Commit dfd948cf by zhanghou

修改了n92,n96的getMtType方法

parent 3c5e89ee
......@@ -55,36 +55,25 @@ public class Mx2Mtn92Creator extends AbstractMx2MtCreator {
fieldsGenerateList.add(new Field79Generate());
return fieldsGenerateList;
}
@Override
protected String getMtType() {
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, "Undrlyg.TxInf.OrgnlGrpInf.OrgnlMsgNmId");
String msgType = "";
if(StringUtil.isNotEmpty(mtType)){
if(mtType.startsWith("pacs.008")){
msgType = "103";
}else if(mtType.startsWith("pacs.003")){
msgType = "104";
}else if(mtType.startsWith("pacs.009")){
msgType = "202";
}else if(mtType.startsWith("pacs.010")){
msgType = "204";
}else if(mtType.matches("/MT10[0-9]{1}/")){
msgType = mtType.substring(2);
}else if(mtType.matches("/MT20[0-9]{1}/")){
msgType = mtType.substring(2);
}else {
msgType = "202";
String orgMsgNameIdentification = getXmlNodeValue(bodyParentPath, document, "Undrlyg.TxInf.OrgnlGrpInf.OrgnlMsgNmId");
String mtType = Mx2MtConstants.MT_TYPE_292;
if (StringUtil.isNotEmpty(orgMsgNameIdentification)) {
if (orgMsgNameIdentification.startsWith("pacs.008")
|| orgMsgNameIdentification.startsWith("pacs.003")) {
mtType = Mx2MtConstants.MT_TYPE_192;
} else if (orgMsgNameIdentification.startsWith("pacs.009")
|| orgMsgNameIdentification.startsWith("pacs.010")) {
mtType = Mx2MtConstants.MT_TYPE_292;
} else if (orgMsgNameIdentification.matches("MT10[0-9]{1}")) {
mtType = Mx2MtConstants.MT_TYPE_192;
} else if (orgMsgNameIdentification.matches("MT20[0-9]{1}")) {
mtType = Mx2MtConstants.MT_TYPE_292;
}
}
if (msgType.startsWith("1")) {
return Mx2MtConstants.MT_TYPE_192;
} else if(msgType.startsWith("2")){
return Mx2MtConstants.MT_TYPE_292;
}else {
return "类型错误";
}
return mtType;
}
}
......@@ -56,60 +56,25 @@ public class Mx2Mtn96Creator extends AbstractMx2MtCreator {
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
protected String getMtType() {
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, "CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlMsgNmId");
String msgType = "";
if(StringUtil.isNotEmpty(mtType)){
if(mtType.startsWith("pacs.008")){
msgType = "103";
}else if(mtType.startsWith("pacs.003")){
msgType = "104";
}else if(mtType.startsWith("pacs.009")){
msgType = "202";
}else if(mtType.startsWith("pacs.010")){
msgType = "204";
}else if(mtType.matches("/MT10[0-9]{1}/")){
msgType = mtType.substring(2);
}else if(mtType.matches("/MT20[0-9]{1}/")){
msgType = mtType.substring(2);
}else {
msgType = "202";
String orgMsgNameIdentification = getXmlNodeValue(bodyParentPath, document, "CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlMsgNmId");
String mtType = Mx2MtConstants.MT_TYPE_296;
if (StringUtil.isNotEmpty(orgMsgNameIdentification)) {
if (orgMsgNameIdentification.startsWith("pacs.008")
|| orgMsgNameIdentification.startsWith("pacs.003")) {
mtType = Mx2MtConstants.MT_TYPE_196;
} else if (orgMsgNameIdentification.startsWith("pacs.009")
|| orgMsgNameIdentification.startsWith("pacs.010")) {
mtType = Mx2MtConstants.MT_TYPE_296;
} else if (orgMsgNameIdentification.matches("MT10[0-9]{1}")) {
mtType = Mx2MtConstants.MT_TYPE_196;
} else if (orgMsgNameIdentification.matches("MT20[0-9]{1}")) {
mtType = Mx2MtConstants.MT_TYPE_296;
}
}
if (msgType.startsWith("1")) {
return Mx2MtConstants.MT_TYPE_196;
} else if(msgType.startsWith("2")){
return Mx2MtConstants.MT_TYPE_296;
}else {
return "类型错误";
}
return mtType;
}
}
......@@ -47,6 +47,16 @@ public class Test {
String maps = SwiftTransfer.mx2Gson(xmlStr);
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 {
//test202();
......@@ -54,7 +64,9 @@ public class Test {
//test196();
//test910();
//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