|
|
|
|
@ -1,14 +1,18 @@
|
|
|
|
|
package com.ruoyi.kaohe.controller;
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.kaohe.domain.KhPcEmp;
|
|
|
|
|
import com.ruoyi.kaohe.domain.KhPingce;
|
|
|
|
|
import com.ruoyi.kaohe.domain.KhVoteEmp;
|
|
|
|
|
import com.ruoyi.kaohe.service.IKhPcEmpService;
|
|
|
|
|
import com.ruoyi.kaohe.service.IKhVoteEmpService;
|
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
@ -35,8 +39,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
*/
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/kaohe/vote")
|
|
|
|
|
public class KhVoteController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
public class KhVoteController extends BaseController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IKhVoteService khVoteService;
|
|
|
|
|
@Autowired
|
|
|
|
|
@ -44,24 +47,48 @@ public class KhVoteController extends BaseController
|
|
|
|
|
@Autowired
|
|
|
|
|
private IKhVoteEmpService voteEmpService;
|
|
|
|
|
|
|
|
|
|
/*@Scheduled(cron = "0 * * * * ?") // 每分钟的第0秒执行一次 监测时间修改评分状态
|
|
|
|
|
public void performTask() {
|
|
|
|
|
System.out.println("进入定时任务-------------------------------------------------------------");
|
|
|
|
|
//获取所有未完成的评分任务
|
|
|
|
|
List<KhVote> list = khVoteService.selectUnfinishedVote();
|
|
|
|
|
for (KhVote vote : list) {
|
|
|
|
|
Date sTime = vote.getsTime();
|
|
|
|
|
Date eTime = vote.geteTime();
|
|
|
|
|
String state = vote.getState();
|
|
|
|
|
// 获取当前日期和时间
|
|
|
|
|
Date now = new Date();
|
|
|
|
|
// 根据当前时间与开始、结束时间关系 修改状态
|
|
|
|
|
if (state.equals("0") && (now.after(sTime) && now.before(eTime))) {
|
|
|
|
|
vote.setState("1");
|
|
|
|
|
khVoteService.updateKhVote(vote);
|
|
|
|
|
System.out.println("执行定时任务: " + System.currentTimeMillis() + " 修改评分任务: " + vote.getVoteTitle() + " 状态为进行中");
|
|
|
|
|
}
|
|
|
|
|
if (now.after(eTime)) {
|
|
|
|
|
vote.setState("2");
|
|
|
|
|
khVoteService.updateKhVote(vote);
|
|
|
|
|
System.out.println("执行定时任务: " + System.currentTimeMillis() + " 修改评分任务: " + vote.getVoteTitle() + " 状态为已完成");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询投票评测列表
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:vote:list')")
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
public TableDataInfo list(KhVote khVote)
|
|
|
|
|
{
|
|
|
|
|
public TableDataInfo list(KhVote khVote) {
|
|
|
|
|
startPage();
|
|
|
|
|
List<KhVote> list = khVoteService.selectKhVoteList(khVote);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 首页根据pingceId、itemIds、state查询投票评测列表
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:vote:list')")
|
|
|
|
|
@GetMapping("/listByConditons")
|
|
|
|
|
public TableDataInfo getListByConditons(KhVote khVote)
|
|
|
|
|
{
|
|
|
|
|
public TableDataInfo getListByConditons(KhVote khVote) {
|
|
|
|
|
startPage();
|
|
|
|
|
List<KhVote> list = khVoteService.getListByPcIdAndItemIds(khVote);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
@ -73,8 +100,7 @@ public class KhVoteController extends BaseController
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:vote:export')")
|
|
|
|
|
@Log(title = "投票评测", businessType = BusinessType.EXPORT)
|
|
|
|
|
@PostMapping("/export")
|
|
|
|
|
public void export(HttpServletResponse response, KhVote khVote)
|
|
|
|
|
{
|
|
|
|
|
public void export(HttpServletResponse response, KhVote khVote) {
|
|
|
|
|
List<KhVote> list = khVoteService.selectKhVoteList(khVote);
|
|
|
|
|
ExcelUtil<KhVote> util = new ExcelUtil<KhVote>(KhVote.class);
|
|
|
|
|
util.exportExcel(response, list, "投票评测数据");
|
|
|
|
|
@ -85,8 +111,7 @@ public class KhVoteController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:vote:query')")
|
|
|
|
|
@GetMapping(value = "/{id}")
|
|
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
|
|
return success(khVoteService.selectKhVoteById(id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -97,14 +122,13 @@ public class KhVoteController extends BaseController
|
|
|
|
|
@Log(title = "投票评测", businessType = BusinessType.INSERT)
|
|
|
|
|
@PostMapping
|
|
|
|
|
@Transactional
|
|
|
|
|
public AjaxResult add(@RequestBody KhVote khVote)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult add(@RequestBody KhVote khVote) {
|
|
|
|
|
khVoteService.insertKhVote(khVote);
|
|
|
|
|
//根据评测id查询职工评测关联 职工
|
|
|
|
|
KhPcEmp query = new KhPcEmp();
|
|
|
|
|
query.setPcId(khVote.getPingceId());
|
|
|
|
|
List<KhPcEmp> pcEmps = pcEmpService.selectKhPcEmpList(query);
|
|
|
|
|
for(KhPcEmp pcEmp:pcEmps){
|
|
|
|
|
for (KhPcEmp pcEmp : pcEmps) {
|
|
|
|
|
//新增投票选项关联表
|
|
|
|
|
KhVoteEmp voteEmp = new KhVoteEmp();
|
|
|
|
|
voteEmp.setBkhdxId(pcEmp.getBkhdxId());
|
|
|
|
|
@ -123,8 +147,7 @@ public class KhVoteController extends BaseController
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:vote:edit')")
|
|
|
|
|
@Log(title = "投票评测", businessType = BusinessType.UPDATE)
|
|
|
|
|
@PutMapping
|
|
|
|
|
public AjaxResult edit(@RequestBody KhVote khVote)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult edit(@RequestBody KhVote khVote) {
|
|
|
|
|
return toAjax(khVoteService.updateKhVote(khVote));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -134,8 +157,7 @@ public class KhVoteController extends BaseController
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:vote:remove')")
|
|
|
|
|
@Log(title = "投票评测", businessType = BusinessType.DELETE)
|
|
|
|
|
@DeleteMapping("/{ids}")
|
|
|
|
|
public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
|
|
return toAjax(khVoteService.deleteKhVoteByIds(ids));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|