Quellcode durchsuchen

Merge branch 'debug' of http://8.136.199.33:3000/eta_server/eta_chart_lib into debug

zwxi vor 7 Monaten
Ursprung
Commit
da742f75ae

+ 23 - 0
controllers/chart_common.go

@@ -265,6 +265,29 @@ func GetFutureGoodChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key
 				}
 			}
 		}
+		if v.Source == 0 {
+			name := strings.Split(v.EdbName, "(")
+			if barConfig.FutureGoodEdbName != "" {
+				name[0] = barConfig.FutureGoodEdbName
+			}
+			v.EdbName = name[0]
+			if len(name) > 1 {
+				v.EdbName = v.EdbName + "(" + name[1]
+			}
+			//英文
+			// 编译正则表达式,匹配一个或多个数字
+
+			if v.EdbNameEn != "" {
+				name = strings.Split(v.EdbNameEn, "(")
+				if barConfig.FutureGoodEdbNameEn != "" {
+					name[0] = barConfig.FutureGoodEdbNameEn
+				}
+				v.EdbNameEn = name[0]
+				if len(name) > 1 {
+					v.EdbNameEn = v.EdbNameEn + "(" + name[1]
+				}
+			}
+		}
 	}
 	chartInfo.UnitEn = baseEdbInfo.UnitEn
 

+ 6 - 4
models/data_manage/chart_info.go

@@ -67,10 +67,12 @@ type BarChartInfoReq struct {
 }
 
 type FutureGoodBarChartInfoReq struct {
-	EdbInfoIdList []BarChartInfoEdbItemReq `description:"指标信息"`
-	DateList      []BarChartInfoDateReq    `description:"日期配置"`
-	XDataList     []XData                  `description:"横轴配置"`
-	BaseEdbInfoId int                      `description:"日期基准指标id"`
+	EdbInfoIdList       []BarChartInfoEdbItemReq `description:"指标信息"`
+	DateList            []BarChartInfoDateReq    `description:"日期配置"`
+	XDataList           []XData                  `description:"横轴配置"`
+	BaseEdbInfoId       int                      `description:"日期基准指标id"`
+	FutureGoodEdbName   string                   `description:"期货名称"`
+	FutureGoodEdbNameEn string                   `description:"期货英文名称"`
 }
 
 // XData 商品价格曲线的的x轴数据

+ 8 - 6
models/request/mixed_table.go

@@ -160,12 +160,14 @@ type MixDateCalculateTagReq struct {
 
 // MixCellShowStyle 混合表格 单元格样式展示计算
 type MixCellShowStyle struct {
-	Pn              int    `description:"小数点位数增加或减少,正数表述增加,负数表示减少" json:"pn"`
-	Nt              string `description:"变换类型:number 小数点位数改变,percent百分比," json:"nt"`
-	Decimal         *int   `description:"小数点位数"`
-	Last            string `description:"起始操作:nt|decimal"`
-	Color           string `description:"颜色值,#RRG" json:"color"`
-	BackgroundColor string `description:"背景颜色值,#RRG" json:"background-color"`
+	Pn              int     `description:"小数点位数增加或减少,正数表述增加,负数表示减少" json:"pn"`
+	Nt              string  `description:"变换类型:number 小数点位数改变,percent百分比," json:"nt"`
+	Decimal         *int    `description:"小数点位数"`
+	Last            string  `description:"起始操作:nt|decimal"`
+	Color           string  `description:"颜色值,#RRG" json:"color"`
+	BackgroundColor string  `description:"背景颜色值,#RRG" json:"background-color"`
+	Width           float64 `description:"单元格宽度" json:"width"`
+	Align           string  `description:"对齐方式:left|center|right" json:"align"`
 }
 
 type DateDataBeforeAfterReq struct {

+ 2 - 2
services/data/future_good/base_future_good_lib.go

@@ -31,9 +31,9 @@ func RefreshEdbData(futureGoodEdbInfoId int, futureGoodEdbCode, startDate string
 }
 
 // RefreshEdbRelation 刷新商品期货指标相关的数据
-func RefreshEdbRelation(futureGoodEdbInfoId int) (resp *models.BaseResponse, err error) {
+func RefreshEdbRelation(chartInfoId int) (resp *models.BaseResponse, err error) {
 	param := make(map[string]interface{})
-	param["FutureGoodEdbInfoId"] = futureGoodEdbInfoId
+	param["ChartInfoId"] = chartInfoId
 	urlStr := `future_good/relation/refresh`
 	resp, err = postRefreshEdbData(param, urlStr)
 	return

+ 8 - 0
services/data/future_good/chart_info.go

@@ -1072,5 +1072,13 @@ func FutureGoodChartInfoRefresh(chartInfoId int) (err error) {
 		return
 	}
 
+	resp, err := RefreshEdbRelation(chartInfoId)
+	if err != nil {
+		return
+	}
+	if resp.Ret != 200 {
+		err = fmt.Errorf("刷新利润曲线图表数据失败:Err:%s", resp.Msg)
+		return
+	}
 	return
 }

+ 0 - 8
services/data/future_good/future_edb_info.go

@@ -53,13 +53,5 @@ func FutureGoodEdbInfoRefreshAllFromBase(futureGoodEdbInfoList []*future_good.Fu
 			return fmt.Errorf("刷新失败, err:%s", errMsg)
 		}
 	}
-
-	// 刷新商品期货指标相关的数据
-	for _, bv := range futureGoodEdbInfoList {
-		if bv.ParentId == 0 {
-			RefreshEdbRelation(bv.FutureGoodEdbInfoId)
-		}
-	}
-
 	return err
 }

+ 13 - 0
services/data/range_analysis/chart_info.go

@@ -421,6 +421,12 @@ func GetChartDataByEdbInfoList(chartInfoId int, dateType, startYear int, startDa
 			edbInfoMapping.ConvertUnit = req.DataConvertConf.Unit
 			edbInfoMapping.ConvertEnUnit = req.DataConvertConf.Unit
 		}
+		if edbInfoMapping.ConvertUnit == "无" {
+			edbInfoMapping.ConvertUnit = ""
+		}
+		if edbInfoMapping.ConvertEnUnit == "无" {
+			edbInfoMapping.ConvertEnUnit = ""
+		}
 		dataList := edbInfoMapping.DataList.([]*models.EdbDataList)
 		// 处理上下限
 		var maxData, minData float64
@@ -548,6 +554,12 @@ func GetChartDataByEdbInfoListBySeries(chartInfoId int, dateType, startYear int,
 			edbInfoMapping.ConvertUnit = req.DataConvertConf.Unit
 			edbInfoMapping.ConvertEnUnit = req.DataConvertConf.Unit
 		}
+		if edbInfoMapping.ConvertUnit == "无" {
+			edbInfoMapping.ConvertUnit = ""
+		}
+		if edbInfoMapping.ConvertEnUnit == "无" {
+			edbInfoMapping.ConvertEnUnit = ""
+		}
 		edbInfoMapping.DataList = dataList
 		// 处理上下限
 		var maxData, minData float64
@@ -761,6 +773,7 @@ func getChartDataByEdbInfo(edbInfoMapping *models.ChartEdbInfoMapping, req *mode
 					dealDataList = append(dealDataList, v)
 				}
 			}
+			newDataList = dealDataList
 		case 2:
 			for i, v := range newDataList {
 				if utils.CompareFloatByOpStrings(req.UnNormalDataConf.Formula, v.Value, req.UnNormalDataConf.Value) {

+ 11 - 0
services/excel/lucky_sheet.go

@@ -1218,6 +1218,17 @@ func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq, hide
 					if styleConfig.Color != "" {
 						tmp.FontColor = styleConfig.Color
 					}
+					switch styleConfig.Align {
+					case "center":
+						tmp.HorizontalType = 0
+						tmp.Ht = 0
+					case "left":
+						tmp.HorizontalType = 1
+						tmp.Ht = 1
+					case "right":
+						tmp.HorizontalType = 2
+						tmp.Ht = 2
+					}
 					tmp.Monitor = cell.ShowFormatValue
 					tmpShowValue, err := strconv.ParseFloat(cell.Value, 64)
 					if err == nil {