Commit a3ec481e by zhouhaibao

[+]督导新增团队以及个人业绩模块查询、优秀案例管理

1 parent 5b11ae02
Showing 41 changed files with 4077 additions and 0 deletions
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 优秀案例提交请求DTO
* <p>
* 包含优秀案例提交的请求参数,如录音ID、员工ID、督导ID等
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "优秀案例提交请求DTO")
@Data
public class CaseSubmitReq implements Serializable {
/**
* 录音ID
*/
@ApiModelProperty(value = "录音ID", example = "123", required = true)
private Long recordingId;
/**
* 员工ID
*/
@ApiModelProperty(value = "员工ID", example = "123_456", required = true)
private String employeeId;
/**
* 督导ID
*/
@ApiModelProperty(value = "督导ID", example = "123", required = true)
private Long supervisorId;
/**
* 案例描述
*/
@ApiModelProperty(value = "案例描述", example = "该录音展示了优秀的销售技巧")
private String caseDescription;
}
\ No newline at end of file \ 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;
@Data
public class DashboardMetrics implements Serializable {
public static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "门店数量")
private Integer storeCount; // 门店数量 (不受维度限制)
@ApiModelProperty(notes = "驻店人员总数")
private Integer staffCount; // 驻店人员总数 (受维度限制)
@ApiModelProperty(notes = "总产值")
private BigDecimal totalOutput; // 总产值 (受维度限制)
@ApiModelProperty(notes = "核心指标")
private BigDecimal avgUnitPrice; // 平均客单价 (A076 聚合)
@ApiModelProperty(notes = "核心指标")
private BigDecimal avgConversion; // 平均转化率 (A085 聚合)
}
\ No newline at end of file \ 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;
/**
* 督导看板查询请求参数
* <p>
* 包含督导看板查询的请求参数,如督导ID、日期范围、日期类型、业务类型等
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "督导看板查询请求参数")
@Data
public class DashboardQueryReq implements Serializable {
public static final long serialVersionUID = 1L;
/**
* 督导ID
*/
@ApiModelProperty(value = "督导ID", example = "123", required = true, notes = "督导ID")
@NotNull
private String supervisorId;
/**
* 当前选中的开始日期
*/
@ApiModelProperty(value = "当前选中的开始日期", example = "2026-02-01", required = true, notes = "当前选中的开始日期")
@NotNull
private String startDate; // 当前选中的基准日期
/**
* 当前选中的结束日期
*/
@ApiModelProperty(value = "当前选中的结束日期", example = "2026-02-29", required = true, notes = "当前选中的结束日期")
@NotNull
private String endDate;
/**
* 日期类型:0,按指定时段;1,按周;2,按月;3,按年;4,全部
*/
@ApiModelProperty(value = "日期类型", example = "0", required = true, notes = "日期类型:0,按指定时段;1,按周;2,按月;3,按年;4,全部")
@NotNull
private Integer dateType;
/**
* 业务类型:1.延保 2.轻改 3.权益 4.二手车 必传
*/
@ApiModelProperty(value = "业务类型", example = "1", notes = "业务类型:1.延保 2.轻改 3.权益 4.二手车 必传")
private Integer bizs;
/**
* 门店ID列表
*/
@ApiModelProperty(value = "门店ID列表", notes = "门店ID列表")
private List<Integer> merchantIds;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 员工基础信息DTO
* <p>
* 包含员工基础信息,如姓名、手机号、归业业务、入职时间、年龄、出生日期、民族、籍贯、入职部门、职务、直线经理等
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "员工基础信息DTO")
@Data
public class EmployeeBasicInfoDTO implements Serializable {
/**
* 姓名
*/
@ApiModelProperty(value = "姓名", example = "周芳")
private String name;
/**
* 手机号
*/
@ApiModelProperty(value = "手机号", example = "13812345678")
private String phone;
/**
* 归属业务
*/
@ApiModelProperty(value = "归属业务", example = "延保")
private String business;
/**
* 入职时间
*/
@ApiModelProperty(value = "入职时间", example = "2025-12-12")
private String entryDate;
/**
* 年龄
*/
@ApiModelProperty(value = "年龄", example = "33")
private Integer age;
/**
* 出生日期
*/
@ApiModelProperty(value = "出生日期", example = "1993-03-26")
private String birthday;
/**
* 民族
*/
@ApiModelProperty(value = "民族", example = "汉")
private String ethnicity;
/**
* 籍贯
*/
@ApiModelProperty(value = "籍贯", example = "陕西省/延安市")
private String origin;
/**
* 入职部门
*/
@ApiModelProperty(value = "入职部门", example = "运营零售部门")
private String department;
/**
* 职务
*/
@ApiModelProperty(value = "职务", example = "延保门店销售")
private String position;
/**
* 直线经理
*/
@ApiModelProperty(value = "直线经理", example = "XXX")
private String manager;
/**
* 性别
*/
@ApiModelProperty(value = "性别", example = "女")
private String gender;
}
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 人员基础信息请求DTO
* <p>
* 包含人员基础信息查询的请求参数
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "人员基础信息请求DTO")
@Data
public class EmployeeBasicInfoReq implements Serializable {
/**
* 员工ID
*/
@ApiModelProperty(value = "员工ID", example = "123_456", required = true)
private String employeeId;
/**
* 督导ID
*/
@ApiModelProperty(value = "督导ID", example = "123", required = true)
private Long supervisorId;
}
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Map;
/**
* 个人行为分析数据DTO
* <p>
* 包含员工行为分析数据,如考勤统计、日报统计、客户接待、录音分析、着装预警等
* 支持场景、时间维度的查询
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "个人行为分析数据DTO")
@Data
public class EmployeeBehaviorDTO implements Serializable {
/**
* AI建议
*/
@ApiModelProperty(value = "AI建议", example = "该员工学习时长领先但线索转化率低于平均水平,建议加强成交环节的实操带教")
private String aiSuggestion;
/**
* 考勤统计
*/
@ApiModelProperty(value = "考勤统计")
private AttendanceData attendance;
/**
* 日报统计
*/
@ApiModelProperty(value = "日报统计")
private DailyReportData dailyReport;
/**
* 客户接待
*/
@ApiModelProperty(value = "客户接待")
private CustomerReceptionData customerReception;
/**
* 录音分析
*/
@ApiModelProperty(value = "录音分析")
private RecordingAnalysisData recordingAnalysis;
/**
* 着装预警
*/
@ApiModelProperty(value = "着装预警")
private DressCodeWarningData dressCodeWarning;
/**
* 考勤统计数据
*/
@ApiModel(description = "考勤统计数据")
@Data
public static class AttendanceData implements Serializable {
/**
* 打卡天数
*/
@ApiModelProperty(value = "打卡天数", example = "1")
private Integer checkInDays;
/**
* 迟到次数
*/
@ApiModelProperty(value = "迟到次数", example = "1")
private Integer late;
/**
* 早退次数
*/
@ApiModelProperty(value = "早退次数", example = "1")
private Integer earlyLeave;
/**
* 旷工次数
*/
@ApiModelProperty(value = "旷工次数", example = "1")
private Integer absenteeism;
}
/**
* 日报统计数据
*/
@ApiModel(description = "日报统计数据")
@Data
public static class DailyReportData implements Serializable {
/**
* 已提交
*/
@ApiModelProperty(value = "已提交", example = "0")
private Integer submitted;
/**
* 未提交
*/
@ApiModelProperty(value = "未提交", example = "1")
private Integer notSubmitted;
/**
* 在岗
*/
@ApiModelProperty(value = "在岗", example = "0")
private Integer onDuty;
/**
* 调休
*/
@ApiModelProperty(value = "调休", example = "0")
private Integer rest;
/**
* 日报完成率
*/
@ApiModelProperty(value = "日报完成率", example = "85%")
private String completionRate;
}
/**
* 客户接待数据
*/
@ApiModel(description = "客户接待数据")
@Data
public static class CustomerReceptionData implements Serializable {
/**
* 实际交车数(指标A062)
*/
@ApiModelProperty(value = "实际交车数(指标A062)", example = "4")
private Integer actualDelivery;
/**
* 接待数量(指标A084)
*/
@ApiModelProperty(value = "接待数量(指标A084)", example = "2")
private Integer receptionCount;
/**
* 未触客数
*/
@ApiModelProperty(value = "未触客数", example = "2")
private Integer notTouched;
}
/**
* 录音分析数据
*/
@ApiModel(description = "录音分析数据")
@Data
public static class RecordingAnalysisData implements Serializable {
/**
* 行为标签
*/
@ApiModelProperty(value = "行为标签")
private Map<String, String> behaviorTags;
/**
* 量化指标
*/
@ApiModelProperty(value = "量化指标")
private QuantitativeIndicators quantitativeIndicators;
}
/**
* 量化指标数据
*/
@ApiModel(description = "量化指标数据")
@Data
public static class QuantitativeIndicators implements Serializable {
/**
* 录音数
*/
@ApiModelProperty(value = "录音数", example = "2")
private Integer recordingCount;
/**
* 成交数
*/
@ApiModelProperty(value = "成交数", example = "1")
private Integer dealCount;
/**
* 战败数
*/
@ApiModelProperty(value = "战败数", example = "1")
private Integer defeatCount;
/**
* 成交率
*/
@ApiModelProperty(value = "成交率", example = "50%")
private String dealRate;
/**
* 质检平均分
*/
@ApiModelProperty(value = "质检平均分", example = "2")
private Integer qualityScore;
/**
* 攻防平均分
*/
@ApiModelProperty(value = "攻防平均分", example = "1")
private Integer attackDefenseScore;
/**
* 录音缺失率
*/
@ApiModelProperty(value = "录音缺失率", example = "1")
private Integer recordingMissingRate;
}
/**
* 着装预警数据
*/
@ApiModel(description = "着装预警数据")
@Data
public static class DressCodeWarningData implements Serializable {
/**
* 预警次数
*/
@ApiModelProperty(value = "预警次数", example = "1")
private Integer warningCount;
}
}
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 个人行为分析数据请求DTO
* <p>
* 包含个人行为分析数据查询的请求参数
* 支持场景、时间维度的查询
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "个人行为分析数据请求DTO")
@Data
public class EmployeeBehaviorReq implements Serializable {
/**
* 员工ID
*/
@ApiModelProperty(value = "员工ID", example = "123_456", required = true)
private String employeeId;
/**
* 督导ID
*/
@ApiModelProperty(value = "督导ID", example = "123", required = true)
private Long supervisorId;
/**
* 场景
*/
@ApiModelProperty(value = "场景", example = "sales")
private String scene;
/**
* 开始日期
*/
@ApiModelProperty(value = "开始日期", example = "2026-02-01")
private String startDate;
/**
* 结束日期
*/
@ApiModelProperty(value = "结束日期", example = "2026-02-29")
private String endDate;
/**
* 门店ID
*/
@ApiModelProperty(value = "门店ID", example = "1001")
private Integer merchantId;
}
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* 个人业绩数据DTO
* <p>
* 包含员工个人业绩数据,如总产值、客单价、总触客数、总成交数等
* 支持场景、时间、门店维度的查询
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "个人业绩数据DTO")
@Data
public class EmployeePerformanceDTO implements Serializable {
/**
* AI建议
*/
@ApiModelProperty(value = "AI建议", example = "该员工学习时长领先但线索转化率低于平均水平,建议加强成交环节的实操带教")
private String aiSuggestion;
/**
* 门店数据
*/
@ApiModelProperty(value = "门店数据")
private StorePerformanceData storeData;
/**
* 人员数据
*/
@ApiModelProperty(value = "人员数据")
private EmployeeData employeeData;
/**
* 个人产值趋势
*/
@ApiModelProperty(value = "个人产值趋势")
private List<TrendData> trendData;
/**
* 门店业绩数据
*/
@ApiModel(description = "门店业绩数据")
@Data
public static class StorePerformanceData implements Serializable {
/**
* 总产值(指标A036)
*/
@ApiModelProperty(value = "总产值(指标A036)", example = "15000")
private Integer totalValue;
/**
* 客单价(指标A076)
*/
@ApiModelProperty(value = "客单价(指标A076)", example = "12000")
private Integer averagePrice;
/**
* 总触客数(指标A084)
*/
@ApiModelProperty(value = "总触客数(指标A084)", example = "129")
private Integer totalCustomers;
/**
* 总成交数(指标A075)
*/
@ApiModelProperty(value = "总成交数(指标A075)", example = "101")
private Integer totalDeals;
}
/**
* 人员数据
*/
@ApiModel(description = "人员数据")
@Data
public static class EmployeeData implements Serializable {
/**
* 总产值
*/
@ApiModelProperty(value = "总产值", example = "93196")
private Integer totalValue;
/**
* 客单价
*/
@ApiModelProperty(value = "客单价", example = "11649.5")
private Double averagePrice;
/**
* 日报完成率
*/
@ApiModelProperty(value = "日报完成率", example = "100%")
private String dailyPerformanceRate;
}
/**
* 趋势数据
*/
@ApiModel(description = "趋势数据")
@Data
public static class TrendData implements Serializable {
/**
* 日期
*/
@ApiModelProperty(value = "日期", example = "2026-02-24")
private String date;
/**
* 产值
*/
@ApiModelProperty(value = "产值", example = "10000")
private Integer value;
}
}
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 个人业绩数据请求DTO
* <p>
* 包含个人业绩数据查询的请求参数
* 支持场景、时间、门店维度的查询
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "个人业绩数据请求DTO")
@Data
public class EmployeePerformanceReq implements Serializable {
/**
* 员工ID
*/
@ApiModelProperty(value = "员工ID", example = "123_456", required = true)
private String employeeId;
/**
* 督导ID
*/
@ApiModelProperty(value = "督导ID", example = "123", required = true)
private Long supervisorId;
/**
* 场景
*/
@ApiModelProperty(value = "场景", example = "sales")
private String scene;
/**
* 开始日期
*/
@ApiModelProperty(value = "开始日期", example = "2026-02-01")
private String startDate;
/**
* 结束日期
*/
@ApiModelProperty(value = "结束日期", example = "2026-02-29")
private String endDate;
/**
* 门店ID
*/
@ApiModelProperty(value = "门店ID", example = "1001")
private Integer merchantId;
}
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;
@Data
public class EmployeeRanking implements Serializable {
public static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "员工ID")
private String employeeId;
@ApiModelProperty(notes = "员工名称")
private String employeeName;
@ApiModelProperty(notes = "员工手机号")
private String employeePhone;
@ApiModelProperty(notes = "个人产值")
private BigDecimal personalOutput; // A036
@ApiModelProperty(notes = "个人客单价")
private BigDecimal personalUnitPrice; // A076
@ApiModelProperty(notes = "个人转化率")
private BigDecimal personalConversion; // A085
// --- 行为指标 (新增) ---
@ApiModelProperty(notes = "成交数")
private Integer dealCount;// 成交数 (A075)
@ApiModelProperty(notes = "战败数")
private Integer defeatCount; // 战败数 (A0123)
@ApiModelProperty(notes = "录音数")
private Integer recordingCount; // 录音数 (质检)
@ApiModelProperty(notes = "录音缺失率")
private BigDecimal missingRate; // 录音缺失率 (%)
// --- 衍生行为指标 (用于 AI 分析或前端展示) ---
private BigDecimal dealRate; // 成交率 = 成交/(成交 + 战败)
private BigDecimal avgRecordPerDeal; // 平均单产录音数 = 录音/成交
}
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 员工调店记录DTO
* <p>
* 包含员工在不同门店之间的流动履历
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "员工调店记录DTO")
@Data
public class EmployeeStoreTransferDTO implements Serializable {
/**
* 记录ID
*/
@ApiModelProperty(value = "记录ID", example = "1")
private Integer id;
/**
* 门店名称
*/
@ApiModelProperty(value = "门店名称", example = "深圳市南山界4S店")
private String storeName;
/**
* 开始日期
*/
@ApiModelProperty(value = "开始日期", example = "2025-12-12")
private String startDate;
/**
* 结束日期
*/
@ApiModelProperty(value = "结束日期", example = "2026-03-12")
private String endDate;
/**
* 状态(current: 当前, history: 历史)
*/
@ApiModelProperty(value = "状态(current: 当前, history: 历史)", example = "current")
private String status;
}
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 员工调店记录请求DTO
* <p>
* 包含员工调店记录查询的请求参数
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "员工调店记录请求DTO")
@Data
public class EmployeeStoreTransferReq implements Serializable {
/**
* 员工ID
*/
@ApiModelProperty(value = "员工ID", example = "123_456", required = true)
private String employeeId;
/**
* 督导ID
*/
@ApiModelProperty(value = "督导ID", example = "123", required = true)
private Long supervisorId;
}
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
@Data
@ToString
public class ExcellentCaseDetailDTO implements Serializable {
@ApiModelProperty(notes = "主键ID")
private Long id;
@ApiModelProperty(notes = "案例标题")
private String caseTitle;
@ApiModelProperty(notes = "驻店人员姓名")
private String staffName;
@ApiModelProperty(notes = "驻店人员手机号")
private String staffPhone;
@ApiModelProperty(notes = "门店ID")
private Integer merchantId;
@ApiModelProperty(notes = "门店名称")
private String merchantName;
@ApiModelProperty(notes = "客户类别")
private String customerCategory;
@ApiModelProperty(notes = "案例描述")
private String caseDescription;
@ApiModelProperty(notes = "录音URL")
private String recordingUrl;
@ApiModelProperty(notes = "录音时长(秒)")
private Integer recordingDuration;
@ApiModelProperty(notes = "提交人ID")
private Long submitterId;
@ApiModelProperty(notes = "提交人姓名")
private String submitterName;
@ApiModelProperty(notes = "提交人手机号")
private String submitterPhone;
@ApiModelProperty(notes = "审核状态:0-待审核,1-通过,2-驳回")
private Integer reviewStatus;
@ApiModelProperty(notes = "审核人ID")
private Long reviewerId;
@ApiModelProperty(notes = "审核人姓名")
private String reviewerName;
@ApiModelProperty(notes = "审核时间")
private Date reviewTime;
@ApiModelProperty(notes = "审核意见")
private String reviewComment;
@ApiModelProperty(notes = "创建时间")
private Date createTime;
@ApiModelProperty(notes = "更新时间")
private Date updatedDate;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
@Data
@ToString
public class ExcellentCaseReviewDTO implements Serializable {
@ApiModelProperty(notes = "主键ID")
private Long id;
@ApiModelProperty(notes = "案例标题")
private String caseTitle;
@ApiModelProperty(notes = "驻店人员姓名")
private String staffName;
@ApiModelProperty(notes = "驻店人员手机号")
private String staffPhone;
@ApiModelProperty(notes = "门店ID")
private Integer merchantId;
@ApiModelProperty(notes = "门店名称")
private String merchantName;
@ApiModelProperty(notes = "客户类别")
private String customerCategory;
@ApiModelProperty(notes = "案例描述")
private String caseDescription;
@ApiModelProperty(notes = "录音URL")
private String recordingUrl;
@ApiModelProperty(notes = "录音时长(秒)")
private Integer recordingDuration;
@ApiModelProperty(notes = "提交人ID")
private Long submitterId;
@ApiModelProperty(notes = "提交人姓名")
private String submitterName;
@ApiModelProperty(notes = "提交人手机号")
private String submitterPhone;
@ApiModelProperty(notes = "审核状态:0-待审核,1-通过,2-驳回")
private Integer reviewStatus;
@ApiModelProperty(notes = "审核人ID")
private Long reviewerId;
@ApiModelProperty(notes = "审核人姓名")
private String reviewerName;
@ApiModelProperty(notes = "审核时间")
private Date reviewTime;
@ApiModelProperty(notes = "审核意见")
private String reviewComment;
@ApiModelProperty(notes = "创建时间")
private Date createTime;
@ApiModelProperty(notes = "更新时间")
private Date updatedDate;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
@Data
@ToString
public class ExcellentCaseReviewQueryDTO implements Serializable {
@ApiModelProperty(notes = "驻店人员姓名,模糊匹配")
private String staffName;
@ApiModelProperty(notes = "接待门店名称,模糊匹配")
private String merchantName;
@ApiModelProperty(notes = "客户类别")
private String customerCategory;
@ApiModelProperty(notes = "提交人姓名,模糊匹配")
private String submitterName;
@ApiModelProperty(notes = "审核状态:0-待审核,1-通过,2-驳回")
private Integer reviewStatus;
@ApiModelProperty(notes = "页码")
private Integer pageNum;
@ApiModelProperty(notes = "每页大小")
private Integer pageSize;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
@ToString
public class ExcellentCaseReviewReqDTO implements Serializable {
@NotNull(message = "案例ID不能为空")
@ApiModelProperty(notes = "案例ID", required = true)
private Long id;
@ApiModelProperty(notes = "审核意见")
private String reviewComment;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
@ToString
public class ExcellentCaseSubmitDTO implements Serializable {
@NotBlank(message = "案例标题不能为空")
@ApiModelProperty(notes = "案例标题", required = true)
private String caseTitle;
@NotBlank(message = "驻店人员姓名不能为空")
@ApiModelProperty(notes = "驻店人员姓名", required = true)
private String staffName;
@NotBlank(message = "驻店人员手机号不能为空")
@ApiModelProperty(notes = "驻店人员手机号", required = true)
private String staffPhone;
@NotNull(message = "门店ID不能为空")
@ApiModelProperty(notes = "门店ID", required = true)
private Integer merchantId;
@NotBlank(message = "门店名称不能为空")
@ApiModelProperty(notes = "门店名称", required = true)
private String merchantName;
@NotBlank(message = "客户类别不能为空")
@ApiModelProperty(notes = "客户类别", required = true)
private String customerCategory;
@NotBlank(message = "案例描述不能为空")
@ApiModelProperty(notes = "案例描述", required = true)
private String caseDescription;
@NotBlank(message = "录音URL不能为空")
@ApiModelProperty(notes = "录音URL", required = true)
private String recordingUrl;
@ApiModelProperty(notes = "录音时长(秒)")
private Integer recordingDuration;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 录音列表项DTO
* <p>
* 包含录音列表中的单个录音信息,如客户姓名、手机号、驻店人员、门店、客户类型、车型等
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "录音列表项DTO")
@Data
public class RecordingItemDTO implements Serializable {
/**
* 录音ID
*/
@ApiModelProperty(value = "录音ID", example = "123")
private Long recordingId;
/**
* 客户姓名
*/
@ApiModelProperty(value = "客户姓名", example = "李四")
private String customerName;
/**
* 客户手机号
*/
@ApiModelProperty(value = "客户手机号", example = "13812345678")
private String customerPhone;
/**
* 驻店人员
*/
@ApiModelProperty(value = "驻店人员", example = "张三")
private String storeStaff;
/**
* 归属门店
*/
@ApiModelProperty(value = "归属门店", example = "深圳市南山界4S店")
private String storeName;
/**
* 客户类型识别
*/
@ApiModelProperty(value = "客户类型识别", example = "潜在客户")
private String customerType;
/**
* 车型
*/
@ApiModelProperty(value = "车型", example = "GL8")
private String carModel;
/**
* 接待时间
*/
@ApiModelProperty(value = "接待时间", example = "2026-02-01 10:00:00")
private String receptionTime;
/**
* 接待结果(成交/战败)
*/
@ApiModelProperty(value = "接待结果(成交/战败)", example = "成交")
private String receptionResult;
/**
* 优秀案例提交状态
* 0: 未提交
* 1: 待审核
* 2: 通过
* 3: 驳回
*/
@ApiModelProperty(value = "优秀案例提交状态", example = "0")
private Integer caseSubmitStatus;
/**
* 优秀案例提交状态文案
*/
@ApiModelProperty(value = "优秀案例提交状态文案", example = "提交优秀案例")
private String caseSubmitStatusText;
/**
* 优秀案例提交按钮是否可点击
*/
@ApiModelProperty(value = "优秀案例提交按钮是否可点击", example = "true")
private Boolean caseSubmitButtonEnabled;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 录音列表DTO
* <p>
* 包含录音复盘页面的完整数据,如摘要信息和录音列表
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "录音列表DTO")
@Data
public class RecordingListDTO implements Serializable {
/**
* 录音摘要信息
*/
@ApiModelProperty(value = "录音摘要信息")
private RecordingSummaryDTO summary;
/**
* 录音列表
*/
@ApiModelProperty(value = "录音列表")
private List<RecordingItemDTO> recordingList;
/**
* 总记录数
*/
@ApiModelProperty(value = "总记录数", example = "10")
private Integer totalCount;
/**
* 当前页码
*/
@ApiModelProperty(value = "当前页码", example = "1")
private Integer pageNum;
/**
* 每页大小
*/
@ApiModelProperty(value = "每页大小", example = "10")
private Integer pageSize;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 录音查询请求DTO
* <p>
* 包含录音查询的请求参数,如员工ID、督导ID、日期、页码、每页大小等
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "录音查询请求DTO")
@Data
public class RecordingQueryReq implements Serializable {
/**
* 员工ID
*/
@ApiModelProperty(value = "员工ID", example = "123_456", required = true)
private String employeeId;
/**
* 督导ID
*/
@ApiModelProperty(value = "督导ID", example = "123", required = true)
private Long supervisorId;
/**
* 日期
*/
@ApiModelProperty(value = "日期", example = "2026-02-01")
private String date;
/**
* 开始日期
*/
@ApiModelProperty(value = "开始日期", example = "2026-02-01")
private String startDate;
/**
* 结束日期
*/
@ApiModelProperty(value = "结束日期", example = "2026-02-29")
private String endDate;
/**
* 页码
*/
@ApiModelProperty(value = "页码", example = "1")
private Integer pageNum;
/**
* 每页大小
*/
@ApiModelProperty(value = "每页大小", example = "10")
private Integer pageSize;
/**
* 接待结果(成交/战败)
*/
@ApiModelProperty(value = "接待结果(成交/战败)", example = "成交")
private String receptionResult;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 录音摘要DTO
* <p>
* 包含录音复盘页面的摘要信息,如日期、录音数、成交数、战败数等
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "录音摘要DTO")
@Data
public class RecordingSummaryDTO implements Serializable {
/**
* 日期
*/
@ApiModelProperty(value = "日期", example = "2月1日")
private String date;
/**
* 总录音数
*/
@ApiModelProperty(value = "总录音数", example = "10")
private Integer totalRecordings;
/**
* 成交数
*/
@ApiModelProperty(value = "成交数", example = "3")
private Integer dealCount;
/**
* 战败数
*/
@ApiModelProperty(value = "战败数", example = "2")
private Integer defeatCount;
}
\ No newline at end of file \ 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 lombok.Data;
/**
* 督导首页数据响应对象
* <p>
* 包含督导首页数据,如日期类型、核心指标、员工列表、AI分析建议等
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiModel(description = "督导首页数据响应对象")
@Data
public class SupervisorDashboardVO implements Serializable {
public static final long serialVersionUID = 1L;
/**
* 日期类型:0,按指定时段;1,按周;2,按月;3,按年;4,全部
*/
@ApiModelProperty(value = "日期类型", example = "0", notes = "日期类型:0,按指定时段;1,按周;2,按月;3,按年;4,全部")
private Integer dateType;
/**
* 核心指标 (来自 BI)
*/
@ApiModelProperty(value = "核心指标 (来自 BI)")
private DashboardMetrics metrics;
/**
* 员工列表 (用于排行)
*/
@ApiModelProperty(value = "员工列表 (用于排行)")
private List<EmployeeRanking> employeeList;
/**
* AI 分析建议
*/
@ApiModelProperty(value = "AI 分析建议", example = "根据数据分析,建议关注低绩效员工的培训和辅导,提升整体业绩水平")
private String aiAnalysisSuggestion;
}
package cn.com.glsx.dj.supervisor.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ExcellentCaseReviewStatusEnum {
PENDING(0, "待审核"),
APPROVED(1, "通过"),
REJECTED(2, "驳回");
private Integer code;
private String name;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 行为数据 DTO
* 数据来源:D+ 后台 - 人员管理 - 质检管理 / 线索系统
* 用途:提供录音数、线索数,用于计算录音缺失率、平均单产录音数等。
* 注意:成交数(A075)和战败数(A0123) 已从 BI 获取,本 DTO 不再包含这两个字段。
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BehaviorDataDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 员工手机号 (聚合主键)
* 必须与 BI 数据中的 staffPhone 保持一致,以便内存合并
*/
private String staffPhone;
/**
* 员工姓名
*/
private String staffName;
// ================= 核心行为指标 =================
/**
* 录音数
* 来源:质检系统统计的有效录音数量
* 用途:
* 1. 直接展示
* 2. 计算 [平均单产录音数] = 录音数 / 成交数(A075)
*/
private Integer recordingCount;
/**
* 线索总数 (或应录音总数)
* 来源:线索系统 或 销售过程管理系统
* 定义:该员工在统计周期内分配到的、需要跟进并录音的线索总量
* 用途:
* 计算 [录音缺失率] = (线索总数 - 录音数) / 线索总数 * 100%
*
* 注意:如果业务定义“应录音数”不等于“线索数”(例如只有通话超过1分钟才算),
* 请确保此字段返回的是符合“应录音”定义的基数。
*/
private Integer leadCount;
// ================= 辅助扩展字段 (可选) =================
/**
* 质检得分/平均分
* 如果后续需要展示质检分数,可在此扩展
*/
private Double qualityScore;
/**
* 违规次数
* 如果后续需要展示合规性警告,可在此扩展
*/
private Integer violationCount;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.model;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* 统计业务
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Builder
public class DataBusinessDTO implements Serializable {
// 主要使用字段
/**
* 指标编码
* <a href="https://doc.weixin.qq.com/sheet/e3_ADoAiwalAOstQVLBOVoS1i0Wusban?scode=APkAlwewABABoyeIaIAXIAHAZ3AKw&tab=BB08J2">指标编码</a>
*/
private String itemCode;
/**
* 业务类型:1.延保 2.轻改 3.权益 都为 -
*/
private String biz;
/**
* 商户ID
*/
private Integer merchantId;
/**
* 商户名称
*/
private String merchantName;
/**
* 指标值
*/
private BigDecimal itemValue;
/**
* 上个周期值
*/
private BigDecimal preValue;
/**
* 开始时间
*/
private String startDate;
/**
* 结束时间
*/
private String endDate;
/**
* 环比
*/
private String rate;
// 未返回字段
private Integer id;
private String brandId;
private String brandName;
private String createTime;
private String date;
private BigDecimal nextValue;
private String productId;
private String productName;
private String remark;
private String rowkey;
private String staffId;
private String staffName;
private String staffPhone;
private String msg;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class DataResp<T> {
private Integer code;
private String msg;
private T content;
}
package cn.com.glsx.dj.supervisor.model;
import java.math.BigDecimal;
import lombok.Data;
/**
* 内部临时类,用于内存聚合中间状态
*/
@Data
public class EmployeeMetricTemp {
private String staffName;
private Integer merchantId;
private BigDecimal outputValue = BigDecimal.ZERO; // A036 累加
private BigDecimal numeratorValue = BigDecimal.ZERO; // A075 累加
private BigDecimal denominatorValue = BigDecimal.ZERO; // A084 累加
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.model;
import cn.com.glsx.dj.supervisor.enums.ExcellentCaseReviewStatusEnum;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
/**
* 优秀案例审核实体类
* <p>
* 用于存储督导提交的优秀案例信息,包括案例详情、驻店人员信息、门店信息、录音资料等
* 支持审核流程:待审核 -> 通过/驳回
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@Data
@ToString
@Table(name = "excellent_case_review")
public class ExcellentCaseReview implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID(自增)
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 案例标题
*/
@Column(name = "case_title")
private String caseTitle;
/**
* 驻店人员姓名
*/
@Column(name = "staff_name")
private String staffName;
/**
* 驻店人员手机号
*/
@Column(name = "staff_phone")
private String staffPhone;
/**
* 门店ID
*/
@Column(name = "merchant_id")
private Integer merchantId;
/**
* 门店名称
*/
@Column(name = "merchant_name")
private String merchantName;
/**
* 客户类别
*/
@Column(name = "customer_category")
private String customerCategory;
/**
* 案例描述
*/
@Column(name = "case_description")
private String caseDescription;
/**
* 录音URL
*/
@Column(name = "recording_url")
private String recordingUrl;
/**
* 录音时长(秒)
*/
@Column(name = "recording_duration")
private Integer recordingDuration;
/**
* 提交人ID
*/
@Column(name = "submitter_id")
private String submitterId;
/**
* 提交人姓名
*/
@Column(name = "submitter_name")
private String submitterName;
/**
* 提交人手机号
*/
@Column(name = "submitter_phone")
private String submitterPhone;
/**
* 审核状态
* <p>
* 0 - 待审核(默认)
* 1 - 通过
* 2 - 驳回
* </p>
*
* @see ExcellentCaseReviewStatusEnum
*/
@Column(name = "review_status")
private Integer reviewStatus;
/**
* 审核人ID
*/
@Column(name = "reviewer_id")
private String reviewerId;
/**
* 审核人姓名
*/
@Column(name = "reviewer_name")
private String reviewerName;
/**
* 审核时间
*/
@Column(name = "review_time")
private Date reviewTime;
/**
* 审核意见
*/
@Column(name = "review_comment")
private String reviewComment;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* 更新人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "updated_date")
private Date updatedDate;
/**
* 删除标识
* <p>
* D - 已删除
* N - 未删除(默认)
* </p>
*/
@Column(name = "deleted_flag")
private String deletedFlag;
}
package cn.com.glsx.dj.supervisor.remote;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseDetailDTO;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseReviewQueryDTO;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseReviewReqDTO;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseSubmitDTO;
import cn.com.glsx.framework.core.annotation.*;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import com.github.pagehelper.Page;
import java.util.List;
/**
* 优秀案例审核远程服务接口
* <p>
* 提供优秀案例的提交、查询、审核等功能的Dubbo远程调用接口
* 支持案例的生命周期管理:提交 -> 待审核 -> 通过/驳回
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@ApiService(value = "优秀案例审核", owner = "fanfr")
public interface ExcellentCaseReviewRemote {
/**
* 提交优秀案例
* <p>
* 督导提交优秀案例信息,案例初始状态为"待审核"
* </p>
*/
@interface SubmitExcellentCase {}
@ApiMethod("提交优秀案例")
@ApiParams({
@ApiParam(name = "request", notes = "优秀案例信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true),
@ApiParam(name = "currentUser", notes = "当前用户", dataType = ApiParam.DataTypeEnum.STRING, required = true),
@ApiParam(name = "currentUserId", notes = "当前用户ID", dataType = ApiParam.DataTypeEnum.LONG, required = true)
})
@ApiResponse("提交结果")
RpcResponse<Boolean> submitExcellentCase(ExcellentCaseSubmitDTO request, String currentUser, String currentUserId);
/**
* 查询优秀案例列表(分页)
* <p>
* 支持多条件筛选:驻店人员姓名、门店名称、客户类别、提交人姓名、审核状态
* </p>
*/
@interface QueryExcellentCaseList {}
@ApiMethod("查询优秀案例列表")
@ApiParams({@ApiParam(name = "request", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)})
@ApiResponse("优秀案例列表")
RpcResponse<Page<ExcellentCaseDetailDTO>> queryExcellentCaseList(RpcPagination<ExcellentCaseReviewQueryDTO> request);
/**
* 查询优秀案例详情
* <p>
* 根据案例ID查询完整的案例信息
* </p>
*/
@interface GetExcellentCaseDetail {}
@ApiMethod("查询优秀案例详情")
@ApiParams({@ApiParam(name = "id", notes = "案例ID", dataType = ApiParam.DataTypeEnum.LONG, required = true)})
@ApiResponse("优秀案例详情")
RpcResponse<ExcellentCaseDetailDTO> getExcellentCaseDetail(Long id);
/**
* 审核通过优秀案例
* <p>
* 将案例状态从"待审核"更新为"通过"
* </p>
*/
@interface ApproveExcellentCase {}
@ApiMethod("审核通过优秀案例")
@ApiParams({
@ApiParam(name = "request", notes = "审核信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true),
@ApiParam(name = "currentUser", notes = "当前用户", dataType = ApiParam.DataTypeEnum.STRING, required = true),
@ApiParam(name = "currentUserId", notes = "当前用户ID", dataType = ApiParam.DataTypeEnum.LONG, required = true)
})
@ApiResponse("审核结果")
RpcResponse<Boolean> approveExcellentCase(ExcellentCaseReviewReqDTO request, String currentUser, String currentUserId);
/**
* 审核驳回优秀案例
* <p>
* 将案例状态从"待审核"更新为"驳回"
* </p>
*/
@interface RejectExcellentCase {}
@ApiMethod("审核驳回优秀案例")
@ApiParams({
@ApiParam(name = "request", notes = "审核信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true),
@ApiParam(name = "currentUser", notes = "当前用户", dataType = ApiParam.DataTypeEnum.STRING, required = true),
@ApiParam(name = "currentUserId", notes = "当前用户ID", dataType = ApiParam.DataTypeEnum.LONG, required = true)
})
@ApiResponse("审核结果")
RpcResponse<Boolean> rejectExcellentCase(ExcellentCaseReviewReqDTO request, String currentUser, String currentUserId);
/**
* 下载优秀案例录音
* <p>
* 根据案例ID获取录音文件的URL
* </p>
*/
@interface DownloadRecording {}
@ApiMethod("下载优秀案例录音")
@ApiParams({@ApiParam(name = "id", notes = "案例ID", dataType = ApiParam.DataTypeEnum.LONG, required = true)})
@ApiResponse("录音URL")
RpcResponse<String> downloadRecording(Long id);
/**
* 查询客户类别列表
* <p>
* 获取系统中已有的所有客户类别,用于下拉选择
* </p>
*/
@interface QueryCustomerCategories {}
@ApiMethod("查询客户类别列表")
@ApiResponse("客户类别列表")
RpcResponse<List<String>> queryCustomerCategories();
}
package cn.com.glsx.dj.supervisor.remote;
import cn.com.glsx.dj.supervisor.dto.*;
import cn.com.glsx.framework.core.annotation.*;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* 督导看板远程服务接口
* <p>
* 提供督导看板相关的远程调用接口
* 包括首页数据、行为数据、人员基础信息、个人业绩、行为分析等功能
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@Api(value = "督导看板远程服务", tags = "督导看板")
@ApiService(value = "督导看板", owner = "fanfr")
public interface SupervisorDashboardRemote {
/**
* 获取督导首页数据
* <p>
* 包含基础指标、员工数据、AI分析建议等
* </p>
*/
@interface GetDashboardData {}
@ApiOperation("获取督导首页数据")
@ApiMethod("获取督导首页数据")
@ApiParams({
@ApiParam(name = "req", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
})
@ApiResponse("首页数据")
RpcResponse<SupervisorDashboardVO> getDashboardData(DashboardQueryReq req);
/**
* 获取督导行为数据
* <p>
* 包含行为分析、员工行为数据、AI分析建议等
* </p>
*/
@interface GetDashboardBehaviorData {}
@ApiOperation("获取督导行为数据")
@ApiMethod("获取督导行为数据")
@ApiParams({
@ApiParam(name = "req", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
})
@ApiResponse("行为数据")
RpcResponse<SupervisorDashboardVO> getDashboardBehaviorData(DashboardQueryReq req);
/**
* 获取人员基础信息
* <p>
* 包含员工基础信息,如姓名、手机号、归业业务、入职时间、年龄、出生日期、民族、籍贯、入职部门、职务、直线经理等
* </p>
*/
@interface GetEmployeeDashboardData {}
@ApiOperation("获取人员基础信息")
@ApiMethod("获取人员基础信息")
@ApiParams({
@ApiParam(name = "req", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
})
@ApiResponse("人员基础信息")
RpcResponse<EmployeeBasicInfoDTO> getEmployeeDashboardData(EmployeeBasicInfoReq req);
/**
* 获取个人业绩数据
* <p>
* 包含员工个人业绩数据,如总产值、客单价、总触客数、总成交数等
* 支持场景、时间、门店维度的查询
* </p>
*/
@interface GetEmployeePerformanceData {}
@ApiOperation("获取个人业绩数据")
@ApiMethod("获取个人业绩数据")
@ApiParams({
@ApiParam(name = "req", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
})
@ApiResponse("个人业绩数据")
RpcResponse<EmployeePerformanceDTO> getEmployeePerformanceData(EmployeePerformanceReq req);
/**
* 获取个人行为分析数据
* <p>
* 包含员工行为分析数据,如考勤统计、日报统计、客户接待、录音分析、着装预警等
* 支持场景、时间维度的查询
* </p>
*/
@interface GetEmployeeBehaviorData {}
@ApiOperation("获取个人行为分析数据")
@ApiMethod("获取个人行为分析数据")
@ApiParams({
@ApiParam(name = "req", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
})
@ApiResponse("个人行为分析数据")
RpcResponse<EmployeeBehaviorDTO> getEmployeeBehaviorData(EmployeeBehaviorReq req);
/**
* 获取员工调店记录
* <p>
* 获取员工在不同门店之间的流动履历
* </p>
*/
@interface GetEmployeeStoreTransferRecords {}
@ApiOperation("获取员工调店记录")
@ApiMethod("获取员工调店记录")
@ApiParams({
@ApiParam(name = "req", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
})
@ApiResponse("员工调店记录")
RpcResponse<List<EmployeeStoreTransferDTO>> getEmployeeStoreTransferRecords(EmployeeStoreTransferReq req);
/**
* 获取录音列表
* <p>
* 获取员工的录音列表,包含客户姓名、手机号、驻店人员、门店、客户类型、车型等信息
* 支持按日期、接待结果等条件查询
* </p>
*/
@interface GetRecordingList {}
@ApiOperation("获取录音列表")
@ApiMethod("获取录音列表")
@ApiParams({
@ApiParam(name = "req", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
})
@ApiResponse("录音列表")
RpcResponse<RecordingListDTO> getRecordingList(RecordingQueryReq req);
}
...@@ -48,6 +48,11 @@ ...@@ -48,6 +48,11 @@
<artifactId>platform-merchants-api</artifactId> <artifactId>platform-merchants-api</artifactId>
<version>5.6.1-SNAPSHOT</version> <version>5.6.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.38</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.mapper;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseDetailDTO;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseReviewQueryDTO;
import cn.com.glsx.dj.supervisor.model.ExcellentCaseReview;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
/**
* 优秀案例审核数据访问层
* <p>
* 提供优秀案例的增删改查操作,包括:
* - 案例列表分页查询(支持多条件筛选)
* - 案例详情查询
* - 客户类别列表查询
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@Mapper
public interface ExcellentCaseReviewMapper extends OreMapper<ExcellentCaseReview> {
/**
* 查询优秀案例列表
* <p>
* 支持多条件筛选查询,包括:
* - 驻店人员姓名(模糊匹配)
* - 门店名称(模糊匹配)
* - 客户类别(精确匹配)
* - 提交人姓名(模糊匹配)
* - 审核状态(精确匹配)
* </p>
*
* @param query 查询条件
* @return 案例详情列表
*/
List<ExcellentCaseDetailDTO> queryExcellentCaseList(@Param("query") ExcellentCaseReviewQueryDTO query);
/**
* 查询优秀案例详情
* <p>
* 根据案例ID查询完整的案例信息,包括案例详情、审核信息等
* </p>
*
* @param id 案例ID
* @return 案例详情DTO
*/
ExcellentCaseDetailDTO getExcellentCaseDetail(@Param("id") Long id);
/**
* 查询客户类别列表
* <p>
* 获取系统中已有的所有客户类别(去重)
* 只查询未删除的案例中的客户类别
* </p>
*
* @return 客户类别列表
*/
List<String> queryCustomerCategories();
}
package cn.com.glsx.dj.supervisor.remote;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseDetailDTO;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseReviewQueryDTO;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseReviewReqDTO;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseSubmitDTO;
import cn.com.glsx.dj.supervisor.service.ExcellentCaseReviewService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.github.pagehelper.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* 优秀案例审核远程服务实现类
* <p>
* 实现优秀案例审核的Dubbo远程调用接口
* 负责处理来自前端或其他服务的远程调用请求,调用本地Service层完成业务逻辑
* 统一处理异常并返回标准的RPC响应
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@Slf4j
@DubboService(retries = 0, timeout = 30000, validation = "true")
public class ExcellentCaseReviewRemoteImpl implements ExcellentCaseReviewRemote {
@Autowired
private ExcellentCaseReviewService excellentCaseReviewService;
/**
* 提交优秀案例
* <p>
* 接收远程调用请求,调用Service层提交优秀案例
* </p>
*
* @param request 案例提交信息
* @param currentUser 当前操作用户姓名
* @param currentUserId 当前操作用户ID
* @return RPC响应,包含提交结果
*/
@Override
public RpcResponse<Boolean> submitExcellentCase(ExcellentCaseSubmitDTO request, String currentUser, String currentUserId) {
try {
Boolean result = excellentCaseReviewService.submitExcellentCase(request, currentUser, currentUserId);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.submitExcellentCase error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.submitExcellentCase system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
/**
* 查询优秀案例列表(分页)
* <p>
* 接收远程调用请求,调用Service层查询案例列表
* </p>
*
* @param request 分页查询参数
* @return RPC响应,包含分页的案例列表
*/
@Override
public RpcResponse<Page<ExcellentCaseDetailDTO>> queryExcellentCaseList(RpcPagination<ExcellentCaseReviewQueryDTO> request) {
try {
Page result = excellentCaseReviewService.queryExcellentCaseList(request);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.queryExcellentCaseList error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.queryExcellentCaseList system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
/**
* 查询优秀案例详情
* <p>
* 接收远程调用请求,调用Service层查询案例详情
* </p>
*
* @param id 案例ID
* @return RPC响应,包含案例详情
*/
@Override
public RpcResponse<ExcellentCaseDetailDTO> getExcellentCaseDetail(Long id) {
try {
ExcellentCaseDetailDTO result = excellentCaseReviewService.getExcellentCaseDetail(id);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.getExcellentCaseDetail error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.getExcellentCaseDetail system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
/**
* 审核通过优秀案例
* <p>
* 接收远程调用请求,调用Service层审核通过案例
* </p>
*
* @param request 审核请求
* @param currentUser 当前审核人姓名
* @param currentUserId 当前审核人ID
* @return RPC响应,包含审核结果
*/
@Override
public RpcResponse<Boolean> approveExcellentCase(ExcellentCaseReviewReqDTO request, String currentUser, String currentUserId) {
try {
Boolean result = excellentCaseReviewService.approveExcellentCase(request, currentUser, currentUserId);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.approveExcellentCase error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.approveExcellentCase system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
/**
* 审核驳回优秀案例
* <p>
* 接收远程调用请求,调用Service层审核驳回案例
* </p>
*
* @param request 审核请求
* @param currentUser 当前审核人姓名
* @param currentUserId 当前审核人ID
* @return RPC响应,包含审核结果
*/
@Override
public RpcResponse<Boolean> rejectExcellentCase(ExcellentCaseReviewReqDTO request, String currentUser, String currentUserId) {
try {
Boolean result = excellentCaseReviewService.rejectExcellentCase(request, currentUser, currentUserId);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.rejectExcellentCase error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.rejectExcellentCase system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
/**
* 下载优秀案例录音
* <p>
* 接收远程调用请求,调用Service层获取录音URL
* </p>
*
* @param id 案例ID
* @return RPC响应,包含录音URL
*/
@Override
public RpcResponse<String> downloadRecording(Long id) {
try {
String result = excellentCaseReviewService.downloadRecording(id);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.downloadRecording error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.downloadRecording system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
/**
* 查询客户类别列表
* <p>
* 接收远程调用请求,调用Service层查询客户类别
* </p>
*
* @return RPC响应,包含客户类别列表
*/
@Override
public RpcResponse<List<String>> queryCustomerCategories() {
try {
List<String> result = excellentCaseReviewService.queryCustomerCategories();
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.queryCustomerCategories error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemoteImpl.queryCustomerCategories system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
}
package cn.com.glsx.dj.supervisor.remote;
import cn.com.glsx.dj.supervisor.dto.*;
import cn.com.glsx.dj.supervisor.service.SupervisorDashboardService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 督导看板远程服务实现类
* <p>
* 实现督导看板相关的远程调用接口
* 调用本地Service层完成业务逻辑
* 统一处理异常并返回标准的RPC响应
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@Slf4j
@DubboService(retries = 0, timeout = 30000, validation = "true")
public class SupervisorDashboardRemoteImpl implements SupervisorDashboardRemote {
@Autowired
private SupervisorDashboardService supervisorDashboardService;
/**
* 获取督导首页数据
* <p>
* 接收远程调用请求,调用Service层获取首页数据
* </p>
*
* @param req 查询参数
* @return RPC响应,包含首页数据
*/
@Override
public RpcResponse<SupervisorDashboardVO> getDashboardData(DashboardQueryReq req) {
try {
log.info("开始远程调用获取督导首页数据,请求参数:{}", req);
SupervisorDashboardVO result = supervisorDashboardService.getDashboardData(req);
log.info("远程调用获取督导首页数据成功");
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorDashboardRemoteImpl.getDashboardData error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorDashboardRemoteImpl.getDashboardData system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
/**
* 获取督导行为数据
* <p>
* 接收远程调用请求,调用Service层获取行为数据
* </p>
*
* @param req 查询参数
* @return RPC响应,包含行为数据
*/
@Override
public RpcResponse<SupervisorDashboardVO> getDashboardBehaviorData(DashboardQueryReq req) {
try {
log.info("开始远程调用获取督导行为数据,请求参数:{}", req);
SupervisorDashboardVO result = supervisorDashboardService.getDashboardBehaviorData(req);
log.info("远程调用获取督导行为数据成功");
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorDashboardRemoteImpl.getDashboardBehaviorData error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorDashboardRemoteImpl.getDashboardBehaviorData system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
/**
* 获取人员基础信息
* <p>
* 接收远程调用请求,返回人员基础信息
* 只包含员工基础信息,不包含业绩、行为分析等其他数据
* </p>
*
* @param req 查询参数
* @return RPC响应,包含人员基础信息
*/
@Override
public RpcResponse<EmployeeBasicInfoDTO> getEmployeeDashboardData(EmployeeBasicInfoReq req) {
try {
log.info("开始远程调用获取人员基础信息,请求参数:{}", req);
// 构建人员基础信息
EmployeeBasicInfoDTO basicInfo = new EmployeeBasicInfoDTO();
basicInfo.setName("周芳");
basicInfo.setPhone("13812345678");
basicInfo.setBusiness("延保");
basicInfo.setEntryDate("2025-12-12");
basicInfo.setAge(33);
basicInfo.setBirthday("1993-03-26");
basicInfo.setEthnicity("汉");
basicInfo.setOrigin("陕西省/延安市");
basicInfo.setDepartment("运营零售部门");
basicInfo.setPosition("延保门店销售");
basicInfo.setManager("XXX");
basicInfo.setGender("女");
log.info("远程调用获取人员基础信息成功");
return RpcResponse.success(basicInfo);
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorDashboardRemoteImpl.getEmployeeDashboardData error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
/**
* 获取个人业绩数据
* <p>
* 接收远程调用请求,返回个人业绩数据
* 包含门店数据和人员数据
* </p>
*
* @param req 查询参数
* @return RPC响应,包含个人业绩数据
*/
@Override
public RpcResponse<EmployeePerformanceDTO> getEmployeePerformanceData(EmployeePerformanceReq req) {
try {
log.info("开始远程调用获取个人业绩数据,请求参数:{}", req);
// 构建个人业绩数据
EmployeePerformanceDTO performanceData = new EmployeePerformanceDTO();
// AI建议
performanceData.setAiSuggestion("该员工学习时长领先但线索转化率低于平均水平,建议加强成交环节的实操带教");
// 门店数据
EmployeePerformanceDTO.StorePerformanceData storeData = new EmployeePerformanceDTO.StorePerformanceData();
storeData.setTotalValue(15000); // 总产值(指标A036)
storeData.setAveragePrice(12000); // 客单价(指标A076)
storeData.setTotalCustomers(129); // 总触客数(指标A084)
storeData.setTotalDeals(101); // 总成交数(指标A075)
performanceData.setStoreData(storeData);
// 人员数据
EmployeePerformanceDTO.EmployeeData employeeData = new EmployeePerformanceDTO.EmployeeData();
employeeData.setTotalValue(93196);
employeeData.setAveragePrice(11649.5);
employeeData.setDailyPerformanceRate("100%");
performanceData.setEmployeeData(employeeData);
// 个人产值趋势
List<EmployeePerformanceDTO.TrendData> trendData = new ArrayList<>();
EmployeePerformanceDTO.TrendData trend1 = new EmployeePerformanceDTO.TrendData();
trend1.setDate("2026-02-24");
trend1.setValue(10000);
trendData.add(trend1);
EmployeePerformanceDTO.TrendData trend2 = new EmployeePerformanceDTO.TrendData();
trend2.setDate("2026-02-25");
trend2.setValue(8000);
trendData.add(trend2);
EmployeePerformanceDTO.TrendData trend3 = new EmployeePerformanceDTO.TrendData();
trend3.setDate("2026-02-26");
trend3.setValue(12000);
trendData.add(trend3);
EmployeePerformanceDTO.TrendData trend4 = new EmployeePerformanceDTO.TrendData();
trend4.setDate("2026-02-27");
trend4.setValue(9000);
trendData.add(trend4);
EmployeePerformanceDTO.TrendData trend5 = new EmployeePerformanceDTO.TrendData();
trend5.setDate("2026-02-28");
trend5.setValue(15000);
trendData.add(trend5);
EmployeePerformanceDTO.TrendData trend6 = new EmployeePerformanceDTO.TrendData();
trend6.setDate("2026-02-29");
trend6.setValue(18000);
trendData.add(trend6);
EmployeePerformanceDTO.TrendData trend7 = new EmployeePerformanceDTO.TrendData();
trend7.setDate("2026-03-01");
trend7.setValue(20000);
trendData.add(trend7);
performanceData.setTrendData(trendData);
log.info("远程调用获取个人业绩数据成功");
return RpcResponse.success(performanceData);
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorDashboardRemoteImpl.getEmployeePerformanceData error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
/**
* 获取个人行为分析数据
* <p>
* 接收远程调用请求,返回个人行为分析数据
* 包含考勤统计、日报统计、客户接待、录音分析、着装预警等
* </p>
*
* @param req 查询参数
* @return RPC响应,包含个人行为分析数据
*/
@Override
public RpcResponse<EmployeeBehaviorDTO> getEmployeeBehaviorData(EmployeeBehaviorReq req) {
try {
log.info("开始远程调用获取个人行为分析数据,请求参数:{}", req);
// 构建个人行为分析数据
EmployeeBehaviorDTO behaviorData = new EmployeeBehaviorDTO();
// AI建议
behaviorData.setAiSuggestion("该员工学习时长领先但线索转化率低于平均水平,建议加强成交环节的实操带教");
// 考勤统计
EmployeeBehaviorDTO.AttendanceData attendance = new EmployeeBehaviorDTO.AttendanceData();
attendance.setCheckInDays(1); // 打卡天数
attendance.setLate(1); // 迟到
attendance.setEarlyLeave(1); // 早退
attendance.setAbsenteeism(1); // 旷工
behaviorData.setAttendance(attendance);
// 日报统计
EmployeeBehaviorDTO.DailyReportData dailyReport = new EmployeeBehaviorDTO.DailyReportData();
dailyReport.setSubmitted(0); // 已提交
dailyReport.setNotSubmitted(1); // 未提交
dailyReport.setOnDuty(0); // 在岗
dailyReport.setRest(0); // 调休
dailyReport.setCompletionRate("85%"); // 日报完成率
behaviorData.setDailyReport(dailyReport);
// 客户接待
EmployeeBehaviorDTO.CustomerReceptionData customerReception = new EmployeeBehaviorDTO.CustomerReceptionData();
customerReception.setActualDelivery(4); // 实际交车数(指标A062)
customerReception.setReceptionCount(2); // 接待数量(指标A084)
customerReception.setNotTouched(2); // 未触客数
behaviorData.setCustomerReception(customerReception);
// 录音分析
EmployeeBehaviorDTO.RecordingAnalysisData recordingAnalysis = new EmployeeBehaviorDTO.RecordingAnalysisData();
// 行为标签
Map<String, String> behaviorTags = new HashMap<>();
behaviorTags.put("salesAbility", "优秀");
behaviorTags.put("customerService", "一般");
behaviorTags.put("productKnowledge", "优秀");
behaviorTags.put("serviceAttitude", "一般");
behaviorTags.put("communicationSkills", "良好");
behaviorTags.put("persuasionAbility", "一般");
recordingAnalysis.setBehaviorTags(behaviorTags);
// 量化指标
EmployeeBehaviorDTO.QuantitativeIndicators quantitativeIndicators = new EmployeeBehaviorDTO.QuantitativeIndicators();
quantitativeIndicators.setRecordingCount(2); // 录音
quantitativeIndicators.setDealCount(1); // 成交数
quantitativeIndicators.setDefeatCount(1); // 战败数
quantitativeIndicators.setDealRate("50%"); // 成交率
quantitativeIndicators.setQualityScore(2); // 质检平均分
quantitativeIndicators.setAttackDefenseScore(1); // 攻防平均分
quantitativeIndicators.setRecordingMissingRate(1); // 录音缺失率
recordingAnalysis.setQuantitativeIndicators(quantitativeIndicators);
behaviorData.setRecordingAnalysis(recordingAnalysis);
// 着装预警
EmployeeBehaviorDTO.DressCodeWarningData dressCodeWarning = new EmployeeBehaviorDTO.DressCodeWarningData();
dressCodeWarning.setWarningCount(1); // 预警次数
behaviorData.setDressCodeWarning(dressCodeWarning);
log.info("远程调用获取个人行为分析数据成功");
return RpcResponse.success(behaviorData);
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorDashboardRemoteImpl.getEmployeeBehaviorData error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
/**
* 获取员工调店记录
* <p>
* 接收远程调用请求,返回员工调店记录
* </p>
*
* @param req 查询参数
* @return RPC响应,包含员工调店记录
*/
@Override
public RpcResponse<List<EmployeeStoreTransferDTO>> getEmployeeStoreTransferRecords(EmployeeStoreTransferReq req) {
try {
log.info("开始远程调用获取员工调店记录,请求参数:{}", req);
// 构建员工调店记录
List<EmployeeStoreTransferDTO> transferRecords = new ArrayList<>();
EmployeeStoreTransferDTO record1 = new EmployeeStoreTransferDTO();
record1.setId(1);
record1.setStoreName("深圳市南山界4S店");
record1.setStartDate("2025-12-12");
record1.setEndDate("2026-03-12");
record1.setStatus("current");
transferRecords.add(record1);
EmployeeStoreTransferDTO record2 = new EmployeeStoreTransferDTO();
record2.setId(2);
record2.setStoreName("深圳市福田区5S店");
record2.setStartDate("2025-06-01");
record2.setEndDate("2025-12-11");
record2.setStatus("history");
transferRecords.add(record2);
EmployeeStoreTransferDTO record3 = new EmployeeStoreTransferDTO();
record3.setId(3);
record3.setStoreName("深圳市宝安区6S店");
record3.setStartDate("2025-01-01");
record3.setEndDate("2025-05-31");
record3.setStatus("history");
transferRecords.add(record3);
log.info("远程调用获取员工调店记录成功");
return RpcResponse.success(transferRecords);
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorDashboardRemoteImpl.getEmployeeStoreTransferRecords error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
/**
* 获取录音列表
* <p>
* 接收远程调用请求,返回录音列表
* 包含录音摘要和录音列表数据
* </p>
*
* @param req 查询参数
* @return RPC响应,包含录音列表
*/
@Override
public RpcResponse<RecordingListDTO> getRecordingList(RecordingQueryReq req) {
try {
log.info("开始远程调用获取录音列表,请求参数:{}", req);
// 构建录音摘要
RecordingSummaryDTO summary = new RecordingSummaryDTO();
summary.setDate("2月1日");
summary.setTotalRecordings(10);
summary.setDealCount(3);
summary.setDefeatCount(2);
// 构建录音列表
List<RecordingItemDTO> recordingList = new ArrayList<>();
// 成交录音
RecordingItemDTO recording1 = new RecordingItemDTO();
recording1.setRecordingId(1L);
recording1.setCustomerName("李四");
recording1.setCustomerPhone("13812345678");
recording1.setStoreStaff("张三");
recording1.setStoreName("深圳市南山界4S店");
recording1.setCustomerType("潜在客户");
recording1.setCarModel("GL8");
recording1.setReceptionTime("2026-02-01 10:00:00");
recording1.setReceptionResult("成交");
recording1.setCaseSubmitStatus(0);
recording1.setCaseSubmitStatusText("提交优秀案例");
recording1.setCaseSubmitButtonEnabled(true);
recordingList.add(recording1);
// 成交录音(已提交待审核)
RecordingItemDTO recording2 = new RecordingItemDTO();
recording2.setRecordingId(2L);
recording2.setCustomerName("王五");
recording2.setCustomerPhone("13987654321");
recording2.setStoreStaff("张三");
recording2.setStoreName("深圳市南山界4S店");
recording2.setCustomerType("老客户");
recording2.setCarModel("昂科威");
recording2.setReceptionTime("2026-02-01 14:30:00");
recording2.setReceptionResult("成交");
recording2.setCaseSubmitStatus(1);
recording2.setCaseSubmitStatusText("审核中");
recording2.setCaseSubmitButtonEnabled(false);
recordingList.add(recording2);
// 成交录音(已通过)
RecordingItemDTO recording3 = new RecordingItemDTO();
recording3.setRecordingId(3L);
recording3.setCustomerName("赵六");
recording3.setCustomerPhone("13765432198");
recording3.setStoreStaff("张三");
recording3.setStoreName("深圳市南山界4S店");
recording3.setCustomerType("潜在客户");
recording3.setCarModel("君越");
recording3.setReceptionTime("2026-02-01 16:00:00");
recording3.setReceptionResult("成交");
recording3.setCaseSubmitStatus(2);
recording3.setCaseSubmitStatusText("优秀案例提交通过");
recording3.setCaseSubmitButtonEnabled(false);
recordingList.add(recording3);
// 成交录音(已驳回)
RecordingItemDTO recording4 = new RecordingItemDTO();
recording4.setRecordingId(4L);
recording4.setCustomerName("孙七");
recording4.setCustomerPhone("13654321987");
recording4.setStoreStaff("张三");
recording4.setStoreName("深圳市南山界4S店");
recording4.setCustomerType("老客户");
recording4.setCarModel("英朗");
recording4.setReceptionTime("2026-02-01 11:00:00");
recording4.setReceptionResult("成交");
recording4.setCaseSubmitStatus(3);
recording4.setCaseSubmitStatusText("优秀案例提交已驳回,重新提交");
recording4.setCaseSubmitButtonEnabled(true);
recordingList.add(recording4);
// 战败录音
RecordingItemDTO recording5 = new RecordingItemDTO();
recording5.setRecordingId(5L);
recording5.setCustomerName("周八");
recording5.setCustomerPhone("13543219876");
recording5.setStoreStaff("张三");
recording5.setStoreName("深圳市南山界4S店");
recording5.setCustomerType("潜在客户");
recording5.setCarModel("威朗");
recording5.setReceptionTime("2026-02-01 09:00:00");
recording5.setReceptionResult("战败");
recording5.setCaseSubmitStatus(0);
recording5.setCaseSubmitStatusText("提交优秀案例");
recording5.setCaseSubmitButtonEnabled(false);
recordingList.add(recording5);
// 构建返回数据
RecordingListDTO result = new RecordingListDTO();
result.setSummary(summary);
result.setRecordingList(recordingList);
result.setTotalCount(10);
result.setPageNum(req.getPageNum() != null ? req.getPageNum() : 1);
result.setPageSize(req.getPageSize() != null ? req.getPageSize() : 10);
log.info("远程调用获取录音列表成功");
return RpcResponse.success(result);
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorDashboardRemoteImpl.getRecordingList error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
}
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.dto.EmployeeRanking;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class AiAnalysisService {
private static final String SYSTEM_PROMPT = "";
/**
* 生成 AI 分析建议
*/
public String generateSuggestion(List<EmployeeRanking> employeeList) {
if (employeeList == null || employeeList.isEmpty()) {
return "当前周期暂无足够数据进行 AI 分析。";
}
// 构造输入数据上下文 (简化为文本描述,实际可转为 JSON 字符串)
StringBuilder dataContext = new StringBuilder("以下是团队当前周期的详细数据:\n");
// 计算简单的统计信息辅助 AI
double avgOutput = employeeList.stream().mapToDouble(e -> e.getPersonalOutput().doubleValue()).average().orElse(0);
double avgConversion = employeeList.stream().mapToDouble(e -> e.getPersonalConversion().doubleValue()).average().orElse(0);
dataContext.append(String.format("团队人数:%d, 平均产值:%.2f, 平均转化率:%.2f%%\n",
employeeList.size(), avgOutput, avgConversion * 100));
dataContext.append("详细员工数据 (姓名, 产值, 客单价, 转化率):\n");
for (EmployeeRanking emp : employeeList) {
dataContext.append(String.format("- %s: 产值=%.2f, 客单价=%.2f, 转化率=%.2f%%\n",
emp.getEmployeeName(),
emp.getPersonalOutput(),
emp.getPersonalUnitPrice(),
emp.getPersonalConversion()));
}
// TODO 调用大模型
return null;
}
public String generateBehaviorSuggestion(List<EmployeeRanking> employeeList) {
if (employeeList == null || employeeList.isEmpty()) {
return "当前周期暂无行为数据进行 AI 分析。";
}
StringBuilder dataContext = new StringBuilder("团队行为数据详情 (姓名,成交数,战败数,录音数,缺失率%):\n");
// 统计总量供 AI 参考
int totalDeal = 0, totalDefeat = 0, totalRec = 0;
double avgMissingRate = 0;
for (EmployeeRanking emp : employeeList) {
int deal = emp.getDealCount() != null ? emp.getDealCount() : 0;
int defeat = emp.getDefeatCount() != null ? emp.getDefeatCount() : 0;
int rec = emp.getRecordingCount() != null ? emp.getRecordingCount() : 0;
double missRate = emp.getMissingRate() != null ? emp.getMissingRate().doubleValue() : 0;
totalDeal += deal;
totalDefeat += defeat;
totalRec += rec;
avgMissingRate += missRate;
dataContext.append(String.format("- %s: 成交=%d, 战败=%d, 录音=%d, 缺失率=%.2f%%\n",
emp.getEmployeeName(), deal, defeat, rec, missRate));
}
avgMissingRate /= employeeList.size();
double teamDealRate = (totalDeal + totalDefeat) > 0 ? (double)totalDeal / (totalDeal + totalDefeat) : 0;
dataContext.insert(0, String.format("团队汇总:总成交=%d, 总战败=%d, 总录音=%d, 平均缺失率=%.2f%%, 团队成交率=%.2f%%\n\n",
totalDeal, totalDefeat, totalRec, avgMissingRate, teamDealRate * 100));
// TODO 调用大模型
return null;
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.service;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* 查询参数实体类
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class DataBizQueryParamsDTO implements Serializable {
/**
* 业务类型:1.延保 2.轻改 3.权益 4.二手车 必传
*/
private Integer bizs;
/**
* 品牌ID列表,多个用逗号分隔,为空表示不分 固定值:"-1,-3"
*/
private String brandIds;
/**
* 日期类型:0,按指定时段;1,按周;2,按月;3,按年;4,全部
*/
private Integer dateType;
/**
* 开始日期
*/
private String startDate;
/**
* 结束日期
*/
private String endDate;
/**
* 聚合维度,多个用逗号分隔,为空表示不按维度聚合
* 格式示例:merchantId,staffId,productId,date
*/
private String exts;
/**
* 项目编码列表,多个用逗号分隔
* 产值-A036
* 客单价-A076 = [(产值 A036)/(订单数 A075)]
* 引流率-A064 = [(触客数售前 A063)/(新车交付数 A062)]
* 转化率-A085 = [(订单数 A075)/(总触客数 A084)]
* 渗透率-A077 = [(订单数 A075)/(新车交付数 A062)]
* <p>
* (订单数-A075)
* (触客数售前-A063)
* (总触客数-A084)
* (新车交付数-A062)
*/
private String itemCodes;
/**
* 最大日期
*/
private String maxDate;
/**
* 门店ID列表,多个用逗号分隔,为空表示不分
*/
private String merchantIds;
/**
* 最小日期
*/
private String minDate;
/**
* 产品ID列表,多个用逗号分隔,为空表示不分
*/
private String productIds;
/**
* 驻店ID列表,多个用逗号分隔,为空表示不分
*/
private String staffIds;
/**
* 驻点手机号列表,多个用逗号分隔,为空表示不分
*/
private String staffPhones;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseDetailDTO;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseReviewQueryDTO;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseReviewReqDTO;
import cn.com.glsx.dj.supervisor.dto.ExcellentCaseSubmitDTO;
import cn.com.glsx.dj.supervisor.enums.ExcellentCaseReviewStatusEnum;
import cn.com.glsx.dj.supervisor.mapper.ExcellentCaseReviewMapper;
import cn.com.glsx.dj.supervisor.model.ExcellentCaseReview;
import cn.com.glsx.framework.core.beans.BaseModel;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* 优秀案例审核服务类
* <p>
* 提供优秀案例的提交、查询、审核等功能
* 支持案例的生命周期管理:提交 -> 待审核 -> 通过/驳回
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@Service
@Slf4j
public class ExcellentCaseReviewService {
@Autowired
private ExcellentCaseReviewMapper excellentCaseReviewMapper;
/**
* 提交优秀案例
* <p>
* 督导提交优秀案例信息,案例初始状态为"待审核"
* 包含案例标题、驻店人员信息、门店信息、客户类别、案例描述、录音资料等
* </p>
*
* @param request 案例提交信息
* @param currentUser 当前操作用户姓名
* @param currentUserId 当前操作用户ID
* @return 提交成功返回true
* @throws RpcServiceException 数据库操作失败时抛出
*/
@Transactional(rollbackFor = Exception.class)
public Boolean submitExcellentCase(ExcellentCaseSubmitDTO request, String currentUser, String currentUserId) {
log.info("开始提交优秀案例,请求参数:{}", request);
ExcellentCaseReview excellentCase = new ExcellentCaseReview();
BeanUtils.copyProperties(request, excellentCase);
// 设置初始状态为待审核
excellentCase.setReviewStatus(ExcellentCaseReviewStatusEnum.PENDING.getCode());
// 设置提交人信息
excellentCase.setSubmitterId(currentUserId);
excellentCase.setSubmitterName(currentUser);
// 设置创建信息
excellentCase.setCreatedBy(currentUser);
excellentCase.setCreateTime(new Date());
excellentCase.setUpdatedBy(currentUser);
excellentCase.setUpdatedDate(new Date());
excellentCase.setDeletedFlag(BaseModel.DeletedFlagEnum.N.name());
int count = excellentCaseReviewMapper.insertSelective(excellentCase);
if (count <= 0) {
log.error("插入优秀案例失败,请求参数:{}", request);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR, "插入优秀案例失败");
}
log.info("提交优秀案例成功,案例ID:{}", excellentCase.getId());
return true;
}
/**
* 查询优秀案例列表(分页)
* <p>
* 支持多条件筛选:驻店人员姓名、门店名称、客户类别、提交人姓名、审核状态
* 支持模糊查询和精确查询
* </p>
*
* @param request 分页查询参数,包含查询条件和分页信息
* @return 分页的案例列表
*/
public Page<ExcellentCaseDetailDTO> queryExcellentCaseList(RpcPagination<ExcellentCaseReviewQueryDTO> request) {
log.info("开始查询优秀案例列表,请求参数:{}", request);
Page<ExcellentCaseDetailDTO> page = PageHelper.startPage(request.getPageNum(), request.getPageSize());
List<ExcellentCaseDetailDTO> caseList = excellentCaseReviewMapper.queryExcellentCaseList(request.getCondition());
log.info("查询优秀案例列表成功,数据条数:{}", caseList != null ? caseList.size() : 0);
return page;
}
/**
* 查询优秀案例详情
* <p>
* 根据案例ID查询完整的案例信息,包括案例详情、审核信息等
* </p>
*
* @param id 案例ID
* @return 案例详情DTO
* @throws RpcServiceException 案例不存在时抛出
*/
public ExcellentCaseDetailDTO getExcellentCaseDetail(Long id) {
log.info("开始查询优秀案例详情,案例ID:{}", id);
RpcAssert.assertNotNull(id, DefaultErrorEnum.PARAMETER_NULL, "案例ID不能为空");
ExcellentCaseDetailDTO detail = excellentCaseReviewMapper.getExcellentCaseDetail(id);
if (detail == null) {
log.error("根据ID查询优秀案例详情不存在,案例ID:{}", id);
throw new RpcServiceException(DefaultErrorEnum.DATA_NOT_EXIST, "根据ID查询优秀案例详情不存在");
}
log.info("查询优秀案例详情成功,案例ID:{}", id);
return detail;
}
/**
* 审核通过优秀案例
* <p>
* 将案例状态从"待审核"更新为"通过"
* 记录审核人信息和审核时间
* 只有待审核状态的案例才能进行审核操作
* </p>
*
* @param request 审核请求,包含案例ID和审核意见
* @param currentUser 当前审核人姓名
* @param currentUserId 当前审核人ID
* @return 审核成功返回true
* @throws RpcServiceException 案例不存在或已审核时抛出
*/
@Transactional(rollbackFor = Exception.class)
public Boolean approveExcellentCase(ExcellentCaseReviewReqDTO request, String currentUser, String currentUserId) {
log.info("开始审核通过优秀案例,请求参数:{}", request);
RpcAssert.assertNotNull(request.getId(), DefaultErrorEnum.PARAMETER_NULL, "案例ID不能为空");
// 查询案例信息
ExcellentCaseReview excellentCase = excellentCaseReviewMapper.selectByPrimaryKey(request.getId());
if (excellentCase == null) {
log.error("根据ID查询优秀案例不存在,案例ID:{}", request.getId());
throw new RpcServiceException(DefaultErrorEnum.DATA_NOT_EXIST, "根据ID查询优秀案例不存在");
}
// 校验案例状态,只有待审核状态的案例才能审核
if (!ExcellentCaseReviewStatusEnum.PENDING.getCode().equals(excellentCase.getReviewStatus())) {
log.error("优秀案例已审核,案例ID:{},当前状态:{}", request.getId(), excellentCase.getReviewStatus());
throw new RpcServiceException("优秀案例已审核");
}
// 构建更新对象
ExcellentCaseReview update = new ExcellentCaseReview();
update.setId(request.getId());
update.setReviewStatus(ExcellentCaseReviewStatusEnum.APPROVED.getCode());
update.setReviewerId(currentUserId);
update.setReviewerName(currentUser);
update.setReviewTime(new Date());
update.setReviewComment(request.getReviewComment());
update.setUpdatedBy(currentUser);
update.setUpdatedDate(new Date());
int count = excellentCaseReviewMapper.updateByPrimaryKeySelective(update);
if (count <= 0) {
log.error("审核通过优秀案例失败,案例ID:{}", request.getId());
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR, "审核通过优秀案例失败");
}
log.info("审核通过优秀案例成功,案例ID:{}", request.getId());
return true;
}
/**
* 审核驳回优秀案例
* <p>
* 将案例状态从"待审核"更新为"驳回"
* 记录审核人信息、审核时间和驳回意见
* 只有待审核状态的案例才能进行驳回操作
* </p>
*
* @param request 审核请求,包含案例ID和审核意见
* @param currentUser 当前审核人姓名
* @param currentUserId 当前审核人ID
* @return 驳回成功返回true
* @throws RpcServiceException 案例不存在或已审核时抛出
*/
@Transactional(rollbackFor = Exception.class)
public Boolean rejectExcellentCase(ExcellentCaseReviewReqDTO request, String currentUser, String currentUserId) {
log.info("开始审核驳回优秀案例,请求参数:{}", request);
RpcAssert.assertNotNull(request.getId(), DefaultErrorEnum.PARAMETER_NULL, "案例ID不能为空");
// 查询案例信息
ExcellentCaseReview excellentCase = excellentCaseReviewMapper.selectByPrimaryKey(request.getId());
if (excellentCase == null) {
log.error("根据ID查询优秀案例不存在,案例ID:{}", request.getId());
throw new RpcServiceException(DefaultErrorEnum.DATA_NOT_EXIST, "根据ID查询优秀案例不存在");
}
// 校验案例状态,只有待审核状态的案例才能审核
if (!ExcellentCaseReviewStatusEnum.PENDING.getCode().equals(excellentCase.getReviewStatus())) {
log.error("优秀案例已审核,案例ID:{},当前状态:{}", request.getId(), excellentCase.getReviewStatus());
throw new RpcServiceException("优秀案例已审核");
}
// 构建更新对象
ExcellentCaseReview update = new ExcellentCaseReview();
update.setId(request.getId());
update.setReviewStatus(ExcellentCaseReviewStatusEnum.REJECTED.getCode());
update.setReviewerId(currentUserId);
update.setReviewerName(currentUser);
update.setReviewTime(new Date());
update.setReviewComment(request.getReviewComment());
update.setUpdatedBy(currentUser);
update.setUpdatedDate(new Date());
int count = excellentCaseReviewMapper.updateByPrimaryKeySelective(update);
if (count <= 0) {
log.error("审核驳回优秀案例失败,案例ID:{}", request.getId());
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR, "审核驳回优秀案例失败");
}
log.info("审核驳回优秀案例成功,案例ID:{}", request.getId());
return true;
}
/**
* 下载优秀案例录音
* <p>
* 根据案例ID获取录音文件的URL
* 用于已审核通过或驳回的案例下载录音
* </p>
*
* @param id 案例ID
* @return 录音文件的URL
* @throws RpcServiceException 案例不存在或录音URL为空时抛出
*/
public String downloadRecording(Long id) {
log.info("开始下载优秀案例录音,案例ID:{}", id);
RpcAssert.assertNotNull(id, DefaultErrorEnum.PARAMETER_NULL, "案例ID不能为空");
ExcellentCaseReview excellentCase = excellentCaseReviewMapper.selectByPrimaryKey(id);
if (excellentCase == null) {
log.error("根据ID查询优秀案例不存在,案例ID:{}", id);
throw new RpcServiceException(DefaultErrorEnum.DATA_NOT_EXIST, "根据ID查询优秀案例不存在");
}
if (excellentCase.getRecordingUrl() == null || excellentCase.getRecordingUrl().isEmpty()) {
log.error("优秀案例录音URL为空,案例ID:{}", id);
throw new RpcServiceException("优秀案例录音URL为空");
}
log.info("下载优秀案例录音成功,案例ID:{},录音URL:{}", id, excellentCase.getRecordingUrl());
return excellentCase.getRecordingUrl();
}
/**
* 查询客户类别列表
* <p>
* 获取系统中已有的所有客户类别,用于下拉选择
* 从所有未删除的案例中提取唯一的客户类别
* </p>
*
* @return 客户类别列表
*/
public List<String> queryCustomerCategories() {
log.info("开始查询客户类别列表");
List<String> categories = excellentCaseReviewMapper.queryCustomerCategories();
log.info("查询客户类别列表成功,数据条数:{}", categories != null ? categories.size() : 0);
return categories;
}
}
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.model.DataBusinessDTO;
import cn.com.glsx.dj.supervisor.model.DataResp;
import cn.com.glsx.dj.supervisor.util.HttpRequestUtils;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.oreframework.boot.env.OrePropertyConfigurer;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Pair;
import cn.hutool.core.lang.TypeReference;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
@Service
@Slf4j
public class GetDataStatsService {
@Resource
private TaskExecutor taskExecutor;
public DataResp<List<DataBusinessDTO>> getListDataResp(String jsonBody) {
DataResp<List<DataBusinessDTO>> dataResp;
// String url = OrePropertyConfigurer.getProperty("total.data.url", String.class, "http://dc.glsx.com.cn/data");
String url = OrePropertyConfigurer.getProperty("total.data.url", String.class, "http://192.168.3.211:8021/data");
// post请求
String jsonResponse;
try {
log.info("jsonBody: {}", jsonBody);
jsonResponse = HttpRequestUtils.postJson(url, jsonBody, new HashMap<>());
} catch (Exception e) {
throw new RpcServiceException("查询统计数据异常");
}
dataResp = JSONUtil.toBean(jsonResponse, new TypeReference<DataResp<List<DataBusinessDTO>>>() {
}, true);
if (ObjectUtil.notEqual(dataResp.getCode(), 200)) {
throw new RpcServiceException("查询统计数据异常");
}
return dataResp;
}
/**
* 通用并行调用方法 - 返回Map: 指标代码 -> 数据
* @param itemCodes 指标编码列表
* @param queryDataBiz 请求参数
* @return 指标代码到数据的映射
*/
public Map<String, DataBusinessDTO> parallelCallMap(List<String> itemCodes, DataBizQueryParamsDTO queryDataBiz) {
Map<String, DataBusinessDTO> resultMap = new ConcurrentHashMap<>();
List<CompletableFuture<Void>> futures = new ArrayList<>();
for (String itemCode : itemCodes) {
DataBizQueryParamsDTO queryCopy = new DataBizQueryParamsDTO();
BeanUtil.copyProperties(queryDataBiz, queryCopy);
queryCopy.setItemCodes(itemCode);
String jsonBody = JSONUtil.toJsonStr(queryCopy);
log.info("jsonBody: {}", jsonBody);
futures.add(CompletableFuture.runAsync(() -> {
try {
DataResp<List<DataBusinessDTO>> dataResp = this.getListDataResp(jsonBody);
List<DataBusinessDTO> content = dataResp.getContent();
if (CollUtil.isEmpty(content)) {
log.info("item:{}, dataResp:{}", itemCode, JSONUtil.toJsonPrettyStr(dataResp));
return;
}
resultMap.put(itemCode, CollUtil.getFirst(content));
} catch (Exception e) {
log.error("Error processing itemCode: {}, cause: {}", itemCode, ExceptionUtils.getStackTrace(e));
resultMap.put(itemCode, null);
}
}, taskExecutor));
}
// 等待所有任务完成
try {
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).get();
} catch (Exception e) {
log.error("Parallel call interrupted", e);
Thread.currentThread().interrupt();
}
return resultMap;
}
/**
* 通用并行调用方法 - 返回Map: 指标代码 -> 数据
* @param itemCodes 指标编码列表
* @param queryDataBiz 请求参数
* @return 指标代码到数据的映射
*/
public Map<String, List<DataBusinessDTO>> parallelCallListMap(List<String> itemCodes, DataBizQueryParamsDTO queryDataBiz) {
Map<String, List<DataBusinessDTO>> resultMap = new ConcurrentHashMap<>();
List<CompletableFuture<Void>> futures = new ArrayList<>();
for (String itemCode : itemCodes) {
DataBizQueryParamsDTO queryCopy = new DataBizQueryParamsDTO();
BeanUtil.copyProperties(queryDataBiz, queryCopy);
queryCopy.setItemCodes(itemCode);
String jsonBody = JSONUtil.toJsonStr(queryCopy);
log.info("jsonBody: {}", jsonBody);
futures.add(CompletableFuture.runAsync(() -> {
try {
DataResp<List<DataBusinessDTO>> dataResp = this.getListDataResp(jsonBody);
List<DataBusinessDTO> content = dataResp.getContent();
if (CollUtil.isEmpty(content)) {
log.info("item:{}, dataResp:{}", itemCode, JSONUtil.toJsonPrettyStr(dataResp));
return;
}
resultMap.put(itemCode, content);
} catch (Exception e) {
log.error("Error processing itemCode: {}, cause: {}", itemCode, ExceptionUtils.getStackTrace(e));
resultMap.put(itemCode, null);
}
}, taskExecutor));
}
// 等待所有任务完成
try {
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).get();
} catch (Exception e) {
log.error("Parallel call interrupted", e);
Thread.currentThread().interrupt();
}
return resultMap;
}
public Map<String, List<DataBusinessDTO>> parallelCallListWithKey(Map<String, DataBizQueryParamsDTO> queryDataBiz) {
Map<String, List<DataBusinessDTO>> resultMap = new ConcurrentHashMap<>();
List<CompletableFuture<Void>> futures = new ArrayList<>();
queryDataBiz.forEach((key, query) -> {
DataBizQueryParamsDTO queryCopy = new DataBizQueryParamsDTO();
BeanUtil.copyProperties(query, queryCopy);
String jsonBody = JSONUtil.toJsonStr(queryCopy);
log.info("jsonBody: {}", jsonBody);
futures.add(CompletableFuture.runAsync(() -> {
try {
DataResp<List<DataBusinessDTO>> dataResp = this.getListDataResp(jsonBody);
List<DataBusinessDTO> content = dataResp.getContent();
if (CollUtil.isEmpty(content)) {
log.info("key:{}, dataResp:{}", key, JSONUtil.toJsonPrettyStr(dataResp));
return;
}
resultMap.put(key, content);
} catch (Exception e) {
log.error("Error processing key: {}, cause: {}", key, ExceptionUtils.getStackTrace(e));
resultMap.put(key, null);
}
}, taskExecutor));
});
// 等待所有任务完成
try {
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).get();
} catch (Exception e) {
log.error("Parallel call interrupted", e);
Thread.currentThread().interrupt();
}
return resultMap;
}
/**
* 通用并行调用方法 - 返回Map: 指标代码 -> 数据
* @param dateList 时间列表
* @param queryDataBiz 请求参数
* @return 指标代码到数据的映射
*/
public Map<Pair<String, String>, DataBusinessDTO> parallelCallTimeMap(List<Pair<String, String>> dateList, DataBizQueryParamsDTO queryDataBiz) {
Map<Pair<String, String>, DataBusinessDTO> resultMap = new ConcurrentHashMap<>();
List<CompletableFuture<Void>> futures = new ArrayList<>();
for (Pair<String, String> dateItem : dateList) {
DataBizQueryParamsDTO queryCopy = new DataBizQueryParamsDTO();
BeanUtil.copyProperties(queryDataBiz, queryCopy);
queryCopy.setStartDate(dateItem.getKey());
queryCopy.setEndDate(dateItem.getValue());
String jsonBody = JSONUtil.toJsonStr(queryCopy);
futures.add(CompletableFuture.runAsync(() -> {
try {
DataResp<List<DataBusinessDTO>> dataResp = this.getListDataResp(jsonBody);
List<DataBusinessDTO> content = dataResp.getContent();
if (CollUtil.isEmpty(content)) {
log.info("dateItem:{}, dataResp:{}", dateItem, JSONUtil.toJsonPrettyStr(dataResp));
return;
}
resultMap.put(dateItem, CollUtil.getFirst(content));
} catch (Exception e) {
log.error("Error processing itemCode: {}, cause: {}", dateItem, ExceptionUtils.getStackTrace(e));
resultMap.put(dateItem, null);
}
}, taskExecutor));
}
// 等待所有任务完成
try {
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).get();
} catch (Exception e) {
log.error("Parallel call interrupted", e);
Thread.currentThread().interrupt();
}
return resultMap;
}
public Map<Pair<String, String>, List<DataBusinessDTO>> parallelCallTimeListMap(List<Pair<String, String>> dateList, DataBizQueryParamsDTO queryDataBiz) {
Map<Pair<String, String>, List<DataBusinessDTO>> resultMap = new ConcurrentHashMap<>();
List<CompletableFuture<Void>> futures = new ArrayList<>();
for (Pair<String, String> dateItem : dateList) {
DataBizQueryParamsDTO queryCopy = new DataBizQueryParamsDTO();
BeanUtil.copyProperties(queryDataBiz, queryCopy);
queryCopy.setStartDate(dateItem.getKey());
queryCopy.setEndDate(dateItem.getValue());
String jsonBody = JSONUtil.toJsonStr(queryCopy);
futures.add(CompletableFuture.runAsync(() -> {
try {
DataResp<List<DataBusinessDTO>> dataResp = this.getListDataResp(jsonBody);
List<DataBusinessDTO> content = dataResp.getContent();
if (CollUtil.isEmpty(content)) {
log.info("dateItem:{}, dataResp:{}", dateItem, JSONUtil.toJsonPrettyStr(dataResp));
return;
}
resultMap.put(dateItem, content);
} catch (Exception e) {
log.error("Error processing itemCode: {}, cause: {}", dateItem, ExceptionUtils.getStackTrace(e));
resultMap.put(dateItem, null);
}
}, taskExecutor));
}
// 等待所有任务完成
try {
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).get();
} catch (Exception e) {
log.error("Parallel call interrupted", e);
Thread.currentThread().interrupt();
}
return resultMap;
}
}
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.dto.*;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 督导看板服务类
* <p>
* 提供督导看板相关的业务逻辑处理
* 包括首页数据、行为数据、人员基础信息、个人业绩、行为分析等功能
* </p>
*
* @author fanfr
* @since 2026-03-12
*/
@Slf4j
@Service
public class SupervisorDashboardService {
/**
* 获取督导首页数据
* <p>
* 包含基础指标、员工数据、AI分析建议等
* </p>
*
* @param req 查询参数
* @return 督导首页数据
* @throws RpcServiceException 服务异常
*/
@Transactional(readOnly = true)
public SupervisorDashboardVO getDashboardData(DashboardQueryReq req) throws RpcServiceException {
log.info("开始获取督导首页数据,请求参数:{}", req);
// 构建返回数据
SupervisorDashboardVO dashboardVO = new SupervisorDashboardVO();
// 基础指标
Map<String, Object> basicMetrics = new HashMap<>();
basicMetrics.put("totalEmployees", 100);
basicMetrics.put("activeEmployees", 85);
basicMetrics.put("totalStores", 50);
basicMetrics.put("totalRevenue", 1000000);
dashboardVO.setBasicMetrics(basicMetrics);
// 员工数据
Map<String, Object> employeeData = new HashMap<>();
employeeData.put("highPerforming", 20);
employeeData.put("mediumPerforming", 50);
employeeData.put("lowPerforming", 30);
dashboardVO.setEmployeeData(employeeData);
// AI分析建议
dashboardVO.setAiSuggestion("根据数据分析,建议关注低绩效员工的培训和辅导,提升整体业绩水平");
log.info("获取督导首页数据完成");
return dashboardVO;
}
/**
* 获取督导行为数据
* <p>
* 包含行为分析、员工行为数据、AI分析建议等
* </p>
*
* @param req 查询参数
* @return 督导行为数据
* @throws RpcServiceException 服务异常
*/
@Transactional(readOnly = true)
public SupervisorDashboardVO getDashboardBehaviorData(DashboardQueryReq req) throws RpcServiceException {
log.info("开始获取督导行为数据,请求参数:{}", req);
// 构建返回数据
SupervisorDashboardVO dashboardVO = new SupervisorDashboardVO();
// 行为分析数据
Map<String, Object> behaviorAnalysis = new HashMap<>();
behaviorAnalysis.put("attendanceRate", "95%");
behaviorAnalysis.put("reportCompletionRate", "85%");
behaviorAnalysis.put("customerSatisfaction", "90%");
dashboardVO.setBehaviorAnalysis(behaviorAnalysis);
// 员工行为数据
Map<String, Object> employeeBehavior = new HashMap<>();
employeeBehavior.put("onTimeEmployees", 80);
employeeBehavior.put("lateEmployees", 10);
employeeBehavior.put("absentEmployees", 5);
dashboardVO.setEmployeeBehavior(employeeBehavior);
// AI分析建议
dashboardVO.setAiSuggestion("员工考勤情况良好,但日报完成率有待提高,建议加强日报管理");
log.info("获取督导行为数据完成");
return dashboardVO;
}
/**
* 获取人员基础信息
* <p>
* 包含员工基础信息,如姓名、手机号、归业业务、入职时间、年龄、出生日期、民族、籍贯、入职部门、职务、直线经理等
* </p>
*
* @param req 查询参数
* @return 人员基础信息
*/
@Transactional(readOnly = true)
public EmployeeBasicInfoDTO getEmployeeDashboardData(EmployeeBasicInfoReq req) {
log.info("开始获取人员基础信息,请求参数:{}", req);
// 构建人员基础信息
EmployeeBasicInfoDTO basicInfo = new EmployeeBasicInfoDTO();
basicInfo.setName("周芳");
basicInfo.setPhone("13812345678");
basicInfo.setBusiness("延保");
basicInfo.setEntryDate("2025-12-12");
basicInfo.setAge(33);
basicInfo.setBirthday("1993-03-26");
basicInfo.setEthnicity("汉");
basicInfo.setOrigin("陕西省/延安市");
basicInfo.setDepartment("运营零售部门");
basicInfo.setPosition("延保门店销售");
basicInfo.setManager("XXX");
basicInfo.setGender("女");
log.info("获取人员基础信息完成");
return basicInfo;
}
/**
* 获取个人业绩数据
* <p>
* 包含员工个人业绩数据,如总产值、客单价、总触客数、总成交数等
* 支持场景、时间、门店维度的查询
* </p>
*
* @param req 查询参数
* @return 个人业绩数据
*/
@Transactional(readOnly = true)
public EmployeePerformanceDTO getEmployeePerformanceData(EmployeePerformanceReq req) {
log.info("开始获取个人业绩数据,请求参数:{}", req);
// 构建个人业绩数据
EmployeePerformanceDTO performanceData = new EmployeePerformanceDTO();
// AI建议
performanceData.setAiSuggestion("该员工学习时长领先但线索转化率低于平均水平,建议加强成交环节的实操带教");
// 门店数据
EmployeePerformanceDTO.StorePerformanceData storeData = new EmployeePerformanceDTO.StorePerformanceData();
storeData.setTotalValue(15000); // 总产值(指标A036)
storeData.setAveragePrice(12000); // 客单价(指标A076)
storeData.setTotalCustomers(129); // 总触客数(指标A084)
storeData.setTotalDeals(101); // 总成交数(指标A075)
performanceData.setStoreData(storeData);
// 人员数据
EmployeePerformanceDTO.EmployeeData employeeData = new EmployeePerformanceDTO.EmployeeData();
employeeData.setTotalValue(93196);
employeeData.setAveragePrice(11649.5);
employeeData.setDailyPerformanceRate("100%");
performanceData.setEmployeeData(employeeData);
// 个人产值趋势
List<EmployeePerformanceDTO.TrendData> trendData = new ArrayList<>();
EmployeePerformanceDTO.TrendData trend1 = new EmployeePerformanceDTO.TrendData();
trend1.setDate("2026-02-24");
trend1.setValue(10000);
trendData.add(trend1);
EmployeePerformanceDTO.TrendData trend2 = new EmployeePerformanceDTO.TrendData();
trend2.setDate("2026-02-25");
trend2.setValue(8000);
trendData.add(trend2);
EmployeePerformanceDTO.TrendData trend3 = new EmployeePerformanceDTO.TrendData();
trend3.setDate("2026-02-26");
trend3.setValue(12000);
trendData.add(trend3);
EmployeePerformanceDTO.TrendData trend4 = new EmployeePerformanceDTO.TrendData();
trend4.setDate("2026-02-27");
trend4.setValue(9000);
trendData.add(trend4);
EmployeePerformanceDTO.TrendData trend5 = new EmployeePerformanceDTO.TrendData();
trend5.setDate("2026-02-28");
trend5.setValue(15000);
trendData.add(trend5);
EmployeePerformanceDTO.TrendData trend6 = new EmployeePerformanceDTO.TrendData();
trend6.setDate("2026-02-29");
trend6.setValue(18000);
trendData.add(trend6);
EmployeePerformanceDTO.TrendData trend7 = new EmployeePerformanceDTO.TrendData();
trend7.setDate("2026-03-01");
trend7.setValue(20000);
trendData.add(trend7);
performanceData.setTrendData(trendData);
log.info("获取个人业绩数据完成");
return performanceData;
}
/**
* 获取个人行为分析数据
* <p>
* 包含员工行为分析数据,如考勤统计、日报统计、客户接待、录音分析、着装预警等
* 支持场景、时间维度的查询
* </p>
*
* @param req 查询参数
* @return 个人行为分析数据
*/
@Transactional(readOnly = true)
public EmployeeBehaviorDTO getEmployeeBehaviorData(EmployeeBehaviorReq req) {
log.info("开始获取个人行为分析数据,请求参数:{}", req);
// 构建个人行为分析数据
EmployeeBehaviorDTO behaviorData = new EmployeeBehaviorDTO();
// AI建议
behaviorData.setAiSuggestion("该员工学习时长领先但线索转化率低于平均水平,建议加强成交环节的实操带教");
// 考勤统计
EmployeeBehaviorDTO.AttendanceData attendance = new EmployeeBehaviorDTO.AttendanceData();
attendance.setCheckInDays(1); // 打卡天数
attendance.setLate(1); // 迟到
attendance.setEarlyLeave(1); // 早退
attendance.setAbsenteeism(1); // 旷工
behaviorData.setAttendance(attendance);
// 日报统计
EmployeeBehaviorDTO.DailyReportData dailyReport = new EmployeeBehaviorDTO.DailyReportData();
dailyReport.setSubmitted(0); // 已提交
dailyReport.setNotSubmitted(1); // 未提交
dailyReport.setOnDuty(0); // 在岗
dailyReport.setRest(0); // 调休
dailyReport.setCompletionRate("85%"); // 日报完成率
behaviorData.setDailyReport(dailyReport);
// 客户接待
EmployeeBehaviorDTO.CustomerReceptionData customerReception = new EmployeeBehaviorDTO.CustomerReceptionData();
customerReception.setActualDelivery(4); // 实际交车数(指标A062)
customerReception.setReceptionCount(2); // 接待数量(指标A084)
customerReception.setNotTouched(2); // 未触客数
behaviorData.setCustomerReception(customerReception);
// 录音分析
EmployeeBehaviorDTO.RecordingAnalysisData recordingAnalysis = new EmployeeBehaviorDTO.RecordingAnalysisData();
// 行为标签
Map<String, String> behaviorTags = new HashMap<>();
behaviorTags.put("salesAbility", "优秀");
behaviorTags.put("customerService", "一般");
behaviorTags.put("productKnowledge", "优秀");
behaviorTags.put("serviceAttitude", "一般");
behaviorTags.put("communicationSkills", "良好");
behaviorTags.put("persuasionAbility", "一般");
recordingAnalysis.setBehaviorTags(behaviorTags);
// 量化指标
EmployeeBehaviorDTO.QuantitativeIndicators quantitativeIndicators = new EmployeeBehaviorDTO.QuantitativeIndicators();
quantitativeIndicators.setRecordingCount(2); // 录音
quantitativeIndicators.setDealCount(1); // 成交数
quantitativeIndicators.setDefeatCount(1); // 战败数
quantitativeIndicators.setDealRate("50%"); // 成交率
quantitativeIndicators.setQualityScore(2); // 质检平均分
quantitativeIndicators.setAttackDefenseScore(1); // 攻防平均分
quantitativeIndicators.setRecordingMissingRate(1); // 录音缺失率
recordingAnalysis.setQuantitativeIndicators(quantitativeIndicators);
behaviorData.setRecordingAnalysis(recordingAnalysis);
// 着装预警
EmployeeBehaviorDTO.DressCodeWarningData dressCodeWarning = new EmployeeBehaviorDTO.DressCodeWarningData();
dressCodeWarning.setWarningCount(1); // 预警次数
behaviorData.setDressCodeWarning(dressCodeWarning);
log.info("获取个人行为分析数据完成");
return behaviorData;
}
/**
* 获取员工调店记录
* <p>
* 获取员工在不同门店之间的流动履历
* </p>
*
* @param req 查询参数
* @return 员工调店记录列表
*/
@Transactional(readOnly = true)
public List<EmployeeStoreTransferDTO> getEmployeeStoreTransferRecords(EmployeeStoreTransferReq req) {
log.info("开始获取员工调店记录,请求参数:{}", req);
// 构建员工调店记录
List<EmployeeStoreTransferDTO> transferRecords = new ArrayList<>();
EmployeeStoreTransferDTO record1 = new EmployeeStoreTransferDTO();
record1.setId(1);
record1.setStoreName("深圳市南山界4S店");
record1.setStartDate("2025-12-12");
record1.setEndDate("2026-03-12");
record1.setStatus("current");
transferRecords.add(record1);
EmployeeStoreTransferDTO record2 = new EmployeeStoreTransferDTO();
record2.setId(2);
record2.setStoreName("深圳市福田区5S店");
record2.setStartDate("2025-06-01");
record2.setEndDate("2025-12-11");
record2.setStatus("history");
transferRecords.add(record2);
EmployeeStoreTransferDTO record3 = new EmployeeStoreTransferDTO();
record3.setId(3);
record3.setStoreName("深圳市宝安区6S店");
record3.setStartDate("2025-01-01");
record3.setEndDate("2025-05-31");
record3.setStatus("history");
transferRecords.add(record3);
log.info("获取员工调店记录完成");
return transferRecords;
}
}
package cn.com.glsx.dj.supervisor.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Map;
public class HttpRequestUtils {
private static final String DEFAULT_USER_AGENT = "Java-HttpRequestUtils/1.0";
private static final int DEFAULT_CONNECT_TIMEOUT = 30000; // 30秒
private static final int DEFAULT_READ_TIMEOUT = 60000; // 60秒
/**
* 发送 POST 请求(JSON 数据)
*
* @param urlStr 目标 URL
* @param jsonBody JSON 格式的请求体
* @return 响应内容字符串
* @throws IOException 网络异常
*/
public static String postJson(String urlStr, String jsonBody) throws IOException {
return post(urlStr, jsonBody, "application/json; charset=utf-8");
}
/**
* 发送 POST 请求(表单数据)
*
* @param urlStr 目标 URL
* @param formData 表单参数(如:key1=value1&key2=value2)
* @return 响应内容字符串
* @throws IOException 网络异常
*/
public static String postForm(String urlStr, String formData) throws IOException {
return post(urlStr, formData, "application/x-www-form-urlencoded; charset=utf-8");
}
/**
* 通用 POST 方法(支持自定义请求头和超时)
*
* @param urlStr 目标 URL
* @param body 请求体内容
* @param contentType 内容类型
* @param headers 自定义请求头(可选)
* @param connectTimeout 连接超时(毫秒)
* @param readTimeout 读取超时(毫秒)
* @return 响应内容字符串
* @throws IOException 网络异常
*/
public static String post(String urlStr, String body, String contentType,
Map<String, String> headers, int connectTimeout, int readTimeout) throws IOException {
URL url = new URL(urlStr);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// 配置请求
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", contentType);
connection.setRequestProperty("User-Agent", DEFAULT_USER_AGENT);
// 添加自定义请求头
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
connection.setRequestProperty(entry.getKey(), entry.getValue());
}
}
// 设置超时
connection.setConnectTimeout(connectTimeout);
connection.setReadTimeout(readTimeout);
// 写入请求体
try (OutputStream os = connection.getOutputStream()) {
byte[] input = body.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
// 处理响应
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
try (BufferedReader br = new BufferedReader(
new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
StringBuilder response = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
response.append(line);
}
return response.toString();
}
} else {
throw new IOException("HTTP error code: " + responseCode +
" - " + getErrorResponse(connection));
}
}
// 重载方法(默认值)
public static String post(String urlStr, String body, String contentType) throws IOException {
return post(urlStr, body, contentType, null, DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT);
}
// 重载:JSON POST
public static String postJson(String urlStr, String jsonBody, Map<String, String> headers) throws IOException {
return post(urlStr, jsonBody, "application/json; charset=utf-8", headers,
DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT);
}
// 重载:表单 POST
public static String postForm(String urlStr, String formData, Map<String, String> headers) throws IOException {
return post(urlStr, formData, "application/x-www-form-urlencoded; charset=utf-8", headers,
DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT);
}
// 获取错误响应体
private static String getErrorResponse(HttpURLConnection connection) throws IOException {
try (BufferedReader br = new BufferedReader(
new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8))) {
StringBuilder errorResponse = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
errorResponse.append(line);
}
return errorResponse.toString();
} catch (IOException e) {
return "Error reading error stream";
}
}
}
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.supervisor.mapper.ExcellentCaseReviewMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.supervisor.model.ExcellentCaseReview" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="case_title" property="caseTitle" jdbcType="VARCHAR" />
<result column="staff_name" property="staffName" jdbcType="VARCHAR" />
<result column="staff_phone" property="staffPhone" jdbcType="VARCHAR" />
<result column="merchant_id" property="merchantId" jdbcType="INTEGER" />
<result column="merchant_name" property="merchantName" jdbcType="VARCHAR" />
<result column="customer_category" property="customerCategory" jdbcType="VARCHAR" />
<result column="case_description" property="caseDescription" jdbcType="VARCHAR" />
<result column="recording_url" property="recordingUrl" jdbcType="VARCHAR" />
<result column="recording_duration" property="recordingDuration" jdbcType="INTEGER" />
<result column="submitter_id" property="submitterId" jdbcType="BIGINT" />
<result column="submitter_name" property="submitterName" jdbcType="VARCHAR" />
<result column="submitter_phone" property="submitterPhone" jdbcType="VARCHAR" />
<result column="review_status" property="reviewStatus" jdbcType="INTEGER" />
<result column="reviewer_id" property="reviewerId" jdbcType="BIGINT" />
<result column="reviewer_name" property="reviewerName" jdbcType="VARCHAR" />
<result column="review_time" property="reviewTime" jdbcType="TIMESTAMP" />
<result column="review_comment" property="reviewComment" jdbcType="VARCHAR" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<resultMap id="ExcellentCaseDetailMap" type="cn.com.glsx.dj.supervisor.dto.ExcellentCaseDetailDTO">
<id column="id" property="id"/>
<result column="case_title" property="caseTitle"/>
<result column="staff_name" property="staffName"/>
<result column="staff_phone" property="staffPhone"/>
<result column="merchant_id" property="merchantId"/>
<result column="merchant_name" property="merchantName"/>
<result column="customer_category" property="customerCategory"/>
<result column="case_description" property="caseDescription"/>
<result column="recording_url" property="recordingUrl"/>
<result column="recording_duration" property="recordingDuration"/>
<result column="submitter_id" property="submitterId"/>
<result column="submitter_name" property="submitterName"/>
<result column="submitter_phone" property="submitterPhone"/>
<result column="review_status" property="reviewStatus"/>
<result column="reviewer_id" property="reviewerId"/>
<result column="reviewer_name" property="reviewerName"/>
<result column="review_time" property="reviewTime"/>
<result column="review_comment" property="reviewComment"/>
<result column="create_time" property="createTime"/>
<result column="updated_date" property="updatedDate"/>
</resultMap>
<sql id="Base_Column_List" >
id, case_title, staff_name, staff_phone, merchant_id, merchant_name, customer_category,
case_description, recording_url, recording_duration, submitter_id, submitter_name, submitter_phone,
review_status, reviewer_id, reviewer_name, review_time, review_comment,
created_by, create_time, updated_by, updated_date, deleted_flag
</sql>
<select id="queryExcellentCaseList" parameterType="cn.com.glsx.dj.supervisor.dto.ExcellentCaseReviewQueryDTO" resultMap="ExcellentCaseDetailMap">
select
<include refid="Base_Column_List" />
from excellent_case_review
<where>
deleted_flag = 'N'
<if test="query.staffName != null and query.staffName != ''">
and staff_name like CONCAT('%', #{query.staffName}, '%')
</if>
<if test="query.merchantName != null and query.merchantName != ''">
and merchant_name like CONCAT('%', #{query.merchantName}, '%')
</if>
<if test="query.customerCategory != null and query.customerCategory != ''">
and customer_category = #{query.customerCategory}
</if>
<if test="query.submitterName != null and query.submitterName != ''">
and submitter_name like CONCAT('%', #{query.submitterName}, '%')
</if>
<if test="query.reviewStatus != null">
and review_status = #{query.reviewStatus}
</if>
</where>
order by create_time desc
</select>
<select id="getExcellentCaseDetail" resultMap="ExcellentCaseDetailMap">
select
<include refid="Base_Column_List" />
from excellent_case_review
<where>
deleted_flag = 'N' and id = #{id}
</where>
</select>
<select id="queryCustomerCategories" resultType="java.lang.String">
select distinct customer_category
from excellent_case_review
where deleted_flag = 'N'
and customer_category is not null
and customer_category != ''
order by customer_category
</select>
</mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!