Browse Source
Merge in DESIGN/design from ~HOKY.HE/design-hoky:release/11.0 to release/11.0 * commit '63267aac4b7b5c54ef809643b5c0d6989f4a61c0': 解决冲突 解决冲突 解决冲突 REPORT-58124 公式编辑器优化:不支持实时计算的功能提示处理 1.修改遍历不支持公式的逻辑 REPORT-57892 公式编辑器优化:实时计算返回结果为日期格式时不正确 1.添加一个object2string REPORT-54887 公式编辑器优化一期 1.添加了公式的参数个数和参数类型的校验; 2.添加了实时计算的功能。fix-lag
Hoky.He
3 years ago
2 changed files with 71 additions and 21 deletions
@ -0,0 +1,49 @@
|
||||
package com.fr.design.formula; |
||||
|
||||
import com.fr.parser.BinaryExpression; |
||||
import com.fr.parser.FunctionCall; |
||||
import com.fr.stable.script.Node; |
||||
|
||||
import java.util.Arrays; |
||||
|
||||
/** |
||||
* @author Hoky |
||||
* @date 2021/8/30 |
||||
*/ |
||||
public class UnsupportedFormulaScanner { |
||||
public final static String[] UNSUPPORTED_FORMULAS = new String[]{"PROPORTION", "TOIMAGE", |
||||
"WEBIMAGE", "SORT", "CROSSLAYERTOTAL", "CIRCULAR", "LAYERTOTAL", "MOM", "HIERARCHY", |
||||
"FILENAME", "FILESIZE", "FILETYPE", "TREELAYER", "GETUSERDEPARTMENTS", "GETUSERJOBTITLES"}; |
||||
|
||||
private String unSupportFormula = ""; |
||||
|
||||
public boolean travelFormula(Node node) { |
||||
if (node instanceof FunctionCall) { |
||||
if (isUnsupportedFomula(((FunctionCall) node).getName())) { |
||||
unSupportFormula = ((FunctionCall) node).getName(); |
||||
return false; |
||||
} else { |
||||
for (Node argument : ((FunctionCall) node).getArguments()) { |
||||
if (!travelFormula(argument)) { |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
} else if (node instanceof BinaryExpression) { |
||||
for (Node array : ((BinaryExpression) node).getNodes()) { |
||||
if (!travelFormula(array)) { |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public String getUnSupportFormula() { |
||||
return unSupportFormula; |
||||
} |
||||
|
||||
private static boolean isUnsupportedFomula(String formula) { |
||||
return Arrays.asList(UNSUPPORTED_FORMULAS).contains(formula.toUpperCase()); |
||||
} |
||||
} |
Loading…
Reference in new issue