diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 000000000..2b1e1fa34 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,162 @@ +version: '3' +services: + yudao-gateway: + image: yudao-gateway + container_name: yudao-gateway + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + restart: always + network_mode: host # 以主机网络环境运行 + yudao-system: + image: yudao-module-system-biz + container_name: yudao-system + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + healthcheck: + test: [ "CMD","curl","-f","http://localhost:48081" ] + interval: 30s + timeout: 10s + retries: 5 + start_period: 60s + restart: always + network_mode: host + yudao-infra: + image: yudao-module-infra-biz + container_name: yudao-infra + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + restart: always + network_mode: host + healthcheck: + test: [ "CMD","curl","-f","http://localhost:48082" ] + interval: 30s + timeout: 10s + retries: 5 + start_period: 60s + depends_on: + yudao-system: + condition: service_healthy + yudao-report: + image: yudao-module-report-biz + container_name: yudao-report + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + restart: always + network_mode: host + depends_on: + yudao-infra: + condition: service_healthy + yudao-bpm: + image: yudao-module-bpm-biz + container_name: yudao-bpm + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + restart: always + network_mode: host + depends_on: + yudao-infra: + condition: service_healthy + yudao-pay: + image: yudao-module-pay-biz + container_name: yudao-pay + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + restart: always + network_mode: host + depends_on: + yudao-infra: + condition: service_healthy + yudao-mp: + image: yudao-module-mp-biz + container_name: yudao-mp + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + restart: always + network_mode: host + depends_on: + yudao-infra: + condition: service_healthy \ No newline at end of file diff --git a/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java b/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java index c300c525e..bc821bec2 100644 --- a/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java +++ b/yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java @@ -23,13 +23,11 @@ public class BannerApplicationRunner implements ApplicationRunner { "项目启动成功!\n\t" + "接口文档: \t{} \n\t" + "开发文档: \t{} \n\t" + - "视频教程: \t{} \n\t" + - "源码解析: \t{} \n" + + "视频教程: \t{} \n" + "----------------------------------------------------------", "https://cloud.iocoder.cn/api-doc/", "https://cloud.iocoder.cn", - "https://t.zsxq.com/02Yf6M7Qn", - "https://t.zsxq.com/02B6ujIee"); + "https://t.zsxq.com/02Yf6M7Qn"); // 数据报表 System.out.println("[报表模块 yudao-module-report 教程][参考 https://cloud.iocoder.cn/report/ 开启]"); @@ -37,9 +35,9 @@ public class BannerApplicationRunner implements ApplicationRunner { System.out.println("[工作流模块 yudao-module-bpm 教程][参考 https://cloud.iocoder.cn/bpm/ 开启]"); // 微信公众号 System.out.println("[微信公众号 yudao-module-mp 教程][参考 https://cloud.iocoder.cn/mp/build/ 开启]"); - // 商城 + // 商城系统 System.out.println("[商城系统 yudao-module-mall 教程][参考 https://cloud.iocoder.cn/mall/build/ 开启]"); - // 支付 + // 支付平台 System.out.println("[支付系统 yudao-module-pay - 已禁用][参考 https://doc.iocoder.cn/pay/build/ 开启]"); }); } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java index 1dd82c6fa..df49cbebe 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.web.core.handler; import cn.hutool.core.exceptions.ExceptionUtil; import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.extra.servlet.ServletUtil; import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLog; import cn.iocoder.yudao.framework.common.exception.ServiceException; @@ -219,6 +220,13 @@ public class GlobalExceptionHandler { */ @ExceptionHandler(value = Exception.class) public CommonResult defaultExceptionHandler(HttpServletRequest req, Throwable ex) { + // 情况一:处理表不存在的异常 + CommonResult tableNotExistsResult = handleTableNotExists(ex); + if (tableNotExistsResult != null) { + return tableNotExistsResult; + } + + // 情况二:处理异常 log.error("[defaultExceptionHandler]", ex); // 插入异常日志 this.createExceptionLog(req, ex); @@ -269,4 +277,48 @@ public class GlobalExceptionHandler { errorLog.setExceptionTime(LocalDateTime.now()); } + /** + * 处理 Table 不存在的异常情况 + * + * @param ex 异常 + * @return 如果是 Table 不存在的异常,则返回对应的 CommonResult + */ + private CommonResult handleTableNotExists(Throwable ex) { + String message = ExceptionUtil.getRootCauseMessage(ex); + if (!message.contains("doesn't exist")) { + return null; + } + // 1. 数据报表 + if (message.contains("report_")) { + log.error("[报表模块 yudao-module-report - 表结构未导入][参考 https://doc.iocoder.cn/report/ 开启]"); + return CommonResult.error(NOT_IMPLEMENTED.getCode(), + "[报表模块 yudao-module-report - 表结构未导入][参考 https://doc.iocoder.cn/report/ 开启]"); + } + // 2. 工作流 + if (message.contains("bpm_")) { + log.error("[工作流模块 yudao-module-bpm - 表结构未导入][参考 https://doc.iocoder.cn/bpm/ 开启]"); + return CommonResult.error(NOT_IMPLEMENTED.getCode(), + "[工作流模块 yudao-module-bpm - 表结构未导入][参考 https://doc.iocoder.cn/bpm/ 开启]"); + } + // 3. 微信公众号 + if (message.contains("mp_")) { + log.error("[微信公众号 yudao-module-mp - 表结构未导入][参考 https://doc.iocoder.cn/mp/build/ 开启]"); + return CommonResult.error(NOT_IMPLEMENTED.getCode(), + "[微信公众号 yudao-module-mp - 表结构未导入][参考 https://doc.iocoder.cn/mp/build/ 开启]"); + } + // 4. 商城系统 + if (StrUtil.containsAny(message, "product_", "promotion_", "trade_")) { + log.error("[商城系统 yudao-module-mall - 已禁用][参考 https://doc.iocoder.cn/mall/build/ 开启]"); + return CommonResult.error(NOT_IMPLEMENTED.getCode(), + "[商城系统 yudao-module-mall - 已禁用][参考 https://doc.iocoder.cn/mall/build/ 开启]"); + } + // 5. 支付平台 + if (message.contains("pay_")) { + log.error("[支付模块 yudao-module-pay - 表结构未导入][参考 https://doc.iocoder.cn/pay/build/ 开启]"); + return CommonResult.error(NOT_IMPLEMENTED.getCode(), + "[支付模块 yudao-module-pay - 表结构未导入][参考 https://doc.iocoder.cn/pay/build/ 开启]"); + } + return null; + } + } diff --git a/yudao-gateway/Dockerfile b/yudao-gateway/Dockerfile new file mode 100644 index 000000000..9ffb1b922 --- /dev/null +++ b/yudao-gateway/Dockerfile @@ -0,0 +1,19 @@ +## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性 +## 感谢复旦核博士的建议!灰子哥,牛皮! +FROM eclipse-temurin:8-jre + +## 创建目录,并使用它作为工作目录 +RUN mkdir -p /yudao-gateway +WORKDIR /yudao-gateway +## 将后端项目的 Jar 文件,复制到镜像中 +COPY ./target/yudao-gateway.jar app.jar + +## 设置 TZ 时区 +## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖 +ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m" + +## 暴露后端项目的 48080 端口 +EXPOSE 48080 + +## 启动后端项目 +CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar diff --git a/yudao-gateway/src/main/resources/logback-spring.xml b/yudao-gateway/src/main/resources/logback-spring.xml index 5f4b30d04..b1b9f3faf 100644 --- a/yudao-gateway/src/main/resources/logback-spring.xml +++ b/yudao-gateway/src/main/resources/logback-spring.xml @@ -4,7 +4,7 @@ - +       diff --git a/yudao-module-bpm/yudao-module-bpm-biz/Dockerfile b/yudao-module-bpm/yudao-module-bpm-biz/Dockerfile new file mode 100644 index 000000000..4febef856 --- /dev/null +++ b/yudao-module-bpm/yudao-module-bpm-biz/Dockerfile @@ -0,0 +1,19 @@ +## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性 +## 感谢复旦核博士的建议!灰子哥,牛皮! +FROM eclipse-temurin:8-jre + +## 创建目录,并使用它作为工作目录 +RUN mkdir -p /yudao-module-bpm-biz +WORKDIR /yudao-module-bpm-biz +## 将后端项目的 Jar 文件,复制到镜像中 +COPY ./target/yudao-module-bpm-biz.jar app.jar + +## 设置 TZ 时区 +## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖 +ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m" + +## 暴露后端项目的 48080 端口 +EXPOSE 48083 + +## 启动后端项目 +CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/logback-spring.xml b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/logback-spring.xml index 5f4b30d04..b1b9f3faf 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/logback-spring.xml +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/logback-spring.xml @@ -4,7 +4,7 @@ - +       diff --git a/yudao-module-infra/yudao-module-infra-biz/Dockerfile b/yudao-module-infra/yudao-module-infra-biz/Dockerfile new file mode 100644 index 000000000..578cba767 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/Dockerfile @@ -0,0 +1,19 @@ +## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性 +## 感谢复旦核博士的建议!灰子哥,牛皮! +FROM eclipse-temurin:8-jre + +## 创建目录,并使用它作为工作目录 +RUN mkdir -p /yudao-module-infra-biz +WORKDIR /yudao-module-infra-biz +## 将后端项目的 Jar 文件,复制到镜像中 +COPY ./target/yudao-module-infra-biz.jar app.jar + +## 设置 TZ 时区 +## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖 +ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m" + +## 暴露后端项目的 48080 端口 +EXPOSE 48082 + +## 启动后端项目 +CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/health/HealthController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/health/HealthController.java new file mode 100644 index 000000000..a490ecace --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/health/HealthController.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.infra.controller.admin.health; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.security.PermitAll; + +/** + * @description: 健康检查 + * @author: jhaol + */ +@Tag(name = "infra 模块 - 健康检查") +@RestController +@RequestMapping("/infra/health") +@Validated +public class HealthController { + @GetMapping() + @Operation(summary = "健康检查") + @PermitAll + public Integer health() { + return 0; + } +} diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/logback-spring.xml b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/logback-spring.xml index 5f4b30d04..b1b9f3faf 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/logback-spring.xml +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/logback-spring.xml @@ -4,7 +4,7 @@ - +       diff --git a/yudao-module-mp/yudao-module-mp-biz/Dockerfile b/yudao-module-mp/yudao-module-mp-biz/Dockerfile new file mode 100644 index 000000000..99c228ab8 --- /dev/null +++ b/yudao-module-mp/yudao-module-mp-biz/Dockerfile @@ -0,0 +1,19 @@ +## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性 +## 感谢复旦核博士的建议!灰子哥,牛皮! +FROM eclipse-temurin:8-jre + +## 创建目录,并使用它作为工作目录 +RUN mkdir -p /yudao-module-mp-biz-1.8.0-snapshot +WORKDIR /yudao-module-mp-biz-1.8.0-snapshot +## 将后端项目的 Jar 文件,复制到镜像中 +COPY ./target/yudao-module-mp-biz-1.8.0-snapshot.jar app.jar + +## 设置 TZ 时区 +## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖 +ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m" + +## 暴露后端项目的 48080 端口 +EXPOSE 48086 + +## 启动后端项目 +CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/account/MpAccountServiceImpl.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/account/MpAccountServiceImpl.java index af359b02a..a8f9b78d1 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/account/MpAccountServiceImpl.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/service/account/MpAccountServiceImpl.java @@ -27,6 +27,7 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.PostConstruct; import javax.annotation.Resource; import java.time.LocalDateTime; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -68,7 +69,15 @@ public class MpAccountServiceImpl implements MpAccountService { // 注意:忽略自动多租户,因为要全局初始化缓存 TenantUtils.executeIgnore(() -> { // 第一步:查询数据 - List accounts = mpAccountMapper.selectList(); + List accounts = Collections.emptyList(); + try { + accounts = mpAccountMapper.selectList(); + } catch (Throwable ex) { + if (!ex.getMessage().contains("doesn't exist")) { + throw ex; + } + log.error("[微信公众号 yudao-module-mp - 表结构未导入][参考 https://doc.iocoder.cn/mp/build/ 开启]"); + } log.info("[initLocalCacheIfUpdate][缓存公众号账号,数量为:{}]", accounts.size()); // 第二步:构建缓存。创建或更新支付 Client diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/resources/logback-spring.xml b/yudao-module-mp/yudao-module-mp-biz/src/main/resources/logback-spring.xml index 5f4b30d04..b1b9f3faf 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/resources/logback-spring.xml +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/resources/logback-spring.xml @@ -4,7 +4,7 @@ - +       diff --git a/yudao-module-pay/yudao-module-pay-biz/Dockerfile b/yudao-module-pay/yudao-module-pay-biz/Dockerfile new file mode 100644 index 000000000..e49321f39 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/Dockerfile @@ -0,0 +1,20 @@ +## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性 +## 感谢复旦核博士的建议!灰子哥,牛皮! +FROM eclipse-temurin:8-jre + + +## 创建目录,并使用它作为工作目录 +RUN mkdir -p /yudao-module-pay-biz-1.8.0-snapshot +WORKDIR /yudao-module-pay-biz-1.8.0-snapshot +## 将后端项目的 Jar 文件,复制到镜像中 +COPY ./target/yudao-module-pay-biz-1.8.0-snapshot.jar app.jar + +## 设置 TZ 时区 +## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖 +ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m" + +## 暴露后端项目的 48080 端口 +EXPOSE 48085 + +## 启动后端项目 +CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java index 3eb996c4a..57aaf07d0 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceImpl.java @@ -27,6 +27,7 @@ import javax.annotation.Resource; import javax.validation.Validator; import java.time.LocalDateTime; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; @@ -64,7 +65,15 @@ public class PayChannelServiceImpl implements PayChannelService { // 注意:忽略自动多租户,因为要全局初始化缓存 TenantUtils.executeIgnore(() -> { // 第一步:查询数据 - List channels = channelMapper.selectList(); + List channels = Collections.emptyList(); + try { + channels = channelMapper.selectList(); + } catch (Throwable ex) { + if (!ex.getMessage().contains("doesn't exist")) { + throw ex; + } + log.error("[支付模块 yudao-module-pay - 表结构未导入][参考 https://doc.iocoder.cn/pay/build/ 开启]"); + } log.info("[initLocalCache][缓存支付渠道,数量为:{}]", channels.size()); // 第二步:构建缓存:创建或更新支付 Client diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/resources/logback-spring.xml b/yudao-module-pay/yudao-module-pay-biz/src/main/resources/logback-spring.xml index 5f4b30d04..b1b9f3faf 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/resources/logback-spring.xml +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/resources/logback-spring.xml @@ -4,7 +4,7 @@ - +       diff --git a/yudao-module-report/yudao-module-report-biz/Dockerfile b/yudao-module-report/yudao-module-report-biz/Dockerfile new file mode 100644 index 000000000..06cee9c70 --- /dev/null +++ b/yudao-module-report/yudao-module-report-biz/Dockerfile @@ -0,0 +1,19 @@ +## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性 +## 感谢复旦核博士的建议!灰子哥,牛皮! +FROM eclipse-temurin:8-jre + +## 创建目录,并使用它作为工作目录 +RUN mkdir -p /yudao-module-report-biz +WORKDIR /yudao-module-report-biz +## 将后端项目的 Jar 文件,复制到镜像中 +COPY ./target/yudao-module-report-biz.jar app.jar + +## 设置 TZ 时区 +## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖 +ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m" + +## 暴露后端项目的 48080 端口 +EXPOSE 48084 + +## 启动后端项目 +CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar diff --git a/yudao-module-report/yudao-module-report-biz/src/main/resources/logback-spring.xml b/yudao-module-report/yudao-module-report-biz/src/main/resources/logback-spring.xml index 5f4b30d04..b1b9f3faf 100644 --- a/yudao-module-report/yudao-module-report-biz/src/main/resources/logback-spring.xml +++ b/yudao-module-report/yudao-module-report-biz/src/main/resources/logback-spring.xml @@ -4,7 +4,7 @@ - +       diff --git a/yudao-module-system/yudao-module-system-biz/Dockerfile b/yudao-module-system/yudao-module-system-biz/Dockerfile new file mode 100644 index 000000000..fcad0ddde --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/Dockerfile @@ -0,0 +1,19 @@ +## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性 +## 感谢复旦核博士的建议!灰子哥,牛皮! +FROM eclipse-temurin:8-jre + +## 创建目录,并使用它作为工作目录 +RUN mkdir -p /yudao-module-system-biz +WORKDIR /yudao-module-system-biz +## 将后端项目的 Jar 文件,复制到镜像中 +COPY ./target/yudao-module-system-biz.jar app.jar + +## 设置 TZ 时区 +## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖 +ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m" + +## 暴露后端项目的 48080 端口 +EXPOSE 48081 + +## 启动后端项目 +CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/health/HealthController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/health/HealthController.java new file mode 100644 index 000000000..d57888327 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/health/HealthController.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.system.controller.admin.health; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.security.PermitAll; + +/** + * @description: 健康检查 + * @author: jhaol + */ +@Tag(name = "system 模块 - 健康检查") +@RestController +@RequestMapping("/system/health") +@Validated +public class HealthController { + @GetMapping() + @Operation(summary = "健康检查") + @PermitAll + public Integer health() { + return 0; + } +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountServiceImpl.java index 457056f40..94b02dbab 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountServiceImpl.java @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; import cn.iocoder.yudao.module.system.dal.mysql.mail.MailAccountMapper; import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants; import lombok.extern.slf4j.Slf4j; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -46,7 +47,7 @@ public class MailAccountServiceImpl implements MailAccountService { } @Override - @Cacheable(value = RedisKeyConstants.MAIL_ACCOUNT, key = "#updateReqVO.id") + @CacheEvict(value = RedisKeyConstants.MAIL_ACCOUNT, key = "#updateReqVO.id") public void updateMailAccount(MailAccountUpdateReqVO updateReqVO) { // 校验是否存在 validateMailAccountExists(updateReqVO.getId()); @@ -57,7 +58,7 @@ public class MailAccountServiceImpl implements MailAccountService { } @Override - @Cacheable(value = RedisKeyConstants.MAIL_ACCOUNT, key = "#id") + @CacheEvict(value = RedisKeyConstants.MAIL_ACCOUNT, key = "#id") public void deleteMailAccount(Long id) { // 校验是否存在账号 validateMailAccountExists(id); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java index a108e8f77..f90d66c34 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.system.service.permission; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuListReqVO; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuUpdateReqVO; @@ -20,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.Collection; +import java.util.Collections; import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; @@ -130,6 +132,9 @@ public class MenuServiceImpl implements MenuService { @Override public List getMenuList(Collection ids) { + if (CollectionUtil.isEmpty(ids)) { + return Collections.emptyList(); + } return menuMapper.selectBatchIds(ids); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/logback-spring.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/logback-spring.xml index 5f4b30d04..b1b9f3faf 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/logback-spring.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/logback-spring.xml @@ -4,7 +4,7 @@ - +