Browse Source

定时任务刷新重复刷新过滤

kobe6258 4 ngày trước cách đây
mục cha
commit
a1921f0072
2 tập tin đã thay đổi với 5 bổ sung5 xóa
  1. 1 1
      services/data/edb_info.go
  2. 4 4
      services/edb_refresh.go

+ 1 - 1
services/data/edb_info.go

@@ -304,7 +304,7 @@ func RefreshDataFromCalculateAll() (err error) {
 			continue
 		}
 		for _, mapping := range mappings {
-			if mapping.FromEdbInfoType == 0 && mapping.FromEdbInfoId > 0 && mapping.NoUpdate == 1 {
+			if mapping.FromEdbInfoType == 0 && mapping.FromEdbType == 1 && mapping.FromEdbInfoId > 0 && mapping.NoUpdate == 1 {
 				utils.FileLog.Info("基础指标停用,基础指标ID:" + mapping.FromEdbCode + ",停用当前计算指标,CODE:" + v.EdbCode)
 				stopErr := data_manage.StopRefreshCalculateEdbIndex(v.EdbInfoId)
 				if stopErr != nil {

+ 4 - 4
services/edb_refresh.go

@@ -735,7 +735,7 @@ func DisableEdbRefresh(cont context.Context) (err error) {
 			utils.Rc.Delete(cacheKey)
 		}
 		if err != nil {
-			tips := "DisableEdbRefresh-钢联化工和wind指标设置成禁止刷新失败, ErrMsg:\n" + err.Error()
+			tips := "DisableEdbRefresh-钢联化工、wind、彭博、彭博财务、同花顺指标设置成禁止刷新失败, ErrMsg:\n" + err.Error()
 			utils.FileLog.Info(tips)
 			go alarm_msg.SendAlarmMsg(tips, 3)
 		}
@@ -844,12 +844,12 @@ func DisableEdbRefresh(cont context.Context) (err error) {
 	}
 
 	if rule.EdbStopDays > 0 {
-		// 查询钢联和wind来源的指标
+		// 查询钢联和wind、彭博、彭博财务、同花顺来源的指标
 		edbEndDate := now.AddDate(0, 0, -rule.EdbStopDays+1).Format(utils.FormatDate)
 
-		condition := ` AND no_update=0 AND source in (?,?) AND ((create_time < ? and set_update_time is null) or set_update_time < ? )`
+		condition := ` AND no_update=0 AND source in (?,?,?,?,?) AND ((create_time < ? and set_update_time is null) or set_update_time < ? )`
 		var pars []interface{}
-		pars = append(pars, utils.DATA_SOURCE_MYSTEEL_CHEMICAL, utils.DATA_SOURCE_WIND, edbEndDate, edbEndDate)
+		pars = append(pars, utils.DATA_SOURCE_MYSTEEL_CHEMICAL, utils.DATA_SOURCE_WIND, utils.DATA_SOURCE_PB_FINANCE, utils.DATA_SOURCE_PB, utils.DATA_SOURCE_THS, edbEndDate, edbEndDate)
 		// 查询钢联化工指标和wind指标 分批查询,先查总数,再查列表
 		totalCount, e := data_manage.GetEdbInfoCountByCondition(condition, pars)
 		if e != nil {