Commit 4fbb8df4 authored by Quxl's avatar Quxl

x

parent 83222ec1
......@@ -68,7 +68,7 @@ public class TestController {
@GetMapping("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 {
}
}
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) {
String requestUrl = baseUrl + insertOrderTrackingUri;
String token = this.getToken();
......
......@@ -168,7 +168,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
}
try {
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) {
logger.error(timeString, e);
}
......@@ -176,7 +176,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
isSuccess = false;
try {
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) {
logger.error(timeString, e1);
}
......
......@@ -77,7 +77,7 @@ public class DNDeletionServiceImpl implements DNDeletionService {
jdbcTemplate.update(headerSql.getSql(), headerSql.getArgs());
try {
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) {
logger.error(timeString, e);
}
......@@ -85,7 +85,7 @@ public class DNDeletionServiceImpl implements DNDeletionService {
isSuccess = false;
try {
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) {
logger.error(timeString, e1);
}
......
......@@ -124,7 +124,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
}
try {
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) {
logger.error(timeString, e);
}
......@@ -132,7 +132,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
isSuccess = false;
try {
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) {
logger.error(timeString, e1);
}
......
......@@ -251,7 +251,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
jdbcTemplate.batchUpdate(itemDataSql.getSql(), itemDataSql.getBachArgs());
try {
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) {
logger.error(timeString, e);
}
......@@ -259,7 +259,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
isSuccess = false;
try {
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) {
logger.error(timeString, e1);
}
......
......@@ -107,7 +107,7 @@ public class PriceListServiceImpl implements PriceListService {
}
try {
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) {
logger.error(timeString, e);
}
......@@ -115,7 +115,7 @@ public class PriceListServiceImpl implements PriceListService {
isSuccess = false;
try {
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) {
logger.error(timeString, e1);
}
......
......@@ -176,7 +176,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
}
try {
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) {
logger.error(timeString, e);
}
......@@ -184,7 +184,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
isSuccess = false;
try {
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) {
logger.error(timeString, e1);
}
......
......@@ -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;
import com.egolm.sso.services.CommonService;
import com.egolm.sso.util.ServiceFactory;
import com.egolm.sso.util.ThrowableUtil;
import com.schneider_distributor.ZDTSD009SOCREATION.Header;
import com.schneider_distributor.ZDTSD009SOCREATION.ITEM;
......@@ -106,14 +107,14 @@ public class ZMISD009SOCREATIONTask {
ZMISD009SOCREATION.zMISD009SOCREATION(ZDTSD009SOCREATIONBean);
jdbcTemplate.update("UPDATE t_so_creation_header SET SEND_STATUS = 'Y', SEND_TIME = NOW() WHERE ID = ?", ID);
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) {
e.printStackTrace();
}
} catch (DataAccessException e) {
e.printStackTrace();
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) {
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