Commit 75ec5bdd by 林永健

Merge remote-tracking branch 'origin/v5.5.1' into v5.5.1

2 parents cb6e0f04 fb64629b
...@@ -41,7 +41,10 @@ public enum BiErrorEnum implements ErrorEnum { ...@@ -41,7 +41,10 @@ public enum BiErrorEnum implements ErrorEnum {
SEND_MESSAGE_ERROR("10000012", "发送消息失败!"), SEND_MESSAGE_ERROR("10000012", "发送消息失败!"),
BI_MATTER_OPERATOR_NOT_EMPTY("10000013", "线上运营与区域运营不能同时为空!"); BI_MATTER_OPERATOR_NOT_EMPTY("10000013", "线上运营与区域运营不能同时为空!"),
MERCHANT_BI_MATTER_DELETED("10000014", "事项已删除,无法处理!"),
;
......
...@@ -534,6 +534,10 @@ public class BiAnalyseBackgroundService { ...@@ -534,6 +534,10 @@ public class BiAnalyseBackgroundService {
MerchantBiMatter merchantBiMatter = Optional.ofNullable(merchantBiMatterMapper.selectByPrimaryKey(request.getId())) MerchantBiMatter merchantBiMatter = Optional.ofNullable(merchantBiMatterMapper.selectByPrimaryKey(request.getId()))
.orElseThrow(() -> new RpcServiceException(BiErrorEnum.MERCHANT_BI_MATTER_NOT_EXIST)); .orElseThrow(() -> new RpcServiceException(BiErrorEnum.MERCHANT_BI_MATTER_NOT_EXIST));
if (BaseModel.DeletedFlagEnum.D.name().equals(merchantBiMatter.getDeletedFlag())) {
throw new RpcServiceException(BiErrorEnum.MERCHANT_BI_MATTER_DELETED);
}
Integer status = Optional.ofNullable(merchantBiMatter.getStatus()).orElse(MerchantBiMatterStatusEnum.WAIT_PROCESS.getCode()); Integer status = Optional.ofNullable(merchantBiMatter.getStatus()).orElse(MerchantBiMatterStatusEnum.WAIT_PROCESS.getCode());
if (MerchantBiMatterStatusEnum.PROCESSED.getCode().compareTo(status) == 0) { if (MerchantBiMatterStatusEnum.PROCESSED.getCode().compareTo(status) == 0) {
throw new RpcServiceException(BiErrorEnum.BI_MATTER_HANDLED); throw new RpcServiceException(BiErrorEnum.BI_MATTER_HANDLED);
......
  • @wangxw1
    commented
    Master

    Auto Review Result:

    代码审查报告

    问题描述和优化建议

    1. 生态系数阈值调整

    问题描述: 在 GoodsCategorySummaryResponse 类中,生态系数的阈值从 BigDecimal("0.6") 变更为 BigDecimal("60"),这将导致比较逻辑出现错误。例如,原本 x >= 0.6 的条件将变成 x >= 60,这显然不是预期的行为。

    优化建议: 恢复阈值的小数形式,确保比较逻辑正确。

    BigDecimal[] thresholds = {
        new BigDecimal("0.6"), new BigDecimal("1.2"),  // x>=0.6:1.2
        new BigDecimal("0.5"), new BigDecimal("1.0"),  // 0.5<=x<0.6:1.0
        new BigDecimal("0.4"), new BigDecimal("0.8"),  // 0.4<=x<0.5:0.8
        new BigDecimal("0.3"), new BigDecimal("0.6")   // 0.3<=x<0.4:0.6
    };
    

    2. 指标赋值逻辑中的字段名称错误

    问题描述: 在 GoodsCategorySummaryResponse 类中,computeWindowFilmEcoCoefficient、computeCarBodyFilmEcoCoefficient 和 computeAccessoriesEcoCoefficient 方法中,使用的字段名称不正确,例如 windowFilmPenetrationRate 应该是 windowFilmPerCarOutput。

    优化建议: 确保使用的字段名称与实际需要的字段一致。

    if (this.windowFilmPerCarOutput == null) {
        return;
    }
    // ...
    this.windowFilmEcoCoefficient = computeEcoCoefficient(this.windowFilmPerCarOutput, thresholds, BigDecimal.ZERO);
    

    3. 提交信息的清晰性与准确性

    问题描述: 提交信息中提到“生态系数阈值调整,区间阈值由小数改为整数”,但实际上阈值并未改为整数,而是错误地将小数改为大整数。

    优化建议: 确保提交信息准确反映所做的更改,避免误导其他开发者。

    refactor(peanalysis): 优化百分比处理及生态系数计算逻辑
    
    - 新增 convertPercentage 方法统一数值转百分比处理
    - 调整指标赋值逻辑,统一调用 convertPercentage 函数转换百分比值
    - 修正环比计算逻辑,移除无效的空值判断,确保计算准确
    - 将部分指标求平均时乘以100,修正统计结果的单位
    - 生态系数阈值调整,确保比较逻辑正确
    - 修正车窗膜、车身膜、精品附件生态系数计算,改为使用产值字段
    - 增加车窗膜、车身膜、精品附件生态系数计算调用,保证数据完整性
    

    评分明细

    1. 功能实现的正确性与健壮性(40分):

      • 代码逻辑存在错误,需要修正阈值和字段名称问题。
      • 分数: 20分
    2. 安全性与潜在风险(30分):

      • 代码未涉及直接的安全风险,但需注意逻辑错误可能导致的数据不一致。
      • 分数: 30分
    3. 是否符合最佳实践(20分):

      • 新增 convertPercentage 方法有助于代码复用和可读性。
      • 分数: 15分
    4. 性能与资源利用效率(5分):

      • 代码未明显存在性能瓶颈。
      • 分数: 5分
    5. Commits信息的清晰性与准确性(5分):

      • 提交信息不够准确,需修正。
      • 分数: 2分

    总分

    总分: 72分


    通过以上分析,可以看出代码在功能实现上存在一些问题,但整体上遵循了一定的最佳实践。建议根据上述优化建议进行修改,以提高代码的质量和可靠性。

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!