|
@@ -1936,18 +1936,29 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
public void batchResetHtmlUrl(List<WbsTreePrivate> wbsTreePrivateList) throws IOException, InterruptedException {
|
|
|
//Thread.sleep(10000L);
|
|
|
if (wbsTreePrivateList != null) {
|
|
|
+ String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String projectId = wbsTreePrivateList.get(0).getProjectId();
|
|
|
+ String dir = file_path + "/privateUrlCopy/" +projectId;
|
|
|
+ File directory = new File(dir);
|
|
|
+ if (!directory.exists()){
|
|
|
+ directory.mkdir();
|
|
|
+ }
|
|
|
//存在htmlUrl才重新保存
|
|
|
+ System.out.println("copyHtml-去除空路径之前:"+wbsTreePrivateList.size());
|
|
|
wbsTreePrivateList = wbsTreePrivateList.stream().filter(wtp -> StringUtils.isNotBlank(wtp.getHtmlUrl())).collect(Collectors.toList());
|
|
|
- String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ System.out.println("copyHtml-去除重复路径之前:"+wbsTreePrivateList.size());
|
|
|
+ wbsTreePrivateList = wbsTreePrivateList.stream().collect(Collectors.toMap(WbsTreePrivate::getHtmlUrl,wbs->wbs,(w1,w2)->w1))
|
|
|
+ .values().stream().collect(Collectors.toList());
|
|
|
+ System.out.println("copyHtml-去除重复路径之后:"+wbsTreePrivateList.size());
|
|
|
//批量复制保存html
|
|
|
for (WbsTreePrivate tree : wbsTreePrivateList) {
|
|
|
String[] split = tree.getHtmlUrl().split("/");
|
|
|
File file_in = ResourceUtil.getFile(tree.getHtmlUrl());
|
|
|
- //File file_in = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\"+split[split.length-1]);
|
|
|
+// File file_in = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\"+split[split.length-1]);
|
|
|
if (!file_in.exists() || file_in.length() == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
- String htmlUrl = file_path + "/privateUrlCopy/" + split[split.length - 1];
|
|
|
+ String htmlUrl = file_path + "/privateUrlCopy/" +projectId+"/"+ split[split.length - 1];
|
|
|
//String htmlUrl = "C:\\Users\\泓创研发01\\Desktop\\privateUrlCopy\\" + split[split.length-1];
|
|
|
File file_out = ResourceUtil.getFile(htmlUrl);
|
|
|
FileUtil.copy(file_in, file_out);
|