1.设置全局更新变量
2.把过期信息一并抓取
This commit is contained in:
@@ -394,6 +394,7 @@ def get_today_data(request: TodayDataRequest, db: Session = Depends(get_db)):
|
|||||||
# account_id = request.account_id # 根据根据实际需求决定是否需要
|
# account_id = request.account_id # 根据根据实际需求决定是否需要
|
||||||
|
|
||||||
# 触发定时任务(如果需要传入参数,可在这里添加)
|
# 触发定时任务(如果需要传入参数,可在这里添加)
|
||||||
|
# from ..utils.scheduler import scheduled_get_max_nyid_by_point_id
|
||||||
# scheduled_get_max_nyid_by_point_id()
|
# scheduled_get_max_nyid_by_point_id()
|
||||||
|
|
||||||
# 调用服务层获取数据
|
# 调用服务层获取数据
|
||||||
|
|||||||
@@ -13,3 +13,4 @@ class DailyData(Base):
|
|||||||
section_id = Column(String(255), nullable=False, comment="所属断面id")
|
section_id = Column(String(255), nullable=False, comment="所属断面id")
|
||||||
remaining = Column(Integer, nullable=False, comment="剩余天数")
|
remaining = Column(Integer, nullable=False, comment="剩余天数")
|
||||||
user_id = Column(Integer, default=1, nullable=False, comment="用户id")
|
user_id = Column(Integer, default=1, nullable=False, comment="用户id")
|
||||||
|
is_all = Column(Integer, default=1, nullable=False, comment="是否全量数据")
|
||||||
|
|||||||
@@ -238,6 +238,7 @@ def scheduled_get_max_nyid_by_point_id():
|
|||||||
daily_data = monitor.get_due_data(result)
|
daily_data = monitor.get_due_data(result)
|
||||||
data = daily_data['data']
|
data = daily_data['data']
|
||||||
error_data = daily_data['error_data']
|
error_data = daily_data['error_data']
|
||||||
|
|
||||||
winters = daily_data['winter']
|
winters = daily_data['winter']
|
||||||
logger.info(f"首次获取数据完成,共{len(result)}条记录")
|
logger.info(f"首次获取数据完成,共{len(result)}条记录")
|
||||||
|
|
||||||
@@ -254,9 +255,9 @@ def scheduled_get_max_nyid_by_point_id():
|
|||||||
winters = w_list['winter']
|
winters = w_list['winter']
|
||||||
data.extend(w_list['data'])
|
data.extend(w_list['data'])
|
||||||
# 过期数据一并处理
|
# 过期数据一并处理
|
||||||
data.extend(w_list['error_data'])
|
# data.extend(w_list['error_data'])
|
||||||
# error_data.extend(w_list['error_data'])
|
error_data.extend(w_list['error_data'])
|
||||||
|
data.extend(error_data)
|
||||||
# 4. 初始化服务实例
|
# 4. 初始化服务实例
|
||||||
level_service = LevelDataService()
|
level_service = LevelDataService()
|
||||||
checkpoint_db = CheckpointService()
|
checkpoint_db = CheckpointService()
|
||||||
@@ -299,7 +300,7 @@ def scheduled_get_max_nyid_by_point_id():
|
|||||||
'linecode': d['level_data']['linecode'],
|
'linecode': d['level_data']['linecode'],
|
||||||
'account_id': d['account_data']['account_id'],
|
'account_id': d['account_data']['account_id'],
|
||||||
'section_id': d['section_data']['section_id'],
|
'section_id': d['section_data']['section_id'],
|
||||||
'remaining': d['remaining'],
|
'remaining': (0-int(d['overdue'])) if 'overdue' in d else d['remaining'],
|
||||||
}
|
}
|
||||||
daily_create_data.append(tem)
|
daily_create_data.append(tem)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user