|
@@ -21,10 +21,7 @@ import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
-import org.springblade.core.tool.utils.BeanUtil;
|
|
|
-import org.springblade.core.tool.utils.Func;
|
|
|
-import org.springblade.core.tool.utils.RegexUtil;
|
|
|
-import org.springblade.core.tool.utils.StringPool;
|
|
|
+import org.springblade.core.tool.utils.*;
|
|
|
import org.springblade.manager.dto.*;
|
|
|
import org.springblade.manager.entity.*;
|
|
|
import org.springblade.manager.enums.ExecuteType;
|
|
@@ -80,6 +77,37 @@ public class FormulaController {
|
|
|
@PostMapping("/save")
|
|
|
@Deprecated
|
|
|
public R save(@RequestBody FormulaBean f) {
|
|
|
+ //ifelseMulti 多条件处理
|
|
|
+ if(CollectionUtil.isNotEmpty(f.getFormulas())){
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("FC.ifelseMulti(");
|
|
|
+ for (int i = 0; i < f.getFormulas().size(); i++) {
|
|
|
+ if(i != 0){
|
|
|
+ sb.append(",(");
|
|
|
+ }
|
|
|
+ FormulaMultipleIf formulaMultipleIf = f.getFormulas().get(i);
|
|
|
+ //盘点条件
|
|
|
+ for (FormulaIfElse formulaIfElse : formulaMultipleIf.getFormulaIfElse()) {
|
|
|
+ sb.append(formulaIfElse.getParameter1())
|
|
|
+ .append(formulaIfElse.getSymbol())
|
|
|
+ .append(formulaIfElse.getParameter2());
|
|
|
+ if(StringUtils.isNotEmpty(formulaIfElse.getGroupTerm())){
|
|
|
+ String s = formulaIfElse.getGroupTerm().replaceAll("&&", "&&");
|
|
|
+ sb.append(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sb.append(",").append(formulaMultipleIf.getTrueData());
|
|
|
+ //当前是否为最后一层判断
|
|
|
+ if(i >= f.getFormulas().size() - 1){
|
|
|
+ sb.append(",").append(formulaMultipleIf.getFalseData());
|
|
|
+ }
|
|
|
+ if(i != 0){
|
|
|
+ sb.append(")");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sb.append(")");
|
|
|
+ f.setFormula(sb.toString());
|
|
|
+ }
|
|
|
return saveOrUpdate(f);
|
|
|
}
|
|
|
|
|
@@ -90,6 +118,36 @@ public class FormulaController {
|
|
|
@PostMapping("/update")
|
|
|
@Deprecated
|
|
|
public R update(@RequestBody FormulaBean f) {
|
|
|
+ if(CollectionUtil.isNotEmpty(f.getFormulas())){
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("FC.ifelseMulti(");
|
|
|
+ for (int i = 0; i < f.getFormulas().size(); i++) {
|
|
|
+ if(i != 0){
|
|
|
+ sb.append(",(");
|
|
|
+ }
|
|
|
+ FormulaMultipleIf formulaMultipleIf = f.getFormulas().get(i);
|
|
|
+ //盘点条件
|
|
|
+ for (FormulaIfElse formulaIfElse : formulaMultipleIf.getFormulaIfElse()) {
|
|
|
+ sb.append(formulaIfElse.getParameter1())
|
|
|
+ .append(formulaIfElse.getSymbol())
|
|
|
+ .append(formulaIfElse.getParameter2());
|
|
|
+ if(StringUtils.isNotEmpty(formulaIfElse.getGroupTerm())){
|
|
|
+ String s = formulaIfElse.getGroupTerm().replaceAll("&&", "&&");
|
|
|
+ sb.append(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sb.append(",").append(formulaMultipleIf.getTrueData());
|
|
|
+ //当前是否为最后一层判断
|
|
|
+ if(i >= f.getFormulas().size() - 1){
|
|
|
+ sb.append(",").append(formulaMultipleIf.getFalseData());
|
|
|
+ }
|
|
|
+ if(i != 0){
|
|
|
+ sb.append(")");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sb.append(")");
|
|
|
+ f.setFormula(sb.toString());
|
|
|
+ }
|
|
|
return saveOrUpdate(f);
|
|
|
}
|
|
|
|