| | |
| | | package com.ruoyi.sy.gps31; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.gps31.push.netty.PushClient; |
| | | import com.gps31.push.netty.PushMsg; |
| | | import com.gps31.push.netty.client.TcpClient; |
| | | import com.gps31.push.util.MapUtil; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.sy.domain.ArdAccessFence; |
| | | import com.ruoyi.sy.domain.ArdAccessNum; |
| | | import com.ruoyi.sy.domain.ArdOilWall; |
| | | import com.ruoyi.sy.domain.ArdSyCarLock; |
| | | import com.ruoyi.sy.domain.*; |
| | | import com.ruoyi.sy.service.ArdAccessFenceService; |
| | | import com.ruoyi.sy.service.ArdOilWallService; |
| | | import com.ruoyi.sy.service.impl.*; |
| | | import com.ruoyi.utils.gps.GeoTools; |
| | | import com.ruoyi.utils.mqtt.MqttConsumer; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | |
| | |
| | | break; |
| | | } |
| | | } |
| | | ((ArdAccessFenceServiceImpl)SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence); |
| | | }else { |
| | | //如果有进入围栏ID,判断是否开出装油点 |
| | | String out = ardAccessFence.getOutShipmentId(); |
| | |
| | | //如果unload为空,判断是否进入卸油点 |
| | | if (unload == null) { |
| | | //车辆未进入卸油点 |
| | | List<ArdOilWall> ardOilWallUpload = SpringUtils.getBean(ArdOilWallService.class).uploadAll(); |
| | | List<ArdOilWall> ardOilWallUpload = ((ArdOilWallServiceImpl)SpringUtils.getBean("ArdOilWallServiceImpl")).uploadAll(); |
| | | //是否在路上 |
| | | Boolean isRoad = true; |
| | | //判断是否进去卸油点 |
| | | for (int i = 0; i < ardOilWallUpload.size(); i++) { |
| | | pts.clear(); |
| | | ArdOilWall ardOilWall = ardOilWallUpload.get(i); |
| | |
| | | ardAccessFence.setNowWallName(ardOilWall.getName()); |
| | | ardAccessFence.setLastTime(time); |
| | | ((ArdAccessFenceServiceImpl) SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence); |
| | | //发送解封指令 |
| | | ArdSyCarRtu ardSyCarRtu = ((ArdSyCarRtuServiceImpl) SpringUtils.getBean("ArdSyCarRtuServiceImpl")).one(carId); |
| | | if(ardSyCarRtu!=null){ |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("A01", 110000);//导通第一路继电器 |
| | | // map.put("A02", 110000);//导通第二路继电器 |
| | | map.put("res", String.valueOf(System.currentTimeMillis())); |
| | | MqttConsumer.publish(ardSyCarRtu.getTopicSubscribe(), String.valueOf(new JSONObject(map))); |
| | | }else { |
| | | log.error("车辆"+carId+"无锁状态"); |
| | | } |
| | | //已经进入卸油点,不在路上不需要停车报警 |
| | | isRoad = false; |
| | | break; |
| | |
| | | } |
| | | if (!GeoTools.IsPtInPoly(point, pts)) { |
| | | //开出了卸油点围栏,删除该条车辆数据 |
| | | //发送解封指令 |
| | | ArdSyCarRtu ardSyCarRtu = ((ArdSyCarRtuServiceImpl) SpringUtils.getBean("ArdSyCarRtuServiceImpl")).one(carId); |
| | | if(ardSyCarRtu!=null) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("A01", 100000);//断开第一路继电器 |
| | | // map.put("A02", 100000);//断开第二路继电器 |
| | | map.put("res", String.valueOf(System.currentTimeMillis())); |
| | | MqttConsumer.publish(ardSyCarRtu.getTopicSubscribe(), String.valueOf(new JSONObject(map))); |
| | | } |
| | | ((ArdAccessFenceServiceImpl) SpringUtils.getBean("ArdAccessFenceServiceImpl")).delAccess(carId); |
| | | }else { |
| | | //未开出卸油点,更新经纬度保存 |