Merge branch 'main' of http://119.6.225.4:3000/lhx/project
This commit is contained in:
@@ -449,8 +449,8 @@ 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
|
# 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()
|
||||||
|
|
||||||
# 调用服务层获取数据
|
# 调用服务层获取数据
|
||||||
account_id = request.account_id
|
account_id = request.account_id
|
||||||
@@ -472,6 +472,31 @@ def get_today_data(request: TodayDataRequest, db: Session = Depends(get_db)):
|
|||||||
total=0,
|
total=0,
|
||||||
data={}
|
data={}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@router.post("/refresh_today_data", response_model=DataResponse)
|
||||||
|
def refresh_today_data(request: TodayDataRequest, db: Session = Depends(get_db)):
|
||||||
|
"""接口:通过POST请求触发调度器中的 scheduled_get_max_nyid_by_point_id 定时任务"""
|
||||||
|
try:
|
||||||
|
from ..utils.scheduler import scheduled_get_max_nyid_by_point_id
|
||||||
|
scheduled_get_max_nyid_by_point_id()
|
||||||
|
account_id = request.account_id
|
||||||
|
daily_service = DailyDataService()
|
||||||
|
daily_data = daily_service.get_daily_data_by_account(db, account_id=account_id)
|
||||||
|
|
||||||
|
return DataResponse(
|
||||||
|
code=ResponseCode.SUCCESS,
|
||||||
|
message="定时时任务触发执行成功!任务已开始处理(具体结果查看系统日志)",
|
||||||
|
total=len(daily_data), # 根据实际数据是否存在调整total
|
||||||
|
data=daily_data
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"接口触发定时任务失败:{str(e)}", exc_info=True)
|
||||||
|
return DataResponse(
|
||||||
|
code=ResponseCode.QUERY_FAILED,
|
||||||
|
message=f"定时任务触发失败:{str(e)}",
|
||||||
|
total=len(daily_data),
|
||||||
|
data={}
|
||||||
|
)
|
||||||
# account_id获取所有断面数据
|
# account_id获取所有断面数据
|
||||||
@router.post("/get_all_section_by_account", response_model=DataResponse)
|
@router.post("/get_all_section_by_account", response_model=DataResponse)
|
||||||
def get_all_section_by_account(request: SectionByAccountRequest, db: Session = Depends(get_db)):
|
def get_all_section_by_account(request: SectionByAccountRequest, db: Session = Depends(get_db)):
|
||||||
|
|||||||
Reference in New Issue
Block a user