whycxzp
2021-05-20 3da521b9e0a86dd9cc0bb28b2dfa0e7084ffc00f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package com.whyc.controller;
 
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.pojo.Experiment;
import com.whyc.pojo.ExperimentWindingStep1;
import com.whyc.pojo.ExperimentWindingStep2;
import com.whyc.pojo.Project;
import com.whyc.service.ExperimentService;
import com.whyc.service.WindingExperimentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
@RestController
@RequestMapping("windingExperiment")
@Api(tags = "绕组试验")
public class WindingExperimentController {
 
 
    @Autowired
    private WindingExperimentService service;
    @Autowired
    private ExperimentService experimentService;
 
    @GetMapping("experimentId")
    @ApiOperation(value = "查询当前试验编号",notes = "传入的type选择其一:" +
            "绕组:rz,\n" +
            "空载:kz,\n" +
            "负载:fz,\n" +
            "升温:sw,\n" +
            "超速:cs,\n" +
            "空载反电动势:kzfdds,\n" +
            "振动:zd,\n" +
            "耐压:ny,\n" +
            "转动惯量:zdgl,\n")
    public Response getExperimentId(@RequestParam String type){
        return experimentService.getExperimentId(type);
    }
 
    @GetMapping("getProjectName")
    @ApiOperation(value = "获取实验项目名称")
    public Response<List<Project>> getProjectName(){
 
        return service.getProjectName();
    }
 
    @PostMapping("")
    @ApiOperation(value = "开始实验")
    public Response addWindingExperiment(@RequestBody Experiment experiment){
 
        return service.addWindingExperiment(experiment);
    }
    @PostMapping("addWindingStep1")
    @ApiOperation(value = "实验步骤1",notes = "[\n" +
            "  {\n" +
            "    \"winding\": \"绕组1\",\n" +
            "    \"electricCurrent\": 10.0,\n" +
            "    \"vol\": 10.0,\n" +
            "    \"resistance\": 20.0,\n" +
            "    \"temperature\": 10.0,\n" +
            "    \"saveTime\": \"2021-05-19 08:16:20\",\n" +
            "    \"experimentId\": \"RZ_20210518132332\",\n" +
            "    \"status\": 0\n" +
            "  },\n" +
            "  {\n" +
            "    \"winding\": \"绕组2\",\n" +
            "    \"electricCurrent\": 10.0,\n" +
            "    \"vol\": 10.0,\n" +
            "    \"resistance\": 20.0,\n" +
            "    \"temperature\": 10.0,\n" +
            "    \"saveTime\": \"2021-05-19 08:16:20\",\n" +
            "    \"experimentId\": \"RZ_20210518132332\",\n" +
            "    \"status\": 0\n" +
            "  }\n" +
            "]")
    public Response addExperimentWindingStep1(@RequestBody List<ExperimentWindingStep1> windingStep1s){
 
        return service.addExperimentWindingStep1(windingStep1s);
    }
    @PostMapping("addWindingStep2")
    @ApiOperation(value = "实验步骤2",notes = "[\n" +
            "  {\n" +
            "    \"winding\": \"绕组\",\n" +
            "    \"electricCurrent\": 10.0,\n" +
            "    \"vol\": 10.0,\n" +
            "    \"resistance\": 20.0,\n" +
            "    \"temperature\": 10.0,\n" +
            "    \"saveTime\": \"2021-05-18 08:16:20\",\n" +
            "    \"experimentId\": \"RZ_20210518132332\",\n" +
            "    \"status\": 0\n" +
            "  }\n" +
            "]")
    public Response addExperimentWindingStep2(@RequestBody List<ExperimentWindingStep2> windingStep2s){
 
        return service.addExperimentWindingStep2(windingStep2s);
    }
 
    @GetMapping("getWindingStep1")
    @ApiOperation(value = "实验数据1")
    public Response<PageInfo<ExperimentWindingStep1>> getExperimentWindingStep1(@RequestParam int pageNum, @RequestParam int pageSize){
 
        return service.getExperimentWindingStep1(pageNum,pageSize);
    }
 
    @GetMapping("getWindingStep2")
    @ApiOperation(value = "实验数据2")
    public Response<PageInfo<ExperimentWindingStep2>> getExperimentWindingStep2(@RequestParam int pageNum, @RequestParam int pageSize){
 
        return service.getExperimentWindingStep2(pageNum,pageSize);
    }
 
 
    @DeleteMapping("delExperimentWinding")
    @ApiOperation(value = "删除绕组实验数据",notes = "根据唯一试验编号删除试验数据")
    public Response delExperimentWindingbyId(@ApiParam(value = "试验编号",required = true) @RequestParam String experimentId){
 
        return service.delExperimentWindingbyId(experimentId);
    }
 
    @PostMapping("updateWindingStep1")
    @ApiOperation(value = "编辑试验数据1",notes = "根据试验编号experimentId编辑试验数据")
    public Response updateExperimentWindingStep1ById(@RequestBody List<ExperimentWindingStep1> windingStep1s){
 
        return service.updateExperimentWindingStep1(windingStep1s);
    }
 
 
    @PostMapping("updateWindingStep2")
    @ApiOperation(value = "编辑试验数据2",notes = "根据试验编号experimentId编辑试验数据")
    public Response updateExperimentWindingStep2ById(@RequestBody List<ExperimentWindingStep2> windingStep2s){
 
        return service.updateExperimentWindingStep2(windingStep2s);
    }
 
}