|
@@ -293,14 +293,14 @@ func GetEdbInfoCalculateCountByCondition(condition string, pars []interface{}) (
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//优化版本-处理数据精度问题
|
|
|
+// 优化版本-处理数据精度问题
|
|
|
type EdbInfoSearchDataV1 struct {
|
|
|
EdbDataId int `description:"数据ID"`
|
|
|
DataTime string `description:"数据日期"`
|
|
|
Value string `description:"数据"`
|
|
|
}
|
|
|
|
|
|
-//优化版本-处理数据精度问题
|
|
|
+// 优化版本-处理数据精度问题
|
|
|
func GetEdbDataListAllV1(condition string, pars []interface{}, source, order int) (item []*EdbInfoSearchDataV1, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := ``
|
|
@@ -729,18 +729,18 @@ func GetPredictDataListByPredictEdbInfo(edbInfo *EdbInfo, order int, startDate s
|
|
|
condition += " AND data_time>=? "
|
|
|
pars = append(pars, startDate)
|
|
|
}
|
|
|
- dataList, err = GetEdbDataListAll(condition, pars, sourceEdbInfoItem.Source, order)
|
|
|
+ tmpDataList, err := GetEdbDataListAll(condition, pars, sourceEdbInfoItem.Source, 1)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
// 如果选择了日期,那么需要筛选所有的数据,用于未来指标的生成
|
|
|
if startDate != `` {
|
|
|
- allDataList, err = GetEdbDataListAll(" AND edb_info_id=? ", []interface{}{sourceEdbInfoItem.EdbInfoId}, sourceEdbInfoItem.Source, order)
|
|
|
+ allDataList, err = GetEdbDataListAll(" AND edb_info_id=? ", []interface{}{sourceEdbInfoItem.EdbInfoId}, sourceEdbInfoItem.Source, 1)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
} else {
|
|
|
- allDataList = dataList
|
|
|
+ allDataList = tmpDataList
|
|
|
}
|
|
|
|
|
|
// 获取预测指标未来的数据
|
|
@@ -758,16 +758,20 @@ func GetPredictDataListByPredictEdbInfo(edbInfo *EdbInfo, order int, startDate s
|
|
|
|
|
|
//order:1升序,其余值为降序
|
|
|
if order == 1 {
|
|
|
- dataList = append(dataList, predictDataList...)
|
|
|
- }else{
|
|
|
+ dataList = append(tmpDataList, predictDataList...)
|
|
|
+ } else {
|
|
|
+ // 先倒序预测数据
|
|
|
lenPredictDataList := len(predictDataList)
|
|
|
- if lenPredictDataList >0 {
|
|
|
- tmpDataList :=make([]*EdbInfoSearchData,0)
|
|
|
- for k,_:=range predictDataList{
|
|
|
- tmpDataList = append(tmpDataList,predictDataList[lenPredictDataList-k-1])
|
|
|
+ if lenPredictDataList > 0 {
|
|
|
+ for k := range predictDataList {
|
|
|
+ dataList = append(dataList, predictDataList[lenPredictDataList-k-1])
|
|
|
}
|
|
|
- tmpDataList = append(tmpDataList,dataList...)
|
|
|
- dataList = tmpDataList
|
|
|
+ }
|
|
|
+
|
|
|
+ // 接着倒序实际指标
|
|
|
+ lenDataList := len(tmpDataList)
|
|
|
+ for k := range tmpDataList {
|
|
|
+ dataList = append(dataList, tmpDataList[lenDataList-k-1])
|
|
|
}
|
|
|
}
|
|
|
if len(predictDataList) > 0 {
|