| | |
| | | import io.netty.buffer.ByteBuf; |
| | | import io.netty.buffer.ByteBufUtil; |
| | | import io.netty.buffer.Unpooled; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.junit.platform.commons.util.StringUtils; |
| | | import org.yzh.protocol.JT808Beans; |
| | | import org.yzh.protocol.basics.JTMessage; |
| | | import org.yzh.protocol.codec.JTMessageAdapter; |
| | | import org.yzh.protocol.codec.JTMessageDecoder; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.ByteOrder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 解码分析 |
| | |
| | | public static final JTMessageAdapter coder = new JTMessageAdapter("org.yzh.protocol"); |
| | | |
| | | public static void main(String[] args) { |
| | | String hex = "0200004c067244400211004600000000000c0400015b197c06c8362e00000000000025020610234801040000083f02020000030200002504000000002a0200002b0400000000300117310100e3060000129d0000f2020000497e"; |
| | | String hex = "0200004c06724440021104ad00000000000c000301e4c49606fcbc04003c00000000250213220412010400001a4e02020000030200002504000000002a0200002b0400000000300115310112e306000012990000f2020000ac7e"; |
| | | // String hex = "0201004e0672444002110097019100000000000c0001015b197c06c8362e00000000000025020616592601040000083f02020000030200002504000000002a0200002b0400000000300117310100e306000012990000f2020000187e"; |
| | | // String hex = "020000d40123456789017fff000004000000080006eeb6ad02633df7013800030063200707192359642f000000400101020a0a02010a1e00640001b2070003640e200707192359000100000061646173200827111111010101652f000000410202020a0000000a1e00c8000516150006c81c20070719235900020000000064736d200827111111020202662900000042031e012c00087a23000a2c2a200707192359000300000074706d732008271111110303030067290000004304041e0190000bde31000d90382007071923590004000000006273642008271111110404049d"; |
| | | JTMessage msg = H2019(T0200JSATL12()); |
| | | // JTMessage msg = H2019(T0200JSATL12()); |
| | | |
| | | msg = decode(hex); |
| | | // msg = decode(hex); |
| | | // hex = encode(msg); |
| | | // System.out.println(decode(hex)); |
| | | |
| | | try (FileInputStream fis = new FileInputStream(new File("C:\\Users\\T14\\Desktop\\member.xlsx")); |
| | | Workbook workbook = new XSSFWorkbook(fis)) { |
| | | Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表 |
| | | List<String> phoneNumbers = new ArrayList<>(); |
| | | for (Row row : sheet) { |
| | | Cell cell = row.getCell(1); // 假设手机号在第一列 |
| | | if (cell != null) { |
| | | if (cell.getCellType() == CellType.NUMERIC){ |
| | | System.out.println(cell.getCellType()); |
| | | phoneNumbers.add( cell.getNumericCellValue()+""); // 添加到列表中 |
| | | } |
| | | cell.setCellType(CellType.STRING); // 确保单元格类型为字符串 |
| | | String phoneNumber = cell.getStringCellValue(); // 获取单元格值作为字符串 |
| | | phoneNumbers.add( phoneNumber); // 添加到列表中 |
| | | } |
| | | } |
| | | // 输出手机号列表 |
| | | phoneNumbers.forEach(System.out::println); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | private static String encode(JTMessage message) { |