|
@@ -359,7 +359,11 @@ func (obj CalculateRangeAnalysis) refresh(to *gorm.DB, edbInfoId, source, subSou
|
|
|
|
|
|
// GetAutoCalculateDateDataList 获取当前时间相关的区间作为计算依据
|
|
|
func GetAutoCalculateDateDataList(currentDate string, dataList []*EdbInfoSearchData, req RangeAnalysisCalculateFormula) (newDataList []*EdbInfoSearchData, err error) {
|
|
|
- currentDateTime, _ := time.ParseInLocation(utils.FormatDate, currentDate, time.Local)
|
|
|
+ currentDateTime, err := time.ParseInLocation(utils.FormatDate, currentDate, time.Local)
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("获取当前时间失败:%s", err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
switch req.DateRangeType {
|
|
|
case 0:
|
|
|
// 智能划分得到一个开始日期,和结束日期
|
|
@@ -714,8 +718,16 @@ func HandleRangeAnalysisDataByCalculateType(originList []*ChartRangeAnalysisDate
|
|
|
// GetRangeAnalysisChartDataByEdbInfo 区间计算
|
|
|
func GetRangeAnalysisChartDataByEdbInfo(fromEdbInfo *EdbInfo, calculateFormula RangeAnalysisCalculateFormula) (newDataList []*EdbInfoSearchData, err error) {
|
|
|
// 指标的开始日期和结束日期
|
|
|
- edbStartDateTime, _ := time.ParseInLocation(utils.FormatDate, fromEdbInfo.StartDate, time.Local)
|
|
|
- edbEndDateTime, _ := time.ParseInLocation(utils.FormatDate, fromEdbInfo.EndDate, time.Local)
|
|
|
+ edbStartDateTime, err := time.ParseInLocation(utils.FormatDate, fromEdbInfo.StartDate, time.Local)
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("指标开始日期解析失败:%s", err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ edbEndDateTime, err := time.ParseInLocation(utils.FormatDate, fromEdbInfo.EndDate, time.Local)
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("指标结束日期解析失败:%s", err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
edbEndDate := edbEndDateTime.Format(utils.FormatDate)
|
|
|
|
|
|
// 获取时间基准指标在时间区间内的值
|