Sfoglia il codice sorgente

[功能修复]下单发送103消息

liufei 1 anno fa
parent
commit
98d1c76cac

+ 6 - 0
src/main/java/com/tmzn/devicelinkykc/DeviceLinkYkcApplication.java

@@ -40,4 +40,10 @@ public class DeviceLinkYkcApplication {
         }));
         }));
     }
     }
 
 
+    public static void test(){
+
+        //32010600564205012409091224514152320106005642050100000000000000000000000000000000a36100000000
+
+    }
+
 }
 }

+ 1 - 0
src/main/java/com/tmzn/devicelinkykc/frameMsg/frameType/CharngingPushFrame.java

@@ -42,6 +42,7 @@ public class CharngingPushFrame {
             deviceConnectionMsg.getOutputStream().write(spliceing);
             deviceConnectionMsg.getOutputStream().write(spliceing);
             deviceConnectionMsg.getOutputStream().flush();
             deviceConnectionMsg.getOutputStream().flush();
         } catch (Exception e) {
         } catch (Exception e) {
+            log.info("startStatus>充电回复异常>>>"+DataConversion.bytesToHexString(params)+e.getMessage());
             e.printStackTrace();
             e.printStackTrace();
         }
         }
         deviceConnectionMsg.incrementMessageCount();
         deviceConnectionMsg.incrementMessageCount();

+ 15 - 3
src/main/java/com/tmzn/devicelinkykc/message/DeviceMsgHandle.java

@@ -263,6 +263,7 @@ public class DeviceMsgHandle {
                 if (result == 0x01) {
                 if (result == 0x01) {
                     //启充成功上报充电开启成功
                     //启充成功上报充电开启成功
                     charngingPushFrame.startStatus(deviceConnection, bytes, port, result, 0x00);
                     charngingPushFrame.startStatus(deviceConnection, bytes, port, result, 0x00);
+
                 } else {
                 } else {
                     //启机不成功,根据设备状态判断,并且要结束充电并上报订单
                     //启机不成功,根据设备状态判断,并且要结束充电并上报订单
                     if (port == 1) {
                     if (port == 1) {
@@ -291,11 +292,22 @@ public class DeviceMsgHandle {
                         }
                         }
                     }
                     }
                 }
                 }
+
+                //发送一条103消息 等待状态上报
+                try{
+                    DeviceParam dataParam = new DeviceParam();
+                    dataParam.setDeviceId(imei);
+                    dataParam.setCcid(imei);
+                    deviceControlerService.sendPortDetailCmd(dataParam);
+                    logger.info(statusServiceOne.getPileCode() + ":主动下发103消息");
+                }catch (Exception e){
+                    logger.info(statusServiceOne.getPileCode() + ":主动下发103消息异常"+e.getMessage());
+                }
+
             } else if (NormalChargeConstant.KEY_END_NOTICE.equals(type)) {
             } else if (NormalChargeConstant.KEY_END_NOTICE.equals(type)) {
                 //停止充电通知触发情况:1.急停,收到停充时主动要去发停充,所以这里不能处理急停的交易订单;2.手动停充,正常的远程停止指令
                 //停止充电通知触发情况:1.急停,收到停充时主动要去发停充,所以这里不能处理急停的交易订单;2.手动停充,正常的远程停止指令
                 // 1.设备已经在接收到云快充指令的时候进行了停充操作,2.结算订单,上报云快充停止回复
                 // 1.设备已经在接收到云快充指令的时候进行了停充操作,2.结算订单,上报云快充停止回复
 
 
-
                 try {
                 try {
 
 
                     JSONObject data = jsonObject.getJSONObject("real_data");
                     JSONObject data = jsonObject.getJSONObject("real_data");
@@ -305,7 +317,7 @@ public class DeviceMsgHandle {
                     QueryWrapper<OrderStatus> orderStatusQueryWrapper = new QueryWrapper<>();
                     QueryWrapper<OrderStatus> orderStatusQueryWrapper = new QueryWrapper<>();
                     orderStatusQueryWrapper.eq("device_imei", imei).eq("guns_code", port).orderByDesc("create_time").last("limit 1");
                     orderStatusQueryWrapper.eq("device_imei", imei).eq("guns_code", port).orderByDesc("create_time").last("limit 1");
                     OrderStatus statusServiceOne = orderStatusService.getOne(orderStatusQueryWrapper);
                     OrderStatus statusServiceOne = orderStatusService.getOne(orderStatusQueryWrapper);
-                    if (NormalChargeConstant.KEY_END_NOTICE.equals(type)&&statusServiceOne.getReasonStopCharging()!=TransConstant.APP_REMOTE_STOP) {
+                    if (statusServiceOne.getReasonStopCharging() != TransConstant.APP_REMOTE_STOP) {
                         DeviceParam dataParam = new DeviceParam();
                         DeviceParam dataParam = new DeviceParam();
                         dataParam.setDeviceId(imei);
                         dataParam.setDeviceId(imei);
                         dataParam.setCcid(imei);
                         dataParam.setCcid(imei);
@@ -327,7 +339,7 @@ public class DeviceMsgHandle {
                             JSONObject dataJson = redisCache.getCacheObject(RedisConstant.DEVICE_PORT_STATUS + imei);
                             JSONObject dataJson = redisCache.getCacheObject(RedisConstant.DEVICE_PORT_STATUS + imei);
                             Integer port_first_status = dataJson.getInteger("port_first_status");
                             Integer port_first_status = dataJson.getInteger("port_first_status");
                             Integer port_second_status = dataJson.getInteger("port_second_status");
                             Integer port_second_status = dataJson.getInteger("port_second_status");
-                            if (port_first_status == PortStatusConstant.EMERGENCY_STOP || port_first_status == PortStatusConstant.EMERGENCY_STOP) {
+                            if (port_first_status == PortStatusConstant.EMERGENCY_STOP || port_second_status == PortStatusConstant.EMERGENCY_STOP) {
                                 return false;
                                 return false;
                             }
                             }
                         }
                         }

+ 1 - 1
src/main/java/com/tmzn/devicelinkykc/taskQueue/StartTask.java

@@ -115,7 +115,7 @@ public class StartTask {
                 } catch (InterruptedException e) {
                 } catch (InterruptedException e) {
                     e.printStackTrace();
                     e.printStackTrace();
                 }
                 }
-                //transCheckTask.start();
+//                transCheckTask.start();
                 //启动定时任务:登录,心跳,检查订单等,然后等心跳校验登录情况,
                 //启动定时任务:登录,心跳,检查订单等,然后等心跳校验登录情况,
             }
             }
         };
         };