本文档详细阐述了房地产专家评估系统中四个核心数据结构类(Hierarchy、Problem、Expert、Model)的设计理念、结构关系和作用机制。这些类构成了系统的标准体系核心,支撑着整个评估业务的数据模型和算法实现。
Hierarchy:层级体系,用于存储综合体系、设备体系、实测实量体系的层级数据
Problem:问题管理,用于存储建筑工程中的各类安全问题和风险点
Expert:专家管理,用于存储专家信息
Model:模型管理,用于存储模型信息
ByPassInfo:轮空信息,用于存储排查项目
Hierarchy是所有数据的基础,一个树结构
Model则是从Hierarchy中抽取出来的子树
Expert是根据特定Model的配置,定义打分的一些权重、表格,用于具体的计算
erDiagram
Hierarchy {
int id PK
string name
json content
datetime create_time
datetime update_time
}
Problem {
int id PK
int hierarchy_id FK
string hierarchy_path
text description
json number_factors
json scale_factors
json incident_types
string review_paradigm
string responsible_person
string responsible_department
string correct_practice
datetime create_time
datetime update_time
}
Expert {
int id PK
string name
string type
string contact
float matrix_weight
float membership_weight
float expert_inquiry_weight
json weight_map
json compare_matrix_map
datetime create_time
datetime update_time
}
Model {
int id PK
string name
string type
int hierarchy_id FK
int version
datetime create_time
datetime update_time
}
SysModel {
int id PK
json problem_ids
json hierarchy_paths
}
DeviceModel {
int id PK
boolean published
boolean enable
string description
}
SysExpert {
int id PK
int system_model_id FK
}
DeviceExpert {
int id PK
int device_model_id FK
}
Hierarchy ||--o{ Problem : "包含问题"
Hierarchy ||--o{ Model : "生成模型"
Model ||--o{ SysModel : "系统模型"
Model ||--o{ DeviceModel : "设备模型"
Expert ||--o{ SysExpert : "系统专家"
Expert ||--o{ DeviceExpert : "设备专家"
SysModel ||--o{ SysExpert : "关联专家"
DeviceModel ||--o{ DeviceExpert : "关联专家"
Problem ||--o{ SysModel : "选择问题"
@Entity
public class Hierarchy extends EntityBase {
@Type(type = "io.hypersistence.utils.hibernate.type.json.JsonType")
@Column(columnDefinition = "json")
private SimpleTreeRoot<HierarchyData> content;
}
核心作用:
- 层级数据存储:用于存储综合体系、设备体系、实测实量体系的层级数据
- 树形结构管理:通过JSON格式存储树形结构,支持层级关系的快速查询和操作
- 内存加速:通过@PostLoad注解在数据加载时构建树形结构,提高查询性能
SimpleTreeRoot<HierarchyData>提供完整的树形操作接口HierarchyData,包含分数和权重信息@Entity
public class Problem extends EntityBase {
@Column(nullable = false)
private Integer hierarchyId; // 关联层级ID
@Column(nullable = false)
private String hierarchyPath; // 层级路径
@Column(nullable = false)
private String description; // 问题描述
// 多种因子类型
private List<NumberFactor> numberFactors; // 数量因子
private List<ScaleFactor> scaleFactors; // 等级因子
private List<IncidentType> incidentTypes; // 事故类型
// 问题处理信息
private String reviewParadigm; // 点评范式
private String responsiblePerson; // 责任人
private String responsibleDepartment; // 责任部门
private String correctPractice; // 正确做法
}
核心作用:
- 问题定义:存储建筑工程中的各类安全问题和风险点
- 层级关联:通过hierarchyId和hierarchyPath与层级体系建立关联
- 多因子支持:支持数量因子、等级因子等多种评估因子类型
- 处理指导:提供问题处理的标准流程和责任分工
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "type")
public class Expert extends EntityBase {
// 权重配置
private Float matrixWeight; // 矩阵权重
private Float membershipWeight; // 隶属度权重
private Float expertInquiryWeight; // 专家调查权重
// 打分专家部分
@Type(type = "io.hypersistence.utils.hibernate.type.json.JsonType")
private Map<String, Float> weightMap; // 权重映射表
// 模糊专家部分
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private MembershipMatrix membershipMatrix; // 隶属度矩阵
@Type(type = "io.hypersistence.utils.hibernate.type.json.JsonType")
private Map<String, CompareMatrix> compareMatrixMap; // 比较矩阵映射
}
核心作用:
- 专家分类:支持系统专家(SysExpert)和设备专家(DeviceExpert)两种类型
- 权重管理:管理专家在评估中的权重配置
- 算法支持:为打分算法和模糊评估算法提供权重矩阵和比较矩阵
- 模型关联:通过继承关系与具体的模型建立关联
type字段区分专家类型@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING)
public class Model extends EntityBase {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "hierarchy_id")
Hierarchy hierarchy; // 关联层级
@Column(nullable = false)
private Integer version; // 版本号
}
核心作用:
- 模型基类:为系统模型、设备模型、实测模型提供统一的基础结构
- 层级关联:与层级体系建立关联,定义模型的适用范围
- 版本管理:支持模型的版本控制,便于模型迭代和回滚
- 子树抽取:从完整的层级数据中抽取特定的子树作为评估模型
// 系统模型
@Entity
@DiscriminatorValue("system")
public class SysModel extends Model {
private List<Integer> problemIds; // 选中的问题ID列表
private List<String> hierarchyPaths; // 层级路径列表
}
// 设备模型
@Entity
@DiscriminatorValue("device")
public class DeviceModel extends Model {
private Boolean published; // 是否发布
private Boolean enable; // 是否激活
private String description; // 模型描述
}
erDiagram
Hierarchy ||--o{ Problem : contains
Hierarchy ||--o{ Model : contains
Model ||--o{ SysModel : extends
Model ||--o{ DeviceModel : extends
Expert ||--|| SysModel : belongs_to_system
Expert ||--|| DeviceModel : belongs_to_device
Problem ||--o{ SysModel : selected_by
hierarchyId和hierarchyPath建立关联hierarchy_id外键建立关联problemIds列表建立关联flowchart TD
A[Hierarchy层级体系] --> B[Problem问题库]
A --> C[Model模型基类]
B --> D[SysModel系统模型]
C --> D
D --> E[Expert专家配置]
E --> F[评估算法]
flowchart TD
A[选择Model模型] --> B[获取Problem问题列表]
B --> C[加载Expert专家配置]
C --> D[构建评估矩阵]
D --> E[执行评估算法]
E --> F[生成评估结果]
type字段区分专家类型type字段区分模型类型SimpleTreeRoot<HierarchyData>实现树形结构这四个核心类构成了房地产专家评估系统的数据模型基础,通过合理的架构设计和优化策略,为整个系统提供了稳定、高效、可扩展的数据支撑。