Browse Source

Merge branch 'bzq1/pool_317_stl_rename'

hsun 2 months ago
parent
commit
54d109379e
1 changed files with 7 additions and 4 deletions
  1. 7 4
      services/data/stl/stl.go

+ 7 - 4
services/data/stl/stl.go

@@ -69,7 +69,7 @@ func GenerateStlEdbData(req *request.StlConfigReq, adminId int) (resp *response.
 	case LAST_N_YEARS:
 		condition += " AND data_time >=?"
 		year := time.Now().Year()
-		lastNyear, er := strconv.Atoi(req.LastNYear)
+		lastNyear, er := strconv.Atoi(confReq.LastNYear)
 		if er != nil {
 			msg = "最近N年输入不合法"
 			err = er
@@ -172,6 +172,9 @@ func GenerateStlEdbData(req *request.StlConfigReq, adminId int) (resp *response.
 		return
 	}
 	defer os.Remove(saveFilePath)
+	trendName := fmt.Sprintf("%sTrend/F%g", edbInfo.EdbName, confReq.Fraction)
+	seasonalName := fmt.Sprintf("%sSeasonal/F%g", edbInfo.EdbName, confReq.Fraction)
+	residualName := fmt.Sprintf("%sResidual/F%g", edbInfo.EdbName, confReq.Fraction)
 	resp = new(response.StlPreviewResp)
 	resp.OriginEdbInfo.EdbInfoId = edbInfo.EdbInfoId
 	resp.OriginEdbInfo.Title = edbInfo.EdbName
@@ -184,7 +187,7 @@ func GenerateStlEdbData(req *request.StlConfigReq, adminId int) (resp *response.
 	resp.TrendChartInfo.DataList = trendChart.DataList
 	resp.TrendChartInfo.MaxData = trendChart.MaxData
 	resp.TrendChartInfo.MinData = trendChart.MinData
-	resp.TrendChartInfo.Title = edbInfo.EdbName + "Trend"
+	resp.TrendChartInfo.Title = trendName
 	resp.TrendChartInfo.ClassifyId = edbInfo.ClassifyId
 	resp.TrendChartInfo.Frequency = edbInfo.Frequency
 	resp.TrendChartInfo.Unit = edbInfo.Unit
@@ -192,14 +195,14 @@ func GenerateStlEdbData(req *request.StlConfigReq, adminId int) (resp *response.
 	resp.SeasonalChartInfo.MaxData = seasonalChart.MaxData
 	resp.SeasonalChartInfo.MinData = seasonalChart.MinData
 	resp.SeasonalChartInfo.ClassifyId = edbInfo.ClassifyId
-	resp.SeasonalChartInfo.Title = edbInfo.EdbName + "Seasonal"
+	resp.SeasonalChartInfo.Title = seasonalName
 	resp.SeasonalChartInfo.Frequency = edbInfo.Frequency
 	resp.SeasonalChartInfo.Unit = edbInfo.Unit
 	resp.ResidualChartInfo.DataList = residualChart.DataList
 	resp.ResidualChartInfo.MaxData = residualChart.MaxData
 	resp.ResidualChartInfo.MinData = residualChart.MinData
 	resp.ResidualChartInfo.ClassifyId = edbInfo.ClassifyId
-	resp.ResidualChartInfo.Title = edbInfo.EdbName + "Residual"
+	resp.ResidualChartInfo.Title = residualName
 	resp.ResidualChartInfo.Frequency = edbInfo.Frequency
 	resp.ResidualChartInfo.Unit = edbInfo.Unit