| | |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.sinata.push.config.QYTConfig; |
| | | import com.sinata.push.util.*; |
| | | import io.netty.buffer.ByteBuf; |
| | | import io.netty.buffer.Unpooled; |
| | |
| | | public static Hashtable<String, Hashtable<ChannelHandlerContext, String>> map = new Hashtable<String, Hashtable<ChannelHandlerContext,String>>(); |
| | | |
| | | public static Hashtable<String,String> table; |
| | | |
| | | public static QYTConfig qytConfig; |
| | | |
| | | private RedisUtil redisUtil = SpringUtil.getObject(RedisUtil.class); |
| | | |
| | | |
| | | |
| | | private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
| | | |
| | | |
| | | |
| | | static{ |
| | | if(table == null){ |
| | | table = new Hashtable<>(); |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void setQytConfig(QYTConfig qytConfig) { |
| | | NettyServerController.qytConfig = qytConfig; |
| | | } |
| | | |
| | | public static boolean isdebug = false; |
| | |
| | | String device = jsonCon.getString("device"); |
| | | String version = jsonCon.getString("version"); |
| | | String businessType = jsonCon.getString("businessType");//1:打车,2=代驾 |
| | | String business = "1".equals(businessType) ? "dache" : "daijia"; |
| | | String business = "2".equals(businessType) ? "daijia" : "dache"; |
| | | if(StringUtil.isNotEmpty(userId1)){ |
| | | |
| | | //判断用户或者司机长连接 |
| | |
| | | if(method.equals(Method.location)){ |
| | | Integer driverId = jsonCon.getInteger("driverId"); |
| | | String businessType = jsonCon.getString("businessType");//1:打车,2=代驾 |
| | | String business = "1".equals(businessType) ? "dache" : "daijia"; |
| | | String business = "2".equals(businessType) || null==businessType ? "daijia" : "dache"; |
| | | |
| | | String fluid_control = redisUtil.getValue(business + ":location_" + driverId); |
| | | if(!StringUtils.hasLength(fluid_control)){ |
| | |
| | | params.put("lat", String.valueOf(lat)); |
| | | params.put("directionAngle", String.valueOf(computeAzimuth)); |
| | | params.put("altitude", String.valueOf(altitude)); |
| | | HttpRequest post = HttpUtil.createPost(URLUtil.zuul + "/driver-server/base/savePosition"); |
| | | HttpRequest post = HttpUtil.createPost(qytConfig.getChuxingUrl() + "/driver-server/base/savePosition"); |
| | | post.contentType(MediaType.APPLICATION_FORM_URLENCODED_VALUE); |
| | | post.form(params); |
| | | HttpResponse execute = post.execute(); |
| | |
| | | params.put("lat", String.valueOf(lat)); |
| | | params.put("directionAngle", String.valueOf(computeAzimuth)); |
| | | params.put("altitude", String.valueOf(altitude)); |
| | | HttpRequest post = HttpUtil.createPost(URLUtil.aj_zuul + "/driver-server/base/driver/addDriverPosition"); |
| | | HttpRequest post = HttpUtil.createPost(qytConfig.getDaijiaurl() + "/driver-server/base/driver/addDriverPosition"); |
| | | post.contentType(MediaType.APPLICATION_FORM_URLENCODED_VALUE); |
| | | post.form(params); |
| | | HttpResponse execute = post.execute(); |