|
@@ -572,13 +572,33 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
List<Long> contractInfosIds = contractInfos.stream().filter(f -> 1 == f.getContractType()).map(ContractInfo::getId).collect(Collectors.toList());
|
|
|
|
|
|
Map<Long, WbsTreePrivate> maps = wbsTreePrivatesAllNow.stream().filter(f -> Objects.nonNull(f.getId())).collect(Collectors.toMap(WbsTreePrivate::getId, wbsTreePrivate -> wbsTreePrivate, (obj1, obj2) -> obj1));
|
|
|
-
|
|
|
+ String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ Set<String> urls = new HashSet<>();
|
|
|
for (WbsTreePrivate wbsTreePrivate : wbsTreePrivates) {
|
|
|
if (ObjectUtil.isNotEmpty(wbsTreePrivate)) {
|
|
|
WbsTreePrivate treePrivateNow = maps.getOrDefault(wbsTreePrivate.getId(), null);
|
|
|
//判断相同节点基础信息、元素表类型、元素表所属方是否发生改变
|
|
|
if (treePrivateNow != null && this.fieldsNotEqualPrivateWbs(wbsTreePrivate, treePrivateNow)) {
|
|
|
- //先复制html,并修改位置
|
|
|
+ try {
|
|
|
+ //先复制html,并修改位置
|
|
|
+ if (org.apache.commons.lang.StringUtils.isNotBlank(wbsTreePrivate.getHtmlUrl())) {
|
|
|
+ String[] split = wbsTreePrivate.getHtmlUrl().split("/");
|
|
|
+ String htmlUrl = file_path + "privateUrlCopy/" + projectId + "/" + split[split.length - 1];
|
|
|
+ if (!urls.contains(wbsTreePrivate.getHtmlUrl())) {
|
|
|
+ urls.add(wbsTreePrivate.getHtmlUrl());
|
|
|
+ File file_in = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
+ if (!file_in.exists() || file_in.length() == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ File file_out = ResourceUtil.getFile(htmlUrl);
|
|
|
+ FileUtil.copy(file_in, file_out);
|
|
|
+ }
|
|
|
+ wbsTreePrivate.setHtmlUrl(htmlUrl);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ throw new ServiceException("复制html时出错");
|
|
|
+ }
|
|
|
//修改项目wbs信息
|
|
|
WbsTreePrivate wbsPrivate = BeanUtil.copyProperties(wbsTreePrivate, WbsTreePrivate.class);
|
|
|
if (wbsPrivate != null) {
|
|
@@ -1939,7 +1959,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
if (wbsTreePrivateList != null) {
|
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
String projectId = wbsTreePrivateList.get(0).getProjectId();
|
|
|
- String dir = file_path + "/privateUrlCopy/" +projectId;
|
|
|
+ String dir = file_path + "privateUrlCopy/" +projectId;
|
|
|
File directory = new File(dir);
|
|
|
if (!directory.exists()){
|
|
|
directory.mkdir();
|
|
@@ -1955,7 +1975,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
//批量复制保存html
|
|
|
for (WbsTreePrivate tree : wbsTreePrivateList) {
|
|
|
String[] split = tree.getHtmlUrl().split("/");
|
|
|
- String htmlUrl = file_path + "/privateUrlCopy/" +projectId+"/"+ split[split.length - 1];
|
|
|
+ String htmlUrl = file_path + "privateUrlCopy/" +projectId+"/"+ split[split.length - 1];
|
|
|
if (!urls.contains(tree.getHtmlUrl())){
|
|
|
urls.add(tree.getHtmlUrl());
|
|
|
File file_in = ResourceUtil.getFile(tree.getHtmlUrl());
|