Commit 076ea7fe authored by Quxl's avatar Quxl

x

parent bacdd330
......@@ -54,7 +54,10 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
Date now = new Date();
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sapsoconfirmquotation"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
Long time = now.getTime();
String KUNNR = null;
String VBELN = null;
try {
Map<String, Object> header = new HashMap<>();
RESPONSE res = Z_MT_SD_008_SO_CONFIRM_QUOTATION.getRESPONSE();
......@@ -65,10 +68,10 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
header.put("MSGTXT", MESSAGE.getMSGTXT());
}
if(h != null) {
String KUNNR = h.getKUNNR();
KUNNR = h.getKUNNR();
VBELN = h.getVBELN();
header.put("BSTKD_E", h.getBSTKD_E());
header.put("VBELN", h.getVBELN());
header.put("VBELN", VBELN);
header.put("VKORG", h.getVKORG());
header.put("VTWEG", h.getVTWEG());
header.put("SPART", h.getSPART());
......@@ -102,7 +105,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
String idIndex = StringUtil.getIndex("T_SO_CONFIRMATION_HEADER_ID");
Long hID = Long.valueOf(time+idIndex);
header.put("ID", hID);
header.put("TRACE_NO", "sapsoconfirmquotation"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
header.put("TRACE_NO", TRACE_NO);
insertTo(header, "t_so_confirmation_header");
List<ITEM_DATA> ids = res.getITEM_DATA();
Map<String, Map<String, Object>> itemDatas = new HashMap<>();
......@@ -163,8 +166,20 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
}
}
}
try {
common.saveApiAccessLog("execute", "/confirm_quotation", "SUCCESS");
common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Exception e) {
isSuccess = false;
try {
common.saveApiAccessLog("execute", "/confirm_quotation", "ERROR");
common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "ERROR", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString);
} catch (Throwable e1) {
e1.printStackTrace();
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
String xmlName = Z_MT_SD_008_SO_CONFIRM_QUOTATION.getClass().getSimpleName();
......@@ -174,7 +189,6 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_008_SO_CONFIRM_QUOTATION);
FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/confirm_quotation", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
}
......
......@@ -48,10 +48,12 @@ public class DNDeletionServiceImpl implements DNDeletionService {
Date now = new Date();
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 SOLD_TO = null;
try {
Map<String, Object> map = new HashMap<String, Object>();
Long ID = Long.valueOf("" + System.currentTimeMillis() + StringUtil.getIndex("T_SO_DN_DELETION_ID"));
String SOLD_TO = DELETED_DOCUMENTS.getSOLD_TO();
SOLD_TO = DELETED_DOCUMENTS.getSOLD_TO();
map.put("ID", ID);
map.put("MESSAGE_ID", DELETED_DOCUMENTS.getMSGID());
map.put("TARGET_SYSTEM", DELETED_DOCUMENTS.getTARGET_SYSTEM());
......@@ -65,7 +67,7 @@ public class DNDeletionServiceImpl implements DNDeletionService {
throw new XRException("Unable to generate batch number, [SOLD_TO] cannot be empty");
}
map.put("BATCH", dateString + "-" + common.getNextval("T_SO_DN_DELETION_BATCH_" + SOLD_TO));
map.put("TRACE_NO", "sapsodndeletion" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
map.put("TRACE_NO", TRACE_NO);
map.put("SEND_STATUS", "N");
map.put("CREATED", now);
map.put("CREATEBY", systemId);
......@@ -73,8 +75,20 @@ 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("execute", "/dn_deletion", "SUCCESS");
common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Exception e) {
isSuccess = false;
try {
common.saveApiAccessLog("execute", "/dn_deletion", "ERROR");
common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "ERROR", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString);
} catch (Throwable e1) {
e1.printStackTrace();
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
String xmlName = DELETED_DOCUMENTS.getClass().getSimpleName();
......@@ -84,7 +98,6 @@ public class DNDeletionServiceImpl implements DNDeletionService {
FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(DELETED_DOCUMENTS);
FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/dn_deletion", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
}
......
......@@ -51,10 +51,11 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
boolean isSuccess = true;
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 DIS_CODE = null;
try {
RECORD RECORD = Z_MT_SD_001_MATERIAL_MASTER.getRECORD();
HEADER_SENDING HEADER_SENDING = RECORD.getHEADER_SENDING();
String DIS_CODE = null;
String DATUM = null;
String UZEIT = null;
if(HEADER_SENDING != null) {
......@@ -110,7 +111,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
goods.put("MEABM_B", item.getMEABM_B());
goods.put("PUBLIC", item.getPUBLIC());
goods.put("INTERNET", item.getINTERNET());
goods.put("TRACE_NO", "sapmaterialmaster" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
goods.put("TRACE_NO", TRACE_NO);
goods.put("BATCH", BATCH);
goods.put("SEND_STATUS", "N");
if (goods.get("ID") != null) {
......@@ -121,8 +122,20 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
}
}
}
try {
common.saveApiAccessLog("execute", "/material_master", "SUCCESS");
common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Exception e) {
isSuccess = false;
try {
common.saveApiAccessLog("execute", "/material_master", "ERROR");
common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "ERROR", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString);
} catch (Throwable e1) {
e1.printStackTrace();
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
String xmlName = Z_MT_SD_001_MATERIAL_MASTER.getClass().getSimpleName();
......@@ -132,7 +145,6 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_001_MATERIAL_MASTER);
FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/material_master", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
}
......
......@@ -63,6 +63,8 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
Date now = new Date();
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 BATCH_CODE = null;
try {
Map<String, Object> headMap = new HashMap<String, Object>();
Z_DT_SD_005_PERFORM_INVOICE Z_DT_SD_005_PERFORM_INVOICE = Z_MT_SD_005_PERFORM_INVOICE.getZ_DT_SD_005_PERFORM_INVOICE();
......@@ -80,7 +82,6 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
headMap.put("GENERAL_BELNR", HEADER_GENERAL_DATA.getBELNR());
headMap.put("GENERAL_ZTERM", HEADER_GENERAL_DATA.getZTERM());
}
String BATCH_CODE = null;
if(partnerList != null) {
for(HEADER_PARTNER_DATA HEADER_PARTNER_DATA : partnerList) {
if(HEADER_PARTNER_DATA != null) {
......@@ -156,7 +157,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
throw new XRException("Unable to generate batch number, [PARTN] cannot be empty");
}
headMap.put("BATCH", dateString + "-" + common.getNextval("T_PERFORM_INVOICE_HEADER_BATCH_" + BATCH_CODE));
headMap.put("TRACE_NO", "sapproformainvoice" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
headMap.put("TRACE_NO", TRACE_NO);
headMap.put("CREATED", now);
headMap.put("CREATEBY", systemId);
......@@ -248,8 +249,20 @@ 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("execute", "/prforma_invoice", "SUCCESS");
common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Exception e) {
isSuccess = false;
try {
common.saveApiAccessLog("execute", "/prforma_invoice", "ERROR");
common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "ERROR", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString);
} catch (Throwable e1) {
e1.printStackTrace();
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
String xmlName = Z_MT_SD_005_PERFORM_INVOICE.getClass().getSimpleName();
......@@ -259,7 +272,6 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_005_PERFORM_INVOICE);
FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/prforma_invoice", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
}
......
......@@ -51,13 +51,14 @@ public class PriceListServiceImpl implements PriceListService {
Date now = new Date();
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 KUNNR = null;
try {
RECORD r = Z_MT_SD_002_PRICE_LIST.getRECORD();
if(r != null) {
HEADER_SENDING h = r.getHEADER_SENDING();
List<ITEM> items = r.getITEM();
String KUNNR = null;
String DATUM = null;
String UZEIT = null;
if(h != null) {
......@@ -93,7 +94,7 @@ public class PriceListServiceImpl implements PriceListService {
priceObj.put("PLINE", item.getPLINE());
priceObj.put("PRSCH_1", StringUtil.toDouble(item.getPRSCH_1()));
priceObj.put("SEND_STATUS", "N");
priceObj.put("TRACE_NO", "sappricelist" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
priceObj.put("TRACE_NO", TRACE_NO);
priceObj.put("BATCH", BATCH);
if (priceObj.get("ID") != null) {
updatePriceObj(priceObj);
......@@ -104,8 +105,20 @@ public class PriceListServiceImpl implements PriceListService {
}
}
}
try {
common.saveApiAccessLog("execute", "/price_list", "SUCCESS");
common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Exception e) {
isSuccess = false;
try {
common.saveApiAccessLog("execute", "/price_list", "ERROR");
common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "ERROR", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString);
} catch (Throwable e1) {
e1.printStackTrace();
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
String xmlName = Z_MT_SD_002_PRICE_LIST.getClass().getSimpleName();
......@@ -115,7 +128,6 @@ public class PriceListServiceImpl implements PriceListService {
FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_002_PRICE_LIST);
FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/price_list", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
}
......
......@@ -58,13 +58,15 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
String TRACE_NO = "sapshippingnotification"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
String BATCH_CODE = null;
try {
Map<String, Object> header = new HashMap<>();
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE = Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.getZ_DT_SD_007_SHIPPING_NOTIFICATION_FILE();
if(Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE != null) {
HEADER_DELIVERY HEADER_DELIVERY = Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE.getHEADER_DELIVERY();
if(HEADER_DELIVERY != null) {
String BATCH_CODE = null;
header.put("DELIVERY_VBELN", HEADER_DELIVERY.getVBELN());
header.put("DELIVERY_LFART", HEADER_DELIVERY.getLFART());
header.put("DELIVERY_INCO1", HEADER_DELIVERY.getINCO1());
......@@ -114,7 +116,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
}
header.put("BATCH", dateString + "-" + common.getNextval("T_SHIPPING_NOTIFICATION_HEADER_BATCH_" + BATCH_CODE));
header.put("SEND_STATUS", "N");
header.put("TRACE_NO", "sapshippingnotification"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
header.put("TRACE_NO", TRACE_NO);
header.put("CREATED", now);
header.put("CREATEBY", systemId);
Long hID = Long.valueOf(time + StringUtil.getIndex("T_SHIPPING_NOTIFICATION_HEADER_ID"));
......@@ -172,8 +174,20 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
}
}
}
try {
common.saveApiAccessLog("execute", "/shipping_notfirmation", "SUCCESS");
common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Exception e) {
isSuccess = false;
try {
common.saveApiAccessLog("execute", "/shipping_notfirmation", "ERROR");
common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "ERROR", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString);
} catch (Throwable e1) {
e1.printStackTrace();
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
String xmlName = Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.getClass().getSimpleName();
......@@ -183,7 +197,6 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE);
FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/shipping_notfirmation", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
}
......
......@@ -9,11 +9,13 @@ import java.util.Map;
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;
import org.springframework.transaction.annotation.Transactional;
import com.egolm.sso.services.CommonService;
import com.egolm.sso.util.ServiceFactory;
import com.schneider_distributor.ZDTSD009SOCREATION.Header;
import com.schneider_distributor.ZDTSD009SOCREATION.ITEM;
......@@ -24,6 +26,9 @@ public class ZMISD009SOCREATIONTask {
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private CommonService common;
@Value("${schneider.username}")
private String username;
......@@ -54,15 +59,18 @@ public class ZMISD009SOCREATIONTask {
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");
try {
ZDTSD009SOCREATION ZDTSD009SOCREATIONBean = new ZDTSD009SOCREATION();
Header header = new Header();
Long ID = (Long)headerMap.get("ID");
String BSTKD_E = (String)headerMap.get("BSTKD_E");
String VBELN = (String)headerMap.get("VBELN");
Date BSTDK = (Date)headerMap.get("BSTDK");
String KUNNR = (String)headerMap.get("KUNNR");
String KGNNR = (String)headerMap.get("KGNNR");
String QTFLAG = (String)headerMap.get("QTFLAG");
header.setBSTKDE(BSTKD_E);
header.setVBELN(VBELN);
header.setKUNNR(KUNNR);
......@@ -97,6 +105,19 @@ 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);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (DataAccessException e) {
e.printStackTrace();
try {
common.saveOrderTracking(TRACE_NO, "SoCreation", null, KUNNR, "D", "ERROR", null);
} 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