From c35ea17d309300dc41bc042a07c33c14bda43705 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期一, 21 七月 2025 15:28:55 +0800 Subject: [PATCH] 修改bug --- DriverQYTTravel/guns-admin/src/main/resources/application-prod.yml | 116 ++++++++++++++++ DriverQYTTravel/guns-admin/src/main/resources/application-test.yml | 116 ++++++++++++++++ ManagementQYTTravel/guns-admin/src/main/resources/application-dev.yml | 2 DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/QianYunTongConfig.java | 110 +++++++++++++++ DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SpringContextsUtil.java | 37 +++++ 5 files changed, 380 insertions(+), 1 deletions(-) diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SpringContextsUtil.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SpringContextsUtil.java new file mode 100644 index 0000000..fc674da --- /dev/null +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SpringContextsUtil.java @@ -0,0 +1,37 @@ +package com.stylefeng.guns.modular.system.util; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +@Component +public class SpringContextsUtil implements ApplicationContextAware{ + + private static ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + if (SpringContextsUtil.applicationContext == null) { + SpringContextsUtil.applicationContext = applicationContext; + } + } + // 获取applicationContext + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + // 通过name获取 Bean. + public static Object getBean(String name) { + return getApplicationContext().getBean(name); + } + // 通过class获取Bean. + public static <T> T getBean(Class<T> clazz) { + return getApplicationContext().getBean(clazz); + } + // 通过name,以及Clazz返回指定的Bean + public static <T> T getBean(String name, Class<T> clazz) { + System.out.println(getApplicationContext().getBean(name, clazz)); + return getApplicationContext().getBean(name, clazz); + } + +} diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/QianYunTongConfig.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/QianYunTongConfig.java new file mode 100644 index 0000000..4958b9e --- /dev/null +++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/QianYunTongConfig.java @@ -0,0 +1,110 @@ +package com.stylefeng.guns.modular.system.util.qianyuntong; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * @author zhibing.pu + * @Date 2025/7/8 11:31 + */ +@Data +@Component +public class QianYunTongConfig { + + @Value("${spring.profiles.active}") + private String activeProfile; + + + /** + * appkey + */ + private String appkey; + /** + * 私钥地址 + */ + private String privateKeyPath; + /** + * 消费者账号 + */ + private String userName; + /** + * 状态 + * 1:生产环境 + * 2:测试环境 + */ + private String status; + /** + * API地址 + */ + private String apiUrl; + /** + * 桶名 + */ + private String bucketName; + /** + * 小程序appId + */ + private String appId; + /** + * HOS的基础路径(公共前缀) + */ + private String endPoint; + /** + * 账户的ID + */ + private String account; + /** + * 向UAAS服务请求到的access_key + */ + private String accessKey; + /** + * 向UAAS服务请求到的secret_key + */ + private String secretKey; + + + public QianYunTongConfig getQianYunTongConfig() { + if("dev".equals(activeProfile)){ + this.appkey = "10001104"; + this.privateKeyPath = "C:\\Users\\39373\\Desktop\\黔云通\\private_key_test.pem"; + this.userName = "xiaofei"; + this.status = "1"; + this.setApiUrl("https://test-zhongtai.stqcloud.com:10070"); + this.setBucketName("bucuTest0625"); + this.setAppId("wxcc3c9058e2b294db"); + this.setEndPoint("http://119.4.112.68:27741/v1"); + this.setAccount("d8bef0a04db511f0b79d01a3e2b7587e"); + this.setAccessKey("TYMFTFD5SIIT15DCCUD7"); + this.setSecretKey("AoI1dkH3yoAvXoaQlREO3ed9mwQJFluLTliS9T1z"); + } + if("test".equals(activeProfile)){ + this.setAppkey("10001104"); + this.setPrivateKeyPath("/root/server/app/key/private_key_test.pem"); + this.setUserName("xiaofei"); + this.setStatus("1"); + this.setApiUrl("https://test-zhongtai.stqcloud.com:10070"); + this.setBucketName("bucuTest0625"); + this.setAppId("wxcc3c9058e2b294db"); + this.setEndPoint("http://119.4.112.68:27741/v1"); + this.setAccount("d8bef0a04db511f0b79d01a3e2b7587e"); + this.setAccessKey("TYMFTFD5SIIT15DCCUD7"); + this.setSecretKey("AoI1dkH3yoAvXoaQlREO3ed9mwQJFluLTliS9T1z"); + } + if("prod".equals(activeProfile)){ + this.setAppkey("10001104"); + this.setPrivateKeyPath("/root/server/app/key/private_key.pem"); + this.setUserName("xiwang"); + this.setStatus("1"); + this.setApiUrl("http://jjzhongtai.stqcloud.com:10010"); + this.setBucketName("qyt20250702"); + this.setAppId("wxcc3c9058e2b294db"); + this.setEndPoint("http://119.4.112.68:27741/v1"); + this.setAccount("d8bef0a04db511f0b79d01a3e2b7587e"); + this.setAccessKey("TYMFTFD5SIIT15DCCUD7"); + this.setSecretKey("AoI1dkH3yoAvXoaQlREO3ed9mwQJFluLTliS9T1z"); + } + return this; + } + +} diff --git a/DriverQYTTravel/guns-admin/src/main/resources/application-prod.yml b/DriverQYTTravel/guns-admin/src/main/resources/application-prod.yml new file mode 100644 index 0000000..1e79014 --- /dev/null +++ b/DriverQYTTravel/guns-admin/src/main/resources/application-prod.yml @@ -0,0 +1,116 @@ +server: + port: 8007 + +guns: + swagger-open: true #是否开启swagger (true/false) + kaptcha-open: false #是否开启登录时验证码 (true/false) + file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录) + picture-server-address: http://192.168.0.43/resources/ #图片服务器地址 + spring-session-open: false #是否开启spring session,如果是多机环境需要开启(true/false) + session-invalidate-time: 1800 #session失效时间(只在单机环境下生效,多机环境在SpringSessionConfig类中配置) 单位:秒 + session-validation-interval: 900 #多久检测一次失效的session(只在单机环境下生效) 单位:秒 + +spring: + application: + name: driver-server + profiles: + active: prod + mvc: + static-path-pattern: /static/** + view: + prefix: /WEB-INF/view + devtools: + restart: + enabled: false + additional-paths: src/main/java + exclude: static/**,WEB-INF/view/** + servlet: + multipart: + max-request-size: 100MB + max-file-size: 100MB + redis: + host: 172.21.35.151 + port: 6512 + password: SC_cache@20#25 + database: 0 + timeout: 1000 + cluster: + nodes: 172.21.35.151:6512,172.21.35.152:6512,172.21.35.153:6512,172.21.35.151:6513,172.21.35.152:6513,172.21.35.153:6513 + +mybatis-plus: + typeAliasesPackage: com.stylefeng.guns.modular + global-config: + id-type: 0 #0:数据库ID自增 1:用户输入id 2:全局唯一id(IdWorker) 3:全局唯一ID(uuid) + db-column-underline: false + configuration: + configuration.map-underscore-to-camel-case: true #是否开启自动驼峰命名规则(camel case)映射 + log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl #输出Sql,如需打印Sql注释该配置 + + +eureka: + client: + service-url: #注册中心地址 + defaultZone: http://sinata:sinata@127.0.0.1:8000/eureka #启用身份验证的方式连接 + register-with-eureka: true #在注册中心进行注册 + fetch-registry: true #从Eureka中获取注册信息。 + +--- + +spring: + datasource: + url: jdbc:mysql://172.21.35.140:8066/traffic_scdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai + username: traffic_scusr + password: QYT_sc@20#25 + db-name: traffic_scdb #用来搜集数据库的所有表 + filters: wall,mergeStat + +--- +spring: + data: + mongodb: + uri: mongodb://qyt_jtcx:qyt_jtcx2025@172.21.35.195:27017,172.21.35.196:27017/traveling_track + +--- + +wx: + grantType: authorization_code #填authorization_code + appid: 111 #应用唯一标识,在微信开放平台提交应用审核通过后获得 + appSecret: 111 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 + appletsAppid: wxcc3c9058e2b294db #小程序APPid + appletsAppSecret: 5610fc6126255ca5f7bd9fa4330338b6 # + mchId: 111 #微信支付分配的商户号 + key: 111 #key为商户平台设置的密钥key: + +--- + +alipay: + appid: 111 #应用程序唯一标识 + appPrivateKey: 111 #开发者应用私钥 + alipayPublicKey: 1 #应用公钥 + alipay_public_key: 111 #支付宝公钥 + +--- + +juhe: #聚合数据 + appKey: 111 # + + +--- + +jiguang: + appKey-driver: 111 #极光推送应用唯一标识 + masterSecret-driver: 111 #用于服务器端 API 调用时与 AppKey 配合使用达到鉴权的目的 + appKey-dispatch: 111 #极光推送应用唯一标识 + masterSecret-dispatch: 111 #用于服务器端 API 调用时与 AppKey 配合使用达到鉴权的目的 + + +--- + +#支付回调地址 +#正式环境 +callbackPath: https://traffic.qytzt.cn/driver + +--- +#交通部推送数据功能开关 +pushMinistryOfTransport: false + diff --git a/DriverQYTTravel/guns-admin/src/main/resources/application-test.yml b/DriverQYTTravel/guns-admin/src/main/resources/application-test.yml new file mode 100644 index 0000000..526159e --- /dev/null +++ b/DriverQYTTravel/guns-admin/src/main/resources/application-test.yml @@ -0,0 +1,116 @@ +server: + port: 8007 + +guns: + swagger-open: true #是否开启swagger (true/false) + kaptcha-open: false #是否开启登录时验证码 (true/false) + file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录) + picture-server-address: http://192.168.0.43/resources/ #图片服务器地址 + spring-session-open: false #是否开启spring session,如果是多机环境需要开启(true/false) + session-invalidate-time: 1800 #session失效时间(只在单机环境下生效,多机环境在SpringSessionConfig类中配置) 单位:秒 + session-validation-interval: 900 #多久检测一次失效的session(只在单机环境下生效) 单位:秒 + +spring: + application: + name: driver-server + profiles: + active: test + mvc: + static-path-pattern: /static/** + view: + prefix: /WEB-INF/view + devtools: + restart: + enabled: false + additional-paths: src/main/java + exclude: static/**,WEB-INF/view/** + servlet: + multipart: + max-request-size: 100MB + max-file-size: 100MB + redis: + host: 172.21.35.151 + port: 6512 + password: SC_cache@20#25 + database: 0 + timeout: 1000 + cluster: + nodes: 172.21.35.151:6512,172.21.35.152:6512,172.21.35.153:6512,172.21.35.151:6513,172.21.35.152:6513,172.21.35.153:6513 + +mybatis-plus: + typeAliasesPackage: com.stylefeng.guns.modular + global-config: + id-type: 0 #0:数据库ID自增 1:用户输入id 2:全局唯一id(IdWorker) 3:全局唯一ID(uuid) + db-column-underline: false + configuration: + configuration.map-underscore-to-camel-case: true #是否开启自动驼峰命名规则(camel case)映射 + log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl #输出Sql,如需打印Sql注释该配置 + + +eureka: + client: + service-url: #注册中心地址 + defaultZone: http://sinata:sinata@127.0.0.1:8000/eureka #启用身份验证的方式连接 + register-with-eureka: true #在注册中心进行注册 + fetch-registry: true #从Eureka中获取注册信息。 + +--- + +spring: + datasource: + url: jdbc:mysql://172.21.35.140:8066/traffic_scdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai + username: traffic_scusr + password: QYT_sc@20#25 + db-name: traffic_scdb #用来搜集数据库的所有表 + filters: wall,mergeStat + +--- +spring: + data: + mongodb: + uri: mongodb://qyt_jtcx:qyt_jtcx2025@172.21.35.195:27017,172.21.35.196:27017/traveling_track + +--- + +wx: + grantType: authorization_code #填authorization_code + appid: 111 #应用唯一标识,在微信开放平台提交应用审核通过后获得 + appSecret: 111 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 + appletsAppid: wxcc3c9058e2b294db #小程序APPid + appletsAppSecret: 5610fc6126255ca5f7bd9fa4330338b6 # + mchId: 111 #微信支付分配的商户号 + key: 111 #key为商户平台设置的密钥key: + +--- + +alipay: + appid: 111 #应用程序唯一标识 + appPrivateKey: 111 #开发者应用私钥 + alipayPublicKey: 1 #应用公钥 + alipay_public_key: 111 #支付宝公钥 + +--- + +juhe: #聚合数据 + appKey: 111 # + + +--- + +jiguang: + appKey-driver: 111 #极光推送应用唯一标识 + masterSecret-driver: 111 #用于服务器端 API 调用时与 AppKey 配合使用达到鉴权的目的 + appKey-dispatch: 111 #极光推送应用唯一标识 + masterSecret-dispatch: 111 #用于服务器端 API 调用时与 AppKey 配合使用达到鉴权的目的 + + +--- + +#支付回调地址 +#正式环境 +callbackPath: https://traffic.qytzt.cn/driver + +--- +#交通部推送数据功能开关 +pushMinistryOfTransport: false + diff --git a/ManagementQYTTravel/guns-admin/src/main/resources/application-dev.yml b/ManagementQYTTravel/guns-admin/src/main/resources/application-dev.yml index 1cc8356..1ae6eb8 100644 --- a/ManagementQYTTravel/guns-admin/src/main/resources/application-dev.yml +++ b/ManagementQYTTravel/guns-admin/src/main/resources/application-dev.yml @@ -45,7 +45,7 @@ --- spring: datasource: - url: jdbc:mysql://127.0.0.1:3306/qyttravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai + url: jdbc:mysql://192.168.110.80:3306/qyttravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai username: root password: 123456 db-name: qyttravel #用来搜集数据库的所有表 -- Gitblit v1.7.1