Commit 459d3431 by leialin

Merge branch 'lal' into 'develop'

Lal

See merge request 8timerv2/8timerapiv200!302
parents 3243bc72 945f5d36
......@@ -627,162 +627,175 @@ public class JxglController {
@ApiOperationSupport(order = 9)
public Result<Object> updatePAS(@CurrentUser UserBean userBean,
@Validated @RequestBody AppraisalUpdateSts appraisalUpdateSts) {
JxglPerformanceAppraisal performanceAppraisal = jxglPerformanceAppraisalMapper
.selectOne(new QueryWrapper<JxglPerformanceAppraisal>().lambda()
.eq(JxglPerformanceAppraisal::getId, appraisalUpdateSts.getId())
.eq(JxglPerformanceAppraisal::getSts, appraisalUpdateSts.getSts()));
if (performanceAppraisal == null && appraisalUpdateSts.getSts() != PerformanceAppraisalSts.PERFORMANCE_ARCHIVE.getType()) {
return ResultUtil.error("绩效考核不存在");
}
if (performanceAppraisal.getSts() == PerformanceAppraisalSts.TERMINATION_ASSESSMENT.getType()) {
// 修改 绩效考核状态
jxglPerformanceAppraisalMapper
.updateById(JxglPerformanceAppraisal.builder()
.id(appraisalUpdateSts.getId())
.sts(PerformanceAppraisalSts.PERFORMANCE_ARCHIVE.getType())
.build());
return ResultUtil.success();
}
Integer sts = null;
Integer id = performanceAppraisal.getId();
List<JxglAppraisal> listA = CollUtil.toList();
List<Integer> aIds = CollUtil.toList();
List<JxglProcessNode> listPN = CollUtil.toList();
List<Integer> pNIds = CollUtil.toList();
//查询绩效组是否还存在可开启的绩效
// JxglPerformanceAppraisal appisal = JxglPerformanceAppraisal.builder().id(appraisalUpdateSts.getId()).build().selectById();
// if(appisal.getAppraisalPersonNum() == 1) {
//
// }
List<JxglAppraisal> ais = JxglAppraisal.builder().build().selectList(new QueryWrapper<JxglAppraisal>().lambda().eq(JxglAppraisal::getPerformanceAppraisalId, appraisalUpdateSts.getId())
.eq(JxglAppraisal::getSts, 0));
if(ais.size() > 0) {
JxglPerformanceAppraisal performanceAppraisal = jxglPerformanceAppraisalMapper
.selectOne(new QueryWrapper<JxglPerformanceAppraisal>().lambda()
.eq(JxglPerformanceAppraisal::getId, appraisalUpdateSts.getId())
.eq(JxglPerformanceAppraisal::getSts, appraisalUpdateSts.getSts()));
if (performanceAppraisal == null && appraisalUpdateSts.getSts() != PerformanceAppraisalSts.PERFORMANCE_ARCHIVE.getType()) {
return ResultUtil.error("绩效考核不存在");
}
if (performanceAppraisal.getSts() == PerformanceAppraisalSts.TERMINATION_ASSESSMENT.getType()) {
// 修改 绩效考核状态
jxglPerformanceAppraisalMapper
.updateById(JxglPerformanceAppraisal.builder()
.id(appraisalUpdateSts.getId())
.sts(PerformanceAppraisalSts.PERFORMANCE_ARCHIVE.getType())
.build());
return ResultUtil.success();
}
switch (performanceAppraisal.getSts()) {
case 0:
sts = PerformanceAppraisalSts.PERFORMANCE_SCORE.getType();
Integer sts = null;
Integer id = performanceAppraisal.getId();
listA = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda()
.select(JxglAppraisal::getId).eq(JxglAppraisal::getPerformanceAppraisalId, id));
List<JxglAppraisal> listA = CollUtil.toList();
List<Integer> aIds = CollUtil.toList();
List<JxglProcessNode> listPN = CollUtil.toList();
List<Integer> pNIds = CollUtil.toList();
if (CollectionUtil.isNotEmpty(listA)) {
aIds = listA.stream().map(JxglAppraisal::getId).collect(Collectors.toList());
switch (performanceAppraisal.getSts()) {
case 0:
sts = PerformanceAppraisalSts.PERFORMANCE_SCORE.getType();
listPN = jxglProcessNodeMapper.selectList(
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds)
.eq(JxglProcessNode::getProcessType, ProcessType.TARGET_CONFIRMED.getType())
.eq(JxglProcessNode::getSts, ProcessNodeSts.EXECUTED.getType()));
listA = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda()
.select(JxglAppraisal::getId).eq(JxglAppraisal::getPerformanceAppraisalId, id));
if (CollectionUtil.isNotEmpty(listPN)) {
aIds = listPN.stream().map(JxglProcessNode::getAppraisalId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(listA)) {
aIds = listA.stream().map(JxglAppraisal::getId).collect(Collectors.toList());
listPN = jxglProcessNodeMapper.selectList(
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds)
.eq(JxglProcessNode::getProcessType, ProcessType.SELF_ASSESSMENT.getType())
.eq(JxglProcessNode::getSts, ProcessNodeSts.NON_EXECUTION.getType()));
.eq(JxglProcessNode::getProcessType, ProcessType.TARGET_CONFIRMED.getType())
.eq(JxglProcessNode::getSts, ProcessNodeSts.EXECUTED.getType()));
if (CollectionUtil.isNotEmpty(listPN)) {
pNIds = listPN.stream().map(JxglProcessNode::getId).collect(Collectors.toList());
aIds = listPN.stream().map(JxglProcessNode::getAppraisalId).collect(Collectors.toList());
JxglProcessNode.builder().sts(ProcessNodeSts.IN_EXECUTION.getType()).build().update(
new UpdateWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getId, pNIds));
listPN = jxglProcessNodeMapper.selectList(
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds)
.eq(JxglProcessNode::getProcessType, ProcessType.SELF_ASSESSMENT.getType())
.eq(JxglProcessNode::getSts, ProcessNodeSts.NON_EXECUTION.getType()));
if (CollectionUtil.isNotEmpty(listPN)) {
pNIds = listPN.stream().map(JxglProcessNode::getId).collect(Collectors.toList());
aIds = listPN.stream().map(JxglProcessNode::getAppraisalId).collect(Collectors.toList());
JxglProcessNode.builder().sts(ProcessNodeSts.IN_EXECUTION.getType()).build().update(
new UpdateWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getId, pNIds));
JxglAppraisal.builder().sts(AppraisalSts.SELF_ASSESSMENT.getType()).build()
.update(new UpdateWrapper<JxglAppraisal>().lambda().in(JxglAppraisal::getId, aIds));
JxglAppraisal.builder().sts(AppraisalSts.SELF_ASSESSMENT.getType()).build()
.update(new UpdateWrapper<JxglAppraisal>().lambda().in(JxglAppraisal::getId, aIds));
}
}
}
}
break;
case 1:
sts = PerformanceAppraisalSts.RESULT_VERIFICATION.getType();
listA = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda()
.select(JxglAppraisal::getId).eq(JxglAppraisal::getPerformanceAppraisalId, id));
break;
case 1:
sts = PerformanceAppraisalSts.RESULT_VERIFICATION.getType();
if (CollectionUtil.isNotEmpty(listA)) {
aIds = listA.stream().map(JxglAppraisal::getId).collect(Collectors.toList());
listA = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda()
.select(JxglAppraisal::getId).eq(JxglAppraisal::getPerformanceAppraisalId, id));
listPN = jxglProcessNodeMapper.selectList(
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds)
.eq(JxglProcessNode::getProcessType, ProcessType.SUPERIOR_SCORE.getType())
.eq(JxglProcessNode::getSts, ProcessNodeSts.EXECUTED.getType()));
if (CollectionUtil.isNotEmpty(listPN)) {
aIds = listPN.stream().map(JxglProcessNode::getAppraisalId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(listA)) {
aIds = listA.stream().map(JxglAppraisal::getId).collect(Collectors.toList());
listPN = jxglProcessNodeMapper.selectList(
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds)
.eq(JxglProcessNode::getProcessType, ProcessType.RESULT_VERIFICATION.getType())
.eq(JxglProcessNode::getSts, ProcessNodeSts.NON_EXECUTION.getType()));
.eq(JxglProcessNode::getProcessType, ProcessType.SUPERIOR_SCORE.getType())
.eq(JxglProcessNode::getSts, ProcessNodeSts.EXECUTED.getType()));
if (CollectionUtil.isNotEmpty(listPN)) {
pNIds = listPN.stream().map(JxglProcessNode::getId).collect(Collectors.toList());
aIds = listPN.stream().map(JxglProcessNode::getAppraisalId).collect(Collectors.toList());
JxglProcessNode.builder().sts(ProcessNodeSts.IN_EXECUTION.getType()).build().update(
new UpdateWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getId, pNIds));
listPN = jxglProcessNodeMapper.selectList(
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds)
.eq(JxglProcessNode::getProcessType, ProcessType.RESULT_VERIFICATION.getType())
.eq(JxglProcessNode::getSts, ProcessNodeSts.NON_EXECUTION.getType()));
if (CollectionUtil.isNotEmpty(listPN)) {
pNIds = listPN.stream().map(JxglProcessNode::getId).collect(Collectors.toList());
aIds = listPN.stream().map(JxglProcessNode::getAppraisalId).collect(Collectors.toList());
JxglProcessNode.builder().sts(ProcessNodeSts.IN_EXECUTION.getType()).build().update(
new UpdateWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getId, pNIds));
JxglAppraisal.builder().sts(AppraisalSts.RESULT_VERIFICATION.getType()).build()
.update(new UpdateWrapper<JxglAppraisal>().lambda().in(JxglAppraisal::getId, aIds));
JxglAppraisal.builder().sts(AppraisalSts.RESULT_VERIFICATION.getType()).build()
.update(new UpdateWrapper<JxglAppraisal>().lambda().in(JxglAppraisal::getId, aIds));
}
}
}
}
break;
case 2:
sts = PerformanceAppraisalSts.PERFORMANCE_ARCHIVE.getType();
break;
case 2:
sts = PerformanceAppraisalSts.PERFORMANCE_ARCHIVE.getType();
listA = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda()
.select(JxglAppraisal::getId).eq(JxglAppraisal::getPerformanceAppraisalId, id));
listA = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda()
.select(JxglAppraisal::getId).eq(JxglAppraisal::getPerformanceAppraisalId, id));
if (CollectionUtil.isNotEmpty(listA)) {
aIds = listA.stream().map(JxglAppraisal::getId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(listA)) {
aIds = listA.stream().map(JxglAppraisal::getId).collect(Collectors.toList());
listPN = jxglProcessNodeMapper.selectList(
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds)
.eq(JxglProcessNode::getProcessType, ProcessType.RESULT_VERIFICATION.getType())
.in(JxglProcessNode::getSts, ProcessNodeSts.NON_EXECUTION.getType(),ProcessNodeSts.IN_EXECUTION.getType()));
listPN = jxglProcessNodeMapper.selectList(
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds)
.eq(JxglProcessNode::getProcessType, ProcessType.RESULT_VERIFICATION.getType())
.in(JxglProcessNode::getSts, ProcessNodeSts.NON_EXECUTION.getType(),ProcessNodeSts.IN_EXECUTION.getType()));
if (CollectionUtil.isNotEmpty(listPN)) {
throw new CustomException("所有考核 确认结果后才能 归档");
if (CollectionUtil.isNotEmpty(listPN)) {
throw new CustomException("所有考核 确认结果后才能 归档");
}
}
}
break;
case 3:
// 修改 考核状态
jxglAppraisalMapper.update(
JxglAppraisal.builder().performanceAppraisalId(id).sts(AppraisalSts.PERFORMANCE_ARCHIVE.getType()).build(),
new UpdateWrapper<JxglAppraisal>().lambda()
.eq(JxglAppraisal::getPerformanceAppraisalId, id)
);
List<JxglAppraisal> listAppraisal = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda()
.select(JxglAppraisal::getId)
.eq(JxglAppraisal::getPerformanceAppraisalId, performanceAppraisal.getId()));
if (CollectionUtil.isNotEmpty(listAppraisal)) {
break;
case 3:
// 修改 考核状态
jxglAppraisalMapper.update(
JxglAppraisal.builder().performanceAppraisalId(id).sts(AppraisalSts.PERFORMANCE_ARCHIVE.getType()).build(),
new UpdateWrapper<JxglAppraisal>().lambda()
.eq(JxglAppraisal::getPerformanceAppraisalId, id)
);
List<Integer> aIds2 = listAppraisal.stream().map(JxglAppraisal::getId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(aIds2)) {
JxglAppraisalLog appraisalLog = JxglAppraisalLog.builder().build();
aIds2.forEach(aId -> {
appraisalLog.setId(null);
appraisalLog.setAppraisalId(aId);
appraisalLog.setExecutorId(userBean.getEmpNum());
appraisalLog.setExecutorName(userBean.getUserInfo().getName());
appraisalLog.setType(AppraisalLogType.PERFORMANCE_ARCHIVE.getType());
appraisalLog.insert();
});
List<JxglAppraisal> listAppraisal = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda()
.select(JxglAppraisal::getId)
.eq(JxglAppraisal::getPerformanceAppraisalId, performanceAppraisal.getId()));
if (CollectionUtil.isNotEmpty(listAppraisal)) {
List<Integer> aIds2 = listAppraisal.stream().map(JxglAppraisal::getId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(aIds2)) {
JxglAppraisalLog appraisalLog = JxglAppraisalLog.builder().build();
aIds2.forEach(aId -> {
appraisalLog.setId(null);
appraisalLog.setAppraisalId(aId);
appraisalLog.setExecutorId(userBean.getEmpNum());
appraisalLog.setExecutorName(userBean.getUserInfo().getName());
appraisalLog.setType(AppraisalLogType.PERFORMANCE_ARCHIVE.getType());
appraisalLog.insert();
});
}
}
break;
default:
break;
}
break;
default:
break;
}
// 修改 绩效考核状态
jxglPerformanceAppraisalMapper
.updateById(JxglPerformanceAppraisal.builder().id(appraisalUpdateSts.getId()).sts(sts).build());
// 修改 绩效考核状态
jxglPerformanceAppraisalMapper
.updateById(JxglPerformanceAppraisal.builder().id(appraisalUpdateSts.getId()).sts(sts).build());
return ResultUtil.success();
return ResultUtil.success();
}else {
return ResultUtil.error("已无可开启的绩效节点");
}
}
/**
......@@ -1031,6 +1044,20 @@ public class JxglController {
} else if (appraisal.getSts() <= AppraisalSts.RESULT_VERIFICATION.getType()) {
JxglAppraisal.builder().id(id).sts(AppraisalSts.TERMINATION_ASSESSMENT.getType()).build().updateById();
//查询所属绩效组是否为一人
JxglPerformanceAppraisal appisal = JxglPerformanceAppraisal.builder().id(appraisal.getPerformanceAppraisalId()).build().selectById();
if(appisal.getAppraisalPersonNum() == 1) {
//绩效考核改为 “4, "终止考核"”
jxglPerformanceAppraisalMapper.updateById(JxglPerformanceAppraisal.builder().id(appraisal.getPerformanceAppraisalId()).sts(PerformanceAppraisalSts.TERMINATION_ASSESSMENT.getType()).build());
}else {
List<JxglAppraisal> ais = JxglAppraisal.builder().build().selectList(new QueryWrapper<JxglAppraisal>().lambda().eq(JxglAppraisal::getPerformanceAppraisalId, appraisal.getPerformanceAppraisalId())
.eq(JxglAppraisal::getSts, 0));
if(ais.size() == 0) {
//绩效考核改为 “4, "终止考核"”
jxglPerformanceAppraisalMapper.updateById(JxglPerformanceAppraisal.builder().id(appraisal.getPerformanceAppraisalId()).sts(PerformanceAppraisalSts.TERMINATION_ASSESSMENT.getType()).build());
}
}
JxglAppraisalLog appraisalLog = JxglAppraisalLog.builder().build();
appraisalLog.setAppraisalId(appraisal.getId());
appraisalLog.setExecutorId(userBean.getEmpNum());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment