| | |
| | | buf.readBytes(req); |
| | | String body = new String(req, CharsetUtil.UTF_8); |
| | | |
| | | System.out.println("【UDP】>>>>>> 收到客户端的数据:"+body); |
| | | // System.out.println("【UDP】>>>>>> 收到客户端的数据:"+body); |
| | | String s = bytesToHexString(req); |
| | | System.out.println("s111111 = " + s); |
| | | // System.out.println("s111111 = " + s); |
| | | //获取字符串的长度 |
| | | int length = s.length(); |
| | | System.out.println("数据长度>>>>>> = " + length); |
| | | // System.out.println("数据长度>>>>>> = " + length); |
| | | //数据解析 |
| | | dataHandler(s); |
| | | } |
| | |
| | | second = "0" + second; |
| | | } |
| | | String time = year + "-" + month + "-" + day +" " + hour+ ":"+minute + ":" + second; |
| | | System.out.println("接收时间: time = " + time); |
| | | //时间拼接 |
| | | try { |
| | | backEquipment.setReceiveTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(time)); |
| | |
| | | @Async |
| | | public void saveTalkBackEquipmentInfo(String body) { |
| | | TalkBackEquipment equipmentRecord = new TalkBackEquipment(); |
| | | equipmentRecord.setName("ces"); |
| | | equipmentRecord.setCode("cs123456"); |
| | | equipmentRecord.setStatus(1); |
| | | equipmentRecord.setUnitName("CSDW"); |
| | | equipmentRecord.setUnitCode("CSDW123456"); |
| | | equipmentRecord.setPoliceName("JINGYUAN"); |
| | | equipmentRecord.setPoliceCode("JINGYUAN123456"); |
| | | equipmentRecord.setTerminalNumber("788888888888"); |
| | | equipmentRecord.setLongitude("128.124124412"); |
| | | equipmentRecord.setLatitude("27.1224521421"); |
| | | equipmentRecord.setSpeed("10"); |
| | | equipmentRecord.setDirection("10"); |
| | | equipmentRecord.setElevation("10"); |
| | | equipmentRecord.setPrecisions("10"); |
| | | equipmentRecord.setReceiveTime(new Date()); |
| | | equipmentRecord.setCreateTime(new Date()); |
| | | equipmentRecord.setUpdateTime(new Date()); |
| | | |
| | | |
| | | } |
| | | |