zwxi 8 місяців тому
батько
коміт
648684588f

+ 37 - 7
controllers/data_manage/excel/excel_info.go

@@ -1546,6 +1546,7 @@ func (c *ExcelInfoController) GetExcelTableData() {
 	}
 
 	var tableData excel.TableData
+	var excelSource, excelSourceEn string
 	switch excelInfo.Source {
 	case utils.EXCEL_DEFAULT:
 		luckySheetData, err := excel.GetLuckySheetData(excelInfo.Content)
@@ -1580,6 +1581,14 @@ func (c *ExcelInfoController) GetExcelTableData() {
 			br.ErrMsg = "转换成table失败,Err:" + err.Error()
 			return
 		}
+		sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList(result.EdbInfoIdList)
+		if err != nil {
+			br.Msg = "自定义表格数据获取失败"
+			br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+			return
+		}
+		excelSource = strings.Join(sourceNameList, ",")
+		excelSourceEn = strings.Join(sourceNameEnList, ",")
 	case utils.MIXED_TABLE:
 		var result request.MixedTableReq
 		err = json.Unmarshal([]byte(excelInfo.Content), &result)
@@ -1603,7 +1612,26 @@ func (c *ExcelInfoController) GetExcelTableData() {
 			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 := excel2.GetEdbSourceByEdbInfoIdList(edbInfoIds)
+		if err != nil {
+			br.Msg = "自定义表格数据获取失败"
+			br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+			return
+		}
+		excelSource = strings.Join(sourceNameList, ",")
+		excelSourceEn = strings.Join(sourceNameEnList, ",")
 	}
 
 	tableData = excel.HandleTableCell(tableData)
@@ -1625,12 +1653,14 @@ func (c *ExcelInfoController) GetExcelTableData() {
 	}
 
 	resp := response.ExcelTableDetailResp{
-		UniqueCode:  excelInfo.UniqueCode,
-		ExcelImage:  excelInfo.ExcelImage,
-		ExcelName:   excelInfo.ExcelName,
-		TableInfo:   tableData,
-		Config:      config,
-		SourcesFrom: excelInfo.SourcesFrom,
+		UniqueCode:    excelInfo.UniqueCode,
+		ExcelImage:    excelInfo.ExcelImage,
+		ExcelName:     excelInfo.ExcelName,
+		TableInfo:     tableData,
+		Config:        config,
+		SourcesFrom:   excelInfo.SourcesFrom,
+		ExcelSource:   excelSource,
+		ExcelSourceEn: excelSourceEn,
 	}
 	br.Ret = 200
 	br.Success = true

+ 12 - 10
models/data_manage/excel/response/excel_info.go

@@ -22,12 +22,14 @@ type ExcelListResp struct {
 
 // ExcelTableDetailResp  excel表格详情
 type ExcelTableDetailResp struct {
-	UniqueCode  string `description:"表格唯一code"`
-	ExcelImage  string `description:"表格截图"`
-	ExcelName   string `description:"表格名称"`
-	TableInfo   excel.TableData
-	Config      ExcelTableDetailConfigResp
-	SourcesFrom string `description:"图表来源"`
+	UniqueCode    string `description:"表格唯一code"`
+	ExcelImage    string `description:"表格截图"`
+	ExcelName     string `description:"表格名称"`
+	TableInfo     excel.TableData
+	Config        ExcelTableDetailConfigResp
+	SourcesFrom   string `description:"图表来源"`
+	ExcelSource   string `description:"表格来源str"`
+	ExcelSourceEn string `description:"表格来源(英文)"`
 }
 
 // ExcelTableDetailConfigResp
@@ -45,10 +47,10 @@ type TableCellResp struct {
 }
 
 type TableDataItem struct {
-	EdbInfoId int                     `description:"指标id"`
-	Data      []request.ManualDataReq `description:"数据列表"`
-	ExcelSource        string                       `description:"表格来源str"`
-	ExcelSourceEn      string                       `description:"表格来源(英文)"`
+	EdbInfoId     int                     `description:"指标id"`
+	Data          []request.ManualDataReq `description:"数据列表"`
+	ExcelSource   string                  `description:"表格来源str"`
+	ExcelSourceEn string                  `description:"表格来源(英文)"`
 }
 
 // TableDetailResp  excel表格详情