CaseperformanceController.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. package com.gyee.sampleimpala.controller;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.gyee.sampleimpala.common.result.JsonResult;
  4. import com.gyee.sampleimpala.common.result.ResultCode;
  5. import com.gyee.sampleimpala.model.kudu.Caseperformance;
  6. import com.gyee.sampleimpala.service.custom.GoldenService;
  7. import com.gyee.sampleimpala.service.kudu.CaseperformanceService;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.web.bind.annotation.*;
  10. import java.util.List;
  11. /**
  12. * 性能样本
  13. *
  14. * @author w
  15. * @since 2021-11-17
  16. import org.springframework.web.bind.annotation.CrossOrigin;
  17. import org.springframework.web.bind.annotation.RequestMapping;
  18. import org.springframework.web.bind.annotation.RestController;
  19. /**
  20. * 性能下降样本库
  21. */
  22. @CrossOrigin
  23. @RestController
  24. @RequestMapping("/case")
  25. public class CaseperformanceController {
  26. @Autowired
  27. private CaseperformanceService caseperformanceService;
  28. @Autowired
  29. private GoldenService goldenService;
  30. /**
  31. * 获取样本数据
  32. *
  33. * @param station 场站
  34. * @param model 风机模型
  35. * @param tag 样本类型
  36. * @param st 开始时间
  37. * @param et 结束时间
  38. * @return
  39. */
  40. @GetMapping("/performance/list")
  41. public JSONObject getPerformanceList(String station, String[] model, Integer tag,
  42. String st, String et) {
  43. List<Caseperformance> list = caseperformanceService.getPerformanceList(station, model, tag, st, et);
  44. return JsonResult.successData(ResultCode.SUCCESS, list);
  45. }
  46. /**
  47. * 新增样本
  48. *
  49. * @param performance 样本对象
  50. * @return
  51. */
  52. @PostMapping("/performance/add")
  53. public JSONObject addPerformance(@RequestBody Caseperformance performance) {
  54. boolean flag = caseperformanceService.addPerformance(performance);
  55. if (flag) {
  56. return JsonResult.success(ResultCode.SUCCESS);
  57. }
  58. return JsonResult.error(ResultCode.ERROR);
  59. }
  60. /**
  61. * 编辑样本
  62. *
  63. * @param performance 样本对象
  64. * @return
  65. */
  66. @PostMapping("/performance/edit")
  67. public JSONObject editPerformance(@RequestBody Caseperformance performance) {
  68. boolean flag = caseperformanceService.editPerformance(performance);
  69. if (flag) {
  70. return JsonResult.success(ResultCode.SUCCESS);
  71. }
  72. return JsonResult.error(ResultCode.ERROR);
  73. }
  74. /**
  75. * 删除样本
  76. *
  77. * @param id 样本id
  78. * @return
  79. */
  80. @PostMapping("/performance/remove")
  81. public JSONObject removePerformance(Integer id) {
  82. boolean flag = caseperformanceService.removePerformance(id);
  83. if (flag) {
  84. return JsonResult.success(ResultCode.SUCCESS);
  85. }
  86. return JsonResult.error(ResultCode.ERROR);
  87. }
  88. /**
  89. *
  90. * @param id 样本id(数组)
  91. * @param interval 数据时间间隔
  92. * @return
  93. */
  94. public JSONObject getCurve(
  95. @RequestParam(value = "id",required = false) Integer[] id,
  96. @RequestParam(value = "interval",required = false) Integer interval
  97. ) {
  98. return null;
  99. }
  100. }