|
@@ -94,7 +94,7 @@ func CalculateByRuleByNine(formulaStr string, edbInfoList []*models.EdbInfo, edb
|
|
|
return
|
|
|
}
|
|
|
dataMap := make(map[string]float64)
|
|
|
- lenData := len(sourceDataList)
|
|
|
+ //lenData := len(sourceDataList)
|
|
|
for _, dv := range sourceDataList {
|
|
|
// 实际数据
|
|
|
if val, ok := realSaveDataMap[dv.DataTime]; ok {
|
|
@@ -121,19 +121,26 @@ func CalculateByRuleByNine(formulaStr string, edbInfoList []*models.EdbInfo, edb
|
|
|
// 以第一个指标的日期作为基准日期
|
|
|
if edbInfoIndex == 0 {
|
|
|
dateList = append(dateList, dv.DataTime)
|
|
|
- }
|
|
|
-
|
|
|
- if lenData > 0 {
|
|
|
- tmpLatestDate, _ := time.ParseInLocation(utils.FormatDate, sourceDataList[lenData-1].DataTime, time.Local)
|
|
|
- if minLatestDate.IsZero() || minLatestDate.After(tmpLatestDate) {
|
|
|
- minLatestDate = tmpLatestDate
|
|
|
+ tmpDate, _ := time.ParseInLocation(utils.FormatDate, dv.DataTime, time.Local)
|
|
|
+ if minLatestDate.IsZero() || tmpDate.After(minLatestDate) {
|
|
|
+ minLatestDate = tmpDate
|
|
|
}
|
|
|
-
|
|
|
- tmpStartDate, _ := time.ParseInLocation(utils.FormatDate, sourceDataList[0].DataTime, time.Local)
|
|
|
- if maxStartDate.IsZero() || maxStartDate.Before(tmpStartDate) {
|
|
|
- maxStartDate = tmpStartDate
|
|
|
+ if maxStartDate.IsZero() || tmpDate.Before(maxStartDate) {
|
|
|
+ maxStartDate = tmpDate
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /* if lenData > 0 {
|
|
|
+ tmpLatestDate, _ := time.ParseInLocation(utils.FormatDate, sourceDataList[lenData-1].DataTime, time.Local)
|
|
|
+ if minLatestDate.IsZero() || minLatestDate.After(tmpLatestDate) {
|
|
|
+ minLatestDate = tmpLatestDate
|
|
|
+ }
|
|
|
+
|
|
|
+ tmpStartDate, _ := time.ParseInLocation(utils.FormatDate, sourceDataList[0].DataTime, time.Local)
|
|
|
+ if maxStartDate.IsZero() || maxStartDate.Before(tmpStartDate) {
|
|
|
+ maxStartDate = tmpStartDate
|
|
|
+ }
|
|
|
+ }*/
|
|
|
}
|
|
|
item := new(models.CalculateItems)
|
|
|
item.EdbInfoId = v.EdbInfoId
|