TestIotController.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. package com.ruoyi.sim.controller;
  2. import com.ruoyi.common.core.controller.BaseController;
  3. import com.ruoyi.common.core.domain.AjaxResult;
  4. import com.ruoyi.sim.domain.Fault;
  5. import com.ruoyi.sim.domain.RealExam;
  6. import com.ruoyi.sim.service.impl.CommSendService;
  7. import com.ruoyi.sim.service.impl.FaultService;
  8. import com.ruoyi.sim.service.impl.MajorService;
  9. import com.ruoyi.sim.service.impl.RealExamService;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiOperation;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.GetMapping;
  14. import org.springframework.web.bind.annotation.PathVariable;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RestController;
  17. import java.util.List;
  18. @RestController
  19. @RequestMapping("/sim/iot")
  20. @Api("测试通信Controller")
  21. public class TestIotController extends BaseController {
  22. @Autowired
  23. private MajorService majorService;
  24. @Autowired
  25. private CommSendService commSendService;
  26. @Autowired
  27. private RealExamService realExamService;
  28. @Autowired
  29. private FaultService faultService;
  30. @ApiOperation("testIot通信")
  31. @GetMapping(value = "/{codeId}")
  32. public AjaxResult testIndex(@PathVariable("codeId") Integer codeId) {
  33. long examId = 2L;
  34. switch (codeId) {
  35. case 1: {
  36. commSendService.checkAllSimState();
  37. }
  38. break;
  39. case 2: {
  40. // commSnedService.clearOneFault(null, null, null);
  41. }
  42. break;
  43. case 3: {
  44. // commSnedService.readOneFaultResistance(null, null);
  45. }
  46. break;
  47. case 4: {
  48. // commSnedService.writeOneFault(null, null, null);
  49. }
  50. break;
  51. case 5: {
  52. // for (int i = 0; i < 100; i++) {
  53. // commSnedService.readOneFaultResistance(null, null);
  54. // }
  55. }
  56. break;
  57. case 6: {
  58. RealExam re = realExamService.selectRealExamByExamId(1L);
  59. commSendService.clearOneSimAllFaultByExam(re);
  60. }
  61. break;
  62. case 10: {
  63. commSendService.checkAllSimState();
  64. commSendService.clearAll();
  65. RealExam re = realExamService.selectRealExamByExamId(1L);
  66. commSendService.clearOneSimAllFaultByExam(re);
  67. }
  68. break;
  69. case 11: {
  70. commSendService.readAll();
  71. }
  72. break;
  73. case 12: {
  74. RealExam re = realExamService.selectRealExamByExamId(1L);
  75. commSendService.readOneExamAtLast(re);
  76. //
  77. }
  78. break;
  79. case 20: {
  80. realExamService.studentEnterRealExam(examId);
  81. //
  82. }
  83. break;
  84. case 21: {
  85. realExamService.studentLoopPrepareRealExam(examId);
  86. //
  87. }
  88. break;
  89. case 22: {
  90. realExamService.studentStartRealExam(examId);
  91. //
  92. }
  93. break;
  94. case 23: {
  95. realExamService.studentLoopAnsweringRealExam(examId);
  96. //
  97. }
  98. break;
  99. case 24: {
  100. realExamService.studentSubmitRealExam(examId);
  101. //
  102. }
  103. break;
  104. case 25: {
  105. realExamService.studentLoopPostRealExam(examId);
  106. //
  107. }
  108. case 66: {
  109. }
  110. break;
  111. }
  112. return AjaxResult.success();
  113. }
  114. @ApiOperation("testIot通信")
  115. @GetMapping(value = "/testIndex2/{codeId}")
  116. public AjaxResult testIndex2(@PathVariable("codeId") Integer codeId) {
  117. List<Fault> list = faultService.randomEnable3("0001");
  118. return AjaxResult.success(list);
  119. }
  120. }