Commit 5c490d5e by lixinyi

cips拟报时间截断

parent 1b8221a7
......@@ -2,8 +2,8 @@
import axios from 'axios'
const service = axios.create({
baseURL: '/swift-editor-1.0.0', //代理
// baseURL: '/swift-editor', //本地用这个
// baseURL: '/swift-editor-1.0.0', //代理
baseURL: '/swift-editor', //本地用这个
timeout: 50000 // request timeout
})
......
......@@ -16,13 +16,14 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public class CipsTransfer {
private final static Logger logger = LoggerFactory.getLogger(CipsTransfer.class);
public static String transfer(String gsonStr) {
public static String transfer(String gsonStr) throws ParseException {
Map<String, Object> gsonMaps = JSON.parseObject(gsonStr);
Date date = new Date();
SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyyMMdd");
......@@ -103,6 +104,19 @@ public class CipsTransfer {
gsonMaps.put("OrigSenderSID","CIPS");
gsonMaps.put("OrigReceiverSID","CIPS");
Map grpHdr = (Map) gsonMaps.get("GrpHdr");
if(grpHdr.get("CreDtTm") != null){
String creDtTm= (String) grpHdr.get("CreDtTm");
grpHdr.put("CreDtTm",creDtTm.substring(0,19));
}
if (cdtTrfTxInf.get("SttlmTmIndctn") != null){
Map sttlmTmIndctn = (Map) cdtTrfTxInf.get("SttlmTmIndctn");
if (sttlmTmIndctn.get("DbtDtTm") != null){
String dbtDtTm= (String) sttlmTmIndctn.get("DbtDtTm");
sttlmTmIndctn.put("DbtDtTm",dbtDtTm.substring(0,19));
}
}
String swiftGsonStr = new JSONObject(gsonMaps).toJSONString();
System.out.println("CIPSGsonStr------>:::" + swiftGsonStr);
//本地
......@@ -244,7 +258,7 @@ public class CipsTransfer {
return maps;
}
public static void main(String[] args) throws IOException {
public static void main(String[] args) throws IOException, ParseException {
File file = new File(System.getProperty("user.dir")+"\\src\\main\\resources\\json\\pacs00800108.json");
// File file = new File("d:/test/tst.json");
String gsonStr = FileUtils.readFileToString(file, "UTF-8");
......
......@@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -45,7 +46,7 @@ public class CipsEditorController {
@RequestMapping(value = "/msgsend", method = RequestMethod.POST)
@ResponseBody
public String msgPreview(@RequestBody SwiftVo swiftVo) {
public String msgPreview(@RequestBody SwiftVo swiftVo) throws ParseException {
String xml = null;
if(StringUtil.isNotEmpty(swiftVo.getJson())){
xml = transfer(swiftVo.getJson());
......
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