Pu Zhibing
6 天以前 4c99ee7028c3fe58a2cd4b8273b22c75c45574fc
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushUtil.java
@@ -61,7 +61,7 @@
     * @param orderType     订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)
     * @param state         订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付)
     */
    public void pushOrderState(Integer type, Integer uid, Integer orderId, Integer orderType, Integer state, Integer time){
    public void pushOrderState(Integer type, Integer uid, Integer orderId, Integer orderType, Integer state, Integer time, String audioUrl, String from){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code", 200);
        jsonObject.put("msg", "SUCCESS");
@@ -71,6 +71,8 @@
        map.put("orderType", orderType);
        map.put("state", state);
        map.put("time", time);
        map.put("audioUrl", audioUrl);
        map.put("from", from);
        jsonObject.put("data", map);
        //调用推送
@@ -89,41 +91,7 @@
            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"));
//        }
//    }
@@ -207,7 +175,7 @@
     * @param orderType
     * @param status 1=申请,2=同意,3=拒绝
     */
    public void pushModifyAddress(Integer type, Integer uid, Integer orderId, Integer orderType, Integer status){
    public void pushModifyAddress(Integer type, Integer uid, Integer orderId, Integer orderType, Integer status, String audioUrl){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code", 200);
        jsonObject.put("msg", "SUCCESS");
@@ -216,6 +184,7 @@
        map.put("orderId", orderId);
        map.put("orderType", orderType);
        map.put("status", status);
        map.put("audioUrl", audioUrl);
        jsonObject.put("data", map);
        
        //调用推送
@@ -433,8 +402,6 @@
    }
    /**
     * 摆渡抢单成功后推单
     * @param type
@@ -492,7 +459,7 @@
     * @param orderId
     * @param orderType
     */
    public void pushOfflinePayment(Integer type, Integer uid, Integer orderId, Integer orderType){
    public void pushOfflinePayment(Integer type, Integer uid, Integer orderId, Integer orderType, Double money, String audioUrl){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code", 200);
        jsonObject.put("msg", "SUCCESS");
@@ -500,6 +467,8 @@
        Map<String, Object> map = new HashMap<>();
        map.put("orderId", orderId);
        map.put("orderType", orderType);
        map.put("money", money);
        map.put("audioUrl", audioUrl);
        jsonObject.put("data", map);
        //调用推送
@@ -518,6 +487,45 @@
            System.err.println(jsonObject1.getString("msg"));
        }
    }
    /**
     * 小件物流差价支付的推送
     * @param type
     * @param uid
     * @param orderId
     * @param orderType
     * @param money
     * @param status 1=申请,2=同意,3=拒绝
     */
    public void pushPayDifference(Integer type, Integer uid, Integer orderId, Integer orderType, Double money, Integer status, String audioUrl){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code", 200);
        jsonObject.put("msg", "SUCCESS");
        jsonObject.put("method", "DIFFERENCE");
        Map<String, Object> map = new HashMap<>();
        map.put("orderId", orderId);
        map.put("orderType", orderType);
        map.put("money", money);
        map.put("status", status);
        map.put("audioUrl", audioUrl);
        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"));
        }
    }
}