| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 线下支付数据推送 |
| | | * @param type |
| | | * @param uid |
| | | * @param orderId |
| | | * @param orderType |
| | | */ |
| | | public void pushOfflinePayment(Integer type, Integer uid, Integer orderId, Integer orderType){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | | jsonObject.put("method", "OFFLINE_PAYMENT"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("orderId", orderId); |
| | | map.put("orderType", orderType); |
| | | 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 |
| | | // * @param uid |
| | | // * @param orderId |
| | | // * @param orderType |
| | | // */ |
| | | // public void pushOfflinePayment(Integer type, Integer uid, Integer orderId, Integer orderType){ |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject.put("code", 200); |
| | | // jsonObject.put("msg", "SUCCESS"); |
| | | // jsonObject.put("method", "OFFLINE_PAYMENT"); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("orderId", orderId); |
| | | // map.put("orderType", orderType); |
| | | // 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")); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |