ccjgmwz 3 سال پیش
والد
کامیت
f6a7ccb113

+ 7 - 3
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/util/XmlUtil.java

@@ -66,13 +66,16 @@ public class XmlUtil implements InitializingBean {
         Document document;
         try {
             document = DocumentHelper.parseText(str);
+            document.setXMLEncoding("gb2312");
+            document.asXML();
 //            document = saxReader.read(new ByteArrayInputStream(str.getBytes("UTF-8")));
             OutputFormat format = OutputFormat.createPrettyPrint();
+            format.setEncoding("gbk");
 //            File file = new File(new String(("templates" + File.separator + name + ".xml").getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8));
 //            if (!file.exists()) {
 //                boolean flag = file.mkdirs();
 //            }
-            Path path = FileSystems.getDefault().getPath(new File(new String(("templates" + File.separator + name + ".xml").getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8)).getAbsoluteFile().getPath());
+            Path path = FileSystems.getDefault().getPath(new File("templates" + File.separator + name + ".xml").getAbsoluteFile().getPath());
             File file = new File(String.valueOf(path));
             /** 将document中的内容写入文件中 */
             XMLWriter writer = new XMLWriter(new FileWriter(file), format);
@@ -94,6 +97,7 @@ public class XmlUtil implements InitializingBean {
         String regEx = "[^0-9]";
         Pattern p = Pattern.compile(regEx);
         Matcher m = p.matcher(paymentManagement.getPaymentNo());
+        String number = m.replaceAll("").trim();
         String s = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
                 "\n" +
                 "<Kp>\n" +
@@ -111,11 +115,11 @@ public class XmlUtil implements InitializingBean {
                 "\n" +
                 "<Fp>\n" +
                 "\n" +
-                "<Djh>" + m.replaceAll("").trim() + "</Djh>\n" +
+                "<Djh>" + number.substring(4) + "</Djh>\n" +
                 "\n" +
                 "<Gfmc>" + paymentManagement.getIdentityAuthenticationInfo().getCustomerName() + "</Gfmc>\n" +
                 "\n" +
-                "<Gfsh>" + paymentManagement.getIdentityAuthenticationInfo().getCustomerName() + "</Gfsh>\n" +
+                "<Gfsh>" + paymentManagement.getIdentityAuthenticationInfo().getCustomerNumberCard() + "</Gfsh>\n" +
                 "\n" +
                 "<Gfyhzh>" + paymentManagement.getIdentityAuthenticationInfo().getBankDeposit()+paymentManagement.getIdentityAuthenticationInfo().getBankCard() + "</Gfyhzh>\n" +
                 "\n" +