提交修改

This commit is contained in:
quyixiao 2020-12-11 10:19:20 +08:00
commit 4c480bceaf
24 changed files with 344 additions and 84 deletions

View File

@ -24,6 +24,8 @@ public enum WorkMsgTypeEnum {
SKIP(10, "绩效跳过", "跳过", "# @的绩效\n ## 己经跳过"),
TRANSFER(11, "绩效转交", "转交", "# @的绩效\n ## 己经转交"),
CLEARN(12, "绩效转交", "转交", "# @的绩效\n ## 己经转交"),
TASK_COMMENT(13, "任务评论", "去查看", "# 任务评论\n ## @1评论了你的@2的任务"),
TASK_UPDATE(14, "任务更新", "去更新", "# 任务更新\n ## 记得每天来更新任务哦"),
// 您的2020年10月绩效考核已经开始请尽快制定绩效目标
// 吴林的2020年12月绩效考核的目标需要您确认点击前往确认
;

View File

@ -633,9 +633,6 @@ public class ResultRecordController extends AbstractController {
resultRecordDetailDto.setRecortModelDtos(resultRecortModelDtos);
return R.ok().put("data", resultRecordDetailDto);
}
//目前支持已生成对象的不支持当前非对象表中的数据如果要使用请用常量值
@ -873,10 +870,10 @@ public class ResultRecordController extends AbstractController {
}else{
ResultUpdateTaskReq taskReq = new ResultUpdateTaskReq();
taskReq.setDetailId(resultDetail.getId());
taskReq.setTasklId(taskDto.getId());
taskReq.setTaskId(taskDto.getId());
taskReq.setName(taskDto.getName());
taskReq.setOrderBy(orderBy);
taskReq.setProcessRate(taskDto.getProcessRate());
taskReq.setProcessRate(BigDecimal.valueOf(taskDto.getProcessRate()));
resultTaskService.saveOrUpdateResultTask(taskReq);
orderBy++;
}

View File

@ -29,9 +29,15 @@ import com.lz.modules.flow.service.FlowRecordService;
import com.lz.modules.flow.service.FlowStartService;
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
import com.lz.modules.performance.entity.ResultTask;
import com.lz.modules.performance.entity.TaskComment;
import com.lz.modules.performance.service.ResultTaskService;
import com.lz.modules.performance.service.TaskCommentService;
import com.lz.modules.sys.dao.SysUserTokenDao;
import com.lz.modules.sys.entity.SysUserTokenEntity;
import com.lz.modules.sys.entity.app.ResultDetail;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultDetailService;
import com.lz.modules.sys.service.app.ResultRecordService;
import com.lz.modules.third.entity.ThirdAppConfig;
import com.lz.modules.third.entity.ThirdMsgSendRecord;
@ -101,6 +107,15 @@ public class DingtalkBusiness {
@Autowired
private ThirdMsgSendRecordService thirdMsgSendRecordService;
@Autowired
private ResultDetailService resultDetailService;
@Autowired
private ResultTaskService resultTaskService;
@Autowired
private TaskCommentService taskCommentService;
@Resource
StaffDao staffDao;
@ -645,8 +660,91 @@ public class DingtalkBusiness {
return "error";
}
public String sendTaskNoticeMsg(Long detailId, Long taskId) {
public String sendTaskInputMsg(List<StaffEntity> staffs){
int m = 0;
String userIds = "";
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
String token = dingTalkUtil.getAccessTokenWitchEntity(thirdAppConfig);
if(token != null && token.length() > 0){
String url = homeUrl;
if(url.contains("?")){
url += "&halokit=" + System.currentTimeMillis();
}else{
url += "?halokit=" + System.currentTimeMillis();
}
url = URLEncoder.encode(url);
url = "dingtalk://dingtalkclient/action/openapp?corpid=" + thirdAppConfig.getCorpId() +
"&container_type=work_platform&app_id=0_" +
appid + "&redirect_type=jump&redirect_url=" + url;
for (int i = 0; i < staffs.size(); i++) {
StaffEntity staff = staffs.get(i);
userIds += (staff.getEmployeeId() + ",");
if(m >= 99 || i == staffs.size() - 1){
//发送消息
StaffEntity info = new StaffEntity();
info.setId(0L);
info.setEmployeeId(userIds);
dingTalkUtil.sendSingleActionCardMSG(appid, info, WorkMsgTypeEnum.TASK_UPDATE.getTitle(),
WorkMsgTypeEnum.TASK_UPDATE.getContent(), WorkMsgTypeEnum.TASK_UPDATE.getBtnText(), url, token);
m = 0;
userIds = "";
continue;
}
m++;
}
}
return "OK";
}
public String sendTaskNoticeMsg(Long detailId, Long taskId) {
ResultDetail resultDetail = resultDetailService.selectResultDetailById(detailId);
logger.info("评论通知指标id{} 任务id{}", detailId, taskId);
if(resultDetail != null){
TaskComment taskComment = null;
if(taskId == null){
taskComment = taskCommentService.selectTaskCommentByDetailId(detailId);
}else{
taskComment = taskCommentService.selectTaskCommentByTaskId(taskId);
}
StaffSimpleInfo fromStaffSimpleInfo = staffService.selectStaffSimpleInfo(taskComment.getStaffId());
StaffSimpleInfo toStaffSimpleInfo = staffService.selectStaffSimpleInfo(resultDetail.getStaffId());
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
String token = dingTalkUtil.getAccessTokenWitchEntity(thirdAppConfig);
if(token != null && token.length() > 0){
String url = homeUrl;
if(url.contains("?")){
url += "&halokit=" + System.currentTimeMillis();
}else{
url += "?halokit=" + System.currentTimeMillis();
}
url += ("&detail=1&id=" + resultDetail.getRecordId());
url = URLEncoder.encode(url);
url = "dingtalk://dingtalkclient/action/openapp?corpid=" + thirdAppConfig.getCorpId() +
"&container_type=work_platform&app_id=0_" +
appid + "&redirect_type=jump&redirect_url=" + url;
StaffEntity info = new StaffEntity();
info.setId(toStaffSimpleInfo.getId());
info.setEmployeeId(toStaffSimpleInfo.getEmployeeId());
String content = WorkMsgTypeEnum.TASK_COMMENT.getContent().replace("@1", fromStaffSimpleInfo.getName());
content = content.replace("@2", "" + resultDetail.getTarget() + "");
logger.info("通知内容{},url{}", content, url);
dingTalkUtil.sendSingleActionCardMSG(appid, info, WorkMsgTypeEnum.TASK_COMMENT.getTitle(),
content, WorkMsgTypeEnum.TASK_COMMENT.getBtnText(), url, token);
return "OK";
}else{
return "token无效";
}
}
return "OK";
}
public String sendNoticeMsg(ResultRecord lzResultRecord, List<StaffEntity> staffs) {

View File

@ -0,0 +1,46 @@
package com.lz.modules.job.task;
import com.google.common.collect.Lists;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.performance.enums.ResultFlowProcessEnum;
import com.lz.modules.sys.service.app.ResultRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: djc
* @Desc:
* @Date: 2020/12/10 10:26
*/
@Component("resultTaskNoticJob")
public class ResultTaskNoticJob implements ITask {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
DingtalkBusiness dingtalkBusiness;
@Autowired
private ResultRecordService resultRecordService;
@Autowired
private StaffService staffService;
static final List<Integer> process = Lists.newArrayList(ResultFlowProcessEnum.TARGET.getStatus(), ResultFlowProcessEnum.CONFIRM.getStatus(),
ResultFlowProcessEnum.DO.getStatus(), ResultFlowProcessEnum.WRITE.getStatus());
@Override
public void run(String params) {
List<Long> ids = resultRecordService.selectStaffIdsByFlowProcess(process);
List<StaffEntity> staffEntities = staffService.selectByIds(ids);
String res = dingtalkBusiness.sendTaskInputMsg(staffEntities);
logger.info("绩效任务填写通知响应:" + res);
}
}

View File

@ -2,6 +2,7 @@ package com.lz.modules.performance.controller;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.modules.performance.dto.TaskProcessRecordDto;
import com.lz.modules.performance.entity.TaskProcessRecord;
import com.lz.modules.performance.req.ChangeTaskListReq;
import com.lz.modules.performance.req.ResultUpdateTaskReq;
@ -56,8 +57,8 @@ public class ResultTaskController {
@PostMapping("/result/changeTaskList")
@ApiOperation("任务变更记录")
@ApiResponses({@ApiResponse(code = 200,message = "成功")})
public R changeTaskList(ChangeTaskListReq req){
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = TaskProcessRecordDto.class)})
public R changeTaskList(@RequestBody ChangeTaskListReq req){
PageUtils pageUtils = taskProcessRecordService.selectTaskProcessRecordsByTaskId(req);
return R.ok().put("data",pageUtils);
}

View File

@ -38,4 +38,8 @@ public interface TaskCommentMapper extends BaseMapper<TaskComment> {
int deleteTaskCommensByTaskId(@Param("taskId") Long taskId);
List<TaskComment> selectByCondition(@Param("page") IPage page, @Param("taskModel") TaskModel taskModel);
TaskComment selectTaskCommentByTaskId(Long taskId);
TaskComment selectTaskCommentByDetailId(Long detailId);
}

View File

@ -33,4 +33,9 @@ public interface TaskProcessRecordMapper extends BaseMapper<TaskProcessRecord> {
List<TaskProcessRecordDto> selectTaskProcessRecordsByTaskId(@Param("page") IPage page, @Param("taskId") Long taskId);
int deleteTaskProcessRecordsByTaskId(@Param("taskId") Long taskId);
TaskProcessRecordDto selectTaskProcessRecordLastByTaskId(@Param("taskId") Long taskId);
List<TaskProcessRecordDto> selectTaskProcessRecordsByTaskIds(@Param("page") IPage page, @Param("taskIds") List<Long> taskIds);
}

View File

@ -28,44 +28,14 @@ public class ResultTaskDto {
private String name;
//任务的当前进度
@ApiModelProperty(value = "任务的当前进度", name = "processRate")
private BigDecimal processRate;
/**
* 任务名称
* @return
*/
public String getName() {
return name;
}
/**
* 任务名称
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
* 任务的当前进度
* @return
*/
public BigDecimal getProcessRate() {
return processRate;
}
/**
* 任务的当前进度
* @param processRate
*/
public void setProcessRate(BigDecimal processRate) {
this.processRate = processRate;
}
@Override
public String toString() {
return "ResultTaskDto{" +
"name='" + name + '\'' +
", processRate=" + processRate +
'}';
}
private Double processRate;
//头像
@ApiModelProperty(value = "头像", name = "avatar")
private String avatar;
//姓名
@ApiModelProperty(value = "姓名", name = "staffName")
private String staffName;
//标签
@ApiModelProperty(value = "标签", name = "label")
private String label;
}

View File

@ -6,14 +6,23 @@ package com.lz.modules.performance.enums;
* @Date: 2020/12/9 14:08
*/
public enum ProcessRecordEnum {
NAME(1,"修改名称"),
PROCESS(2,"修改进度"),
ALL(3,"全部修改"),
ADD(4,"增加"),
DELETE(5,"删除"),
NAME(1,"更新了名称"),
PROCESS(2,"更新了进度"),
ALL(3,"更新了名称和进度"),
ADD(4,"增加了任务"),
DELETE(5,"删除了任务"),
;
public static ProcessRecordEnum findByType(int type){
for(ProcessRecordEnum recordEnum:ProcessRecordEnum.values()){
if(type == recordEnum.getType()){
return recordEnum;
}
}
return null;
}
private int type;
private String desc;

View File

@ -15,6 +15,9 @@ import lombok.Data;
@ApiModel("任务变更记录")
public class ChangeTaskListReq extends BasePage {
@ApiModelProperty(value="任务id",name = "taskId")
@ApiModelProperty(value="任务id(二选一)",name = "taskId")
private Long taskId;
@ApiModelProperty(value="详情id二选一",name = "detailId")
private Long detailId;
}

View File

@ -16,8 +16,8 @@ public class ResultUpdateTaskReq {
@ApiModelProperty(value = "绩效详情id如果任务id为空必传", name = "detailId")
private Long detailId;
//任务id
@ApiModelProperty(value = "任务id", name = "tasklId")
private Long tasklId;
@ApiModelProperty(value = "任务id", name = "taskId")
private Long taskId;
//任务名称
@ApiModelProperty(value = "任务名称", name = "name")
private String name;

View File

@ -28,4 +28,5 @@ public class ResultTaskDetailRes {
//任务列表
@ApiModelProperty(value = "集体进度", name = "resultTasks")
private List<ResultTaskDto> resultTasks;
}

View File

@ -44,5 +44,6 @@ public interface ResultTaskService extends IService<ResultTask> {
List<ResultTask> selectResultTasksByDetailId(Long detailId);
void deleteTask(Long taskId);
List<ResultTaskDto> selectResultTaskDtosByDetailId(Long detailId);
}

View File

@ -31,4 +31,8 @@ public interface TaskCommentService extends IService<TaskComment> {
int deleteTaskCommensByTaskId(Long taskId);
TaskComment selectTaskCommentByDetailId(Long detailId);
TaskComment selectTaskCommentByTaskId(Long taskId);
}

View File

@ -2,8 +2,12 @@ package com.lz.modules.performance.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.BigDecimalUtil;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.performance.dao.ResultTaskMapper;
import com.lz.modules.performance.dao.TaskProcessRecordMapper;
import com.lz.modules.performance.dto.ResultTaskDto;
import com.lz.modules.performance.dto.TaskProcessRecordDto;
import com.lz.modules.performance.entity.ResultTask;
import com.lz.modules.performance.entity.TaskProcessRecord;
import com.lz.modules.performance.enums.ProcessRecordEnum;
@ -24,6 +28,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
/**
* <p>
@ -47,6 +52,10 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
private TaskCommentService taskCommentService;
@Autowired
private TaskProcessRecordService taskProcessRecordService;
@Autowired
private TaskProcessRecordMapper taskProcessRecordMapper;
@Autowired
private StaffService staffService;
@ -86,19 +95,39 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
@Override
public ResultTaskDetailRes taskDetail(Long detailId) {
ResultTaskDetailRes res = new ResultTaskDetailRes();
StaffEntity staffEntity = null;
ResultDetail resultDetail = resultDetailService.selectResultDetailById(detailId);
Optional.ofNullable(resultDetail).ifPresent(resultDetail1 -> {
res.setProcessRate(resultDetail1.getProcessRate());
res.setTarget(resultDetail1.getTarget());
});
if(resultDetail != null){
res.setProcessRate(resultDetail.getProcessRate());
res.setTarget(resultDetail.getTarget());
Long staffId = resultDetail.getStaffId();
staffEntity = staffService.selectStaffById(staffId);
}
List<ResultTaskDto> resultTasks = resultTaskMapper.selectResultTaskDtosByDetailId(detailId);
//获取最近更新记录
if(CollectionUtils.isNotEmpty(resultTasks)){
StaffEntity finalStaffEntity = staffEntity;
resultTasks.forEach(resultTaskDto -> {
TaskProcessRecordDto taskProcessRecordDto = taskProcessRecordMapper.selectTaskProcessRecordLastByTaskId(resultTaskDto.getId());
if(taskProcessRecordDto != null){
ProcessRecordEnum byType = ProcessRecordEnum.findByType(taskProcessRecordDto.getType());
Optional.ofNullable(byType).ifPresent(processRecordEnum -> resultTaskDto.setLabel(byType.getDesc()));
if(finalStaffEntity !=null){
resultTaskDto.setAvatar(finalStaffEntity.getAvatar());
resultTaskDto.setStaffName(finalStaffEntity.getName());
}
}
});
}
res.setResultTasks(resultTasks);
return res;
}
@Override
public int saveOrUpdateResultTask(ResultUpdateTaskReq req) {
Long tasklId = req.getTasklId();
Long tasklId = req.getTaskId();
Long detailId = req.getDetailId();
if(tasklId == null && detailId == null){
log.error("任务保存或更新失败tasklId, detailId都为空");
@ -117,33 +146,40 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
log.info("绩效任务修改操作。。。");
resultTask = resultTaskMapper.selectResultTaskById(tasklId);
BeanUtils.copyProperties(req,resultTask);
resultTaskMapper.updateResultTaskById(resultTask);
int i = changeTaskProcess(resultTask, req);
if(i<1){
log.info("任务暂无变化,不做修改");
}
resultTask.setOrderBy(req.getOrderBy());
resultTask.setName(req.getName());
resultTask.setProcessRate(req.getProcessRate());
resultTaskMapper.updateCoverResultTaskById(resultTask);
}
//修改总进度
if(detailId == null){
detailId = resultTask.getDetailId();
}
ResultDetail resultDetail = resultDetailService.selectResultDetailById(detailId);
resultDetail.setProcessRate(caclateResultDetailProcess(detailId));
resultDetail.setProcessRate(BigDecimal.valueOf(caclateResultDetailProcess(detailId)));
return resultDetailService.updateResultDetailById(resultDetail);
}
//计算总进度
private BigDecimal caclateResultDetailProcess(Long detailId){
private Double caclateResultDetailProcess(Long detailId){
List<ResultTaskDto> resultTaskDtos = resultTaskMapper.selectResultTaskDtosByDetailId(detailId);
if(CollectionUtils.isEmpty(resultTaskDtos)){
log.info("未找到该绩效详情下得任务信息");
return BigDecimal.ZERO;
return 0d;
}
int size = resultTaskDtos.size();
BigDecimal rate = BigDecimal.ZERO;
Double rate = 0d;
for(ResultTaskDto dto:resultTaskDtos){
rate = BigDecimalUtil.add(rate,dto.getProcessRate());
}
return BigDecimalUtil.divide(rate,BigDecimal.valueOf(size)).setScale(2);
double result = BigDecimalUtil.div(rate, size, 4);
return result;
}
@ -154,16 +190,16 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
//新增操作
if(before == null){
taskProcessRecord.setType(ProcessRecordEnum.ADD.getType());
taskProcessRecord.setLabel("新增key Results名称" + after.getName() + "进度:" + after.getProcessRate());
taskProcessRecord.setLabel("新增key Results名称" + after.getName() + "进度:" + BigDecimalUtil.mul(after.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%");
return taskProcessRecordService.insertTaskProcessRecord(taskProcessRecord).intValue();
}
taskProcessRecord.setTaskId(before.getId());
//判断修改了名称或进度
if(before.getName().equals(after.getName())){
if(before.getProcessRate().equals(after.getProcessRate())){
if(!before.getName().equals(after.getName())){
if(!before.getProcessRate().equals(after.getProcessRate())){
taskProcessRecord.setType(ProcessRecordEnum.ALL.getType());
taskProcessRecord.setLabel("将key Results名称" + before.getName() + "改为" + after.getName() + "\n"
+ "进度:" + before.getProcessRate() + "改为" + after.getProcessRate());
+ "进度:" + BigDecimalUtil.mul(before.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%" + "改为" + BigDecimalUtil.mul(after.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%");
return taskProcessRecordService.insertTaskProcessRecord(taskProcessRecord).intValue();
}
@ -172,14 +208,16 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
return taskProcessRecordService.insertTaskProcessRecord(taskProcessRecord).intValue();
}
if(before.getProcessRate().equals(after.getProcessRate())){
if(!before.getProcessRate().equals(after.getProcessRate())){
taskProcessRecord.setType(ProcessRecordEnum.PROCESS.getType());
taskProcessRecord.setLabel("" +before.getName() + "得进度由" + before.getProcessRate() + "更新为:" + after.getProcessRate());
taskProcessRecord.setLabel("" +before.getName() + "得进度由" + BigDecimalUtil.mul(before.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%" + "更新为:" + BigDecimalUtil.mul(after.getProcessRate(),BigDecimal.valueOf(100)).setScale(2) + "%");
return taskProcessRecordService.insertTaskProcessRecord(taskProcessRecord).intValue();
}
return -1;
}
@Override
public List<ResultTask> selectResultTasksByDetailId(Long detailId){
return resultTaskMapper.selectResultTasksByDetailId(detailId);
@ -205,6 +243,10 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
taskProcessRecord.setType(ProcessRecordEnum.DELETE.getType());
taskProcessRecord.setLabel("" +resultTask.getName() + "任务删除");
taskProcessRecordService.insertTaskProcessRecord(taskProcessRecord);
//修改总进度
ResultDetail resultDetail = resultDetailService.selectResultDetailById(resultTask.getDetailId());
resultDetail.setProcessRate(BigDecimal.valueOf(caclateResultDetailProcess(resultTask.getDetailId())));
resultDetailService.updateResultDetailById(resultDetail);
}
@Override

View File

@ -62,6 +62,16 @@ public class TaskCommentServiceImpl extends ServiceImpl<TaskCommentMapper, TaskC
public int deleteTaskCommensByTaskId(Long taskId){
return taskCommentMapper.deleteTaskCommensByTaskId(taskId);
}
@Override
public TaskComment selectTaskCommentByDetailId(Long detailId){
return taskCommentMapper.selectTaskCommentByDetailId(detailId);
}
@Override
public TaskComment selectTaskCommentByTaskId(Long taskId){
return taskCommentMapper.selectTaskCommentByTaskId(taskId);
}

View File

@ -5,6 +5,7 @@ import com.lz.common.utils.PageUtils;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.performance.dao.TaskProcessRecordMapper;
import com.lz.modules.performance.dto.ResultTaskDto;
import com.lz.modules.performance.dto.TaskProcessRecordDto;
import com.lz.modules.performance.entity.ResultTask;
import com.lz.modules.performance.entity.TaskProcessRecord;
@ -18,6 +19,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* <p>
@ -81,19 +86,41 @@ public class TaskProcessRecordServiceImpl extends ServiceImpl<TaskProcessRecordM
@Override
public PageUtils selectTaskProcessRecordsByTaskId(ChangeTaskListReq req) {
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
page -> taskProcessRecordMapper.selectTaskProcessRecordsByTaskId(page, req.getTaskId())
);
Long taskId = req.getTaskId();
Long detailId = req.getDetailId();
PageUtils pageUtils = new PageUtils();
if(detailId!=null){
List<ResultTaskDto> resultTaskDtos = resultTaskService.selectResultTaskDtosByDetailId(req.getDetailId());
if(CollectionUtils.isNotEmpty(resultTaskDtos)){
List<Long> collect = resultTaskDtos.stream().map(resultTaskDto -> resultTaskDto.getId()).collect(Collectors.toList());
pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
page -> taskProcessRecordMapper.selectTaskProcessRecordsByTaskIds(page, collect)
);
}
}
else {
pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
page -> taskProcessRecordMapper.selectTaskProcessRecordsByTaskId(page, req.getTaskId())
);
}
List list = pageUtils.getList();
if(CollectionUtils.isNotEmpty(list)){
Long taskId = req.getTaskId();
ResultTask resultTask = resultTaskService.selectResultTaskById(taskId);
ResultDetail resultDetail = resultDetailService.selectResultDetailById(resultTask.getDetailId());
if(detailId == null){
ResultTask resultTask = resultTaskService.selectResultTaskById(taskId);
detailId = resultTask.getDetailId();
}
ResultDetail resultDetail = resultDetailService.selectResultDetailById(detailId);
StaffEntity staffEntity = staffService.selectStaffById(resultDetail.getStaffId());
List<TaskProcessRecordDto> dtos = list;
for(TaskProcessRecordDto dto:dtos){
dto.setAvatar(staffEntity.getAvatar());
dto.setStaffName(staffEntity.getName());
Optional.ofNullable(staffEntity).ifPresent(staffEntity1 -> {
dto.setAvatar(staffEntity1.getAvatar());
dto.setStaffName(staffEntity1.getName());
});
}
}
return pageUtils;

View File

@ -112,5 +112,6 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
List<LevelDetailExportDto> selectLevelDetailList(@Param("departmentIds") List<String> departmentIds, @Param("startId")Long startId, @Param("scoreLevel")String scoreLevel);
List<Long> selectStaffIdsByFlowProcess(@Param("flowProcess") List<Integer> flowProcess);
}

View File

@ -131,4 +131,6 @@ public interface ResultRecordService extends IService<ResultRecord> {
R resetData(Long recordId, int clearFlag);
List<Long> selectStaffIdsByFlowProcess(List<Integer> flowProcess);
}

View File

@ -1506,4 +1506,10 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
return R.error("无数据删除");
}
@Override
public List<Long> selectStaffIdsByFlowProcess(List<Integer> flowProcess) {
return resultRecordMapper.selectStaffIdsByFlowProcess(flowProcess);
}
}

View File

@ -643,5 +643,15 @@
ORDER BY all_score desc
</select>
<select id="selectStaffIdsByFlowProcess" resultType="long">
select staff_id from lz_result_record where is_delete = 0
and flow_process in (
<foreach collection="flowProcess" item="process" separator=",">
#{process}
</foreach>
)
</select>
</mapper>

View File

@ -85,7 +85,7 @@
</update>
<select id="selectResultTasksByDetailId" resultType="ResultTask" >
select * from lz_result_task where detail_id=#{detailId} and is_delete = 0 order by order_by asc
select * from lz_result_task where detail_id=#{detailId} and is_delete = 0
</select>
<update id="deleteResultTasksByDetailId" parameterType="java.lang.Long">
@ -93,7 +93,7 @@
</update>
<select id="selectResultTaskDtosByDetailId" resultType="com.lz.modules.performance.dto.ResultTaskDto" >
select id, is_delete, name,process_rate from lz_result_task where detail_id=#{detailId} and is_delete = 0 order by order_by asc
select id, is_delete, name,process_rate from lz_result_task where detail_id=#{detailId} and is_delete = 0
</select>
</mapper>

View File

@ -111,5 +111,13 @@
update lz_task_comment set is_delete = 1 where task_id=#{taskId}
</update>
<select id="selectTaskCommentByTaskId" resultType="TaskComment" >
select * from lz_task_comment where task_id=#{taskId} and is_delete = 0 order by id desc limit 1
</select>
<select id="selectTaskCommentByDetailId" resultType="TaskComment" >
select * from lz_task_comment where detail_id=#{detailId} and is_delete = 0 order by id desc limit 1
</select>
</mapper>

View File

@ -136,7 +136,20 @@
update lz_task_process_record set is_delete = 1 where task_id=#{taskId}
</update>
<select id="selectTaskProcessRecordLastByTaskId" resultType="com.lz.modules.performance.dto.TaskProcessRecordDto">
select gmt_create,remark,label,type from lz_task_process_record where task_id=#{taskId} and is_delete = 0 order by id desc limit 1
</select>
<select id="selectTaskProcessRecordsByTaskIds" resultType="com.lz.modules.performance.dto.TaskProcessRecordDto">
select gmt_create,remark,label,type from lz_task_process_record where is_delete = 0
and
task_id in
<foreach collection="taskIds" item="taskId" separator="," open="(" close=")">
#{taskId}
</foreach>
order by gmt_create desc
</select>
</mapper>