|
|
|
@ -6,6 +6,8 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.kaohe.domain.*;
|
|
|
|
import com.ruoyi.kaohe.domain.*;
|
|
|
|
import com.ruoyi.kaohe.service.IKhPcEmpService;
|
|
|
|
import com.ruoyi.kaohe.service.IKhPcEmpService;
|
|
|
|
|
|
|
|
import com.ruoyi.kaohe.service.IKhVoteEmpService;
|
|
|
|
|
|
|
|
import com.ruoyi.kaohe.service.IKhVoteService;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
@ -33,20 +35,51 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("/kaohe/pingce")
|
|
|
|
@RequestMapping("/kaohe/pingce")
|
|
|
|
public class KhPingceController extends BaseController
|
|
|
|
public class KhPingceController extends BaseController {
|
|
|
|
{
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private IKhPingceService khPingceService;
|
|
|
|
private IKhPingceService khPingceService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private IKhPcEmpService pcEmpService;
|
|
|
|
private IKhPcEmpService pcEmpService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IKhVoteEmpService voteEmpService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IKhVoteService khVoteService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 生成考核结果
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
// @PreAuthorize("@ss.hasPermi('kaohe:pingce:list')")
|
|
|
|
|
|
|
|
@GetMapping("/generateResult")
|
|
|
|
|
|
|
|
public TableDataInfo generateResult(Long id) {
|
|
|
|
|
|
|
|
KhVote khVote = new KhVote();
|
|
|
|
|
|
|
|
khVote.setPingceId(id);
|
|
|
|
|
|
|
|
//查询该考核任务下的所有评分任务
|
|
|
|
|
|
|
|
List<KhVote> votes = khVoteService.selectKhVoteList(khVote);
|
|
|
|
|
|
|
|
for (KhVote vote : votes) {
|
|
|
|
|
|
|
|
KhVoteEmp khVoteEmp = new KhVoteEmp();
|
|
|
|
|
|
|
|
khVoteEmp.setVoteId(vote.getId());
|
|
|
|
|
|
|
|
//查询该评分任务对应的所有被考核对象详情
|
|
|
|
|
|
|
|
List<KhVoteEmp> khVoteEmps = voteEmpService.selectKhVoteEmpList(khVoteEmp);
|
|
|
|
|
|
|
|
for (KhVoteEmp voteEmp : khVoteEmps) {
|
|
|
|
|
|
|
|
//根据考核类型存储不同数据
|
|
|
|
|
|
|
|
if(vote.getKhitemTypeid().equals(1L)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if(vote.getKhitemTypeid().equals(2L)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return getDataTable(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询考核评测列表
|
|
|
|
* 查询考核评测列表
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:pingce:list')")
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:pingce:list')")
|
|
|
|
@GetMapping("/list")
|
|
|
|
@GetMapping("/list")
|
|
|
|
public TableDataInfo list(KhPingce khPingce)
|
|
|
|
public TableDataInfo list(KhPingce khPingce) {
|
|
|
|
{
|
|
|
|
|
|
|
|
startPage();
|
|
|
|
startPage();
|
|
|
|
List<KhPingce> list = khPingceService.selectKhPingceList(khPingce);
|
|
|
|
List<KhPingce> list = khPingceService.selectKhPingceList(khPingce);
|
|
|
|
return getDataTable(list);
|
|
|
|
return getDataTable(list);
|
|
|
|
@ -58,8 +91,7 @@ public class KhPingceController extends BaseController
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:pingce:export')")
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:pingce:export')")
|
|
|
|
@Log(title = "考核评测", businessType = BusinessType.EXPORT)
|
|
|
|
@Log(title = "考核评测", businessType = BusinessType.EXPORT)
|
|
|
|
@PostMapping("/export")
|
|
|
|
@PostMapping("/export")
|
|
|
|
public void export(HttpServletResponse response, KhPingce khPingce)
|
|
|
|
public void export(HttpServletResponse response, KhPingce khPingce) {
|
|
|
|
{
|
|
|
|
|
|
|
|
List<KhPingce> list = khPingceService.selectKhPingceList(khPingce);
|
|
|
|
List<KhPingce> list = khPingceService.selectKhPingceList(khPingce);
|
|
|
|
ExcelUtil<KhPingce> util = new ExcelUtil<KhPingce>(KhPingce.class);
|
|
|
|
ExcelUtil<KhPingce> util = new ExcelUtil<KhPingce>(KhPingce.class);
|
|
|
|
util.exportExcel(response, list, "考核评测数据");
|
|
|
|
util.exportExcel(response, list, "考核评测数据");
|
|
|
|
@ -70,8 +102,7 @@ public class KhPingceController extends BaseController
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:pingce:query')")
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:pingce:query')")
|
|
|
|
@GetMapping(value = "/{id}")
|
|
|
|
@GetMapping(value = "/{id}")
|
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return success(khPingceService.selectKhPingceById(id));
|
|
|
|
return success(khPingceService.selectKhPingceById(id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -82,13 +113,12 @@ public class KhPingceController extends BaseController
|
|
|
|
@Log(title = "考核评测", businessType = BusinessType.INSERT)
|
|
|
|
@Log(title = "考核评测", businessType = BusinessType.INSERT)
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@PostMapping
|
|
|
|
@PostMapping
|
|
|
|
public AjaxResult add(@RequestBody KhPingce khPingce)
|
|
|
|
public AjaxResult add(@RequestBody KhPingce khPingce) {
|
|
|
|
{
|
|
|
|
|
|
|
|
khPingceService.insertKhPingce(khPingce);
|
|
|
|
khPingceService.insertKhPingce(khPingce);
|
|
|
|
//增加关联表
|
|
|
|
//增加关联表
|
|
|
|
List<Bkhdx> pcEmps = khPingce.getPcBkhdxs();
|
|
|
|
List<Bkhdx> pcEmps = khPingce.getPcBkhdxs();
|
|
|
|
if(pcEmps !=null&& pcEmps.size()>0){
|
|
|
|
if (pcEmps != null && pcEmps.size() > 0) {
|
|
|
|
for(Bkhdx item:pcEmps){
|
|
|
|
for (Bkhdx item : pcEmps) {
|
|
|
|
KhPcEmp pcEmp = new KhPcEmp();
|
|
|
|
KhPcEmp pcEmp = new KhPcEmp();
|
|
|
|
pcEmp.setPcId(khPingce.getId());
|
|
|
|
pcEmp.setPcId(khPingce.getId());
|
|
|
|
pcEmp.setBkhdxId(item.getBkhdxId());
|
|
|
|
pcEmp.setBkhdxId(item.getBkhdxId());
|
|
|
|
@ -108,22 +138,21 @@ public class KhPingceController extends BaseController
|
|
|
|
@Log(title = "考核评测", businessType = BusinessType.UPDATE)
|
|
|
|
@Log(title = "考核评测", businessType = BusinessType.UPDATE)
|
|
|
|
@PutMapping
|
|
|
|
@PutMapping
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public AjaxResult edit(@RequestBody KhPingce khPingce)
|
|
|
|
public AjaxResult edit(@RequestBody KhPingce khPingce) {
|
|
|
|
{
|
|
|
|
|
|
|
|
khPingceService.updateKhPingce(khPingce);
|
|
|
|
khPingceService.updateKhPingce(khPingce);
|
|
|
|
|
|
|
|
|
|
|
|
List<Bkhdx> pcEmps = khPingce.getPcBkhdxs();
|
|
|
|
List<Bkhdx> pcEmps = khPingce.getPcBkhdxs();
|
|
|
|
if(pcEmps !=null&& pcEmps.size()>0){
|
|
|
|
if (pcEmps != null && pcEmps.size() > 0) {
|
|
|
|
//删除原来关联
|
|
|
|
//删除原来关联
|
|
|
|
KhPcEmp query = new KhPcEmp();
|
|
|
|
KhPcEmp query = new KhPcEmp();
|
|
|
|
query.setPcId(khPingce.getId());
|
|
|
|
query.setPcId(khPingce.getId());
|
|
|
|
List<KhPcEmp> temItems = pcEmpService.selectKhPcEmpList(query);
|
|
|
|
List<KhPcEmp> temItems = pcEmpService.selectKhPcEmpList(query);
|
|
|
|
List<Long> ids = temItems.stream().map(KhPcEmp::getId).collect(Collectors.toList());
|
|
|
|
List<Long> ids = temItems.stream().map(KhPcEmp::getId).collect(Collectors.toList());
|
|
|
|
if(ids!=null&&ids.size()>0){
|
|
|
|
if (ids != null && ids.size() > 0) {
|
|
|
|
pcEmpService.deleteKhPcEmpByIds(ids.toArray(new Long[ids.size()]));
|
|
|
|
pcEmpService.deleteKhPcEmpByIds(ids.toArray(new Long[ids.size()]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//增加新的关联
|
|
|
|
//增加新的关联
|
|
|
|
for(Bkhdx item:pcEmps){
|
|
|
|
for (Bkhdx item : pcEmps) {
|
|
|
|
KhPcEmp pcEmp = new KhPcEmp();
|
|
|
|
KhPcEmp pcEmp = new KhPcEmp();
|
|
|
|
pcEmp.setPcId(khPingce.getId());
|
|
|
|
pcEmp.setPcId(khPingce.getId());
|
|
|
|
pcEmp.setBkhdxId(item.getBkhdxId());
|
|
|
|
pcEmp.setBkhdxId(item.getBkhdxId());
|
|
|
|
@ -142,12 +171,11 @@ public class KhPingceController extends BaseController
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:pingce:remove')")
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:pingce:remove')")
|
|
|
|
@Log(title = "考核评测", businessType = BusinessType.DELETE)
|
|
|
|
@Log(title = "考核评测", businessType = BusinessType.DELETE)
|
|
|
|
@DeleteMapping("/{ids}")
|
|
|
|
@DeleteMapping("/{ids}")
|
|
|
|
public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
|
{
|
|
|
|
for (Long id : ids) {
|
|
|
|
for(Long id:ids){
|
|
|
|
|
|
|
|
KhPingce khPingce = khPingceService.selectKhPingceById(id);
|
|
|
|
KhPingce khPingce = khPingceService.selectKhPingceById(id);
|
|
|
|
if(!khPingce.getState().equals("0")){
|
|
|
|
if (!khPingce.getState().equals("0")) {
|
|
|
|
return AjaxResult.error("评测:"+khPingce.getPcTitle()+" 不是未开始状态,不允许删除");
|
|
|
|
return AjaxResult.error("评测:" + khPingce.getPcTitle() + " 不是未开始状态,不允许删除");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return toAjax(khPingceService.deleteKhPingceByIds(ids));
|
|
|
|
return toAjax(khPingceService.deleteKhPingceByIds(ids));
|
|
|
|
|