1.自动更新今日需要抓取数据

2.工况接口返回
This commit is contained in:
whm
2025-10-30 11:43:20 +08:00
parent a48c2f4e8a
commit 5e9409aada
16 changed files with 652 additions and 23 deletions

View File

@@ -13,4 +13,13 @@ class Account(Base):
project_name = Column(String(1000), comment="项目名称")
created_at = Column(DateTime, server_default=func.now(), comment="创建时间")
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment="更新时间")
update_time = Column(String(1000), nullable=False, comment="更新时间跨度")
update_time = Column(String(1000), nullable=False, comment="更新时间跨度")
# 模型转字典
def to_dict(self):
"""将模型实例转换为字典,支持 Pydantic 序列化"""
return {
column.name: getattr(self, column.name)
for column in self.__table__.columns
}

View File

@@ -8,4 +8,12 @@ class Checkpoint(Base):
aname = Column(String(100), nullable=False, comment="观察点名称")
burial_date = Column(String(100), comment="埋设日期")
section_id = Column(String(100), nullable=False, comment="所属断面id")
point_id = Column(String(100), nullable=False, comment="观察点id")
point_id = Column(String(100), nullable=False, comment="观察点id")
# 模型转字典
def to_dict(self):
"""将模型实例转换为字典,支持 Pydantic 序列化"""
return {
column.name: getattr(self, column.name)
for column in self.__table__.columns
}

12
app/models/daily.py Normal file
View File

@@ -0,0 +1,12 @@
from sqlalchemy import Column, Integer, String
from ..core.database import Base
class DailyData(Base):
__tablename__ = "daily"
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
account_id = Column(Integer, nullable=False, comment="账户id")
point_id = Column(String(100), comment="测点id")
NYID = Column(String(100), nullable=False, comment="期数id")
linecode = Column(String(255), nullable=False, comment="水准线路编码")
section_id = Column(String(255), nullable=False, comment="所属断面id")

View File

@@ -10,4 +10,12 @@ class LevelData(Base):
wsphigh = Column(String(100), comment="工作基点高程序列(m)")
NYID = Column(String(100), nullable=False, comment="期数id", index=True)
createDate = Column(DateTime, comment="上传时间")
mtype = Column(String(100), comment="水准观测类型")
mtype = Column(String(100), comment="水准观测类型")
# 模型转字典
def to_dict(self):
"""将模型实例转换为字典,支持 Pydantic 序列化"""
return {
column.name: getattr(self, column.name)
for column in self.__table__.columns
}

View File

@@ -18,4 +18,12 @@ class SectionData(Base):
foundation_treatment_method = Column(String(100), comment="地基处理方法")
rock_mass_classification = Column(String(100), comment="围岩级别")
account_id = Column(String(100), nullable=True, comment="账号id", index=True)
section_id = Column(String(100), nullable=False, comment="断面id", index=True)
section_id = Column(String(100), nullable=False, comment="断面id", index=True)
# 模型转字典
def to_dict(self):
"""将模型实例转换为字典,支持 Pydantic 序列化"""
return {
column.name: getattr(self, column.name)
for column in self.__table__.columns
}

View File

@@ -1,6 +1,6 @@
from sqlalchemy import Column, Integer, String, DateTime
from ..core.database import Base
from datetime import datetime
class SettlementData(Base):
__tablename__ = "settlement_data"
@@ -23,4 +23,15 @@ class SettlementData(Base):
sjName = Column(String(100), comment="司镜人员")
useflag = Column(String(100))
workinfoname = Column(String(100), comment="观测阶段")
upd_remark = Column(String(1000), comment="备注")
upd_remark = Column(String(1000), comment="备注")
def to_dict(self):
data = {}
for column in self.__table__.columns:
field_value = getattr(self, column.name)
# 时间字段格式化(不影响原生字段名)
if isinstance(field_value, datetime):
data[column.name] = field_value.strftime("%Y-%m-%d %H:%M:%S")
else:
data[column.name] = field_value
# 【关键】删除之前添加的max_nyid只保留原生NYID字段
return data