提交修改

This commit is contained in:
quyixiao 2020-11-13 17:18:42 +08:00
commit 94e54af6a3

View File

@ -39,6 +39,7 @@ import org.springframework.web.bind.annotation.*;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
@ -367,14 +368,16 @@ public class ResultRecordController extends AbstractController {
flowChartDetailRecordService.selectFlowChartDetailRecordsByFlowProcess(resultRecord.getEvaluationId(), ChartFlowType.SCORE.getCode());//获取参与评分的人 flowChartDetailRecordService.selectFlowChartDetailRecordsByFlowProcess(resultRecord.getEvaluationId(), ChartFlowType.SCORE.getCode());//获取参与评分的人
List<StaffEntity> staffs = new ArrayList<>(); List<StaffEntity> staffs = new ArrayList<>();
Boolean isAllScore = true;//false表示返回所有的评分true表示值返回评分了的人 Boolean isAllScore = true;//false表示返回所有的评分true表示值返回评分了的人
Boolean isOrScore = false;//是否为或签
for (FlowChartDetailRecord record:flowChartDetailRecords for (FlowChartDetailRecord record:flowChartDetailRecords
) { ) {
List<StaffEntity> staffs1 = new ArrayList<>();
if(record.getOptType().intValue() == -1){ if(record.getOptType().intValue() == -1){
//自己 //自己
StaffEntity staffEntity = new StaffEntity(); StaffEntity staffEntity = new StaffEntity();
staffEntity.setId(resultRecord.getId()); staffEntity.setId(resultRecord.getId());
staffEntity.setName(resultRecord.getStaffName()); staffEntity.setName(resultRecord.getStaffName());
staffs.add(staffEntity); staffs1.add(staffEntity);
}else if(record.getOptType().intValue() == 0){ }else if(record.getOptType().intValue() == 0){
//指定人员 //指定人员
//获取人员信息 //获取人员信息
@ -384,50 +387,58 @@ public class ResultRecordController extends AbstractController {
return Long.parseLong(s); return Long.parseLong(s);
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());
staffs.addAll(staffService.selectNamesByIds(sIds));//这里不过滤离职人员因为过滤了可能涉及到评分规则的变更 staffs1.addAll(staffService.selectNamesByIds(sIds));//这里不过滤离职人员因为过滤了可能涉及到评分规则的变更
}else{ }else{
//领导 //领导
DepartManagers departManagers = staffService.findLeader(resultRecord.getStaffId(), record.getOptType()); DepartManagers departManagers = staffService.findLeader(resultRecord.getStaffId(), record.getOptType());
if(departManagers.getManagers().size() > 0){ if(departManagers.getManagers().size() > 0){
staffs.addAll(departManagers.getManagers()); staffs1.addAll(departManagers.getManagers());
} }
} }
if(staffs.size() == 0){ if(staffs1.size() == 0){
log.info("无法找到评分人员,开始找绩效管理人员"); log.info("无法找到评分人员,开始找绩效管理人员");
staffs = staffService.findManger(resultRecord.getId(), ChartFlowType.SCORE.getCode()); staffs1 = staffService.findManger(resultRecord.getId(), ChartFlowType.SCORE.getCode());
} }
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(resultRecord.getId(), 0);//获取未执行的节点 //流程已经到了审批节点那么判断评分是否为或签如果是那么只需要返回实际评分的那个人即可否则全部返回
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdFlowProcess(resultRecord.getId(), ChartFlowType.SCORE.getCode());//获取当前的流程节点
if(flowRecords.get(0).getType().intValue() == 1){
//或签
isOrScore = true;
}
for (StaffEntity staff:staffs1
) {
ResultScoreDto resultScore = new ResultScoreDto();
resultScore.setApprovalId(staff.getId());
resultScore.setApprovalName(staff.getName());
if(isOrScore){
//或签每个权重一样
resultScore.setWeight(record.getWeight());
}else{
//多人的时候权重平分
resultScore.setWeight(record.getWeight().divide(BigDecimal.valueOf(staffs1.size()), RoundingMode.CEILING));
}
scoreDtos.add(resultScore);
}
flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(resultRecord.getId(), 0);//获取未执行的节点
if(flowRecords.size() > 0){ if(flowRecords.size() > 0){
if(flowRecords.get(0).getFlowProcess().intValue() > ChartFlowType.SCORE.getCode()){ if(flowRecords.get(0).getFlowProcess().intValue() > ChartFlowType.SCORE.getCode()){
//流程已经到了审批节点那么判断评分是否为或签如果是那么只需要返回实际评分的那个人即可否则全部返回 //流程已经到了审批节点那么判断评分是否为或签如果是那么只需要返回实际评分的那个人即可否则全部返回
flowRecords = flowRecordService.selectFlowRecordByRecordIdFlowProcess(resultRecord.getId(), ChartFlowType.SCORE.getCode());//获取当前的流程节点 if(isOrScore){
if(flowRecords.get(0).getType().intValue() == 1){
//或签
isAllScore = false; isAllScore = false;
} }
} }
}else{//绩效流程已经走完 }else{//绩效流程已经走完
//流程已经到了审批节点那么判断评分是否为或签如果是那么只需要返回实际评分的那个人即可否则全部返回 if(isOrScore){
flowRecords = flowRecordService.selectFlowRecordByRecordIdFlowProcess(resultRecord.getId(), ChartFlowType.SCORE.getCode());//获取当前的流程节点
if(flowRecords.get(0).getType().intValue() == 1){
//或签
isAllScore = false; isAllScore = false;
} }
} }
staffs.addAll(staffs1);
for (StaffEntity staff:staffs
) {
ResultScoreDto resultScore = new ResultScoreDto();
resultScore.setApprovalId(staff.getId());
resultScore.setApprovalName(staff.getName());
resultScore.setWeight(record.getWeight());
scoreDtos.add(resultScore);
}
} }