提交修改

This commit is contained in:
quyixiao 2020-08-27 18:25:15 +08:00
parent c5bb74ebc7
commit 2d3aecea81

View File

@ -363,19 +363,15 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
StaffEntity staff = staffService.selectStaffById(resultRecord.getStaffId());
int flowIndex = lastFlowRecord != null ? lastFlowRecord.getFlowIndex() + 1 : 1;
int index = getDepartmentLevelIndex(flows, flowIndex);
if (index < 0) { //表示流程己经结束
if (index < 0 || index >= approvalList.size()) { //表示流程己经结束
lastFlowRecord.setFlowName(mySelf.getName() + "-审批通过");
flowRecordService.updateCoverFlowRecordById(lastFlowRecord);
resultRecordService.updateFlowStaffIdRoleToNull(resultRecord.getId());// 更新用户权限
return R.ok("流程审批结束")
.put("from", staff)
.put("to", staff)
.put("type", WorkMsgTypeEnum.PASS);
}
FlowRecord flowRecord = new FlowRecord();
flowRecord.setRecordId(resultRecordId);
flowRecord.setRecordStaffId(resultRecord.getStaffId());
@ -383,35 +379,36 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
flowRecord.setFlowId(flowId);
String departmentLevel = approvalList.get(index);
flowRecord.setDepartmentLevel(departmentLevel);
StaffEntity approvalStaff = null;
List<StaffRoleDto> staffRoleDtos = new ArrayList<>();
Long roleId = flows.get(flowIndex - 1).getRoleId();
if (Constant.ME.equals(departmentLevel)) { //如果是自己
approvalStaff = staff; // 是自己进行审批
StaffRoleDto staffRoleDto = new StaffRoleDto(staff.getId(), flows.get(flowIndex - 1).getRoleId());
StaffRoleDto staffRoleDto = new StaffRoleDto(staff.getId(), roleId);
staffRoleDtos.add(staffRoleDto);
} else {
FlowDepartment flowD = staffEntityMap.get(departmentLevel);
if (flowD == null) {
List<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel);
for (StaffRole staffRole : staffRoles) {
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
Map<String, String> departmentIdMap = departmentsService.selectUserAllDepartmentIds(resultRecord.getDepartmentId());
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
String value = departmentIdMap.get(staffRoleDepartment.getDepartmentId());
if (StringUtil.isNotBlank(value)) {
StaffRoleDto staffRoleDto = new StaffRoleDto(staffRole.getStaffId(), TypeRoleDto.getRoleId(staffRole.getTypeRoleIds(), resultRecord.getType()));
StaffRoleDto staffRoleDto = new StaffRoleDto(staffRole.getStaffId(), roleId != null && roleId > 0 ? roleId :
TypeRoleDto.getRoleId(staffRole.getTypeRoleIds(), resultRecord.getType()));
staffRoleDtos.add(staffRoleDto);
}
}
}
if (staffRoleDtos.size() >= 1) { //表示只有一个审批的用户
approvalStaff = staffService.selectStaffById(staffRoleDtos.get(0).getStaffId());
}
} else {
approvalStaff = staffService.selectStaffById(flowD.getStaffId());
StaffRoleDto staffRoleDto = new StaffRoleDto(approvalStaff.getId(), flows.get(flowIndex - 1).getRoleId());
StaffRoleDto staffRoleDto = new StaffRoleDto(approvalStaff.getId(), roleId);
staffRoleDtos.add(staffRoleDto);
}
}