| | |
| | | } |
| | | |
| | | /** |
| | | * 推送乘客位置给司机端 |
| | | */ |
| | | public ResultUtil pushPassengerLocationToDriver(Integer driverId, Integer userId, Integer orderId, Integer orderType, |
| | | String lon, String lat, String timestamp) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | | jsonObject.put("method", "PASSENGER_LOCATION"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("orderId", orderId); |
| | | map.put("orderType", orderType); |
| | | map.put("userId", userId); |
| | | map.put("lon", lon); |
| | | map.put("lat", lat); |
| | | map.put("timestamp", timestamp); |
| | | jsonObject.put("data", map); |
| | | |
| | | HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient"); |
| | | post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE); |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("msg", jsonObject.toJSONString()); |
| | | params.put("id", driverId); |
| | | params.put("type", 2); |
| | | params.put("bussinessType", "dache"); |
| | | post.form(params); |
| | | HttpResponse execute = post.execute(); |
| | | if (200 != execute.getStatus()) { |
| | | return ResultUtil.error("司机端定位推送失败"); |
| | | } |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class); |
| | | if (jsonObject1.getIntValue("code") != 200) { |
| | | return ResultUtil.error(jsonObject1.getString("msg")); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | | * 推送司机位置给乘客端 |
| | | */ |
| | | public void pushDriverPosition(Integer orderId, Integer orderType) { |