value
2024-04-25 c623c05868d94854e31652181570537a6493a7eb
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年MM月dd日")));
                        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年MM月dd日")));
                        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);