|
@@ -11,7 +11,6 @@ type CalculateItems struct {
|
|
|
DataMap map[string]float64
|
|
|
}
|
|
|
|
|
|
-
|
|
|
func CheckFormula(formula string) map[string]string {
|
|
|
mathFormula := []string{"MAX", "MIN", "ABS", "ACOS", "ASIN", "CEIL", "MOD", "POW", "ROUND", "SIGN", "SIN", "TAN", "LOG10", "LOG2", "LOG"}
|
|
|
|
|
@@ -56,7 +55,9 @@ func ReplaceFormula(edbInfoIdArr []*data_manage.EdbInfo, valArr map[int]float64,
|
|
|
if dk == 1 {
|
|
|
dKey := edbInfoIdBytes[dk]
|
|
|
if _, ok := formulaMap[dKey]; ok { //公式中存在
|
|
|
+
|
|
|
if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
|
|
|
+
|
|
|
dvStr := fmt.Sprintf("%v", val)
|
|
|
formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
|
|
|
replaceCount++
|
|
@@ -156,4 +157,4 @@ func GetFormulaMap() map[string]string {
|
|
|
funMap["POW"] = "[@*]"
|
|
|
funMap["ROUND"] = "[@(]"
|
|
|
return funMap
|
|
|
-}
|
|
|
+}
|