Ver código fonte

Merge branch 'feature/eta2.2.1_usda_fas' into debug

xyxie 5 meses atrás
pai
commit
d4cb1fe923
1 arquivos alterados com 10 adições e 6 exclusões
  1. 10 6
      controllers/data_manage/usda_fas_data.go

+ 10 - 6
controllers/data_manage/usda_fas_data.go

@@ -411,7 +411,7 @@ func (this *BaseFromUsdaFasController) UsdaFasSingleData() {
 // @Title 美国农业部指标列表
 // @Description 美国农业部指标列表
 // @Param   ClassifyId   query   int  true       "分类id"
-// @Success 200 {object} data_manage.BaseFromMysteelChemicalIndexResp
+// @Success 200 {object} data_manage.BaseFromUsdaFasClassifyResp
 // @router /usda_fas/classify/index/list [get]
 func (this *BaseFromUsdaFasController) UsdaFasIndexList() {
 	br := new(models.BaseResponse).Init()
@@ -1072,6 +1072,8 @@ func (this *BaseFromUsdaFasController) ExportUsdaFasList() {
 
 	indexList, err := data_manage.GetUsdaFasIndex(condition, pars)
 	if err != nil {
+		br.Msg = "下载失败"
+		br.ErrMsg = "获取指标失败,Err:" + err.Error()
 		fmt.Println("获取数据失败,Err:" + err.Error())
 		return
 	}
@@ -1083,15 +1085,15 @@ func (this *BaseFromUsdaFasController) ExportUsdaFasList() {
 		return
 	}
 
-	indexCodeList := make([]string, 0)
+	codeList := make([]string, 0)
 	frequenciesMap := make(map[string][]*data_manage.BaseFromUsdaFasIndexList)
 	for _, v := range indexList {
-		indexCodeList = append(indexCodeList, v.IndexCode)
+		codeList = append(codeList, v.IndexCode)
 		frequenciesMap[v.Frequency] = append(frequenciesMap[v.Frequency], v)
 	}
 	dataListMap := make(map[string][]*data_manage.BaseFromUsdaFasData)
 	if len(indexList) > 0 {
-		allDataList, e := data_manage.GetUsdaFasIndexDataByCodes(indexCodeList)
+		allDataList, e := data_manage.GetUsdaFasIndexDataByCodes(codeList)
 		if e != nil {
 			br.Msg = "获取数据失败"
 			br.ErrMsg = "获取数据失败,Err:" + e.Error()
@@ -1150,6 +1152,8 @@ func (this *BaseFromUsdaFasController) ExportUsdaFasList() {
 		}
 		dataTimeList, err := data_manage.GetUsdaFasDataDataTimeByIndexId(indexIdList)
 		if err != nil {
+			br.Msg = "下载失败"
+			br.ErrMsg = "获取数据时间失败,Err:" + err.Error()
 			fmt.Println("获取数据时间失败", err.Error())
 			return
 		}
@@ -1223,8 +1227,8 @@ func (this *BaseFromUsdaFasController) ExportUsdaFasList() {
 		rowSecName := sheet.AddRow()
 		celSecName := rowSecName.AddCell()
 		celSecName.SetValue("")
-		err = xlsxFile.Save(downLoadnFilePath)
-		if err != nil {
+		e := xlsxFile.Save(downLoadnFilePath)
+		if e != nil {
 			br.Msg = "保存文件失败"
 			br.ErrMsg = "保存文件失败"
 			return