|
@@ -297,7 +297,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
// fd.getValues().add(new ElementData(0,0,Expression.parse(formula.getFormula()).calculate(currentMap)));
|
|
|
// }
|
|
|
}else{
|
|
|
- fd.getValues().add(new ElementData(0,0,Expression.parse(formula.getFormula()).calculate(currentMap)));
|
|
|
+ Object data =Expression.parse(formula.getFormula()).calculate(currentMap);
|
|
|
+ write(fd,data);
|
|
|
}
|
|
|
}
|
|
|
/*数量不相等*/
|
|
@@ -307,6 +308,23 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public void write(FormData fd,Object data){
|
|
|
+ if(data instanceof List){
|
|
|
+ List<Object> values = (List<Object>) data;
|
|
|
+ if(values.size()>fd.getValues().size()){
|
|
|
+ /*当生成的数据超过实际容量的时候,会自动合并到第一个单元格*/
|
|
|
+ fd.getValues().get(0).setValue(values.stream().map(StringUtils::handleNull).collect(Collectors.joining("、")));
|
|
|
+ }else{
|
|
|
+ for(int n=0;n<values.size();n++){
|
|
|
+ fd.getValues().get(n).setValue(values.get(n));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ fd.getValues().get(0).setValue(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
/**对比内容再觉得是否刷新,如果允许牺牲部分性能,也可以不做判断进行全部刷新*/
|
|
@@ -446,6 +464,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
if(l.size()>0){
|
|
|
f.setRely(String.join(",", l));
|
|
|
+ }else{
|
|
|
+ f.setRely("");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -479,13 +499,15 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
data = CustomFunction.setScale(data, StringUtils.getScale(data));
|
|
|
}
|
|
|
/*必须要用括号套壳,不然无法处理负数*/
|
|
|
- String key ="HA@"+HashUtil.identityHashCode(data);
|
|
|
+ String key ="HA"+HashUtil.identityHashCode(data);
|
|
|
this.env.constantMap.put(key,data);
|
|
|
f = f.replace(CustomFunction.CLASS_CALL + m.group(), key);
|
|
|
fd.getFormula().setFormula(f);
|
|
|
+ /*更新依赖*/
|
|
|
+ relyParse(fd.getFormula());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ System.out.println("聚合处理");
|
|
|
}
|
|
|
}
|
|
|
}
|