|
|
|
|
@ -2,8 +2,14 @@ package com.ruoyi.kaohe.controller;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.kaohe.domain.KhPcEmp;
|
|
|
|
|
import com.ruoyi.kaohe.domain.KhVoteEmp;
|
|
|
|
|
import com.ruoyi.kaohe.service.IKhPcEmpService;
|
|
|
|
|
import com.ruoyi.kaohe.service.IKhVoteEmpService;
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
@ -33,6 +39,10 @@ public class KhVoteController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
@Autowired
|
|
|
|
|
private IKhVoteService khVoteService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IKhPcEmpService pcEmpService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IKhVoteEmpService voteEmpService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询投票评测列表
|
|
|
|
|
@ -75,9 +85,25 @@ public class KhVoteController extends BaseController
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:vote:add')")
|
|
|
|
|
@Log(title = "投票评测", businessType = BusinessType.INSERT)
|
|
|
|
|
@PostMapping
|
|
|
|
|
@Transactional
|
|
|
|
|
public AjaxResult add(@RequestBody KhVote khVote)
|
|
|
|
|
{
|
|
|
|
|
return toAjax(khVoteService.insertKhVote(khVote));
|
|
|
|
|
khVoteService.insertKhVote(khVote);
|
|
|
|
|
//根据评测id查询职工评测关联 职工
|
|
|
|
|
KhPcEmp query = new KhPcEmp();
|
|
|
|
|
query.setPcId(khVote.getPingceId());
|
|
|
|
|
List<KhPcEmp> pcEmps = pcEmpService.selectKhPcEmpList(query);
|
|
|
|
|
for(KhPcEmp pcEmp:pcEmps){
|
|
|
|
|
//新增投票选项关联表
|
|
|
|
|
KhVoteEmp voteEmp = new KhVoteEmp();
|
|
|
|
|
voteEmp.setEmpId(pcEmp.getEmpId());
|
|
|
|
|
voteEmp.setEmpName(pcEmp.getEmpName());
|
|
|
|
|
voteEmp.setVoteId(khVote.getId());
|
|
|
|
|
voteEmp.setVoteTitle(khVote.getVoteTitle());
|
|
|
|
|
voteEmp.setPercentage(khVote.getPercentage());
|
|
|
|
|
voteEmpService.insertKhVoteEmp(voteEmp);
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|