2 Commits 751015a946 ... bfae3e43c2

Author SHA1 Message Date
  zhoudazhuang bfae3e43c2 Merge remote-tracking branch 'origin/master' 6 months ago
  zhoudazhuang 5741855ff8 试车标准库/试车导出提示优化 6 months ago

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

@@ -38,7 +38,7 @@ public interface ZhcxCommissionCheckBaseInfoDetailDao extends BaseMapper<ZhcxCom
             "WHERE\n" +
             "DELETED = 0\n" +
             "AND PID = #{standardId}\n" +
-            "ORDER BY SORT ASC")
+            "ORDER BY CREATEDATE,SORT ASC")
     List<ZhcxCommissionCheckBaseInfoDetailDo> listData(Map<String, Object> map);
 
     /**

+ 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 SORT ASC")
+            "ORDER BY CREATEDATE,SORT ASC")
     List<ZhcxCommissionCheckDetailDo> listData(Map<String, Object> map);
 
     @Select("SELECT " +

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

@@ -885,6 +885,10 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
             for (ZhcxCommissionCheckDetailDo item : list) {
                 String key = "";
                 String treeFullId = item.getTreefullid();
+                if (StringUtils.isBlank(treeFullId)){
+                    log.error("该内容节点treeFullId值为空:{}", item.getChtestcontent());
+                    return R.error(item.getChtestcontent()+"该内容节点数据有误");
+                }
                 int fillIdLength = treeFullId.split(",").length;
                 int i = treeFullId.indexOf(",");
                 if (fillIdLength<=3){
@@ -892,7 +896,7 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                     if(!resMap.containsKey(key)){
                         log.error("不能导出树表的id:{}的报告", treeFullId);
                         log.error("不能导出树表的key:{}的报告", key);
-                        log.error("章节号有无误:{}的报告", item.getChapterno());
+                        log.error("该内容节点有错误:{}的报告", item.getChtestcontent());
                         return R.error(item.getChtestcontent()+"该内容节点数据有误");
                     }
                 }else {
@@ -933,40 +937,20 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                 if(ObjectUtil.isNotEmpty(res.getDetailList())){
                     // 插入表头
                     builder.insertCell();
-                    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.NORMAL, 12, true,
-                            "NO.", null);
+                    buildTextContentTitle(builder,40,20,HeightRule.EXACTLY,TextOrientation.HORIZONTAL,DEFAULT_FONT_NAME,StyleIdentifier.NORMAL,
+                            12,true,"NO.", null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(170);
-                    builder.getRowFormat().setHeight(20);
-                    builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                    builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL, 12, true,
-                            "检查项目", null);
+                    buildTextContentTitle(builder,170,20,HeightRule.EXACTLY,TextOrientation.HORIZONTAL,DEFAULT_FONT_NAME,StyleIdentifier.NORMAL,
+                            12,true,"检查项目", null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(120);
-                    builder.getRowFormat().setHeight(20);
-                    builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                    builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL, 12, true,
-                            "测试地点", null);
+                    buildTextContentTitle(builder,120,20,HeightRule.EXACTLY,TextOrientation.HORIZONTAL,DEFAULT_FONT_NAME,StyleIdentifier.NORMAL,
+                            12,true,"测试地点", null);
                     builder.insertCell();
-                    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.NORMAL, 12, true,
-                            "结果", null);
+                    buildTextContentTitle(builder,40,20,HeightRule.EXACTLY,TextOrientation.HORIZONTAL,DEFAULT_FONT_NAME,StyleIdentifier.NORMAL,
+                            12, true,"结果", null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(100);
-                    builder.getRowFormat().setHeight(20);
-                    builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                    builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    buildTextContentTitle(builder, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL, 12, true,
-                            "备注", null);
+                    buildTextContentTitle(builder,100,20,HeightRule.EXACTLY,TextOrientation.HORIZONTAL,DEFAULT_FONT_NAME,StyleIdentifier.NORMAL,
+                            12, true,"备注", null);
                     builder.endRow();
                     int count =0;
                     for (ZhcxCommissionCheckDetailDo detailWordVO:res.getDetailList()){
@@ -1121,6 +1105,10 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
      * 内容添加
      *
      * @param builder         文档对象
+     * @param width           宽度
+     * @param height          高度
+     * @param heightRule      高度规则
+     * @param orientation     样式
      * @param fontName        字体名称
      * @param styleIdentifier 设置样式  正文 标题1 标题2 StyleIdentifier.HEADING_1
      * @param fontSize        字体大小
@@ -1129,8 +1117,16 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
      * @param prefixContent   内容前缀 此处用来做首行缩进
      * @throws Exception
      */
-    private void buildTextContentTitle(DocumentBuilder builder, String fontName, int styleIdentifier, int fontSize,
+    private void buildTextContentTitle(DocumentBuilder builder, double width,double height, int heightRule, int orientation,String fontName, int styleIdentifier, int fontSize,
                            boolean isBold, String content, String prefixContent) throws Exception {
+        //设置宽度
+        builder.getCellFormat().setWidth(width);
+        //设置高度
+        builder.getRowFormat().setHeight(height);
+        //设置HeightRule
+        builder.getRowFormat().setHeightRule(heightRule);
+        //设置样式
+        builder.getCellFormat().setOrientation(orientation);
         // 设置字体
         builder.getFont().setName(fontName);
         // 是否倾斜
@@ -1218,6 +1214,10 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
      * 内容添加
      *
      * @param builder         文档对象
+     * @param width           宽度
+     * @param height          高度
+     * @param heightRule      高度规则
+     * @param orientation     样式
      * @param fontName        字体名称
      * @param styleIdentifier 设置样式  正文 标题1 标题2 StyleIdentifier.HEADING_1
      * @param fontSize        字体大小
@@ -1226,8 +1226,16 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
      * @param prefixContent   内容前缀 此处用来做首行缩进
      * @throws Exception
      */
-    private void buildTableTitleContent(DocumentBuilder builder, String fontName, int styleIdentifier, int fontSize,
+    private void buildTableTitleContent(DocumentBuilder builder, double width,double height, int heightRule, int orientation, String fontName, int styleIdentifier, int fontSize,
                                    boolean isBold, String content, String prefixContent) throws Exception {
+        //设置宽度
+        builder.getCellFormat().setWidth(width);
+        //设置高度
+        builder.getRowFormat().setHeight(height);
+        //设置HeightRule
+        builder.getRowFormat().setHeightRule(heightRule);
+        //设置样式
+        builder.getCellFormat().setOrientation(orientation);
         // 设置字体
         builder.getFont().setName(fontName);
         // 是否倾斜
@@ -1450,6 +1458,10 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
             for (ZhcxCommissionCheckBaseInfoDetailDo item : list) {
                 String key = "";
                 String treeFullId = item.getTreefullid();
+                if (StringUtils.isBlank(treeFullId)){
+                    log.error("该内容节点treeFullId值为空:{}", item.getChtestcontent());
+                    return R.error(item.getChtestcontent()+"该内容节点数据有误");
+                }
                 int fillIdLength = treeFullId.split(",").length;
                 int i = treeFullId.indexOf(",");
                 if (fillIdLength<=3){
@@ -1457,8 +1469,9 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                     if(!resMap.containsKey(key)){
                         log.error("不能导出树表的id:{}的报告", treeFullId);
                         log.error("不能导出树表的key:{}的报告", key);
-                        log.error("章节号有无误:{}的报告", item.getChapterno());
-                        return R.error(item.getChapterno()+"章节号有无误");
+                        log.error("章节号有误:{}的报告", item.getChapterno());
+                        log.error("该内容节点数据有误:{}的报告", item.getChtestcontent());
+                        return R.error(item.getChtestcontent()+"该内容节点数据有误");
                     }
                 }else {
                     // 从第一个逗号之后开始找第二个逗号
@@ -1467,8 +1480,9 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                     if(!resMap.containsKey(key)){
                         log.error("不能导出树表的id:{}的报告", treeFullId);
                         log.error("不能导出树表的key:{}的报告", key);
-                        log.error("章节号有无误:{}的报告", item.getChapterno());
-                        return R.error(item.getChapterno()+"章节号有无误");
+                        log.error("章节号有误:{}的报告", item.getChapterno());
+                        log.error("该内容节点数据有误:{}的报告", item.getChtestcontent());
+                        return R.error(item.getChtestcontent()+"该内容节点数据有误");
                     }
                 }
                 ZhcxCommissionCheckDetailStandardWordVO checkDetailWordVO = resMap.get(key);
@@ -1498,47 +1512,26 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
                 if(ObjectUtil.isNotEmpty(res.getDetailList())){
                     // 插入表头
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(30);
-                    builder.getRowFormat().setHeight(20);
-                    builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                    builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    buildTableTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL, 9, true,"NO.", null);
+                    buildTableTitleContent(builder,30,20,HeightRule.EXACTLY,TextOrientation.HORIZONTAL,DEFAULT_FONT_NAME,StyleIdentifier.NORMAL,
+                            9, true,"NO.",null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(40);
-                    builder.getRowFormat().setHeight(20);
-                    builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                    builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    buildTableTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL, 9, true,"模式1", null);
+                    buildTableTitleContent(builder,40,20,HeightRule.EXACTLY,TextOrientation.HORIZONTAL,DEFAULT_FONT_NAME,StyleIdentifier.NORMAL,
+                            9, true,"模式1",null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(40);
-                    builder.getRowFormat().setHeight(20);
-                    builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                    builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    buildTableTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL, 9, true,"模式2", null);
+                    buildTableTitleContent(builder,40,20,HeightRule.EXACTLY,TextOrientation.HORIZONTAL,DEFAULT_FONT_NAME,StyleIdentifier.NORMAL,
+                            9, true,"模式2",null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(60);
-                    builder.getRowFormat().setHeight(20);
-                    builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                    builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    buildTableTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL, 9, true,"测试内容中文", null);
+                    buildTableTitleContent(builder,60,20,HeightRule.EXACTLY,TextOrientation.HORIZONTAL,DEFAULT_FONT_NAME,StyleIdentifier.NORMAL,
+                            9, true,"测试内容中文",null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(60);
-                    builder.getRowFormat().setHeight(20);
-                    builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                    builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    buildTableTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL, 9, true,"测试内容英文", null);
+                    buildTableTitleContent(builder,60,20,HeightRule.EXACTLY,TextOrientation.HORIZONTAL,DEFAULT_FONT_NAME,StyleIdentifier.NORMAL,
+                            9, true,"测试内容英文",null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(60);
-                    builder.getRowFormat().setHeight(20);
-                    builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                    builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    buildTableTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL, 9, true,"标准测试方法", null);
+                    buildTableTitleContent(builder,60,20,HeightRule.EXACTLY,TextOrientation.HORIZONTAL,DEFAULT_FONT_NAME,StyleIdentifier.NORMAL,
+                            9, true,"标准测试方法",null);
                     builder.insertCell();
-                    builder.getCellFormat().setWidth(60);
-                    builder.getRowFormat().setHeight(20);
-                    builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);//设置HeightRule
-                    builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);
-                    buildTableTitleContent(builder, DEFAULT_FONT_NAME, StyleIdentifier.NORMAL, 9, true,"测试地点", null);
+                    buildTableTitleContent(builder,60,20,HeightRule.EXACTLY,TextOrientation.HORIZONTAL,DEFAULT_FONT_NAME,StyleIdentifier.NORMAL,
+                            9, true,"测试地点",null);
                     builder.endRow();
                     for (ZhcxCommissionCheckBaseInfoDetailDo detailWordVO:res.getDetailList()){
                         // 插入表格的第一行

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

@@ -75,8 +75,8 @@ public class ZhcxCommissionCheckController {
         try {
             return commissionCheckService.exportFile(map,response);
         } catch (Exception e) {
-            ExceptionUtils.printExceptionDetail(e,"试车报告导出异常");
-            return R.error("试车报告导出异常");
+            ExceptionUtils.printExceptionDetail(e,"试车报告导出/预览异常");
+            return R.error("试车报告导出/预览异常");
         }
     }