puzhibing
2023-08-16 d5b3e5a413bcfccba294793ee093722f31b2448a
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PushUtil.java
@@ -56,7 +56,6 @@
        JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
        if(jsonObject1.getIntValue("code") != 200){
            logger.debug(jsonObject1.getString("msg"));
            System.err.println(jsonObject1.getString("msg"));
        }
    }
@@ -87,7 +86,6 @@
        JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
        if(jsonObject1.getIntValue("code") != 200){
            logger.debug(jsonObject1.getString("msg"));
            System.err.println(jsonObject1.getString("msg"));
        }
    }
@@ -125,7 +123,6 @@
        JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
        if(jsonObject1.getIntValue("code") != 200){
            logger.debug(jsonObject1.getString("msg"));
            System.err.println(jsonObject1.getString("msg"));
        }
    }
@@ -158,7 +155,6 @@
        JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
        if(jsonObject1.getIntValue("code") != 200){
            logger.debug(jsonObject1.getString("msg"));
            System.err.println(jsonObject1.getString("msg"));
        }
    }
@@ -198,7 +194,40 @@
        JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
        if(jsonObject1.getIntValue("code") != 200){
            logger.debug(jsonObject1.getString("msg"));
            System.err.println(jsonObject1.getString("msg"));
        }
    }
    /**
     * 系统推单推送 附加(防止 用户推单后,范围内的司机20s 内接不到单的补充方法)
     * @param id            接受对象id
     * @param type          接受对象类型(1=用户,2=司机)
     */
    public void pushGrabOrderExtras(Integer id, Integer type){
        JSONObject msg = new JSONObject();
        msg.put("code", 200);
        msg.put("msg", "SUCCESS");
        msg.put("method", "PUSH_ORDER");
        Map<String, Object> map = new HashMap<>();
        msg.put("data", map);
        //调用推送
        HttpHeaders headers = new HttpHeaders();
        // 以表单的方式提交
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        //将请求头部和参数合成一个请求
        MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
        params.add("msg", msg.toJSONString());
        params.add("id", id.toString());
        params.add("type", type.toString());
        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){
            logger.debug(jsonObject1.getString("msg"));
        }
    }
@@ -234,7 +263,6 @@
        JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
        if(jsonObject1.getIntValue("code") != 200){
            logger.debug(jsonObject1.getString("msg"));
            System.err.println(jsonObject1.getString("msg"));
        }
    }
}