重构模型类包结构,将模型类按功能模块划分到不同的子包中。优化序列化处理,为VO类添加serialVersionUID并实现Serializable接口。移除部分冗余的serialVersionUID字段,简化模型类代码。同时修复UITools中空值处理的问题,并更新pom版本至0.0.100-SNAPSHOT。 - 将模型类按功能模块划分到ds子包中 - 为VO类添加序列化支持 - 移除冗余的serialVersionUID字段 - 修复UITools空值处理问题 - 更新项目版本号
100 lines
5.5 KiB
Markdown
100 lines
5.5 KiB
Markdown
# Service类规范符合性检查报告
|
||
|
||
## 概述
|
||
|
||
本报告对Contract-Manager项目Server模块中所有64个注解了@CacheConfig的Service类进行了规范符合性检查和修复验证。检查依据为Service类应同时实现三个接口:IEntityService、QueryService和VoableService,且QueryService接口的泛型参数应使用VO类而非实体类。
|
||
|
||
## 检查与修复结果汇总
|
||
|
||
| 类别 | 初始数量 | 修复后数量 | 说明 |
|
||
|------|----------|------------|------|
|
||
| 完全符合规范 | 约40个 | 64个 | 同时实现三个接口,QueryService泛型参数使用VO类 |
|
||
| QueryService泛型参数错误 | 约22个 | 0个 | 已全部修复为正确使用VO类作为QueryService泛型参数 |
|
||
| 仅实现QueryService接口 | 约2个 | 0个 | 已全部修复为实现完整的三个接口 |
|
||
|
||
## 不符合规范的Service类修复详情
|
||
|
||
### 1. QueryService泛型参数错误修复情况
|
||
|
||
所有实现了三个接口但QueryService泛型参数使用实体类的Service类已全部修复。修复的主要类包括:
|
||
|
||
- **VendorTypeService**:将QueryService<VendorTypeLocal>修改为QueryService<VendorTypeLocalVo>
|
||
- **ProjectSaleTypeRequireFileTypeService**:将QueryService<ProjectSaleTypeRequireFileType>修改为QueryService<ProjectSaleTypeRequireFileTypeVo>
|
||
- **CompanyFileService**:将QueryService<CompanyFile>修改为QueryService<CompanyFileVo>
|
||
- 其他修复的类包括PurchaseOrdersService、ContractGroupService、ContractItemService等
|
||
|
||
### 2. 仅实现QueryService接口修复情况
|
||
|
||
所有仅实现了QueryService接口的Service类已全部修复为实现完整的三个接口:
|
||
|
||
- **CompanyExtendInfoService**:从仅实现QueryService<CompanyExtendInfo>修复为实现IEntityService<CompanyExtendInfo>、QueryService<CompanyExtendInfoVo>和VoableService<CompanyExtendInfo, CompanyExtendInfoVo>
|
||
- **CompanyInvoiceInfoService**:从仅实现QueryService<CompanyInvoiceInfo>修复为实现IEntityService<CompanyInvoiceInfo>、QueryService<CompanyInvoiceInfoVo>和VoableService<CompanyInvoiceInfo, CompanyInvoiceInfoVo>
|
||
|
||
## 符合规范的Service类示例
|
||
|
||
所有Service类现在都符合以下规范实现模式:
|
||
|
||
| 类名 | 包路径 | 符合规范的实现 |
|
||
|------|--------|----------------|
|
||
| ProjectFileTypeService | com.ecep.contract.ds.project.service | 实现了IEntityService<ProjectFileTypeLocal>、QueryService<ProjectFileTypeLocalVo>和VoableService<ProjectFileTypeLocal, ProjectFileTypeLocalVo>,QueryService泛型参数使用VO类 |
|
||
| ContractBidVendorService | com.ecep.contract.ds.contract.service | 实现了IEntityService<ContractBidVendor>、QueryService<ContractBidVendorVo>和VoableService<ContractBidVendor, ContractBidVendorVo>,QueryService泛型参数使用VO类 |
|
||
| CompanyOldNameService | com.ecep.contract.ds.company.service | 实现了IEntityService<CompanyOldName>、QueryService<CompanyOldNameVo>和VoableService<CompanyOldName, CompanyOldNameVo>,QueryService泛型参数使用VO类 |
|
||
| VendorTypeService | com.ecep.contract.ds.vendor.service | 实现了IEntityService<VendorTypeLocal>、QueryService<VendorTypeLocalVo>和VoableService<VendorTypeLocal, VendorTypeLocalVo>,QueryService泛型参数使用VO类 |
|
||
| CompanyFileService | com.ecep.contract.ds.company.service | 实现了IEntityService<CompanyFile>、QueryService<CompanyFileVo>和VoableService<CompanyFile, CompanyFileVo>,QueryService泛型参数使用VO类 |
|
||
| CompanyExtendInfoService | com.ecep.contract.ds.company.service | 实现了IEntityService<CompanyExtendInfo>、QueryService<CompanyExtendInfoVo>和VoableService<CompanyExtendInfo, CompanyExtendInfoVo>,QueryService泛型参数使用VO类 |
|
||
|
||
## 修复方案执行情况
|
||
|
||
### 1. QueryService泛型参数错误修复
|
||
|
||
修复过程中采用的标准模式示例:
|
||
|
||
```java
|
||
// 修改前
|
||
public class CompanyFileService implements IEntityService<CompanyFile>, QueryService<CompanyFile>, VoableService<CompanyFile, CompanyFileVo> {
|
||
// ...
|
||
@Override
|
||
public Page<CompanyFile> findAll(JsonNode paramsNode, Pageable pageable) {
|
||
// ...返回实体类Page
|
||
}
|
||
|
||
@Cacheable(key = "#p0")
|
||
@Override
|
||
public CompanyFile findById(Integer id) {
|
||
// ...返回实体类
|
||
}
|
||
// ...
|
||
}
|
||
|
||
// 修改后
|
||
public class CompanyFileService implements IEntityService<CompanyFile>, QueryService<CompanyFileVo>, VoableService<CompanyFile, CompanyFileVo> {
|
||
// ...
|
||
@Override
|
||
public Page<CompanyFileVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
||
// ...使用map方法转换为VO对象
|
||
return findAll(spec, pageable).map(CompanyFile::toVo);
|
||
}
|
||
|
||
@Cacheable(key = "#p0")
|
||
@Override
|
||
public CompanyFileVo findById(Integer id) {
|
||
// ...转换为VO对象返回
|
||
return repository.findById(id).map(CompanyFile::toVo).orElse(null);
|
||
}
|
||
// ...
|
||
}
|
||
```
|
||
|
||
### 2. 编译验证
|
||
|
||
修复完成后,通过执行`mvn compile`命令验证了所有修改的Service类编译通过,没有引入新的编译错误。
|
||
|
||
## 结论
|
||
|
||
通过本次修复工作,Contract-Manager项目Server模块中所有64个注解了@CacheConfig的Service类现已完全符合设计规范。所有Service类:
|
||
1. 同时实现了IEntityService、QueryService和VoableService三个接口
|
||
2. QueryService接口的泛型参数正确使用了对应的VO类
|
||
3. findById和findAll方法正确返回VO对象而非实体类
|
||
4. 编译验证通过,确保代码质量
|
||
|
||
这些修复确保了缓存调整为Vo对象的目标顺利实现,统一了Service层的接口实现方式,简化了WebSocket通信处理逻辑,并优化了缓存存储效率。 |