Commit f84d5e5b by 春觉晓

添加策略信息中心接口定义

1 parent 6d1214d1
...@@ -95,6 +95,13 @@ public class SceneBaseReq implements Serializable { ...@@ -95,6 +95,13 @@ public class SceneBaseReq implements Serializable {
@ApiModelProperty(notes = "查询类型") @ApiModelProperty(notes = "查询类型")
private int queryType; private int queryType;
@ApiModelProperty(notes = "驻店员工ID")
private String staffId;
@ApiModelProperty(notes = "驻店员工手机号")
private String staffPhone;
// 是否跳过产值商户提前过滤步骤
private boolean skipFlag;
/** /**
* 权限角色 * 权限角色
*/ */
......
package cn.com.glsx.dj.peanalysis.dto.strategy;
import cn.com.glsx.dj.peanalysis.dto.res.output.GoodsCategorySummaryResponse;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class GoodsCategorySummaryWithWarn implements Serializable {
@ApiModelProperty(notes = "品类信息")
private GoodsCategorySummaryResponse summaryResponse;
@ApiModelProperty(notes = "警告信息")
private List<WarningInfo> warningInfoList;
}
package cn.com.glsx.dj.peanalysis.dto.strategy;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class StaffAnalysisDTO implements Serializable {
@ApiModelProperty(notes = "员工姓名")
private String staffName;
@ApiModelProperty(notes = "员工手机号")
private String staffPhone;
@ApiModelProperty(notes = "员工ID")
private String staffId;
@ApiModelProperty(notes = "员工状态(D:已删除;N:未删除 I :禁用)")
private String staffStatus;
// private Integer tempFlag;
@ApiModelProperty(notes = "警告信息列表")
private List<WarningInfo> warningInfoList;
}
package cn.com.glsx.dj.peanalysis.dto.strategy;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class StaffSummaryDTO implements Serializable {
@ApiModelProperty(value = "驻店时长")
private Integer stayDuration;
@ApiModelProperty(value = "学习时长")
private BigDecimal studyDuration;
@ApiModelProperty(value = "学习率")
private BigDecimal studyRate;
}
package cn.com.glsx.dj.peanalysis.dto.strategy;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class WarningInfo implements Serializable {
@ApiModelProperty(notes = "警告类型")
private Integer warningType;
private String warningContent;
}
...@@ -4,6 +4,9 @@ package cn.com.glsx.dj.peanalysis.remote; ...@@ -4,6 +4,9 @@ package cn.com.glsx.dj.peanalysis.remote;
import cn.com.glsx.dj.peanalysis.dto.job.BiRecord; import cn.com.glsx.dj.peanalysis.dto.job.BiRecord;
import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq; import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq;
import cn.com.glsx.dj.peanalysis.dto.res.output.*; import cn.com.glsx.dj.peanalysis.dto.res.output.*;
import cn.com.glsx.dj.peanalysis.dto.strategy.GoodsCategorySummaryWithWarn;
import cn.com.glsx.dj.peanalysis.dto.strategy.StaffAnalysisDTO;
import cn.com.glsx.dj.peanalysis.dto.strategy.StaffSummaryDTO;
import cn.com.glsx.framework.core.annotation.ApiMethod; import cn.com.glsx.framework.core.annotation.ApiMethod;
import cn.com.glsx.framework.core.annotation.ApiService; import cn.com.glsx.framework.core.annotation.ApiService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
...@@ -60,4 +63,14 @@ public interface BusinessSceneAnalysisRemote { ...@@ -60,4 +63,14 @@ public interface BusinessSceneAnalysisRemote {
@ApiMethod("查询BI统计信息中的门店") @ApiMethod("查询BI统计信息中的门店")
RpcResponse<List<BiRecord>> getBiRecords(Integer businessType, List<Integer> merchantIds, String startDate, String endDate); RpcResponse<List<BiRecord>> getBiRecords(Integer businessType, List<Integer> merchantIds, String startDate, String endDate);
@ApiMethod("查询驻店员工列表")
RpcResponse<List<StaffAnalysisDTO>> listStaffAnalysis(SceneBaseReq req);
@ApiMethod("查询驻店员工时长")
RpcResponse<StaffSummaryDTO> summaryStaffDuration(SceneBaseReq req);
@ApiMethod("策略中心-门店商品品类分析")
RpcResponse<GoodsCategorySummaryWithWarn> merchantGoodsSummaryWithWarm(SceneBaseReq req);
} }
...@@ -3,6 +3,9 @@ package cn.com.glsx.dj.peanalysis.remote; ...@@ -3,6 +3,9 @@ package cn.com.glsx.dj.peanalysis.remote;
import cn.com.glsx.dj.peanalysis.dto.job.BiRecord; import cn.com.glsx.dj.peanalysis.dto.job.BiRecord;
import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq; import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq;
import cn.com.glsx.dj.peanalysis.dto.res.output.*; import cn.com.glsx.dj.peanalysis.dto.res.output.*;
import cn.com.glsx.dj.peanalysis.dto.strategy.GoodsCategorySummaryWithWarn;
import cn.com.glsx.dj.peanalysis.dto.strategy.StaffAnalysisDTO;
import cn.com.glsx.dj.peanalysis.dto.strategy.StaffSummaryDTO;
import cn.com.glsx.dj.peanalysis.service.BusinessSceneAnalysisService; import cn.com.glsx.dj.peanalysis.service.BusinessSceneAnalysisService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
...@@ -214,4 +217,42 @@ public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRem ...@@ -214,4 +217,42 @@ public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRem
} }
} }
@Override
public RpcResponse<List<StaffAnalysisDTO>> listStaffAnalysis(SceneBaseReq req) {
try {
return RpcResponse.success(businessSceneAnalysisService.listStaffAnalysis(req));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("系统异常", e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<StaffSummaryDTO> summaryStaffDuration(SceneBaseReq req) {
try {
return RpcResponse.success(businessSceneAnalysisService.summaryStaffDuration(req));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("系统异常", e);
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<GoodsCategorySummaryWithWarn> merchantGoodsSummaryWithWarm(SceneBaseReq req) {
try {
return RpcResponse.success(businessSceneAnalysisService.merchantGoodsSummaryWithWarm(req));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("系统异常", e);
return RpcResponse.error(e);
}
}
} }
...@@ -11,6 +11,9 @@ import cn.com.glsx.dj.peanalysis.dto.job.BiRecord; ...@@ -11,6 +11,9 @@ import cn.com.glsx.dj.peanalysis.dto.job.BiRecord;
import cn.com.glsx.dj.peanalysis.dto.req.SalePotentialCustomersReq; import cn.com.glsx.dj.peanalysis.dto.req.SalePotentialCustomersReq;
import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq; import cn.com.glsx.dj.peanalysis.dto.req.output.SceneBaseReq;
import cn.com.glsx.dj.peanalysis.dto.res.output.*; import cn.com.glsx.dj.peanalysis.dto.res.output.*;
import cn.com.glsx.dj.peanalysis.dto.strategy.GoodsCategorySummaryWithWarn;
import cn.com.glsx.dj.peanalysis.dto.strategy.StaffAnalysisDTO;
import cn.com.glsx.dj.peanalysis.dto.strategy.StaffSummaryDTO;
import cn.com.glsx.dj.peanalysis.mapper.*; import cn.com.glsx.dj.peanalysis.mapper.*;
import cn.com.glsx.dj.peanalysis.util.SortUtils; import cn.com.glsx.dj.peanalysis.util.SortUtils;
import cn.com.glsx.dj.peanalysis.utils.DateUtils; import cn.com.glsx.dj.peanalysis.utils.DateUtils;
...@@ -2127,4 +2130,19 @@ public class BusinessSceneAnalysisService { ...@@ -2127,4 +2130,19 @@ public class BusinessSceneAnalysisService {
public List<BiRecord> getBiRecords(Integer businessType, List<Integer> merchantIds, String startDate, String endDate) { public List<BiRecord> getBiRecords(Integer businessType, List<Integer> merchantIds, String startDate, String endDate) {
return businessIntelligenceMapper.getBiRecords(businessType, merchantIds, startDate, endDate); return businessIntelligenceMapper.getBiRecords(businessType, merchantIds, startDate, endDate);
} }
public List<StaffAnalysisDTO> listStaffAnalysis(SceneBaseReq req) {
return null;
}
/**
* 驻店员工时长统计
*/
public StaffSummaryDTO summaryStaffDuration(SceneBaseReq req) {
return null;
}
public GoodsCategorySummaryWithWarn merchantGoodsSummaryWithWarm(SceneBaseReq req) {
return null;
}
} }
...@@ -13,4 +13,4 @@ ore.starter.class-name=Main ...@@ -13,4 +13,4 @@ ore.starter.class-name=Main
# diamond config # diamond config
ore.diamond.group=dijia ore.diamond.group=dijia
ore.diamond.dataId=rpc-dj-pe-analysis ore.diamond.dataId=rpc-dj-pe-analysis
ore.diamond.env=release
\ No newline at end of file \ No newline at end of file
ore.diamond.env=fanfr
\ No newline at end of file \ No newline at end of file
  • @wangxw1
    commented
    Master

    Auto Review Result:

    代码审查报告

    问题描述和优化建议

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

    问题描述:

    • 新增的BusinessSceneAnalysisService中的方法listStaffAnalysis, summaryStaffDuration, merchantGoodsSummaryWithWarm目前返回null。这在实际应用中可能导致空指针异常或其他运行时错误。

    优化建议:

    • 实现这些方法的具体业务逻辑,确保它们能够根据请求参数返回正确的数据。可以先抛出NotImplementedError或者默认返回一个空集合来替代null。

    2. 安全性与潜在风险 (30分)

    问题描述:

    • 目前没有看到明显的安全漏洞,但新添加的数据传输对象(DTO)和远程调用接口需要确保参数验证和输入清洗,防止潜在的安全威胁。
    • SceneBaseReq类新增的staffId和staffPhone字段没有进行任何验证,如果这些字段直接用于数据库查询或者其他敏感操作,可能存在SQL注入的风险。

    优化建议:

    • 对所有外部传入的数据进行严格的验证和清理,确保其符合预期的格式和范围。
    • 使用ORM框架提供的功能来防止SQL注入等安全问题。

    3. 是否符合最佳实践 (20分)

    问题描述:

    • SceneBaseReq类中新增的skipFlag字段缺少@ApiModelProperty注解,这可能会影响API文档的生成。
    • BusinessSceneAnalysisRemoteImpl中的异常处理部分存在重复代码,违反了DRY(Don't Repeat Yourself)原则。

    优化建议:

    • 为skipFlag字段添加@ApiModelProperty注解。
    • 将异常处理部分提取到一个单独的方法中,以提高代码的可读性和可维护性。

    4. 性能与资源利用效率 (5分)

    问题描述:

    • 没有明显的性能问题,但新增的三个方法目前只是简单的返回null,无法评估其实际性能表现。

    优化建议:

    • 在实现业务逻辑后,进行性能测试,确保这些方法在高并发场景下的性能表现良好。

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

    问题描述:

    • 提交信息较为简单,只写了“修改版本号;添加策略信息中心接口定义”,没有详细说明具体的更改内容和原因。

    优化建议:

    • 提交信息应更加详细,明确指出添加了哪些接口,以及这些接口的作用和背景。

    评分明细

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

    总分: 68分


    希望以上反馈能帮助改进代码质量,使其更加健壮、安全、高效。

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