提交修改

This commit is contained in:
quyixiao 2020-11-13 15:18:36 +08:00
parent b37f63d2b5
commit 1279d9ebdd
2 changed files with 35 additions and 55 deletions

View File

@ -17,6 +17,4 @@ public class FlowRecordResp {
private List<FlowDetailResp> flowDetailRespList;
}

View File

@ -1094,6 +1094,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordId(recordDetailDto.getResultRecordId());
List<FlowRecordResp> flowRecordList = new ArrayList<>();
int flowIndex = -1;
Long flowRecordId= 0l;
ResultRecord resultRecord = resultRecordService.selectResultRecordById(recordDetailDto.getResultRecordId());
for (FlowRecord flowRecord : flowRecords) {
if (flowRecord.getFlowIndex().equals(flowIndex)) { //表示有重复数据
@ -1187,7 +1188,6 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
if( flowProcess <= 4 ){
auth.put("showScore",0);
}
FlowRecord currentResultRecord = null;
for(FlowRecord flowRecord:currentResultRecords){
if(flowRecord.getApprovalStaffId().equals(recordDetailDto.getLoginUserId())){
@ -1199,26 +1199,19 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
if(currentResultRecord !=null){
if(StringUtil.isNotBlank(currentResultRecord.getFlowStaffIdRole())){
auth = getAuth(currentFlowRecord.getFlowStaffIdRole());
flowRecordId = currentFlowRecord.getId();
}
}
}
for(FlowRecordResp flowRecordResp : flowRecordList){
List<FlowDetailResp> flowDetailResps = flowRecordResp.getFlowDetailRespList();
if(flowDetailResps !=null && flowDetailResps.size() ==1 && flowRecordResp.getRealStatus() == 2){
auth.put("transfer",flowDetailResps.get(0).getTransfer());
auth.put("tiaozhuang",0);
}
}
auth.put("tiaozhuang",0);
Map<String, Object> map = new HashMap<>();
map.put("flowRecordList", flowRecordList);
map.put("resultCommentList", resultCommentList);
map.put("auth",auth);
map.put("flowRecordId",flowRecordId);
return R.ok().put("data", map);
}
public Map<String,Integer> getAuth(String flowStaffIdRole){
Map<String,Integer> auth = Maps.newHashMap();
Map<String,Object> map = JSONObject.parseObject(flowStaffIdRole,Map.class);
@ -1253,60 +1246,49 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
DepartmentsEntity departmentsEntity = departmentsDao.selectByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
flowDetailResp.setDepartName(departmentsEntity.getDepartmentName());
if(new Integer(0).equals(flowRecord.getStatus()) || new Integer(2).equals(flowRecord.getStatus())){
int position = 0 ;
StaffRole staffRole = staffRoleService.selectStaffRolesByStaffIdDepartmentLevelList(loginUserId,
Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName(),RoleEnums.MASTER_PM.getName()}));
if(staffRole !=null ){
boolean flag = false;
if(staffRole.getDepartmentId() == 0 ){
flag = true ;
}else {
Map<String, String> map = departmentsService.selectUserAllDepartmentIds(departmentsStaffRelateEntity.getDepartmentId());
List<StaffRoleDepartment> 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 ;
}
int position = getRole(loginUserId,departmentsStaffRelateEntity) ;
/**
* 1绩效管理员进来
* 1.1转交 都有
* 1.2跳过都有
* 2审批节点人员
* 2.1转交根据初始化数据来确定自己所在节点的权限
* 2.2跳转都没有
* 3普通员工
* 3.1转交没有
* 3.2跳转没有
1绩效管理员的权限只在里面
2流程节点的授权只展示在外面里面不展示
3既是绩效管理员和审批节点人员里面展示外面根据节点授权情况来确定是否展示
*/
if(position == 1){ //如果是绩效管理员
initTiaoZhuangZhuangJiao(flowDetailResp,1,1);
if(flowRecord.getFlowProcess() == 0 ){//目标制定有转交但是没有跳过
initTiaoZhuangZhuangJiao(flowDetailResp,0,1);
}
}else if (position == 2 ){ //如果是审批节点人员
Map<String,Integer> auth = getAuth(flowRecord.getFlowStaffIdRole());
if(new Integer(1).equals(auth.get("transfer"))){
flowDetailResp.setTransfer(1);
}
}//如果是普通员工没有跳转和转交的权限
}
}//如果流程节点己经走了直接返回不可跳转不可转交
flowDetailRespList.add(flowDetailResp);
}
public int getRole(Long loginUserId ,DepartmentsStaffRelateEntity departmentsStaffRelateEntity){
int position = 0 ;
StaffRole staffRole = staffRoleService.selectStaffRolesByStaffIdDepartmentLevelList(loginUserId,
Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName(),RoleEnums.MASTER_PM.getName()}));
if(staffRole !=null ){
boolean flag = false;
if(staffRole.getDepartmentId() == 0 ){
flag = true ;
}else {
Map<String, String> map = departmentsService.selectUserAllDepartmentIds(departmentsStaffRelateEntity.getDepartmentId());
List<StaffRoleDepartment> 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;//表示当前是绩效管理员
}
}
return position;
}
public void initTiaoZhuangZhuangJiao(FlowDetailResp flowDetailResp,int tiaoZhuang,int transfer){
flowDetailResp.setTiaozhuang(tiaoZhuang);