|
|
@@ -6134,8 +6134,12 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
public void setFormulaReference(FormulaReferenceDTO dto) {
|
|
|
try {
|
|
|
dto.setKey(dto.getKey().split("__")[0]);
|
|
|
- //查询父节点
|
|
|
- WbsTreeContract parentNode = wbsTreeContractMapper.selectById(dto.getPId());
|
|
|
+ WbsTreeContract parentNode = null;
|
|
|
+ if(dto.getType() == 1){
|
|
|
+ //查询父节点
|
|
|
+ parentNode = wbsTreeContractMapper.selectById(dto.getPId());
|
|
|
+ }
|
|
|
+
|
|
|
//查询父节点的扩展信息
|
|
|
WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(dto.getPKeyId());
|
|
|
|
|
|
@@ -6159,11 +6163,19 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
}else{
|
|
|
if(dto.getStatus() == 0){
|
|
|
WbsTreeContractExtend wbsTreeContractExtend = new WbsTreeContractExtend();
|
|
|
- wbsTreeContractExtend.setPKeyId(parentNode.getPKeyId());
|
|
|
- wbsTreeContractExtend.setContractId(Long.valueOf(parentNode.getContractId()));
|
|
|
+ if(dto.getType() == 1){
|
|
|
+ if(parentNode == null){
|
|
|
+ throw new ServiceException("父节点不存在");
|
|
|
+ }
|
|
|
+ wbsTreeContractExtend.setPKeyId(parentNode.getPKeyId());
|
|
|
+ wbsTreeContractExtend.setContractId(Long.valueOf(parentNode.getContractId()));
|
|
|
+ wbsTreeContractExtend.setAncestors(parentNode.getAncestorsPId());
|
|
|
+ }
|
|
|
+ if(dto.getType() == 2){
|
|
|
+ wbsTreeContractExtend.setPKeyId(dto.getPId());
|
|
|
+ }
|
|
|
wbsTreeContractExtend.setType(null);
|
|
|
wbsTreeContractExtend.setIsSync(0);
|
|
|
- wbsTreeContractExtend.setAncestors(parentNode.getAncestorsPId());
|
|
|
wbsTreeContractExtend.setFormulaConfig(dto.getInitTableName() + ":" + dto.getKey());
|
|
|
wbsTreeContractExtendService.save(wbsTreeContractExtend);
|
|
|
}
|