Explorar o código

电签默认信息相关bug

liuyc %!s(int64=2) %!d(string=hai) anos
pai
achega
7e2b27e48c

+ 32 - 23
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TextdictInfoController.java

@@ -44,6 +44,7 @@ import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.excel.WbsExcelBatchUtil;
 import org.springblade.manager.mapper.WbsTreePrivateMapper;
+import org.springblade.manager.service.impl.WbsTreePrivateServiceImpl;
 import org.springblade.manager.utils.CopyUtil;
 import org.springblade.manager.vo.TextdictBy345VO;
 import org.springblade.manager.vo.TextdictDataInfoVO;
@@ -82,6 +83,7 @@ public class TextdictInfoController extends BladeController {
 
     private final ITextdictInfoService textdictInfoService;
     private final WbsTreePrivateMapper wbsTreePrivateMapper;
+    private final WbsTreePrivateServiceImpl wbsTreePrivateService;
 
     private final JdbcTemplate jdbcTemplate;
 
@@ -346,7 +348,7 @@ public class TextdictInfoController extends BladeController {
         //获取当前项目下引用相同模板的元素表信息
         List<WbsTreePrivate> wbsTreePrivatesEqual = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
                 .eq(WbsTreePrivate::getProjectId, wbsTreePrivate.getProjectId())
-                .eq(WbsTreePrivate::getHtmlUrl, wbsTreePrivate.getHtmlUrl())
+                .eq(WbsTreePrivate::getExcelId, wbsTreePrivate.getExcelId())
                 .eq(WbsTreePrivate::getStatus, 1));
         List<Long> pKeyIds = wbsTreePrivatesEqual.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
         String ids = StringUtils.join(pKeyIds, ",");
@@ -425,6 +427,12 @@ public class TextdictInfoController extends BladeController {
         File writeFile = new File(wbsTreePrivate.getHtmlUrl());
         FileUtil.writeToFile(writeFile, doc.html(), Boolean.parseBoolean("UTF-8"));
 
+        String replace = wbsTreePrivate.getHtmlUrl().replace("\\", "\\\\");
+
+        //修改所有节点的htmlUrl
+        String updateSql = "update m_wbs_tree_private set html_url = '" + replace + "' where p_key_id in (" + ids + ")";
+        jdbcTemplate.execute(updateSql);
+
         return R.success("操作成功");
     }
 
@@ -441,9 +449,10 @@ public class TextdictInfoController extends BladeController {
         //获取当前项目下引用相同模板的元素表信息
         List<WbsTreePrivate> wbsTreePrivatesEqual = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
                 .eq(WbsTreePrivate::getProjectId, wbsTreePrivate.getProjectId())
-                .eq(WbsTreePrivate::getHtmlUrl, wbsTreePrivate.getHtmlUrl())
+                .eq(WbsTreePrivate::getExcelId, wbsTreePrivate.getExcelId())
                 .eq(WbsTreePrivate::getStatus, 1));
         List<Long> pKeyIds = wbsTreePrivatesEqual.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
+        String ids = StringUtils.join(pKeyIds, ",");
 
         //读取html页面信息
         File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
@@ -480,36 +489,17 @@ public class TextdictInfoController extends BladeController {
             textDictBean.setSigRoleName(textdictInfo.getTextId());
             textDictBean.setIsDeleted(0);
 
-            if (textdictInfo.getType() == 4) { //默认值
-                textDictBean.setType(4);
-                textDictBean.setName("编辑默认值");
-            }
-
-            if (textdictInfo.getType() == 5) { // 提示语
-                textDictBean.setType(5);
-                textDictBean.setName("提示信息");
-                String lastHtml = "";
-                if (element.html().indexOf("el-tooltip") >= 0) {
-                    element.children().attr("content", textdictInfo.getTextId());
-                } else {
-                    lastHtml = " <el-tooltip content='" + textdictInfo.getTextId() + "' placement='top' effect='customized'>" + element.html() + "</el-tooltip>";
-                    element.empty().append(lastHtml);
-                }
-                File writeFile = new File(wbsTreePrivate.getHtmlUrl());
-                FileUtil.writeToFile(writeFile, doc.html(), Boolean.parseBoolean("UTF-8"));
-            }
-
             textDictInfosNew.add(textDictBean);
 
             //重新构造赋值
-            if (textDictBean.getType() == 4) {
+            if (textdictInfo.getType() == 4) {
                 for (TextdictInfo obj : textDictInfosNew) {
                     obj.setId(SnowFlakeUtil.getId());
                     obj.setTabId(pKeyId.toString());
                     obj.setType(4);
                     obj.setName("编辑默认值");
                 }
-            } else if (textDictBean.getType() == 5) {
+            } else if (textdictInfo.getType() == 5) {
                 for (TextdictInfo obj : textDictInfosNew) {
                     obj.setId(SnowFlakeUtil.getId());
                     obj.setTabId(pKeyId.toString());
@@ -526,6 +516,25 @@ public class TextdictInfoController extends BladeController {
             //批量新增
             textdictInfoService.saveBatch(textDictInfosNew);
         }
+
+        if (textdictInfo.getType() == 5) { // 提示语
+            String lastHtml = "";
+            if (element.html().indexOf("el-tooltip") >= 0) {
+                element.children().attr("content", textdictInfo.getTextId());
+            } else {
+                lastHtml = " <el-tooltip content='" + textdictInfo.getTextId() + "' placement='top' effect='customized'>" + element.html() + "</el-tooltip>";
+                element.empty().append(lastHtml);
+            }
+            File writeFile = new File(wbsTreePrivate.getHtmlUrl());
+            FileUtil.writeToFile(writeFile, doc.html(), Boolean.parseBoolean("UTF-8"));
+        }
+
+        String replace = wbsTreePrivate.getHtmlUrl().replace("\\", "\\\\");
+
+        //修改所有节点的htmlUrl
+        String updateSql = "update m_wbs_tree_private set html_url = '" + replace + "' where p_key_id in (" + ids + ")";
+        jdbcTemplate.execute(updateSql);
+
         return R.success("操作成功");
     }