Merge branch 'v5.8.5' into 'master'
上线合并 See merge request !7
Showing
131 changed files
with
3779 additions
and
439 deletions
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
-
一、关键问题与优化建议(Top 3)
1. 严重:Dubbo RPC 接口向后兼容性破坏(违反重要规则)
-
问题描述:在
rpc-dj-strategy-api(典型的 Dubbo API 包)中,发生了多处破坏向后兼容性的修改:-
MentoringTaskDetailDTO中的mentoringTime字段类型由Date强行修改为了String。 -
MentoringTaskDetailDTO删除了taskStatus、supervisorName字段。 -
MentoringApplicationDetailDTO删除了approvalInfo字段,并直接删除了MentoringApprovalInfoDTO类。
-
-
影响分析:极其危险。根据规则,Dubbo 服务提供者 Remote 接口中的已有参数/返回值变更视为危险实现。强行修改字段类型(
Date->String)会导致旧版本的服务消费者在进行 Hessian/FastJSON 反序列化时直接抛出异常(如ClassCastException或反序列化失败),导致线上调用大面积报错;直接删除类和字段会导致编译失败或NoSuchFieldError。 - 优化建议:API 升级必须遵循“只增不减,兼容旧版”的原则。 ```java // 建议1:保留原字段并标记废弃,新增字段用于新逻辑 @Deprecated @ApiModelProperty(notes = "带教时间(已废弃,请使用 mentoringTimeStr)") private Date mentoringTime;
@ApiModelProperty(notes = "带教时间(字符串格式)") private String mentoringTimeStr;
// 建议2:恢复被删除的 MentoringApprovalInfoDTO 类及字段,标记为 @Deprecated,并在服务端保证即使无数据也不要让旧消费者报错。
**2. 中风险:JSON 序列化时间格式变更引发的潜在解析异常** - **问题描述**:`CollaborativeTaskDetailDTO` 中的 `completedTime` 字段的 `@JsonFormat` 注解,其 `pattern` 从 `"yyyy-MM-dd HH:mm"` 变更为 `"yyyy-MM-dd HH:mm:ss"`。 - **影响分析**:如果前端页面或其他微服务消费者采用了严格的时间字符串截取(例如固定截取前16位)或严格按原格式解析该字段,格式后缀增加了秒数将导致解析失败(如 `ParseException`)或页面显示异常。 - **优化建议**:需全面排查调用方(前端/消费端)对该字段的解析逻辑是否具备包容性。如果无法确定,建议新增一个字段专门返回带秒的时间格式,或者在网关/BFF层做兼容处理。 **3. 建议:新增 Request DTO 缺乏深层次的业务校验** - **问题描述**:新增的 `StrategyDetailPageReqDTO` 中,使用了 `@NotNull` 校验 `startDate` 和 `endDate`,以及 `@NotBlank` 校验 `businessType`。但缺乏对时间区间的逻辑校验,以及对业务类型的枚举校验。 - **影响分析**:非法的参数(如 `startDate` 大于 `endDate`,或 `businessType` 传入了非 "1,2,3" 的非法字符串)会穿透到 Service 层甚至数据库层,造成无效查询或潜在的 SQL 性能问题。 - **优化建议**:使用自定义校验注解或在 Controller/Service 层进行防御性编程。 ```java // 建议对 businessType 增加正则校验或枚举校验 @NotBlank(message = "业务类型不能为空") @Pattern(regexp = "^[123]$", message = "业务类型只能为1(延保)、2(轻改)或3(权益)") private String businessType; // 并在业务入口处校验 startDate.before(endDate)
二、评分明细
功能实现的正确性与健壮性(26/40分): 扣分主要在于 API 包中 DTO 字段类型的直接修改(
Date改String)。在分布式 RPC 架构中,这种改动会导致消费者反序列化失败,严重破坏了系统功能的正确性与向下兼容性。安全性与潜在风险(20/30分): 未发现 SQL 注入(本次无 MyBatis SQL 变更,无子查询违规)或越权等传统安全漏洞。但直接删除 RPC 依赖的类和字段属于极高风险的发布行为,极易引发线上生产事故,因此扣除一定分数。
最佳实践与可维护性(15/20分): 代码整体结构清晰,Swagger 注解完备,新增的 DTO 命名规范。但违反了 API 演进的最佳实践(Open-Closed Principle),未采用
@Deprecated平滑过渡的方式。性能与资源利用(5/5分): 从 DTO 结构来看,没有发现会导致内存泄漏或过度反序列化嵌套的性能瓶颈问题。
提交信息质量(5/5分): Commit 记录非常优秀。遵循了
feat/fix/refactor规范,详细描述了修改的背景、目的及具体实现逻辑,具备极高的可追溯性。
总分:71分
-
问题描述:在
-
Please register or sign in to post a comment