From eaa61bc9ecd9158f192f9999845cb2f05e6970fb Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期四, 21 八月 2025 02:09:02 +0800 Subject: [PATCH] 修改bug --- driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java | 54 ++-- driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java | 3 driver/guns-admin/src/main/resources/application-dev.yml | 3 driver/guns-admin/src/main/resources/application-prod.yml | 1 driver/guns-admin/src/main/resources/application-test.yml | 3 driver/guns-admin/src/main/resources/logback.xml | 0 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java | 74 ++---- driver/guns-admin/pom.xml | 7 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/qianyuntong/NCOSSUtil.java | 486 ++++++++++++++++++++++---------------------- 9 files changed, 296 insertions(+), 335 deletions(-) diff --git a/driver/guns-admin/pom.xml b/driver/guns-admin/pom.xml index 8198f20..6e392f6 100644 --- a/driver/guns-admin/pom.xml +++ b/driver/guns-admin/pom.xml @@ -243,13 +243,6 @@ <scope>system</scope> <systemPath>${pom.basedir}/lib/javabase64-1.3.1.jar</systemPath> </dependency> - <dependency> - <groupId>com.ncoss</groupId> - <artifactId>ncoss-java-sdk</artifactId> - <version>1.0.5</version> - <scope>system</scope> - <systemPath>${pom.basedir}/lib/ncoss-java-sdk-1.0.5.jar</systemPath> - </dependency> </dependencies> diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java index f019773..7254f10 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java @@ -1,11 +1,13 @@ package com.supersavedriving.driver.modular.system.api; +import cn.hutool.core.io.FileUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; -import com.heredata.hos.model.bucket.Bucket; import com.supersavedriving.driver.modular.system.dao.MonthOrderMapper; import com.supersavedriving.driver.modular.system.model.*; import com.supersavedriving.driver.modular.system.service.*; @@ -13,8 +15,6 @@ import com.supersavedriving.driver.modular.system.util.MallBook.model.InterfaceResponse; import com.supersavedriving.driver.modular.system.util.MiniPay.MiniAppPay; import com.supersavedriving.driver.modular.system.util.juhe.OCRUtil; -import com.supersavedriving.driver.modular.system.util.qianyuntong.NCOSSUtil; -import com.supersavedriving.driver.modular.system.util.qianyuntong.QianYunTongConfig; import com.supersavedriving.driver.modular.system.util.qianyuntong.SMSUtil; import com.supersavedriving.driver.modular.system.util.qianyuntong.model.SendSmsRequest; import com.supersavedriving.driver.modular.system.util.separateAccounts.StrUtil; @@ -33,12 +33,14 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.io.InputStream; import java.io.PrintWriter; import java.time.LocalDateTime; @@ -86,8 +88,6 @@ @Autowired private ISystemConfigService systemConfigService; - - @Autowired private IEditionService editionService; @@ -99,9 +99,12 @@ @Autowired private TCheckFacilitatorService checkFacilitatorService; - - @Resource - private QianYunTongConfig qianYunTongConfig; + + @Value("${filePath}") + private String filePath; + + @Value("${qyt.admin_url}") + private String adminUrl; @@ -164,6 +167,8 @@ return new ResponseWarpper(500, e.getMessage()); } } + + @ResponseBody @PostMapping("/base/driver/orcPhoto") // @ServiceLog(name = "司机注册申请", url = "/base/driver/driverRegister") @@ -920,7 +925,6 @@ /** * 账户余额充值支付回调 - * @param response */ @ResponseBody @PostMapping("/base/driver/balanceRechargeCallback") @@ -1179,29 +1183,15 @@ InputStream inputStream = file.getInputStream(); String name = file.getOriginalFilename(); name = UUIDUtil.getRandomCode() + name.substring(name.lastIndexOf(".")); - QianYunTongConfig qianYunTongConfig1 = qianYunTongConfig.getQianYunTongConfig(); - String bucketName = qianYunTongConfig1.getBucketName(); - Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName); - if (null == grjyTest) { - //创建桶 - Boolean bucket = NCOSSUtil.createBucket(bucketName); - if (!bucket) { - throw new RuntimeException("创建存储桶失败"); - } - //设置桶策略 - String policyText = "{\"Version\":\"2025-06-23\",\"Statement\":[{\"Sid\":\"Stmt20250623\",\"Action\":[\"GetObject\"],\"Effect\":\"Allow\",\"Resource\":\"" + bucketName + "/*\",\"Principal\":\"*\"}]}"; - Boolean bucketPolicy = NCOSSUtil.setBucketPolicy(bucketName, policyText); - if (!bucketPolicy) { - throw new RuntimeException("设置桶策略失败"); - } + File file1 = FileUtil.writeFromStream(inputStream, new File(filePath + name)); + HttpRequest post = HttpUtil.createPost(adminUrl + "/upload/image"); + HttpRequest form = post.form("file", file1); + HttpResponse execute = form.execute(); + int status = execute.getStatus(); + if(200 != status){ + throw new RuntimeException("上传图片异常"); } - //上传对象 - String key = "imgs/daijia/user/" + name; - String object = NCOSSUtil.putObject(bucketName, key, inputStream); - if (null == object) { - throw new RuntimeException("上传图片失败"); - } - return ResponseWarpper.success("https://traffic.qytzt.cn/v1/AUTH_" + qianYunTongConfig1.getAccount() + "/" + bucketName + "/" + key); + return ResponseWarpper.success(execute.body()); }catch (Exception e){ e.printStackTrace(); return new ResponseWarpper(500, e.getMessage()); diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java index 68a4ea6..fac41bc 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java @@ -1,11 +1,13 @@ package com.supersavedriving.driver.modular.system.service.impl; -import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +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.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.heredata.hos.model.bucket.Bucket; import com.supersavedriving.driver.core.common.constant.JwtConstants; import com.supersavedriving.driver.core.shiro.ShiroKit; import com.supersavedriving.driver.core.shiro.ShiroUser; @@ -19,9 +21,7 @@ import com.supersavedriving.driver.modular.system.util.MallBook.util.TrhRequest; import com.supersavedriving.driver.modular.system.util.*; import com.supersavedriving.driver.modular.system.util.MiniPay.MiniAppPay; -import com.supersavedriving.driver.modular.system.util.huawei.OBSUtil; import com.supersavedriving.driver.modular.system.util.mongodb.model.Location; -import com.supersavedriving.driver.modular.system.util.qianyuntong.NCOSSUtil; import com.supersavedriving.driver.modular.system.util.qianyuntong.QianYunTongConfig; import com.supersavedriving.driver.modular.system.util.rongyun.RongYunUtil; import com.supersavedriving.driver.modular.system.util.weChat.WeChatUtil; @@ -50,6 +50,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.io.File; import java.io.InputStream; import java.math.BigDecimal; import java.math.BigInteger; @@ -90,6 +91,9 @@ @Value("${filePath}") private String filePath; + + @Value("${qyt.admin_url}") + private String adminUrl; @Autowired private IAppUserService appUserService; @@ -217,59 +221,29 @@ public String wechatMiniProgramORCode(Integer driverId) throws Exception{ InputStream release = weChatUtil.getwxacodeunlimit("pages/index/index", "driverId=" + driverId, "release"); String pictureName = "driver_" + driverId + ".png"; - QianYunTongConfig qianYunTongConfig1 = qianYunTongConfig.getQianYunTongConfig(); - String bucketName = qianYunTongConfig1.getBucketName(); - Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName); - if (null == grjyTest) { - //创建桶 - Boolean bucket = NCOSSUtil.createBucket(bucketName); - if (!bucket) { - throw new RuntimeException("创建存储桶失败"); - } - //设置桶策略 - String policyText = "{\"Version\":\"2025-06-23\",\"Statement\":[{\"Sid\":\"Stmt20250623\",\"Action\":[\"GetObject\"],\"Effect\":\"Allow\",\"Resource\":\"" + bucketName + "/*\",\"Principal\":\"*\"}]}"; - Boolean bucketPolicy = NCOSSUtil.setBucketPolicy(bucketName, policyText); - if (!bucketPolicy) { - throw new RuntimeException("设置桶策略失败"); - } + File file = FileUtil.writeFromStream(release, new File(filePath + pictureName)); + HttpRequest post = HttpUtil.createPost(adminUrl + "/upload/image"); + HttpRequest form = post.form("file", file); + HttpResponse execute = form.execute(); + int status = execute.getStatus(); + if(200 != status){ + throw new RuntimeException("上传图片异常"); } - //上传对象 - String key = "imgs/daijia/driver/" + pictureName; - String object = NCOSSUtil.putObject(bucketName, key, release); - if (null == object) { - throw new RuntimeException("上传图片失败"); - } - - return "https://traffic.qytzt.cn/v1/AUTH_" + qianYunTongConfig1.getAccount() + "/" + bucketName + "/" + key; + return execute.body(); } //司机下单二维码 public String wechatMiniOrderQRCode(Integer driverId) throws Exception{ InputStream release = weChatUtil.getwxacodeunlimitOrder("pages/index/index", "driverIds=" + driverId, "release"); String pictureName = "driver_" + driverId + ".png"; - QianYunTongConfig qianYunTongConfig1 = qianYunTongConfig.getQianYunTongConfig(); - String bucketName = qianYunTongConfig1.getBucketName(); - Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName); - if (null == grjyTest) { - //创建桶 - Boolean bucket = NCOSSUtil.createBucket(bucketName); - if (!bucket) { - throw new RuntimeException("创建存储桶失败"); - } - //设置桶策略 - String policyText = "{\"Version\":\"2025-06-23\",\"Statement\":[{\"Sid\":\"Stmt20250623\",\"Action\":[\"GetObject\"],\"Effect\":\"Allow\",\"Resource\":\"" + bucketName + "/*\",\"Principal\":\"*\"}]}"; - Boolean bucketPolicy = NCOSSUtil.setBucketPolicy(bucketName, policyText); - if (!bucketPolicy) { - throw new RuntimeException("设置桶策略失败"); - } + File file = FileUtil.writeFromStream(release, new File(filePath + pictureName)); + HttpRequest post = HttpUtil.createPost(adminUrl + "/upload/image"); + HttpRequest form = post.form("file", file); + HttpResponse execute = form.execute(); + int status = execute.getStatus(); + if(200 != status){ + throw new RuntimeException("上传图片异常"); } - //上传对象 - String key = "imgs/daijia/driver/" + pictureName; - String object = NCOSSUtil.putObject(bucketName, key, release); - if (null == object) { - throw new RuntimeException("上传图片失败"); - } - - return "https://traffic.qytzt.cn/v1/AUTH_" + qianYunTongConfig1.getAccount() + "/" + bucketName + "/" + key; + return execute.body(); } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java index 854ddc9..0f8679a 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java @@ -1179,7 +1179,8 @@ .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); city = null != weatherCity ? weatherCity.getId().toString() : ""; } - boolean badWeather = WeatherUtil.isBadWeather(city); +// boolean badWeather = WeatherUtil.isBadWeather(city); + boolean badWeather = false; if(badWeather){ Integer num8 = JSON.parseObject(systemConfig.getContent()).getInteger("num8"); if(num8 > 0){ diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/qianyuntong/NCOSSUtil.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/qianyuntong/NCOSSUtil.java index 4f07299..9652a82 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/qianyuntong/NCOSSUtil.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/qianyuntong/NCOSSUtil.java @@ -1,243 +1,243 @@ -package com.supersavedriving.driver.modular.system.util.qianyuntong; - -import com.heredata.hos.HOS; -import com.heredata.hos.HOSClientBuilder; -import com.heredata.hos.model.CreateBucketRequest; -import com.heredata.hos.model.HOSObject; -import com.heredata.hos.model.PutObjectRequest; -import com.heredata.hos.model.PutObjectResult; -import com.heredata.hos.model.bucket.Bucket; -import com.heredata.model.VoidResult; -import com.supersavedriving.driver.modular.system.util.SpringContextsUtil; -import lombok.extern.slf4j.Slf4j; - -import java.io.InputStream; - -/** - * OSS 工具类 - * @author zhibing.pu - * @Date 2025/6/23 17:50 - */ -@Slf4j -public class NCOSSUtil { - - private static QianYunTongConfig qianYunTongConfig = SpringContextsUtil.getBean(QianYunTongConfig.class).getQianYunTongConfig(); - - /** - * 创建桶 - * @param bucketName - * @return - */ - public static Boolean createBucket(String bucketName) { - /** - * endPoint:HOS的基础路径(公共前缀) - * account:账户的ID - * accessKey:向UAAS服务请求到的access_key - * secretKey:向UAAS服务请求到的secret_key - */ - HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); - try { - // 创建请求对象,并且设置创建桶名为"example"的桶 - CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName); - VoidResult result = hos.createBucket(createBucketRequest); - if (result.getResponse().isSuccessful()) { - log.info("创建桶成功:" + bucketName); - return true; - } - } catch (Exception e){ - log.info("创建桶失败:" + bucketName); - e.printStackTrace(); - } - return false; - } - - - /** - * 查询桶详情 - * @param bucketName - * @return - */ - public static Bucket getBucketInfo(String bucketName) { - /** - * endPoint:HOS的基础路径(公共前缀) - * account:账户的ID - * accessKey:向UAAS服务请求到的access_key - * secretKey:向UAAS服务请求到的secret_key - */ - HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); - try { - // 查询桶名为"example"的详情 - Bucket bucket = hos.getBucketInfo(bucketName); - return bucket; - } catch (Exception e){ - e.printStackTrace(); - } - return null; - } - - - /** - * 删除桶 - * @param bucketName - * @return - */ - public static Boolean deleteBucket(String bucketName) { - /** - * endPoint:HOS的基础路径(公共前缀) - * account:账户的ID - * accessKey:向UAAS服务请求到的access_key - * secretKey:向UAAS服务请求到的secret_key - */ - HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); - try { - VoidResult result = hos.deleteBucket(bucketName); - if (result.getResponse().isSuccessful()) { - log.info("删除桶成功:" + bucketName); - return true; - } - } catch (Exception e){ - log.info("删除桶成功:" + bucketName); - e.printStackTrace(); - } - return false; - } - - - /** - * 设置桶策略 - * @param bucketName 桶名 - * @param policyText 策略规则字符串 - * { - * // 策略配置的版本号,由用户定义 - * "Version": "2012-10-17", - * // 策略规则配置,可指定多条策略规则 - * "Statement": [{ - * // 策略规则ID,可用户指定,如不指定则服务自动生成一条 - * "Sid": "sid", - * // 策略规则指定的HOS API接口标识,可参照下表填写 - * "Action": [ - * "action" - * ], - * // 策略规则效果,具体表现为允许或拒绝,有效值为Allow(允许),Deny(拒绝); - * "Effect": "Allow", - * // 策略规则指定的资源参照下面resource配置 - * "Resource": "resource", - * // 策略规则指定的授权人 参照下面Principal配置 - * "Principal": { - * "HWS": [ - * "account_id:root" - * ] - * } - * } - * ] - * } - * @return - */ - public static Boolean setBucketPolicy(String bucketName, String policyText) { - /** - * endPoint:HOS的基础路径(公共前缀) - * account:账户的ID - * accessKey:向UAAS服务请求到的access_key - * secretKey:向UAAS服务请求到的secret_key - */ - HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); - // 桶策略字符串 - try { - VoidResult result = hos.setBucketPolicy(bucketName, policyText); - if (result.getResponse().isSuccessful()) { - log.info("设置桶策略成功:" + bucketName); - return true; - } - } catch (Exception e) { - log.info("设置桶策略失败:" + bucketName); - e.printStackTrace(); - } - return false; - } - - - /** - * 上传对象 - * @param bucketName 桶名称 - * @param key 存储文件名 - * @param inputStream 上传文件流 - * @return 对象唯一标识 - */ - public static String putObject(String bucketName, String key, InputStream inputStream) { - /** - * endPoint:HOS的基础路径(公共前缀) - * account:账户的ID - * accessKey:向UAAS服务请求到的access_key - * secretKey:向UAAS服务请求到的secret_key - */ - HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); - try { - PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key , inputStream); - PutObjectResult example = hos.putObject(putObjectRequest); - if (example.getResponse().isSuccessful()) { - log.info("上传对象成功:" + bucketName + "--->" + key); - return example.getETag(); - } - } catch (Exception e) { - log.info("上传对象成功:" + bucketName); - e.printStackTrace(); - } - return null; - } - - - /** - * 查询对象 - * @param bucketName 桶名称 - * @param key 存储文件名 - * @return - */ - public static HOSObject getObject(String bucketName, String key) { - /** - * endPoint:HOS的基础路径(公共前缀) - * account:账户的ID - * accessKey:向UAAS服务请求到的access_key - * secretKey:向UAAS服务请求到的secret_key - */ - HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); - try { - HOSObject example = hos.getObject(bucketName, key); - if (example.getResponse().isSuccessful()) { - log.info("查询对象成功:" + bucketName + "--->" + key); - return example; - } - } catch (Exception e) { - log.info("查询对象失败:" + bucketName); - e.printStackTrace(); - } - return null; - } - - - /** - * 删除对象 - * @param bucketName 桶名称 - * @param key 存储文件名 - * @return - */ - public static Boolean deleteObject(String bucketName, String key) { - /** - * endPoint:HOS的基础路径(公共前缀) - * account:账户的ID - * accessKey:向UAAS服务请求到的access_key - * secretKey:向UAAS服务请求到的secret_key - */ - HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); - try { - VoidResult example = hos.deleteObject(bucketName, key); - if (example.getResponse().isSuccessful()) { - log.info("删除对象成功:" + bucketName + "--->" + key); - return true; - } - } catch (Exception e) { - log.info("删除对象失败:" + bucketName + "--->" + key); - e.printStackTrace(); - } - return false; - } -} +//package com.supersavedriving.driver.modular.system.util.qianyuntong; +// +//import com.heredata.hos.HOS; +//import com.heredata.hos.HOSClientBuilder; +//import com.heredata.hos.model.CreateBucketRequest; +//import com.heredata.hos.model.HOSObject; +//import com.heredata.hos.model.PutObjectRequest; +//import com.heredata.hos.model.PutObjectResult; +//import com.heredata.hos.model.bucket.Bucket; +//import com.heredata.model.VoidResult; +//import com.supersavedriving.driver.modular.system.util.SpringContextsUtil; +//import lombok.extern.slf4j.Slf4j; +// +//import java.io.InputStream; +// +///** +// * OSS 工具类 +// * @author zhibing.pu +// * @Date 2025/6/23 17:50 +// */ +//@Slf4j +//public class NCOSSUtil { +// +// private static QianYunTongConfig qianYunTongConfig = SpringContextsUtil.getBean(QianYunTongConfig.class).getQianYunTongConfig(); +// +// /** +// * 创建桶 +// * @param bucketName +// * @return +// */ +// public static Boolean createBucket(String bucketName) { +// /** +// * endPoint:HOS的基础路径(公共前缀) +// * account:账户的ID +// * accessKey:向UAAS服务请求到的access_key +// * secretKey:向UAAS服务请求到的secret_key +// */ +// HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); +// try { +// // 创建请求对象,并且设置创建桶名为"example"的桶 +// CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName); +// VoidResult result = hos.createBucket(createBucketRequest); +// if (result.getResponse().isSuccessful()) { +// log.info("创建桶成功:" + bucketName); +// return true; +// } +// } catch (Exception e){ +// log.info("创建桶失败:" + bucketName); +// e.printStackTrace(); +// } +// return false; +// } +// +// +// /** +// * 查询桶详情 +// * @param bucketName +// * @return +// */ +// public static Bucket getBucketInfo(String bucketName) { +// /** +// * endPoint:HOS的基础路径(公共前缀) +// * account:账户的ID +// * accessKey:向UAAS服务请求到的access_key +// * secretKey:向UAAS服务请求到的secret_key +// */ +// HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); +// try { +// // 查询桶名为"example"的详情 +// Bucket bucket = hos.getBucketInfo(bucketName); +// return bucket; +// } catch (Exception e){ +// e.printStackTrace(); +// } +// return null; +// } +// +// +// /** +// * 删除桶 +// * @param bucketName +// * @return +// */ +// public static Boolean deleteBucket(String bucketName) { +// /** +// * endPoint:HOS的基础路径(公共前缀) +// * account:账户的ID +// * accessKey:向UAAS服务请求到的access_key +// * secretKey:向UAAS服务请求到的secret_key +// */ +// HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); +// try { +// VoidResult result = hos.deleteBucket(bucketName); +// if (result.getResponse().isSuccessful()) { +// log.info("删除桶成功:" + bucketName); +// return true; +// } +// } catch (Exception e){ +// log.info("删除桶成功:" + bucketName); +// e.printStackTrace(); +// } +// return false; +// } +// +// +// /** +// * 设置桶策略 +// * @param bucketName 桶名 +// * @param policyText 策略规则字符串 +// * { +// * // 策略配置的版本号,由用户定义 +// * "Version": "2012-10-17", +// * // 策略规则配置,可指定多条策略规则 +// * "Statement": [{ +// * // 策略规则ID,可用户指定,如不指定则服务自动生成一条 +// * "Sid": "sid", +// * // 策略规则指定的HOS API接口标识,可参照下表填写 +// * "Action": [ +// * "action" +// * ], +// * // 策略规则效果,具体表现为允许或拒绝,有效值为Allow(允许),Deny(拒绝); +// * "Effect": "Allow", +// * // 策略规则指定的资源参照下面resource配置 +// * "Resource": "resource", +// * // 策略规则指定的授权人 参照下面Principal配置 +// * "Principal": { +// * "HWS": [ +// * "account_id:root" +// * ] +// * } +// * } +// * ] +// * } +// * @return +// */ +// public static Boolean setBucketPolicy(String bucketName, String policyText) { +// /** +// * endPoint:HOS的基础路径(公共前缀) +// * account:账户的ID +// * accessKey:向UAAS服务请求到的access_key +// * secretKey:向UAAS服务请求到的secret_key +// */ +// HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); +// // 桶策略字符串 +// try { +// VoidResult result = hos.setBucketPolicy(bucketName, policyText); +// if (result.getResponse().isSuccessful()) { +// log.info("设置桶策略成功:" + bucketName); +// return true; +// } +// } catch (Exception e) { +// log.info("设置桶策略失败:" + bucketName); +// e.printStackTrace(); +// } +// return false; +// } +// +// +// /** +// * 上传对象 +// * @param bucketName 桶名称 +// * @param key 存储文件名 +// * @param inputStream 上传文件流 +// * @return 对象唯一标识 +// */ +// public static String putObject(String bucketName, String key, InputStream inputStream) { +// /** +// * endPoint:HOS的基础路径(公共前缀) +// * account:账户的ID +// * accessKey:向UAAS服务请求到的access_key +// * secretKey:向UAAS服务请求到的secret_key +// */ +// HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); +// try { +// PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key , inputStream); +// PutObjectResult example = hos.putObject(putObjectRequest); +// if (example.getResponse().isSuccessful()) { +// log.info("上传对象成功:" + bucketName + "--->" + key); +// return example.getETag(); +// } +// } catch (Exception e) { +// log.info("上传对象成功:" + bucketName); +// e.printStackTrace(); +// } +// return null; +// } +// +// +// /** +// * 查询对象 +// * @param bucketName 桶名称 +// * @param key 存储文件名 +// * @return +// */ +// public static HOSObject getObject(String bucketName, String key) { +// /** +// * endPoint:HOS的基础路径(公共前缀) +// * account:账户的ID +// * accessKey:向UAAS服务请求到的access_key +// * secretKey:向UAAS服务请求到的secret_key +// */ +// HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); +// try { +// HOSObject example = hos.getObject(bucketName, key); +// if (example.getResponse().isSuccessful()) { +// log.info("查询对象成功:" + bucketName + "--->" + key); +// return example; +// } +// } catch (Exception e) { +// log.info("查询对象失败:" + bucketName); +// e.printStackTrace(); +// } +// return null; +// } +// +// +// /** +// * 删除对象 +// * @param bucketName 桶名称 +// * @param key 存储文件名 +// * @return +// */ +// public static Boolean deleteObject(String bucketName, String key) { +// /** +// * endPoint:HOS的基础路径(公共前缀) +// * account:账户的ID +// * accessKey:向UAAS服务请求到的access_key +// * secretKey:向UAAS服务请求到的secret_key +// */ +// HOS hos = new HOSClientBuilder().build(qianYunTongConfig.getEndPoint(), qianYunTongConfig.getAccount(), qianYunTongConfig.getAccessKey(), qianYunTongConfig.getSecretKey()); +// try { +// VoidResult example = hos.deleteObject(bucketName, key); +// if (example.getResponse().isSuccessful()) { +// log.info("删除对象成功:" + bucketName + "--->" + key); +// return true; +// } +// } catch (Exception e) { +// log.info("删除对象失败:" + bucketName + "--->" + key); +// e.printStackTrace(); +// } +// return false; +// } +//} diff --git a/driver/guns-admin/src/main/resources/application-dev.yml b/driver/guns-admin/src/main/resources/application-dev.yml index 398e7b0..6352954 100644 --- a/driver/guns-admin/src/main/resources/application-dev.yml +++ b/driver/guns-admin/src/main/resources/application-dev.yml @@ -98,7 +98,7 @@ --- -filePath: /usr/local/server/app/orderPostionFile/ #存储订单轨迹文件路径 +filePath: /etraffic/server/qytPdf/ #存储订单轨迹文件路径 callbackPath: http://121.31.232.206:3002/driver @@ -113,6 +113,7 @@ qyt: socket_uri: http://10.88.188.138:6000 + admin_url: http://127.0.0.1:7070 --- rongyun: diff --git a/driver/guns-admin/src/main/resources/application-prod.yml b/driver/guns-admin/src/main/resources/application-prod.yml index 96ce4e3..60b2d3a 100644 --- a/driver/guns-admin/src/main/resources/application-prod.yml +++ b/driver/guns-admin/src/main/resources/application-prod.yml @@ -112,6 +112,7 @@ qyt: socket_uri: http://10.88.188.138:6000 + admin_url: http://127.0.0.1:7070 --- diff --git a/driver/guns-admin/src/main/resources/application-test.yml b/driver/guns-admin/src/main/resources/application-test.yml index 3d5cb24..8c58d22 100644 --- a/driver/guns-admin/src/main/resources/application-test.yml +++ b/driver/guns-admin/src/main/resources/application-test.yml @@ -102,7 +102,7 @@ --- -filePath: /usr/local/server/app/orderPostionFile/ #存储订单轨迹文件路径 +filePath: /etraffic/server/qytPdf/ #存储订单轨迹文件路径 callbackPath: https://test-qncx.sitechcloud.com/daijia/driver-server @@ -120,6 +120,7 @@ qyt: socket_uri: http://10.88.188.138:6000 + admin_url: http://127.0.0.1:7070 --- diff --git a/driver/guns-admin/src/main/resources/logback-spring.xml b/driver/guns-admin/src/main/resources/logback.xml similarity index 100% rename from driver/guns-admin/src/main/resources/logback-spring.xml rename to driver/guns-admin/src/main/resources/logback.xml -- Gitblit v1.7.1