Commit 9a176f4b by 林永健

feat(business): 完善业务场景分析相关接口及指标计算

- 补充并完善BusinessSceneAnalysisController中多个分析接口的实现,增加异常处理
- 新增指标常量类DataStatsConstants,统一管理指标项code
- 优化BusinessSceneAnalysisRemoteImpl实现,增强异常捕获和日志记录
- 在BusinessSceneAnalysisService中优化产值及相关指标查询逻辑,支持门店目标产值查询和达成率计算
- 实现新拓门店分析中潜客数、签约数和展业数的统计功能
- 实现门店列表指标计算,包含产值、达成率、触客率、转化率等关键指标
- 增加门店均值指标计算和环比计算方法,提高数据分析准确性
- 改进多处业务逻辑,统一使用指标常量,优化代码结构和日志输出
- 添加对商户名称的查询和映射,完善展示信息
- 为部分接口预留待实现方法,便于后续功能扩展
1 parent e5c890a8
package cn.com.glsx.dj.peanalysis.dto.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Accessors(chain = true)
public class SalePotentialCustomersReq implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 关联商户id
*/
@ApiModelProperty(notes = "关联商户id ")
private List<Integer> merchantIds;
/**
* 是否绑定 0-否 1-是
*/
@ApiModelProperty(notes = "是否绑定 0-否 1-是")
private Integer isBind;
/**
* 合作模式:1-直营 2-服务商
*/
@ApiModelProperty(notes = "合作模式:1-直营 2-服务商")
private Integer cooperationMode;
/**
* 流量情况 1-[30以下]、2-[30-50]、3-[50-80]、4-[80-120]、5-[120 以上]
*/
@ApiModelProperty(notes = "流量情况 1-[30以下]、2-[30-50]、3-[50-80]、4-[80-120]、5-[120 以上]")
private Integer flowSituation;
/**
* 省id
*/
@ApiModelProperty(notes = "省id")
private Integer provinceId;
private List<Integer> provinceIds;
/**
* 省份
*/
@ApiModelProperty(notes = "省份")
private String provinceName;
/**
* 状态: 1-跟进中 2-未签约 3-已签约
*/
@ApiModelProperty(notes = "状态: 1-跟进中 2-未签约 3-已签约")
private List<Integer> potentialCustomersStatus;
/**
* 预计展业时间 结果反馈为成功时填入的时间
*/
@ApiModelProperty(notes = "预计展业时间 结果反馈为成功时填入的时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date expectedOperationDate;
/**
* 结果反馈状态: 1-成功 2-失败
*/
@ApiModelProperty(notes = "结果反馈状态: 1-成功 2-失败")
private Integer resultFeedbackStatus;
/**
* 签约时间
*/
private String signedTimeStart;
private String signedTimeEnd;
/**
* 创建时间
*/
private String createdDateStart;
private String createdDateEnd;
/**
* 首次下单时间
*/
private String firstPayTimeStart;
private String firstPayTimeEnd;
}
......@@ -84,118 +84,4 @@ public class EmployeeDetailSummaryResponse implements Serializable {
@ApiModelProperty("转化率环比")
private BigDecimal conversionRateMom;
@ApiModelProperty("整车延保-成交数")
private Integer vehicleWarrantyDealCount;
@ApiModelProperty("整车延保-渗透率")
private BigDecimal vehicleWarrantyPenetrationRate;
@ApiModelProperty("整车延保-渗透率兜底目标")
private BigDecimal vehicleWarrantyPenetrationBottomTarget;
@ApiModelProperty("整车延保-转化率")
private BigDecimal vehicleWarrantyConversionRate;
@ApiModelProperty("整车延保-转化率兜底目标")
private BigDecimal vehicleWarrantyConversionBottomTarget;
@ApiModelProperty("安心包-成交数")
private Integer safetyPackageDealCount;
@ApiModelProperty("安心包-渗透率")
private BigDecimal safetyPackagePenetrationRate;
@ApiModelProperty("安心包-渗透率兜底目标")
private BigDecimal safetyPackagePenetrationBottomTarget;
@ApiModelProperty("安心包-转化率")
private BigDecimal safetyPackageConversionRate;
@ApiModelProperty("安心包-转化率兜底目标")
private BigDecimal safetyPackageConversionBottomTarget;
@ApiModelProperty("电池延保-成交数")
private Integer batteryWarrantyDealCount;
@ApiModelProperty("电池延保-渗透率")
private BigDecimal batteryWarrantyPenetrationRate;
@ApiModelProperty("电池延保-渗透率兜底目标")
private BigDecimal batteryWarrantyPenetrationBottomTarget;
@ApiModelProperty("电池延保-转化率")
private BigDecimal batteryWarrantyConversionRate;
@ApiModelProperty("电池延保-转化率兜底目标")
private BigDecimal batteryWarrantyConversionBottomTarget;
@ApiModelProperty("轮胎延保-成交数")
private Integer tireWarrantyDealCount;
@ApiModelProperty("轮胎延保-渗透率")
private BigDecimal tireWarrantyPenetrationRate;
@ApiModelProperty("轮胎延保-渗透率兜底目标")
private BigDecimal tireWarrantyPenetrationBottomTarget;
@ApiModelProperty("轮胎延保-转化率")
private BigDecimal tireWarrantyConversionRate;
@ApiModelProperty("轮胎延保-转化率兜底目标")
private BigDecimal tireWarrantyConversionBottomTarget;
@ApiModelProperty("车窗膜-成交数")
private Integer windowFilmDealCount;
@ApiModelProperty("车窗膜-单车采购产值")
private BigDecimal windowFilmPerCarOutput;
@ApiModelProperty("车窗膜-渗透率")
private BigDecimal windowFilmPenetrationRate;
@ApiModelProperty("车窗膜-渗透率兜底目标")
private BigDecimal windowFilmPenetrationBottomTarget;
@ApiModelProperty("车窗膜-转化率")
private BigDecimal windowFilmConversionRate;
@ApiModelProperty("车窗膜-转化率兜底目标")
private BigDecimal windowFilmConversionBottomTarget;
@ApiModelProperty("车身膜-成交数")
private Integer carBodyFilmDealCount;
@ApiModelProperty("车身膜-单车采购产值")
private BigDecimal carBodyFilmPerCarOutput;
@ApiModelProperty("车身膜-渗透率")
private BigDecimal carBodyFilmPenetrationRate;
@ApiModelProperty("车身膜-渗透率兜底目标")
private BigDecimal carBodyFilmPenetrationBottomTarget;
@ApiModelProperty("车身膜-转化率")
private BigDecimal carBodyFilmConversionRate;
@ApiModelProperty("车身膜-转化率兜底目标")
private BigDecimal carBodyFilmConversionBottomTarget;
@ApiModelProperty("精品附件-成交数")
private Integer accessoriesDealCount;
@ApiModelProperty("精品附件-单车采购产值")
private BigDecimal accessoriesPerCarOutput;
@ApiModelProperty("精品附件-渗透率")
private BigDecimal accessoriesPenetrationRate;
@ApiModelProperty("精品附件-渗透率兜底目标")
private BigDecimal accessoriesPenetrationBottomTarget;
@ApiModelProperty("精品附件-转化率")
private BigDecimal accessoriesConversionRate;
@ApiModelProperty("精品附件-转化率兜底目标")
private BigDecimal accessoriesConversionBottomTarget;
}
package cn.com.glsx.dj.peanalysis.dto.res.output;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@ApiModel(description = "门店/员工分析-商品品类响应")
@Data
public class GoodsCategorySummaryResponse implements Serializable {
private static final long serialVersionUID = -1;
@ApiModelProperty("整车延保-成交数")
private Integer vehicleWarrantyDealCount;
@ApiModelProperty("整车延保-渗透率")
private BigDecimal vehicleWarrantyPenetrationRate;
@ApiModelProperty("整车延保-渗透率兜底目标")
private BigDecimal vehicleWarrantyPenetrationBottomTarget;
@ApiModelProperty("整车延保-转化率")
private BigDecimal vehicleWarrantyConversionRate;
@ApiModelProperty("整车延保-转化率兜底目标")
private BigDecimal vehicleWarrantyConversionBottomTarget;
@ApiModelProperty("整车延保-生态系数")
private Integer vehicleWarrantyEcoCoefficient;
@ApiModelProperty("安心包-成交数")
private Integer safetyPackageDealCount;
@ApiModelProperty("安心包-渗透率")
private BigDecimal safetyPackagePenetrationRate;
@ApiModelProperty("安心包-渗透率兜底目标")
private BigDecimal safetyPackagePenetrationBottomTarget;
@ApiModelProperty("安心包-转化率")
private BigDecimal safetyPackageConversionRate;
@ApiModelProperty("安心包-转化率兜底目标")
private BigDecimal safetyPackageConversionBottomTarget;
@ApiModelProperty("安心包-生态系数")
private Integer safetyPackageEcoCoefficient;
@ApiModelProperty("电池延保-成交数")
private Integer batteryWarrantyDealCount;
@ApiModelProperty("电池延保-渗透率")
private BigDecimal batteryWarrantyPenetrationRate;
@ApiModelProperty("电池延保-渗透率兜底目标")
private BigDecimal batteryWarrantyPenetrationBottomTarget;
@ApiModelProperty("电池延保-转化率")
private BigDecimal batteryWarrantyConversionRate;
@ApiModelProperty("电池延保-转化率兜底目标")
private BigDecimal batteryWarrantyConversionBottomTarget;
@ApiModelProperty("电池延保-生态系数")
private Integer batteryWarrantyEcoCoefficient;
@ApiModelProperty("轮胎延保-成交数")
private Integer tireWarrantyDealCount;
@ApiModelProperty("轮胎延保-渗透率")
private BigDecimal tireWarrantyPenetrationRate;
@ApiModelProperty("轮胎延保-渗透率兜底目标")
private BigDecimal tireWarrantyPenetrationBottomTarget;
@ApiModelProperty("轮胎延保-转化率")
private BigDecimal tireWarrantyConversionRate;
@ApiModelProperty("轮胎延保-转化率兜底目标")
private BigDecimal tireWarrantyConversionBottomTarget;
@ApiModelProperty("轮胎延保-生态系数")
private Integer tireWarrantyEcoCoefficient;
@ApiModelProperty("车窗膜-成交数")
private Integer windowFilmDealCount;
@ApiModelProperty("车窗膜-单车采购产值")
private BigDecimal windowFilmPerCarOutput;
@ApiModelProperty("车窗膜-渗透率")
private BigDecimal windowFilmPenetrationRate;
@ApiModelProperty("车窗膜-渗透率兜底目标")
private BigDecimal windowFilmPenetrationBottomTarget;
@ApiModelProperty("车窗膜-转化率")
private BigDecimal windowFilmConversionRate;
@ApiModelProperty("车窗膜-转化率兜底目标")
private BigDecimal windowFilmConversionBottomTarget;
@ApiModelProperty("车窗膜-生态系数")
private Integer windowFilmEcoCoefficient;
@ApiModelProperty("车身膜-成交数")
private Integer carBodyFilmDealCount;
@ApiModelProperty("车身膜-单车采购产值")
private BigDecimal carBodyFilmPerCarOutput;
@ApiModelProperty("车身膜-渗透率")
private BigDecimal carBodyFilmPenetrationRate;
@ApiModelProperty("车身膜-渗透率兜底目标")
private BigDecimal carBodyFilmPenetrationBottomTarget;
@ApiModelProperty("车身膜-转化率")
private BigDecimal carBodyFilmConversionRate;
@ApiModelProperty("车身膜-转化率兜底目标")
private BigDecimal carBodyFilmConversionBottomTarget;
@ApiModelProperty("车身膜-生态系数")
private Integer carBodyFilmEcoCoefficient;
@ApiModelProperty("精品附件-成交数")
private Integer accessoriesDealCount;
@ApiModelProperty("精品附件-单车采购产值")
private BigDecimal accessoriesPerCarOutput;
@ApiModelProperty("精品附件-渗透率")
private BigDecimal accessoriesPenetrationRate;
@ApiModelProperty("精品附件-渗透率兜底目标")
private BigDecimal accessoriesPenetrationBottomTarget;
@ApiModelProperty("精品附件-转化率")
private BigDecimal accessoriesConversionRate;
@ApiModelProperty("精品附件-转化率兜底目标")
private BigDecimal accessoriesConversionBottomTarget;
@ApiModelProperty("精品附件-生态系数")
private Integer accessoriesEcoCoefficient;
}
......@@ -123,139 +123,4 @@ public class StoreDetailSummaryResponse implements Serializable {
@ApiModelProperty("渗透率环比")
private BigDecimal penetrationRateMom;
@ApiModelProperty("整车延保-成交数")
private Integer vehicleWarrantyDealCount;
@ApiModelProperty("整车延保-渗透率")
private BigDecimal vehicleWarrantyPenetrationRate;
@ApiModelProperty("整车延保-渗透率兜底目标")
private BigDecimal vehicleWarrantyPenetrationBottomTarget;
@ApiModelProperty("整车延保-转化率")
private BigDecimal vehicleWarrantyConversionRate;
@ApiModelProperty("整车延保-转化率兜底目标")
private BigDecimal vehicleWarrantyConversionBottomTarget;
@ApiModelProperty("整车延保-生态系数")
private Integer vehicleWarrantyEcoCoefficient;
@ApiModelProperty("安心包-成交数")
private Integer safetyPackageDealCount;
@ApiModelProperty("安心包-渗透率")
private BigDecimal safetyPackagePenetrationRate;
@ApiModelProperty("安心包-渗透率兜底目标")
private BigDecimal safetyPackagePenetrationBottomTarget;
@ApiModelProperty("安心包-转化率")
private BigDecimal safetyPackageConversionRate;
@ApiModelProperty("安心包-转化率兜底目标")
private BigDecimal safetyPackageConversionBottomTarget;
@ApiModelProperty("安心包-生态系数")
private Integer safetyPackageEcoCoefficient;
@ApiModelProperty("电池延保-成交数")
private Integer batteryWarrantyDealCount;
@ApiModelProperty("电池延保-渗透率")
private BigDecimal batteryWarrantyPenetrationRate;
@ApiModelProperty("电池延保-渗透率兜底目标")
private BigDecimal batteryWarrantyPenetrationBottomTarget;
@ApiModelProperty("电池延保-转化率")
private BigDecimal batteryWarrantyConversionRate;
@ApiModelProperty("电池延保-转化率兜底目标")
private BigDecimal batteryWarrantyConversionBottomTarget;
@ApiModelProperty("电池延保-生态系数")
private Integer batteryWarrantyEcoCoefficient;
@ApiModelProperty("轮胎延保-成交数")
private Integer tireWarrantyDealCount;
@ApiModelProperty("轮胎延保-渗透率")
private BigDecimal tireWarrantyPenetrationRate;
@ApiModelProperty("轮胎延保-渗透率兜底目标")
private BigDecimal tireWarrantyPenetrationBottomTarget;
@ApiModelProperty("轮胎延保-转化率")
private BigDecimal tireWarrantyConversionRate;
@ApiModelProperty("轮胎延保-转化率兜底目标")
private BigDecimal tireWarrantyConversionBottomTarget;
@ApiModelProperty("轮胎延保-生态系数")
private Integer tireWarrantyEcoCoefficient;
@ApiModelProperty("车窗膜-成交数")
private Integer windowFilmDealCount;
@ApiModelProperty("车窗膜-单车采购产值")
private BigDecimal windowFilmPerCarOutput;
@ApiModelProperty("车窗膜-渗透率")
private BigDecimal windowFilmPenetrationRate;
@ApiModelProperty("车窗膜-渗透率兜底目标")
private BigDecimal windowFilmPenetrationBottomTarget;
@ApiModelProperty("车窗膜-转化率")
private BigDecimal windowFilmConversionRate;
@ApiModelProperty("车窗膜-转化率兜底目标")
private BigDecimal windowFilmConversionBottomTarget;
@ApiModelProperty("车窗膜-生态系数")
private Integer windowFilmEcoCoefficient;
@ApiModelProperty("车身膜-成交数")
private Integer carBodyFilmDealCount;
@ApiModelProperty("车身膜-单车采购产值")
private BigDecimal carBodyFilmPerCarOutput;
@ApiModelProperty("车身膜-渗透率")
private BigDecimal carBodyFilmPenetrationRate;
@ApiModelProperty("车身膜-渗透率兜底目标")
private BigDecimal carBodyFilmPenetrationBottomTarget;
@ApiModelProperty("车身膜-转化率")
private BigDecimal carBodyFilmConversionRate;
@ApiModelProperty("车身膜-转化率兜底目标")
private BigDecimal carBodyFilmConversionBottomTarget;
@ApiModelProperty("车身膜-生态系数")
private Integer carBodyFilmEcoCoefficient;
@ApiModelProperty("精品附件-成交数")
private Integer accessoriesDealCount;
@ApiModelProperty("精品附件-单车采购产值")
private BigDecimal accessoriesPerCarOutput;
@ApiModelProperty("精品附件-渗透率")
private BigDecimal accessoriesPenetrationRate;
@ApiModelProperty("精品附件-渗透率兜底目标")
private BigDecimal accessoriesPenetrationBottomTarget;
@ApiModelProperty("精品附件-转化率")
private BigDecimal accessoriesConversionRate;
@ApiModelProperty("精品附件-转化率兜底目标")
private BigDecimal accessoriesConversionBottomTarget;
@ApiModelProperty("精品附件-生态系数")
private Integer accessoriesEcoCoefficient;
}
......@@ -2,7 +2,9 @@ package cn.com.glsx.dj.peanalysis.dto.res.output;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
......@@ -10,6 +12,8 @@ import java.util.List;
@ApiModel(description = "门店列表响应")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class StoreListResponse implements Serializable {
private static final long serialVersionUID = -1L;
......@@ -18,7 +22,7 @@ public class StoreListResponse implements Serializable {
private String storeName;
@ApiModelProperty("门店id")
private Long storeId;
private Integer storeId;
@ApiModelProperty("产值")
private BigDecimal outputValue;
......@@ -43,4 +47,8 @@ public class StoreListResponse implements Serializable {
@ApiModelProperty("门店状态 1:正常 2:兜底预警 3:生态指标预警 4:达成率不及预期")
private List<String> storeStatus;
public StoreListResponse(Integer storeId) {
this.storeId = storeId;
}
}
......@@ -38,4 +38,22 @@ public interface BusinessSceneAnalysisRemote {
@ApiMethod("门店平均值")
RpcResponse<StoreAvgResponse> storeAvgList(SceneBaseReq req);
@ApiMethod("门店列表")
RpcResponse<List<StoreListResponse>> storeList(SceneBaseReq req);
@ApiMethod("门店分析")
RpcResponse<StoreDetailSummaryResponse> storeDetailSummary(SceneBaseReq req);
@ApiMethod("门店员工排名")
RpcResponse<StoreEmployeeRankResponse> storeEmployeeRank(SceneBaseReq req);
@ApiMethod("门店流量贡献度排名")
RpcResponse<List<TrafficContributionRankResponse>> storeTrafficRank(SceneBaseReq req);
@ApiMethod("门店员工分析")
RpcResponse<EmployeeDetailSummaryResponse> storeEmployeeSummary(SceneBaseReq req);
@ApiMethod("商品品类分析")
RpcResponse<GoodsCategorySummaryResponse> goodsSummary(SceneBaseReq req);
}
package cn.com.glsx.dj.peanalysis.config;
/**
* 指标常量
*/
public class DataStatsConstants {
/** 无品牌时的默认传参 */
public static final String DEFAULT_BRAND_ID = "-1,-2,3454";
/** 产值 */
public static final String ITEM_CODE_A036 = "A036";
/** 触客率 */
public static final String ITEM_CODE_A064 = "A064";
/** 转化率 */
public static final String ITEM_CODE_A085 = "A085";
/** 渗透率 */
public static final String ITEM_CODE_A077 = "A077";
/** 升级客单价 */
public static final String ITEM_CODE_A076 = "A076";
/** 平均客单价 */
public static final String ITEM_CODE_A095 = "A095";
/** 新车交付数 */
public static final String ITEM_CODE_A062 = "A062";
/** 精品附件产值 */
public static final String ITEM_CODE_A0117 = "A0117";
/** 车身膜产值 */
public static final String ITEM_CODE_A0112 = "A0112";
/** 车窗膜产值 */
public static final String ITEM_CODE_A0107 = "A0107";
/** 售前触客数 */
public static final String ITEM_CODE_A063 = "A063";
/** 售后触客数 */
public static final String ITEM_CODE_A096 = "A096";
/** 售前成交数 */
public static final String ITEM_CODE_A097 = "A097";
/** 售后成交数 */
public static final String ITEM_CODE_A098 = "A098";
/** 售前转化率 */
public static final String ITEM_CODE_A0104 = "A0104";
/** 售后转化率 */
public static final String ITEM_CODE_A0105 = "A0105";
}
package cn.com.glsx.dj.peanalysis.mapper;
import cn.com.glsx.dj.peanalysis.dto.req.SalePotentialCustomersReq;
import cn.com.glsx.dj.peanalysis.model.SalePotentialCustomers;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
......@@ -7,4 +8,5 @@ import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper
public interface SalePotentialCustomersMapper extends OreMapper<SalePotentialCustomers> {
Integer countStoreSummary(SalePotentialCustomersReq req);
}
\ No newline at end of file
......@@ -19,12 +19,12 @@ import java.util.List;
public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRemote{
@Resource
private BusinessSceneAnalysisService businessAnalysisService;
private BusinessSceneAnalysisService businessSceneAnalysisService;
@Override
public RpcResponse<SceneOutputResponse> sceneOutput(SceneBaseReq req) {
try {
return RpcResponse.success(businessAnalysisService.sceneOutput(req));
return RpcResponse.success(businessSceneAnalysisService.sceneOutput(req));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
......@@ -34,7 +34,7 @@ public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRem
@Override
public RpcResponse<List<TrendOutputResponse>> trendOutput(SceneBaseReq req) {
try {
return RpcResponse.success(businessAnalysisService.trendOutput(req));
return RpcResponse.success(businessSceneAnalysisService.trendOutput(req));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
......@@ -47,7 +47,7 @@ public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRem
@Override
public RpcResponse<StoreSceneSummaryResponse> storeAnalysis(SceneBaseReq req) {
try {
return RpcResponse.success(businessAnalysisService.storeAnalysis(req));
return RpcResponse.success(businessSceneAnalysisService.storeAnalysis(req));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
......@@ -60,7 +60,7 @@ public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRem
@Override
public RpcResponse<List<TrafficSummaryResponse>> trafficSummary(SceneBaseReq req) {
try {
return RpcResponse.success(businessAnalysisService.trafficSummary(req));
return RpcResponse.success(businessSceneAnalysisService.trafficSummary(req));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
......@@ -73,7 +73,7 @@ public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRem
@Override
public RpcResponse<List<RegionalDistributionResponse>> regionalDistribution(SceneBaseReq req) {
try {
return RpcResponse.success(businessAnalysisService.regionalDistribution(req));
return RpcResponse.success(businessSceneAnalysisService.regionalDistribution(req));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
......@@ -86,7 +86,7 @@ public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRem
@Override
public RpcResponse<NewStoreAnalysisResponse> newStoreSummary(SceneBaseReq req) {
try {
return RpcResponse.success(businessAnalysisService.newStoreSummary(req));
return RpcResponse.success(businessSceneAnalysisService.newStoreSummary(req));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
......@@ -99,7 +99,7 @@ public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRem
@Override
public RpcResponse<List<ContactRateAnalysisResponse>> touchRateSummary(SceneBaseReq req) {
try {
return RpcResponse.success(businessAnalysisService.touchRateSummary(req));
return RpcResponse.success(businessSceneAnalysisService.touchRateSummary(req));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
......@@ -112,7 +112,7 @@ public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRem
@Override
public RpcResponse<StoreAvgResponse> storeAvgList(SceneBaseReq req) {
try {
return RpcResponse.success(businessAnalysisService.storeAvgList(req));
return RpcResponse.success(businessSceneAnalysisService.storeAvgList(req));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
......@@ -121,4 +121,83 @@ public class BusinessSceneAnalysisRemoteImpl implements BusinessSceneAnalysisRem
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<List<StoreListResponse>> storeList(SceneBaseReq req){
try {
return RpcResponse.success(businessSceneAnalysisService.storeList(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<StoreDetailSummaryResponse> storeDetailSummary(SceneBaseReq req){
try {
return RpcResponse.success(businessSceneAnalysisService.storeDetailSummary(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<StoreEmployeeRankResponse> storeEmployeeRank(SceneBaseReq req){
try {
return RpcResponse.success(businessSceneAnalysisService.storeEmployeeRank(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<List<TrafficContributionRankResponse>> storeTrafficRank(SceneBaseReq req){
try {
return RpcResponse.success(businessSceneAnalysisService.storeTrafficRank(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<EmployeeDetailSummaryResponse> storeEmployeeSummary(SceneBaseReq req){
try {
return RpcResponse.success(businessSceneAnalysisService.storeEmployeeSummary(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<GoodsCategorySummaryResponse> goodsSummary(SceneBaseReq req){
try {
return RpcResponse.success(businessSceneAnalysisService.goodsSummary(req));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("系统异常", e);
return RpcResponse.error(e);
}
}
}
......@@ -79,4 +79,60 @@
deleted_flag
</sql>
<select id="countStoreSummary" parameterType="cn.com.glsx.dj.peanalysis.dto.req.SalePotentialCustomersReq"
resultType="int">
select
count(*)
from sale_potential_customers spc
left join dj_car_life_service_merchant sm on sm.merchant_id = spc.merchant_id and sm.deleted_flag = 'N'
<where>
spc.deleted_flag = 'N'
<if test="merchantIds != null and merchantIds.size() > 0">
and spc.merchant_id in
<foreach item="item" collection="merchantIds" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
<if test="isBind != null">
and spc.is_bind = #{isBind}
</if>
<if test="cooperationMode != null">
and spc.cooperation_mode = #{cooperationMode}
</if>
<if test="flowSituation != null">
and spc.flow_situation = #{flowSituation}
</if>
<if test="provinceIds != null and provinceIds.size() > 0">
and spc.province_id in
<foreach item="item" collection="provinceIds" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
<if test="potentialCustomersStatus != null and potentialCustomersStatus.size() > 0">
and spc.potential_customers_status in
<foreach item="item" collection="potentialCustomersStatus" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
<if test="firstPayTimeStart != null">
and sm.first_pay_time >= #{firstPayTimeStart}
</if>
<if test="firstPayTimeEnd != null">
and sm.first_pay_time &lt;= #{firstPayTimeEnd}
</if>
<if test="signedTimeStart != null">
and spc.signed_time >= #{signedTimeStart}
</if>
<if test="signedTimeEnd != null">
and spc.signed_time &lt;= #{signedTimeEnd}
</if>
<if test="createdDateStart != null">
and spc.created_date >= #{createdDateStart}
</if>
<if test="createdDateEnd != null">
and spc.created_date &lt;= #{createdDateEnd}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
  • @wangxw1
    commented
    Master

    Auto Review Result:

    代码审查报告

    问题描述和优化建议

    1. SalePotentialCustomersReq.java

    • 问题: serialVersionUID 应该是一个唯一的序列号,通常使用工具生成。当前值 -1 可能不是唯一的。
      • 建议: 使用 UUID 工具生成一个唯一的 serialVersionUID。
    • 问题: 字段 provinceId 和 provinceIds 存在冗余,可能导致数据不一致。
      • 建议: 删除其中一个字段,或者明确两个字段的区别并加以注释。
    • 问题: 字段 signedTimeStart, signedTimeEnd, createdDateStart, createdDateEnd, firstPayTimeStart, firstPayTimeEnd 使用 String 类型,这可能导致日期格式解析错误。
      • 建议: 将这些字段改为 LocalDateTime 或 Date 类型,并添加相应的 @JsonFormat 注解来处理日期格式。

    2. EmployeeDetailSummaryResponse.java

    • 问题: 移除了大量字段,但没有提供这些字段被移除的原因或替代方案。
      • 建议: 如果这些字段不再需要,确保所有引用这些字段的地方都已更新。如果这些字段需要,考虑重新添加它们或提供替代方案。

    3. GoodsCategorySummaryResponse.java

    • 问题: 类似于 EmployeeDetailSummaryResponse.java,新添加了大量字段,但没有提供这些字段的来源或用途。
      • 建议: 确保这些字段的必要性,并添加适当的文档说明。

    4. StoreListResponse.java

    • 问题: 字段 storeId 的类型从 Long 改为 Integer,这可能会导致数据范围受限。
      • 建议: 确认 storeId 的实际数据范围,如果可能超出 Integer 的范围,则应保留 Long 类型。
    • 问题: 手动添加了一个构造函数 public StoreListResponse(Integer storeId),但已经有了 @AllArgsConstructor 注解。
      • 建议: 删除手动添加的构造函数,使用 @AllArgsConstructor 生成的构造函数。

    5. BusinessSceneAnalysisRemote.java

    • 问题: 接口定义了很多新的方法,但没有提供这些方法的具体实现或调用示例。
      • 建议: 确保这些方法有对应的实现,并提供一些简单的调用示例。

    6. DataStatsConstants.java

    • 问题: 常量命名规范良好,但没有提供这些常量的具体用途。
      • 建议: 添加注释说明每个常量的用途。

    7. SalePotentialCustomersMapper.java

    • 问题: 新增了一个方法 countStoreSummary,但没有提供对应的 SQL 映射。
      • 建议: 确保有对应的 SQL 映射文件,并测试该方法的功能。

    8. BusinessSceneAnalysisRemoteImpl.java

    • 问题: 异常处理逻辑重复,可以提取到一个单独的方法中。
      • 建议: 提取重复的异常处理逻辑到一个单独的方法中,以减少代码重复。
    • 问题: 方法 storeAvgList 中的异常处理没有捕获 Exception 类型,这可能会导致未处理的异常。
      • 建议: 确保所有的异常都被正确捕获和处理。

    评分明细

    1. 功能实现的正确性与健壮性:35分
      • 代码实现了所需的功能,但存在一些字段冗余和类型不一致的问题。
    2. 安全性与潜在风险:30分
      • 代码中没有明显的安全漏洞,但日期字段使用 String 类型存在潜在的风险。
    3. 是否符合最佳实践:15分
      • 代码结构良好,但存在一些冗余字段和重复的异常处理逻辑。
    4. 性能与资源利用效率:5分
      • 代码没有明显的性能问题,但需要进一步测试。
    5. Commits信息的清晰性与准确性:5分
      • 提交信息详细,但可以进一步明确某些字段被移除的原因。

    总分

    总分: 90分

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