|
@@ -124,6 +124,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
if(Func.isEmpty(nodes)){
|
|
|
nodes=wpService.chain(contractId,one.getRelateId(),primaryKeyId,null);
|
|
|
}
|
|
|
+ if(Func.isEmpty(nodes)){
|
|
|
+ this.tec.getLog().append("WBS信息缺失;");
|
|
|
+ }
|
|
|
this.constantMap.put(CHAIN,nodes.stream().map(WbsTreeContract::getNodeName).collect(Collectors.toList()));
|
|
|
/*节点参数*/
|
|
|
this.constantMap.put(WP,getWpMap(one));
|
|
@@ -149,6 +152,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
});
|
|
|
missingFill(missingList);
|
|
|
+ if(Func.isNotEmpty(missingList)){
|
|
|
+ this.tec.getLog().append("无法识别的依赖:").append(missingList.stream().map(e->e.replaceAll("'","")).collect(Collectors.joining(",")));
|
|
|
+ }
|
|
|
/*实测值参数*/
|
|
|
List<Map<String,Object>> textInfoMap= this.jdbcTemplate.queryForList("SELECT b.tab_id pkId, b.col_key ekey,b.col_name val ,c.init_table_name tableName " +
|
|
|
"from m_wbs_tree_contract a " +
|
|
@@ -342,6 +348,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
result.put(p.getK(),p.getV());
|
|
|
}
|
|
|
}
|
|
|
+ this.tec.getLog().append("本节点参数情况:").append(result.entrySet().stream().map(p->p.getKey()+":"+p.getValue()).collect(Collectors.joining(";")));
|
|
|
/*元素动态绑定*/
|
|
|
this.formDataMap.values().stream().filter(e->e.getIsCurrentNodeElement()&&e.getFormula()==null).forEach(e->{
|
|
|
/*执行列表里不存在,且元素的名称和节点参数名称匹配成功*/
|
|
@@ -356,6 +363,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
formula.setFormula("WP["+d.getK()+"]");
|
|
|
}
|
|
|
e.setFormula(formula);
|
|
|
+ tec.getLog().append("动态绑定参数:").append(e.getEName()).append(";");
|
|
|
this.formDataList.add(e);
|
|
|
});
|
|
|
});
|
|
@@ -464,7 +472,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
});
|
|
|
if(ele.size()<relyList.size()){
|
|
|
- System.out.println(formula.getFormula()+"不满足依赖要求");
|
|
|
+ this.tec.getLog().append(fd.getEName()).append(fd.getFormula().getFormula().replaceAll("'", "")).append("不满足执行依赖;");
|
|
|
}
|
|
|
LinkedHashMap<String,FormData> fdMap =new LinkedHashMap<>();
|
|
|
ele.forEach(e->{
|
|
@@ -504,7 +512,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
write(fd,data);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
- write(fd,"计算错误");
|
|
|
+ tec.getLog().append(fd.getEName()).append("计算错误; ");
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -702,9 +710,6 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
* 先把公式脚本需要聚合部分预处理
|
|
|
* */
|
|
|
public void polymerization(FormData fd){
|
|
|
-// for(FormData fd:this.formDataList){
|
|
|
-// Formula formula = fd.getFormula();
|
|
|
-// }
|
|
|
Formula formula = fd.getFormula();
|
|
|
if(Func.isNotEmpty(formula)){
|
|
|
String f=formula.getFormula();
|
|
@@ -730,9 +735,15 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}else{
|
|
|
Map<String, Object> currentMap = new HashMap<>(this.constantMap);
|
|
|
List<String> relyList = fd.getFormula().getRelyList();
|
|
|
- List<FormData> tmp = this.formDataList.stream().filter(e -> relyList.contains(e.getCode())).collect(Collectors.toList());
|
|
|
Map<String, Object> E = getMap(currentMap, "E");
|
|
|
- tmp.forEach(e -> E.put(e.getCode(), e.getValues().stream().map(ElementData::getValue).collect(Collectors.toList())));
|
|
|
+ for(String k:relyList){
|
|
|
+ FormData e=this.formDataMap.get(k);
|
|
|
+ if(e==null){
|
|
|
+ this.tec.getLog().append(fd.getEName()).append("缺失依赖:").append(k);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ E.put(e.getCode(),e.getValues().stream().map(ElementData::getValue).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
data = Expression.parse(CustomFunction.CLASS_CALL + m.group()).calculate(currentMap);
|
|
|
}
|
|
|
String key ="HA"+HashUtil.identityHashCode(data);
|
|
@@ -824,9 +835,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
if(args.size()<18){
|
|
|
args.addAll(Collections.nCopies(18-args.size(),"''"));
|
|
|
System.out.println("原:"+formula);
|
|
|
- String newformula=("FC."+fn+"("+String.join(",",args)+")");
|
|
|
- System.out.println("改:"+newformula);
|
|
|
- this.update(Wrappers.<Formula>lambdaUpdate().set(Formula::getFormula,newformula).eq(Formula::getId,ident));
|
|
|
+ String newFormula=("FC."+fn+"("+String.join(",",args)+")");
|
|
|
+ System.out.println("改:"+newFormula);
|
|
|
+ this.update(Wrappers.<Formula>lambdaUpdate().set(Formula::getFormula,newFormula).eq(Formula::getId,ident));
|
|
|
}
|
|
|
}
|
|
|
}
|