diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java index 5c4cc508..878206c1 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -1455,4 +1455,12 @@ public class ResultRecordController extends AbstractController { return R.ok(); } + + + + + + + + } diff --git a/src/main/java/com/lz/modules/app/controller/StaffRoleController.java b/src/main/java/com/lz/modules/app/controller/StaffRoleController.java index 88442101..2ecc3668 100644 --- a/src/main/java/com/lz/modules/app/controller/StaffRoleController.java +++ b/src/main/java/com/lz/modules/app/controller/StaffRoleController.java @@ -10,6 +10,7 @@ import com.lz.modules.app.entity.DepartmentsStaffRelateEntity; import com.lz.modules.app.entity.StaffEntity; import com.lz.modules.app.enums.RoleEnums; import com.lz.modules.app.model.RoleModel; +import com.lz.modules.app.model.TaskModel; import com.lz.modules.app.resp.StaffRoleModel; import com.lz.modules.app.service.DepartmentsService; import com.lz.modules.app.service.DepartmentsStaffRelateService; @@ -23,6 +24,7 @@ import com.lz.modules.flow.service.RecordRoleService; import com.lz.modules.flow.service.StaffRoleDepartmentService; import com.lz.modules.flow.service.StaffRoleEvaluationGroupService; import com.lz.modules.flow.service.StaffRoleService; +import com.lz.modules.sys.controller.AbstractController; import com.lz.modules.sys.entity.SysMenuEntity; import com.lz.modules.sys.entity.SysRoleEntity; import io.swagger.annotations.Api; @@ -48,7 +50,7 @@ import java.util.stream.Collectors; @RestController @RequestMapping("user/lzstaffrole") @Api(tags = "考评组管理员管理") -public class StaffRoleController { +public class StaffRoleController extends AbstractController { @Autowired private StaffRoleService staffRoleService; @@ -252,4 +254,22 @@ public class StaffRoleController { return staffRoleService.delete(roleModel); } + + + + // http://localhost:8080/lz_management/user/lzstaffrole/task/comment?taskId=1&content=xxx&staffId=294 + @RequestMapping("/task/comment") + public R taskComment(TaskModel taskModel) { + if(taskModel.getStaffId() == null && getUser()!=null && getUserId() !=null){ + taskModel.setStaffId(getUserId()); + } + 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) { + return staffRoleService.commentList(taskModel); + } + } diff --git a/src/main/java/com/lz/modules/app/controller/TestController.java b/src/main/java/com/lz/modules/app/controller/TestController.java index ab853483..1eccaa9d 100644 --- a/src/main/java/com/lz/modules/app/controller/TestController.java +++ b/src/main/java/com/lz/modules/app/controller/TestController.java @@ -15,6 +15,7 @@ import com.lz.modules.app.entity.DepartmentsStaffRelateEntity; import com.lz.modules.app.entity.StaffEntity; import com.lz.modules.app.enums.ResultRecordStatusEnum; import com.lz.modules.app.enums.RoleEnums; +import com.lz.modules.app.model.TaskModel; import com.lz.modules.app.resp.Step; import com.lz.modules.app.service.DepartmentsService; import com.lz.modules.app.service.DepartmentsStaffRelateService; @@ -315,4 +316,19 @@ public class TestController { return R.error(e.getMessage()); } } + + + + // http://localhost:8080/lz_management/test/task/comment?taskId=1&content=xxx&staffId=294 + @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); + } + } diff --git a/src/main/java/com/lz/modules/app/dto/TaskCommentDto.java b/src/main/java/com/lz/modules/app/dto/TaskCommentDto.java new file mode 100644 index 00000000..8c35321f --- /dev/null +++ b/src/main/java/com/lz/modules/app/dto/TaskCommentDto.java @@ -0,0 +1,8 @@ +package com.lz.modules.app.dto; + +import com.lz.modules.performance.entity.TaskComment; +import lombok.Data; + +@Data +public class TaskCommentDto extends TaskComment { +} diff --git a/src/main/java/com/lz/modules/app/model/TaskModel.java b/src/main/java/com/lz/modules/app/model/TaskModel.java new file mode 100644 index 00000000..4097980e --- /dev/null +++ b/src/main/java/com/lz/modules/app/model/TaskModel.java @@ -0,0 +1,14 @@ +package com.lz.modules.app.model; + + +import lombok.Data; + +@Data +public class TaskModel { + private int currPage = 1; + private int pageSize = 10; + private Long taskId; + private Long detailId; + private String content; + private Long staffId; +} diff --git a/src/main/java/com/lz/modules/flow/service/StaffRoleService.java b/src/main/java/com/lz/modules/flow/service/StaffRoleService.java index 26bde5a1..496a59a6 100644 --- a/src/main/java/com/lz/modules/flow/service/StaffRoleService.java +++ b/src/main/java/com/lz/modules/flow/service/StaffRoleService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; import com.lz.modules.app.model.RoleModel; +import com.lz.modules.app.model.TaskModel; import com.lz.modules.flow.entity.StaffRole; import com.lz.modules.sys.entity.SysMenuEntity; import com.lz.modules.sys.entity.SysRoleEntity; @@ -76,4 +77,7 @@ public interface StaffRoleService extends IService { StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long loginUserId, List asList); + R taskComment(TaskModel roleModel); + + R commentList(TaskModel taskModel); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java index 02b35589..52a70d59 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java @@ -9,10 +9,7 @@ import com.lz.common.utils.R; import com.lz.common.utils.StringUtil; import com.lz.modules.app.dao.DepartmentsDao; import com.lz.modules.app.dao.StaffDao; -import com.lz.modules.app.dto.EvaluationGroupInfo; -import com.lz.modules.app.dto.StaffRoleDetailInfo; -import com.lz.modules.app.dto.StaffRoleInfo; -import com.lz.modules.app.dto.StaffRoleResp; +import com.lz.modules.app.dto.*; import com.lz.modules.app.entity.DepartmentsEntity; import com.lz.modules.app.entity.DepartmentsStaffRelateEntity; import com.lz.modules.app.entity.StaffEntity; @@ -21,6 +18,7 @@ import com.lz.modules.app.enums.EvaluationGroupEnums; import com.lz.modules.app.enums.RoleEnums; import com.lz.modules.app.enums.RoleMenuEnums; import com.lz.modules.app.model.RoleModel; +import com.lz.modules.app.model.TaskModel; import com.lz.modules.app.service.DepartmentsService; import com.lz.modules.app.service.DepartmentsStaffRelateService; import com.lz.modules.flow.dao.RecordRoleMapper; @@ -28,8 +26,16 @@ import com.lz.modules.flow.dao.StaffRoleDepartmentMapper; import com.lz.modules.flow.dao.StaffRoleMapper; import com.lz.modules.flow.entity.*; import com.lz.modules.flow.service.*; +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.service.ResultTaskService; +import com.lz.modules.performance.service.TaskCommentService; import com.lz.modules.sys.entity.SysMenuEntity; import com.lz.modules.sys.entity.SysRoleEntity; +import com.lz.modules.sys.entity.app.ResultDetail; +import com.lz.modules.sys.service.app.ResultDetailService; import com.lz.modules.sys.service.app.ResultRecordService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; @@ -98,6 +104,21 @@ public class StaffRoleServiceImpl extends ServiceImpl getRoleByUserId(Long userId) { - Map map = new HashMap<>(); + Map map = new HashMap<>(); List staffRoleList = staffRoleMapper.selectAllByStaffId(userId); List staffMenus = new ArrayList<>(); - List commonStaffList= staffMenuService.selectByParentId( RoleMenuEnums.COMMON_STAFF.getType()); - if(CollectionUtils.isNotEmpty(commonStaffList)){ + List commonStaffList = staffMenuService.selectByParentId(RoleMenuEnums.COMMON_STAFF.getType()); + if (CollectionUtils.isNotEmpty(commonStaffList)) { staffMenus.addAll(commonStaffList); } DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(userId); - if(departmentsStaffRelateEntity !=null && new Integer(1).equals(departmentsStaffRelateEntity.getIsLeader())){ - List staffMenuDepartmentList= staffMenuService.selectByParentId( RoleMenuEnums.DEPARTMENT_PM.getType()); - if(CollectionUtils.isNotEmpty(staffMenuDepartmentList)){ + if (departmentsStaffRelateEntity != null && new Integer(1).equals(departmentsStaffRelateEntity.getIsLeader())) { + List staffMenuDepartmentList = staffMenuService.selectByParentId(RoleMenuEnums.DEPARTMENT_PM.getType()); + if (CollectionUtils.isNotEmpty(staffMenuDepartmentList)) { staffMenus.addAll(staffMenuDepartmentList); } } - if(CollectionUtils.isNotEmpty(staffRoleList)){ - for(StaffRole staffRole: staffRoleList){ - if(staffRole.getDepartmentLevel().equals(RoleEnums.MASTER_PM.getName())){ //如果是主管理员 - List staffMenuList= staffMenuService.selectByParentId( RoleMenuEnums.MASTER_PM.getType()); - if(CollectionUtils.isNotEmpty(staffMenuList)){ - staffMenus.addAll(staffMenuList); - } - }else{ - List staffMenuList = staffRoleMapper.selectAllMenus(staffRole.getStaffId()); - if(CollectionUtils.isNotEmpty(staffMenuList)){ - staffMenus.addAll(staffMenuList); - } - } - } + if (CollectionUtils.isNotEmpty(staffRoleList)) { + for (StaffRole staffRole : staffRoleList) { + if (staffRole.getDepartmentLevel().equals(RoleEnums.MASTER_PM.getName())) { //如果是主管理员 + List staffMenuList = staffMenuService.selectByParentId(RoleMenuEnums.MASTER_PM.getType()); + if (CollectionUtils.isNotEmpty(staffMenuList)) { + staffMenus.addAll(staffMenuList); + } + } else { + List staffMenuList = staffRoleMapper.selectAllMenus(staffRole.getStaffId()); + if (CollectionUtils.isNotEmpty(staffMenuList)) { + staffMenus.addAll(staffMenuList); + } + } + } } - if(CollectionUtils.isNotEmpty(staffMenus) && staffMenus.size() > 0 ){ + if (CollectionUtils.isNotEmpty(staffMenus) && staffMenus.size() > 0) { List authIds = new ArrayList<>(); - for(StaffMenu staffMenu:staffMenus){ - List ids = StringUtil.splitToLongList(staffMenu.getAuthIds(),","); + for (StaffMenu staffMenu : staffMenus) { + List ids = StringUtil.splitToLongList(staffMenu.getAuthIds(), ","); authIds.addAll(ids); } - if(authIds.size() > 0){ + if (authIds.size() > 0) { map = recordAuthService.selectAuthByIds(authIds); } } @@ -550,11 +571,11 @@ public class StaffRoleServiceImpl extends ServiceImpl selectMastRoles(){ + public List selectMastRoles() { return staffRoleMapper.selectMastRoles(); } @Override - public List selectAllGroupManageRoles(){ + public List selectAllGroupManageRoles() { return staffRoleMapper.selectAllGroupManageRoles(); } @Override - public List selectByEvaluationGroupId(Long groupId){ + public List selectByEvaluationGroupId(Long groupId) { return staffRoleMapper.selectByEvaluationGroupId(groupId); } @Override - public StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long staffId, List departmentLevels) { + public StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long staffId, List departmentLevels) { + + return staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(staffId, departmentLevels); + } + + @Override + public R taskComment(TaskModel roleModel) { + if (roleModel.getDetailId() == null && roleModel.getTaskId() == null) { + return R.error("detailId和taskId不能同时为空"); + } + TaskComment taskComment = new TaskComment(); + taskComment.setContent(roleModel.getContent()); + taskComment.setTaskId(roleModel.getTaskId()); + if (roleModel.getTaskId() != null) { + ResultTask resultTask = resultTaskService.selectResultTaskById(roleModel.getTaskId()); + taskComment.setDetailId(resultTask.getDetailId()); + taskComment.setType(1); + } else { + taskComment.setDetailId(roleModel.getDetailId()); + taskComment.setType(0);// + } + ResultDetail resultDetail = resultDetailService.selectResultDetailById(taskComment.getDetailId()); + taskComment.setResultRecordId(resultDetail.getRecordId()); + StaffEntity staffEntity = staffDao.selectStaffById(roleModel.getStaffId()); + if (staffEntity != null) { + taskComment.setStaffId(staffEntity.getId()); + taskComment.setStaffName(staffEntity.getName()); + } + taskCommentService.insertTaskComment(taskComment); + dingtalkBusiness.sendTaskNoticeMsg(taskComment.getDetailId(), taskComment.getTaskId()); + return R.ok(); + } + + @Override + public R commentList(TaskModel taskModel) { + PageUtils pageUtils = PageUtils.startPage(taskModel.getCurrPage(), taskModel.getPageSize()).doSelect( + page -> taskCommentMapper.selectByCondition(page, taskModel) + ); + List taskComments = pageUtils.getList(); + List taskCommentDtoList = new ArrayList<>(); + for (TaskComment taskComment : taskComments) { + TaskCommentDto taskCommentDto = new TaskCommentDto(); + BeanUtils.copyProperties(taskComment, taskCommentDto); + taskCommentDtoList.add(taskCommentDto); + } + pageUtils.setList(taskCommentDtoList); + return R.ok().put("data", pageUtils); - return staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(staffId,departmentLevels); } } diff --git a/src/main/java/com/lz/modules/performance/dao/TaskCommentMapper.java b/src/main/java/com/lz/modules/performance/dao/TaskCommentMapper.java index e114e577..0d7850d4 100644 --- a/src/main/java/com/lz/modules/performance/dao/TaskCommentMapper.java +++ b/src/main/java/com/lz/modules/performance/dao/TaskCommentMapper.java @@ -8,9 +8,14 @@ package com.lz.modules.performance.dao; * @since 2020-12-08 */ 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.entity.TaskComment; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + +import java.util.List; + @Mapper public interface TaskCommentMapper extends BaseMapper { @@ -31,4 +36,6 @@ public interface TaskCommentMapper extends BaseMapper { int deleteTaskCommensByTaskId(@Param("taskId") Long taskId); + + List selectByCondition(@Param("page") IPage page, @Param("taskModel") TaskModel taskModel); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java index d86528cc..2ffb981c 100644 --- a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java +++ b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java @@ -968,7 +968,11 @@ public class ResultRecordServiceImpl extends ServiceImpl flowRecords = flowRecordService.selectFlowRecordByRecordId(flowRecord.getRecordId()); + Long flowRecordId = approvalDto.getResultRecordId(); + if(flowRecord != null ){ + flowRecordId = flowRecord.getRecordId(); + } + List flowRecords = flowRecordService.selectFlowRecordByRecordId(flowRecordId); List flowRecordIds =new ArrayList<>(); boolean flag = false ; for(FlowRecord f: flowRecords){ @@ -978,9 +982,9 @@ public class ResultRecordServiceImpl extends ServiceImpl newflowRecords = flowRecordService.selectFlowRecordByRecordId(flowRecord.getRecordId()); + flowRecordService.deleteFlowRecordByRecordId(flowRecordId); + initFlowRecord(flowRecordId); + List newflowRecords = flowRecordService.selectFlowRecordByRecordId(flowRecordId); for(int i = 0 ;i < newflowRecords.size() ; i ++){ flowRecordService.updateFlowRecordIdById(newflowRecords.get(i).getId(),flowRecordIds.get(i)); if(flag ){ //如果录入己经走了,设置新的数据,结果录入己走 @@ -991,7 +995,7 @@ public class ResultRecordServiceImpl extends ServiceImpl - + @@ -95,11 +95,19 @@ + + + + update lz_task_comment set is_delete = 1 where id=#{id} limit 1 - + update lz_task_comment set is_delete = 1 where task_id=#{taskId}