Commit c747cde9 by 春觉晓

修改门店存量分析接口中品类门店计算逻辑

1 parent e05e8a1b
...@@ -338,7 +338,7 @@ public class BusinessSceneAnalysisService { ...@@ -338,7 +338,7 @@ public class BusinessSceneAnalysisService {
// 老店 // 老店
int oldStoreCount = 0; int oldStoreCount = 0;
if (!CollectionUtils.isEmpty(merchantIds)) {// 有产值门店,作为查询条件 if (!CollectionUtils.isEmpty(merchantIds)) {// 有产值门店,作为查询条件
List<BiRecord> biRecords = businessIntelligenceMapper.getBiRecords(biBusinessType, merchantIds, startDate, endDate); List<BiRecord> biRecords = businessIntelligenceMapper.getBiRecords(null, merchantIds, startDate, endDate);
if (!CollectionUtils.isEmpty(biRecords)) { if (!CollectionUtils.isEmpty(biRecords)) {
// 按门店分组 // 按门店分组
Map<Integer, List<BiRecord>> groupedByMerchant = biRecords.stream().collect(Collectors.groupingBy(BiRecord::getMerchantId)); Map<Integer, List<BiRecord>> groupedByMerchant = biRecords.stream().collect(Collectors.groupingBy(BiRecord::getMerchantId));
...@@ -395,7 +395,7 @@ public class BusinessSceneAnalysisService { ...@@ -395,7 +395,7 @@ public class BusinessSceneAnalysisService {
int preStoreCount = preMerchantIds.size(); int preStoreCount = preMerchantIds.size();
BigDecimal countRatio = usedCarDataStatsService.calculateDiv(res.getTotalStores() - preStoreCount, preStoreCount); BigDecimal countRatio = usedCarDataStatsService.calculateDiv(res.getTotalStores() - preStoreCount, preStoreCount);
res.setTotalStoresMom(countRatio); res.setTotalStoresMom(countRatio);
List<BiRecord> biRecords = businessIntelligenceMapper.getBiRecords(biBusinessType, preMerchantIds, req.getPreStartDate(), req.getPreEndDate()); List<BiRecord> biRecords = businessIntelligenceMapper.getBiRecords(null, preMerchantIds, req.getPreStartDate(), req.getPreEndDate());
if (!CollectionUtils.isEmpty(biRecords)) { if (!CollectionUtils.isEmpty(biRecords)) {
// 按门店分组 // 按门店分组
Map<Integer, List<BiRecord>> preGroupedByMerchant = biRecords.stream().collect(Collectors.groupingBy(BiRecord::getMerchantId)); Map<Integer, List<BiRecord>> preGroupedByMerchant = biRecords.stream().collect(Collectors.groupingBy(BiRecord::getMerchantId));
......
  • @wangxw1
    commented
    Master

    Auto Review Result:

    代码审查报告

    问题描述和优化建议

    问题描述

    在 BusinessSceneAnalysisService 类的 businessIntelligenceMapper.getBiRecords 方法调用中,biBusinessType 参数被设置为 null。这可能会影响业务逻辑的正确性,因为 biBusinessType 参数在查询条件中起着关键作用,如果设置为 null,可能会导致查询结果不符合预期,从而影响门店存量分析的结果。

    影响

    • 功能实现的正确性:可能导致查询结果不准确,进而影响门店存量分析的准确性。
    • 安全性:虽然此处没有直接的安全漏洞,但参数错误传递可能导致其他间接的安全问题,例如数据泄露或未授权访问。

    优化建议

    • 检查 biBusinessType 参数是否可以为 null,如果不可以,则需要修复调用处的代码,确保传递正确的业务类型。
    • 如果 biBusinessType 参数可以为 null,则需要确保业务逻辑能够正确处理这种情况,例如添加相应的逻辑判断或默认值处理。

    评分明细

    1. 功能实现的正确性与健壮性(40分):20分。代码存在逻辑问题,可能导致查询结果不准确。
    2. 安全性与潜在风险(30分):25分。虽然此处没有直接的安全漏洞,但参数错误传递可能导致其他间接的安全问题。
    3. 是否符合最佳实践(20分):15分。代码没有遵循最佳实践,参数传递存在硬编码问题。
    4. 性能与资源利用效率(5分):5分。代码没有明显的性能问题。
    5. Commits信息的清晰性与准确性(5分):3分。提交信息不够具体,无法完全理解具体的修改内容。

    总分

    总分:68分


    建议: 请根据上述反馈修改代码,并重新提交详细的 commit 信息,以便更好地理解和维护代码。

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