线下订单驱动开门
This commit is contained in:
@@ -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();
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user