Browse Source

试车检查内容报告细节调整

zhoudazhuang 9 tháng trước cách đây
mục cha
commit
ce0c0c4f5e

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

@@ -635,7 +635,7 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
             log.error("导出空模板出现异常");
             return 0;
         }
-        // 移动到页眉
+        //移动到页眉
         builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY); // 主页眉
         // 如果有多个页眉,可以选择HeaderFooterType.HEADER_FIRST, HeaderFooterType.HEADER_EVEN等
         for (com.aspose.words.Field field : doc.getRange().getFields()) {
@@ -680,23 +680,23 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                 List<ZhcxCommissionCheckDetailDo> detailList = checkDetailWordVO.getDetailList();
                 detailList.add(item);
                 detailList.sort((a,b)->{
-                LinkedList<String> a1 = new LinkedList<>(Arrays.asList(a.getChapternopuls().split("\\.")));
-                LinkedList<String> b1 = new LinkedList<>(Arrays.asList(b.getChapternopuls().split("\\.")));
-                    return sort1(a1,b1);
-                }
-            );
+                            LinkedList<String> a1 = new LinkedList<>(Arrays.asList(a.getChapternopuls().split("\\.")));
+                            LinkedList<String> b1 = new LinkedList<>(Arrays.asList(b.getChapternopuls().split("\\.")));
+                            return sort1(a1,b1);
+                        }
+                );
             }
             List<ZhcxCommissionCheckDetailWordVO> resList = new LinkedList<>();
             for (String s : resMap.keySet()) {
                 resList.add(resMap.get(s));
             }
             resList.sort((a,b)->{
-                        LinkedList<String> a1 = new LinkedList<>(Arrays.asList(a.getChapterno().split("\\.")));
-                        LinkedList<String> b1 = new LinkedList<>(Arrays.asList(b.getChapterno().split("\\.")));
-                        return sort1(a1,b1);
-                    });
+                LinkedList<String> a1 = new LinkedList<>(Arrays.asList(a.getChapterno().split("\\.")));
+                LinkedList<String> b1 = new LinkedList<>(Arrays.asList(b.getChapterno().split("\\.")));
+                return sort1(a1,b1);
+            });
+            builder.moveToDocumentStart();
             for (ZhcxCommissionCheckDetailWordVO res : resList) {
-                builder.moveToDocumentStart();
                 int titleType = res.getChapterno().split("\\.").length;
                 if (titleType==1){
                     buildText(builder, DEFAULT_FONT_NAME, titleType, 12, true,
@@ -709,54 +709,46 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                     builder.getFont().setSize(15);
                     // 插入表头
                     builder.insertCell();
+                    builder.getCellFormat().setWidth(60);
                     builder.getRowFormat().setHeight(20);
                     builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
                     builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);
-                    builder.getCellFormat().setWidth(60);
                     buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_6, 12, true,
                             "NO.", null);
                     builder.insertCell();
+                    builder.getCellFormat().setWidth(200);
                     builder.getRowFormat().setHeight(20);
                     builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
                     builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);
-                    builder.getCellFormat().setWidth(200);
                     buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_6, 12, true,
                             "检查项目", null);
                     builder.insertCell();
+                    builder.getCellFormat().setWidth(60);
                     builder.getRowFormat().setHeight(20);
                     builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
                     builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);
-                    builder.getCellFormat().setWidth(60);
                     buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_6, 12, true,
                             "结果", null);
                     builder.insertCell();
+                    builder.getCellFormat().setWidth(150);
                     builder.getRowFormat().setHeight(20);
                     builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
                     builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);
-                    builder.getCellFormat().setWidth(150);
                     buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_6, 12, true,
                             "备注", null);
                     builder.endRow();
                     for (ZhcxCommissionCheckDetailDo detailWordVO:res.getDetailList()){
                         // 插入表格的第一行
                         builder.insertCell();
-                        builder.getRowFormat().setHeight(40);
-                        builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                        builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                        builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);
                         builder.getCellFormat().setWidth(60);
+                        builder.getRowFormat().setHeightRule(HeightRule.AUTO);//设置HeightRule
+                        builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
                         buildTextContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_7, 11, false,
                                 detailWordVO.getChapterno().replaceAll("\\s", ""), null);
                         builder.insertCell();
-                        builder.getRowFormat().setHeight(40);
-                        builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                        builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                        builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);
                         builder.getCellFormat().setWidth(200);
+                        builder.getRowFormat().setHeightRule(HeightRule.AUTO);//设置HeightRule
+                        builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
                         String chtestcontent = "";
                         String entestcontent = "";
                         if (StringUtils.isNotBlank(detailWordVO.getChtestcontent())){
@@ -768,11 +760,9 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                         buildTextContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_7, 11, false,
                                 chtestcontent+entestcontent, null);
                         builder.insertCell();
-                        builder.getRowFormat().setHeight(40);
-                        builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                        builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                        builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);
                         builder.getCellFormat().setWidth(60);
+                        builder.getRowFormat().setHeightRule(HeightRule.AUTO);//设置HeightRule
+                        builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
                         String testresult = "";
                         if (StringUtils.isNotBlank(detailWordVO.getTestresult())){
                             testresult = resultType.stream().filter(dictDo -> detailWordVO.getTestresult().contains(dictDo.getString("VALUE"))).findFirst().get().getString("NAME").toString();
@@ -780,11 +770,9 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                         buildTextContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_7, 11, false,
                                 testresult, null);
                         builder.insertCell();
-                        builder.getRowFormat().setHeight(40);
-                        builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                        builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                        builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);
                         builder.getCellFormat().setWidth(150);
+                        builder.getRowFormat().setHeightRule(HeightRule.AUTO);//设置HeightRule
+                        builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
                         String testnotes = "";
                         if (StringUtils.isNotBlank(detailWordVO.getTestnotes())){
                             testnotes = detailWordVO.getTestnotes().replaceAll("\\s", "");
@@ -862,23 +850,6 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
         }
     }
 
-    /**
-     * 上传文件到平台
-     * @param multipartFile
-     */
-    public static Object uploadFile(MultipartFile multipartFile,String checkId) {
-        Object fileId = "";
-        //文件上传只需将参数中的键指定(默认file),值设为文件对象即可,对于使用者来说,文件上传与普通表单提交并无区别
-        R upload = commonFeginClient.upload(multipartFile,checkId);
-        if ("200".equals(upload.getCode())){
-            Map<String,String> map = (Map<String, String>) JSON.parse(upload.getData().toString());
-            if (!map.isEmpty()){
-                fileId =map.get("id");
-            }
-        }
-        return fileId;
-    }
-
     /**
      * 内容添加
      *
@@ -1042,4 +1013,4 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
         //改动目录的相关内容都得更新目录域
         doc.updateFields();
     }
-}
+}

BIN
business-server/src/main/resources/template/检查内容明细模版.doc