Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0

This commit is contained in:
杜建超 2020-11-10 17:40:25 +08:00
commit 93fdd183c9
12 changed files with 145 additions and 33 deletions

View File

@ -103,6 +103,9 @@ public class StaffRoleController {
if(staffRoleEvaluationGroup !=null){
staffRoleModel.setIsSelect(1);
}
if(new Long(0).equals(staffRole.getEvaluationGroupId())){ //如果是管理全部考评组则设置为1
staffRoleModel.setIsSelect(1);
}
if(staffRole.getDepartmentLevel().equals(RoleEnums.MASTER_PM.getName())){
staffRoleModel.setIsSelect(1);
}

View File

@ -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;
@ -40,5 +41,9 @@ public interface StaffRoleEvaluationGroupMapper extends BaseMapper<StaffRoleEval
void deleteStaffRoleEvaluationGroupByRoleId(@Param("roleId") Long roleId);
List<StaffRoleEvaluationGroup> selectStaffRoleEvaluationsGroupByStaffRoles(@Param("list") List<StaffRole> staffRoles);
StaffRoleEvaluationGroup selectEvaluationGroupIdsByRoleIdGroupId(@Param("roleId") Long roleId, @Param("groupId") Long groupId);
}

View File

@ -59,7 +59,11 @@ public interface StaffRoleMapper extends BaseMapper<StaffRole> {
List<StaffMenu> selectAllMenus(@Param("userId") Long userId);
List<StaffRole> selectMastRoles();
List<StaffRole> selectAllGroupManageRoles();
List<StaffRole> selectAllStaffRoleByDepartmentLevel(@Param("departmentLevels") List<String> departmentLevels);
StaffRole selectStaffRolesByStaffIdDepartmentLevelList(@Param("staffId") Long staffId, @Param("departmentLevels") List<String> departmentLevels);
}

View File

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

View File

@ -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;
@ -39,5 +40,9 @@ public interface StaffRoleEvaluationGroupService extends IService<StaffRoleEvalu
void deleteStaffRoleEvaluationGroupByRoleId(Long roleId);
List<StaffRoleEvaluationGroup> selectStaffRoleEvaluationsGroupByStaffRoles(List<StaffRole> staffRoles);
StaffRoleEvaluationGroup selectEvaluationGroupIdsByRoleIdGroupId(Long roleId, Long groupId);
}

View File

@ -65,6 +65,11 @@ public interface StaffRoleService extends IService<StaffRole> {
List<StaffRole> selectAllByStaffId(Long userId);
Map<String, Integer> getRoleByUserId(Long userId);
//获取主管理员
List<StaffRole> selectMastRoles();
//获取管理全部考评组
List<StaffRole> selectAllGroupManageRoles();
List<StaffRole> selectAllStaffRoleByDepartmentLevel(List<String> asList);
List<StaffRole> selectByEvaluationGroupId(Long id);
}

View File

@ -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,30 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
}
})
.collect(Collectors.toList());
}else{
//考评组管理
List<StaffRole> staffRoles = staffRoleService.selectAllByStaffId(sysUserEntity.getUserId());
if(staffRoles.size() == 0){
log.info("非绩效管理员登录查询");
return null;
}
List<StaffRoleEvaluationGroup> staffRoleEvaluationGroups =
staffRoleEvaluationGroupService.selectStaffRoleEvaluationsGroupByStaffRoles(staffRoles);
if(staffRoleEvaluationGroups.size() == 0){
log.info("查询的管理组为空");
return null;
}
gIds = new ArrayList<>();
for (StaffRoleEvaluationGroup staffRoleEvaluationGroup:staffRoleEvaluationGroups
) {
if(staffRoleEvaluationGroup.getEvaluationGroupId().longValue() == 0l){//管理所有组
gIds = null;
log.info("管理所有组");
break;
}
gIds.add(staffRoleEvaluationGroup.getEvaluationGroupId());//管理特定组
}
}
List<Long> finalGIds = gIds;
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize())

View File

@ -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;
@ -81,4 +82,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);
}
}

View File

@ -550,4 +550,19 @@ 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();
}
@Override
public List<StaffRole> selectByEvaluationGroupId(Long groupId){
return staffRoleMapper.selectByEvaluationGroupId(groupId);
}
}

View File

@ -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);
}
@ -133,6 +135,7 @@ public class EvaluationGroupController {
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = EvaluationGroup.class)})
public R save(@RequestBody @ApiParam EvaluationGroup evaluationGroup) {
EvaluationGroup evaluationGroup1 = evaluationGroupService.selectEvaluationGroupByName(evaluationGroup.getName());
List<StaffRole> staffRoles = null;
if(evaluationGroup.getId() != null && evaluationGroup.getId().intValue() > 0){
if(evaluationGroup1 == null || evaluationGroup1.getId().equals(evaluationGroup.getId())){
if(evaluationGroup.getDepIds() == null){
@ -148,6 +151,8 @@ public class EvaluationGroupController {
evaluationGroup.setOutIds("");
}
evaluationGroupService.updateEvaluationGroupById(evaluationGroup);
staffRoles = staffRoleService.selectByEvaluationGroupId(evaluationGroup.getId());//查询已经管理改组的管理员
}else {
return R.error("已经存在相同名称考核组");
}
@ -160,37 +165,49 @@ 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.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;
for (StaffRole staffRole:staffRoles
) {//去掉已经在管理本组的管理员
if(mapIds.containsKey(staffRole.getStaffId())){
mapIds.remove(staffRole.getStaffId());
}else{//删除管理的组信息
staffRoleEvaluationGroupService.deleteStaffRoleEvaluationGroupByRoleId(staffRole.getId());
}
}
//去掉管理全考评组
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);
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);
}

View File

@ -97,6 +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
role_id in (
<foreach collection="list" item="item" separator=",">
#{item.id}
</foreach>
)
</select>
<select id="selectEvaluationGroupIdsByRoleIdGroupId"
resultType="com.lz.modules.flow.entity.StaffRoleEvaluationGroup">
select * from lz_staff_role_evaluation_group where is_delete = 0 and role_id = #{roleId} and evaluation_group_id = #{groupId}

View File

@ -183,6 +183,14 @@
</foreach>
</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 * from lz_staff_role where evaluation_group_id=0 and is_delete=0 and is_delete=0
</select>
</mapper>