package com.huimv.env.input.utils;


import com.alibaba.fastjson.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public  class ElePostUtils {



    public static String basePost(String url,String deviceId, Map data) throws IOException {
        long currentTimeMillis = System.currentTimeMillis();

        Map map = new HashMap();
        map.put("message_id",currentTimeMillis);
        map.put("gateway_id",deviceId);
        map.put("timestamp",currentTimeMillis / 1000);
        map.put("method","4g");
        map.put("signal",null);
//        List list = new ArrayList();
//        list.add(data);
        map.put("data",data);
        String string = JSONObject.toJSONString(map);
        System.out.println("data---->" + string);
         return   HttpClientUtil.post(url, string);
    }

    public static String heartPost(String url,String deviceId, List data) throws IOException {
        long currentTimeMillis = System.currentTimeMillis();

        Map map = new HashMap();
        map.put("message_id",currentTimeMillis);
        map.put("device_id",deviceId);
        map.put("timestamp",currentTimeMillis / 1000);
        map.put("method","4g");
        map.put("signal",null);
        map.put("data",data);
        String string = JSONObject.toJSONString(map);
        System.out.println("data---->" + string);
        return   HttpClientUtil.post(url, string);
    }

}
