ClassifyTestController.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. package com.ips.system.controller;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletResponse;
  4. import com.fasterxml.jackson.core.JsonProcessingException;
  5. import com.ips.common.utils.StringUtils;
  6. import com.ips.system.domain.Distillation;
  7. import org.springframework.security.access.prepost.PreAuthorize;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.web.bind.annotation.GetMapping;
  10. import org.springframework.web.bind.annotation.PostMapping;
  11. import org.springframework.web.bind.annotation.PutMapping;
  12. import org.springframework.web.bind.annotation.DeleteMapping;
  13. import org.springframework.web.bind.annotation.PathVariable;
  14. import org.springframework.web.bind.annotation.RequestBody;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RestController;
  17. import com.ips.common.annotation.Log;
  18. import com.ips.common.core.controller.BaseController;
  19. import com.ips.common.core.domain.AjaxResult;
  20. import com.ips.common.enums.BusinessType;
  21. import com.ips.system.domain.ClassifyTest;
  22. import com.ips.system.service.IClassifyTestService;
  23. import com.ips.common.utils.poi.ExcelUtil;
  24. import com.ips.common.core.page.TableDataInfo;
  25. /**
  26. * 分类测试Controller
  27. *
  28. * @author Allen
  29. * @date 2025-05-21
  30. */
  31. @RestController
  32. @RequestMapping("/biz/test")
  33. public class ClassifyTestController extends BaseController
  34. {
  35. @Autowired
  36. private IClassifyTestService classifyTestService;
  37. /**
  38. * 查询分类测试列表
  39. */
  40. @PreAuthorize("@ss.hasPermi('biz:test:list')")
  41. @GetMapping("/list")
  42. public TableDataInfo list(ClassifyTest classifyTest)
  43. {
  44. startPage();
  45. List<ClassifyTest> list = classifyTestService.selectClassifyTestList(classifyTest);
  46. return getDataTable(list);
  47. }
  48. /**
  49. * 导出分类测试列表
  50. */
  51. @PreAuthorize("@ss.hasPermi('biz:test:export')")
  52. @Log(title = "分类测试", businessType = BusinessType.EXPORT)
  53. @PostMapping("/export")
  54. public void export(HttpServletResponse response, ClassifyTest classifyTest)
  55. {
  56. List<ClassifyTest> list = classifyTestService.selectClassifyTestList(classifyTest);
  57. ExcelUtil<ClassifyTest> util = new ExcelUtil<ClassifyTest>(ClassifyTest.class);
  58. util.exportExcel(response, list, "分类测试数据");
  59. }
  60. /**
  61. * 获取分类测试详细信息
  62. */
  63. @PreAuthorize("@ss.hasPermi('biz:test:query')")
  64. @GetMapping(value = "/{id}")
  65. public AjaxResult getInfo(@PathVariable("id") Long id)
  66. {
  67. return success(classifyTestService.selectClassifyTestById(id));
  68. }
  69. /**
  70. * 新增分类测试
  71. */
  72. @PreAuthorize("@ss.hasPermi('biz:test:add')")
  73. @Log(title = "分类测试", businessType = BusinessType.INSERT)
  74. @PostMapping
  75. public AjaxResult add(@RequestBody ClassifyTest classifyTest)
  76. {
  77. return toAjax(classifyTestService.insertClassifyTest(classifyTest));
  78. }
  79. /**
  80. * 修改分类测试
  81. */
  82. @PreAuthorize("@ss.hasPermi('biz:test:edit')")
  83. @Log(title = "分类测试", businessType = BusinessType.UPDATE)
  84. @PutMapping
  85. public AjaxResult edit(@RequestBody ClassifyTest classifyTest)
  86. {
  87. return toAjax(classifyTestService.updateClassifyTest(classifyTest));
  88. }
  89. /**
  90. * 删除分类测试
  91. */
  92. @PreAuthorize("@ss.hasPermi('biz:test:remove')")
  93. @Log(title = "分类测试", businessType = BusinessType.DELETE)
  94. @DeleteMapping("/{ids}")
  95. public AjaxResult remove(@PathVariable Long[] ids)
  96. {
  97. return toAjax(classifyTestService.deleteClassifyTestByIds(ids));
  98. }
  99. /**
  100. * 运行算法模型
  101. * @param id
  102. * @return
  103. * @throws JsonProcessingException
  104. */
  105. @PreAuthorize("@ss.hasPermi('biz:test:add')")
  106. @GetMapping(value = "/run/{id}")
  107. public AjaxResult run(@PathVariable("id") Long id) throws JsonProcessingException {
  108. String errorMsg = classifyTestService.run(id);
  109. if(StringUtils.isEmpty(errorMsg)){
  110. return success(errorMsg);
  111. } else {
  112. return error(errorMsg);
  113. }
  114. }
  115. /**
  116. * 获取结果详情
  117. * @param id
  118. * @return
  119. * @throws JsonProcessingException
  120. */
  121. @PreAuthorize("@ss.hasPermi('biz:test:add')")
  122. @GetMapping(value = "/getResultDetails/{id}")
  123. public AjaxResult getResultDetails(@PathVariable("id") Long id) throws JsonProcessingException {
  124. ClassifyTest obj = classifyTestService.getResultDetails(id);
  125. if(obj != null){
  126. return success(obj);
  127. } else {
  128. return error("获取详情失败");
  129. }
  130. }
  131. @PreAuthorize("@ss.hasPermi('biz:test:add')")
  132. @GetMapping(value = "/getTaskStatusIsChanged/{id}")
  133. public AjaxResult getTaskStatusIsChanged(@PathVariable("id") Long id){
  134. return success(classifyTestService.getTaskStatusIsChanged(id));
  135. }
  136. }