浏览代码

Merge branch 'ETA_1.4.5' into debug

zwxi 1 年之前
父节点
当前提交
2a0032d80d
共有 1 个文件被更改,包括 30 次插入14 次删除
  1. 30 14
      controllers/data_manage/edb_info.go

+ 30 - 14
controllers/data_manage/edb_info.go

@@ -5641,6 +5641,24 @@ func (this *EdbInfoController) EdbInfoSmmSearch() {
 		br.Msg = "无符合指标或指标代码错误"
 		return
 	}
+
+	edbCodeStr := ""
+	for i, _ := range edbCodeArr {
+		edbCodeStr += "'" + edbCodeArr[i] + "'" + ","
+	}
+	edbCodeStr = strings.Trim(edbCodeStr, ",")
+	smmInfoList, err := data_manage.GetBaseFromSmmIndexByIndexCodes(edbCodeStr)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取有色指标详情失败,Err:" + err.Error()
+		return
+	}
+
+	smmInfoMap := make(map[string]*data_manage.BaseFromSmmIndex)
+	for _, v := range smmInfoList {
+		smmInfoMap[v.IndexCode] = v
+	}
+
 	searchItemList := make([]*data_manage.EdbInfoSearch, 0)
 
 	resp := new(data_manage.EdbInfoSearchResp)
@@ -5666,8 +5684,10 @@ func (this *EdbInfoController) EdbInfoSmmSearch() {
 			searchItem.DataList = dataItems
 			searchItem.StartDate = minDate
 			searchItem.EndDate = maxDate
-
-			searchItem.DataList = dataItems
+			searchItem.Frequency = smmInfoMap[edbCode].Frequency
+			searchItem.Unit = smmInfoMap[edbCode].Unit
+			searchItem.EdbName = smmInfoMap[edbCode].IndexName
+			searchItem.EdbCode = smmInfoMap[edbCode].IndexCode
 
 			searchItemList = append(searchItemList, searchItem)
 		} else {
@@ -5696,21 +5716,17 @@ func (this *EdbInfoController) EdbInfoSmmSearch() {
 		}
 	}
 
-	edbCodeStr := ""
-	for i, _ := range edbCodeArr {
-		edbCodeStr += "'" + edbCodeArr[i] + "'" + ","
-	}
-	edbCodeStr = strings.Trim(edbCodeStr, ",")
-	smmInfoList, err := data_manage.GetBaseFromSmmIndexByIndexCodes(edbCodeStr)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取有色指标详情失败,Err:" + err.Error()
-		return
-	}
 	for _, smmInfo := range smmInfoList {
 		if smmInfo != nil {
 			searchItem := new(data_manage.EdbInfoSearch)
-
+			minDate, maxDate, err := data_manage.GetEdbDataYsMaxAndMinDate(smmInfo.IndexCode)
+			if err != nil {
+				br.Msg = "获取失败"
+				br.ErrMsg = "获取YS日期信息失败,Err:" + err.Error()
+				return
+			}
+			searchItem.StartDate = minDate
+			searchItem.EndDate = maxDate
 			searchItem.Frequency = smmInfo.Frequency
 			searchItem.Unit = smmInfo.Unit
 			searchItem.EdbName = smmInfo.IndexName