瀏覽代碼

后管项目WBS树,同步新增表单

qianxb 1 年之前
父節點
當前提交
edf337a331

+ 25 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -1840,6 +1840,31 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
                     }
                 }
             }
+            //重置html路径
+            if (!insertDataPrivateList.isEmpty()) {
+                try {
+                    String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+                    Set<String> urls = new HashSet<>();
+                    for (WbsTreePrivate tree : insertDataPrivateList) {
+                        if (org.apache.commons.lang3.StringUtils.isNotBlank(tree.getHtmlUrl())) {
+                            String[] split = tree.getHtmlUrl().split("/");
+                            String htmlUrl = file_path + "privateUrlCopy/" + projectInfo.getId() + "/" + split[split.length - 1];
+                            if (!urls.contains(tree.getHtmlUrl())) {
+                                urls.add(tree.getHtmlUrl());
+                                File file_in = ResourceUtil.getFile(tree.getHtmlUrl());
+                                if (!file_in.exists() || file_in.length() == 0) {
+                                    continue;
+                                }
+                                File file_out = ResourceUtil.getFile(htmlUrl);
+                                FileUtil.copy(file_in, file_out);
+                            }
+                            tree.setHtmlUrl(htmlUrl);
+                        }
+                    }
+                }catch (Exception e){
+                    throw new ServiceException("重置表单路径错误");
+                }
+            }
 
             //新增同步到项目
             if (!insertDataPrivateList.isEmpty()) {