Commit 2fffd814 by lixinyi

手工拟报经办修改

parent fc1b93ea
<!DOCTYPE html>
<html lang="">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
......
......@@ -241,6 +241,9 @@ export default {
//console.log(json);
this.jsonMsg = JSON.stringify(json);
let data = { json: this.jsonMsg };
if (smhinr != undefined && smhinr != null) {
this.$set(data, "opeType", "2");
}
send
.sendSWiftMes(data)
.then((res) => {
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.brilliance.mxeditor.MxTransfer;
import com.brilliance.mxeditor.exception.SwiftException;
import com.brilliance.mxeditor.interf.CommonSend;
import com.brilliance.mxeditor.util.StringUtil;
import com.brilliance.mxeditor.config.EditorEnvConfig;
import com.brilliance.mxeditor.util.SwiftTransferUtil;
......@@ -18,6 +19,8 @@ import com.prowidesoftware.swift.model.mx.AbstractMX;
import com.prowidesoftware.swift.model.mx.NamespaceReader;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
......@@ -38,6 +41,8 @@ import static com.brilliance.mxeditor.MxTransfer.transfer;
@CrossOrigin
@RequestMapping("/swift")
public class MxEditorController {
private final static Logger logger = LoggerFactory.getLogger(MxEditorController.class);
@Autowired
private EditorEnvConfig editorEnvConfig;
......@@ -55,27 +60,53 @@ public class MxEditorController {
@RequestMapping(value = "/msgsave", method = RequestMethod.POST)
@ResponseBody
public String msgSave(@RequestBody SwiftVo swiftVo) {
// Map<String, Object> gsonMaps = JSON.parseObject(swiftVo.getJson());
// String identifier = (String)gsonMaps.get("identifier");
// identifier = identifier.replace(".", "");
// try {
// File msgFolder = new File(editorEnvConfig.getRootPath()+"/"+ editorEnvConfig.getMsgPath());
// if(!msgFolder.exists()){
// msgFolder.mkdirs();
// }
// String fileName = identifier+"-"+System.currentTimeMillis();
// String xml = transfer(swiftVo.getJson());
// File msgFile = new File(msgFolder,fileName+".xml");
// boolean bFile = msgFile.createNewFile();
// if(bFile){
// FileWriter fileWriter = new FileWriter(msgFile);
// IOUtils.write(xml,fileWriter);
// fileWriter.flush();
// fileWriter.close();
// }
// return "1" + identifier+".xml文件保存成功保存路径为"+msgFile.getAbsolutePath();
// } catch (IOException e) {
// e.printStackTrace();
// return "0";
// }
String opeType = swiftVo.getOpeType();
String loginUser = swiftVo.getLoginUser();
Map<String, Object> gsonMaps = JSON.parseObject(swiftVo.getJson());
String identifier = (String)gsonMaps.get("identifier");
String identifier = (String) gsonMaps.get("identifier");
identifier = identifier.replace(".", "");
try {
File msgFolder = new File(editorEnvConfig.getRootPath()+"/"+ editorEnvConfig.getMsgPath());
if(!msgFolder.exists()){
msgFolder.mkdirs();
}
String fileName = identifier+"-"+System.currentTimeMillis();
String xml = transfer(swiftVo.getJson());
File msgFile = new File(msgFolder,fileName+".xml");
boolean bFile = msgFile.createNewFile();
if(bFile){
FileWriter fileWriter = new FileWriter(msgFile);
IOUtils.write(xml,fileWriter);
fileWriter.flush();
fileWriter.close();
Map<String, Object> map = new HashMap();
map.put("interface", "bdTaskFive");
map.put("transaction", "savsf2");
map.put("sf2msg", xml);
map.put("user", loginUser);
map.put("ismx", "1");
// 1-新增报文 2-更新报文
map.put("opeType", StringUtil.isNotEmpty(opeType) ? opeType : "1");
Map res = (Map) CommonSend.send(map);
String retcod = (String) res.get("retcode");
if (retcod != null && retcod.endsWith("0000000")) {
return "1" + identifier + ".xml is saved successfully";
} else {
return "savsf2 return:" + retcod;
}
return "1" + identifier+".xml文件保存成功保存路径为"+msgFile.getAbsolutePath();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
logger.error(e.getMessage(), e);
return "0";
}
}
......
package com.brilliance.mxeditor.interf;
import com.google.gson.Gson;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
public class CommonSend {
private static Properties innerService = new Properties();
private static int PORT;
private static String IP;
final static Logger logger = LoggerFactory.getLogger(CommonSend.class);
static {
try {
innerService.load(CommonSend.class.getClassLoader().getResourceAsStream("innerService.properties"));
IP = (String) innerService.get("ip");
PORT = Integer.parseInt((String) innerService.get("port"));
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
}
@SuppressWarnings("unchecked")
public static Object send(Map<String, Object> data) {
Map<String, String> map = new HashMap<String, String>();
Socket s = null;
try {
logger.info("------------begin connect");
s = new Socket(IP, PORT);
s.setSoTimeout(40000); //40秒超时
String json = new Gson().toJson(data);
byte[] bytes = json.getBytes();
IOUtils.write(String.format("%08d", bytes.length).getBytes(), s.getOutputStream());
IOUtils.write(bytes, s.getOutputStream());
byte[] buffer = new byte[8];
IOUtils.readFully(s.getInputStream(), buffer);
int len = Integer.parseInt(new String(buffer));
buffer = new byte[len];
IOUtils.readFully(s.getInputStream(), buffer);
json = new String(buffer, "utf-8");
logger.info("------------receve json:" + json);
map = new Gson().fromJson(json, Map.class);
return map;
} catch (Exception e) {
// TODO Auto-generated catch block
logger.error("CommonSend Error:",e);
map.put("retcode","9999999");
map.put("retdesp",e.getMessage());
return map;
} finally {
IOUtils.closeQuietly(s);
}
// logger.debug("don't get json");
//return new HashMap();
}
}
......@@ -11,10 +11,31 @@ public class SwiftVo {
private String mtType;
// 1-新增报文 2-更新报文
private String opeType;
private String loginUser;
public String getLoginUser() {
return loginUser;
}
public void setLoginUser(String loginUser) {
this.loginUser = loginUser;
}
public String getXml() {
return xml;
}
public String getOpeType() {
return opeType;
}
public void setOpeType(String opeType) {
this.opeType = opeType;
}
public String getJson() {
return json;
}
......
ip=127.0.0.1
port=10019
\ No newline at end of file
.el-input[data-v-847ac5b6] input,.el-select[data-v-847ac5b6] input{background-color:#fff;background-image:none;border-radius:4px;border:1px solid #dcdfe6;box-sizing:border-box;color:#606266;display:inline-block;height:30px;line-height:30px;outline:0;padding:0 15px;transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:300px}.el-form-item[data-v-847ac5b6]{font-size:14px;color:#606266;line-height:40px;padding:0 12px 0 0;box-sizing:border-box;margin-bottom:5px}.inputDeep[data-v-0826e2f4] .el-input__inner{background-color:#fff}.el_table[data-v-151331da]{border:1px solid #ebebeb}.tipCls[data-v-151331da]{color:#f56c6c;font-size:12px;margin-left:5px;float:left}[data-v-151331da] .isError .el-input__inner{border-color:#f56c6c}.tip[data-v-81e69ab8]{color:red}.page_title[data-v-18d12c12]{text-align:center}.node_nonleaf[data-v-18d12c12]{color:#169bff;border-bottom:1px dotted #169bff}.msg_title input[data-v-18d12c12]{vertical-align:top;margin-right:0}.el-form-item[data-v-18d12c12]{margin-bottom:0}[data-v-18d12c12] .el-form-item__content{padding-left:23px}[data-v-18d12c12] .el-tree-node__content{height:auto}.el-button+.el-button[data-v-18d12c12]{margin-left:0}.el-button--mini.is-circle[data-v-18d12c12]{padding:1px}.tree_node[data-v-18d12c12]{flex:1;display:flex;align-items:center;font-size:14px}.iso_tools[data-v-18d12c12]{position:fixed;top:150px;right:10px;z-index:9}.left[data-v-18d12c12],.right[data-v-18d12c12]{width:50%;height:100%;background:#fff;float:left}.title1[data-v-18d12c12]{background:red;text-align:center}.title2[data-v-18d12c12]{background:green;text-align:center}.textleft[data-v-18d12c12],.textright[data-v-18d12c12]{width:100%;height:600px}a[data-v-8aebcede]{text-decoration:none}.box[data-v-91a4afba]{width:100%;height:100%;margin:1% 0;overflow:hidden;box-shadow:-1px 9px 10px 3px rgba(0,0,0,.11)}.left[data-v-91a4afba],.mid[data-v-91a4afba]{width:50%;height:100%;background:#fff;float:left}.title1[data-v-91a4afba]{background:red;text-align:center}.title2[data-v-91a4afba]{background:green;text-align:center}.textleft[data-v-91a4afba],.textright[data-v-91a4afba]{width:100%;height:600px}.box[data-v-6b5c7b01]{width:100%;height:100%;margin:1% 0;overflow:hidden;box-shadow:-1px 9px 10px 3px rgba(0,0,0,.11)}.left[data-v-6b5c7b01],.mid[data-v-6b5c7b01]{width:50%;height:100%;background:#fff;float:left}.title1[data-v-6b5c7b01]{background:red;text-align:center}.title2[data-v-6b5c7b01]{background:green;text-align:center}.textleft[data-v-6b5c7b01],.textright[data-v-6b5c7b01]{width:100%;height:600px}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<!doctype html><html lang=""><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="icon" href="favicon.ico"/><title>ISO手工拟报</title><script defer="defer" src="js/chunk-vendors.ed29fde2.js"></script><script defer="defer" src="js/app.73fde165.js"></script><link href="css/chunk-vendors.7c88cb4c.css" rel="stylesheet"><link href="css/app.c68f2234.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but swiftiso-editor doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
\ No newline at end of file
<!doctype html><html lang=""><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="icon" href="favicon.ico"/><title>ISO手工拟报</title><script defer="defer" src="js/chunk-vendors.e88189ab.js"></script><script defer="defer" src="js/app.68bb1d7e.js"></script><link href="css/chunk-vendors.b3e1a118.css" rel="stylesheet"><link href="css/app.a0703934.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but swiftiso-editor doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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