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-09 19:14:49 +08:00
commit 4673471145
10 changed files with 210 additions and 55 deletions

View File

@ -1455,4 +1455,12 @@ public class ResultRecordController extends AbstractController {
return R.ok();
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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 {
}

View File

@ -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;
}

View File

@ -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> {
StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long loginUserId, List<String> asList);
R taskComment(TaskModel roleModel);
R commentList(TaskModel taskModel);
}

View File

@ -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<StaffRoleMapper, StaffRole
private RecordAuthService recordAuthService;
@Autowired
private ResultTaskService resultTaskService;
@Autowired
private ResultDetailService resultDetailService;
@Autowired
private TaskCommentService taskCommentService;
@Autowired
private DingtalkBusiness dingtalkBusiness;
@Autowired
private TaskCommentMapper taskCommentMapper;
@Override
public StaffRole selectStaffRoleById(Long id) {
return staffRoleMapper.selectStaffRoleById(id);
@ -403,10 +424,10 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
staffRole.setStaffName(staffEntity.getName());
//如果当前子管理员修改成主管理员
if (RoleEnums.MASTER_PM.getName().equals(roleModel.getDepartmentLevel())) {
StaffRole data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(roleModel.getStaffId(), Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName()}));
if(data !=null){
staffRoleMapper.deleteStaffRoleById(data.getId()); //删除子管理员
}
StaffRole data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(roleModel.getStaffId(), Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName()}));
if (data != null) {
staffRoleMapper.deleteStaffRoleById(data.getId()); //删除子管理员
}
}
staffRoleMapper.updateStaffRoleById(staffRole);
if (RoleEnums.BOSS.getName().equals(staffRole.getDepartmentLevel()) ||
@ -414,11 +435,11 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
return R.ok("更新成功");
}
} else if (roleModel.getStaffId() != null) { // 员工不为空,表示是新增数据
StaffRole data = null;
if(RoleEnums.CHILD_PM.getName().equals(roleModel.getDepartmentLevel()) //如果是主管理员或者是子管理员主管理员和子管理员不能同时存在
|| RoleEnums.MASTER_PM.getName().equals(roleModel.getDepartmentLevel())){
StaffRole data = null;
if (RoleEnums.CHILD_PM.getName().equals(roleModel.getDepartmentLevel()) //如果是主管理员或者是子管理员主管理员和子管理员不能同时存在
|| RoleEnums.MASTER_PM.getName().equals(roleModel.getDepartmentLevel())) {
data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(roleModel.getStaffId(),
Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName(),RoleEnums.MASTER_PM.getName()}));
Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName(), RoleEnums.MASTER_PM.getName()}));
} else {
data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevel(roleModel.getStaffId(), roleModel.getDepartmentLevel());
}
@ -443,11 +464,11 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
} else if (RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) {
insertPM(staffRole, RoleMenuEnums.MASTER_PM.getType(), staffEntity);
} else if (RoleEnums.CHILD_PM.getName().equals(staffRole.getDepartmentLevel())) { //如果是子管理员
if(new Long(0).equals(roleModel.getEvaluationGroupId())){//全部考评组
insertStaffRoleEvaluationGroup(staffRole.getId(),0l);
}else{///部分考评组
if (new Long(0).equals(roleModel.getEvaluationGroupId())) {//全部考评组
insertStaffRoleEvaluationGroup(staffRole.getId(), 0l);
} else {///部分考评组
for (Long evaluationGroupId : evaluationGroupInfoIds) {
insertStaffRoleEvaluationGroup(staffRole.getId(),evaluationGroupId);
insertStaffRoleEvaluationGroup(staffRole.getId(), evaluationGroupId);
}
}
if (roleModel.getDepartmentId().equals(DepartmentPMEnums.SELF_DEPARTMENT.getType().toString())) {//如果是自己所在部门
@ -488,44 +509,44 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
@Override
public Map<String, Integer> getRoleByUserId(Long userId) {
Map<String ,Integer> map = new HashMap<>();
Map<String, Integer> map = new HashMap<>();
List<StaffRole> staffRoleList = staffRoleMapper.selectAllByStaffId(userId);
List<StaffMenu> staffMenus = new ArrayList<>();
List<StaffMenu> commonStaffList= staffMenuService.selectByParentId( RoleMenuEnums.COMMON_STAFF.getType());
if(CollectionUtils.isNotEmpty(commonStaffList)){
List<StaffMenu> 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<StaffMenu> staffMenuDepartmentList= staffMenuService.selectByParentId( RoleMenuEnums.DEPARTMENT_PM.getType());
if(CollectionUtils.isNotEmpty(staffMenuDepartmentList)){
if (departmentsStaffRelateEntity != null && new Integer(1).equals(departmentsStaffRelateEntity.getIsLeader())) {
List<StaffMenu> 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<StaffMenu> staffMenuList= staffMenuService.selectByParentId( RoleMenuEnums.MASTER_PM.getType());
if(CollectionUtils.isNotEmpty(staffMenuList)){
staffMenus.addAll(staffMenuList);
}
}else{
List<StaffMenu> 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<StaffMenu> staffMenuList = staffMenuService.selectByParentId(RoleMenuEnums.MASTER_PM.getType());
if (CollectionUtils.isNotEmpty(staffMenuList)) {
staffMenus.addAll(staffMenuList);
}
} else {
List<StaffMenu> 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<Long> authIds = new ArrayList<>();
for(StaffMenu staffMenu:staffMenus){
List<Long> ids = StringUtil.splitToLongList(staffMenu.getAuthIds(),",");
for (StaffMenu staffMenu : staffMenus) {
List<Long> 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<StaffRoleMapper, StaffRole
staffRoleMenuService.insertStaffRoleMenu(staffRoleMenu);
}
if (parentId.equals(RoleMenuEnums.MASTER_PM.getType())) { //如果是绩效管理员
insertStaffRoleEvaluationGroup(staffRole.getId(),0l);
insertStaffRoleEvaluationGroup(staffRole.getId(), 0l);
}
}
public void insertStaffRoleEvaluationGroup(Long roleId,Long evaluationGroupId){
public void insertStaffRoleEvaluationGroup(Long roleId, Long evaluationGroupId) {
StaffRoleEvaluationGroup staffRoleEvaluationGroup = new StaffRoleEvaluationGroup();
staffRoleEvaluationGroup.setRoleId(roleId);
staffRoleEvaluationGroup.setEvaluationGroupId(evaluationGroupId);
@ -575,24 +596,69 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
}
@Override
public List<StaffRole> selectMastRoles(){
public List<StaffRole> selectMastRoles() {
return staffRoleMapper.selectMastRoles();
}
@Override
public List<StaffRole> selectAllGroupManageRoles(){
public List<StaffRole> selectAllGroupManageRoles() {
return staffRoleMapper.selectAllGroupManageRoles();
}
@Override
public List<StaffRole> selectByEvaluationGroupId(Long groupId){
public List<StaffRole> selectByEvaluationGroupId(Long groupId) {
return staffRoleMapper.selectByEvaluationGroupId(groupId);
}
@Override
public StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long staffId, List<String> departmentLevels) {
public StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long staffId, List<String> 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<TaskComment> taskComments = pageUtils.getList();
List<TaskCommentDto> 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);
}
}

View File

@ -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<TaskComment> {
@ -31,4 +36,6 @@ public interface TaskCommentMapper extends BaseMapper<TaskComment> {
int deleteTaskCommensByTaskId(@Param("taskId") Long taskId);
List<TaskComment> selectByCondition(@Param("page") IPage page, @Param("taskModel") TaskModel taskModel);
}

View File

@ -968,7 +968,11 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
private R resetAll(ApprovalDto approvalDto) {
FlowRecord flowRecord = flowRecordService.selectFlowRecordById(approvalDto.getFlowRecordId());
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordId(flowRecord.getRecordId());
Long flowRecordId = approvalDto.getResultRecordId();
if(flowRecord != null ){
flowRecordId = flowRecord.getRecordId();
}
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordId(flowRecordId);
List<Long> flowRecordIds =new ArrayList<>();
boolean flag = false ;
for(FlowRecord f: flowRecords){
@ -978,9 +982,9 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
flag = true;
}
}
flowRecordService.deleteFlowRecordByRecordId(flowRecord.getRecordId());
initFlowRecord(flowRecord.getRecordId());
List<FlowRecord> newflowRecords = flowRecordService.selectFlowRecordByRecordId(flowRecord.getRecordId());
flowRecordService.deleteFlowRecordByRecordId(flowRecordId);
initFlowRecord(flowRecordId);
List<FlowRecord> 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<ResultRecordMapper, Res
}
}
}
resultRecordService.resetData(flowRecord.getRecordId(),approvalDto.getClearFlag());
resultRecordService.resetData(flowRecordId,approvalDto.getClearFlag());
return R.ok();
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.lz.modules.performance.daor.TaskCommentMapper">
<mapper namespace="com.lz.modules.performance.dao.TaskCommentMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.performance.entity.TaskComment">
@ -95,11 +95,19 @@
</update>
<select id="selectByCondition" resultType="com.lz.modules.performance.entity.TaskComment">
select * from lz_task_comment where is_delete = 0
and (detail_id = #{taskModel.detailId} or task_id=#{taskModel.taskId} )
order by id desc
</select>
<update id="deleteTaskCommentById" parameterType="java.lang.Long">
update lz_task_comment set is_delete = 1 where id=#{id} limit 1
</update>
<update id="deleteTaskCommentById" parameterType="java.lang.Long">
<update id="deleteTaskCommensByTaskId" parameterType="java.lang.Long">
update lz_task_comment set is_delete = 1 where task_id=#{taskId}
</update>