Commit 41819e38 by 林永健

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

2 parents 3c10778e ea0c0b27
......@@ -18,6 +18,9 @@ public class StoreSceneSummaryResponse implements Serializable {
@ApiModelProperty(notes = "总开单门店数")
private Integer totalStores;
@ApiModelProperty(notes = "总开单门店商户号")
private List<Integer> totalStoreIds;
@ApiModelProperty(notes = "总开单门店环比")
private BigDecimal totalStoresMom;
......
......@@ -129,4 +129,8 @@ public interface BusinessIntelligenceMapper {
List<TrendChartRes> countUsedCarMerchants(@Param("statDateList") List<Pair<String, String>> statDateList, @Param("merchantIds") List<Integer> merchantIds);
List<Integer> getZyMerchantIds(@Param("property") String property);
//统计兜底门店数量
Integer countBackUpStores(@Param("merchantIds") List<Integer> merchantIds, @Param("businessType") Integer businessType
, @Param("startDate") String startDate, @Param("endDate") String endDate);
}
\ No newline at end of file
......@@ -23,4 +23,6 @@ public interface ServiceMerchantMapper extends OreMapper<ServiceMerchant> {
List<StoreSettingDTO> findStoreSetting(@Param("merchantIds") List<Integer> merchantIds, @Param("scene") Integer scene);
List<StoreInfo> findYydList(@Param("list") List<Integer> collected);
}
\ No newline at end of file
......@@ -787,5 +787,35 @@
AND t1.deleted_flag = 'N'
</select>
<select id="countBackUpStores" resultType="java.lang.Integer">
SELECT count(distinct merchant_id4s)
FROM early_warning_msg t1
left join early_warning_rule t2 on t1.rule_id =t2.id
WHERE t1.deleted_flag = 'N' and t2.rule_type ='兜底指标'
<choose>
<when test="businessType == 1">
and t1.business_type = 4
</when>
<when test="businessType == 2">
and t1.business_type = 2
</when>
<otherwise>
and t1.business_type = 3
</otherwise>
</choose>
<if test="merchantIds != null and merchantIds.size() > 0">
and t1.merchant_id4s in
<foreach item="item" index="index" collection="merchantIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="startDate != null and startDate != null">
and t1.star_date &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != null">
and t1.star_date &lt;= #{endDate}
</if>
</select>
</mapper>
\ No newline at end of file
package cn.com.glsx.dj.peanalysis.service;
import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq;
import cn.com.glsx.dj.peanalysis.dto.res.output.StoreSceneSummaryResponse;
import cn.com.glsx.dj.peanalysis.remote.BaseRemoteTest;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -171,4 +173,16 @@ public class BusinessSceneAnalysisServiceTest extends BaseRemoteTest {
Object res = service.goodsSummary(req);
System.out.println(res);
}
@Test
public void testStoreAnalysis() {
SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(5);
req.setStartTime("2025-01-01");
req.setEndTime("2025-12-31");
req.setMerchantIds(Lists.newArrayList(44217664));
StoreSceneSummaryResponse res = service.storeAnalysis(req);
System.out.println(JSON.toJSONString(res));
}
}
  • @wangxw1
    commented
    Master

    Auto Review Result:

    代码审查报告

    问题描述和优化建议

    1. 功能实现的正确性与健壮性

    • 问题描述:

      • 新增的startTime和endTime字段虽然有API文档注解,但缺少对这两个字段的任何验证或处理逻辑。如果这些字段在业务逻辑中是必需的,没有相应的校验可能会导致数据不一致的问题。
      • serialVersionUID被设置为-1,通常情况下,serialVersionUID应该是一个唯一且稳定的值,以便在序列化和反序列化过程中保持兼容性。
    • 优化建议:

      • 增加对startTime和endTime字段的校验逻辑,确保它们符合预期的时间格式(例如,使用LocalDateTime或Date类型来替代String类型,并增加必要的校验)。
      • 为serialVersionUID生成一个唯一的、稳定的值,可以通过IDE自动生成。

    2. 安全性与潜在风险

    • 问题描述:

      • 当前代码片段没有直接的安全风险,但需要注意的是,如果startTime和endTime字段将来用于数据库查询或其他外部交互,需要确保它们经过适当的清理和验证,以防止SQL注入等安全问题。
    • 优化建议:

      • 在处理这些字段时,确保它们经过适当的清理和验证,特别是在用于数据库查询时,应使用参数化查询来防止SQL注入。

    3. 是否符合最佳实践

    • 问题描述:

      • 引入了@ToString和@Accessors(chain = true)注解,这增加了对象的可打印性和链式调用能力,但同时也可能引入不必要的复杂性,特别是当对象的属性较多时。
      • 使用String类型来存储时间信息并不是最佳实践,建议使用更合适的时间类型,如LocalDateTime。
    • 优化建议:

      • 仅在确实需要链式调用的情况下使用@Accessors(chain = true),否则可以避免使用以简化代码。
      • 考虑将startTime和endTime字段的数据类型从String改为LocalDateTime,以提高代码的可读性和安全性。

    4. 性能与资源利用效率

    • 问题描述:

      • 当前代码片段对性能和资源利用没有明显的影响,但如果toString方法被频繁调用,可能会带来一定的性能开销。
    • 优化建议:

      • 如果toString方法不常使用,可以考虑移除@ToString注解以减少不必要的性能开销。
      • 确保在生产环境中,toString方法的调用不会成为性能瓶颈。

    5. Commits信息的清晰性与准确性

    • 问题描述:

      • 提交信息“refactor(api): 优化请求和响应类结构”较为模糊,没有具体说明优化了哪些方面。
      • 合并分支的信息“Merge remote-tracking branch 'origin/v5.5.1' into v5.5.1”是正常的合并操作记录,但与具体的代码变更不相关。
    • 优化建议:

      • 提供更详细的提交信息,说明具体优化了哪些方面,例如:“refactor(api): 添加startTime和endTime字段并改进TrendOutputResponse类的结构”。

    评分明细

    1. 功能实现的正确性与健壮性:30/40分
    2. 安全性与潜在风险:25/30分
    3. 是否符合最佳实践:15/20分
    4. 性能与资源利用效率:4/5分
    5. Commits信息的清晰性与准确性:3/5分

    总分:92分

    注: 此次审查主要针对代码变更内容,未涉及其他可能存在的问题。建议在后续开发中持续关注这些问题,并遵循最佳实践以提高代码质量。

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