Commit 79d17d8b authored by Quxl's avatar Quxl

x

parent 0e3dd137
......@@ -14,8 +14,6 @@ import org.springframework.dao.DuplicateKeyException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONObject;
import com.egolm.sso.SapServiceApplication;
......@@ -58,11 +56,15 @@ public class CommonService {
public Long getNextval(String sName) {
CommonService common = SapServiceApplication.getBean(CommonService.class);
return common.getNextvalBySql(sName);
return common.getNextval2(sName);
}
@Transactional(propagation=Propagation.NOT_SUPPORTED)
public Long getNextvalBySql(String sName) {
public void saveApiAccessLog(String METHOD, String ADDRESS, String RESULT) {
CommonService common = SapServiceApplication.getBean(CommonService.class);
common.saveApiAccessLog2(METHOD, ADDRESS, RESULT);
}
private Long getNextval2(String sName) {
try {
Map<String, Object> seqMap = jdbcTemplate.queryForMap("select * from x_sequence where name = ?", sName);
Integer id = (Integer) seqMap.get("id");
......@@ -95,21 +97,7 @@ public class CommonService {
}
}
public String getNextBatch(Date day, String sPrefix, String sName) {
String dateString = DateUtil.formatDate(day, "yyyyMMdd");
sName = sPrefix + "_" + sName + "_" + dateString;
return dateString + "-" + this.getNextval(sName);
}
public String limitByMysql(String sql, Page page) {
long start = (page.getIndex() - 1) * page.getLimit();
long limit = page.getLimit();
String limitKeys = StringUtil.join(", as_limit.", " order by as_limit.", "", "", page.getLimitKey());
return "select as_limit.* from (" + sql + ") as_limit" + limitKeys + " limit " + start + ", " + limit;
}
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void saveApiAccessLog(String METHOD, String ADDRESS, String RESULT) {
private void saveApiAccessLog2(String METHOD, String ADDRESS, String RESULT) {
Date now = new Date();
Map<String, Object> map = new HashMap<String, Object>();
map.put("ID", Long.valueOf(System.currentTimeMillis() + StringUtil.getIndex("T_API_ACCESS_LOG_ID")));
......@@ -125,6 +113,25 @@ public class CommonService {
jdbcTemplate.update(sql, objs);
}
public String getNextBatch(Date day, String sPrefix, String sName) {
String dateString = DateUtil.formatDate(day, "yyyyMMdd");
sName = sPrefix + "_" + sName + "_" + dateString;
return dateString + "-" + this.getNextval(sName);
}
public String getNextTrace(Date now, String sPrefix, String sName) {
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
return sPrefix + timeString + this.getNextval(sName + "_" + dateString);
}
public String limitByMysql(String sql, Page page) {
long start = (page.getIndex() - 1) * page.getLimit();
long limit = page.getLimit();
String limitKeys = StringUtil.join(", as_limit.", " order by as_limit.", "", "", page.getLimitKey());
return "select as_limit.* from (" + sql + ") as_limit" + limitKeys + " limit " + start + ", " + limit;
}
@Value("${dataTracking.tokenExpireMinute}")
private Long tokenExpireMinute;
private static String token;
......
......@@ -53,8 +53,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
System.out.println(new Gson().toJson(Z_MT_SD_008_SO_CONFIRM_QUOTATION));
Date now = new Date();
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sapsoconfirmquotation" + timeString + common.getNextval("T_SO_CONFIRMACTION_HEADER_TRACE_" + dateString);
String TRACE_NO = common.getNextTrace(now, "sapsoconfirmquotation", "T_SO_CONFIRMACTION_HEADER_TRACE");
Long time = now.getTime();
String KUNNR = null;
String VBELN = null;
......
......@@ -17,11 +17,11 @@ import com.egolm.sso.services.CommonService;
import com.egolm.sso.util.DateUtil;
import com.egolm.sso.util.FileUtil;
import com.egolm.sso.util.SqlUtil;
import com.egolm.sso.util.SqlUtil.Sql;
import com.egolm.sso.util.StringUtil;
import com.egolm.sso.util.ThrowableUtil;
import com.egolm.sso.util.SqlUtil.Sql;
import com.google.gson.Gson;
import com.egolm.sso.util.XMLUtil;
import com.google.gson.Gson;
@Component
@WebService(serviceName = "DNDeletionService", targetNamespace = "http://dn_deletion.sso.egolm.com", endpointInterface = "com.egolm.sso.services.dn_deletion.DNDeletionService")
......@@ -47,8 +47,7 @@ public class DNDeletionServiceImpl implements DNDeletionService {
System.out.println(new Gson().toJson(DELETED_DOCUMENTS));
Date now = new Date();
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sapsodndeletion" + timeString + common.getNextval("T_SO_DN_DELETION_TRACE_" + dateString);
String TRACE_NO = common.getNextTrace(now, "sapsodndeletion", "T_SO_DN_DELETION_TRACE");
String apiName = "SAP单据删除通知接口";
String apiPath = "/dn_deletion";
String traceName = "SODNDeletion";
......
......@@ -50,8 +50,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
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" + timeString + common.getNextval("T_VEN_GOODS_TRACE_" + dateString);
String TRACE_NO = common.getNextTrace(now, "sapmaterialmaster", "T_VEN_GOODS_TRACE");
String apiName = "SAP物料接口";
String apiPath = "/material_master";
String traceName = "MaterialMaster";
......
......@@ -62,8 +62,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
System.out.println(new Gson().toJson(Z_MT_SD_005_PERFORM_INVOICE));
Date now = new Date();
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sapproformainvoice" + timeString + common.getNextval("T_PERFORM_INVOICE_HEADER_TRACE_" + dateString);
String TRACE_NO = common.getNextTrace(now, "sapproformainvoice", "T_PERFORM_INVOICE_HEADER_TRACE");
String apiName = "SAP形式发票接口";
String apiPath = "/prforma_invoice";
String traceName = "ProFormaInvoice";
......
......@@ -50,8 +50,7 @@ public class PriceListServiceImpl implements PriceListService {
System.out.println(new Gson().toJson(Z_MT_SD_002_PRICE_LIST));
Date now = new Date();
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sappricelist" + timeString + common.getNextval("T_PRICE_LIST_TRACE_" + dateString);
String TRACE_NO = common.getNextTrace(now, "sappricelist", "T_PRICE_LIST_TRACE");
String apiName = "SAP列表价接口";
String apiPath = "/price_list";
String traceName = "PriceList";
......
......@@ -55,10 +55,9 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
boolean isSuccess = true;
System.out.println(new Gson().toJson(Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE));
Date now = new Date();
Long timeMillis = now.getTime();
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
String TRACE_NO = "sapshippingnotification" + timeString + common.getNextval("T_SHIPPING_NOTIFICATION_HEADER_TRACE_" + dateString);
String TRACE_NO = common.getNextTrace(now, "sapshippingnotification", "T_SHIPPING_NOTIFICATION_HEADER_TRACE");
String apiName = "SAP发货通知接口";
String apiPath = "/shipping_notfirmation";
String traceName = "ShippingNotfirmation";
......@@ -126,7 +125,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
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"));
Long hID = Long.valueOf(timeMillis + StringUtil.getIndex("T_SHIPPING_NOTIFICATION_HEADER_ID"));
header.put("ID", hID);
insertTo(header, "t_shipping_notification_header");
......@@ -134,7 +133,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
if(ITEMs != null) {
for(ITEM ITEM : ITEMs) {
Map<String, Object> item = new HashMap<>();
Long iID = Long.valueOf(time + StringUtil.getIndex("T_SHIPPING_NOTIFICATION_ITEM_ID"));
Long iID = Long.valueOf(timeMillis + StringUtil.getIndex("T_SHIPPING_NOTIFICATION_ITEM_ID"));
item.put("ID", iID);
item.put("HEADER_ID", hID);
item.put("POSNR", ITEM.getPOSNR());
......
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