|
@@ -32,6 +32,7 @@ import java.nio.file.Files;
|
|
import java.nio.file.StandardCopyOption;
|
|
import java.nio.file.StandardCopyOption;
|
|
import java.rmi.ServerException;
|
|
import java.rmi.ServerException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -634,7 +635,7 @@ public class WbsSynchronousServiceImpl {
|
|
if (wbsTreePrivates.isEmpty()) {
|
|
if (wbsTreePrivates.isEmpty()) {
|
|
throw new ServiceException("无法找到模板对应节点,请检查模板节点");
|
|
throw new ServiceException("无法找到模板对应节点,请检查模板节点");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ Map<Long, WbsTreePrivate> collect1 = wbsTreePrivates.stream().collect(Collectors.toMap(WbsTreePrivate::getPKeyId, Function.identity()));
|
|
//合同同步
|
|
//合同同步
|
|
for (ContractInfo contractInfo : contractInfos) {
|
|
for (ContractInfo contractInfo : contractInfos) {
|
|
//获取合同下当前节点的数据
|
|
//获取合同下当前节点的数据
|
|
@@ -685,114 +686,114 @@ public class WbsSynchronousServiceImpl {
|
|
|
|
|
|
//筛选出需要更新的节点 同时做数据隔离
|
|
//筛选出需要更新的节点 同时做数据隔离
|
|
List<WbsTreeContract> editContractNodes = new ArrayList<>();
|
|
List<WbsTreeContract> editContractNodes = new ArrayList<>();
|
|
- for (WbsTreePrivate templateNode : wbsTreePrivates) {
|
|
|
|
- //更新只跟新表单
|
|
|
|
- for (WbsTreeContract editContractNode : wbsTreeContracts) {
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // 判断模板表与项目表 html是否一致
|
|
|
|
- if (ObjectUtils.equals(templateNode.getPKeyId(), editContractNode.getIsTypePrivatePid())) {
|
|
|
|
- if (templateNode.getType() == 2) {
|
|
|
|
- //同步范围 当前节点是否允许修改
|
|
|
|
- Boolean isSync = false;
|
|
|
|
-
|
|
|
|
- //是否记录历史html
|
|
|
|
- Boolean isOldHtml = false;
|
|
|
|
-
|
|
|
|
- if (CollectionUtil.isNotEmpty(contractRanges)) {
|
|
|
|
- switch (Integer.valueOf(wbsTreePrivate.getWbsType())) {
|
|
|
|
- //质检
|
|
|
|
- case 1:
|
|
|
|
- //判断是否已保存
|
|
|
|
- if (StringUtils.isEmpty(editContractNode.getInitTableName())) {
|
|
|
|
- throw new ServiceException(editContractNode.getNodeName() + "( " + editContractNode.getPKeyId() + ")--实体表不存在");
|
|
|
|
- }
|
|
|
|
- String isSave = "select count(0) from " + editContractNode.getInitTableName() + " where p_key_id = " + editContractNode.getPKeyId();
|
|
|
|
- Integer i = jdbcTemplate.queryForObject(isSave, Integer.class);
|
|
|
|
|
|
|
|
- //判断是否上报审批
|
|
|
|
- Integer submit = informationQueryMap.get(editContractNode.getPId());
|
|
|
|
|
|
+ //更新只跟新表单
|
|
|
|
+ for (WbsTreeContract editContractNode : wbsTreeContracts) {
|
|
|
|
+ if (editContractNode.getType() != 2 || editContractNode.getIsTypePrivatePid() == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ WbsTreePrivate templateNode = collect1.get(editContractNode.getIsTypePrivatePid());
|
|
|
|
|
|
- if (submit == null && contractRanges.contains(WbsSyncTypeEnum.NOT_FILLED_IN.code)) {
|
|
|
|
- //未填报 101
|
|
|
|
- isSync = true;
|
|
|
|
|
|
+ // 判断模板表与项目表 html是否一致
|
|
|
|
+ if (templateNode != null) {
|
|
|
|
+ if (templateNode.getType() == 2) {
|
|
|
|
+ //同步范围 当前节点是否允许修改
|
|
|
|
+ Boolean isSync = false;
|
|
|
|
+
|
|
|
|
+ //是否记录历史html
|
|
|
|
+ Boolean isOldHtml = false;
|
|
|
|
+
|
|
|
|
+ if (CollectionUtil.isNotEmpty(contractRanges)) {
|
|
|
|
+ switch (Integer.valueOf(wbsTreePrivate.getWbsType())) {
|
|
|
|
+ //质检
|
|
|
|
+ case 1:
|
|
|
|
+ //判断是否已保存
|
|
|
|
+ if (StringUtils.isEmpty(editContractNode.getInitTableName())) {
|
|
|
|
+ throw new ServiceException(editContractNode.getNodeName() + "( " + editContractNode.getPKeyId() + ")--实体表不存在");
|
|
|
|
+ }
|
|
|
|
+ String isSave = "select count(0) from " + editContractNode.getInitTableName() + " where p_key_id = " + editContractNode.getPKeyId();
|
|
|
|
+ Integer i = jdbcTemplate.queryForObject(isSave, Integer.class);
|
|
|
|
+
|
|
|
|
+ //判断是否上报审批
|
|
|
|
+ Integer submit = informationQueryMap.get(editContractNode.getPId());
|
|
|
|
+
|
|
|
|
+ if (submit == null && contractRanges.contains(WbsSyncTypeEnum.NOT_FILLED_IN.code)) {
|
|
|
|
+ //未填报 101
|
|
|
|
+ isSync = true;
|
|
|
|
+ } else {
|
|
|
|
+ //没有选择未填报,但是表单查不到数据,表示这个节点有问题
|
|
|
|
+ if (i == 0 && !contractRanges.contains(WbsSyncTypeEnum.NOT_FILLED_IN.code)) {
|
|
|
|
+ errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未填报;");
|
|
} else {
|
|
} else {
|
|
- //没有选择未填报,但是表单查不到数据,表示这个节点有问题
|
|
|
|
- if (i == 0 && !contractRanges.contains(WbsSyncTypeEnum.NOT_FILLED_IN.code)) {
|
|
|
|
- errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未填报;");
|
|
|
|
|
|
+ if (contractRanges.contains(WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED.code) && (submit == null || submit == 0)) {
|
|
|
|
+ //已填报-未上报 102
|
|
|
|
+ isSync = true;
|
|
} else {
|
|
} else {
|
|
- if (contractRanges.contains(WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED.code) && (submit == null || submit == 0)) {
|
|
|
|
- //已填报-未上报 102
|
|
|
|
- isSync = true;
|
|
|
|
|
|
+ if (submit == null) {
|
|
|
|
+ isSync = false;
|
|
|
|
+ errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未上报;");
|
|
} else {
|
|
} else {
|
|
- if (submit == null) {
|
|
|
|
- isSync = false;
|
|
|
|
- errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未上报;");
|
|
|
|
- } else {
|
|
|
|
- if (submit == 1 && contractRanges.contains(WbsSyncTypeEnum.PENDING_APPROVAL.code)) {
|
|
|
|
- //待审批 104
|
|
|
|
- isSync = true;
|
|
|
|
- isOldHtml = true;
|
|
|
|
- } else if (submit == 2 && contractRanges.contains(WbsSyncTypeEnum.APPROVED.code)) {
|
|
|
|
- //已审批 105
|
|
|
|
- isSync = true;
|
|
|
|
- isOldHtml = true;
|
|
|
|
- }
|
|
|
|
|
|
+ if (submit == 1 && contractRanges.contains(WbsSyncTypeEnum.PENDING_APPROVAL.code)) {
|
|
|
|
+ //待审批 104
|
|
|
|
+ isSync = true;
|
|
|
|
+ isOldHtml = true;
|
|
|
|
+ } else if (submit == 2 && contractRanges.contains(WbsSyncTypeEnum.APPROVED.code)) {
|
|
|
|
+ //已审批 105
|
|
|
|
+ isSync = true;
|
|
|
|
+ isOldHtml = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- break;
|
|
|
|
- //试验
|
|
|
|
- case 2:
|
|
|
|
- break;
|
|
|
|
- //计量
|
|
|
|
- case 3:
|
|
|
|
- break;
|
|
|
|
- //日志
|
|
|
|
- case 4:
|
|
|
|
- break;
|
|
|
|
- //征地拆迁
|
|
|
|
- case 5:
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- isSync = true;
|
|
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ //试验
|
|
|
|
+ case 2:
|
|
|
|
+ break;
|
|
|
|
+ //计量
|
|
|
|
+ case 3:
|
|
|
|
+ break;
|
|
|
|
+ //日志
|
|
|
|
+ case 4:
|
|
|
|
+ break;
|
|
|
|
+ //征地拆迁
|
|
|
|
+ case 5:
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ isOldHtml = true;
|
|
|
|
+ isSync = true;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
- //清表 公式 元素
|
|
|
|
- if (collect.contains(2) || collect.contains(3) || collect.contains(5)) {
|
|
|
|
- if (collect.contains(2) && (templateNode.getHtmlUrl() == null || templateNode.getInitTableName() == null || templateNode.getExcelId() == null)) {
|
|
|
|
- errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未配置清表;");
|
|
|
|
- } else {
|
|
|
|
- editContractNode.setExcelId(templateNode.getExcelId());
|
|
|
|
- editContractNode.setInitTableName(templateNode.getInitTableName());
|
|
|
|
- editContractNode.setHtmlUrl(templateNode.getHtmlUrl());
|
|
|
|
- if (templateNode.getExcelId() != null) {
|
|
|
|
- editContractNode.setIsLinkTable(2);
|
|
|
|
- }
|
|
|
|
|
|
+ //清表 公式 元素
|
|
|
|
+ if (collect.contains(2) || collect.contains(3) || collect.contains(5)) {
|
|
|
|
+ if (collect.contains(2) && (templateNode.getHtmlUrl() == null || templateNode.getInitTableName() == null || templateNode.getExcelId() == null)) {
|
|
|
|
+ errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未配置清表;");
|
|
|
|
+ } else {
|
|
|
|
+ editContractNode.setExcelId(templateNode.getExcelId());
|
|
|
|
+ editContractNode.setInitTableName(templateNode.getInitTableName());
|
|
|
|
+ editContractNode.setHtmlUrl(templateNode.getHtmlUrl());
|
|
|
|
+ if (templateNode.getExcelId() != null) {
|
|
|
|
+ editContractNode.setIsLinkTable(2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //排序
|
|
|
|
- if (collect.contains(7)) {
|
|
|
|
- editContractNode.setSort(templateNode.getSort());
|
|
|
|
|
|
+ }
|
|
|
|
+ //排序
|
|
|
|
+ if (collect.contains(7)) {
|
|
|
|
+ editContractNode.setSort(templateNode.getSort());
|
|
|
|
+ }
|
|
|
|
+ //手动选中的表单 进行筛选
|
|
|
|
+ if (collect.contains(2) || collect.contains(3) || collect.contains(4) || collect.contains(5) || collect.contains(6) || collect.contains(7)) {
|
|
|
|
+ if (isSync) {
|
|
|
|
+ editContractNodes.add(editContractNode);
|
|
}
|
|
}
|
|
- //手动选中的表单 进行筛选
|
|
|
|
- if (collect.contains(2) || collect.contains(3) || collect.contains(4) || collect.contains(5) || collect.contains(6) || collect.contains(7)) {
|
|
|
|
- if (isSync) {
|
|
|
|
- editContractNodes.add(editContractNode);
|
|
|
|
- }
|
|
|
|
- //记录历史html
|
|
|
|
- if (isOldHtml) {
|
|
|
|
- oldHtml.add(editContractNode);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ //记录历史html
|
|
|
|
+ if (isOldHtml) {
|
|
|
|
+ oldHtml.add(editContractNode);
|
|
}
|
|
}
|
|
- //找到了某个选中节点下与项目节点想同的节点了 提前结束循环,节省资源
|
|
|
|
- break;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -800,33 +801,17 @@ public class WbsSynchronousServiceImpl {
|
|
|
|
|
|
//合同段新增节点
|
|
//合同段新增节点
|
|
List<WbsTreeContract> addContractNode = null;
|
|
List<WbsTreeContract> addContractNode = null;
|
|
- if (addPrivateNodes != null) {
|
|
|
|
|
|
+ if (addPrivateNodes != null && (CollectionUtil.isEmpty(collect) || collect.contains(1))) {
|
|
addContractNode = BeanUtil.copyProperties(addPrivateNodes, WbsTreeContract.class);
|
|
addContractNode = BeanUtil.copyProperties(addPrivateNodes, WbsTreeContract.class);
|
|
}
|
|
}
|
|
|
|
|
|
- //转类型排序
|
|
|
|
- List<Integer> integers = new ArrayList<>(collect);
|
|
|
|
- Collections.sort(integers);
|
|
|
|
- for (Integer i : integers) {
|
|
|
|
- switch (i) {
|
|
|
|
- //添加表单
|
|
|
|
- case 1:
|
|
|
|
- List<WbsTreeContract> list = insertContractForm(wbsTreeSynchronousRecord, contractInfo, wbsTreeContracts, addContractNode, errorMsg);
|
|
|
|
- addData.addAll(list);
|
|
|
|
- break;
|
|
|
|
- //清表配置
|
|
|
|
- case 2:
|
|
|
|
- //元素配置
|
|
|
|
- case 3:
|
|
|
|
- //公式配置
|
|
|
|
- case 5:
|
|
|
|
- //排序
|
|
|
|
- case 7:
|
|
|
|
- editData.addAll(editContractNodes);
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ if (CollectionUtil.isNotEmpty(addContractNode)) {
|
|
|
|
+ List<WbsTreeContract> list = insertContractForm(wbsTreeSynchronousRecord, contractInfo, wbsTreeContracts, addContractNode, errorMsg);
|
|
|
|
+ addData.addAll(list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (CollectionUtil.isNotEmpty(editContractNodes)) {
|
|
|
|
+ editData.addAll(editContractNodes);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|