管理组权限的限制,管理组保存的相关表修改
This commit is contained in:
parent
b0c35fcd57
commit
7c5d1aaa53
@ -9,6 +9,7 @@ package com.lz.modules.flow.dao;
|
||||
*/
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.app.dto.EvaluationGroupInfo;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import com.lz.modules.flow.entity.StaffRoleEvaluationGroup;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -39,4 +40,6 @@ public interface StaffRoleEvaluationGroupMapper extends BaseMapper<StaffRoleEval
|
||||
|
||||
|
||||
void deleteStaffRoleEvaluationGroupByRoleId(@Param("roleId") Long roleId);
|
||||
|
||||
List<StaffRoleEvaluationGroup> selectStaffRoleEvaluationsGroupByStaffRoles(@Param("list") List<StaffRole> staffRoles);
|
||||
}
|
||||
@ -58,4 +58,8 @@ public interface StaffRoleMapper extends BaseMapper<StaffRole> {
|
||||
List<StaffRole> selectAllByStaffId(@Param("staffId") Long staffId);
|
||||
|
||||
List<StaffMenu> selectAllMenus(@Param("userId") Long userId);
|
||||
|
||||
List<StaffRole> selectMastRoles();
|
||||
|
||||
List<StaffRole> selectAllGroupManageRoles();
|
||||
}
|
||||
@ -8,6 +8,7 @@ import com.lz.modules.flow.entity.EvaluationGroup;
|
||||
import com.lz.modules.flow.req.EvaluationGroupReq;
|
||||
import com.lz.modules.performance.dto.CheckStaffDto;
|
||||
import com.lz.modules.performance.req.CheckStaffReq;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -41,7 +42,7 @@ public interface EvaluationGroupService extends IService<EvaluationGroup> {
|
||||
List<String> selectAllStaffIdsByGroupId(Long id);
|
||||
|
||||
|
||||
PageUtils selectEvaluationGroupByReq(EvaluationGroupReq req);
|
||||
PageUtils selectEvaluationGroupByReq(EvaluationGroupReq req, SysUserEntity sysUserEntity);
|
||||
|
||||
List<EvaluationGroup> selectEvaluationGroupByIds(List<Long> ids);
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ package com.lz.modules.flow.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.modules.app.dto.EvaluationGroupInfo;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import com.lz.modules.flow.entity.StaffRoleEvaluationGroup;
|
||||
|
||||
import java.util.List;
|
||||
@ -38,4 +39,6 @@ public interface StaffRoleEvaluationGroupService extends IService<StaffRoleEvalu
|
||||
List<EvaluationGroupInfo> selectStaffRoleEvaluationGroupBy(Long id);
|
||||
|
||||
void deleteStaffRoleEvaluationGroupByRoleId(Long roleId);
|
||||
|
||||
List<StaffRoleEvaluationGroup> selectStaffRoleEvaluationsGroupByStaffRoles(List<StaffRole> staffRoles);
|
||||
}
|
||||
@ -65,4 +65,9 @@ public interface StaffRoleService extends IService<StaffRole> {
|
||||
List<StaffRole> selectAllByStaffId(Long userId);
|
||||
|
||||
Map<String, Integer> getRoleByUserId(Long userId);
|
||||
|
||||
//获取主管理员
|
||||
List<StaffRole> selectMastRoles();
|
||||
//获取管理全部考评组
|
||||
List<StaffRole> selectAllGroupManageRoles();
|
||||
}
|
||||
@ -19,11 +19,16 @@ import com.lz.modules.flow.dao.EvaluationGroupMapper;
|
||||
import com.lz.modules.flow.dao.EvaluationStartStaffMapper;
|
||||
import com.lz.modules.flow.entity.EvaluationGroup;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import com.lz.modules.flow.entity.StaffRoleEvaluationGroup;
|
||||
import com.lz.modules.flow.req.EvaluationGroupReq;
|
||||
import com.lz.modules.flow.service.EvaluationGroupService;
|
||||
import com.lz.modules.flow.service.FlowStartService;
|
||||
import com.lz.modules.flow.service.StaffRoleEvaluationGroupService;
|
||||
import com.lz.modules.flow.service.StaffRoleService;
|
||||
import com.lz.modules.performance.dto.CheckStaffDto;
|
||||
import com.lz.modules.performance.req.CheckStaffReq;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@ -71,6 +76,12 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
@Autowired
|
||||
private EvaluationStartStaffMapper evaluationStartStaffMapper;
|
||||
|
||||
@Autowired
|
||||
private StaffRoleService staffRoleService;
|
||||
|
||||
@Autowired
|
||||
private StaffRoleEvaluationGroupService staffRoleEvaluationGroupService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@ -108,9 +119,9 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils selectEvaluationGroupByReq(EvaluationGroupReq req){
|
||||
public PageUtils selectEvaluationGroupByReq(EvaluationGroupReq req, SysUserEntity sysUserEntity){
|
||||
List<Long> gIds = null;
|
||||
if(req.getStartId() != null){
|
||||
if(req.getStartId() != null){//发起评分时调用,传发起的id
|
||||
FlowStart flowStart = flowStartService.selectFlowStartById(req.getStartId());
|
||||
if(flowStart == null){
|
||||
return null;
|
||||
@ -123,6 +134,27 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}else{
|
||||
//考评组管理
|
||||
List<StaffRole> staffRoles = staffRoleService.selectAllByStaffId(sysUserEntity.getUserId());
|
||||
if(staffRoles.size() == 0){
|
||||
return null;
|
||||
}
|
||||
List<StaffRoleEvaluationGroup> staffRoleEvaluationGroups =
|
||||
staffRoleEvaluationGroupService.selectStaffRoleEvaluationsGroupByStaffRoles(staffRoles);
|
||||
if(staffRoleEvaluationGroups.size() == 0){
|
||||
return null;
|
||||
}
|
||||
gIds = new ArrayList<>();
|
||||
for (StaffRoleEvaluationGroup staffRoleEvaluationGroup:staffRoleEvaluationGroups
|
||||
) {
|
||||
if(staffRoleEvaluationGroup.getEvaluationGroupId().longValue() == 0l){//管理所有组
|
||||
gIds = null;
|
||||
break;
|
||||
}
|
||||
gIds.add(staffRoleEvaluationGroup.getEvaluationGroupId());//管理特定组
|
||||
|
||||
}
|
||||
}
|
||||
List<Long> finalGIds = gIds;
|
||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize())
|
||||
|
||||
@ -3,6 +3,7 @@ package com.lz.modules.flow.service.impl;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.modules.app.dto.EvaluationGroupInfo;
|
||||
import com.lz.modules.flow.dao.StaffRoleEvaluationGroupMapper;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import com.lz.modules.flow.entity.StaffRoleEvaluationGroup;
|
||||
import com.lz.modules.flow.service.StaffRoleEvaluationGroupService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -75,4 +76,9 @@ public class StaffRoleEvaluationGroupServiceImpl extends ServiceImpl<StaffRoleEv
|
||||
public List<Long> selectEvaluationGroupIdsByRoleId(Long roleId) {
|
||||
return staffRoleEvaluationGroupMapper.selectEvaluationGroupIdsByRoleId(roleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffRoleEvaluationGroup> selectStaffRoleEvaluationsGroupByStaffRoles(List<StaffRole> staffRoles){
|
||||
return staffRoleEvaluationGroupMapper.selectStaffRoleEvaluationsGroupByStaffRoles(staffRoles);
|
||||
}
|
||||
}
|
||||
|
||||
@ -532,4 +532,14 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
||||
}
|
||||
parent.setChilds(childs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffRole> selectMastRoles(){
|
||||
return staffRoleMapper.selectMastRoles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffRole> selectAllGroupManageRoles(){
|
||||
return staffRoleMapper.selectAllGroupManageRoles();
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,14 +8,13 @@ import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dto.DepartmentsSimpleDto;
|
||||
import com.lz.modules.app.dto.StaffSimpleDto;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.entity.EvaluationGroup;
|
||||
import com.lz.modules.flow.entity.FlowManager;
|
||||
import com.lz.modules.flow.entity.ResultModel;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import com.lz.modules.flow.entity.*;
|
||||
import com.lz.modules.flow.model.EvaluationGroupDto;
|
||||
import com.lz.modules.flow.req.EvaluationGroupReq;
|
||||
import com.lz.modules.flow.service.*;
|
||||
import com.lz.modules.performance.req.CheckStaffReq;
|
||||
import com.lz.modules.sys.controller.AbstractController;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -28,7 +27,7 @@ import java.util.stream.Collectors;
|
||||
@RestController
|
||||
@RequestMapping("/evaluationGroup")
|
||||
@Api(tags="考评组")
|
||||
public class EvaluationGroupController {
|
||||
public class EvaluationGroupController extends AbstractController {
|
||||
|
||||
|
||||
@Autowired
|
||||
@ -47,6 +46,8 @@ public class EvaluationGroupController {
|
||||
|
||||
@Autowired
|
||||
private StaffRoleService staffRoleService;
|
||||
@Autowired
|
||||
private StaffRoleEvaluationGroupService staffRoleEvaluationGroupService;
|
||||
|
||||
|
||||
|
||||
@ -115,7 +116,8 @@ public class EvaluationGroupController {
|
||||
@ApiOperation("获取考评组列表")
|
||||
@ApiResponses({@ApiResponse(code=200,message = "成功", response=EvaluationGroup.class)})
|
||||
public R getGroups(@RequestBody @ApiParam EvaluationGroupReq req) {
|
||||
PageUtils pageUtils = evaluationGroupService.selectEvaluationGroupByReq(req);
|
||||
SysUserEntity sysUserEntity = getUser();
|
||||
PageUtils pageUtils = evaluationGroupService.selectEvaluationGroupByReq(req, sysUserEntity);
|
||||
return R.ok().put("data",pageUtils);
|
||||
}
|
||||
|
||||
@ -160,37 +162,44 @@ public class EvaluationGroupController {
|
||||
}
|
||||
//更新组管理员信息
|
||||
if(evaluationGroup.getManagerIds() != null && evaluationGroup.getManagerIds().length() > 0){
|
||||
List<Long> mIds = Arrays.stream(evaluationGroup.getManagerIds().split(",")).map(new Function<String, Long>() {
|
||||
Map<Long, Long> mapIds = Arrays.stream(evaluationGroup.getManagerIds().split(",")).map(new Function<String, Long>() {
|
||||
@Override
|
||||
public Long apply(String s) {
|
||||
return Long.parseLong(s);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
}).collect(Collectors.toMap(Long::longValue, Function.identity(), (e, replace) -> e));
|
||||
List<StaffRole> staffRoles = staffRoleService.selectMastRoles();//获取主绩效管理员
|
||||
for (StaffRole staffRole:staffRoles
|
||||
) {//去掉主管理员
|
||||
if(mapIds.containsKey(staffRole.getStaffId())){
|
||||
mapIds.remove(staffRole.getStaffId());
|
||||
}
|
||||
}
|
||||
//去掉管理全考评组
|
||||
staffRoles = staffRoleService.selectAllGroupManageRoles();
|
||||
for (StaffRole staffRole:staffRoles
|
||||
) {
|
||||
if(mapIds.containsKey(staffRole.getStaffId())){
|
||||
mapIds.remove(staffRole.getStaffId());
|
||||
}
|
||||
}
|
||||
if(mapIds.size() > 0){
|
||||
List<Long> ids = mapIds.values().stream().collect(Collectors.toList());
|
||||
staffRoles = staffRoleService.selectStaffRolesByStaffId(ids);
|
||||
|
||||
List<StaffRole> staffRoles = staffRoleService.selectByGroupId(evaluationGroup.getId());
|
||||
if(staffRoles.size() > 0){
|
||||
Map<Long, StaffRole> staffRoleMap =
|
||||
staffRoles.stream().collect(Collectors.toMap(StaffRole::getStaffId, Function.identity(), (e, repace) -> e));
|
||||
for(int i = 0; i < mIds.size();){
|
||||
Long l = mIds.get(i);
|
||||
if(staffRoleMap.containsKey(l)){
|
||||
mIds.remove(l);
|
||||
continue;
|
||||
if(staffRoles.size() > 0){
|
||||
List<StaffRoleEvaluationGroup> staffRoleEvaluationGroups = new ArrayList<>();
|
||||
for (StaffRole staffRole:staffRoles
|
||||
) {
|
||||
StaffRoleEvaluationGroup staffRoleEvaluationGroup = new StaffRoleEvaluationGroup();
|
||||
staffRoleEvaluationGroup.setRoleId(staffRole.getId());
|
||||
staffRoleEvaluationGroup.setEvaluationGroupId(evaluationGroup.getId());
|
||||
staffRoleEvaluationGroups.add(staffRoleEvaluationGroup);
|
||||
}
|
||||
i++;
|
||||
staffRoleEvaluationGroupService.saveBatch(staffRoleEvaluationGroups);
|
||||
}
|
||||
}
|
||||
if(mIds.size() > 0){
|
||||
staffRoles = new ArrayList<>();
|
||||
for (Long id:mIds
|
||||
) {
|
||||
StaffRole staffRole = new StaffRole();
|
||||
staffRole.setStaffId(id);
|
||||
staffRole.setEvaluationGroupId(evaluationGroup.getId());
|
||||
staffRoles.add(staffRole);
|
||||
}
|
||||
staffRoleService.saveBatch(staffRoles);
|
||||
}
|
||||
|
||||
}
|
||||
return R.ok().put("data", evaluationGroup);
|
||||
}
|
||||
|
||||
@ -97,5 +97,14 @@
|
||||
select evaluation_group_id from lz_staff_role_evaluation_group where is_delete = 0 and role_id = #{roleId} and is_select = 1
|
||||
</select>
|
||||
|
||||
<select id="selectStaffRoleEvaluationsGroupByStaffRoles" resultType="StaffRoleEvaluationGroup" >
|
||||
select * from lz_staff_role_evaluation_group where is_delete = 0 and
|
||||
id in (
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -170,6 +170,14 @@
|
||||
select id from lz_staff_role where staff_id = #{userId}))
|
||||
</select>
|
||||
|
||||
<select id="selectMastRoles" resultType="StaffRole" >
|
||||
select * from lz_staff_role where department_level='MASTER_PM' and is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="selectAllGroupManageRoles" resultType="StaffRole" >
|
||||
select role.* from lz_staff_role role join lz_staff_role_evaluation_group egroup on egroup.role_id = role.id where egroup.evaluation_group_id=0 and egroup.is_delete=0 and role.is_delete=0
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user