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 { ...@@ -627,162 +627,175 @@ public class JxglController {
@ApiOperationSupport(order = 9) @ApiOperationSupport(order = 9)
public Result<Object> updatePAS(@CurrentUser UserBean userBean, public Result<Object> updatePAS(@CurrentUser UserBean userBean,
@Validated @RequestBody AppraisalUpdateSts appraisalUpdateSts) { @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()) { //查询绩效组是否还存在可开启的绩效
// 修改 绩效考核状态 // JxglPerformanceAppraisal appisal = JxglPerformanceAppraisal.builder().id(appraisalUpdateSts.getId()).build().selectById();
jxglPerformanceAppraisalMapper // if(appisal.getAppraisalPersonNum() == 1) {
.updateById(JxglPerformanceAppraisal.builder() //
.id(appraisalUpdateSts.getId()) // }
.sts(PerformanceAppraisalSts.PERFORMANCE_ARCHIVE.getType())
.build()); List<JxglAppraisal> ais = JxglAppraisal.builder().build().selectList(new QueryWrapper<JxglAppraisal>().lambda().eq(JxglAppraisal::getPerformanceAppraisalId, appraisalUpdateSts.getId())
return ResultUtil.success(); .eq(JxglAppraisal::getSts, 0));
} if(ais.size() > 0) {
JxglPerformanceAppraisal performanceAppraisal = jxglPerformanceAppraisalMapper
Integer sts = null; .selectOne(new QueryWrapper<JxglPerformanceAppraisal>().lambda()
Integer id = performanceAppraisal.getId(); .eq(JxglPerformanceAppraisal::getId, appraisalUpdateSts.getId())
.eq(JxglPerformanceAppraisal::getSts, appraisalUpdateSts.getSts()));
List<JxglAppraisal> listA = CollUtil.toList();
List<Integer> aIds = CollUtil.toList(); if (performanceAppraisal == null && appraisalUpdateSts.getSts() != PerformanceAppraisalSts.PERFORMANCE_ARCHIVE.getType()) {
List<JxglProcessNode> listPN = CollUtil.toList(); return ResultUtil.error("绩效考核不存在");
List<Integer> pNIds = CollUtil.toList(); }
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()) { Integer sts = null;
case 0: Integer id = performanceAppraisal.getId();
sts = PerformanceAppraisalSts.PERFORMANCE_SCORE.getType();
listA = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda() List<JxglAppraisal> listA = CollUtil.toList();
.select(JxglAppraisal::getId).eq(JxglAppraisal::getPerformanceAppraisalId, id)); List<Integer> aIds = CollUtil.toList();
List<JxglProcessNode> listPN = CollUtil.toList();
List<Integer> pNIds = CollUtil.toList();
if (CollectionUtil.isNotEmpty(listA)) { switch (performanceAppraisal.getSts()) {
aIds = listA.stream().map(JxglAppraisal::getId).collect(Collectors.toList()); case 0:
sts = PerformanceAppraisalSts.PERFORMANCE_SCORE.getType();
listPN = jxglProcessNodeMapper.selectList( listA = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda()
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds) .select(JxglAppraisal::getId).eq(JxglAppraisal::getPerformanceAppraisalId, id));
.eq(JxglProcessNode::getProcessType, ProcessType.TARGET_CONFIRMED.getType())
.eq(JxglProcessNode::getSts, ProcessNodeSts.EXECUTED.getType()));
if (CollectionUtil.isNotEmpty(listPN)) { if (CollectionUtil.isNotEmpty(listA)) {
aIds = listPN.stream().map(JxglProcessNode::getAppraisalId).collect(Collectors.toList()); aIds = listA.stream().map(JxglAppraisal::getId).collect(Collectors.toList());
listPN = jxglProcessNodeMapper.selectList( listPN = jxglProcessNodeMapper.selectList(
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds) new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds)
.eq(JxglProcessNode::getProcessType, ProcessType.SELF_ASSESSMENT.getType()) .eq(JxglProcessNode::getProcessType, ProcessType.TARGET_CONFIRMED.getType())
.eq(JxglProcessNode::getSts, ProcessNodeSts.NON_EXECUTION.getType())); .eq(JxglProcessNode::getSts, ProcessNodeSts.EXECUTED.getType()));
if (CollectionUtil.isNotEmpty(listPN)) { if (CollectionUtil.isNotEmpty(listPN)) {
pNIds = listPN.stream().map(JxglProcessNode::getId).collect(Collectors.toList());
aIds = listPN.stream().map(JxglProcessNode::getAppraisalId).collect(Collectors.toList()); aIds = listPN.stream().map(JxglProcessNode::getAppraisalId).collect(Collectors.toList());
JxglProcessNode.builder().sts(ProcessNodeSts.IN_EXECUTION.getType()).build().update( listPN = jxglProcessNodeMapper.selectList(
new UpdateWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getId, pNIds)); 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() JxglAppraisal.builder().sts(AppraisalSts.SELF_ASSESSMENT.getType()).build()
.update(new UpdateWrapper<JxglAppraisal>().lambda().in(JxglAppraisal::getId, aIds)); .update(new UpdateWrapper<JxglAppraisal>().lambda().in(JxglAppraisal::getId, aIds));
}
} }
} }
}
break;
case 1:
sts = PerformanceAppraisalSts.RESULT_VERIFICATION.getType();
listA = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda() break;
.select(JxglAppraisal::getId).eq(JxglAppraisal::getPerformanceAppraisalId, id)); case 1:
sts = PerformanceAppraisalSts.RESULT_VERIFICATION.getType();
if (CollectionUtil.isNotEmpty(listA)) { listA = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda()
aIds = listA.stream().map(JxglAppraisal::getId).collect(Collectors.toList()); .select(JxglAppraisal::getId).eq(JxglAppraisal::getPerformanceAppraisalId, id));
listPN = jxglProcessNodeMapper.selectList( if (CollectionUtil.isNotEmpty(listA)) {
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds) aIds = listA.stream().map(JxglAppraisal::getId).collect(Collectors.toList());
.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());
listPN = jxglProcessNodeMapper.selectList( listPN = jxglProcessNodeMapper.selectList(
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds) new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds)
.eq(JxglProcessNode::getProcessType, ProcessType.RESULT_VERIFICATION.getType()) .eq(JxglProcessNode::getProcessType, ProcessType.SUPERIOR_SCORE.getType())
.eq(JxglProcessNode::getSts, ProcessNodeSts.NON_EXECUTION.getType())); .eq(JxglProcessNode::getSts, ProcessNodeSts.EXECUTED.getType()));
if (CollectionUtil.isNotEmpty(listPN)) { if (CollectionUtil.isNotEmpty(listPN)) {
pNIds = listPN.stream().map(JxglProcessNode::getId).collect(Collectors.toList());
aIds = listPN.stream().map(JxglProcessNode::getAppraisalId).collect(Collectors.toList()); aIds = listPN.stream().map(JxglProcessNode::getAppraisalId).collect(Collectors.toList());
JxglProcessNode.builder().sts(ProcessNodeSts.IN_EXECUTION.getType()).build().update( listPN = jxglProcessNodeMapper.selectList(
new UpdateWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getId, pNIds)); 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() JxglAppraisal.builder().sts(AppraisalSts.RESULT_VERIFICATION.getType()).build()
.update(new UpdateWrapper<JxglAppraisal>().lambda().in(JxglAppraisal::getId, aIds)); .update(new UpdateWrapper<JxglAppraisal>().lambda().in(JxglAppraisal::getId, aIds));
}
} }
} }
} break;
break; case 2:
case 2: sts = PerformanceAppraisalSts.PERFORMANCE_ARCHIVE.getType();
sts = PerformanceAppraisalSts.PERFORMANCE_ARCHIVE.getType();
listA = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda() listA = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda()
.select(JxglAppraisal::getId).eq(JxglAppraisal::getPerformanceAppraisalId, id)); .select(JxglAppraisal::getId).eq(JxglAppraisal::getPerformanceAppraisalId, id));
if (CollectionUtil.isNotEmpty(listA)) { if (CollectionUtil.isNotEmpty(listA)) {
aIds = listA.stream().map(JxglAppraisal::getId).collect(Collectors.toList()); aIds = listA.stream().map(JxglAppraisal::getId).collect(Collectors.toList());
listPN = jxglProcessNodeMapper.selectList( listPN = jxglProcessNodeMapper.selectList(
new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds) new QueryWrapper<JxglProcessNode>().lambda().in(JxglProcessNode::getAppraisalId, aIds)
.eq(JxglProcessNode::getProcessType, ProcessType.RESULT_VERIFICATION.getType()) .eq(JxglProcessNode::getProcessType, ProcessType.RESULT_VERIFICATION.getType())
.in(JxglProcessNode::getSts, ProcessNodeSts.NON_EXECUTION.getType(),ProcessNodeSts.IN_EXECUTION.getType())); .in(JxglProcessNode::getSts, ProcessNodeSts.NON_EXECUTION.getType(),ProcessNodeSts.IN_EXECUTION.getType()));
if (CollectionUtil.isNotEmpty(listPN)) { if (CollectionUtil.isNotEmpty(listPN)) {
throw new CustomException("所有考核 确认结果后才能 归档"); throw new CustomException("所有考核 确认结果后才能 归档");
}
} }
} break;
break; case 3:
case 3: // 修改 考核状态
// 修改 考核状态 jxglAppraisalMapper.update(
jxglAppraisalMapper.update( JxglAppraisal.builder().performanceAppraisalId(id).sts(AppraisalSts.PERFORMANCE_ARCHIVE.getType()).build(),
JxglAppraisal.builder().performanceAppraisalId(id).sts(AppraisalSts.PERFORMANCE_ARCHIVE.getType()).build(), new UpdateWrapper<JxglAppraisal>().lambda()
new UpdateWrapper<JxglAppraisal>().lambda() .eq(JxglAppraisal::getPerformanceAppraisalId, id)
.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)) {
List<Integer> aIds2 = listAppraisal.stream().map(JxglAppraisal::getId).collect(Collectors.toList()); List<JxglAppraisal> listAppraisal = jxglAppraisalMapper.selectList(new QueryWrapper<JxglAppraisal>().lambda()
if (CollectionUtil.isNotEmpty(aIds2)) { .select(JxglAppraisal::getId)
JxglAppraisalLog appraisalLog = JxglAppraisalLog.builder().build(); .eq(JxglAppraisal::getPerformanceAppraisalId, performanceAppraisal.getId()));
aIds2.forEach(aId -> {
appraisalLog.setId(null); if (CollectionUtil.isNotEmpty(listAppraisal)) {
appraisalLog.setAppraisalId(aId);
appraisalLog.setExecutorId(userBean.getEmpNum()); List<Integer> aIds2 = listAppraisal.stream().map(JxglAppraisal::getId).collect(Collectors.toList());
appraisalLog.setExecutorName(userBean.getUserInfo().getName()); if (CollectionUtil.isNotEmpty(aIds2)) {
appraisalLog.setType(AppraisalLogType.PERFORMANCE_ARCHIVE.getType()); JxglAppraisalLog appraisalLog = JxglAppraisalLog.builder().build();
appraisalLog.insert(); 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 jxglPerformanceAppraisalMapper
.updateById(JxglPerformanceAppraisal.builder().id(appraisalUpdateSts.getId()).sts(sts).build()); .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 { ...@@ -1031,6 +1044,20 @@ public class JxglController {
} else if (appraisal.getSts() <= AppraisalSts.RESULT_VERIFICATION.getType()) { } else if (appraisal.getSts() <= AppraisalSts.RESULT_VERIFICATION.getType()) {
JxglAppraisal.builder().id(id).sts(AppraisalSts.TERMINATION_ASSESSMENT.getType()).build().updateById(); 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(); JxglAppraisalLog appraisalLog = JxglAppraisalLog.builder().build();
appraisalLog.setAppraisalId(appraisal.getId()); appraisalLog.setAppraisalId(appraisal.getId());
appraisalLog.setExecutorId(userBean.getEmpNum()); 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