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; } }