|
|
|
|
@ -44,6 +44,10 @@ public class KhPingceController extends BaseController {
|
|
|
|
|
private IKhPingceService khPingceService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IKhPcEmpService pcEmpService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IKhVoteService khVoteService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IKhVoteEmpService khVoteEmpService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询考核评测列表
|
|
|
|
|
@ -152,4 +156,58 @@ public class KhPingceController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
return toAjax(khPingceService.deleteKhPingceByIds(ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除考核评测——————清理数据库时调用, 清除已完成的全部关联数据、进行中的仅清除voteemp已打票的成绩 保留考核项及关联的voteemp
|
|
|
|
|
* vote_recard表直接全部清除 截断表即可
|
|
|
|
|
*/
|
|
|
|
|
// @PreAuthorize("@ss.hasPermi('kaohe:pingce:remove')")
|
|
|
|
|
@Log(title = "考核评测", businessType = BusinessType.DELETE)
|
|
|
|
|
@DeleteMapping("/clean")
|
|
|
|
|
@Transactional
|
|
|
|
|
public AjaxResult removeTest() {
|
|
|
|
|
//已完成
|
|
|
|
|
KhPingce khPingce = new KhPingce();
|
|
|
|
|
khPingce.setState("2");
|
|
|
|
|
List<KhPingce> wPingces = khPingceService.selectKhPingceList(khPingce);
|
|
|
|
|
List<Long> wIds = wPingces.stream().map(KhPingce::getId).collect(Collectors.toList());
|
|
|
|
|
khPingceService.deleteKhPingceByIds2(wIds.toArray(new Long[wIds.size()]));
|
|
|
|
|
|
|
|
|
|
//进行中 的数据 清除关联的vote及voteemp数据为原始状态
|
|
|
|
|
KhPingce jxz = new KhPingce();
|
|
|
|
|
jxz.setState("1");
|
|
|
|
|
List<KhPingce> jxzPingces = khPingceService.selectKhPingceList(jxz);
|
|
|
|
|
List<Long> jxzIds = jxzPingces.stream().map(KhPingce::getId).collect(Collectors.toList());
|
|
|
|
|
for (Long jxzId : jxzIds) {
|
|
|
|
|
KhVote vote = new KhVote();
|
|
|
|
|
vote.setPingceId(jxzId);
|
|
|
|
|
List<KhVote> votes = khVoteService.selectKhVoteList(vote);
|
|
|
|
|
List<Long> vIds = votes.stream().map(KhVote::getId).collect(Collectors.toList());
|
|
|
|
|
if (vIds != null && vIds.size() > 0) {
|
|
|
|
|
//修改voteemp
|
|
|
|
|
for (Long vId : vIds) {
|
|
|
|
|
KhVoteEmp vemp = new KhVoteEmp();
|
|
|
|
|
vemp.setVoteId(vId);
|
|
|
|
|
List<KhVoteEmp> vEmps = khVoteEmpService.selectKhVoteEmpList(vemp);
|
|
|
|
|
if(vEmps != null && vEmps.size() > 0){
|
|
|
|
|
//修改关联的员工数据到最初创建状态
|
|
|
|
|
for (KhVoteEmp uPEmp : vEmps) {
|
|
|
|
|
uPEmp.setVoteNum(BigDecimal.ZERO);
|
|
|
|
|
uPEmp.setVoteScore(BigDecimal.ZERO);
|
|
|
|
|
uPEmp.setAvgScore(BigDecimal.ZERO);
|
|
|
|
|
uPEmp.setEndScore(BigDecimal.ZERO);
|
|
|
|
|
if(uPEmp.getKhitemTypeid().equals(1L)){
|
|
|
|
|
uPEmp.setOptionA(BigDecimal.ZERO);
|
|
|
|
|
uPEmp.setOptionB(BigDecimal.ZERO);
|
|
|
|
|
uPEmp.setOptionC(BigDecimal.ZERO);
|
|
|
|
|
uPEmp.setOptionD(BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
khVoteEmpService.updateKhVoteEmp(uPEmp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return toAjax(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|