|
|
@@ -5994,6 +5994,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
|
|
|
// 解析参数,处理嵌套逗号(在括号内的逗号不应该作为分隔符)
|
|
|
List<String> pa = parseParameters(content);
|
|
|
+ String method = null;
|
|
|
+ if(pa.size() == 4){
|
|
|
+ method = pa.remove(0);
|
|
|
+ }
|
|
|
|
|
|
if (pa.size() == 3) {
|
|
|
Map<String, Object> currentMap = createCurrentMap(f, tec);
|
|
|
@@ -6052,11 +6056,17 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
if(fd.getValues().size() > 1){
|
|
|
f = f.replace(f, putDataWithKey(dataAll, tec));
|
|
|
} else {
|
|
|
- //计算平均值
|
|
|
- OptionalDouble op = dataAll.stream().filter(StringUtils::isNumber).map(StringUtils::handleNull).mapToDouble(Double::parseDouble).average();
|
|
|
- if (op.isPresent()) {
|
|
|
- f = f.replace(f, putDataWithKey(op.getAsDouble(), tec));
|
|
|
+ if(StringUtil.isNotBlank(method) && "sum".equals(method)){
|
|
|
+ double sum = dataAll.stream().filter(StringUtils::isNumber).map(StringUtils::handleNull).mapToDouble(Double::parseDouble).sum();
|
|
|
+ f = f.replace(f, putDataWithKey(sum, tec));
|
|
|
+ } else{
|
|
|
+ //计算平均值
|
|
|
+ OptionalDouble op = dataAll.stream().filter(StringUtils::isNumber).map(StringUtils::handleNull).mapToDouble(Double::parseDouble).average();
|
|
|
+ if (op.isPresent()) {
|
|
|
+ f = f.replace(f, putDataWithKey(op.getAsDouble(), tec));
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
} else {
|
|
|
Object data = parse.calculate(currentMap);
|