Parcourir la source

试车标准库导出报告初版

zhoudazhuang il y a 7 mois
Parent
commit
827a950cda

+ 12 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxCommissionCheckBaseInfoDetailDao.java

@@ -4,8 +4,10 @@ import com.rongwei.bsentity.domain.ZhcxCommissionCheckBaseInfoDetailDo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.rongwei.bsentity.dto.CommissionCheckChapterNoPulsDTO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -21,4 +23,14 @@ public interface ZhcxCommissionCheckBaseInfoDetailDao extends BaseMapper<ZhcxCom
     void batchUpdate(List<ZhcxCommissionCheckBaseInfoDetailDo> list);
 
     void batchUpdateChapterNoPuls(List<CommissionCheckChapterNoPulsDTO> list);
+
+    @Select("SELECT\n" +
+            "*\n" +
+            "FROM\n" +
+            "ZHCX_COMMISSION_CHECK_BASE_INFO_DETAIL\n" +
+            "WHERE\n" +
+            "DELETED = 0\n" +
+            "AND PID = #{standardId}\n" +
+            "ORDER BY SORT ASC")
+    List<ZhcxCommissionCheckBaseInfoDetailDo> listData(Map<String, Object> map);
 }

+ 13 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxCommissionCheckBaseInfoTreeDao.java

@@ -2,6 +2,10 @@ package com.rongwei.bscommon.sys.dao;
 
 import com.rongwei.bsentity.domain.ZhcxCommissionCheckBaseInfoTreeDo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -13,4 +17,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ZhcxCommissionCheckBaseInfoTreeDao extends BaseMapper<ZhcxCommissionCheckBaseInfoTreeDo> {
 
+    @Select("SELECT\n" +
+            "*\n" +
+            "FROM\n" +
+            "ZHCX_COMMISSION_CHECK_BASE_INFO_TREE\n" +
+            "WHERE\n" +
+            "DELETED = 0\n" +
+            "AND BASEINFOID = #{standardId}\n" +
+            "ORDER BY SORT ASC")
+    List<ZhcxCommissionCheckBaseInfoTreeDo> listTreeData(Map<String, Object> map);
 }

+ 1 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxCommissionCheckService.java

@@ -51,5 +51,5 @@ public interface ZhcxCommissionCheckService extends IService<ZhcxCommissionCheck
      * @param response
      * @return
      */
-    int exportFile2(Map<String, Object> map, HttpServletResponse response) throws Exception;
+    int wordExportStandard(Map<String, Object> map, HttpServletResponse response) throws Exception;
 }

+ 1 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxCommissionCheckBaseInfoDetailServiceImpl.java

@@ -1,7 +1,7 @@
 package com.rongwei.bscommon.sys.service.impl;
 
-import com.rongwei.bsentity.domain.ZhcxCommissionCheckBaseInfoDetailDo;
 import com.rongwei.bscommon.sys.dao.ZhcxCommissionCheckBaseInfoDetailDao;
+import com.rongwei.bsentity.domain.ZhcxCommissionCheckBaseInfoDetailDo;
 import com.rongwei.bscommon.sys.service.ZhcxCommissionCheckBaseInfoDetailService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.rongwei.bsentity.dto.CommissionCheckChapterNoPulsDTO;

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

@@ -2,10 +2,11 @@ package com.rongwei.bscommon.sys.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.aspose.words.*;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.rongwei.bscommon.sys.dao.ZhcxCommissionCheckBaseInfoDetailDao;
+import com.rongwei.bscommon.sys.dao.ZhcxCommissionCheckBaseInfoTreeDao;
 import com.rongwei.bscommon.sys.dao.ZhcxCommissionCheckDetailDao;
 import com.rongwei.bscommon.sys.feign.CXCommonFeginClient;
 import com.rongwei.bscommon.sys.service.*;
@@ -18,6 +19,7 @@ import com.rongwei.bsentity.domain.ZhcxCommissionCheckParameterSetDo;
 import com.rongwei.bsentity.dto.CheckDetailDTO;
 import com.rongwei.bsentity.dto.CommissionCheckDTO;
 import com.rongwei.bsentity.vo.FormDataCheckVO;
+import com.rongwei.bsentity.vo.ZhcxCommissionCheckDetailStandardWordVO;
 import com.rongwei.bsentity.vo.ZhcxCommissionCheckDetailWordVO;
 import com.rongwei.rwcommon.base.R;
 import com.rongwei.rwcommon.utils.DateUtils;
@@ -32,11 +34,9 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.ClassPathResource;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import com.rongwei.rwcommoncomponent.excel.aspose.ExcelExportUtil;
-import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.PostConstruct;
 import javax.servlet.http.HttpServletResponse;
@@ -86,6 +86,12 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
     @Autowired
     private ZhcxCommissionCheckDetailTreeService zhcxCommissionCheckDetailTreeService;
 
+    @Autowired
+    private ZhcxCommissionCheckBaseInfoDetailDao zhcxCommissionCheckBaseInfoDetailDao;
+
+    @Autowired
+    private ZhcxCommissionCheckBaseInfoTreeDao zhcxCommissionCheckBaseInfoTreeDao;
+
     @Autowired
     private ExcelUtils excelUtils;
 
@@ -468,17 +474,17 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                     if (StringUtils.isNotBlank(checkDetailDo.getEntestcontent())){
                         entestcontent = checkDetailDo.getEntestcontent();
                     }
-                    checkDetailWordVO.setContent(chtestcontent+entestcontent);
+//                    checkDetailWordVO.setContent(chtestcontent+entestcontent);
                     String testresult = "";
                     if (StringUtils.isNotBlank(checkDetailDo.getTestresult())){
                         testresult = resultType.stream().filter(dictDo -> checkDetailDo.getTestresult().contains(dictDo.getString("VALUE"))).findFirst().get().getString("NAME").toString();
                     }
-                    checkDetailWordVO.setResult(testresult);
+//                    checkDetailWordVO.setResult(testresult);
                     String testnotes = "";
                     if (StringUtils.isNotBlank(checkDetailDo.getTestnotes())){
                         testnotes = checkDetailDo.getTestnotes();
                     }
-                    checkDetailWordVO.setTestnotes(testnotes);
+//                    checkDetailWordVO.setTestnotes(testnotes);
                     detailWordVOList.add(checkDetailWordVO);
                 }
             }
@@ -1109,24 +1115,21 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
     }
 
     @Override
-    public int exportFile2(Map<String, Object> map, HttpServletResponse response) throws Exception{
-        SysFileItemDo fileItemDo = sysFileItemService.getById("d1b3271ce2ec45c2915f2dbcd819f45a");
+    public int wordExportStandard(Map<String, Object> map, HttpServletResponse response) throws Exception{
+        SysFileItemDo fileItemDo = sysFileItemService.getById("a2ccde8da9ec485f83650b75429f0e78");
         final Document[] indexDoc = {WordHelpUtils.getDoc(fileItemDo.getFullpath())};
         FormData formData = new FormData();
         List<Map<String,Object>> mainDataList = new ArrayList<>();
         Map<String,Object> mainMap = new HashMap<>(16);
-        mainMap.put("projectNames","XXX");
-        mainMap.put("projectCode","XXX");
-        mainMap.put("projectName","XXX");
         mainMap.put("currentDate",DateUtils.format(new Date()));
-        mainMap.put("machineNo","XXX");
         mainDataList.add(mainMap);
         formData.setMainDataList(mainDataList);
         indexDoc[0] = ExcelExportUtil.fillWordDataByMap(fileItemDo.getFullpath(), formData);
-        List<ZhcxCommissionCheckDetailDo> list = zhcxCommissionCheckDetailDao.listData(map);
+        List<ZhcxCommissionCheckBaseInfoDetailDo> list = zhcxCommissionCheckBaseInfoDetailDao.listData(map);
+        List<ZhcxCommissionCheckBaseInfoTreeDo> treeList = zhcxCommissionCheckBaseInfoTreeDao.listTreeData(map);
         Document doc = null;
         DocumentBuilder builder = null;
-        ClassPathResource classPathResource = new ClassPathResource("template/检查内容明细模版.doc");
+        ClassPathResource classPathResource = new ClassPathResource("template/试车标准内容明细.doc");
         try {
             doc = new Document(classPathResource.getInputStream());
             builder = new DocumentBuilder(doc);
@@ -1134,61 +1137,90 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
             ExceptionUtils.printExceptionDetail(e,"空模板获取出现异常");
             return 0;
         }
-        //移动到页眉
-        builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY); // 主页眉
-        // 如果有多个页眉,可以选择HeaderFooterType.HEADER_FIRST, HeaderFooterType.HEADER_EVEN等
-        for (com.aspose.words.Field field : doc.getRange().getFields()) {
-            if ("«projectName»".equals(field.getResult())) { // 替换FieldName为你的字段名称
-                // 在这里操作field对象
-                builder.moveToField(field, true);
-                builder.write("XXX");
-                field.setResult("");
-            }
-        }
-        List<JSONObject> resultType = zhcxCommissionCheckDetailDao.getResultDictList();
-        if(list.isEmpty()){
+        if(list.isEmpty()||treeList.isEmpty()){
             return 1;
         }else {
             //标题
-            Set<ZhcxCommissionCheckDetailDo> noSet = list.stream().filter(item -> ObjectUtil.isNotEmpty(item.getIstitle()) && "y".equals(item.getIstitle())).collect(Collectors.toSet());
-            Map<String, ZhcxCommissionCheckDetailWordVO> resMap = new HashMap<>();
-            for (ZhcxCommissionCheckDetailDo item : noSet) {
-                ZhcxCommissionCheckDetailWordVO checkDetailWordVO = new ZhcxCommissionCheckDetailWordVO();
-                checkDetailWordVO.setChapterno(item.getChapternopuls());
-                String chtitle = "";
-                String entitle = "";
-                if (StringUtils.isNotBlank(item.getChtitle())){
-                    chtitle = item.getChtitle();
-                }
-                if (StringUtils.isNotBlank(item.getEntitle())){
-                    entitle = item.getEntitle();
-                }
-                checkDetailWordVO.setTitleContent(chtitle+entitle);
+            Map<String, ZhcxCommissionCheckDetailStandardWordVO> resMap = new HashMap<>();
+            for (ZhcxCommissionCheckBaseInfoTreeDo item : treeList) {
+                ZhcxCommissionCheckDetailStandardWordVO checkDetailWordVO = new ZhcxCommissionCheckDetailStandardWordVO();
+                checkDetailWordVO.setTitleContent(item.getName());
+                checkDetailWordVO.setLevel(item.getLevel());
                 checkDetailWordVO.setDetailList(new LinkedList<>());
-                resMap.put(item.getChapternopuls(),checkDetailWordVO);
+                if (!"-1".equals(item.getPid())){
+                    //目前标题最多到三级
+                    if (item.getLevel()==2){
+                        List<ZhcxCommissionCheckBaseInfoTreeDo> parentList =  treeList.stream().filter(info->info.getId().equals(item.getPid())).collect(Collectors.toList());
+                        if (!parentList.isEmpty()){
+                            int i = parentList.get(0).getTreecode().indexOf(".");
+                            if (i!= -1){
+                                String key = parentList.get(0).getTreecode().substring(i+1);
+                                String result = item.getTreecode().replaceAll(".*\\.", key+".");
+                                checkDetailWordVO.setChapterno(result);
+                            }
+                        }
+                    }else {
+                        String[] fullIds = item.getFullpid().split(",");
+                        if (fullIds.length>2){
+                            String oneLevelKey = "";
+                            List<ZhcxCommissionCheckBaseInfoTreeDo> oneLevelList =  treeList.stream().filter(info->info.getId().equals(fullIds[1])).collect(Collectors.toList());
+                            if (!oneLevelList.isEmpty()){
+                                int i = oneLevelList.get(0).getTreecode().indexOf(".");
+                                if (i!= -1){
+                                    oneLevelKey = oneLevelList.get(0).getTreecode().substring(i+1);
+                                    String twoLevelKey = "";
+                                    List<ZhcxCommissionCheckBaseInfoTreeDo> parentList =  treeList.stream().filter(info->info.getId().equals(item.getPid())).collect(Collectors.toList());
+                                    if (!parentList.isEmpty()){
+                                        int j = parentList.get(0).getTreecode().indexOf(".");
+                                        if (j!= -1){
+                                            twoLevelKey = parentList.get(0).getTreecode().substring(j+1);
+                                        }
+                                    }
+                                    String result = item.getTreecode().replaceAll(".*\\.", oneLevelKey+"."+twoLevelKey+".");
+                                    checkDetailWordVO.setChapterno(result);
+                                }
+                            }
+                        }
+                    }
+                    resMap.put(item.getPid()+","+item.getId(),checkDetailWordVO);
+                }else {
+                    int i = item.getTreecode().indexOf(".");
+                    if (i!= -1){
+                        String key = item.getTreecode().substring(i+1);
+                        checkDetailWordVO.setChapterno(key);
+                    }
+                    resMap.put(item.getId(),checkDetailWordVO);
+                }
             }
-            //非标题
-            List<ZhcxCommissionCheckDetailDo> detailLists = list.stream().filter(item -> !(ObjectUtil.isNotEmpty(item.getIstitle()) && "y".equals(item.getIstitle()))).collect(Collectors.toList());
-            for (ZhcxCommissionCheckDetailDo item : detailLists) {
-                String chapternopuls = item.getChapternopuls();
-                int i = chapternopuls.lastIndexOf(".");
-                String key = chapternopuls.substring(0, i);
-                if(!resMap.containsKey(key)){
-                    log.error("不能导出错误的章节号:{}的报告", chapternopuls);
-                    log.error("不能导出错误的章节号key:{}的报告", key);
-                    return 2;
+            //子表数据
+            for (ZhcxCommissionCheckBaseInfoDetailDo item : list) {
+                String key = "";
+                String treeFullId = item.getTreefullid();
+                int fillIdLength = treeFullId.split(",").length;
+                int i = treeFullId.indexOf(",");
+                if (fillIdLength<=3){
+                    key = treeFullId.substring(i+1);
+                    if(!resMap.containsKey(key)){
+                        log.error("不能导入树表的id:{}的报告", treeFullId);
+                        log.error("不能导入树表的key:{}的报告", key);
+                        return 2;
+                    }
+                }else {
+                    // 从第一个逗号之后开始找第二个逗号
+                    int j = treeFullId.indexOf(',', i + 1);
+                    key = treeFullId.substring(j+1);
+                    if(!resMap.containsKey(key)){
+                        log.error("不能导入树表的id:{}的报告", treeFullId);
+                        log.error("不能导入树表的key:{}的报告", key);
+                        return 2;
+                    }
+
                 }
-                ZhcxCommissionCheckDetailWordVO checkDetailWordVO = resMap.get(key);
-                List<ZhcxCommissionCheckDetailDo> detailList = checkDetailWordVO.getDetailList();
+                ZhcxCommissionCheckDetailStandardWordVO checkDetailWordVO = resMap.get(key);
+                List<ZhcxCommissionCheckBaseInfoDetailDo> 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);
-                        }
-                );
             }
-            List<ZhcxCommissionCheckDetailWordVO> resList = new LinkedList<>();
+            List<ZhcxCommissionCheckDetailStandardWordVO> resList = new LinkedList<>();
             for (String s : resMap.keySet()) {
                 resList.add(resMap.get(s));
             }
@@ -1198,113 +1230,116 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                 return sort1(a1,b1);
             });
             builder.moveToDocumentStart();
-            for (ZhcxCommissionCheckDetailWordVO res : resList) {
-                int titleType = res.getChapterno().split("\\.").length;
-                if (titleType==1){
-                    buildText(builder, DEFAULT_FONT_NAME, titleType, 12, true,
+            for (ZhcxCommissionCheckDetailStandardWordVO res : resList) {
+                if (res.getLevel()==1){
+                    buildText(builder, DEFAULT_FONT_NAME, res.getLevel(), 12, true,
                             res.getChapterno()+"."+res.getTitleContent(), null);
                 }else {
-                    buildText(builder, DEFAULT_FONT_NAME, titleType, 12, true,
+                    buildText(builder, DEFAULT_FONT_NAME, res.getLevel(), 12, true,
                             res.getChapterno()+res.getTitleContent(), null);
                 }
                 if(ObjectUtil.isNotEmpty(res.getDetailList())){
                     builder.getFont().setSize(15);
                     // 插入表头
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(40);
+                    builder.getCellFormat().setWidth(30);
                     builder.getRowFormat().setHeight(20);
                     builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
                     builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
                     buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_6, 12, true,
                             "NO.", null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(170);
+                    builder.getCellFormat().setWidth(40);
                     builder.getRowFormat().setHeight(20);
                     builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
                     builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
                     buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_6, 12, true,
-                            "检查项目", null);
+                            "模式1", null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(120);
+                    builder.getCellFormat().setWidth(40);
                     builder.getRowFormat().setHeight(20);
                     builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
                     builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
                     buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_6, 12, true,
-                            "测试地点", null);
+                            "模式2", null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(40);
+                    builder.getCellFormat().setWidth(60);
                     builder.getRowFormat().setHeight(20);
                     builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
                     builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
                     buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_6, 12, true,
-                            "结果", null);
+                            "测试内容中文", null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(100);
+                    builder.getCellFormat().setWidth(60);
                     builder.getRowFormat().setHeight(20);
                     builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
                     builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
                     buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_6, 12, true,
-                            "备注", null);
+                            "测试内容英文", null);
+                    builder.insertCell();
+                    builder.getCellFormat().setWidth(60);
+                    builder.getRowFormat().setHeight(20);
+                    builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
+                    builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
+                    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);
+                    buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_6, 12, true,
+                            "测试地点", null);
                     builder.endRow();
-                    for (ZhcxCommissionCheckDetailDo detailWordVO:res.getDetailList()){
+                    for (ZhcxCommissionCheckBaseInfoDetailDo detailWordVO:res.getDetailList()){
                         // 插入表格的第一行
                         builder.insertCell();
-                        builder.getCellFormat().setWidth(40);
+                        builder.getCellFormat().setWidth(30);
                         builder.getRowFormat().setHeightRule(HeightRule.AUTO);//设置HeightRule
                         builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                        // 取的应该是新的章节号 detailWordVO.getChapterno
                         buildTextContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_7, 11, false,
-                                detailWordVO.getChapternopuls(), null);
-
+                                detailWordVO.getChapterno(), null);
                         builder.insertCell();
-                        builder.getCellFormat().setWidth(170);
+                        builder.getCellFormat().setWidth(40);
+                        builder.getRowFormat().setHeightRule(HeightRule.AUTO);//设置HeightRule
+                        builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
+                        buildTextContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_7, 11, false,detailWordVO.getClassification(), null);
+                        builder.insertCell();
+                        builder.getCellFormat().setWidth(40);
+                        builder.getRowFormat().setHeightRule(HeightRule.AUTO);//设置HeightRule
+                        builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
+                        buildTextContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_7, 11, false,detailWordVO.getClassificationtwo(), null);
+                        builder.insertCell();
+                        builder.getCellFormat().setWidth(60);
                         builder.getRowFormat().setHeightRule(HeightRule.AUTO);//设置HeightRule
                         builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                        String chtestcontent = "";
-                        String entestcontent = "";
-                        if (StringUtils.isNotBlank(detailWordVO.getChtestcontent())){
-                            chtestcontent = detailWordVO.getChtestcontent();
-                        }
-                        if (StringUtils.isNotBlank(detailWordVO.getEntestcontent())){
-                            entestcontent = detailWordVO.getEntestcontent();
-                        }
                         buildTextContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_7, 11, false,
-                                chtestcontent+entestcontent, null);
-
+                                detailWordVO.getChtestcontent(), null);
                         builder.insertCell();
-                        builder.getCellFormat().setWidth(120);
+                        builder.getCellFormat().setWidth(60);
                         builder.getRowFormat().setHeightRule(HeightRule.AUTO);//设置HeightRule
                         builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                        String testaddress = "CX BASE长兴基地";
-                        if (StringUtils.isNotBlank(detailWordVO.getTestaddress())){
-                            // 10-> CX BASE长兴基地  20-> USER SITE码头现场
-                            if(detailWordVO.getTestaddress().equals("20")){
-                                testaddress = "USER SITE码头现场";
-                            }
-                        }
                         buildTextContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_7, 11, false,
-                                testaddress, null);
-
+                                detailWordVO.getEntestcontent(), null);
                         builder.insertCell();
-                        builder.getCellFormat().setWidth(40);
+                        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();
-                        }
                         buildTextContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_7, 11, false,
-                                testresult, null);
+                                detailWordVO.getTestmethod(), null);
                         builder.insertCell();
-                        builder.getCellFormat().setWidth(100);
+                        builder.getCellFormat().setWidth(60);
                         builder.getRowFormat().setHeightRule(HeightRule.AUTO);//设置HeightRule
                         builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                        String testnotes = "";
-                        if (StringUtils.isNotBlank(detailWordVO.getTestnotes())){
-                            testnotes = detailWordVO.getTestnotes();
+                        String testaddress = "CX BASE长兴基地";
+                        if (StringUtils.isNotBlank(detailWordVO.getTestaddress())){
+                            // 10-> CX BASE长兴基地  20-> USER SITE码头现场
+                            if(detailWordVO.getTestaddress().equals("20")){
+                                testaddress = "USER SITE码头现场";
+                            }
                         }
-                        buildTextContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_7, 11, false,
-                                testnotes, null);
+                        buildTextContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.HEADING_8, 9, false,
+                                testaddress, null);
                         builder.endRow();
                     }
                     // 结束表格

+ 7 - 0
business-entity/src/main/java/com/rongwei/bsentity/domain/ZhcxCommissionCheckBaseInfoDetailDo.java

@@ -186,4 +186,11 @@ public class ZhcxCommissionCheckBaseInfoDetailDo extends BaseDo implements Seria
      */
     @TableField("TREEFULLID")
     private String treefullid;
+
+    /**
+     * 测试地点
+     */
+    @TableField("TESTADDRESS")
+    private String testaddress;
+
 }

+ 36 - 0
business-entity/src/main/java/com/rongwei/bsentity/vo/ZhcxCommissionCheckDetailStandardWordVO.java

@@ -0,0 +1,36 @@
+package com.rongwei.bsentity.vo;
+
+import com.rongwei.bsentity.domain.ZhcxCommissionCheckBaseInfoDetailDo;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 试车检查子表
+ * </p>
+ *
+ * @author xuan
+ * @since 2024-09-24
+ */
+@Data
+public class ZhcxCommissionCheckDetailStandardWordVO {
+
+    /**
+     * 序号
+     */
+    private String chapterno;
+
+    /**
+     * 标题层级
+     */
+    private Integer level;
+
+    /**
+     * 测试内容中文
+     */
+    private String titleContent;
+
+    //子表数据
+    private List<ZhcxCommissionCheckBaseInfoDetailDo> detailList;
+}

+ 3 - 3
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxCommissionCheckController.java

@@ -77,10 +77,10 @@ public class ZhcxCommissionCheckController {
         }
     }
 
-    @PostMapping("wordExport2")
+    @PostMapping("wordExportStandard")
     @ApiOperation("试车标准库word导出/预览")
-    public void wordExport2(@RequestBody Map<String,Object> map, HttpServletResponse response) throws Exception {
-        int i = commissionCheckService.exportFile2(map,response);
+    public void wordExportStandard(@RequestBody Map<String,Object> map, HttpServletResponse response) throws Exception {
+        int i = commissionCheckService.wordExportStandard(map,response);
         if(i == 0){
             throw new CustomException("程序异常");
         }else if(i == 1){

BIN
business-server/src/main/resources/template/试车标准内容明细.doc