Commit c2bd4f0a by 范富荣

添加删除预警基线配置接口,添加查询录音详情接口,优化日报模块查询接口

1 parent 8bfd42d3
Showing 19 changed files with 368 additions and 56 deletions
......@@ -73,7 +73,7 @@ public class AudioReceptionDTO implements Serializable {
* 录音复盘内容
*/
@ApiModelProperty(notes = "录音复盘内容")
private String reviewContent;
private String reviewContext;
@ApiModelProperty(notes = "录音批次id")
private Integer batchId;
......
......@@ -15,17 +15,26 @@ public class AudioSummaryDTO implements Serializable {
* 已复盘数量
*/
@ApiModelProperty(notes = "已复盘数量")
private Integer reviewedCount;
private Integer reviewedCount;
/**
* 未复盘数量
*/
@ApiModelProperty(notes = "未复盘数量")
private Integer unreviewedCount;
@ApiModelProperty(notes = "未复盘数量")
private Integer unreviewedCount;
/**
* 总数
*/
@ApiModelProperty(notes = "总数")
private Integer totalCount;
@ApiModelProperty(notes = "总数")
private Integer totalCount;
@ApiModelProperty(notes = "任务状态 0-待完成 1-进行中,2-已完成")
private Integer taskStatus;
/**
* 创建时间
*/
@ApiModelProperty(notes = "创建时间")
private Date createTime;
}
......@@ -102,6 +102,22 @@ public class SupervisorTaskDTO implements Serializable {
@ApiModelProperty(notes = "更新人手机号")
private String updatedPhone;
@ApiModelProperty(value = "入职时间", example = "2025-12-12")
private String entryDate;
/**
* 性别
*/
@ApiModelProperty(value = "性别", example = "女")
private String gender;
/**
* 归属业务
*/
@ApiModelProperty(value = "归属业务", example = "延保")
private String business;
/**
* 周任务人员列表
*/
......
......@@ -29,7 +29,8 @@ public class WarningBaselineConfigDTO implements Serializable {
@NotEmpty(message = "预警基线配置列表不能为空")
@ApiModelProperty(notes = "预警基线配置列表", required = true)
private List<SupervisorWarningBaselineConfig> configList;
@ApiModelProperty(notes = "更新标识:(0.新增,1.更新)", required = true)
private int updateFlag;
private String updatedBy;
......
......@@ -84,6 +84,17 @@ public interface SupervisorTaskInfoRemote {
@ApiResponse("提交结果")
RpcResponse<Boolean> submitAudioReview(SupervisorAudioReviewInfo request);
/**
* 查询录音详情信息
*/
@ApiMethod("查询录音详情信息")
@ApiParams({@ApiParam(name = "request", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)})
@ApiResponse("录音详情信息")
RpcResponse<AudioReceptionDTO> getAudioReviewDetail(SupervisorTaskQueryDTO request);
/**
* 发起带教 - 提交
*/
......
......@@ -23,5 +23,13 @@ public interface SupervisorWarningBaselineConfigRemote {
@ApiResponse("预警基线配置列表")
RpcResponse<List<WarningBaselineConfigDTO>> listAllWarningBaselineConfigs();
/**
* 删除预警基线配置
*/
@ApiMethod("删除预警基线配置")
@ApiParams({@ApiParam(name = "request", notes = "预警基线配置信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)})
@ApiResponse("删除结果")
RpcResponse<Boolean> deleteWarningBaselineConfig(WarningBaselineConfigDTO request);
}
......@@ -70,12 +70,13 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
log.info("督导录音复盘任务生成开始执行");
// 1. 查询系统中所有督导员工列表
List<MerchantStaffResponse> supervisorList = supervisorTaskInfoService.listAllSupervisors();
List<MerchantStaffResponse> supervisorList = supervisorTaskInfoService.listAllEffectiveSupervisors();
if (supervisorList == null || supervisorList.isEmpty()) {
log.error("查询督导员工列表为空");
return;
}
String yesterday = DateUtils.getYesterdayDate();
//String yesterday = "2024-05-10";
//计算员工排名阈值
double rankThreshold = environment.getProperty("dj.supervisor.audio.review.task.rank.threshold", Double.class, 0.3);
// 2. 遍历督导员工列表
......@@ -110,9 +111,12 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
List<StaffBaseInfoDTO> staffList = staffResponse.getResult();
// 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));
//将staffMap 转为list
List<StaffBaseInfoDTO> staffPhoneList = staffMap.values().stream().collect(Collectors.toList());
// 3. 根据员工的产值,对员工进行排序(按产值降序排序,如果为空,排最后)
List<StaffBaseInfoDTO> sortedStaffList = staffList.stream()
List<StaffBaseInfoDTO> sortedStaffList = staffPhoneList.stream()
.sorted((s1, s2) -> {
BigDecimal v1 = staffValueMap.getOrDefault(s1.getStaffPhone(), BigDecimal.ZERO);
BigDecimal v2 = staffValueMap.getOrDefault(s2.getStaffPhone(), BigDecimal.ZERO);
......@@ -129,7 +133,6 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
// 3.2 获取绩差员工列表
List<StaffBaseInfoDTO> poorPerfStaffList = sortedStaffList.subList(
Math.max(0, totalStaff - poorPerfCount), totalStaff);
poorPerfStaffList.stream().map(StaffBaseInfoDTO::getStaffPhone).collect(Collectors.toList());
// 4. 根据绩差员工列表,查询员工昨日接待录音列表(接待状态为战败)
List<AudioReceptionDTO> audioList = getStaffAudioList(merchantIdList, poorPerfStaffList.stream().map(StaffBaseInfoDTO::getStaffPhone).collect(Collectors.toList()), yesterday);
if (CollectionUtils.isEmpty(audioList)) {
......@@ -168,6 +171,7 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
req.setCycleType(1); // 3.按日
// 设置时间范围,查询昨日数据
req.setStartTime(date);
req.setEndTime(date);
// 设置门店列表
req.setMerchantIds(merchantIdList);
//设置员工信息
......@@ -213,8 +217,8 @@ public class SupervisorAudioReviewTaskJob implements SimpleJob {
/**
* 生成录音复盘任务记录
*/
private void generateAudioReviewTask(cn.com.glsx.merchants.model.response.MerchantStaffResponse supervisor,
List<AudioReceptionDTO> audioList) {
private void generateAudioReviewTask(MerchantStaffResponse supervisor,
List<AudioReceptionDTO> audioList) {
Date date = new Date();
// 1. 生成supervisor_task_info记录
SupervisorTaskInfo taskInfo = new SupervisorTaskInfo();
......
......@@ -12,7 +12,7 @@ import java.util.List;
@Mapper
public interface SupervisorAudioReviewInfoMapper extends OreMapper<SupervisorAudioReviewInfo> {
List<AudioReceptionDTO> listAudionByReceptionId(@Param("relationId") Long receptionId);
List<AudioReceptionDTO> listAudionByReceptionId(SupervisorTaskQueryDTO query);
List<AudioReceptionDTO> listAudionByEmployeeInfo(SupervisorTaskQueryDTO query);
......
......@@ -153,6 +153,22 @@ public class SupervisorTaskInfoRemoteImpl implements SupervisorTaskInfoRemote {
}
}
@Override
public RpcResponse<AudioReceptionDTO> getAudioReviewDetail(SupervisorTaskQueryDTO request) {
try {
AudioReceptionDTO result = supervisorAudioReviewInfoService.getAudioReviewDetail(request);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.getAudioReviewDetail error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.getAudioReviewDetail system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
@Override
public RpcResponse<Long> submitCoaching(SupervisorTaskDTO request) {
try {
......
......@@ -45,4 +45,18 @@ public class SupervisorWarningBaselineConfigRemoteImpl implements SupervisorWarn
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
@Override
public RpcResponse<Boolean> deleteWarningBaselineConfig(WarningBaselineConfigDTO request) {
try {
Boolean result = supervisorWarningBaselineConfigService.deleteWarningBaselineConfig(request);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorWarningBaselineConfigRemoteImpl.deleteWarningBaselineConfig error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorWarningBaselineConfigRemoteImpl.deleteWarningBaselineConfig system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
}
......@@ -2,6 +2,7 @@ package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.dto.AudioReceptionDTO;
import cn.com.glsx.dj.supervisor.dto.AudioSummaryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO;
import cn.com.glsx.dj.supervisor.enums.ReviewStatusEnum;
import cn.com.glsx.dj.supervisor.enums.TaskStatusEnum;
......@@ -15,6 +16,7 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.oreframework.distribute.lock.annotation.GlsxDistributeLockable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -57,7 +59,7 @@ public class SupervisorAudioReviewInfoService {
public Page<AudioReceptionDTO> pageAudioReception(RpcPagination<SupervisorTaskQueryDTO> request) {
//分页查询
Page<AudioReceptionDTO> page = PageHelper.startPage(request.getPageNum(), request.getPageSize());
List<AudioReceptionDTO> list = supervisorAudioReviewInfoMapper.listAudionByReceptionId(request.getCondition().getId());
List<AudioReceptionDTO> list = supervisorAudioReviewInfoMapper.listAudionByReceptionId(request.getCondition());
if(CollectionUtils.isNotEmpty(list)) {
list.forEach(item -> {
//处理录音时长
......@@ -69,6 +71,20 @@ public class SupervisorAudioReviewInfoService {
return page;
}
/**
* 查询录音复盘记录详情
* @param query
* @return
*/
public AudioReceptionDTO getAudioReviewDetail(SupervisorTaskQueryDTO query) {
List<AudioReceptionDTO> audioReceptionDTOS = supervisorAudioReviewInfoMapper.listAudionByReceptionId(query);
if (CollectionUtils.isNotEmpty(audioReceptionDTOS)) {
return audioReceptionDTOS.get(0);
}
return null;
}
public List<AudioReceptionDTO> listAudionByEmployeeInfo(SupervisorTaskQueryDTO query) {
return supervisorAudioReviewInfoMapper.listAudionByEmployeeInfo(query);
}
......@@ -89,6 +105,12 @@ public class SupervisorAudioReviewInfoService {
dto.setUnreviewedCount((int) unreviewedCount);
dto.setTotalCount(list.size());
}
//查询 录音任务详情
SupervisorTaskDTO task = supervisorTaskInfoService.getTaskDetailById(request.getId());
if (task != null) {
dto.setTaskStatus(task.getTaskStatus());
dto.setCreateTime(task.getCreateTime());
}
return dto;
}
......@@ -107,7 +129,7 @@ public class SupervisorAudioReviewInfoService {
throw new RpcServiceException(DefaultErrorEnum.DATA_NOT_EXIST, "录音复盘记录不存在");
}
//判断是否已复盘
if (ReviewStatusEnum.COMPLETED.getCode().equals(info.getReviewStatus())) {
if (ReviewStatusEnum.COMPLETED.getCode().equals(info.getReviewStatus()) && StringUtils.isBlank(request.getReviewTarget())) {
log.error("提交录音复盘记录,录音复盘记录已复盘,id={}", request.getId());
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR, "录音复盘记录已复盘,不能重复提交");
}
......
......@@ -9,6 +9,7 @@ import cn.com.glsx.dj.supervisor.dto.*;
import cn.com.glsx.dj.supervisor.enums.ReviewStatusEnum;
import cn.com.glsx.dj.supervisor.enums.TaskStatusEnum;
import cn.com.glsx.dj.supervisor.enums.TaskTypeEnum;
import cn.com.glsx.dj.supervisor.mapper.BusinessSceneMapper;
import cn.com.glsx.dj.supervisor.mapper.SupervisorTaskCourseMapper;
import cn.com.glsx.dj.supervisor.mapper.SupervisorTaskImageMapper;
import cn.com.glsx.dj.supervisor.mapper.SupervisorTaskInfoMapper;
......@@ -18,16 +19,20 @@ 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 cn.com.glsx.framework.core.util.DateUtils;
import cn.com.glsx.framework.core.util.RpcAssert;
import cn.com.glsx.merchants.dto.beisen.BeiSenEmployeeListResonseDTO;
import cn.com.glsx.merchants.dto.beisen.BeisenEmployeeInfoDTO;
import cn.com.glsx.merchants.model.request.MerchantStaffRequest;
import cn.com.glsx.merchants.model.response.MerchantStaffResponse;
import cn.com.glsx.merchants.remote.MerchantStaffRemote;
import cn.com.glsx.merchants.remote.MerchantUserRemote;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.dubbo.config.annotation.DubboReference;
import org.oreframework.distribute.lock.annotation.GlsxDistributeLockable;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -79,6 +84,12 @@ public class SupervisorTaskInfoService {
@Autowired
private SupervisorLearningCenterService supervisorLearningCenterService;
@DubboReference(version = "2.0.0", check = false, timeout = 5000)
private MerchantUserRemote merchantUserRemote;
@Autowired
private BusinessSceneMapper businessSceneMapper;
/**
* 生成日报信息
* @param startTimeStr 日报的开始时间,yyyy-MM-dd
......@@ -190,6 +201,33 @@ public class SupervisorTaskInfoService {
return onlineCount;
}
public List<MerchantStaffResponse> listAllEffectiveSupervisors() {
//查询督导人员列表
List<MerchantStaffResponse> merchantStaffResponses = listAllSupervisors();
if (CollectionUtils.isNotEmpty(merchantStaffResponses)) {
// 2. 批量查询北森信息,统计在职人数
List<String> phoneList = merchantStaffResponses.stream()
.map(MerchantStaffResponse::getStaffPhone)
.filter(phone -> phone != null && !phone.isEmpty())
.distinct()
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(phoneList)) {
return Collections.emptyList();
}
List<BeiSenEmployeeListResonseDTO> beisenList = supervisorLearningCenterService.listEmployeeInfoByStaffPhone(phoneList);
if (CollectionUtils.isEmpty(beisenList)) {
return Collections.emptyList();
}
// 3. 过滤出在职督导
List<String> beisenPhoneList = beisenList.stream()
.filter(emp -> Integer.valueOf(1).equals(emp.getZzStatus()))
.map(BeiSenEmployeeListResonseDTO::getMobilePhone).collect(Collectors.toList());
merchantStaffResponses = merchantStaffResponses.stream().filter(staff -> beisenPhoneList.contains(staff.getStaffPhone()))
.collect(Collectors.toList());
}
return merchantStaffResponses;
}
/**
* 查询所有飞行督导人员
* @return
......@@ -298,6 +336,25 @@ public class SupervisorTaskInfoService {
if (TaskTypeEnum.TRAINING.getCode().equals(taskInfo.getTaskType())) {
List<SupervisorTaskCourse> taskCourseList = supervisorTaskCourseService.selectByTaskId(id);
taskInfo.setTaskCourseList(taskCourseList);
//根据员工手机号,查询北森员工信息
String phoneNumber = taskInfo.getStoreManagerPhone();
log.info("调用北森接口获取人员基本信息,手机号:{}", phoneNumber);
List<String> phoneNumbers = new ArrayList<>();
phoneNumbers.add(phoneNumber);
RpcResponse<List<BeisenEmployeeInfoDTO>> beisenResponse = merchantUserRemote.selectByPhones(phoneNumbers);
if (beisenResponse.isSuccess() && beisenResponse.getResult() != null && !beisenResponse.getResult().isEmpty()) {
BeisenEmployeeInfoDTO beisenInfo = beisenResponse.getResult().get(0);
if (beisenInfo.getEntryDate() != null) {
taskInfo.setEntryDate(
DateUtils.formatDate(beisenInfo.getEntryDate())); // 北森-人员-入职日期
}
// 性别:0男、1女
if (beisenInfo.getGender() != null) {
taskInfo.setGender(beisenInfo.getGender() == 0 ? "男" : "女");
}
}
String businessScene = businessSceneMapper.getBusinessSceneByPhoneNumber(phoneNumber);
taskInfo.setBusiness(businessScene); // 业务场景标签
}
return taskInfo;
}
......
......@@ -4,6 +4,8 @@ import cn.com.glsx.dj.supervisor.dto.WarningBaselineConfigDTO;
import cn.com.glsx.dj.supervisor.mapper.SupervisorWarningBaselineConfigMapper;
import cn.com.glsx.dj.supervisor.model.SupervisorWarningBaselineConfig;
import cn.com.glsx.framework.core.beans.BaseModel;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
......@@ -32,34 +34,58 @@ public class SupervisorWarningBaselineConfigService {
* @return 是否成功
*/
@GlsxDistributeLockable(name = "warningBaselineConfig_createOrUpdateWarningBaselineConfig", timeoutException = Exception.class)
public Boolean createOrUpdateWarningBaselineConfig(WarningBaselineConfigDTO config) {
//根据 指标+ 时间维度查询数据库是否已经配置过相同记录
List<SupervisorWarningBaselineConfig> configList = queryWarningBaselineConfig(config.getIndicatorCode(), config.getTimeDimension());
Date now = new Date();
if (CollectionUtils.isEmpty(configList)) {
// 新增
config.getConfigList().stream().forEach(item -> {
item.setIndicatorCode(config.getIndicatorCode());
item.setIndicatorName(config.getIndicatorName());
item.setTimeDimension(config.getTimeDimension());
item.setDeletedFlag(BaseModel.DeletedFlagEnum.N.name());
item.setCreatedBy(config.getUpdatedBy());
item.setCreateTime(now);
item.setUpdatedBy(config.getUpdatedBy());
item.setUpdatedDate(now);
});
supervisorWarningBaselineConfigMapper.insertList(config.getConfigList());
} else {
// 更新
config.getConfigList().stream().forEach(item -> {
item.setUpdatedBy(config.getUpdatedBy());
item.setUpdatedDate(now);
});
//批量更新
supervisorWarningBaselineConfigMapper.batchUpdate(config.getConfigList());
}
return true;
}
public Boolean createOrUpdateWarningBaselineConfig(WarningBaselineConfigDTO config) {
//根据 指标+ 时间维度查询数据库是否已经配置过相同记录
List<SupervisorWarningBaselineConfig> configList = queryWarningBaselineConfig(config.getIndicatorCode(), config.getTimeDimension());
Date now = new Date();
//判断是否为新增操作
if (config.getUpdateFlag() == 0) {
if (CollectionUtils.isNotEmpty(configList)) {
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR, "已存在相同预警基线设置!");
}
// 新增
config.getConfigList().stream().forEach(item -> {
item.setIndicatorCode(config.getIndicatorCode());
item.setIndicatorName(config.getIndicatorName());
item.setTimeDimension(config.getTimeDimension());
item.setDeletedFlag(BaseModel.DeletedFlagEnum.N.name());
item.setCreatedBy(config.getUpdatedBy());
item.setCreateTime(now);
item.setUpdatedBy(config.getUpdatedBy());
item.setUpdatedDate(now);
});
supervisorWarningBaselineConfigMapper.insertList(config.getConfigList());
} else {
// 过滤出需要更新的记录
List<Long> updateList = config.getConfigList().stream()
.filter(item -> item.getId() != null).
map(SupervisorWarningBaselineConfig::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(updateList)) {
//没传id, 抛异常
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR, "更新预警基线配置时,必须传递id!");
}
if (CollectionUtils.isNotEmpty(configList)) {
//检查 更新的id是否存在,如果不存在,说明已经存在其他指标配置,不能更新
List<Long> existList = configList.stream()
.filter(item -> updateList.contains(item.getId()))
.map(SupervisorWarningBaselineConfig::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(existList)) {
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR, "已存在相同预警基线设置!");
}
}
// 更新
config.getConfigList().stream().forEach(item -> {
item.setIndicatorCode(config.getIndicatorCode());
item.setIndicatorName(config.getIndicatorName());
item.setTimeDimension(config.getTimeDimension());
item.setUpdatedBy(config.getUpdatedBy());
item.setUpdatedDate(now);
});
//批量更新
supervisorWarningBaselineConfigMapper.batchUpdate(config.getConfigList());
}
return true;
}
/**
* 指标+ 时间维度查询数据库记录
......@@ -111,6 +137,34 @@ public class SupervisorWarningBaselineConfigService {
}).collect(Collectors.toList());
}
/**
* 删除预警基线配置
* @param config 预警基线配置DTO
* @return 是否成功
*/
@GlsxDistributeLockable(name = "warningBaselineConfig_deleteWarningBaselineConfig", timeoutException = Exception.class)
public Boolean deleteWarningBaselineConfig(WarningBaselineConfigDTO config) {
//根据 指标+ 时间维度查询数据库是否已经配置过相同记录
List<SupervisorWarningBaselineConfig> configList = queryWarningBaselineConfig(config.getIndicatorCode(), config.getTimeDimension());
if (CollectionUtils.isEmpty(configList)) {
return false;
}
// 逻辑删除
SupervisorWarningBaselineConfig update = new SupervisorWarningBaselineConfig();
update.setDeletedFlag(BaseModel.DeletedFlagEnum.D.name());
update.setUpdatedBy(config.getUpdatedBy());
update.setUpdatedDate(new Date());
//批量更新
Example example = new Example(SupervisorWarningBaselineConfig.class);
Example.Criteria criteria = example.createCriteria();
//根据 指标编码+时间维度更新
criteria.andEqualTo("indicatorCode", config.getIndicatorCode());
criteria.andEqualTo("timeDimension", config.getTimeDimension());
criteria.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
supervisorWarningBaselineConfigMapper.updateByExampleSelective(update, example);
return true;
}
......
......@@ -25,8 +25,8 @@
create_time, updated_by, updated_date, deleted_flag
</sql>
<select id="listAudionByReceptionId" resultType="cn.com.glsx.dj.supervisor.dto.AudioReceptionDTO">
select sari.id, sari.receptionId as batchId, sari.reviewStatus, sari.review_target reviewTarget, sari.review_context reviewContext,
<select id="listAudionByReceptionId" parameterType="cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO" resultType="cn.com.glsx.dj.supervisor.dto.AudioReceptionDTO">
select sari.id, sari.reception_id as batchId, sari.review_status reviewStatus, sari.review_target reviewTarget, sari.review_context reviewContext,
t2.audio_time as staticDate,t1.employee_name employeeName,re.customer_name customerName,re.phone_number as phoneNumber,
re.merchant_id merchantNo,re.car_model carModel, re.car_brand as carBrand,
ind.customer_type as customerType,ind.avg_defence as avgDefence,
......@@ -41,14 +41,19 @@
left join dj_car_life_service_merchant sm on re.merchant_id = sm.merchant_id and sm.deleted_flag= 'N'
<where>
sari.deleted_flag = 'N' and cb.deleted_flag = 'N'
and sari.relation_id = #{relationId}
<if test="id != null">
and sari.relation_id = #{id}
</if>
<if test="audioId != null">
and sari.id = #{audioId}
</if>
</where>
order by cb.start_time desc
</select>
<select id="listAudionByEmployeeInfo" parameterType="cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO" resultType="cn.com.glsx.dj.supervisor.dto.AudioReceptionDTO">
select cb.id as batchId , t1.phone_number as staffPhone
from join inspection_conversation_batch cb
from inspection_conversation_batch cb
left join reception_customer_info re on cb.task_id = re.id
left join inspection_conversation_date t2 on cb.conversation_id = t2.id
left join inspection_employee_badge t1 on t1.badge_id = t2.badge_id
......
......@@ -46,6 +46,8 @@
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" />
<result column="updated_phone" property="updatedPhone" />
<result column="store_manager_phone" property="storeManagerPhone" jdbcType="VARCHAR" />
<result column="store_manager_name" property="storeManagerName" jdbcType="VARCHAR" />
<collection property="taskImageList" ofType="cn.com.glsx.dj.supervisor.model.SupervisorTaskImage">
<result column="image_url" property="imageUrl" />
</collection>
......@@ -68,7 +70,7 @@
<select id="getTaskDetailById" resultMap="TaskDetailMap">
select sti.id, sti.task_type, sti.task_status, sti.on_duty_flag, sti.merchant_id, sti.merchant_name, sti.task_desc,sti.task_context,sti.create_time,sti.updated_date,
stim.image_url
stim.image_url,sti.store_manager_name,sti.store_manager_phone
from supervisor_task_info sti
left join supervisor_task_image stim on stim.relation_id = sti.id and stim.deleted_flag = 'N'
<where>
......@@ -92,10 +94,10 @@
</foreach>
</if>
<if test="startDate != null and startDate != ''">
and sti.start_date &gt;= #{startDate}
and CAST(sti.create_time AS DATE) &gt;= #{startDate, jdbcType=DATE}
</if>
<if test="endDate != null and endDate != ''">
and sti.end_date &lt;= #{endDate}
and CAST(sti.create_time AS DATE) &lt;= #{endDate, jdbcType=DATE}
</if>
<if test="taskStatus != null">
and sti.task_status = #{taskStatus}
......
......@@ -29,6 +29,21 @@
<update id="batchUpdate">
UPDATE supervisor_warning_baseline_config
SET
indicator_code = CASE
<foreach collection="list" item="item" separator="">
WHEN id = #{item.id} THEN #{item.indicatorCode}
</foreach>
END,
indicator_name = CASE
<foreach collection="list" item="item" separator="">
WHEN id = #{item.id} THEN #{item.indicatorName}
</foreach>
END,
time_dimension = CASE
<foreach collection="list" item="item" separator="">
WHEN id = #{item.id} THEN #{item.timeDimension}
</foreach>
END,
min_value = CASE
<foreach collection="list" item="item" separator="">
WHEN id = #{item.id} THEN #{item.minValue}
......
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.dto.AudioReceptionDTO;
import cn.com.glsx.dj.supervisor.dto.AudioSummaryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO;
import cn.com.glsx.dj.supervisor.model.SupervisorAudioReviewInfo;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import com.github.pagehelper.Page;
import org.apache.commons.collections4.CollectionUtils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import static org.junit.Assert.assertTrue;
public class SupervisorAudioReviewInfoServiceTest extends BaseServiceTest {
@Autowired
private SupervisorAudioReviewInfoService supervisorAudioReviewInfoService;
/**
* 测试提交录音复盘记录
*/
@Test
public void testSubmitAudioReview() {
SupervisorAudioReviewInfo request = new SupervisorAudioReviewInfo();
request.setId(1L);
request.setReviewContext("测试录音");
request.setReviewTarget("标签仔");
request.setUpdatedBy("fanfr");
Boolean result = supervisorAudioReviewInfoService.submitAudioReview(request);
assertTrue(result);
}
/**
* 测试 分页查询录音复盘记录
*/
@Test
public void testQueryAudioReviewInfoPage() {
RpcPagination<SupervisorTaskQueryDTO> request = new RpcPagination<>();
request.setPageNum(1);
request.setPageSize(10);
SupervisorTaskQueryDTO condition = new SupervisorTaskQueryDTO();
request.setCondition(condition);
condition.setId(16L);
Page<AudioReceptionDTO> result = supervisorAudioReviewInfoService.pageAudioReception(request);
assertTrue(CollectionUtils.isNotEmpty(result));
}
/**
* 测试 查询录音复盘汇总信息(getAudioSummary)
*/
@Test
public void testQueryAudioReviewSummary() {
Long id = 16L;
SupervisorTaskQueryDTO request = new SupervisorTaskQueryDTO();
request.setId(id);
AudioSummaryDTO result = supervisorAudioReviewInfoService.getAudioSummary(request);
assertTrue(result != null);
}
}
......@@ -166,6 +166,8 @@ public class SupervisorTaskInfoServiceTest extends BaseServiceTest {
request.setCondition(queryDTO);
List<Integer> typeList = Arrays.asList(0, 3, 5);
queryDTO.setTaskTypeList(typeList);
queryDTO.setStartDate("2026-01-01");
queryDTO.setEndDate("2026-01-31");
request.setPageSize(10);
request.setPageNum(1);
Page<SupervisorTaskDTO> supervisorTaskDTOS = supervisorTaskInfoService.pageTask(request);
......
......@@ -22,30 +22,31 @@ public class SupervisorWarningBaselineConfigServiceTest extends BaseServiceTest
@Test
public void testCreateOrUpdateWarningBaselineConfig() {
WarningBaselineConfigDTO config = new WarningBaselineConfigDTO();
config.setIndicatorCode("A036");
config.setIndicatorName("个人产值");
config.setIndicatorCode("A076");
config.setIndicatorName("个人客单价");
config.setTimeDimension(2);
config.setUpdateFlag(1);
List<SupervisorWarningBaselineConfig> configList = new java.util.ArrayList<>();
SupervisorWarningBaselineConfig redItem = new SupervisorWarningBaselineConfig();
redItem.setMinValue(new BigDecimal(0));
redItem.setMaxValue(new BigDecimal(1200));
redItem.setMaxValueInf(0);
redItem.setWarningLevel(0);
redItem.setId(4L);
redItem.setId(10L);
configList.add(redItem);
SupervisorWarningBaselineConfig yellowItem = new SupervisorWarningBaselineConfig();
yellowItem.setMinValue(new BigDecimal(1200));
yellowItem.setMaxValue(new BigDecimal(4000));
yellowItem.setMaxValueInf(0);
yellowItem.setWarningLevel(1);
yellowItem.setId(5L);
yellowItem.setId(11L);
configList.add(yellowItem);
SupervisorWarningBaselineConfig greenItem = new SupervisorWarningBaselineConfig();
greenItem.setMinValue(new BigDecimal(4000));
greenItem.setMaxValue(new BigDecimal(6000));
greenItem.setMaxValueInf(0);
greenItem.setWarningLevel(2);
greenItem.setId(6L);
greenItem.setId(12L);
configList.add(greenItem);
config.setConfigList(configList);
config.setUpdatedBy("system");
......@@ -61,4 +62,19 @@ public class SupervisorWarningBaselineConfigServiceTest extends BaseServiceTest
List<WarningBaselineConfigDTO> configList = supervisorWarningBaselineConfigService.listAllWarningBaselineConfig();
assertTrue(configList.size() > 0);
}
/**
* 测试删除
*/
@Test
public void testDeleteWarningBaselineConfig() {
WarningBaselineConfigDTO config = new WarningBaselineConfigDTO();
config.setIndicatorCode("A036");
config.setTimeDimension(2);
config.setUpdatedBy("system");
Boolean result = supervisorWarningBaselineConfigService.deleteWarningBaselineConfig(config);
assertTrue(result);
List<WarningBaselineConfigDTO> configList = supervisorWarningBaselineConfigService.listAllWarningBaselineConfig();
assertTrue(configList.size() > 0);
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!