Browse Source

Merge branch 'feature/eta1.9.6_chart_series' into debug

# Conflicts:
#	models/chart_info.go
#	services/chart_info_show.go
xyxie 8 months ago
parent
commit
615672d411
3 changed files with 54 additions and 64 deletions
  1. 42 52
      models/chart_info.go
  2. 2 2
      services/chart_extra_config.go
  3. 10 10
      services/chart_info_show.go

+ 42 - 52
models/chart_info.go

@@ -2217,11 +2217,49 @@ type ChartSectionDateConfItem struct {
 	DateType       int    `description:"日期类型:0 指标日期,1系统日期"`
 	DateConfName   string `description:"引用日期名称"` // 引用日期名称不能重复
 	DateConfNameEn string `description:"引用日期英文名称"`
-	DateChange     []*ChartSectionDateChange
+	DateChange     []*EdbDateConfDateChange
 }
 
-// 截面组合图引用日期配置
-type ChartSectionDateChange struct {
+type MarkersLine struct {
+	Axis             int             `json:"axis" description:"1左轴 2右轴 3横轴"`
+	AxisName         string          `json:"axisName" description:"轴的名称,例如'左轴'"`
+	MarkerType       string          `json:"markerType" description:"标识线或标识区"`
+	MarkLineType     int             `json:"markLineType" description:"1:固定 2:指标计算"`
+	Value            string          `json:"value" description:"连线指向的数值,例如'4000'"`
+	FromValue        string          `json:"fromValue" description:"连线的起始点,可以为空"`
+	ToValue          string          `json:"toValue" description:"连线的结束点,可以为空"`
+	LineWidth        float64         `json:"lineWidth" description:"连线的宽度"`
+	DashStyle        string          `json:"dashStyle" description:"连线的虚线样式,例如'ShortDashDot'"`
+	Color            string          `json:"color" description:"连线的颜色"`
+	Text             string          `json:"text" description:"连线旁边显示的文本"`
+	TextPosition     string          `json:"textPosition" description:"文本的显示位置,例如'bottom'"`
+	TextColor        string          `json:"textColor" description:"文本颜色"`
+	TextFontSize     int             `json:"textFontSize" description:"文本的字号大小"`
+	IsShow           bool            `json:"isShow" description:"是否显示连线及文本"`
+	EdbType          int             `json:"edbType" description:"指标类型 0图中第一个指标 1其他指标 前端回显用"`
+	EdbInfoId        int             `json:"edbInfoId" description:"指标id"`
+	Calculation      int             `json:"calculation" description:"计算方式 1区间均值 2区间均值加N倍标准差 3区间个数分位 4区间数值分位"`
+	CalculationValue int             `json:"calculationValue" description:"计算方式对应的值 2就是几倍标准差 3就是分位值 4就是数值值·"`
+	TimeIntervalType int             `json:"timeInterval" description:"时间区间 0跟随图表 1自定义"`
+	StartDate        MarkersLineTime `json:"startTime" description:"开始时间"`
+	EndDate          MarkersLineTime `json:"endTime" description:"结束时间"`
+}
+
+type MarkersLineTime struct {
+	TimeType int               `json:"timeType" description:"时间类型 1固定 2动态 3至今(仅结束时间)"`
+	Date     string            `json:"date" description:"日期"`
+	Conf     EdbDateChangeConf `json:"conf" description:"动态时间配置"`
+}
+
+// EdbDateExtraConf
+// @Description: 导入指标日期前移和日期变换
+type EdbDateChangeConf struct {
+	MoveForward int `description:"前移的期数"`
+	BaseDate    int `description:"基准日期 0系统日期 1指标最新日期"`
+	DateChange  []*EdbDateConfDateChange
+}
+
+type EdbDateConfDateChange struct {
 	Year         int
 	Month        int
 	Day          int
@@ -2282,7 +2320,7 @@ type ChartSectionCombineDataResp struct {
 // 系列里的指标日期配置
 type ChartSectionSeriesDateConfItem struct {
 	MoveForward int `description:"前移的期数"`
-	DateChange  []*ChartSectionDateChange
+	DateChange  []*EdbDateConfDateChange
 }
 
 // PreviewSectionCombineChartReq 预览截面组合图的请求
@@ -2309,51 +2347,3 @@ type ChartTimeCombineExtraConf struct {
 type ChartTimeCombineDataResp struct {
 	IsHeap int `description:"是否堆积(1.堆积,0不堆积)"`
 }
-
-type MarkersLine struct {
-	Axis             int             `json:"axis" description:"1左轴 2右轴 3横轴"`
-	AxisName         string          `json:"axisName" description:"轴的名称,例如'左轴'"`
-	MarkerType       string          `json:"markerType" description:"标识线或标识区"`
-	MarkLineType     int             `json:"markLineType" description:"1:固定 2:指标计算"`
-	Value            string          `json:"value" description:"连线指向的数值,例如'4000'"`
-	FromValue        string          `json:"fromValue" description:"连线的起始点,可以为空"`
-	ToValue          string          `json:"toValue" description:"连线的结束点,可以为空"`
-	LineWidth        float64         `json:"lineWidth" description:"连线的宽度"`
-	DashStyle        string          `json:"dashStyle" description:"连线的虚线样式,例如'ShortDashDot'"`
-	Color            string          `json:"color" description:"连线的颜色"`
-	Text             string          `json:"text" description:"连线旁边显示的文本"`
-	TextPosition     string          `json:"textPosition" description:"文本的显示位置,例如'bottom'"`
-	TextColor        string          `json:"textColor" description:"文本颜色"`
-	TextFontSize     int             `json:"textFontSize" description:"文本的字号大小"`
-	IsShow           bool            `json:"isShow" description:"是否显示连线及文本"`
-	EdbType          int             `json:"edbType" description:"指标类型 0图中第一个指标 1其他指标 前端回显用"`
-	EdbInfoId        int             `json:"edbInfoId" description:"指标id"`
-	Calculation      int             `json:"calculation" description:"计算方式 1区间均值 2区间均值加N倍标准差 3区间个数分位 4区间数值分位"`
-	CalculationValue int             `json:"calculationValue" description:"计算方式对应的值 2就是几倍标准差 3就是分位值 4就是数值值·"`
-	TimeIntervalType int             `json:"timeInterval" description:"时间区间 0跟随图表 1自定义"`
-	StartDate        MarkersLineTime `json:"startTime" description:"开始时间"`
-	EndDate          MarkersLineTime `json:"endTime" description:"结束时间"`
-}
-
-type MarkersLineTime struct {
-	TimeType int               `json:"timeType" description:"时间类型 1固定 2动态 3至今(仅结束时间)"`
-	Date     string            `json:"date" description:"日期"`
-	Conf     EdbDateChangeConf `json:"conf" description:"动态时间配置"`
-}
-
-// EdbDateExtraConf
-// @Description: 导入指标日期前移和日期变换
-type EdbDateChangeConf struct {
-	MoveForward int `description:"前移的期数"`
-	BaseDate    int `description:"基准日期 0系统日期 1指标最新日期"`
-	DateChange  []*EdbDateConfDateChange
-}
-
-type EdbDateConfDateChange struct {
-	Year         int
-	Month        int
-	Day          int
-	Frequency    string `description:"频度变换"`
-	FrequencyDay string `description:"频度的固定日期"`
-	ChangeType   int    `description:"日期变换类型1日期位移,2指定频率"`
-}

+ 2 - 2
services/chart_extra_config.go

@@ -323,7 +323,7 @@ func GetChartSectionCombineData(chartInfo *models.ChartInfo, mappingList []*mode
 }
 
 // GetChartSectionSeriesDateByDateChange 获取日期变换后的日期edbInfoId 1指标日期,2 系统日期
-func GetChartSectionSeriesDateByDateChange(edbInfoId int, dataList []*models.EdbDataList, dateChange []*models.ChartSectionDateChange, moveForward int) (newDate string, err error) {
+func GetChartSectionSeriesDateByDateChange(edbInfoId int, dataList []*models.EdbDataList, dateChange []*models.EdbDateConfDateChange, moveForward int) (newDate string, err error) {
 	if edbInfoId > 0 { //指标日期
 		newDate = GetEdbDateByMoveForward(moveForward, dataList)
 	} else {
@@ -359,7 +359,7 @@ func GetEdbDateByMoveForwardByDateList(moveForward int, dateList []string) (date
 }
 
 // HandleChartSectionSeriesDateChange 处理日期变换
-func HandleChartSectionSeriesDateChange(date string, dateChange []*models.ChartSectionDateChange) (newDate string, err error) {
+func HandleChartSectionSeriesDateChange(date string, dateChange []*models.EdbDateConfDateChange) (newDate string, err error) {
 	newDate = date
 	if newDate != "" {
 		if len(dateChange) > 0 {

+ 10 - 10
services/chart_info_show.go

@@ -273,15 +273,6 @@ func GetChartEdbData(chartInfoId, chartType int, calendar, startDate, endDate st
 
 	// 特殊图形数据处理
 	switch chartType {
-	case 6: //时序组合图
-		//判断是否堆积
-		timeConf := extraConfig.(models.ChartTimeCombineExtraConf)
-		if extraConfigStr == "" { //历史数据,默认开启堆积
-			timeConf = models.ChartTimeCombineExtraConf{
-				IsHeap: 1,
-			}
-		}
-		dataResp = models.ChartTimeCombineDataResp{IsHeap: timeConf.IsHeap}
 	case 2: // 季节性图
 		if seasonExtraConfig != "" {
 			// 季节性图计算不管图上数据时间,拿所有数据
@@ -295,6 +286,15 @@ func GetChartEdbData(chartInfoId, chartType int, calendar, startDate, endDate st
 			// 兼容无配置的老图
 			dataResp = new(models.SeasonChartResp)
 		}
+	case 6: //时序组合图
+		//判断是否堆积
+		timeConf := extraConfig.(models.ChartTimeCombineExtraConf)
+		if extraConfigStr == "" { //历史数据,默认开启堆积
+			timeConf = models.ChartTimeCombineExtraConf{
+				IsHeap: 1,
+			}
+		}
+		dataResp = models.ChartTimeCombineDataResp{IsHeap: timeConf.IsHeap}
 	case 7: // 柱形图
 		barChartConf := extraConfig.(models.BarChartInfoReq)
 		xEdbIdValue, yDataList, err = BarChartData(mappingList, edbDataListMap, barChartConf.DateList, barChartConf.Sort)
@@ -2320,4 +2320,4 @@ func SeasonChartData(dataList []*models.ChartEdbInfoMapping, seasonExtraConfig s
 	}
 
 	return
-}
+}