线下订单驱动开门

This commit is contained in:
2023-11-24 22:37:12 +08:00
parent c79b75708d
commit 07a648c3f5
24 changed files with 1621 additions and 37 deletions

View File

@@ -8,20 +8,23 @@ import Net.PC15.FC8800.Command.Door.OpenDoor;
import Net.PC15.FC8800.Command.Door.Parameter.OpenDoor_Parameter;
import Net.PC15.FC8800.FC8800Identity;
import com.sv.intergration.DoorService;
import com.sv.netty.config.NettyConstant;
public class OldDoorService implements DoorService {
@Override
public void enterOpenDoor() {
try {
logger.info("----init open door tcp ----");
ConnectorAllocator connector = ConnectorAllocator.GetAllocator();
TCPClientDetial tcpClientDetial = new TCPClientDetial("192.168.1.150", Integer.valueOf("8000"));
connector.GetCommandCount(tcpClientDetial);
connector.OpenForciblyConnect(tcpClientDetial);
CommandDetial detial = new CommandDetial();
detial.Connector = tcpClientDetial;
detial.Identity = new FC8800Identity("MC-5824T23014127", "12345678", E_ControllerType.FC8900);
String clientSn = System.getProperty(NettyConstant.VENUE_CLIENT_SN);
System.out.println(clientSn);
// detial.Identity = new FC8800Identity("MC-5824T23014127", "12345678", E_ControllerType.FC8900);
detial.Identity = new FC8800Identity(clientSn, "12345678", E_ControllerType.FC8900);
OpenDoor_Parameter openDoorParameter = new OpenDoor_Parameter(detial);
openDoorParameter.Door.SetDoor(1, 1);
OpenDoor openDoor = new OpenDoor(openDoorParameter);
@@ -40,19 +43,19 @@ public class OldDoorService implements DoorService {
@Override
public void outOpenDoor() {
try {
logger.info("----init open door tcp ----");
ConnectorAllocator connector = ConnectorAllocator.GetAllocator();
TCPClientDetial tcpClientDetial = new TCPClientDetial("192.168.1.150", Integer.valueOf("8000"));
connector.GetCommandCount(tcpClientDetial);
connector.OpenForciblyConnect(tcpClientDetial);
CommandDetial detial = new CommandDetial();
detial.Connector = tcpClientDetial;
detial.Identity = new FC8800Identity("MC-5824T23014127", "12345678", E_ControllerType.FC8900);
String clientSn = System.getProperty(NettyConstant.VENUE_CLIENT_SN);
// detial.Identity = new FC8800Identity("MC-5824T23014127", "12345678", E_ControllerType.FC8900);
detial.Identity = new FC8800Identity(clientSn, "12345678", E_ControllerType.FC8900);
OpenDoor_Parameter openDoorParameter = new OpenDoor_Parameter(detial);
openDoorParameter.Door.SetDoor(2, 1);
OpenDoor openDoor = new OpenDoor(openDoorParameter);
boolean command = connector.AddCommand(openDoor);
System.out.println(command);
if (!command) {
logger.error("出场开门命令执行失败");
}
@@ -65,9 +68,9 @@ public class OldDoorService implements DoorService {
}
// 测试
public static void main(String[] args) {
OldDoorService oldDoorService = new OldDoorService();
oldDoorService.enterOpenDoor();
oldDoorService.outOpenDoor();
}
// public static void main(String[] args) {
// OldDoorService oldDoorService = new OldDoorService();
// oldDoorService.enterOpenDoor();
// oldDoorService.outOpenDoor();
// }
}

View File

@@ -1,6 +1,7 @@
package com.sv.netty;
import com.sv.netty.config.*;
import com.sv.netty.utils.AesUtil;
import com.sv.netty.utils.EncodeMsg;
import com.sv.netty.utils.JsonUtils;
import com.sv.netty.utils.MakeCode;
@@ -27,10 +28,14 @@ public class MessageHandler {
* @return
*/
public static String checkBarcode(String barcode) {
String decrypt = AesUtil.decrypt(barcode);
// 这个二维码是线下的二维码
if (!decrypt.startsWith("venue-")){
VenueBarCode venueBarCode = MakeCode.decodeCode(barcode);
if (venueBarCode == null) {
logger.error("二维码不合法" + barcode);
return null;
if (venueBarCode == null) {
logger.error("二维码不合法" + barcode);
return null;
}
}
VenueMessage venueMessage = new VenueMessage();
venueMessage.setMessageType(MessageType.SCAN_CODE);

View File

@@ -1 +1 @@
{"serverIp":"127.0.0.1","serverPort":"56792","clientSN":"20230901venue","clientVid":"41"}
{"serverIp":"127.0.0.1","serverPort":"56792","clientSN":"MC-5824T23014127","clientVid":"41"}