123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- package com.ruoyi.sim.controller;
- import com.ruoyi.common.core.controller.BaseController;
- import com.ruoyi.common.core.domain.AjaxResult;
- import com.ruoyi.sim.domain.Fault;
- import com.ruoyi.sim.domain.RealExam;
- import com.ruoyi.sim.service.impl.CommSendService;
- import com.ruoyi.sim.service.impl.FaultService;
- import com.ruoyi.sim.service.impl.MajorService;
- import com.ruoyi.sim.service.impl.RealExamService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.List;
- @RestController
- @RequestMapping("/sim/iot")
- @Api("测试通信Controller")
- public class TestIotController extends BaseController {
- @Autowired
- private MajorService majorService;
- @Autowired
- private CommSendService commSendService;
- @Autowired
- private RealExamService realExamService;
- @Autowired
- private FaultService faultService;
- @ApiOperation("testIot通信")
- @GetMapping(value = "/{codeId}")
- public AjaxResult testIndex(@PathVariable("codeId") Integer codeId) {
- long examId = 2L;
- switch (codeId) {
- case 1: {
- commSendService.checkAllSimState();
- }
- break;
- case 2: {
- // commSnedService.clearOneFault(null, null, null);
- }
- break;
- case 3: {
- // commSnedService.readOneFaultResistance(null, null);
- }
- break;
- case 4: {
- // commSnedService.writeOneFault(null, null, null);
- }
- break;
- case 5: {
- // for (int i = 0; i < 100; i++) {
- // commSnedService.readOneFaultResistance(null, null);
- // }
- }
- break;
- case 6: {
- RealExam re = realExamService.selectRealExamByExamId(1L);
- commSendService.clearOneSimAllFaultByExam(re);
- }
- break;
- case 10: {
- commSendService.checkAllSimState();
- commSendService.clearAll();
- RealExam re = realExamService.selectRealExamByExamId(1L);
- commSendService.clearOneSimAllFaultByExam(re);
- }
- break;
- case 11: {
- commSendService.readAll();
- }
- break;
- case 12: {
- RealExam re = realExamService.selectRealExamByExamId(1L);
- commSendService.readOneExamAtLast(re);
- //
- }
- break;
- case 20: {
- realExamService.studentEnterRealExam(examId);
- //
- }
- break;
- case 21: {
- realExamService.studentLoopPrepareRealExam(examId);
- //
- }
- break;
- case 22: {
- realExamService.studentStartRealExam(examId);
- //
- }
- break;
- case 23: {
- realExamService.studentLoopAnsweringRealExam(examId);
- //
- }
- break;
- case 24: {
- realExamService.studentSubmitRealExam(examId);
- //
- }
- break;
- case 25: {
- realExamService.studentLoopPostRealExam(examId);
- //
- }
- case 66: {
- }
- break;
- }
- return AjaxResult.success();
- }
- @ApiOperation("testIot通信")
- @GetMapping(value = "/testIndex2/{codeId}")
- public AjaxResult testIndex2(@PathVariable("codeId") Integer codeId) {
- List<Fault> list = faultService.randomEnable3("0001");
- return AjaxResult.success(list);
- }
- }
|