|
@@ -257,7 +257,9 @@ func RefreshAllPredictCalculate(edbInfoIdList []*EdbInfo, edbInfoId, source, sub
|
|
|
_ = to.Commit()
|
|
|
}
|
|
|
}()
|
|
|
+
|
|
|
latestDateStr, latestValue, err = refreshAllPredictCalculate(to, edbInfoIdList, edbInfoId, source, subSource, edbCode, formulaStr, startDate, edbInfoIdBytes, emptyType, maxEmptyType)
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -266,7 +268,7 @@ func refreshAllPredictCalculate(to orm.TxOrmer, edbInfoIdList []*EdbInfo, edbInf
|
|
|
fmt.Println("startDate:", startDate)
|
|
|
|
|
|
|
|
|
- var minLatestDate, minEndDate, maxStartDate time.Time
|
|
|
+ var minLatestDate, maxStartDate time.Time
|
|
|
dateList := make([]string, 0)
|
|
|
|
|
|
realSaveDataMap := make(map[string]map[int]float64)
|
|
@@ -274,7 +276,7 @@ func refreshAllPredictCalculate(to orm.TxOrmer, edbInfoIdList []*EdbInfo, edbInf
|
|
|
|
|
|
for edbInfoIndex, v := range edbInfoIdList {
|
|
|
|
|
|
- tmpLatestDate, tmpErr := time.ParseInLocation(utils.FormatDate, v.LatestDate, time.Local)
|
|
|
+
|
|
|
if tmpErr != nil {
|
|
|
err = errors.New(`最近的日期格式化失败;日期:` + v.LatestDate + `;err:` + tmpErr.Error())
|
|
|
return
|
|
@@ -298,6 +300,7 @@ func refreshAllPredictCalculate(to orm.TxOrmer, edbInfoIdList []*EdbInfo, edbInf
|
|
|
if minEndDate.IsZero() || tmpEndDate.Before(minEndDate) {
|
|
|
minEndDate = tmpEndDate
|
|
|
}
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
dataList, tmpErr := GetPredictEdbDataListAllByStartDate(v, 1, startDate)
|
|
@@ -329,14 +332,21 @@ func refreshAllPredictCalculate(to orm.TxOrmer, edbInfoIdList []*EdbInfo, edbInf
|
|
|
}
|
|
|
if edbInfoIndex == 0 {
|
|
|
dateList = append(dateList, dv.DataTime)
|
|
|
+ tmpDate, _ := time.ParseInLocation(utils.FormatDate, dv.DataTime, time.Local)
|
|
|
+ if minLatestDate.IsZero() || tmpDate.After(minLatestDate) {
|
|
|
+ minLatestDate = tmpDate
|
|
|
+ }
|
|
|
+ if maxStartDate.IsZero() || tmpDate.Before(maxStartDate) {
|
|
|
+ maxStartDate = tmpDate
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
HandleDateSaveDataMap(dateList, maxStartDate, minLatestDate, realSaveDataMap, saveDataMap, edbInfoIdList, emptyType)
|
|
|
|
|
|
- formulaDateSlice, formulaDateMap, err := utils.HandleFormulaJson(formulaStr, maxStartDate.Format(utils.FormatDate))
|
|
|
+ formulaDateSlice, formulaDateMap, err := utils.HandleFormulaJson(formulaStr, minLatestDate)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -381,7 +391,7 @@ func refreshAllPredictCalculate(to orm.TxOrmer, edbInfoIdList []*EdbInfo, edbInf
|
|
|
formulaMap := make(map[string]string)
|
|
|
formulaStr = ""
|
|
|
for _, fv := range formulaDateSlice {
|
|
|
- if sk >= fv {
|
|
|
+ if sk < fv {
|
|
|
if f, ok := formulaDateMap[fv]; ok {
|
|
|
formulaStr = f
|
|
|
formulaMap = utils.CheckFormula(formulaStr)
|