Commit 4fbb8df4 authored by Quxl's avatar Quxl

x

parent 83222ec1
...@@ -68,7 +68,7 @@ public class TestController { ...@@ -68,7 +68,7 @@ public class TestController {
@GetMapping("saveOrderTracking") @GetMapping("saveOrderTracking")
public Object saveOrderTracking() { public Object saveOrderTracking() {
return common.saveOrderTracking("sapmaterialmaster" + DateUtil.formatDate(new Date(), DateUtil.FMT_DATETIME), "MaterialMaster", "123456", "123456", "G", null, "操作失败"); return common.saveOrderTracking("sapmaterialmaster" + DateUtil.formatDate(new Date(), DateUtil.FMT_DATETIME), "MaterialMaster", "123456", "123456", "G", null, "操作失败", "操作失败");
} }
......
...@@ -131,7 +131,7 @@ public class CommonService { ...@@ -131,7 +131,7 @@ public class CommonService {
} }
} }
public String saveOrderTracking(String traceNo, String orderType, String orderNo, String disCode, String action, String result, String errorMessage) { public String saveOrderTracking(String traceNo, String orderType, String orderNo, String disCode, String action, String result, String message, String errorMessage) {
if(isOpen) { if(isOpen) {
String requestUrl = baseUrl + insertOrderTrackingUri; String requestUrl = baseUrl + insertOrderTrackingUri;
String token = this.getToken(); String token = this.getToken();
......
...@@ -168,7 +168,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService { ...@@ -168,7 +168,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
} }
try { try {
common.saveApiAccessLog("execute", "/confirm_quotation", "S"); common.saveApiAccessLog("execute", "/confirm_quotation", "S");
common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "S", 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);
} }
...@@ -176,7 +176,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService { ...@@ -176,7 +176,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
isSuccess = false; isSuccess = false;
try { try {
common.saveApiAccessLog("execute", "/confirm_quotation", "F"); common.saveApiAccessLog("execute", "/confirm_quotation", "F");
common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "F", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString); common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) { } catch (Throwable e1) {
logger.error(timeString, e1); logger.error(timeString, e1);
} }
......
...@@ -77,7 +77,7 @@ public class DNDeletionServiceImpl implements DNDeletionService { ...@@ -77,7 +77,7 @@ public class DNDeletionServiceImpl implements DNDeletionService {
jdbcTemplate.update(headerSql.getSql(), headerSql.getArgs()); jdbcTemplate.update(headerSql.getSql(), headerSql.getArgs());
try { try {
common.saveApiAccessLog("execute", "/dn_deletion", "S"); common.saveApiAccessLog("execute", "/dn_deletion", "S");
common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "S", 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);
} }
...@@ -85,7 +85,7 @@ public class DNDeletionServiceImpl implements DNDeletionService { ...@@ -85,7 +85,7 @@ public class DNDeletionServiceImpl implements DNDeletionService {
isSuccess = false; isSuccess = false;
try { try {
common.saveApiAccessLog("execute", "/dn_deletion", "F"); common.saveApiAccessLog("execute", "/dn_deletion", "F");
common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "F", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString); common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) { } catch (Throwable e1) {
logger.error(timeString, e1); logger.error(timeString, e1);
} }
......
...@@ -124,7 +124,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -124,7 +124,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
} }
try { try {
common.saveApiAccessLog("execute", "/material_master", "S"); common.saveApiAccessLog("execute", "/material_master", "S");
common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "S", 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);
} }
...@@ -132,7 +132,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -132,7 +132,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
isSuccess = false; isSuccess = false;
try { try {
common.saveApiAccessLog("execute", "/material_master", "F"); common.saveApiAccessLog("execute", "/material_master", "F");
common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "F", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString); common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) { } catch (Throwable e1) {
logger.error(timeString, e1); logger.error(timeString, e1);
} }
......
...@@ -251,7 +251,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService { ...@@ -251,7 +251,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
jdbcTemplate.batchUpdate(itemDataSql.getSql(), itemDataSql.getBachArgs()); jdbcTemplate.batchUpdate(itemDataSql.getSql(), itemDataSql.getBachArgs());
try { try {
common.saveApiAccessLog("execute", "/prforma_invoice", "S"); common.saveApiAccessLog("execute", "/prforma_invoice", "S");
common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "S", 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);
} }
...@@ -259,7 +259,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService { ...@@ -259,7 +259,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
isSuccess = false; isSuccess = false;
try { try {
common.saveApiAccessLog("execute", "/prforma_invoice", "F"); common.saveApiAccessLog("execute", "/prforma_invoice", "F");
common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "F", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString); common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) { } catch (Throwable e1) {
logger.error(timeString, e1); logger.error(timeString, e1);
} }
......
...@@ -107,7 +107,7 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -107,7 +107,7 @@ public class PriceListServiceImpl implements PriceListService {
} }
try { try {
common.saveApiAccessLog("execute", "/price_list", "S"); common.saveApiAccessLog("execute", "/price_list", "S");
common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "S", 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);
} }
...@@ -115,7 +115,7 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -115,7 +115,7 @@ public class PriceListServiceImpl implements PriceListService {
isSuccess = false; isSuccess = false;
try { try {
common.saveApiAccessLog("execute", "/price_list", "F"); common.saveApiAccessLog("execute", "/price_list", "F");
common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "F", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString); common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) { } catch (Throwable e1) {
logger.error(timeString, e1); logger.error(timeString, e1);
} }
......
...@@ -176,7 +176,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ ...@@ -176,7 +176,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
} }
try { try {
common.saveApiAccessLog("execute", "/shipping_notfirmation", "S"); common.saveApiAccessLog("execute", "/shipping_notfirmation", "S");
common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "S", 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);
} }
...@@ -184,7 +184,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ ...@@ -184,7 +184,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
isSuccess = false; isSuccess = false;
try { try {
common.saveApiAccessLog("execute", "/shipping_notfirmation", "F"); common.saveApiAccessLog("execute", "/shipping_notfirmation", "F");
common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "F", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString); common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) { } catch (Throwable e1) {
logger.error(timeString, e1); logger.error(timeString, e1);
} }
......
...@@ -11,4 +11,20 @@ public class ThrowableUtil { ...@@ -11,4 +11,20 @@ public class ThrowableUtil {
} }
} }
public static StringBuffer toStackString(Throwable ex) {
StringBuffer stack = new StringBuffer();
if(ex != null) {
stack.append(ex.getClass().getName()).append(ex.getMessage());
StackTraceElement[] elms = ex.getStackTrace();
for(StackTraceElement elm : elms) {
stack.append("\t").append(elm.getClassName()).append(".").append(elm.getMethodName()).append("(").append(elm.getFileName()).append(" ").append(elm.getLineNumber()).append(")\n");
}
stack.append("\n\n").append("Cause By: \n").append(toStackString(ex.getCause()));
for(Throwable e : ex.getSuppressed()) {
stack.append("\n\n").append("Suppressed By: \n").append(toStackString(e));
}
}
return stack;
}
} }
...@@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import com.egolm.sso.services.CommonService; import com.egolm.sso.services.CommonService;
import com.egolm.sso.util.ServiceFactory; import com.egolm.sso.util.ServiceFactory;
import com.egolm.sso.util.ThrowableUtil;
import com.schneider_distributor.ZDTSD009SOCREATION.Header; import com.schneider_distributor.ZDTSD009SOCREATION.Header;
import com.schneider_distributor.ZDTSD009SOCREATION.ITEM; import com.schneider_distributor.ZDTSD009SOCREATION.ITEM;
...@@ -106,14 +107,14 @@ public class ZMISD009SOCREATIONTask { ...@@ -106,14 +107,14 @@ public class ZMISD009SOCREATIONTask {
ZMISD009SOCREATION.zMISD009SOCREATION(ZDTSD009SOCREATIONBean); ZMISD009SOCREATION.zMISD009SOCREATION(ZDTSD009SOCREATIONBean);
jdbcTemplate.update("UPDATE t_so_creation_header SET SEND_STATUS = 'Y', SEND_TIME = NOW() WHERE ID = ?", ID); jdbcTemplate.update("UPDATE t_so_creation_header SET SEND_STATUS = 'Y', SEND_TIME = NOW() WHERE ID = ?", ID);
try { try {
common.saveOrderTracking(TRACE_NO, "SoCreation", null, KUNNR, "D", "SUCCESS", null); common.saveOrderTracking(TRACE_NO, "SoCreation", null, KUNNR, "D", "S", null, null);
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
} }
} catch (DataAccessException e) { } catch (DataAccessException e) {
e.printStackTrace(); e.printStackTrace();
try { try {
common.saveOrderTracking(TRACE_NO, "SoCreation", null, KUNNR, "D", "ERROR", null); common.saveOrderTracking(TRACE_NO, "SoCreation", null, KUNNR, "D", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e).toString());
} catch (Throwable e1) { } catch (Throwable e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
......
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