# 数据库表结构设计 v3 ## 〇、报表体系总览(交通运输企业统计调查制度) Demo 阶段仅处理 **交企统H203-2表**,后续陆续扩展。 ### 年报(10张) | 表号 | 表名 | 说明 | |------|------|------| | 交企统101表 | 单位基本情况 | | | 交企统102表 | 法人企业财务状况 | | | 交企统U103-1表 | 公共汽电车运营情况 | | | 交企统U103-2表 | 城市轨道交通车辆及线路情况 | | | 交企统U103-3表 | 城市轨道交通人员及运营情况 | | | 交企统U103-4表 | 城市客运轮渡运营情况 | | | 交企统U104表 | 公共交通能源消耗情况 | | | 交企统H104-1表 | 公路旅客运输能源消耗情况 | | | 交企统W104表 | 水路运输能源消耗情况 | | | 交企统P104表 | 港口能源消耗情况 | | ### 月报/季报(14张) | 表号 | 表名 | 周期 | Demo | |------|------|------|------| | 交企统202表 | 法人企业季度财务状况 | 季报 | | | 交企统H203-1表 | 公路旅客运输月度生产情况 | 月报 | | | **交企统H203-2表** | **道路货物运输月度生产情况** | **月报** | **v1** | | 交企统U203表 | 公共交通月度运营情况 | 月报 | | | 交企统W203表 | 水路运输月度生产情况 | 月报 | | | 交企统P203-1表 | 港口分航线进出港旅客人数 | 月报 | | | 交企统P203-2表 | 港口分货类吞吐量 | 月报 | | | 交企统P203-3表 | 港口集装箱吞吐量 | 月报 | | | 交企统P203-4表 | 一箱制集装箱铁水联运量 | 月报 | | | 交企统P203-5表 | 港口分货类分运输方式集疏运情况 | 季报 | | | 交企统H204表 | 道路货运车辆能源消耗情况 | 季报 | | | 交企统205表 | 企业运行景气状况 | 月报 | | | 交企统W206表 | 船舶受电设施安装使用情况 | 半年报 | | | 交企统P206表 | 港口岸电设施建设使用情况 | 月/半年报 | | --- ## 一、用户权限模块(含三员) ### sys_user 用户表 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | username | varchar(50) | 登录名 | | password | varchar(200) | BCrypt | | real_name | varchar(50) | 真实姓名 | | phone | varchar(20) | 手机号 | | dept_id | bigint | 部门ID | | status | tinyint | 0禁用 1启用 | ### sys_role 角色表 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | role_name | varchar(50) | 角色名 | | role_code | varchar(50) | SYS_ADMIN/SEC_OFFICER/AUDITOR/PROVINCE/CITY/COUNTY | | role_type | varchar(20) | SYSTEM(三员) / BUSINESS(业务) | | role_level | tinyint | 0三员 1省厅 2市局 3县区 | | is_mutex | tinyint | 1三员互斥 0普通 | ### sys_dept 部门表 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | dept_name | varchar(100) | 部门名称 | | dept_code | varchar(20) | 行政区划代码 | | parent_id | bigint | 上级部门 | | dept_level | tinyint | 1省 2市 3县 | ### 三员约束规则 - sys_role 中 role_type=SYSTEM + is_mutex=1 的角色为三员角色 - 用户分配角色时后端校验:三员角色最多1个 - 删除三员角色用户时,检查该三员是否还有其它用户持有 --- ## 二、业务数据模块 ### h2032_enterprise_monthly(交企统H203-2表 道路货物运输月度生产情况) > 数据来源:模板_交企统H203-2表_道路货物运输月度生产情况.xlsx | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 2026-06 | | region_code | varchar(20) | 所属地区(行政区划代码) | | enterprise_code | varchar(50) | 企业代码 | | enterprise_name | varchar(200) | 企业名称 | | unified_credit_code | varchar(50) | 统一社会信用代码 | | report_unit | varchar(200) | 填报单位 | | vehicle_total | int | 车辆数_总计 | | tons_total | double | 标记吨位数_总计 | | vehicle_tractor | int | 车辆数_牵引车 | | vehicle_trailer | int | 车辆数_挂车 | | tons_trailer | double | 标记吨位数_挂车 | | vehicle_container | int | 车辆数_集装箱车 | | tons_container | double | 标记吨位数_集装箱车 | | vehicle_whole | int | 车辆数_整车 | | tons_whole | double | 标记吨位数_整车 | | freight_total | double | 货运量_总计(吨) | | turnover_total | double | 货物周转量_总计(吨公里) | | freight_container | double | 货运量_集装箱(吨) | | freight_coal | double | 货运量_煤炭及制品(吨) | | freight_oil_gas | double | 货运量_石油天然气及制品(吨) | | freight_crude_oil | double | 货运量_其中原油(吨) | | freight_metal_ore | double | 货运量_金属矿石(吨) | | freight_iron_ore | double | 货运量_其中铁矿石(吨) | | freight_building | double | 货运量_矿物性建筑材料(吨) | | freight_grain | double | 货运量_粮食(吨) | | avg_tonnage | double | 货车平均吨位 | | avg_tonnage_trailer | double | 平均吨位_挂车 | | avg_tonnage_whole | double | 平均吨位_整车 | | avg_distance | double | 货车平均运距(公里) | | daily_trips_per_ton | double | 单吨日均载运次数 | | daily_mileage_per_vehicle | double | 单车单天行驶里程(公里) | | daily_volume_per_vehicle | double | 单车日均运量(吨) | | daily_trips_with_tractor | double | 单吨日均载运次数(结合牵引车) | | vehicle_mom_growth | double | 车辆数-总计环比增速 | | tons_mom_growth | double | 标记吨位-总计环比增速 | | freight_mom_growth | double | 货运量-总计环比增速 | | turnover_mom_growth | double | 货物周转量-总计环比增速 | | avg_distance_mom_growth | double | 货车平均运距-环比增速 | | vehicle_yoy_growth | double | 车辆数-总计同比增速 | | tons_yoy_growth | double | 标记吨位-总计同比增速 | | tractor_trailer_ratio | double | 牵引车挂车比 | | freight_yoy_growth | double | 货运量-总计同比增速 | | turnover_yoy_growth | double | 货物周转量-总计同比增速 | | avg_distance_yoy_growth | double | 货车平均运距-同比增速 | | unit_leader | varchar(50) | 单位负责人 | | stats_leader | varchar(50) | 统计负责人 | | contact_person | varchar(50) | 填表人 | | contact_phone | varchar(20) | 联系电话 | | report_date | date | 报出日期 | | verify_explanation | text | 核实性原因解释 | | report_notes | varchar(200) | 上报说明 | | modify_record | text | 修改记录 | | import_batch_id | bigint | 导入批次 | | created_at | datetime | 创建时间 | ### h202_freight_vehicle_ownership (H202 highway freight operating vehicle ownership) Source: transport authority comprehensive ledger workbook `RP_JTB_FreightVehicle_.xlsx`. One row contains one report period, one region, and one indicator code (`01`-`93`). All numeric values use `DECIMAL(30,15)` and Java `BigDecimal`; Excel values are converted through their exact text and are never routed through `double`. | Field | Type | Description | |------|------|------| | id | bigint | Primary key | | report_period | varchar(20) | Report period `yyyy-MM` | | region_name | varchar(50) | Hubei province or one of 17 prefecture-level regions | | report_date | date | Report date read from cell `L3` | | item_code | varchar(10) | H202 indicator code `01`-`93` | | item_name | varchar(200) | Indicator name inherited from the matrix row | | unit | varchar(20) | Measurement unit | | total_value | decimal(30,15) | Total | | individual_value | decimal(30,15) | Individual | | large_value | decimal(30,15) | Large | | large_heavy_value | decimal(30,15) | Large-heavy | | large_heavy_individual_value | decimal(30,15) | Large-heavy-individual | | large_individual_value | decimal(30,15) | Large-individual | | medium_value | decimal(30,15) | Medium | | medium_individual_value | decimal(30,15) | Medium-individual | | small_value | decimal(30,15) | Small | | small_individual_value | decimal(30,15) | Small-individual | | source_file_name | varchar(255) | Source workbook file name | | import_batch_id | bigint | Import batch | | created_at | datetime | Creation time | Unique key: `(report_period, region_name, item_code)`. ### transport_auth_vehicle(运政车辆数据) > 数据来源:模板_运政车辆.xlsx | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 | | enterprise_name | varchar(200) | 企业名称 | | tractor_count | int | 总牵引车数 | | trailer_count | int | 总挂车数 | | other_count | int | 其它车辆数 | | trailer_tons | double | 挂车总吨位(吨) | | other_tons | double | 其它车辆总吨位(吨) | | container_count | int | 集装箱车辆数(2026年11月起);NULL表示无该字段或未填写,0表示明确为零 | | import_batch_id | bigint | 导入批次 | | created_at | datetime | 创建时间 | ### vehicle_track_mileage(车辆轨迹里程) > 数据来源:省重载平台模板,以及市州第三方轨迹文件。同一报表期可同时存在多个来源。 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | enterprise_name | varchar(200) | 企业名称 | | enterprise_category | varchar(20) | ABOVE_SCALE(规上企业)/PASSENGER(两客企业)/UNREGISTERED(未入规企业) | | data_source | varchar(30) | PROVINCIAL(省重载平台)/CITY_THIRD_PARTY(市州第三方) | | city_name | varchar(50) | 市州规范名;省级数据固定为“全省” | | monthly_mileage | double | 月度总里程(公里) | | tracked_vehicles | int | 有里程的车辆数 | | anomaly_mileage | double | 异常里程(公里);旧文件无此列时为 NULL | | report_period | varchar(20) | 报表期 | | import_batch_id | bigint | 导入批次 | | created_at | datetime | 创建时间 | > 唯一约束:`report_period + data_source + city_name + enterprise_category + enterprise_name`。有效轨迹里程 = `monthly_mileage + anomaly_mileage`;仅当异常里程率不超过 100% 且单车异常里程不超过 10,000 公里时纳入异常里程,否则只使用 `monthly_mileage`。轨迹来源由 `track_mileage_city_source_rule` 按“市州 + 生效报表期”配置:命中启用规则的市州强制采用本市第三方记录,不采用省重载平台,也不因省级单车里程更大而改选;没有可用本市记录时按无轨迹处理。未命中规则的市州同时存在两类记录时,按“有效轨迹里程 ÷ 有轨迹车辆数”计算单车有效里程,只有市州严格更大时才采用市州记录,相等时采用省重载平台。未入规数据不参与测算。 ### track_mileage_city_source_rule 市州轨迹来源规则 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | city_name | varchar(50) | 市州规范名称 | | effective_from_period | varchar(7) | 首个生效报表期 yyyy-MM | | effective_to_period | varchar(7) | 最后生效报表期;NULL 表示长期有效 | | enabled | tinyint | 1 启用 / 0 停用 | | remark | varchar(255) | 配置说明 | | created_at / updated_at | datetime | 创建/更新时间 | 唯一键:`(city_name, effective_from_period)`。命中启用规则且报表期在生效区间内的市州,规上测算、H2032/H204 轨迹相关审核及分市州轨迹生成统一采用本市第三方轨迹。初始预置孝感市 `effective_from_period=2026-11`。 ### scale_split_transport(规上规下拆分运输量) > 数据来源:模板_规上规下拆分运输量.xlsx,用户手动上传 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 2026-06 | | period_type | varchar(10) | MONTH(当月)/ CUMULATIVE(累计) | | region_name | varchar(50) | 市州名称 | | above_scale_freight | double | 规上货运量 | | above_scale_turnover | double | 规上周转量 | | above_scale_rank | int | 规上排名 | | above_scale_yoy | double | 规上同比 | | above_scale_yoy_rank | int | 规上增速排名 | | below_scale_freight | double | 规下货运量 | | below_scale_turnover | double | 规下周转量 | | below_scale_rank | int | 规下排名 | | below_scale_yoy | double | 规下同比 | | below_scale_yoy_rank | int | 规下增速排名 | | total_freight | double | 运输量合计-货运量 | | total_turnover | double | 运输量合计-周转量 | | total_rank | int | 合计排名 | | total_yoy | double | 合计同比 | | total_yoy_rank | int | 合计增速排名 | | import_batch_id | bigint | 导入批次 | | created_at | datetime | 创建时间 | ### freight_turnover_import(模板_货运量周转量导入) > 数据来源:模板_货运量周转量.xlsx,每月导入。每行含 48 个月度列:货运量今年 1-12 月(左半,仅 1-N 月有值)、去年 1-12 月(右半,算同比)、周转量今年/去年(导入存档,报表周转量仍用拆分表) | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 2026-06(N=月份数) | | region_name | varchar(50) | 市州或湖北省(忠实导入) | | freight_m01 ~ freight_m12 | double | 今年各月货运量(万吨),左半 1-N 月有值 | | last_freight_m01 ~ last_freight_m12 | double | 去年各月货运量(万吨),右半固定 12 个月 | | turnover_m01 ~ turnover_m12 | double | 今年各月周转量(万吨公里),导入存档 | | last_turnover_m01 ~ last_turnover_m12 | double | 去年各月周转量(万吨公里),导入存档 | | import_batch_id | bigint | 导入批次 | | created_at | datetime | 创建时间 | ### h2031_enterprise_monthly(交企统H203-1表 公路旅客运输月度生产情况) > 数据来源:公路旅客运输月度生产情况.xlsx 的「公路旅客6月报」sheet;同文件「运政车辆数」sheet 导入 passenger_auth_vehicle | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 2026-06 | | region_code | varchar(20) | 所属地区(行政区划代码) | | enterprise_code | varchar(50) | 企业代码 | | enterprise_name | varchar(200) | 企业名称 | | unified_credit_code | varchar(50) | 统一社会信用代码(新版模板新增列;老模板无此列时为 NULL) | | report_unit | varchar(200) | 填报单位(新版模板新增列;老模板无此列时为 NULL) | | vehicle_total | int | 客运车辆_总计 | | seat_total | int | 核定载客位_总计 | | vehicle_schedule | int | 车辆数_客运班车(含定线旅游) | | seat_schedule | int | 核定载客位_客运班车(含定线旅游) | | vehicle_charter | int | 车辆数_客运包车(含非定线旅游) | | seat_charter | int | 核定载客位_客运包车(含非定线旅游) | | passenger_total | double | 客运量_总计(人) | | turnover_total | double | 旅客周转量_总计(人公里) | | passenger_class1 ~ passenger_class4 | double | 客运量_一~四类客运班线(含定线旅游) | | turnover_class1 ~ turnover_class4 | double | 旅客周转量_一~四类客运班线(含定线旅游) | | passenger_charter | double | 客运量_客运包车(含非定线旅游) | | turnover_charter | double | 旅客周转量_客运包车(含非定线旅游) | | avg_distance_total | double | 客运平均运距(公里) | | avg_distance_class1 ~ avg_distance_class4 | double | 一~四类客运班线平均运距(公里) | | avg_distance_charter | double | 旅游、包车平均运距(公里) | | verify_explanation | text | 核实性原因解释 | | import_batch_id | bigint | 导入批次 | | created_at | datetime | 创建时间 | ### passenger_auth_vehicle(公路旅客运政车辆数据) > 数据来源:公路旅客运输月度生产情况.xlsx 的「运政车辆数」sheet(企业代码/企业名称/车辆数/载客位数),随月报一起按报表期导入 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 | | enterprise_code | varchar(50) | 企业代码 | | enterprise_name | varchar(200) | 企业名称 | | vehicle_count | int | 车辆数 | | seat_count | int | 载客位数 | | import_batch_id | bigint | 导入批次 | | created_at | datetime | 创建时间 | --- ### h204_vehicle_quarterly(交企统H204表 道路货运车辆能源消耗情况·车辆粒度) > 数据来源:道路货运车辆能源消耗情况(2026年).xlsx 的「第二季度货车能耗明细」sheet(每行左右各5组车辆、每组18列);同文件「运政车辆信息」sheet 导入 h204_auth_vehicle | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 2026-06(季度末月) | | region_code | varchar(20) | 所属地区(行政区划代码) | | enterprise_code | varchar(50) | 企业代码 | | enterprise_name | varchar(200) | 企业名称 | | plate_no | varchar(30) | 车牌号 | | vehicle_type_code | varchar(10) | 车辆类型代码 | | vehicle_type | varchar(50) | 车辆类型(中文) | | fuel_type_code | varchar(10) | 燃料类型代码 | | fuel_type | varchar(50) | 燃料类型(中文) | | manufacture_year | int | 出厂年份 | | marked_tonnage | double | 标记吨位(吨) | | total_mileage | double | 总行程(公里) | | loaded_mileage | double | 载货里程(公里) | | empty_mileage | double | 空驶里程(公里) | | freight | double | 货运量(吨) | | turnover | double | 货物周转量(吨公里) | | trip_count | int | 趟次数(个) | | fuel_unit | varchar(20) | 燃料1计量单位 | | fuel_consumption | double | 燃料1消耗量 | | avg_distance | double | 平均运距(公里) | | avg_loaded_tonnage | double | 平均载货吨位(吨)= 货物周转量/载货里程 | | transport_efficiency | double | 运输效率(吨)= 货物周转量/总行程(官方格式自带该列,缺列时回算) | | avg_trip_mileage | double | 单趟平均里程(公里) | | fuel_per_100km | double | 百公里单耗 | | turnover_fuel | double | 周转量单耗 | | import_batch_id | bigint | 导入批次 | | created_at | datetime | 创建时间 | ### h204_fuel_per100km_threshold(H204 百公里单耗审核阈值·《单耗审核公式》表) > 数据来源:docs/能耗/单耗审核公式.xlsx。判定:单耗 < normal_min 或 >= edit_threshold → 「请修改」(RED);normal_max < 单耗 < edit_threshold → 「请核实」(YELLOW);[normal_min, normal_max] 为正常。按 (fuel_group, k_min, effective_period) 唯一;审核时取 effective_period 不大于报表期且最大者。 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | fuel_group | varchar(30) | 燃料分组码:GASOLINE / DIESEL_LNG / CNG / DUAL / EV | | fuel_group_name | varchar(50) | 燃料分组名称 | | k_min | double | 标记吨位下限(不含) | | k_max | double | 标记吨位上限(含);NULL=无上限 | | k_label | varchar(20) | 档位文字,如 8-30吨 | | normal_min | double | 正常区间下限 | | normal_max | double | 正常区间上限 | | edit_threshold | double | 达到该值(含)即为「请修改」 | | effective_period | varchar(20) | 生效报表期(含),种子为 2026-01 | | remark | varchar(200) | 备注 | | created_at | datetime | 创建时间 | > 燃料分组对应:01 汽油→GASOLINE;02 柴油、04 液化天然气→DIESEL_LNG;03 压缩天然气→CNG;05 双燃料、06 混合动力、08 燃料电池→DUAL;07 纯电动→EV。 ### h204_auth_vehicle(道路货运能耗_运政车辆信息) > 数据来源:道路货运车辆能源消耗情况(2026年).xlsx 的「运政车辆信息」sheet(车牌号/车辆类型/燃料类型/标记吨位/准牵引质量),随季报一起按报表期导入 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 | | plate_no | varchar(30) | 车牌号 | | vehicle_type | varchar(50) | 车辆类型(中文) | | fuel_type | varchar(50) | 燃料类型(中文) | | marked_tonnage | double | 标记吨位(吨) | | traction_quality | double | 准牵引质量(牵引车标记吨位) | | import_batch_id | bigint | 导入批次 | | created_at | datetime | 创建时间 | ## 三、审核规则模块 ### audit_rule 审核规则表 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | rule_name | varchar(100) | 规则名称 | | rule_code | varchar(50) | 规则编码 | | description | text | 规则描述 | | check_field | varchar(200) | 检查字段 | | compare_type | varchar(20) | >/5 → RED) 2. 吨位运政对比(DIFF>50 → RED) 3. 周转量轨迹对比(RATIO>1.3 → RED) 4. 货运类型环比(MOM → YELLOW) 5. 集装箱异常(NULL_CHECK → RED) 6. 整车吨位范围(OUT_RANGE 不在4-40之间 → YELLOW) 旅客 H2031 8条(compare_type 新增 MOM_EQ_ZERO/MOM_PCT/MOM_EQ/EXISTENCE): 1. 车辆数运政对比(DIFF>3 → RED) 2. 载客位数运政对比(DIFF>50 → RED) 3. 客运量环比=0(一~四类+包车,值与上月相同 → YELLOW) 4. 旅客周转量环比=0(同上 → YELLOW) 5. 平均运距环比超±10%(一~四类 → YELLOW) 6. 包车平均运距等于上月(→ YELLOW) 7. 无班线有班线客运量(EXISTENCE → RED) 8. 无包车有包车客运量(EXISTENCE → RED) ## 四、审核结果模块 ### audit_result 审核结果表 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | rule_id | bigint | FK → audit_rule | | report_id | bigint | FK → h2032_enterprise_monthly | | enterprise_code | varchar(50) | 企业代码 | | report_period | varchar(20) | 报表期 | | actual_value | varchar(200) | 实际值 | | threshold_value | varchar(200) | 阈值 | | deviation | varchar(200) | 偏差 | | status | varchar(20) | PENDING/CONFIRMED/IGNORED | | reviewer_id | bigint | 审核人 | | review_comment | text | 意见 | | created_at | datetime | 创建时间 | ### audit_explanation 审核解释表 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | audit_result_id | bigint | FK → audit_result | | explanation_text | text | 上报人解释 | | llm_suggestion | text | LLM建议 | | llm_confidence | decimal(5,2) | 置信度 | | llm_status | varchar(20) | PENDING/PROCESSED/FAILED | --- ## 五、报表生成模块 > 以下4张输出表由系统根据导入数据自动计算生成,用户点击"生成报表"触发。 | 输出文件 | 数据来源 | 说明 | |------|------|------| | 生成_货运量分市州明细.xlsx | freight_turnover_import + h2032_enterprise_monthly + scale_split_transport | 1-N月明细+同比;货运量合计=模板、规上=H2032、规下=合计-规上;周转量=拆分表 | | 生成_货运量排名.xlsx | freight_turnover_import + h2032_enterprise_monthly | 规上=H2032累计、合计=模板累计、规下=合计-规上 | | 生成_公路旅客分市州明细.xlsx | h2031_enterprise_monthly(按市州汇总) | 月报(选年-月,今年1-N月+累计)/年报(选年份,全年12个月+累计);每期含当年+近3年区块、各月同比、累计同比;城际城乡公交/巡游出租/网约车列暂留空 | | 生成_周转量排名.xlsx | scale_split_transport | 规上/规下/合计周转量排名(含忠实导入的全省行) | ## 六、系统日志 ### sys_operation_log 操作日志表 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | user_id | bigint | 操作人 | | module | varchar(50) | 模块 | | action | varchar(50) | 操作 | | detail | text | 详情JSON | | ip_address | varchar(50) | IP | ### import_batch 导入批次表 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | file_name | varchar(200) | 文件名 | | import_type | varchar(50) | H2032 / TRANSPORT_AUTH / TRACK_MILEAGE / SCALE_SPLIT | | total_rows | int | 总行数 | | success_rows | int | 成功行数 | | fail_rows | int | 失败行数 | | error_detail | text | 错误详情 | | created_at | datetime | 创建时间 | ## 七、LLM脱敏映射 > **实现说明(2026-09-14 更新)**:当前实际生效的脱敏是**内存态**的——`DesensitizeService` 在数据外发前把企业名称替换为 `Company1`、`Company2`…,回答返回前再还原,映射只存在进程内存中、不落库。 > 具体做法:AI 查库(`query_database`)结果回填给大模型前,企业名称统一换别名,自由文本里的企业名称与手机号一并处理;`contact_person`(填表人)、`contact_phone`(联系电话)、`unified_credit_code`(统一社会信用代码)、`unit_leader`、`stats_leader`、`report_unit`、`enterprise_code` 直接从"可查列"中剔除,AI 既查不到也不能作为过滤/排序条件。 > 下表 `llm_desensitize_map` 为**预留**的落库版映射表,目前代码未引用、表为空;若后续需要留存脱敏审计痕迹再启用。 ### llm_desensitize_map 脱敏映射表 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | original_value | varchar(200) | 原始值 | | masked_value | varchar(200) | 脱敏值 | | mask_type | varchar(20) | ENTERPRISE/REGION | | call_id | varchar(50) | 调用ID | ## 八、投资模块(客运站场 / 物流园区) > 数据源:全省汇总大表(`7月客运站投资明细表.xlsx` 明细sheet、`6月物流站场投资明细.xls` 分项目投资完成情况sheet),审核比对基准为投资系统导出(`查询结果(投资系统-客运+物流 2026.7).xls`)。 ### investment_project(投资项目主档) | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | project_name | varchar(200) | 项目名称(与 category 组成唯一键) | | category | varchar(20) | 客运站场 / 物流园区 | | city | varchar(50) | 市州 | | county | varchar(100) | 县(市、区) | | builder_name | varchar(200) | 投资建设单位 | | construct_nature | varchar(50) | 建设性质(新建/续建/改扩建) | | start_time / end_time | varchar(20) | 开工 / 建成时间 | | total_investment | double | 计划总投资(万元) | | approval_gk / approval_cs | varchar(500) | 工可 / 初设批复 | | building_area | double | 建筑面积(平方米,物流表) | | is_billion / is_county / is_five_year | tinyint | 亿元 / 经济强县 / 十五五重点 固定名单标记 | ### investment_monthly(投资项目月度完成情况) | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 2026-07 | | project_id | bigint | 关联 investment_project.id | | year_plan | double | 本年计划投资(万元) | | year_cum | double | 自年初累计完成投资(万元) | | month_done | double | 其中:本月完成投资(万元) | | start_cum | double | 自开始建设累计完成投资(万元) | | progress_stage | varchar(100) | 建设阶段 | | progress_desc | varchar(2000) | 形象进度 | | building_area | double | 建筑面积(平方米) | ### investment_system(投资系统导出·审核比对基准) | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 | | project_name | varchar(200) | 项目名称(单位) | | total_investment | double | 计划总投资(万元) | | start_cum | double | 自开始建设至本月累计完成投资(万元) | | year_plan | double | 本年计划投资(万元) | | year_cum | double | 自年初累计完成投资(万元) | | month_done | double | 当月完成投资(万元) | ### 投资审核规则(report_type=INVEST) | 规则 | 比较类型 | 说明 | |------|---------|------| | RULE_I001 自开始累计对比 | CROSS_DIFF | 绝对差>100万 且 相对差>5% | | RULE_I002 自年初累计对比 | CROSS_DIFF | 绝对差>50万 且 相对差>5% | | RULE_I003 本月完成对比 | CROSS_DIFF | 绝对差>30万 且 相对差>30% | | RULE_I004 系统缺失 | EXISTENCE_SYS | 汇总大表项目在投资系统导出中不存在 | ### 投资 4 张领导报表(ReportExportService) | 端点 | 表名 | 数据 | |------|------|------| | /api/report/export/investPlan | 全省预安排计划进度汇总 | 客运+物流大块、17市州小节+项目行 | | /api/report/export/investFiveYearLogistics | "十五五"物流项目进展 | 固定名单过滤,市州小节+项目行 | | /api/report/export/investBillion | 亿元投资项目 | 投资总表 + 规上项目表两sheet,亿元名单过滤 | | /api/report/export/investCounty | 经济强县投资统计 | 经济强县名单过滤 | ## 九、专项统计-重要节假日模块 > 数据来源与模板:`docs/专项统计/重要节假日/2026年十一数据.xlsx`;快报模板:`docs/专项统计/重要节假日/湖北省国庆假期综合运输客流快报模板.docx`。首次启动会从工作簿初始化 2024/2025 年十一客流、车流数据、2024-2026 年铁路/民航前一日数据、2019 年道路数据,并初始化 2024-2026 年客运系数。 ### holiday_calendar 节假日日期配置 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | year | int | 年份 | | holiday_type | varchar(32) | 春节 SPRING_FESTIVAL / 五一 LABOR_DAY / 十一 NATIONAL_DAY | | holiday_date | date | 节假日具体日期 | | day_index | int | 0=前一日,1..N=假期第 N 日 | | created_at / updated_at | datetime | 创建/更新时间 | 唯一键:`(year, holiday_type, day_index)`、`(year, holiday_type, holiday_date)`。仅 admin 可通过系统配置菜单维护;`day_index=0` 用于铁路、民航的前一日环比基数。 ### holiday_passenger_flow 节假日综合运输营业性客流 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | year | int | 年份 | | flow_date | date | 日期 | | transport_mode | varchar(32) | 铁路 RAIL / 民航 CIVIL_AVIATION / 道路 ROAD / 水路 WATER | | passenger_count | decimal(30,15) | 发送旅客数(万人次) | | created_at / updated_at | datetime | 创建/更新时间 | 唯一键:`(year, flow_date, transport_mode)`。 ### holiday_vehicle_flow 节假日综合运输非营业性车流 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | year | int | 年份 | | flow_date | date | 日期 | | road_category | varchar(32) | 高速公路 EXPRESSWAY / 普通国省道 NATIONAL_PROVINCIAL | | vehicle_type | varchar(32) | 小客车 SMALL_PASSENGER / 中小客车 MEDIUM_SMALL_PASSENGER | | vehicle_count | decimal(30,15) | 车流量(万辆次) | | comparison_base | decimal(30,15) | 普通国省道环比基期(万辆次,人工备用值,仅 2026 年启用、不参与计算) | | created_at / updated_at | datetime | 创建/更新时间 | 唯一键:`(year, flow_date, road_category, vehicle_type)`。 ### holiday_passenger_coefficient 客运系数配置 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | year | int | 年份 | | date_category | varchar(32) | 节假日 HOLIDAY / 非节假日 NON_HOLIDAY | | coefficient | decimal(30,15) | 客运系数 | | created_at / updated_at | datetime | 创建/更新时间 | 唯一键:`(year, date_category)`。仅 admin 可通过系统配置菜单维护。 ### 计算与导入导出口径 - 非营业性人员流动量 =(高速车流 + 普通国省道车流)× 当年节假日客运系数。 - 普通国省道环比固定按“当日 / 前一日 - 1”计算;2024/2025/2026 各年一致。`comparison_base`(Excel 普通国省道表 C 列“环比基期”)自 2026-10-05 起仅作人工备用:导入导出原样保存/回写,不参与环比、折算或累计;导出时 C 列照常写出,E 列“环比”公式始终引用上一行同年 D 列。 - 公路人员流动量 = 道路营业性客运量 + 非营业性人员流动量。 - 总人员流动量 = 公路 + 铁路 + 民航 + 水路。 - 导入按“年份 + 节假日分类”读取 `holiday_calendar` 中 `day_index>=1` 的日期,将工作簿“第N日”行覆盖写入当年客流/车流;同时读取当前年份铁路、民航的“前一日”行,写入 `day_index=0` 对应的日期。 - 日常导入只读取所选年份的当年列(道路表的 2019/2024/2025 列均不读取);2019 年道路数据和 2024/2025/2026 年前一日铁路、民航数据由启动初始化直接写入数据库。2019 年 10 月 1-8 日的 `holiday_calendar` 配置用于在系统配置和节假日统计页查看该历史基线。 - 导入前检查比本次最新导入日更早的历史日期是否发生变化;如有变化先不写库,返回差异清单,用户确认后才允许覆盖。 - 记录“前一日”的铁路、民航数据后,假期第 1 日的铁路、民航环比按该数据计算;公路、水路、总人员流动量在第 1 日仍不计算环比。 - 导出以源工作簿为底稿,回填库内数据与客运系数;快报按日期生成 Word,同比固定使用 2025、2024 两年,不使用 2019 数据。 ## 十、货运测算模块 货运测算使用现有 `h2032_enterprise_monthly` 作为唯一月报企业数据源,不另存第二套企业指标。模块自身 5 张表由启动器 `FreightForecastSchemaInitializer` 幂等创建;部署包也可执行 `deploy-templates/db/sql_freight_forecast_migration.sql`。轨迹来源规则表 `track_mileage_city_source_rule` 由 `TrackMileageCitySourceRuleInitializer` 幂等创建并预置孝感规则,部署包另执行 `sql_track_mileage_city_source_rule_migration.sql`。 ### freight_forecast_base_month 规下年度基期 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | stat_year | smallint | 统计年度 | | report_month | tinyint | 1-12 月 | | below_freight | double | 规下货运量基期(万吨) | | below_turnover | double | 规下周转量基期(万吨公里) | | source_file | varchar(255) | 来源文件 | | created_at / updated_at | datetime | 创建/更新时间 | 唯一键:`(stat_year, report_month)`。2026 年基期来自 `42-2026年基数.xlsx` 湖北页 `L14:W15`;导入按年度整体替换 12 个月。 ### freight_forecast_below_result 规下两步测算结果 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 yyyy-MM | | result_type | varchar(10) | GROWTH 第一步增速预测 / ACTUAL 第二步实际值 | | base_freight / base_turnover | double | 当月规下基期 | | highway_* / provincial_* | double | 高速、国省道分项基期、本期值、增速 | | below_freight | double | 测算规下货运量(万吨) | | below_turnover | double | 测算规下周转量(万吨公里) | | below_freight_yoy / below_turnover_yoy | double | 相对基期增速 | | note | varchar(500) | 备注 | | calculated_at | datetime | 计算时间 | 唯一键:`(report_period, result_type)`。同月同时存在两步结果时,差异率报告和总周转量累计同比优先采用 `ACTUAL`,否则采用 `GROWTH`。 ### freight_forecast_above_enterprise 规上企业测算快照 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 yyyy-MM | | city / enterprise_name | varchar | 市州、企业名称 | | tractor_count / other_tons | int / double | 运政总牵引车数、其它车辆总吨位 | | monthly_mileage / anomaly_mileage | double | 所选轨迹来源的月度里程、异常里程 | | tracked_vehicles | int | 有里程车辆数 | | effective_mileage | double | 可纳入测算的有效里程 | | forecast_turnover | double | 测算周转量(吨公里) | | track_source | varchar(30) | PROVINCIAL / CITY_THIRD_PARTY | | calculation_status | varchar(30) | OK / NO_AUTH / NO_TRACK / NO_MILEAGE | 唯一键:`(report_period, enterprise_name)`。企业范围取当年 `h2032_enterprise_year`;轨迹来源按 `track_mileage_city_source_rule` 判定。命中规则的市州强制使用本市第三方轨迹,不回退省级;其他市州按有效单车里程整条择优,相等时省级。 规上公式:`(总牵引车数×31 + 其它车辆总吨位) × 有效里程 ÷ 有里程车辆数`。有效里程默认 `月度里程 + 异常里程`;异常里程率 > 100% 或单车异常里程 > 10,000 公里时整笔异常里程不纳入。市州第三方文件不拆分正常/异常里程,仅取月度里程。 ### freight_forecast_above_history 规上历史累计测算 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | stat_year | smallint | 统计年度 | | through_period | varchar(20) | 历史累计截止报表期 yyyy-MM | | city / enterprise_name | varchar | 市州、企业名称 | | first_half_forecast / month7_forecast ... month12_forecast | double | 1-6月及7-12月逐期测算周转量(吨公里) | | cumulative_forecast | double | 按逐期列重建的累计测算周转量(吨公里) | | source_cumulative_forecast | double | 工作簿原累计列值,仅用于差异核对 | | corrected | tinyint(1) | 原累计列与逐期列重建值是否不一致 | | calculation_note | varchar(500) | 累计值使用的期间列说明 | | source_file_name | varchar(255) | 来源工作簿文件名 | | imported_at | datetime | 导入时间 | 唯一键:`(stat_year, through_period, enterprise_name)`。2026年1-10月共636家企业数据作为系统内置初始数据,由应用启动时从资源文件`freight-forecast-above-history-2026-10.tsv`幂等写入。历史累计不直接采用工作簿原累计列,而是按`1-6月测算周转量 + 7月测算 + ... + 10月测算`重建;这样可以还原企业后期失去轨迹里程后被原公式累计列漏掉的历史月份。累计为`4,843,359.17407395`万吨公里,原累计列少算`36.51338069`万吨公里,涉及3家企业。 ### freight_forecast_report_round 货运月报版本台账 | 字段 | 类型 | 说明 | |------|------|------| | id | bigint | PK | | report_period | varchar(20) | 报表期 yyyy-MM | | report_stage | varchar(10) | AUDIT 审核中 / FINAL 定稿上报部 | | revision_no | int | 同阶段版本号,从 1 递增 | | file_name | varchar(255) | 源文件名 | | row_count | int | 企业行数 | | note | varchar(500) | 版本说明 | | imported_at | datetime | 导入时间 | 唯一键:`(report_period, report_stage, revision_no)`。本表只记录版本台账,不保存企业指标;每次导入都会覆盖该报表期 `h2032_enterprise_monthly` 当前工作数据,差异分析和差异率报告始终读取最新 H2032。历史补录或管理员纠错可直接走数据导入,但不登记版本。 旧版曾使用的 `freight_forecast_report_enterprise` 已停止读写。已有环境中的空物理表可以保留,不在初始化或迁移时自动删除。 差异率统一为 `上报周转量 ÷ 测算周转量 - 1`;总周转量累计同比 = `(累计上报规上 + 累计测算规下) ÷ (上年同期规上 + 基期规下) - 1`。