Commit dfd948cf by zhanghou

修改了n92,n96的getMtType方法

parent 3c5e89ee
...@@ -55,36 +55,25 @@ public class Mx2Mtn92Creator extends AbstractMx2MtCreator { ...@@ -55,36 +55,25 @@ public class Mx2Mtn92Creator extends AbstractMx2MtCreator {
fieldsGenerateList.add(new Field79Generate()); fieldsGenerateList.add(new Field79Generate());
return fieldsGenerateList; return fieldsGenerateList;
} }
@Override @Override
protected String getMtType() { protected String getMtType() {
Document document = (Document)context.get(Mx2MtContextIdentifier.MX_XMl_DOCUMENT, true); Document document = (Document)context.get(Mx2MtContextIdentifier.MX_XMl_DOCUMENT, true);
String bodyParentPath = (String)context.get(Mx2MtContextIdentifier.BODY_PARENT_ELEMENT_NAME, true); String bodyParentPath = (String)context.get(Mx2MtContextIdentifier.BODY_PARENT_ELEMENT_NAME, true);
String mtType = getXmlNodeValue(bodyParentPath, document, "Undrlyg.TxInf.OrgnlGrpInf.OrgnlMsgNmId"); String orgMsgNameIdentification = getXmlNodeValue(bodyParentPath, document, "Undrlyg.TxInf.OrgnlGrpInf.OrgnlMsgNmId");
String msgType = ""; String mtType = Mx2MtConstants.MT_TYPE_292;
if(StringUtil.isNotEmpty(mtType)){ if (StringUtil.isNotEmpty(orgMsgNameIdentification)) {
if(mtType.startsWith("pacs.008")){ if (orgMsgNameIdentification.startsWith("pacs.008")
msgType = "103"; || orgMsgNameIdentification.startsWith("pacs.003")) {
}else if(mtType.startsWith("pacs.003")){ mtType = Mx2MtConstants.MT_TYPE_192;
msgType = "104"; } else if (orgMsgNameIdentification.startsWith("pacs.009")
}else if(mtType.startsWith("pacs.009")){ || orgMsgNameIdentification.startsWith("pacs.010")) {
msgType = "202"; mtType = Mx2MtConstants.MT_TYPE_292;
}else if(mtType.startsWith("pacs.010")){ } else if (orgMsgNameIdentification.matches("MT10[0-9]{1}")) {
msgType = "204"; mtType = Mx2MtConstants.MT_TYPE_192;
}else if(mtType.matches("/MT10[0-9]{1}/")){ } else if (orgMsgNameIdentification.matches("MT20[0-9]{1}")) {
msgType = mtType.substring(2); mtType = Mx2MtConstants.MT_TYPE_292;
}else if(mtType.matches("/MT20[0-9]{1}/")){
msgType = mtType.substring(2);
}else {
msgType = "202";
} }
} }
if (msgType.startsWith("1")) { return mtType;
return Mx2MtConstants.MT_TYPE_192;
} else if(msgType.startsWith("2")){
return Mx2MtConstants.MT_TYPE_292;
}else {
return "类型错误";
}
} }
} }
...@@ -56,60 +56,25 @@ public class Mx2Mtn96Creator extends AbstractMx2MtCreator { ...@@ -56,60 +56,25 @@ public class Mx2Mtn96Creator extends AbstractMx2MtCreator {
return fieldsGenerateList; return fieldsGenerateList;
} }
public String getMtMsg() {
Document document = (Document)context.get(Mx2MtContextIdentifier.MX_XMl_DOCUMENT, true);
String bodyParentPath = (String)context.get(Mx2MtContextIdentifier.BODY_PARENT_ELEMENT_NAME, true);
String mtType = getXmlNodeValue(bodyParentPath, document, "RsltnOfInvstgtn.CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlMsgNmId");
if(StringUtil.isNotEmpty(mtType)){
if("pacs.008".equals(mtType)){
return "103";
}else if("pacs.003".equals(mtType)){
return "104";
}else if("pacs.009".equals(mtType)){
return "202";
}else if("pacs.010".equals(mtType)){
return "204";
}else if(mtType.matches("/MT10[0-9]{1}/")){
return mtType.substring(2);
}else if(mtType.matches("/MT20[0-9]{1}/")){
return mtType.substring(2);
}else {
return "202";
}
}else {
return "没有找到指定的类型";
}
}
@Override @Override
protected String getMtType() { protected String getMtType() {
Document document = (Document)context.get(Mx2MtContextIdentifier.MX_XMl_DOCUMENT, true); Document document = (Document)context.get(Mx2MtContextIdentifier.MX_XMl_DOCUMENT, true);
String bodyParentPath = (String)context.get(Mx2MtContextIdentifier.BODY_PARENT_ELEMENT_NAME, true); String bodyParentPath = (String)context.get(Mx2MtContextIdentifier.BODY_PARENT_ELEMENT_NAME, true);
String mtType = getXmlNodeValue(bodyParentPath, document, "CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlMsgNmId"); String orgMsgNameIdentification = getXmlNodeValue(bodyParentPath, document, "CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlMsgNmId");
String msgType = ""; String mtType = Mx2MtConstants.MT_TYPE_296;
if(StringUtil.isNotEmpty(mtType)){ if (StringUtil.isNotEmpty(orgMsgNameIdentification)) {
if(mtType.startsWith("pacs.008")){ if (orgMsgNameIdentification.startsWith("pacs.008")
msgType = "103"; || orgMsgNameIdentification.startsWith("pacs.003")) {
}else if(mtType.startsWith("pacs.003")){ mtType = Mx2MtConstants.MT_TYPE_196;
msgType = "104"; } else if (orgMsgNameIdentification.startsWith("pacs.009")
}else if(mtType.startsWith("pacs.009")){ || orgMsgNameIdentification.startsWith("pacs.010")) {
msgType = "202"; mtType = Mx2MtConstants.MT_TYPE_296;
}else if(mtType.startsWith("pacs.010")){ } else if (orgMsgNameIdentification.matches("MT10[0-9]{1}")) {
msgType = "204"; mtType = Mx2MtConstants.MT_TYPE_196;
}else if(mtType.matches("/MT10[0-9]{1}/")){ } else if (orgMsgNameIdentification.matches("MT20[0-9]{1}")) {
msgType = mtType.substring(2); mtType = Mx2MtConstants.MT_TYPE_296;
}else if(mtType.matches("/MT20[0-9]{1}/")){
msgType = mtType.substring(2);
}else {
msgType = "202";
} }
} }
if (msgType.startsWith("1")) { return mtType;
return Mx2MtConstants.MT_TYPE_196;
} else if(msgType.startsWith("2")){
return Mx2MtConstants.MT_TYPE_296;
}else {
return "类型错误";
}
} }
} }
...@@ -47,6 +47,16 @@ public class Test { ...@@ -47,6 +47,16 @@ public class Test {
String maps = SwiftTransfer.mx2Gson(xmlStr); String maps = SwiftTransfer.mx2Gson(xmlStr);
System.out.println(maps); System.out.println(maps);
} }
private static void test942() throws IOException {
String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MXcamt05200108_942.xml"));
String maps = SwiftTransfer.mx2Gson(xmlStr);
System.out.println(maps);
}
private static void test210() throws IOException {
String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05700106.xml"));
String maps = SwiftTransfer.mx2Gson(xmlStr);
System.out.println(maps);
}
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
//test202(); //test202();
...@@ -54,7 +64,9 @@ public class Test { ...@@ -54,7 +64,9 @@ public class Test {
//test196(); //test196();
//test910(); //test910();
//test940(); //test940();
test192(); //test192();
//test942();
test210();
} }
} }
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