diff --git a/app/services/settlement_data.py b/app/services/settlement_data.py index 19e009e..fd7b608 100644 --- a/app/services/settlement_data.py +++ b/app/services/settlement_data.py @@ -413,16 +413,19 @@ class SettlementDataService(BaseService[SettlementData]): # 解析查询结果(元组:(沉降数据实例, section_id, aname, work_site)) settlement, section_id, aname, work_site = record - # 根据work_site判断work_type(默认0表示未匹配或无数据) + # 根据work_site判断work_type(默认0表示未匹配或无数据) 涵洞H 沉降板L 观测桩G和Z(分标段) B 路基 work_type = 0 if work_site: work_site_str = str(work_site).strip() # 确保为字符串且去空格 - if "隧道" in work_site_str: + if "S" in aname: work_type = 1 - elif "区间路基" in work_site_str: + elif "L" in aname or "G" in aname or "Z" in aname or "B" in aname: work_type = 2 - elif "桥" in work_site_str: + elif "T" in aname or "D" in aname or "C " in aname: work_type = 3 + elif "H" in aname : + work_type = 4 + # 组装返回字典(新增aname字段) record_dict = { @@ -431,7 +434,7 @@ class SettlementDataService(BaseService[SettlementData]): "aname": aname, # 新增:测点名称(从Checkpoint表获取) "section_id": section_id, # 新增:观测点关联的断面ID "work_site": work_site, # 新增:断面的工点信息 - "work_type": work_type, # 新增:工点类型编码(1-隧道,2-区间路基,3-桥) + "work_type": work_type, # 新增:工点类型编码(1-隧道,2-区间路基,3-桥,4-) "CVALUE": settlement.CVALUE, "MAVALUE": settlement.MAVALUE, "MTIME_W": settlement.MTIME_W.strftime("%Y-%m-%d %H:%M:%S") if settlement.MTIME_W else None,