package com.ruoyi.safety.controller;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.safety.pojo.SafetyAssessmentTask;
|
import com.ruoyi.safety.pojo.SafetyAssessmentTaskEmployee;
|
import com.ruoyi.safety.service.SafetyAssessmentTaskEmployeeService;
|
import com.ruoyi.safety.service.SafetyAssessmentTaskService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* 安环管理-测评任务接口。
|
*/
|
@RestController
|
@Api(tags = "安环管理-测评任务")
|
@RequestMapping("/safety/learning/assessment")
|
public class SafetyAssessmentTaskController extends SafetyControllerSupport {
|
|
@Autowired
|
private SafetyAssessmentTaskService taskService;
|
|
@Autowired
|
private SafetyAssessmentTaskEmployeeService taskEmployeeService;
|
|
/**
|
* 分页查询测评任务。
|
*/
|
@Log(title = "安环管理-测评任务-分页查询", businessType = BusinessType.OTHER)
|
@ApiOperation("分页查询测评任务")
|
@GetMapping("/list")
|
public AjaxResult list(Page<SafetyAssessmentTask> page, SafetyAssessmentTask query,
|
@RequestParam(value = "pageNum", required = false) Long pageNum,
|
@RequestParam(value = "pageSize", required = false) Long pageSize) {
|
return AjaxResult.success(taskService.queryPage(buildPage(page, pageNum, pageSize), query));
|
}
|
|
/**
|
* 开始测评,生成当前员工与测评任务的关联记录。
|
*/
|
@Log(title = "安环管理-测评任务-开始测评", businessType = BusinessType.INSERT)
|
@ApiOperation("开始测评")
|
@PostMapping("/start")
|
public AjaxResult start(@RequestBody SafetyAssessmentTaskEmployee request) {
|
return toAjax(taskEmployeeService.start(request));
|
}
|
|
/**
|
* 提交测评结果。
|
*/
|
@Log(title = "安环管理-测评任务-提交测评", businessType = BusinessType.UPDATE)
|
@ApiOperation("提交测评")
|
@PostMapping("/submit")
|
public AjaxResult submit(@RequestBody SafetyAssessmentTaskEmployee request) {
|
return toAjax(taskEmployeeService.submit(request));
|
}
|
}
|