Просмотр исходного кода

试车项目层面导出+概要

wangxuan 4 месяцев назад
Родитель
Сommit
519d7c9503

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

@@ -2190,6 +2190,8 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                 ZhcxCommissionCheckDetailWordVO checkDetailWordVO = new ZhcxCommissionCheckDetailWordVO();
                 checkDetailWordVO.setTitleContent(item.getName());
                 checkDetailWordVO.setLevel(item.getLevel());
+                checkDetailWordVO.setSummary(item.getSummary());
+                checkDetailWordVO.setAnnex(item.getAnnex());
                 checkDetailWordVO.setDetailList(new LinkedList<>());
                 if (!"-1".equals(item.getPid())) {
                     //目前标题最多到三级
@@ -2317,11 +2319,31 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                         buildTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_1, 15, true, res.getChapterno() + "." + res.getTitleContent(), null);
                     } else {
                         if (res.getLevel() == 2) {
-                            buildTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_2, 15, true, res.getChapterno() + "." + res.getTitleContent(), null);
+                            buildTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_3, 14, true, res.getChapterno() + "." + res.getTitleContent(), null);
                         } else {
-                            buildTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_3, 15, true, res.getChapterno() + "." + res.getTitleContent(), null);
+                            buildTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_3, 12, true, res.getChapterno() + "." + res.getTitleContent(), null);
                         }
                     }
+                    //摘要及图片
+                    if (StringUtils.isNotBlank(res.getSummary())) {
+                        buildTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_5, 10, false, res.getSummary(), null);
+                    }
+                    if (StringUtils.isNotBlank(res.getAnnex())) {
+                        // 文件存储路径目录
+                        String filePath = sysConfigService.getContentByConfigCode(Constants.CONFIG_FILE_ROOT_PATH);
+                        String outputDir = filePath + "\\by_files\\driveinspection_files\\"; // 写死
+                        String[] annexArr = res.getAnnex().split("\\^\\_\\^");
+                        for (String imginfo : annexArr) {
+                            String[] imgArr = imginfo.split("-;-");
+                            String imgFullName = imgArr[1] + "." + imgArr[0].split("\\.")[1];
+                            String imgPath = outputDir + imgFullName;
+                            Shape shape = builder.insertImage(imgPath);
+                            shape.setWidth(80); // 宽度 200 磅
+                            shape.setHeight(80); // 高度 150 磅
+                        }
+                        builder.writeln();//换行
+                    }
+
                     if (ObjectUtil.isNotEmpty(res.getDetailList())) {
                         // 插入表头
                         builder.insertCell();
@@ -2354,38 +2376,54 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                         builder.endRow();
                         int count = 0;
                         for (ZhcxCommissionCheckDetailDo detailWordVO : res.getDetailList()) {
-                            count++;
-                            // 插入表格的第一行
-                            builder.insertCell();
-                            buildTableTextContent(builder, 10, 9, DEFAULT_FONT_NAME, false, String.valueOf(count));
-                            builder.insertCell();
-                            buildTableTextContent(builder, 40, 9, DEFAULT_FONT_NAME, false, detailWordVO.getClassification());
-                            builder.insertCell();
-                            buildTableTextContent(builder, 40, 9, DEFAULT_FONT_NAME, false, detailWordVO.getClassificationtwo());
-                            builder.insertCell();
-                            buildTableTextContent(builder, 50, 9, DEFAULT_FONT_NAME, false, detailWordVO.getChtestcontent());
-                            builder.insertCell();
-                            buildTableTextContent(builder, 50, 9, DEFAULT_FONT_NAME, false, detailWordVO.getEntestcontent());
-                            builder.insertCell();
-                            //buildTableTextContent(builder, 50, 9, DEFAULT_FONT_NAME, false, detailWordVO.getTestmethod());
-                            // 标准测试时间
-                            buildTableTextContent(builder, 50, 9, DEFAULT_FONT_NAME, false,
-                                    (detailWordVO.getTesttime() != null ? detailWordVO.getTesttime() : "").replace(".0", ""));
-                            // 接收标准
+                            String chtestcontent = "";
                             builder.insertCell();
-                            buildTableTextContent(builder, 50, 9, DEFAULT_FONT_NAME, false, detailWordVO.getAcceptancecriteria());
-                            builder.insertCell();
-                            String testAddress = "";
-                            if (StringUtils.isNotBlank(detailWordVO.getTestaddress())) {
-                                // 10-> CX BASE长兴基地  20-> USER SITE码头现场
-                                if ("20".equals(detailWordVO.getTestaddress())) {
-                                    testAddress = "USER SITE码头现场";
+                            //合并单元格
+                            if (detailWordVO.getIstitle() != null && detailWordVO.getIstitle().equals("y")) {
+                                if (StringUtils.isNotBlank(detailWordVO.getChtestcontent())) {
+                                    chtestcontent = detailWordVO.getChtestcontent();
+                                }
+                                buildTableTextContent(builder, 350, 9, DEFAULT_FONT_NAME, true, chtestcontent);
+                                builder.getCurrentParagraph().getParagraphFormat().setAlignment(ParagraphAlignment.LEFT); // 内容靠左
+                                builder.getCellFormat().setHorizontalMerge(CellMerge.FIRST); // 设置为合并起始单元格
+                                for (int col = 1; col < 8; col++) {
+                                    builder.insertCell();
+                                    builder.getCellFormat().setHorizontalMerge(CellMerge.PREVIOUS); // 设置为合并到前一个单元格
                                 }
-                                if ("10".equals(detailWordVO.getTestaddress())) {
-                                    testAddress = "CX BASE长兴基地";
+                            }else {
+                                count++;
+                                // 插入表格的第一行
+                                //builder.insertCell();
+                                buildTableTextContent(builder, 10, 9, DEFAULT_FONT_NAME, false, String.valueOf(count));
+                                builder.insertCell();
+                                buildTableTextContent(builder, 40, 9, DEFAULT_FONT_NAME, false, detailWordVO.getClassification());
+                                builder.insertCell();
+                                buildTableTextContent(builder, 40, 9, DEFAULT_FONT_NAME, false, detailWordVO.getClassificationtwo());
+                                builder.insertCell();
+                                buildTableTextContent(builder, 50, 9, DEFAULT_FONT_NAME, false, detailWordVO.getChtestcontent());
+                                builder.insertCell();
+                                buildTableTextContent(builder, 50, 9, DEFAULT_FONT_NAME, false, detailWordVO.getEntestcontent());
+                                builder.insertCell();
+                                //buildTableTextContent(builder, 50, 9, DEFAULT_FONT_NAME, false, detailWordVO.getTestmethod());
+                                // 标准测试时间
+                                buildTableTextContent(builder, 50, 9, DEFAULT_FONT_NAME, false,
+                                        (detailWordVO.getTesttime() != null ? detailWordVO.getTesttime() : "").replace(".0", ""));
+                                // 接收标准
+                                builder.insertCell();
+                                buildTableTextContent(builder, 50, 9, DEFAULT_FONT_NAME, false, detailWordVO.getAcceptancecriteria());
+                                builder.insertCell();
+                                String testAddress = "";
+                                if (StringUtils.isNotBlank(detailWordVO.getTestaddress())) {
+                                    // 10-> CX BASE长兴基地  20-> USER SITE码头现场
+                                    if ("20".equals(detailWordVO.getTestaddress())) {
+                                        testAddress = "USER SITE码头现场";
+                                    }
+                                    if ("10".equals(detailWordVO.getTestaddress())) {
+                                        testAddress = "CX BASE长兴基地";
+                                    }
                                 }
+                                buildTableTextContent(builder, 60, 9, DEFAULT_FONT_NAME, false, testAddress);
                             }
-                            buildTableTextContent(builder, 60, 9, DEFAULT_FONT_NAME, false, testAddress);
                             builder.endRow();
                             // 设置行高为自适应
                             builder.getRowFormat().setHeightRule(HeightRule.AUTO);