Commit 50bafe19 by 杨卫

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

2 parents d392f7f1 abf35509
...@@ -19,13 +19,13 @@ public class EmployeeDetailSummaryResponse implements Serializable { ...@@ -19,13 +19,13 @@ public class EmployeeDetailSummaryResponse implements Serializable {
private BigDecimal totalOutputValue; private BigDecimal totalOutputValue;
@ApiModelProperty(notes = "总产值环比") @ApiModelProperty(notes = "总产值环比")
private BigDecimal totalOutputValueMom; private String totalOutputValueMom;
@ApiModelProperty(notes = "客单价") @ApiModelProperty(notes = "客单价")
private BigDecimal avgCustomerPrice; private BigDecimal avgCustomerPrice;
@ApiModelProperty(notes = "客单价环比") @ApiModelProperty(notes = "客单价环比")
private BigDecimal avgCustomerPriceMom; private String avgCustomerPriceMom;
@ApiModelProperty(notes = "日报完成率") @ApiModelProperty(notes = "日报完成率")
private BigDecimal dailyReportCompletionRate; private BigDecimal dailyReportCompletionRate;
...@@ -34,54 +34,54 @@ public class EmployeeDetailSummaryResponse implements Serializable { ...@@ -34,54 +34,54 @@ public class EmployeeDetailSummaryResponse implements Serializable {
private BigDecimal preSalesContactCount; private BigDecimal preSalesContactCount;
@ApiModelProperty(notes = "售前触客数环比") @ApiModelProperty(notes = "售前触客数环比")
private BigDecimal preSalesContactCountMom; private String preSalesContactCountMom;
@ApiModelProperty(notes = "售后触客数") @ApiModelProperty(notes = "售后触客数")
private BigDecimal afterSalesContactCount; private BigDecimal afterSalesContactCount;
@ApiModelProperty(notes = "售后触客数环比") @ApiModelProperty(notes = "售后触客数环比")
private BigDecimal afterSalesContactCountMom; private String afterSalesContactCountMom;
@ApiModelProperty(notes = "总触客数") @ApiModelProperty(notes = "总触客数")
private BigDecimal totalContactCount; private BigDecimal totalContactCount;
@ApiModelProperty(notes = "总触客数环比") @ApiModelProperty(notes = "总触客数环比")
private BigDecimal totalContactCountMom; private String totalContactCountMom;
@ApiModelProperty(notes = "售前成交数") @ApiModelProperty(notes = "售前成交数")
private BigDecimal preSalesDealCount; private BigDecimal preSalesDealCount;
@ApiModelProperty(notes = "售前成交数环比") @ApiModelProperty(notes = "售前成交数环比")
private BigDecimal preSalesDealCountMom; private String preSalesDealCountMom;
@ApiModelProperty(notes = "售后成交数") @ApiModelProperty(notes = "售后成交数")
private BigDecimal afterSalesDealCount; private BigDecimal afterSalesDealCount;
@ApiModelProperty(notes = "售后成交数环比") @ApiModelProperty(notes = "售后成交数环比")
private BigDecimal afterSalesDealCountMom; private String afterSalesDealCountMom;
@ApiModelProperty(notes = "总成交数") @ApiModelProperty(notes = "总成交数")
private BigDecimal totalDealCount; private BigDecimal totalDealCount;
@ApiModelProperty(notes = "总成交数环比") @ApiModelProperty(notes = "总成交数环比")
private BigDecimal totalDealCountMom; private String totalDealCountMom;
@ApiModelProperty(notes = "售前转化率") @ApiModelProperty(notes = "售前转化率")
private BigDecimal preSalesConversionRate; private BigDecimal preSalesConversionRate;
@ApiModelProperty(notes = "售前转化率环比") @ApiModelProperty(notes = "售前转化率环比")
private BigDecimal preSalesConversionRateMom; private String preSalesConversionRateMom;
@ApiModelProperty(notes = "售后转化率") @ApiModelProperty(notes = "售后转化率")
private BigDecimal afterSalesConversionRate; private BigDecimal afterSalesConversionRate;
@ApiModelProperty(notes = "售后转化率环比") @ApiModelProperty(notes = "售后转化率环比")
private BigDecimal afterSalesConversionRateMom; private String afterSalesConversionRateMom;
@ApiModelProperty(notes = "转化率") @ApiModelProperty(notes = "转化率")
private BigDecimal conversionRate; private BigDecimal conversionRate;
@ApiModelProperty(notes = "转化率环比") @ApiModelProperty(notes = "转化率环比")
private BigDecimal conversionRateMom; private String conversionRateMom;
} }
...@@ -45,7 +45,7 @@ public class StoreDetailSummaryResponse implements Serializable { ...@@ -45,7 +45,7 @@ public class StoreDetailSummaryResponse implements Serializable {
private BigDecimal totalOutputValue; private BigDecimal totalOutputValue;
@ApiModelProperty(notes = "总产值环比") @ApiModelProperty(notes = "总产值环比")
private BigDecimal totalOutputValueMom; private String totalOutputValueMom;
@ApiModelProperty(notes = "目标产值(仅月周期展示)") @ApiModelProperty(notes = "目标产值(仅月周期展示)")
private BigDecimal targetOutputValue; private BigDecimal targetOutputValue;
...@@ -57,72 +57,72 @@ public class StoreDetailSummaryResponse implements Serializable { ...@@ -57,72 +57,72 @@ public class StoreDetailSummaryResponse implements Serializable {
private BigDecimal newCarDeliveryCount; private BigDecimal newCarDeliveryCount;
@ApiModelProperty(notes = "新车交付数环比") @ApiModelProperty(notes = "新车交付数环比")
private BigDecimal newCarDeliveryCountMom; private String newCarDeliveryCountMom;
@ApiModelProperty(notes = "售前触客数") @ApiModelProperty(notes = "售前触客数")
private BigDecimal preSalesContactCount; private BigDecimal preSalesContactCount;
@ApiModelProperty(notes = "售前触客数环比") @ApiModelProperty(notes = "售前触客数环比")
private BigDecimal preSalesContactCountMom; private String preSalesContactCountMom;
@ApiModelProperty(notes = "售后触客数") @ApiModelProperty(notes = "售后触客数")
private BigDecimal afterSalesContactCount; private BigDecimal afterSalesContactCount;
@ApiModelProperty(notes = "售后触客数环比") @ApiModelProperty(notes = "售后触客数环比")
private BigDecimal afterSalesContactCountMom; private String afterSalesContactCountMom;
@ApiModelProperty(notes = "总触客数") @ApiModelProperty(notes = "总触客数")
private BigDecimal totalContactCount; private BigDecimal totalContactCount;
@ApiModelProperty(notes = "总触客数环比") @ApiModelProperty(notes = "总触客数环比")
private BigDecimal totalContactCountMom; private String totalContactCountMom;
@ApiModelProperty(notes = "触客率") @ApiModelProperty(notes = "触客率")
private BigDecimal contactRate; private BigDecimal contactRate;
@ApiModelProperty(notes = "触客率环比") @ApiModelProperty(notes = "触客率环比")
private BigDecimal contactRateMom; private String contactRateMom;
@ApiModelProperty(notes = "售前成交数") @ApiModelProperty(notes = "售前成交数")
private BigDecimal preSalesDealCount; private BigDecimal preSalesDealCount;
@ApiModelProperty(notes = "售前成交数环比") @ApiModelProperty(notes = "售前成交数环比")
private BigDecimal preSalesDealCountMom; private String preSalesDealCountMom;
@ApiModelProperty(notes = "售后成交数") @ApiModelProperty(notes = "售后成交数")
private BigDecimal afterSalesDealCount; private BigDecimal afterSalesDealCount;
@ApiModelProperty(notes = "售后成交数环比") @ApiModelProperty(notes = "售后成交数环比")
private BigDecimal afterSalesDealCountMom; private String afterSalesDealCountMom;
@ApiModelProperty(notes = "总成交数") @ApiModelProperty(notes = "总成交数")
private BigDecimal totalDealCount; private BigDecimal totalDealCount;
@ApiModelProperty(notes = "总成交数环比") @ApiModelProperty(notes = "总成交数环比")
private BigDecimal totalDealCountMom; private String totalDealCountMom;
@ApiModelProperty(notes = "售前转化率") @ApiModelProperty(notes = "售前转化率")
private BigDecimal preSalesConversionRate; private BigDecimal preSalesConversionRate;
@ApiModelProperty(notes = "售前转化率环比") @ApiModelProperty(notes = "售前转化率环比")
private BigDecimal preSalesConversionRateMom; private String preSalesConversionRateMom;
@ApiModelProperty(notes = "售后转化率") @ApiModelProperty(notes = "售后转化率")
private BigDecimal afterSalesConversionRate; private BigDecimal afterSalesConversionRate;
@ApiModelProperty(notes = "售后转化率环比") @ApiModelProperty(notes = "售后转化率环比")
private BigDecimal afterSalesConversionRateMom; private String afterSalesConversionRateMom;
@ApiModelProperty(notes = "转化率") @ApiModelProperty(notes = "转化率")
private BigDecimal conversionRate; private BigDecimal conversionRate;
@ApiModelProperty(notes = "转化率环比") @ApiModelProperty(notes = "转化率环比")
private BigDecimal conversionRateMom; private String conversionRateMom;
@ApiModelProperty(notes = "渗透率") @ApiModelProperty(notes = "渗透率")
private BigDecimal penetrationRate; private BigDecimal penetrationRate;
@ApiModelProperty(notes = "渗透率环比") @ApiModelProperty(notes = "渗透率环比")
private BigDecimal penetrationRateMom; private String penetrationRateMom;
} }
...@@ -12,5 +12,8 @@ import java.util.List; ...@@ -12,5 +12,8 @@ import java.util.List;
public interface GoodsOrderMapper extends OreMapper<GoodsOrder> { public interface GoodsOrderMapper extends OreMapper<GoodsOrder> {
List<TrafficContributionRankResponse> findTrafficRank(@Param("staffUuids") List<String> staffUuids, @Param("scene") Integer sceneType); List<TrafficContributionRankResponse> findTrafficRank(
@Param("merchantIds") List<Integer> merchantIds,
@Param("staffUuids") List<String> staffUuids,
@Param("scene") Integer sceneType);
} }
\ No newline at end of file \ No newline at end of file
...@@ -155,6 +155,12 @@ ...@@ -155,6 +155,12 @@
deleted_flag = 'N' deleted_flag = 'N'
and user_id is not null and user_id is not null
and status in (2, 4, 6) and status in (2, 4, 6)
<if test="merchantIds != null and merchantIds.size() > 0">
and merchant_id in
<foreach collection="merchantIds" item="uuid" open="(" close=")" separator=",">
#{uuid}
</foreach>
</if>
<if test="staffUuids != null and staffUuids.size() > 0"> <if test="staffUuids != null and staffUuids.size() > 0">
and user_id in and user_id in
<foreach collection="staffUuids" item="uuid" open="(" close=")" separator=","> <foreach collection="staffUuids" item="uuid" open="(" close=")" separator=",">
......
...@@ -110,6 +110,11 @@ public class BusinessSceneAnalysisServiceTest extends BaseRemoteTest { ...@@ -110,6 +110,11 @@ public class BusinessSceneAnalysisServiceTest extends BaseRemoteTest {
@Test @Test
public void storeDetailSummary() { public void storeDetailSummary() {
SceneBaseReq req = new SceneBaseReq(); SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
Object res = service.storeDetailSummary(req); Object res = service.storeDetailSummary(req);
System.out.println(res); System.out.println(res);
} }
...@@ -117,6 +122,11 @@ public class BusinessSceneAnalysisServiceTest extends BaseRemoteTest { ...@@ -117,6 +122,11 @@ public class BusinessSceneAnalysisServiceTest extends BaseRemoteTest {
@Test @Test
public void storeEmployeeRank() { public void storeEmployeeRank() {
SceneBaseReq req = new SceneBaseReq(); SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
Object res = service.storeEmployeeRank(req); Object res = service.storeEmployeeRank(req);
System.out.println(res); System.out.println(res);
} }
...@@ -124,6 +134,12 @@ public class BusinessSceneAnalysisServiceTest extends BaseRemoteTest { ...@@ -124,6 +134,12 @@ public class BusinessSceneAnalysisServiceTest extends BaseRemoteTest {
@Test @Test
public void storeTrafficRank() { public void storeTrafficRank() {
SceneBaseReq req = new SceneBaseReq(); SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
req.setStaffUuids(Lists.newArrayList());
Object res = service.storeTrafficRank(req); Object res = service.storeTrafficRank(req);
System.out.println(res); System.out.println(res);
} }
...@@ -131,6 +147,12 @@ public class BusinessSceneAnalysisServiceTest extends BaseRemoteTest { ...@@ -131,6 +147,12 @@ public class BusinessSceneAnalysisServiceTest extends BaseRemoteTest {
@Test @Test
public void storeEmployeeSummary() { public void storeEmployeeSummary() {
SceneBaseReq req = new SceneBaseReq(); SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
req.setStaffUuids(Lists.newArrayList());
Object res = service.storeEmployeeSummary(req); Object res = service.storeEmployeeSummary(req);
System.out.println(res); System.out.println(res);
} }
...@@ -138,6 +160,12 @@ public class BusinessSceneAnalysisServiceTest extends BaseRemoteTest { ...@@ -138,6 +160,12 @@ public class BusinessSceneAnalysisServiceTest extends BaseRemoteTest {
@Test @Test
public void goodsSummary() { public void goodsSummary() {
SceneBaseReq req = new SceneBaseReq(); SceneBaseReq req = new SceneBaseReq();
req.setBizs(2);
req.setCycleType(2);
req.setStartTime("2025-02-01");
req.setEndTime("2025-11-31");
req.setMerchantIds(Lists.newArrayList());
req.setStaffUuids(Lists.newArrayList());
Object res = service.goodsSummary(req); Object res = service.goodsSummary(req);
System.out.println(res); System.out.println(res);
} }
......
  • @wangxw1
    commented
    Master

    Auto Review Result:

    代码审查报告

    问题描述和优化建议

    文件: MerchantProfitRecordImportDTO.java

    问题:

    • 将Map改为LinkedHashMap可能会影响内存使用和性能,因为LinkedHashMap会维护元素插入顺序,而普通Map(通常是HashMap)不保证顺序,但通常在性能上更好。

    优化建议:

    • 如果不需要维护插入顺序,建议保留Map。如果确实需要保持顺序,可以保留LinkedHashMap,但应确保这是必要的,并且理解其带来的额外开销。

    文件: BiAnalyseBackgroundService.java

    问题:

    1. 空值检查:

      • 在处理storeId时,多次进行了空值检查。虽然这些检查是有必要的,但可以考虑将这些检查提取到一个单独的方法中以提高代码的可读性和可维护性。
    2. 重复代码:

      • 对于storeId, businessType, 和 monthYear的空值检查在多个地方重复出现。这可以通过创建一个方法来封装这些检查,减少代码冗余。
    3. 错误信息:

      • 错误信息直接硬编码在代码中。为了国际化支持和更好的维护性,建议将错误信息提取到配置文件中。
    4. 分区收集器:

      • 在分区收集器中,使用了MapUtil.newHashMap(true)来初始化映射。这里true参数没有明确的含义,应该确保它的作用是预期的。如果只是想创建一个普通的HashMap,可以直接使用Collectors.toMap()的默认行为。

    优化建议:

    • 提取空值检查和重复逻辑到单独的方法中。
    • 将错误信息移到配置文件中。
    • 确认并解释MapUtil.newHashMap(true)的作用。

    评分明细

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

      • 代码逻辑基本正确,但是存在一些冗余的空值检查和硬编码的错误信息。这些小问题不会导致严重的功能故障,但会影响代码的可维护性。评分: 35分
    2. 安全性与潜在风险(30分):

      • 代码中没有明显的安全漏洞,如SQL注入、XSS攻击等。但是,由于缺少对用户输入的有效验证和过滤,可能存在潜在的安全风险。评分: 25分
    3. 是否符合最佳实践(20分):

      • 代码结构良好,使用了Lombok注解简化了getter和setter方法的编写。但是,存在一些重复代码和硬编码的错误信息,不符合最佳实践。评分: 15分
    4. 性能与资源利用效率(5分):

      • 代码中使用了LinkedHashMap可能会带来额外的性能开销。如果不需要保持元素插入顺序,建议使用普通的HashMap。评分: 3分
    5. Commits信息的清晰性与准确性(5分):

      • 提交信息不够详细,只提到了“导入代码优化”,没有具体说明优化的内容。评分: 2分

    总分: 80分

    通过以上优化建议,可以进一步提升代码的质量,提高其可维护性和安全性。

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