liufei пре 1 година
родитељ
комит
15391ecca3

+ 6 - 0
src/main/java/com/tmzn/devicelinkykc/frameMsg/frameType/RealTimeStatusPushFrame.java

@@ -6,6 +6,7 @@ import com.tmzn.devicelinkykc.frameMsg.FrameDataSplicing;
 import com.tmzn.devicelinkykc.msgEnum.DeviceSendYkc;
 import com.tmzn.devicelinkykc.redis.RedisCache;
 import com.tmzn.devicelinkykc.socket.DeviceConnectionMsg;
+import com.tmzn.devicelinkykc.socket.SocketHandle;
 import com.tmzn.devicelinkykc.util.Encrytion;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +27,8 @@ import java.util.Date;
 public class RealTimeStatusPushFrame {
     @Autowired
     private RedisCache redisCache;
+    @Autowired
+    private SocketHandle socketHandle;
 
     public void deviceStatusPush(DeviceConnectionMsg deviceConnectionMsg, byte[] trans, String pileCode, byte guns, byte gunsStatus, byte gunsInsert, double voltage, double power, BigDecimal elec, BigDecimal money, int time) {
         byte[] encrypt = new byte[0];
@@ -46,8 +49,11 @@ public class RealTimeStatusPushFrame {
                 deviceConnectionMsg.getOutputStream().write(bytes,0,bytes.length);
                 deviceConnectionMsg.getOutputStream().flush();
             } catch (IOException e) {
+
                 log.info("pileCode:" + pileCode + " ,realTimeStatus push frame Exception");
+                socketHandle.removeDeviceConnection(pileCode);
                 e.printStackTrace();
+
             }
             deviceConnectionMsg.incrementMessageCount();
         } else {

+ 1 - 1
src/main/java/com/tmzn/devicelinkykc/message/YkcMsgHandle.java

@@ -26,7 +26,7 @@ import com.tmzn.devicelinkykc.redis.RedisCache;
 import com.tmzn.devicelinkykc.service.*;
 import com.tmzn.devicelinkykc.socket.DeviceConnectionMsg;
 import com.tmzn.devicelinkykc.socket.SocketHandle;
-import com.tmzn.devicelinkykc.test.SendMsgToDevice;
+//import com.tmzn.devicelinkykc.test.SendMsgToDevice;
 import com.tmzn.devicelinkykc.transdata.entity.DeviceParam;
 import com.tmzn.devicelinkykc.transdata.entity.MainBoard;
 import com.tmzn.devicelinkykc.transdata.entity.opertype.OperEnum;