完善指定考核人员信息
This commit is contained in:
parent
8f38d222fa
commit
81aa664cb3
@ -1,11 +1,12 @@
|
||||
package com.lz.modules.flow.model;
|
||||
|
||||
import com.lz.modules.flow.entity.EvaluationGroup;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
//组,人员ids
|
||||
@Data
|
||||
public class GroupStaffs {
|
||||
private Long groupId;
|
||||
private EvaluationGroup evaluationGroup;
|
||||
private List<Long> staffIds;
|
||||
}
|
||||
|
||||
@ -7,5 +7,5 @@ import java.util.List;
|
||||
@Data
|
||||
public class StartGroups {
|
||||
private Long startId;
|
||||
private List<GroupStaffs> staffIds;
|
||||
private List<GroupStaffs> groups;
|
||||
}
|
||||
|
||||
@ -10,10 +10,7 @@ import com.lz.modules.app.entity.StaffSimpleInfo;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.dao.FlowStartMapper;
|
||||
import com.lz.modules.flow.entity.*;
|
||||
import com.lz.modules.flow.model.DepartManagers;
|
||||
import com.lz.modules.flow.model.ResultModelDto;
|
||||
import com.lz.modules.flow.model.ResultTagetLibDto;
|
||||
import com.lz.modules.flow.model.StartGroups;
|
||||
import com.lz.modules.flow.model.*;
|
||||
import com.lz.modules.flow.service.*;
|
||||
import com.lz.modules.performance.service.ResultTagetLibService;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
@ -135,6 +132,28 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
if(staffSimpleInfos.size() == 0){
|
||||
return R.error("无有效考核人员,考核人员已离职");
|
||||
}*/
|
||||
Map<String, List<StaffEntity>> staffManages = new HashedMap();//部门(id+几级)和部门几级管理对应关系,减少数据库查找
|
||||
for (GroupStaffs groupStaffs:startGroupStaffIds.getGroups()
|
||||
) {
|
||||
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(groupStaffs.getStaffIds());
|
||||
if(staffSimpleInfos.size() == 0){
|
||||
R.error(groupStaffs.getEvaluationGroup().getName() + "——无有效考核人员");
|
||||
}
|
||||
switch (start(groupStaffs.getEvaluationGroup(), flowStart, staffManages, staffSimpleInfos)){
|
||||
|
||||
case 1:
|
||||
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有设置考核模板");
|
||||
case 2:
|
||||
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有绩效流程节点");
|
||||
case 3:
|
||||
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有设置考核流程");
|
||||
case 4:
|
||||
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有设置绩效管理人员");
|
||||
case 5:
|
||||
return R.error(groupStaffs.getEvaluationGroup().getName() + "——初始化考核流程失败");
|
||||
}
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -180,44 +199,45 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
for (int n = 0; n < evaluationGroups.size(); n++
|
||||
) {
|
||||
EvaluationGroup evaluationGroup = evaluationGroups.get(n);
|
||||
switch (start(evaluationGroup, flowStart, staffManages)){
|
||||
//下面初始化员工考核流程
|
||||
List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);
|
||||
|
||||
if(staffIds.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
|
||||
return R.error(evaluationGroup.getName() + "——无有效考核人员");
|
||||
}
|
||||
switch (start(evaluationGroup, flowStart, staffManages, staffIds)){
|
||||
|
||||
case 1:
|
||||
return R.error(evaluationGroup.getName() + "——无有效考核人员");
|
||||
case 2:
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
|
||||
case 3:
|
||||
case 2:
|
||||
return R.error(evaluationGroup.getName() + "——没有绩效流程节点");
|
||||
case 4:
|
||||
case 3:
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核流程");
|
||||
case 5:
|
||||
case 4:
|
||||
return R.error(evaluationGroup.getName() + "——没有设置绩效管理人员");
|
||||
case 6:
|
||||
case 5:
|
||||
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
|
||||
}
|
||||
}
|
||||
return R.ok("发起成功").put("data", flowStart);
|
||||
}
|
||||
|
||||
private int start(EvaluationGroup evaluationGroup, FlowStart flowStart, Map<String, List<StaffEntity>> staffManages){
|
||||
private int start(EvaluationGroup evaluationGroup, FlowStart flowStart,
|
||||
Map<String, List<StaffEntity>> staffManages, List<StaffSimpleInfo> staffIds){
|
||||
|
||||
//下面初始化员工考核流程
|
||||
List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);
|
||||
|
||||
if(staffIds.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
|
||||
return 1;
|
||||
}
|
||||
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
|
||||
if(resultModelDtos.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
List<FlowChart> flowCharts = flowChartService.selectFlowChartsByGroupId(evaluationGroup.getId());
|
||||
if(flowCharts.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return 3;
|
||||
return 2;
|
||||
}
|
||||
List<FlowChartDetailRecord> flowChartDetailRecords = new ArrayList<>();
|
||||
for (FlowChart chart:flowCharts
|
||||
@ -229,7 +249,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
|
||||
if(flowChartDetailRecords.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return 4;
|
||||
return 3;
|
||||
}
|
||||
Map<Long, String> chartNameMaps =
|
||||
flowCharts.stream().collect(Collectors.toMap(FlowChart::getId, FlowChart::getName));//流程节点与流程名称对应map,下面多次循环,减少数据库查找
|
||||
@ -249,15 +269,18 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
}
|
||||
if(staffManagers == null || staffManagers.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return 5;
|
||||
return 4;
|
||||
}
|
||||
|
||||
//下面拷贝一份考评组信息发起后所使用的考评组id为复制后的id
|
||||
evaluationGroup.setCopyId(evaluationGroup.getId());
|
||||
evaluationGroup.setId(null);
|
||||
evaluationGroup.setGmtCreate(null);
|
||||
evaluationGroup.setGmtModified(null);
|
||||
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
|
||||
if(evaluationGroup.getCopyId() == null){
|
||||
evaluationGroup.setCopyId(evaluationGroup.getId());
|
||||
evaluationGroup.setId(null);
|
||||
evaluationGroup.setGmtCreate(null);
|
||||
evaluationGroup.setGmtModified(null);
|
||||
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
|
||||
}
|
||||
|
||||
|
||||
//拷贝考评组的指标信息
|
||||
List<ResultTagetLib> resultTagetLibs = new ArrayList<>();
|
||||
@ -512,7 +535,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
//如果有下面通知所有管理人员
|
||||
}else{
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return 6;
|
||||
return 5;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user