From 13d2bd6a27f941cfd8f096a7ae2def858a565363 Mon Sep 17 00:00:00 2001
From: zhibing.pu <393733352@qq.com>
Date: 星期三, 04 九月 2024 11:01:34 +0800
Subject: [PATCH] 修改2.0 bug

---
 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/PushUtil.java |   49 ++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/PushUtil.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/PushUtil.java
index e54a9d6..17be056 100644
--- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/PushUtil.java
+++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/PushUtil.java
@@ -4,6 +4,7 @@
 import com.alibaba.fastjson.JSONObject;
 
 import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil;
+import com.stylefeng.guns.modular.system.util.PushURL;
 import com.stylefeng.guns.modular.system.util.RedisUtil;
 
 
@@ -44,9 +45,35 @@
 
     private Map<String, Timer> taskMap = new HashMap<>();//存储定时推送的定时器
 
-
-
-
+    /**
+     * 后台 冻结订单 向司机端推送消息
+     * @param uid
+     * @param type
+     */
+    public void frozenOrder(Integer uid,Integer type){
+        System.err.println("后台 冻结订单 向司机端推送消息");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("code", 200);
+        jsonObject.put("msg", "SUCCESS");
+        jsonObject.put("method", "FROZEN_ORDER");
+        Map<String, Object> map = new HashMap<>();
+        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(PushURL.zull_user_url + "/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          1=用户,2=司机
@@ -78,7 +105,7 @@
         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);
+        String s = internalRestTemplate.postForObject(PushURL.zull_user_url + "/netty/sendMsgToClient",requestEntity , String.class);
         JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
         if(jsonObject1.getIntValue("code") != 200){
             System.err.println(jsonObject1.getString("msg"));
@@ -117,7 +144,7 @@
         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);
+        String s = internalRestTemplate.postForObject(PushURL.zull_user_url + "/netty/sendMsgToClient",requestEntity , String.class);
         JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
         if(jsonObject1.getIntValue("code") != 200){
             System.err.println(jsonObject1.getString("msg"));
@@ -152,7 +179,7 @@
         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);
+        String s = internalRestTemplate.postForObject(PushURL.zull_user_url + "/netty/sendMsgToClient",requestEntity , String.class);
         JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
         if(jsonObject1.getIntValue("code") != 200){
             System.err.println(jsonObject1.getString("msg"));
@@ -190,7 +217,7 @@
         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);
+        String s = internalRestTemplate.postForObject(PushURL.zull_user_url + "/netty/sendMsgToClient",requestEntity , String.class);
         JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
         if(jsonObject1.getIntValue("code") != 200){
             System.err.println(jsonObject1.getString("msg"));
@@ -226,7 +253,7 @@
         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);
+        String s = internalRestTemplate.postForObject(PushURL.zull_user_url + "/netty/sendMsgToClient",requestEntity , String.class);
         JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
         if(jsonObject1.getIntValue("code") != 200){
             System.err.println(jsonObject1.getString("msg"));
@@ -265,7 +292,7 @@
         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);
+        String s = internalRestTemplate.postForObject(PushURL.zull_user_url + "/netty/sendMsgToClient",requestEntity , String.class);
         JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
         if(jsonObject1.getIntValue("code") != 200){
             System.err.println(jsonObject1.getString("msg"));
@@ -313,7 +340,7 @@
         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);
+        String s = internalRestTemplate.postForObject(PushURL.zull_user_url + "/netty/sendMsgToClient",requestEntity , String.class);
         JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
         if(jsonObject1.getIntValue("code") != 200){
             System.err.println(jsonObject1.getString("msg"));
@@ -354,7 +381,7 @@
         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);
+        String s = internalRestTemplate.postForObject(PushURL.zull_user_url + "/netty/sendMsgToClient",requestEntity , String.class);
         JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
         if(jsonObject1.getIntValue("code") != 200){
             System.err.println(jsonObject1.getString("msg"));

--
Gitblit v1.7.1