Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0

This commit is contained in:
wulin 2020-11-12 12:38:29 +08:00
commit 658fdc1d08
6 changed files with 94 additions and 20 deletions

View File

@ -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 ){

View File

@ -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);

View File

@ -10,5 +10,6 @@ public class FlowDetailResp {
private String departName;
private String avatar;
private int status ;
private int transfer;
private int tiaozhuang;
}

View File

@ -69,7 +69,10 @@ public interface StaffRoleService extends IService<StaffRole> {
List<StaffRole> selectMastRoles();
//获取管理全部考评组
List<StaffRole> selectAllGroupManageRoles();
List<StaffRole> selectAllStaffRoleByDepartmentLevel(List<String> asList);
List<StaffRole> selectByEvaluationGroupId(Long id);
StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long loginUserId, List<String> asList);
}

View File

@ -33,6 +33,7 @@ import com.lz.modules.sys.entity.SysRoleEntity;
import com.lz.modules.sys.service.app.ResultRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -565,4 +566,11 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
public List<StaffRole> selectByEvaluationGroupId(Long groupId){
return staffRoleMapper.selectByEvaluationGroupId(groupId);
}
@Override
public StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long staffId, List<String> departmentLevels) {
return staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(staffId,departmentLevels);
}
}

View File

@ -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<ResultRecordMapper, Res
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordId(recordDetailDto.getResultRecordId());
List<FlowRecordResp> 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<ResultRecordMapper, Res
boolean flag2 = false;
boolean flag4 = false;
List<FlowDetailResp> 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<ResultRecordMapper, Res
resp.setStatus(flowRecord.getStatus() == 2 ? 1 : flowRecord.getStatus());
List<FlowDetailResp> 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<ResultRecordMapper, Res
}
if(currentResultRecord !=null){
if(StringUtil.isNotBlank(currentResultRecord.getFlowStaffIdRole())){
Map<String,Object> map = JSONObject.parseObject(currentResultRecord.getFlowStaffIdRole(),Map.class);
List<Long> roleIds = null;
for (Map.Entry<String, Object> 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<ResultRecordMapper, Res
}
public void mySetFlowDetailRespList(List<FlowDetailResp> flowDetailRespList ,FlowRecord flowRecord){
public Map<String,Integer> getAuth(String flowStaffIdRole){
Map<String,Integer> auth = Maps.newHashMap();
Map<String,Object> map = JSONObject.parseObject(flowStaffIdRole,Map.class);
List<Long> roleIds = null;
for (Map.Entry<String, Object> 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<FlowDetailResp> 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<ResultRecordMapper, Res
StaffEntity staffEntity = staffService.selectStaffById(flowRecord.getApprovalStaffId());
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(flowRecord.getApprovalStaffId());
flowDetailResp.setAvatar(staffEntity.getAvatar());
if(departmentsStaffRelateEntity !=null){
DepartmentsEntity departmentsEntity = departmentsDao.selectByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
flowDetailResp.setDepartName(departmentsEntity.getDepartmentName());
}
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 ;
}
/**
* 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<String,Integer> 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<StaffEntity> staffEntities = departManagers.getManagers();