|
@@ -46,7 +46,6 @@ func EdbInfoRefreshAllFromBaseV3Bak(edbInfoIdList []int, refreshAll, isSync bool
|
|
|
if err != nil {
|
|
|
fmt.Println("EdbInfoRefreshAllFromBaseV2 Err:" + err.Error() + ";errmsg:" + errmsg)
|
|
|
go alarm_msg.SendAlarmMsg("EdbInfoRefreshFromBaseV2,Err"+err.Error()+";errMsg:"+errmsg, 3)
|
|
|
- //go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "EdbInfoRefreshFromBase:"+errmsg, utils.EmailSendToUsers)
|
|
|
}
|
|
|
}()
|
|
|
|
|
@@ -237,7 +236,7 @@ func getRefreshEdbInfoListByTraceEdbInfo(traceEdbInfo data_manage.TraceEdbInfoRe
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if traceEdbInfo.Child != nil && len(traceEdbInfo.Child) > 0 {
|
|
|
+ if len(traceEdbInfo.Child) > 0 {
|
|
|
for _, v := range traceEdbInfo.Child {
|
|
|
tmpBaseEdbInfoArr, tmpPredictEdbInfoArr, tmpCalculateMap, tmpPredictCalculateMap, tmpCalculateArr, tmpPredictCalculateArr := getRefreshEdbInfoListByTraceEdbInfo(v, existEdbInfoIdMap)
|
|
|
|
|
@@ -2225,7 +2224,7 @@ func getEdbRuleTitle(edbInfo, parentEdbInfo *data_manage.EdbInfo, childList []da
|
|
|
// 规则
|
|
|
switch edbInfo.Source {
|
|
|
case utils.DATA_SOURCE_CALCULATE, utils.DATA_SOURCE_PREDICT_CALCULATE:
|
|
|
- ruleTitle = "=" + edbInfo.CalculateFormula
|
|
|
+ ruleTitle = formatCalculateFormula(edbInfo.CalculateFormula)
|
|
|
case utils.DATA_SOURCE_CALCULATE_LJZZY, utils.DATA_SOURCE_PREDICT_CALCULATE_LJZZY:
|
|
|
ruleTitle = `累计转月值计算`
|
|
|
ruleTitleEn = `Cumulative to Monthly Calculation`
|
|
@@ -2259,7 +2258,6 @@ func getEdbRuleTitle(edbInfo, parentEdbInfo *data_manage.EdbInfo, childList []da
|
|
|
if childEdbInfo, ok := edbInfoMap[childList[0].EdbInfoId]; ok {
|
|
|
childFrequency = childEdbInfo.Frequency
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
ruleTitle = fmt.Sprintf("升频计算(%s转%s)", childFrequency, edbInfo.Frequency)
|
|
|
ruleTitleEn = fmt.Sprintf("Upsampling Calculation(%s转%s)", childFrequency, edbInfo.Frequency)
|
|
@@ -2397,6 +2395,64 @@ func getEdbRuleTitle(edbInfo, parentEdbInfo *data_manage.EdbInfo, childList []da
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func formatCalculateFormula(calculateFormula string) (ruleTitle string) {
|
|
|
+ var tmpCalculateFormula []map[string]string
|
|
|
+ if e := json.Unmarshal([]byte(calculateFormula), &tmpCalculateFormula); e != nil {
|
|
|
+ ruleTitle = "=" + calculateFormula
|
|
|
+ } else {
|
|
|
+ newCalculateFormula := make([]map[string]string, 0)
|
|
|
+ sort.Slice(tmpCalculateFormula, func(i, j int) bool {
|
|
|
+ if tmpCalculateFormula[i]["d"] == "" {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ if tmpCalculateFormula[j]["d"] == "" {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ it, e := time.Parse(utils.FormatDate, tmpCalculateFormula[i]["d"])
|
|
|
+ if e != nil {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ jt, e := time.Parse(utils.FormatDate, tmpCalculateFormula[j]["d"])
|
|
|
+ if e != nil {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return it.Before(jt)
|
|
|
+ })
|
|
|
+ fLen := len(tmpCalculateFormula)
|
|
|
+ for i := 0; i < fLen; i++ {
|
|
|
+ singleFormula := make(map[string]string)
|
|
|
+ val, ok := tmpCalculateFormula[i]["f"]
|
|
|
+ if !ok {
|
|
|
+ continue
|
|
|
+ } else {
|
|
|
+ singleFormula["公式"] = val
|
|
|
+ }
|
|
|
+ date, ok := tmpCalculateFormula[i]["d"]
|
|
|
+ if ok {
|
|
|
+ var tmpDate string
|
|
|
+ if len(tmpCalculateFormula) > 1 && i == 0 {
|
|
|
+ tmpDate = tmpCalculateFormula[fLen-1]["d"] + "(含)之后"
|
|
|
+ }
|
|
|
+ if i == fLen-1 {
|
|
|
+ tmpDate = date + "之前"
|
|
|
+ }
|
|
|
+ if fLen > 2 && i >= 1 && i < fLen-1 {
|
|
|
+ tmpDate = fmt.Sprintf("%s(含)——%s", date, tmpCalculateFormula[i+1]["d"])
|
|
|
+ }
|
|
|
+ singleFormula["日期"] = tmpDate
|
|
|
+ }
|
|
|
+ newCalculateFormula = append(newCalculateFormula, singleFormula)
|
|
|
+ }
|
|
|
+ b, e := json.Marshal(newCalculateFormula)
|
|
|
+ if e != nil {
|
|
|
+ ruleTitle = "=" + calculateFormula
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ruleTitle = "=" + string(b)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// GetEdbChartAdminList
|
|
|
// @param source 来源 :1:手工数据指标 2:钢联化工数据库 3:ETA指标库 4:ETA预测指标 5:图库 6:ETA表格
|
|
|
func GetEdbChartAdminList(source int) (list []int, err error) {
|