修复超级管理员无法管理组的问题

This commit is contained in:
wulin 2020-11-17 11:29:37 +08:00
parent 61d57a9292
commit e3de3fa4cd
3 changed files with 40 additions and 45 deletions

View File

@ -138,7 +138,7 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
.collect(Collectors.toList());
}else{
//考评组管理
List<StaffRole> staffRoles = staffRoleService.selectAllByStaffId(sysUserEntity.getUserId());
List<StaffRole> staffRoles = staffRoleService.selectAllByStaffId(sysUserEntity.getUserId());//一个人只会有一个
if(staffRoles.size() == 0){
log.info("非绩效管理员登录查询");
return null;
@ -149,17 +149,20 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
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());//管理特定组
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<Long> finalGIds = gIds;
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize())

View File

@ -248,7 +248,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
Map<Long, List<FlowChartRole>> mustRole = new HashMap<>();
Map<Long, List<FlowChartRole>> selfMustRole = new HashMap<>();
List<StaffSimpleInfo> 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<FlowStartMapper, FlowStart
return R.error(evaluationGroup.getName() + "——没有设置绩效管理人员");
case 5:
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
case 0:
noticeStaff.addAll(staffIds);
break;
}
dingtalkBusiness.sendWorkMSGWithAsyn(staffIds, WorkMsgTypeEnum.START_WORK.getType());
}
dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
return R.ok("发起成功").put("data", flowStart);
}
//isInsert表示是否中途加人
@ -474,10 +477,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
if(resultDetails.size() > 0){
//
resultDetailService.insertResultDetails(resultDetails);
}
}
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
return 0;
@ -507,7 +507,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
mustRole.put(flow.getChartId(), flowChartRoles);
}
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的
String roles = null;
@ -522,8 +521,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
for (String id:optIds
) {
@ -613,7 +610,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
evaluationStartStaff.setType(CheckStaffType.STAFF.getCode());
evaluationStartStaffs.add(evaluationStartStaff);
//初始化lz_result_records数据
ResultRecord resultRecord = new ResultRecord();
resultRecord.setDepartmentId(staffInfo.getDepartmentId());
@ -715,8 +711,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
if(modelDto.getTagetLibs() != null && modelDto.getTagetLibs().size() > 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<FlowStartMapper, FlowStart
if(resultDetails.size() > 0){
//
resultDetailService.insertResultDetails(resultDetails);
}
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
//下面通知所有参与考核人员
//如果有下面通知所有管理人员
}else{
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("初始化考核流程失败");

View File

@ -237,29 +237,31 @@ public class DingtalkBusiness {
public String sendWorkMSGWithAsyn(StaffSimpleInfo fromStaff, List<StaffSimpleInfo> toStaffids, int type) {
if (toStaffids.get(0).getEmployeeId() == null || toStaffids.get(0).getEmployeeId().length() == 0) {
//查询第三方id
List<Long> ids = toStaffids.stream().map(new Function<StaffSimpleInfo, Long>() {
@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<Long> ids = toStaffids.stream().map(new Function<StaffSimpleInfo, Long>() {
@Override
public Long apply(StaffSimpleInfo staffSimpleInfo) {
return staffSimpleInfo.getId();
}
}).collect(Collectors.toList());
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(ids);
Map<Long, StaffSimpleInfo> 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<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(ids);
Map<Long, StaffSimpleInfo> 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";
}