Ver código fonte

nfc 上位机状态同步

tanbin 8 meses atrás
pai
commit
f52789edac

+ 13 - 0
device-api-service/src/main/java/com/xy/service/DeviceMqttConsumerImpl.java

@@ -16,6 +16,7 @@ import com.xy.device.EnumDeviceOnlineStatus;
 import com.xy.dto.*;
 import com.xy.dto.be.MercDto;
 import com.xy.dto.be.MercUserDeviceDto;
+import com.xy.dto.nfc.UpperDeviceStatusDTO;
 import com.xy.entity.*;
 import com.xy.enums.ChannelType;
 import com.xy.enums.MsgConfigId;
@@ -60,6 +61,10 @@ public class DeviceMqttConsumerImpl implements DeviceMqttConsumer {
 
     private DeviceFaultInfoServiceImpl deviceFaultInfoService;
 
+    private DeviceSysinfoServiceImpl deviceSysinfoService;
+
+    private AlipayDeviceService alipayDeviceService;
+
     @Override
     @ApiOperation("设备在线")
     @Async(DeviceThreadPoolConfig.DEVICE_NETWORK_POLL)
@@ -406,6 +411,14 @@ public class DeviceMqttConsumerImpl implements DeviceMqttConsumer {
         } catch (Exception e) {
             return;
         }
+        DeviceSysinfo deviceSysinfo = deviceSysinfoService.getById(deviceId);
+        if (deviceSysinfo != null) {
+            Boolean isHaveAlipayNpad = deviceSysinfo.getIsHaveAlipayNpad();
+            if (BooleanUtil.isTrue(isHaveAlipayNpad)) {
+                //nfc 同步上位机状态
+                alipayDeviceService.upperDeviceStatusSync(new UpperDeviceStatusDTO().setTerminalId(String.valueOf(deviceId)).setOnline(netState == 1));
+            }
+        }
         //上报状态
         DeviceStatusDto.Up up = new DeviceStatusDto.Up().setDeviceId(deviceId);
         up.setNetState(netState);