Commit a991e4a6 authored by Quxl's avatar Quxl

x

parent db71c18e
...@@ -16,7 +16,7 @@ public class ExceptionAspect { ...@@ -16,7 +16,7 @@ public class ExceptionAspect {
@AfterThrowing(throwing = "ex", pointcut = execution) @AfterThrowing(throwing = "ex", pointcut = execution)
public void afterThrowing(Throwable ex) { public void afterThrowing(Throwable ex) {
logger.error("未处理异常", ex); //logger.error("未处理异常", ex);
} }
} }
package com.egolm.sso.services; package com.egolm.sso.services;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.DuplicateKeyException;
import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
...@@ -12,6 +15,9 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -12,6 +15,9 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.egolm.sso.config.XRException; import com.egolm.sso.config.XRException;
import com.egolm.sso.util.SqlUtil;
import com.egolm.sso.util.SqlUtil.Sql;
import com.egolm.sso.util.StringUtil;
@Service @Service
public class CommonService { public class CommonService {
...@@ -19,6 +25,9 @@ public class CommonService { ...@@ -19,6 +25,9 @@ public class CommonService {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Value("${systemId}")
private String systemId;
@Transactional(propagation=Propagation.NOT_SUPPORTED) @Transactional(propagation=Propagation.NOT_SUPPORTED)
public Long getNextval(String sName) { public Long getNextval(String sName) {
try { try {
...@@ -54,4 +63,21 @@ public class CommonService { ...@@ -54,4 +63,21 @@ public class CommonService {
} }
} }
public void saveApiAccessLog(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")));
map.put("METHOD", METHOD);
map.put("ADDRESS", ADDRESS);
map.put("ACCESS_DATE", now);
map.put("RESULT", RESULT);
map.put("CREATED", now);
map.put("CREATEBY", systemId);
Sql sqlObj = SqlUtil.insertSql("t_api_access_log", map);
String sql = sqlObj.getSql();
Object[] objs = sqlObj.getArgs();
jdbcTemplate.update(sql, objs);
}
} }
...@@ -174,6 +174,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService { ...@@ -174,6 +174,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
FileUtil.writeText(xmlFullName, xml); FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_008_SO_CONFIRM_QUOTATION); String json = new Gson().toJson(Z_MT_SD_008_SO_CONFIRM_QUOTATION);
FileUtil.writeText(xmlFullName + ".JSON", json); FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/confirm_quotation", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) { } catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e); throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
} }
......
...@@ -84,6 +84,7 @@ public class DNDeletionServiceImpl implements DNDeletionService { ...@@ -84,6 +84,7 @@ public class DNDeletionServiceImpl implements DNDeletionService {
FileUtil.writeText(xmlFullName, xml); FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(DELETED_DOCUMENTS); String json = new Gson().toJson(DELETED_DOCUMENTS);
FileUtil.writeText(xmlFullName + ".JSON", json); FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/dn_deletion", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) { } catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e); throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
} }
......
...@@ -132,6 +132,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -132,6 +132,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
FileUtil.writeText(xmlFullName, xml); FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_001_MATERIAL_MASTER); String json = new Gson().toJson(Z_MT_SD_001_MATERIAL_MASTER);
FileUtil.writeText(xmlFullName + ".JSON", json); FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/material_master", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) { } catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e); throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
} }
......
...@@ -259,6 +259,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService { ...@@ -259,6 +259,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
FileUtil.writeText(xmlFullName, xml); FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_005_PERFORM_INVOICE); String json = new Gson().toJson(Z_MT_SD_005_PERFORM_INVOICE);
FileUtil.writeText(xmlFullName + ".JSON", json); FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/prforma_invoice", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) { } catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e); throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
} }
......
...@@ -115,6 +115,7 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -115,6 +115,7 @@ public class PriceListServiceImpl implements PriceListService {
FileUtil.writeText(xmlFullName, xml); FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_002_PRICE_LIST); String json = new Gson().toJson(Z_MT_SD_002_PRICE_LIST);
FileUtil.writeText(xmlFullName + ".JSON", json); FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/price_list", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) { } catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e); throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
} }
......
...@@ -183,6 +183,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ ...@@ -183,6 +183,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
FileUtil.writeText(xmlFullName, xml); FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE); String json = new Gson().toJson(Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE);
FileUtil.writeText(xmlFullName + ".JSON", json); FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/shipping_notfirmation", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) { } catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e); throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
} }
......
...@@ -3,17 +3,20 @@ package test; ...@@ -3,17 +3,20 @@ package test;
import com.egolm.sso.services.material_master.MaterialMasterService; import com.egolm.sso.services.material_master.MaterialMasterService;
import com.egolm.sso.services.material_master.Z_MT_SD_001_MATERIAL_MASTER; import com.egolm.sso.services.material_master.Z_MT_SD_001_MATERIAL_MASTER;
import com.egolm.sso.util.ServiceFactory; import com.egolm.sso.util.ServiceFactory;
import com.egolm.sso.util.ServiceFactory.PasswordType;
import com.egolm.sso.util.StringUtil; import com.egolm.sso.util.StringUtil;
import com.egolm.sso.util.XMLUtil; import com.egolm.sso.util.XMLUtil;
public class MaterialMasterServiceTest { public class MaterialMasterServiceTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String wsdlLocation = "http://10.204.15.9:8080/api/services/material_master?wsdl"; //String wsdlLocation = "http://10.204.15.9:8080/api/services/material_master?wsdl";
String wsdlLocation = "http://localhost:8080/api/services/material_master?wsdl";
String namespace = "http://material_master.sso.egolm.com"; String namespace = "http://material_master.sso.egolm.com";
String serviceName = "MaterialMasterService"; String serviceName = "MaterialMasterService";
MaterialMasterService service = ServiceFactory.create(MaterialMasterService.class, wsdlLocation, namespace, serviceName); MaterialMasterService service = ServiceFactory.create(MaterialMasterService.class, wsdlLocation, namespace, serviceName, "test", "78258c537d6e4d5fb210a57d05619fb6", PasswordType.PasswordText);
String XML = StringUtil.readText("C:\\Users\\Quxl\\Desktop\\SSP3A250F7R.xml"); //String XML = StringUtil.readText("C:\\Users\\Quxl\\Desktop\\SSP3A250F7R.xml");
String XML = StringUtil.readText("D:/data/sso/001.XML");
Z_MT_SD_001_MATERIAL_MASTER Z_MT_SD_001_MATERIAL_MASTER = XMLUtil.toBeanByJxab(XML, Z_MT_SD_001_MATERIAL_MASTER.class); Z_MT_SD_001_MATERIAL_MASTER Z_MT_SD_001_MATERIAL_MASTER = XMLUtil.toBeanByJxab(XML, Z_MT_SD_001_MATERIAL_MASTER.class);
service.execute(Z_MT_SD_001_MATERIAL_MASTER); service.execute(Z_MT_SD_001_MATERIAL_MASTER);
} }
......
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