| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.lang.Console; |
| | | import cn.hutool.core.lang.UUID; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | |
| | | JSONObject jo = JSON.parseObject(JSON.toJSONString(v)); |
| | | InsProduct insProduct = new InsProduct(); |
| | | insProduct.setId(Integer.parseInt(k)); |
| | | InsProductResult result = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId())); |
| | | if (BeanUtil.isEmpty(result)) { |
| | | result = new InsProductResult(); |
| | | List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId())); |
| | | InsProductResult result; |
| | | if (CollectionUtils.isEmpty(results)) { |
| | | result = new InsProductResult(); |
| | | } else { |
| | | result = results.get(0); |
| | | } |
| | | result.setInsProductId(Integer.parseInt(k)); |
| | | if (jo.get("insValue") != null) { |
| | |
| | | } |
| | | templateSet.add(JSON.toJSONString(b.getTemplate())); |
| | | } |
| | | AtomicInteger index = new AtomicInteger(); |
| | | Set<String> itemSet = new HashSet<>(); |
| | | templateSet.forEach(tem -> { |
| | | AtomicInteger index = new AtomicInteger(); |
| | | Set<Integer> set2 = new HashSet<>(); |
| | | List<RowRenderData> rows = new ArrayList<>(); |
| | | List<TextRenderData> text = new ArrayList<>(); |
| | |
| | | if (p != null && v.get("ps") != null) { |
| | | String value = JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + ""; |
| | | if (value.equals("要求值")) { |
| | | textRenderData.setText(p.getAsk()); |
| | | textRenderData.setText(ObjectUtils.isNotEmpty(p.getTell()) ? p.getTell() : ""); |
| | | } else if (value.equals("单位")) { |
| | | textRenderData.setText(p.getUnit()); |
| | | } else if (value.equals("结论")) { |
| | |
| | | break; |
| | | } |
| | | } else if (value.equals("序号")) { |
| | | index.getAndIncrement(); |
| | | if(itemSet.add(p.getInspectionItem())){ |
| | | index.getAndIncrement(); |
| | | } |
| | | textRenderData.setText(index + ""); |
| | | } else if (value.equals("计算值")) { |
| | | JSONArray jsonArray = JSON.parseArray(p.getInsProductResult().getComValue()); |
| | |
| | | textRenderData.setText(a.getSample()); |
| | | } else if (value.equals("试验方法")) { |
| | | textRenderData.setText(p.getMethodS()); |
| | | } else if (value.equals("检验项")) { |
| | | textRenderData.setText(p.getInspectionItem() + "\n" + p.getInspectionItemEn()); |
| | | } else if (value.equals("检验子项")) { |
| | | if (ObjectUtils.isEmpty(p.getInspectionItemSubclassEn())) { |
| | | textRenderData.setText(p.getInspectionItemSubclass()); |
| | | } else { |
| | | textRenderData.setText(p.getInspectionItemSubclass() + "\n" + p.getInspectionItemSubclassEn()); |
| | | } |
| | | } else { |
| | | textRenderData.setText(v.get("v") == null ? "" : v.get("v") + ""); |
| | | } |
| | |
| | | } catch (Exception e) { |
| | | throw new ErrorException("找不到检验人的签名"); |
| | | } |
| | | Custom custom = customMapper.selectById(user.get("company")); |
| | | //Custom custom = customMapper.selectById(user.get("company")); |
| | | Custom custom = customMapper.selectById(insOrder.getCompanyId()); |
| | | if (!resultCh.get().equals("")) { |
| | | resultCh.set("依据委托要求," + resultCh.get().replaceFirst("、", "") + "等所检项目不符合要求,其余所检项目均符合要求。"); |
| | | resultEn.set("According to commissioned requirements," + resultEn.get().replaceFirst("、", "") + " these inspected items do not meet the requirements, all other inspected items meet the requirements."); |
| | |
| | | cells.add(cellRenderData); |
| | | } else if (j == 1) { |
| | | //第二列 |
| | | textRenderData.setText("光纤色标\tScanning Number∑101"); |
| | | textRenderData.setText("光纤色标\nScanning Number∑101"); |
| | | renderData.add(textRenderData); |
| | | paragraphRenderData.setContents(renderData); |
| | | paragraphRenderDataList.add(paragraphRenderData); |
| | |
| | | if (insProducts1.get((int) (j - 2)).getInspectionItemSubclass().equals("") || insProducts1.get((int) (j - 2)).getInspectionItemSubclass() == null) { |
| | | textRenderData.setText(insProducts1.get((int) (j - 2)).getInspectionItem() + "\n" + insProducts1.get((int) (j - 2)).getInspectionItemEn() + "∑" + (j + 101)); |
| | | } else { |
| | | textRenderData.setText(insProducts1.get((int) (j - 2)).getInspectionItemSubclass() + "\n" + insProducts1.get((int) (j - 2)).getInspectionItemSubclassEn()); |
| | | textRenderData.setText(insProducts1.get((int) (j - 2)).getInspectionItemSubclass() + "\n\n" + insProducts1.get((int) (j - 2)).getInspectionItemSubclassEn()); |
| | | } |
| | | renderData.add(textRenderData); |
| | | paragraphRenderData.setContents(renderData); |
| | |
| | | if (CollectionUtils.isNotEmpty(insOrderFiles)) { |
| | | insOrderFiles.forEach(insOrderFile -> { |
| | | Map<String, Object> image = new HashMap<>(); |
| | | PictureRenderData pictureRenderData = Pictures.ofLocal(imgUrl + "/" + insOrderFile.getFileUrl()).sizeInCm(17,20).create(); |
| | | PictureRenderData pictureRenderData = Pictures.ofLocal(imgUrl + "/" + insOrderFile.getFileUrl()).sizeInCm(17, 20).create(); |
| | | image.put("url", pictureRenderData); |
| | | image.put("report", insReport); |
| | | images.add(image); |
| | | }); |
| | | } |
| | | //委托人和电话字段判断 |
| | | if (ObjectUtils.isEmpty(insOrder.getPrepareUser())) { |
| | | insOrder.setPrepareUser("/"); |
| | | } |
| | | if (ObjectUtils.isEmpty(insOrder.getPhone())) { |
| | | insOrder.setPhone("/"); |
| | | } |
| | | |
| | | XWPFTemplate template = XWPFTemplate.compile(url, builder.build()).render( |
| | | new HashMap<String, Object>() {{ |
| | | put("order", insOrder); |
| | | put("report", insReport); |
| | | put("user", user); |
| | | //put("user", user); |
| | | put("custom", custom); |
| | | put("sampleSize", samples.size()); |
| | | put("tables", tables); |