cnas-server/src/main/java/com/yuanchu/mom/pojo/Seal.java
@@ -39,6 +39,7 @@ @TableField(fill = FieldFill.INSERT) private Integer createUser; @TableField(fill = FieldFill.INSERT) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime createTime; } inspect-server/src/main/java/com/yuanchu/mom/dto/SampleOrderDto.java
@@ -14,19 +14,21 @@ @Data public class SampleOrderDto extends InsOrder { @ValueTableShow(5) @ApiModelProperty("检验对象") private String sampleType; @ValueTableShow(6) @ValueTableShow(3) @ApiModelProperty("样品名称") private String sampleName; @ValueTableShow(6) @ValueTableShow(4) @ApiModelProperty("样品型号") private String sampleModel; @ValueTableShow(6) @ValueTableShow(5) @ApiModelProperty("样品数量") private Integer sampleNum; @ApiModelProperty("样品编号") private String sampleCode; inspect-server/src/main/java/com/yuanchu/mom/mapper/InsOrderMapper.java
@@ -40,6 +40,8 @@ Long getCount(String inspectionItems, String orderNumber); String getEnumLabelByValue(String value); String getStandardMethodCode(Integer id); } inspect-server/src/main/java/com/yuanchu/mom/mapper/InsReportMapper.java
@@ -1,12 +1,10 @@ package com.yuanchu.mom.mapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.yuanchu.mom.dto.ReportPageDto; import com.yuanchu.mom.dto.SampleOrderDto; import com.yuanchu.mom.pojo.InsOrder; import com.yuanchu.mom.pojo.InsReport; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * @author Administrator @@ -18,6 +16,8 @@ IPage<ReportPageDto> pageInsReport(IPage<ReportPageDto> page, QueryWrapper<ReportPageDto> ew); String getLaboratoryByName(String name); } inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java
@@ -28,13 +28,12 @@ /** * 委托编号 */ @ValueTableShow(2) @ValueTableShow(1) @Size(max= 255,message="编码长度不能超过255") @ApiModelProperty(value = "委托编号") @Length(max= 255,message="编码长度不能超过255") private String entrustCode; @ValueTableShow(2) @Size(max= 255,message="编码长度不能超过255") @ApiModelProperty(value = "检验类别") @Length(max= 255,message="编码长度不能超过255") @@ -43,22 +42,21 @@ /** * 下单客户 */ @ValueTableShow(3) @ValueTableShow(5) @Size(max= 255,message="编码长度不能超过255") @ApiModelProperty("委托客户") @ApiModelProperty("委托人") @Length(max= 255,message="编码长度不能超过255") private String custom; /** * 下单单位 */ @ValueTableShow(4) @ValueTableShow(2) @Size(max= 255,message="编码长度不能超过255") @ApiModelProperty("委托单位") @Length(max= 255,message="编码长度不能超过255") private String company; @ValueTableShow(4) @Size(max= 255,message="编码长度不能超过255") @ApiModelProperty("联系方式") @Length(max= 255,message="编码长度不能超过255") @@ -88,15 +86,12 @@ @JsonFormat(pattern = "yyyy-MM-dd") private LocalDate appointed; // @ValueTableShow(7) @ApiModelProperty("检验结果") private Integer insResult; @ValueTableShow(7) @ApiModelProperty("样品处理方式") private Integer processing; @ValueTableShow(7) @ApiModelProperty("是否留样") private Integer isLeave; @@ -109,7 +104,7 @@ /** * 备注 */ @ValueTableShow(9) @ValueTableShow(6) @Size(max= 255,message="编码长度不能超过255") @ApiModelProperty("备注") @Length(max= 255,message="编码长度不能超过255") @@ -191,10 +186,8 @@ @ValueTableShow(value = 14, name = "退回理由") private String tell; @ValueTableShow(value = 15, name = "报告发送方式") private Integer send; @ValueTableShow(value = 16, name = "来样方式") private String formType; @ApiModelProperty("审核时间") inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -98,6 +98,12 @@ @Resource private InformationNotificationService informationNotificationService; @Resource private UserMapper userMapper; @Value("${file.path}") private String imgUrl; @Override public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { Map<String, Object> map = new HashMap<>(); @@ -295,7 +301,6 @@ Map<String, String> user = insProductMapper.selectUserById(insOrder.getUserId()); List<SampleProductDto> samples = insSampleMapper.selectSampleProductListByOrderId(orderId); InsReport insReport = new InsReport(); // insReport.setCode(giveCode.giveCode("JCZX/TX-", "ins_report", "-", "yyMMdd")); insReport.setCode(insOrder.getEntrustCode()); insReport.setInsOrderId(orderId); Set<Integer> set = new HashSet<>(); @@ -308,10 +313,10 @@ String[] monthNames = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; samples.forEach(a -> { models.add(a.getModel()); standardMethod.add(baseMapper.getStandardMethodCode(a.getStandardMethodListId())); Set<String> templateSet = new HashSet<>(); getTemplateThing(set, map2, a); for (InsProduct b : a.getInsProduct()) { standardMethod.add(b.getMethodS()); productSize.set(productSize.get() + 1); if (b.getInsProductResult() != null) { List<JSONObject> jsonObjects = JSON.parseArray(b.getInsProductResult().getEquipValue(), JSONObject.class); @@ -320,6 +325,9 @@ deviceSet.add(jsonObject.get("v") + ""); } } } if(b.getTemplate()==null){ continue; } if (b.getTemplate().size() == 0) { continue; @@ -365,10 +373,15 @@ Set<String> delRSet = new HashSet<>(); for (JSONObject jo1 : temp) { JSONObject v = JSON.parseObject(JSON.toJSONString(jo1.get("v"))); if(Integer.parseInt(jo1.get("c")+"") > 9){ delSet.add(jo1.get("c") + ""); continue; } if (v.get("ps") != null) { int count3 = 0; String str = ""; if ("检验值".equals(JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + "") || "设备名称".equals(JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + "") || "设备编码".equals(JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + "")) { String s = JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + ""; if ("检验值".equals(s) || "设备名称".equals(s) || "设备编码".equals(s) || "试验方法".equals(s) || "检测方法".equals(s)) { delSet.add(jo1.get("c") + ""); continue; } @@ -513,22 +526,11 @@ } TableRenderData tableRenderData = new TableRenderData(); tableRenderData.setRows(rows); System.out.println(rows.size()); TableStyle tableStyle = new TableStyle(); /*JSONObject styleJo = JSON.parseObject(JSON.toJSONString(b.getStyle().get("columnlen"))); List<Integer> colLen = new ArrayList<>(); int colSize = rows.get(0).getCells().size(); int colOne = Integer.parseInt(b.getTemplate().get(0).get("r") + ""); for (int i = colOne; i < colSize + colOne; i++) { if (styleJo.get(i + "") == null) { colLen.add(pxToCm(100)); } else { int i1 = Integer.parseInt(styleJo.get(i + "") + ""); colLen.add(pxToCm(i1)); } }*/ // tableStyle.setColWidths(ArrayUtils.toPrimitive(colLen.toArray(new Integer[0]))); tableStyle.setColWidths(new int[]{650,1600,2000,750,2800,1100,1100}); tableStyle.setWidth("10000"); tableStyle.setAlign(TableRowAlign.CENTER); tableStyle.setWidth(XWPFTable.DEFAULT_PERCENTAGE_WIDTH); BorderStyle borderStyle = new BorderStyle(); borderStyle.setColor("000000"); borderStyle.setType(XWPFTable.XWPFBorderType.THICK); @@ -590,6 +592,13 @@ ConfigureBuilder builder = Configure.builder(); builder.useSpringEL(true); List<Map<String, String>> finalDeviceList = deviceList; Integer userId = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery().eq(InsSampleUser::getInsSampleId, orderId).orderByDesc(InsSampleUser::getCreateTime).last("limit 1")).getUserId(); String signatureUrl; try { signatureUrl = userMapper.selectById(userId).getSignatureUrl(); }catch (Exception e){ throw new ErrorException("找不到检验人的签名"); } XWPFTemplate template = XWPFTemplate.compile(url, builder.build()).render( new HashMap<String, Object>() {{ put("order", insOrder); @@ -608,20 +617,21 @@ put("insTime", insOrder.getInsTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"))); put("insTimeEn", monthNames[insOrder.getInsTime().getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear()); put("writeUrl", null); put("insUrl", null); put("insUrl", Pictures.ofLocal(imgUrl+"/"+signatureUrl).create()); put("examineUrl", null); put("ratifyUrl", null); put("sampleEn", sampleEn); put("orderType", orderType); put("getTime", insOrder.getExamineTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"))); put("getTimeEn", monthNames[insOrder.getExamineTime().getMonthValue() - 1] + " " + insOrder.getExamineTime().getDayOfMonth() + ", " + insOrder.getExamineTime().getYear()); put("seal1", null); put("seal2", null); }}); try { String name = insReport.getCode().replace("/", "") + ".docx"; template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl + "/" + name))); insReport.setUrl("/word/" + name); insReportMapper.insert(insReport); // insOrder.setState(4); insOrder.setInsState(5); insOrderMapper.updateById(insOrder); } catch (IOException e) { @@ -698,10 +708,12 @@ product.setTemplate(new ArrayList<>()); continue; } String thing = null; if (product.getTemplateId() != null && set.add(product.getTemplateId())) { map2.put(product.getTemplateId(), standardTemplateService.getStandTempThingById(product.getTemplateId()) + ""); thing = map2.get(product.getTemplateId()); } String thing = map2.get(product.getTemplateId()); // thing = map2.get(product.getTemplateId()); if (StrUtil.isNotEmpty(thing)) { JSONObject sheet = JSON.parseObject(JSON.toJSONString(JSON.parseArray(JSON.toJSONString(JSON.parseObject(thing).get("data"))).get(0))); JSONObject config = JSON.parseObject(JSON.toJSONString(sheet.get("config"))); @@ -740,7 +752,7 @@ info.setViewStatus(false); info.setJumpPath("b1-inspect-order-plan"); informationNotificationService.addInformationNotification(info); upPlanUser(userId, orderId); upPlanUser(verifyUser, orderId); return 1; } inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java
@@ -95,7 +95,12 @@ insReport.setWriteUserId(getLook.selectPowerByMethodAndUserId(null).get("userId"));//提交人 insReport.setWriteTime(LocalDateTime.now());//提交时间 //获取提交人的签名地址 String signatureUrl = userMapper.selectById(insReport.getWriteUserId()).getSignatureUrl(); String signatureUrl; try { signatureUrl = userMapper.selectById(insReport.getWriteUserId()).getSignatureUrl(); }catch (Exception e){ throw new ErrorException("找不到编制人的签名"); } //系统生成报告地址 String url = insReport.getUrl(); //手动上传报告地址 @@ -122,7 +127,12 @@ return insReportMapper.updateById(insReport); } //获取审核人的签名地址 String signatureUrl = userMapper.selectById(insReport.getExamineUserId()).getSignatureUrl(); String signatureUrl; try { signatureUrl = userMapper.selectById(insReport.getExamineUserId()).getSignatureUrl(); }catch (Exception e){ throw new ErrorException("找不到审核人的签名"); } //系统生成报告地址 String url = insReport.getUrl(); //手动上传报告地址 @@ -149,14 +159,28 @@ insReport.setState(0);//提交状态改为待提交 return insReportMapper.updateById(insReport); } //获取审核人的签名地址 String signatureUrl = userMapper.selectById(insReport.getRatifyUserId()).getSignatureUrl(); //获取批准人的签名地址 String signatureUrl; try { signatureUrl = userMapper.selectById(insReport.getRatifyUserId()).getSignatureUrl(); }catch (Exception e){ throw new ErrorException("找不到批准人的签名"); } String sealUrl; try { String laboratory = insOrderMapper.selectById(insReport.getInsOrderId()).getLaboratory(); sealUrl = insReportMapper.getLaboratoryByName(laboratory); }catch (Exception e){ throw new ErrorException("找不到报告章印"); } //系统生成报告地址 String url = insReport.getUrl(); //手动上传报告地址 String urlS = insReport.getUrlS(); wordInsertUrl(new HashMap<String, Object>(){{ put("ratifyUrl", Pictures.ofLocal(imgUrl+"/"+signatureUrl).create()); put("seal1", Pictures.ofLocal(imgUrl+"/"+sealUrl).create()); put("seal2", Pictures.ofLocal(imgUrl+"/"+sealUrl).create()); }}, (urlS==null?url:urlS).replace("/word", wordUrl)); wordToPdf((urlS == null ? url : urlS).replace("/word", wordUrl)); InsOrder insOrder = new InsOrder(); inspect-server/src/main/java/com/yuanchu/mom/vo/InsOrderPlanVO.java
@@ -13,7 +13,7 @@ @ValueTableShow(value = 1,name = "委托编号") private String entrustCode; @ValueTableShow(value = 2,name = "样品类型") @ValueTableShow(value = 2,name = "检验对象") private String sampleType; @ValueTableShow(value = 4,name = "紧急程度") inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -95,9 +95,11 @@ ir.id report_id, ir.url, ir.url_s, concat(ROUND((select count(*) from ins_sample isa2 where ins_state = 5 and isa2.ins_order_id = io.id) / (select count(*) from ins_sample isa2 where isa2.ins_order_id = io.id) * 100, 2), '%') insProgress, (select count(*) from ins_sample isa2 where isa2.ins_order_id = io.id) sample_num, concat(ROUND((select count(*) from ins_order_state ios where ins_state = 5 and ios.ins_order_id = io.id) / (select count(*) from ins_order_state ios2 where ios2.ins_order_id = io.id) * 100, 2), '%') insProgress, group_concat(distinct isa.sample_code,' ') sample_code, group_concat(distinct isa.sample,' ') sample_name, group_concat(distinct isa.model,' ') sample_model @@ -152,9 +154,10 @@ ins_order i LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id LEFT JOIN `user` u ON u.id = i.user_id LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id,GROUP_CONCAT(b.inspection_item LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id,GROUP_CONCAT(b.inspection_item2 SEPARATOR ',') inspection_item from (select * from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP inspection_item from (select *,GROUP_CONCAT(inspection_item SEPARATOR ',') inspection_item2 from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP BY b.ins_sample_id) c ON c.ins_sample_id = isa.id ) a <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> @@ -238,4 +241,8 @@ select label from `center-lims`.enums where value = #{value} </select> <select id="getStandardMethodCode" resultType="java.lang.String"> select code from `center-lims`.standard_method where id = #{id} </select> </mapper> inspect-server/src/main/resources/mapper/InsReportMapper.xml
@@ -34,4 +34,12 @@ ${ew.customSqlSegment} </if> </select> <select id="getLaboratoryByName" resultType="java.lang.String"> select s.address from `center-lims`.seal s left join `center-lims`.laboratory l on s.lab_id = l.id where l.laboratory_name = #{name} and s.type = '报告类型' order by l.create_time desc limit 1 </select> </mapper> inspect-server/src/main/resources/static/report-template.docxBinary files differ
inspect-server/src/main/resources/static/template-table.docxBinary files differ