Process.java 937 Bytes
package com.viontech.process;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;

import java.util.Map;

/**
 * .
 *
 * @author 谢明辉
 * @date 2020/8/20
 */

public abstract class Process {

    public void process(String jsonStr) throws Exception{
        ByteBuf byteBuf = ByteBufAllocator.DEFAULT.ioBuffer();
        ObjectMapper objectMapper=new ObjectMapper();
        Map jsonMap=objectMapper.readValue(jsonStr,Map.class);
        String vchan_refid= (String) jsonMap.get("vchan_refid");
        //封装包头,暂未赋值
        byteBuf.writeInt(0);    //相机编号为String,他们要的是int,暂时保留
        byteBuf.writeInt(0);
        byteBuf.writeInt(0);
        byteBuf.writeInt(0);

        //封装包体
        getData(jsonMap,byteBuf);
    }
    public abstract void getData(Map jsonMap,ByteBuf byteBuf) throws Exception;

}