提交修改
This commit is contained in:
parent
f95c279483
commit
1adb43448b
@ -21,7 +21,6 @@ import com.lz.modules.app.model.RoleModel;
|
|||||||
import com.lz.modules.app.model.TaskModel;
|
import com.lz.modules.app.model.TaskModel;
|
||||||
import com.lz.modules.app.service.DepartmentsService;
|
import com.lz.modules.app.service.DepartmentsService;
|
||||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||||
import com.lz.modules.equipment.entity.model.FindEmployeeResModel;
|
|
||||||
import com.lz.modules.flow.dao.RecordRoleMapper;
|
import com.lz.modules.flow.dao.RecordRoleMapper;
|
||||||
import com.lz.modules.flow.dao.StaffRoleDepartmentMapper;
|
import com.lz.modules.flow.dao.StaffRoleDepartmentMapper;
|
||||||
import com.lz.modules.flow.dao.StaffRoleMapper;
|
import com.lz.modules.flow.dao.StaffRoleMapper;
|
||||||
@ -43,7 +42,6 @@ import org.apache.commons.collections.CollectionUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import sun.jvm.hotspot.oops.TypeArrayKlass;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -426,10 +424,10 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
|||||||
staffRole.setStaffName(staffEntity.getName());
|
staffRole.setStaffName(staffEntity.getName());
|
||||||
//如果当前子管理员修改成主管理员
|
//如果当前子管理员修改成主管理员
|
||||||
if (RoleEnums.MASTER_PM.getName().equals(roleModel.getDepartmentLevel())) {
|
if (RoleEnums.MASTER_PM.getName().equals(roleModel.getDepartmentLevel())) {
|
||||||
StaffRole data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(roleModel.getStaffId(), Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName()}));
|
StaffRole data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(roleModel.getStaffId(), Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName()}));
|
||||||
if(data !=null){
|
if (data != null) {
|
||||||
staffRoleMapper.deleteStaffRoleById(data.getId()); //删除子管理员
|
staffRoleMapper.deleteStaffRoleById(data.getId()); //删除子管理员
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
staffRoleMapper.updateStaffRoleById(staffRole);
|
staffRoleMapper.updateStaffRoleById(staffRole);
|
||||||
if (RoleEnums.BOSS.getName().equals(staffRole.getDepartmentLevel()) ||
|
if (RoleEnums.BOSS.getName().equals(staffRole.getDepartmentLevel()) ||
|
||||||
@ -437,11 +435,11 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
|||||||
return R.ok("更新成功");
|
return R.ok("更新成功");
|
||||||
}
|
}
|
||||||
} else if (roleModel.getStaffId() != null) { // 员工不为空,表示是新增数据
|
} else if (roleModel.getStaffId() != null) { // 员工不为空,表示是新增数据
|
||||||
StaffRole data = null;
|
StaffRole data = null;
|
||||||
if(RoleEnums.CHILD_PM.getName().equals(roleModel.getDepartmentLevel()) //如果是主管理员,或者是子管理员,主管理员和子管理员不能同时存在
|
if (RoleEnums.CHILD_PM.getName().equals(roleModel.getDepartmentLevel()) //如果是主管理员,或者是子管理员,主管理员和子管理员不能同时存在
|
||||||
|| RoleEnums.MASTER_PM.getName().equals(roleModel.getDepartmentLevel())){
|
|| RoleEnums.MASTER_PM.getName().equals(roleModel.getDepartmentLevel())) {
|
||||||
data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(roleModel.getStaffId(),
|
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 {
|
} else {
|
||||||
data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevel(roleModel.getStaffId(), roleModel.getDepartmentLevel());
|
data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevel(roleModel.getStaffId(), roleModel.getDepartmentLevel());
|
||||||
}
|
}
|
||||||
@ -466,11 +464,11 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
|||||||
} else if (RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) {
|
} else if (RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) {
|
||||||
insertPM(staffRole, RoleMenuEnums.MASTER_PM.getType(), staffEntity);
|
insertPM(staffRole, RoleMenuEnums.MASTER_PM.getType(), staffEntity);
|
||||||
} else if (RoleEnums.CHILD_PM.getName().equals(staffRole.getDepartmentLevel())) { //如果是子管理员
|
} else if (RoleEnums.CHILD_PM.getName().equals(staffRole.getDepartmentLevel())) { //如果是子管理员
|
||||||
if(new Long(0).equals(roleModel.getEvaluationGroupId())){//全部考评组
|
if (new Long(0).equals(roleModel.getEvaluationGroupId())) {//全部考评组
|
||||||
insertStaffRoleEvaluationGroup(staffRole.getId(),0l);
|
insertStaffRoleEvaluationGroup(staffRole.getId(), 0l);
|
||||||
}else{///部分考评组
|
} else {///部分考评组
|
||||||
for (Long evaluationGroupId : evaluationGroupInfoIds) {
|
for (Long evaluationGroupId : evaluationGroupInfoIds) {
|
||||||
insertStaffRoleEvaluationGroup(staffRole.getId(),evaluationGroupId);
|
insertStaffRoleEvaluationGroup(staffRole.getId(), evaluationGroupId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (roleModel.getDepartmentId().equals(DepartmentPMEnums.SELF_DEPARTMENT.getType().toString())) {//如果是自己所在部门
|
if (roleModel.getDepartmentId().equals(DepartmentPMEnums.SELF_DEPARTMENT.getType().toString())) {//如果是自己所在部门
|
||||||
@ -511,44 +509,44 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Integer> getRoleByUserId(Long userId) {
|
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<StaffRole> staffRoleList = staffRoleMapper.selectAllByStaffId(userId);
|
||||||
List<StaffMenu> staffMenus = new ArrayList<>();
|
List<StaffMenu> staffMenus = new ArrayList<>();
|
||||||
|
|
||||||
List<StaffMenu> commonStaffList= staffMenuService.selectByParentId( RoleMenuEnums.COMMON_STAFF.getType());
|
List<StaffMenu> commonStaffList = staffMenuService.selectByParentId(RoleMenuEnums.COMMON_STAFF.getType());
|
||||||
if(CollectionUtils.isNotEmpty(commonStaffList)){
|
if (CollectionUtils.isNotEmpty(commonStaffList)) {
|
||||||
staffMenus.addAll(commonStaffList);
|
staffMenus.addAll(commonStaffList);
|
||||||
}
|
}
|
||||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(userId);
|
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(userId);
|
||||||
if(departmentsStaffRelateEntity !=null && new Integer(1).equals(departmentsStaffRelateEntity.getIsLeader())){
|
if (departmentsStaffRelateEntity != null && new Integer(1).equals(departmentsStaffRelateEntity.getIsLeader())) {
|
||||||
List<StaffMenu> staffMenuDepartmentList= staffMenuService.selectByParentId( RoleMenuEnums.DEPARTMENT_PM.getType());
|
List<StaffMenu> staffMenuDepartmentList = staffMenuService.selectByParentId(RoleMenuEnums.DEPARTMENT_PM.getType());
|
||||||
if(CollectionUtils.isNotEmpty(staffMenuDepartmentList)){
|
if (CollectionUtils.isNotEmpty(staffMenuDepartmentList)) {
|
||||||
staffMenus.addAll(staffMenuDepartmentList);
|
staffMenus.addAll(staffMenuDepartmentList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CollectionUtils.isNotEmpty(staffRoleList)){
|
if (CollectionUtils.isNotEmpty(staffRoleList)) {
|
||||||
for(StaffRole staffRole: staffRoleList){
|
for (StaffRole staffRole : staffRoleList) {
|
||||||
if(staffRole.getDepartmentLevel().equals(RoleEnums.MASTER_PM.getName())){ //如果是主管理员
|
if (staffRole.getDepartmentLevel().equals(RoleEnums.MASTER_PM.getName())) { //如果是主管理员
|
||||||
List<StaffMenu> staffMenuList= staffMenuService.selectByParentId( RoleMenuEnums.MASTER_PM.getType());
|
List<StaffMenu> staffMenuList = staffMenuService.selectByParentId(RoleMenuEnums.MASTER_PM.getType());
|
||||||
if(CollectionUtils.isNotEmpty(staffMenuList)){
|
if (CollectionUtils.isNotEmpty(staffMenuList)) {
|
||||||
staffMenus.addAll(staffMenuList);
|
staffMenus.addAll(staffMenuList);
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
List<StaffMenu> staffMenuList = staffRoleMapper.selectAllMenus(staffRole.getStaffId());
|
List<StaffMenu> staffMenuList = staffRoleMapper.selectAllMenus(staffRole.getStaffId());
|
||||||
if(CollectionUtils.isNotEmpty(staffMenuList)){
|
if (CollectionUtils.isNotEmpty(staffMenuList)) {
|
||||||
staffMenus.addAll(staffMenuList);
|
staffMenus.addAll(staffMenuList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(CollectionUtils.isNotEmpty(staffMenus) && staffMenus.size() > 0 ){
|
if (CollectionUtils.isNotEmpty(staffMenus) && staffMenus.size() > 0) {
|
||||||
List<Long> authIds = new ArrayList<>();
|
List<Long> authIds = new ArrayList<>();
|
||||||
for(StaffMenu staffMenu:staffMenus){
|
for (StaffMenu staffMenu : staffMenus) {
|
||||||
List<Long> ids = StringUtil.splitToLongList(staffMenu.getAuthIds(),",");
|
List<Long> ids = StringUtil.splitToLongList(staffMenu.getAuthIds(), ",");
|
||||||
authIds.addAll(ids);
|
authIds.addAll(ids);
|
||||||
}
|
}
|
||||||
if(authIds.size() > 0){
|
if (authIds.size() > 0) {
|
||||||
map = recordAuthService.selectAuthByIds(authIds);
|
map = recordAuthService.selectAuthByIds(authIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -573,11 +571,11 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
|||||||
staffRoleMenuService.insertStaffRoleMenu(staffRoleMenu);
|
staffRoleMenuService.insertStaffRoleMenu(staffRoleMenu);
|
||||||
}
|
}
|
||||||
if (parentId.equals(RoleMenuEnums.MASTER_PM.getType())) { //如果是绩效管理员
|
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 staffRoleEvaluationGroup = new StaffRoleEvaluationGroup();
|
||||||
staffRoleEvaluationGroup.setRoleId(roleId);
|
staffRoleEvaluationGroup.setRoleId(roleId);
|
||||||
staffRoleEvaluationGroup.setEvaluationGroupId(evaluationGroupId);
|
staffRoleEvaluationGroup.setEvaluationGroupId(evaluationGroupId);
|
||||||
@ -598,52 +596,52 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StaffRole> selectMastRoles(){
|
public List<StaffRole> selectMastRoles() {
|
||||||
return staffRoleMapper.selectMastRoles();
|
return staffRoleMapper.selectMastRoles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StaffRole> selectAllGroupManageRoles(){
|
public List<StaffRole> selectAllGroupManageRoles() {
|
||||||
return staffRoleMapper.selectAllGroupManageRoles();
|
return staffRoleMapper.selectAllGroupManageRoles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StaffRole> selectByEvaluationGroupId(Long groupId){
|
public List<StaffRole> selectByEvaluationGroupId(Long groupId) {
|
||||||
return staffRoleMapper.selectByEvaluationGroupId(groupId);
|
return staffRoleMapper.selectByEvaluationGroupId(groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long staffId, List<String> departmentLevels) {
|
public StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long staffId, List<String> departmentLevels) {
|
||||||
|
|
||||||
return staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(staffId,departmentLevels);
|
return staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(staffId, departmentLevels);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R taskComment(TaskModel roleModel){
|
public R taskComment(TaskModel roleModel) {
|
||||||
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();
|
TaskComment taskComment = new TaskComment();
|
||||||
taskComment.setContent(roleModel.getContent());
|
taskComment.setContent(roleModel.getContent());
|
||||||
taskComment.setTaskId(roleModel.getTaskId());
|
taskComment.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());
|
taskComment.setDetailId(resultTask.getDetailId());
|
||||||
taskComment.setType(1);
|
taskComment.setType(1);
|
||||||
}else{
|
} else {
|
||||||
taskComment.setDetailId(roleModel.getDetailId());
|
taskComment.setDetailId(roleModel.getDetailId());
|
||||||
taskComment.setType(0);//
|
taskComment.setType(0);//
|
||||||
}
|
}
|
||||||
ResultDetail resultDetail =resultDetailService.selectResultDetailById(taskComment.getDetailId());
|
ResultDetail resultDetail = resultDetailService.selectResultDetailById(taskComment.getDetailId());
|
||||||
taskComment.setResultRecordId(resultDetail.getRecordId());
|
taskComment.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());
|
taskComment.setStaffId(staffEntity.getId());
|
||||||
taskComment.setStaffName(staffEntity.getName());
|
taskComment.setStaffName(staffEntity.getName());
|
||||||
}
|
}
|
||||||
taskCommentService.insertTaskComment(taskComment);
|
taskCommentService.insertTaskComment(taskComment);
|
||||||
dingtalkBusiness.sendTaskNoticeMsg(taskComment.getDetailId(),taskComment.getTaskId());
|
dingtalkBusiness.sendTaskNoticeMsg(taskComment.getDetailId(), taskComment.getTaskId());
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -654,9 +652,9 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
|||||||
);
|
);
|
||||||
List<TaskComment> taskComments = pageUtils.getList();
|
List<TaskComment> taskComments = pageUtils.getList();
|
||||||
List<TaskCommentDto> taskCommentDtoList = new ArrayList<>();
|
List<TaskCommentDto> taskCommentDtoList = new ArrayList<>();
|
||||||
for(TaskComment taskComment :taskComments){
|
for (TaskComment taskComment : taskComments) {
|
||||||
TaskCommentDto taskCommentDto = new TaskCommentDto();
|
TaskCommentDto taskCommentDto = new TaskCommentDto();
|
||||||
BeanUtils.copyProperties(taskComment,taskCommentDto);
|
BeanUtils.copyProperties(taskComment, taskCommentDto);
|
||||||
taskCommentDtoList.add(taskCommentDto);
|
taskCommentDtoList.add(taskCommentDto);
|
||||||
}
|
}
|
||||||
pageUtils.setList(taskCommentDtoList);
|
pageUtils.setList(taskCommentDtoList);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user