| | |
| | | import com.ruoyi.dataInterchange.netty.client.ChannelMap; |
| | | import com.ruoyi.dataInterchange.util.jtt809.common.Jtt809Util; |
| | | import com.ruoyi.dataInterchange.util.jtt809.packet.common.OuterPacket; |
| | | import com.ruoyi.dataInterchange.wapper.UPConnect; |
| | | import io.netty.buffer.ByteBuf; |
| | | import io.netty.buffer.Unpooled; |
| | | import io.netty.channel.Channel; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.util.Iterator; |
| | | |
| | | /** |
| | |
| | | public void up_exg_msg_register(ChannelHandlerContext ctx, int inferiorPlatformId, UPExgMsg exgMsg) { |
| | | UPExgMsgRegister upExgMsgRegister = new UPExgMsgRegister().decode(exgMsg); |
| | | upExgMsgRegister.setInferiorPlatformId(inferiorPlatformId); |
| | | upExgMsgRegister.setCreateTime(LocalDateTime.now()); |
| | | upExgMsgRegisterDao.save(upExgMsgRegister); |
| | | upExgMsgRegister.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); |
| | | UPExgMsgRegister register = upExgMsgRegisterDao.findByVehicleNo(upExgMsgRegister.getVehicleNo()); |
| | | if (null == register) { |
| | | upExgMsgRegisterDao.save(upExgMsgRegister); |
| | | } |
| | | //上报驾驶员身份识别信息请求 |
| | | down_exg_msg_report_driver_info(ctx, inferiorPlatformId, upExgMsgRegister.getVehicleNo(), upExgMsgRegister.getVehicleColor()); |
| | | UPExgMsgReportDriverInfoAck byVehicleNo = upExgMsgReportDriverInfoAckDao.findByVehicleNo(upExgMsgRegister.getVehicleNo()); |
| | | if (null == byVehicleNo) { |
| | | down_exg_msg_report_driver_info(ctx, inferiorPlatformId, upExgMsgRegister.getVehicleNo(), upExgMsgRegister.getVehicleColor()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | Channel channel = ChannelMap.getClientChannel(inferiorPlatformId); |
| | | if (null != channel && channel.isActive()) { |
| | | channel.writeAndFlush(out); |
| | | channel.flush(); |
| | | } else { |
| | | ctx.writeAndFlush(out); |
| | | ctx.flush(); |
| | | } |
| | | } |
| | | |
| | |
| | | public void up_exg_msg_real_location(ChannelHandlerContext ctx, int inferiorPlatformId, UPExgMsg exgMsg) { |
| | | UPExgMsgRealLocation upExgMsgRealLocation = new UPExgMsgRealLocation().decode(exgMsg); |
| | | upExgMsgRealLocation.setInferiorPlatformId(inferiorPlatformId); |
| | | upExgMsgRealLocation.setCreateTime(LocalDateTime.now()); |
| | | upExgMsgRealLocation.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); |
| | | upExgMsgRealLocationDao.save(upExgMsgRealLocation); |
| | | } |
| | | |
| | |
| | | Channel channel = ChannelMap.getClientChannel(inferiorPlatformId); |
| | | if (null != channel && channel.isActive()) { |
| | | channel.writeAndFlush(out); |
| | | channel.flush(); |
| | | } else { |
| | | //重新连接从链路 |
| | | UPConnect ipAndPort = ChannelMap.getIpAndPort(inferiorPlatformId); |
| | | connectReqService.downConnect(inferiorPlatformId, ipAndPort.getDownLinkIp(), ipAndPort.getDownLinkPort(), ipAndPort.getVerifyCode()); |
| | | channel = ChannelMap.getServerChannel(inferiorPlatformId); |
| | | channel.writeAndFlush(out); |
| | | } |
| | | } |
| | | |
| | |
| | | public void up_exg_msg_history_location(ChannelHandlerContext ctx, int inferiorPlatformId, UPExgMsg exgMsg) { |
| | | UPExgMsgHistoryLocation upExgMsgHistoryLocation = new UPExgMsgHistoryLocation().decode(exgMsg); |
| | | upExgMsgHistoryLocation.setInferiorPlatformId(inferiorPlatformId); |
| | | upExgMsgHistoryLocation.setCreateTime(LocalDateTime.now()); |
| | | upExgMsgHistoryLocation.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); |
| | | upExgMsgHistoryLocationDao.save(upExgMsgHistoryLocation); |
| | | } |
| | | |
| | |
| | | public void up_exg_msg_report_driver_info_ack(ChannelHandlerContext ctx, int inferiorPlatformId, UPExgMsg exgMsg) { |
| | | UPExgMsgReportDriverInfoAck upExgMsgReportDriverInfoAck = new UPExgMsgReportDriverInfoAck().decode(exgMsg); |
| | | upExgMsgReportDriverInfoAck.setInferiorPlatformId(inferiorPlatformId); |
| | | upExgMsgReportDriverInfoAck.setCreateTime(LocalDateTime.now()); |
| | | upExgMsgReportDriverInfoAck.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); |
| | | upExgMsgReportDriverInfoAckDao.save(upExgMsgReportDriverInfoAck); |
| | | } |
| | | |
| | |
| | | public void up_exg_msg_take_ewaybill_ack(ChannelHandlerContext ctx, int inferiorPlatformId, UPExgMsg exgMsg) { |
| | | UPExgMsgTakeEwayBillAck upExgMsgTakeEwayBillAck = new UPExgMsgTakeEwayBillAck().decode(exgMsg); |
| | | upExgMsgTakeEwayBillAck.setInferiorPlatformId(inferiorPlatformId); |
| | | upExgMsgTakeEwayBillAck.setCreateTime(LocalDateTime.now()); |
| | | upExgMsgTakeEwayBillAckDao.save(upExgMsgTakeEwayBillAck); |
| | | upExgMsgTakeEwayBillAck.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); |
| | | UPExgMsgTakeEwayBillAck byVehicleNo = upExgMsgTakeEwayBillAckDao.findByVehicleNo(upExgMsgTakeEwayBillAck.getVehicleNo()); |
| | | if (null == byVehicleNo) { |
| | | upExgMsgTakeEwayBillAckDao.save(upExgMsgTakeEwayBillAck); |
| | | } |
| | | } |
| | | |
| | | } |