From d86a37f36ec375f8aa3d3eaee18ea1ad323eba0b Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期五, 26 四月 2024 09:13:04 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
index 15ca9f6..83c2394 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -276,16 +276,16 @@
List<Map<String, Object>> tables = new ArrayList<>();
Set<String> standardMethod = new HashSet<>();
Set<String> deviceSet = new HashSet<>();
- AtomicReference<String> models = new AtomicReference<>("");
+ Set<String> models = new HashSet<>();
AtomicReference<Integer> productSize = new AtomicReference<>(0);
String[] monthNames = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
samples.forEach(a -> {
+ models.add(a.getModel());
Set<String> templateSet = new HashSet<>();
getTemplateThing(set, map2, a);
for (InsProduct b : a.getInsProduct()) {
- models.set(models.get()+b.getModel());
standardMethod.add(b.getMethodS());
- productSize.set(productSize.get()+1);
+ productSize.set(productSize.get() + 1);
if (b.getInsProductResult() != null) {
List<JSONObject> jsonObjects = JSON.parseArray(b.getInsProductResult().getEquipValue(), JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
@@ -509,7 +509,8 @@
String url;
try {
InputStream inputStream = this.getClass().getResourceAsStream("/static/report-template.docx");
- File file = File.createTempFile("temp", ".tmp");OutputStream outputStream = new FileOutputStream(file);
+ File file = File.createTempFile("temp", ".tmp");
+ OutputStream outputStream = new FileOutputStream(file);
IOUtils.copy(inputStream, outputStream);
url = file.getAbsolutePath();
} catch (FileNotFoundException e) {
@@ -539,6 +540,11 @@
} catch (Exception e) {
throw new RuntimeException(e);
}
+ String modelStr = "";
+ for (String model : models) {
+ modelStr += "," + model;
+ }
+ String finalModelStr = modelStr;
ConfigureBuilder builder = Configure.builder();
builder.useSpringEL(true);
XWPFTemplate template = XWPFTemplate.compile(url, builder.build()).render(
@@ -553,19 +559,19 @@
put("standardMethod", standardMethod2);
put("deviceList", deviceList);
put("twoCode", Pictures.ofLocal(codePath).create());
- put("models", models);
+ put("models", finalModelStr.replace(",", ""));
put("productSize", productSize);
put("createTime", now.format(DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�")));
- put("createTimeEn", monthNames[now.getMonthValue()-1]+" "+now.getDayOfMonth()+", "+now.getYear());
+ put("createTimeEn", monthNames[now.getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear());
put("insTime", insOrder.getInsTime().format(DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�")));
- put("insTimeEn", monthNames[insOrder.getInsTime().getMonthValue()-1]+" "+now.getDayOfMonth()+", "+now.getYear());
+ put("insTimeEn", monthNames[insOrder.getInsTime().getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear());
put("writeUrl", null);
put("insUrl", null);
put("examineUrl", null);
put("ratifyUrl", null);
}});
try {
- String name = now.format(DateTimeFormatter.ofPattern("yy_MM_dd&HH_mm_ss")) + ".docx";
+ String name = insReport.getCode().replace("/", "") + ".docx";
template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl + "/" + name)));
insReport.setUrl("/word/" + name);
insReportMapper.insert(insReport);
--
Gitblit v1.9.3