|
@@ -253,21 +253,21 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
|
source := v.Source
|
|
|
fmt.Println(v.EdbInfoId, v.EdbCode, v.EdbName, v.SourceName, source)
|
|
|
if source == utils.DATA_SOURCE_CALCULATE {
|
|
|
- startDate := ""
|
|
|
- if v.Frequency == "日度" {
|
|
|
- startDate = v.EndDate.AddDate(0, 0, -utils.DATA_REFRESH).Format(utils.FormatDate)
|
|
|
- } else if v.Frequency == "周度" {
|
|
|
- startDate = v.EndDate.AddDate(0, 0, -(utils.DATA_REFRESH * 7)).Format(utils.FormatDate)
|
|
|
- } else if v.Frequency == "月度" {
|
|
|
- startDate = v.EndDate.AddDate(0, -utils.DATA_REFRESH, 0).Format(utils.FormatDate)
|
|
|
- } else if v.Frequency == "季度" {
|
|
|
- startDate = v.EndDate.AddDate(0, -utils.DATA_REFRESH*3, 0).Format(utils.FormatDate)
|
|
|
- } else if v.Frequency == "年度" {
|
|
|
- startDate = v.EndDate.AddDate(-utils.DATA_REFRESH, 0, 0).Format(utils.FormatDate)
|
|
|
- } else {
|
|
|
- startDate = v.EndDate.AddDate(0, 0, -utils.DATA_REFRESH).Format(utils.FormatDate)
|
|
|
- }
|
|
|
- endDate := time.Now().Format(utils.FormatDate)
|
|
|
+ //startDate := ""
|
|
|
+ //if v.Frequency == "日度" {
|
|
|
+ // startDate = v.EndDate.AddDate(0, 0, -utils.DATA_REFRESH).Format(utils.FormatDate)
|
|
|
+ //} else if v.Frequency == "周度" {
|
|
|
+ // startDate = v.EndDate.AddDate(0, 0, -(utils.DATA_REFRESH * 7)).Format(utils.FormatDate)
|
|
|
+ //} else if v.Frequency == "月度" {
|
|
|
+ // startDate = v.EndDate.AddDate(0, -utils.DATA_REFRESH, 0).Format(utils.FormatDate)
|
|
|
+ //} else if v.Frequency == "季度" {
|
|
|
+ // startDate = v.EndDate.AddDate(0, -utils.DATA_REFRESH*3, 0).Format(utils.FormatDate)
|
|
|
+ //} else if v.Frequency == "年度" {
|
|
|
+ // startDate = v.EndDate.AddDate(-utils.DATA_REFRESH, 0, 0).Format(utils.FormatDate)
|
|
|
+ //} else {
|
|
|
+ // startDate = v.EndDate.AddDate(0, 0, -utils.DATA_REFRESH).Format(utils.FormatDate)
|
|
|
+ //}
|
|
|
+ //endDate := time.Now().Format(utils.FormatDate)
|
|
|
var edbInfoIdBytes []string
|
|
|
calculateMap, err := data_manage.GetEdbInfoCalculateDetail(int(v.EdbInfoId))
|
|
|
if err != nil {
|
|
@@ -281,24 +281,30 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
|
edbInfo, _ := data_manage.GetEdbInfoById(v.FromEdbInfoId)
|
|
|
edbInfoList = append(edbInfoList, edbInfo)
|
|
|
}
|
|
|
- endDate = ""
|
|
|
- err = RefreshCalculate(edbInfoList, edbInfoId, edbCode, v.CalculateFormula, startDate, endDate, edbInfoIdBytes)
|
|
|
+ //endDate = ""
|
|
|
+ err = RefreshCalculate(edbInfoList, edbInfoId, edbCode, v.CalculateFormula, edbInfoIdBytes)
|
|
|
if err != nil {
|
|
|
return errors.New("RefreshCalculate Err:" + err.Error())
|
|
|
}
|
|
|
} else if source == utils.DATA_SOURCE_CALCULATE_LJZZY {
|
|
|
calculateLjzzy, err := data_manage.GetEdbInfoCalculateLjzzyDetail(edbInfoId)
|
|
|
if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ continue
|
|
|
+ }
|
|
|
return errors.New("GetEdbInfoCalculateLjzzyDetail Err:" + err.Error())
|
|
|
}
|
|
|
fromEdbInfo, err := data_manage.GetEdbInfoById(calculateLjzzy.FromEdbInfoId)
|
|
|
if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ continue
|
|
|
+ }
|
|
|
return errors.New("GetEdbInfoById Err:" + err.Error())
|
|
|
}
|
|
|
- year := time.Now().Year() - 1
|
|
|
- startDate := strconv.Itoa(year) + "-01" + "-01"
|
|
|
- endDate := "" //time.Now().Format(utils.FormatDate)
|
|
|
- err = data_manage.RefreshCalculateLjzzy(edbInfoId, fromEdbInfo, edbCode, startDate, endDate)
|
|
|
+ //year := time.Now().Year() - 1
|
|
|
+ //startDate := strconv.Itoa(year) + "-01" + "-01"
|
|
|
+ //endDate := "" //time.Now().Format(utils.FormatDate)
|
|
|
+ err = data_manage.RefreshCalculateLjzzy(edbInfoId, fromEdbInfo, edbCode)
|
|
|
if err != nil {
|
|
|
return errors.New("RefreshCalculateLjzzy Err:" + err.Error())
|
|
|
}
|
|
@@ -309,11 +315,14 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
|
}
|
|
|
fromEdbInfo, err := data_manage.GetEdbInfoById(calculateTbz.FromEdbInfoId)
|
|
|
if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ continue
|
|
|
+ }
|
|
|
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.RefreshCalculateTbz(edbInfoId, fromEdbInfo, calculateTbz.EdbCode, startDate, endDate)
|
|
|
+ //startDate := time.Now().AddDate(-2, -2, 0).Format(utils.FormatDate)
|
|
|
+ //endDate := "" //time.Now().Format(utils.FormatDate)
|
|
|
+ err = data_manage.RefreshCalculateTbz(edbInfoId, fromEdbInfo, calculateTbz.EdbCode)
|
|
|
if err != nil {
|
|
|
return errors.New("RefreshCalculateTbz Err:" + err.Error())
|
|
|
}
|
|
@@ -324,11 +333,14 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
|
}
|
|
|
fromEdbInfo, err := data_manage.GetEdbInfoById(calculateTcz.FromEdbInfoId)
|
|
|
if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ continue
|
|
|
+ }
|
|
|
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.RefreshCalculateTcz(edbInfoId, fromEdbInfo, calculateTcz.EdbCode, startDate, endDate)
|
|
|
+ //startDate := time.Now().AddDate(-2, -2, 0).Format(utils.FormatDate)
|
|
|
+ //endDate := "" //time.Now().Format(utils.FormatDate)
|
|
|
+ err = data_manage.RefreshCalculateTcz(edbInfoId, fromEdbInfo, calculateTcz.EdbCode)
|
|
|
if err != nil {
|
|
|
return errors.New("RefreshCalculateTcz Err:" + err.Error())
|
|
|
}
|
|
@@ -339,6 +351,9 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
|
}
|
|
|
fromEdbInfo, err := data_manage.GetEdbInfoById(calculateNszydpjjs.FromEdbInfoId)
|
|
|
if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ continue
|
|
|
+ }
|
|
|
return errors.New("GetEdbInfoById Err:" + err.Error())
|
|
|
}
|
|
|
formulaInt, _ := strconv.Atoi(v.CalculateFormula)
|
|
@@ -353,6 +368,9 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
|
}
|
|
|
fromEdbInfo, err := data_manage.GetEdbInfoById(calculateHbz.FromEdbInfoId)
|
|
|
if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ continue
|
|
|
+ }
|
|
|
return errors.New("GetEdbInfoById Err:" + err.Error())
|
|
|
}
|
|
|
//startDate := time.Now().AddDate(-2, -2, 0).Format(utils.FormatDate)
|
|
@@ -369,11 +387,14 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
|
}
|
|
|
fromEdbInfo, err := data_manage.GetEdbInfoById(calculateHcz.FromEdbInfoId)
|
|
|
if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ continue
|
|
|
+ }
|
|
|
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)
|
|
|
+ //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)
|
|
|
if err != nil {
|
|
|
return errors.New("RefreshCalculateTbz Err:" + err.Error())
|
|
|
}
|
|
@@ -385,11 +406,14 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
|
if calculateBp != nil {
|
|
|
fromEdbInfo, err := data_manage.GetEdbInfoById(calculateBp.FromEdbInfoId)
|
|
|
if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ continue
|
|
|
+ }
|
|
|
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)
|
|
|
+ //startDate := time.Now().AddDate(-2, -2, 0).Format(utils.FormatDate)
|
|
|
+ //endDate := "" //time.Now().Format(utils.FormatDate)
|
|
|
+ err = data_manage.RefreshCalculateBp(edbInfoId, fromEdbInfo, calculateBp.EdbCode)
|
|
|
if err != nil {
|
|
|
return errors.New("RefreshCalculateTbz Err:" + err.Error())
|
|
|
}
|
|
@@ -401,23 +425,40 @@ func RefreshDataFromCalculateAll() (err error) {
|
|
|
}
|
|
|
fromEdbInfo, err := data_manage.GetEdbInfoById(calculate.FromEdbInfoId)
|
|
|
if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ continue
|
|
|
+ }
|
|
|
return fmt.Errorf("GetEdbInfoById Err:" + err.Error())
|
|
|
}
|
|
|
- startDate := v.StartDate.Format(utils.FormatDate)
|
|
|
- endDate := time.Now().Format(utils.FormatDate)
|
|
|
+ //startDate := v.StartDate.Format(utils.FormatDate)
|
|
|
+ //endDate := time.Now().Format(utils.FormatDate)
|
|
|
formulaInt, _ := strconv.Atoi(calculate.CalculateFormula)
|
|
|
- err = data_manage.RefreshAllCalculateTimeShift(edbInfoId, source, formulaInt, calculate.MoveType, fromEdbInfo, calculate.EdbCode, startDate, endDate, calculate.MoveFrequency)
|
|
|
+ err = data_manage.RefreshAllCalculateTimeShift(edbInfoId, source, formulaInt, calculate.MoveType, fromEdbInfo, calculate.EdbCode, calculate.MoveFrequency)
|
|
|
if err != nil {
|
|
|
return fmt.Errorf("RefreshAllCalculateTimeShift Err:" + err.Error())
|
|
|
}
|
|
|
|
|
|
} else if source == utils.DATA_SOURCE_CALCULATE_ZJPJ { //刷新直接拼接
|
|
|
- err = data_manage.RefreshAllCalculateZjpj(v)
|
|
|
+ tmpEdbInfo, err := data_manage.GetEdbInfoById(v.EdbInfoId)
|
|
|
+ if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ return fmt.Errorf("GetEdbInfoById Err:" + err.Error())
|
|
|
+ }
|
|
|
+ err = data_manage.RefreshAllCalculateZjpj(tmpEdbInfo)
|
|
|
if err != nil {
|
|
|
return fmt.Errorf("RefreshAllCalculateZjpj Err:" + err.Error())
|
|
|
}
|
|
|
} else if source == utils.DATA_SOURCE_CALCULATE_LJZTBPJ { //刷新累计值同比拼接
|
|
|
- err = data_manage.RefreshAllCalculateLjztbpj(v)
|
|
|
+ tmpEdbInfo, err := data_manage.GetEdbInfoById(v.EdbInfoId)
|
|
|
+ if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ return fmt.Errorf("GetEdbInfoById Err:" + err.Error())
|
|
|
+ }
|
|
|
+ err = data_manage.RefreshAllCalculateLjztbpj(tmpEdbInfo)
|
|
|
if err != nil {
|
|
|
return fmt.Errorf("RefreshAllCalculateLjztbpj Err:" + err.Error())
|
|
|
}
|