Commit 93a4b99d authored by Quxl's avatar Quxl

x

parent d8bd91f5
......@@ -5,3 +5,4 @@
/application.properties
/bin/
/logs/
/xmlHistory/
......@@ -9,8 +9,6 @@ import java.util.Map.Entry;
import javax.jws.WebService;
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.jdbc.core.JdbcTemplate;
......@@ -32,8 +30,6 @@ import com.google.gson.Gson;
@WebService(serviceName = "MaterialMasterService", targetNamespace = "http://material_master.sso.egolm.com", endpointInterface = "com.egolm.sso.services.material_master.MaterialMasterService")
public class MaterialMasterServiceImpl implements MaterialMasterService {
private static Log logger = LogFactory.getLog(MaterialMasterService.class);
@Autowired
JdbcTemplate jdbcTemplate;
......@@ -125,10 +121,11 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
isSuccess = false;
throw new XRException("数据保存失败", e);
} finally {
String xmlName = Z_MT_SD_001_MATERIAL_MASTER.getClass().getSimpleName() + ".xml";
String xmlName = Z_MT_SD_001_MATERIAL_MASTER.getClass().getSimpleName();
try {
String xml = XMLUtil.toXml(Z_MT_SD_001_MATERIAL_MASTER);
FileUtil.writeText(xmlRoot + "/sap/" + xmlName + "/" + DateUtil.formatDate(new Date(), DateUtil.FMT_DATE) + "/" + (isSuccess?"success":"error") + "/" + xmlName + "-" + common.getNextval(dateString + "T_VEN_GOODS_BATCH_" + dateString) + ".XML" , xml);
String xmlFullName = xmlRoot + "/sap/" + xmlName + "/" + DateUtil.formatDate(new Date(), DateUtil.FMT_DATE) + "/" + (isSuccess?"success":"error") + "/" + xmlName + "-" + common.getNextval(dateString + "MATERIAL_MASTER_FILE_NAME" + dateString) + ".XML";
FileUtil.writeText(xmlFullName, xml);
} catch (Exception e) {
throw new XRException("报文保存失败", e);
}
......
......@@ -2,6 +2,7 @@ package com.egolm.sso.util;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
......@@ -26,7 +27,12 @@ public class FileUtil {
}
public static void writeText(String path, String text) throws IOException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path)));
File file = new File(path);
File parentFile = file.getParentFile();
if(!parentFile.exists()) {
parentFile.mkdirs();
}
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file)));
writer.write(text);
writer.close();
}
......
wsUsername: test
wsPassword: 78258c537d6e4d5fb210a57d05619fb6
xmlRoot: xmlHistory
xmlRoot: XML_HISTORY
SAP:
NO009:
CRON: 0 0 0 * * ?
......
wsUsername: schneider
wsPassword: f14d4a80f823438a875b1924384c944c
xmlRoot: xmlHistory
xmlRoot: XML_HISTORY
SAP:
NO009:
CRON: 0 0 0 * * ?
......
wsUsername: test
wsPassword: 78258c537d6e4d5fb210a57d05619fb6
xmlRoot: xmlHistory
xmlRoot: XML_HISTORY
SAP:
NO009:
CRON: 0 0 0 * * ?
......
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