|
@@ -52,6 +52,7 @@ import java.util.stream.Collectors;
|
|
|
public class FormulaController {
|
|
|
private final FormulaServiceImpl service;
|
|
|
private final IExcelTabService tabService;
|
|
|
+ private final IWbsTreeService wbsTreeService;
|
|
|
private final IElementFormulaMappingService elementFormulaMappingService;
|
|
|
private final JdbcTemplate jdbcTemplate;
|
|
|
private final IContractInfoService contractInfoService;
|
|
@@ -101,7 +102,15 @@ public class FormulaController {
|
|
|
efm.setNodeId(f.getNodeId());
|
|
|
efm.setProjectId(f.getProjectId());
|
|
|
if(f.getScope()<=2&&f.getScope()>0){
|
|
|
- throw new ServiceException("缺少wbsId");
|
|
|
+ if(f.getWbsId()==null&&f.getNodeId()==null) {
|
|
|
+ throw new ServiceException("wbsId和nodeId 必须有一个");
|
|
|
+ }if(f.getWbsId()!=null){
|
|
|
+ efm.setWbsId(f.getWbsId());
|
|
|
+ }else{
|
|
|
+ WbsTree wbsTree =this.wbsTreeService.getById(f.getNodeId());
|
|
|
+ efm.setWbsId(Long.parseLong(wbsTree.getWbsId()));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
this.elementFormulaMappingService.save(efm);
|
|
|
/*假如不存在projectId则认为是系统级模版公式,必须同步给所有项目TODO*/
|
|
@@ -172,7 +181,7 @@ public class FormulaController {
|
|
|
if(f.getElementId()!=null){
|
|
|
StringBuilder sb = new StringBuilder("select b.* from m_element_formula_mapping a INNER JOIN m_formula b on a.formula_id=b.id where a.element_id="+f.getElementId()+" and b.is_deleted=0 and a.scope ="+f.getScope());
|
|
|
if(StringUtils.isNotEquals(0,f.getScope())){
|
|
|
- if(Func.isNotEmpty(f.getNodeId())){
|
|
|
+ if(Func.isNotEmpty(f.getNodeId())&&(f.getScope().equals(FormulaBean.PRO_PART)||f.getScope().equals(FormulaBean.WBS_PART))){
|
|
|
sb.append(" and a.node_id=").append(f.getNodeId());
|
|
|
}
|
|
|
if(Func.isNotEmpty(f.getProjectId())){
|