Commit 87ba9f62 authored by Quxl's avatar Quxl

x

parent 6ee9fa0f
...@@ -167,7 +167,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService { ...@@ -167,7 +167,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
} }
} }
try { try {
common.saveApiAccessLog("SoConfirmQuotation", "/confirm_quotation", "S"); common.saveApiAccessLog("SAP报价单订单确认接口", "/confirm_quotation", "S");
common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "S", null, null); common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "S", null, null);
} catch (Throwable e) { } catch (Throwable e) {
logger.error(timeString, e); logger.error(timeString, e);
...@@ -175,8 +175,8 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService { ...@@ -175,8 +175,8 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
} catch (Exception e) { } catch (Exception e) {
isSuccess = false; isSuccess = false;
try { try {
common.saveApiAccessLog("SoConfirmQuotation", "/confirm_quotation", "F"); common.saveApiAccessLog("SAP报价单订单确认接口", "/confirm_quotation", "F");
common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e) + " -- " + timeString); common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "F", ThrowableUtil.getThrowableDesc(e), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) { } catch (Throwable e1) {
logger.error(timeString, e1); logger.error(timeString, e1);
} }
......
...@@ -76,7 +76,7 @@ public class DNDeletionServiceImpl implements DNDeletionService { ...@@ -76,7 +76,7 @@ public class DNDeletionServiceImpl implements DNDeletionService {
Sql headerSql = SqlUtil.insertSql("t_so_dn_deletion", map); Sql headerSql = SqlUtil.insertSql("t_so_dn_deletion", map);
jdbcTemplate.update(headerSql.getSql(), headerSql.getArgs()); jdbcTemplate.update(headerSql.getSql(), headerSql.getArgs());
try { try {
common.saveApiAccessLog("SODNDeletion", "/dn_deletion", "S"); common.saveApiAccessLog("SAP单据删除通知接口", "/dn_deletion", "S");
common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "S", null, null); common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "S", null, null);
} catch (Throwable e) { } catch (Throwable e) {
logger.error(timeString, e); logger.error(timeString, e);
...@@ -84,8 +84,8 @@ public class DNDeletionServiceImpl implements DNDeletionService { ...@@ -84,8 +84,8 @@ public class DNDeletionServiceImpl implements DNDeletionService {
} catch (Exception e) { } catch (Exception e) {
isSuccess = false; isSuccess = false;
try { try {
common.saveApiAccessLog("SODNDeletion", "/dn_deletion", "F"); common.saveApiAccessLog("SAP单据删除通知接口", "/dn_deletion", "F");
common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e) + " -- " + timeString); common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "F", ThrowableUtil.getThrowableDesc(e), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) { } catch (Throwable e1) {
logger.error(timeString, e1); logger.error(timeString, e1);
} }
......
...@@ -123,7 +123,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -123,7 +123,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
} }
} }
try { try {
common.saveApiAccessLog("MaterialMaster", "/material_master", "S"); common.saveApiAccessLog("SAP物料接口", "/material_master", "S");
common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "S", null, null); common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "S", null, null);
} catch (Throwable e) { } catch (Throwable e) {
logger.error(timeString, e); logger.error(timeString, e);
...@@ -131,8 +131,8 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -131,8 +131,8 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
} catch (Exception e) { } catch (Exception e) {
isSuccess = false; isSuccess = false;
try { try {
common.saveApiAccessLog("MaterialMaster", "/material_master", "F"); common.saveApiAccessLog("SAP物料接口", "/material_master", "F");
common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e) + " -- " + timeString); common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "F", ThrowableUtil.getThrowableDesc(e), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) { } catch (Throwable e1) {
logger.error(timeString, e1); logger.error(timeString, e1);
} }
......
...@@ -250,7 +250,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService { ...@@ -250,7 +250,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
Sql itemDataSql = SqlUtil.insertSqlBatch("t_perform_invoice_item_data", itemDatas); Sql itemDataSql = SqlUtil.insertSqlBatch("t_perform_invoice_item_data", itemDatas);
jdbcTemplate.batchUpdate(itemDataSql.getSql(), itemDataSql.getBachArgs()); jdbcTemplate.batchUpdate(itemDataSql.getSql(), itemDataSql.getBachArgs());
try { try {
common.saveApiAccessLog("ProFormaInvoice", "/prforma_invoice", "S"); common.saveApiAccessLog("SAP形式发票接口", "/prforma_invoice", "S");
common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "S", null, null); common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "S", null, null);
} catch (Throwable e) { } catch (Throwable e) {
logger.error(timeString, e); logger.error(timeString, e);
...@@ -258,8 +258,8 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService { ...@@ -258,8 +258,8 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
} catch (Exception e) { } catch (Exception e) {
isSuccess = false; isSuccess = false;
try { try {
common.saveApiAccessLog("ProFormaInvoice", "/prforma_invoice", "F"); common.saveApiAccessLog("SAP形式发票接口", "/prforma_invoice", "F");
common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e) + " -- " + timeString); common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "F", ThrowableUtil.getThrowableDesc(e), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) { } catch (Throwable e1) {
logger.error(timeString, e1); logger.error(timeString, e1);
} }
......
...@@ -106,7 +106,7 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -106,7 +106,7 @@ public class PriceListServiceImpl implements PriceListService {
} }
} }
try { try {
common.saveApiAccessLog("PriceList", "/price_list", "S"); common.saveApiAccessLog("SAP列表价接口", "/price_list", "S");
common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "S", null, null); common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "S", null, null);
} catch (Throwable e) { } catch (Throwable e) {
logger.error(timeString, e); logger.error(timeString, e);
...@@ -114,8 +114,8 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -114,8 +114,8 @@ public class PriceListServiceImpl implements PriceListService {
} catch (Exception e) { } catch (Exception e) {
isSuccess = false; isSuccess = false;
try { try {
common.saveApiAccessLog("PriceList", "/price_list", "F"); common.saveApiAccessLog("SAP列表价接口", "/price_list", "F");
common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e) + " -- " + timeString); common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "F", ThrowableUtil.getThrowableDesc(e), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) { } catch (Throwable e1) {
logger.error(timeString, e1); logger.error(timeString, e1);
} }
......
...@@ -175,7 +175,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ ...@@ -175,7 +175,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
} }
} }
try { try {
common.saveApiAccessLog("ShippingNotification", "/shipping_notfirmation", "S"); common.saveApiAccessLog("SAP发货通知接口", "/shipping_notfirmation", "S");
common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "S", null, null); common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "S", null, null);
} catch (Throwable e) { } catch (Throwable e) {
logger.error(timeString, e); logger.error(timeString, e);
...@@ -183,8 +183,8 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ ...@@ -183,8 +183,8 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
} catch (Exception e) { } catch (Exception e) {
isSuccess = false; isSuccess = false;
try { try {
common.saveApiAccessLog("ShippingNotification", "/shipping_notfirmation", "F"); common.saveApiAccessLog("SAP发货通知接口", "/shipping_notfirmation", "F");
common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e) + " -- " + timeString); common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "F", ThrowableUtil.getThrowableDesc(e), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) { } catch (Throwable e1) {
logger.error(timeString, e1); logger.error(timeString, e1);
} }
......
package com.egolm.sso.util; package com.egolm.sso.util;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ThrowableUtil { public class ThrowableUtil {
public static Throwable getCaused(Throwable e) { public static Throwable getCaused(Throwable e) {
...@@ -27,4 +32,25 @@ public class ThrowableUtil { ...@@ -27,4 +32,25 @@ public class ThrowableUtil {
return stack; return stack;
} }
private static final Map<Pattern, String> map = new HashMap<Pattern, String>();
static {
map.put(Pattern.compile("NumberFormatException: For input string: "), "上传数据格式错误");
map.put(Pattern.compile("Unparseable date"), "日期格式错误");
map.put(Pattern.compile("Data truncation"), "数据长度错误");
}
public static String getThrowableDesc(Throwable e) {
return getThrowableDesc(getCaused(e).getMessage());
}
public static String getThrowableDesc(String message) {
for(Pattern pattern : map.keySet()) {
Matcher matcher = pattern.matcher(message);
if(matcher.find()) {
return map.get(pattern);
}
}
return "未知错误类型";
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment