Commit a9b1bffa by gechengyang

Merge remote-tracking branch 'origin/ncbgjzf' into ncbgjzf

parents 9365da64 1be338cb
......@@ -65,7 +65,7 @@ public class Element2MxForSSTF {
TEMPLATE_DIR=System.getProperty("java.io.tmpdir");
}
getEnvMap();
readEnvCfg();
}
......@@ -187,8 +187,8 @@ public class Element2MxForSSTF {
Map<String, Object> elementMap = new HashMap<>();
//读取数组字段配置
Map<String, String> atrbutMap = getEnvMaps(CHN+"/saa/body/"+messageType.substring(0,10)+"/atrbut");
Map<String, String> fldtypMap = getEnvMaps(CHN+"/saa/body/"+messageType.substring(0,10)+"/fldtyp");
Map<String, String> atrbutMap = getEnv(CHN+"/saa/body/"+messageType.substring(0,10)+"/atrbut");
Map<String, String> fldtypMap = getEnv(CHN+"/saa/body/"+messageType.substring(0,10)+"/fldtyp");
logger.info("atrbut(ini)---->");
atrbutMap.forEach((k,v)->{
logger.info(" "+k+"-->"+v.toString());
......@@ -287,7 +287,7 @@ public class Element2MxForSSTF {
elementMap.put("uetr", uuid);
}
Map<String,String>envIni=getEnvMaps(CHN+"/saa/body");
Map<String,String>envIni=getEnv(CHN+"/saa/body");
if (StrUtil.isNotEmpty(envIni.getOrDefault("frBic",""))){
elementMap.put("frBic",envIni.get("frBic"));
}
......@@ -310,7 +310,7 @@ public class Element2MxForSSTF {
saaMap.put("MessageIdentifier",msgDefIdr);
String frBic=elementMap.getOrDefault("frBic","").toString();
Map<String,String>envIni=getEnvMaps(CHN+"/saa/header");
Map<String,String>envIni=getEnv(CHN+"/saa/header");
if (StrUtil.isNotEmpty(envIni.getOrDefault("frBic",""))){
frBic=envIni.get("frBic");
}
......@@ -344,7 +344,7 @@ public class Element2MxForSSTF {
*/
private static Map<String, String> getEnvMaps(String path) {
private static Map<String, String> getEnv(String path) {
try{
Map<String, Object> tmpMap=MapUtil.getsMap(ENV_MAP,path);
Map<String, String>secMap=new HashMap<>();
......@@ -353,10 +353,18 @@ public class Element2MxForSSTF {
}catch (Exception e) {
return new HashMap<>();
}
}
private static String getEnvs(String path) {
try{
String tmpS=MapUtil.gets(ENV_MAP,path);
return tmpS;
}catch (Exception e) {
return "";
}
}
private static void getEnvMap() {
private static void readEnvCfg() {
if (CHN ==null) {
Yaml yaml = new Yaml();
Map<String, Object> yamlMap= new HashMap<>();
......@@ -384,7 +392,9 @@ public class Element2MxForSSTF {
String uniqueNumber = UUID.randomUUID().toString().substring(0, 8); // 取UUID的前8个字符
// 构建文件名
String fileName = uniqueNumber + ".xml";
String fileExtension=getEnvs(CHN+"/saa/extension");
fileExtension=StringUtil.isNotEmpty(fileExtension)?fileExtension:"xml";
String fileName = uniqueNumber + "."+fileExtension;
// 定义文件路径(这里使用相对路径,你可以根据需要更改为绝对路径)
String filePath = TEMPLATE_DIR +File.separator+ fileName;
FileUtil.writeString(xmlStr, filePath, StandardCharsets.UTF_8);
......
......@@ -55,7 +55,7 @@ public class Mx2ElementForSSTF {
TEMPLATE_DIR=System.getProperty("java.io.tmpdir");
}
getEnvMap();
readEnvCfg();
}
public static Map<String, Object> mx2MtWithFile(String xmlFileNm) {
......@@ -152,9 +152,9 @@ public class Mx2ElementForSSTF {
String line = "";
//读取数组字段配置ini
Map<String, String> atrbutMap = getEnvMaps(CHN+"/saa/body/"+messageType.substring(0,10)+"/atrbut");
Map<String, String> fldtypMap = getEnvMaps(CHN+"/saa/body/"+messageType.substring(0,10)+"/fldtyp");
Map<String, String> xmltagMap = getEnvMaps(CHN+"/saa/body/"+messageType.substring(0,10)+"/xmltag");
Map<String, String> atrbutMap = getEnv(CHN+"/saa/body/"+messageType.substring(0,10)+"/atrbut");
Map<String, String> fldtypMap = getEnv(CHN+"/saa/body/"+messageType.substring(0,10)+"/fldtyp");
Map<String, String> xmltagMap = getEnv(CHN+"/saa/body/"+messageType.substring(0,10)+"/xmltag");
String key = "";
Object obj = null;
......@@ -237,7 +237,7 @@ public class Mx2ElementForSSTF {
}
private static Map<String, String> getEnvMaps(String path) {
private static Map<String, String> getEnv(String path) {
try{
Map<String, Object> tmpMap=MapUtil.getsMap(ENV_MAP,path);
Map<String, String>secMap=new HashMap<>();
......@@ -246,10 +246,18 @@ public class Mx2ElementForSSTF {
}catch (Exception e) {
return new HashMap<>();
}
}
private static String getEnvs(String path) {
try{
String tmpS=MapUtil.gets(ENV_MAP,path);
return tmpS;
}catch (Exception e) {
return "";
}
}
private static void getEnvMap() {
private static void readEnvCfg() {
if (CHN ==null) {
Yaml yaml = new Yaml();
Map<String, Object> yamlMap= new HashMap<>();
......
......@@ -184,3 +184,4 @@ sstf:
invcee: Invcee
undrlRmtInfStrdTaxRmt: TaxRmt
undrlRmtInfStrdGrnshmtRmt: GrnshmtRmt
extension: mx
\ 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