|
@@ -1,5 +1,6 @@
|
|
|
package com.zksy.lamp.controller;
|
|
package com.zksy.lamp.controller;
|
|
|
|
|
|
|
|
|
|
+import com.zksy.common.core.domain.Result;
|
|
|
import com.zksy.lamp.server.ExecutionServer;
|
|
import com.zksy.lamp.server.ExecutionServer;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
@@ -23,35 +24,35 @@ public class ExecutionController {
|
|
|
private ExecutionServer server;
|
|
private ExecutionServer server;
|
|
|
@GetMapping("/firstRelay")
|
|
@GetMapping("/firstRelay")
|
|
|
@ApiOperation(value = "第一路继电器闭合、断开", notes = "第一路继电器闭合、断开")
|
|
@ApiOperation(value = "第一路继电器闭合、断开", notes = "第一路继电器闭合、断开")
|
|
|
- public String firstRelay(@ApiParam(value = "第一路继电器(0-断开,1-闭合)",required = true)
|
|
|
|
|
|
|
+ public Result<?> firstRelay(@ApiParam(value = "第一路继电器(0-断开,1-闭合)",required = true)
|
|
|
@RequestParam(value = "value") Integer value){
|
|
@RequestParam(value = "value") Integer value){
|
|
|
String data = "AT+STACH1="+value+"\r\n";
|
|
String data = "AT+STACH1="+value+"\r\n";
|
|
|
String msg = server.ExecutionData(data);
|
|
String msg = server.ExecutionData(data);
|
|
|
- return msg;
|
|
|
|
|
|
|
+ return Result.ok(msg);
|
|
|
}
|
|
}
|
|
|
@GetMapping("/secondRelay")
|
|
@GetMapping("/secondRelay")
|
|
|
@ApiOperation(value = "第二路继电器闭合、断开", notes = "第二路继电器闭合、断开")
|
|
@ApiOperation(value = "第二路继电器闭合、断开", notes = "第二路继电器闭合、断开")
|
|
|
- public String secondRelay(@ApiParam(value = "第二路继电器(0-断开,1-闭合)",required = true)
|
|
|
|
|
|
|
+ public Result<?> secondRelay(@ApiParam(value = "第二路继电器(0-断开,1-闭合)",required = true)
|
|
|
@RequestParam(value = "value") Integer value){
|
|
@RequestParam(value = "value") Integer value){
|
|
|
String data = "AT+STACH2="+value+"\r\n";
|
|
String data = "AT+STACH2="+value+"\r\n";
|
|
|
String msg = server.ExecutionData(data);
|
|
String msg = server.ExecutionData(data);
|
|
|
- return msg;
|
|
|
|
|
|
|
+ return Result.ok(msg);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/timingOn")
|
|
@GetMapping("/timingOn")
|
|
|
@ApiOperation(value = "定时开启", notes = "定时开启")
|
|
@ApiOperation(value = "定时开启", notes = "定时开启")
|
|
|
- public String timingOn(@ApiParam(value = "定时开启时间,时:分:秒,示例:17:00:00",required = true)
|
|
|
|
|
|
|
+ public Result<?> timingOn(@ApiParam(value = "定时开启时间,时:分:秒,示例:17:00:00",required = true)
|
|
|
@RequestParam(value = "value") String value){
|
|
@RequestParam(value = "value") String value){
|
|
|
String data = "AT+AUTOCONT=2,task1,[CYC:1],[T:3,0|1|2|3|4|5|6,"+value+"],[DO:0,1,1,100000,100000,1000000],[N:1,0]\r\n";
|
|
String data = "AT+AUTOCONT=2,task1,[CYC:1],[T:3,0|1|2|3|4|5|6,"+value+"],[DO:0,1,1,100000,100000,1000000],[N:1,0]\r\n";
|
|
|
String msg = server.ExecutionData(data);
|
|
String msg = server.ExecutionData(data);
|
|
|
- return msg;
|
|
|
|
|
|
|
+ return Result.ok(msg);
|
|
|
}
|
|
}
|
|
|
@GetMapping("/timedShutdown")
|
|
@GetMapping("/timedShutdown")
|
|
|
@ApiOperation(value = "定时关闭", notes = "定时关闭")
|
|
@ApiOperation(value = "定时关闭", notes = "定时关闭")
|
|
|
- public String timedShutdown(@ApiParam(value = "定时关闭时间,时:分:秒,示例:06:00:00",required = true)
|
|
|
|
|
|
|
+ public Result<?> timedShutdown(@ApiParam(value = "定时关闭时间,时:分:秒,示例:06:00:00",required = true)
|
|
|
@RequestParam(value = "value") String value){
|
|
@RequestParam(value = "value") String value){
|
|
|
String data = "AT+AUTOCONT=2,task2,[CYC:1],[T:3,0|1|2|3|4|5|6,"+value+"],[DO:0,1,0,100000,100000,1000000],[N:1,0]\r\n";
|
|
String data = "AT+AUTOCONT=2,task2,[CYC:1],[T:3,0|1|2|3|4|5|6,"+value+"],[DO:0,1,0,100000,100000,1000000],[N:1,0]\r\n";
|
|
|
String msg = server.ExecutionData(data);
|
|
String msg = server.ExecutionData(data);
|
|
|
- return msg;
|
|
|
|
|
|
|
+ return Result.ok(msg);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|