Просмотр исходного кода

fix:卓创红期但指标导出

zqbao 8 месяцев назад
Родитель
Сommit
8c26441d3d
1 измененных файлов с 8 добавлено и 9 удалено
  1. 8 9
      controllers/data_manage/sci_hq_data.go

+ 8 - 9
controllers/data_manage/sci_hq_data.go

@@ -1380,6 +1380,7 @@ func (this *SciHqDataController) DeleteSciHqData() {
 // @Title 导出Sci数据
 // @Description 导出Sci数据
 // @Param   ClassifyId   query   int  true       "关键字搜索"
+// @Param   IndexCode   query   string  true       "指标编码"
 // @Success 200  导出成功
 // @router /export/sciHqList [get]
 func (this *SciHqDataController) ExportSciHqList() {
@@ -1396,8 +1397,9 @@ func (this *SciHqDataController) ExportSciHqList() {
 	}
 
 	classifyId, _ := this.GetInt("ClassifyId")
+	indexCode := this.GetString("IndexCode")
 	if classifyId < 0 {
-		br.Msg = "请选择分类"
+		br.Msg = "请选择分类或指标"
 		return
 	}
 	secNameList := make([]*data_manage.BaseFromSciHqIndex, 0)
@@ -1428,6 +1430,10 @@ func (this *SciHqDataController) ExportSciHqList() {
 		condition += ` AND classify_id=?`
 		pars = append(pars, classifyId)
 	}
+	if indexCode != "" {
+		condition += ` AND index_code=? `
+		pars = append(pars, indexCode)
+	}
 	frequencies, err := data_manage.GetSciHqFrequencyByCondition(condition, pars)
 	if err != nil {
 		fmt.Println("GetSciFrequency err:", err.Error())
@@ -1479,13 +1485,6 @@ func (this *SciHqDataController) ExportSciHqList() {
 			displayDateCell.SetDate(displayDate)
 
 		}
-		//获取分类下指标最大数据量
-		dataMax, err := data_manage.GetSciHqDataMaxCount(condition, pars)
-		if err != nil {
-			fmt.Println("获取指标最大数据量失败", err.Error())
-			return
-		}
-		fmt.Println("dataMax:", dataMax)
 		for k, sv := range secNameList {
 			//获取数据
 			dataList, err := data_manage.GetSciHqIndexDataByCode(sv.IndexCode)
@@ -1547,7 +1546,7 @@ func (this *SciHqDataController) ExportSciHqList() {
 		}
 	}
 	fileName := `卓创红期`
-	if len(secNameList) == 1 {
+	if indexCode != "" && len(secNameList) == 1 {
 		fileName = secNameList[0].IndexName
 	}
 	fileName += time.Now().Format("2006.01.02") + `.xlsx` //文件名称