|
|
|
|
@ -8,9 +8,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
import com.ruoyi.kaohe.domain.*;
|
|
|
|
|
import com.ruoyi.kaohe.service.IKhPcEmpService;
|
|
|
|
|
import com.ruoyi.kaohe.service.IKhVoteEmpService;
|
|
|
|
|
import com.ruoyi.kaohe.service.IKhVoteService;
|
|
|
|
|
import com.ruoyi.kaohe.service.*;
|
|
|
|
|
import com.ruoyi.kaohe.service.impl.KhVoteServiceImpl;
|
|
|
|
|
import com.ruoyi.kaohe.util.PinYinUtil;
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
@ -21,7 +19,6 @@ import com.ruoyi.common.annotation.Log;
|
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
|
import com.ruoyi.kaohe.service.IKhPingceService;
|
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
|
|
|
|
|
@ -42,6 +39,8 @@ public class KhPingceController extends BaseController {
|
|
|
|
|
private IKhVoteService khVoteService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IKhVoteEmpService khVoteEmpService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IKhVoteRecardService khVoteRecardService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询考核评测列表
|
|
|
|
|
@ -156,7 +155,7 @@ public class KhPingceController extends BaseController {
|
|
|
|
|
* 传参:id、pcBkhdxs、addOrDel、bkhdxType
|
|
|
|
|
*/
|
|
|
|
|
// @PreAuthorize("@ss.hasPermi('kaohe:pingce:modifyBkhdx')")
|
|
|
|
|
@Log(title = "考核评测", businessType = BusinessType.UPDATE)
|
|
|
|
|
@Log(title = "任务添加/删除被考核对象", businessType = BusinessType.UPDATE)
|
|
|
|
|
@PutMapping("/modifyBkhdx")
|
|
|
|
|
@Transactional
|
|
|
|
|
public AjaxResult modifyBkhdx(@RequestBody ModifyBkhdxParam bkhdxParam) {
|
|
|
|
|
@ -204,10 +203,17 @@ public class KhPingceController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//删除关联
|
|
|
|
|
List<Long> ids = new ArrayList<>();
|
|
|
|
|
KhPcEmp query = new KhPcEmp();
|
|
|
|
|
query.setPcId(id);
|
|
|
|
|
List<KhPcEmp> temItems = pcEmpService.selectKhPcEmpList(query);
|
|
|
|
|
List<Long> ids = temItems.stream().map(KhPcEmp::getId).collect(Collectors.toList());
|
|
|
|
|
List<KhPcEmp> pcEmpsItems = pcEmpService.selectKhPcEmpList(query);
|
|
|
|
|
for (Bkhdx pcEmp : pcEmps) {
|
|
|
|
|
for (KhPcEmp pcEmpsItem : pcEmpsItems) {
|
|
|
|
|
if (pcEmpsItem.getBkhdxId().equals(pcEmp.getBkhdxId())) {
|
|
|
|
|
ids.add(pcEmpsItem.getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ids != null && ids.size() > 0) {
|
|
|
|
|
pcEmpService.deleteKhPcEmpByIds(ids.toArray(new Long[ids.size()]));
|
|
|
|
|
}
|
|
|
|
|
@ -237,18 +243,18 @@ public class KhPingceController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ids传入为null——————清理数据库时调用, 清除已完成的全部关联数据、进行中的仅清除voteemp的打票成绩 保留考核项及关联的voteemp
|
|
|
|
|
* 清理数据库时:vote_recard表手动直接全部清除 截断表即可
|
|
|
|
|
* 清理数据库时:vote_recard表截断表即可
|
|
|
|
|
* ids有值 按任务id-----修改所有关联的vote的voteemp数据为原始状态
|
|
|
|
|
*/
|
|
|
|
|
// @PreAuthorize("@ss.hasPermi('kaohe:pingce:remove')")
|
|
|
|
|
@Log(title = "考核评测", businessType = BusinessType.DELETE)
|
|
|
|
|
@Log(title = "任务清除打分数据", businessType = BusinessType.DELETE)
|
|
|
|
|
@DeleteMapping("/clean")
|
|
|
|
|
@Transactional
|
|
|
|
|
public AjaxResult removeTest(@RequestParam Long[] ids) {
|
|
|
|
|
if (ids != null && ids.length > 0) { //按任务id-----修改所有关联的vote的voteemp数据为原始状态
|
|
|
|
|
for (Long jxzId : ids) {
|
|
|
|
|
for (Long cleanId : ids) {
|
|
|
|
|
KhVote vote = new KhVote();
|
|
|
|
|
vote.setPingceId(jxzId);
|
|
|
|
|
vote.setPingceId(cleanId);
|
|
|
|
|
List<KhVote> votes = khVoteService.selectKhVoteList(vote);
|
|
|
|
|
if (votes != null && votes.size() > 0) {
|
|
|
|
|
List<Long> vIds = votes.stream().map(KhVote::getId).collect(Collectors.toList());
|
|
|
|
|
@ -274,9 +280,18 @@ public class KhPingceController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//清空投票记录表 根据pcId查询
|
|
|
|
|
KhVoteRecard vr = new KhVoteRecard();
|
|
|
|
|
vr.setPcId(cleanId);
|
|
|
|
|
List<KhVoteRecard> khVoteRecards = khVoteRecardService.selectKhVoteRecardList(vr);
|
|
|
|
|
if (khVoteRecards != null & khVoteRecards.size() > 0) {
|
|
|
|
|
List<Long> vrIds = khVoteRecards.stream().map(KhVoteRecard::getId).collect(Collectors.toList());
|
|
|
|
|
khVoteRecardService.deleteKhVoteRecardByIds(vrIds.toArray(new Long[vrIds.size()]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {//null认为清理所有 (已完成删除全部数据,进行中数据清除评分数据)
|
|
|
|
|
return toAjax(1);
|
|
|
|
|
} /*else {//null认为清理所有 (已完成删除全部数据,进行中数据清除评分数据)
|
|
|
|
|
//已完成的数据直接清除任务及所有关联数据————完全删除已完成任务
|
|
|
|
|
KhPingce khPingce = new KhPingce();
|
|
|
|
|
khPingce.setState("2");
|
|
|
|
|
@ -319,11 +334,21 @@ public class KhPingceController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//清空投票记录表 根据pcId查询
|
|
|
|
|
KhVoteRecard vr = new KhVoteRecard();
|
|
|
|
|
vr.setPcId(jxzId);
|
|
|
|
|
List<KhVoteRecard> khVoteRecards = khVoteRecardService.selectKhVoteRecardList(vr);
|
|
|
|
|
if (khVoteRecards != null & khVoteRecards.size() > 0) {
|
|
|
|
|
List<Long> vrIds = khVoteRecards.stream().map(KhVoteRecard::getId).collect(Collectors.toList());
|
|
|
|
|
khVoteRecardService.deleteKhVoteRecardByIds(vrIds.toArray(new Long[vrIds.size()]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
AjaxResult.success("按要求清理数据库成功")
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
return toAjax(1);
|
|
|
|
|
return AjaxResult.error("请选择需要清理的考核任务!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|