Commit 5656e840 by zhouhaibao

[+]驻店员工逻辑调整

1 parent f37fac32
...@@ -2,6 +2,7 @@ package cn.com.glsx.dj.supervisor.dto; ...@@ -2,6 +2,7 @@ package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -215,19 +216,19 @@ public class EmployeeBehaviorDTO implements Serializable { ...@@ -215,19 +216,19 @@ public class EmployeeBehaviorDTO implements Serializable {
* 质检平均分 * 质检平均分
*/ */
@ApiModelProperty(notes = "质检平均分", example = "2") @ApiModelProperty(notes = "质检平均分", example = "2")
private Integer qualityScore; private BigDecimal qualityScore;
/** /**
* 攻防平均分 * 攻防平均分
*/ */
@ApiModelProperty(notes = "攻防平均分", example = "1") @ApiModelProperty(notes = "攻防平均分", example = "1")
private Integer attackDefenseScore; private BigDecimal attackDefenseScore;
/** /**
* 录音缺失率 * 录音缺失率
*/ */
@ApiModelProperty(notes = "录音缺失率", example = "1") @ApiModelProperty(notes = "录音缺失率", example = "1")
private Integer recordingMissingRate; private String recordingMissingRate;
} }
/** /**
......
...@@ -170,9 +170,9 @@ public class SupervisorDashboardService { ...@@ -170,9 +170,9 @@ public class SupervisorDashboardService {
EmployeeRanking metric = metricMap.get(employee.getEmployeePhone()); EmployeeRanking metric = metricMap.get(employee.getEmployeePhone());
if (metric != null) { if (metric != null) {
// 设置指标数据 // 设置指标数据
employee.setPersonalOutput(metric.getPersonalOutput()); employee.setPersonalOutput(formatPercentage2(metric.getPersonalOutput()));
employee.setPersonalUnitPrice(metric.getPersonalUnitPrice()); employee.setPersonalUnitPrice(formatPercentage2(metric.getPersonalUnitPrice()));
employee.setPersonalConversion(metric.getPersonalConversion()); employee.setPersonalConversion(formatPercentage3(metric.getPersonalConversion()));
} }
} }
} }
...@@ -288,12 +288,12 @@ public class SupervisorDashboardService { ...@@ -288,12 +288,12 @@ public class SupervisorDashboardService {
EmployeeRanking metric = metricMap.get(employee.getEmployeePhone()); EmployeeRanking metric = metricMap.get(employee.getEmployeePhone());
if (metric != null) { if (metric != null) {
// 设置指标数据 // 设置指标数据
employee.setPersonalOutput(metric.getPersonalOutput()); employee.setPersonalOutput(formatPercentage2(metric.getPersonalOutput()));
employee.setDealCount(metric.getDealCount()); employee.setDealCount(metric.getDealCount());
employee.setDefeatCount(metric.getDefeatCount()); employee.setDefeatCount(metric.getDefeatCount());
employee.setRecordingCount(metric.getRecordingCount()); employee.setRecordingCount(metric.getRecordingCount());
employee.setLeadCount(metric.getLeadCount()); employee.setLeadCount(metric.getLeadCount());
employee.setMissingRate(metric.getMissingRate()); employee.setMissingRate(formatPercentage3(metric.getMissingRate()));
} }
} }
} }
...@@ -918,7 +918,7 @@ public class SupervisorDashboardService { ...@@ -918,7 +918,7 @@ public class SupervisorDashboardService {
behaviorTags.put(groupName, tagName); behaviorTags.put(groupName, tagName);
if ("差".equals(tagName)) { if ("差".equals(tagName)|| "低".equals(tagName)) {
badList.put(groupName, tagName); badList.put(groupName, tagName);
} else { } else {
ohterList.put(groupName, tagName); ohterList.put(groupName, tagName);
...@@ -941,9 +941,9 @@ public class SupervisorDashboardService { ...@@ -941,9 +941,9 @@ public class SupervisorDashboardService {
String dealRate = recordingCount > 0 ? String.format("%.0f%%", (double) dealCount / recordingCount * 100) : "0%"; String dealRate = recordingCount > 0 ? String.format("%.0f%%", (double) dealCount / recordingCount * 100) : "0%";
quantitativeIndicators.setDealRate(dealRate); // 成交率 quantitativeIndicators.setDealRate(dealRate); // 成交率
quantitativeIndicators.setQualityScore(getIntegerValue(recordingAnalysisData, "qualityScore")); // 质检平均分 quantitativeIndicators.setQualityScore(formatPercentage2(getBigValue(recordingAnalysisData, "qualityScore"))); // 质检平均分
quantitativeIndicators.setAttackDefenseScore(getIntegerValue(recordingAnalysisData, "attackDefenseScore")); // 攻防平均分 quantitativeIndicators.setAttackDefenseScore(formatPercentage2(getBigValue(recordingAnalysisData, "attackDefenseScore"))); // 攻防平均分
quantitativeIndicators.setRecordingMissingRate(getDoubleValue(recordingAnalysisData, "recordingMissingRate").intValue()); // 录音缺失率 quantitativeIndicators.setRecordingMissingRate(formatPercentage(getBigValue(recordingAnalysisData, "recordingMissingRate"))); // 录音缺失率
recordingAnalysis.setQuantitativeIndicators(quantitativeIndicators); recordingAnalysis.setQuantitativeIndicators(quantitativeIndicators);
behaviorData.setRecordingAnalysis(recordingAnalysis); behaviorData.setRecordingAnalysis(recordingAnalysis);
...@@ -980,6 +980,9 @@ public class SupervisorDashboardService { ...@@ -980,6 +980,9 @@ public class SupervisorDashboardService {
if (value instanceof Double) { if (value instanceof Double) {
return ((Double) value).intValue(); return ((Double) value).intValue();
} }
if (value instanceof BigDecimal){
return ((BigDecimal) value).intValue();
}
return 0; return 0;
} }
...@@ -989,24 +992,21 @@ public class SupervisorDashboardService { ...@@ -989,24 +992,21 @@ public class SupervisorDashboardService {
* @param key 键 * @param key 键
* @return 浮点数值 * @return 浮点数值
*/ */
private Double getDoubleValue(Map<String, Object> map, String key) { private BigDecimal getBigValue(Map<String, Object> map, String key) {
if (map == null || !map.containsKey(key)) { if (map == null || !map.containsKey(key)) {
return 0.0; return null;
} }
Object value = map.get(key); Object value = map.get(key);
if (value == null) { if (value == null) {
return 0.0; return null;
}
if (value instanceof Double) {
return (Double) value;
} }
if (value instanceof Integer) { if (value instanceof BigDecimal){
return ((Integer) value).doubleValue(); return (BigDecimal) value;
} }
if (value instanceof Long) { if (value instanceof Double) {
return ((Long) value).doubleValue(); return BigDecimal.valueOf((Double) value);
} }
return 0.0; return null;
} }
/** /**
...@@ -1198,6 +1198,19 @@ public class SupervisorDashboardService { ...@@ -1198,6 +1198,19 @@ public class SupervisorDashboardService {
* @param value 数值(如0.25表示25%) * @param value 数值(如0.25表示25%)
* @return 格式化后的百分比字符串(如"25.00%") * @return 格式化后的百分比字符串(如"25.00%")
*/ */
private BigDecimal formatPercentage3(BigDecimal value) {
if (value == null) {
return null;
}
BigDecimal percentage = value.multiply(new BigDecimal("100"));
return percentage.setScale(2, BigDecimal.ROUND_HALF_UP);
}
/**
* 格式化百分比:将数值乘以100,保留两位小数并加上%号
* @param value 数值(如0.25表示25%)
* @return 格式化后的百分比字符串(如"25.00%")
*/
private String formatPercentage1(BigDecimal value) { private String formatPercentage1(BigDecimal value) {
if (value == null) { if (value == null) {
return null; return null;
......
...@@ -147,6 +147,7 @@ ...@@ -147,6 +147,7 @@
AND merchant_id = #{merchantId} AND merchant_id = #{merchantId}
AND report_date &gt;= #{startDate} AND report_date &gt;= #{startDate}
AND report_date &lt;= #{endDate} AND report_date &lt;= #{endDate}
<if test="biz != null"> <if test="biz != null">
AND ( AND (
(#{biz} = 1 AND scene_type = 0) (#{biz} = 1 AND scene_type = 0)
...@@ -192,7 +193,7 @@ ...@@ -192,7 +193,7 @@
-- 平均攻防分 -- 平均攻防分
COALESCE(SUM(gfScroe) / COUNT(1), 0) AS attackDefenseScore, COALESCE(SUM(gfScroe) / COUNT(1), 0) AS attackDefenseScore,
-- 录音缺失率 = (接待数量 - 录音数量) / 接待数量 -- 录音缺失率 = (接待数量 - 录音数量) / 接待数量
COALESCE((#{receptionCount} - COUNT(*)) / #{receptionCount} * 100, 0) AS recordingMissingRate COALESCE((#{receptionCount} - COUNT(1)) / #{receptionCount} , 0) AS recordingMissingRate
FROM ( FROM (
SELECT SELECT
t1.merchant_id, t1.merchant_id,
...@@ -233,7 +234,7 @@ ...@@ -233,7 +234,7 @@
LEFT JOIN dj_car_life_service_merchant t6 ON t1.merchant_id=t6.merchant_id LEFT JOIN dj_car_life_service_merchant t6 ON t1.merchant_id=t6.merchant_id
WHERE t1.merchant_id = #{merchantId} WHERE t1.merchant_id = #{merchantId}
AND t1.staff_uuid = #{staffUuid} AND t1.staff_uuid = #{staffUuid}
AND t1.bussiness_type = #{biz} AND t2.check_type = #{biz}
AND DATE(T1.reception_start_time)&gt;=#{startDate} AND DATE(T1.reception_start_time)&gt;=#{startDate}
AND DATE(T1.reception_start_time)&lt;=#{endDate} AND DATE(T1.reception_start_time)&lt;=#{endDate}
) AS recordingData ) AS recordingData
......
...@@ -82,9 +82,9 @@ public class SupervisorDashboardRemoteImplTest extends BaseServiceTest { ...@@ -82,9 +82,9 @@ public class SupervisorDashboardRemoteImplTest extends BaseServiceTest {
req.setEmployeeId("584fdb460afa4dad835cbe8d73cfa923"); req.setEmployeeId("584fdb460afa4dad835cbe8d73cfa923");
req.setPhone("13132112126"); req.setPhone("13132112126");
req.setMerchantId(44211227); req.setMerchantId(44211227);
req.setBizs(1); req.setBizs(2);
req.setStartDate("2026-03-01"); req.setStartDate("2026-03-01");
req.setEndDate("2026-03-15"); req.setEndDate("2026-03-30");
RpcResponse<EmployeeBehaviorDTO> response = supervisorDashboardRemote.getEmployeeBehaviorData(req); RpcResponse<EmployeeBehaviorDTO> response = supervisorDashboardRemote.getEmployeeBehaviorData(req);
System.out.println(JSON.toJSONString(response)); 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!