|
@@ -187,8 +187,10 @@ func fillResidualChartInfo(edbInfoMappingA *data_manage.ChartEdbInfoMapping, edb
|
|
|
mappingEdb[i].DataList = edbData
|
|
|
mappingEdb[i].EdbName = edbInfoMappingA.EdbName + "映射残差/" + edbInfoMappingB.EdbName
|
|
|
mappingEdb[i].IsAxis = 1
|
|
|
+ mappingEdb[i].ChartColor = `#00F`
|
|
|
} else {
|
|
|
mappingEdb[i].IsAxis = 0
|
|
|
+ mappingEdb[i].ChartColor = `#F00`
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -375,6 +377,7 @@ func ContrastPreview(indexCode string) (residual_analysis_model.ResidualAnalysis
|
|
|
var resp residual_analysis_model.ResidualAnalysisChartEdbInfoMapping
|
|
|
resp.EdbInfoId = edbInfo.EdbInfoId
|
|
|
resp.EdbCode = edbInfo.EdbCode
|
|
|
+ resp.ChartColor = "#F00"
|
|
|
resp.SourceName = edbInfo.SourceName
|
|
|
resp.EdbName = edbInfo.EdbName
|
|
|
resp.Unit = edbInfo.Unit
|
|
@@ -411,30 +414,32 @@ func SaveResidualAnalysis(req residual_analysis_model.ResidualAnalysisIndexSaveR
|
|
|
// 获取指标数据最大值 最小值 最后更新时间 最后更新时间对应的值
|
|
|
var indexMax, indexMin, indexLatestValue float64
|
|
|
var indexLatestDate string
|
|
|
- latestTime, _ := time.Parse(utils.YearMonthDay, req.DataList[0].DataTime)
|
|
|
- for _, data := range req.DataList {
|
|
|
- // 比较最大值
|
|
|
- if data.Value > indexMax {
|
|
|
- indexMax = data.Value
|
|
|
- }
|
|
|
+ if len(req.DataList) > 0 {
|
|
|
+ latestTime, _ := time.Parse(utils.YearMonthDay, req.DataList[0].DataTime)
|
|
|
+ for _, data := range req.DataList {
|
|
|
+ // 比较最大值
|
|
|
+ if data.Value > indexMax {
|
|
|
+ indexMax = data.Value
|
|
|
+ }
|
|
|
|
|
|
- // 比较最小值
|
|
|
- if data.Value < indexMin {
|
|
|
- indexMin = data.Value
|
|
|
- }
|
|
|
+ // 比较最小值
|
|
|
+ if data.Value < indexMin {
|
|
|
+ indexMin = data.Value
|
|
|
+ }
|
|
|
|
|
|
- // 比较最新时间和对应值
|
|
|
- currentTime, err := time.Parse(utils.YearMonthDay, data.DataTime)
|
|
|
- if err != nil {
|
|
|
- // 时间解析失败,跳过此项
|
|
|
- continue
|
|
|
- }
|
|
|
+ // 比较最新时间和对应值
|
|
|
+ currentTime, err := time.Parse(utils.YearMonthDay, data.DataTime)
|
|
|
+ if err != nil {
|
|
|
+ // 时间解析失败,跳过此项
|
|
|
+ continue
|
|
|
+ }
|
|
|
|
|
|
- // 如果当前时间更晚
|
|
|
- if currentTime.After(latestTime) {
|
|
|
- latestTime = currentTime
|
|
|
- indexLatestDate = data.DataTime
|
|
|
- indexLatestValue = data.Value
|
|
|
+ // 如果当前时间更晚
|
|
|
+ if currentTime.After(latestTime) {
|
|
|
+ latestTime = currentTime
|
|
|
+ indexLatestDate = data.DataTime
|
|
|
+ indexLatestValue = data.Value
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|