package data import ( "fmt" "hongze/hongze_chart_lib/models/data_manage" "hongze/hongze_chart_lib/utils" "sort" "strconv" "time" ) func ChartInfoRefresh(chartInfoId int) (err error) { var errmsg string defer func() { if err != nil { go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "ChartInfoRefresh:"+errmsg, utils.EmailSendToUsers) fmt.Println("ChartInfoRefresh Err:" + errmsg) } }() baseEdbInfoArr, calculateInfoArr, err := data_manage.GetChartInfoRefreshData(chartInfoId) if err != nil { errmsg = "获取需要刷新的指标失败:Err:" + err.Error() return } var startDate string newBaseEdbInfoArr := make([]*data_manage.EdbInfo, 0) baseMap := make(map[int]*data_manage.EdbInfo) for _, bv := range baseEdbInfoArr { if _, ok := baseMap[bv.EdbInfoId]; !ok { newBaseEdbInfoArr = append(newBaseEdbInfoArr, bv) } baseMap[bv.EdbInfoId] = bv } fmt.Println("calculateInfoArr:", len(calculateInfoArr)) newCalculateInfoArr := make([]*data_manage.EdbInfo, 0) calculateMap := make(map[int]*data_manage.EdbInfo) var calculateArr []int for _, bv := range calculateInfoArr { if _, ok := calculateMap[bv.EdbInfoId]; !ok { newCalculateInfoArr = append(newCalculateInfoArr, bv) calculateArr = append(calculateArr, bv.EdbInfoId) } calculateMap[bv.EdbInfoId] = bv } sort.Ints(calculateArr) for _, bv := range newBaseEdbInfoArr { source := bv.Source edbInfoId := bv.EdbInfoId edbCode := bv.EdbCode startDate = bv.StartDate sTime, err := time.Parse(utils.FormatDate, bv.EndDate) if err != nil { return err } startDate = sTime.Format(utils.FormatDate) if source == utils.DATA_SOURCE_THS { endDate := time.Now().AddDate(utils.DATA_END_DATE_LIMIT, 0, 0).Format(utils.FormatDate) err = RefreshEdbDataByThs(edbInfoId, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByThs Err:" + err.Error() } } else if source == utils.DATA_SOURCE_WIND { endDate := time.Now().Format(utils.FormatDate) err = RefreshEdbDataByWind(edbInfoId, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByWind Err:" + err.Error() } } else if source == utils.DATA_SOURCE_PB { startDate := sTime.Format(utils.FormatDateUnSpace) endDate := time.Now().AddDate(utils.DATA_END_DATE_LIMIT, 0, 0).Format(utils.FormatDateUnSpace) err = RefreshEdbDataByPb(edbInfoId, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByPb Err:" + err.Error() } } else if source == utils.DATA_SOURCE_MANUAL { endDate := time.Now().AddDate(utils.DATA_END_DATE_LIMIT, 0, 0).Format(utils.FormatDate) err = data_manage.RefreshEdbDataByManual(edbInfoId, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByManual Err:" + err.Error() } } else if source == utils.DATA_SOURCE_LZ { endDate := time.Now().AddDate(utils.DATA_END_DATE_LIMIT, 0, 0).Format(utils.FormatDate) err = data_manage.RefreshEdbDataByLz(edbInfoId, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByLz Err:" + err.Error() } } else if source == utils.DATA_SOURCE_YS { endDate := time.Now().AddDate(utils.DATA_END_DATE_LIMIT, 0, 0).Format(utils.FormatDate) err = data_manage.RefreshAllEdbDataByYs(edbInfoId, source, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByYs Err:" + err.Error() } } else if source == utils.DATA_SOURCE_GL { endDate := time.Now().AddDate(utils.DATA_END_DATE_LIMIT, 0, 0).Format(utils.FormatDate) err = data_manage.RefreshEdbDataByGl(edbInfoId, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByGl Err:" + err.Error() } }else if source == utils.DATA_SOURCE_LT { endDate := time.Now().Format(utils.FormatDate) err = data_manage.RefreshAllEdbDataByLt(edbInfoId, source, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshAllEdbDataByLT Err:" + err.Error() } } maxAndMinItem, err := data_manage.GetEdbInfoMaxAndMinInfo(source, edbCode) if err != nil { return err } if maxAndMinItem != nil { err = data_manage.ModifyEdbInfoMaxAndMinInfo(edbInfoId, maxAndMinItem) if err != nil { return err } } } for _, v := range calculateArr { edbInfo := calculateMap[v] if edbInfo == nil { return err } edbInfoId := edbInfo.EdbInfoId source := edbInfo.Source edbCode := edbInfo.EdbCode fmt.Println("source:", source) fmt.Println("edbInfoId:", edbInfoId) if source == utils.DATA_SOURCE_CALCULATE { //指标运算 startDate = edbInfo.StartDate sTime, err := time.Parse(utils.FormatDate, edbInfo.EndDate) if err != nil { return err } startDate = sTime.Format(utils.FormatDate) var edbInfoIdBytes []string calculateMap, err := data_manage.GetEdbInfoCalculateDetail(edbInfoId, edbInfo.Source) if err != nil { errmsg = "GetEdbInfoCalculateDetail Err:" + err.Error() return err } var formulaStr string edbInfoList := make([]*data_manage.EdbInfo, 0) for _, v := range calculateMap { formulaStr += v.FromTag + "," edbInfoIdBytes = append(edbInfoIdBytes, v.FromTag) edbInfo, _ := data_manage.GetEdbInfoById(v.FromEdbInfoId) edbInfoList = append(edbInfoList, edbInfo) } fmt.Println("start RefreshCalculate") endDate := "" err = RefreshCalculate(edbInfoList, int(edbInfoId), edbInfo.EdbCode, edbInfo.CalculateFormula, startDate, endDate, edbInfoIdBytes) if err != nil { errmsg = "RefreshCalculate Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_LJZZY { //刷新累计值转月值 calculateLjzzy, err := data_manage.GetEdbInfoCalculateLjzzyDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateLjzzyDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateLjzzy.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } year := time.Now().Year() startDate = strconv.Itoa(year) + "-01" + "-01" endDate := "" err = data_manage.RefreshCalculateLjzzy(edbInfoId, fromEdbInfo, calculateLjzzy.EdbCode, startDate, endDate) if err != nil { errmsg = "RefreshCalculateLjzzy Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_TBZ { //刷新同比值 calculateTbz, err := data_manage.GetEdbInfoCalculateTbzDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateTbzDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateTbz.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } startDate = time.Now().AddDate(-1, -2, 0).Format(utils.FormatDate) endDate := "" // time.Now().Format(utils.FormatDate) err = data_manage.RefreshCalculateTbz(edbInfoId, fromEdbInfo, calculateTbz.EdbCode, startDate, endDate) if err != nil { errmsg = "RefreshCalculateTbz Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_TCZ { //同差值 calculateTcz, err := data_manage.GetEdbInfoCalculateTczDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateTczDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateTcz.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } startDate = time.Now().AddDate(-1, -2, 0).Format(utils.FormatDate) endDate := "" //time.Now().Format(utils.FormatDate) err = data_manage.RefreshCalculateTcz(edbInfoId, fromEdbInfo, calculateTcz.EdbCode, startDate, endDate) if err != nil { errmsg = "RefreshCalculateTcz Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_NSZYDPJJS { //N数值移动平均计算 fmt.Println("刷新计算指标:", edbInfoId) calculateNszydpjjs, err := data_manage.GetEdbInfoCalculateNszydpjjsDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateNszydpjjsDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateNszydpjjs.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } formulaInt, _ := strconv.Atoi(edbInfo.CalculateFormula) err = data_manage.RefreshCalculateNszydpjjs(edbInfoId, edbInfo.Source, formulaInt, fromEdbInfo, calculateNszydpjjs.EdbCode) if err != nil { errmsg = "RefreshCalculateNszydpjjs Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_HBZ { //刷新环比 calculateTbz, err := data_manage.GetEdbInfoCalculateHbzDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateHbzDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateTbz.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } startDate = time.Now().AddDate(-1, -2, 0).Format(utils.FormatDate) endDate := "" //time.Now().Format(utils.FormatDate) err = data_manage.RefreshCalculateHbz(edbInfoId, edbInfo.Source, fromEdbInfo, calculateTbz.EdbCode, startDate, endDate) if err != nil { errmsg = "RefreshCalculateHbz Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_HCZ { //刷新环差值 calculateTbz, err := data_manage.GetEdbInfoCalculateHczDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateHczDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateTbz.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } startDate = time.Now().AddDate(-1, -2, 0).Format(utils.FormatDate) endDate := "" //time.Now().Format(utils.FormatDate) err = data_manage.RefreshCalculateHcz(edbInfoId, edbInfo.Source, fromEdbInfo, calculateTbz.EdbCode, startDate, endDate) if err != nil { errmsg = "RefreshCalculateHcz Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_BP { //刷新变频 calculateTbz, err := data_manage.GetEdbInfoCalculateBpDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateBpDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateTbz.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } startDate = time.Now().AddDate(-1, -2, 0).Format(utils.FormatDate) endDate := "" //time.Now().Format(utils.FormatDate) err = data_manage.RefreshCalculateBp(edbInfoId, fromEdbInfo, calculateTbz.EdbCode, startDate, endDate) if err != nil { errmsg = "RefreshCalculateBp Err:" + err.Error() return err } } maxAndMinItem, err := data_manage.GetEdbInfoMaxAndMinInfo(source, edbCode) if err != nil { return err } if maxAndMinItem != nil { err = data_manage.ModifyEdbInfoMaxAndMinInfo(edbInfoId, maxAndMinItem) if err != nil { return err } } } return err } func ChartInfoRefreshV1(chartInfoId int) (err error) { var errmsg string defer func() { if err != nil { go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "ChartInfoRefresh:"+errmsg, utils.EmailSendToUsers) fmt.Println("ChartInfoRefresh Err:" + errmsg) } }() baseEdbInfoArr, calculateInfoArr, err := data_manage.GetChartInfoRefreshData(chartInfoId) if err != nil { errmsg = "获取需要刷新的指标失败:Err:" + err.Error() return } var startDate string newBaseEdbInfoArr := make([]*data_manage.EdbInfo, 0) baseMap := make(map[int]*data_manage.EdbInfo) for _, bv := range baseEdbInfoArr { if _, ok := baseMap[bv.EdbInfoId]; !ok { newBaseEdbInfoArr = append(newBaseEdbInfoArr, bv) } baseMap[bv.EdbInfoId] = bv } fmt.Println("calculateInfoArr:", len(calculateInfoArr)) newCalculateInfoArr := make([]*data_manage.EdbInfo, 0) calculateMap := make(map[int]*data_manage.EdbInfo) var calculateArr []int for _, bv := range calculateInfoArr { if _, ok := calculateMap[bv.EdbInfoId]; !ok { newCalculateInfoArr = append(newCalculateInfoArr, bv) calculateArr = append(calculateArr, bv.EdbInfoId) } calculateMap[bv.EdbInfoId] = bv } sort.Ints(calculateArr) for _, bv := range newBaseEdbInfoArr { source := bv.Source edbInfoId := bv.EdbInfoId edbCode := bv.EdbCode startDate = bv.StartDate sTime, err := time.Parse(utils.FormatDate, bv.EndDate) if err != nil { return err } startDate = sTime.Format(utils.FormatDate) if source == utils.DATA_SOURCE_THS { endDate := time.Now().AddDate(utils.DATA_END_DATE_LIMIT, 0, 0).Format(utils.FormatDate) err = RefreshEdbDataByThs(edbInfoId, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByThs Err:" + err.Error() } } else if source == utils.DATA_SOURCE_WIND { endDate := time.Now().Format(utils.FormatDate) err = RefreshEdbDataByWind(edbInfoId, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByWind Err:" + err.Error() } } else if source == utils.DATA_SOURCE_PB { startDate := sTime.Format(utils.FormatDateUnSpace) endDate := time.Now().AddDate(utils.DATA_END_DATE_LIMIT, 0, 0).Format(utils.FormatDateUnSpace) err = RefreshEdbDataByPb(edbInfoId, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByPb Err:" + err.Error() } } else if source == utils.DATA_SOURCE_MANUAL { err = data_manage.RefreshAllEdbDataByManual(edbInfoId,bv.Source, edbCode) if err != nil { errmsg = "RefreshEdbDataByManual Err:" + err.Error() } } else if source == utils.DATA_SOURCE_LZ { endDate := time.Now().AddDate(utils.DATA_END_DATE_LIMIT, 0, 0).Format(utils.FormatDate) err = data_manage.RefreshEdbDataByLz(edbInfoId, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByLz Err:" + err.Error() } } else if source == utils.DATA_SOURCE_YS { endDate := time.Now().AddDate(utils.DATA_END_DATE_LIMIT, 0, 0).Format(utils.FormatDate) err = data_manage.RefreshAllEdbDataByYs(edbInfoId, source, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByYs Err:" + err.Error() } } else if source == utils.DATA_SOURCE_GL { endDate := time.Now().AddDate(utils.DATA_END_DATE_LIMIT, 0, 0).Format(utils.FormatDate) err = data_manage.RefreshEdbDataByGl(edbInfoId, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshEdbDataByGl Err:" + err.Error() } }else if source == utils.DATA_SOURCE_LT { endDate := time.Now().Format(utils.FormatDate) err = data_manage.RefreshAllEdbDataByLt(edbInfoId, source, edbCode, startDate, endDate) if err != nil { errmsg = "RefreshAllEdbDataByLT Err:" + err.Error() } } maxAndMinItem, err := data_manage.GetEdbInfoMaxAndMinInfo(source, edbCode) if err != nil { return err } if maxAndMinItem != nil { err = data_manage.ModifyEdbInfoMaxAndMinInfo(edbInfoId, maxAndMinItem) if err != nil { return err } } } endDate := "" //计算指标不限制日期 //刷新相关计算指标 for _, v := range calculateArr { edbInfo := calculateMap[v] if edbInfo == nil { return err } edbInfoId := edbInfo.EdbInfoId source := edbInfo.Source edbCode := edbInfo.EdbCode if source == utils.DATA_SOURCE_CALCULATE { startDate = edbInfo.StartDate sTime, err := time.Parse(utils.FormatDate, edbInfo.EndDate) if err != nil { return err } startDate = sTime.Format(utils.FormatDate) var edbInfoIdBytes []string calculateMap, err := data_manage.GetEdbInfoCalculateDetail(edbInfoId, edbInfo.Source) if err != nil { errmsg = "GetEdbInfoCalculateDetail Err:" + err.Error() return err } var formulaStr string edbInfoList := make([]*data_manage.EdbInfo, 0) for _, v := range calculateMap { formulaStr += v.FromTag + "," edbInfoIdBytes = append(edbInfoIdBytes, v.FromTag) edbInfo, _ := data_manage.GetEdbInfoById(v.FromEdbInfoId) edbInfoList = append(edbInfoList, edbInfo) } err = data_manage.RefreshAllCalculate(edbInfoList, int(edbInfoId), source, edbInfo.EdbCode, edbInfo.CalculateFormula, startDate, endDate, edbInfoIdBytes) if err != nil { errmsg = "RefreshCalculate Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_LJZZY { //刷新累计值转月值 calculateLjzzy, err := data_manage.GetEdbInfoCalculateLjzzyDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateLjzzyDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateLjzzy.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } startDate = edbInfo.StartDate endDate = time.Now().Format(utils.FormatDate) err = data_manage.RefreshAllCalculateLjzzy(edbInfoId, source, fromEdbInfo, calculateLjzzy.EdbCode, startDate, endDate) if err != nil { errmsg = "RefreshAllCalculateLjzzy Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_TBZ { //刷新同比值 calculateTbz, err := data_manage.GetEdbInfoCalculateTbzDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateTbzDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateTbz.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } startDate = edbInfo.StartDate endDate = time.Now().Format(utils.FormatDate) err = data_manage.RefreshAllCalculateTbz(edbInfoId, source, fromEdbInfo, calculateTbz.EdbCode, startDate, endDate) if err != nil { errmsg = "RefreshAllCalculateTbz Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_TCZ { //同差值 calculateTcz, err := data_manage.GetEdbInfoCalculateTczDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateTczDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateTcz.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } startDate = edbInfo.StartDate endDate = time.Now().Format(utils.FormatDate) err = data_manage.RefreshAllCalculateTcz(edbInfoId, source, fromEdbInfo, calculateTcz.EdbCode, startDate, endDate) if err != nil { errmsg = "RefreshCalculateTcz Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_NSZYDPJJS { //N数值移动平均计算 calculateNszydpjjs, err := data_manage.GetEdbInfoCalculateNszydpjjsDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateNszydpjjsDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateNszydpjjs.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } formulaInt, _ := strconv.Atoi(edbInfo.CalculateFormula) startDate = edbInfo.StartDate err = data_manage.RefreshAllCalculateNszydpjjs(edbInfoId, edbInfo.Source, formulaInt, fromEdbInfo, calculateNszydpjjs.EdbCode, startDate) if err != nil { errmsg = "RefreshCalculateNszydpjjs Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_HBZ { //刷新环比值 calculateTbz, err := data_manage.GetEdbInfoCalculateHbzDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateHbzDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateTbz.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } startDate = edbInfo.StartDate endDate = time.Now().Format(utils.FormatDate) formulaInt, _ := strconv.Atoi(edbInfo.CalculateFormula) err = data_manage.RefreshAllCalculateHbz(edbInfoId, source, fromEdbInfo, calculateTbz.EdbCode, startDate, endDate, formulaInt) if err != nil { errmsg = "RefreshAllCalculateHbz Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_HCZ { //刷新环差值 calculateTbz, err := data_manage.GetEdbInfoCalculateHczDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateHczDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateTbz.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } startDate = edbInfo.StartDate endDate = time.Now().Format(utils.FormatDate) formulaInt, _ := strconv.Atoi(edbInfo.CalculateFormula) err = data_manage.RefreshAllCalculateHcz(edbInfoId, source, fromEdbInfo, calculateTbz.EdbCode, startDate, endDate, formulaInt) if err != nil { errmsg = "RefreshAllCalculateHcz Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_BP { //刷新变频 calculateTbz, err := data_manage.GetEdbInfoCalculateBpDetail(edbInfoId) if err != nil { errmsg = "GetEdbInfoCalculateTbzDetail Err:" + err.Error() return err } fromEdbInfo, err := data_manage.GetEdbInfoById(calculateTbz.FromEdbInfoId) if err != nil { errmsg = "GetEdbInfoById Err:" + err.Error() return err } startDate = edbInfo.StartDate endDate = time.Now().Format(utils.FormatDate) err = data_manage.RefreshAllCalculateBp(edbInfoId, source, fromEdbInfo, calculateTbz.EdbCode, startDate, endDate) if err != nil { errmsg = "RefreshAllCalculateBp Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_ZJPJ { //刷新直接拼接数据 err = data_manage.RefreshAllCalculateZjpj(edbInfo) if err != nil { errmsg = "RefreshAllCalculateZjpj Err:" + err.Error() return err } } else if source == utils.DATA_SOURCE_CALCULATE_LJZTBPJ { //刷新累计值同比拼接数据 err = data_manage.RefreshAllCalculateLjztbpj(edbInfo) if err != nil { errmsg = "RefreshAllCalculateLjztbpj Err:" + err.Error() return err } } maxAndMinItem, err := data_manage.GetEdbInfoMaxAndMinInfo(source, edbCode) if err != nil { return err } if maxAndMinItem != nil { err = data_manage.ModifyEdbInfoMaxAndMinInfo(edbInfoId, maxAndMinItem) if err != nil { return err } } fmt.Println("end calculateArr:", v, time.Now()) } return err }