|
|
@@ -137,18 +137,40 @@ public class WbsDivideServiceImpl extends BaseServiceImpl<WbsDivideMapper, WbsDi
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+ // 先删除该pKeyId的所有已有绑定
|
|
|
+ log.info("批量绑定前,先删除pKeyId={}的所有已有绑定", pKeyId);
|
|
|
+ unbindAllByPKeyId(pKeyId);
|
|
|
+
|
|
|
+ // 重新绑定
|
|
|
int successCount = 0;
|
|
|
for (DivideClientVo divideClientVo : divideClientVos) {
|
|
|
- boolean result = bind(pKeyId, divideClientVo, projectId, contractId);
|
|
|
- if (result) {
|
|
|
+ // 创建新记录(不再需要检查是否存在,因为已经全部删除了)
|
|
|
+ WbsDivide wbsDivide = new WbsDivide();
|
|
|
+ wbsDivide.setPKeyId(pKeyId);
|
|
|
+ wbsDivide.setDivideId(divideClientVo.getId());
|
|
|
+ wbsDivide.setName(divideClientVo.getName());
|
|
|
+ wbsDivide.setParentId(divideClientVo.getParentId());
|
|
|
+ wbsDivide.setContractId(contractId);
|
|
|
+ wbsDivide.setDivideNum(divideClientVo.getDivideNum());
|
|
|
+ wbsDivide.setProjectId(projectId);
|
|
|
+
|
|
|
+ if (save(wbsDivide)) {
|
|
|
successCount++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- log.info("批量绑定节点,pKeyId={}, 总数={}, 成功={}", pKeyId, divideClientVos.size(), successCount);
|
|
|
+ log.info("批量绑定节点完成,pKeyId={}, 总数={}, 成功={}", pKeyId, divideClientVos.size(), successCount);
|
|
|
return successCount;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean unbindAllByPKeyId(Long pKeyId) {
|
|
|
+ Integer rows = baseMapper.unbindAllByPKeyId(pKeyId);
|
|
|
+ log.info("批量解绑pKeyId={}的记录,影响行数={}", pKeyId, rows);
|
|
|
+ return rows != null && rows > 0;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<String> getBindedDivideIds(Long pKeyId) {
|
|
|
List<WbsDivide> list = baseMapper.selectByPKeyId(pKeyId);
|
|
|
@@ -202,7 +224,7 @@ public class WbsDivideServiceImpl extends BaseServiceImpl<WbsDivideMapper, WbsDi
|
|
|
// 3. 使用informationQueryClient.getInfoByWbsId获取InformationQuery对象
|
|
|
// 第二个参数classify传0
|
|
|
org.springblade.business.entity.InformationQuery informationQuery =
|
|
|
- informationQueryClient.getInfoByWbsId(pKeyId, 0);
|
|
|
+ informationQueryClient.getInfoByWbsId(pKeyId, 1);
|
|
|
|
|
|
if (informationQuery != null && informationQuery.getPdfUrl() != null
|
|
|
&& !informationQuery.getPdfUrl().trim().isEmpty()) {
|