|
@@ -242,8 +242,9 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
for _, v := range items {
|
|
for _, v := range items {
|
|
edbInfoId := v.EdbInfoId
|
|
edbInfoId := v.EdbInfoId
|
|
edbCode := v.EdbCode
|
|
edbCode := v.EdbCode
|
|
|
|
+ source := v.Source
|
|
fmt.Println(v.EdbInfoId, v.EdbCode, v.EdbName, v.SourceName)
|
|
fmt.Println(v.EdbInfoId, v.EdbCode, v.EdbName, v.SourceName)
|
|
- if v.Source == utils.DATA_SOURCE_CALCULATE {
|
|
|
|
|
|
+ if source == utils.DATA_SOURCE_CALCULATE {
|
|
startDate := ""
|
|
startDate := ""
|
|
if v.Frequency == "日度" {
|
|
if v.Frequency == "日度" {
|
|
startDate = v.EndDate.AddDate(0, 0, -utils.DATA_REFRESH).Format(utils.FormatDate)
|
|
startDate = v.EndDate.AddDate(0, 0, -utils.DATA_REFRESH).Format(utils.FormatDate)
|
|
@@ -277,7 +278,7 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
if err != nil {
|
|
if err != nil {
|
|
return errors.New("RefreshCalculate Err:" + err.Error())
|
|
return errors.New("RefreshCalculate Err:" + err.Error())
|
|
}
|
|
}
|
|
- } else if v.Source == utils.DATA_SOURCE_CALCULATE_LJZZY {
|
|
|
|
|
|
+ } else if source == utils.DATA_SOURCE_CALCULATE_LJZZY {
|
|
calculateLjzzy, err := data_manage.GetEdbInfoCalculateLjzzyDetail(edbInfoId)
|
|
calculateLjzzy, err := data_manage.GetEdbInfoCalculateLjzzyDetail(edbInfoId)
|
|
if err != nil {
|
|
if err != nil {
|
|
return errors.New("GetEdbInfoCalculateLjzzyDetail Err:" + err.Error())
|
|
return errors.New("GetEdbInfoCalculateLjzzyDetail Err:" + err.Error())
|
|
@@ -293,7 +294,7 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
if err != nil {
|
|
if err != nil {
|
|
return errors.New("RefreshCalculateLjzzy Err:" + err.Error())
|
|
return errors.New("RefreshCalculateLjzzy Err:" + err.Error())
|
|
}
|
|
}
|
|
- } else if v.Source == utils.DATA_SOURCE_CALCULATE_TBZ {
|
|
|
|
|
|
+ } else if source == utils.DATA_SOURCE_CALCULATE_TBZ {
|
|
calculateTbz, err := data_manage.GetEdbInfoCalculateTbzDetail(edbInfoId)
|
|
calculateTbz, err := data_manage.GetEdbInfoCalculateTbzDetail(edbInfoId)
|
|
if err != nil {
|
|
if err != nil {
|
|
return errors.New("GetEdbInfoCalculateTbzDetail Err:" + err.Error())
|
|
return errors.New("GetEdbInfoCalculateTbzDetail Err:" + err.Error())
|
|
@@ -308,7 +309,7 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
if err != nil {
|
|
if err != nil {
|
|
return errors.New("RefreshCalculateTbz Err:" + err.Error())
|
|
return errors.New("RefreshCalculateTbz Err:" + err.Error())
|
|
}
|
|
}
|
|
- } else if v.Source == utils.DATA_SOURCE_CALCULATE_TCZ {
|
|
|
|
|
|
+ } else if source == utils.DATA_SOURCE_CALCULATE_TCZ {
|
|
calculateTcz, err := data_manage.GetEdbInfoCalculateTczDetail(edbInfoId)
|
|
calculateTcz, err := data_manage.GetEdbInfoCalculateTczDetail(edbInfoId)
|
|
if err != nil {
|
|
if err != nil {
|
|
return errors.New("GetEdbInfoCalculateTczDetail Err:" + err.Error())
|
|
return errors.New("GetEdbInfoCalculateTczDetail Err:" + err.Error())
|
|
@@ -323,7 +324,7 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
if err != nil {
|
|
if err != nil {
|
|
return errors.New("RefreshCalculateTcz Err:" + err.Error())
|
|
return errors.New("RefreshCalculateTcz Err:" + err.Error())
|
|
}
|
|
}
|
|
- } else if v.Source == utils.DATA_SOURCE_CALCULATE_NSZYDPJJS {
|
|
|
|
|
|
+ } else if source == utils.DATA_SOURCE_CALCULATE_NSZYDPJJS {
|
|
calculateNszydpjjs, err := data_manage.GetEdbInfoCalculateNszydpjjsDetail(edbInfoId)
|
|
calculateNszydpjjs, err := data_manage.GetEdbInfoCalculateNszydpjjsDetail(edbInfoId)
|
|
if err != nil {
|
|
if err != nil {
|
|
return errors.New("GetEdbInfoCalculateNszydpjjsDetail Err:" + err.Error())
|
|
return errors.New("GetEdbInfoCalculateNszydpjjsDetail Err:" + err.Error())
|
|
@@ -337,6 +338,51 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
if err != nil {
|
|
if err != nil {
|
|
return errors.New("RefreshCalculateNszydpjjs Err:" + err.Error())
|
|
return errors.New("RefreshCalculateNszydpjjs Err:" + err.Error())
|
|
}
|
|
}
|
|
|
|
+ } else if source == utils.DATA_SOURCE_CALCULATE_HBZ {
|
|
|
|
+ calculateHbz, err := data_manage.GetEdbInfoCalculateHbzDetail(edbInfoId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return errors.New("GetEdbInfoCalculateHbzDetail Err:" + err.Error())
|
|
|
|
+ }
|
|
|
|
+ fromEdbInfo, err := data_manage.GetEdbInfoById(calculateHbz.FromEdbInfoId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return errors.New("GetEdbInfoById Err:" + err.Error())
|
|
|
|
+ }
|
|
|
|
+ startDate := time.Now().AddDate(-2, -2, 0).Format(utils.FormatDate)
|
|
|
|
+ endDate := time.Now().Format(utils.FormatDate)
|
|
|
|
+ err = data_manage.RefreshCalculateHbz(edbInfoId, source, fromEdbInfo, calculateHbz.EdbCode, startDate, endDate)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return errors.New("RefreshCalculateTbz Err:" + err.Error())
|
|
|
|
+ }
|
|
|
|
+ } else if source == utils.DATA_SOURCE_CALCULATE_HCZ {
|
|
|
|
+ calculateHcz, err := data_manage.GetEdbInfoCalculateHczDetail(edbInfoId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return errors.New("GetEdbInfoCalculateHczDetail Err:" + err.Error())
|
|
|
|
+ }
|
|
|
|
+ fromEdbInfo, err := data_manage.GetEdbInfoById(calculateHcz.FromEdbInfoId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return errors.New("GetEdbInfoById Err:" + err.Error())
|
|
|
|
+ }
|
|
|
|
+ startDate := time.Now().AddDate(-2, -2, 0).Format(utils.FormatDate)
|
|
|
|
+ endDate := time.Now().Format(utils.FormatDate)
|
|
|
|
+ err = data_manage.RefreshCalculateHcz(edbInfoId, source, fromEdbInfo, calculateHcz.EdbCode, startDate, endDate)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return errors.New("RefreshCalculateTbz Err:" + err.Error())
|
|
|
|
+ }
|
|
|
|
+ } else if source == utils.DATA_SOURCE_CALCULATE_BP {
|
|
|
|
+ calculateBp, err := data_manage.GetEdbInfoCalculateBpDetail(edbInfoId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return errors.New("GetEdbInfoCalculateBpDetail Err:" + err.Error())
|
|
|
|
+ }
|
|
|
|
+ fromEdbInfo, err := data_manage.GetEdbInfoById(calculateBp.FromEdbInfoId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return errors.New("GetEdbInfoById Err:" + err.Error())
|
|
|
|
+ }
|
|
|
|
+ startDate := time.Now().AddDate(-2, -2, 0).Format(utils.FormatDate)
|
|
|
|
+ endDate := time.Now().Format(utils.FormatDate)
|
|
|
|
+ err = data_manage.RefreshCalculateBp(edbInfoId, fromEdbInfo, calculateBp.EdbCode, startDate, endDate)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return errors.New("RefreshCalculateTbz Err:" + err.Error())
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
msg := "刷新失败,无效的指标渠道"
|
|
msg := "刷新失败,无效的指标渠道"
|
|
err = errors.New(msg)
|
|
err = errors.New(msg)
|