cnas-process/src/main/java/com/ruoyi/process/controller/ProcessComplainController.java
@@ -48,7 +48,7 @@ } @ApiOperation(value = "投诉详情") @PostMapping("/getProcessComplain") @GetMapping("/getProcessComplain") public Result getProcessComplain(Long id) { return Result.success(processComplainService.getProcessComplain(id)); } cnas-process/src/main/java/com/ruoyi/process/controller/ProcessDealController.java
@@ -29,7 +29,7 @@ private ProcessDealService processDealService; @ApiOperation(value = "查询检测或校准物品的处置详情") @PostMapping("/pageProcessDeal") @GetMapping("/pageProcessDeal") public Result pageProcessDeal(ProcessDeal processDeal, Page page) throws Exception { return Result.success(processDealService.pageProcessDeal(page, processDeal)); } @@ -53,7 +53,7 @@ } @ApiOperation(value = "查看检测或校准物品的处置") @PostMapping("/getProcessDeal") @GetMapping("/getProcessDeal") public Result getProcessDeal(Integer id) { return Result.success(processDealService.getById(id)); } cnas-process/src/main/java/com/ruoyi/process/controller/ProcessMethodSearchNewController.java
@@ -78,7 +78,7 @@ * @return */ @ApiOperation(value = "导入标准查新") @GetMapping("/importMethodSearchNew") @PostMapping("/importMethodSearchNew") public Result importMethodSearchNew(MultipartFile file){ return Result.success(processMethodSearchNewService.importMethodSearchNew(file)); } cnas-process/src/main/java/com/ruoyi/process/controller/ProcessMethodVerifyController.java
@@ -47,7 +47,7 @@ * @return */ @ApiOperation(value = "标准方法更新验证列表") @PostMapping("/pagesMethodVerify") @GetMapping("/pagesMethodVerify") public Result<IPage<ProcessMethodVerify>> pagesMethodVerify(ProcessMethodVerifyDto methodVerifyDto,Page page) throws Exception { return Result.success(processMethodVerifyService.pagesMethodVerify(page, methodVerifyDto)); } cnas-process/src/main/java/com/ruoyi/process/controller/ProcessReportController.java
@@ -7,10 +7,7 @@ import com.ruoyi.process.service.ProcessReportService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Map; @@ -32,7 +29,7 @@ private ProcessReportService processReportService; @ApiOperation(value = "查询检验报告发放登记列表") @PostMapping("/pageProcessReport") @GetMapping("/pageProcessReport") public Result pageProcessReport(ProcessReport processReport , Page page) throws Exception { return Result.success(processReportService.pageProcessReport(page, processReport)); } @@ -44,13 +41,13 @@ } @ApiOperation(value = "删除检验报告发放登记") @PostMapping("/delProcessReport") @DeleteMapping("/delProcessReport") public Result delProcessReport(Long id) { return Result.success(processReportService.removeById(id)); } @ApiOperation(value = "查看检验报告发放登记详情") @PostMapping("/getProcessReport") @GetMapping("/getProcessReport") public Result getProcessReport(Long id) { return Result.success(processReportService.getById(id)); } cnas-process/src/main/java/com/ruoyi/process/controller/ProcessTotalSampleController.java
@@ -35,19 +35,24 @@ @ApiOperation(value = "提交样品接收") @PostMapping("/submitProcessTotalSample") public Result submitProcessTotalSample(Integer id) { public Result submitProcessTotalSample(@RequestBody Map<String, Object> param) { Integer id = (Integer) param.get("id"); return Result.success(processTotalSampleService.submitProcessTotalSample(id)); } @ApiOperation(value = "审核样品接收") @PostMapping("/checkProcessTotalSample") public Result checkProcessTotalSample(Integer id, String state) { public Result checkProcessTotalSample(@RequestBody Map<String, Object> param) { Integer id = (Integer) param.get("id"); String state = (String) param.get("state"); return Result.success(processTotalSampleService.checkProcessTotalSample(id, state)); } @ApiOperation(value = "批准样品接收") @PostMapping("/ratifyProcessTotalSample") public Result ratifyProcessTotalSample(Integer id,String state) { public Result ratifyProcessTotalSample(@RequestBody Map<String, Object> param) { Integer id = (Integer) param.get("id"); String state = (String) param.get("state"); return Result.success(processTotalSampleService.ratifyProcessTotalSample(id,state)); } cnas-process/src/main/java/com/ruoyi/process/controller/ProcessTotaldealController.java
@@ -35,19 +35,24 @@ @ApiOperation(value = "提交检测或校准物品的处置") @PostMapping("/submitProcessTotaldeal") public Result submitProcessTotaldeal(Integer id) { public Result submitProcessTotaldeal(@RequestBody Map<String, Integer> param) { Integer id = param.get("id"); return Result.success(processTotaldealService.submitProcessTotaldeal(id)); } @ApiOperation(value = "审核检测或校准物品的处置") @PostMapping("/checkProcessTotaldeal") public Result checkProcessTotaldeal(Integer id, String state) { public Result checkProcessTotaldeal(@RequestBody Map<String, Object> param) { Integer id = (Integer) param.get("id"); String state = (String) param.get("state"); return Result.success(processTotaldealService.checkProcessTotaldeal(id, state)); } @ApiOperation(value = "批准检测或校准物品的处置") @PostMapping("/ratifyProcessTotaldeal") public Result ratifyProcessTotaldeal(Integer id,String state) { public Result ratifyProcessTotaldeal(@RequestBody Map<String, Object> param) { Integer id = (Integer) param.get("id"); String state = (String) param.get("state"); return Result.success(processTotaldealService.ratifyProcessTotaldeal(id,state)); } cnas-process/src/main/java/com/ruoyi/process/mapper/ProcessReportMapper.java
@@ -21,5 +21,5 @@ IPage<ProcessReport> pageProcessReport(Page page, @Param("ew") QueryWrapper<ProcessReport> queryWrappers); List<ProcessReport> getIds(List<Integer> ids); List<ProcessReport> getIds(@Param("ids") List<Integer> ids); } inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java
@@ -38,7 +38,7 @@ List<CostStatisticsDto> selectCostStatistics2(@Param("ew") QueryWrapper<CostStatisticsDto> ew); List<Map<String, String>> selectDeviceList(@Param("names") Set<String> names); List<Map<String, String>> selectDeviceList(@Param("managementNumbers") Set<String> managementNumbers); List<SampleDefectsFatherVo> selectSampleDefects(Page page, @Param("inspectionItems") String inspectionItems, @Param("orderNumber") String orderNumber); Long getCount(@Param("inspectionItems") String inspectionItems, @Param("orderNumber") String orderNumber); inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -42,6 +42,7 @@ import com.ruoyi.inspect.mapper.*; import com.ruoyi.inspect.pojo.*; import com.ruoyi.inspect.service.*; import com.ruoyi.inspect.util.HackLoopTableRenderPolicy; import com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo; import com.ruoyi.inspect.vo.InsOrderPlanVO; import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper; @@ -1880,6 +1881,8 @@ put("seal1", null); }}); try { // 修改换行和合并问题 updaeMerge(template.getXWPFDocument(), true); String name = insReport.getCode().replace("/", "") + "-J.docx"; template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl + "/" + name))); insReport.setUrl("/word/" + name); @@ -1894,8 +1897,6 @@ } catch (IOException e) { throw new RuntimeException(e); } // 修改换行和合并问题 updaeMerge(insReport, null, true); } /** @@ -2263,10 +2264,19 @@ tables.forEach(table -> { table.put("tableSize", tables.size() + 1); }); // 设备信息 List<Map<String, String>> deviceList = null; if (deviceSet.size() != 0) { if (CollectionUtils.isNotEmpty(deviceSet)) { deviceList = insOrderMapper.selectDeviceList(deviceSet); } if (CollectionUtils.isNotEmpty(deviceList)) { int count = 1; for (Map<String, String> stringMap : deviceList) { stringMap.put("index", String.valueOf(count)); count++; } } Map<String, String> codeStr = new HashMap<>(); codeStr.put("报告编号", insReport.getCode()); codeStr.put("样品名称", insOrder.getSample()); @@ -2274,7 +2284,6 @@ codeStr.put("发放日期", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); String modelStr = CollUtil.join(models, "\n"); String finalModelStr = modelStr; // 检测类型 String orderType = null; @@ -2288,11 +2297,10 @@ String formType = iSysDictTypeService.selectLabelByDict(DictDataConstants.FORM_TYPE, insOrder.getFormType()); // 样品状态 String sampleStatus = iSysDictTypeService.selectLabelByDict(DictDataConstants.SAMPLE_STATUS_LIST, insOrder.getSampleStatus());; String sampleStatus = iSysDictTypeService.selectLabelByDict(DictDataConstants.SAMPLE_STATUS_LIST, insOrder.getSampleStatus()); ; ConfigureBuilder builder = Configure.builder(); builder.useSpringEL(true); List<Map<String, String>> finalDeviceList = deviceList; // 公司信息 Custom custom = customMapper.selectById(insOrder.getCompanyId()); // 查询判断是否有不判定项目,和全都是判定项 @@ -2382,12 +2390,18 @@ environment = (ObjectUtils.isNotEmpty(insOrder.getTemperature()) ? insOrder.getTemperature() + "℃ " : "") + (ObjectUtils.isNotEmpty(insOrder.getHumidity()) ? insOrder.getHumidity() + "%" : ""); String finalEnvironment = environment; LocalDateTime finalSendTime = sendTime; String finalResultCh = resultCh; String finalResultEn = resultEn; String finalOrderType = orderType; List<Map<String, String>> finalDeviceList = deviceList; String finalModelStr = modelStr; InputStream inputStream = this.getClass().getResourceAsStream("/static/report-template.docx"); XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render( Configure configure = Configure.builder() .bind("deviceList", new HackLoopTableRenderPolicy()) .build(); XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render( new HashMap<String, Object>() {{ put("order", insOrder); put("report", insReport); @@ -2422,6 +2436,8 @@ put("sampleStatus", sampleStatus); }}); try { // 修改换行和合并问题 updaeMerge(template.getXWPFDocument(), false); String name = insReport.getCode().replace("/", "") + ".docx"; template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl + "/" + name))); insReport.setUrl("/word/" + name); @@ -2434,8 +2450,6 @@ } catch (IOException e) { throw new RuntimeException(e); } // 修改换行和合并问题 updaeMerge(insReport, deviceList, false); } /** @@ -2506,19 +2520,13 @@ /** * 合并单元格 * @param insReport * @param deviceList */ private void updaeMerge(InsReport insReport, List<Map<String, String>> deviceList, boolean isSmall) { private void updaeMerge(XWPFDocument document, boolean isSmall) { // 处理合并单元格的问题 String path = wordUrl + insReport.getUrl().replaceFirst("/word", ""); try { // 获取文档中的所有表格 FileInputStream stream = new FileInputStream(path); XWPFDocument document = new XWPFDocument(stream); List<XWPFTable> xwpfTables = document.getTables(); // 遍历表格,但跳过第一个表格(如果deviceList为null,则额外跳过第二个) for (int i = 1; i < xwpfTables.size() - (deviceList == null ? 1 : 2); i++) { // 遍历表格 for (int i = 1; i < xwpfTables.size(); i++) { // 创建一个HashSet来存储唯一的字符串(这里基于"∑"分割后的第二部分) Set<String> set1 = new HashSet<>(); // 创建一个HashMap来存储每个唯一字符串及其对应的单元格位置信息 @@ -2614,20 +2622,11 @@ } } } FileOutputStream fileOutputStream = new FileOutputStream(path); document.write(fileOutputStream); fileOutputStream.close(); } catch (FileNotFoundException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } //处理中英文换行的问题 try { FileInputStream stream1 = new FileInputStream(path); XWPFDocument document1 = new XWPFDocument(stream1); List<XWPFTable> xwpfTables1 = document1.getTables(); for (int i = 1; i < xwpfTables1.size() - (deviceList == null ? 1 : 2); i++) { List<XWPFTable> xwpfTables1 = document.getTables(); for (int i = 1; i < xwpfTables1.size(); i++) { for (int j = 0; j < xwpfTables1.get(i).getRows().size(); j++) { for (int k = 0; k < xwpfTables1.get(i).getRows().get(j).getTableCells().size(); k++) { if (xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getText().contains("@")) { @@ -2680,14 +2679,6 @@ } } } } FileOutputStream fileOutputStream1 = new FileOutputStream(path); document1.write(fileOutputStream1); fileOutputStream1.close(); } catch (FileNotFoundException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } } inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -241,7 +241,7 @@ latest_traceability from device where device.management_number in <foreach collection="names" index="index" open="(" separator="," close=")" item="val"> <foreach collection="managementNumbers" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </select> inspect-server/src/main/resources/static/report-template.docxBinary files differ
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
@@ -14,7 +14,6 @@ { public static void main(String[] args) { // System.setProperty("spring.devtools.restart.enabled", "false"); SpringApplication.run(RuoYiApplication.class, args); } }