Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0
This commit is contained in:
commit
128f92cdf1
@ -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")
|
||||
public R taskComment(TaskModel taskModel) {
|
||||
if(taskModel.getStaffId() == null && getUser()!=null && getUserId() !=null){
|
||||
@ -266,6 +266,7 @@ public class StaffRoleController extends AbstractController {
|
||||
return staffRoleService.taskComment(taskModel);
|
||||
}
|
||||
|
||||
|
||||
//http://localhost:8080/lz_management/user/lzstaffrole/comment/list?detailId=4917&pageSize=2
|
||||
@RequestMapping("/comment/list")
|
||||
public R commentList(TaskModel taskModel) {
|
||||
|
||||
@ -318,17 +318,16 @@ public class TestController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// http://localhost:8080/lz_management/test/task/comment?taskId=1&content=xxx&staffId=294
|
||||
// http://localhost:8080/lz_management/test/task/comment?taskId=1&content=xxx&staffId=294&atStaffId=314
|
||||
@RequestMapping("/test/task/comment")
|
||||
public R taskComment(TaskModel taskModel) {
|
||||
return staffRoleService.taskComment(taskModel);
|
||||
}
|
||||
|
||||
|
||||
//http://localhost:8080/lz_management/test/comment/list?detailId=4917&pageSize=2
|
||||
@RequestMapping("/test/comment/list")
|
||||
public R commentList(TaskModel taskModel) {
|
||||
return staffRoleService.commentList(taskModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,9 +1,22 @@
|
||||
package com.lz.modules.app.dto;
|
||||
|
||||
import com.lz.modules.performance.entity.TaskComment;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class TaskCommentDto extends TaskComment {
|
||||
public class TaskCommentDto {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -11,4 +11,6 @@ public class TaskModel {
|
||||
private Long detailId;
|
||||
private String content;
|
||||
private Long staffId;
|
||||
private int useType;
|
||||
private Long atStaffId;
|
||||
}
|
||||
|
||||
@ -30,8 +30,10 @@ import com.lz.modules.job.business.DingtalkBusiness;
|
||||
import com.lz.modules.performance.dao.TaskCommentMapper;
|
||||
import com.lz.modules.performance.entity.ResultTask;
|
||||
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.TaskCommentService;
|
||||
import com.lz.modules.performance.service.TaskProcessRecordService;
|
||||
import com.lz.modules.sys.entity.SysMenuEntity;
|
||||
import com.lz.modules.sys.entity.SysRoleEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
@ -113,6 +115,9 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
||||
@Autowired
|
||||
private TaskCommentService taskCommentService;
|
||||
|
||||
@Autowired
|
||||
private TaskProcessRecordService taskProcessRecordService;
|
||||
|
||||
@Autowired
|
||||
private DingtalkBusiness dingtalkBusiness;
|
||||
|
||||
@ -622,46 +627,55 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
||||
if (roleModel.getDetailId() == null && roleModel.getTaskId() == null) {
|
||||
return R.error("detailId和taskId不能同时为空");
|
||||
}
|
||||
TaskComment taskComment = new TaskComment();
|
||||
taskComment.setContent(roleModel.getContent());
|
||||
taskComment.setTaskId(roleModel.getTaskId());
|
||||
TaskProcessRecord taskProcessRecord = new TaskProcessRecord();
|
||||
taskProcessRecord.setLabel(roleModel.getContent());
|
||||
taskProcessRecord.setTaskId(roleModel.getTaskId());
|
||||
if (roleModel.getTaskId() != null) {
|
||||
ResultTask resultTask = resultTaskService.selectResultTaskById(roleModel.getTaskId());
|
||||
taskComment.setDetailId(resultTask.getDetailId());
|
||||
taskComment.setType(1);
|
||||
taskProcessRecord.setDetailId(resultTask.getDetailId());
|
||||
taskProcessRecord.setType(1);
|
||||
} else {
|
||||
taskComment.setDetailId(roleModel.getDetailId());
|
||||
taskComment.setType(0);//
|
||||
taskProcessRecord.setDetailId(roleModel.getDetailId());
|
||||
taskProcessRecord.setType(0);//
|
||||
}
|
||||
ResultDetail resultDetail = resultDetailService.selectResultDetailById(taskComment.getDetailId());
|
||||
taskComment.setResultRecordId(resultDetail.getRecordId());
|
||||
ResultDetail resultDetail = resultDetailService.selectResultDetailById(taskProcessRecord.getDetailId());
|
||||
taskProcessRecord.setResultRecordId(resultDetail.getRecordId());
|
||||
|
||||
StaffEntity staffEntity = staffDao.selectStaffById(roleModel.getStaffId());
|
||||
if (staffEntity != null) {
|
||||
taskComment.setStaffId(staffEntity.getId());
|
||||
taskComment.setStaffName(staffEntity.getName());
|
||||
taskProcessRecord.setStaffId(staffEntity.getId());
|
||||
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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R commentList(TaskModel taskModel) {
|
||||
taskModel.setUseType(1);
|
||||
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<>();
|
||||
for (TaskComment taskComment : taskComments) {
|
||||
for (TaskProcessRecord taskProcessRecord : pageUtilsList) {
|
||||
TaskCommentDto taskCommentDto = new TaskCommentDto();
|
||||
BeanUtils.copyProperties(taskComment, taskCommentDto);
|
||||
if(taskComment.getStaffId().equals(taskModel.getStaffId())){
|
||||
BeanUtils.copyProperties(taskProcessRecord, taskCommentDto);
|
||||
if (taskProcessRecord.getStaffId().equals(taskModel.getStaffId())) {
|
||||
taskCommentDto.setIsSelf(1);
|
||||
}
|
||||
taskCommentDtoList.add(taskCommentDto);
|
||||
}
|
||||
pageUtils.setList(taskCommentDtoList);
|
||||
return R.ok().put("data", pageUtils);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ public class ResultTaskController {
|
||||
|
||||
|
||||
@PostMapping("/result/changeTask")
|
||||
@ApiOperation("任务修改")
|
||||
@ApiOperation("任务新增或修改")
|
||||
@ApiResponses({@ApiResponse(code = 200,message = "成功")})
|
||||
public R changeTask(@RequestBody ResultUpdateTaskReq req){
|
||||
int i = resultTaskService.saveOrUpdateResultTask(req);
|
||||
@ -58,7 +58,7 @@ public class ResultTaskController {
|
||||
@PostMapping("/result/changeTaskList")
|
||||
@ApiOperation("任务变更记录")
|
||||
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = TaskProcessRecordDto.class)})
|
||||
public R changeTaskList(ChangeTaskListReq req){
|
||||
public R changeTaskList(@RequestBody ChangeTaskListReq req){
|
||||
PageUtils pageUtils = taskProcessRecordService.selectTaskProcessRecordsByTaskId(req);
|
||||
return R.ok().put("data",pageUtils);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ package com.lz.modules.performance.dao;
|
||||
*/
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
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.entity.TaskProcessRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -22,25 +23,21 @@ public interface TaskProcessRecordMapper extends BaseMapper<TaskProcessRecord> {
|
||||
|
||||
TaskProcessRecord selectTaskProcessRecordById(@Param("id") Long id);
|
||||
|
||||
|
||||
Long insertTaskProcessRecord(TaskProcessRecord taskProcessRecord);
|
||||
|
||||
|
||||
int updateTaskProcessRecordById(TaskProcessRecord taskProcessRecord);
|
||||
|
||||
|
||||
int updateCoverTaskProcessRecordById(TaskProcessRecord taskProcessRecord);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
@ -35,7 +35,10 @@ public class ResultTaskDto {
|
||||
//姓名
|
||||
@ApiModelProperty(value = "姓名", name = "staffName")
|
||||
private String staffName;
|
||||
//标签
|
||||
/* //标签
|
||||
@ApiModelProperty(value = "标签", name = "label")
|
||||
private String label;
|
||||
private String label;*/
|
||||
//标签
|
||||
@ApiModelProperty(value = "类型", name = "描述")
|
||||
private String typeDesc;
|
||||
}
|
||||
@ -31,4 +31,7 @@ public class TaskProcessRecordDto {
|
||||
|
||||
@ApiModelProperty(value = "头像", name = "avatar")
|
||||
private String avatar;
|
||||
//标签
|
||||
@ApiModelProperty(value = "类型", name = "描述")
|
||||
private String typeDesc;
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ import java.util.Date;
|
||||
* <p>
|
||||
* </p>*任务进度更新表
|
||||
* @author quyixiao
|
||||
* @since 2020-12-09
|
||||
* @since 2020-12-11
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ -40,8 +40,8 @@ public class TaskProcessRecord implements java.io.Serializable {
|
||||
//操作标签
|
||||
@ApiModelProperty(value = "操作标签", name = "label")
|
||||
private String label;
|
||||
//1,修改名称,2修改进度 ,3名称和进度都修改
|
||||
@ApiModelProperty(value = "1,修改名称,2修改进度 ,3名称和进度都修改", name = "type")
|
||||
//1,修改名称,2修改进度 ,3名称和进度都修改 4:新增 5:删除
|
||||
@ApiModelProperty(value = "1,修改名称,2修改进度 ,3名称和进度都修改 4:新增 5:删除", name = "type")
|
||||
private Integer type;
|
||||
//任务 result_task得id
|
||||
@ApiModelProperty(value = "任务 result_task得id ", name = "taskId")
|
||||
@ -49,6 +49,27 @@ public class TaskProcessRecord implements java.io.Serializable {
|
||||
//任务名称
|
||||
@ApiModelProperty(value = "任务名称", name = "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
|
||||
@ -155,14 +176,14 @@ public class TaskProcessRecord implements java.io.Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 1,修改名称,2修改进度 ,3名称和进度都修改
|
||||
* 1,修改名称,2修改进度 ,3名称和进度都修改 4:新增 5:删除
|
||||
* @return
|
||||
*/
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* 1,修改名称,2修改进度 ,3名称和进度都修改
|
||||
* 1,修改名称,2修改进度 ,3名称和进度都修改 4:新增 5:删除
|
||||
* @param type
|
||||
*/
|
||||
public void setType(Integer type) {
|
||||
@ -199,6 +220,111 @@ public class TaskProcessRecord implements java.io.Serializable {
|
||||
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
|
||||
public String toString() {
|
||||
return "TaskProcessRecord{" +
|
||||
@ -212,6 +338,13 @@ public class TaskProcessRecord implements java.io.Serializable {
|
||||
",type=" + type +
|
||||
",taskId=" + taskId +
|
||||
",name=" + name +
|
||||
",useType=" + useType +
|
||||
",atStaffId=" + atStaffId +
|
||||
",atStaffName=" + atStaffName +
|
||||
",detailId=" + detailId +
|
||||
",resultRecordId=" + resultRecordId +
|
||||
",staffId=" + staffId +
|
||||
",staffName=" + staffName +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
|
||||
@ -20,4 +20,7 @@ public class ChangeTaskListReq extends BasePage {
|
||||
|
||||
@ApiModelProperty(value="详情id(二选一)",name = "detailId")
|
||||
private Long detailId;
|
||||
|
||||
@ApiModelProperty(value="0:不包含评论,1包含评论",name = "type")
|
||||
private int useType;
|
||||
}
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.lz.modules.performance.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
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.req.ChangeTaskListReq;
|
||||
|
||||
@ -37,4 +39,6 @@ public interface TaskProcessRecordService extends IService<TaskProcessRecord> {
|
||||
|
||||
|
||||
int deleteTaskProcessRecordsByTaskId(Long taskId);
|
||||
|
||||
List<TaskProcessRecord> selectByCondition(IPage page, TaskModel taskModel);
|
||||
}
|
||||
@ -111,11 +111,13 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
|
||||
resultTasks.forEach(resultTaskDto -> {
|
||||
TaskProcessRecordDto taskProcessRecordDto = taskProcessRecordMapper.selectTaskProcessRecordLastByTaskId(resultTaskDto.getId());
|
||||
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){
|
||||
resultTaskDto.setAvatar(finalStaffEntity.getAvatar());
|
||||
}
|
||||
resultTaskDto.setStaffName(finalStaffEntity.getName());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package com.lz.modules.performance.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
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.performance.dao.TaskProcessRecordMapper;
|
||||
import com.lz.modules.performance.dto.ResultTaskDto;
|
||||
@ -19,6 +21,8 @@ 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;
|
||||
|
||||
@ -84,33 +88,41 @@ public class TaskProcessRecordServiceImpl extends ServiceImpl<TaskProcessRecordM
|
||||
|
||||
@Override
|
||||
public PageUtils selectTaskProcessRecordsByTaskId(ChangeTaskListReq req) {
|
||||
Long taskId = req.getTaskId();
|
||||
Long detailId = req.getDetailId();
|
||||
PageUtils pageUtils = new PageUtils();
|
||||
if(req.getDetailId()!=null){
|
||||
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)
|
||||
page -> taskProcessRecordMapper.selectTaskProcessRecordsByTaskIds(page, collect,req.getUseType())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
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();
|
||||
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;
|
||||
@ -120,4 +132,9 @@ public class TaskProcessRecordServiceImpl extends ServiceImpl<TaskProcessRecordM
|
||||
public int deleteTaskProcessRecordsByTaskId(Long taskId){
|
||||
return taskProcessRecordMapper.deleteTaskProcessRecordsByTaskId(taskId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskProcessRecord> selectByCondition(IPage page, TaskModel taskModel) {
|
||||
return taskProcessRecordMapper.selectByCondition(page,taskModel);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 `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 `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` 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`;
|
||||
@ -2,7 +2,6 @@
|
||||
<!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">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.lz.modules.performance.entity.TaskProcessRecord">
|
||||
<id column="id" property="id"/>
|
||||
<result column="is_delete" property="isDelete"/>
|
||||
@ -14,21 +13,29 @@
|
||||
<result column="type" property="type"/>
|
||||
<result column="task_id" property="taskId"/>
|
||||
<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>
|
||||
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectTaskProcessRecordById" resultType="TaskProcessRecord" >
|
||||
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>
|
||||
|
||||
|
||||
<insert id="insertTaskProcessRecord" parameterType="TaskProcessRecord" useGeneratedKeys="true" keyProperty="id" >
|
||||
insert into lz_task_process_record(
|
||||
<if test="processRate != null">process_rate, </if>
|
||||
@ -37,6 +44,13 @@
|
||||
<if test="type != null">type, </if>
|
||||
<if test="taskId != null">task_id, </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,
|
||||
gmt_create,
|
||||
gmt_modified
|
||||
@ -47,6 +61,13 @@
|
||||
<if test="type != null">#{ type}, </if>
|
||||
<if test="taskId != null">#{ taskId}, </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,
|
||||
now(),
|
||||
now()
|
||||
@ -65,7 +86,14 @@
|
||||
<if test="label != null">label = #{label},</if>
|
||||
<if test="type != null">type = #{type},</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>
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
@ -83,19 +111,25 @@
|
||||
label = #{label},
|
||||
type = #{type},
|
||||
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()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="deleteTaskProcessRecordById" parameterType="java.lang.Long">
|
||||
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>
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
<update id="deleteTaskProcessRecordsByTaskId" parameterType="java.lang.Long">
|
||||
@ -103,19 +137,24 @@
|
||||
</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
|
||||
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
|
||||
select gmt_create,remark,label,type from lz_task_process_record where is_delete = 0 and use_type = #{useType}
|
||||
and task_id in
|
||||
<foreach collection="taskIds" item="taskId" separator="," open="(" close=")">
|
||||
#{taskId}
|
||||
</foreach>
|
||||
order by gmt_create desc
|
||||
</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>
|
||||
|
||||
|
||||
@ -84,9 +84,6 @@ public class MysqlMain {
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
|
||||
|
||||
list.add(new TablesBean("lz_result_task"));
|
||||
|
||||
list.add(new TablesBean("lz_task_process_record"));
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user