1.修改get_all_section_by_account

This commit is contained in:
whm
2025-11-01 14:15:32 +08:00
parent 61be8f9243
commit 51068dc4e1
3 changed files with 5 additions and 8 deletions

View File

@@ -412,11 +412,12 @@ def get_all_section_by_account(request: SectionByAccountRequest, db: Session = D
account_id = request.account_id
section_service = SectionDataService()
result_data = section_service.get_by_account_id(db, account_id=account_id)
data_list = [item.to_dict() for item in result_data] if result_data else []
return DataResponse(
code=ResponseCode.SUCCESS,
message="查询成功",
total=len(result_data),
data=result_data
total=len(data_list),
data=data_list
)
except Exception as e:
logger.error(f"Query section data failed: {str(e)}")

View File

@@ -23,7 +23,7 @@ class SectionDataService(BaseService[SectionData]):
def get_by_account_id(self, db: Session, account_id: str) -> Optional[SectionData]:
"""根据账号ID获取断面数据"""
accounts = self.get_by_field(db, "account_id", account_id)
return accounts[0] if accounts else None
return accounts if accounts else None
def get_by_number(self, db: Session, number: str) -> List[SectionData]:
"""根据桥梁墩(台)编号获取断面数据"""
return self.get_by_field(db, "number", number)

View File

@@ -78,7 +78,7 @@ class TaskScheduler:
# 检查是否已存在每日重置任务
existing_job = self.scheduler.get_job("daily_reset_today_updated")
existing_job = self.scheduler.get_job("get_max_nyid")
# existing_job = self.scheduler.get_job("get_max_nyid")
if not existing_job:
# 添加每天午夜12点重置today_updated字段的任务
self.scheduler.add_job(
@@ -90,10 +90,6 @@ class TaskScheduler:
second=0,
name='每日重置账号更新状态'
)
self.scheduler.add_job(
scheduled_get_max_nyid_by_point_id,
id='get_max_nyid',
)
logger.info("系统定时任务:每日重置账号更新状态已添加")
except Exception as e:
logger.error(f"设置系统定时任务失败: {e}")