浏览代码

Merge branch 'feature/eta_1.9.9' into custom

hsun 7 月之前
父节点
当前提交
c5cddcf611

+ 4 - 0
controllers/data_manage/chart_info.go

@@ -1014,6 +1014,7 @@ func (this *ChartInfoController) ChartInfoDetail() {
 			br.ErrMsg = "获取主题信息失败,Err:" + err.Error()
 			return
 		}
+
 		chartInfo.ChartThemeStyle = chartTheme.Config
 		chartInfo.ChartThemeId = chartTheme.ChartThemeId
 
@@ -1503,6 +1504,7 @@ func (this *ChartInfoController) ChartInfoDetailV2() {
 		br.ErrMsg = "获取主题信息失败,Err:" + err.Error()
 		return
 	}
+
 	chartInfo.ChartThemeStyle = chartTheme.Config
 	chartInfo.ChartThemeId = chartTheme.ChartThemeId
 
@@ -2632,6 +2634,7 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 		errMsg = "获取主题信息失败,Err:" + err.Error()
 		return
 	}
+
 	chartInfo.ChartThemeStyle = chartTheme.Config
 	chartInfo.ChartThemeId = chartTheme.ChartThemeId
 
@@ -3923,6 +3926,7 @@ func (this *ChartInfoController) ChartInfoConvertDetail() {
 			br.ErrMsg = "获取主题信息失败,Err:" + err.Error()
 			return
 		}
+
 		chartInfo.ChartThemeStyle = chartTheme.Config
 		chartInfo.ChartThemeId = chartTheme.ChartThemeId
 

+ 19 - 0
controllers/data_manage/chart_theme.go

@@ -53,6 +53,15 @@ func (c *ChartThemeController) List() {
 		return
 	}
 
+	// 兼容历史数据,加入新字段LineOptionList
+	for i, v := range list {
+		newConfig, e := data.ConvertOldChartOptions(v.Config)
+		if e != nil {
+			continue
+		}
+		list[i].Config = newConfig
+	}
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
@@ -661,6 +670,16 @@ func (c *ChartThemeController) ListBySource() {
 		return
 	}
 
+	// 兼容历史数据,加入新字段LineOptionList
+	for i, v := range list {
+		newConfig, e := data.ConvertOldChartOptions(v.Config)
+		if e != nil {
+			continue
+		}
+		list[i].Config = newConfig
+	}
+
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 1 - 1
controllers/data_manage/excel/balance_table.go

@@ -1413,7 +1413,7 @@ func downloadBalanceTable(excelInfo *excel.ExcelInfo, lang string) (savePath, zi
 				errMsg = msg
 				return
 			}
-			tableData, er := excel2.GetTableDataByMixedTableData(newResult)
+			tableData, er := excel2.GetTableDataByMixedTableData(newResult, false)
 			if er != nil {
 				errMsg = "获取失败"
 				err = fmt.Errorf("转换成table失败,Err:" + err.Error())

+ 179 - 10
controllers/data_manage/excel/excel_info.go

@@ -248,6 +248,7 @@ func (c *ExcelInfoController) Add() {
 		ParentId:           req.ParentId,
 		UpdateUserId:       sysUser.AdminId,
 		UpdateUserRealName: sysUser.RealName,
+		SourcesFrom:        req.SourcesFrom,
 	}
 
 	excelEdbMappingList := make([]*excel3.ExcelEdbMapping, 0)
@@ -662,6 +663,70 @@ func (c *ExcelInfoController) Detail() {
 		excelDetail.Editor = markStatus.Editor
 	}
 
+	// 图表的指标来源
+	if excelDetail.Source == utils.TIME_TABLE {
+		jsonStrByte, err := json.Marshal(excelDetail.TableData)
+		if err != nil {
+			br.Msg = "自定义表格数据获取失败"
+			br.ErrMsg = "自定义表格数据获取失败,转json失败,Err:" + err.Error()
+			return
+		}
+		var tableData request.TableDataReq
+		err = json.Unmarshal(jsonStrByte, &tableData)
+		if err != nil {
+			br.Msg = "自定义表格数据获取失败"
+			br.ErrMsg = "自定义表格数据获取失败,json转结构体失败,Err:" + err.Error()
+			return
+		}
+		sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList(tableData.EdbInfoIdList)
+		if err != nil {
+			br.Msg = "自定义表格数据获取失败"
+			br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+			return
+		}
+		excelDetail.ExcelSource = strings.Join(sourceNameList, ",")
+		excelDetail.ExcelSourceEn = strings.Join(sourceNameEnList, ",")
+
+	}
+
+	// 数据刷新-混合表格
+	if excelDetail.Source == utils.MIXED_TABLE {
+		// todo 刷新动态表的所有子表中关联的指标数据
+		jsonByte, e := json.Marshal(excelDetail.TableData)
+		if e != nil {
+			br.Msg = "刷新失败"
+			br.ErrMsg = "JSON格式化混合表格数据失败, Err: " + e.Error()
+			return
+		}
+		var tableData request.MixedTableReq
+		if e = json.Unmarshal(jsonByte, &tableData); e != nil {
+			br.Msg = "刷新失败"
+			br.ErrMsg = "解析混合表格数据失败, Err: " + e.Error()
+			return
+		}
+		edbInfoIds := make([]int, 0)
+		edbInfoIdExist := make(map[int]bool)
+		if len(tableData.Data) > 0 {
+			for _, t := range tableData.Data {
+				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
+		}
+		excelDetail.ExcelSource = strings.Join(sourceNameList, ",")
+		excelDetail.ExcelSourceEn = strings.Join(sourceNameEnList, ",")
+	}
+
+
 	// excel表格按钮权限
 	if excelDetail.Source != utils.BALANCE_TABLE {
 		excelDetail.Button = excel2.GetExcelInfoOpButton(sysUser, excelDetail.SysUserId, excelDetail.Source, excelDetail.HaveOperaAuth)
@@ -936,12 +1001,14 @@ func (c *ExcelInfoController) Edit() {
 	excelInfo.UpdateUserId = sysUser.AdminId
 	excelInfo.UpdateUserRealName = sysUser.RealName
 	excelInfo.Content = content
+	excelInfo.SourcesFrom = req.SourcesFrom
+
 	// 自动保存时不会传缩略图,也就不更新这个字段
 	var updateExcelInfoParams []string
 	if req.ExcelImage != "" {
-		updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "ExcelImage", "Content", "UpdateUserId", "UpdateUserRealName"}
+		updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "ExcelImage", "Content", "SourcesFrom"}
 	} else {
-		updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "Content", "UpdateUserId", "UpdateUserRealName"}
+		updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "Content", "SourcesFrom"}
 	}
 
 	excelEdbMappingList := make([]*excel3.ExcelEdbMapping, 0)
@@ -1479,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)
@@ -1513,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)
@@ -1530,13 +1606,32 @@ func (c *ExcelInfoController) GetExcelTableData() {
 			br.ErrMsg = "获取最新的数据失败,Err:" + err.Error()
 			return
 		}
-		tableData, err = excel.GetTableDataByMixedTableData(newResult)
+		tableData, err = excel.GetTableDataByMixedTableData(newResult, true)
 		if err != nil {
 			br.Msg = "获取失败"
 			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)
@@ -1558,11 +1653,14 @@ func (c *ExcelInfoController) GetExcelTableData() {
 	}
 
 	resp := response.ExcelTableDetailResp{
-		UniqueCode: excelInfo.UniqueCode,
-		ExcelImage: excelInfo.ExcelImage,
-		ExcelName:  excelInfo.ExcelName,
-		TableInfo:  tableData,
-		Config:     config,
+		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
@@ -1743,12 +1841,23 @@ func (c *ExcelInfoController) GetFirstEdbData() {
 		}
 	}
 
+	sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList([]int{edbInfoId})
+	if err != nil {
+		br.Msg = "自定义表格数据获取失败"
+		br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+		return
+	}
+	excelSource := strings.Join(sourceNameList, ",")
+	excelSourceEn := strings.Join(sourceNameEnList, ",")
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
 	br.Data = response.TableDataItem{
 		EdbInfoId: edbInfoId,
 		Data:      dataList,
+		ExcelSource: excelSource,
+		ExcelSourceEn: excelSourceEn,
 	}
 }
 
@@ -1811,12 +1920,23 @@ func (c *ExcelInfoController) GetOtherEdbData() {
 		}
 	}
 
+	sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList([]int{req.EdbInfoId})
+	if err != nil {
+		br.Msg = "自定义表格数据获取失败"
+		br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+		return
+	}
+	excelSource := strings.Join(sourceNameList, ",")
+	excelSourceEn := strings.Join(sourceNameEnList, ",")
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
 	br.Data = response.TableDataItem{
 		EdbInfoId: req.EdbInfoId,
 		Data:      dataList,
+		ExcelSource: excelSource,
+		ExcelSourceEn: excelSourceEn,
 	}
 }
 
@@ -2344,7 +2464,7 @@ func (c *ExcelInfoController) Download() {
 			br.ErrMsg = "获取最新的数据失败,Err:" + err.Error()
 			return
 		}
-		tableData, err = excel.GetTableDataByMixedTableData(newResult)
+		tableData, err = excel.GetTableDataByMixedTableData(newResult, false)
 		if err != nil {
 			br.Msg = "获取失败"
 			br.ErrMsg = "转换成table失败,Err:" + err.Error()
@@ -2788,3 +2908,52 @@ func (c *ExcelInfoController) GetBatchChartRefreshResult() {
 	br.Ret = 200
 	br.Success = true
 }
+
+
+// GetBatchChartRefreshResult
+// @Title 获取批量刷新表格结果
+// @Description 获取批量刷新表格结果
+// @Param   EdbInfoId   query   int  true       "edb id"
+// @Success Ret=200 刷新成功
+// @router /excel_info/get_edb_source [get]
+func (c *ExcelInfoController) GetEdbSource() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		c.Data["json"] = br
+		c.ServeJSON()
+	}()
+	sysUser := c.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	edbInfoId, _ := c.GetInt("EdbInfoId")
+	if edbInfoId <= 0  {
+		br.Msg = "请选择指标"
+		br.ErrMsg = "请选择指标"
+		br.IsSendEmail = false
+		return
+	}
+	sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList([]int{edbInfoId})
+	if err != nil {
+		br.Msg = "自定义表格数据获取失败"
+		br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
+		return
+	}
+	excelSource := strings.Join(sourceNameList, ",")
+	excelSourceEn := strings.Join(sourceNameEnList, ",")
+
+	var resp struct {
+		ExcelSource string `description:"表格来源"`
+		ExcelSourceEn string `description:"表格来源(英文)"`
+	}
+
+	resp.ExcelSource = excelSource
+	resp.ExcelSourceEn = excelSourceEn
+
+	br.Data = resp
+	br.Ret = 200
+	br.Success = true
+}

+ 84 - 0
models/data_manage/chart_theme/request/theme.go

@@ -28,3 +28,87 @@ type SetDefaultThemeReq struct {
 	ChartThemeId     int `description:"主题id"`
 	ChartThemeTypeId int `description:"主题类型id"`
 }
+
+type ColorsOptions []string
+
+type LegendOptions struct {
+	VerticalAlign string `json:"verticalAlign"`
+	ItemStyle     struct {
+		Color        string `json:"color"`
+		FontSize     int    `json:"fontSize"`
+		Cursor       string `json:"cursor"`
+		FontWeight   string `json:"fontWeight"`
+		TextOverflow string `json:"textOverflow"`
+	} `json:"itemStyle"`
+}
+
+type TitleOptions struct {
+	Align string `json:"align"`
+	Style struct {
+		Color    string `json:"color"`
+		FontSize int    `json:"fontSize"`
+	} `json:"style"`
+}
+
+type MarkerOptions struct {
+	Style struct {
+		Color    string `json:"color"`
+		FontSize int    `json:"fontSize"`
+	} `json:"style"`
+}
+
+type AxisOptions struct {
+	Style struct {
+		Color    string `json:"color"`
+		FontSize int    `json:"fontSize"`
+	} `json:"style"`
+}
+
+type DrawOption struct {
+	PlotBackgroundColor string `json:"plotBackgroundColor"`
+}
+
+type LineOptions struct {
+	DashStyle string  `json:"dashStyle"`
+	LineWidth int     `json:"lineWidth"`
+	LineType  string  `json:"lineType"`
+	Radius    float64 `json:"radius"`
+}
+
+type OldChartOptions struct {
+	ColorsOptions  []string         `json:"colorsOptions"`
+	LineOptions    LineOptions      `json:"lineOptions"`
+	LegendOptions  interface{}      `json:"legendOptions"`
+	TitleOptions   interface{}      `json:"titleOptions"`
+	MarkerOptions  interface{}      `json:"markerOptions"`
+	XAxisOptions   interface{}      `json:"xAxisOptions"`
+	YAxisOptions   interface{}      `json:"yAxisOptions"`
+	DrawOption     interface{}      `json:"drawOption"`
+	LineOptionList []LineStyleOptions `json:"lineOptionList"`
+}
+
+type NewChartOptions struct {
+	OldChartOptions
+	LineOptionList []NewLineOptions `json:"lineOptionList"`
+}
+
+type NewLineOptions struct {
+	LineOptions
+	Color     string `json:"color"`
+	DataMark  string `json:"dataMark"`
+	MarkType  string `json:"markType"`
+	MarkSize  int    `json:"markSize"`
+	MarkColor string `json:"markColor"`
+}
+
+type LineStyleOptions struct {
+	DashStyle string `json:"dashStyle"`
+	Color     string `json:"color"`
+	LineWidth int    `json:"lineWidth"`
+	LineType  string `json:"lineType"`
+	Radius    int `json:"radius"`
+	DataMark  string `json:"dataMark"`
+	MarkType  string `json:"markType"`
+	MarkSize  int `json:"markSize"`
+	MarkColor string `json:"markColor"`
+}

+ 1 - 0
models/data_manage/excel/excel_info.go

@@ -33,6 +33,7 @@ type ExcelInfo struct {
 	UpdateUserRealName string    `description:"更新人真实姓名"`
 	RelExcelInfoId     int       `description:"平衡表里静态表关联的动态表excel id"`
 	VersionName        string    `description:"静态表版本名称"`
+	SourcesFrom        string    `description:"图表来源"`
 }
 
 // Update 更新 excel表格基础信息

+ 2 - 0
models/data_manage/excel/request/excel_info.go

@@ -24,6 +24,7 @@ type AddExcelInfoReq struct {
 	Content         string      `description:"Excel表格内容"`
 	TableData       interface{} `description:"自定义表格的数据内容"`
 	ParentId        int         `description:"表格的父级id"`
+	SourcesFrom     string      `description:"图表来源"`
 }
 
 // EditExcelInfoReq 编辑表格请求
@@ -35,6 +36,7 @@ type EditExcelInfoReq struct {
 	ExcelClassifyId int         `description:"分类id"`
 	Content         string      `description:"Excel表格内容"`
 	TableData       interface{} `description:"自定义表格的数据内容"`
+	SourcesFrom     string      `description:"图表来源"`
 }
 
 // SetExcelInfoImageReq 设置excel表格图片请求

+ 10 - 0
models/data_manage/excel/request/mixed_table.go

@@ -45,6 +45,16 @@ type MixedTableCellDataReq struct {
 	Extra           string      `description:"额外参数"`
 	ShowStyle       string      `description:"展示的样式配置"`
 	ShowFormatValue interface{} `description:"样式处理后的值"`
+	MerData         *struct {
+		Type string `json:"type"`
+		Mer  struct {
+			SKey    string `json:"sKey"`
+			Rowspan int    `json:"rowspan"`
+			Colspan int    `json:"colspan"`
+			Row     int    `json:"row"`
+			Col     int    `json:"col"`
+		} `json:"mer"`
+	} `json:"merData" description:"合并单元格"`
 }
 
 // CellRelationConf

+ 15 - 7
models/data_manage/excel/response/excel_info.go

@@ -22,11 +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
+	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
@@ -44,8 +47,10 @@ type TableCellResp struct {
 }
 
 type TableDataItem struct {
-	EdbInfoId int                     `description:"指标id"`
-	Data      []request.ManualDataReq `description:"数据列表"`
+	EdbInfoId     int                     `description:"指标id"`
+	Data          []request.ManualDataReq `description:"数据列表"`
+	ExcelSource   string                  `description:"表格来源str"`
+	ExcelSourceEn string                  `description:"表格来源(英文)"`
 }
 
 // TableDetailResp  excel表格详情
@@ -82,6 +87,9 @@ type ExcelInfoDetail struct {
 	UpdateUserId       int                          `description:"更新人id"`
 	UpdateUserRealName string                       `description:"更新人真实姓名"`
 	RelExcelInfoId     int                          `description:"平衡表里静态表关联的动态表excel id"`
+	SourcesFrom        string                       `description:"图表来源"`
+	ExcelSource        string                       `description:"表格来源str"`
+	ExcelSourceEn      string                       `description:"表格来源(英文)"`
 }
 
 type BalanceChildTableResp struct {

+ 9 - 0
routers/commentsRouter.go

@@ -997,6 +997,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/excel:ExcelInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/excel:ExcelInfoController"],
+        beego.ControllerComments{
+            Method: "GetEdbSource",
+            Router: `/excel_info/get_edb_source`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/excel:ExcelInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/excel:ExcelInfoController"],
         beego.ControllerComments{
             Method: "GetSystemDate",

+ 47 - 0
services/data/chart_theme.go

@@ -5,6 +5,7 @@ import (
 	"errors"
 	"eta/eta_api/models/data_manage"
 	"eta/eta_api/models/data_manage/chart_theme"
+	"eta/eta_api/models/data_manage/chart_theme/request"
 	"eta/eta_api/utils"
 	"fmt"
 	"github.com/shopspring/decimal"
@@ -580,6 +581,11 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 
 	// 如果找到了,那么就返回
 	if chartTheme != nil {
+		// 兼容历史数据,加入新字段LineOptionList
+		newConfig, e := ConvertOldChartOptions(chartTheme.Config)
+		if e == nil {
+			chartTheme.Config = newConfig
+		}
 		return
 	}
 
@@ -601,11 +607,52 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 
 	// 如果找到了,那么就返回
 	if chartTheme != nil {
+		// 兼容历史数据,加入新字段LineOptionList
+		newConfig, e := ConvertOldChartOptions(chartTheme.Config)
+		if e == nil {
+			chartTheme.Config = newConfig
+		}
 		return
 	}
 
 	// 如果还是没找到,那就系统的主题id
 	chartTheme, err = chart_theme.GetSystemChartTheme(chartThemeType.ChartThemeTypeId)
 
+	// 兼容历史数据,加入新字段LineOptionList
+	newConfig, e := ConvertOldChartOptions(chartTheme.Config)
+	if e == nil {
+		chartTheme.Config = newConfig
+	}
+
+	return
+}
+
+// 兼容历史数据,加入新字段LineOptionList
+func ConvertOldChartOptions(config string) (newConfig string, err error) {
+	var oldTheme request.OldChartOptions
+
+	var newTheme request.NewChartOptions
+	err = json.Unmarshal([]byte(config), &oldTheme)
+	if err != nil {
+		return
+	}
+	if oldTheme.LineOptionList != nil && len(oldTheme.LineOptionList) > 0 {
+		newConfig = config
+		return
+	}
+	newTheme.OldChartOptions = oldTheme
+	for i := 0; i < 10; i++ {
+		newLineOption := request.NewLineOptions{
+			LineOptions: oldTheme.LineOptions,
+			Color:       oldTheme.ColorsOptions[i],
+			DataMark:    "none",
+			MarkType:    "square",
+			MarkSize:    5,
+			MarkColor:   oldTheme.ColorsOptions[i],
+		}
+		newTheme.LineOptionList = append(newTheme.LineOptionList, newLineOption)
+	}
+	newThemeStr, _ := json.Marshal(newTheme)
+	newConfig = string(newThemeStr)
 	return
 }

+ 54 - 0
services/data/excel/excel_info.go

@@ -3,6 +3,7 @@ package excel
 import (
 	"encoding/json"
 	"errors"
+	"eta/eta_api/models"
 	"eta/eta_api/models/data_manage"
 	"eta/eta_api/models/data_manage/excel"
 	"eta/eta_api/models/data_manage/excel/request"
@@ -101,6 +102,7 @@ func formatExcelInfo2Detail(excelInfo *excel.ExcelInfo, sysUserId int, lang stri
 		UpdateUserId:       excelInfo.UpdateUserId,
 		UpdateUserRealName: excelInfo.UpdateUserRealName,
 		RelExcelInfoId:     excelInfo.RelExcelInfoId,
+		SourcesFrom:        excelInfo.SourcesFrom,
 	}
 
 	// 无权限,不需要返回数据
@@ -527,3 +529,55 @@ func GetExcelEdbBatchRefreshKey(source string, primaryId, subId int) string {
 
 	return fmt.Sprint("batch_refresh_excel_edb:", source, ":", primaryId, ":", subId)
 }
+
+// GetEdbSourceByEdbInfoIdList 获取关联指标的来源
+func GetEdbSourceByEdbInfoIdList(edbInfoIdList []int) (sourceNameList, sourceNameEnList []string,err error) {
+	sourceNameList = make([]string, 0)
+	sourceNameEnList = make([]string, 0)
+	sourceMap := make(map[int]string)
+	edbInfoList, tmpErr := data_manage.GetEdbInfoByIdList(edbInfoIdList)
+	if tmpErr != nil {
+		err = tmpErr
+		return
+	}
+	for _, v := range edbInfoList {
+		// 指标类型:1:基础指标,2:计算指标
+		if v.EdbType == 2 {
+			//sourceMap[0] = "弘则研究"
+			baseEdbInfoArr, _, _ := data_manage.GetRefreshEdbInfoFromBase(v.EdbInfoId, v.Source)
+			for _, baseEdbInfo := range baseEdbInfoArr {
+				if baseEdbInfo.EdbInfoType == 0 { //普通指标才参与,预测指标不参与
+					sourceMap[baseEdbInfo.Source] = baseEdbInfo.SourceName
+				}
+			}
+		} else {
+			sourceMap[v.Source] = v.SourceName
+		}
+	}
+
+	for source, sourceName := range sourceMap {
+		if utils.InArrayByInt([]int{utils.DATA_SOURCE_MANUAL, utils.DATA_SOURCE_MYSTEEL_CHEMICAL}, source) {
+			continue
+		}
+		sourceNameList = append(sourceNameList, sourceName)
+
+		sourceNameEn, ok := utils.DataSourceEnMap[source]
+		if !ok {
+			sourceNameEn = sourceName
+		}
+		sourceNameEnList = append(sourceNameEnList, sourceNameEn)
+	}
+	//sourceNameList = append(sourceNameList, utils.ChartDefaultNameCn)
+	//sourceNameEnList = append(sourceNameEnList, utils.ChartDefaultNameEn)
+
+	// 图表来源
+	conf, e := models.GetBusinessConf()
+	if e != nil {
+		return
+	}
+	if conf[models.BusinessConfCompanyName] != "" {
+		sourceNameList = append(sourceNameList, conf[models.BusinessConfCompanyName])
+		sourceNameEnList = append(sourceNameEnList, conf[models.BusinessConfCompanyName])
+	}
+	return
+}

+ 2 - 1
services/data/excel/mixed_table.go

@@ -1258,7 +1258,8 @@ func changePointDecimalPlaces(str string, changeNum int, numberType string, isPe
 		val, _ = decimal.NewFromFloat(val).Round(int32(decimalPlaces)).Float64()
 		newStr = strconv.FormatFloat(val, 'f', decimalPlaces, 64)
 	} else {
-		newStr = fmt.Sprintf("%v", val)
+		// 此处用%.f避免科学计数法, 从而导致后面出现很多位0
+		newStr = fmt.Sprintf("%.f", val)
 	}
 	// 计算小数位数
 	decimalPlaces = 0

+ 12 - 1
services/excel/lucky_sheet.go

@@ -1717,7 +1717,7 @@ func GetTableDataByCustomData(excelType int, data request.TableDataReq, lang str
 }
 
 // GetTableDataByMixedTableData 通过混合表格数据获取表格数据
-func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq) (selfTableData TableData, err error) {
+func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq, hideMerged bool) (selfTableData TableData, err error) {
 	tableDataList := make([][]LuckySheetDataValue, 0)
 	mergeList := make([]TableDataMerge, 0)
 
@@ -1731,6 +1731,17 @@ func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq) (sel
 					Monitor:   cell.ShowValue,
 					MergeCell: LuckySheetDataConfigMerge{},
 				}
+				// TODO: 混合表格/平衡表-合并单元格
+				// 前端需要隐藏被合并的单元格, 混合表格/平衡表通过这个字段判断, 不通过HandleTableCell方法隐藏
+				if cell.MerData != nil {
+					if hideMerged && cell.MerData.Type == "merged" {
+						continue
+					}
+					tmp.MergeCell.Rs = cell.MerData.Mer.Rowspan
+					tmp.MergeCell.Cs = cell.MerData.Mer.Colspan
+					tmp.MergeCell.Row = cell.MerData.Mer.Row
+					tmp.MergeCell.Column = cell.MerData.Mer.Col
+				}
 				if cell.ShowStyle != "" {
 					showFormatValue := fmt.Sprintf("%v", cell.ShowFormatValue)
 					tmp.Monitor = showFormatValue