import com.alibaba.fastjson.JSONObject;
import com.ho.common.tools.constant.CommonConstant;
import com.ho.datacollect.api.vo.req.mqtt.DataJson;
import com.ho.datacollect.api.vo.req.mqtt.MqttJson;
import com.ho.common.tools.util.MqttUtil;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author fancl
 * @desc:
 * @date 2022/12/10
 */
public class JsonTest {
    public static void main(String[] args) {
        MqttJson json = new MqttJson();
        json.setToken(new MqttUtil().getToken());
        json.setDataType(CommonConstant.MQTT_DATATYPE.READ_REQUEST);
        json.setIsZip(CommonConstant.MQTT_ISZIP.NOT_IS);
        DataJson data = new DataJson();
        data.setCmdId("abcd1234");
        List<String> list = new ArrayList<>();
        list.add("station_251/para/");
        list.add("station_251/bay_252/device_254/para/");
        list.add("station_251/bay_252/device_254/device_257/para/");
        data.setList(list);
        String dataString = JSONObject.toJSONString(data);
        json.setData(dataString);
        String jsonString = JSONObject.toJSONString(json);

        HashMap<String, Object> hashMap = null;

        HashMap<String, Object> hashMap1 = JSONObject.parseObject(jsonString.getBytes(StandardCharsets.UTF_8), Map.class);
        System.out.println();
    }
}
