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-11 10:47:20 +08:00
commit 9300ba5c8c

View File

@ -20,6 +20,7 @@ import com.lz.modules.sys.entity.app.ResultDetail;
import com.lz.modules.sys.entity.app.ResultRecord; import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultDetailService; import com.lz.modules.sys.service.app.ResultDetailService;
import com.lz.modules.sys.service.app.ResultRecordService; import com.lz.modules.sys.service.app.ResultRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.map.HashedMap; import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -41,6 +42,7 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
@Slf4j
public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart> implements FlowStartService { public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart> implements FlowStartService {
@ -130,8 +132,10 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
//发起指定用户的绩效中途添加的时候 //发起指定用户的绩效中途添加的时候
public R startStaffs(StartGroups startGroupStaffIds){ public R startStaffs(StartGroups startGroupStaffIds){
log.info("发起指定用户的绩效,中途添加的时候{}", startGroupStaffIds);
FlowStart flowStart = flowStartMapper.selectFlowStartById(startGroupStaffIds.getStartId()); FlowStart flowStart = flowStartMapper.selectFlowStartById(startGroupStaffIds.getStartId());
if(flowStart == null){ if(flowStart == null){
log.info("发起任务不存在");
return R.error("发起任务不存在"); return R.error("发起任务不存在");
} }
@ -142,6 +146,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
) { ) {
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(groupStaffs.getStaffIds()); List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(groupStaffs.getStaffIds());
if(staffSimpleInfos.size() == 0){ if(staffSimpleInfos.size() == 0){
log.info("无有效考核人员");
R.error(groupStaffs.getEvaluationGroup().getName() + "——无有效考核人员"); R.error(groupStaffs.getEvaluationGroup().getName() + "——无有效考核人员");
} }
switch (start(groupStaffs.getEvaluationGroup(), flowStart, staffManages, staffSimpleInfos, mustRole, selfMustRole)){ switch (start(groupStaffs.getEvaluationGroup(), flowStart, staffManages, staffSimpleInfos, mustRole, selfMustRole)){
@ -165,8 +170,10 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
@Override @Override
public R saveStart(FlowStart flowStart){ public R saveStart(FlowStart flowStart){
log.info("发起考核{}", flowStart);
//下面生成或者合并发起绩效 //下面生成或者合并发起绩效
if(flowStart.getStartTime() == null){ if(flowStart.getStartTime() == null){
log.info("未设置有效考核月份");
return R.error("未设置有效考核月份"); return R.error("未设置有效考核月份");
} }
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月");
@ -175,6 +182,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
if(flowStart.getCycleType().intValue() != 0){ if(flowStart.getCycleType().intValue() != 0){
//月份 //月份
if(flowStart.getEndTime() == null){ if(flowStart.getEndTime() == null){
log.info("未设置有效考核结束月份");
return R.error("未设置有效考核结束月份"); return R.error("未设置有效考核结束月份");
} }
String endDate = sdf.format(flowStart.getStartTime()); String endDate = sdf.format(flowStart.getStartTime());
@ -244,7 +252,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup); List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);
if(staffIds.size() == 0){ if(staffIds.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("无有效考核人员");
return R.error(evaluationGroup.getName() + "——无有效考核人员"); return R.error(evaluationGroup.getName() + "——无有效考核人员");
} }
if(flowStart.getIsDelete() != null){//已经发起过的 if(flowStart.getIsDelete() != null){//已经发起过的
@ -260,6 +268,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
staffIds = map.values().stream().collect(Collectors.toList()); staffIds = map.values().stream().collect(Collectors.toList());
if(staffIds.size() == 0){ if(staffIds.size() == 0){
log.info("本次发起参与人员为0");
return R.error(evaluationGroup.getName() + "——本次发起参与人员为0"); return R.error(evaluationGroup.getName() + "——本次发起参与人员为0");
} }
} }
@ -294,12 +303,14 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId()); List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
if(resultModelDtos.size() == 0){ if(resultModelDtos.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("没有设置考核模板");
return 1; return 1;
} }
List<FlowChart> flowCharts = flowChartService.selectFlowChartsByGroupId(evaluationGroup.getId()); List<FlowChart> flowCharts = flowChartService.selectFlowChartsByGroupId(evaluationGroup.getId());
if(flowCharts.size() == 0){ if(flowCharts.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("无有效绩效流程节点");
return 2; return 2;
} }
List<FlowChartDetailRecord> flowChartDetailRecords = new ArrayList<>(); List<FlowChartDetailRecord> flowChartDetailRecords = new ArrayList<>();
@ -312,6 +323,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
if(flowChartDetailRecords.size() == 0){ if(flowChartDetailRecords.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("没有设置考核流程");
return 3; return 3;
} }
Map<Long, String> chartNameMaps = Map<Long, String> chartNameMaps =
@ -322,6 +334,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
if(staffManagers == null || staffManagers.size() == 0){ if(staffManagers == null || staffManagers.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("没有设置绩效管理人员");
return 4; return 4;
} }
@ -646,6 +659,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
//如果有下面通知所有管理人员 //如果有下面通知所有管理人员
}else{ }else{
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
log.info("初始化考核流程失败");
return 5; return 5;
} }
return 0; return 0;