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

Merge branch 'master' of http://8.136.199.33:3000/eta_server/eta_chart_lib into bzq/custom_dw_mini_cf

zqbao 8 месяцев назад
Родитель
Сommit
e75e668dda
4 измененных файлов с 46 добавлено и 45 удалено
  1. 30 29
      controllers/excel_info.go
  2. 1 1
      models/excel_info.go
  3. 3 3
      models/response/excel_info.go
  4. 12 12
      services/data/chart_theme.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
 }

+ 12 - 12
services/data/chart_theme.go

@@ -26,10 +26,10 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 	// 如果找到了,那么就返回
 	if chartTheme != nil {
 		// 兼容历史数据,加入新字段LineOptionList
-		//newConfig, e := ConvertOldChartOptions(chartTheme.Config)
-		//if e == nil {
-		//	chartTheme.Config = newConfig
-		//}
+		newConfig, e := ConvertOldChartOptions(chartTheme.Config)
+		if e == nil {
+			chartTheme.Config = newConfig
+		}
 		return
 	}
 
@@ -52,10 +52,10 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 	// 如果找到了,那么就返回
 	if chartTheme != nil {
 		// 兼容历史数据,加入新字段LineOptionList
-		//newConfig, e := ConvertOldChartOptions(chartTheme.Config)
-		//if e == nil {
-		//	chartTheme.Config = newConfig
-		//}
+		newConfig, e := ConvertOldChartOptions(chartTheme.Config)
+		if e == nil {
+			chartTheme.Config = newConfig
+		}
 		return
 	}
 
@@ -63,10 +63,10 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 	chartTheme, err = chart_theme.GetSystemChartTheme(chartThemeType.ChartThemeTypeId)
 
 	// 兼容历史数据,加入新字段LineOptionList
-	//newConfig, e := ConvertOldChartOptions(chartTheme.Config)
-	//if e == nil {
-	//	chartTheme.Config = newConfig
-	//}
+	newConfig, e := ConvertOldChartOptions(chartTheme.Config)
+	if e == nil {
+		chartTheme.Config = newConfig
+	}
 	return
 }