Commit 09817a53 by zhouhaibao

feat(supervisor): 添加问界鸿蒙品牌业绩统计功能

- 新增HarmonyStaffPerformanceDTO和HarmonyStorePerformanceDTO数据传输对象
- 添加问界鸿蒙品牌相关的员工和门店业绩指标配置
- 实现渗透率和售后占比等核心业务指标的计算逻辑
- 扩展EmployeeRanking DTO以支持商户ID列表
- 创建MerchantQueryReq请求参数类支持多维度查询
- 定义完整的指标配置常量类支持员工和门店两个维度的业绩统计
1 parent 6121436c
......@@ -7,7 +7,7 @@
</parent>
<groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-supervisor-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>5.8.2-SNAPSHOT</version>
<name>rpc-dj-supervisor-api</name>
<properties>
<deploy.scanPackage>cn.com.glsx.dj.supervisor.remote</deploy.scanPackage>
......@@ -24,7 +24,7 @@
<dependency>
<groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-supervisor-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>5.8.2-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
......
......@@ -3,6 +3,7 @@ package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import lombok.Data;
@Data
......@@ -55,4 +56,7 @@ public class EmployeeRanking implements Serializable {
@ApiModelProperty(notes = "个人产值预警等级:0-红,1-黄,2-绿")
private Integer outputWarningLevel;
}
private List<Integer> merchantIdList;
}
\ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;
/**
* 问界鸿蒙品牌驻店销售人员业绩DTO
* 包含:智界、享界、尚界等品牌
*
* 指标计算说明:
* 1. 渗透率分母均为实际售前触客数(售后触客不在考核范围内)
* 2. 售后占比 = 售后成交数 / 总成交数(售前+售后)
*/
@Data
public class HarmonyStaffPerformanceDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "员工ID")
private String employeeId;
@ApiModelProperty(notes = "员工姓名")
private String employeeName;
@ApiModelProperty(notes = "员工手机号")
private String employeePhone;
@ApiModelProperty(notes = "关联门店ID")
private Integer merchantId;
@ApiModelProperty(notes = "关联门店名称")
private String merchantName;
@ApiModelProperty(notes = "品牌ID")
private Integer brandId;
@ApiModelProperty(notes = "品牌名称")
private String brandName;
// ========== 核心指标(1级指标)==========
/**
* 交付数(应触客数)
* 该驻店销售在归属在该督导管理门店范围+延保权益场景下+对应时间段内的总的应触客数
*/
@ApiModelProperty(notes = "交付数(应触客数)")
private Integer deliveryCount;
/**
* 售前触客数(实际售前触客数)
* 该驻店销售在归属在该督导管理门店范围+延保权益场景下+对应时间段内的总的实际售前触客数
*/
@ApiModelProperty(notes = "售前触客数")
private Integer preSalesTouchCount;
/**
* 总产值
* 该驻店销售在归属在该督导管理门店范围+延保权益场景下+对应时间段内的累计成交金额
*/
@ApiModelProperty(notes = "总产值(万元)")
private BigDecimal totalOutput;
// ========== 渗透率指标(2级指标,需计算)==========
// 渗透率分母均为实际售前触客数(售后触客不在考核范围内)
/**
* 整车延保渗透率 = 整车延保成交数(售前+售后)/实际售前触客数
*/
@ApiModelProperty(notes = "整车延保渗透率(%)")
private BigDecimal vehicleWarrantyRate;
/**
* 安心包渗透率 = 安心包成交数(售前+售后)/实际售前触客数
*/
@ApiModelProperty(notes = "安心包渗透率(%)")
private BigDecimal peaceOfMindRate;
/**
* 电池延保渗透率 = 电池延保成交数(售前+售后)/实际售前触客数
*/
@ApiModelProperty(notes = "电池延保渗透率(%)")
private BigDecimal batteryWarrantyRate;
/**
* 轮胎险渗透率 = 轮胎险成交数(售前+售后)/实际售前触客数
*/
@ApiModelProperty(notes = "轮胎险渗透率(%)")
private BigDecimal tireInsuranceRate;
// ========== 售后能力指标(2级指标,需计算)==========
/**
* 整车延保售后占比 = 整车延保售后成交数 / 整车延保成交数(售前+售后)
*/
@ApiModelProperty(notes = "整车延保售后占比(%)")
private BigDecimal vehicleWarrantyAfterSalesRate;
/**
* 安心包售后占比 = 安心包售后成交数 / 安心包成交数(售前+售后)
*/
@ApiModelProperty(notes = "安心包售后占比(%)")
private BigDecimal peaceOfMindAfterSalesRate;
/**
* 电池售后占比 = 电池售后成交数 / 电池成交数(售前+售后)
*/
@ApiModelProperty(notes = "电池售后占比(%)")
private BigDecimal batteryAfterSalesRate;
/**
* 轮胎险售后占比 = 轮胎险售后成交数 / 轮胎险成交数(售前+售后)
*/
@ApiModelProperty(notes = "轮胎险售后占比(%)")
private BigDecimal tireInsuranceAfterSalesRate;
// ========== 中间指标(1级指标,用于计算2级指标)==========
// 整车延保相关
@ApiModelProperty(notes = "整车延保成交数(售前+售后)")
private Integer vehicleWarrantyTotalCount;
@ApiModelProperty(notes = "整车延保售后成交数")
private Integer vehicleWarrantyAfterSalesCount;
// 安心包相关
@ApiModelProperty(notes = "安心包成交数(售前+售后)")
private Integer peaceOfMindTotalCount;
@ApiModelProperty(notes = "安心包售后成交数")
private Integer peaceOfMindAfterSalesCount;
// 电池延保相关
@ApiModelProperty(notes = "电池延保成交数(售前+售后)")
private Integer batteryTotalCount;
@ApiModelProperty(notes = "电池延保售后成交数")
private Integer batteryAfterSalesCount;
// 轮胎险相关
@ApiModelProperty(notes = "轮胎险成交数(售前+售后)")
private Integer tireInsuranceTotalCount;
@ApiModelProperty(notes = "轮胎险售后成交数")
private Integer tireInsuranceAfterSalesCount;
// ========== 预警等级 ==========
/**
* 预警等级:0-红(预警),1-黄(需关注),2-绿(达标)
*/
@ApiModelProperty(notes = "预警等级:0-红,1-黄,2-绿")
private Integer warningLevel;
@ApiModelProperty(notes = "门店预警等级(用于排序)")
private Integer storeWarningLevel;
// ========== 格式化后的显示值 ==========
@ApiModelProperty(notes = "格式化后的交付数")
private String displayDeliveryCount;
@ApiModelProperty(notes = "格式化后的售前触客数")
private String displayPreSalesTouchCount;
@ApiModelProperty(notes = "格式化后的总产值(万元)")
private String displayTotalOutput;
@ApiModelProperty(notes = "格式化后的整车延保渗透率")
private String displayVehicleWarrantyRate;
@ApiModelProperty(notes = "格式化后的安心包渗透率")
private String displayPeaceOfMindRate;
@ApiModelProperty(notes = "格式化后的电池延保渗透率")
private String displayBatteryWarrantyRate;
@ApiModelProperty(notes = "格式化后的轮胎险渗透率")
private String displayTireInsuranceRate;
@ApiModelProperty(notes = "格式化后的整车延保售后占比")
private String displayVehicleWarrantyAfterSalesRate;
@ApiModelProperty(notes = "格式化后的安心包售后占比")
private String displayPeaceOfMindAfterSalesRate;
@ApiModelProperty(notes = "格式化后的电池售后占比")
private String displayBatteryAfterSalesRate;
@ApiModelProperty(notes = "格式化后的轮胎险售后占比")
private String displayTireInsuranceAfterSalesRate;
/**
* 计算2级指标
*/
public void calculateSecondaryIndicators() {
// 计算渗透率指标(分母为售前触客数)
if (preSalesTouchCount != null && preSalesTouchCount > 0) {
BigDecimal denominator = new BigDecimal(preSalesTouchCount);
// 整车延保渗透率
if (vehicleWarrantyTotalCount != null) {
vehicleWarrantyRate = new BigDecimal(vehicleWarrantyTotalCount)
.multiply(new BigDecimal("100"))
.divide(denominator, 2, BigDecimal.ROUND_HALF_UP);
}
// 安心包渗透率
if (peaceOfMindTotalCount != null) {
peaceOfMindRate = new BigDecimal(peaceOfMindTotalCount)
.multiply(new BigDecimal("100"))
.divide(denominator, 2, BigDecimal.ROUND_HALF_UP);
}
// 电池延保渗透率
if (batteryTotalCount != null) {
batteryWarrantyRate = new BigDecimal(batteryTotalCount)
.multiply(new BigDecimal("100"))
.divide(denominator, 2, BigDecimal.ROUND_HALF_UP);
}
// 轮胎险渗透率
if (tireInsuranceTotalCount != null) {
tireInsuranceRate = new BigDecimal(tireInsuranceTotalCount)
.multiply(new BigDecimal("100"))
.divide(denominator, 2, BigDecimal.ROUND_HALF_UP);
}
}
// 计算售后占比指标
// 整车延保售后占比
if (vehicleWarrantyTotalCount != null && vehicleWarrantyTotalCount > 0) {
vehicleWarrantyAfterSalesRate = new BigDecimal(vehicleWarrantyAfterSalesCount != null ? vehicleWarrantyAfterSalesCount : 0)
.multiply(new BigDecimal("100"))
.divide(new BigDecimal(vehicleWarrantyTotalCount), 2, BigDecimal.ROUND_HALF_UP);
}
// 安心包售后占比
if (peaceOfMindTotalCount != null && peaceOfMindTotalCount > 0) {
peaceOfMindAfterSalesRate = new BigDecimal(peaceOfMindAfterSalesCount != null ? peaceOfMindAfterSalesCount : 0)
.multiply(new BigDecimal("100"))
.divide(new BigDecimal(peaceOfMindTotalCount), 2, BigDecimal.ROUND_HALF_UP);
}
// 电池售后占比
if (batteryTotalCount != null && batteryTotalCount > 0) {
batteryAfterSalesRate = new BigDecimal(batteryAfterSalesCount != null ? batteryAfterSalesCount : 0)
.multiply(new BigDecimal("100"))
.divide(new BigDecimal(batteryTotalCount), 2, BigDecimal.ROUND_HALF_UP);
}
// 轮胎险售后占比
if (tireInsuranceTotalCount != null && tireInsuranceTotalCount > 0) {
tireInsuranceAfterSalesRate = new BigDecimal(tireInsuranceAfterSalesCount != null ? tireInsuranceAfterSalesCount : 0)
.multiply(new BigDecimal("100"))
.divide(new BigDecimal(tireInsuranceTotalCount), 2, BigDecimal.ROUND_HALF_UP);
}
}
}
\ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;
/**
* 问界鸿蒙品牌门店业绩DTO
* 包含:智界、享界、尚界等品牌
*
* 指标计算说明:
* 1. 渗透率分母为门店累计交付数
* 2. 售后占比 = 售后成交数 / 总成交数(售前+售后)
*/
@Data
public class HarmonyStorePerformanceDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "门店ID")
private Integer merchantId;
@ApiModelProperty(notes = "门店名称")
private String merchantName;
@ApiModelProperty(notes = "品牌ID")
private Integer brandId;
@ApiModelProperty(notes = "品牌名称")
private String brandName;
@ApiModelProperty(notes = "驻店销售数量")
private Integer staffCount;
// ========== 核心指标(1级指标)==========
/**
* 交付数(门店累计交付数)
* 该门店在归属在该督导管理驻店销售范围+延保权益场景下+对应时间段内的总的门店累计交付数
*/
@ApiModelProperty(notes = "交付数(门店累计交付数)")
private Integer deliveryCount;
/**
* 售前触客数(实际售前触客数)
* 该门店在归属在该督导管理驻店销售范围+延保权益场景下+对应时间段内的总的实际售前触客数
*/
@ApiModelProperty(notes = "售前触客数")
private Integer preSalesTouchCount;
/**
* 总产值
* 该门店在归属在该督导管理驻店销售范围+延保权益场景下+对应时间段内的门店累计成交金额
*/
@ApiModelProperty(notes = "总产值(万元)")
private BigDecimal totalOutput;
// ========== 渗透率指标(2级指标)==========
/**
* 整车延保渗透率 = 整车延保成交数(售前+售后)/门店累计交付数
*/
@ApiModelProperty(notes = "整车延保渗透率(%)")
private BigDecimal vehicleWarrantyRate;
/**
* 安心包渗透率 = 安心包成交数(售前+售后)/门店累计交付数
*/
@ApiModelProperty(notes = "安心包渗透率(%)")
private BigDecimal peaceOfMindRate;
/**
* 电池延保渗透率 = 电池延保成交数(售前+售后)/门店累计交付数
*/
@ApiModelProperty(notes = "电池延保渗透率(%)")
private BigDecimal batteryWarrantyRate;
/**
* 轮胎险渗透率 = 轮胎险成交数(售前+售后)/门店累计交付数
*/
@ApiModelProperty(notes = "轮胎险渗透率(%)")
private BigDecimal tireInsuranceRate;
// ========== 售后能力指标(2级指标)==========
/**
* 整车延保售后占比 = 整车延保售后成交数 / 整车延保成交数(售前+售后)
*/
@ApiModelProperty(notes = "整车延保售后占比(%)")
private BigDecimal vehicleWarrantyAfterSalesRate;
/**
* 安心包售后占比 = 安心包售后成交数 / 安心包成交数(售前+售后)
*/
@ApiModelProperty(notes = "安心包售后占比(%)")
private BigDecimal peaceOfMindAfterSalesRate;
/**
* 电池售后占比 = 电池售后成交数 / 电池成交数(售前+售后)
*/
@ApiModelProperty(notes = "电池售后占比(%)")
private BigDecimal batteryAfterSalesRate;
/**
* 轮胎险售后占比 = 轮胎险售后成交数 / 轮胎险成交数(售前+售后)
*/
@ApiModelProperty(notes = "轮胎险售后占比(%)")
private BigDecimal tireInsuranceAfterSalesRate;
// ========== 中间指标(1级指标,用于计算2级指标)==========
// 整车延保相关
@ApiModelProperty(notes = "整车延保成交数(售前+售后)")
private Integer vehicleWarrantyTotalCount;
@ApiModelProperty(notes = "整车延保售后成交数")
private Integer vehicleWarrantyAfterSalesCount;
// 安心包相关
@ApiModelProperty(notes = "安心包成交数(售前+售后)")
private Integer peaceOfMindTotalCount;
@ApiModelProperty(notes = "安心包售后成交数")
private Integer peaceOfMindAfterSalesCount;
// 电池延保相关
@ApiModelProperty(notes = "电池延保成交数(售前+售后)")
private Integer batteryTotalCount;
@ApiModelProperty(notes = "电池延保售后成交数")
private Integer batteryAfterSalesCount;
// 轮胎险相关
@ApiModelProperty(notes = "轮胎险成交数(售前+售后)")
private Integer tireInsuranceTotalCount;
@ApiModelProperty(notes = "轮胎险售后成交数")
private Integer tireInsuranceAfterSalesCount;
// ========== 预警等级 ==========
/**
* 预警等级:0-红(预警),1-黄(需关注),2-绿(达标)
* 根据门店基础信息中的兜底指标确定
*/
@ApiModelProperty(notes = "预警等级:0-红,1-黄,2-绿")
private Integer warningLevel;
// ========== 格式化后的显示值 ==========
@ApiModelProperty(notes = "格式化后的交付数")
private String displayDeliveryCount;
@ApiModelProperty(notes = "格式化后的售前触客数")
private String displayPreSalesTouchCount;
@ApiModelProperty(notes = "格式化后的总产值(万元)")
private String displayTotalOutput;
@ApiModelProperty(notes = "格式化后的整车延保渗透率")
private String displayVehicleWarrantyRate;
@ApiModelProperty(notes = "格式化后的安心包渗透率")
private String displayPeaceOfMindRate;
@ApiModelProperty(notes = "格式化后的电池延保渗透率")
private String displayBatteryWarrantyRate;
@ApiModelProperty(notes = "格式化后的轮胎险渗透率")
private String displayTireInsuranceRate;
@ApiModelProperty(notes = "格式化后的整车延保售后占比")
private String displayVehicleWarrantyAfterSalesRate;
@ApiModelProperty(notes = "格式化后的安心包售后占比")
private String displayPeaceOfMindAfterSalesRate;
@ApiModelProperty(notes = "格式化后的电池售后占比")
private String displayBatteryAfterSalesRate;
@ApiModelProperty(notes = "格式化后的轮胎险售后占比")
private String displayTireInsuranceAfterSalesRate;
/**
* 计算2级指标(问界鸿蒙门店维度)
*/
public void calculateSecondaryIndicators() {
// 计算渗透率指标(分母为门店累计交付数)
if (deliveryCount != null && deliveryCount > 0) {
BigDecimal denominator = new BigDecimal(deliveryCount);
// 整车延保渗透率
if (vehicleWarrantyTotalCount != null) {
vehicleWarrantyRate = new BigDecimal(vehicleWarrantyTotalCount)
.multiply(new BigDecimal("100"))
.divide(denominator, 2, BigDecimal.ROUND_HALF_UP);
}
// 安心包渗透率
if (peaceOfMindTotalCount != null) {
peaceOfMindRate = new BigDecimal(peaceOfMindTotalCount)
.multiply(new BigDecimal("100"))
.divide(denominator, 2, BigDecimal.ROUND_HALF_UP);
}
// 电池延保渗透率
if (batteryTotalCount != null) {
batteryWarrantyRate = new BigDecimal(batteryTotalCount)
.multiply(new BigDecimal("100"))
.divide(denominator, 2, BigDecimal.ROUND_HALF_UP);
}
// 轮胎险渗透率
if (tireInsuranceTotalCount != null) {
tireInsuranceRate = new BigDecimal(tireInsuranceTotalCount)
.multiply(new BigDecimal("100"))
.divide(denominator, 2, BigDecimal.ROUND_HALF_UP);
}
}
// 计算售后占比指标
// 整车延保售后占比
if (vehicleWarrantyTotalCount != null && vehicleWarrantyTotalCount > 0) {
vehicleWarrantyAfterSalesRate = new BigDecimal(vehicleWarrantyAfterSalesCount != null ? vehicleWarrantyAfterSalesCount : 0)
.multiply(new BigDecimal("100"))
.divide(new BigDecimal(vehicleWarrantyTotalCount), 2, BigDecimal.ROUND_HALF_UP);
}
// 安心包售后占比
if (peaceOfMindTotalCount != null && peaceOfMindTotalCount > 0) {
peaceOfMindAfterSalesRate = new BigDecimal(peaceOfMindAfterSalesCount != null ? peaceOfMindAfterSalesCount : 0)
.multiply(new BigDecimal("100"))
.divide(new BigDecimal(peaceOfMindTotalCount), 2, BigDecimal.ROUND_HALF_UP);
}
// 电池售后占比
if (batteryTotalCount != null && batteryTotalCount > 0) {
batteryAfterSalesRate = new BigDecimal(batteryAfterSalesCount != null ? batteryAfterSalesCount : 0)
.multiply(new BigDecimal("100"))
.divide(new BigDecimal(batteryTotalCount), 2, BigDecimal.ROUND_HALF_UP);
}
// 轮胎险售后占比
if (tireInsuranceTotalCount != null && tireInsuranceTotalCount > 0) {
tireInsuranceAfterSalesRate = new BigDecimal(tireInsuranceAfterSalesCount != null ? tireInsuranceAfterSalesCount : 0)
.multiply(new BigDecimal("100"))
.divide(new BigDecimal(tireInsuranceTotalCount), 2, BigDecimal.ROUND_HALF_UP);
}
}
}
\ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import lombok.Data;
/**
* 门店业绩查询请求参数
*/
@ApiModel(description = "门店业绩查询请求参数")
@Data
public class MerchantQueryReq implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "商户号", required = true)
@NotNull
private Integer merchantId;
@ApiModelProperty(notes = "开始日期", example = "2026-02-01", required = true)
@NotNull
private String startDate;
@ApiModelProperty(notes = "结束日期", example = "2026-02-29", required = true)
@NotNull
private String endDate;
@ApiModelProperty(notes = "日期类型:0-指定时段,1-周,2-月", example = "1", required = true)
@NotNull
private Integer dateType;
/**
* 统计维度:
* 1 - 问界鸿蒙--延保权益
* 2 - 通用品牌--延保权益
*/
@ApiModelProperty(notes = "统计维度:1-问界鸿蒙--延保权益,2-通用品牌--延保权益", example = "1")
private Integer statDimension;
@ApiModelProperty(notes = "搜索关键词(姓名或门店名称)")
private String searchKeyword;
@ApiModelProperty(notes = "门店区域")
public String region;
}
\ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
import javax.validation.constraints.NotNull;
import lombok.Data;
/**
* 盯防业绩查询请求参数
*/
@ApiModel(description = "盯防业绩查询请求参数")
@Data
public class SupervisionQueryReq implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "督导ID", required = true)
@NotNull
private String supervisorId;
@ApiModelProperty(notes = "开始日期", example = "2026-02-01", required = true)
@NotNull
private String startDate;
@ApiModelProperty(notes = "结束日期", example = "2026-02-29", required = true)
@NotNull
private String endDate;
@ApiModelProperty(notes = "日期类型:0-指定时段,1-周,2-月", example = "1", required = true)
@NotNull
private Integer dateType;
/**
* 统计维度:
* 1 - 问界鸿蒙--延保权益
* 2 - 通用品牌--延保权益
*/
@ApiModelProperty(notes = "统计维度:1-问界鸿蒙--延保权益,2-通用品牌--延保权益", example = "1")
private Integer statDimension;
@ApiModelProperty(notes = "搜索关键词(姓名或门店名称)")
private String searchKeyword;
@ApiModelProperty(notes = "门店区域")
public String region;
}
\ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import lombok.Data;
/**
* 督导管理查询请求参数(总部运营视角)
*
* 用于总部运营查看所有督导业绩和所有门店业绩,不需要指定特定督导
*/
@ApiModel(description = "督导管理查询请求参数(总部运营视角)")
@Data
public class SupervisorManagementQueryReq implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "开始日期", example = "2026-02-01", required = true)
@NotNull
private String startDate;
@ApiModelProperty(notes = "结束日期", example = "2026-02-29", required = true)
@NotNull
private String endDate;
@ApiModelProperty(notes = "日期类型:0-指定时段,1-周,2-月", example = "1", required = true)
@NotNull
private Integer dateType;
/**
* 统计维度:
* 1 - 问界鸿蒙--延保权益
* 2 - 通用品牌--延保权益
*/
@ApiModelProperty(notes = "统计维度:1-问界鸿蒙--延保权益,2-通用品牌--延保权益", example = "1")
private Integer statDimension;
@ApiModelProperty(notes = "搜索关键词(姓名或门店名称)")
private String searchKeyword;
@ApiModelProperty(notes = "门店区域(仅门店业绩查询时使用)")
private String region;
}
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import lombok.Data;
/**
* 督导业绩DTO(总部运营视角)
*/
@Data
public class SupervisorPerformanceDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "督导ID")
private String supervisorId;
@ApiModelProperty(notes = "督导姓名")
private String supervisorName;
@ApiModelProperty(notes = "督导手机号")
private String supervisorPhone;
@ApiModelProperty(notes = "所属区域")
private String region;
// ========== 管理维度数据 ==========
@ApiModelProperty(notes = "辖区门店数")
private Integer regionStoreCount;
@ApiModelProperty(notes = "预警门店数(红店)")
private Integer warningStoreCount;
@ApiModelProperty(notes = "需关注门店数(黄店)")
private Integer attentionStoreCount;
@ApiModelProperty(notes = "管理驻店数")
private Integer managedStaffCount;
// ========== 核心指标(复用驻店销售业绩逻辑) ==========
@ApiModelProperty(notes = "交付数(应触客数)")
private Integer deliveryCount;
@ApiModelProperty(notes = "售前触客数")
private Integer preSalesTouchCount;
@ApiModelProperty(notes = "总产值(万元)")
private BigDecimal totalOutput;
@ApiModelProperty(notes = "触客成交率(%)")
private BigDecimal touchConversionRate;
@ApiModelProperty(notes = "延保渗透率(%)")
private BigDecimal warrantyRate;
@ApiModelProperty(notes = "权益商品渗透率(%)")
private BigDecimal equityProductRate;
@ApiModelProperty(notes = "权益渗透率(%)")
private BigDecimal equityRate;
@ApiModelProperty(notes = "延保售后占比(%)")
private BigDecimal warrantyAfterSalesRate;
@ApiModelProperty(notes = "权益商品售后占比(%)")
private BigDecimal equityProductAfterSalesRate;
@ApiModelProperty(notes = "权益售后占比(%)")
private BigDecimal equityAfterSalesRate;
@ApiModelProperty(notes = "权益平均客单价(元)")
private BigDecimal equityAvgUnitPrice;
// ========== 通用品牌中间指标(一级指标,用于计算二级指标) ==========
@ApiModelProperty(notes = "主订单成交数")
private Integer mainOrderCount;
@ApiModelProperty(notes = "含延保产品交付的主订单成交数")
private Integer warrantyMainOrderCount;
@ApiModelProperty(notes = "含延保产品交付的售后主订单成交数")
private Integer warrantyAfterSalesOrderCount;
@ApiModelProperty(notes = "含权益产品交付的子订单成交数")
private Integer equitySubOrderCount;
@ApiModelProperty(notes = "含权益产品交付的售后子订单成交数")
private Integer equityAfterSalesSubOrderCount;
@ApiModelProperty(notes = "含权益产品交付的主订单成交数")
private Integer equityMainOrderCount;
@ApiModelProperty(notes = "含权益产品交付的售后主订单成交数")
private Integer equityAfterSalesMainOrderCount;
@ApiModelProperty(notes = "含权益产品的子订单金额数")
private BigDecimal equitySubOrderAmount;
// ========== 问界鸿蒙品牌指标 ==========
// 渗透率指标(二级指标)
@ApiModelProperty(notes = "整车延保渗透率")
private BigDecimal vehicleWarrantyRate;
@ApiModelProperty(notes = "安心包渗透率")
private BigDecimal peaceOfMindRate;
@ApiModelProperty(notes = "电池延保渗透率")
private BigDecimal batteryWarrantyRate;
@ApiModelProperty(notes = "轮胎险渗透率")
private BigDecimal tireInsuranceRate;
// 售后能力指标(二级指标)
@ApiModelProperty(notes = "整车延保售后占比")
private BigDecimal vehicleWarrantyAfterSalesRate;
@ApiModelProperty(notes = "安心包售后占比")
private BigDecimal peaceOfMindAfterSalesRate;
@ApiModelProperty(notes = "电池售后占比")
private BigDecimal batteryAfterSalesRate;
@ApiModelProperty(notes = "轮胎险售后占比")
private BigDecimal tireInsuranceAfterSalesRate;
// 中间指标(一级指标,用于计算二级指标)
@ApiModelProperty(notes = "整车延保成交数(售前+售后)")
private Integer vehicleWarrantyTotalCount;
@ApiModelProperty(notes = "整车延保售后成交数")
private Integer vehicleWarrantyAfterSalesCount;
@ApiModelProperty(notes = "安心包成交数(售前+售后)")
private Integer peaceOfMindTotalCount;
@ApiModelProperty(notes = "安心包售后成交数")
private Integer peaceOfMindAfterSalesCount;
@ApiModelProperty(notes = "电池延保成交数(售前+售后)")
private Integer batteryTotalCount;
@ApiModelProperty(notes = "电池延保售后成交数")
private Integer batteryAfterSalesCount;
@ApiModelProperty(notes = "轮胎险成交数(售前+售后)")
private Integer tireInsuranceTotalCount;
@ApiModelProperty(notes = "轮胎险售后成交数")
private Integer tireInsuranceAfterSalesCount;
// ========== 预警等级 ==========
@ApiModelProperty(notes = "预警等级:0-红,1-黄,2-绿")
private Integer warningLevel;
// ========== 格式化显示值 ==========
@ApiModelProperty(notes = "格式化后的交付数")
private String displayDeliveryCount;
@ApiModelProperty(notes = "格式化后的售前触客数")
private String displayPreSalesTouchCount;
@ApiModelProperty(notes = "格式化后的总产值(万元)")
private String displayTotalOutput;
@ApiModelProperty(notes = "格式化后的触客成交率")
private String displayTouchConversionRate;
@ApiModelProperty(notes = "格式化后的延保渗透率")
private String displayWarrantyRate;
@ApiModelProperty(notes = "格式化后的权益商品渗透率")
private String displayEquityProductRate;
@ApiModelProperty(notes = "格式化后的权益渗透率")
private String displayEquityRate;
@ApiModelProperty(notes = "格式化后的延保售后占比")
private String displayWarrantyAfterSalesRate;
@ApiModelProperty(notes = "格式化后的权益商品售后占比")
private String displayEquityProductAfterSalesRate;
@ApiModelProperty(notes = "格式化后的权益售后占比")
private String displayEquityAfterSalesRate;
@ApiModelProperty(notes = "格式化后的权益平均客单价")
private String displayEquityAvgUnitPrice;
// ========== 关联数据(用于跳转) ==========
@ApiModelProperty(notes = "负责的门店列表(用于跳转查看)")
private List<StorePerformanceDTO> storeList;
}
\ No newline at end of file
......@@ -131,4 +131,90 @@ public interface SupervisorDashboardRemote {
RpcResponse<RecordingListDTO> getRecordingList(RecordingQueryReq req);
/**
* 盯防驻店销售业绩接口
* <p>
* 获取督导管理范围内的驻店销售业绩数据
* 支持问界鸿蒙和通用品牌区分统计
* </p>
*/
@interface GetStaffPerformance {}
@ApiOperation("盯防驻店销售业绩接口")
@ApiMethod("盯防驻店销售业绩接口")
@ApiParams({
@ApiParam(name = "req", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
})
@ApiResponse("驻店销售业绩列表")
RpcResponse<List<StaffPerformanceDTO>> getStaffPerformance(SupervisionQueryReq req);
/**
* 盯防门店业绩接口
* <p>
* 获取督导管理范围内的门店业绩数据
* 支持问界鸿蒙和通用品牌区分统计
* </p>
*/
@interface GetStorePerformance {}
@ApiOperation("盯防门店业绩接口")
@ApiMethod("盯防门店业绩接口")
@ApiParams({
@ApiParam(name = "req", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
})
@ApiResponse("门店业绩列表")
RpcResponse<List<StorePerformanceDTO>> getStorePerformance(SupervisionQueryReq req);
/**
* 门店维度业绩看板接口
* <p>
* 入口:从工作台&团队页面--团队概况中,点击门店数量的区域,跳转进入
* 数据默认按照品牌进行区分统计,支持"问界鸿蒙--延保权益"、"通用品牌--延保权益"固定筛选
* 支持日、周、月的时间筛选
* 支持直接搜索门店名称进行查询
* 排序规则:红店(驻店有预警) > 黄店(驻店需关注) > 绿店(驻店达标)
* </p>
*/
@interface GetStorePerformanceByMerchant {}
@ApiOperation("门店维度业绩看板接口")
@ApiMethod("门店维度业绩看板接口")
@ApiParams({
@ApiParam(name = "req", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
})
@ApiResponse("门店业绩列表")
RpcResponse<List<StaffPerformanceDTO>> getStorePerformanceByMerchant(MerchantQueryReq req);
/**
* 业绩概览 -- 督导业绩接口(总部运营视角)
* <p>
* 触发场景:运营在"督导业绩" Tab页查看
* 数据复用:界面及统计逻辑复用"驻店销售业绩列表",但统计对象变为"区域督导"
* 包含:辖区门店数、预警门店数、需关注门店数、管理驻店数等管理维度数据
* </p>
*/
@interface GetSupervisorPerformance {}
@ApiOperation("业绩概览 -- 督导业绩接口")
@ApiMethod("业绩概览 -- 督导业绩接口")
@ApiParams({
@ApiParam(name = "req", notes = "查询参数(总部运营视角,不需要指定督导ID)", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
})
@ApiResponse("督导业绩列表")
RpcResponse<List<SupervisorPerformanceDTO>> getSupervisorPerformance(SupervisorManagementQueryReq req);
/**
* 业绩概览 -- 门店业绩接口(总部运营视角)
* <p>
* 触发场景:运营在"门店业绩" Tab页查看
* 数据范围:展示所有门店业绩(无负责范围过滤)
* 筛选功能:支持按"区域"进行筛选
* </p>
*/
@interface GetAllStorePerformance {}
@ApiOperation("业绩概览 -- 门店业绩接口")
@ApiMethod("业绩概览 -- 门店业绩接口")
@ApiParams({
@ApiParam(name = "req", notes = "查询参数(总部运营视角,不需要指定督导ID)", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
})
@ApiResponse("门店业绩列表")
RpcResponse<List<StorePerformanceDTO>> getAllStorePerformance(SupervisorManagementQueryReq req);
}
  • @wangxw1
    commented
    Master

    一、关键问题与优化建议(Top 3)

    1. 业务计算逻辑(舍入模式)不一致

    • 问题描述:在计算相同类型的业务指标(如渗透率)时,员工维度和门店维度的计算代码采用了不同的舍入策略。StaffPerformanceDTO(及 HarmonyStaffPerformanceDTO)中使用了先乘 100 再除,且采用 BigDecimal.ROUND_HALF_UP(四舍五入);而 StorePerformanceDTO 中使用了先除再乘 100,且采用 RoundingMode.DOWN(向下取整)。
    • 影响分析:同一指标在不同维度下计算规则不一致,会导致前端报表展示时,员工维度的汇总数据与门店维度的数据无法对齐,容易引发业务方对数据准确性的质疑。
    • 优化建议:建议统一所有维度的舍入规则,并将计算逻辑提取到公共的工具类中,避免代码重复和规则不一。且建议使用较新的 RoundingMode.HALF_UP 替代废弃的 BigDecimal.ROUND_HALF_UP。 java // 建议抽取的公共计算方法 public static BigDecimal calculateRate(Integer numerator, Integer denominator) { if (numerator == null || denominator == null || denominator == 0) { return BigDecimal.ZERO; } return BigDecimal.valueOf(numerator) .multiply(BigDecimal.valueOf(100)) .divide(BigDecimal.valueOf(denominator), 2, RoundingMode.HALF_UP); }

    2. 全局静态配置集合存在被篡改的风险

    • 问题描述:IndicatorConfig 类中的 GENERAL_STAFF_INDICATORS 等配置集合被声明为 public static final Map,并在静态代码块中初始化,但未使用不可变集合进行包装。
    • 影响分析:final 关键字仅保证引用地址不可变,外部调用方仍可通过 .put()、.remove() 等方法修改集合内部的数据。这可能导致全局指标配置在运行时被意外篡改,引发不可预知的系统错误。
    • 优化建议:在静态代码块初始化完成后,使用 Collections.unmodifiableMap 封装这些集合,或者将其访问级别改为 private 并仅暴露只读的获取方法。 java // 优化示例 public static final Map<String, IndicatorInfo> GENERAL_STAFF_INDICATORS; static { Map<String, IndicatorInfo> tempGeneralStaff = new HashMap<>(); addIndicator(tempGeneralStaff, "A061", "deliveryCount", "交付数", Level.FIRST, true); // ... 其他指标初始化 GENERAL_STAFF_INDICATORS = Collections.unmodifiableMap(tempGeneralStaff); }

    3. DTO 字段封装性被破坏

    • 问题描述:在 MerchantQueryReq、StorePerformanceDTO、SupervisionQueryReq 等类中,region 字段被声明为了 public String region;。
    • 影响分析:违背了面向对象编程的封装性原则。类级别已经使用了 Lombok 的 @Data 注解,会自动生成 getter/setter 方法,将字段显式声明为 public 是不规范的工程实践。
    • 优化建议:将相关类中的 public String region; 修改为 private String region;。

    二、评分明细

    • 功能实现的正确性与健壮性(35/40分):
      • 理由:指标计算时都进行了分母判空处理,有效避免了除零异常(ArithmeticException),健壮性良好。但在不同对象中出现了计算逻辑(舍入模式)不一致的问题,可能引发业务数据对不齐的 Bug,故扣除 5 分。
    • 安全性与潜在风险(25/30分):
      • 理由:未发现 SQL 注入、越权等严重漏洞;Dubbo 的 Remote 接口中仅新增了方法,未变更已有方法参数,符合安全规则。但全局静态配置暴露了可变集合,存在被意外篡改的内存安全风险,故扣除 5 分。
    • 最佳实践与可维护性(15/20分):
      • 理由:代码结构清晰,注释较为完善。但 DTO 字段使用了 public 破坏了封装性,且存在大量相似的计算逻辑散落在不同的 DTO 中(未做抽象复用),故扣除 5 分。
    • 性能与资源利用(5/5分):
      • 理由:没有明显的性能瓶颈,资源利用合理。
    • 提交信息质量(5/5分):
      • 理由:Commit 信息清晰、准确,详细列出了本次变更的具体内容,符合最佳实践。

    总分:85分

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