From ca481dc99dd9bfb0c4ae45dda1abf58c5d8651ce Mon Sep 17 00:00:00 2001 From: bin Date: Thu, 14 Jan 2021 23:23:01 +0800 Subject: [PATCH] 222 --- .../guizhou/handle/GZResponseHandle.java | 3 +++ .../zhaobiao/guizhou/quartz/job/GZHeartJob.java | 11 ++++++++--- .../guizhou/quartz/job/GZSyncSetting.java | 2 +- src/main/resources/application.properties | 16 ++++++++-------- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/ssjl/zhaobiao/guizhou/handle/GZResponseHandle.java b/src/main/java/com/ssjl/zhaobiao/guizhou/handle/GZResponseHandle.java index ead199e..dcf4d6e 100644 --- a/src/main/java/com/ssjl/zhaobiao/guizhou/handle/GZResponseHandle.java +++ b/src/main/java/com/ssjl/zhaobiao/guizhou/handle/GZResponseHandle.java @@ -26,6 +26,9 @@ public class GZResponseHandle { if(res[1] == (byte)0xFF){ // 常规应答 + return null; + }else if(res[0] != (byte)0x7E){ + // 非正常应答 return null; }else { // 其他命令 diff --git a/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZHeartJob.java b/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZHeartJob.java index d4105e0..a6455a4 100644 --- a/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZHeartJob.java +++ b/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZHeartJob.java @@ -42,13 +42,18 @@ public class GZHeartJob extends QuartzJobBean { String imei = device.getImei(); String phone = device.getPhone(); GpsDeviceStatus gpsDeviceStatus = statusMapper.selectByImei(imei); - String statusStr = gpsDeviceStatus.getDeviceStatus(); - IOTDeviceStatus status = IOTDeviceStatus.build(statusStr); + int pow = 50; + if(gpsDeviceStatus != null){ + String statusStr = gpsDeviceStatus.getDeviceStatus(); + IOTDeviceStatus status = IOTDeviceStatus.build(statusStr); + pow = status.getBattery(); + } + DianxinGzDeviceConfig config = configMapper.selectByImei(imei); GZHeart heart = new GZHeart(); GZDevicePower power = new GZDevicePower(); - power.setPower(status.getBattery()); + power.setPower(pow); power.setCharge(false); heart.setPower(power); GZDeviceStatus gzStatus = new GZDeviceStatus(); diff --git a/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZSyncSetting.java b/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZSyncSetting.java index 2a328e0..304865a 100644 --- a/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZSyncSetting.java +++ b/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZSyncSetting.java @@ -38,7 +38,7 @@ public class GZSyncSetting extends QuartzJobBean { GZAskSetting askSetting = new GZAskSetting(); try { byte[] res = httpUtil.send(device.getImei(), device.getPhone(), askSetting); - //System.out.println(ByteUtil.bytesToHexString(res)); + System.out.println(ByteUtil.bytesToHexString(res)); res = (byte[]) responseHandle.process(device.getImei(), res); // System.out.println(ByteUtil.bytesToHexString(res)); } catch (IOException e) { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 01c07d9..e9db67d 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -45,15 +45,15 @@ guizhou.protocol=T01.4 #guizhou.device.version=ACB_1001 #guizhou.device.testList= [{ "imei": "862622050253671","phone": "" },{ "imei": "862622050253358","phone": "" },{ "imei": "800115470000678","phone": "" }] -guizhou.factory=zhizhong -guizhou.device.model=RZL600 -guizhou.device.version=RZL_2021 -guizhou.device.testList= [{ "imei": "862622050654340","phone": "" },{ "imei": "862622050317740","phone": "" }] +#guizhou.factory=zhizhong +#guizhou.device.model=RZL600 +#guizhou.device.version=RZL_2021 +#guizhou.device.testList= [{ "imei": "862622050654340","phone": "" },{ "imei": "862622050317740","phone": "" }] -#guizhou.factory=zhanneng -#guizhou.device.model=TPE390 -#guizhou.device.version=TPE_0056 -#guizhou.device.testList= [{ "imei": "862622050925104","phone": "" },{ "imei": "862622050927027","phone": "" }] +guizhou.factory=zhanneng +guizhou.device.model=TPE390 +guizhou.device.version=TPE_0056 +guizhou.device.testList= [{ "imei": "862622050925104","phone": "" },{ "imei": "862622050927027","phone": "" }] guizhou.http.url=http://120.24.195.54:24183