Pu Zhibing
4 小时以前 36116d32f83517e574d77dcc233b96785906be2f
更换三方账号和添加环境配置
3个文件已修改
300 ■■■■ 已修改文件
user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/AppUserController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/DriverServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PushUtil.java 287 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/AppUserController.java
@@ -286,9 +286,8 @@
            InputStream inputStream = file.getInputStream();
            String name = file.getOriginalFilename();
            name = UUIDUtil.getRandomCode() + name.substring(name.lastIndexOf("."));
//            String s = OBSUtil.putObjectToBucket(inputStream, name);
//            String s = OssUploadUtil.ossUpload(file);
            String bucketName = qianYunTongConfig.getBucketName();
            QianYunTongConfig qianYunTongConfig1 = qianYunTongConfig.getQianYunTongConfig();
            String bucketName = qianYunTongConfig1.getBucketName();
            Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName);
            if (null == grjyTest) {
                //创建桶
@@ -309,7 +308,7 @@
            if (null == object) {
                throw new RuntimeException("上传图片失败");
            }
            return ResponseWarpper.success("https://traffic.qytzt.cn/v1/AUTH_" + qianYunTongConfig.getAccount() + "/" + bucketName + "/" + key);
            return ResponseWarpper.success("https://traffic.qytzt.cn/v1/AUTH_" + qianYunTongConfig1.getAccount() + "/" + bucketName + "/" + key);
        }catch (Exception e){
            e.printStackTrace();
            return new ResponseWarpper(500, e.getMessage());
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/DriverServiceImpl.java
@@ -254,9 +254,9 @@
    //生成小程序二维码
    public String wechatMiniProgramORCode(Integer driverId) throws Exception{
        InputStream release = weChatUtil.getwxacodeunlimit("pages/index/index", "driverId=" + driverId, "release");
//        String s = OBSUtil.putObjectToBucket(release, "driver_" + driverId);
        String pictureName = "driver_" + driverId + ".png";
        String bucketName = qianYunTongConfig.getBucketName();
        QianYunTongConfig qianYunTongConfig1 = qianYunTongConfig.getQianYunTongConfig();
        String bucketName = qianYunTongConfig1.getBucketName();
        Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName);
        if (null == grjyTest) {
            //创建桶
@@ -278,6 +278,6 @@
            throw new RuntimeException("上传图片失败");
        }
    
        return "https://traffic.qytzt.cn/v1/AUTH_" + qianYunTongConfig.getAccount() + "/" + bucketName + "/" + key;
        return "https://traffic.qytzt.cn/v1/AUTH_" + qianYunTongConfig1.getAccount() + "/" + bucketName + "/" + key;
    }
}
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PushUtil.java
@@ -1,5 +1,8 @@
package com.supersavedriving.user.modular.system.util;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.supersavedriving.user.modular.system.warpper.PushCheckOrderInfoWarpper;
@@ -25,9 +28,8 @@
public class PushUtil {
    Logger logger = LoggerFactory.getLogger("ServiceLog");
    @Autowired
    private RestTemplate internalRestTemplate;
    private final String socket_uri = "http://192.168.110.85:6000";
@@ -42,22 +44,25 @@
        msg.put("msg", "SUCCESS");
        msg.put("method", "OFFLINE");
        msg.put("data", new Object());
        //调用推送
        HttpHeaders headers = new HttpHeaders();
        // 以表单的方式提交
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient");
        post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
        //将请求头部和参数合成一个请求
        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"));
            System.err.println(jsonObject1.getString("msg"));
        Map<String, Object> params = new HashMap<>();
        params.put("msg", msg.toJSONString());
        params.put("id", id.toString());
        params.put("type", type.toString());
        post.form(params);
        HttpResponse execute = post.execute();
        if (200 != execute.getStatus()) {
            System.err.println("推送异常");
        }else{
            JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class);
            if(jsonObject1.getIntValue("code") != 200){
                logger.debug(jsonObject1.getString("msg"));
                System.err.println(jsonObject1.getString("msg"));
            }
        }
    }
@@ -73,22 +78,25 @@
        msg.put("msg", "SUCCESS");
        msg.put("method", "OFF_WORK");
        msg.put("data", new Object());
        //调用推送
        HttpHeaders headers = new HttpHeaders();
        // 以表单的方式提交
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient");
        post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
        //将请求头部和参数合成一个请求
        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"));
            System.err.println(jsonObject1.getString("msg"));
        Map<String, Object> params = new HashMap<>();
        params.put("msg", msg.toJSONString());
        params.put("id", id.toString());
        params.put("type", type.toString());
        post.form(params);
        HttpResponse execute = post.execute();
        if (200 != execute.getStatus()) {
            System.err.println("推送异常");
        }else{
            JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class);
            if(jsonObject1.getIntValue("code") != 200){
                logger.debug(jsonObject1.getString("msg"));
                System.err.println(jsonObject1.getString("msg"));
            }
        }
    }
@@ -111,22 +119,25 @@
        map.put("status", status);
        msg.put("data", map);
        //调用推送
        HttpHeaders headers = new HttpHeaders();
        // 以表单的方式提交
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient");
        post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
        //将请求头部和参数合成一个请求
        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"));
            System.err.println(jsonObject1.getString("msg"));
        Map<String, Object> params = new HashMap<>();
        params.put("msg", msg.toJSONString());
        params.put("id", id.toString());
        params.put("type", type.toString());
        post.form(params);
        HttpResponse execute = post.execute();
        if (200 != execute.getStatus()) {
            System.err.println("推送异常");
        }else{
            JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class);
            if(jsonObject1.getIntValue("code") != 200){
                logger.debug(jsonObject1.getString("msg"));
                System.err.println(jsonObject1.getString("msg"));
            }
        }
    }
@@ -142,22 +153,25 @@
        map.put("status", status);
        msg.put("data", map);
        //调用推送
        HttpHeaders headers = new HttpHeaders();
        // 以表单的方式提交
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient");
        post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
        //将请求头部和参数合成一个请求
        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"));
            System.err.println(jsonObject1.getString("msg"));
        Map<String, Object> params = new HashMap<>();
        params.put("msg", msg.toJSONString());
        params.put("id", id.toString());
        params.put("type", type.toString());
        post.form(params);
        HttpResponse execute = post.execute();
        if (200 != execute.getStatus()) {
            System.err.println("推送异常");
        }else{
            JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class);
            if(jsonObject1.getIntValue("code") != 200){
                logger.debug(jsonObject1.getString("msg"));
                System.err.println(jsonObject1.getString("msg"));
            }
        }
    }
@@ -176,22 +190,25 @@
        msg.put("msg", "SUCCESS");
        msg.put("method", "ORDER_INFO");
        msg.put("data", pushOrderInfoWarpper);
        //调用推送
        HttpHeaders headers = new HttpHeaders();
        // 以表单的方式提交
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient");
        post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
        //将请求头部和参数合成一个请求
        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"));
            System.err.println(jsonObject1.getString("msg"));
        Map<String, Object> params = new HashMap<>();
        params.put("msg", msg.toJSONString());
        params.put("id", id.toString());
        params.put("type", type.toString());
        post.form(params);
        HttpResponse execute = post.execute();
        if (200 != execute.getStatus()) {
            System.err.println("推送异常");
        }else{
            JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class);
            if(jsonObject1.getIntValue("code") != 200){
                logger.debug(jsonObject1.getString("msg"));
                System.err.println(jsonObject1.getString("msg"));
            }
        }
    }
@@ -201,22 +218,25 @@
        msg.put("msg", "SUCCESS");
        msg.put("method", "CHECK_ORDER_INFO");
        msg.put("data", pushOrderInfoWarpper);
        //调用推送
        HttpHeaders headers = new HttpHeaders();
        // 以表单的方式提交
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient");
        post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
        //将请求头部和参数合成一个请求
        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"));
            System.err.println(jsonObject1.getString("msg"));
        Map<String, Object> params = new HashMap<>();
        params.put("msg", msg.toJSONString());
        params.put("id", id.toString());
        params.put("type", type.toString());
        post.form(params);
        HttpResponse execute = post.execute();
        if (200 != execute.getStatus()) {
            System.err.println("推送异常");
        }else{
            JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class);
            if(jsonObject1.getIntValue("code") != 200){
                logger.debug(jsonObject1.getString("msg"));
                System.err.println(jsonObject1.getString("msg"));
            }
        }
    }
@@ -241,22 +261,25 @@
        map.put("countdown", countdown);
        msg.put("data", map);
        //调用推送
        HttpHeaders headers = new HttpHeaders();
        // 以表单的方式提交
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient");
        post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
        //将请求头部和参数合成一个请求
        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"));
            System.err.println(jsonObject1.getString("msg"));
        Map<String, Object> params = new HashMap<>();
        params.put("msg", msg.toJSONString());
        params.put("id", id.toString());
        params.put("type", type.toString());
        post.form(params);
        HttpResponse execute = post.execute();
        if (200 != execute.getStatus()) {
            System.err.println("推送异常");
        }else{
            JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class);
            if(jsonObject1.getIntValue("code") != 200){
                logger.debug(jsonObject1.getString("msg"));
                System.err.println(jsonObject1.getString("msg"));
            }
        }
    }
@@ -276,22 +299,25 @@
        Map<String, Object> map = new HashMap<>();
        msg.put("data", map);
        //调用推送
        HttpHeaders headers = new HttpHeaders();
        // 以表单的方式提交
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient");
        post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
        //将请求头部和参数合成一个请求
        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"));
            System.err.println(jsonObject1.getString("msg"));
        Map<String, Object> params = new HashMap<>();
        params.put("msg", msg.toJSONString());
        params.put("id", id.toString());
        params.put("type", type.toString());
        post.form(params);
        HttpResponse execute = post.execute();
        if (200 != execute.getStatus()) {
            System.err.println("推送异常");
        }else{
            JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class);
            if(jsonObject1.getIntValue("code") != 200){
                logger.debug(jsonObject1.getString("msg"));
                System.err.println(jsonObject1.getString("msg"));
            }
        }
    }
@@ -312,22 +338,25 @@
        map.put("orderId", orderId);
        msg.put("data", map);
        //调用推送
        HttpHeaders headers = new HttpHeaders();
        // 以表单的方式提交
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient");
        post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
        //将请求头部和参数合成一个请求
        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"));
            System.err.println(jsonObject1.getString("msg"));
        Map<String, Object> params = new HashMap<>();
        params.put("msg", msg.toJSONString());
        params.put("id", id.toString());
        params.put("type", type.toString());
        post.form(params);
        HttpResponse execute = post.execute();
        if (200 != execute.getStatus()) {
            System.err.println("推送异常");
        }else{
            JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class);
            if(jsonObject1.getIntValue("code") != 200){
                logger.debug(jsonObject1.getString("msg"));
                System.err.println(jsonObject1.getString("msg"));
            }
        }
    }
}