diff --git a/src/main/java/com/gxwebsoft/think/controller/SchedulingController.java b/src/main/java/com/gxwebsoft/think/controller/SchedulingController.java index bd45ea6..79cbd8d 100644 --- a/src/main/java/com/gxwebsoft/think/controller/SchedulingController.java +++ b/src/main/java/com/gxwebsoft/think/controller/SchedulingController.java @@ -17,6 +17,7 @@ import com.gxwebsoft.think.service.ThinkOrderService; import com.gxwebsoft.think.service.ThinkSiteService; import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.web.bind.annotation.RequestMapping; @@ -37,6 +38,7 @@ import java.util.concurrent.TimeUnit; @RestController @RequestMapping("/api/scheduled") @Profile("!test") +@ConditionalOnProperty(name = "config.think-scheduling-enabled", havingValue = "true", matchIfMissing = true) public class SchedulingController extends BaseController { @Resource diff --git a/src/main/java/com/gxwebsoft/think/task/ThinkFaceAccessTask.java b/src/main/java/com/gxwebsoft/think/task/ThinkFaceAccessTask.java index fb2ede4..fa69aee 100644 --- a/src/main/java/com/gxwebsoft/think/task/ThinkFaceAccessTask.java +++ b/src/main/java/com/gxwebsoft/think/task/ThinkFaceAccessTask.java @@ -9,6 +9,7 @@ import com.gxwebsoft.think.entity.*; import com.gxwebsoft.think.service.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -36,6 +37,7 @@ import java.util.stream.Collectors; */ @Component @Profile("!test") +@ConditionalOnProperty(name = "config.think-face-access-enabled", havingValue = "true", matchIfMissing = true) public class ThinkFaceAccessTask { private static final Logger logger = LoggerFactory.getLogger(ThinkFaceAccessTask.class); diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 12610e2..cb288ca 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,27 +1,58 @@ -# 开发环境配置 +# 测试环境配置(8.134.55.105:13306 / 本地 Redis database 5) +# +# application.yml 已默认激活 dev,直接启动即可: +# sh mvnw spring-boot:run +# 或: +# java -jar target/com-gxwebsoft-server-1.5.2.jar -# 数据源配置 spring: datasource: - url: jdbc:mysql://47.121.133.163:3308/gxtyzx_ws?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8 - username: gxtyzx_ws - password: 2jPKyRhw5eTLHhJJ - driver-class-name: com.mysql.cj.jdbc.Driver - type: com.alibaba.druid.pool.DruidDataSource + dynamic: + primary: master + strict: false + datasource: + master: + url: jdbc:mysql://8.134.55.105:13306/db_gxtyzx?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8 + username: db_gxtyzx + password: ekXdi5iJMjHKaw3K + driver-class-name: com.mysql.cj.jdbc.Driver + type: com.alibaba.druid.pool.DruidDataSource + server: + url: jdbc:mysql://47.121.133.163:3308/gxwebsoft_core?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&rewriteBatchedStatements=true + username: gxwebsoft_core + password: jdj7HYEdYHnYEFBy + driver-class-name: com.mysql.cj.jdbc.Driver + type: com.alibaba.druid.pool.DruidDataSource + redis: + database: 5 + host: 127.0.0.1 + port: 6379 + password: # 日志配置 logging: level: - com.gxwebsoft: DEBUG - com.baomidou.mybatisplus: DEBUG + com.gxwebsoft: INFO + com.baomidou.mybatisplus: INFO socketio: host: localhost #IP地址 # 框架配置 config: - # 开发环境接口 -# server-url: https://gxtyzx-api2.websoft.top/api -# upload-path: /www/wwwroot/gxtyzx-api/file/ - server-url: http://127.0.0.1:9099/api - upload-path: /Users/liangxin/Project/JAVA/gxtyzx-java/file/ + # 生产环境接口 + server-url: https://gxtyzx-server.websoft.top/api + upload-path: /www/wwwroot/gxtyzx-api/file/ + + # 阿里云OSS云存储 + endpoint: https://oss-cn-shenzhen.aliyuncs.com + accessKeyId: LTAI4GKGZ9Z2Z8JZ77c3GNZP + accessKeySecret: BiDkpS7UXj72HWwDWaFZxiXjNFBNCM + bucketName: oss-gxwebsoft + bucketDomain: https://oss.wsdns.cn + aliyunDomain: https://oss-gxwebsoft.oss-cn-shenzhen.aliyuncs.com + + # 本地联调关闭旧 ThinkPHP 定时任务(SchedulingController 每秒触发,会回写共享测试库订单) + think-scheduling-enabled: false + # 本地联调关闭人脸闸机同步(闸机服务 47.121.133.163:18098 从本机不可达) + think-face-access-enabled: false diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 585021b..a3da66c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -7,9 +7,7 @@ socketio: # 多环境配置 spring: profiles: - # 开发环境固定使用测试库(8.134.55.105 / Redis db5);生产/其他环境通过 SPRING_PROFILES_ACTIVE 覆盖 - active: ${SPRING_PROFILES_ACTIVE:gxtyzx-test} -# active: dev + active: dev # active: dev-local # active: prod