Selaa lähdekoodia

核心检验指标Word导出优化

DLC 4 kuukautta sitten
vanhempi
commit
4d9e3c58c0

+ 1 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxCommissionCheckDetailDao.java

@@ -28,7 +28,7 @@ public interface ZhcxCommissionCheckDetailDao extends BaseMapper<ZhcxCommissionC
             "WHERE " +
             "DELETED = 0 " +
             "AND PID = #{checkId} " +
-            "ORDER BY CREATEDATE,SORT ASC")
+            "ORDER BY SORT")
     List<ZhcxCommissionCheckDetailDo> listData(Map<String, Object> map);
 
     @Select("SELECT " +

+ 47 - 33
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxCommissionCheckServiceImpl.java

@@ -1041,7 +1041,7 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                     buildTextContentTitle(builder, 40, 20, HeightRule.EXACTLY, TextOrientation.HORIZONTAL, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL,
                             12, true, "NO.", null);
                     builder.insertCell();
-                    buildTextContentTitle(builder, 170, 20, HeightRule.EXACTLY, TextOrientation.HORIZONTAL, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL,
+                    buildTextContentTitle(builder, 200, 20, HeightRule.EXACTLY, TextOrientation.HORIZONTAL, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL,
                             12, true, "检查项目", null);
                     builder.insertCell();
                     buildTextContentTitle(builder, 120, 20, HeightRule.EXACTLY, TextOrientation.HORIZONTAL, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL,
@@ -1056,39 +1056,53 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                     int count = 0;
                     for (ZhcxCommissionCheckDetailDo detailWordVO : res.getDetailList()) {
                         count++;
-                        builder.insertCell();
-                        // 设置样式
-                        buildTableTextContent(builder, 40, 9, DEFAULT_FONT_NAME, false, String.valueOf(count));
-                        builder.insertCell();
                         String chtestcontent = "";
-                        String entestcontent = "";
-                        if (StringUtils.isNotBlank(detailWordVO.getChtestcontent())) {
-                            chtestcontent = detailWordVO.getChtestcontent();
-                        }
-                        if (StringUtils.isNotBlank(detailWordVO.getEntestcontent())) {
-                            entestcontent = detailWordVO.getEntestcontent();
-                        }
-                        buildTableTextContent(builder, 170, 9, DEFAULT_FONT_NAME, false, chtestcontent + entestcontent);
                         builder.insertCell();
-                        String testaddress = "";
-                        if (StringUtils.isNotBlank(detailWordVO.getTestaddress())) {
-                            // 10-> CX BASE长兴基地  20-> USER SITE码头现场
-                            if (detailWordVO.getTestaddress().equals("20")) {
-                                testaddress = "USER SITE码头现场";
+                        //合并单元格
+                        if (detailWordVO.getIstitle() != null && detailWordVO.getIstitle().equals("y")) {
+                            if (StringUtils.isNotBlank(detailWordVO.getChtestcontent())) {
+                                chtestcontent = detailWordVO.getChtestcontent();
                             }
-                            if (detailWordVO.getTestaddress().equals("10")) {
-                                testaddress = "CX BASE长兴基地";
+                            buildTableTextContent(builder, 100, 9, DEFAULT_FONT_NAME, true, chtestcontent);
+                            builder.getCurrentParagraph().getParagraphFormat().setAlignment(ParagraphAlignment.LEFT); // 内容靠左
+                            builder.getCellFormat().setHorizontalMerge(CellMerge.FIRST); // 设置为合并起始单元格
+                            for (int col = 1; col < 5; col++) {
+                                builder.insertCell();
+                                builder.getCellFormat().setHorizontalMerge(CellMerge.PREVIOUS); // 设置为合并到前一个单元格
                             }
+                        } else {
+                            // 设置样式
+                            buildTableTextContent(builder, 40, 9, DEFAULT_FONT_NAME, false, String.valueOf(count));
+                            builder.insertCell();
+                            String entestcontent = "";
+                            if (StringUtils.isNotBlank(detailWordVO.getChtestcontent())) {
+                                chtestcontent = detailWordVO.getChtestcontent();
+                            }
+                            if (StringUtils.isNotBlank(detailWordVO.getEntestcontent())) {
+                                entestcontent = detailWordVO.getEntestcontent();
+                            }
+                            buildTableTextContent(builder, 200, 9, DEFAULT_FONT_NAME, false, chtestcontent + entestcontent);
+                            builder.insertCell();
+                            String testaddress = "";
+                            if (StringUtils.isNotBlank(detailWordVO.getTestaddress())) {
+                                // 10-> CX BASE长兴基地  20-> USER SITE码头现场
+                                if (detailWordVO.getTestaddress().equals("20")) {
+                                    testaddress = "USER SITE码头现场";
+                                }
+                                if (detailWordVO.getTestaddress().equals("10")) {
+                                    testaddress = "CX BASE长兴基地";
+                                }
+                            }
+                            buildTableTextContent(builder, 120, 9, DEFAULT_FONT_NAME, false, testaddress);
+                            builder.insertCell();
+                            String testresult = "";
+                            if (StringUtils.isNotBlank(detailWordVO.getTestresult())) {
+                                testresult = resultType.stream().filter(dictDo -> detailWordVO.getTestresult().contains(dictDo.getString("VALUE"))).findFirst().get().getString("NAME").toString();
+                            }
+                            buildTableTextContent(builder, 40, 9, DEFAULT_FONT_NAME, false, testresult);
+                            builder.insertCell();
+                            buildTableTextContent(builder, 100, 9, DEFAULT_FONT_NAME, false, detailWordVO.getTestnotes());
                         }
-                        buildTableTextContent(builder, 120, 9, DEFAULT_FONT_NAME, false, testaddress);
-                        builder.insertCell();
-                        String testresult = "";
-                        if (StringUtils.isNotBlank(detailWordVO.getTestresult())) {
-                            testresult = resultType.stream().filter(dictDo -> detailWordVO.getTestresult().contains(dictDo.getString("VALUE"))).findFirst().get().getString("NAME").toString();
-                        }
-                        buildTableTextContent(builder, 40, 9, DEFAULT_FONT_NAME, false, testresult);
-                        builder.insertCell();
-                        buildTableTextContent(builder, 100, 9, DEFAULT_FONT_NAME, false, detailWordVO.getTestnotes());
                         builder.endRow();
                         // 设置行高为自适应
                         builder.getRowFormat().setHeightRule(HeightRule.AUTO);
@@ -1888,15 +1902,15 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                         .build();
                 // 改用MP的插入
                 LambdaQueryWrapper<ZhcxCommissionCheckDetailDo> queryWrapper = new LambdaQueryWrapper<>();
-                queryWrapper.eq(ZhcxCommissionCheckDetailDo::getPid,importDto.getId())
-                        .eq(ZhcxCommissionCheckDetailDo::getDeleted,"0");
+                queryWrapper.eq(ZhcxCommissionCheckDetailDo::getPid, importDto.getId())
+                        .eq(ZhcxCommissionCheckDetailDo::getDeleted, "0");
                 List<ZhcxCommissionCheckDetailDo> detailDos = zhcxCommissionCheckDetailService.list(queryWrapper);
                 int finalM = m;
                 detailDos.forEach(item -> {
                     item.setId(SecurityUtil.getUUID())
                             .setPid(check.getId());
-                    item.setTreefullid(item.getTreefullid().replaceAll(",",","+finalM+"#") );
-                    item.setTreeid(finalM+"#"+item.getTreeid());
+                    item.setTreefullid(item.getTreefullid().replaceAll(",", "," + finalM + "#"));
+                    item.setTreeid(finalM + "#" + item.getTreeid());
                 });
                 zhcxCommissionCheckDetailService.saveBatch(detailDos);
                 //zhcxCommissionCheckDetailService.copyByPid(copyDto);//详情