| | |
| | | package org.yzh.web.endpoint; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import io.github.yezhihao.netmc.core.annotation.Async; |
| | | import io.github.yezhihao.netmc.core.annotation.AsyncBatch; |
| | | import io.github.yezhihao.netmc.core.annotation.Endpoint; |
| | | import io.github.yezhihao.netmc.core.annotation.Mapping; |
| | | import io.github.yezhihao.netmc.session.Session; |
| | | import org.apache.commons.codec.binary.Hex; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.yzh.web.model.enums.SessionKey; |
| | | import org.yzh.web.service.FileService; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigInteger; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Properties; |
| | | |
| | | import static org.yzh.protocol.commons.JT808.*; |
| | | |
| | |
| | | |
| | | @Mapping(types = 终端心跳, desc = "终端心跳") |
| | | public void T0002(JTMessage message, Session session) { |
| | | log.info("终端心跳========={}", JSONObject.toJSONString(message)); |
| | | } |
| | | |
| | | @Mapping(types = 终端注销, desc = "终端注销") |
| | |
| | | |
| | | @Mapping(types = 终端补传分包请求, desc = "终端补传分包请求") |
| | | public void T8003(T8003 message, Session session) { |
| | | } |
| | | @Mapping(types = 终端校时请求上行, desc = "终端校时请求上行") |
| | | public void T0F01(JTMessage message, Session session) { |
| | | } |
| | | |
| | | @Mapping(types = 终端注册, desc = "终端注册") |
| | |
| | | |
| | | @Mapping(types = 查询终端属性应答, desc = "查询终端属性应答") |
| | | public void T0107(T0107 message, Session session) { |
| | | log.info("查询终端属性应答========={}", JSONObject.toJSONString(message)); |
| | | session.response(message); |
| | | } |
| | | |
| | |
| | | @AsyncBatch(poolSize = 2, maxElements = 4000, maxWait = 1000) |
| | | @Mapping(types = 位置信息汇报, desc = "位置信息汇报") |
| | | public void T0200(List<T0200> list) { |
| | | |
| | | System.out.println(JSONObject.toJSONString(list) |
| | | ); |
| | | } |
| | | |
| | | @Mapping(types = 定位数据批量上传, desc = "定位数据批量上传") |
| | | public void T0704(T0704 message) { |
| | | } |
| | | public static String bcd2String(byte[] bytes) { |
| | | StringBuilder temp = new StringBuilder(bytes.length * 2); |
| | | for (int i = 0; i < bytes.length; i++) { |
| | | // 高四位 |
| | | temp.append((bytes[i] & 0xf0) >>> 4); |
| | | // 低四位 |
| | | temp.append(bytes[i] & 0x0f); |
| | | } |
| | | return temp.toString().substring(0, 1).equalsIgnoreCase("0") ? temp.toString().substring(1) : temp.toString(); |
| | | } |
| | | |
| | | @Mapping(types = {位置信息查询应答, 车辆控制应答}, desc = "位置信息查询应答/车辆控制应答") |
| | | public void T0201_0500(T0201_0500 message, Session session) { |