zhangqian 1 жил өмнө
parent
commit
a89bec72f1

+ 5 - 2
src/main/java/com/greentech/gateservice/controller/GateController.java

@@ -30,7 +30,10 @@ public class GateController {
                 //获取handle句柄和设备信息
                 NetSDKLib.NET_DEVICEINFO_Ex value = LoginModule.m_stDeviceInfo.get(key);
                 String deviceSn = new String(value.sSerialNumber);
-                if (deviceSn.equals(sn)) {
+                System.out.println("内存sn:"+deviceSn+"传入sn:"+sn);
+                boolean f = deviceSn.trim().equalsIgnoreCase(sn.trim());
+                System.out.println(f);
+                if (f) {
                     boolean ret = LoginModule.netsdk.CLIENT_ControlDeviceEx(key,
                             NetSDKLib.CtrlType.CTRLTYPE_CTRL_ACCESS_OPEN, pointer, null, 10000);
                     if (!ret) {
@@ -58,7 +61,7 @@ public class GateController {
                 //获取handle句柄和设备信息
                 NetSDKLib.NET_DEVICEINFO_Ex value = LoginModule.m_stDeviceInfo.get(key);
                 String deviceSn = new String(value.sSerialNumber);
-                if (deviceSn.equals(sn)) {
+                if (deviceSn.trim().equalsIgnoreCase(sn.trim())) {
                     boolean result = LoginModule.netsdk.CLIENT_ControlDeviceEx(key,
                             NetSDKLib.CtrlType.CTRLTYPE_CTRL_ACCESS_CLOSE, close.getPointer(), null, 5000);
                     close.read();

+ 7 - 0
src/main/java/com/greentech/gateservice/task/GateLogService.java

@@ -7,6 +7,7 @@ import com.netsdk.common.Res;
 import com.netsdk.lib.NetSDKLib;
 import com.netsdk.lib.ToolKits;
 import com.sun.jna.Memory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -21,6 +22,8 @@ import java.util.Date;
 @RequestMapping("crud")
 @Service
 public class GateLogService {
+
+    @Autowired
     GateOplogMapper gateOplogMapper;
 
     @Scheduled(cron = "0 * * * * *")
@@ -104,6 +107,10 @@ public class GateLogService {
                         System.err.println("解析时间发生错误: " + excep.getMessage());
                     }
                     opLog.setCreatedTime(d);
+                    byte isDelete = 0;
+                    opLog.setIsDelete(isDelete);
+                    opLog.setId(0);
+                    opLog.setCheckType("");
                     gateOplogMapper.insert(opLog);
                 }
                 //断开查询句柄

+ 1 - 0
src/main/java/com/greentech/gateservice/util/LoginModule.java

@@ -100,6 +100,7 @@ public class LoginModule {
         } else {
             //维护登录设备和句柄信息
             m_stDeviceInfo.put(singleLoginHandle,deviceInnfo);
+            System.out.println(new String(deviceInnfo.sSerialNumber));
             System.out.println("Login Success [ " + m_strIp + " ]");
             return true;
         }