Commit 91112621 by zhouhaibao

[+]督导团队业绩和个人业绩查询

1 parent 576a7976
......@@ -35,6 +35,8 @@ public class EmployeeRanking implements Serializable {
private Integer defeatCount; // 战败数 (A0123)
@ApiModelProperty(notes = "录音数")
private Integer recordingCount; // 录音数 (质检)
@ApiModelProperty(notes = "线索量")
private Integer leadCount; // 线索量 (A084)
@ApiModelProperty(notes = "录音缺失率")
private BigDecimal missingRate; // 录音缺失率 (%)
......@@ -45,4 +47,12 @@ public class EmployeeRanking implements Serializable {
@ApiModelProperty(notes = "业务类型")
private String bussinessType;
@ApiModelProperty(notes = "转化率预警等级:0-红,1-黄,2-绿")
private Integer conversionWarningLevel;
@ApiModelProperty(notes = "个人客单价预警等级:0-红,1-黄,2-绿")
private Integer unitPriceWarningLevel;
@ApiModelProperty(notes = "个人产值预警等级:0-红,1-黄,2-绿")
private Integer outputWarningLevel;
}
......@@ -20,22 +20,22 @@ import java.io.Serializable;
public class EmployeeStoreTransferDTO implements Serializable {
/**
* 记录ID
*/
@ApiModelProperty(value = "记录ID", example = "1")
private Integer id;
/**
* 门店ID
*/
@ApiModelProperty(value = "门店ID", example = "44210895")
private Integer merchantId;
/**
* 员工ID
*/
@ApiModelProperty(value = "员工uuid", example = "544554455445")
private String employeeId;
/**
* 门店名称
*/
@ApiModelProperty(value = "门店名称", example = "深圳市南山界4S店")
private String storeName;
private String merchantName;
/**
* 开始日期
......@@ -43,16 +43,5 @@ public class EmployeeStoreTransferDTO implements Serializable {
@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;
}
......@@ -20,17 +20,6 @@ import java.util.List;
@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;
/**
* 员工手机号
......
......@@ -29,6 +29,14 @@ public interface BusinessSceneMapper {
String getBusinessSceneByPhoneNumber(@Param("phoneNumber") String phoneNumber);
/**
* 批次查询业务场景标签
*
* @param phoneNumbers 手机号列表
* @return 业务场景标签列表,每个Map包含phoneNumber和businessScene字段
*/
List<Map<String, Object>> batchGetBusinessSceneByPhoneNumbers(@Param("phoneNumbers") List<String> phoneNumbers);
/**
* 查询员工调店记录
* <p>
* 根据业务类型和场景类型查询员工调店记录
......
......@@ -161,6 +161,7 @@ public class SupervisorDashboardRemoteImpl implements SupervisorDashboardRemote
public RpcResponse<List<EmployeeStoreTransferDTO>> getEmployeeStoreTransferRecords(EmployeeStoreTransferReq req) {
try {
log.info("开始远程调用获取员工调店记录,请求参数:{}", req);
List<EmployeeStoreTransferDTO> result = supervisorDashboardService.getEmployeeStoreTransferRecords(req);
log.info("远程调用获取员工调店记录成功");
return RpcResponse.success(result);
......
......@@ -17,7 +17,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Service
public class AiAnalysisService {
......@@ -34,13 +33,14 @@ public class AiAnalysisService {
/**
* 生成 AI 分析建议
*/
public String generateSuggestion(String supervisorId, String period, List<EmployeeRanking> employeeList) {
public String generateSuggestion(String supervisorId, String period, List<EmployeeRanking> employeeList,
Integer bizs) {
if (employeeList == null || employeeList.isEmpty()) {
return "当前周期暂无足够数据进行 AI 分析。";
}
// 生成缓存键
String cacheKey = String.format("supervisor:ai:performance:%s:%s", supervisorId, period);
String cacheKey = String.format("supervisor:ai:performance:%s:%s:%s", supervisorId, period, bizs==null?"-1":bizs);
// 尝试从缓存获取
try {
......@@ -103,13 +103,14 @@ public class AiAnalysisService {
}
}
public String generateBehaviorSuggestion(String supervisorId, String period, List<EmployeeRanking> employeeList) {
public String generateBehaviorSuggestion(String supervisorId, String period, List<EmployeeRanking> employeeList,
Integer bizs) {
if (employeeList == null || employeeList.isEmpty()) {
return "当前周期暂无行为数据进行 AI 分析。";
}
// 生成缓存键
String cacheKey = String.format("supervisor:ai:behavior:%s:%s", supervisorId, period);
String cacheKey = String.format("supervisor:ai:behavior:%s:%s:%s", supervisorId, period, bizs==null?"-1":bizs);
// 尝试从缓存获取
try {
......
......@@ -34,7 +34,7 @@ public class GetDataStatsService {
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");
String url = OrePropertyConfigurer.getProperty("total.data.url", String.class, "http://192.168.3.99:8021/data");
// post请求
String jsonResponse;
try {
......
......@@ -6,25 +6,43 @@
<select id="getBusinessSceneByPhoneNumber" parameterType="java.lang.String" resultType="java.lang.String">
SELECT COALESCE(GROUP_CONCAT(DISTINCT CASE WHEN go.scene_type = 1 THEN '1' WHEN go.scene_type = 0 THEN CASE WHEN go.business_type = 1 THEN '2' WHEN go.business_type = 2 THEN '3' END END ORDER BY CASE WHEN go.scene_type = 1 THEN '1' WHEN go.scene_type = 0 AND go.business_type = 1 THEN '2' WHEN go.scene_type = 0 AND go.business_type = 2 THEN '3' END SEPARATOR ', '), '') AS staff_scene_label
FROM dj_car_life_staff_info si
LEFT JOIN dj_car_life_goods_order go ON si.staff_uuid = go.seller_user_id AND go.install_upgrade_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)
LEFT JOIN dj_car_life_goods_order go ON si.staff_uuid = go.seller_user_id AND go.install_upgrade_time &gt;= DATE_SUB(CURDATE(), INTERVAL 30 DAY)
WHERE si.phone_number = #{phoneNumber}
GROUP BY si.phone_number
</select>
<!-- 批次查询业务场景标签 -->
<select id="batchGetBusinessSceneByPhoneNumbers" parameterType="java.util.List" resultType="java.util.HashMap">
SELECT
si.phone_number as phoneNumber,
COALESCE(GROUP_CONCAT(DISTINCT CASE WHEN go.scene_type = 1 THEN '1' WHEN go.scene_type = 0 THEN CASE WHEN go.business_type = 1 THEN '2' WHEN go.business_type = 2 THEN '3' END END ORDER BY CASE WHEN go.scene_type = 1 THEN '1' WHEN go.scene_type = 0 AND go.business_type = 1 THEN '2' WHEN go.scene_type = 0 AND go.business_type = 2 THEN '3' END SEPARATOR ', '), '') AS businessScene
FROM dj_car_life_staff_info si
LEFT JOIN dj_car_life_goods_order go ON si.staff_uuid = go.seller_user_id AND go.install_upgrade_time &gt;= DATE_SUB(CURDATE(), INTERVAL 30 DAY)
WHERE si.phone_number IN
<foreach collection="phoneNumbers" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY si.phone_number
</select>
<!-- 查询员工调店记录 -->
<select id="getEmployeeStoreTransferRecords" parameterType="map" resultType="cn.com.glsx.dj.supervisor.dto.EmployeeStoreTransferDTO">
SELECT
gi.merchant_id as merchantId,
MIN(gi.order_time) as startDate
gi.merchant_id as merchantId,
gi.merchant_name as merchantName,
gi.seller_user_id as employeeId,
date(MIN(gi.order_time)) as startDate
FROM
dj_car_life_staff_info si
LEFT JOIN dj_car_life_goods_order gi ON si.staff_uuid = gi.seller_user_id
WHERE
si.phone_number = #{phoneNumber}
AND gi.merchant_id IN
<foreach collection="merchantIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="merchantIds != null ">
AND gi.merchant_id IN
<foreach collection="merchantIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
AND gi.deleted_flag = 'N'
<if test="bizs != null">
AND (
......
......@@ -24,10 +24,10 @@
</foreach>
</if>
<if test="startDate != null and startDate != ''">
and date(t1.reception_start_time) >= #{startDate}
and date(t1.reception_start_time) &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and date(t1.reception_start_time) <= #{endDate}
and date(t1.reception_start_time) &lt;= #{endDate}
</if>
and t3.phone_number is not null
group by t3.phone_number
......
package cn.com.glsx.dj.supervisor.remote;
import cn.com.glsx.dj.supervisor.dto.*;
import cn.com.glsx.dj.supervisor.service.BaseServiceTest;
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 cn.com.glsx.merchants.dto.beisen.BeisenEmployeeInfoDTO;
import cn.com.glsx.merchants.remote.MerchantUserRemote;
import com.alibaba.fastjson.JSON;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @Title:
* @Description:
* @Author
* @Date 2026/3/18
**/
public class SupervisorDashboardRemoteImplTest extends BaseServiceTest {
@Autowired
private SupervisorDashboardRemoteImpl supervisorDashboardRemote;
@Test
public void testGetDashboardData() {
DashboardQueryReq req = new DashboardQueryReq();
req.setSupervisorId("63c121922cba4956b2aac3f21dacd92f");
req.setStartDate("2026-03-01");
req.setEndDate("2026-03-16");
req.setBizs(2);
req.setDateType(4);
req.setNeedAiAnalysis(true);
RpcResponse<SupervisorDashboardVO> response = supervisorDashboardRemote.getDashboardData(req);
System.out.println(JSON.toJSONString(response));
}
@Test
public void testGetDashboardBehaviorData() {
DashboardQueryReq req = new DashboardQueryReq();
req.setSupervisorId("63c121922cba4956b2aac3f21dacd92f");
req.setStartDate("2026-03-01");
req.setEndDate("2026-03-16");
req.setDateType(4);
req.setNeedAiAnalysis(true);
RpcResponse<SupervisorDashboardVO> response = supervisorDashboardRemote.getDashboardBehaviorData(req);
System.out.println(JSON.toJSONString(response));
}
@Test
public void testGetEmployeeDashboardData() {
EmployeeBasicInfoReq req = new EmployeeBasicInfoReq();
req.setPhone("13476670731");
RpcResponse<EmployeeBasicInfoDTO> response = supervisorDashboardRemote.getEmployeeDashboardData(req);
System.out.println(JSON.toJSONString(response));
}
@Test
public void testGetEmployeePerformanceData() {
EmployeePerformanceReq req = new EmployeePerformanceReq();
req.setEmployeeId("584fdb460afa4dad835cbe8d73cfa923");
req.setMerchantId(44211227);
req.setStartDate("2026-03-01");
req.setEndDate("2026-03-15");
req.setDateType(4);
RpcResponse<EmployeePerformanceDTO> response = supervisorDashboardRemote.getEmployeePerformanceData(req);
System.out.println(JSON.toJSONString(response));
}
@Test
public void testGetEmployeeBehaviorData() {
EmployeeBehaviorReq req = new EmployeeBehaviorReq();
req.setEmployeeId("123");
req.setPhone("13800138000");
req.setMerchantId(456);
req.setBizs(1);
req.setStartDate("2026-03-01");
req.setEndDate("2026-03-15");
RpcResponse<EmployeeBehaviorDTO> response = supervisorDashboardRemote.getEmployeeBehaviorData(req);
System.out.println(JSON.toJSONString(response));
}
@Test
public void testGetEmployeeStoreTransferRecords() {
EmployeeStoreTransferReq req = new EmployeeStoreTransferReq();
req.setPhoneNumber("13132112126");
RpcResponse<List<EmployeeStoreTransferDTO>> response = supervisorDashboardRemote.getEmployeeStoreTransferRecords(req);
System.out.println(JSON.toJSONString(response));
}
@Test
public void testGetRecordingList() {
RecordingQueryReq req = new RecordingQueryReq();
req.setMerchantId(123);
req.setEmployeeId("456");
req.setBiz(1);
req.setStartDate("2026-03-01");
req.setEndDate("2026-03-15");
req.setPageNum(1);
req.setPageSize(10);
RpcResponse<RecordingListDTO> response = supervisorDashboardRemote.getRecordingList(req);
System.out.println(JSON.toJSONString(response));
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!