| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.DeviceInf; |
| | | import com.whyc.pojo.TestPlan; |
| | | import com.whyc.service.DeviceInfService; |
| | | import com.whyc.service.TestPlanService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("testPlan") |
| | | @Api(tags = "试验计划") |
| | | @Api(tags = "试验计划、试验结论") |
| | | @Slf4j |
| | | public class TestPlanController { |
| | | @Autowired |
| | | private TestPlanService service; |
| | | @Autowired |
| | | private DeviceInfService deviceInfService; |
| | | |
| | | |
| | | @GetMapping("all") |
| | | @ApiOperation(value = "查询所有-分页") |
| | |
| | | return service.getPageByCondition(pageNum,pageSize,testPlan); |
| | | } |
| | | |
| | | @PostMapping("conclusion") |
| | | @ApiOperation(value = "试验结论查询分页-根据筛选条件") |
| | | public Response<IPage<TestPlan>> getConclusion(@RequestParam int pageNum, @RequestParam int pageSize, @RequestBody TestPlan testPlan){ |
| | | return service.getConclusion(pageNum,pageSize,testPlan); |
| | | } |
| | | |
| | | @GetMapping |
| | | @ApiOperation(value = "查看详情") |
| | | public Response getOne(@RequestParam Integer num){ |
| | | return service.getOne(num); |
| | | } |
| | | |
| | | @GetMapping("getDeviceInf") |
| | | @ApiOperation(value = "设备信息") |
| | | public Response getDeviceInf(@RequestParam Integer num){ |
| | | TestPlan testPlan = service.getOneById(num); |
| | | String devices = testPlan.getDevices(); |
| | | String[] ids = devices.split(","); |
| | | List<DeviceInf> list = new ArrayList<>(); |
| | | for (String deviceId:ids) { |
| | | DeviceInf deviceInf = deviceInfService.getOneByDeviceId(Integer.valueOf(deviceId)); |
| | | list.add(deviceInf); |
| | | } |
| | | return new Response().set(1,list); |
| | | } |
| | | |
| | | |
| | |
| | | return service.startPlan(num); |
| | | } |
| | | |
| | | @PutMapping("delete") |
| | | @ApiOperation(value = "删除作废") |
| | | public Response deletePlan(@RequestParam int num){ |
| | | return service.deletePlan(num); |
| | | } |
| | | @PutMapping("stop") |
| | | @ApiOperation(value = "停止计划") |
| | | public Response stopPlan(@RequestParam int num){ |
| | | return service.stopPlan(num); |
| | | } |
| | | @PutMapping("verified") |
| | | @ApiOperation(value = "审核计划") |
| | | public Response verifiedPlan(@RequestParam int num,@RequestParam String verifier){ |
| | | return service.verifiedPlan(num,verifier); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |