Commit 4ef68d20 by 范富荣

优化督导员工接口

1 parent c5f02ec7
......@@ -72,7 +72,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
// 1. 查询系统中所有督导员工列表
List<MerchantStaffResponse> supervisorList = supervisorTaskInfoService.listAllEffectiveSupervisors();
if (supervisorList == null || supervisorList.isEmpty()) {
log.error("查询督导员工列表为空");
log.error("查询督导列表为空");
return;
}
String yesterday = DateUtils.getYesterdayDate();
......@@ -112,7 +112,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
// 2.3 查询督导员工产值列表,根据手机号匹配员工产值
Map<String, BigDecimal> staffValueMap = getStaffValueMap(staffList, merchantIdList, yesterday);
//将staffList 用手机号分组, 并转为list
Map<String, StaffBaseInfoDTO> staffMap = staffList.stream().collect(Collectors.toMap(StaffBaseInfoDTO::getStaffPhone, v -> v, (v1, v2) -> v1));
Map<String, StaffBaseInfoDTO> staffMap = staffList.stream().filter(x -> StringUtils.isNotBlank(x.getStaffPhone())).collect(Collectors.toMap(StaffBaseInfoDTO::getStaffPhone, v -> v, (v1, v2) -> v1));
//将staffMap 转为list
List<StaffBaseInfoDTO> staffPhoneList = staffMap.values().stream().collect(Collectors.toList());
// 3. 根据员工的产值,对员工进行排序(按产值降序排序,如果为空,排最后)
......@@ -141,7 +141,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
}
// 5. 生成录音任务记录
generateAudioReviewTask(supervisor, audioList);
generateAudioReviewTask(supervisor, audioList, yesterday);
} catch (Exception e) {
log.error("处理督导 {} 的录音复盘任务生成失败", supervisor.getStaffName(), e);
......@@ -202,7 +202,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
}
/**
* 模拟获取员工昨日接待录音列表
* 获取员工昨日接待录音列表-战败状态
*/
private List<AudioReceptionDTO> getStaffAudioList(List<Integer> merchantIdList, List<String> staffPhoneList, String date) {
//查询录音列表
......@@ -211,6 +211,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
query.setStaffPhoneList(staffPhoneList);
query.setStartDate(date);
query.setEndDate(date);
query.setReceptionStatus(0);
return supervisorAudioReviewInfoService.listAudionByEmployeeInfo(query);
}
......@@ -218,7 +219,8 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
* 生成录音复盘任务记录
*/
private void generateAudioReviewTask(MerchantStaffResponse supervisor,
List<AudioReceptionDTO> audioList) {
List<AudioReceptionDTO> audioList,
String yesterday) {
Date date = new Date();
// 1. 生成supervisor_task_info记录
SupervisorTaskInfo taskInfo = new SupervisorTaskInfo();
......@@ -227,6 +229,8 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
taskInfo.setSupervisorPhone(supervisor.getStaffPhone());
taskInfo.setSupervisorName(supervisor.getStaffName());
taskInfo.setSupervisorUuid(supervisor.getUuid());
taskInfo.setStartDate(yesterday);
taskInfo.setEndDate(yesterday);
taskInfo.setCreatedBy("system");
taskInfo.setCreateTime(date);
taskInfo.setDeletedFlag(BaseModel.DeletedFlagEnum.N.name());
......
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.smartcarlife.util.DateUtils;
import cn.com.glsx.dj.supervisor.dto.AudioReceptionDTO;
import cn.com.glsx.dj.supervisor.dto.AudioSummaryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
......@@ -109,7 +110,9 @@ public class SupervisorAudioReviewInfoService {
SupervisorTaskDTO task = supervisorTaskInfoService.getTaskDetailById(request.getId());
if (task != null) {
dto.setTaskStatus(task.getTaskStatus());
dto.setCreateTime(task.getCreateTime());
//根据task.getCreateTime() , 获取前一天日期
Date yesterday = DateUtils.addDate(task.getCreateTime(), "day", -1);
dto.setCreateTime(yesterday);
}
return dto;
}
......
......@@ -91,7 +91,7 @@ public class SupervisorTaskInfoService {
@Autowired
private SupervisorDashboardService supervisorDashboardService;
@DubboReference(version = "2.0.0", check = false, timeout = 5000)
@Autowired
private MerchantUserRemote merchantUserRemote;
@Autowired
......@@ -108,7 +108,7 @@ public class SupervisorTaskInfoService {
public void generateTask(Integer taskType, String startTimeStr, String endTimeStr) {
//查询督导人员列表
List<MerchantStaffResponse> staffList = listAllSupervisors();
List<MerchantStaffResponse> staffList = listAllEffectiveSupervisors();
if (CollectionUtils.isEmpty(staffList)) {
log.error("查询督导人员列表为空,startTimeStr={}", startTimeStr);
return;
......@@ -269,7 +269,7 @@ public class SupervisorTaskInfoService {
return getMerchantStaffByPhone(null);
}
private List<MerchantStaffResponse> getMerchantStaffByPhone(String phone) {
public List<MerchantStaffResponse> getMerchantStaffByPhone(String phone) {
MerchantStaffRequest staffRequest = new MerchantStaffRequest();
staffRequest.setMerchantNo(env.getProperty("glsk_merchant_id", Integer.class, 44205577));
staffRequest.setRoleName(env.getProperty("glsk_supervisor_role_name", String.class, "飞行督导"));
......@@ -535,14 +535,9 @@ public class SupervisorTaskInfoService {
public SupervisorTaskSummaryDTO getTaskSummary(SupervisorTaskQueryDTO request) {
SupervisorTaskSummaryDTO res = new SupervisorTaskSummaryDTO();
//查询所有飞行督导员工列表
List<MerchantStaffResponse> merchantStaffResponses = listAllSupervisors();
List<MerchantStaffResponse> merchantStaffResponses = listAllEffectiveSupervisors();
if (CollectionUtils.isNotEmpty(merchantStaffResponses)) {
List<String> phoneList = merchantStaffResponses.stream()
.map(MerchantStaffResponse::getStaffPhone)
.filter(phone -> phone != null && !phone.isEmpty())
.distinct()
.collect(Collectors.toList());
res.setTotalCount(getEffectiveSupervisors(phoneList).size());
res.setTotalCount(merchantStaffResponses.size());
}
//根据条件,调用分页查询任务 接口,根据返回的数据,去重计算提交任务人数,提交任务数
List<SupervisorTaskDTO> taskList = supervisorTaskInfoMapper.listTask(request);
......@@ -640,7 +635,7 @@ public class SupervisorTaskInfoService {
List<StaffBaseInfoDTO> staffList = response.getResult();
if (CollectionUtils.isNotEmpty(staffList)) {
//根据员工手机号去重计算员工个数
Set<String> phoneSet = staffList.stream().map(StaffBaseInfoDTO::getStaffPhone).collect(Collectors.toSet());
Set<String> phoneSet = staffList.stream().filter(x -> StringUtils.isNotBlank(x.getStaffPhone())).map(StaffBaseInfoDTO::getStaffPhone).collect(Collectors.toSet());
overviewDTO.setStaffCount(phoneSet.size());
//查询产值
SceneBaseReq req = new SceneBaseReq();
......
......@@ -14,6 +14,7 @@ import cn.com.glsx.dj.supervisor.model.SupervisorWeekTaskStaff;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.merchants.model.response.MerchantStaffResponse;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import org.apache.commons.collections.CollectionUtils;
......@@ -45,6 +46,20 @@ public class SupervisorTaskInfoServiceTest extends BaseServiceTest {
System.out.println(JSON.toJSONString(detail));
}
/**
* 测试 getMerchantStaffByPhone
*/
@Test
public void testGetMerchantStaffByPhone() {
String phone = "13603070903";
List<MerchantStaffResponse> merchantUser = supervisorTaskInfoService.getMerchantStaffByPhone(phone);
System.out.println(JSON.toJSONString(merchantUser));
}
/**
* 测试 submitCoaching
*/
@Test
public void testSubmitCoaching() {
SupervisorTaskDTO request = new SupervisorTaskDTO();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!