|
@@ -128,7 +128,34 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- System.out.println();
|
|
|
+ System.out.println("执行结束");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static void slice(Map<String,Object> variables,String formula){
|
|
|
+ int min =0;
|
|
|
+ Map<String,Object> currentMap = new HashMap<>();
|
|
|
+ Map<String,List<Object>> massMap = new HashMap<>();
|
|
|
+ for(Map.Entry<String,Object> entry:variables.entrySet()){
|
|
|
+ if(entry.getValue() instanceof List){
|
|
|
+ List<Object> tmp = (List<Object>) entry.getValue();
|
|
|
+ if(min==0){
|
|
|
+ min=tmp.size();
|
|
|
+ }else{
|
|
|
+ min= Math.min(min,tmp.size());
|
|
|
+ }
|
|
|
+ massMap.put(entry.getKey(),tmp);
|
|
|
+ }else{
|
|
|
+ currentMap.put(entry.getKey(),entry.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(int i=0;i<min;i++){
|
|
|
+ for(Map.Entry<String,List<Object>> e:massMap.entrySet()){
|
|
|
+ currentMap.put(e.getKey(),e.getValue().get(i));
|
|
|
+ }
|
|
|
+ Object data = Expression.parse(formula).calculate(currentMap);
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static final String WP_REG= "(?<=P\\[)[^]]+(?=\\])";
|