|
@@ -2652,7 +2652,6 @@ type EdbDateConfDateChange struct {
|
|
|
ChangeType int `description:"日期变换类型1日期位移,2指定频率"`
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 自定义右轴指标
|
|
|
type SeasonRightAxis struct {
|
|
|
IndicatorType int `description:"右轴指标类型 1:左轴指标同比,2:指标库,3:预测指标 "`
|
|
@@ -2755,4 +2754,73 @@ type MaxMinLimitsData struct {
|
|
|
DataTimestamp int64 `description:"数据日期时间戳"`
|
|
|
MaxValue float64 `description:"最大值"`
|
|
|
MinValue float64 `description:"最小值"`
|
|
|
+}
|
|
|
+
|
|
|
+func getThsHfEdbDataListByMongo(source, subSource, edbInfoId int, startDate, endDate string) (list []*EdbDataList, err error) {
|
|
|
+ list = make([]*EdbDataList, 0)
|
|
|
+
|
|
|
+ mogDataObj := mgo.EdbDataThsHf{}
|
|
|
+ // 构建查询条件
|
|
|
+ queryConditions := bson.M{
|
|
|
+ "edb_info_id": edbInfoId,
|
|
|
+ }
|
|
|
+
|
|
|
+ // 数据日期
|
|
|
+ dateCondition, err := mgo.BuildDateCondition(startDate, endDate)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(dateCondition) > 0 {
|
|
|
+ queryConditions["data_time"] = dateCondition
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取列表数据
|
|
|
+ tmpDataList, tmpErr := mogDataObj.GetAllDataList(queryConditions, []string{"data_time"})
|
|
|
+ if tmpErr != nil {
|
|
|
+ err = tmpErr
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for k, v := range tmpDataList {
|
|
|
+ list = append(list, &EdbDataList{
|
|
|
+ EdbDataId: k + 1,
|
|
|
+ EdbInfoId: v.EdbInfoId,
|
|
|
+ DataTime: v.DataTime.Format(utils.FormatDate),
|
|
|
+ DataTimestamp: v.DataTimestamp,
|
|
|
+ Value: v.Value,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func getThsHfEdbDataListMinAndMaxByMongo(source, subSource, edbInfoId int, startDate, endDate string) (minData, maxData float64, err error) {
|
|
|
+ mogDataObj := mgo.EdbDataThsHf{}
|
|
|
+ // 构建查询条件
|
|
|
+ queryConditions := bson.M{
|
|
|
+ "edb_info_id": edbInfoId,
|
|
|
+ }
|
|
|
+ // 日期
|
|
|
+ dateCondition, err := mgo.BuildDateCondition(startDate, endDate)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(dateCondition) > 0 {
|
|
|
+ queryConditions["data_time"] = dateCondition
|
|
|
+ }
|
|
|
+
|
|
|
+ pipeline := []bson.M{
|
|
|
+ {"$match": queryConditions},
|
|
|
+ {"$group": bson.M{
|
|
|
+ "_id": nil,
|
|
|
+ "min_value": bson.M{"$min": "$value"},
|
|
|
+ "max_value": bson.M{"$max": "$value"},
|
|
|
+ }},
|
|
|
+ {"$project": bson.M{"_id": 0}}, // 可选,如果不需要_id字段
|
|
|
+ }
|
|
|
+ result, err := mogDataObj.GetEdbInfoMaxAndMinInfo(pipeline)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ minData = result.MinValue
|
|
|
+ maxData = result.MaxValue
|
|
|
+ return
|
|
|
}
|