Commit 9d5a3052 by zhanghou

修改了camt05300108的Mx2ElementCamt053001Creator方法,和修改了25,28和86的部分逻辑

parent 06393a03
......@@ -37,15 +37,14 @@ public class Camt052001Parse25Field extends AbstractMt2MxCamt052001ParseField {
}
if(tag25P!=null){
field25P = (Field25P) tag25P.asField();
mt_to_mxAccount35(field25P.getValue(),acctMaps,"Rpt/Acct/Id/Othr/Id");
mt_to_mxAccount35(field25P.getAccount(),acctMaps,"Rpt/Acct/Id/Othr/Id");
Map<String, Object> ownrMaps = new HashMap<>();
acctMaps.put("ownr",ownrMaps);
Map<String, Object> idMaps = new HashMap<>();
ownrMaps.put("id",idMaps);
Map<String, Object> orgIdMaps = new HashMap<>();
idMaps.put("orgId",orgIdMaps);
String sendBic = (String) context.get(Mt2MxContextIdentifier.MT_SEND_BIC, true);
orgIdMaps.put("anyBIC",sendBic);
orgIdMaps.put("anyBIC",field25P.getBIC());
}
}
}
......@@ -27,9 +27,6 @@ public class Camt052001Parse28CField extends AbstractMt2MxCamt052001ParseField {
rptPgntnMaps = new HashMap<>();
rptMaps.put("rptPgntn",rptPgntnMaps);
}
if(field28C.getSequenceNumber().equals("1")){
rptPgntnMaps.put("lastPgInd",Boolean.TRUE);
}
rptPgntnMaps.put("pgNb",field28C.getSequenceNumber());
}
}
......
package com.brilliance.swift.mt2mx.camt052001.impl;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.camt052001.AbstractMt2MxCamt052001ParseField;
import com.prowidesoftware.swift.model.Tag;
......@@ -21,7 +22,7 @@ public class Camt052001Parse86Field extends AbstractMt2MxCamt052001ParseField {
for (int i = 1;i < tags.size(); i++) {
if(!tags.get(i-1).getName().equals("61")&&tags.get(i).getName().equals("86")){
Field86 field86 = (Field86) tag86[tag86.length-1].asField();
rptMaps.put("addtlRptInf",field86.getValue().replace("\r\n",""));
rptMaps.put("addtlRptInf",field86.getValue().replace(Mx2MtConstants.NEW_LINE,""));
}
}
}
......
......@@ -34,8 +34,7 @@ public class Camt052001Parse90CField extends AbstractMt2MxCamt052001ParseField {
txsSummryMaps.put("ttlCdtNtries",ttlCdtNtriesMaps);
}
ttlCdtNtriesMaps.put("nbOfNtries",field90C.getNumber());
String sum = field90C.getAmount();
ttlCdtNtriesMaps.put("sum",sum.substring(0,sum.length()-1));
ttlCdtNtriesMaps.put("sum",field90C.amount());
}
}
}
......@@ -34,8 +34,7 @@ public class Camt052001Parse90DField extends AbstractMt2MxCamt052001ParseField {
txsSummryMaps.put("ttlDbtNtries",ttlDbtNtriesMaps);
}
ttlDbtNtriesMaps.put("nbOfNtries",field90D.getNumber());
String sum = field90D.getAmount();
ttlDbtNtriesMaps.put("sum",sum.substring(0,sum.length()-1));
ttlDbtNtriesMaps.put("sum",field90D.amount());
}
}
}
......@@ -37,15 +37,14 @@ public class Camt053001Parse25Field extends AbstractMt2MxCamt053001ParseField {
}
if(tag25P!=null){
field25P = (Field25P) tag25P.asField();
mt_to_mxAccount35(field25P.getValue(),acctMaps,"Ntfctn/Acct/Id/Othr/Id");
mt_to_mxAccount35(field25P.getAccount(),acctMaps,"Ntfctn/Acct/Id/Othr/Id");
Map<String, Object> ownrMaps = new HashMap<>();
acctMaps.put("ownr",ownrMaps);
Map<String, Object> idMaps = new HashMap<>();
ownrMaps.put("id",idMaps);
Map<String, Object> orgIdMaps = new HashMap<>();
idMaps.put("orgId",orgIdMaps);
String sendBic = (String) context.get(Mt2MxContextIdentifier.MT_SEND_BIC, true);
orgIdMaps.put("anyBIC",sendBic);
orgIdMaps.put("anyBIC",field25P.getBIC());
}
}
}
......@@ -27,9 +27,6 @@ public class Camt053001Parse28CField extends AbstractMt2MxCamt053001ParseField {
stmtPgntnMaps = new HashMap<>();
stmtMaps.put("stmtPgntn",stmtPgntnMaps);
}
if(field28C.getSequenceNumber().equals("1")){
stmtPgntnMaps.put("lastPgInd",Boolean.TRUE);
}
stmtPgntnMaps.put("pgNb",field28C.getSequenceNumber());
}
}
......
package com.brilliance.swift.mt2mx.camt053001.impl;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.camt053001.AbstractMt2MxCamt053001ParseField;
import com.prowidesoftware.swift.model.Tag;
......@@ -24,7 +25,7 @@ public class Camt053001Parse86Field extends AbstractMt2MxCamt053001ParseField {
for (int i = 1;i < tags.size(); i++) {
if(!tags.get(i-1).getName().equals("61")&&tags.get(i).getName().equals("86")){
Field86 field86 = (Field86) tag86[tag86.length-1].asField();
stmtMaps.put("addtlStmtInf",field86.getValue().replace("\r\n",""));
stmtMaps.put("addtlStmtInf",field86.getValue().replace(Mx2MtConstants.NEW_LINE,""));
}
}
}
......
......@@ -37,15 +37,14 @@ public class Camt054001Parse25Field extends AbstractMt2MxCamt054001ParseField {
}
if(tag25P!=null){
field25P = (Field25P) tag25P.asField();
mt_to_mxAccount35(field25P.getValue(),acctMaps,"Ntfctn/Acct/Id/Othr/Id");
mt_to_mxAccount35(field25P.getAccount(),acctMaps,"Ntfctn/Acct/Id/Othr/Id");
Map<String, Object> ownrMaps = new HashMap<>();
acctMaps.put("ownr",ownrMaps);
Map<String, Object> idMaps = new HashMap<>();
ownrMaps.put("id",idMaps);
Map<String, Object> orgIdMaps = new HashMap<>();
idMaps.put("orgId",orgIdMaps);
String sendBic = (String) context.get(Mt2MxContextIdentifier.MT_SEND_BIC, true);
orgIdMaps.put("anyBIC",sendBic);
orgIdMaps.put("anyBIC",field25P.getBIC());
}
}
}
......@@ -79,49 +79,6 @@ public class Mx2ElementCamt053001Creator extends AbstractMx2ElementCreator {
}
}
}
if(path.lastIndexOf("#")>0){
JSONArray array = (JSONArray)getXmlValue(jsonMaps, path.split("#")[0], 0);
String key = path.substring(path.indexOf("#")+1);
String fileName = "/template/"+key+".properties";
InputStream resourceAsStream = AbstractMx2ElementCreator.class.getResourceAsStream(fileName);
List<String> properties = StringUtil.inputStreamToLines(resourceAsStream);
List<Map<String,Object>> list = new ArrayList<>();
List<String> keyList = new ArrayList<>();
List<String> valueList = new ArrayList<>();
if (properties.size() > 0) {
for (String property : properties) {
if (property.startsWith("#")) {
continue;//过滤注释
}
String[] strArr = property.split("=");
if (strArr.length != 2) {
continue;//过滤掉不符合规则的配置
}
String key1 = strArr[0];
String value1 = strArr[1];
if(StringUtil.isNotEmpty(key1)&&StringUtil.isNotEmpty(value1)){
keyList.add(key1);
valueList.add(value1);
}
}
}
for (int i = 0; i < array.size(); i++) {
Map<String,Object> entryMaps = new LinkedHashMap<>();
for (int j = 0; j < valueList.size(); j++) {
Object xmlValue = getXmlValue((Map<String, Object>) array.get(i), valueList.get(j), 0);
if(xmlValue!=null){
entryMaps.put(keyList.get(j),xmlValue);
}
}
list.add(entryMaps);
}
if(list.size()>0){
return list;
}else {
return null;
}
//清空ntry中的值将list存入ntry中
}
//获取数据类型,&分隔,默认是string
String type = "string";
if (path.indexOf("&") > -1) {
......@@ -139,6 +96,50 @@ public class Mx2ElementCamt053001Creator extends AbstractMx2ElementCreator {
for (int i=0; i<paths.length; i++) {
int j = 0;
String p = paths[i];
if(!p.contains("\\.")&&p.indexOf("#")>0){
String key = p.split("#")[0];
System.out.println(tmpMaps);
JSONArray array = (JSONArray) tmpMaps.get(key);
String fileName = "/template/"+p.split("#")[1]+".properties";
InputStream resourceAsStream = AbstractMx2ElementCreator.class.getResourceAsStream(fileName);
List<String> properties = StringUtil.inputStreamToLines(resourceAsStream);
List<Map<String,Object>> list = new ArrayList<>();
List<String> keyList = new ArrayList<>();
List<String> valueList = new ArrayList<>();
if (properties.size() > 0) {
for (String property : properties) {
if (property.startsWith("#")) {
continue;//过滤注释
}
String[] strArr = property.split("=");
if (strArr.length != 2) {
continue;//过滤掉不符合规则的配置
}
String key1 = strArr[0];
String value1 = strArr[1];
if(StringUtil.isNotEmpty(key1)&&StringUtil.isNotEmpty(value1)){
keyList.add(key1);
valueList.add(value1);
}
}
}
for (int i1 = 0; i1 < array.size(); i1++) {
Map<String,Object> entryMaps = new LinkedHashMap<>();
for (int j1 = 0; j1 < valueList.size(); j1++) {
Object xmlValue = getXmlValue((Map<String, Object>) array.get(i1), valueList.get(j1), 0);
if(xmlValue!=null){
entryMaps.put(keyList.get(j1),xmlValue);
}
}
list.add(entryMaps);
}
if(list.size()>0){
return list;
}else {
return null;
}
//清空ntry中的值将list存入ntry中
}
if(p.contains("(")&&p.contains(")")){
JSONArray array = (JSONArray) tmpMaps.get(p.substring(0,p.indexOf("(")));
String[] split = p.split(":");
......
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