123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- package com.ips.system.controller;
- import java.util.List;
- import javax.servlet.http.HttpServletResponse;
- import com.fasterxml.jackson.core.JsonProcessingException;
- import com.ips.common.utils.StringUtils;
- import com.ips.system.domain.Distillation;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import com.ips.common.annotation.Log;
- import com.ips.common.core.controller.BaseController;
- import com.ips.common.core.domain.AjaxResult;
- import com.ips.common.enums.BusinessType;
- import com.ips.system.domain.ClassifyTest;
- import com.ips.system.service.IClassifyTestService;
- import com.ips.common.utils.poi.ExcelUtil;
- import com.ips.common.core.page.TableDataInfo;
- /**
- * 分类测试Controller
- *
- * @author Allen
- * @date 2025-05-21
- */
- @RestController
- @RequestMapping("/biz/test")
- public class ClassifyTestController extends BaseController
- {
- @Autowired
- private IClassifyTestService classifyTestService;
- /**
- * 查询分类测试列表
- */
- @PreAuthorize("@ss.hasPermi('biz:test:list')")
- @GetMapping("/list")
- public TableDataInfo list(ClassifyTest classifyTest)
- {
- startPage();
- List<ClassifyTest> list = classifyTestService.selectClassifyTestList(classifyTest);
- return getDataTable(list);
- }
- /**
- * 导出分类测试列表
- */
- @PreAuthorize("@ss.hasPermi('biz:test:export')")
- @Log(title = "分类测试", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, ClassifyTest classifyTest)
- {
- List<ClassifyTest> list = classifyTestService.selectClassifyTestList(classifyTest);
- ExcelUtil<ClassifyTest> util = new ExcelUtil<ClassifyTest>(ClassifyTest.class);
- util.exportExcel(response, list, "分类测试数据");
- }
- /**
- * 获取分类测试详细信息
- */
- @PreAuthorize("@ss.hasPermi('biz:test:query')")
- @GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id)
- {
- return success(classifyTestService.selectClassifyTestById(id));
- }
- /**
- * 新增分类测试
- */
- @PreAuthorize("@ss.hasPermi('biz:test:add')")
- @Log(title = "分类测试", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody ClassifyTest classifyTest)
- {
- return toAjax(classifyTestService.insertClassifyTest(classifyTest));
- }
- /**
- * 修改分类测试
- */
- @PreAuthorize("@ss.hasPermi('biz:test:edit')")
- @Log(title = "分类测试", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody ClassifyTest classifyTest)
- {
- return toAjax(classifyTestService.updateClassifyTest(classifyTest));
- }
- /**
- * 删除分类测试
- */
- @PreAuthorize("@ss.hasPermi('biz:test:remove')")
- @Log(title = "分类测试", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- public AjaxResult remove(@PathVariable Long[] ids)
- {
- return toAjax(classifyTestService.deleteClassifyTestByIds(ids));
- }
- /**
- * 运行算法模型
- * @param id
- * @return
- * @throws JsonProcessingException
- */
- @PreAuthorize("@ss.hasPermi('biz:test:add')")
- @GetMapping(value = "/run/{id}")
- public AjaxResult run(@PathVariable("id") Long id) throws JsonProcessingException {
- String errorMsg = classifyTestService.run(id);
- if(StringUtils.isEmpty(errorMsg)){
- return success(errorMsg);
- } else {
- return error(errorMsg);
- }
- }
- /**
- * 获取结果详情
- * @param id
- * @return
- * @throws JsonProcessingException
- */
- @PreAuthorize("@ss.hasPermi('biz:test:add')")
- @GetMapping(value = "/getResultDetails/{id}")
- public AjaxResult getResultDetails(@PathVariable("id") Long id) throws JsonProcessingException {
- ClassifyTest obj = classifyTestService.getResultDetails(id);
- if(obj != null){
- return success(obj);
- } else {
- return error("获取详情失败");
- }
- }
- @PreAuthorize("@ss.hasPermi('biz:test:add')")
- @GetMapping(value = "/getTaskStatusIsChanged/{id}")
- public AjaxResult getTaskStatusIsChanged(@PathVariable("id") Long id){
- return success(classifyTestService.getTaskStatusIsChanged(id));
- }
- }
|