puzhibing
2023-07-03 d6af8c450e89d515f7f77a2b4b4ddf9c5f9ad4db
修改bug
1个文件已修改
66 ■■■■ 已修改文件
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushUtil.java 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushUtil.java
@@ -91,39 +91,39 @@
    }
    /**
     * 线下支付数据推送
     * @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"));
//        }
//    }