Commit 80149aa5 by lixinyi

cips手工拟报组报调整,反显调整

parent 1fd7a8b5
......@@ -100,5 +100,12 @@ export default{
data:data
})
},
cips2Json(data){
return new link({
url:`/cips/cips2Json`,
method:"post",
data:data
})
},
}
......@@ -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
})
......
<template>
<span>
<span :class="{'warning-border': iswarning}">
<el-select
v-model="orgData.Ccy"
:disabled="dataModel.disabled"
filterable
placeholder="select currency"
clearable
size="small"
@change="changeOption"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
<el-input
:disabled="dataModel.disabled"
v-model="orgData.amount"
type="number"
:show-word-limit="true"
style="width: 60%"
@blur="amountHandle"
@input="checkData"
:placeholder="`Please enter ${dataModel.name}`"
>
</el-input>
</span>
<p v-if="iswarning" class="warning-text">{{ warningText }}</p>
</span>
</template>
<script>
import MsgCodes from '../script/MsgCode'
import MsgJsonMap from '../script/MsgJson'
import Decimal from 'decimal.js'
export default {
props: ['dataModel', 'sca1'],
data() {
return {
scale: 2,
orgData: {},
options: [],
scaleMap: {},
iswarning: false,
warningText:''
}
},
mounted() {
this.orgData = this.dataModel.value
? this.dataModel.value
: MsgJsonMap('Amount')
this.dataModel.value = this.orgData
this.options = MsgCodes['Ccy']
for (let opt of this.options) {
this.scaleMap[opt.value] = opt.scale
}
this.changeOption(this.orgData.amount)
},
methods: {
changeOption(value) {
if (value === '') {
this.orgData.amount = ''
this.iswarning = false;
} else {
if(this.dataModel.comparePath){
this.compare(this.dataModel.comparePath)
}
this.scale = this.scaleMap[value]
this.amountHandle()
}
},
//与关联路径对应的Amount的币种进行比较,如果不一致则给出提示信息
compare(path) {
let pathMap = path.split('.')
let treeNodeArry = this.$root.$children[0].$children[0].$data.treeModel.treeNodeArry;
let exp = `treeNodeArry[${pathMap[0]}]`;
for (let index = 1; index < pathMap.length; index++) {
const child = pathMap[index];
exp += `.children[${child}]`
}
let targetCcy = eval(exp + '.value.Ccy')
let targetName = eval(exp + '.name')
if(targetCcy != undefined && targetCcy !='' && this.dataModel.value.Ccy !== targetCcy){
this.iswarning = true;
this.warningText = `${this.dataModel.name} And ${targetName} have different Currency`
}else{
this.iswarning = false;
}
},
checkData() {
if (
this.orgData.Ccy === undefined ||
this.orgData.Ccy === null ||
this.orgData.Ccy.trim() === ''
) {
this.orgData.Ccy = this.options[0].value
this.scale = this.options[0].scale
}
},
amountHandle() {
this.$root.$children[0].$children[0].$refs.form.validateField(
this.$parent._props.prop,
(errMsg) => {
if (errMsg === '') {
if (this.orgData.amount !== '' && this.orgData.amount !== undefined) {
const Ccy = this.orgData.Ccy
const inputValue = Decimal(this.orgData.amount)
var maxValue = Decimal('999999999999.99')
const minValue = Decimal('0')
var tip = '999,999,999,999.99'
let value = inputValue.toFixed(this.scale, Decimal.ROUND_HALF_UP)
if (Ccy !== '' && Ccy !== undefined) {
if (Ccy == 'RAND' || Ccy == 'IDR' || Ccy == 'VND') {
maxValue = Decimal('9999999999999999.99')
tip = '9,999,999,999,999,999.99'
}
}
if (inputValue.comparedTo(maxValue) === 1) {
this.$message({
message: 'The amount maxVlue is ' + tip,
type: 'error',
})
value = maxValue.toFixed(this.scale, Decimal.ROUND_HALF_UP)
//} else if(inputValue.comparedTo(minValue)===-1||inputValue.comparedTo(minValue)===0) {
// this.$message({
// message: "The amount must be greater than zero",
// type: "error",
// });
// value = null;
// }
} else if (inputValue.comparedTo(minValue) === -1) {
this.$message({
message: 'The amount must be greater than or equal to zero',
type: 'error',
})
value = null
}
this.orgData.amount = value
}
}
}
)
},
},
watch: {
orgData: function (newValue, oldValue) {
//监听异步改变的orgData的值,并实时绑定到dataModel.value上
this.dataModel.value = newValue
},
},
}
</script>
<style scoped>
.warning-border >>> .el-input--small .el-input__inner{
border-color: orange;
}
.warning-text{
font-size: 12px;
color: orange;
padding: 0;
margin: 0;
}
</style>
\ No newline at end of file
......@@ -195,6 +195,9 @@ export default {
) {
this.active = true;
this.showSpan = true;
} else if("1" === this.dataModel.iscips){
this.$set(this.dataModel, 'value', "C"+this.$moment(new Date()).format("YYYYMMDDHHmmssSSS"));
console.log("MsgId:"+this.dataModel.value);
}
if (this.dataModel.defaultValue !== undefined) {
this.$set(this.dataModel, "value", this.dataModel.defaultValue);
......
<template>
<!-- <el-menu class="el-menu-demo" mode="horizontal">
<el-submenu index="1">
<template slot="title">CBPR+ Manual mirroring packet</template>
<div v-for="(item, i) in messageTypeCodes">
<el-menu-item><router-link :to="'/iso/'+item.value">{{item.label}}</router-link></el-menu-item>
</div>
</el-submenu>
<el-submenu index="2">
<template slot="title">RTGS Manual mirroring packet</template>
<div v-for="(item, i) in messageTypeCodesRtgs">
<el-menu-item><router-link :to="'/rtgs/'+item.value">{{item.label}}</router-link></el-menu-item>
</div>
</el-submenu> -->
<!-- <el-submenu index="3">
<template slot="title">SWIFT报文中央格转器</template>
<el-menu-item index="3-1"><router-link to="/mx2mt">MX转MT</router-link></el-menu-item>
<el-menu-item index="3-2"><router-link to="/mt2mx">MT转MX</router-link></el-menu-item>
</el-submenu> -->
<!-- </el-menu> -->
<el-row>
<!-- <el-col :span="3"></el-col> -->
<el-col :span="18" :offset="3">
<el-tabs v-model="activeName" type="card">
<!--
<el-tab-pane label="RTGS Manual mirroring packet" name="first">
<el-input v-model="inputRtgs" placeholder="Input message type for quick screening" @input="searchRtgsMessageByType"></el-input>
<el-table
:data="messageTypeCodesRtgs.filter((v) => v.isShow == true)"
:show-header="false"
style="width: 100%">
<el-table-column>
<template slot-scope="scope">
<router-link :to="'/rtgs/'+scope.row.value+`/${loginUser}`">{{"Create " + scope.row.value + " " + scope.row.label}}</router-link>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
-->
<el-tab-pane label="CIPS Manual mirroring packet" name="second">
<el-input v-model="inputCbprPlus" placeholder="Input message type for quick screening" @input="searchCIPSPlusMessageByType"></el-input>
<el-table
:data="CIPSmessageTypeCodes.filter((v) => v.isShow == true)"
:show-header="false"
style="width: 100%">
<el-table-column>
<template slot-scope="scope">
<router-link :to="'/cips/'+scope.row.value+`/${loginUser}`">{{"Create " + scope.row.value + " " + scope.row.label}}</router-link>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</el-col>
<!-- <el-col :span="3"></el-col> -->
</el-row>
</template>
<script>
import MsgCodes from './script/MsgCode';
export default {
data() {
return {
CIPSmessageTypeCodes : MsgCodes['CIPSmessageTypeCode'],
activeName: 'second',
inputCbprPlus: '',
inputRtgs: '',
loginUser: this.$route.query.loginUser,
}
},
methods:{
searchCIPSPlusMessageByType(){
let icp = this.inputCbprPlus;
console.log(this.CIPSmessageTypeCodes);
console.log("icp:"+icp);
for(let mess of this.CIPSmessageTypeCodes){
if(icp != null || icp != undefined){
console.log(mess.value.indexOf(icp));
console.log(mess.value);
if(mess.value.indexOf(icp) != -1)
mess.isShow = true;
else
mess.isShow = false;
}else
mess.isShow = true;
}
},
},
mounted(){
//点击goBack,返回刷新页面
this.searchCIPSPlusMessageByType();
},
created(){
console.log(this.loginUser);
}
}
</script>
<style scoped>
a{text-decoration: none}
</style>
\ No newline at end of file
<template>
<div class="main"><span>success</span></div>
</template>
<script>
export default {
components: {},
props: {},
data() {
return {
loginUser: this.$route.query.loginUser,
};
},
watch: {},
computed: {},
methods: {
toHome() {
this.$router.push({
path: "/cips",
query: {
loginUser: this.loginUser,
},
});
},
},
created() {
console.log(this.loginUser);
},
mounted() {}
};
</script>
<style scoped>
.main {
height: 100%;
margin-top: 10%;
}
.main span {
margin: auto;
font-size: 40px;
width: 200px;
height: 200px;
border-radius: 100px;
text-align: center;
line-height: 200px;
display: block;
color: blueviolet;
background-color: rgb(240, 210, 155);
}
.btn {
display: block;
margin: auto;
margin-top: 20px;
}
</style>
\ No newline at end of file
......@@ -113,6 +113,12 @@ const MsgCodes = {
// scale: 2
// },
],
Ccy: [{
value: "CNY",
label: "CNY",
scale: 2
},
],
externalAccountIdCode: [{
value: "AIIN",
label: "Issuer Identification Number"
......
import message from '../Message.js'
import {isEmpty,isNotEmpty} from '../BeanUtil.js'
import Decimal from 'decimal.js';
export default function validator(obj) {
console.log("com to cips111 rule....");
console.log(obj);
if(!CIPS_Creditor(obj.FIToFICstmrCdtTrf.CdtTrfTxInf.Cdtr,'Message root/CreditTransferTransactionInformation/Creditor')){
return false;
}
if(!CIPS_Dbtr(obj.FIToFICstmrCdtTrf.CdtTrfTxInf.Dbtr,'Message root/CreditTransferTransactionInformation/Debtor')){
return false;
}
if(!CIPS_CdtrAgt(obj.FIToFICstmrCdtTrf.CdtTrfTxInf.CdtrAgt,'Message root/CreditTransferTransactionInformation/CreditorAgent')){
return false;
}
if(!CIPS_DbtrAgt(obj.FIToFICstmrCdtTrf.CdtTrfTxInf.DbtrAgt,'Message root/CreditTransferTransactionInformation/DebtorAgent')){
return false;
}
return true;
}
//收款人名称、收款人地址必须有一个存在
function CIPS_Creditor(cdtr,position) {
const msg = "* 收款人名称、收款人地址必须有一个存在";
let nm = cdtr.Nm;
let adrLine = cdtr.AdrLine;
if(isEmpty(nm) && isEmpty(adrLine)){
message(position,msg);
return false;
}
return true;
}
//汇款人名称、汇款人地址必须有一个存在
function CIPS_Dbtr(cdtr,position) {
const msg = "* 汇款人名称、汇款人地址必须有一个存在";
let nm = cdtr.Nm;
let adrLine = cdtr.AdrLine;
if(isEmpty(nm) && isEmpty(adrLine)){
message(position,msg);
return false;
}
return true;
}
//收款人开户行行号、名称必须有一个存在
function CIPS_CdtrAgt(cdtr,position) {
const msg = "* 收款人开户行行号、名称必须有一个存在";
let mmbId = cdtr.FinInstnId.ClrSysMmbId.MmbId;
let nm = cdtr.FinInstnId.Nm;
if(isEmpty(nm) && isEmpty(mmbId)){
message(position,msg);
return false;
}
return true;
}
//汇款人开户行行号、名称必须有一个存在
function CIPS_DbtrAgt(cdtr,position) {
const msg = "* 汇款人开户行行号、名称必须有一个存在";
let mmbId = cdtr.FinInstnId.ClrSysMmbId.MmbId;
let nm = cdtr.FinInstnId.Nm;
if(isEmpty(nm) && isEmpty(mmbId)){
message(position,msg);
return false;
}
return true;
}
import cips111 from './CIPS/Cips111.js'
export function validatorRule(mty,obj) {
console.log("COMON TO validatorRule");
console.log(mty,obj);
switch (mty) {
case 'cips.111.001.02':
return cips111(obj);
}
return true;
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import ISO2 from "../iso/pages/indexrtgs.vue";
import index from "../iso/index.vue";
import indexcips from "../iso/indexcips.vue";
import success from "../iso/pages/success.vue";
import successCips from "../iso/pages/successCips.vue";
import MX2MT from "../iso/pages/mx2mt.vue";
import MT2MX from "../iso/pages/mt2mx.vue";
import CIPS from "../iso/pages/indexcips.vue"
......@@ -38,6 +39,10 @@ export default new VueRouter({
path: "/success",
component: success,
},
{
path: "/successCips",
component: successCips,
},
// {
// path: "/mx2mt",
// component: MX2MT,
......
......@@ -27,14 +27,23 @@ public class CipsTransfer {
SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat dateFormat2 = new SimpleDateFormat("HHmmss");
//改造map层级,使能转换成xml报文
//删除最外层FIToFICstmrCdtTrf
//删除最外层FIToFICstmrCdtTrf(cips111)
if (gsonMaps.get("FIToFICstmrCdtTrf") != null) {
JSONObject jsonObject = (JSONObject) gsonMaps.get("FIToFICstmrCdtTrf");
for (String key : jsonObject.keySet()) {
gsonMaps.put(key, jsonObject.get(key));
}
}
gsonMaps.remove("FIToFICstmrCdtTrf");
}
//删除最外层FICdtTrf(cips112)
if (gsonMaps.get("FICdtTrf") != null) {
JSONObject jsonObject = (JSONObject) gsonMaps.get("FICdtTrf");
for (String key : jsonObject.keySet()) {
gsonMaps.put(key, jsonObject.get(key));
}
gsonMaps.remove("FICdtTrf");
}
//新增OrigSendDate
String currentDate = dateFormat1.format(date);
gsonMaps.put("OrigSendDate",currentDate);
......@@ -75,8 +84,13 @@ public class CipsTransfer {
if (res.get(s) != null)
res = (Map) res.get(s);
}
if("cips.112.001.02".equals(gsonMaps.get("MesgType"))) {
if (res.get("MsgId") != null)
gsonMaps.put("MesgRefID",res.get("MsgId"));
gsonMaps.put("MesgRefID", res.get("MsgId"));
}else if ("cips.111.001.02".equals(gsonMaps.get("MesgType"))){
if (res.get("EndToEndId") != null)
gsonMaps.put("MesgRefID", res.get("EndToEndId"));
}
//新增MesgID、cipsMsgId、OrigSenderSID、OrigReceiverSID
gsonMaps.put("MesgID",gsonMaps.get("MesgRefID"));
gsonMaps.put("cipsMsgId",gsonMaps.get("MesgRefID"));
......
......@@ -77,10 +77,14 @@ public class CipsEditorController {
map.put("opeType", StringUtil.isNotEmpty(opeType) ? opeType : "1");
Map res = (Map) CommonSend.send(map);
String retcod = (String) res.get("retcode");
String retmsg = (String) res.get("retmsg");
logger.info(res.toString());
if (retcod != null && retcod.endsWith("0000000")) {
return "1" + identifier + ".xml is saved successfully";
} else {
return "save return:" + retcod;
} else if((retcod != null && retcod.endsWith("OBS0000111"))){
return "原因:" + retmsg;
}else {
return "请联系管理员";
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
......@@ -117,34 +121,6 @@ public class CipsEditorController {
}
return null;
}
@RequestMapping(value = "/mx2mt", method = RequestMethod.POST)
@ResponseBody
public String mx2Mt(@RequestBody SwiftVo swiftVo){
Map<String, Object> maps = new HashMap<String, Object>();
try {
if("MT202".equals(swiftVo.getMtType())||"MT205".equals(swiftVo.getMtType())){
maps.put("MtType",swiftVo.getMtType());
}
SwiftTranslationReport str = SwiftTransfer.mx2MtPlus(swiftVo.getXml(), null, maps);
String mstr = str.getMessage();
List<SwiftTranslationErrorInfo> errorInfos = str.getErrorInfos();
if (StringUtil.isEmpty(mstr)) {
return null;
}
String errorDsp = "Translation Result : " + str.getTranslationResult();
if (errorInfos != null && errorInfos.size() > 0) {
for (int i = 0; i < errorInfos.size(); i++) {
SwiftTranslationErrorInfo errorInfo = errorInfos.get(i);
errorDsp += Mx2MtConstants.NEW_LINE + errorInfo.toString();
}
}
return errorDsp +Mx2MtConstants.NEW_LINE+ mstr;
} catch (com.brilliance.swift.exception.SwiftException e){
return e.getMessage();
} catch (Exception e){
return "报文格式有问题,请重新输入!!!";
}
}
@RequestMapping(value = "/mt2mx", method = RequestMethod.POST)
@ResponseBody
......@@ -176,19 +152,19 @@ public class CipsEditorController {
}
}
@RequestMapping(value = "/mx2Json", method = RequestMethod.POST)
@RequestMapping(value = "/cips2Json", method = RequestMethod.POST)
@ResponseBody
public JSONObject mx2Json(@RequestBody SwiftVo swiftVo) {
logger.info("---->swiftVo.getMty():" + swiftVo.getMty());
if (swiftVo.getMty() != null) {
String messageType = swiftVo.getMty().replaceAll("\\.", "");
public JSONObject mx2Json(@RequestBody CipsVo cipsVo) {
logger.info("---->swiftVo.getMty():" + cipsVo.getMty());
if (cipsVo.getMty() != null) {
String messageType = cipsVo.getMty().replaceAll("\\.", "");
// 根据smhinr获取报文内容
String smhinr = swiftVo.getSmhinr();
String smhinr = cipsVo.getSmhinr();
logger.info("---->messageType:" + messageType);
logger.info("---->smhinr:" + smhinr);
Map<String, Object> map = new HashMap();
// 接口
map.put("interface", "bdTaskFive");
map.put("interface", "cipsEdit");
// 交易
map.put("transaction", "getMsg");
// 根据报文id获取报文内容
......@@ -207,10 +183,20 @@ public class CipsEditorController {
// } catch (IOException e) {
// }
// }
if (swiftVo.getType() != null) {
AbstractMX abstractMX = AbstractMX.parse(xmlStr);
String s = abstractMX.toJson();
Map<String, Object> maps = MxTransfer.transfer2(s, messageType, swiftVo.getType());
if (cipsVo.getType() != null) {
Map<String, Object> xmlMaps = MsgUtil.cips2Map(xmlStr);
Map<String, Object> maps = new HashMap<>();
Map<String, Object> fIToFICstmrCdtTrf = new HashMap<>();
fIToFICstmrCdtTrf.put("GrpHdr",xmlMaps.get("GrpHdr"));
fIToFICstmrCdtTrf.put("CdtTrfTxInf",xmlMaps.get("CdtTrfTxInf"));
if("cips11100102".equals(messageType))
maps.put("FIToFICstmrCdtTrf",fIToFICstmrCdtTrf);
else if ("cips11200102".equals(messageType)) {
maps.put("FICdtTrf",fIToFICstmrCdtTrf);
}
// AbstractMX abstractMX = AbstractMX.parse(xmlStr);
// String s = abstractMX.toJson();
// Map<String, Object> maps = MxTransfer.transfer2(s, messageType, cipsVo.getType());
JSONObject json = new JSONObject(maps);
return json;
}
......
<!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.4f0b7632.js"></script><link href="css/chunk-vendors.7c88cb4c.css" rel="stylesheet"><link href="css/app.24dcf439.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.364b900e.js"></script><link href="css/chunk-vendors.7c88cb4c.css" rel="stylesheet"><link href="css/app.8d1e3241.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
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