Skip to content
  • Projects
  • Groups
  • Snippets
  • Help

dj / rpc-smartcarlife

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Merged
Merge Request !58 opened Oct 28, 2026 by 叶立庆@yelq

上线合并

v5.8.7.1发起合并请求到master分支

Edited Oct 28, 2026
Request to merge v5.8.7.1 into master
×

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b v5.8.7.1 origin/v5.8.7.1

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git checkout master
git merge --no-ff v5.8.7.1

Step 4. Push the result of the merge to GitLab

git push origin master

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

Merged by 叶立庆 Oct 28, 2026

  • The changes were merged into master.
  • Discussion 1
  • Commits 1
  • Changes 1
  • {{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • 2641f1b3da612f8e5cf4541059e216a6?s=80&d=identicon
    Toggle discussion
    王欣伟
    @wangxw1 started a discussion on commit be69857e Oct 28, 2026
    • @wangxw1 王欣伟
      @wangxw1 commented Oct 28, 2026
      Master

      一、关键问题与优化建议(仅限 Top 3)

      1. 潜在的空指针异常(NPE)风险或非预期的 Null 值传递

      • 问题描述:在原代码中,计算 djGrossProfit 时对所有的参与计算的变量都使用了 Optional.ofNullable(...).orElse(BigDecimal.ZERO) 进行严格的判空兜底。修改后,直接调用 product.getDjGrossProfit() 赋值给 productDTO。如果上游数据未能保证 product.getDjGrossProfit() 绝对不为 null,则 productDTO 的该属性将被赋为 null。
      • 影响分析:如果下游逻辑(或前端展示、数据库入库)依赖该字段为具体数值(如进行后续的 BigDecimal 数学运算),传入 null 将直接引发 NullPointerException,导致核心业务流程中断。
      • 优化建议:建议保留对空值的防御性编程习惯,确保赋值的健壮性。

      代码示例:

      // 建议增加判空兜底,保持与原逻辑一致的健壮性
      productDTO.setDjGrossProfit(Optional.ofNullable(product.getDjGrossProfit()).orElse(BigDecimal.ZERO));
      

      二、评分明细

      • 功能实现的正确性与健壮性(35/40分):
        • 理由:消除了重复计算逻辑,复用已有字段,方向正确。但移除了原有的空值防御机制,存在一定的边缘场景风险(若上游未赋值则可能引发 NPE),故扣除 5 分。未发现违反 MyBatis 子查询和 Dubbo 接口变更的强制规则。
      • 安全性与潜在风险(30/30分):
        • 理由:本次变更为纯内存对象的属性赋值调整,不涉及外部输入解析、数据库查询及权限校验,无 SQL 注入、XSS 或越权等安全隐患。
      • 最佳实践与可维护性(20/20分):
        • 理由:符合 DRY(Don't Repeat Yourself)原则,将散落的计算逻辑收口到上游或对象内部,提高了代码的可读性和可维护性。
      • 性能与资源利用(5/5分):
        • 理由:移除了多次多余的 BigDecimal 实例化和减法运算,对性能有极其微小的正面提升,无资源浪费。
      • 提交信息质量(5/5分):
        • 理由:Commit 信息“测算上架表中的利润率直接使用已经计算出来的数据,不再重新计算”清晰准确地描述了修改的动机和内容,具有良好的可追溯性。

      总分:95分

  • @yelq 叶立庆
    @yelq

    merged

    Oct 28, 2026

    merged

    Toggle commit list
  • @yelq 叶立庆
    @yelq

    mentioned in commit ef493c16

    Oct 28, 2026

    mentioned in commit ef493c16

    Toggle commit list
  • Write
  • Preview
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
  • Please register or sign in to post a comment
叶立庆
Assignee
叶立庆 @yelq
Assign to
None
Milestone
None
Assign milestone
Time tracking
1
1 participant
Reference: dj/rpc-smartcarlife!58
×

Revert this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.
×

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.