jiazx0107@163.com
2023-05-17 a87eff704037284e46568c7c7b8a60caaae884c2
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
package com.ld.igds.inout.controller;
 
import com.ld.igds.constant.RespCodeEnum;
import com.ld.igds.data.PageResponse;
import com.ld.igds.inout.manager.CheckManager;
import com.ld.igds.io.dto.CheckResultParam;
import com.ld.igds.io.sample.data.SampleDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * 扦样机和化验接口
 * 
 * @author: andy.jia
 * @description:
 * @version:
 * @data:2020年3月22日
 *
 */
@Slf4j
@RestController
@RequestMapping("api/check")
public class CheckController {
 
    @Autowired
    private CheckManager manager;
 
    /**
     * 
     * @param param
     *            扦样机器信息
     * @return
     */
    @RequestMapping("/check-exe")
    public @ResponseBody
    PageResponse<String> checkExe(@RequestBody SampleDto param) {
 
        if (null == param.getIp()) {
            return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
                    "扦样机信息配置不完整,请核查!!");
        }
 
        String result = manager.checkExe(param);
 
        if (null != result) {
            return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), result);
        }
        return new PageResponse<String>(RespCodeEnum.CODE_0000, "执行命令已经成功发送!!");
    }
 
    /**
     * 
     * @param param
     *            扦样机器信息
     * @return
     */
    @RequestMapping("/stop")
    public @ResponseBody
    PageResponse<String> stop(@RequestBody SampleDto param) {
 
        if (null == param.getIp()) {
            return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
                    "扦样机信息配置不完整,请核查!!");
        }
 
        String result = manager.stop(param);
 
        if (null != result) {
            return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), result);
        }
        return new PageResponse<String>(RespCodeEnum.CODE_0000, "执行命令已经成功发送!!");
    }
 
    /**
     * 
     * @param param
     *            扦样机器信息
     * @return
     */
    @RequestMapping("/reset")
    public @ResponseBody
    PageResponse<String> reset(@RequestBody SampleDto param) {
 
        if (null == param.getIp()) {
            return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
                    "扦样机信息配置不完整,请核查!!");
        }
 
        String result = manager.reset(param);
 
        if (null != result) {
            return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), result);
        }
        return new PageResponse<String>(RespCodeEnum.CODE_0000, "执行命令已经成功发送!!");
    }
 
 
    /**
     *
     * @param param
     *            扦样机器急停复位
     * @return
     */
    @RequestMapping("/reset-stop")
    public @ResponseBody
    PageResponse<String> resetStop(@RequestBody SampleDto param) {
 
        if (null == param.getIp()) {
            return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
                    "扦样机信息配置不完整,请核查!!");
        }
 
        String result = manager.resetStop(param);
 
        if (null != result) {
            return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), result);
        }
        return new PageResponse<String>(RespCodeEnum.CODE_0000, "执行命令已经成功发送!!");
    }
 
}