Commit 18e941fa authored by Quxl's avatar Quxl

x

parent 63e60c54
......@@ -58,6 +58,12 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
Long time = now.getTime();
String KUNNR = null;
String VBELN = null;
String apiName = "SAP报价单订单确认接口";
String apiPath = "/confirm_quotation";
String traceName = "SoConfirmQuotation";
String traceAction = "U";
String message = null;
String errorMessage = null;
try {
Map<String, Object> header = new HashMap<>();
RESPONSE res = Z_MT_SD_008_SO_CONFIRM_QUOTATION.getRESPONSE();
......@@ -166,22 +172,22 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
}
}
}
try {
common.saveApiAccessLog("SAP报价单订单确认接口", "/confirm_quotation", "S");
common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "S", null, null);
} catch (Throwable e) {
logger.error(timeString, e);
}
} catch (Exception e) {
isSuccess = false;
message = ThrowableUtil.getThrowableDesc(e);
errorMessage = ThrowableUtil.toStackString(e) + " -- " + timeString;
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
try {
common.saveApiAccessLog("SAP报价单订单确认接口", "/confirm_quotation", "F");
common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "F", ThrowableUtil.getThrowableDesc(e), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) {
common.saveApiAccessLog(apiName, apiPath, isSuccess ? "S" : "F");
} catch (Exception e1) {
logger.error(timeString, e1);
}
try {
common.saveOrderTracking(TRACE_NO, traceName, VBELN, KUNNR, traceAction, isSuccess ? "S" : "F", message, errorMessage);
} catch (Exception e1) {
logger.error(timeString, e1);
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
String xmlName = Z_MT_SD_008_SO_CONFIRM_QUOTATION.getClass().getSimpleName();
try {
String xml = XMLUtil.toXml(Z_MT_SD_008_SO_CONFIRM_QUOTATION);
......
......@@ -49,6 +49,12 @@ public class DNDeletionServiceImpl implements DNDeletionService {
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sapsodndeletion" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
String apiName = "SAP单据删除通知接口";
String apiPath = "/dn_deletion";
String traceName = "SODNDeletion";
String traceAction = "U";
String message = null;
String errorMessage = null;
String SOLD_TO = null;
try {
Map<String, Object> map = new HashMap<String, Object>();
......@@ -75,22 +81,22 @@ public class DNDeletionServiceImpl implements DNDeletionService {
map.put("UPDATEBY", systemId);
Sql headerSql = SqlUtil.insertSql("t_so_dn_deletion", map);
jdbcTemplate.update(headerSql.getSql(), headerSql.getArgs());
try {
common.saveApiAccessLog("SAP单据删除通知接口", "/dn_deletion", "S");
common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "S", null, null);
} catch (Throwable e) {
logger.error(timeString, e);
}
} catch (Exception e) {
isSuccess = false;
message = ThrowableUtil.getThrowableDesc(e);
errorMessage = ThrowableUtil.toStackString(e) + " -- " + timeString;
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
try {
common.saveApiAccessLog("SAP单据删除通知接口", "/dn_deletion", "F");
common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "F", ThrowableUtil.getThrowableDesc(e), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) {
common.saveApiAccessLog(apiName, apiPath, isSuccess ? "S" : "F");
} catch (Exception e1) {
logger.error(timeString, e1);
}
try {
common.saveOrderTracking(TRACE_NO, traceName, null, SOLD_TO, traceAction, isSuccess ? "S" : "F", message, errorMessage);
} catch (Exception e1) {
logger.error(timeString, e1);
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
String xmlName = DELETED_DOCUMENTS.getClass().getSimpleName();
try {
String xml = XMLUtil.toXml(DELETED_DOCUMENTS);
......
......@@ -52,6 +52,12 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
System.out.println(new Gson().toJson(Z_MT_SD_001_MATERIAL_MASTER));
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sapmaterialmaster" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
String apiName = "SAP物料接口";
String apiPath = "/material_master";
String traceName = "MaterialMaster";
String traceAction = "U";
String message = null;
String errorMessage = null;
String DIS_CODE = null;
try {
RECORD RECORD = Z_MT_SD_001_MATERIAL_MASTER.getRECORD();
......@@ -122,22 +128,22 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
}
}
}
try {
common.saveApiAccessLog("SAP物料接口", "/material_master", "S");
common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "S", null, null);
} catch (Throwable e) {
logger.error(timeString, e);
}
} catch (Exception e) {
isSuccess = false;
message = ThrowableUtil.getThrowableDesc(e);
errorMessage = ThrowableUtil.toStackString(e) + " -- " + timeString;
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
try {
common.saveApiAccessLog("SAP物料接口", "/material_master", "F");
common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "F", ThrowableUtil.getThrowableDesc(e), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) {
common.saveApiAccessLog(apiName, apiPath, isSuccess ? "S" : "F");
} catch (Exception e1) {
logger.error(timeString, e1);
}
try {
common.saveOrderTracking(TRACE_NO, traceName, null, DIS_CODE, traceAction, isSuccess ? "S" : "F", message, errorMessage);
} catch (Exception e1) {
logger.error(timeString, e1);
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
String xmlName = Z_MT_SD_001_MATERIAL_MASTER.getClass().getSimpleName();
try {
String xml = XMLUtil.toXml(Z_MT_SD_001_MATERIAL_MASTER);
......
......@@ -64,6 +64,12 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sapproformainvoice" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
String apiName = "SAP形式发票接口";
String apiPath = "/prforma_invoice";
String traceName = "ProFormaInvoice";
String traceAction = "U";
String message = null;
String errorMessage = null;
String BATCH_CODE = null;
try {
Map<String, Object> headMap = new HashMap<String, Object>();
......@@ -249,22 +255,22 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
jdbcTemplate.update(headerSql.getSql(), headerSql.getArgs());
Sql itemDataSql = SqlUtil.insertSqlBatch("t_perform_invoice_item_data", itemDatas);
jdbcTemplate.batchUpdate(itemDataSql.getSql(), itemDataSql.getBachArgs());
try {
common.saveApiAccessLog("SAP形式发票接口", "/prforma_invoice", "S");
common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "S", null, null);
} catch (Throwable e) {
logger.error(timeString, e);
}
} catch (Exception e) {
isSuccess = false;
message = ThrowableUtil.getThrowableDesc(e);
errorMessage = ThrowableUtil.toStackString(e) + " -- " + timeString;
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
try {
common.saveApiAccessLog("SAP形式发票接口", "/prforma_invoice", "F");
common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "F", ThrowableUtil.getThrowableDesc(e), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) {
common.saveApiAccessLog(apiName, apiPath, isSuccess ? "S" : "F");
} catch (Exception e1) {
logger.error(timeString, e1);
}
try {
common.saveOrderTracking(TRACE_NO, traceName, null, BATCH_CODE, traceAction, isSuccess ? "S" : "F", message, errorMessage);
} catch (Exception e1) {
logger.error(timeString, e1);
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
String xmlName = Z_MT_SD_005_PERFORM_INVOICE.getClass().getSimpleName();
try {
String xml = XMLUtil.toXml(Z_MT_SD_005_PERFORM_INVOICE);
......
......@@ -52,6 +52,12 @@ public class PriceListServiceImpl implements PriceListService {
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sappricelist" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
String apiName = "SAP列表价接口";
String apiPath = "/price_list";
String traceName = "PriceList";
String traceAction = "U";
String message = null;
String errorMessage = null;
String KUNNR = null;
try {
RECORD r = Z_MT_SD_002_PRICE_LIST.getRECORD();
......@@ -105,22 +111,22 @@ public class PriceListServiceImpl implements PriceListService {
}
}
}
try {
common.saveApiAccessLog("SAP列表价接口", "/price_list", "S");
common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "S", null, null);
} catch (Throwable e) {
logger.error(timeString, e);
}
} catch (Exception e) {
isSuccess = false;
message = ThrowableUtil.getThrowableDesc(e);
errorMessage = ThrowableUtil.toStackString(e) + " -- " + timeString;
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
try {
common.saveApiAccessLog("SAP列表价接口", "/price_list", "F");
common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "F", ThrowableUtil.getThrowableDesc(e), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) {
common.saveApiAccessLog(apiName, apiPath, isSuccess ? "S" : "F");
} catch (Exception e1) {
logger.error(timeString, e1);
}
try {
common.saveOrderTracking(TRACE_NO, traceName, null, KUNNR, traceAction, isSuccess ? "S" : "F", message, errorMessage);
} catch (Exception e1) {
logger.error(timeString, e1);
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
String xmlName = Z_MT_SD_002_PRICE_LIST.getClass().getSimpleName();
try {
String xml = XMLUtil.toXml(Z_MT_SD_002_PRICE_LIST);
......
......@@ -59,6 +59,12 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
String TRACE_NO = "sapshippingnotification"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
String apiName = "SAP发货通知接口";
String apiPath = "/shipping_notfirmation";
String traceName = "ShippingNotfirmation";
String traceAction = "U";
String message = null;
String errorMessage = null;
String BATCH_CODE = null;
try {
Map<String, Object> header = new HashMap<>();
......@@ -174,22 +180,22 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
}
}
}
try {
common.saveApiAccessLog("SAP发货通知接口", "/shipping_notfirmation", "S");
common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "S", null, null);
} catch (Throwable e) {
logger.error(timeString, e);
}
} catch (Exception e) {
isSuccess = false;
message = ThrowableUtil.getThrowableDesc(e);
errorMessage = ThrowableUtil.toStackString(e) + " -- " + timeString;
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
try {
common.saveApiAccessLog("SAP发货通知接口", "/shipping_notfirmation", "F");
common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "F", ThrowableUtil.getThrowableDesc(e), ThrowableUtil.toStackString(e) + " -- " + timeString);
} catch (Throwable e1) {
common.saveApiAccessLog(apiName, apiPath, (isSuccess ? "S" : "F"));
} catch (Exception e1) {
logger.error(timeString, e1);
}
try {
common.saveOrderTracking(TRACE_NO, traceName, null, BATCH_CODE, traceAction, isSuccess ? "S" : "F", message, errorMessage);
} catch (Exception e1) {
logger.error(timeString, e1);
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
String xmlName = Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.getClass().getSimpleName();
try {
String xml = XMLUtil.toXml(Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE);
......
......@@ -6,10 +6,11 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.system.ApplicationHome;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
......@@ -24,6 +25,8 @@ import com.schneider_distributor.ZDTSD009SOCREATION.ITEM;
@Component
public class ZMISD009SOCREATIONTask {
Log logger = LogFactory.getLog(ZMISD009SOCREATIONTask.class);
@Autowired
private JdbcTemplate jdbcTemplate;
......@@ -57,11 +60,16 @@ public class ZMISD009SOCREATIONTask {
}
private void sendData(ZMISD009SOCREATION ZMISD009SOCREATION) {
String traceName = "SoCreation";
String traceAction = "D";
List<Map<String, Object>> headerList = jdbcTemplate.queryForList("SELECT * FROM t_so_creation_header WHERE SEND_STATUS = ? LIMIT ?", "N", 1);
if(headerList.size() > 0) {
for(Map<String, Object> headerMap : headerList) {
String TRACE_NO = (String)headerMap.get("TRACE_NO");
String KUNNR = (String)headerMap.get("KUNNR");
String result = "S";
String message = null;
String errorMessage = null;
try {
ZDTSD009SOCREATION ZDTSD009SOCREATIONBean = new ZDTSD009SOCREATION();
Header header = new Header();
......@@ -106,17 +114,16 @@ 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", "S", null, null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (DataAccessException e) {
e.printStackTrace();
result = "F";
message = ThrowableUtil.getThrowableDesc(e);
errorMessage = ThrowableUtil.toStackString(e).toString();
logger.error("数据上传错误", e);
} finally {
try {
common.saveOrderTracking(TRACE_NO, "SoCreation", null, KUNNR, "D", "F", ThrowableUtil.getCaused(e).getMessage(), ThrowableUtil.toStackString(e).toString());
common.saveOrderTracking(TRACE_NO, traceName, null, KUNNR, traceAction, result, message, errorMessage);
} catch (Throwable e1) {
e1.printStackTrace();
logger.error("追踪数据保存失败", e1);
}
}
}
......
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