diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java index 0b932a69..2b11e14f 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -1033,7 +1033,7 @@ public class ResultRecordController extends AbstractController { * * 删除 */ - // http://localhost:8080/lz_management/user/lzresultrecord/new/resultRecordDetail?resultRecordId=387&loginUserId=380 + // http://localhost:8080/lz_management/user/lzresultrecord/new/resultRecordDetail?resultRecordId=491&loginUserId=408 @RequestMapping("/new/resultRecordDetail") public R newResultRecordList(RecordDetailDto recordDetailDto) { if(recordDetailDto.getLoginUserId() ==null && getUser() !=null ){ diff --git a/src/main/java/com/lz/modules/app/controller/TestController.java b/src/main/java/com/lz/modules/app/controller/TestController.java index a2694f2b..6d1f2fa5 100644 --- a/src/main/java/com/lz/modules/app/controller/TestController.java +++ b/src/main/java/com/lz/modules/app/controller/TestController.java @@ -261,7 +261,7 @@ public class TestController { } } - // http://localhost:8080/lz_management/test/resultrecord?resultRecordId=415 + // http://localhost:8080/lz_management/test/resultrecord?resultRecordId=475 @RequestMapping("/test/resultrecord") public void resultRecorcd(Long resultRecordId) throws Exception{ R r = resultRecordService.initFlowRecord(resultRecordId); diff --git a/src/main/java/com/lz/modules/app/resp/FlowDetailResp.java b/src/main/java/com/lz/modules/app/resp/FlowDetailResp.java index bdfbe2aa..7457bcf4 100644 --- a/src/main/java/com/lz/modules/app/resp/FlowDetailResp.java +++ b/src/main/java/com/lz/modules/app/resp/FlowDetailResp.java @@ -10,5 +10,6 @@ public class FlowDetailResp { private String departName; private String avatar; private int status ; - + private int transfer; + private int tiaozhuang; } diff --git a/src/main/java/com/lz/modules/flow/dao/FlowChartMapper.java b/src/main/java/com/lz/modules/flow/dao/FlowChartMapper.java index 4dbb61ea..110deb97 100644 --- a/src/main/java/com/lz/modules/flow/dao/FlowChartMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/FlowChartMapper.java @@ -43,4 +43,5 @@ public interface FlowChartMapper extends BaseMapper { List selectFlowChartsByGroupId(Long groupId); + List selectCanSetChartRoleByChartId(Long id); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/dao/ResultTagetLibMapper.java b/src/main/java/com/lz/modules/flow/dao/ResultTagetLibMapper.java index 3c7cae1c..5c3d8f1d 100644 --- a/src/main/java/com/lz/modules/flow/dao/ResultTagetLibMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/ResultTagetLibMapper.java @@ -37,7 +37,7 @@ public interface ResultTagetLibMapper extends BaseMapper { int deleteResultTagetLibById(@Param("id")Long id); - List selectResultTagetLibByModelId(Long id); + List selectResultTagetLibByModelId(Long id); List selectByCondition(@Param("page") IPage page, @Param("req") ResultTagetLibSearchReq req); diff --git a/src/main/java/com/lz/modules/flow/service/FlowChartService.java b/src/main/java/com/lz/modules/flow/service/FlowChartService.java index c3a3e84a..7ad4b0ab 100644 --- a/src/main/java/com/lz/modules/flow/service/FlowChartService.java +++ b/src/main/java/com/lz/modules/flow/service/FlowChartService.java @@ -41,4 +41,6 @@ public interface FlowChartService extends IService { List selectFlowChartDtoByFlowManagerId(Long id); List selectFlowChartsByGroupId(Long groupId); + + List selectCanSetChartRoleByChartId(Long id); } \ 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 2f7481bf..549f8f5a 100644 --- a/src/main/java/com/lz/modules/flow/service/StaffRoleService.java +++ b/src/main/java/com/lz/modules/flow/service/StaffRoleService.java @@ -69,7 +69,10 @@ public interface StaffRoleService extends IService { List selectMastRoles(); //获取管理全部考评组 List selectAllGroupManageRoles(); + List selectAllStaffRoleByDepartmentLevel(List asList); List selectByEvaluationGroupId(Long id); + + StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long loginUserId, List asList); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowChartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowChartServiceImpl.java index 57865106..d3539334 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowChartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowChartServiceImpl.java @@ -82,6 +82,12 @@ public class FlowChartServiceImpl extends ServiceImpl selectCanSetChartRoleByChartId(Long id) + { + return flowChartMapper.selectCanSetChartRoleByChartId(id); + } + } diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java index d1420cdd..230044e9 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java @@ -383,13 +383,26 @@ public class FlowStartServiceImpl extends ServiceImpl resultTagetLibDtos = resultTagetLibService.selectResultTagetLibDtoByModelId(modelDto.getId()); + modelDto.setTagetLibs(resultTagetLibDtos); + } + //以下代码没必要更新,因为这个拷贝分用不到。正确的对应关系清查看lz_evaluation_start_staff //evaluationGroup.setStaffIds(evaluationGroup.getStaffIds() + ","); List evaluationStartStaffs = new ArrayList<>(); + List resultDetails = new ArrayList(); //下面初始化参与人员 for (StaffSimpleInfo staffInfo:staffIds ) { @@ -423,9 +436,39 @@ public class FlowStartServiceImpl extends ServiceImpl 0){//模板里面有添加指标 + for (ResultTagetLibDto libDto: + modelDto.getTagetLibs()) { + + ResultDetail resultDetail = new ResultDetail(); + resultDetail.setRecordId(resultRecord.getId()); + resultDetail.setTarget(libDto.getName()); + resultDetail.setType(modelDto.getType()); + resultDetail.setKeyResult(libDto.getKeyResult()); + resultDetail.setCheckWeight(libDto.getWeight()); + resultDetail.setStaffId(staffInfo.getId()); + resultDetail.setPriority(libDto.getOrderBy()); + resultDetails.add(resultDetail); + } + } + } + + //如果有数据插入lz_result_detail表 + if(resultDetails.size() > 0){ + // + resultDetailService.insertResultDetails(resultDetails); + + } + + } evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs); return 0; diff --git a/src/main/java/com/lz/modules/flow/service/impl/ResultModelServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/ResultModelServiceImpl.java index 7c117d67..f40b8f43 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/ResultModelServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/ResultModelServiceImpl.java @@ -181,7 +181,7 @@ public class ResultModelServiceImpl extends ServiceImpl selectByEvaluationGroupId(Long groupId){ return staffRoleMapper.selectByEvaluationGroupId(groupId); } + + + @Override + public StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long staffId, List departmentLevels) { + + return staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(staffId,departmentLevels); + } } 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 2da9911f..7580c83a 100644 --- a/src/main/java/com/lz/modules/performance/controller/EvaluationGroupController.java +++ b/src/main/java/com/lz/modules/performance/controller/EvaluationGroupController.java @@ -171,15 +171,17 @@ public class EvaluationGroupController extends AbstractController { return Long.parseLong(s); } }).collect(Collectors.toMap(Long::longValue, Function.identity(), (e, replace) -> e)); + if(staffRoles != null && staffRoles.size() > 0){ + for (StaffRole staffRole:staffRoles + ) {//去掉已经在管理本组的管理员 + if(mapIds.containsKey(staffRole.getStaffId())){ + mapIds.remove(staffRole.getStaffId()); + }else{//删除管理的组信息 + staffRoleEvaluationGroupService.deleteStaffRoleEvaluationGroupByRoleId(staffRole.getId()); + } + } + } - for (StaffRole staffRole:staffRoles - ) {//去掉已经在管理本组的管理员 - if(mapIds.containsKey(staffRole.getStaffId())){ - mapIds.remove(staffRole.getStaffId()); - }else{//删除管理的组信息 - staffRoleEvaluationGroupService.deleteStaffRoleEvaluationGroupByRoleId(staffRole.getId()); - } - } //去掉管理全考评组 staffRoles = staffRoleService.selectAllGroupManageRoles(); diff --git a/src/main/java/com/lz/modules/performance/controller/FlowChartController.java b/src/main/java/com/lz/modules/performance/controller/FlowChartController.java index 2f066aba..063e2980 100644 --- a/src/main/java/com/lz/modules/performance/controller/FlowChartController.java +++ b/src/main/java/com/lz/modules/performance/controller/FlowChartController.java @@ -57,8 +57,8 @@ public class FlowChartController { List flowChartDtos = flowChartService.selectFlowChartDtoByFlowManagerId(flowManager.getId()); for (FlowChartDto dto:flowChartDtos ) { - List flowCharts = flowChartService.selectChartRoleByChartId(dto.getId()); - dto.setRoleDtos(flowCharts); + List flowChartRoles = flowChartService.selectCanSetChartRoleByChartId(dto.getId()); + dto.setRoleDtos(flowChartRoles); if(groupId > 0){ //获取节点已保存的数据 FlowChartDetailRecordListDto flowChartDetailRecordListDto = new FlowChartDetailRecordListDto(); diff --git a/src/main/java/com/lz/modules/performance/service/ResultTagetLibService.java b/src/main/java/com/lz/modules/performance/service/ResultTagetLibService.java index a0158ed0..b530a852 100644 --- a/src/main/java/com/lz/modules/performance/service/ResultTagetLibService.java +++ b/src/main/java/com/lz/modules/performance/service/ResultTagetLibService.java @@ -37,7 +37,7 @@ public interface ResultTagetLibService extends IService { int deleteResultTagetLibById(Long id); - List selectResultTagetLibByModelId(Long id); + List selectResultTagetLibByModelId(Long id); PageUtils selectResultTagetLibByReq(ResultTagetLibSearchReq req); diff --git a/src/main/java/com/lz/modules/performance/service/impl/ResultTagetLibServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/ResultTagetLibServiceImpl.java index 341f6aa2..50370d6b 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/ResultTagetLibServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/ResultTagetLibServiceImpl.java @@ -55,7 +55,7 @@ public class ResultTagetLibServiceImpl extends ServiceImpl resultTagetLibDtos = selectResultTagetLibByModelId(resultModel.getId()); + List resultTagetLibDtos = selectResultTagetLibDtoByModelId(resultModel.getId()); BigDecimal weight = BigDecimal.ZERO; for(int i = 0; i < resultTagetLibDtos.size(); i++){ ResultTagetLibDto dto = resultTagetLibDtos.get(i); @@ -92,7 +92,7 @@ public class ResultTagetLibServiceImpl extends ServiceImpl selectResultTagetLibByModelId(Long id){ + public List selectResultTagetLibByModelId(Long id){ return resultTagetLibMapper.selectResultTagetLibByModelId(id); } diff --git a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java index 8fc2225e..0a9f47e6 100644 --- a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java +++ b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java @@ -3,6 +3,7 @@ package com.lz.modules.sys.service.app.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Maps; import com.lz.common.emun.WorkMsgTypeEnum; import com.lz.common.exception.RRException; import com.lz.common.utils.*; @@ -1083,6 +1084,7 @@ public class ResultRecordServiceImpl extends ServiceImpl flowRecords = flowRecordService.selectFlowRecordByResultRecordId(recordDetailDto.getResultRecordId()); List flowRecordList = new ArrayList<>(); int flowIndex = -1; + ResultRecord resultRecord = resultRecordService.selectResultRecordById(recordDetailDto.getResultRecordId()); for (FlowRecord flowRecord : flowRecords) { if (flowRecord.getFlowIndex().equals(flowIndex)) { //表示有重复数据 FlowRecordResp lastResp = flowRecordList.get(flowRecordList.size() - 1); @@ -1094,7 +1096,7 @@ public class ResultRecordServiceImpl extends ServiceImpl flowDetailRespList = lastResp.getFlowDetailRespList(); - mySetFlowDetailRespList(flowDetailRespList, flowRecord); + mySetFlowDetailRespList(flowDetailRespList, flowRecord,recordDetailDto.getLoginUserId(),resultRecord.getStaffId()); for (FlowRecord mul : mulFlowRecord) { if (mul.getStatus().equals(FlowRecordStatusEnums.UN_TO_STATUS.getStatus())) { flag0 = true; @@ -1138,7 +1140,7 @@ public class ResultRecordServiceImpl extends ServiceImpl flowDetailRespList = new ArrayList<>(); - mySetFlowDetailRespList(flowDetailRespList,flowRecord); + mySetFlowDetailRespList(flowDetailRespList,flowRecord,recordDetailDto.getLoginUserId(),resultRecord.getStaffId()); resp.setFlowDetailRespList(flowDetailRespList); flowRecordList.add(resp); flowIndex = flowRecord.getFlowIndex(); @@ -1186,16 +1188,7 @@ public class ResultRecordServiceImpl extends ServiceImpl map = JSONObject.parseObject(currentResultRecord.getFlowStaffIdRole(),Map.class); - List roleIds = null; - for (Map.Entry entry : map.entrySet()) { - if(entry.getValue() !=null ){ - roleIds = JSON.parseArray(entry.getValue().toString(),Long.class); - } - } - if(roleIds !=null && roleIds.size() > 0){ - auth = recordAuthService.selectAuthByRoleIds(roleIds); - } + auth = getAuth(currentFlowRecord.getFlowStaffIdRole()); } } } @@ -1207,7 +1200,23 @@ public class ResultRecordServiceImpl extends ServiceImpl flowDetailRespList ,FlowRecord flowRecord){ + public Map getAuth(String flowStaffIdRole){ + Map auth = Maps.newHashMap(); + Map map = JSONObject.parseObject(flowStaffIdRole,Map.class); + List roleIds = null; + for (Map.Entry entry : map.entrySet()) { + if(entry.getValue() !=null ){ + roleIds = JSON.parseArray(entry.getValue().toString(),Long.class); + } + } + if(roleIds !=null && roleIds.size() > 0){ + auth = recordAuthService.selectAuthByRoleIds(roleIds); + } + return auth; + } + + + public void mySetFlowDetailRespList(List flowDetailRespList ,FlowRecord flowRecord,Long loginUserId,Long recordStaffId){ FlowDetailResp flowDetailResp = new FlowDetailResp(); flowDetailResp.setCurrentStaffId(flowRecord.getApprovalStaffId()); flowDetailResp.setStaffName(flowRecord.getApprovalStaffName()); @@ -1223,13 +1232,66 @@ public class ResultRecordServiceImpl extends ServiceImpl map = departmentsService.selectUserAllDepartmentIds(departmentsStaffRelateEntity.getDepartmentId()); + List staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId()); + for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) { + String departmentName = map.get(staffRoleDepartment.getDepartmentId()); + if (StringUtil.isNotBlank(departmentName)) { + flag = true; + break; + } + } + } + if(flag){ + log.info("当前 loginUserId : " + loginUserId + ",是管理员"); + position = 1;//表示当前是绩效管理员 + } + } + if(position == 0 && flowRecord.getApprovalStaffId().equals(loginUserId) && !loginUserId.equals(recordStaffId) ){ + log.info("当前 loginUserId : " + loginUserId + ",是审批节点人员"); + position = 2 ; + } + /** + * 1:绩效管理员进来 + * 1.1:转交 都有 + * 1.2:跳过都有 + * 2:审批节点人员 + * 2.1:转交根据初始化数据来确定自己所在节点的权限 + * 2.2:跳转都没有 + * 3:普通员工 + * 3.1:转交没有 + * 3.2:跳转没有 + */ + if(position == 1){ //如果是绩效管理员 + initTiaoZhuangZhuangJiao(flowDetailResp,1,1); + }else if (position == 2 ){ //如果是审批节点人员 + Map auth = getAuth(flowRecord.getFlowStaffIdRole()); + if(new Integer(1).equals(auth.get("transfer"))){ + flowDetailResp.setTransfer(1); + } + }//如果是普通员工,没有跳转和转交的权限 + }//如果流程节点己经走了,直接返回不可跳转,不可转交 flowDetailRespList.add(flowDetailResp); } + + + public void initTiaoZhuangZhuangJiao(FlowDetailResp flowDetailResp,int tiaoZhuang,int transfer){ + flowDetailResp.setTiaozhuang(tiaoZhuang); + flowDetailResp.setTransfer(transfer); + } + public StaffEntity getDepartmentStaff(Long staffId, int level) { DepartManagers departManagers = staffService.findLeader( staffId, level); List staffEntities = departManagers.getManagers(); diff --git a/src/main/resources/mapper/flow/FlowChartMapper.xml b/src/main/resources/mapper/flow/FlowChartMapper.xml index 7cf2e556..948bfa61 100644 --- a/src/main/resources/mapper/flow/FlowChartMapper.xml +++ b/src/main/resources/mapper/flow/FlowChartMapper.xml @@ -119,5 +119,11 @@ ) and is_delete=0 order by step_index asc + + diff --git a/src/main/resources/mapper/flow/ResultTagetLibMapper.xml b/src/main/resources/mapper/flow/ResultTagetLibMapper.xml index f4a1edd6..bf1fd63e 100644 --- a/src/main/resources/mapper/flow/ResultTagetLibMapper.xml +++ b/src/main/resources/mapper/flow/ResultTagetLibMapper.xml @@ -89,7 +89,7 @@ update lz_result_taget_lib set is_delete = 1 where id=#{id} limit 1 - select * from lz_result_taget_lib where model_id=#{id} and is_delete = 0 order by order_by desc