zhibing.pu
2024-04-12 a075cdd2f76fae321ecf95dce363141ade30f0f1
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushUtil.java
@@ -91,6 +91,44 @@
    }
//    /**
//     * 线下支付数据推送
//     * @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
@@ -124,8 +162,78 @@
            System.err.println(jsonObject1.getString("msg"));
        }
    }
    /**
     * 司机超时提醒
     * @param type
     * @param uid
     * @param orderId
     * @param orderType
     */
    public void pushDriverTimeOut(Integer type, Integer uid, Integer orderId, Integer orderType){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code", 200);
        jsonObject.put("msg", "SUCCESS");
        jsonObject.put("method", "DRIVER_TIME_OUT");
        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
     * @param status 1=申请,2=同意,3=拒绝
     */
    public void pushModifyAddress(Integer type, Integer uid, Integer orderId, Integer orderType, Integer status){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code", 200);
        jsonObject.put("msg", "SUCCESS");
        jsonObject.put("method", "MODIFY_ADDRESS");
        Map<String, Object> map = new HashMap<>();
        map.put("orderId", orderId);
        map.put("orderType", orderType);
        map.put("status", status);
        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"));
        }
    }
    /**
@@ -325,6 +433,8 @@
    }
    /**
     * 摆渡抢单成功后推单
     * @param type