15832144755
2022-01-06 7b4c8991dca9cf2a809a95e239d144697d3afb56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.hxzkoa.udp;
 
import com.hxzkoa.json.tb_collector;
import com.hxzkoa.util.Config;
import com.hxzkoa.util.HttpUtil;
import net.sf.json.JSONObject;
 
public class gasCollector {
    /*
     * gas_colector,[length],[dizhi],[qishidizhi],[datalength],[ip],[weizhi],[x],[y],[mark]
     * 
     */
 
    public static void collector(String message) {
        String[] dis = message.split(",");
        String macid = dis[2];
        String startip = dis[3];
        String datlenth = dis[4];
        String macname = dis[5];
        String posx = dis[6];
        String posy = dis[7];
        String postUrl = Config.getPostUrl()+"collectorManagement_bw.do";
        // 更改标签的状态和电量信息
        tb_collector collector = new tb_collector();
        collector.setMacid(Integer.parseInt(macid));
        collector.setStartip(Integer.parseInt(startip));
        collector.setDatlenth(Integer.parseInt(datlenth));
        collector.setMacname(macname);
        collector.setPosx(Integer.parseInt(posx));
        collector.setPosy(Integer.parseInt(posy));
        JSONObject tagObject = JSONObject.fromObject(collector);
        HttpUtil.doPost(postUrl, tagObject.toString(), "UTF-8");
        dis = null;
    }
}