| | |
| | | |
| | | private Map<String, Timer> taskMap = new HashMap<>();//存储定时推送的定时器 |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 后台 冻结订单 向司机端推送消息 |
| | | * @param uid |
| | | * @param type |
| | | */ |
| | | public void frozenOrder(Integer uid,Integer type){ |
| | | System.err.println("后台 冻结订单 向司机端推送消息"); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | | jsonObject.put("method", "FROZEN_ORDER"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | jsonObject.put("data", map); |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", jsonObject.toJSONString()); |
| | | params.add("id", String.valueOf(uid)); |
| | | params.add("type", String.valueOf(type)); |
| | | 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){ |
| | | System.err.println("后台 冻结订单 向司机端推送消息"+jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | /** |
| | | * 推送订单状态 |
| | | * @param type 1=用户,2=司机 |