Commit 5b11ae02 by 范富荣

添加督导日报列表查询/详情查询接口

1 parent 82c642ac
Showing 18 changed files with 689 additions and 3 deletions
/rpc-dj-supervisor/target/
/rpc-dj-supervisor-api/target/
...@@ -46,6 +46,12 @@ public class SupervisorTaskDTO implements Serializable { ...@@ -46,6 +46,12 @@ public class SupervisorTaskDTO implements Serializable {
private String merchantName; private String merchantName;
/** /**
* 驻店员工姓名
*/
@ApiModelProperty(notes = "驻店员工姓名")
private String storeManagerName;
/**
* 督导记录(富文本内容) * 督导记录(富文本内容)
*/ */
@NotEmpty(message = "督导记录不能为空") @NotEmpty(message = "督导记录不能为空")
...@@ -53,6 +59,18 @@ public class SupervisorTaskDTO implements Serializable { ...@@ -53,6 +59,18 @@ public class SupervisorTaskDTO implements Serializable {
private String taskContext; private String taskContext;
/** /**
* 录音总数量
*/
@ApiModelProperty(notes = "录音总数量")
private Integer audioReviewTotalCount;
/**
* 录音已完成数量
*/
@ApiModelProperty(notes = "录音已完成数量")
private Integer audioReviewCompletedCount;
/**
* 更新时间 * 更新时间
*/ */
@ApiModelProperty(notes = "更新时间") @ApiModelProperty(notes = "更新时间")
......
package cn.com.glsx.dj.supervisor.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.List;
@Data
@ToString
public class SupervisorTaskQueryDTO implements Serializable {
@ApiModelProperty(notes = "督导任务ID")
private Long id;
@ApiModelProperty(notes = "督导手机号")
private String supervisorPhone;
@ApiModelProperty(notes = "督导任务类型列表, 0-日报 1-周报,2-月报, 3-录音,4-专项,5-带教")
private List<Integer> taskTypeList;
@ApiModelProperty(notes = "开始时间,格式yyyy-MM-dd")
private String startDate;
@ApiModelProperty(notes = "结束时间,格式yyyy-MM-dd")
private String endDate;
@ApiModelProperty(notes = "任务状态 0-待完成 1-进行中,2-已完成")
private Integer taskStatus;
}
package cn.com.glsx.dj.supervisor.dto;
import cn.com.glsx.dj.supervisor.model.SupervisorWarningBaselineConfig;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
@Data
@ToString
public class WarningBaselineConfigDTO implements Serializable {
@NotBlank(message = "指标编码不能为空")
@ApiModelProperty(notes = "指标编码, 个人产值:A036", required = true)
private String indicatorCode;
@NotBlank(message = "指标名称不能为空")
@ApiModelProperty(notes = "指标名称, 个人产值:个人产值", required = true)
private String indicatorName;
@NotNull(message = "时间维度不能为空")
@ApiModelProperty(notes = "时间维度:(1.按天,2.按周,3.按月,5.按年)", required = true)
private Integer timeDimension;
@NotEmpty(message = "预警基线配置列表不能为空")
@ApiModelProperty(notes = "预警基线配置列表", required = true)
private List<SupervisorWarningBaselineConfig> configList;
private String updatedBy;
}
package cn.com.glsx.dj.supervisor.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
@Data
@Table(name = "supervisor_warning_baseline_config")
public class SupervisorWarningBaselineConfig implements Serializable {
/**
* 主键ID
*/
@ApiModelProperty(notes = "主键ID")
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 指标编码
*/
@Column(name = "indicator_code")
private String indicatorCode;
/**
* 指标名称
*/
@Column(name = "indicator_name")
private String indicatorName;
/**
* 时间维度:(1.按天,2.按周,3.按月,5.按年)
*/
@Column(name = "time_dimension")
private Integer timeDimension;
/**
* 区间最小值,+∞用NULL表示
*/
@ApiModelProperty(notes = "区间最小值", required = true)
@Column(name = "min_value")
private BigDecimal minValue;
/**
* 区间最大值,+∞用NULL表示
*/
@ApiModelProperty(notes = "区间最大值, +∞用NULL表示")
@Column(name = "max_value")
private BigDecimal maxValue;
/**
* 预警等级:0-红,1-黄,2-绿
*/
@ApiModelProperty(notes = "预警等级:0-红,1-黄,2-绿", required = true)
@Column(name = "warning_level")
private Integer warningLevel;
/**
* 创建人名称
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* 更新人名称
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "updated_date")
private Date updatedDate;
/**
* 删除标识 0-正常 1-已删除
*/
@Column(name = "deleted_flag")
private String deletedFlag;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.model; package cn.com.glsx.dj.supervisor.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.ToString; import lombok.ToString;
...@@ -27,12 +28,14 @@ public class SupervisorWeekTaskStaff implements Serializable { ...@@ -27,12 +28,14 @@ public class SupervisorWeekTaskStaff implements Serializable {
/** /**
* 员工手机号 * 员工手机号
*/ */
@ApiModelProperty(notes = "员工手机号")
@Column(name = "staff_phone") @Column(name = "staff_phone")
private String staffPhone; private String staffPhone;
/** /**
* 员工姓名 * 员工姓名
*/ */
@ApiModelProperty(notes = "员工姓名")
@Column(name = "staff_name") @Column(name = "staff_name")
private String staffName; private String staffName;
......
...@@ -2,7 +2,9 @@ package cn.com.glsx.dj.supervisor.remote; ...@@ -2,7 +2,9 @@ package cn.com.glsx.dj.supervisor.remote;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO; import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO;
import cn.com.glsx.framework.core.annotation.*; import cn.com.glsx.framework.core.annotation.*;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
@ApiService(value = "督导任务", owner = "fanfr") @ApiService(value = "督导任务", owner = "fanfr")
...@@ -25,4 +27,15 @@ public interface SupervisorTaskInfoRemote { ...@@ -25,4 +27,15 @@ public interface SupervisorTaskInfoRemote {
@ApiParams({@ApiParam(name = "request", notes = "月报信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)}) @ApiParams({@ApiParam(name = "request", notes = "月报信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)})
@ApiResponse("提交结果") @ApiResponse("提交结果")
RpcResponse<Boolean> submitMonthTask(SupervisorTaskDTO request); RpcResponse<Boolean> submitMonthTask(SupervisorTaskDTO request);
@ApiMethod("根据ID查询督导任务详情")
@ApiParams({@ApiParam(name = "id", notes = "任务ID", dataType = ApiParam.DataTypeEnum.LONG, required = true)})
@ApiResponse("提交结果")
RpcResponse<SupervisorTaskDTO> getTaskDetailById(Long id);
@ApiMethod("查询督导任务分页列表")
@ApiParams({@ApiParam(name = "request", notes = "查询参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)})
@ApiResponse("提交结果")
RpcResponse<RpcPagination<SupervisorTaskDTO>> pageTask(RpcPagination<SupervisorTaskQueryDTO> request);
} }
package cn.com.glsx.dj.supervisor.remote;
import cn.com.glsx.dj.supervisor.dto.WarningBaselineConfigDTO;
import cn.com.glsx.framework.core.annotation.*;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import java.util.List;
@ApiService(value = "督导预警基线管理", owner = "fanfr")
public interface SupervisorWarningBaselineConfigRemote {
@ApiMethod("创建或修改预警基线配置")
@ApiParams({@ApiParam(name = "request", notes = "预警基线配置信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)})
@ApiResponse("提交结果")
RpcResponse<Boolean> createOrUpdateWarningBaselineConfig(WarningBaselineConfigDTO request);
/**
* 查询所有预警基线配置
*/
@ApiMethod("查询所有预警基线配置")
@ApiResponse("预警基线配置列表")
RpcResponse<List<WarningBaselineConfigDTO>> listAllWarningBaselineConfigs();
}
package cn.com.glsx.dj.supervisor.mapper; package cn.com.glsx.dj.supervisor.mapper;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO;
import cn.com.glsx.dj.supervisor.model.SupervisorTaskInfo; import cn.com.glsx.dj.supervisor.model.SupervisorTaskInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper; import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper @Mapper
public interface SupervisorTaskInfoMapper extends OreMapper<SupervisorTaskInfo> { public interface SupervisorTaskInfoMapper extends OreMapper<SupervisorTaskInfo> {
/**
* 根据ID查询督导任务详情
*
* @param id
* @return
*/
SupervisorTaskDTO getTaskDetailById(@Param("id") Long id);
List<SupervisorTaskDTO> listTask(SupervisorTaskQueryDTO request);
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.mapper;
import cn.com.glsx.dj.supervisor.model.SupervisorWarningBaselineConfig;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper
public interface SupervisorWarningBaselineConfigMapper extends OreMapper<SupervisorWarningBaselineConfig> {
int batchUpdate(@Param("list") List<SupervisorWarningBaselineConfig> configList);
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.supervisor.remote; package cn.com.glsx.dj.supervisor.remote;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO; import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO;
import cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService; import cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum; import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.github.pagehelper.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService; import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -56,4 +59,32 @@ public class SupervisorTaskInfoRemoteImpl implements SupervisorTaskInfoRemote { ...@@ -56,4 +59,32 @@ public class SupervisorTaskInfoRemoteImpl implements SupervisorTaskInfoRemote {
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage()); return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
} }
} }
@Override
public RpcResponse<SupervisorTaskDTO> getTaskDetailById(Long id) {
try {
SupervisorTaskDTO result = supervisorTaskInfoService.getTaskDetailById(id);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.getTaskDetailById error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.getTaskDetailById system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
@Override
public RpcResponse<RpcPagination<SupervisorTaskDTO>> pageTask(RpcPagination<SupervisorTaskQueryDTO> request) {
try {
Page result = supervisorTaskInfoService.pageTask(request);
return RpcResponse.success(RpcPagination.copyPage(result));
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.pageTask error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.pageTask system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVER_ERROR, e.getMessage());
}
}
} }
package cn.com.glsx.dj.supervisor.remote;
import cn.com.glsx.dj.supervisor.dto.WarningBaselineConfigDTO;
import cn.com.glsx.dj.supervisor.service.SupervisorWarningBaselineConfigService;
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 lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Slf4j
@DubboService(retries = 0, timeout = 30000, validation = "true")
public class SupervisorWarningBaselineConfigRemoteImpl implements SupervisorWarningBaselineConfigRemote {
@Autowired
private SupervisorWarningBaselineConfigService supervisorWarningBaselineConfigService;
@Override
public RpcResponse<Boolean> createOrUpdateWarningBaselineConfig(WarningBaselineConfigDTO request) {
try {
Boolean result = supervisorWarningBaselineConfigService.createOrUpdateWarningBaselineConfig(request);
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorWarningBaselineConfigRemoteImpl.createOrUpdateWarningBaselineConfig error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorWarningBaselineConfigRemoteImpl.createOrUpdateWarningBaselineConfig system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
@Override
public RpcResponse<List<WarningBaselineConfigDTO>> listAllWarningBaselineConfigs() {
try {
List<WarningBaselineConfigDTO> result = supervisorWarningBaselineConfigService.listAllWarningBaselineConfig();
return RpcResponse.success(result);
} catch (RpcServiceException e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorWarningBaselineConfigRemoteImpl.listAllWarningBaselineConfigs error {}", e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error("cn.com.glsx.dj.supervisor.remote.SupervisorWarningBaselineConfigRemoteImpl.listAllWarningBaselineConfigs system error {}", e);
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
}
package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.mapper.SupervisorAudioReviewInfoMapper;
import cn.com.glsx.dj.supervisor.model.SupervisorAudioReviewInfo;
import cn.com.glsx.framework.core.beans.BaseModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
@Service
@Slf4j
public class SupervisorAudioReviewInfoService {
@Autowired
private SupervisorAudioReviewInfoMapper supervisorAudioReviewInfoMapper;
/**
* 根据任务id列表,查询录音信息
*/
public List<SupervisorAudioReviewInfo> listByTaskIds(List<Long> taskIds) {
Example example = new Example(SupervisorAudioReviewInfo.class);
example.createCriteria().andIn("relationId", taskIds)
.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
return supervisorAudioReviewInfoMapper.selectByExample(example);
}
}
package cn.com.glsx.dj.supervisor.service; package cn.com.glsx.dj.supervisor.service;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO; 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; import cn.com.glsx.dj.supervisor.enums.TaskStatusEnum;
import cn.com.glsx.dj.supervisor.enums.TaskTypeEnum; import cn.com.glsx.dj.supervisor.enums.TaskTypeEnum;
import cn.com.glsx.dj.supervisor.mapper.SupervisorTaskInfoMapper; import cn.com.glsx.dj.supervisor.mapper.SupervisorTaskInfoMapper;
import cn.com.glsx.dj.supervisor.model.SupervisorAudioReviewInfo;
import cn.com.glsx.dj.supervisor.model.SupervisorTaskInfo; import cn.com.glsx.dj.supervisor.model.SupervisorTaskInfo;
import cn.com.glsx.dj.supervisor.model.SupervisorWeekTaskStaff;
import cn.com.glsx.framework.core.beans.BaseModel; import cn.com.glsx.framework.core.beans.BaseModel;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum; import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert;
import cn.com.glsx.merchants.model.request.MerchantStaffRequest; import cn.com.glsx.merchants.model.request.MerchantStaffRequest;
import cn.com.glsx.merchants.model.response.MerchantStaffResponse; import cn.com.glsx.merchants.model.response.MerchantStaffResponse;
import cn.com.glsx.merchants.remote.MerchantStaffRemote; import cn.com.glsx.merchants.remote.MerchantStaffRemote;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.oreframework.distribute.lock.annotation.GlsxDistributeLockable; import org.oreframework.distribute.lock.annotation.GlsxDistributeLockable;
...@@ -24,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -24,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -45,6 +54,9 @@ public class SupervisorTaskInfoService { ...@@ -45,6 +54,9 @@ public class SupervisorTaskInfoService {
@Autowired @Autowired
private SupervisorWeekTaskStaffService supervisorWeekTaskStaffService; private SupervisorWeekTaskStaffService supervisorWeekTaskStaffService;
@Autowired
private SupervisorAudioReviewInfoService supervisorAudioReviewInfoService;
...@@ -184,6 +196,64 @@ public class SupervisorTaskInfoService { ...@@ -184,6 +196,64 @@ public class SupervisorTaskInfoService {
return doSubmitTask(request); return doSubmitTask(request);
} }
/**
* 根据ID查询督导任务详情
* @param id
* @return
*/
public SupervisorTaskDTO getTaskDetailById(Long id) {
RpcAssert.assertNotNull(id, DefaultErrorEnum.PARAMETER_NULL, "任务ID不能为空");
//根据id查询任务信息
SupervisorTaskDTO taskInfo = supervisorTaskInfoMapper.getTaskDetailById(id);
if (taskInfo == null) {
log.error("根据id查询任务信息不存在,id={}", id);
throw new RpcServiceException(DefaultErrorEnum.DATA_NOT_EXIST, "根据id查询任务信息不存在");
}
if (TaskTypeEnum.WEEKLY_REPORT.getCode().equals(taskInfo.getTaskType())) {
//查询周任务员工列表
List<SupervisorWeekTaskStaff> weekTaskStaffList = supervisorWeekTaskStaffService.selectByRelationId(id);
taskInfo.setWeekTaskStaffList(weekTaskStaffList);
}
//TODO: 处理带教类型
return taskInfo;
}
/**
* 查询督导任务分页列表
* @param request
* @return
*/
public Page<SupervisorTaskDTO> pageTask(RpcPagination<SupervisorTaskQueryDTO> request) {
Page<SupervisorTaskDTO> page = PageHelper.startPage(request.getPageNum(), request.getPageSize());
//查询任务列表
List<SupervisorTaskDTO> taskList = supervisorTaskInfoMapper.listTask(request.getCondition());
if (CollectionUtils.isNotEmpty(taskList)) {
//录音复盘 需要计算录音进度
List<Long> idList = taskList.stream().filter(x -> TaskTypeEnum.AUDIO_RECORDING.getCode().equals(x.getTaskType()))
.map(SupervisorTaskDTO::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(idList)) {
List<SupervisorAudioReviewInfo> audioReviewInfoList = supervisorAudioReviewInfoService.listByTaskIds(idList);
if (CollectionUtils.isNotEmpty(audioReviewInfoList)) {
//遍历任务列表, 计算录音进度,需要根据relationId 进行统计, 总复盘录音数 和已复盘录音数
Map<Long, List<SupervisorAudioReviewInfo>> audioReviewInfoMap = audioReviewInfoList.stream()
.collect(Collectors.groupingBy(SupervisorAudioReviewInfo::getRelationId));
for (SupervisorTaskDTO task : taskList) {
List<SupervisorAudioReviewInfo> reviewList = audioReviewInfoMap.get(task.getId());
if (CollectionUtils.isNotEmpty(reviewList)) {
//录音总数
task.setAudioReviewTotalCount(reviewList.size());
//已复盘录音数
Integer completedCount = reviewList.stream().filter(x -> ReviewStatusEnum.COMPLETED.getCode().equals(x.getReviewStatus()))
.collect(Collectors.toList()).size();
task.setAudioReviewCompletedCount(completedCount);
}
}
}
}
}
return page;
}
......
package cn.com.glsx.dj.supervisor.service;
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 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;
import tk.mybatis.mapper.entity.Example;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@Slf4j
public class SupervisorWarningBaselineConfigService {
@Autowired
private SupervisorWarningBaselineConfigMapper supervisorWarningBaselineConfigMapper;
/**
* 创建或修改预警基线配置
* @param config 预警基线配置DTO
* @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.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;
}
/**
* 指标+ 时间维度查询数据库记录
* @param indicatorCode 指标编码
* @param timeDimension 时间维度
* @return 预警基线配置列表
*/
public List<SupervisorWarningBaselineConfig> queryWarningBaselineConfig(String indicatorCode, Integer timeDimension) {
Example example = new Example(SupervisorWarningBaselineConfig.class);
Example.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(indicatorCode)) {
criteria.andEqualTo("indicatorCode", indicatorCode);
}
if (timeDimension != null) {
criteria.andEqualTo("timeDimension", timeDimension);
}
criteria.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
//根据更新时间降序
example.setOrderByClause("updatedDate desc");
return supervisorWarningBaselineConfigMapper.selectByExample(example);
}
/**
* 查询所有预警基线配置
* @return
*/
public List<WarningBaselineConfigDTO> listAllWarningBaselineConfig() {
//查询所有预警基线配置
List<SupervisorWarningBaselineConfig> configList = queryWarningBaselineConfig(null, null);
if (CollectionUtils.isEmpty(configList)) {
return null;
}
//1.根据指标+ 时间维度 分组, 并且保持原有顺序, 转为LinkedHashMap
Map<String, List<SupervisorWarningBaselineConfig>> configMap = configList.stream()
.collect(Collectors.groupingBy(
config -> config.getIndicatorCode() + "_" + config.getTimeDimension(),
LinkedHashMap::new,
Collectors.toList()
));
//2.遍历map,转为list
return configMap.entrySet().stream().map(entry -> {
WarningBaselineConfigDTO dto = new WarningBaselineConfigDTO();
SupervisorWarningBaselineConfig first = entry.getValue().get(0);
dto.setIndicatorCode(first.getIndicatorCode());
dto.setTimeDimension(first.getTimeDimension());
dto.setIndicatorName(first.getIndicatorName());
dto.setConfigList(entry.getValue());
return dto;
}).collect(Collectors.toList());
}
}
...@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -38,4 +39,15 @@ public class SupervisorWeekTaskStaffService { ...@@ -38,4 +39,15 @@ public class SupervisorWeekTaskStaffService {
} }
return 0; return 0;
} }
/**
* 根据任务ID查询周任务员工列表
* @param relationId
* @return
*/
public List<SupervisorWeekTaskStaff> selectByRelationId(Long relationId) {
Example example = new Example(SupervisorWeekTaskStaff.class);
example.createCriteria().andEqualTo("relationId", relationId).andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
return supervisorWeekTaskStaffMapper.selectByExample(example);
}
} }
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
--> -->
<id column="id" property="id" jdbcType="BIGINT" /> <id column="id" property="id" jdbcType="BIGINT" />
<result column="task_type" property="taskType" jdbcType="BIT" /> <result column="task_type" property="taskType" jdbcType="BIT" />
<result column="task_status" property="taskStatus" jdbcType="BIT" /> <result column="task_status" property="taskStatus" />
<result column="on_duty_flag" property="onDutyFlag" jdbcType="BIT" /> <result column="on_duty_flag" property="onDutyFlag" />
<result column="merchant_id" property="merchantId" jdbcType="BIGINT" /> <result column="merchant_id" property="merchantId" />
<result column="merchant_name" property="merchantName" jdbcType="VARCHAR" /> <result column="merchant_name" property="merchantName" jdbcType="VARCHAR" />
<result column="start_date" property="startDate" jdbcType="VARCHAR" /> <result column="start_date" property="startDate" jdbcType="VARCHAR" />
<result column="end_date" property="endDate" jdbcType="VARCHAR" /> <result column="end_date" property="endDate" jdbcType="VARCHAR" />
...@@ -31,6 +31,22 @@ ...@@ -31,6 +31,22 @@
--> -->
<result column="task_context" property="taskContext" jdbcType="LONGVARCHAR" /> <result column="task_context" property="taskContext" jdbcType="LONGVARCHAR" />
</resultMap> </resultMap>
<resultMap id="TaskDetailMap" type="cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO">
<id column="id" property="id"/>
<result column="task_type" property="taskType" />
<result column="task_status" property="taskStatus" />
<result column="on_duty_flag" property="onDutyFlag" />
<result column="merchant_id" property="merchantId" />
<result column="merchant_name" property="merchantName"/>
<result column="task_context" property="taskContext" />
<result column="store_manager_name" property="storeManagerName"/>
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<collection property="taskImageList" ofType="cn.com.glsx.dj.supervisor.model.SupervisorTaskImage">
<result column="image_url" property="imageUrl" />
</collection>
</resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
...@@ -45,4 +61,43 @@ ...@@ -45,4 +61,43 @@
--> -->
task_context task_context
</sql> </sql>
<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_context,sti.updated_date,
sti.image_url
from supervisor_task_info sti
left join supervisor_task_image sti on sti.relation_id = sti.id and sti.deleted_flag = 'N'
<where>
sti.deleted_flag = 'N' and sti.id = #{id}
</where>
</select>
<select id="listTask" parameterType="cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO" resultMap="TaskDetailMap">
select sti.id, sti.task_type, sti.task_status,sti.updated_date,
sti.store_manager_name
from supervisor_task_info sti
<where>
sti.deleted_flag = 'N'
<if test="supervisorPhone != null and supervisorPhone != ''">
and sti.supervisor_phone = #{supervisorPhone}
</if>
<if test="taskTypeList != null and taskTypeList.size() > 0">
and sti.task_type in
<foreach collection="taskTypeList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="startDate != null and startDate != ''">
and sti.start_date &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and sti.end_date &lt;= #{endDate}
</if>
<if test="taskStatus != null">
and sti.task_status = #{taskStatus}
</if>
</where>
order by sti.task_status asc, sti.create_time desc
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.supervisor.mapper.SupervisorWarningBaselineConfigMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.supervisor.model.SupervisorWarningBaselineConfig" >
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="BIGINT" />
<result column="indicator_code" property="indicatorCode" jdbcType="VARCHAR" />
<result column="indicator_name" property="indicatorName" jdbcType="VARCHAR" />
<result column="time_dimension" property="timeDimension" jdbcType="INTEGER" />
<result column="min_value" property="minValue" jdbcType="DECIMAL" />
<result column="max_value" property="maxValue" jdbcType="DECIMAL" />
<result column="warning_level" property="warningLevel" jdbcType="INTEGER" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<sql id="Base_Column_List" >
<!--
WARNING - @mbg.generated
-->
id, indicator_code, indicator_name, time_dimension, min_value, max_value, warning_level,
created_by, create_time, updated_by, updated_date, deleted_flag
</sql>
<update id="batchUpdate">
UPDATE t_warning_baseline_config
SET
min_value = CASE
<foreach collection="list" item="item" separator="">
WHEN id = #{item.id} THEN #{item.minValue}
</foreach>
END,
max_value = CASE
<foreach collection="list" item="item" separator="">
WHEN id = #{item.id} THEN #{item.maxValue}
</foreach>
END,
warning_level = CASE
<foreach collection="list" item="item" separator="">
WHEN id = #{item.id} THEN #{item.warningLevel}
</foreach>
END,
updated_date = CASE
<foreach collection="list" item="item" separator="">
WHEN id = #{item.id} THEN #{item.updatedDate}
</foreach>
END,
updated_by = CASE
<foreach collection="list" item="item" separator="">
WHEN id = #{item.id} THEN #{item.updatedBy}
</foreach>
END
WHERE
id IN
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.id}
</foreach>
AND deleted_flag = 'N'
</update>
</mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!