Commit 8bfd42d3 by 范富荣

修改查询员工接口

1 parent 222378e8
...@@ -20,6 +20,7 @@ import cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService; ...@@ -20,6 +20,7 @@ import cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService;
import cn.com.glsx.dj.supervisor.utils.DateUtils; import cn.com.glsx.dj.supervisor.utils.DateUtils;
import cn.com.glsx.framework.core.beans.BaseModel; import cn.com.glsx.framework.core.beans.BaseModel;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.merchants.model.response.MerchantStaffResponse;
import com.dangdang.ddframe.job.api.ShardingContext; import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob; import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -27,6 +28,7 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -27,6 +28,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf; import org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -58,6 +60,9 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob { ...@@ -58,6 +60,9 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
@Autowired @Autowired
private BusinessSceneAnalysisRemote businessSceneAnalysisRemote; private BusinessSceneAnalysisRemote businessSceneAnalysisRemote;
@Autowired
private Environment environment;
@Override @Override
public void execute(ShardingContext shardingContext) { public void execute(ShardingContext shardingContext) {
...@@ -65,14 +70,16 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob { ...@@ -65,14 +70,16 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
log.info("督导录音复盘任务生成开始执行"); log.info("督导录音复盘任务生成开始执行");
// 1. 查询系统中所有督导员工列表 // 1. 查询系统中所有督导员工列表
List<cn.com.glsx.merchants.model.response.MerchantStaffResponse> supervisorList = supervisorTaskInfoService.listAllSupervisors(); List<MerchantStaffResponse> supervisorList = supervisorTaskInfoService.listAllSupervisors();
if (supervisorList == null || supervisorList.isEmpty()) { if (supervisorList == null || supervisorList.isEmpty()) {
log.error("查询督导员工列表为空"); log.error("查询督导员工列表为空");
return; return;
} }
String yesterday = DateUtils.getYesterdayDate(); String yesterday = DateUtils.getYesterdayDate();
//计算员工排名阈值
double rankThreshold = environment.getProperty("dj.supervisor.audio.review.task.rank.threshold", Double.class, 0.3);
// 2. 遍历督导员工列表 // 2. 遍历督导员工列表
for (cn.com.glsx.merchants.model.response.MerchantStaffResponse supervisor : supervisorList) { for (MerchantStaffResponse supervisor : supervisorList) {
try { try {
// 2.1 查询督导管理的门店列表,参考CommonUtil.getFlightSupervisionMerchantList方法 // 2.1 查询督导管理的门店列表,参考CommonUtil.getFlightSupervisionMerchantList方法
ShopMerchantDirectorConfigDTO dto = new ShopMerchantDirectorConfigDTO(); ShopMerchantDirectorConfigDTO dto = new ShopMerchantDirectorConfigDTO();
...@@ -95,7 +102,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob { ...@@ -95,7 +102,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
// 2.2 查询督导下面的员工列表 // 2.2 查询督导下面的员工列表
StaffBaseInfoDTO staffParam = new StaffBaseInfoDTO(); StaffBaseInfoDTO staffParam = new StaffBaseInfoDTO();
staffParam.setMerchantIdList(merchantIdList); staffParam.setMerchantIdList(merchantIdList);
RpcResponse<List<StaffBaseInfoDTO>> staffResponse = staffBaseInfoRemote.listShopStaffBaseInfo(staffParam); RpcResponse<List<StaffBaseInfoDTO>> staffResponse = staffBaseInfoRemote.listShopStaffInfoGroupByUUid(staffParam);
if (!staffResponse.isSuccess() || staffResponse.getResult() == null || staffResponse.getResult().isEmpty()) { if (!staffResponse.isSuccess() || staffResponse.getResult() == null || staffResponse.getResult().isEmpty()) {
log.info("督导 {} 无管理员工", supervisor.getStaffName()); log.info("督导 {} 无管理员工", supervisor.getStaffName());
continue; continue;
...@@ -114,7 +121,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob { ...@@ -114,7 +121,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
.collect(Collectors.toList()); .collect(Collectors.toList());
// 3.1 计算排名倒数30%的人员数量,向上取值 // 3.1 计算排名倒数30%的人员数量,向上取值
int totalStaff = sortedStaffList.size(); int totalStaff = sortedStaffList.size();
int poorPerfCount = (int) Math.ceil(totalStaff * 0.3); int poorPerfCount = (int) Math.ceil(totalStaff * rankThreshold);
if (poorPerfCount <= 0) { if (poorPerfCount <= 0) {
log.info("督导 {} 管理员工数量不足,无需生成录音复盘任务", supervisor.getStaffName()); log.info("督导 {} 管理员工数量不足,无需生成录音复盘任务", supervisor.getStaffName());
continue; continue;
...@@ -164,7 +171,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob { ...@@ -164,7 +171,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
// 设置门店列表 // 设置门店列表
req.setMerchantIds(merchantIdList); req.setMerchantIds(merchantIdList);
//设置员工信息 //设置员工信息
req.setStaffPhones(staffList.stream().map(StaffBaseInfoDTO::getStaffPhone).collect(Collectors.toList())); req.setStaffUuids(staffList.stream().map(StaffBaseInfoDTO::getLoginUuid).collect(Collectors.toList()));
// 调用远程接口查询督导员工产值列表 // 调用远程接口查询督导员工产值列表
RpcResponse<List<StoreEmployeeRankResponse.EmployeeAnalysisItem>> response = RpcResponse<List<StoreEmployeeRankResponse.EmployeeAnalysisItem>> response =
......
...@@ -407,7 +407,7 @@ public class SupervisorTaskInfoService { ...@@ -407,7 +407,7 @@ public class SupervisorTaskInfoService {
// 计算团队员工个数 // 计算团队员工个数
StaffBaseInfoDTO param = new StaffBaseInfoDTO(); StaffBaseInfoDTO param = new StaffBaseInfoDTO();
param.setMerchantIdList(merchantIdList); param.setMerchantIdList(merchantIdList);
RpcResponse<List<StaffBaseInfoDTO>> response = staffBaseInfoRemote.listShopStaffBaseInfo(param); RpcResponse<List<StaffBaseInfoDTO>> response = staffBaseInfoRemote.listShopStaffInfoGroupByUUid(param);
if (response.hasError()) { if (response.hasError()) {
log.error("查询团队员工个数失败,merchantIdList={}, error={}, message={}", merchantIdList, response.getError(), response.getMessage()); log.error("查询团队员工个数失败,merchantIdList={}, error={}, message={}", merchantIdList, response.getError(), response.getMessage());
throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, response.getMessage()); throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, response.getMessage());
...@@ -419,7 +419,7 @@ public class SupervisorTaskInfoService { ...@@ -419,7 +419,7 @@ public class SupervisorTaskInfoService {
SceneBaseReq req = new SceneBaseReq(); SceneBaseReq req = new SceneBaseReq();
req.setMerchantIds(merchantIdList); req.setMerchantIds(merchantIdList);
req.setCycleType(4); req.setCycleType(4);
req.setStaffPhones(staffList.stream().map(StaffBaseInfoDTO::getStaffPhone).collect(Collectors.toList())); req.setStaffUuids(staffList.stream().map(StaffBaseInfoDTO::getLoginUuid).collect(Collectors.toList()));
RpcResponse<SceneOutputResponse> outputResponse = businessSceneAnalysisRemote.querySupervisorOutput(req); RpcResponse<SceneOutputResponse> outputResponse = businessSceneAnalysisRemote.querySupervisorOutput(req);
if (outputResponse.hasError()) { if (outputResponse.hasError()) {
log.error("查询督导团队产值失败,SceneBaseReq={}, error={}, message={}", JSON.toJSONString(req), outputResponse.getError(), outputResponse.getMessage()); log.error("查询督导团队产值失败,SceneBaseReq={}, error={}, message={}", JSON.toJSONString(req), outputResponse.getError(), outputResponse.getMessage());
......
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.job.SupervisorAudioReviewTaskJob;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
public class SupervisorAudioReviewTaskJobTest extends BaseServiceTest {
@Autowired
private SupervisorAudioReviewTaskJob supervisorAudioReviewTaskJob;
@Test
public void testExecute() {
supervisorAudioReviewTaskJob.execute(null);
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!