Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0
This commit is contained in:
commit
ff4316d3c5
@ -3,6 +3,7 @@ package com.lz.modules.flow.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.model.StartGroups;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -35,6 +36,8 @@ public interface FlowStartService extends IService<FlowStart> {
|
||||
|
||||
FlowStart selectFlowStartByName(String name);
|
||||
|
||||
R startStaffs(StartGroups startGroupStaffIds);
|
||||
|
||||
R saveStart(FlowStart flowStart);
|
||||
|
||||
R getModelById(Long id, int type);
|
||||
|
||||
@ -180,24 +180,44 @@ 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)){
|
||||
case 1:
|
||||
return R.error(evaluationGroup.getName() + "——无有效考核人员");
|
||||
case 2:
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
|
||||
case 3:
|
||||
return R.error(evaluationGroup.getName() + "——没有绩效流程节点");
|
||||
case 4:
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核流程");
|
||||
case 5:
|
||||
return R.error(evaluationGroup.getName() + "——没有设置绩效管理人员");
|
||||
case 6:
|
||||
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
|
||||
}
|
||||
}
|
||||
return R.ok("发起成功").put("data", flowStart);
|
||||
}
|
||||
|
||||
private int start(EvaluationGroup evaluationGroup, FlowStart flowStart, Map<String, List<StaffEntity>> staffManages){
|
||||
|
||||
//下面初始化员工考核流程
|
||||
List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);
|
||||
|
||||
if(staffIds.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
|
||||
return R.error(evaluationGroup.getName() + "——无有效考核人员");
|
||||
return 1;
|
||||
}
|
||||
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
|
||||
if(resultModelDtos.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
|
||||
return 2;
|
||||
}
|
||||
|
||||
List<FlowChart> flowCharts = flowChartService.selectFlowChartsByGroupId(evaluationGroup.getId());
|
||||
if(flowCharts.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return R.error(evaluationGroup.getName() + "——没有绩效流程节点");
|
||||
return 3;
|
||||
}
|
||||
List<FlowChartDetailRecord> flowChartDetailRecords = new ArrayList<>();
|
||||
for (FlowChart chart:flowCharts
|
||||
@ -209,7 +229,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
|
||||
if(flowChartDetailRecords.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核流程");
|
||||
return 4;
|
||||
}
|
||||
Map<Long, String> chartNameMaps =
|
||||
flowCharts.stream().collect(Collectors.toMap(FlowChart::getId, FlowChart::getName));//流程节点与流程名称对应map,下面多次循环,减少数据库查找
|
||||
@ -229,7 +249,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
}
|
||||
if(staffManagers == null || staffManagers.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return R.error(evaluationGroup.getName() + "——没有设置绩效管理人员");
|
||||
return 5;
|
||||
}
|
||||
|
||||
//下面拷贝一份考评组信息发起后所使用的考评组id为复制后的id
|
||||
@ -492,11 +512,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
//如果有下面通知所有管理人员
|
||||
}else{
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
|
||||
return 6;
|
||||
}
|
||||
|
||||
}
|
||||
return R.ok("发起成功").put("data", flowStart);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user