|
@@ -1166,9 +1166,19 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
|
|
|
//同步到该项目下的所有合同段
|
|
|
for (ContractInfo contractInfoId : contractInfoIds) {
|
|
|
- WbsTreeContract wbsTreeContract = getWbsTreeContract(wbsTreePrivate,pawDTO);
|
|
|
+ WbsTreeContract wbsTreeContract = getWbsTreeContract(wbsTreePrivate, pawDTO);
|
|
|
wbsTreeContract.setContractId(String.valueOf(contractInfoId.getId()));
|
|
|
- wbsTreeContractMapper.insert(wbsTreeContract);
|
|
|
+
|
|
|
+ //判断元素表是否存在上级节点,存在则新增;不存在则表示没被引用,不新增
|
|
|
+ WbsTreeContract wbsTreeContract1 = wbsTreeContractMapper.selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
+ .eq(WbsTreeContract::getProjectId, wbsTreeContract.getProjectId())
|
|
|
+ .eq(WbsTreeContract::getContractId, contractInfoId.getId())
|
|
|
+ .eq(WbsTreeContract::getType, 1)
|
|
|
+ .eq(WbsTreeContract::getId, wbsTreePrivate.getParentId())
|
|
|
+ );
|
|
|
+ if (wbsTreeContract1 != null) {
|
|
|
+ wbsTreeContractMapper.insert(wbsTreeContract);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
});
|
|
@@ -1176,7 +1186,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- }else if (pawDTO.getReferenceType().equals("private")) {
|
|
|
+ } else if (pawDTO.getReferenceType().equals("private")) {
|
|
|
//私有同步新增元素表
|
|
|
//获取所私有引用项目的新增的元素表 根据primaryKeyId获取对象信息
|
|
|
WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>query().lambda()
|
|
@@ -1233,12 +1243,22 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
|
|
|
//同步到该项目下的所有合同段
|
|
|
for (ContractInfo contractInfoId : contractInfoIds) {
|
|
|
- WbsTreeContract wbsTreeContract = getWbsTreeContract(list,pawDTO);
|
|
|
+ WbsTreeContract wbsTreeContract = getWbsTreeContract(list, pawDTO);
|
|
|
wbsTreeContract.setContractId(String.valueOf(contractInfoId.getId()));
|
|
|
wbsTreeContract.setWbsId(pawDTO.getPrimaryKeyId());
|
|
|
- wbsTreeContractMapper.insert(wbsTreeContract);
|
|
|
- }
|
|
|
|
|
|
+ //判断元素表是否存在上级节点,存在则新增;不存在则表示没被引用,不新增
|
|
|
+ WbsTreeContract wbsTreeContract1 = wbsTreeContractMapper.selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
+ .eq(WbsTreeContract::getProjectId, wbsTreeContract.getProjectId())
|
|
|
+ .eq(WbsTreeContract::getContractId, wbsTreeContract.getContractId())
|
|
|
+ .eq(WbsTreeContract::getWbsId, wbsTreeContract.getWbsId())
|
|
|
+ .eq(WbsTreeContract::getType, 1)
|
|
|
+ .eq(WbsTreeContract::getId, wbsTreeContract.getParentId())
|
|
|
+ );
|
|
|
+ if (wbsTreeContract1 != null) {
|
|
|
+ wbsTreeContractMapper.insert(wbsTreeContract);
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
wbsTreePrivateService.saveBatch(lists, 10000);
|