diff --git a/src/main/java/com/lz/config/ShiroConfig.java b/src/main/java/com/lz/config/ShiroConfig.java index 1fe3d0c6..7ea36211 100644 --- a/src/main/java/com/lz/config/ShiroConfig.java +++ b/src/main/java/com/lz/config/ShiroConfig.java @@ -54,6 +54,7 @@ public class ShiroConfig { filterMap.put("/file/**", "anon"); filterMap.put("/user/lzstaffrole/role/**", "anon"); filterMap.put("/user/lzresultrecord/**", "anon"); + filterMap.put("/user/lzstaffrole/listByGroupId/**", "anon"); filterMap.put("/test/**", "anon"); filterMap.put("/druid/**", "anon"); filterMap.put("/app/**", "anon"); 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 a368def7..17d6f218 100644 --- a/src/main/java/com/lz/modules/app/controller/StaffRoleController.java +++ b/src/main/java/com/lz/modules/app/controller/StaffRoleController.java @@ -8,6 +8,7 @@ import com.lz.common.utils.R; import com.lz.modules.app.entity.DepartmentsEntity; 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.resp.StaffRoleModel; import com.lz.modules.app.service.DepartmentsService; @@ -16,9 +17,11 @@ import com.lz.modules.app.service.StaffService; import com.lz.modules.flow.entity.RecordRole; import com.lz.modules.flow.entity.StaffRole; import com.lz.modules.flow.entity.StaffRoleDepartment; +import com.lz.modules.flow.entity.StaffRoleEvaluationGroup; import com.lz.modules.flow.req.StaffRoleRequest; 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.entity.SysMenuEntity; import com.lz.modules.sys.entity.SysRoleEntity; @@ -63,6 +66,8 @@ public class StaffRoleController { @Autowired private DepartmentsStaffRelateService departmentsStaffRelateService; +@Autowired + private StaffRoleEvaluationGroupService staffRoleEvaluationGroupService; /** * 列表 @@ -80,7 +85,7 @@ public class StaffRoleController { // http://localhost:8080/lz_management/user/lzstaffrole/listByGroupId?groupId=3 @ApiImplicitParam(name = "groupId",value = "组id",defaultValue = "1",required = true, dataType = "Long",paramType = "query") public R listByGroupId( Long groupId ) { - List staffRoleList = staffRoleService.selectByGroupId(groupId); + List staffRoleList = staffRoleService.selectAllStaffRoleByDepartmentLevel(Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName(),RoleEnums.CHILD_PM.getName()})); List staffRoles = new ArrayList<>(); for(StaffRole staffRole:staffRoleList){ StaffRoleModel staffRoleModel = new StaffRoleModel(); @@ -93,6 +98,14 @@ public class StaffRoleController { staffRoleModel.setStaffName(staffRoleModel.getStaffName() + " "+departmentsEntity.getDepartmentName()); } } + StaffRoleEvaluationGroup staffRoleEvaluationGroup = staffRoleEvaluationGroupService.selectEvaluationGroupIdsByRoleIdGroupId(staffRole.getId(),groupId); + staffRoleModel.setIsSelect(0); + if(staffRoleEvaluationGroup !=null){ + staffRoleModel.setIsSelect(1); + } + if(staffRole.getDepartmentLevel().equals(RoleEnums.MASTER_PM.getName())){ + staffRoleModel.setIsSelect(1); + } staffRoles.add(staffRoleModel); } return R.ok().put("data", staffRoles); @@ -185,7 +198,6 @@ public class StaffRoleController { } } } - if (req.getId() == null || req.getId() <= 0) { staffRoleService.insertStaffRole(staffRole); } else { diff --git a/src/main/java/com/lz/modules/app/resp/StaffRoleModel.java b/src/main/java/com/lz/modules/app/resp/StaffRoleModel.java index 9e060205..9b16b41e 100644 --- a/src/main/java/com/lz/modules/app/resp/StaffRoleModel.java +++ b/src/main/java/com/lz/modules/app/resp/StaffRoleModel.java @@ -21,10 +21,6 @@ public class StaffRoleModel { @ApiModelProperty(value = "组id", name = "evaluationGroupId") private Long evaluationGroupId; - - - - //是否是必选 @ApiModelProperty(value = "是否是必选,0不是必选,1必选", name = "isSelect") private Integer isSelect; diff --git a/src/main/java/com/lz/modules/flow/dao/StaffRoleEvaluationGroupMapper.java b/src/main/java/com/lz/modules/flow/dao/StaffRoleEvaluationGroupMapper.java index d5b65813..da7e356c 100644 --- a/src/main/java/com/lz/modules/flow/dao/StaffRoleEvaluationGroupMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/StaffRoleEvaluationGroupMapper.java @@ -41,5 +41,9 @@ public interface StaffRoleEvaluationGroupMapper extends BaseMapper selectStaffRoleEvaluationsGroupByStaffRoles(@Param("list") List staffRoles); + + StaffRoleEvaluationGroup selectEvaluationGroupIdsByRoleIdGroupId(@Param("roleId") Long roleId, @Param("groupId") Long groupId); + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/dao/StaffRoleMapper.java b/src/main/java/com/lz/modules/flow/dao/StaffRoleMapper.java index 063b87fa..6ef6647d 100644 --- a/src/main/java/com/lz/modules/flow/dao/StaffRoleMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/StaffRoleMapper.java @@ -62,4 +62,8 @@ public interface StaffRoleMapper extends BaseMapper { List selectMastRoles(); List selectAllGroupManageRoles(); + List selectAllStaffRoleByDepartmentLevel(@Param("departmentLevels") List departmentLevels); + + StaffRole selectStaffRolesByStaffIdDepartmentLevelList(@Param("staffId") Long staffId, @Param("departmentLevels") List departmentLevels); + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/StaffRoleEvaluationGroupService.java b/src/main/java/com/lz/modules/flow/service/StaffRoleEvaluationGroupService.java index b658a0d8..ee78e93d 100644 --- a/src/main/java/com/lz/modules/flow/service/StaffRoleEvaluationGroupService.java +++ b/src/main/java/com/lz/modules/flow/service/StaffRoleEvaluationGroupService.java @@ -40,5 +40,9 @@ public interface StaffRoleEvaluationGroupService extends IService selectStaffRoleEvaluationsGroupByStaffRoles(List staffRoles); + + StaffRoleEvaluationGroup selectEvaluationGroupIdsByRoleIdGroupId(Long roleId, Long groupId); + } \ No newline at end of file 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 c5abdd51..2f7481bf 100644 --- a/src/main/java/com/lz/modules/flow/service/StaffRoleService.java +++ b/src/main/java/com/lz/modules/flow/service/StaffRoleService.java @@ -65,9 +65,11 @@ public interface StaffRoleService extends IService { List selectAllByStaffId(Long userId); Map getRoleByUserId(Long userId); - //获取主管理员 List selectMastRoles(); //获取管理全部考评组 List selectAllGroupManageRoles(); + List selectAllStaffRoleByDepartmentLevel(List asList); + + List selectByEvaluationGroupId(Long id); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleEvaluationGroupServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleEvaluationGroupServiceImpl.java index fc754da4..9fd2b1ed 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleEvaluationGroupServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleEvaluationGroupServiceImpl.java @@ -72,7 +72,13 @@ public class StaffRoleEvaluationGroupServiceImpl extends ServiceImpl selectEvaluationGroupIdsByRoleId(Long roleId) { return staffRoleEvaluationGroupMapper.selectEvaluationGroupIdsByRoleId(roleId); } 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 3f1eb113..ad9a69b3 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 @@ -37,10 +37,8 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.lang.reflect.Array; +import java.util.*; import java.util.stream.Collectors; /** @@ -410,8 +408,15 @@ public class StaffRoleServiceImpl extends ServiceImpl selectAllStaffRoleByDepartmentLevel(List asList) { + + return staffRoleMapper.selectAllStaffRoleByDepartmentLevel(asList); + } + public void insertPM(StaffRole staffRole, Long parentId, StaffEntity staffEntity) { staffRole.setEvaluationGroupId(EvaluationGroupEnums.ALL.getType());//全部考评组 staffRole.setDepartmentId(DepartmentPMEnums.ALL.getType());//所有部门 @@ -515,13 +527,19 @@ public class StaffRoleServiceImpl extends ServiceImpl all) { List childs = new ArrayList<>(); for (StaffMenu child : all) { @@ -542,4 +560,9 @@ public class StaffRoleServiceImpl extends ServiceImpl selectAllGroupManageRoles(){ return staffRoleMapper.selectAllGroupManageRoles(); } + + @Override + public List selectByEvaluationGroupId(Long groupId){ + return staffRoleMapper.selectByEvaluationGroupId(groupId); + } } diff --git a/src/main/java/com/lz/modules/performance/controller/ChartController.java b/src/main/java/com/lz/modules/performance/controller/ChartController.java index 2ea6de62..062cb7a6 100644 --- a/src/main/java/com/lz/modules/performance/controller/ChartController.java +++ b/src/main/java/com/lz/modules/performance/controller/ChartController.java @@ -91,7 +91,7 @@ public class ChartController extends AbstractController{ - @RequestMapping("/own/result") + @PostMapping("/own/result") @ApiOperation("获取个人成长曲线") @ApiResponses({@ApiResponse(code = 200,message = "成功",response = OwnResultResp.class)}) public R ownResult(Long userId){ diff --git a/src/main/java/com/lz/modules/performance/controller/EvaluationGroupController.java b/src/main/java/com/lz/modules/performance/controller/EvaluationGroupController.java index 7faa4e36..87d91ca6 100644 --- a/src/main/java/com/lz/modules/performance/controller/EvaluationGroupController.java +++ b/src/main/java/com/lz/modules/performance/controller/EvaluationGroupController.java @@ -135,6 +135,7 @@ public class EvaluationGroupController extends AbstractController { @ApiResponses({@ApiResponse(code = 200, message = "成功", response = EvaluationGroup.class)}) public R save(@RequestBody @ApiParam EvaluationGroup evaluationGroup) { EvaluationGroup evaluationGroup1 = evaluationGroupService.selectEvaluationGroupByName(evaluationGroup.getName()); + List staffRoles = null; if(evaluationGroup.getId() != null && evaluationGroup.getId().intValue() > 0){ if(evaluationGroup1 == null || evaluationGroup1.getId().equals(evaluationGroup.getId())){ if(evaluationGroup.getDepIds() == null){ @@ -150,6 +151,8 @@ public class EvaluationGroupController extends AbstractController { evaluationGroup.setOutIds(""); } evaluationGroupService.updateEvaluationGroupById(evaluationGroup); + + staffRoles = staffRoleService.selectByEvaluationGroupId(evaluationGroup.getId());//查询已经管理改组的管理员 }else { return R.error("已经存在相同名称考核组"); } @@ -168,13 +171,16 @@ public class EvaluationGroupController extends AbstractController { return Long.parseLong(s); } }).collect(Collectors.toMap(Long::longValue, Function.identity(), (e, replace) -> e)); - List staffRoles = staffRoleService.selectMastRoles();//获取主绩效管理员 + 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 @@ -183,6 +189,8 @@ public class EvaluationGroupController extends AbstractController { mapIds.remove(staffRole.getStaffId()); } } + + if(mapIds.size() > 0){ List ids = mapIds.values().stream().collect(Collectors.toList()); staffRoles = staffRoleService.selectStaffRolesByStaffId(ids); diff --git a/src/main/java/com/lz/modules/performance/req/ChartResultReq.java b/src/main/java/com/lz/modules/performance/req/ChartResultReq.java index fa1941b9..bec1ffa5 100644 --- a/src/main/java/com/lz/modules/performance/req/ChartResultReq.java +++ b/src/main/java/com/lz/modules/performance/req/ChartResultReq.java @@ -21,7 +21,7 @@ public class ChartResultReq extends BasePage{ private Long startId; @ApiModelProperty(value = "等级",name = "scoreLevel") - private Long scoreLevel; + private String scoreLevel; private Long loginUserId; diff --git a/src/main/java/com/lz/modules/performance/res/ChartStatistical.java b/src/main/java/com/lz/modules/performance/res/ChartStatistical.java index 4e936326..3e2b5c35 100644 --- a/src/main/java/com/lz/modules/performance/res/ChartStatistical.java +++ b/src/main/java/com/lz/modules/performance/res/ChartStatistical.java @@ -21,5 +21,8 @@ public class ChartStatistical { @ApiModelProperty(value = "提示",name = "tip") private String tip; + @ApiModelProperty(value = "等级",name = "scoreLevel") + private String scoreLevel; + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/impl/AssessManagerServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/AssessManagerServiceImpl.java index 02ac4fc5..c8a901a2 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/AssessManagerServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/AssessManagerServiceImpl.java @@ -116,9 +116,15 @@ public class AssessManagerServiceImpl implements AssessManagerService { res.setCycleTime(name.substring(0,name.lastIndexOf("绩效考核"))); } //过滤非自己管理的人员 - int i = resultRecordMapper.countStartAndGroupNum(flowStart.getId(),mandepartmentIds); ResultRecord resultRecord = resultRecordMapper.selectOneByStartId(flowStart.getId()); - res.setJoinNum(resultRecord == null? StringUtil.EMPTY : resultRecord.getStaffName() + i + "等人"); + //没有管理的部门 + if(mandepartmentIds!=null && mandepartmentIds.size()==0){ + res.setJoinNum("0人"); + }else { + int i = resultRecordMapper.countStartAndGroupNum(flowStart.getId(),mandepartmentIds); + res.setJoinNum(resultRecord == null? StringUtil.EMPTY : resultRecord.getStaffName() + i + "等人"); + } + data.add(res); }); PageUtils pages = new PageUtils(); @@ -136,6 +142,12 @@ public class AssessManagerServiceImpl implements AssessManagerService { if(StringUtil.isNotBlank(req.getEvaluationIds())){ req.setCopyEvaluationIds(evaluationGroupService.getEvaluationCopyIdsByEvaluationIds(req.getEvaluationIds(),req.getStartId())); } + List mandepartmentIds = assessService.roleDepartments(req.getLoginUserId()); + //没有管理的部门 + if(mandepartmentIds!=null && mandepartmentIds.size()==0){ + return new PageUtils(); + } + req.setDepartmentIds(mandepartmentIds); PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect( page -> resultRecordMapper.selectAssessListByStartId(page,req) ); diff --git a/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java index a0329ee3..05b77272 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java @@ -9,6 +9,7 @@ import com.lz.common.utils.R; import com.lz.common.utils.StringUtil; import com.lz.modules.app.entity.DepartmentsEntity; import com.lz.modules.app.entity.DepartmentsStaffRelateEntity; +import com.lz.modules.app.entity.StaffEntity; import com.lz.modules.app.service.DepartmentsService; import com.lz.modules.app.service.DepartmentsStaffRelateService; import com.lz.modules.app.service.StaffService; @@ -38,6 +39,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; /** * @Author: djc @@ -93,6 +96,9 @@ public class ChartResultServiceImpl implements ChartResultService { } //自己管理的部门 List mandepartmentIds = assessService.roleDepartments(staffId); + if(mandepartmentIds!=null && mandepartmentIds.size()==0){ + return Lists.newArrayList(); + } List data = Lists.newArrayList(); ChartStatisticalRes res; @@ -120,24 +126,16 @@ public class ChartResultServiceImpl implements ChartResultService { data.add(res); //如果不是默认,获得发起考核信息 - if(flowStart == null){ - flowStart = flowStartMapper.selectFlowStartById(startId); - } - String[] split = flowStart.getGroupIds().split(","); - Set staffIds = new HashSet<>(); - for(String s:split){ - List strings = evaluationGroupService.selectAllStaffIdsByGroupId(Long.valueOf(s)); - staffIds.addAll(strings); - } - log.info("chartReport 所有人员:" + JSON.toJSONString(staffIds)); - //自己管理的和发起的人员交集 - List manstaffIds = staffService.staffsByAllDeparmentIds(mandepartmentIds); - log.info("chartReport 管理人员:" + JSON.toJSONString(manstaffIds)); - manstaffIds.retainAll(staffIds); - log.info("chartReport 交集人员:" + JSON.toJSONString(manstaffIds)); - List all = new ArrayList<>(manstaffIds); - List depstaff = this.countDepartmentAndStaffNum(all); + List objects = resultRecordService.listObjs(new QueryWrapper() + .eq("is_delete", 0) + .eq("start_id", startId) + .in(mandepartmentIds != null, "department_id", mandepartmentIds).select("staff_id")); + if(CollectionUtils.isEmpty(objects)){ + return data; + } + List collect = objects.stream().map(o -> String.valueOf(o)).collect(Collectors.toList()); + List depstaff = this.countDepartmentAndStaffNum(collect); res = new ChartStatisticalRes(); res.setType(2); res.setStatisticals(buildDepStaffs(depstaff)); @@ -187,12 +185,19 @@ public class ChartResultServiceImpl implements ChartResultService { //自己管理的和所有的部门交集 log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(allDeparmentIds)); List mandepartmentIds = assessService.roleDepartments(req.getLoginUserId()); - log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(mandepartmentIds)); - mandepartmentIds.retainAll(allDeparmentIds); + if(mandepartmentIds!=null ){ + if(mandepartmentIds.size()==0){ + return new PageUtils(); + } + log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(mandepartmentIds)); + mandepartmentIds.retainAll(allDeparmentIds); + if(mandepartmentIds.size()==0){ + return new PageUtils(); + } + } log.info("selectChartDetailList 交集部门:" + JSON.toJSONString(mandepartmentIds)); - List ids = staffService.staffsByAllDeparmentIds(mandepartmentIds); PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize()).doSelect( - page -> resultRecordMapper.selectChartDetailList(page,ids,req.getStartId(),req.getScoreLevel()) + page -> resultRecordMapper.selectChartDetailList(page,mandepartmentIds,req.getStartId(),req.getScoreLevel()) ); return pageUtils; } @@ -228,6 +233,9 @@ public class ChartResultServiceImpl implements ChartResultService { req.setCopyEvaluationIds(evaluationGroupService.getEvaluationCopyIdsByEvaluationIds(req.getEvaluationIds(),req.getStartId())); //获取自己管理的部门 List mandepartmentIds = assessService.roleDepartments(req.getLoginUserId()); + if(mandepartmentIds!=null && mandepartmentIds.size()==0){ + return Lists.newArrayList(); + } req.setDepartmentIds(mandepartmentIds); List process = resultRecordMapper.countAssessNumByFlowProcess(req); List data = buildProcess(process, req.getStartId(),mandepartmentIds,req); diff --git a/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java b/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java index 4b129a6c..8ecb0c30 100644 --- a/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java +++ b/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java @@ -79,7 +79,7 @@ public interface ResultRecordMapper extends BaseMapper { List countNumByScoreLevel(@Param("startId") Long startId,@Param("evaluationIds")List evaluationIds,@Param("departmentIds")List departmentIds); - List selectChartDetailList(@Param("page") IPage page, @Param("staffIds") List staffIds, @Param("startId")Long startId,@Param("scoreLevel")Long scoreLevel); + List selectChartDetailList(@Param("page") IPage page, @Param("departmentIds") List departmentIds, @Param("startId")Long startId,@Param("scoreLevel")String scoreLevel); int batchDeleteByStartId(@Param("startId")Long startId); diff --git a/src/main/resources/mapper/app/ResultRecordMapper.xml b/src/main/resources/mapper/app/ResultRecordMapper.xml index 5f0d2b69..c0c48620 100644 --- a/src/main/resources/mapper/app/ResultRecordMapper.xml +++ b/src/main/resources/mapper/app/ResultRecordMapper.xml @@ -379,7 +379,7 @@ + diff --git a/src/main/resources/mapper/flow/StaffRoleMapper.xml b/src/main/resources/mapper/flow/StaffRoleMapper.xml index 0f053b1a..19ea3969 100644 --- a/src/main/resources/mapper/flow/StaffRoleMapper.xml +++ b/src/main/resources/mapper/flow/StaffRoleMapper.xml @@ -91,7 +91,7 @@ - update lz_staff_role set is_delete = 1 where id=#{id} limit 1 + delete from lz_staff_role where id=#{id} limit 1 @@ -165,9 +165,22 @@ + + +