From e3de3fa4cd0e83ad5b96098fb1a5e83890849b67 Mon Sep 17 00:00:00 2001 From: wulin Date: Tue, 17 Nov 2020 11:29:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B6=85=E7=BA=A7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E6=97=A0=E6=B3=95=E7=AE=A1=E7=90=86=E7=BB=84?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/EvaluationGroupServiceImpl.java | 23 +++++----- .../service/impl/FlowStartServiceImpl.java | 20 +++------ .../job/business/DingtalkBusiness.java | 42 ++++++++++--------- 3 files changed, 40 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java index d8966a2f..3aa63b51 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java @@ -138,7 +138,7 @@ public class EvaluationGroupServiceImpl extends ServiceImpl staffRoles = staffRoleService.selectAllByStaffId(sysUserEntity.getUserId()); + List staffRoles = staffRoleService.selectAllByStaffId(sysUserEntity.getUserId());//一个人只会有一个 if(staffRoles.size() == 0){ log.info("非绩效管理员登录查询"); return null; @@ -149,17 +149,20 @@ public class EvaluationGroupServiceImpl extends ServiceImpl(); - for (StaffRoleEvaluationGroup staffRoleEvaluationGroup:staffRoleEvaluationGroups - ) { - if(staffRoleEvaluationGroup.getEvaluationGroupId().longValue() == 0l){//管理所有组 - gIds = null; - log.info("管理所有组"); - break; - } - gIds.add(staffRoleEvaluationGroup.getEvaluationGroupId());//管理特定组 + if(staffRoleEvaluationGroups.get(0).getEvaluationGroupId().longValue() != 0L){//管理指定考评组的 + gIds = new ArrayList<>(); + for (StaffRoleEvaluationGroup staffRoleEvaluationGroup:staffRoleEvaluationGroups + ) { + if(staffRoleEvaluationGroup.getEvaluationGroupId().longValue() == 0l){//管理所有组 + gIds = null; + log.info("管理所有组"); + break; + } + gIds.add(staffRoleEvaluationGroup.getEvaluationGroupId());//管理特定组 + } } + } List finalGIds = gIds; PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize()) 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 7dc9aa82..de58bfbc 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 @@ -248,7 +248,7 @@ public class FlowStartServiceImpl extends ServiceImpl> mustRole = new HashMap<>(); Map> selfMustRole = new HashMap<>(); - + List noticeStaff = new ArrayList<>(); for (int n = 0; n < evaluationGroups.size(); n++ ) { EvaluationGroup evaluationGroup = evaluationGroups.get(n); @@ -293,9 +293,12 @@ public class FlowStartServiceImpl extends ServiceImpl 0){ // resultDetailService.insertResultDetails(resultDetails); - } - - } evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs); return 0; @@ -507,7 +507,6 @@ public class FlowStartServiceImpl extends ServiceImpl 0){//模板里面有添加指标 for (ResultTagetLibDto libDto: modelDto.getTagetLibs()) { - - ResultDetail resultDetail = new ResultDetail(); resultDetail.setRecordId(resultRecord.getId()); resultDetail.setTarget(libDto.getName()); @@ -735,12 +729,8 @@ public class FlowStartServiceImpl extends ServiceImpl 0){ // resultDetailService.insertResultDetails(resultDetails); - } evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs); - //下面通知所有参与考核人员 - - //如果有下面通知所有管理人员 }else{ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚 log.info("初始化考核流程失败"); diff --git a/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java b/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java index 593d8ae1..01b724e6 100644 --- a/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java +++ b/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java @@ -237,29 +237,31 @@ public class DingtalkBusiness { public String sendWorkMSGWithAsyn(StaffSimpleInfo fromStaff, List toStaffids, int type) { - - if (toStaffids.get(0).getEmployeeId() == null || toStaffids.get(0).getEmployeeId().length() == 0) { - //查询第三方id - List ids = toStaffids.stream().map(new Function() { - @Override - public Long apply(StaffSimpleInfo staffSimpleInfo) { - return staffSimpleInfo.getId(); + if(toStaffids.size() > 0){ + if (toStaffids.get(0).getEmployeeId() == null || toStaffids.get(0).getEmployeeId().length() == 0) { + //查询第三方id + List ids = toStaffids.stream().map(new Function() { + @Override + public Long apply(StaffSimpleInfo staffSimpleInfo) { + return staffSimpleInfo.getId(); + } + }).collect(Collectors.toList()); + List staffSimpleInfos = staffService.selectStaffSimpleInfos(ids); + Map map = toStaffids.stream().collect(Collectors.toMap(StaffSimpleInfo::getId, e -> e)); + for (StaffSimpleInfo staff : staffSimpleInfos + ) { + StaffSimpleInfo staff1 = map.get(staff.getId()); + staff1.setEmployeeId(staff1.getEmployeeId()); } - }).collect(Collectors.toList()); - List staffSimpleInfos = staffService.selectStaffSimpleInfos(ids); - Map map = toStaffids.stream().collect(Collectors.toMap(StaffSimpleInfo::getId, e -> e)); - for (StaffSimpleInfo staff : staffSimpleInfos - ) { - StaffSimpleInfo staff1 = map.get(staff.getId()); - staff1.setEmployeeId(staff1.getEmployeeId()); } - } - WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type); + WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type); - ThreadSendMessage threadSendMessage = new ThreadSendMessage(fromStaff, toStaffids, workMsgTypeEnum, appid); - Thread thread = new Thread(threadSendMessage); - thread.start(); - return "OK"; + ThreadSendMessage threadSendMessage = new ThreadSendMessage(fromStaff, toStaffids, workMsgTypeEnum, appid); + Thread thread = new Thread(threadSendMessage); + thread.start(); + return "OK"; + } + return "error"; }