Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0

This commit is contained in:
wulin 2020-12-11 11:03:04 +08:00
commit 128f92cdf1
18 changed files with 316 additions and 72 deletions

View File

@ -257,7 +257,7 @@ public class StaffRoleController extends AbstractController {
// http://localhost:8080/lz_management/user/lzstaffrole/task/comment?taskId=1&content=xxx&staffId=294 // http://localhost:8080/lz_management/user/lzstaffrole/task/comment?taskId=1&content=xxx&staffId=294&atStaffId=314
@RequestMapping("/task/comment") @RequestMapping("/task/comment")
public R taskComment(TaskModel taskModel) { public R taskComment(TaskModel taskModel) {
if(taskModel.getStaffId() == null && getUser()!=null && getUserId() !=null){ if(taskModel.getStaffId() == null && getUser()!=null && getUserId() !=null){
@ -266,6 +266,7 @@ public class StaffRoleController extends AbstractController {
return staffRoleService.taskComment(taskModel); return staffRoleService.taskComment(taskModel);
} }
//http://localhost:8080/lz_management/user/lzstaffrole/comment/list?detailId=4917&pageSize=2 //http://localhost:8080/lz_management/user/lzstaffrole/comment/list?detailId=4917&pageSize=2
@RequestMapping("/comment/list") @RequestMapping("/comment/list")
public R commentList(TaskModel taskModel) { public R commentList(TaskModel taskModel) {

View File

@ -318,17 +318,16 @@ public class TestController {
} }
// http://localhost:8080/lz_management/test/task/comment?taskId=1&content=xxx&staffId=294&atStaffId=314
// http://localhost:8080/lz_management/test/task/comment?taskId=1&content=xxx&staffId=294
@RequestMapping("/test/task/comment") @RequestMapping("/test/task/comment")
public R taskComment(TaskModel taskModel) { public R taskComment(TaskModel taskModel) {
return staffRoleService.taskComment(taskModel); return staffRoleService.taskComment(taskModel);
} }
//http://localhost:8080/lz_management/test/comment/list?detailId=4917&pageSize=2 //http://localhost:8080/lz_management/test/comment/list?detailId=4917&pageSize=2
@RequestMapping("/test/comment/list") @RequestMapping("/test/comment/list")
public R commentList(TaskModel taskModel) { public R commentList(TaskModel taskModel) {
return staffRoleService.commentList(taskModel); return staffRoleService.commentList(taskModel);
} }
} }

View File

@ -1,9 +1,22 @@
package com.lz.modules.app.dto; package com.lz.modules.app.dto;
import com.lz.modules.performance.entity.TaskComment; import com.lz.modules.performance.entity.TaskComment;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date;
@Data @Data
public class TaskCommentDto extends TaskComment { public class TaskCommentDto {
private int isSelf; private int isSelf;
private Date gmtCreate;
private Integer type;
private Long taskId;
private Long detailId;
private Long resultRecordId;
private Long staffId;
private String label;
private String staffName;
private Long atStaffId;
private String atStaffName;
} }

View File

@ -11,4 +11,6 @@ public class TaskModel {
private Long detailId; private Long detailId;
private String content; private String content;
private Long staffId; private Long staffId;
private int useType;
private Long atStaffId;
} }

View File

@ -30,8 +30,10 @@ import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.performance.dao.TaskCommentMapper; import com.lz.modules.performance.dao.TaskCommentMapper;
import com.lz.modules.performance.entity.ResultTask; import com.lz.modules.performance.entity.ResultTask;
import com.lz.modules.performance.entity.TaskComment; import com.lz.modules.performance.entity.TaskComment;
import com.lz.modules.performance.entity.TaskProcessRecord;
import com.lz.modules.performance.service.ResultTaskService; import com.lz.modules.performance.service.ResultTaskService;
import com.lz.modules.performance.service.TaskCommentService; import com.lz.modules.performance.service.TaskCommentService;
import com.lz.modules.performance.service.TaskProcessRecordService;
import com.lz.modules.sys.entity.SysMenuEntity; import com.lz.modules.sys.entity.SysMenuEntity;
import com.lz.modules.sys.entity.SysRoleEntity; import com.lz.modules.sys.entity.SysRoleEntity;
import com.lz.modules.sys.entity.app.ResultDetail; import com.lz.modules.sys.entity.app.ResultDetail;
@ -113,6 +115,9 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
@Autowired @Autowired
private TaskCommentService taskCommentService; private TaskCommentService taskCommentService;
@Autowired
private TaskProcessRecordService taskProcessRecordService;
@Autowired @Autowired
private DingtalkBusiness dingtalkBusiness; private DingtalkBusiness dingtalkBusiness;
@ -622,46 +627,55 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
if (roleModel.getDetailId() == null && roleModel.getTaskId() == null) { if (roleModel.getDetailId() == null && roleModel.getTaskId() == null) {
return R.error("detailId和taskId不能同时为空"); return R.error("detailId和taskId不能同时为空");
} }
TaskComment taskComment = new TaskComment(); TaskProcessRecord taskProcessRecord = new TaskProcessRecord();
taskComment.setContent(roleModel.getContent()); taskProcessRecord.setLabel(roleModel.getContent());
taskComment.setTaskId(roleModel.getTaskId()); taskProcessRecord.setTaskId(roleModel.getTaskId());
if (roleModel.getTaskId() != null) { if (roleModel.getTaskId() != null) {
ResultTask resultTask = resultTaskService.selectResultTaskById(roleModel.getTaskId()); ResultTask resultTask = resultTaskService.selectResultTaskById(roleModel.getTaskId());
taskComment.setDetailId(resultTask.getDetailId()); taskProcessRecord.setDetailId(resultTask.getDetailId());
taskComment.setType(1); taskProcessRecord.setType(1);
} else { } else {
taskComment.setDetailId(roleModel.getDetailId()); taskProcessRecord.setDetailId(roleModel.getDetailId());
taskComment.setType(0);// taskProcessRecord.setType(0);//
} }
ResultDetail resultDetail = resultDetailService.selectResultDetailById(taskComment.getDetailId()); ResultDetail resultDetail = resultDetailService.selectResultDetailById(taskProcessRecord.getDetailId());
taskComment.setResultRecordId(resultDetail.getRecordId()); taskProcessRecord.setResultRecordId(resultDetail.getRecordId());
StaffEntity staffEntity = staffDao.selectStaffById(roleModel.getStaffId()); StaffEntity staffEntity = staffDao.selectStaffById(roleModel.getStaffId());
if (staffEntity != null) { if (staffEntity != null) {
taskComment.setStaffId(staffEntity.getId()); taskProcessRecord.setStaffId(staffEntity.getId());
taskComment.setStaffName(staffEntity.getName()); taskProcessRecord.setStaffName(staffEntity.getName());
} }
taskCommentService.insertTaskComment(taskComment);
dingtalkBusiness.sendTaskNoticeMsg(taskComment.getDetailId(), taskComment.getTaskId()); StaffEntity atStaffEntity = staffDao.selectStaffById(roleModel.getAtStaffId());
if (atStaffEntity != null) {
taskProcessRecord.setAtStaffId(atStaffEntity.getId());
taskProcessRecord.setAtStaffName(atStaffEntity.getName());
}
taskProcessRecord.setUseType(1);
taskProcessRecordService.insertTaskProcessRecord(taskProcessRecord);
dingtalkBusiness.sendTaskNoticeMsg(taskProcessRecord.getDetailId(), taskProcessRecord.getTaskId());
return R.ok(); return R.ok();
} }
@Override @Override
public R commentList(TaskModel taskModel) { public R commentList(TaskModel taskModel) {
taskModel.setUseType(1);
PageUtils pageUtils = PageUtils.startPage(taskModel.getCurrPage(), taskModel.getPageSize()).doSelect( PageUtils pageUtils = PageUtils.startPage(taskModel.getCurrPage(), taskModel.getPageSize()).doSelect(
page -> taskCommentMapper.selectByCondition(page, taskModel) page -> taskProcessRecordService.selectByCondition(page, taskModel)
); );
List<TaskComment> taskComments = pageUtils.getList(); List<TaskProcessRecord> pageUtilsList = pageUtils.getList();
List<TaskCommentDto> taskCommentDtoList = new ArrayList<>(); List<TaskCommentDto> taskCommentDtoList = new ArrayList<>();
for (TaskComment taskComment : taskComments) { for (TaskProcessRecord taskProcessRecord : pageUtilsList) {
TaskCommentDto taskCommentDto = new TaskCommentDto(); TaskCommentDto taskCommentDto = new TaskCommentDto();
BeanUtils.copyProperties(taskComment, taskCommentDto); BeanUtils.copyProperties(taskProcessRecord, taskCommentDto);
if(taskComment.getStaffId().equals(taskModel.getStaffId())){ if (taskProcessRecord.getStaffId().equals(taskModel.getStaffId())) {
taskCommentDto.setIsSelf(1); taskCommentDto.setIsSelf(1);
} }
taskCommentDtoList.add(taskCommentDto); taskCommentDtoList.add(taskCommentDto);
} }
pageUtils.setList(taskCommentDtoList); pageUtils.setList(taskCommentDtoList);
return R.ok().put("data", pageUtils); return R.ok().put("data", pageUtils);
}
} }
}

View File

@ -44,7 +44,7 @@ public class ResultTaskController {
@PostMapping("/result/changeTask") @PostMapping("/result/changeTask")
@ApiOperation("任务修改") @ApiOperation("任务新增或修改")
@ApiResponses({@ApiResponse(code = 200,message = "成功")}) @ApiResponses({@ApiResponse(code = 200,message = "成功")})
public R changeTask(@RequestBody ResultUpdateTaskReq req){ public R changeTask(@RequestBody ResultUpdateTaskReq req){
int i = resultTaskService.saveOrUpdateResultTask(req); int i = resultTaskService.saveOrUpdateResultTask(req);
@ -58,7 +58,7 @@ public class ResultTaskController {
@PostMapping("/result/changeTaskList") @PostMapping("/result/changeTaskList")
@ApiOperation("任务变更记录") @ApiOperation("任务变更记录")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = TaskProcessRecordDto.class)}) @ApiResponses({@ApiResponse(code = 200,message = "成功",response = TaskProcessRecordDto.class)})
public R changeTaskList(ChangeTaskListReq req){ public R changeTaskList(@RequestBody ChangeTaskListReq req){
PageUtils pageUtils = taskProcessRecordService.selectTaskProcessRecordsByTaskId(req); PageUtils pageUtils = taskProcessRecordService.selectTaskProcessRecordsByTaskId(req);
return R.ok().put("data",pageUtils); return R.ok().put("data",pageUtils);
} }

View File

@ -9,6 +9,7 @@ package com.lz.modules.performance.dao;
*/ */
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lz.modules.app.model.TaskModel;
import com.lz.modules.performance.dto.TaskProcessRecordDto; import com.lz.modules.performance.dto.TaskProcessRecordDto;
import com.lz.modules.performance.entity.TaskProcessRecord; import com.lz.modules.performance.entity.TaskProcessRecord;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -22,25 +23,21 @@ public interface TaskProcessRecordMapper extends BaseMapper<TaskProcessRecord> {
TaskProcessRecord selectTaskProcessRecordById(@Param("id") Long id); TaskProcessRecord selectTaskProcessRecordById(@Param("id") Long id);
Long insertTaskProcessRecord(TaskProcessRecord taskProcessRecord); Long insertTaskProcessRecord(TaskProcessRecord taskProcessRecord);
int updateTaskProcessRecordById(TaskProcessRecord taskProcessRecord); int updateTaskProcessRecordById(TaskProcessRecord taskProcessRecord);
int updateCoverTaskProcessRecordById(TaskProcessRecord taskProcessRecord); int updateCoverTaskProcessRecordById(TaskProcessRecord taskProcessRecord);
int deleteTaskProcessRecordById(@Param("id") Long id); int deleteTaskProcessRecordById(@Param("id") Long id);
List<TaskProcessRecordDto> selectTaskProcessRecordsByTaskId(@Param("page") IPage page, @Param("taskId") Long taskId); List<TaskProcessRecordDto> selectTaskProcessRecordsByTaskId(@Param("page") IPage page, @Param("taskId") Long taskId,@Param("useType") int useType);
int deleteTaskProcessRecordsByTaskId(@Param("taskId") Long taskId); int deleteTaskProcessRecordsByTaskId(@Param("taskId") Long taskId);
TaskProcessRecordDto selectTaskProcessRecordLastByTaskId(@Param("taskId") Long taskId); TaskProcessRecordDto selectTaskProcessRecordLastByTaskId(@Param("taskId") Long taskId);
List<TaskProcessRecordDto> selectTaskProcessRecordsByTaskIds(@Param("page") IPage page, @Param("taskIds") List<Long> taskIds); List<TaskProcessRecordDto> selectTaskProcessRecordsByTaskIds(@Param("page") IPage page, @Param("taskIds") List<Long> taskIds,@Param("useType") int useType);
List<TaskProcessRecord> selectByCondition(@Param("page") IPage page, @Param("taskModel") TaskModel taskModel);
} }

View File

@ -35,7 +35,10 @@ public class ResultTaskDto {
//姓名 //姓名
@ApiModelProperty(value = "姓名", name = "staffName") @ApiModelProperty(value = "姓名", name = "staffName")
private String staffName; private String staffName;
//标签 /* //标签
@ApiModelProperty(value = "标签", name = "label") @ApiModelProperty(value = "标签", name = "label")
private String label; private String label;*/
//标签
@ApiModelProperty(value = "类型", name = "描述")
private String typeDesc;
} }

View File

@ -31,4 +31,7 @@ public class TaskProcessRecordDto {
@ApiModelProperty(value = "头像", name = "avatar") @ApiModelProperty(value = "头像", name = "avatar")
private String avatar; private String avatar;
//标签
@ApiModelProperty(value = "类型", name = "描述")
private String typeDesc;
} }

View File

@ -12,7 +12,7 @@ import java.util.Date;
* <p> * <p>
* </p>*任务进度更新表 * </p>*任务进度更新表
* @author quyixiao * @author quyixiao
* @since 2020-12-09 * @since 2020-12-11
*/ */
@Data @Data
@ -40,8 +40,8 @@ public class TaskProcessRecord implements java.io.Serializable {
//操作标签 //操作标签
@ApiModelProperty(value = "操作标签", name = "label") @ApiModelProperty(value = "操作标签", name = "label")
private String label; private String label;
//1修改名称2修改进度 3名称和进度都修改 //1修改名称2修改进度 3名称和进度都修改 4:新增 5删除
@ApiModelProperty(value = "1修改名称2修改进度 3名称和进度都修改", name = "type") @ApiModelProperty(value = "1修改名称2修改进度 3名称和进度都修改 4:新增 5删除", name = "type")
private Integer type; private Integer type;
//任务 result_task得id //任务 result_task得id
@ApiModelProperty(value = "任务 result_task得id ", name = "taskId") @ApiModelProperty(value = "任务 result_task得id ", name = "taskId")
@ -49,6 +49,27 @@ public class TaskProcessRecord implements java.io.Serializable {
//任务名称 //任务名称
@ApiModelProperty(value = "任务名称", name = "name") @ApiModelProperty(value = "任务名称", name = "name")
private String name; private String name;
//0表示记录1 表示评论
@ApiModelProperty(value = "0表示记录1 表示评论", name = "useType")
private Integer useType;
//@人员id
@ApiModelProperty(value = "@人员id", name = "atStaffId")
private Long atStaffId;
//@人员名称
@ApiModelProperty(value = "@人员名称", name = "atStaffName")
private String atStaffName;
//lz_result_record表id
@ApiModelProperty(value = "lz_result_record表id", name = "detailId")
private Long detailId;
//lz_detail表id
@ApiModelProperty(value = "lz_detail表id", name = "resultRecordId")
private Long resultRecordId;
//员工id
@ApiModelProperty(value = "员工id", name = "staffId")
private Long staffId;
//员工名称
@ApiModelProperty(value = "员工名称", name = "staffName")
private String staffName;
/** /**
* *
* @return * @return
@ -155,14 +176,14 @@ public class TaskProcessRecord implements java.io.Serializable {
} }
/** /**
* 1修改名称2修改进度 3名称和进度都修改 * 1修改名称2修改进度 3名称和进度都修改 4:新增 5删除
* @return * @return
*/ */
public Integer getType() { public Integer getType() {
return type; return type;
} }
/** /**
* 1修改名称2修改进度 3名称和进度都修改 * 1修改名称2修改进度 3名称和进度都修改 4:新增 5删除
* @param type * @param type
*/ */
public void setType(Integer type) { public void setType(Integer type) {
@ -199,6 +220,111 @@ public class TaskProcessRecord implements java.io.Serializable {
this.name = name; this.name = name;
} }
/**
* 0表示记录1 表示评论
* @return
*/
public Integer getUseType() {
return useType;
}
/**
* 0表示记录1 表示评论
* @param useType
*/
public void setUseType(Integer useType) {
this.useType = useType;
}
/**
* @人员id
* @return
*/
public Long getAtStaffId() {
return atStaffId;
}
/**
* @人员id
* @param atStaffId
*/
public void setAtStaffId(Long atStaffId) {
this.atStaffId = atStaffId;
}
/**
* @人员名称
* @return
*/
public String getAtStaffName() {
return atStaffName;
}
/**
* @人员名称
* @param atStaffName
*/
public void setAtStaffName(String atStaffName) {
this.atStaffName = atStaffName;
}
/**
* lz_result_record表id
* @return
*/
public Long getDetailId() {
return detailId;
}
/**
* lz_result_record表id
* @param detailId
*/
public void setDetailId(Long detailId) {
this.detailId = detailId;
}
/**
* lz_detail表id
* @return
*/
public Long getResultRecordId() {
return resultRecordId;
}
/**
* lz_detail表id
* @param resultRecordId
*/
public void setResultRecordId(Long resultRecordId) {
this.resultRecordId = resultRecordId;
}
/**
* 员工id
* @return
*/
public Long getStaffId() {
return staffId;
}
/**
* 员工id
* @param staffId
*/
public void setStaffId(Long staffId) {
this.staffId = staffId;
}
/**
* 员工名称
* @return
*/
public String getStaffName() {
return staffName;
}
/**
* 员工名称
* @param staffName
*/
public void setStaffName(String staffName) {
this.staffName = staffName;
}
@Override @Override
public String toString() { public String toString() {
return "TaskProcessRecord{" + return "TaskProcessRecord{" +
@ -212,6 +338,13 @@ public class TaskProcessRecord implements java.io.Serializable {
",type=" + type + ",type=" + type +
",taskId=" + taskId + ",taskId=" + taskId +
",name=" + name + ",name=" + name +
",useType=" + useType +
",atStaffId=" + atStaffId +
",atStaffName=" + atStaffName +
",detailId=" + detailId +
",resultRecordId=" + resultRecordId +
",staffId=" + staffId +
",staffName=" + staffName +
"}"; "}";
} }
} }

View File

@ -6,14 +6,23 @@ package com.lz.modules.performance.enums;
* @Date: 2020/12/9 14:08 * @Date: 2020/12/9 14:08
*/ */
public enum ProcessRecordEnum { public enum ProcessRecordEnum {
NAME(1,"修改名称"), NAME(1,"更新了名称"),
PROCESS(2,"修改进度"), PROCESS(2,"更新了进度"),
ALL(3,"全部修改"), ALL(3,"更新了名称和进度"),
ADD(4,"增加"), ADD(4,"增加了任务"),
DELETE(5,"删除"), 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 int type;
private String desc; private String desc;

View File

@ -20,4 +20,7 @@ public class ChangeTaskListReq extends BasePage {
@ApiModelProperty(value="详情id二选一",name = "detailId") @ApiModelProperty(value="详情id二选一",name = "detailId")
private Long detailId; private Long detailId;
@ApiModelProperty(value="0:不包含评论1包含评论",name = "type")
private int useType;
} }

View File

@ -1,7 +1,9 @@
package com.lz.modules.performance.service; package com.lz.modules.performance.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.PageUtils; import com.lz.common.utils.PageUtils;
import com.lz.modules.app.model.TaskModel;
import com.lz.modules.performance.entity.TaskProcessRecord; import com.lz.modules.performance.entity.TaskProcessRecord;
import com.lz.modules.performance.req.ChangeTaskListReq; import com.lz.modules.performance.req.ChangeTaskListReq;
@ -37,4 +39,6 @@ public interface TaskProcessRecordService extends IService<TaskProcessRecord> {
int deleteTaskProcessRecordsByTaskId(Long taskId); int deleteTaskProcessRecordsByTaskId(Long taskId);
List<TaskProcessRecord> selectByCondition(IPage page, TaskModel taskModel);
} }

View File

@ -111,10 +111,12 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
resultTasks.forEach(resultTaskDto -> { resultTasks.forEach(resultTaskDto -> {
TaskProcessRecordDto taskProcessRecordDto = taskProcessRecordMapper.selectTaskProcessRecordLastByTaskId(resultTaskDto.getId()); TaskProcessRecordDto taskProcessRecordDto = taskProcessRecordMapper.selectTaskProcessRecordLastByTaskId(resultTaskDto.getId());
if(taskProcessRecordDto != null){ if(taskProcessRecordDto != null){
resultTaskDto.setStaffName(taskProcessRecordDto.getStaffName()); //resultTaskDto.setLabel(taskProcessRecordDto.getLabel());
resultTaskDto.setLabel(taskProcessRecordDto.getLabel()); ProcessRecordEnum byType = ProcessRecordEnum.findByType(taskProcessRecordDto.getType());
Optional.ofNullable(byType).ifPresent(processRecordEnum -> resultTaskDto.setTypeDesc(byType.getDesc()));
if(finalStaffEntity !=null){ if(finalStaffEntity !=null){
resultTaskDto.setAvatar(finalStaffEntity.getAvatar()); resultTaskDto.setAvatar(finalStaffEntity.getAvatar());
resultTaskDto.setStaffName(finalStaffEntity.getName());
} }
} }

View File

@ -1,8 +1,10 @@
package com.lz.modules.performance.service.impl; package com.lz.modules.performance.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.PageUtils; import com.lz.common.utils.PageUtils;
import com.lz.modules.app.entity.StaffEntity; import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.model.TaskModel;
import com.lz.modules.app.service.StaffService; import com.lz.modules.app.service.StaffService;
import com.lz.modules.performance.dao.TaskProcessRecordMapper; import com.lz.modules.performance.dao.TaskProcessRecordMapper;
import com.lz.modules.performance.dto.ResultTaskDto; import com.lz.modules.performance.dto.ResultTaskDto;
@ -19,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -84,33 +88,41 @@ public class TaskProcessRecordServiceImpl extends ServiceImpl<TaskProcessRecordM
@Override @Override
public PageUtils selectTaskProcessRecordsByTaskId(ChangeTaskListReq req) { public PageUtils selectTaskProcessRecordsByTaskId(ChangeTaskListReq req) {
Long taskId = req.getTaskId();
Long detailId = req.getDetailId();
PageUtils pageUtils = new PageUtils(); PageUtils pageUtils = new PageUtils();
if(req.getDetailId()!=null){ if(detailId!=null){
List<ResultTaskDto> resultTaskDtos = resultTaskService.selectResultTaskDtosByDetailId(req.getDetailId()); List<ResultTaskDto> resultTaskDtos = resultTaskService.selectResultTaskDtosByDetailId(req.getDetailId());
if(CollectionUtils.isNotEmpty(resultTaskDtos)){ if(CollectionUtils.isNotEmpty(resultTaskDtos)){
List<Long> collect = resultTaskDtos.stream().map(resultTaskDto -> resultTaskDto.getId()).collect(Collectors.toList()); List<Long> collect = resultTaskDtos.stream().map(resultTaskDto -> resultTaskDto.getId()).collect(Collectors.toList());
pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect( pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
page -> taskProcessRecordMapper.selectTaskProcessRecordsByTaskIds(page, collect) page -> taskProcessRecordMapper.selectTaskProcessRecordsByTaskIds(page, collect,req.getUseType())
); );
} }
} }
else { else {
pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect( pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
page -> taskProcessRecordMapper.selectTaskProcessRecordsByTaskId(page, req.getTaskId()) page -> taskProcessRecordMapper.selectTaskProcessRecordsByTaskId(page, req.getTaskId(),req.getUseType())
); );
} }
List list = pageUtils.getList(); List list = pageUtils.getList();
if(CollectionUtils.isNotEmpty(list)){ if(CollectionUtils.isNotEmpty(list)){
Long taskId = req.getTaskId();
if(detailId == null){
ResultTask resultTask = resultTaskService.selectResultTaskById(taskId); ResultTask resultTask = resultTaskService.selectResultTaskById(taskId);
ResultDetail resultDetail = resultDetailService.selectResultDetailById(resultTask.getDetailId()); detailId = resultTask.getDetailId();
}
ResultDetail resultDetail = resultDetailService.selectResultDetailById(detailId);
StaffEntity staffEntity = staffService.selectStaffById(resultDetail.getStaffId()); StaffEntity staffEntity = staffService.selectStaffById(resultDetail.getStaffId());
List<TaskProcessRecordDto> dtos = list; List<TaskProcessRecordDto> dtos = list;
for(TaskProcessRecordDto dto:dtos){ for(TaskProcessRecordDto dto:dtos){
dto.setAvatar(staffEntity.getAvatar()); Optional.ofNullable(staffEntity).ifPresent(staffEntity1 -> {
dto.setStaffName(staffEntity.getName()); dto.setAvatar(staffEntity1.getAvatar());
dto.setStaffName(staffEntity1.getName());
});
} }
} }
return pageUtils; return pageUtils;
@ -120,4 +132,9 @@ public class TaskProcessRecordServiceImpl extends ServiceImpl<TaskProcessRecordM
public int deleteTaskProcessRecordsByTaskId(Long taskId){ public int deleteTaskProcessRecordsByTaskId(Long taskId){
return taskProcessRecordMapper.deleteTaskProcessRecordsByTaskId(taskId); return taskProcessRecordMapper.deleteTaskProcessRecordsByTaskId(taskId);
} }
@Override
public List<TaskProcessRecord> selectByCondition(IPage page, TaskModel taskModel) {
return taskProcessRecordMapper.selectByCondition(page,taskModel);
}
} }

View File

@ -44,4 +44,12 @@ ALTER TABLE `lz_management`.`lz_task_comment` ADD COLUMN `task_id` int(11) DEFAU
ALTER TABLE `lz_management`.`lz_task_process_record` ADD COLUMN `detail_id` int(11) COMMENT 'lz_result_record表id' AFTER `at_staff_name`, ADD COLUMN `result_record_id` int(11) COMMENT 'lz_detail表id' AFTER `detail_id`;
ALTER TABLE `lz_management`.`lz_task_process_record` ADD COLUMN `process_rate` decimal(12,2) DEFAULT 0 COMMENT '当前进度' AFTER `gmt_modified`, ADD COLUMN `remark` text COMMENT '更新说明' AFTER `process_rate`, ADD COLUMN `label` text COMMENT '操作标签' AFTER `remark`, ADD COLUMN `type` int(11) DEFAULT 3 COMMENT '1修改名称2修改进度 3名称和进度都修改' AFTER `label`; ALTER TABLE `lz_management`.`lz_task_process_record` ADD COLUMN `process_rate` decimal(12,2) DEFAULT 0 COMMENT '当前进度' AFTER `gmt_modified`, ADD COLUMN `remark` text COMMENT '更新说明' AFTER `process_rate`, ADD COLUMN `label` text COMMENT '操作标签' AFTER `remark`, ADD COLUMN `type` int(11) DEFAULT 3 COMMENT '1修改名称2修改进度 3名称和进度都修改' AFTER `label`;
ALTER TABLE `lz_management`.`lz_task_process_record` CHANGE COLUMN `type` `type` int(11) DEFAULT 3 COMMENT 'user_type为0时1修改名称2修改进度 3名称和进度都修改 4新增 5 删除 。user_type为1时0表示对所有评论1表示对单个具体的task做评论';
ALTER TABLE `lz_management`.`lz_task_process_record` ADD COLUMN `staff_id` int(11) COMMENT '员工id' AFTER `result_record_id`, ADD COLUMN `staff_name` varchar(256) COMMENT '员工名称' AFTER `staff_id`;

View File

@ -2,7 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.lz.modules.performance.dao.TaskProcessRecordMapper"> <mapper namespace="com.lz.modules.performance.dao.TaskProcessRecordMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.performance.entity.TaskProcessRecord"> <resultMap id="BaseResultMap" type="com.lz.modules.performance.entity.TaskProcessRecord">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="is_delete" property="isDelete"/> <result column="is_delete" property="isDelete"/>
@ -14,12 +13,19 @@
<result column="type" property="type"/> <result column="type" property="type"/>
<result column="task_id" property="taskId"/> <result column="task_id" property="taskId"/>
<result column="name" property="name"/> <result column="name" property="name"/>
<result column="use_type" property="useType"/>
<result column="at_staff_id" property="atStaffId"/>
<result column="at_staff_name" property="atStaffName"/>
<result column="detail_id" property="detailId"/>
<result column="result_record_id" property="resultRecordId"/>
<result column="staff_id" property="staffId"/>
<result column="staff_name" property="staffName"/>
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, process_rate AS processRate, remark AS remark, label AS label, type AS type, task_id AS taskId, name AS name id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, process_rate AS processRate, remark AS remark, label AS label, type AS type, task_id AS taskId, name AS name, use_type AS useType, at_staff_id AS atStaffId, at_staff_name AS atStaffName, detail_id AS detailId, result_record_id AS resultRecordId, staff_id AS staffId, staff_name AS staffName
</sql> </sql>
@ -29,6 +35,7 @@
select * from lz_task_process_record where id=#{id} and is_delete = 0 limit 1 select * from lz_task_process_record where id=#{id} and is_delete = 0 limit 1
</select> </select>
<insert id="insertTaskProcessRecord" parameterType="TaskProcessRecord" useGeneratedKeys="true" keyProperty="id" > <insert id="insertTaskProcessRecord" parameterType="TaskProcessRecord" useGeneratedKeys="true" keyProperty="id" >
insert into lz_task_process_record( insert into lz_task_process_record(
<if test="processRate != null">process_rate, </if> <if test="processRate != null">process_rate, </if>
@ -37,6 +44,13 @@
<if test="type != null">type, </if> <if test="type != null">type, </if>
<if test="taskId != null">task_id, </if> <if test="taskId != null">task_id, </if>
<if test="name != null">name, </if> <if test="name != null">name, </if>
<if test="useType != null">use_type, </if>
<if test="atStaffId != null">at_staff_id, </if>
<if test="atStaffName != null">at_staff_name, </if>
<if test="detailId != null">detail_id, </if>
<if test="resultRecordId != null">result_record_id, </if>
<if test="staffId != null">staff_id, </if>
<if test="staffName != null">staff_name, </if>
is_delete, is_delete,
gmt_create, gmt_create,
gmt_modified gmt_modified
@ -47,6 +61,13 @@
<if test="type != null">#{ type}, </if> <if test="type != null">#{ type}, </if>
<if test="taskId != null">#{ taskId}, </if> <if test="taskId != null">#{ taskId}, </if>
<if test="name != null">#{ name}, </if> <if test="name != null">#{ name}, </if>
<if test="useType != null">#{ useType}, </if>
<if test="atStaffId != null">#{ atStaffId}, </if>
<if test="atStaffName != null">#{ atStaffName}, </if>
<if test="detailId != null">#{ detailId}, </if>
<if test="resultRecordId != null">#{ resultRecordId}, </if>
<if test="staffId != null">#{ staffId}, </if>
<if test="staffName != null">#{ staffName}, </if>
0, 0,
now(), now(),
now() now()
@ -65,7 +86,14 @@
<if test="label != null">label = #{label},</if> <if test="label != null">label = #{label},</if>
<if test="type != null">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="taskId != null">task_id = #{taskId},</if> <if test="taskId != null">task_id = #{taskId},</if>
<if test="name != null">name = #{name}</if> <if test="name != null">name = #{name},</if>
<if test="useType != null">use_type = #{useType},</if>
<if test="atStaffId != null">at_staff_id = #{atStaffId},</if>
<if test="atStaffName != null">at_staff_name = #{atStaffName},</if>
<if test="detailId != null">detail_id = #{detailId},</if>
<if test="resultRecordId != null">result_record_id = #{resultRecordId},</if>
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="staffName != null">staff_name = #{staffName}</if>
</trim> </trim>
,gmt_modified = now() ,gmt_modified = now()
where id = #{id} where id = #{id}
@ -83,7 +111,14 @@
label = #{label}, label = #{label},
type = #{type}, type = #{type},
task_id = #{taskId}, task_id = #{taskId},
name = #{name} name = #{name},
use_type = #{useType},
at_staff_id = #{atStaffId},
at_staff_name = #{atStaffName},
detail_id = #{detailId},
result_record_id = #{resultRecordId},
staff_id = #{staffId},
staff_name = #{staffName}
,gmt_modified = now() ,gmt_modified = now()
where id = #{id} where id = #{id}
</update> </update>
@ -93,9 +128,8 @@
update lz_task_process_record set is_delete = 1 where id=#{id} limit 1 update lz_task_process_record set is_delete = 1 where id=#{id} limit 1
</update> </update>
<select id="selectTaskProcessRecordsByTaskId" resultType="com.lz.modules.performance.dto.TaskProcessRecordDto"> <select id="selectTaskProcessRecordsByTaskId" 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 gmt_create desc select gmt_create,remark,label,type from lz_task_process_record where task_id=#{taskId} and use_type = #{useType} and is_delete = 0 order by gmt_create desc
</select> </select>
<update id="deleteTaskProcessRecordsByTaskId" parameterType="java.lang.Long"> <update id="deleteTaskProcessRecordsByTaskId" parameterType="java.lang.Long">
@ -103,19 +137,24 @@
</update> </update>
<select id="selectTaskProcessRecordLastByTaskId" resultType="com.lz.modules.performance.dto.TaskProcessRecordDto"> <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 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>
<select id="selectTaskProcessRecordsByTaskIds" resultType="com.lz.modules.performance.dto.TaskProcessRecordDto"> <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 select gmt_create,remark,label,type from lz_task_process_record where is_delete = 0 and use_type = #{useType}
and and task_id in
task_id in
<foreach collection="taskIds" item="taskId" separator="," open="(" close=")"> <foreach collection="taskIds" item="taskId" separator="," open="(" close=")">
#{taskId} #{taskId}
</foreach> </foreach>
order by gmt_create desc order by gmt_create desc
</select> </select>
<select id="selectByCondition" resultType="com.lz.modules.performance.entity.TaskProcessRecord">
select * from lz_task_process_record where is_delete = 0 and (detail_id = #{taskModel.detailId} or task_id=#{taskModel.taskId} ) and use_type=#{taskModel.useType} order by id desc
</select>
</mapper> </mapper>

View File

@ -84,9 +84,6 @@ public class MysqlMain {
List<TablesBean> list = new ArrayList<TablesBean>(); List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("lz_result_task"));
list.add(new TablesBean("lz_task_process_record")); list.add(new TablesBean("lz_task_process_record"));