123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- package models
- import "eta_gn/eta_index_lib/utils"
- // BaseEdbInfoInterface 基础指标接口
- type BaseEdbInfoInterface interface {
- Add(params AddCalculateBatchParams) (edbInfo *EdbInfo, err error, errMsg string)
- Edit(params EditCalculateBatchParams) (err error, errMsg string)
- Refresh(params RefreshParams) (err error, errMsg string)
- GetSource() int
- GetSourceName() string
- GetEdbType() int
- }
- // AddCalculateBatchParams 添加的请求参
- type AddCalculateBatchParams struct {
- Req *EdbInfoCalculateBatchSaveReq
- FromEdbInfo *EdbInfo
- EdbCode string
- UniqueCode string
- SysUserId int
- SysUserRealName string
- }
- // EditCalculateBatchParams 编辑的请求参
- type EditCalculateBatchParams struct {
- Req *EdbInfoCalculateBatchEditReq
- EdbInfo *EdbInfo
- FromEdbInfo *EdbInfo
- }
- // RefreshParams 编辑的请求参
- type RefreshParams struct {
- EdbInfo *EdbInfo
- FromEdbInfo *EdbInfo
- StartDate string
- EndDate string
- }
- // GetBaseEdbInfoModel 获取普通指标的model
- func GetBaseEdbInfoModel(source int) (baseEdbInfoModel BaseEdbInfoInterface) {
- switch source {
- case utils.DATA_SOURCE_CALCULATE_LJZZJ:
- baseEdbInfoModel = Ljzzj{}
- case utils.DATA_SOURCE_CALCULATE_LJZ:
- baseEdbInfoModel = Ljz{}
- case utils.DATA_SOURCE_CALCULATE_LJZNCZJ:
- baseEdbInfoModel = LjzNczj{}
- case utils.DATA_SOURCE_CALCULATE_STANDARD_DEVIATION:
- baseEdbInfoModel = StandardDeviation{}
- case utils.DATA_SOURCE_CALCULATE_PERCENTILE:
- baseEdbInfoModel = Percentile{}
- case utils.DATA_SOURCE_CALCULATE_ZSXY:
- baseEdbInfoModel = ExponentialSmoothing{}
- case utils.DATA_SOURCE_CALCULATE_ZDYFX:
- baseEdbInfoModel = CustomAnalysis{}
- case utils.DATA_SOURCE_CALCULATE_SUM:
- baseEdbInfoModel = CalculateSum{}
- case utils.DATA_SOURCE_CALCULATE_AVG:
- baseEdbInfoModel = CalculateAvg{}
- case utils.DATA_SOURCE_CALCULATE_RANGEANLYSIS:
- baseEdbInfoModel = CalculateRangeAnalysis{}
- default:
- }
- return
- }
- // BatchSaveCalculateBatchParams 编辑的请求参
- type BatchSaveCalculateBatchParams struct {
- Req EdbInfoCalculateBatchSaveReq
- EdbInfo *EdbInfo
- FromEdbInfo *EdbInfo
- EdbCode string
- UniqueCode string
- SysUserId int
- SysUserRealName string
- Lang string
- }
- // BasePredictEdbInfoInterface 基础指标接口
- type BasePredictEdbInfoInterface interface {
- Add(params BatchSaveCalculateBatchParams) (edbInfo *EdbInfo, latestDateStr string, latestValue float64, err error, errMsg string)
- Edit(params BatchSaveCalculateBatchParams) (latestDateStr string, latestValue float64, err error, errMsg string)
- Refresh(params RefreshParams) (latestDateStr string, latestValue float64, err error, errMsg string)
- GetSourceName() string
- }
- // GetBasePredictEdbInfoModel 获取预测指标的model
- func GetBasePredictEdbInfoModel(source int) (baseEdbInfoModel BasePredictEdbInfoInterface) {
- switch source {
- case utils.DATA_SOURCE_PREDICT_CALCULATE_TBZ:
- baseEdbInfoModel = PredictTb{}
- case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZZJ:
- baseEdbInfoModel = PredictLjzzj{}
- case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZ:
- baseEdbInfoModel = PredictLjz{}
- case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZNCZJ:
- baseEdbInfoModel = PredictLjzNczj{}
- case utils.DATA_SOURCE_PREDICT_CALCULATE_STANDARD_DEVIATION:
- baseEdbInfoModel = PredictStandardDeviation{}
- case utils.DATA_SOURCE_PREDICT_CALCULATE_PERCENTILE:
- baseEdbInfoModel = PredictPercentile{}
- case utils.DATA_SOURCE_PREDICT_CALCULATE_ZSXY:
- baseEdbInfoModel = PredictExponentialSmoothing{}
- case utils.DATA_SOURCE_PREDICT_CALCULATE_RANGEANLYSIS:
- baseEdbInfoModel = PredictCalculateRangeAnalysis{}
- default:
- }
- return
- }
|