| | |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.ReceiveUser; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.RSASignature; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.supersavedriving.driver.modular.system.util.PushUtil; |
| | | import com.supersavedriving.driver.modular.system.util.rongyun.RongYunUtil; |
| | | import com.supersavedriving.driver.modular.system.util.rongyun.model.CloudRecordingCallback; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | |
| | | |
| | | @Autowired |
| | | private IDivisionRecordService divisionRecordService; |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | |
| | | |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 管理后台调用推送 |
| | | * @param id |
| | | * @param type |
| | | * @param pushOrderInfoWarpper |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/pushOrderInfo") |
| | | public void pushOrderInfo(Integer id, Integer type, PushOrderInfoWarpper pushOrderInfoWarpper){ |
| | | pushUtil.pushOrderInfo(id, type, pushOrderInfoWarpper); |
| | | } |
| | | } |
| | |
| | | import com.supersavedriving.driver.modular.system.model.Order; |
| | | import com.supersavedriving.driver.modular.system.service.IOrderService; |
| | | import com.supersavedriving.driver.modular.system.util.GeodesyUtil; |
| | | import com.supersavedriving.driver.modular.system.util.PushUtil; |
| | | import com.supersavedriving.driver.modular.system.util.RedisUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.DriverPositionWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.OrderPositionWarpper; |
| | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | private Map<String, Integer> map = new HashMap<>(); |
| | | |
| | | |
| | |
| | | if(null == order.getDriverId() || order.getDriverId().compareTo(driverId) != 0){ |
| | | return; |
| | | } |
| | | //开始服务提醒 |
| | | if(order.getState() == 104){ |
| | | String fromLonLat = order.getStartLng() + "," + order.getStartLat(); |
| | | String toLonLat = driverPositionWarpper.getLon() + "," + driverPositionWarpper.getLat(); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(fromLonLat, toLonLat); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if(wgs84.compareTo(200D) >= 0){ |
| | | pushUtil.pushStartServer(2, driverId); |
| | | } |
| | | } |
| | | |
| | | if(order.getState() != 105 && order.getState() != 401){ |
| | | return; |
| | | } |
| | |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 提醒开始服务推送 |
| | | * @param id |
| | | * @param type |
| | | */ |
| | | public void pushStartServer(Integer id, Integer type){ |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | | msg.put("msg", "SUCCESS"); |
| | | msg.put("method", "START_SERVER"); |
| | | msg.put("data", ""); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", msg.toJSONString()); |
| | | params.add("id", id.toString()); |
| | | params.add("type", type.toString()); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | logger.debug(jsonObject1.getString("msg")); |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | } |
| | |
| | | private String travelTime; |
| | | @ApiModelProperty("101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中") |
| | | private Integer state; |
| | | @ApiModelProperty("取消方(1=用户,2=司机,3=平台)") |
| | | private Integer cancelObject; |
| | | } |