|
@@ -230,7 +230,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
String tn = miss.substring(0,miss.indexOf(StringPool.COLON));
|
|
|
String key =miss.substring(miss.indexOf(StringPool.COLON)+1);
|
|
|
String targetIds=tableNamePkIdsMaps.stream().filter(m->StringUtils.isEquals(m.get("tableName"),tn)).map(m->m.get("pkId")).map(StringUtils::handleNull).collect(Collectors.joining(","));
|
|
|
- List<Map<String,Object>> tableDatas= this.jdbcTemplate.queryForList("select * from "+tn+" p_key_id in ("+targetIds+")");
|
|
|
+ List<Map<String,Object>> tableDatas= this.jdbcTemplate.queryForList("select * from "+tn+" where p_key_id in ("+targetIds+")");
|
|
|
fill(tableDatas,removeList,tn,key);
|
|
|
});
|
|
|
}
|
|
@@ -247,12 +247,14 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
tableDatas.forEach(m->{
|
|
|
for(Map.Entry<String,Object> entry:m.entrySet()){
|
|
|
- map.merge(entry.getKey(), entry.getValue(), (v1, v2) -> v1 + ";" + v2);
|
|
|
+ if(entry.getValue()!=null){
|
|
|
+ map.merge(entry.getKey(), entry.getValue(), (v1, v2) -> v1 + ";" + v2);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
this.tableDataMaps.put(tn,map);
|
|
|
String values= StringUtils.handleNull(map.get(key));
|
|
|
- String r= tn+key;
|
|
|
+ String r= tn+StringPool.COLON+key;
|
|
|
if(StringUtils.isNotEmpty(values)){
|
|
|
FormData tmp=createFormDataFast(r,values);
|
|
|
if(tmp!=null){
|
|
@@ -449,7 +451,6 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
Map<String, Object> currentMap = new HashMap<>(this.constantMap);
|
|
|
List<String> relyList = fd.getFormula().getRelyList();
|
|
|
if(CollectionUtil.isNotEmpty(relyList)){
|
|
|
-// List<FormData> ele = this.formDataList.stream().filter(e->relyList.contains(e.getCode())&&e.getValues().stream().anyMatch(Func::isNotEmpty)).collect(Collectors.toList());
|
|
|
List<FormData> ele = new ArrayList<>();
|
|
|
relyList.forEach(rely->{
|
|
|
FormData formData= this.tec.getFormDataMap().get(rely);
|
|
@@ -498,7 +499,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
write(fd,data);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
- write(fd,e.getMessage());
|
|
|
+ write(fd,"计算错误");
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -768,6 +769,25 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}else{
|
|
|
fd.getFormula().setFormula(StringPool.EMPTY);
|
|
|
}
|
|
|
+ }else if(f.contains(CustomFunction.CLASS_CALL+"ifelse(")){
|
|
|
+ Matcher im =IF.matcher(f);
|
|
|
+ while (im.find()){
|
|
|
+ String rep =im.group();
|
|
|
+ //Map<String, Object> currentMap = new HashMap<>(this.constantMap);
|
|
|
+ Matcher fm=P.matcher(rep);
|
|
|
+ while (fm.find()){
|
|
|
+ FormData kf= this.formDataMap.get(fm.group().replaceAll("'",""));
|
|
|
+ if(kf!=null&&!kf.empty()){
|
|
|
+ Object dd= kf.getValues().get(0).getValue();
|
|
|
+ rep= rep.replace("E["+fm.group()+"]",dd.toString());
|
|
|
+ rep="'"+rep+"'";
|
|
|
+ }else{
|
|
|
+ rep="'2>1'";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ f=f.replace(im.group(),rep);
|
|
|
+ }
|
|
|
+ formula.setFormula(f);
|
|
|
}
|
|
|
relyParse(fd.getFormula());
|
|
|
StaticLog.info("聚合处理");
|