|
@@ -70,7 +70,7 @@ public class XmlUtil implements InitializingBean {
|
|
|
document.asXML();
|
|
|
// document = saxReader.read(new ByteArrayInputStream(str.getBytes("UTF-8")));
|
|
|
OutputFormat format = OutputFormat.createPrettyPrint();
|
|
|
- format.setEncoding("gbk");
|
|
|
+ format.setEncoding("gb2312");
|
|
|
// 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();
|
|
@@ -78,10 +78,14 @@ public class XmlUtil implements InitializingBean {
|
|
|
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);
|
|
|
+ OutputStream out = new FileOutputStream(file);
|
|
|
+ Writer wr = new OutputStreamWriter(out,"gb2312");
|
|
|
+ XMLWriter writer = new XMLWriter(wr, format);
|
|
|
FileInputStream fileInputStream = new FileInputStream(String.valueOf(path));
|
|
|
writer.write(document);
|
|
|
writer.close();
|
|
|
+ out.close();
|
|
|
+ wr.close();
|
|
|
MultipartFile multipartFile = new MockMultipartFile(ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
|
|
|
String returnFile = upload(multipartFile, name);
|
|
|
file.delete();
|
|
@@ -98,6 +102,9 @@ public class XmlUtil implements InitializingBean {
|
|
|
Pattern p = Pattern.compile(regEx);
|
|
|
Matcher m = p.matcher(paymentManagement.getPaymentNo());
|
|
|
String number = m.replaceAll("").trim();
|
|
|
+ if(paymentManagement.getGoodsName().equals("玉米(潮粮)")){
|
|
|
+ paymentManagement.setGoodsName("玉米");
|
|
|
+ }
|
|
|
String s = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
|
|
|
"\n" +
|
|
|
"<Kp>\n" +
|
|
@@ -145,7 +152,7 @@ public class XmlUtil implements InitializingBean {
|
|
|
"\n" +
|
|
|
"<Spmc>" + paymentManagement.getGoodsName() + "</Spmc>\n" +
|
|
|
"\n" +
|
|
|
- "<Ggxh>" + paymentManagement.getGoodsName() + "</Ggxh>\n" +
|
|
|
+ "<Ggxh>" + paymentManagement.getGrade() + "</Ggxh>\n" +
|
|
|
"\n" +
|
|
|
"<Jldw>公斤</Jldw>\n" +
|
|
|
"\n" +
|