瀏覽代碼

Merge remote-tracking branch 'origin/14.8'

Roc 1 年之前
父節點
當前提交
91dd21aa38

+ 12 - 0
models/data_manage/edb_data_base.go

@@ -123,6 +123,18 @@ func GetEdbDataTableName(source int) (tableName string) {
 		tableName = "edb_data_calculate_correlation"
 	case utils.DATA_SOURCE_NATIONAL_STATISTICS:
 		tableName = "edb_data_national_statistics"
+	case utils.DATA_SOURCE_CALCULATE_LJZZJ: //累计值转季 -> 61
+		tableName = "edb_data_calculate_ljzzj"
+	case utils.DATA_SOURCE_CALCULATE_LJZ: //累计值 -> 62
+		tableName = "edb_data_calculate_ljz"
+	case utils.DATA_SOURCE_CALCULATE_LJZNCZJ: //累计值(年初至今) -> 63
+		tableName = "edb_data_calculate_ljznczj"
+	case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZZJ: // 预测指标 - 累计值 -> 65
+		tableName = "edb_data_predict_calculate_ljzzj"
+	case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZ: //预测指标 - 累计值转季->64
+		tableName = "edb_data_predict_calculate_ljz"
+	case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZNCZJ: //预测指标 - 累计值(年初至今) -> 66
+		tableName = "edb_data_predict_calculate_ljznczj"
 	default:
 		tableName = ""
 	}

+ 0 - 37
models/data_manage/line_equation/response/line_equation.go

@@ -1,37 +0,0 @@
-package response
-
-import (
-	"hongze/hongze_admin/models/data_manage"
-	"hongze/hongze_admin/models/data_manage/line_equation/request"
-)
-
-type ChartInfoResp struct {
-	List []ChartDataResp `description:"数据列表"`
-}
-
-// ChartDataResp 图表数据
-type ChartDataResp struct {
-	LatestDate          string  `description:"真实数据的日期"`
-	Name                string  `description:"名称"`
-	NameEn              string  `description:"英文名称"`
-	EdbInfoCategoryType int     `description:"普通数据还是预测数据,0:普通,1:预测"`
-	MaxData             float64 `description:"最大值"`
-	MinData             float64 `description:"最小值"`
-	DataList            []data_manage.EdbDataList
-}
-
-// MultipleGraphConfigDetailResp 配置详情接口返回
-type MultipleGraphConfigDetailResp struct {
-	MultipleGraphConfigId int
-	LineChartInfoConfig   request.LineChartInfoReq
-	EdbInfoList           []*data_manage.ChartEdbInfoMapping
-	ChartMappingList      []MultipleGraphConfigChartMapping `description:"关联图表"`
-}
-type MultipleGraphConfigChartMapping struct {
-	ChartInfoId int `description:"图表id"`
-	Source      int `description:"来源,5:斜率图,6:截距图;7:相关性图;"`
-}
-type MultipleGraphConfigEdbMapping struct {
-	EdbInfoId int `description:"图表id"`
-	Source    int `description:"来源,5:斜率图,6:截距图;7:相关性图;"`
-}

+ 12 - 0
models/edb_data_base.go

@@ -122,6 +122,18 @@ func GetEdbDataTableName(source int) (tableName string) {
 		tableName = "edb_data_calculate_correlation"
 	case utils.DATA_SOURCE_NATIONAL_STATISTICS:
 		tableName = "edb_data_national_statistics"
+	case utils.DATA_SOURCE_CALCULATE_LJZZJ: //累计值转季 -> 61
+		tableName = "edb_data_calculate_ljzzj"
+	case utils.DATA_SOURCE_CALCULATE_LJZ: //累计值 -> 62
+		tableName = "edb_data_calculate_ljz"
+	case utils.DATA_SOURCE_CALCULATE_LJZNCZJ: //累计值(年初至今) -> 63
+		tableName = "edb_data_calculate_ljznczj"
+	case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZZJ: // 预测指标 - 累计值 -> 65
+		tableName = "edb_data_predict_calculate_ljzzj"
+	case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZ: //预测指标 - 累计值转季->64
+		tableName = "edb_data_predict_calculate_ljz"
+	case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZNCZJ: //预测指标 - 累计值(年初至今) -> 66
+		tableName = "edb_data_predict_calculate_ljznczj"
 	default:
 		tableName = ""
 	}

+ 7 - 0
services/data/correlation/chart_info.go

@@ -86,6 +86,13 @@ func HandleDataByLinearRegression(originList []*models.EdbDataList, handleDataMa
 			}
 		}
 
+		// 最后将自己赋值
+		newList = append(newList, &models.EdbDataList{
+			EdbDataId: v.EdbDataId,
+			DataTime:  v.DataTime,
+			Value:     v.Value,
+		})
+
 		startEdbInfoData = v
 	}
 	return

+ 33 - 0
services/data/predict_edb_info.go

@@ -75,6 +75,15 @@ func getPredictEdbDayList(startDate, endDate time.Time, frequency string) (dayLi
 		for currDate := startDate.AddDate(0, 0, 7); currDate.Before(endDate) || currDate.Equal(endDate); currDate = currDate.AddDate(0, 0, 7) {
 			dayList = append(dayList, currDate)
 		}
+	case "旬度":
+		for currDate := startDate.AddDate(0, 0, 1); currDate.Before(endDate) || currDate.Equal(endDate); {
+			nextDate := currDate.AddDate(0, 0, 1)
+			//每个月的10号、20号、最后一天,那么就写入
+			if nextDate.Day() == 11 || nextDate.Day() == 21 || nextDate.Day() == 1 {
+				dayList = append(dayList, currDate)
+			}
+			currDate = nextDate
+		}
 	case "月度":
 		for currDate := startDate; currDate.Before(endDate) || currDate.Equal(endDate); {
 			currDate = time.Date(currDate.Year(), currDate.Month(), 1, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 1, -1)
@@ -83,6 +92,30 @@ func getPredictEdbDayList(startDate, endDate time.Time, frequency string) (dayLi
 			}
 			currDate = currDate.AddDate(0, 0, 1)
 		}
+	case "季度":
+		for currDate := startDate; currDate.Before(endDate) || currDate.Equal(endDate); {
+			// 每月的最后一天
+			currDate = time.Date(currDate.Year(), currDate.Month(), 1, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 1, -1)
+			if !currDate.After(endDate) && !currDate.Equal(startDate) {
+				// 季度日期就写入,否则不写入
+				if currDate.Month() == 3 || currDate.Month() == 6 || currDate.Month() == 9 || currDate.Month() == 12 {
+					dayList = append(dayList, currDate)
+				}
+			}
+			currDate = currDate.AddDate(0, 0, 1)
+		}
+	case "半年度":
+		for currDate := startDate; currDate.Before(endDate) || currDate.Equal(endDate); {
+			// 每月的最后一天
+			currDate = time.Date(currDate.Year(), currDate.Month(), 1, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 1, -1)
+			if !currDate.After(endDate) && !currDate.Equal(startDate) {
+				// 半年度日期就写入,否则不写入
+				if currDate.Month() == 6 || currDate.Month() == 12 {
+					dayList = append(dayList, currDate)
+				}
+			}
+			currDate = currDate.AddDate(0, 0, 1)
+		}
 	case "年度":
 		for currDate := startDate; currDate.Before(endDate) || currDate.Equal(endDate); {
 			currDate = time.Date(currDate.Year()+1, 12, 31, 0, 0, 0, 0, time.Now().Location())

+ 15 - 6
utils/constants.go

@@ -92,6 +92,12 @@ const (
 	DATA_SOURCE_STOCK_PLANT                             //存量装置 ->58
 	DATA_SOURCE_CALCULATE_CORRELATION                   //滚动相关性->59
 	DATA_SOURCE_NATIONAL_STATISTICS                     //国家统计局->60
+	DATA_SOURCE_CALCULATE_LJZZJ                         //累计值转季 -> 61
+	DATA_SOURCE_CALCULATE_LJZ                           //累计值 -> 62
+	DATA_SOURCE_CALCULATE_LJZNCZJ                       //累计值(年初至今) -> 63
+	DATA_SOURCE_PREDICT_CALCULATE_LJZZJ                 //预测指标 - 累计值转季->64
+	DATA_SOURCE_PREDICT_CALCULATE_LJZ                   //预测指标 - 累计值 -> 65
+	DATA_SOURCE_PREDICT_CALCULATE_LJZNCZJ               //预测指标 - 累计值(年初至今) -> 66
 )
 
 // 数据刷新频率
@@ -135,12 +141,15 @@ var (
 
 // 图表类型
 const (
-	CHART_SOURCE_DEFAULT             = 1
-	CHART_SOURCE_FUTURE_GOOD         = 2
-	CHART_SOURCE_CORRELATION         = 3 // 相关性图表
-	CHART_SOURCE_ROLLING_CORRELATION = 4 // 滚动相关性图表
-	CHART_SOURCE_FUTURE_GOOD_PROFIT  = 5 // 商品利润曲线
-	CHART_SOURCE_LINE_EQUATION       = 6 // 拟合方程图表
+	CHART_SOURCE_DEFAULT                         = 1
+	CHART_SOURCE_FUTURE_GOOD                     = 2
+	CHART_SOURCE_CORRELATION                     = 3 // 相关性图表
+	CHART_SOURCE_ROLLING_CORRELATION             = 4 // 滚动相关性图表
+	CHART_SOURCE_FUTURE_GOOD_PROFIT              = 5 // 商品利润曲线
+	CHART_SOURCE_LINE_EQUATION                   = 6 // 拟合方程图表
+	CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION = 7 // 统计特征-标准差图表
+	CHART_SOURCE_LINE_FEATURE_PERCENTILE         = 8 // 统计特征-百分位图表
+	CHART_SOURCE_LINE_FEATURE_FREQUENCY          = 9 // 统计特征-频率分布图表
 )
 
 // 图表样式类型