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

This commit is contained in:
杜建超 2020-11-12 17:19:24 +08:00
commit 3d9afe5e4f
18 changed files with 173 additions and 39 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

@ -43,4 +43,5 @@ public interface FlowChartMapper extends BaseMapper<FlowChart> {
List<FlowChart> selectFlowChartsByGroupId(Long groupId);
List<FlowChartRoleDto> selectCanSetChartRoleByChartId(Long id);
}

View File

@ -37,7 +37,7 @@ public interface ResultTagetLibMapper extends BaseMapper<ResultTagetLib> {
int deleteResultTagetLibById(@Param("id")Long id);
List<ResultTagetLibDto> selectResultTagetLibByModelId(Long id);
List<ResultTagetLib> selectResultTagetLibByModelId(Long id);
List<ResultTagetLibDto> selectByCondition(@Param("page") IPage page, @Param("req") ResultTagetLibSearchReq req);

View File

@ -41,4 +41,6 @@ public interface FlowChartService extends IService<FlowChart> {
List<FlowChartDto> selectFlowChartDtoByFlowManagerId(Long id);
List<FlowChart> selectFlowChartsByGroupId(Long groupId);
List<FlowChartRoleDto> selectCanSetChartRoleByChartId(Long id);
}

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

@ -82,6 +82,12 @@ public class FlowChartServiceImpl extends ServiceImpl<FlowChartMapper, FlowChart
return flowChartMapper.selectFlowChartsByGroupId(groupId);
}
@Override
public List<FlowChartRoleDto> selectCanSetChartRoleByChartId(Long id)
{
return flowChartMapper.selectCanSetChartRoleByChartId(id);
}
}

View File

@ -383,13 +383,26 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
evaluationGroup =
evaluationGroupService.selectEvaluationGroupByCopyId(evaluationGroup.getId(),flowStart.getId());
if(evaluationGroup == null){
log.info("无法assess/manager/detail找到拷贝组信息");
log.info("无法找到拷贝组信息");
return 5;
}
resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
if(resultModelDtos.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("拷贝组的维度信息错误");
return 1;
}
for (ResultModelDto modelDto:resultModelDtos
) {
List<ResultTagetLibDto> resultTagetLibDtos = resultTagetLibService.selectResultTagetLibDtoByModelId(modelDto.getId());
modelDto.setTagetLibs(resultTagetLibDtos);
}
//以下代码没必要更新因为这个拷贝分用不到正确的对应关系清查看lz_evaluation_start_staff
//evaluationGroup.setStaffIds(evaluationGroup.getStaffIds() + ",");
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
List<ResultDetail> resultDetails = new ArrayList();
//下面初始化参与人员
for (StaffSimpleInfo staffInfo:staffIds
) {
@ -423,9 +436,39 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
resultRecord.setCurrentApprovalStaffName(staffInfo.getName());
resultRecordService.insertResultRecord(resultRecord);
staffInfo.setRecordId(resultRecord.getId());
//下面生成实际的考核流程
resultRecordService.initFlowRecord(resultRecord.getId());
staffInfo.setRecordId(resultRecord.getId());
for (ResultModelDto modelDto:resultModelDtos
) {
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());
resultDetail.setType(modelDto.getType());
resultDetail.setKeyResult(libDto.getKeyResult());
resultDetail.setCheckWeight(libDto.getWeight());
resultDetail.setStaffId(staffInfo.getId());
resultDetail.setPriority(libDto.getOrderBy());
resultDetails.add(resultDetail);
}
}
}
//如果有数据插入lz_result_detail表
if(resultDetails.size() > 0){
//
resultDetailService.insertResultDetails(resultDetails);
}
}
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
return 0;

View File

@ -181,7 +181,7 @@ public class ResultModelServiceImpl extends ServiceImpl<ResultModelMapper, Resul
}
}
if(delCount == 0){
/*if(delCount == 0){
//如果全部被删除或者没有传入具体维度那么默认保存一个维度
//没有传具体的维度
ResultModel resultModel = new ResultModel();
@ -192,7 +192,7 @@ public class ResultModelServiceImpl extends ServiceImpl<ResultModelMapper, Resul
resultModel.setOrderBy(resultModelOrderBy);
resultModelMapper.insertResultModel(resultModel);
return R.ok();
}
}*/
return R.ok();
}

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

@ -171,15 +171,17 @@ public class EvaluationGroupController extends AbstractController {
return Long.parseLong(s);
}
}).collect(Collectors.toMap(Long::longValue, Function.identity(), (e, replace) -> e));
if(staffRoles != null && staffRoles.size() > 0){
for (StaffRole staffRole:staffRoles
) {//去掉已经在管理本组的管理员
if(mapIds.containsKey(staffRole.getStaffId())){
mapIds.remove(staffRole.getStaffId());
}else{//删除管理的组信息
staffRoleEvaluationGroupService.deleteStaffRoleEvaluationGroupByRoleId(staffRole.getId());
}
}
}
for (StaffRole staffRole:staffRoles
) {//去掉已经在管理本组的管理员
if(mapIds.containsKey(staffRole.getStaffId())){
mapIds.remove(staffRole.getStaffId());
}else{//删除管理的组信息
staffRoleEvaluationGroupService.deleteStaffRoleEvaluationGroupByRoleId(staffRole.getId());
}
}
//去掉管理全考评组
staffRoles = staffRoleService.selectAllGroupManageRoles();

View File

@ -57,8 +57,8 @@ public class FlowChartController {
List<FlowChartDto> flowChartDtos = flowChartService.selectFlowChartDtoByFlowManagerId(flowManager.getId());
for (FlowChartDto dto:flowChartDtos
) {
List<FlowChartRoleDto> flowCharts = flowChartService.selectChartRoleByChartId(dto.getId());
dto.setRoleDtos(flowCharts);
List<FlowChartRoleDto> flowChartRoles = flowChartService.selectCanSetChartRoleByChartId(dto.getId());
dto.setRoleDtos(flowChartRoles);
if(groupId > 0){
//获取节点已保存的数据
FlowChartDetailRecordListDto flowChartDetailRecordListDto = new FlowChartDetailRecordListDto();

View File

@ -37,7 +37,7 @@ public interface ResultTagetLibService extends IService<ResultTagetLib> {
int deleteResultTagetLibById(Long id);
List<ResultTagetLibDto> selectResultTagetLibByModelId(Long id);
List<ResultTagetLib> selectResultTagetLibByModelId(Long id);
PageUtils selectResultTagetLibByReq(ResultTagetLibSearchReq req);

View File

@ -55,7 +55,7 @@ public class ResultTagetLibServiceImpl extends ServiceImpl<ResultTagetLibMapper,
if(resultModel == null){
return R.error("找不到相关考核模板");
}
List<ResultTagetLibDto> resultTagetLibDtos = selectResultTagetLibByModelId(resultModel.getId());
List<ResultTagetLibDto> resultTagetLibDtos = selectResultTagetLibDtoByModelId(resultModel.getId());
BigDecimal weight = BigDecimal.ZERO;
for(int i = 0; i < resultTagetLibDtos.size(); i++){
ResultTagetLibDto dto = resultTagetLibDtos.get(i);
@ -92,7 +92,7 @@ public class ResultTagetLibServiceImpl extends ServiceImpl<ResultTagetLibMapper,
}
@Override
public List<ResultTagetLibDto> selectResultTagetLibByModelId(Long id){
public List<ResultTagetLib> selectResultTagetLibByModelId(Long id){
return resultTagetLibMapper.selectResultTagetLibByModelId(id);
}

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

View File

@ -119,5 +119,11 @@
) and is_delete=0 order by step_index asc
</select>
<select id="selectCanSetChartRoleByChartId" resultType="com.lz.modules.flow.model.FlowChartRoleDto" >
SELECT crole.id as id, crole.chart_id as chart_id, crole.role_id as role_id, role.name as role_name,
crole.type as type FROM lz_flow_chart_role crole left join lz_record_role role on role.id=crole.role_id
where crole.chart_id=#{id} and crole.type = 0
</select>
</mapper>

View File

@ -89,7 +89,7 @@
update lz_result_taget_lib set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectResultTagetLibByModelId" resultType="com.lz.modules.flow.model.ResultTagetLibDto" >
<select id="selectResultTagetLibByModelId" resultType="com.lz.modules.flow.entity.ResultTagetLib" >
select * from lz_result_taget_lib where model_id=#{id} and is_delete = 0 order by order_by desc
</select>