|
@@ -5,6 +5,7 @@ import com.zd.common.core.utils.ReUtil;
|
|
|
import com.zd.laboratory.api.entity.CabinetLock;
|
|
import com.zd.laboratory.api.entity.CabinetLock;
|
|
|
import com.zd.laboratory.api.entity.CabinetV2Lock;
|
|
import com.zd.laboratory.api.entity.CabinetV2Lock;
|
|
|
import com.zd.laboratory.mqtt.service.impl.CommonSend;
|
|
import com.zd.laboratory.mqtt.service.impl.CommonSend;
|
|
|
|
|
+import com.zd.laboratory.netty.PushMsgService;
|
|
|
import com.zd.laboratory.socket.runner.TCPServer;
|
|
import com.zd.laboratory.socket.runner.TCPServer;
|
|
|
import com.zd.laboratory.socket.service.SocketService;
|
|
import com.zd.laboratory.socket.service.SocketService;
|
|
|
import com.zd.laboratory.utils.CRCCHECK;
|
|
import com.zd.laboratory.utils.CRCCHECK;
|
|
@@ -35,6 +36,8 @@ public class DeviceRemoteController {
|
|
|
private RedisService redisService;
|
|
private RedisService redisService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private CommonSend commonSend;
|
|
private CommonSend commonSend;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private PushMsgService pushMsgService;
|
|
|
|
|
|
|
|
@Value("${sys.lockTimer:30}")
|
|
@Value("${sys.lockTimer:30}")
|
|
|
private Integer lockTimer;
|
|
private Integer lockTimer;
|
|
@@ -66,11 +69,12 @@ public class DeviceRemoteController {
|
|
|
OutputStream ops = TCPServer.cacheMap.get(relayCode);
|
|
OutputStream ops = TCPServer.cacheMap.get(relayCode);
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- ops.write(ReUtil.hexStringToByteArray(instruct));
|
|
|
|
|
- ops.flush();
|
|
|
|
|
|
|
+// ops.write(ReUtil.hexStringToByteArray(instruct));
|
|
|
|
|
+// ops.flush();
|
|
|
|
|
+ pushMsgService.push(cabinetV2Lock.getRelayCode(), ReUtil.hexStringToByteArray(instruct));
|
|
|
logger.info("柜锁开锁指令:" + instruct);
|
|
logger.info("柜锁开锁指令:" + instruct);
|
|
|
|
|
|
|
|
- Thread.sleep(1000);
|
|
|
|
|
|
|
+ Thread.sleep(2000);
|
|
|
// ops.write(ReUtil.hexStringToByteArray(instruct));
|
|
// ops.write(ReUtil.hexStringToByteArray(instruct));
|
|
|
// ops.flush();
|
|
// ops.flush();
|
|
|
//
|
|
//
|
|
@@ -83,8 +87,9 @@ public class DeviceRemoteController {
|
|
|
Integer status;
|
|
Integer status;
|
|
|
while (timer > 1){
|
|
while (timer > 1){
|
|
|
|
|
|
|
|
- ops.write(ReUtil.hexStringToByteArray(instruct));
|
|
|
|
|
- ops.flush();
|
|
|
|
|
|
|
+// ops.write(ReUtil.hexStringToByteArray(instruct));
|
|
|
|
|
+// ops.flush();
|
|
|
|
|
+ pushMsgService.push(cabinetV2Lock.getRelayCode(), ReUtil.hexStringToByteArray(instruct));
|
|
|
timer-=2;
|
|
timer-=2;
|
|
|
|
|
|
|
|
Thread.sleep(1900);
|
|
Thread.sleep(1900);
|
|
@@ -165,10 +170,11 @@ public class DeviceRemoteController {
|
|
|
String instruct = CRCCHECK.getReadLockOrder(Integer.parseInt(cabinetV2Lock.getLockId()));
|
|
String instruct = CRCCHECK.getReadLockOrder(Integer.parseInt(cabinetV2Lock.getLockId()));
|
|
|
int timer = lockTimer;
|
|
int timer = lockTimer;
|
|
|
Integer status;
|
|
Integer status;
|
|
|
- while (timer > 1){
|
|
|
|
|
|
|
+// while (timer > 1){
|
|
|
|
|
|
|
|
- ops.write(ReUtil.hexStringToByteArray(instruct));
|
|
|
|
|
- ops.flush();
|
|
|
|
|
|
|
+// ops.write(ReUtil.hexStringToByteArray(instruct));
|
|
|
|
|
+// ops.flush();
|
|
|
|
|
+ pushMsgService.push(cabinetV2Lock.getRelayCode(), ReUtil.hexStringToByteArray(instruct));
|
|
|
timer-=2;
|
|
timer-=2;
|
|
|
|
|
|
|
|
Thread.sleep(1900);
|
|
Thread.sleep(1900);
|
|
@@ -177,7 +183,7 @@ public class DeviceRemoteController {
|
|
|
if(status != null && status == 0){
|
|
if(status != null && status == 0){
|
|
|
return ResultData.success("关锁成功");
|
|
return ResultData.success("关锁成功");
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
// return ResultData.success("关锁成功");
|
|
// return ResultData.success("关锁成功");
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|