浏览代码

Merge branch 'ETA_1.9.4' into debug

zwxi 8 月之前
父节点
当前提交
c2dd99a4d9
共有 3 个文件被更改,包括 57 次插入26 次删除
  1. 2 2
      controllers/data_manage/chart_info.go
  2. 22 22
      models/data_manage/chart_info.go
  3. 33 2
      services/data/chart_info_excel_balance.go

+ 2 - 2
controllers/data_manage/chart_info.go

@@ -1432,7 +1432,7 @@ func (this *ChartInfoController) PreviewChartInfoDetail() {
 		err = json.Unmarshal([]byte(req.MarkersLines), &markerLines)
 		if err != nil {
 			br.Msg = "标识线配置异常"
-			br.ErrMsg = "标识线配置异常"
+			br.ErrMsg = "标识线配置异常"+err.Error()
 			return
 		}
 		for i := range markerLines {
@@ -1510,7 +1510,7 @@ func (this *ChartInfoController) PreviewChartInfoDetail() {
 		markerLineStr, err := json.Marshal(markerLines)
 		if err != nil {
 			br.Msg = "标识线配置异常"
-			br.ErrMsg = "标识线配置异常"
+			br.ErrMsg = "标识线配置异常" + err.Error()
 			return
 		}
 

+ 22 - 22
models/data_manage/chart_info.go

@@ -273,7 +273,7 @@ type MarkersLine struct {
 	Value            string          `json:"value" description:"连线指向的数值,例如'4000'"`
 	FromValue        string          `json:"fromValue" description:"连线的起始点,可以为空"`
 	ToValue          string          `json:"toValue" description:"连线的结束点,可以为空"`
-	LineWidth        int             `json:"lineWidth" description:"连线的宽度"`
+	LineWidth        float64         `json:"lineWidth" description:"连线的宽度"`
 	DashStyle        string          `json:"dashStyle" description:"连线的虚线样式,例如'ShortDashDot'"`
 	Color            string          `json:"color" description:"连线的颜色"`
 	Text             string          `json:"text" description:"连线旁边显示的文本"`
@@ -1558,19 +1558,19 @@ type SeasonChartLegend struct {
 
 // 自定义右轴指标
 type SeasonRightAxis struct {
-	IndicatorType int    `description:"右轴指标类型 1:左轴指标同比,2:指标库,3:预测指标 "`
-	Style         string `description:"生成样式"`
-	Shape         string `description:"形状"`
-	ChartColor    string `description:"图表颜色"`
-	Size          int    `description:"大小"`
-	Legend        string `description:"图例名称"`
-	NumFormat     int    `description:"数值格式 1:百分比 2:小数"`
-	IsConnected   int    `description:"是否连接 0不连接 1连接"`
-	LineColor     string `description:"线条颜色"`
-	LineWidth     int    `description:"线条宽度"`
-	LineStyle     string `description:"线条样式"`
-	IsShow        bool   `description:"是否显示"`
-	IsAdd         bool   `description:"是否添加"`
+	IndicatorType int     `description:"右轴指标类型 1:左轴指标同比,2:指标库,3:预测指标 "`
+	Style         string  `description:"生成样式"`
+	Shape         string  `description:"形状"`
+	ChartColor    string  `description:"图表颜色"`
+	Size          float64 `description:"大小"`
+	Legend        string  `description:"图例名称"`
+	NumFormat     int     `description:"数值格式 1:百分比 2:小数"`
+	IsConnected   int     `description:"是否连接 0不连接 1连接"`
+	LineColor     string  `description:"线条颜色"`
+	LineWidth     float64 `description:"线条宽度"`
+	LineStyle     string  `description:"线条样式"`
+	IsShow        bool    `description:"是否显示"`
+	IsAdd         bool    `description:"是否添加"`
 }
 
 // 自定义同期上下限
@@ -1584,13 +1584,13 @@ type MaxMinLimits struct {
 
 // 自定义同期均线
 type SamePeriodAverage struct {
-	Color     string `description:"颜色"`
-	Year      int    `description:"均线取值范围"`
-	Legend    string `description:"图例名称"`
-	LineType  string `description:"线型"`
-	LineWidth int    `description:"线宽"`
-	IsShow    bool   `description:"是否显示"`
-	IsAdd     bool   `description:"是否添加"`
+	Color     string  `description:"颜色"`
+	Year      int     `description:"均线取值范围"`
+	Legend    string  `description:"图例名称"`
+	LineType  string  `description:"线型"`
+	LineWidth float64 `description:"线宽"`
+	IsShow    bool    `description:"是否显示"`
+	IsAdd     bool    `description:"是否添加"`
 }
 
 // 自定义同期均线
@@ -1599,7 +1599,7 @@ type SamePeriodAverageResp struct {
 	Year      int                      `description:"均线取值范围"`
 	Legend    string                   `description:"图例名称"`
 	LineType  string                   `description:"线型"`
-	LineWidth int                      `description:"线宽"`
+	LineWidth float64                  `description:"线宽"`
 	IsShow    bool                     `description:"是否显示"`
 	List      []*SamePeriodAverageData `description:"自定义均线列表"`
 	IsAdd     bool                     `description:"是否添加"`

+ 33 - 2
services/data/chart_info_excel_balance.go

@@ -977,7 +977,27 @@ func GetBalanceExcelEdbDataMapList(chartInfoId, chartType int, calendar, startDa
 			}
 
 		} else if chartType == 2 && item.IsAxis == 0 {
-			// 右轴数据处理,只要最新一年
+			// 右轴数据处理
+			xStartDate := "01-01"
+
+			jumpYear := 0
+			var seasonExtra data_manage.SeasonExtraItem
+			if seasonExtraConfig != "" {
+				err = json.Unmarshal([]byte(seasonExtraConfig), &seasonExtra)
+				if err != nil {
+					return
+				}
+			}
+
+			if seasonExtra.XStartDate != "" {
+				xStartDate = seasonExtra.XStartDate
+				jumpYear = seasonExtra.JumpYear
+			}
+
+			length := len(dataList)
+			if length == 0 {
+				return
+			}
 			latestDate, tmpErr := time.Parse(utils.FormatDate, v.LatestDate)
 			if tmpErr != nil {
 				//item.DataList = dataList
@@ -987,6 +1007,17 @@ func GetBalanceExcelEdbDataMapList(chartInfoId, chartType int, calendar, startDa
 				err = errors.New(fmt.Sprint("获取最后实际数据的日期失败,Err:" + tmpErr.Error() + ";LatestDate:" + v.LatestDate))
 				return
 			}
+
+			var rightAxisDate time.Time
+			if jumpYear == 1 {
+				latestDate = latestDate.AddDate(-1, 0, 0)
+				latestDateStr := fmt.Sprintf("%d-%s", latestDate.Year(),xStartDate)
+				rightAxisDate, err = time.Parse(utils.FormatDate, latestDateStr)
+				if err != nil {
+					return
+				}
+			}
+
 			newDataList := make([]*data_manage.EdbDataList, 0)
 			for _, v := range dataList {
 				dataTime, e := time.Parse(utils.FormatDate, v.DataTime)
@@ -994,7 +1025,7 @@ func GetBalanceExcelEdbDataMapList(chartInfoId, chartType int, calendar, startDa
 					err = errors.New("季节性图处理右轴指标数据转换日期失败,Err:" + e.Error())
 					return
 				}
-				if dataTime.Year() == latestDate.Year() {
+				if dataTime.Equal(rightAxisDate) || dataTime.After(rightAxisDate) {
 					newDataList = append(newDataList, v)
 				}
 			}