经纬度分批显示

//查询该区内所有用户的轨迹数据
 public IBean DrawTrackInMap(){
HttpServletRequest request=Request.getInst();
String type =request.getParameter("type");
String userarea =request.getParameter("userarea");
String trackdate =request.getParameter("trackdate");

String sqlStr =" Select sd.userid ,sd.intime,sd.xpoint,sd.ypoint ,su.user_name from P_CollectionData sd ,SY_USER su where 1=1 ";
if(! type.equals("-1")){
sqlStr +=" and sd.typeid ='"+type+"'";
}
sqlStr +=" and to_char(sd.trackdate,'yyyy-mm-dd') ='"+trackdate+"'"
+" and sd.userid =su.user_code and sd.userid in (select a.userid from Track_UserArea_Tb a where a.userarea ='"+userarea+"') "
+" group by sd.userid, sd.intime,sd.xpoint,sd.ypoint ,su.user_name"
+" order by sd.userid , sd.intime ";

ISqlExecutor isql=SqlUtil .getExecutor();
List<IBean> ibeanList = isql.query(sqlStr);
List<ClsTrackJson> JSLIST = dataChuliJson3(ibeanList);
IBean  iBean=new  Bean();
iBean.set("guiji", JSLIST);
return iBean;
}


//处理成轨迹json分段

public List<ClsTrackJson> dataChuliJson3(List<IBean> ibeanList){
List<ClsTrackJson> cjsonList =new ArrayList<ClsTrackJson>();
List<Map<String, String>> mapList = new ArrayList<Map<String,String>>();
Map<String, String> mapJson = null;
ClsTrackJson clsTrackJson = null;
int i=0;
for (IBean list : ibeanList){
if(i==0){
IBean iBean1 =ibeanList.get(i);
clsTrackJson =new ClsTrackJson();
      clsTrackJson.set_BeginTime(String.valueOf(iBean1.get("INTIME")));
     mapJson =new HashMap<String, String>();
 mapJson.put("XPOINT", String.valueOf(iBean1.get("XPOINT")));
 mapJson.put("YPOINT", String.valueOf(iBean1.get("YPOINT")));
 mapJson.put("INTIME", String.valueOf(iBean1.get("INTIME")));
 mapList.add(mapJson);
  }else{
IBean iBean0 =ibeanList.get(i-1);
IBean iBean1 =ibeanList.get(i);
if(! timeBijiao(String.valueOf(iBean0.get("INTIME")),String.valueOf(iBean1.get("INTIME")))
 && String.valueOf(iBean0.get("USERID")).equals(String.valueOf(iBean1.get("USERID"))) ){ 
 
mapJson =new HashMap<String, String>();
   mapJson.put("XPOINT", String.valueOf(iBean1.get("XPOINT")));
mapJson.put("YPOINT", String.valueOf(iBean1.get("YPOINT")));
mapJson.put("INTIME", String.valueOf(iBean1.get("INTIME")));
mapList.add(mapJson);

if(i ==ibeanList.size()-1){
clsTrackJson.set_EndTime(String.valueOf(iBean0.get("INTIME")));
clsTrackJson.set_JsonPts(new JSONArray().fromObject(mapList));
mapList.clear();
clsTrackJson.set_UserFullName(String.valueOf(iBean0.get("USER_NAME")));
 cjsonList.add(clsTrackJson);
}
}else{
clsTrackJson.set_EndTime(String.valueOf(iBean0.get("INTIME")));
clsTrackJson.set_UserFullName(String.valueOf(iBean0.get("USER_NAME")));
clsTrackJson.set_JsonPts(new JSONArray().fromObject(mapList));
cjsonList.add(clsTrackJson);

mapList.clear();
mapJson.clear();
   mapJson =new HashMap<String, String>();
   mapJson.put("XPOINT", String.valueOf(iBean1.get("XPOINT")));
mapJson.put("YPOINT", String.valueOf(iBean1.get("YPOINT")));
mapJson.put("INTIME", String.valueOf(iBean1.get("INTIME")));
mapList.add(mapJson);
 clsTrackJson =new ClsTrackJson();
clsTrackJson.set_BeginTime(String.valueOf(iBean1.get("INTIME")));
}
 }
i++;
}
return cjsonList;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值