|
|
@@ -80,17 +80,13 @@ public class RedisExpiredAndWorkListener extends KeyExpirationEventMessageListen
|
|
|
.stream()
|
|
|
.forEach(a->{
|
|
|
if(dealyNotifyVo.getOpenOrCloseType().intValue()==1){
|
|
|
- ResultData ResultData = socketService.sendCommand(Symbol.order.control, a.getRelayCode(), Symbol.command.open, a.getBit());
|
|
|
- boolean equals = ResultData.getCode().equals(HttpStatus.SUCCESS);
|
|
|
//插入control 打开日志
|
|
|
- if (equals) {
|
|
|
+ if (relayControl(a,Symbol.command.open)) {
|
|
|
saveControl(a, 1);
|
|
|
}
|
|
|
}else{
|
|
|
- ResultData ResultData = socketService.sendCommand(Symbol.order.control, a.getRelayCode(), Symbol.command.close, a.getBit());
|
|
|
- boolean equals = ResultData.getCode().equals(HttpStatus.SUCCESS);
|
|
|
//插入control 关闭日志
|
|
|
- if (equals) {
|
|
|
+ if (relayControl(a,Symbol.command.close)) {
|
|
|
saveControl(a,0);
|
|
|
}
|
|
|
}
|
|
|
@@ -100,6 +96,18 @@ public class RedisExpiredAndWorkListener extends KeyExpirationEventMessageListen
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public Boolean relayControl(LabHardware labHardwareVO,Symbol.command command){
|
|
|
+ if (labHardwareVO.getHardwareType() == 2) {
|
|
|
+ ResultData ResultData = socketService.sendMqttCommand(labHardwareVO.getId(), labHardwareVO.getRelayCode(), command, labHardwareVO.getBit(),labHardwareVO.getSubjectId());
|
|
|
+ boolean equals = ResultData.getCode().equals(HttpStatus.SUCCESS);
|
|
|
+ return equals;
|
|
|
+ }else{
|
|
|
+ ResultData ResultData = socketService.sendCommand(Symbol.order.control, labHardwareVO.getRelayCode(), command, labHardwareVO.getBit());
|
|
|
+ boolean equals = ResultData.getCode().equals(HttpStatus.SUCCESS);
|
|
|
+ return equals;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public void saveControl(LabHardware labHardware,Integer controlType){
|
|
|
LabControl control = new LabControl();
|