zwxi пре 8 месеци
родитељ
комит
a33208f608
3 измењених фајлова са 34 додато и 33 уклоњено
  1. 30 29
      controllers/excel_info.go
  2. 1 1
      models/excel_info.go
  3. 3 3
      models/response/excel_info.go

+ 30 - 29
controllers/excel_info.go

@@ -12,6 +12,7 @@ import (
 	"eta/eta_chart_lib/utils"
 	"fmt"
 	"github.com/shopspring/decimal"
+	"strings"
 	"time"
 )
 
@@ -124,14 +125,14 @@ func (this *ExcelInfoController) GetTableDetail() {
 			br.ErrMsg = "转换成table失败,Err:" + err.Error()
 			return
 		}
-		//sourceNameList, sourceNameEnList, err := data.GetEdbSourceByEdbInfoIdListForExcel(result.EdbInfoIdList)
-		//if err != nil {
-		//	br.Msg = "自定义表格数据获取失败"
-		//	br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
-		//	return
-		//}
-		//resp.ExcelSource = strings.Join(sourceNameList, ",")
-		//resp.ExcelSourceEn = strings.Join(sourceNameEnList, ",")
+		sourceNameList, sourceNameEnList, err := data.GetEdbSourceByEdbInfoIdListForExcel(result.EdbInfoIdList)
+		if err != nil {
+			br.Msg = "自定义表格数据获取失败"
+			br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+			return
+		}
+		resp.ExcelSource = strings.Join(sourceNameList, ",")
+		resp.ExcelSourceEn = strings.Join(sourceNameEnList, ",")
 	case utils.MIXED_TABLE:
 		var result request.MixedTableReq
 		err = json.Unmarshal([]byte(excelInfo.Content), &result)
@@ -155,26 +156,26 @@ func (this *ExcelInfoController) GetTableDetail() {
 			br.ErrMsg = "转换成table失败,Err:" + err.Error()
 			return
 		}
-		//edbInfoIds := make([]int, 0)
-		//edbInfoIdExist := make(map[int]bool)
-		//if len(newResult) > 0 {
-		//	for _, t := range newResult {
-		//		for _, v := range t {
-		//			if v.EdbInfoId > 0 && !edbInfoIdExist[v.EdbInfoId] {
-		//				edbInfoIdExist[v.EdbInfoId] = true
-		//				edbInfoIds = append(edbInfoIds, v.EdbInfoId)
-		//			}
-		//		}
-		//	}
-		//}
-		//sourceNameList, sourceNameEnList, err := data.GetEdbSourceByEdbInfoIdListForExcel(edbInfoIds)
-		//if err != nil {
-		//	br.Msg = "自定义表格数据获取失败"
-		//	br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
-		//	return
-		//}
-		//resp.ExcelSource = strings.Join(sourceNameList, ",")
-		//resp.ExcelSourceEn = strings.Join(sourceNameEnList, ",")
+		edbInfoIds := make([]int, 0)
+		edbInfoIdExist := make(map[int]bool)
+		if len(newResult) > 0 {
+			for _, t := range newResult {
+				for _, v := range t {
+					if v.EdbInfoId > 0 && !edbInfoIdExist[v.EdbInfoId] {
+						edbInfoIdExist[v.EdbInfoId] = true
+						edbInfoIds = append(edbInfoIds, v.EdbInfoId)
+					}
+				}
+			}
+		}
+		sourceNameList, sourceNameEnList, err := data.GetEdbSourceByEdbInfoIdListForExcel(edbInfoIds)
+		if err != nil {
+			br.Msg = "自定义表格数据获取失败"
+			br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+			return
+		}
+		resp.ExcelSource = strings.Join(sourceNameList, ",")
+		resp.ExcelSourceEn = strings.Join(sourceNameEnList, ",")
 	}
 
 	tableData = excel.HandleTableCell(tableData)
@@ -201,7 +202,7 @@ func (this *ExcelInfoController) GetTableDetail() {
 	resp.ExcelImage = excelInfo.ExcelImage
 	resp.UniqueCode = excelInfo.UniqueCode
 	resp.Config = config
-	//resp.SourcesFrom = excelInfo.SourcesFrom
+	resp.SourcesFrom = excelInfo.SourcesFrom
 
 	if utils.Re == nil {
 		data, _ := json.Marshal(resp)

+ 1 - 1
models/excel_info.go

@@ -171,7 +171,7 @@ type ExcelInfoView struct {
 	IsDelete        int       `description:"是否删除,0:未删除,1:已删除" json:"-"`
 	ModifyTime      time.Time `description:"最近修改日期"`
 	CreateTime      time.Time `description:"创建日期"`
-	//SourcesFrom     string    `description:"图表来源"`
+	SourcesFrom     string    `description:"图表来源"`
 }
 
 // GetExcelInfoByClassifyIdAndName 根据分类id和表格名获取表格信息

+ 3 - 3
models/response/excel_info.go

@@ -15,9 +15,9 @@ type ExcelTableDetailResp struct {
 	ExcelType     int    `description:"表格类型,1:指标列,2:日期列,默认:1"`
 	ExcelImage    string `description:"表格截图"`
 	ExcelName     string `description:"表格名称"`
-	//SourcesFrom   string `description:"图表来源"`
-	//ExcelSource   string `description:"表格来源str"`
-	//ExcelSourceEn string `description:"表格来源(英文)"`
+	SourcesFrom   string `description:"图表来源"`
+	ExcelSource   string `description:"表格来源str"`
+	ExcelSourceEn string `description:"表格来源(英文)"`
 	TableInfo     excel.TableData
 	Config        ExcelTableDetailConfigResp
 }