1.修改get_all_section_by_account
This commit is contained in:
@@ -412,11 +412,12 @@ def get_all_section_by_account(request: SectionByAccountRequest, db: Session = D
|
|||||||
account_id = request.account_id
|
account_id = request.account_id
|
||||||
section_service = SectionDataService()
|
section_service = SectionDataService()
|
||||||
result_data = section_service.get_by_account_id(db, account_id=account_id)
|
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(
|
return DataResponse(
|
||||||
code=ResponseCode.SUCCESS,
|
code=ResponseCode.SUCCESS,
|
||||||
message="查询成功",
|
message="查询成功",
|
||||||
total=len(result_data),
|
total=len(data_list),
|
||||||
data=result_data
|
data=data_list
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Query section data failed: {str(e)}")
|
logger.error(f"Query section data failed: {str(e)}")
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class SectionDataService(BaseService[SectionData]):
|
|||||||
def get_by_account_id(self, db: Session, account_id: str) -> Optional[SectionData]:
|
def get_by_account_id(self, db: Session, account_id: str) -> Optional[SectionData]:
|
||||||
"""根据账号ID获取断面数据"""
|
"""根据账号ID获取断面数据"""
|
||||||
accounts = self.get_by_field(db, "account_id", account_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]:
|
def get_by_number(self, db: Session, number: str) -> List[SectionData]:
|
||||||
"""根据桥梁墩(台)编号获取断面数据"""
|
"""根据桥梁墩(台)编号获取断面数据"""
|
||||||
return self.get_by_field(db, "number", number)
|
return self.get_by_field(db, "number", number)
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class TaskScheduler:
|
|||||||
# 检查是否已存在每日重置任务
|
# 检查是否已存在每日重置任务
|
||||||
|
|
||||||
existing_job = self.scheduler.get_job("daily_reset_today_updated")
|
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:
|
if not existing_job:
|
||||||
# 添加每天午夜12点重置today_updated字段的任务
|
# 添加每天午夜12点重置today_updated字段的任务
|
||||||
self.scheduler.add_job(
|
self.scheduler.add_job(
|
||||||
@@ -90,10 +90,6 @@ class TaskScheduler:
|
|||||||
second=0,
|
second=0,
|
||||||
name='每日重置账号更新状态'
|
name='每日重置账号更新状态'
|
||||||
)
|
)
|
||||||
self.scheduler.add_job(
|
|
||||||
scheduled_get_max_nyid_by_point_id,
|
|
||||||
id='get_max_nyid',
|
|
||||||
)
|
|
||||||
logger.info("系统定时任务:每日重置账号更新状态已添加")
|
logger.info("系统定时任务:每日重置账号更新状态已添加")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"设置系统定时任务失败: {e}")
|
logger.error(f"设置系统定时任务失败: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user