Commit 9bc9b2ac6bb717a4205bdf8ae0917cd48e5bab5b
1 parent
dc11dfc2
多模块重构 5:infra 模块的修改~~~
Showing
146 changed files
with
1203 additions
and
1525 deletions
yudao-admin-server/pom.xml
| @@ -99,12 +99,6 @@ | @@ -99,12 +99,6 @@ | ||
| 99 | <artifactId>yudao-spring-boot-starter-redis</artifactId> | 99 | <artifactId>yudao-spring-boot-starter-redis</artifactId> |
| 100 | </dependency> | 100 | </dependency> |
| 101 | 101 | ||
| 102 | - <!-- Config 配置中心相关 --> | ||
| 103 | - <dependency> | ||
| 104 | - <groupId>cn.iocoder.boot</groupId> | ||
| 105 | - <artifactId>yudao-spring-boot-starter-config</artifactId> | ||
| 106 | - </dependency> | ||
| 107 | - | ||
| 108 | <!-- Job 定时任务相关 --> | 102 | <!-- Job 定时任务相关 --> |
| 109 | <dependency> | 103 | <dependency> |
| 110 | <groupId>cn.iocoder.boot</groupId> | 104 | <groupId>cn.iocoder.boot</groupId> |
| @@ -152,11 +146,6 @@ | @@ -152,11 +146,6 @@ | ||
| 152 | <artifactId>velocity-engine-core</artifactId> | 146 | <artifactId>velocity-engine-core</artifactId> |
| 153 | </dependency> | 147 | </dependency> |
| 154 | 148 | ||
| 155 | - <dependency> | ||
| 156 | - <groupId>cn.smallbun.screw</groupId> | ||
| 157 | - <artifactId>screw-core</artifactId> <!-- 实现数据库文档 --> | ||
| 158 | - </dependency> | ||
| 159 | - | ||
| 160 | <!-- 三方云服务相关 --> | 149 | <!-- 三方云服务相关 --> |
| 161 | 150 | ||
| 162 | <dependency> | 151 | <dependency> |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/AdminServerApplication.java
| @@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; | @@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 5 | 5 | ||
| 6 | @SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${yudao.info.base-package} 和 ${yudao.core-service.base-package} | 6 | @SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${yudao.info.base-package} 和 ${yudao.core-service.base-package} |
| 7 | @SpringBootApplication(scanBasePackages = {"${yudao.info.base-package}", "${yudao.core-service.base-package}", | 7 | @SpringBootApplication(scanBasePackages = {"${yudao.info.base-package}", "${yudao.core-service.base-package}", |
| 8 | - "${yudao.info.member-package}", "${yudao.info.system-package}"}) // TODO 芋艿:重构 | 8 | + "${yudao.info.base-package2}"}) // TODO 芋艿:重构 |
| 9 | public class AdminServerApplication { | 9 | public class AdminServerApplication { |
| 10 | 10 | ||
| 11 | public static void main(String[] args) { | 11 | public static void main(String[] args) { |
yudao-admin-server/src/main/resources/application-dev.yaml
| @@ -100,7 +100,7 @@ apollo: | @@ -100,7 +100,7 @@ apollo: | ||
| 100 | eagerLoad: | 100 | eagerLoad: |
| 101 | enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置 | 101 | enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置 |
| 102 | jdbc: # 自定义的 JDBC 配置项,用于数据库的地址 | 102 | jdbc: # 自定义的 JDBC 配置项,用于数据库的地址 |
| 103 | - dao: cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.config.InfConfigCoreDAOImpl | 103 | + dao: cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigCoreDAOImpl |
| 104 | url: ${spring.datasource.dynamic.datasource.master.url} | 104 | url: ${spring.datasource.dynamic.datasource.master.url} |
| 105 | username: ${spring.datasource.dynamic.datasource.master.username} | 105 | username: ${spring.datasource.dynamic.datasource.master.username} |
| 106 | password: ${spring.datasource.dynamic.datasource.master.password} | 106 | password: ${spring.datasource.dynamic.datasource.master.password} |
yudao-admin-server/src/main/resources/application-local.yaml
| @@ -113,7 +113,7 @@ apollo: | @@ -113,7 +113,7 @@ apollo: | ||
| 113 | eagerLoad: | 113 | eagerLoad: |
| 114 | enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置 | 114 | enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置 |
| 115 | jdbc: # 自定义的 JDBC 配置项,用于数据库的地址 | 115 | jdbc: # 自定义的 JDBC 配置项,用于数据库的地址 |
| 116 | - dao: cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.config.InfConfigCoreDAOImpl | 116 | + dao: cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigCoreDAOImpl |
| 117 | url: ${spring.datasource.dynamic.datasource.master.url} | 117 | url: ${spring.datasource.dynamic.datasource.master.url} |
| 118 | username: ${spring.datasource.dynamic.datasource.master.username} | 118 | username: ${spring.datasource.dynamic.datasource.master.username} |
| 119 | password: ${spring.datasource.dynamic.datasource.master.password} | 119 | password: ${spring.datasource.dynamic.datasource.master.password} |
yudao-admin-server/src/main/resources/application.yaml
| @@ -48,17 +48,16 @@ yudao: | @@ -48,17 +48,16 @@ yudao: | ||
| 48 | info: | 48 | info: |
| 49 | version: 1.0.0 | 49 | version: 1.0.0 |
| 50 | base-package: cn.iocoder.yudao.adminserver | 50 | base-package: cn.iocoder.yudao.adminserver |
| 51 | - member-package: cn.iocoder.yudao.module.member | ||
| 52 | - system-package: cn.iocoder.yudao.module.system | 51 | + base-package2: cn.iocoder.yudao.module |
| 53 | core-service: | 52 | core-service: |
| 54 | base-package: cn.iocoder.yudao.coreservice | 53 | base-package: cn.iocoder.yudao.coreservice |
| 55 | web: | 54 | web: |
| 56 | admin-api: | 55 | admin-api: |
| 57 | prefix: /admin-api | 56 | prefix: /admin-api |
| 58 | - controller: cn.iocoder.yudao.module.system.controller.admin # TODO 芋艿:需要改造 | 57 | + controller: '**.controller.admin.**' |
| 59 | app-api: | 58 | app-api: |
| 60 | prefix: /app-api | 59 | prefix: /app-api |
| 61 | - controller: cn.iocoder.yudao.module.member.controller.app # TODO 芋艿:需要改造 | 60 | + controller: '**.controller.app.**' |
| 62 | 61 | ||
| 63 | swagger: | 62 | swagger: |
| 64 | title: 管理后台 | 63 | title: 管理后台 |
yudao-admin-server/src/test/resources/sql/clean.sql
| 1 | -- inf 开头的 DB | 1 | -- inf 开头的 DB |
| 2 | -DELETE FROM "inf_config"; | ||
| 3 | -DELETE FROM "inf_file"; | ||
| 4 | -DELETE FROM "inf_job"; | ||
| 5 | -DELETE FROM "inf_job_log"; | ||
| 6 | -DELETE FROM "inf_api_access_log"; | ||
| 7 | -DELETE FROM "inf_api_error_log"; | 2 | + |
| 8 | 3 | ||
| 9 | -- pay 开头的 DB | 4 | -- pay 开头的 DB |
| 10 | DELETE FROM pay_merchant; | 5 | DELETE FROM pay_merchant; |
yudao-admin-server/src/test/resources/sql/create_tables.sql
| 1 | -- inf 开头的 DB | 1 | -- inf 开头的 DB |
| 2 | 2 | ||
| 3 | -CREATE TABLE IF NOT EXISTS "inf_config" ( | ||
| 4 | - "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY, | ||
| 5 | - "group" varchar(50) NOT NULL, | ||
| 6 | - "type" tinyint NOT NULL, | ||
| 7 | - "name" varchar(100) NOT NULL DEFAULT '', | ||
| 8 | - "key" varchar(100) NOT NULL DEFAULT '', | ||
| 9 | - "value" varchar(500) NOT NULL DEFAULT '', | ||
| 10 | - "sensitive" bit NOT NULL, | ||
| 11 | - "remark" varchar(500) DEFAULT NULL, | ||
| 12 | - "creator" varchar(64) DEFAULT '', | ||
| 13 | - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 14 | - "updater" varchar(64) DEFAULT '', | ||
| 15 | - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 16 | - "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 17 | - PRIMARY KEY ("id") | ||
| 18 | -) COMMENT '参数配置表'; | ||
| 19 | - | ||
| 20 | -CREATE TABLE IF NOT EXISTS "inf_file" ( | ||
| 21 | - "id" varchar(188) NOT NULL, | ||
| 22 | - "type" varchar(63) DEFAULT NULL, | ||
| 23 | - "content" blob NOT NULL, | ||
| 24 | - "creator" varchar(64) DEFAULT '', | ||
| 25 | - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 26 | - "updater" varchar(64) DEFAULT '', | ||
| 27 | - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 28 | - "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 29 | - "tenant_id" bigint not null default '0', | ||
| 30 | - PRIMARY KEY ("id") | ||
| 31 | -) COMMENT '文件表'; | ||
| 32 | - | ||
| 33 | -CREATE TABLE IF NOT EXISTS "inf_job" ( | ||
| 34 | - "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '任务编号', | ||
| 35 | - "name" varchar(32) NOT NULL COMMENT '任务名称', | ||
| 36 | - "status" tinyint(4) NOT NULL COMMENT '任务状态', | ||
| 37 | - "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字', | ||
| 38 | - "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数', | ||
| 39 | - "cron_expression" varchar(32) NOT NULL COMMENT 'CRON 表达式', | ||
| 40 | - "retry_count" int(11) NOT NULL DEFAULT '0' COMMENT '重试次数', | ||
| 41 | - "retry_interval" int(11) NOT NULL DEFAULT '0' COMMENT '重试间隔', | ||
| 42 | - "monitor_timeout" int(11) NOT NULL DEFAULT '0' COMMENT '监控超时时间', | ||
| 43 | - "creator" varchar(64) DEFAULT '' COMMENT '创建者', | ||
| 44 | - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 45 | - "updater" varchar(64) DEFAULT '' COMMENT '更新者', | ||
| 46 | - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 47 | - "deleted" bit NOT NULL DEFAULT FALSE COMMENT '是否删除', | ||
| 48 | - PRIMARY KEY ("id") | ||
| 49 | -) COMMENT='定时任务表'; | ||
| 50 | - | ||
| 51 | -CREATE TABLE IF NOT EXISTS "inf_job_log" ( | ||
| 52 | - "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '日志编号', | ||
| 53 | - "job_id" bigint(20) NOT NULL COMMENT '任务编号', | ||
| 54 | - "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字', | ||
| 55 | - "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数', | ||
| 56 | - "execute_index" tinyint(4) NOT NULL DEFAULT '1' COMMENT '第几次执行', | ||
| 57 | - "begin_time" datetime NOT NULL COMMENT '开始执行时间', | ||
| 58 | - "end_time" datetime DEFAULT NULL COMMENT '结束执行时间', | ||
| 59 | - "duration" int(11) DEFAULT NULL COMMENT '执行时长', | ||
| 60 | - "status" tinyint(4) NOT NULL COMMENT '任务状态', | ||
| 61 | - "result" varchar(4000) DEFAULT '' COMMENT '结果数据', | ||
| 62 | - "creator" varchar(64) DEFAULT '' COMMENT '创建者', | ||
| 63 | - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 64 | - "updater" varchar(64) DEFAULT '' COMMENT '更新者', | ||
| 65 | - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 66 | - "deleted" bit(1) NOT NULL DEFAULT FALSE COMMENT '是否删除', | ||
| 67 | - PRIMARY KEY ("id") | ||
| 68 | -)COMMENT='定时任务日志表'; | ||
| 69 | 3 | ||
| 70 | CREATE TABLE IF NOT EXISTS "pay_merchant" | 4 | CREATE TABLE IF NOT EXISTS "pay_merchant" |
| 71 | ( | 5 | ( |
yudao-core-service/pom.xml
| @@ -40,10 +40,6 @@ | @@ -40,10 +40,6 @@ | ||
| 40 | <groupId>cn.iocoder.boot</groupId> | 40 | <groupId>cn.iocoder.boot</groupId> |
| 41 | <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | 41 | <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> |
| 42 | </dependency> | 42 | </dependency> |
| 43 | - <dependency> | ||
| 44 | - <groupId>cn.iocoder.boot</groupId> | ||
| 45 | - <artifactId>yudao-spring-boot-starter-biz-social</artifactId> | ||
| 46 | - </dependency> | ||
| 47 | 43 | ||
| 48 | <!-- Web 相关 --> | 44 | <!-- Web 相关 --> |
| 49 | <dependency> | 45 | <dependency> |
yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseDbAndRedisUnitTest.java deleted
| 1 | -package cn.iocoder.yudao.coreservice; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.coreservice.config.RedisTestConfiguration; | ||
| 4 | -import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; | ||
| 5 | -import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; | ||
| 6 | -import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; | ||
| 7 | -import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; | ||
| 8 | -import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; | ||
| 9 | -import org.redisson.spring.starter.RedissonAutoConfiguration; | ||
| 10 | -import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; | ||
| 11 | -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | ||
| 12 | -import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; | ||
| 13 | -import org.springframework.boot.test.context.SpringBootTest; | ||
| 14 | -import org.springframework.context.annotation.Import; | ||
| 15 | -import org.springframework.test.context.ActiveProfiles; | ||
| 16 | -import org.springframework.test.context.jdbc.Sql; | ||
| 17 | - | ||
| 18 | -/** | ||
| 19 | - * 依赖内存 DB + Redis 的单元测试 | ||
| 20 | - * | ||
| 21 | - * 相比 {@link BaseDbUnitTest} 来说,额外增加了内存 Redis | ||
| 22 | - * | ||
| 23 | - * @author 芋道源码 | ||
| 24 | - */ | ||
| 25 | -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbAndRedisUnitTest.Application.class) | ||
| 26 | -@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件 | ||
| 27 | -@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB | ||
| 28 | -public class BaseDbAndRedisUnitTest { | ||
| 29 | - | ||
| 30 | - @Import({ | ||
| 31 | - // DB 配置类 | ||
| 32 | - YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类 | ||
| 33 | - DataSourceAutoConfiguration.class, // Spring DB 自动配置类 | ||
| 34 | - DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类 | ||
| 35 | - DruidDataSourceAutoConfigure.class, // Druid 自动配置类 | ||
| 36 | - // MyBatis 配置类 | ||
| 37 | - YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类 | ||
| 38 | - MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类 | ||
| 39 | - // Redis 配置类 | ||
| 40 | - RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer | ||
| 41 | - RedisAutoConfiguration.class, // Spring Redis 自动配置类 | ||
| 42 | - YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类 | ||
| 43 | - RedissonAutoConfiguration.class, // Redisson 自动高配置类 | ||
| 44 | - }) | ||
| 45 | - public static class Application { | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | -} |
yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseDbUnitTest.java deleted
| 1 | -package cn.iocoder.yudao.coreservice; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; | ||
| 4 | -import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; | ||
| 5 | -import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; | ||
| 6 | -import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; | ||
| 7 | -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | ||
| 8 | -import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; | ||
| 9 | -import org.springframework.boot.test.context.SpringBootTest; | ||
| 10 | -import org.springframework.context.annotation.Import; | ||
| 11 | -import org.springframework.test.context.ActiveProfiles; | ||
| 12 | -import org.springframework.test.context.jdbc.Sql; | ||
| 13 | - | ||
| 14 | -/** | ||
| 15 | - * 依赖内存 DB 的单元测试 | ||
| 16 | - * | ||
| 17 | - * 注意,Service 层同样适用。对于 Service 层的单元测试,我们针对自己模块的 Mapper 走的是 H2 内存数据库,针对别的模块的 Service 走的是 Mock 方法 | ||
| 18 | - * | ||
| 19 | - * @author 芋道源码 | ||
| 20 | - */ | ||
| 21 | -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbUnitTest.Application.class) | ||
| 22 | -@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件 | ||
| 23 | -@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB | ||
| 24 | -public class BaseDbUnitTest { | ||
| 25 | - | ||
| 26 | - @Import({ | ||
| 27 | - // DB 配置类 | ||
| 28 | - YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类 | ||
| 29 | - DataSourceAutoConfiguration.class, // Spring DB 自动配置类 | ||
| 30 | - DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类 | ||
| 31 | - DruidDataSourceAutoConfigure.class, // Druid 自动配置类 | ||
| 32 | - // MyBatis 配置类 | ||
| 33 | - YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类 | ||
| 34 | - MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类 | ||
| 35 | - }) | ||
| 36 | - public static class Application { | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | -} |
yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseRedisUnitTest.java deleted
| 1 | -package cn.iocoder.yudao.coreservice; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.coreservice.config.RedisTestConfiguration; | ||
| 4 | -import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; | ||
| 5 | -import org.redisson.spring.starter.RedissonAutoConfiguration; | ||
| 6 | -import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; | ||
| 7 | -import org.springframework.boot.test.context.SpringBootTest; | ||
| 8 | -import org.springframework.context.annotation.Import; | ||
| 9 | -import org.springframework.test.context.ActiveProfiles; | ||
| 10 | - | ||
| 11 | -/** | ||
| 12 | - * 依赖内存 Redis 的单元测试 | ||
| 13 | - * | ||
| 14 | - * 相比 {@link BaseDbUnitTest} 来说,从内存 DB 改成了内存 Redis | ||
| 15 | - * | ||
| 16 | - * @author 芋道源码 | ||
| 17 | - */ | ||
| 18 | -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseRedisUnitTest.Application.class) | ||
| 19 | -@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件 | ||
| 20 | -public class BaseRedisUnitTest { | ||
| 21 | - | ||
| 22 | - @Import({ | ||
| 23 | - // Redis 配置类 | ||
| 24 | - RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer | ||
| 25 | - RedisAutoConfiguration.class, // Spring Redis 自动配置类 | ||
| 26 | - YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类 | ||
| 27 | - RedissonAutoConfiguration.class, // Redisson 自动高配置类 | ||
| 28 | - }) | ||
| 29 | - public static class Application { | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | -} |
yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/config/RedisTestConfiguration.java deleted
| 1 | -package cn.iocoder.yudao.coreservice.config; | ||
| 2 | - | ||
| 3 | -import com.github.fppt.jedismock.RedisServer; | ||
| 4 | -import org.springframework.boot.autoconfigure.data.redis.RedisProperties; | ||
| 5 | -import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| 6 | -import org.springframework.context.annotation.Bean; | ||
| 7 | -import org.springframework.context.annotation.Configuration; | ||
| 8 | -import org.springframework.context.annotation.Lazy; | ||
| 9 | - | ||
| 10 | -import java.io.IOException; | ||
| 11 | - | ||
| 12 | -@Configuration(proxyBeanMethods = false) | ||
| 13 | -@Lazy(false) // 禁止延迟加载 | ||
| 14 | -@EnableConfigurationProperties(RedisProperties.class) | ||
| 15 | -public class RedisTestConfiguration { | ||
| 16 | - | ||
| 17 | - /** | ||
| 18 | - * 创建模拟的 Redis Server 服务器 | ||
| 19 | - */ | ||
| 20 | - @Bean | ||
| 21 | - public RedisServer redisServer(RedisProperties properties) throws IOException { | ||
| 22 | - RedisServer redisServer = new RedisServer(properties.getPort()); | ||
| 23 | - // TODO 芋艿:一次执行多个单元测试时,貌似创建多个 spring 容器,导致不进行 stop。这样,就导致端口被占用,无法启动。。。 | ||
| 24 | - try { | ||
| 25 | - redisServer.start(); | ||
| 26 | - } catch (Exception ignore) {} | ||
| 27 | - return redisServer; | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | -} |
yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/InfApiAccessLogCoreServiceTest.java deleted
| 1 | -package cn.iocoder.yudao.coreservice.modules.infra.service.logger; | ||
| 2 | - | ||
| 3 | -import cn.hutool.core.util.RandomUtil; | ||
| 4 | -import cn.iocoder.yudao.coreservice.BaseDbUnitTest; | ||
| 5 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | ||
| 6 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiAccessLogCoreMapper; | ||
| 7 | -import cn.iocoder.yudao.coreservice.modules.infra.service.logger.impl.InfApiAccessLogCoreServiceImpl; | ||
| 8 | -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO; | ||
| 9 | -import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 10 | -import cn.iocoder.yudao.framework.test.core.util.RandomUtils; | ||
| 11 | -import org.junit.jupiter.api.Test; | ||
| 12 | -import org.springframework.context.annotation.Import; | ||
| 13 | - | ||
| 14 | -import javax.annotation.Resource; | ||
| 15 | - | ||
| 16 | -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | ||
| 17 | -import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * {@link InfApiAccessLogCoreServiceImpl} 单元测试 | ||
| 21 | - */ | ||
| 22 | -@Import(InfApiAccessLogCoreServiceImpl.class) | ||
| 23 | -public class InfApiAccessLogCoreServiceTest extends BaseDbUnitTest { | ||
| 24 | - | ||
| 25 | - @Resource | ||
| 26 | - private InfApiAccessLogCoreService apiAccessLogCoreService; | ||
| 27 | - | ||
| 28 | - @Resource | ||
| 29 | - private InfApiAccessLogCoreMapper apiAccessLogCoreMapper; | ||
| 30 | - | ||
| 31 | - @Test | ||
| 32 | - public void testCreateApiAccessLogAsync() { | ||
| 33 | - // 准备参数 | ||
| 34 | - ApiAccessLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiAccessLogCreateReqDTO.class, | ||
| 35 | - dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); | ||
| 36 | - | ||
| 37 | - // 调用 | ||
| 38 | - apiAccessLogCoreService.createApiAccessLogAsync(createDTO); | ||
| 39 | - // 断言 | ||
| 40 | - InfApiAccessLogDO infApiAccessLogDO = apiAccessLogCoreMapper.selectOne(null); | ||
| 41 | - assertNotNull(infApiAccessLogDO); | ||
| 42 | - assertPojoEquals(createDTO, infApiAccessLogDO); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | -} |
yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/InfApiErrorLogCoreServiceTest.java deleted
| 1 | -package cn.iocoder.yudao.coreservice.modules.infra.service.logger; | ||
| 2 | - | ||
| 3 | -import cn.hutool.core.util.RandomUtil; | ||
| 4 | -import cn.iocoder.yudao.coreservice.BaseDbUnitTest; | ||
| 5 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; | ||
| 6 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiErrorLogCoreMapper; | ||
| 7 | -import cn.iocoder.yudao.coreservice.modules.infra.service.logger.impl.InfApiErrorLogCoreServiceImpl; | ||
| 8 | -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO; | ||
| 9 | -import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | ||
| 10 | -import cn.iocoder.yudao.framework.test.core.util.RandomUtils; | ||
| 11 | -import org.junit.jupiter.api.Test; | ||
| 12 | -import org.springframework.context.annotation.Import; | ||
| 13 | - | ||
| 14 | -import javax.annotation.Resource; | ||
| 15 | - | ||
| 16 | -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | ||
| 17 | -import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * {@link InfApiErrorLogCoreServiceImpl} 单元测试 | ||
| 21 | - */ | ||
| 22 | -@Import(InfApiErrorLogCoreServiceImpl.class) | ||
| 23 | -public class InfApiErrorLogCoreServiceTest extends BaseDbUnitTest { | ||
| 24 | - | ||
| 25 | - @Resource | ||
| 26 | - private InfApiErrorLogCoreService apiErrorLogCoreService; | ||
| 27 | - | ||
| 28 | - @Resource | ||
| 29 | - private InfApiErrorLogCoreMapper infApiErrorLogCoreMapper; | ||
| 30 | - | ||
| 31 | - @Test | ||
| 32 | - public void testCreateApiErrorLogAsync() { | ||
| 33 | - // 准备参数 | ||
| 34 | - ApiErrorLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiErrorLogCreateReqDTO.class, | ||
| 35 | - dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); | ||
| 36 | - | ||
| 37 | - // 调用 | ||
| 38 | - apiErrorLogCoreService.createApiErrorLogAsync(createDTO); | ||
| 39 | - // 断言 | ||
| 40 | - InfApiErrorLogDO infApiErrorLogDO = infApiErrorLogCoreMapper.selectOne(null); | ||
| 41 | - assertNotNull(infApiErrorLogDO); | ||
| 42 | - assertPojoEquals(createDTO, infApiErrorLogDO); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | -} |
yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/package-info.java deleted
| 1 | -package cn.iocoder.yudao.coreservice.modules.infra.service; |
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/DBConfigRepository.java
| @@ -24,6 +24,7 @@ import java.util.List; | @@ -24,6 +24,7 @@ import java.util.List; | ||
| 24 | import java.util.Properties; | 24 | import java.util.Properties; |
| 25 | import java.util.concurrent.Executors; | 25 | import java.util.concurrent.Executors; |
| 26 | import java.util.concurrent.ScheduledExecutorService; | 26 | import java.util.concurrent.ScheduledExecutorService; |
| 27 | +import java.util.function.Predicate; | ||
| 27 | 28 | ||
| 28 | @Slf4j | 29 | @Slf4j |
| 29 | public class DBConfigRepository extends AbstractConfigRepository { | 30 | public class DBConfigRepository extends AbstractConfigRepository { |
| @@ -135,7 +136,7 @@ public class DBConfigRepository extends AbstractConfigRepository { | @@ -135,7 +136,7 @@ public class DBConfigRepository extends AbstractConfigRepository { | ||
| 135 | 136 | ||
| 136 | private Properties buildProperties(List<ConfigRespDTO> configs) { | 137 | private Properties buildProperties(List<ConfigRespDTO> configs) { |
| 137 | Properties properties = propertiesFactory.getPropertiesInstance(); | 138 | Properties properties = propertiesFactory.getPropertiesInstance(); |
| 138 | - configs.stream().filter(ConfigRespDTO::getDeleted) // 过滤掉被删除的配置 | 139 | + configs.stream().filter(config -> !config.getDeleted()) // 过滤掉被删除的配置 |
| 139 | .forEach(config -> properties.put(config.getKey(), config.getValue())); | 140 | .forEach(config -> properties.put(config.getKey(), config.getValue())); |
| 140 | return properties; | 141 | return properties; |
| 141 | } | 142 | } |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java
| @@ -16,7 +16,7 @@ import org.springframework.context.annotation.Configuration; | @@ -16,7 +16,7 @@ import org.springframework.context.annotation.Configuration; | ||
| 16 | */ | 16 | */ |
| 17 | @Configuration | 17 | @Configuration |
| 18 | @MapperScan(value = {"${yudao.info.base-package}", "${yudao.core-service.base-package}", | 18 | @MapperScan(value = {"${yudao.info.base-package}", "${yudao.core-service.base-package}", |
| 19 | - "${yudao.info.member-package}", "${yudao.info.system-package}"}, | 19 | + "${yudao.info.base-package2}"}, |
| 20 | annotationClass = Mapper.class, | 20 | annotationClass = Mapper.class, |
| 21 | lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试 | 21 | lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试 |
| 22 | public class YudaoMybatisAutoConfiguration { | 22 | public class YudaoMybatisAutoConfiguration { |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/WebProperties.java
| @@ -36,11 +36,9 @@ public class WebProperties { | @@ -36,11 +36,9 @@ public class WebProperties { | ||
| 36 | private String prefix; | 36 | private String prefix; |
| 37 | 37 | ||
| 38 | /** | 38 | /** |
| 39 | - * Controller 所在包 | 39 | + * Controller 所在包的 Ant 路径规则 |
| 40 | * | 40 | * |
| 41 | * 主要目的是,给该 Controller 设置指定的 {@link #prefix} | 41 | * 主要目的是,给该 Controller 设置指定的 {@link #prefix} |
| 42 | - * | ||
| 43 | - * 因为我们有多个 modules 包里会包含 Controller,所以只需要写到 cn.iocoder.yudao 这样的层级 | ||
| 44 | */ | 42 | */ |
| 45 | @NotEmpty(message = "Controller 所在包不能为空") | 43 | @NotEmpty(message = "Controller 所在包不能为空") |
| 46 | private String controller; | 44 | private String controller; |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/YudaoWebAutoConfiguration.java
| @@ -13,6 +13,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties | @@ -13,6 +13,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties | ||
| 13 | import org.springframework.boot.web.servlet.FilterRegistrationBean; | 13 | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| 14 | import org.springframework.context.annotation.Bean; | 14 | import org.springframework.context.annotation.Bean; |
| 15 | import org.springframework.context.annotation.Configuration; | 15 | import org.springframework.context.annotation.Configuration; |
| 16 | +import org.springframework.util.AntPathMatcher; | ||
| 16 | import org.springframework.util.PathMatcher; | 17 | import org.springframework.util.PathMatcher; |
| 17 | import org.springframework.web.bind.annotation.RestController; | 18 | import org.springframework.web.bind.annotation.RestController; |
| 18 | import org.springframework.web.cors.CorsConfiguration; | 19 | import org.springframework.web.cors.CorsConfiguration; |
| @@ -49,8 +50,9 @@ public class YudaoWebAutoConfiguration implements WebMvcConfigurer { | @@ -49,8 +50,9 @@ public class YudaoWebAutoConfiguration implements WebMvcConfigurer { | ||
| 49 | * @param api API 配置 | 50 | * @param api API 配置 |
| 50 | */ | 51 | */ |
| 51 | private void configurePathMatch(PathMatchConfigurer configurer, WebProperties.Api api) { | 52 | private void configurePathMatch(PathMatchConfigurer configurer, WebProperties.Api api) { |
| 53 | + AntPathMatcher antPathMatcher = new AntPathMatcher("."); | ||
| 52 | configurer.addPathPrefix(api.getPrefix(), clazz -> clazz.isAnnotationPresent(RestController.class) | 54 | configurer.addPathPrefix(api.getPrefix(), clazz -> clazz.isAnnotationPresent(RestController.class) |
| 53 | - && clazz.getPackage().getName().startsWith(api.getController())); // 仅仅匹配 controller 包 | 55 | + && antPathMatcher.match(api.getController(), clazz.getPackage().getName())); // 仅仅匹配 controller 包 |
| 54 | } | 56 | } |
| 55 | 57 | ||
| 56 | @Bean | 58 | @Bean |
yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.api.file; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.util.IdUtil; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 文件 API 接口 | ||
| 7 | + * | ||
| 8 | + * @author 芋道源码 | ||
| 9 | + */ | ||
| 10 | +public interface FileApi { | ||
| 11 | + | ||
| 12 | + /** | ||
| 13 | + * 保存文件,并返回文件的访问路径 | ||
| 14 | + * | ||
| 15 | + * @param content 文件内容 | ||
| 16 | + * @return 文件路径 | ||
| 17 | + */ | ||
| 18 | + default String createFile(byte[] content) { | ||
| 19 | + return createFile(IdUtil.fastUUID(), content); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 保存文件,并返回文件的访问路径 | ||
| 24 | + * | ||
| 25 | + * @param path 文件路径 | ||
| 26 | + * @param content 文件内容 | ||
| 27 | + * @return 文件路径 | ||
| 28 | + */ | ||
| 29 | + String createFile(String path, byte[] content); | ||
| 30 | + | ||
| 31 | +} |
yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/package-info.java
0 → 100644
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/DictTypeConstants.java renamed to yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/DictTypeConstants.java
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/InfErrorCodeConstants.java renamed to yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java
| @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; | @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; | ||
| 7 | * | 7 | * |
| 8 | * infra 系统,使用 1-001-000-000 段 | 8 | * infra 系统,使用 1-001-000-000 段 |
| 9 | */ | 9 | */ |
| 10 | -public interface InfErrorCodeConstants { | 10 | +public interface ErrorCodeConstants { |
| 11 | 11 | ||
| 12 | // ========== 参数配置 1001000000 ========== | 12 | // ========== 参数配置 1001000000 ========== |
| 13 | ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(1001000001, "参数配置不存在"); | 13 | ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(1001000001, "参数配置不存在"); |
| @@ -27,4 +27,8 @@ public interface InfErrorCodeConstants { | @@ -27,4 +27,8 @@ public interface InfErrorCodeConstants { | ||
| 27 | ErrorCode API_ERROR_LOG_NOT_FOUND = new ErrorCode(1001002000, "API 错误日志不存在"); | 27 | ErrorCode API_ERROR_LOG_NOT_FOUND = new ErrorCode(1001002000, "API 错误日志不存在"); |
| 28 | ErrorCode API_ERROR_LOG_PROCESSED = new ErrorCode(1001002001, "API 错误日志已处理"); | 28 | ErrorCode API_ERROR_LOG_PROCESSED = new ErrorCode(1001002001, "API 错误日志已处理"); |
| 29 | 29 | ||
| 30 | + // ========= 文件相关 1001003000================= | ||
| 31 | + ErrorCode FILE_PATH_EXISTS = new ErrorCode(1001003000, "文件路径已存在"); | ||
| 32 | + ErrorCode FILE_NOT_EXISTS = new ErrorCode(1001003001, "文件不存在"); | ||
| 33 | + | ||
| 30 | } | 34 | } |
yudao-module-infra/yudao-module-infra-impl/pom.xml
| @@ -23,19 +23,26 @@ | @@ -23,19 +23,26 @@ | ||
| 23 | <artifactId>yudao-module-member-api</artifactId> | 23 | <artifactId>yudao-module-member-api</artifactId> |
| 24 | <version>${revision}</version> | 24 | <version>${revision}</version> |
| 25 | </dependency> | 25 | </dependency> |
| 26 | - | ||
| 27 | <dependency> | 26 | <dependency> |
| 28 | <groupId>cn.iocoder.boot</groupId> | 27 | <groupId>cn.iocoder.boot</groupId> |
| 29 | <artifactId>yudao-module-system-api</artifactId> | 28 | <artifactId>yudao-module-system-api</artifactId> |
| 30 | <version>${revision}</version> | 29 | <version>${revision}</version> |
| 31 | </dependency> | 30 | </dependency> |
| 31 | + <dependency> | ||
| 32 | + <groupId>cn.iocoder.boot</groupId> | ||
| 33 | + <artifactId>yudao-module-infra-api</artifactId> | ||
| 34 | + <version>${revision}</version> | ||
| 35 | + </dependency> | ||
| 32 | 36 | ||
| 33 | <!-- 业务组件 --> | 37 | <!-- 业务组件 --> |
| 34 | - | ||
| 35 | <dependency> | 38 | <dependency> |
| 36 | <groupId>cn.iocoder.boot</groupId> | 39 | <groupId>cn.iocoder.boot</groupId> |
| 37 | <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> | 40 | <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> |
| 38 | </dependency> | 41 | </dependency> |
| 42 | + <dependency> | ||
| 43 | + <groupId>cn.iocoder.boot</groupId> | ||
| 44 | + <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | ||
| 45 | + </dependency> | ||
| 39 | 46 | ||
| 40 | <!-- Web 相关 --> | 47 | <!-- Web 相关 --> |
| 41 | <dependency> | 48 | <dependency> |
| @@ -54,6 +61,12 @@ | @@ -54,6 +61,12 @@ | ||
| 54 | <artifactId>yudao-spring-boot-starter-redis</artifactId> | 61 | <artifactId>yudao-spring-boot-starter-redis</artifactId> |
| 55 | </dependency> | 62 | </dependency> |
| 56 | 63 | ||
| 64 | + <!-- Config 配置中心相关 --> | ||
| 65 | + <dependency> | ||
| 66 | + <groupId>cn.iocoder.boot</groupId> | ||
| 67 | + <artifactId>yudao-spring-boot-starter-config</artifactId> | ||
| 68 | + </dependency> | ||
| 69 | + | ||
| 57 | <!-- 消息队列相关 --> | 70 | <!-- 消息队列相关 --> |
| 58 | <dependency> | 71 | <dependency> |
| 59 | <groupId>cn.iocoder.boot</groupId> | 72 | <groupId>cn.iocoder.boot</groupId> |
| @@ -73,6 +86,10 @@ | @@ -73,6 +86,10 @@ | ||
| 73 | <artifactId>yudao-spring-boot-starter-excel</artifactId> | 86 | <artifactId>yudao-spring-boot-starter-excel</artifactId> |
| 74 | </dependency> | 87 | </dependency> |
| 75 | 88 | ||
| 89 | + <dependency> | ||
| 90 | + <groupId>cn.smallbun.screw</groupId> | ||
| 91 | + <artifactId>screw-core</artifactId> <!-- 实现数据库文档 --> | ||
| 92 | + </dependency> | ||
| 76 | </dependencies> | 93 | </dependencies> |
| 77 | 94 | ||
| 78 | <build> | 95 | <build> |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.api.file; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.infra.api.file.FileApi; | ||
| 4 | +import cn.iocoder.yudao.module.infra.service.file.FileService; | ||
| 5 | +import org.springframework.stereotype.Service; | ||
| 6 | +import org.springframework.validation.annotation.Validated; | ||
| 7 | + | ||
| 8 | +import javax.annotation.Resource; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 文件 API 实现类 | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +@Service | ||
| 16 | +@Validated | ||
| 17 | +public class FileApiImpl implements FileApi { | ||
| 18 | + | ||
| 19 | + @Resource | ||
| 20 | + private FileService fileService; | ||
| 21 | + | ||
| 22 | + @Override | ||
| 23 | + public String createFile(String path, byte[] content) { | ||
| 24 | + return fileService.createFile(path, content); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | +} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/package-info.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.api; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java
| 1 | package cn.iocoder.yudao.module.infra.controller.admin.config; | 1 | package cn.iocoder.yudao.module.infra.controller.admin.config; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; | ||
| 4 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; | 3 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 6 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 8 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 7 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 9 | -import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.*; | ||
| 10 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.*; | 8 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.*; |
| 11 | -import cn.iocoder.yudao.module.infra.convert.config.InfConfigConvert; | ||
| 12 | -import cn.iocoder.yudao.module.infra.service.config.InfConfigService; | ||
| 13 | -import cn.iocoder.yudao.module.infra.controller.config.vo.*; | ||
| 14 | -import cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants; | 9 | +import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert; |
| 10 | +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; | ||
| 11 | +import cn.iocoder.yudao.module.infra.service.config.ConfigService; | ||
| 12 | +import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants; | ||
| 15 | import io.swagger.annotations.Api; | 13 | import io.swagger.annotations.Api; |
| 16 | import io.swagger.annotations.ApiImplicitParam; | 14 | import io.swagger.annotations.ApiImplicitParam; |
| 17 | import io.swagger.annotations.ApiOperation; | 15 | import io.swagger.annotations.ApiOperation; |
| @@ -25,18 +23,17 @@ import javax.validation.Valid; | @@ -25,18 +23,17 @@ import javax.validation.Valid; | ||
| 25 | import java.io.IOException; | 23 | import java.io.IOException; |
| 26 | import java.util.List; | 24 | import java.util.List; |
| 27 | 25 | ||
| 28 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 29 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 26 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 30 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | 27 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 31 | 28 | ||
| 32 | -@Api(tags = "参数配置") | 29 | +@Api(tags = "管理后台 - 参数配置") |
| 33 | @RestController | 30 | @RestController |
| 34 | @RequestMapping("/infra/config") | 31 | @RequestMapping("/infra/config") |
| 35 | @Validated | 32 | @Validated |
| 36 | public class ConfigController { | 33 | public class ConfigController { |
| 37 | 34 | ||
| 38 | @Resource | 35 | @Resource |
| 39 | - private InfConfigService configService; | 36 | + private ConfigService configService; |
| 40 | 37 | ||
| 41 | @PostMapping("/create") | 38 | @PostMapping("/create") |
| 42 | @ApiOperation("创建参数配置") | 39 | @ApiOperation("创建参数配置") |
| @@ -67,19 +64,19 @@ public class ConfigController { | @@ -67,19 +64,19 @@ public class ConfigController { | ||
| 67 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | 64 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 68 | @PreAuthorize("@ss.hasPermission('infra:config:query')") | 65 | @PreAuthorize("@ss.hasPermission('infra:config:query')") |
| 69 | public CommonResult<ConfigRespVO> getConfig(@RequestParam("id") Long id) { | 66 | public CommonResult<ConfigRespVO> getConfig(@RequestParam("id") Long id) { |
| 70 | - return success(InfConfigConvert.INSTANCE.convert(configService.getConfig(id))); | 67 | + return success(ConfigConvert.INSTANCE.convert(configService.getConfig(id))); |
| 71 | } | 68 | } |
| 72 | 69 | ||
| 73 | @GetMapping(value = "/get-value-by-key") | 70 | @GetMapping(value = "/get-value-by-key") |
| 74 | @ApiOperation(value = "根据参数键名查询参数值", notes = "敏感配置,不允许返回给前端") | 71 | @ApiOperation(value = "根据参数键名查询参数值", notes = "敏感配置,不允许返回给前端") |
| 75 | @ApiImplicitParam(name = "key", value = "参数键", required = true, example = "yunai.biz.username", dataTypeClass = String.class) | 72 | @ApiImplicitParam(name = "key", value = "参数键", required = true, example = "yunai.biz.username", dataTypeClass = String.class) |
| 76 | public CommonResult<String> getConfigKey(@RequestParam("key") String key) { | 73 | public CommonResult<String> getConfigKey(@RequestParam("key") String key) { |
| 77 | - InfConfigDO config = configService.getConfigByKey(key); | 74 | + ConfigDO config = configService.getConfigByKey(key); |
| 78 | if (config == null) { | 75 | if (config == null) { |
| 79 | return null; | 76 | return null; |
| 80 | } | 77 | } |
| 81 | if (config.getSensitive()) { | 78 | if (config.getSensitive()) { |
| 82 | - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_SENSITIVE); | 79 | + throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_SENSITIVE); |
| 83 | } | 80 | } |
| 84 | return success(config.getValue()); | 81 | return success(config.getValue()); |
| 85 | } | 82 | } |
| @@ -88,8 +85,8 @@ public class ConfigController { | @@ -88,8 +85,8 @@ public class ConfigController { | ||
| 88 | @ApiOperation("获取参数配置分页") | 85 | @ApiOperation("获取参数配置分页") |
| 89 | @PreAuthorize("@ss.hasPermission('infra:config:query')") | 86 | @PreAuthorize("@ss.hasPermission('infra:config:query')") |
| 90 | public CommonResult<PageResult<ConfigRespVO>> getConfigPage(@Valid ConfigPageReqVO reqVO) { | 87 | public CommonResult<PageResult<ConfigRespVO>> getConfigPage(@Valid ConfigPageReqVO reqVO) { |
| 91 | - PageResult<InfConfigDO> page = configService.getConfigPage(reqVO); | ||
| 92 | - return success(InfConfigConvert.INSTANCE.convertPage(page)); | 88 | + PageResult<ConfigDO> page = configService.getConfigPage(reqVO); |
| 89 | + return success(ConfigConvert.INSTANCE.convertPage(page)); | ||
| 93 | } | 90 | } |
| 94 | 91 | ||
| 95 | @GetMapping("/export") | 92 | @GetMapping("/export") |
| @@ -98,9 +95,9 @@ public class ConfigController { | @@ -98,9 +95,9 @@ public class ConfigController { | ||
| 98 | @OperateLog(type = EXPORT) | 95 | @OperateLog(type = EXPORT) |
| 99 | public void exportSysConfig(@Valid ConfigExportReqVO reqVO, | 96 | public void exportSysConfig(@Valid ConfigExportReqVO reqVO, |
| 100 | HttpServletResponse response) throws IOException { | 97 | HttpServletResponse response) throws IOException { |
| 101 | - List<InfConfigDO> list = configService.getConfigList(reqVO); | 98 | + List<ConfigDO> list = configService.getConfigList(reqVO); |
| 102 | // 拼接数据 | 99 | // 拼接数据 |
| 103 | - List<ConfigExcelVO> datas = InfConfigConvert.INSTANCE.convertList(list); | 100 | + List<ConfigExcelVO> datas = ConfigConvert.INSTANCE.convertList(list); |
| 104 | // 输出 | 101 | // 输出 |
| 105 | ExcelUtils.write(response, "参数配置.xls", "数据", ConfigExcelVO.class, datas); | 102 | ExcelUtils.write(response, "参数配置.xls", "数据", ConfigExcelVO.class, datas); |
| 106 | } | 103 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExportReqVO.java
| @@ -9,7 +9,7 @@ import java.util.Date; | @@ -9,7 +9,7 @@ import java.util.Date; | ||
| 9 | 9 | ||
| 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 11 | 11 | ||
| 12 | -@ApiModel("参数配置导出 Request VO") | 12 | +@ApiModel("管理后台 - 参数配置导出 Request VO") |
| 13 | @Data | 13 | @Data |
| 14 | public class ConfigExportReqVO { | 14 | public class ConfigExportReqVO { |
| 15 | 15 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java
| @@ -12,7 +12,7 @@ import java.util.Date; | @@ -12,7 +12,7 @@ import java.util.Date; | ||
| 12 | 12 | ||
| 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 14 | 14 | ||
| 15 | -@ApiModel("参数配置分页 Request VO") | 15 | +@ApiModel("管理后台 - 参数配置分页 Request VO") |
| 16 | @Data | 16 | @Data |
| 17 | @EqualsAndHashCode(callSuper = true) | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | @ToString(callSuper = true) | 18 | @ToString(callSuper = true) |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigRespVO.java
| @@ -9,7 +9,7 @@ import javax.validation.constraints.NotBlank; | @@ -9,7 +9,7 @@ import javax.validation.constraints.NotBlank; | ||
| 9 | import javax.validation.constraints.Size; | 9 | import javax.validation.constraints.Size; |
| 10 | import java.util.Date; | 10 | import java.util.Date; |
| 11 | 11 | ||
| 12 | -@ApiModel("参数配置信息 Response VO") | 12 | +@ApiModel("管理后台 - 参数配置信息 Response VO") |
| 13 | @Data | 13 | @Data |
| 14 | @EqualsAndHashCode(callSuper = true) | 14 | @EqualsAndHashCode(callSuper = true) |
| 15 | public class ConfigRespVO extends ConfigBaseVO { | 15 | public class ConfigRespVO extends ConfigBaseVO { |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigUpdateReqVO.java
| @@ -8,7 +8,7 @@ import lombok.ToString; | @@ -8,7 +8,7 @@ import lombok.ToString; | ||
| 8 | 8 | ||
| 9 | import javax.validation.constraints.NotNull; | 9 | import javax.validation.constraints.NotNull; |
| 10 | 10 | ||
| 11 | -@ApiModel("参数配置创建 Request VO") | 11 | +@ApiModel("管理后台 - 参数配置创建 Request VO") |
| 12 | @Data | 12 | @Data |
| 13 | @EqualsAndHashCode(callSuper = true) | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | @ToString(callSuper = true) | 14 | @ToString(callSuper = true) |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/doc/InfDbDocController.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/doc/DbDocController.java
| @@ -16,7 +16,6 @@ import com.zaxxer.hikari.HikariDataSource; | @@ -16,7 +16,6 @@ import com.zaxxer.hikari.HikariDataSource; | ||
| 16 | import io.swagger.annotations.Api; | 16 | import io.swagger.annotations.Api; |
| 17 | import io.swagger.annotations.ApiImplicitParam; | 17 | import io.swagger.annotations.ApiImplicitParam; |
| 18 | import io.swagger.annotations.ApiOperation; | 18 | import io.swagger.annotations.ApiOperation; |
| 19 | -import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; | ||
| 20 | import org.springframework.web.bind.annotation.GetMapping; | 19 | import org.springframework.web.bind.annotation.GetMapping; |
| 21 | import org.springframework.web.bind.annotation.RequestMapping; | 20 | import org.springframework.web.bind.annotation.RequestMapping; |
| 22 | import org.springframework.web.bind.annotation.RequestParam; | 21 | import org.springframework.web.bind.annotation.RequestParam; |
| @@ -28,10 +27,10 @@ import java.io.File; | @@ -28,10 +27,10 @@ import java.io.File; | ||
| 28 | import java.io.IOException; | 27 | import java.io.IOException; |
| 29 | import java.util.Collections; | 28 | import java.util.Collections; |
| 30 | 29 | ||
| 31 | -@Api(tags = "数据库文档") | 30 | +@Api(tags = "管理后台 - 数据库文档") |
| 32 | @RestController | 31 | @RestController |
| 33 | @RequestMapping("/infra/db-doc") | 32 | @RequestMapping("/infra/db-doc") |
| 34 | -public class InfDbDocController { | 33 | +public class DbDocController { |
| 35 | 34 | ||
| 36 | @Resource | 35 | @Resource |
| 37 | private DynamicDataSourceProperties dynamicDataSourceProperties; | 36 | private DynamicDataSourceProperties dynamicDataSourceProperties; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/InfFileController.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
| 1 | package cn.iocoder.yudao.module.infra.controller.admin.file; | 1 | package cn.iocoder.yudao.module.infra.controller.admin.file; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.io.IoUtil; | 3 | import cn.hutool.core.io.IoUtil; |
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.infra.service.file.InfFileService; | ||
| 6 | -import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFileRespVO; | ||
| 7 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; | ||
| 8 | -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; | ||
| 9 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 10 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 11 | -import cn.iocoder.yudao.module.infra.convert.file.InfFileConvert; | ||
| 12 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; | 6 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |
| 13 | import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; | 7 | import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; |
| 8 | +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FileRespVO; | ||
| 10 | +import cn.iocoder.yudao.module.infra.convert.file.FileConvert; | ||
| 11 | +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; | ||
| 12 | +import cn.iocoder.yudao.module.infra.service.file.FileService; | ||
| 14 | import io.swagger.annotations.Api; | 13 | import io.swagger.annotations.Api; |
| 15 | import io.swagger.annotations.ApiImplicitParam; | 14 | import io.swagger.annotations.ApiImplicitParam; |
| 16 | import io.swagger.annotations.ApiImplicitParams; | 15 | import io.swagger.annotations.ApiImplicitParams; |
| @@ -29,17 +28,15 @@ import java.io.IOException; | @@ -29,17 +28,15 @@ import java.io.IOException; | ||
| 29 | 28 | ||
| 30 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 29 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 31 | 30 | ||
| 32 | -@Api(tags = "文件存储") | 31 | +@Api(tags = "管理后台 - 文件存储") |
| 33 | @RestController | 32 | @RestController |
| 34 | @RequestMapping("/infra/file") | 33 | @RequestMapping("/infra/file") |
| 35 | @Validated | 34 | @Validated |
| 36 | @Slf4j | 35 | @Slf4j |
| 37 | -public class InfFileController { | 36 | +public class FileController { |
| 38 | 37 | ||
| 39 | @Resource | 38 | @Resource |
| 40 | - private InfFileService fileService; | ||
| 41 | - @Resource | ||
| 42 | - private InfFileCoreService fileCoreService; | 39 | + private FileService fileService; |
| 43 | 40 | ||
| 44 | @PostMapping("/upload") | 41 | @PostMapping("/upload") |
| 45 | @ApiOperation("上传文件") | 42 | @ApiOperation("上传文件") |
| @@ -49,7 +46,7 @@ public class InfFileController { | @@ -49,7 +46,7 @@ public class InfFileController { | ||
| 49 | }) | 46 | }) |
| 50 | public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file, | 47 | public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file, |
| 51 | @RequestParam("path") String path) throws IOException { | 48 | @RequestParam("path") String path) throws IOException { |
| 52 | - return success(fileCoreService.createFile(path, IoUtil.readBytes(file.getInputStream()))); | 49 | + return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream()))); |
| 53 | } | 50 | } |
| 54 | 51 | ||
| 55 | @DeleteMapping("/delete") | 52 | @DeleteMapping("/delete") |
| @@ -57,7 +54,7 @@ public class InfFileController { | @@ -57,7 +54,7 @@ public class InfFileController { | ||
| 57 | @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = String.class) | 54 | @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = String.class) |
| 58 | @PreAuthorize("@ss.hasPermission('infra:file:delete')") | 55 | @PreAuthorize("@ss.hasPermission('infra:file:delete')") |
| 59 | public CommonResult<Boolean> deleteFile(@RequestParam("id") String id) { | 56 | public CommonResult<Boolean> deleteFile(@RequestParam("id") String id) { |
| 60 | - fileCoreService.deleteFile(id); | 57 | + fileService.deleteFile(id); |
| 61 | return success(true); | 58 | return success(true); |
| 62 | } | 59 | } |
| 63 | 60 | ||
| @@ -66,7 +63,7 @@ public class InfFileController { | @@ -66,7 +63,7 @@ public class InfFileController { | ||
| 66 | @ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class) | 63 | @ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class) |
| 67 | public void getFile(HttpServletResponse response, @PathVariable("path") String path) throws IOException { | 64 | public void getFile(HttpServletResponse response, @PathVariable("path") String path) throws IOException { |
| 68 | TenantContextHolder.setNullTenantId(); | 65 | TenantContextHolder.setNullTenantId(); |
| 69 | - InfFileDO file = fileCoreService.getFile(path); | 66 | + FileDO file = fileService.getFile(path); |
| 70 | if (file == null) { | 67 | if (file == null) { |
| 71 | log.warn("[getFile][path({}) 文件不存在]", path); | 68 | log.warn("[getFile][path({}) 文件不存在]", path); |
| 72 | response.setStatus(HttpStatus.NOT_FOUND.value()); | 69 | response.setStatus(HttpStatus.NOT_FOUND.value()); |
| @@ -78,9 +75,9 @@ public class InfFileController { | @@ -78,9 +75,9 @@ public class InfFileController { | ||
| 78 | @GetMapping("/page") | 75 | @GetMapping("/page") |
| 79 | @ApiOperation("获得文件分页") | 76 | @ApiOperation("获得文件分页") |
| 80 | @PreAuthorize("@ss.hasPermission('infra:file:query')") | 77 | @PreAuthorize("@ss.hasPermission('infra:file:query')") |
| 81 | - public CommonResult<PageResult<InfFileRespVO>> getFilePage(@Valid InfFilePageReqVO pageVO) { | ||
| 82 | - PageResult<InfFileDO> pageResult = fileService.getFilePage(pageVO); | ||
| 83 | - return success(InfFileConvert.INSTANCE.convertPage(pageResult)); | 78 | + public CommonResult<PageResult<FileRespVO>> getFilePage(@Valid FilePageReqVO pageVO) { |
| 79 | + PageResult<FileDO> pageResult = fileService.getFilePage(pageVO); | ||
| 80 | + return success(FileConvert.INSTANCE.convertPage(pageResult)); | ||
| 84 | } | 81 | } |
| 85 | 82 | ||
| 86 | } | 83 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/InfFilePageReqVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/FilePageReqVO.java
| @@ -12,11 +12,11 @@ import java.util.Date; | @@ -12,11 +12,11 @@ import java.util.Date; | ||
| 12 | 12 | ||
| 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 14 | 14 | ||
| 15 | -@ApiModel("文件分页 Request VO") | 15 | +@ApiModel("管理后台 - 文件分页 Request VO") |
| 16 | @Data | 16 | @Data |
| 17 | @EqualsAndHashCode(callSuper = true) | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | @ToString(callSuper = true) | 18 | @ToString(callSuper = true) |
| 19 | -public class InfFilePageReqVO extends PageParam { | 19 | +public class FilePageReqVO extends PageParam { |
| 20 | 20 | ||
| 21 | @ApiModelProperty(value = "文件路径", example = "yudao", notes = "模糊匹配") | 21 | @ApiModelProperty(value = "文件路径", example = "yudao", notes = "模糊匹配") |
| 22 | private String id; | 22 | private String id; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/vo/InfFileRespVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/FileRespVO.java
| 1 | -package cn.iocoder.yudao.module.infra.vo; | 1 | +package cn.iocoder.yudao.module.infra.controller.admin.file.vo; |
| 2 | 2 | ||
| 3 | import io.swagger.annotations.ApiModel; | 3 | import io.swagger.annotations.ApiModel; |
| 4 | import io.swagger.annotations.ApiModelProperty; | 4 | import io.swagger.annotations.ApiModelProperty; |
| @@ -6,9 +6,9 @@ import lombok.Data; | @@ -6,9 +6,9 @@ import lombok.Data; | ||
| 6 | 6 | ||
| 7 | import java.util.Date; | 7 | import java.util.Date; |
| 8 | 8 | ||
| 9 | -@ApiModel(value = "文件 Response VO", description = "不返回 content 字段,太大") | 9 | +@ApiModel(value = "管理后台 - 文件 Response VO", description = "不返回 content 字段,太大") |
| 10 | @Data | 10 | @Data |
| 11 | -public class InfFileRespVO { | 11 | +public class FileRespVO { |
| 12 | 12 | ||
| 13 | @ApiModelProperty(value = "文件路径", required = true, example = "yudao.jpg") | 13 | @ApiModelProperty(value = "文件路径", required = true, example = "yudao.jpg") |
| 14 | private String id; | 14 | private String id; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/InfJobController.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java
| @@ -5,12 +5,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -5,12 +5,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 7 | import cn.iocoder.yudao.framework.quartz.core.util.CronUtils; | 7 | import cn.iocoder.yudao.framework.quartz.core.util.CronUtils; |
| 8 | -import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*; | ||
| 9 | import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.*; | 8 | import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.*; |
| 10 | -import cn.iocoder.yudao.module.infra.convert.job.InfJobConvert; | ||
| 11 | -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO; | ||
| 12 | -import cn.iocoder.yudao.module.infra.service.job.InfJobService; | ||
| 13 | -import cn.iocoder.yudao.module.infra.controller.job.vo.job.*; | 9 | +import cn.iocoder.yudao.module.infra.convert.job.JobConvert; |
| 10 | +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; | ||
| 11 | +import cn.iocoder.yudao.module.infra.service.job.JobService; | ||
| 14 | import io.swagger.annotations.Api; | 12 | import io.swagger.annotations.Api; |
| 15 | import io.swagger.annotations.ApiImplicitParam; | 13 | import io.swagger.annotations.ApiImplicitParam; |
| 16 | import io.swagger.annotations.ApiImplicitParams; | 14 | import io.swagger.annotations.ApiImplicitParams; |
| @@ -32,19 +30,19 @@ import java.util.List; | @@ -32,19 +30,19 @@ import java.util.List; | ||
| 32 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 30 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 33 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | 31 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 34 | 32 | ||
| 35 | -@Api(tags = "定时任务") | 33 | +@Api(tags = "管理后台 - 定时任务") |
| 36 | @RestController | 34 | @RestController |
| 37 | @RequestMapping("/infra/job") | 35 | @RequestMapping("/infra/job") |
| 38 | @Validated | 36 | @Validated |
| 39 | -public class InfJobController { | 37 | +public class JobController { |
| 40 | 38 | ||
| 41 | @Resource | 39 | @Resource |
| 42 | - private InfJobService jobService; | 40 | + private JobService jobService; |
| 43 | 41 | ||
| 44 | @PostMapping("/create") | 42 | @PostMapping("/create") |
| 45 | @ApiOperation("创建定时任务") | 43 | @ApiOperation("创建定时任务") |
| 46 | @PreAuthorize("@ss.hasPermission('infra:job:create')") | 44 | @PreAuthorize("@ss.hasPermission('infra:job:create')") |
| 47 | - public CommonResult<Long> createJob(@Valid @RequestBody InfJobCreateReqVO createReqVO) | 45 | + public CommonResult<Long> createJob(@Valid @RequestBody JobCreateReqVO createReqVO) |
| 48 | throws SchedulerException { | 46 | throws SchedulerException { |
| 49 | return success(jobService.createJob(createReqVO)); | 47 | return success(jobService.createJob(createReqVO)); |
| 50 | } | 48 | } |
| @@ -52,7 +50,7 @@ public class InfJobController { | @@ -52,7 +50,7 @@ public class InfJobController { | ||
| 52 | @PutMapping("/update") | 50 | @PutMapping("/update") |
| 53 | @ApiOperation("更新定时任务") | 51 | @ApiOperation("更新定时任务") |
| 54 | @PreAuthorize("@ss.hasPermission('infra:job:update')") | 52 | @PreAuthorize("@ss.hasPermission('infra:job:update')") |
| 55 | - public CommonResult<Boolean> updateJob(@Valid @RequestBody InfJobUpdateReqVO updateReqVO) | 53 | + public CommonResult<Boolean> updateJob(@Valid @RequestBody JobUpdateReqVO updateReqVO) |
| 56 | throws SchedulerException { | 54 | throws SchedulerException { |
| 57 | jobService.updateJob(updateReqVO); | 55 | jobService.updateJob(updateReqVO); |
| 58 | return success(true); | 56 | return success(true); |
| @@ -94,38 +92,38 @@ public class InfJobController { | @@ -94,38 +92,38 @@ public class InfJobController { | ||
| 94 | @ApiOperation("获得定时任务") | 92 | @ApiOperation("获得定时任务") |
| 95 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | 93 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 96 | @PreAuthorize("@ss.hasPermission('infra:job:query')") | 94 | @PreAuthorize("@ss.hasPermission('infra:job:query')") |
| 97 | - public CommonResult<InfJobRespVO> getJob(@RequestParam("id") Long id) { | ||
| 98 | - InfJobDO job = jobService.getJob(id); | ||
| 99 | - return success(InfJobConvert.INSTANCE.convert(job)); | 95 | + public CommonResult<JobRespVO> getJob(@RequestParam("id") Long id) { |
| 96 | + JobDO job = jobService.getJob(id); | ||
| 97 | + return success(JobConvert.INSTANCE.convert(job)); | ||
| 100 | } | 98 | } |
| 101 | 99 | ||
| 102 | @GetMapping("/list") | 100 | @GetMapping("/list") |
| 103 | @ApiOperation("获得定时任务列表") | 101 | @ApiOperation("获得定时任务列表") |
| 104 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, dataTypeClass = List.class) | 102 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, dataTypeClass = List.class) |
| 105 | @PreAuthorize("@ss.hasPermission('infra:job:query')") | 103 | @PreAuthorize("@ss.hasPermission('infra:job:query')") |
| 106 | - public CommonResult<List<InfJobRespVO>> getJobList(@RequestParam("ids") Collection<Long> ids) { | ||
| 107 | - List<InfJobDO> list = jobService.getJobList(ids); | ||
| 108 | - return success(InfJobConvert.INSTANCE.convertList(list)); | 104 | + public CommonResult<List<JobRespVO>> getJobList(@RequestParam("ids") Collection<Long> ids) { |
| 105 | + List<JobDO> list = jobService.getJobList(ids); | ||
| 106 | + return success(JobConvert.INSTANCE.convertList(list)); | ||
| 109 | } | 107 | } |
| 110 | 108 | ||
| 111 | @GetMapping("/page") | 109 | @GetMapping("/page") |
| 112 | @ApiOperation("获得定时任务分页") | 110 | @ApiOperation("获得定时任务分页") |
| 113 | @PreAuthorize("@ss.hasPermission('infra:job:query')") | 111 | @PreAuthorize("@ss.hasPermission('infra:job:query')") |
| 114 | - public CommonResult<PageResult<InfJobRespVO>> getJobPage(@Valid InfJobPageReqVO pageVO) { | ||
| 115 | - PageResult<InfJobDO> pageResult = jobService.getJobPage(pageVO); | ||
| 116 | - return success(InfJobConvert.INSTANCE.convertPage(pageResult)); | 112 | + public CommonResult<PageResult<JobRespVO>> getJobPage(@Valid JobPageReqVO pageVO) { |
| 113 | + PageResult<JobDO> pageResult = jobService.getJobPage(pageVO); | ||
| 114 | + return success(JobConvert.INSTANCE.convertPage(pageResult)); | ||
| 117 | } | 115 | } |
| 118 | 116 | ||
| 119 | @GetMapping("/export-excel") | 117 | @GetMapping("/export-excel") |
| 120 | @ApiOperation("导出定时任务 Excel") | 118 | @ApiOperation("导出定时任务 Excel") |
| 121 | @PreAuthorize("@ss.hasPermission('infra:job:export')") | 119 | @PreAuthorize("@ss.hasPermission('infra:job:export')") |
| 122 | @OperateLog(type = EXPORT) | 120 | @OperateLog(type = EXPORT) |
| 123 | - public void exportJobExcel(@Valid InfJobExportReqVO exportReqVO, | 121 | + public void exportJobExcel(@Valid JobExportReqVO exportReqVO, |
| 124 | HttpServletResponse response) throws IOException { | 122 | HttpServletResponse response) throws IOException { |
| 125 | - List<InfJobDO> list = jobService.getJobList(exportReqVO); | 123 | + List<JobDO> list = jobService.getJobList(exportReqVO); |
| 126 | // 导出 Excel | 124 | // 导出 Excel |
| 127 | - List<InfJobExcelVO> datas = InfJobConvert.INSTANCE.convertList02(list); | ||
| 128 | - ExcelUtils.write(response, "定时任务.xls", "数据", InfJobExcelVO.class, datas); | 125 | + List<JobExcelVO> datas = JobConvert.INSTANCE.convertList02(list); |
| 126 | + ExcelUtils.write(response, "定时任务.xls", "数据", JobExcelVO.class, datas); | ||
| 129 | } | 127 | } |
| 130 | 128 | ||
| 131 | @GetMapping("/get_next_times") | 129 | @GetMapping("/get_next_times") |
| @@ -137,7 +135,7 @@ public class InfJobController { | @@ -137,7 +135,7 @@ public class InfJobController { | ||
| 137 | @PreAuthorize("@ss.hasPermission('infra:job:query')") | 135 | @PreAuthorize("@ss.hasPermission('infra:job:query')") |
| 138 | public CommonResult<List<Date>> getJobNextTimes(@RequestParam("id") Long id, | 136 | public CommonResult<List<Date>> getJobNextTimes(@RequestParam("id") Long id, |
| 139 | @RequestParam(value = "count", required = false, defaultValue = "5") Integer count) { | 137 | @RequestParam(value = "count", required = false, defaultValue = "5") Integer count) { |
| 140 | - InfJobDO job = jobService.getJob(id); | 138 | + JobDO job = jobService.getJob(id); |
| 141 | if (job == null) { | 139 | if (job == null) { |
| 142 | return success(Collections.emptyList()); | 140 | return success(Collections.emptyList()); |
| 143 | } | 141 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/InfJobLogController.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobLogController.java
| @@ -4,13 +4,13 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; | @@ -4,13 +4,13 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 7 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExcelVO; | ||
| 8 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO; | ||
| 9 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO; | ||
| 10 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogRespVO; | ||
| 11 | -import cn.iocoder.yudao.module.infra.convert.job.InfJobLogConvert; | ||
| 12 | -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO; | ||
| 13 | -import cn.iocoder.yudao.module.infra.service.job.InfJobLogService; | 7 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExcelVO; |
| 8 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.infra.convert.job.JobLogConvert; | ||
| 12 | +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; | ||
| 13 | +import cn.iocoder.yudao.module.infra.service.job.JobLogService; | ||
| 14 | import io.swagger.annotations.Api; | 14 | import io.swagger.annotations.Api; |
| 15 | import io.swagger.annotations.ApiImplicitParam; | 15 | import io.swagger.annotations.ApiImplicitParam; |
| 16 | import io.swagger.annotations.ApiOperation; | 16 | import io.swagger.annotations.ApiOperation; |
| @@ -31,51 +31,51 @@ import java.util.List; | @@ -31,51 +31,51 @@ import java.util.List; | ||
| 31 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 31 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 32 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | 32 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 33 | 33 | ||
| 34 | -@Api(tags = "定时任务日志") | 34 | +@Api(tags = "管理后台 - 定时任务日志") |
| 35 | @RestController | 35 | @RestController |
| 36 | @RequestMapping("/infra/job-log") | 36 | @RequestMapping("/infra/job-log") |
| 37 | @Validated | 37 | @Validated |
| 38 | -public class InfJobLogController { | 38 | +public class JobLogController { |
| 39 | 39 | ||
| 40 | @Resource | 40 | @Resource |
| 41 | - private InfJobLogService jobLogService; | 41 | + private JobLogService jobLogService; |
| 42 | 42 | ||
| 43 | @GetMapping("/get") | 43 | @GetMapping("/get") |
| 44 | @ApiOperation("获得定时任务日志") | 44 | @ApiOperation("获得定时任务日志") |
| 45 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | 45 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 46 | @PreAuthorize("@ss.hasPermission('infra:job:query')") | 46 | @PreAuthorize("@ss.hasPermission('infra:job:query')") |
| 47 | - public CommonResult<InfJobLogRespVO> getJobLog(@RequestParam("id") Long id) { | ||
| 48 | - InfJobLogDO jobLog = jobLogService.getJobLog(id); | ||
| 49 | - return success(InfJobLogConvert.INSTANCE.convert(jobLog)); | 47 | + public CommonResult<JobLogRespVO> getJobLog(@RequestParam("id") Long id) { |
| 48 | + JobLogDO jobLog = jobLogService.getJobLog(id); | ||
| 49 | + return success(JobLogConvert.INSTANCE.convert(jobLog)); | ||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | @GetMapping("/list") | 52 | @GetMapping("/list") |
| 53 | @ApiOperation("获得定时任务日志列表") | 53 | @ApiOperation("获得定时任务日志列表") |
| 54 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) | 54 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) |
| 55 | @PreAuthorize("@ss.hasPermission('infra:job:query')") | 55 | @PreAuthorize("@ss.hasPermission('infra:job:query')") |
| 56 | - public CommonResult<List<InfJobLogRespVO>> getJobLogList(@RequestParam("ids") Collection<Long> ids) { | ||
| 57 | - List<InfJobLogDO> list = jobLogService.getJobLogList(ids); | ||
| 58 | - return success(InfJobLogConvert.INSTANCE.convertList(list)); | 56 | + public CommonResult<List<JobLogRespVO>> getJobLogList(@RequestParam("ids") Collection<Long> ids) { |
| 57 | + List<JobLogDO> list = jobLogService.getJobLogList(ids); | ||
| 58 | + return success(JobLogConvert.INSTANCE.convertList(list)); | ||
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | @GetMapping("/page") | 61 | @GetMapping("/page") |
| 62 | @ApiOperation("获得定时任务日志分页") | 62 | @ApiOperation("获得定时任务日志分页") |
| 63 | @PreAuthorize("@ss.hasPermission('infra:job:query')") | 63 | @PreAuthorize("@ss.hasPermission('infra:job:query')") |
| 64 | - public CommonResult<PageResult<InfJobLogRespVO>> getJobLogPage(@Valid InfJobLogPageReqVO pageVO) { | ||
| 65 | - PageResult<InfJobLogDO> pageResult = jobLogService.getJobLogPage(pageVO); | ||
| 66 | - return success(InfJobLogConvert.INSTANCE.convertPage(pageResult)); | 64 | + public CommonResult<PageResult<JobLogRespVO>> getJobLogPage(@Valid JobLogPageReqVO pageVO) { |
| 65 | + PageResult<JobLogDO> pageResult = jobLogService.getJobLogPage(pageVO); | ||
| 66 | + return success(JobLogConvert.INSTANCE.convertPage(pageResult)); | ||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | @GetMapping("/export-excel") | 69 | @GetMapping("/export-excel") |
| 70 | @ApiOperation("导出定时任务日志 Excel") | 70 | @ApiOperation("导出定时任务日志 Excel") |
| 71 | @PreAuthorize("@ss.hasPermission('infra:job:export')") | 71 | @PreAuthorize("@ss.hasPermission('infra:job:export')") |
| 72 | @OperateLog(type = EXPORT) | 72 | @OperateLog(type = EXPORT) |
| 73 | - public void exportJobLogExcel(@Valid InfJobLogExportReqVO exportReqVO, | 73 | + public void exportJobLogExcel(@Valid JobLogExportReqVO exportReqVO, |
| 74 | HttpServletResponse response) throws IOException { | 74 | HttpServletResponse response) throws IOException { |
| 75 | - List<InfJobLogDO> list = jobLogService.getJobLogList(exportReqVO); | 75 | + List<JobLogDO> list = jobLogService.getJobLogList(exportReqVO); |
| 76 | // 导出 Excel | 76 | // 导出 Excel |
| 77 | - List<InfJobLogExcelVO> datas = InfJobLogConvert.INSTANCE.convertList02(list); | ||
| 78 | - ExcelUtils.write(response, "任务日志.xls", "数据", InfJobLogExcelVO.class, datas); | 77 | + List<JobLogExcelVO> datas = JobLogConvert.INSTANCE.convertList02(list); |
| 78 | + ExcelUtils.write(response, "任务日志.xls", "数据", JobLogExcelVO.class, datas); | ||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | } | 81 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobBaseVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobBaseVO.java
| @@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull; | @@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull; | ||
| 10 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | 10 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 11 | */ | 11 | */ |
| 12 | @Data | 12 | @Data |
| 13 | -public class InfJobBaseVO { | 13 | +public class JobBaseVO { |
| 14 | 14 | ||
| 15 | @ApiModelProperty(value = "任务名称", required = true, example = "测试任务") | 15 | @ApiModelProperty(value = "任务名称", required = true, example = "测试任务") |
| 16 | @NotNull(message = "任务名称不能为空") | 16 | @NotNull(message = "任务名称不能为空") |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobCreateReqVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobCreateReqVO.java
| @@ -8,11 +8,11 @@ import lombok.ToString; | @@ -8,11 +8,11 @@ import lombok.ToString; | ||
| 8 | 8 | ||
| 9 | import javax.validation.constraints.NotNull; | 9 | import javax.validation.constraints.NotNull; |
| 10 | 10 | ||
| 11 | -@ApiModel("定时任务创建 Request VO") | 11 | +@ApiModel("管理后台 - 定时任务创建 Request VO") |
| 12 | @Data | 12 | @Data |
| 13 | @EqualsAndHashCode(callSuper = true) | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | @ToString(callSuper = true) | 14 | @ToString(callSuper = true) |
| 15 | -public class InfJobCreateReqVO extends InfJobBaseVO { | 15 | +public class JobCreateReqVO extends JobBaseVO { |
| 16 | 16 | ||
| 17 | @ApiModelProperty(value = "处理器的名字", required = true, example = "sysUserSessionTimeoutJob") | 17 | @ApiModelProperty(value = "处理器的名字", required = true, example = "sysUserSessionTimeoutJob") |
| 18 | @NotNull(message = "处理器的名字不能为空") | 18 | @NotNull(message = "处理器的名字不能为空") |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobExcelVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExcelVO.java
| @@ -14,7 +14,7 @@ import java.util.Date; | @@ -14,7 +14,7 @@ import java.util.Date; | ||
| 14 | * @author 芋道源码 | 14 | * @author 芋道源码 |
| 15 | */ | 15 | */ |
| 16 | @Data | 16 | @Data |
| 17 | -public class InfJobExcelVO { | 17 | +public class JobExcelVO { |
| 18 | 18 | ||
| 19 | @ExcelProperty("任务编号") | 19 | @ExcelProperty("任务编号") |
| 20 | private Long id; | 20 | private Long id; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobExportReqVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExportReqVO.java
| @@ -4,17 +4,17 @@ import io.swagger.annotations.ApiModel; | @@ -4,17 +4,17 @@ import io.swagger.annotations.ApiModel; | ||
| 4 | import io.swagger.annotations.ApiModelProperty; | 4 | import io.swagger.annotations.ApiModelProperty; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | 6 | ||
| 7 | -@ApiModel(value = "定时任务 Excel 导出 Request VO", description = "参数和 InfJobPageReqVO 是一致的") | 7 | +@ApiModel(value = "管理后台 - 定时任务 Excel 导出 Request VO", description = "参数和 InfJobPageReqVO 是一致的") |
| 8 | @Data | 8 | @Data |
| 9 | -public class InfJobExportReqVO { | 9 | +public class JobExportReqVO { |
| 10 | 10 | ||
| 11 | @ApiModelProperty(value = "任务名称", example = "测试任务", notes = "模糊匹配") | 11 | @ApiModelProperty(value = "任务名称", example = "测试任务", notes = "模糊匹配") |
| 12 | private String name; | 12 | private String name; |
| 13 | 13 | ||
| 14 | - @ApiModelProperty(value = "任务状态", example = "1", notes = "参见 InfJobStatusEnum 枚举") | 14 | + @ApiModelProperty(value = "任务状态", example = "1", notes = "参见 JobStatusEnum 枚举") |
| 15 | private Integer status; | 15 | private Integer status; |
| 16 | 16 | ||
| 17 | - @ApiModelProperty(value = "处理器的名字", example = "sysUserSessionTimeoutJob", notes = "模糊匹配") | 17 | + @ApiModelProperty(value = "处理器的名字", example = "UserSessionTimeoutJob", notes = "模糊匹配") |
| 18 | private String handlerName; | 18 | private String handlerName; |
| 19 | 19 | ||
| 20 | } | 20 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobPageReqVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobPageReqVO.java
| @@ -7,11 +7,11 @@ import lombok.Data; | @@ -7,11 +7,11 @@ import lombok.Data; | ||
| 7 | import lombok.EqualsAndHashCode; | 7 | import lombok.EqualsAndHashCode; |
| 8 | import lombok.ToString; | 8 | import lombok.ToString; |
| 9 | 9 | ||
| 10 | -@ApiModel("定时任务分页 Request VO") | 10 | +@ApiModel("管理后台 - 定时任务分页 Request VO") |
| 11 | @Data | 11 | @Data |
| 12 | @EqualsAndHashCode(callSuper = true) | 12 | @EqualsAndHashCode(callSuper = true) |
| 13 | @ToString(callSuper = true) | 13 | @ToString(callSuper = true) |
| 14 | -public class InfJobPageReqVO extends PageParam { | 14 | +public class JobPageReqVO extends PageParam { |
| 15 | 15 | ||
| 16 | @ApiModelProperty(value = "任务名称", example = "测试任务", notes = "模糊匹配") | 16 | @ApiModelProperty(value = "任务名称", example = "测试任务", notes = "模糊匹配") |
| 17 | private String name; | 17 | private String name; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobRespVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java
| @@ -9,11 +9,11 @@ import lombok.ToString; | @@ -9,11 +9,11 @@ import lombok.ToString; | ||
| 9 | import javax.validation.constraints.NotNull; | 9 | import javax.validation.constraints.NotNull; |
| 10 | import java.util.Date; | 10 | import java.util.Date; |
| 11 | 11 | ||
| 12 | -@ApiModel("定时任务 Response VO") | 12 | +@ApiModel("管理后台 - 定时任务 Response VO") |
| 13 | @Data | 13 | @Data |
| 14 | @EqualsAndHashCode(callSuper = true) | 14 | @EqualsAndHashCode(callSuper = true) |
| 15 | @ToString(callSuper = true) | 15 | @ToString(callSuper = true) |
| 16 | -public class InfJobRespVO extends InfJobBaseVO { | 16 | +public class JobRespVO extends JobBaseVO { |
| 17 | 17 | ||
| 18 | @ApiModelProperty(value = "任务编号", required = true, example = "1024") | 18 | @ApiModelProperty(value = "任务编号", required = true, example = "1024") |
| 19 | private Long id; | 19 | private Long id; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobUpdateReqVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobUpdateReqVO.java
| @@ -8,11 +8,11 @@ import lombok.ToString; | @@ -8,11 +8,11 @@ import lombok.ToString; | ||
| 8 | 8 | ||
| 9 | import javax.validation.constraints.NotNull; | 9 | import javax.validation.constraints.NotNull; |
| 10 | 10 | ||
| 11 | -@ApiModel("定时任务更新 Request VO") | 11 | +@ApiModel("管理后台 - 定时任务更新 Request VO") |
| 12 | @Data | 12 | @Data |
| 13 | @EqualsAndHashCode(callSuper = true) | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | @ToString(callSuper = true) | 14 | @ToString(callSuper = true) |
| 15 | -public class InfJobUpdateReqVO extends InfJobBaseVO { | 15 | +public class JobUpdateReqVO extends JobBaseVO { |
| 16 | 16 | ||
| 17 | @ApiModelProperty(value = "任务编号", required = true, example = "1024") | 17 | @ApiModelProperty(value = "任务编号", required = true, example = "1024") |
| 18 | @NotNull(message = "任务编号不能为空") | 18 | @NotNull(message = "任务编号不能为空") |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogBaseVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogBaseVO.java
| @@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 14 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | 14 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 15 | */ | 15 | */ |
| 16 | @Data | 16 | @Data |
| 17 | -public class InfJobLogBaseVO { | 17 | +public class JobLogBaseVO { |
| 18 | 18 | ||
| 19 | @ApiModelProperty(value = "任务编号", required = true, example = "1024") | 19 | @ApiModelProperty(value = "任务编号", required = true, example = "1024") |
| 20 | @NotNull(message = "任务编号不能为空") | 20 | @NotNull(message = "任务编号不能为空") |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogExcelVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExcelVO.java
| @@ -14,7 +14,7 @@ import java.util.Date; | @@ -14,7 +14,7 @@ import java.util.Date; | ||
| 14 | * @author 芋艿 | 14 | * @author 芋艿 |
| 15 | */ | 15 | */ |
| 16 | @Data | 16 | @Data |
| 17 | -public class InfJobLogExcelVO { | 17 | +public class JobLogExcelVO { |
| 18 | 18 | ||
| 19 | @ExcelProperty("日志编号") | 19 | @ExcelProperty("日志编号") |
| 20 | private Long id; | 20 | private Long id; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogExportReqVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExportReqVO.java
| @@ -9,9 +9,9 @@ import java.util.Date; | @@ -9,9 +9,9 @@ import java.util.Date; | ||
| 9 | 9 | ||
| 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 11 | 11 | ||
| 12 | -@ApiModel(value = "定时任务 Excel 导出 Request VO", description = "参数和 InfJobLogPageReqVO 是一致的") | 12 | +@ApiModel(value = "管理后台 - 定时任务 Excel 导出 Request VO", description = "参数和 InfJobLogPageReqVO 是一致的") |
| 13 | @Data | 13 | @Data |
| 14 | -public class InfJobLogExportReqVO { | 14 | +public class JobLogExportReqVO { |
| 15 | 15 | ||
| 16 | @ApiModelProperty(value = "任务编号", example = "10") | 16 | @ApiModelProperty(value = "任务编号", example = "10") |
| 17 | private Long jobId; | 17 | private Long jobId; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogPageReqVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogPageReqVO.java
| @@ -12,11 +12,11 @@ import java.util.Date; | @@ -12,11 +12,11 @@ import java.util.Date; | ||
| 12 | 12 | ||
| 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 14 | 14 | ||
| 15 | -@ApiModel("定时任务日志分页 Request VO") | 15 | +@ApiModel("管理后台 - 定时任务日志分页 Request VO") |
| 16 | @Data | 16 | @Data |
| 17 | @EqualsAndHashCode(callSuper = true) | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | @ToString(callSuper = true) | 18 | @ToString(callSuper = true) |
| 19 | -public class InfJobLogPageReqVO extends PageParam { | 19 | +public class JobLogPageReqVO extends PageParam { |
| 20 | 20 | ||
| 21 | @ApiModelProperty(value = "任务编号", example = "10") | 21 | @ApiModelProperty(value = "任务编号", example = "10") |
| 22 | private Long jobId; | 22 | private Long jobId; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogRespVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogRespVO.java
| @@ -8,11 +8,11 @@ import lombok.ToString; | @@ -8,11 +8,11 @@ import lombok.ToString; | ||
| 8 | 8 | ||
| 9 | import java.util.Date; | 9 | import java.util.Date; |
| 10 | 10 | ||
| 11 | -@ApiModel("定时任务日志 Response VO") | 11 | +@ApiModel("管理后台 - 定时任务日志 Response VO") |
| 12 | @Data | 12 | @Data |
| 13 | @EqualsAndHashCode(callSuper = true) | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | @ToString(callSuper = true) | 14 | @ToString(callSuper = true) |
| 15 | -public class InfJobLogRespVO extends InfJobLogBaseVO { | 15 | +public class JobLogRespVO extends JobLogBaseVO { |
| 16 | 16 | ||
| 17 | @ApiModelProperty(value = "日志编号", required = true, example = "1024") | 17 | @ApiModelProperty(value = "日志编号", required = true, example = "1024") |
| 18 | private Long id; | 18 | private Long id; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/InfApiAccessLogController.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiAccessLogController.java
| 1 | package cn.iocoder.yudao.module.infra.controller.admin.logger; | 1 | package cn.iocoder.yudao.module.infra.controller.admin.logger; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 7 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 8 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExcelVO; | ||
| 9 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; | ||
| 10 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; | ||
| 11 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogRespVO; | ||
| 12 | -import cn.iocoder.yudao.module.infra.convert.logger.InfApiAccessLogConvert; | ||
| 13 | -import cn.iocoder.yudao.module.infra.service.logger.InfApiAccessLogService; | 7 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExcelVO; |
| 8 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.infra.convert.logger.ApiAccessLogConvert; | ||
| 12 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; | ||
| 13 | +import cn.iocoder.yudao.module.infra.service.logger.ApiAccessLogService; | ||
| 14 | import io.swagger.annotations.Api; | 14 | import io.swagger.annotations.Api; |
| 15 | import io.swagger.annotations.ApiOperation; | 15 | import io.swagger.annotations.ApiOperation; |
| 16 | import org.springframework.security.access.prepost.PreAuthorize; | 16 | import org.springframework.security.access.prepost.PreAuthorize; |
| @@ -28,33 +28,33 @@ import java.util.List; | @@ -28,33 +28,33 @@ import java.util.List; | ||
| 28 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 28 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 29 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | 29 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 30 | 30 | ||
| 31 | -@Api(tags = "API 访问日志") | 31 | +@Api(tags = "管理后台 - API 访问日志") |
| 32 | @RestController | 32 | @RestController |
| 33 | @RequestMapping("/infra/api-access-log") | 33 | @RequestMapping("/infra/api-access-log") |
| 34 | @Validated | 34 | @Validated |
| 35 | -public class InfApiAccessLogController { | 35 | +public class ApiAccessLogController { |
| 36 | 36 | ||
| 37 | @Resource | 37 | @Resource |
| 38 | - private InfApiAccessLogService apiAccessLogService; | 38 | + private ApiAccessLogService apiAccessLogService; |
| 39 | 39 | ||
| 40 | @GetMapping("/page") | 40 | @GetMapping("/page") |
| 41 | @ApiOperation("获得API 访问日志分页") | 41 | @ApiOperation("获得API 访问日志分页") |
| 42 | @PreAuthorize("@ss.hasPermission('infra:api-access-log:query')") | 42 | @PreAuthorize("@ss.hasPermission('infra:api-access-log:query')") |
| 43 | - public CommonResult<PageResult<InfApiAccessLogRespVO>> getApiAccessLogPage(@Valid InfApiAccessLogPageReqVO pageVO) { | ||
| 44 | - PageResult<InfApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(pageVO); | ||
| 45 | - return success(InfApiAccessLogConvert.INSTANCE.convertPage(pageResult)); | 43 | + public CommonResult<PageResult<ApiAccessLogRespVO>> getApiAccessLogPage(@Valid ApiAccessLogPageReqVO pageVO) { |
| 44 | + PageResult<ApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(pageVO); | ||
| 45 | + return success(ApiAccessLogConvert.INSTANCE.convertPage(pageResult)); | ||
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | @GetMapping("/export-excel") | 48 | @GetMapping("/export-excel") |
| 49 | @ApiOperation("导出API 访问日志 Excel") | 49 | @ApiOperation("导出API 访问日志 Excel") |
| 50 | @PreAuthorize("@ss.hasPermission('infra:api-access-log:export')") | 50 | @PreAuthorize("@ss.hasPermission('infra:api-access-log:export')") |
| 51 | @OperateLog(type = EXPORT) | 51 | @OperateLog(type = EXPORT) |
| 52 | - public void exportApiAccessLogExcel(@Valid InfApiAccessLogExportReqVO exportReqVO, | 52 | + public void exportApiAccessLogExcel(@Valid ApiAccessLogExportReqVO exportReqVO, |
| 53 | HttpServletResponse response) throws IOException { | 53 | HttpServletResponse response) throws IOException { |
| 54 | - List<InfApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(exportReqVO); | 54 | + List<ApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(exportReqVO); |
| 55 | // 导出 Excel | 55 | // 导出 Excel |
| 56 | - List<InfApiAccessLogExcelVO> datas = InfApiAccessLogConvert.INSTANCE.convertList02(list); | ||
| 57 | - ExcelUtils.write(response, "API 访问日志.xls", "数据", InfApiAccessLogExcelVO.class, datas); | 56 | + List<ApiAccessLogExcelVO> datas = ApiAccessLogConvert.INSTANCE.convertList02(list); |
| 57 | + ExcelUtils.write(response, "API 访问日志.xls", "数据", ApiAccessLogExcelVO.class, datas); | ||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | } | 60 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/InfApiErrorLogController.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiErrorLogController.java
| 1 | package cn.iocoder.yudao.module.infra.controller.admin.logger; | 1 | package cn.iocoder.yudao.module.infra.controller.admin.logger; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 7 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 8 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExcelVO; | ||
| 9 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExportReqVO; | ||
| 10 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogPageReqVO; | ||
| 11 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogRespVO; | ||
| 12 | -import cn.iocoder.yudao.module.infra.convert.logger.InfApiErrorLogConvert; | ||
| 13 | -import cn.iocoder.yudao.module.infra.service.logger.InfApiErrorLogService; | 7 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExcelVO; |
| 8 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.infra.convert.logger.ApiErrorLogConvert; | ||
| 12 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; | ||
| 13 | +import cn.iocoder.yudao.module.infra.service.logger.ApiErrorLogService; | ||
| 14 | import io.swagger.annotations.Api; | 14 | import io.swagger.annotations.Api; |
| 15 | import io.swagger.annotations.ApiImplicitParam; | 15 | import io.swagger.annotations.ApiImplicitParam; |
| 16 | import io.swagger.annotations.ApiImplicitParams; | 16 | import io.swagger.annotations.ApiImplicitParams; |
| @@ -29,14 +29,14 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | @@ -29,14 +29,14 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 29 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | 29 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 30 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 30 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 31 | 31 | ||
| 32 | -@Api(tags = "API 错误日志") | 32 | +@Api(tags = "管理后台 - API 错误日志") |
| 33 | @RestController | 33 | @RestController |
| 34 | @RequestMapping("/infra/api-error-log") | 34 | @RequestMapping("/infra/api-error-log") |
| 35 | @Validated | 35 | @Validated |
| 36 | -public class InfApiErrorLogController { | 36 | +public class ApiErrorLogController { |
| 37 | 37 | ||
| 38 | @Resource | 38 | @Resource |
| 39 | - private InfApiErrorLogService apiErrorLogService; | 39 | + private ApiErrorLogService apiErrorLogService; |
| 40 | 40 | ||
| 41 | @PutMapping("/update-status") | 41 | @PutMapping("/update-status") |
| 42 | @ApiOperation("更新 API 错误日志的状态") | 42 | @ApiOperation("更新 API 错误日志的状态") |
| @@ -54,21 +54,21 @@ public class InfApiErrorLogController { | @@ -54,21 +54,21 @@ public class InfApiErrorLogController { | ||
| 54 | @GetMapping("/page") | 54 | @GetMapping("/page") |
| 55 | @ApiOperation("获得 API 错误日志分页") | 55 | @ApiOperation("获得 API 错误日志分页") |
| 56 | @PreAuthorize("@ss.hasPermission('infra:api-error-log:query')") | 56 | @PreAuthorize("@ss.hasPermission('infra:api-error-log:query')") |
| 57 | - public CommonResult<PageResult<InfApiErrorLogRespVO>> getApiErrorLogPage(@Valid InfApiErrorLogPageReqVO pageVO) { | ||
| 58 | - PageResult<InfApiErrorLogDO> pageResult = apiErrorLogService.getApiErrorLogPage(pageVO); | ||
| 59 | - return success(InfApiErrorLogConvert.INSTANCE.convertPage(pageResult)); | 57 | + public CommonResult<PageResult<ApiErrorLogRespVO>> getApiErrorLogPage(@Valid ApiErrorLogPageReqVO pageVO) { |
| 58 | + PageResult<ApiErrorLogDO> pageResult = apiErrorLogService.getApiErrorLogPage(pageVO); | ||
| 59 | + return success(ApiErrorLogConvert.INSTANCE.convertPage(pageResult)); | ||
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | @GetMapping("/export-excel") | 62 | @GetMapping("/export-excel") |
| 63 | @ApiOperation("导出 API 错误日志 Excel") | 63 | @ApiOperation("导出 API 错误日志 Excel") |
| 64 | @PreAuthorize("@ss.hasPermission('infra:api-error-log:export')") | 64 | @PreAuthorize("@ss.hasPermission('infra:api-error-log:export')") |
| 65 | @OperateLog(type = EXPORT) | 65 | @OperateLog(type = EXPORT) |
| 66 | - public void exportApiErrorLogExcel(@Valid InfApiErrorLogExportReqVO exportReqVO, | 66 | + public void exportApiErrorLogExcel(@Valid ApiErrorLogExportReqVO exportReqVO, |
| 67 | HttpServletResponse response) throws IOException { | 67 | HttpServletResponse response) throws IOException { |
| 68 | - List<InfApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(exportReqVO); | 68 | + List<ApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(exportReqVO); |
| 69 | // 导出 Excel | 69 | // 导出 Excel |
| 70 | - List<InfApiErrorLogExcelVO> datas = InfApiErrorLogConvert.INSTANCE.convertList02(list); | ||
| 71 | - ExcelUtils.write(response, "API 错误日志.xls", "数据", InfApiErrorLogExcelVO.class, datas); | 70 | + List<ApiErrorLogExcelVO> datas = ApiErrorLogConvert.INSTANCE.convertList02(list); |
| 71 | + ExcelUtils.write(response, "API 错误日志.xls", "数据", ApiErrorLogExcelVO.class, datas); | ||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | } | 74 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogBaseVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java
| @@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 14 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | 14 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 15 | */ | 15 | */ |
| 16 | @Data | 16 | @Data |
| 17 | -public class InfApiAccessLogBaseVO { | 17 | +public class ApiAccessLogBaseVO { |
| 18 | 18 | ||
| 19 | @ApiModelProperty(value = "链路追踪编号", required = true, example = "66600cb6-7852-11eb-9439-0242ac130002") | 19 | @ApiModelProperty(value = "链路追踪编号", required = true, example = "66600cb6-7852-11eb-9439-0242ac130002") |
| 20 | @NotNull(message = "链路追踪编号不能为空") | 20 | @NotNull(message = "链路追踪编号不能为空") |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogExcelVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java
| @@ -14,7 +14,7 @@ import java.util.Date; | @@ -14,7 +14,7 @@ import java.util.Date; | ||
| 14 | * @author 芋道源码 | 14 | * @author 芋道源码 |
| 15 | */ | 15 | */ |
| 16 | @Data | 16 | @Data |
| 17 | -public class InfApiAccessLogExcelVO { | 17 | +public class ApiAccessLogExcelVO { |
| 18 | 18 | ||
| 19 | @ExcelProperty("日志主键") | 19 | @ExcelProperty("日志主键") |
| 20 | private Long id; | 20 | private Long id; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogExportReqVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java
| @@ -9,9 +9,9 @@ import java.util.Date; | @@ -9,9 +9,9 @@ import java.util.Date; | ||
| 9 | 9 | ||
| 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 11 | 11 | ||
| 12 | -@ApiModel(value = "API 访问日志 Excel 导出 Request VO", description = "参数和 InfApiAccessLogPageReqVO 是一致的") | 12 | +@ApiModel(value = "管理后台 - API 访问日志 Excel 导出 Request VO", description = "参数和 InfApiAccessLogPageReqVO 是一致的") |
| 13 | @Data | 13 | @Data |
| 14 | -public class InfApiAccessLogExportReqVO { | 14 | +public class ApiAccessLogExportReqVO { |
| 15 | 15 | ||
| 16 | @ApiModelProperty(value = "用户编号", example = "666") | 16 | @ApiModelProperty(value = "用户编号", example = "666") |
| 17 | private Long userId; | 17 | private Long userId; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogPageReqVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java
| @@ -12,11 +12,11 @@ import java.util.Date; | @@ -12,11 +12,11 @@ import java.util.Date; | ||
| 12 | 12 | ||
| 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 14 | 14 | ||
| 15 | -@ApiModel("API 访问日志分页 Request VO") | 15 | +@ApiModel("管理后台 - API 访问日志分页 Request VO") |
| 16 | @Data | 16 | @Data |
| 17 | @EqualsAndHashCode(callSuper = true) | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | @ToString(callSuper = true) | 18 | @ToString(callSuper = true) |
| 19 | -public class InfApiAccessLogPageReqVO extends PageParam { | 19 | +public class ApiAccessLogPageReqVO extends PageParam { |
| 20 | 20 | ||
| 21 | @ApiModelProperty(value = "用户编号", example = "666") | 21 | @ApiModelProperty(value = "用户编号", example = "666") |
| 22 | private Long userId; | 22 | private Long userId; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogRespVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java
| @@ -8,11 +8,11 @@ import lombok.ToString; | @@ -8,11 +8,11 @@ import lombok.ToString; | ||
| 8 | 8 | ||
| 9 | import java.util.Date; | 9 | import java.util.Date; |
| 10 | 10 | ||
| 11 | -@ApiModel("API 访问日志 Response VO") | 11 | +@ApiModel("管理后台 - API 访问日志 Response VO") |
| 12 | @Data | 12 | @Data |
| 13 | @EqualsAndHashCode(callSuper = true) | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | @ToString(callSuper = true) | 14 | @ToString(callSuper = true) |
| 15 | -public class InfApiAccessLogRespVO extends InfApiAccessLogBaseVO { | 15 | +public class ApiAccessLogRespVO extends ApiAccessLogBaseVO { |
| 16 | 16 | ||
| 17 | @ApiModelProperty(value = "日志主键", required = true, example = "1024") | 17 | @ApiModelProperty(value = "日志主键", required = true, example = "1024") |
| 18 | private Long id; | 18 | private Long id; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogBaseVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java
| @@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 14 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | 14 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 15 | */ | 15 | */ |
| 16 | @Data | 16 | @Data |
| 17 | -public class InfApiErrorLogBaseVO { | 17 | +public class ApiErrorLogBaseVO { |
| 18 | 18 | ||
| 19 | @ApiModelProperty(value = "链路追踪编号", required = true, example = "66600cb6-7852-11eb-9439-0242ac130002") | 19 | @ApiModelProperty(value = "链路追踪编号", required = true, example = "66600cb6-7852-11eb-9439-0242ac130002") |
| 20 | @NotNull(message = "链路追踪编号不能为空") | 20 | @NotNull(message = "链路追踪编号不能为空") |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogExcelVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java
| @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog; | @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; |
| 6 | -import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | ||
| 7 | import com.alibaba.excel.annotation.ExcelProperty; | 6 | import com.alibaba.excel.annotation.ExcelProperty; |
| 8 | import lombok.Data; | 7 | import lombok.Data; |
| 9 | 8 | ||
| @@ -15,7 +14,7 @@ import java.util.Date; | @@ -15,7 +14,7 @@ import java.util.Date; | ||
| 15 | * @author 芋道源码 | 14 | * @author 芋道源码 |
| 16 | */ | 15 | */ |
| 17 | @Data | 16 | @Data |
| 18 | -public class InfApiErrorLogExcelVO { | 17 | +public class ApiErrorLogExcelVO { |
| 19 | 18 | ||
| 20 | @ExcelProperty("编号") | 19 | @ExcelProperty("编号") |
| 21 | private Integer id; | 20 | private Integer id; |
| @@ -27,7 +26,7 @@ public class InfApiErrorLogExcelVO { | @@ -27,7 +26,7 @@ public class InfApiErrorLogExcelVO { | ||
| 27 | private Integer userId; | 26 | private Integer userId; |
| 28 | 27 | ||
| 29 | @ExcelProperty(value = "用户类型", converter = DictConvert.class) | 28 | @ExcelProperty(value = "用户类型", converter = DictConvert.class) |
| 30 | - @DictFormat(DictTypeConstants.USER_TYPE) | 29 | + @DictFormat(cn.iocoder.yudao.module.system.enums.DictTypeConstants.USER_TYPE) |
| 31 | private Integer userType; | 30 | private Integer userType; |
| 32 | 31 | ||
| 33 | @ExcelProperty("应用名") | 32 | @ExcelProperty("应用名") |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogExportReqVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java
| @@ -9,9 +9,9 @@ import java.util.Date; | @@ -9,9 +9,9 @@ import java.util.Date; | ||
| 9 | 9 | ||
| 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 11 | 11 | ||
| 12 | -@ApiModel(value = "API 错误日志 Excel 导出 Request VO", description = "参数和 InfApiErrorLogPageReqVO 是一致的") | 12 | +@ApiModel(value = "管理后台 - API 错误日志 Excel 导出 Request VO", description = "参数和 InfApiErrorLogPageReqVO 是一致的") |
| 13 | @Data | 13 | @Data |
| 14 | -public class InfApiErrorLogExportReqVO { | 14 | +public class ApiErrorLogExportReqVO { |
| 15 | 15 | ||
| 16 | @ApiModelProperty(value = "用户编号", example = "666") | 16 | @ApiModelProperty(value = "用户编号", example = "666") |
| 17 | private Long userId; | 17 | private Long userId; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogPageReqVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java
| @@ -12,11 +12,11 @@ import java.util.Date; | @@ -12,11 +12,11 @@ import java.util.Date; | ||
| 12 | 12 | ||
| 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 14 | 14 | ||
| 15 | -@ApiModel("API 错误日志分页 Request VO") | 15 | +@ApiModel("管理后台 - API 错误日志分页 Request VO") |
| 16 | @Data | 16 | @Data |
| 17 | @EqualsAndHashCode(callSuper = true) | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | @ToString(callSuper = true) | 18 | @ToString(callSuper = true) |
| 19 | -public class InfApiErrorLogPageReqVO extends PageParam { | 19 | +public class ApiErrorLogPageReqVO extends PageParam { |
| 20 | 20 | ||
| 21 | @ApiModelProperty(value = "用户编号", example = "666") | 21 | @ApiModelProperty(value = "用户编号", example = "666") |
| 22 | private Long userId; | 22 | private Long userId; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogRespVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java
| @@ -8,11 +8,11 @@ import lombok.ToString; | @@ -8,11 +8,11 @@ import lombok.ToString; | ||
| 8 | 8 | ||
| 9 | import java.util.Date; | 9 | import java.util.Date; |
| 10 | 10 | ||
| 11 | -@ApiModel("API 错误日志 Response VO") | 11 | +@ApiModel("管理后台 - API 错误日志 Response VO") |
| 12 | @Data | 12 | @Data |
| 13 | @EqualsAndHashCode(callSuper = true) | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | @ToString(callSuper = true) | 14 | @ToString(callSuper = true) |
| 15 | -public class InfApiErrorLogRespVO extends InfApiErrorLogBaseVO { | 15 | +public class ApiErrorLogRespVO extends ApiErrorLogBaseVO { |
| 16 | 16 | ||
| 17 | @ApiModelProperty(value = "编号", required = true, example = "1024") | 17 | @ApiModelProperty(value = "编号", required = true, example = "1024") |
| 18 | private Integer id; | 18 | private Integer id; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.http
| 1 | ### 请求 /infra/redis/get-monitor-info 接口 => 成功 | 1 | ### 请求 /infra/redis/get-monitor-info 接口 => 成功 |
| 2 | GET {{baseUrl}}/infra/redis/get-monitor-info | 2 | GET {{baseUrl}}/infra/redis/get-monitor-info |
| 3 | Authorization: Bearer {{token}} | 3 | Authorization: Bearer {{token}} |
| 4 | +tenant-id: {{adminTenentId}} | ||
| 4 | 5 | ||
| 5 | ### 请求 /infra/redis/get-key-list 接口 => 成功 | 6 | ### 请求 /infra/redis/get-key-list 接口 => 成功 |
| 6 | GET {{baseUrl}}/infra/redis/get-key-list | 7 | GET {{baseUrl}}/infra/redis/get-key-list |
| 7 | Authorization: Bearer {{token}} | 8 | Authorization: Bearer {{token}} |
| 9 | +tenant-id: {{adminTenentId}} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.redis; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.redis; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; | 4 | import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; |
| 5 | import cn.iocoder.yudao.framework.redis.core.RedisKeyRegistry; | 5 | import cn.iocoder.yudao.framework.redis.core.RedisKeyRegistry; |
| 6 | -import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.InfRedisKeyRespVO; | ||
| 7 | -import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.InfRedisMonitorRespVO; | 6 | +import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisKeyRespVO; |
| 7 | +import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisMonitorRespVO; | ||
| 8 | import cn.iocoder.yudao.module.infra.convert.redis.RedisConvert; | 8 | import cn.iocoder.yudao.module.infra.convert.redis.RedisConvert; |
| 9 | import io.swagger.annotations.Api; | 9 | import io.swagger.annotations.Api; |
| 10 | import io.swagger.annotations.ApiOperation; | 10 | import io.swagger.annotations.ApiOperation; |
| @@ -22,7 +22,7 @@ import java.util.Properties; | @@ -22,7 +22,7 @@ import java.util.Properties; | ||
| 22 | 22 | ||
| 23 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 23 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 24 | 24 | ||
| 25 | -@Api(tags = "Redis 监控") | 25 | +@Api(tags = "管理后台 - Redis 监控") |
| 26 | @RestController | 26 | @RestController |
| 27 | @RequestMapping("/infra/redis") | 27 | @RequestMapping("/infra/redis") |
| 28 | public class RedisController { | 28 | public class RedisController { |
| @@ -33,7 +33,7 @@ public class RedisController { | @@ -33,7 +33,7 @@ public class RedisController { | ||
| 33 | @GetMapping("/get-monitor-info") | 33 | @GetMapping("/get-monitor-info") |
| 34 | @ApiOperation("获得 Redis 监控信息") | 34 | @ApiOperation("获得 Redis 监控信息") |
| 35 | @PreAuthorize("@ss.hasPermission('infra:redis:get-monitor-info')") | 35 | @PreAuthorize("@ss.hasPermission('infra:redis:get-monitor-info')") |
| 36 | - public CommonResult<InfRedisMonitorRespVO> getRedisMonitorInfo() { | 36 | + public CommonResult<RedisMonitorRespVO> getRedisMonitorInfo() { |
| 37 | // 获得 Redis 统计信息 | 37 | // 获得 Redis 统计信息 |
| 38 | Properties info = stringRedisTemplate.execute((RedisCallback<Properties>) RedisServerCommands::info); | 38 | Properties info = stringRedisTemplate.execute((RedisCallback<Properties>) RedisServerCommands::info); |
| 39 | Long dbSize = stringRedisTemplate.execute(RedisServerCommands::dbSize); | 39 | Long dbSize = stringRedisTemplate.execute(RedisServerCommands::dbSize); |
| @@ -47,7 +47,7 @@ public class RedisController { | @@ -47,7 +47,7 @@ public class RedisController { | ||
| 47 | @GetMapping("/get-key-list") | 47 | @GetMapping("/get-key-list") |
| 48 | @ApiOperation("获得 Redis Key 列表") | 48 | @ApiOperation("获得 Redis Key 列表") |
| 49 | @PreAuthorize("@ss.hasPermission('infra:redis:get-key-list')") | 49 | @PreAuthorize("@ss.hasPermission('infra:redis:get-key-list')") |
| 50 | - public CommonResult<List<InfRedisKeyRespVO>> getKeyList() { | 50 | + public CommonResult<List<RedisKeyRespVO>> getKeyList() { |
| 51 | List<RedisKeyDefine> keyDefines = RedisKeyRegistry.list(); | 51 | List<RedisKeyDefine> keyDefines = RedisKeyRegistry.list(); |
| 52 | return success(RedisConvert.INSTANCE.convertList(keyDefines)); | 52 | return success(RedisConvert.INSTANCE.convertList(keyDefines)); |
| 53 | } | 53 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/InfRedisKeyRespVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/RedisKeyRespVO.java
| @@ -9,11 +9,11 @@ import lombok.Data; | @@ -9,11 +9,11 @@ import lombok.Data; | ||
| 9 | 9 | ||
| 10 | import java.time.Duration; | 10 | import java.time.Duration; |
| 11 | 11 | ||
| 12 | -@ApiModel("Redis Key 信息 Response VO") | 12 | +@ApiModel("管理后台 - Redis Key 信息 Response VO") |
| 13 | @Data | 13 | @Data |
| 14 | @Builder | 14 | @Builder |
| 15 | @AllArgsConstructor | 15 | @AllArgsConstructor |
| 16 | -public class InfRedisKeyRespVO { | 16 | +public class RedisKeyRespVO { |
| 17 | 17 | ||
| 18 | @ApiModelProperty(value = "login_user:%s", required = true, example = "String") | 18 | @ApiModelProperty(value = "login_user:%s", required = true, example = "String") |
| 19 | private String keyTemplate; | 19 | private String keyTemplate; |
| @@ -22,7 +22,7 @@ public class InfRedisKeyRespVO { | @@ -22,7 +22,7 @@ public class InfRedisKeyRespVO { | ||
| 22 | private RedisKeyDefine.KeyTypeEnum keyType; | 22 | private RedisKeyDefine.KeyTypeEnum keyType; |
| 23 | 23 | ||
| 24 | @ApiModelProperty(value = "Value 类型", required = true, example = "java.lang.String") | 24 | @ApiModelProperty(value = "Value 类型", required = true, example = "java.lang.String") |
| 25 | - private Class valueType; | 25 | + private Class<?> valueType; |
| 26 | 26 | ||
| 27 | @ApiModelProperty(value = "超时类型", required = true, example = "1") | 27 | @ApiModelProperty(value = "超时类型", required = true, example = "1") |
| 28 | private RedisKeyDefine.TimeoutTypeEnum timeoutType; | 28 | private RedisKeyDefine.TimeoutTypeEnum timeoutType; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/InfRedisMonitorRespVO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/RedisMonitorRespVO.java
| @@ -9,11 +9,11 @@ import lombok.Data; | @@ -9,11 +9,11 @@ import lombok.Data; | ||
| 9 | import java.util.List; | 9 | import java.util.List; |
| 10 | import java.util.Properties; | 10 | import java.util.Properties; |
| 11 | 11 | ||
| 12 | -@ApiModel("Redis 监控信息 Response VO") | 12 | +@ApiModel("管理后台 - Redis 监控信息 Response VO") |
| 13 | @Data | 13 | @Data |
| 14 | @Builder | 14 | @Builder |
| 15 | @AllArgsConstructor | 15 | @AllArgsConstructor |
| 16 | -public class InfRedisMonitorRespVO { | 16 | +public class RedisMonitorRespVO { |
| 17 | 17 | ||
| 18 | @ApiModelProperty(value = "Redis info 指令结果", required = true, notes = "具体字段,查看 Redis 文档") | 18 | @ApiModelProperty(value = "Redis info 指令结果", required = true, notes = "具体字段,查看 Redis 文档") |
| 19 | private Properties info; | 19 | private Properties info; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/config/InfConfigConvert.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/config/ConfigConvert.java
| 1 | package cn.iocoder.yudao.module.infra.convert.config; | 1 | package cn.iocoder.yudao.module.infra.convert.config; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; | 4 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; |
| 6 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExcelVO; | 5 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExcelVO; |
| 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigRespVO; | 6 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigRespVO; |
| 8 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; | 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; |
| 8 | +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; | ||
| 9 | import org.mapstruct.Mapper; | 9 | import org.mapstruct.Mapper; |
| 10 | import org.mapstruct.factory.Mappers; | 10 | import org.mapstruct.factory.Mappers; |
| 11 | 11 | ||
| 12 | import java.util.List; | 12 | import java.util.List; |
| 13 | 13 | ||
| 14 | @Mapper | 14 | @Mapper |
| 15 | -public interface InfConfigConvert { | 15 | +public interface ConfigConvert { |
| 16 | 16 | ||
| 17 | - InfConfigConvert INSTANCE = Mappers.getMapper(InfConfigConvert.class); | 17 | + ConfigConvert INSTANCE = Mappers.getMapper(ConfigConvert.class); |
| 18 | 18 | ||
| 19 | - PageResult<ConfigRespVO> convertPage(PageResult<InfConfigDO> page); | 19 | + PageResult<ConfigRespVO> convertPage(PageResult<ConfigDO> page); |
| 20 | 20 | ||
| 21 | - ConfigRespVO convert(InfConfigDO bean); | 21 | + ConfigRespVO convert(ConfigDO bean); |
| 22 | 22 | ||
| 23 | - InfConfigDO convert(ConfigCreateReqVO bean); | 23 | + ConfigDO convert(ConfigCreateReqVO bean); |
| 24 | 24 | ||
| 25 | - InfConfigDO convert(ConfigUpdateReqVO bean); | 25 | + ConfigDO convert(ConfigUpdateReqVO bean); |
| 26 | 26 | ||
| 27 | - List<ConfigExcelVO> convertList(List<InfConfigDO> list); | 27 | + List<ConfigExcelVO> convertList(List<ConfigDO> list); |
| 28 | 28 | ||
| 29 | } | 29 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/file/FileConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.convert.file; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FileRespVO; | ||
| 5 | +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; | ||
| 6 | +import org.mapstruct.Mapper; | ||
| 7 | +import org.mapstruct.factory.Mappers; | ||
| 8 | + | ||
| 9 | +@Mapper | ||
| 10 | +public interface FileConvert { | ||
| 11 | + | ||
| 12 | + FileConvert INSTANCE = Mappers.getMapper(FileConvert.class); | ||
| 13 | + | ||
| 14 | + FileRespVO convert(FileDO bean); | ||
| 15 | + | ||
| 16 | + PageResult<FileRespVO> convertPage(PageResult<FileDO> page); | ||
| 17 | + | ||
| 18 | +} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/file/InfFileConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.convert.file; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFileRespVO; | ||
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; | ||
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | -import org.mapstruct.Mapper; | ||
| 7 | -import org.mapstruct.factory.Mappers; | ||
| 8 | - | ||
| 9 | -@Mapper | ||
| 10 | -public interface InfFileConvert { | ||
| 11 | - | ||
| 12 | - InfFileConvert INSTANCE = Mappers.getMapper(InfFileConvert.class); | ||
| 13 | - | ||
| 14 | - InfFileRespVO convert(InfFileDO bean); | ||
| 15 | - | ||
| 16 | - PageResult<InfFileRespVO> convertPage(PageResult<InfFileDO> page); | ||
| 17 | - | ||
| 18 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/InfJobConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.convert.job; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobCreateReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExcelVO; | ||
| 6 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobRespVO; | ||
| 7 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobUpdateReqVO; | ||
| 8 | -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO; | ||
| 9 | -import org.mapstruct.Mapper; | ||
| 10 | -import org.mapstruct.factory.Mappers; | ||
| 11 | - | ||
| 12 | -import java.util.List; | ||
| 13 | - | ||
| 14 | -/** | ||
| 15 | - * 定时任务 Convert | ||
| 16 | - * | ||
| 17 | - * @author 芋道源码 | ||
| 18 | - */ | ||
| 19 | -@Mapper | ||
| 20 | -public interface InfJobConvert { | ||
| 21 | - | ||
| 22 | - InfJobConvert INSTANCE = Mappers.getMapper(InfJobConvert.class); | ||
| 23 | - | ||
| 24 | - InfJobDO convert(InfJobCreateReqVO bean); | ||
| 25 | - | ||
| 26 | - InfJobDO convert(InfJobUpdateReqVO bean); | ||
| 27 | - | ||
| 28 | - InfJobRespVO convert(InfJobDO bean); | ||
| 29 | - | ||
| 30 | - List<InfJobRespVO> convertList(List<InfJobDO> list); | ||
| 31 | - | ||
| 32 | - PageResult<InfJobRespVO> convertPage(PageResult<InfJobDO> page); | ||
| 33 | - | ||
| 34 | - List<InfJobExcelVO> convertList02(List<InfJobDO> list); | ||
| 35 | - | ||
| 36 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/JobConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.convert.job; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExcelVO; | ||
| 6 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobRespVO; | ||
| 7 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; | ||
| 9 | +import org.mapstruct.Mapper; | ||
| 10 | +import org.mapstruct.factory.Mappers; | ||
| 11 | + | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 定时任务 Convert | ||
| 16 | + * | ||
| 17 | + * @author 芋道源码 | ||
| 18 | + */ | ||
| 19 | +@Mapper | ||
| 20 | +public interface JobConvert { | ||
| 21 | + | ||
| 22 | + JobConvert INSTANCE = Mappers.getMapper(JobConvert.class); | ||
| 23 | + | ||
| 24 | + JobDO convert(JobCreateReqVO bean); | ||
| 25 | + | ||
| 26 | + JobDO convert(JobUpdateReqVO bean); | ||
| 27 | + | ||
| 28 | + JobRespVO convert(JobDO bean); | ||
| 29 | + | ||
| 30 | + List<JobRespVO> convertList(List<JobDO> list); | ||
| 31 | + | ||
| 32 | + PageResult<JobRespVO> convertPage(PageResult<JobDO> page); | ||
| 33 | + | ||
| 34 | + List<JobExcelVO> convertList02(List<JobDO> list); | ||
| 35 | + | ||
| 36 | +} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/InfJobLogConvert.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/JobLogConvert.java
| 1 | package cn.iocoder.yudao.module.infra.convert.job; | 1 | package cn.iocoder.yudao.module.infra.convert.job; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExcelVO; | ||
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogRespVO; | ||
| 6 | -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO; | 4 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExcelVO; |
| 5 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogRespVO; | ||
| 6 | +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; | ||
| 7 | import org.mapstruct.Mapper; | 7 | import org.mapstruct.Mapper; |
| 8 | import org.mapstruct.factory.Mappers; | 8 | import org.mapstruct.factory.Mappers; |
| 9 | 9 | ||
| @@ -15,16 +15,16 @@ import java.util.List; | @@ -15,16 +15,16 @@ import java.util.List; | ||
| 15 | * @author 芋艿 | 15 | * @author 芋艿 |
| 16 | */ | 16 | */ |
| 17 | @Mapper | 17 | @Mapper |
| 18 | -public interface InfJobLogConvert { | 18 | +public interface JobLogConvert { |
| 19 | 19 | ||
| 20 | - InfJobLogConvert INSTANCE = Mappers.getMapper(InfJobLogConvert.class); | 20 | + JobLogConvert INSTANCE = Mappers.getMapper(JobLogConvert.class); |
| 21 | 21 | ||
| 22 | - InfJobLogRespVO convert(InfJobLogDO bean); | 22 | + JobLogRespVO convert(JobLogDO bean); |
| 23 | 23 | ||
| 24 | - List<InfJobLogRespVO> convertList(List<InfJobLogDO> list); | 24 | + List<JobLogRespVO> convertList(List<JobLogDO> list); |
| 25 | 25 | ||
| 26 | - PageResult<InfJobLogRespVO> convertPage(PageResult<InfJobLogDO> page); | 26 | + PageResult<JobLogRespVO> convertPage(PageResult<JobLogDO> page); |
| 27 | 27 | ||
| 28 | - List<InfJobLogExcelVO> convertList02(List<InfJobLogDO> list); | 28 | + List<JobLogExcelVO> convertList02(List<JobLogDO> list); |
| 29 | 29 | ||
| 30 | } | 30 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiAccessLogConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.convert.logger; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExcelVO; | ||
| 6 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogRespVO; | ||
| 7 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; | ||
| 8 | +import org.mapstruct.Mapper; | ||
| 9 | +import org.mapstruct.factory.Mappers; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * API 访问日志 Convert | ||
| 15 | + * | ||
| 16 | + * @author 芋道源码 | ||
| 17 | + */ | ||
| 18 | +@Mapper | ||
| 19 | +public interface ApiAccessLogConvert { | ||
| 20 | + | ||
| 21 | + ApiAccessLogConvert INSTANCE = Mappers.getMapper(ApiAccessLogConvert.class); | ||
| 22 | + | ||
| 23 | + ApiAccessLogRespVO convert(ApiAccessLogDO bean); | ||
| 24 | + | ||
| 25 | + List<ApiAccessLogRespVO> convertList(List<ApiAccessLogDO> list); | ||
| 26 | + | ||
| 27 | + PageResult<ApiAccessLogRespVO> convertPage(PageResult<ApiAccessLogDO> page); | ||
| 28 | + | ||
| 29 | + List<ApiAccessLogExcelVO> convertList02(List<ApiAccessLogDO> list); | ||
| 30 | + | ||
| 31 | + ApiAccessLogDO convert(ApiAccessLogCreateReqDTO bean); | ||
| 32 | + | ||
| 33 | +} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiErrorLogConvert.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiErrorLogConvert.java
| 1 | package cn.iocoder.yudao.module.infra.convert.logger; | 1 | package cn.iocoder.yudao.module.infra.convert.logger; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; | 3 | +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExcelVO; | ||
| 6 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogRespVO; | 5 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExcelVO; |
| 6 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogRespVO; | ||
| 7 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; | ||
| 7 | import org.mapstruct.Mapper; | 8 | import org.mapstruct.Mapper; |
| 8 | import org.mapstruct.factory.Mappers; | 9 | import org.mapstruct.factory.Mappers; |
| 9 | 10 | ||
| @@ -15,14 +16,16 @@ import java.util.List; | @@ -15,14 +16,16 @@ import java.util.List; | ||
| 15 | * @author 芋道源码 | 16 | * @author 芋道源码 |
| 16 | */ | 17 | */ |
| 17 | @Mapper | 18 | @Mapper |
| 18 | -public interface InfApiErrorLogConvert { | 19 | +public interface ApiErrorLogConvert { |
| 19 | 20 | ||
| 20 | - InfApiErrorLogConvert INSTANCE = Mappers.getMapper(InfApiErrorLogConvert.class); | 21 | + ApiErrorLogConvert INSTANCE = Mappers.getMapper(ApiErrorLogConvert.class); |
| 21 | 22 | ||
| 22 | - InfApiErrorLogRespVO convert(InfApiErrorLogDO bean); | 23 | + ApiErrorLogRespVO convert(ApiErrorLogDO bean); |
| 23 | 24 | ||
| 24 | - PageResult<InfApiErrorLogRespVO> convertPage(PageResult<InfApiErrorLogDO> page); | 25 | + PageResult<ApiErrorLogRespVO> convertPage(PageResult<ApiErrorLogDO> page); |
| 25 | 26 | ||
| 26 | - List<InfApiErrorLogExcelVO> convertList02(List<InfApiErrorLogDO> list); | 27 | + List<ApiErrorLogExcelVO> convertList02(List<ApiErrorLogDO> list); |
| 28 | + | ||
| 29 | + ApiErrorLogDO convert(ApiErrorLogCreateReqDTO bean); | ||
| 27 | 30 | ||
| 28 | } | 31 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiAccessLogConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.convert.logger; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | ||
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExcelVO; | ||
| 6 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogRespVO; | ||
| 7 | -import org.mapstruct.Mapper; | ||
| 8 | -import org.mapstruct.factory.Mappers; | ||
| 9 | - | ||
| 10 | -import java.util.List; | ||
| 11 | - | ||
| 12 | -/** | ||
| 13 | - * API 访问日志 Convert | ||
| 14 | - * | ||
| 15 | - * @author 芋道源码 | ||
| 16 | - */ | ||
| 17 | -@Mapper | ||
| 18 | -public interface InfApiAccessLogConvert { | ||
| 19 | - | ||
| 20 | - InfApiAccessLogConvert INSTANCE = Mappers.getMapper(InfApiAccessLogConvert.class); | ||
| 21 | - | ||
| 22 | - InfApiAccessLogRespVO convert(InfApiAccessLogDO bean); | ||
| 23 | - | ||
| 24 | - List<InfApiAccessLogRespVO> convertList(List<InfApiAccessLogDO> list); | ||
| 25 | - | ||
| 26 | - PageResult<InfApiAccessLogRespVO> convertPage(PageResult<InfApiAccessLogDO> page); | ||
| 27 | - | ||
| 28 | - List<InfApiAccessLogExcelVO> convertList02(List<InfApiAccessLogDO> list); | ||
| 29 | - | ||
| 30 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiAccessLogCoreConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.convert.logger; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO; | ||
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | ||
| 5 | -import org.mapstruct.Mapper; | ||
| 6 | -import org.mapstruct.factory.Mappers; | ||
| 7 | - | ||
| 8 | -@Mapper | ||
| 9 | -public interface InfApiAccessLogCoreConvert { | ||
| 10 | - | ||
| 11 | - InfApiAccessLogCoreConvert INSTANCE = Mappers.getMapper(InfApiAccessLogCoreConvert.class); | ||
| 12 | - | ||
| 13 | - InfApiAccessLogDO convert(ApiAccessLogCreateReqDTO bean); | ||
| 14 | - | ||
| 15 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiErrorLogCoreConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.convert.logger; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO; | ||
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; | ||
| 5 | -import org.mapstruct.Mapper; | ||
| 6 | -import org.mapstruct.factory.Mappers; | ||
| 7 | - | ||
| 8 | -@Mapper | ||
| 9 | -public interface InfApiErrorLogCoreConvert { | ||
| 10 | - | ||
| 11 | - InfApiErrorLogCoreConvert INSTANCE = Mappers.getMapper(InfApiErrorLogCoreConvert.class); | ||
| 12 | - | ||
| 13 | - InfApiErrorLogDO convert(ApiErrorLogCreateReqDTO bean); | ||
| 14 | - | ||
| 15 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/redis/RedisConvert.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.convert.redis; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.convert.redis; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.StrUtil; | 3 | import cn.hutool.core.util.StrUtil; |
| 4 | import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; | 4 | import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; |
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.InfRedisKeyRespVO; | ||
| 6 | -import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.InfRedisMonitorRespVO; | 5 | +import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisKeyRespVO; |
| 6 | +import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisMonitorRespVO; | ||
| 7 | import org.mapstruct.Mapper; | 7 | import org.mapstruct.Mapper; |
| 8 | import org.mapstruct.factory.Mappers; | 8 | import org.mapstruct.factory.Mappers; |
| 9 | 9 | ||
| @@ -16,11 +16,11 @@ public interface RedisConvert { | @@ -16,11 +16,11 @@ public interface RedisConvert { | ||
| 16 | 16 | ||
| 17 | RedisConvert INSTANCE = Mappers.getMapper(RedisConvert.class); | 17 | RedisConvert INSTANCE = Mappers.getMapper(RedisConvert.class); |
| 18 | 18 | ||
| 19 | - default InfRedisMonitorRespVO build(Properties info, Long dbSize, Properties commandStats) { | ||
| 20 | - InfRedisMonitorRespVO respVO = InfRedisMonitorRespVO.builder().info(info).dbSize(dbSize) | 19 | + default RedisMonitorRespVO build(Properties info, Long dbSize, Properties commandStats) { |
| 20 | + RedisMonitorRespVO respVO = RedisMonitorRespVO.builder().info(info).dbSize(dbSize) | ||
| 21 | .commandStats(new ArrayList<>(commandStats.size())).build(); | 21 | .commandStats(new ArrayList<>(commandStats.size())).build(); |
| 22 | commandStats.forEach((key, value) -> { | 22 | commandStats.forEach((key, value) -> { |
| 23 | - respVO.getCommandStats().add(InfRedisMonitorRespVO.CommandStat.builder() | 23 | + respVO.getCommandStats().add(RedisMonitorRespVO.CommandStat.builder() |
| 24 | .command(StrUtil.subAfter((String) key, "cmdstat_", false)) | 24 | .command(StrUtil.subAfter((String) key, "cmdstat_", false)) |
| 25 | .calls(Integer.valueOf(StrUtil.subBetween((String) value, "calls=", ","))) | 25 | .calls(Integer.valueOf(StrUtil.subBetween((String) value, "calls=", ","))) |
| 26 | .usec(Long.valueOf(StrUtil.subBetween((String) value, "usec=", ","))) | 26 | .usec(Long.valueOf(StrUtil.subBetween((String) value, "usec=", ","))) |
| @@ -29,6 +29,6 @@ public interface RedisConvert { | @@ -29,6 +29,6 @@ public interface RedisConvert { | ||
| 29 | return respVO; | 29 | return respVO; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | - List<InfRedisKeyRespVO> convertList(List<RedisKeyDefine> list); | 32 | + List<RedisKeyRespVO> convertList(List<RedisKeyDefine> list); |
| 33 | 33 | ||
| 34 | } | 34 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/config/InfConfigDO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/config/ConfigDO.java
| @@ -13,11 +13,11 @@ import lombok.ToString; | @@ -13,11 +13,11 @@ import lombok.ToString; | ||
| 13 | * | 13 | * |
| 14 | * @author 芋道源码 | 14 | * @author 芋道源码 |
| 15 | */ | 15 | */ |
| 16 | -@TableName("inf_config") | 16 | +@TableName("infra_config") |
| 17 | @Data | 17 | @Data |
| 18 | @EqualsAndHashCode(callSuper = true) | 18 | @EqualsAndHashCode(callSuper = true) |
| 19 | @ToString(callSuper = true) | 19 | @ToString(callSuper = true) |
| 20 | -public class InfConfigDO extends BaseDO { | 20 | +public class ConfigDO extends BaseDO { |
| 21 | 21 | ||
| 22 | /** | 22 | /** |
| 23 | * 参数主键 | 23 | * 参数主键 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/InfFileDO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/FileDO.java
| 1 | package cn.iocoder.yudao.module.infra.dal.dataobject.file; | 1 | package cn.iocoder.yudao.module.infra.dal.dataobject.file; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; | 3 | import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; |
| 5 | import com.baomidou.mybatisplus.annotation.IdType; | 4 | import com.baomidou.mybatisplus.annotation.IdType; |
| 6 | import com.baomidou.mybatisplus.annotation.TableField; | 5 | import com.baomidou.mybatisplus.annotation.TableField; |
| @@ -16,13 +15,13 @@ import java.io.InputStream; | @@ -16,13 +15,13 @@ import java.io.InputStream; | ||
| 16 | * @author 芋道源码 | 15 | * @author 芋道源码 |
| 17 | */ | 16 | */ |
| 18 | @Data | 17 | @Data |
| 19 | -@TableName("inf_file") | 18 | +@TableName("infra_file") |
| 20 | @EqualsAndHashCode(callSuper = true) | 19 | @EqualsAndHashCode(callSuper = true) |
| 21 | @ToString(callSuper = true) | 20 | @ToString(callSuper = true) |
| 22 | @Builder | 21 | @Builder |
| 23 | @NoArgsConstructor | 22 | @NoArgsConstructor |
| 24 | @AllArgsConstructor | 23 | @AllArgsConstructor |
| 25 | -public class InfFileDO extends TenantBaseDO { | 24 | +public class FileDO extends TenantBaseDO { |
| 26 | 25 | ||
| 27 | /** | 26 | /** |
| 28 | * 文件路径 | 27 | * 文件路径 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/InfJobDO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/JobDO.java
| 1 | package cn.iocoder.yudao.module.infra.dal.dataobject.job; | 1 | package cn.iocoder.yudao.module.infra.dal.dataobject.job; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.module.infra.enums.job.InfJobStatusEnum; | 4 | +import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum; |
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | import lombok.*; | 7 | import lombok.*; |
| @@ -11,14 +11,14 @@ import lombok.*; | @@ -11,14 +11,14 @@ import lombok.*; | ||
| 11 | * | 11 | * |
| 12 | * @author 芋道源码 | 12 | * @author 芋道源码 |
| 13 | */ | 13 | */ |
| 14 | -@TableName("inf_job") | 14 | +@TableName("infra_job") |
| 15 | @Data | 15 | @Data |
| 16 | @EqualsAndHashCode(callSuper = true) | 16 | @EqualsAndHashCode(callSuper = true) |
| 17 | @ToString(callSuper = true) | 17 | @ToString(callSuper = true) |
| 18 | @Builder | 18 | @Builder |
| 19 | @NoArgsConstructor | 19 | @NoArgsConstructor |
| 20 | @AllArgsConstructor | 20 | @AllArgsConstructor |
| 21 | -public class InfJobDO extends BaseDO { | 21 | +public class JobDO extends BaseDO { |
| 22 | 22 | ||
| 23 | /** | 23 | /** |
| 24 | * 任务编号 | 24 | * 任务编号 |
| @@ -32,7 +32,7 @@ public class InfJobDO extends BaseDO { | @@ -32,7 +32,7 @@ public class InfJobDO extends BaseDO { | ||
| 32 | /** | 32 | /** |
| 33 | * 任务状态 | 33 | * 任务状态 |
| 34 | * | 34 | * |
| 35 | - * 枚举 {@link InfJobStatusEnum} | 35 | + * 枚举 {@link JobStatusEnum} |
| 36 | */ | 36 | */ |
| 37 | private Integer status; | 37 | private Integer status; |
| 38 | /** | 38 | /** |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/InfJobLogDO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/JobLogDO.java
| @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.dataobject.job; | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.dataobject.job; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; | 4 | import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; |
| 5 | -import cn.iocoder.yudao.module.infra.enums.job.InfJobLogStatusEnum; | 5 | +import cn.iocoder.yudao.module.infra.enums.job.JobLogStatusEnum; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | import lombok.*; | 7 | import lombok.*; |
| 8 | 8 | ||
| @@ -13,14 +13,14 @@ import java.util.Date; | @@ -13,14 +13,14 @@ import java.util.Date; | ||
| 13 | * | 13 | * |
| 14 | * @author 芋道源码 | 14 | * @author 芋道源码 |
| 15 | */ | 15 | */ |
| 16 | -@TableName("inf_job_log") | 16 | +@TableName("infra_job_log") |
| 17 | @Data | 17 | @Data |
| 18 | @EqualsAndHashCode(callSuper = true) | 18 | @EqualsAndHashCode(callSuper = true) |
| 19 | @ToString(callSuper = true) | 19 | @ToString(callSuper = true) |
| 20 | @Builder | 20 | @Builder |
| 21 | @NoArgsConstructor | 21 | @NoArgsConstructor |
| 22 | @AllArgsConstructor | 22 | @AllArgsConstructor |
| 23 | -public class InfJobLogDO extends BaseDO { | 23 | +public class JobLogDO extends BaseDO { |
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| 26 | * 日志编号 | 26 | * 日志编号 |
| @@ -29,19 +29,19 @@ public class InfJobLogDO extends BaseDO { | @@ -29,19 +29,19 @@ public class InfJobLogDO extends BaseDO { | ||
| 29 | /** | 29 | /** |
| 30 | * 任务编号 | 30 | * 任务编号 |
| 31 | * | 31 | * |
| 32 | - * 关联 {@link InfJobDO#getId()} | 32 | + * 关联 {@link JobDO#getId()} |
| 33 | */ | 33 | */ |
| 34 | private Long jobId; | 34 | private Long jobId; |
| 35 | /** | 35 | /** |
| 36 | * 处理器的名字 | 36 | * 处理器的名字 |
| 37 | * | 37 | * |
| 38 | - * 冗余字段 {@link InfJobDO#getHandlerName()} | 38 | + * 冗余字段 {@link JobDO#getHandlerName()} |
| 39 | */ | 39 | */ |
| 40 | private String handlerName; | 40 | private String handlerName; |
| 41 | /** | 41 | /** |
| 42 | * 处理器的参数 | 42 | * 处理器的参数 |
| 43 | * | 43 | * |
| 44 | - * 冗余字段 {@link InfJobDO#getHandlerParam()} | 44 | + * 冗余字段 {@link JobDO#getHandlerParam()} |
| 45 | */ | 45 | */ |
| 46 | private String handlerParam; | 46 | private String handlerParam; |
| 47 | /** | 47 | /** |
| @@ -66,7 +66,7 @@ public class InfJobLogDO extends BaseDO { | @@ -66,7 +66,7 @@ public class InfJobLogDO extends BaseDO { | ||
| 66 | /** | 66 | /** |
| 67 | * 状态 | 67 | * 状态 |
| 68 | * | 68 | * |
| 69 | - * 枚举 {@link InfJobLogStatusEnum} | 69 | + * 枚举 {@link JobLogStatusEnum} |
| 70 | */ | 70 | */ |
| 71 | private Integer status; | 71 | private Integer status; |
| 72 | /** | 72 | /** |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/InfApiAccessLogDO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiAccessLogDO.java
| @@ -14,14 +14,14 @@ import java.util.Date; | @@ -14,14 +14,14 @@ import java.util.Date; | ||
| 14 | * | 14 | * |
| 15 | * @author 芋道源码 | 15 | * @author 芋道源码 |
| 16 | */ | 16 | */ |
| 17 | -@TableName("inf_api_access_log") | 17 | +@TableName("infra_api_access_log") |
| 18 | @Data | 18 | @Data |
| 19 | @EqualsAndHashCode(callSuper = true) | 19 | @EqualsAndHashCode(callSuper = true) |
| 20 | @ToString(callSuper = true) | 20 | @ToString(callSuper = true) |
| 21 | @Builder | 21 | @Builder |
| 22 | @NoArgsConstructor | 22 | @NoArgsConstructor |
| 23 | @AllArgsConstructor | 23 | @AllArgsConstructor |
| 24 | -public class InfApiAccessLogDO extends TenantBaseDO { | 24 | +public class ApiAccessLogDO extends TenantBaseDO { |
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * 编号 | 27 | * 编号 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/InfApiErrorLogDO.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiErrorLogDO.java
| 1 | package cn.iocoder.yudao.module.infra.dal.dataobject.logger; | 1 | package cn.iocoder.yudao.module.infra.dal.dataobject.logger; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum; | ||
| 4 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 5 | import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; | 4 | import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; |
| 6 | import com.baomidou.mybatisplus.annotation.TableId; | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
| @@ -14,14 +13,14 @@ import java.util.Date; | @@ -14,14 +13,14 @@ import java.util.Date; | ||
| 14 | * | 13 | * |
| 15 | * @author 芋道源码 | 14 | * @author 芋道源码 |
| 16 | */ | 15 | */ |
| 17 | -@TableName("inf_api_error_log") | 16 | +@TableName("infra_api_error_log") |
| 18 | @Data | 17 | @Data |
| 19 | @EqualsAndHashCode(callSuper = true) | 18 | @EqualsAndHashCode(callSuper = true) |
| 20 | @ToString(callSuper = true) | 19 | @ToString(callSuper = true) |
| 21 | @Builder | 20 | @Builder |
| 22 | @NoArgsConstructor | 21 | @NoArgsConstructor |
| 23 | @AllArgsConstructor | 22 | @AllArgsConstructor |
| 24 | -public class InfApiErrorLogDO extends TenantBaseDO { | 23 | +public class ApiErrorLogDO extends TenantBaseDO { |
| 25 | 24 | ||
| 26 | /** | 25 | /** |
| 27 | * 编号 | 26 | * 编号 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/InfConfigCoreDAOImpl.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigCoreDAOImpl.java
| @@ -16,11 +16,11 @@ import java.util.List; | @@ -16,11 +16,11 @@ import java.util.List; | ||
| 16 | * | 16 | * |
| 17 | * @author 芋道源码 | 17 | * @author 芋道源码 |
| 18 | */ | 18 | */ |
| 19 | -public class InfConfigCoreDAOImpl implements ConfigFrameworkDAO { | 19 | +public class ConfigCoreDAOImpl implements ConfigFrameworkDAO { |
| 20 | 20 | ||
| 21 | private final JdbcTemplate jdbcTemplate; | 21 | private final JdbcTemplate jdbcTemplate; |
| 22 | 22 | ||
| 23 | - public InfConfigCoreDAOImpl(String jdbcUrl, String username, String password) { | 23 | + public ConfigCoreDAOImpl(String jdbcUrl, String username, String password) { |
| 24 | DataSource dataSource = new DriverManagerDataSource(jdbcUrl, username, password); | 24 | DataSource dataSource = new DriverManagerDataSource(jdbcUrl, username, password); |
| 25 | this.jdbcTemplate = new JdbcTemplate(dataSource); | 25 | this.jdbcTemplate = new JdbcTemplate(dataSource); |
| 26 | } | 26 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/InfConfigMapper.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigMapper.java
| 1 | package cn.iocoder.yudao.module.infra.dal.mysql.config; | 1 | package cn.iocoder.yudao.module.infra.dal.mysql.config; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; |
| 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; | 6 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; |
| 8 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; | 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; |
| 8 | +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; | ||
| 9 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 9 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 10 | import org.apache.ibatis.annotations.Mapper; | 10 | import org.apache.ibatis.annotations.Mapper; |
| 11 | 11 | ||
| 12 | import java.util.List; | 12 | import java.util.List; |
| 13 | 13 | ||
| 14 | @Mapper | 14 | @Mapper |
| 15 | -public interface InfConfigMapper extends BaseMapperX<InfConfigDO> { | 15 | +public interface ConfigMapper extends BaseMapperX<ConfigDO> { |
| 16 | 16 | ||
| 17 | - default InfConfigDO selectByKey(String key) { | ||
| 18 | - return selectOne(new QueryWrapper<InfConfigDO>().eq("`key`", key)); | 17 | + default ConfigDO selectByKey(String key) { |
| 18 | + return selectOne(new QueryWrapper<ConfigDO>().eq("`key`", key)); | ||
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | - default PageResult<InfConfigDO> selectPage(ConfigPageReqVO reqVO) { | ||
| 22 | - return selectPage(reqVO, new QueryWrapperX<InfConfigDO>() | 21 | + default PageResult<ConfigDO> selectPage(ConfigPageReqVO reqVO) { |
| 22 | + return selectPage(reqVO, new QueryWrapperX<ConfigDO>() | ||
| 23 | .likeIfPresent("name", reqVO.getName()) | 23 | .likeIfPresent("name", reqVO.getName()) |
| 24 | .likeIfPresent("`key`", reqVO.getKey()) | 24 | .likeIfPresent("`key`", reqVO.getKey()) |
| 25 | .eqIfPresent("`type`", reqVO.getType()) | 25 | .eqIfPresent("`type`", reqVO.getType()) |
| 26 | .betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime())); | 26 | .betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime())); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | - default List<InfConfigDO> selectList(ConfigExportReqVO reqVO) { | ||
| 30 | - return selectList(new QueryWrapperX<InfConfigDO>() | 29 | + default List<ConfigDO> selectList(ConfigExportReqVO reqVO) { |
| 30 | + return selectList(new QueryWrapperX<ConfigDO>() | ||
| 31 | .likeIfPresent("name", reqVO.getName()) | 31 | .likeIfPresent("name", reqVO.getName()) |
| 32 | .likeIfPresent("`key`", reqVO.getKey()) | 32 | .likeIfPresent("`key`", reqVO.getKey()) |
| 33 | .eqIfPresent("`type`", reqVO.getType()) | 33 | .eqIfPresent("`type`", reqVO.getType()) |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/InfFileCoreMapper.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileMapper.java
| 1 | package cn.iocoder.yudao.module.infra.dal.mysql.file; | 1 | package cn.iocoder.yudao.module.infra.dal.mysql.file; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; | 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; |
| 6 | +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; | ||
| 5 | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; | 8 | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| 6 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 7 | 10 | ||
| 11 | +/** | ||
| 12 | + * 文件操作 Mapper | ||
| 13 | + * | ||
| 14 | + * @author 芋道源码 | ||
| 15 | + */ | ||
| 8 | @Mapper | 16 | @Mapper |
| 9 | -public interface InfFileCoreMapper extends BaseMapperX<InfFileDO> { | 17 | +public interface FileMapper extends BaseMapperX<FileDO> { |
| 18 | + | ||
| 19 | + default PageResult<FileDO> selectPage(FilePageReqVO reqVO) { | ||
| 20 | + return selectPage(reqVO, new QueryWrapperX<FileDO>() | ||
| 21 | + .likeIfPresent("id", reqVO.getId()) | ||
| 22 | + .likeIfPresent("type", reqVO.getType()) | ||
| 23 | + .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | ||
| 24 | + .orderByDesc("create_time")); | ||
| 25 | + } | ||
| 10 | 26 | ||
| 11 | default Integer selectCountById(String id) { | 27 | default Integer selectCountById(String id) { |
| 12 | - return selectCount(InfFileDO::getId, id); | 28 | + return selectCount(FileDO::getId, id); |
| 13 | } | 29 | } |
| 14 | 30 | ||
| 15 | /** | 31 | /** |
| @@ -21,7 +37,7 @@ public interface InfFileCoreMapper extends BaseMapperX<InfFileDO> { | @@ -21,7 +37,7 @@ public interface InfFileCoreMapper extends BaseMapperX<InfFileDO> { | ||
| 21 | * @return 文件 | 37 | * @return 文件 |
| 22 | */ | 38 | */ |
| 23 | @InterceptorIgnore(tenantLine = "true") | 39 | @InterceptorIgnore(tenantLine = "true") |
| 24 | - default InfFileDO selectByPath(String path) { | 40 | + default FileDO selectByPath(String path) { |
| 25 | return selectById(path); | 41 | return selectById(path); |
| 26 | } | 42 | } |
| 27 | 43 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/InfFileMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.file; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO; | ||
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; | ||
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | ||
| 8 | -import org.apache.ibatis.annotations.Mapper; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * admin 文件操作 Mapper | ||
| 12 | - * | ||
| 13 | - * @author 芋道源码 | ||
| 14 | - */ | ||
| 15 | -@Mapper | ||
| 16 | -public interface InfFileMapper extends BaseMapperX<InfFileDO> { | ||
| 17 | - default PageResult<InfFileDO> selectPage(InfFilePageReqVO reqVO) { | ||
| 18 | - return selectPage(reqVO, new QueryWrapperX<InfFileDO>() | ||
| 19 | - .likeIfPresent("id", reqVO.getId()) | ||
| 20 | - .likeIfPresent("type", reqVO.getType()) | ||
| 21 | - .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | ||
| 22 | - .orderByDesc("create_time")); | ||
| 23 | - } | ||
| 24 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/InfJobLogMapper.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobLogMapper.java
| @@ -3,9 +3,9 @@ package cn.iocoder.yudao.module.infra.dal.mysql.job; | @@ -3,9 +3,9 @@ package cn.iocoder.yudao.module.infra.dal.mysql.job; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO; | ||
| 8 | -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO; | 6 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; |
| 7 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; | ||
| 9 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | ||
| 11 | import java.util.List; | 11 | import java.util.List; |
| @@ -16,10 +16,10 @@ import java.util.List; | @@ -16,10 +16,10 @@ import java.util.List; | ||
| 16 | * @author 芋道源码 | 16 | * @author 芋道源码 |
| 17 | */ | 17 | */ |
| 18 | @Mapper | 18 | @Mapper |
| 19 | -public interface InfJobLogMapper extends BaseMapperX<InfJobLogDO> { | 19 | +public interface JobLogMapper extends BaseMapperX<JobLogDO> { |
| 20 | 20 | ||
| 21 | - default PageResult<InfJobLogDO> selectPage(InfJobLogPageReqVO reqVO) { | ||
| 22 | - return selectPage(reqVO, new QueryWrapperX<InfJobLogDO>() | 21 | + default PageResult<JobLogDO> selectPage(JobLogPageReqVO reqVO) { |
| 22 | + return selectPage(reqVO, new QueryWrapperX<JobLogDO>() | ||
| 23 | .eqIfPresent("job_id", reqVO.getJobId()) | 23 | .eqIfPresent("job_id", reqVO.getJobId()) |
| 24 | .likeIfPresent("handler_name", reqVO.getHandlerName()) | 24 | .likeIfPresent("handler_name", reqVO.getHandlerName()) |
| 25 | .geIfPresent("begin_time", reqVO.getBeginTime()) | 25 | .geIfPresent("begin_time", reqVO.getBeginTime()) |
| @@ -29,8 +29,8 @@ public interface InfJobLogMapper extends BaseMapperX<InfJobLogDO> { | @@ -29,8 +29,8 @@ public interface InfJobLogMapper extends BaseMapperX<InfJobLogDO> { | ||
| 29 | ); | 29 | ); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | - default List<InfJobLogDO> selectList(InfJobLogExportReqVO reqVO) { | ||
| 33 | - return selectList(new QueryWrapperX<InfJobLogDO>() | 32 | + default List<JobLogDO> selectList(JobLogExportReqVO reqVO) { |
| 33 | + return selectList(new QueryWrapperX<JobLogDO>() | ||
| 34 | .eqIfPresent("job_id", reqVO.getJobId()) | 34 | .eqIfPresent("job_id", reqVO.getJobId()) |
| 35 | .likeIfPresent("handler_name", reqVO.getHandlerName()) | 35 | .likeIfPresent("handler_name", reqVO.getHandlerName()) |
| 36 | .geIfPresent("begin_time", reqVO.getBeginTime()) | 36 | .geIfPresent("begin_time", reqVO.getBeginTime()) |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/InfJobMapper.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobMapper.java
| 1 | package cn.iocoder.yudao.module.infra.dal.mysql.job; | 1 | package cn.iocoder.yudao.module.infra.dal.mysql.job; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExportReqVO; | ||
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobPageReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO; | 3 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO; |
| 4 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; | ||
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 7 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 8 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 8 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| @@ -16,25 +16,25 @@ import java.util.List; | @@ -16,25 +16,25 @@ import java.util.List; | ||
| 16 | * @author 芋道源码 | 16 | * @author 芋道源码 |
| 17 | */ | 17 | */ |
| 18 | @Mapper | 18 | @Mapper |
| 19 | -public interface InfJobMapper extends BaseMapperX<InfJobDO> { | 19 | +public interface JobMapper extends BaseMapperX<JobDO> { |
| 20 | 20 | ||
| 21 | - default InfJobDO selectByHandlerName(String handlerName) { | ||
| 22 | - return selectOne(InfJobDO::getHandlerName, handlerName); | 21 | + default JobDO selectByHandlerName(String handlerName) { |
| 22 | + return selectOne(JobDO::getHandlerName, handlerName); | ||
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | - default PageResult<InfJobDO> selectPage(InfJobPageReqVO reqVO) { | ||
| 26 | - return selectPage(reqVO, new LambdaQueryWrapperX<InfJobDO>() | ||
| 27 | - .likeIfPresent(InfJobDO::getName, reqVO.getName()) | ||
| 28 | - .eqIfPresent(InfJobDO::getStatus, reqVO.getStatus()) | ||
| 29 | - .likeIfPresent(InfJobDO::getHandlerName, reqVO.getHandlerName()) | 25 | + default PageResult<JobDO> selectPage(JobPageReqVO reqVO) { |
| 26 | + return selectPage(reqVO, new LambdaQueryWrapperX<JobDO>() | ||
| 27 | + .likeIfPresent(JobDO::getName, reqVO.getName()) | ||
| 28 | + .eqIfPresent(JobDO::getStatus, reqVO.getStatus()) | ||
| 29 | + .likeIfPresent(JobDO::getHandlerName, reqVO.getHandlerName()) | ||
| 30 | ); | 30 | ); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | - default List<InfJobDO> selectList(InfJobExportReqVO reqVO) { | ||
| 34 | - return selectList(new LambdaQueryWrapperX<InfJobDO>() | ||
| 35 | - .likeIfPresent(InfJobDO::getName, reqVO.getName()) | ||
| 36 | - .eqIfPresent(InfJobDO::getStatus, reqVO.getStatus()) | ||
| 37 | - .likeIfPresent(InfJobDO::getHandlerName, reqVO.getHandlerName()) | 33 | + default List<JobDO> selectList(JobExportReqVO reqVO) { |
| 34 | + return selectList(new LambdaQueryWrapperX<JobDO>() | ||
| 35 | + .likeIfPresent(JobDO::getName, reqVO.getName()) | ||
| 36 | + .eqIfPresent(JobDO::getStatus, reqVO.getStatus()) | ||
| 37 | + .likeIfPresent(JobDO::getHandlerName, reqVO.getHandlerName()) | ||
| 38 | ); | 38 | ); |
| 39 | } | 39 | } |
| 40 | 40 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiAccessLogMapper.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java
| 1 | package cn.iocoder.yudao.module.infra.dal.mysql.logger; | 1 | package cn.iocoder.yudao.module.infra.dal.mysql.logger; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; | ||
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; | ||
| 5 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | 3 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO; |
| 4 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; | ||
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 6 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 8 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | 7 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; |
| 8 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; | ||
| 9 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | ||
| 11 | import java.util.List; | 11 | import java.util.List; |
| @@ -16,10 +16,10 @@ import java.util.List; | @@ -16,10 +16,10 @@ import java.util.List; | ||
| 16 | * @author 芋道源码 | 16 | * @author 芋道源码 |
| 17 | */ | 17 | */ |
| 18 | @Mapper | 18 | @Mapper |
| 19 | -public interface InfApiAccessLogMapper extends BaseMapperX<InfApiAccessLogDO> { | 19 | +public interface ApiAccessLogMapper extends BaseMapperX<ApiAccessLogDO> { |
| 20 | 20 | ||
| 21 | - default PageResult<InfApiAccessLogDO> selectPage(InfApiAccessLogPageReqVO reqVO) { | ||
| 22 | - return selectPage(reqVO, new QueryWrapperX<InfApiAccessLogDO>() | 21 | + default PageResult<ApiAccessLogDO> selectPage(ApiAccessLogPageReqVO reqVO) { |
| 22 | + return selectPage(reqVO, new QueryWrapperX<ApiAccessLogDO>() | ||
| 23 | .eqIfPresent("user_id", reqVO.getUserId()) | 23 | .eqIfPresent("user_id", reqVO.getUserId()) |
| 24 | .eqIfPresent("user_type", reqVO.getUserType()) | 24 | .eqIfPresent("user_type", reqVO.getUserType()) |
| 25 | .eqIfPresent("application_name", reqVO.getApplicationName()) | 25 | .eqIfPresent("application_name", reqVO.getApplicationName()) |
| @@ -31,8 +31,8 @@ public interface InfApiAccessLogMapper extends BaseMapperX<InfApiAccessLogDO> { | @@ -31,8 +31,8 @@ public interface InfApiAccessLogMapper extends BaseMapperX<InfApiAccessLogDO> { | ||
| 31 | ); | 31 | ); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | - default List<InfApiAccessLogDO> selectList(InfApiAccessLogExportReqVO reqVO) { | ||
| 35 | - return selectList(new QueryWrapperX<InfApiAccessLogDO>() | 34 | + default List<ApiAccessLogDO> selectList(ApiAccessLogExportReqVO reqVO) { |
| 35 | + return selectList(new QueryWrapperX<ApiAccessLogDO>() | ||
| 36 | .eqIfPresent("user_id", reqVO.getUserId()) | 36 | .eqIfPresent("user_id", reqVO.getUserId()) |
| 37 | .eqIfPresent("user_type", reqVO.getUserType()) | 37 | .eqIfPresent("user_type", reqVO.getUserType()) |
| 38 | .eqIfPresent("application_name", reqVO.getApplicationName()) | 38 | .eqIfPresent("application_name", reqVO.getApplicationName()) |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiErrorLogMapper.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java
| 1 | package cn.iocoder.yudao.module.infra.dal.mysql.logger; | 1 | package cn.iocoder.yudao.module.infra.dal.mysql.logger; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; |
| 7 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExportReqVO; | ||
| 8 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogPageReqVO; | 6 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO; |
| 7 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; | ||
| 9 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | ||
| 11 | import java.util.List; | 11 | import java.util.List; |
| @@ -16,10 +16,10 @@ import java.util.List; | @@ -16,10 +16,10 @@ import java.util.List; | ||
| 16 | * @author 芋道源码 | 16 | * @author 芋道源码 |
| 17 | */ | 17 | */ |
| 18 | @Mapper | 18 | @Mapper |
| 19 | -public interface InfApiErrorLogMapper extends BaseMapperX<InfApiErrorLogDO> { | 19 | +public interface ApiErrorLogMapper extends BaseMapperX<ApiErrorLogDO> { |
| 20 | 20 | ||
| 21 | - default PageResult<InfApiErrorLogDO> selectPage(InfApiErrorLogPageReqVO reqVO) { | ||
| 22 | - return selectPage(reqVO, new QueryWrapperX<InfApiErrorLogDO>() | 21 | + default PageResult<ApiErrorLogDO> selectPage(ApiErrorLogPageReqVO reqVO) { |
| 22 | + return selectPage(reqVO, new QueryWrapperX<ApiErrorLogDO>() | ||
| 23 | .eqIfPresent("user_id", reqVO.getUserId()) | 23 | .eqIfPresent("user_id", reqVO.getUserId()) |
| 24 | .eqIfPresent("user_type", reqVO.getUserType()) | 24 | .eqIfPresent("user_type", reqVO.getUserType()) |
| 25 | .eqIfPresent("application_name", reqVO.getApplicationName()) | 25 | .eqIfPresent("application_name", reqVO.getApplicationName()) |
| @@ -30,8 +30,8 @@ public interface InfApiErrorLogMapper extends BaseMapperX<InfApiErrorLogDO> { | @@ -30,8 +30,8 @@ public interface InfApiErrorLogMapper extends BaseMapperX<InfApiErrorLogDO> { | ||
| 30 | ); | 30 | ); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | - default List<InfApiErrorLogDO> selectList(InfApiErrorLogExportReqVO reqVO) { | ||
| 34 | - return selectList(new QueryWrapperX<InfApiErrorLogDO>() | 33 | + default List<ApiErrorLogDO> selectList(ApiErrorLogExportReqVO reqVO) { |
| 34 | + return selectList(new QueryWrapperX<ApiErrorLogDO>() | ||
| 35 | .eqIfPresent("user_id", reqVO.getUserId()) | 35 | .eqIfPresent("user_id", reqVO.getUserId()) |
| 36 | .eqIfPresent("user_type", reqVO.getUserType()) | 36 | .eqIfPresent("user_type", reqVO.getUserType()) |
| 37 | .eqIfPresent("application_name", reqVO.getApplicationName()) | 37 | .eqIfPresent("application_name", reqVO.getApplicationName()) |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiAccessLogCoreMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.logger; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | ||
| 5 | -import org.apache.ibatis.annotations.Mapper; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * API 访问日志 Mapper | ||
| 9 | - * | ||
| 10 | - * @author 芋道源码 | ||
| 11 | - */ | ||
| 12 | -@Mapper | ||
| 13 | -public interface InfApiAccessLogCoreMapper extends BaseMapperX<InfApiAccessLogDO> { | ||
| 14 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiErrorLogCoreMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.dal.mysql.logger; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; | ||
| 5 | -import org.apache.ibatis.annotations.Mapper; | ||
| 6 | - | ||
| 7 | -@Mapper | ||
| 8 | -public interface InfApiErrorLogCoreMapper extends BaseMapperX<InfApiErrorLogDO> { | ||
| 9 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/SysErrorCodeConstants.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.enums; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.common.exception.ErrorCode; | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | - * System 错误码枚举类 | ||
| 7 | - * | ||
| 8 | - * system 系统,使用 1-006-000-000 段 | ||
| 9 | - */ | ||
| 10 | -public interface SysErrorCodeConstants { | ||
| 11 | - | ||
| 12 | - // ========= 文件相关 1006001000================= | ||
| 13 | - ErrorCode FILE_PATH_EXISTS = new ErrorCode(1006001000, "文件路径已存在"); | ||
| 14 | - ErrorCode FILE_NOT_EXISTS = new ErrorCode(1006001002, "文件不存在"); | ||
| 15 | - | ||
| 16 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/config/InfConfigTypeEnum.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/config/ConfigTypeEnum.java
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/InfJobLogStatusEnum.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/JobLogStatusEnum.java
| @@ -10,7 +10,7 @@ import lombok.Getter; | @@ -10,7 +10,7 @@ import lombok.Getter; | ||
| 10 | */ | 10 | */ |
| 11 | @Getter | 11 | @Getter |
| 12 | @AllArgsConstructor | 12 | @AllArgsConstructor |
| 13 | -public enum InfJobLogStatusEnum { | 13 | +public enum JobLogStatusEnum { |
| 14 | 14 | ||
| 15 | RUNNING(0), // 运行中 | 15 | RUNNING(0), // 运行中 |
| 16 | SUCCESS(1), // 成功 | 16 | SUCCESS(1), // 成功 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/InfJobStatusEnum.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/JobStatusEnum.java
| @@ -3,12 +3,11 @@ package cn.iocoder.yudao.module.infra.enums.job; | @@ -3,12 +3,11 @@ package cn.iocoder.yudao.module.infra.enums.job; | ||
| 3 | import com.google.common.collect.Sets; | 3 | import com.google.common.collect.Sets; |
| 4 | import lombok.AllArgsConstructor; | 4 | import lombok.AllArgsConstructor; |
| 5 | import lombok.Getter; | 5 | import lombok.Getter; |
| 6 | +import org.quartz.impl.jdbcjobstore.Constants; | ||
| 6 | 7 | ||
| 7 | import java.util.Collections; | 8 | import java.util.Collections; |
| 8 | import java.util.Set; | 9 | import java.util.Set; |
| 9 | 10 | ||
| 10 | -import static org.quartz.impl.jdbcjobstore.Constants.*; | ||
| 11 | - | ||
| 12 | /** | 11 | /** |
| 13 | * 任务状态的枚举 | 12 | * 任务状态的枚举 |
| 14 | * | 13 | * |
| @@ -16,7 +15,7 @@ import static org.quartz.impl.jdbcjobstore.Constants.*; | @@ -16,7 +15,7 @@ import static org.quartz.impl.jdbcjobstore.Constants.*; | ||
| 16 | */ | 15 | */ |
| 17 | @Getter | 16 | @Getter |
| 18 | @AllArgsConstructor | 17 | @AllArgsConstructor |
| 19 | -public enum InfJobStatusEnum { | 18 | +public enum JobStatusEnum { |
| 20 | 19 | ||
| 21 | /** | 20 | /** |
| 22 | * 初始化中 | 21 | * 初始化中 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/logger/InfApiErrorLogProcessStatusEnum.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/logger/ApiErrorLogProcessStatusEnum.java
| @@ -10,7 +10,7 @@ import lombok.Getter; | @@ -10,7 +10,7 @@ import lombok.Getter; | ||
| 10 | */ | 10 | */ |
| 11 | @AllArgsConstructor | 11 | @AllArgsConstructor |
| 12 | @Getter | 12 | @Getter |
| 13 | -public enum InfApiErrorLogProcessStatusEnum { | 13 | +public enum ApiErrorLogProcessStatusEnum { |
| 14 | 14 | ||
| 15 | INIT(0, "未处理"), | 15 | INIT(0, "未处理"), |
| 16 | DONE(1, "已处理"), | 16 | DONE(1, "已处理"), |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/file/config/FileConfiguration.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/file/config/FileConfiguration.java
| 1 | -package cn.iocoder.yudao.module.infra.file.config; | 1 | +package cn.iocoder.yudao.module.infra.framework.file.config; |
| 2 | 2 | ||
| 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; | 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| 4 | import org.springframework.context.annotation.Configuration; | 4 | import org.springframework.context.annotation.Configuration; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/file/config/FileProperties.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/file/config/FileProperties.java
| 1 | -package cn.iocoder.yudao.module.infra.file.config; | 1 | +package cn.iocoder.yudao.module.infra.framework.file.config; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | import org.springframework.boot.context.properties.ConfigurationProperties; | 4 | import org.springframework.boot.context.properties.ConfigurationProperties; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/file/package-info.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/file/package-info.java
| @@ -13,4 +13,4 @@ | @@ -13,4 +13,4 @@ | ||
| 13 | * 综合考虑,暂时使用方案 3 的方式,比较适合这样一个 all in one 的项目。 | 13 | * 综合考虑,暂时使用方案 3 的方式,比较适合这样一个 all in one 的项目。 |
| 14 | * 随着文件的量级大了之后,还是推荐采用云服务。 | 14 | * 随着文件的量级大了之后,还是推荐采用云服务。 |
| 15 | */ | 15 | */ |
| 16 | -package cn.iocoder.yudao.coreservice.modules.infra.framework.file; | 16 | +package cn.iocoder.yudao.module.infra.framework.file; |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/consumer/config/InfConfigRefreshConsumer.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/consumer/config/ConfigRefreshConsumer.java
| @@ -2,21 +2,21 @@ package cn.iocoder.yudao.module.infra.mq.consumer.config; | @@ -2,21 +2,21 @@ package cn.iocoder.yudao.module.infra.mq.consumer.config; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.apollo.internals.DBConfigRepository; | 3 | import cn.iocoder.yudao.framework.apollo.internals.DBConfigRepository; |
| 4 | import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; | 4 | import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; |
| 5 | -import cn.iocoder.yudao.module.infra.mq.message.config.InfConfigRefreshMessage; | 5 | +import cn.iocoder.yudao.module.infra.mq.message.config.ConfigRefreshMessage; |
| 6 | import lombok.extern.slf4j.Slf4j; | 6 | import lombok.extern.slf4j.Slf4j; |
| 7 | import org.springframework.stereotype.Component; | 7 | import org.springframework.stereotype.Component; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | - * 针对 {@link InfConfigRefreshMessage} 的消费者 | 10 | + * 针对 {@link ConfigRefreshMessage} 的消费者 |
| 11 | * | 11 | * |
| 12 | * @author 芋道源码 | 12 | * @author 芋道源码 |
| 13 | */ | 13 | */ |
| 14 | @Component | 14 | @Component |
| 15 | @Slf4j | 15 | @Slf4j |
| 16 | -public class InfConfigRefreshConsumer extends AbstractChannelMessageListener<InfConfigRefreshMessage> { | 16 | +public class ConfigRefreshConsumer extends AbstractChannelMessageListener<ConfigRefreshMessage> { |
| 17 | 17 | ||
| 18 | @Override | 18 | @Override |
| 19 | - public void onMessage(InfConfigRefreshMessage message) { | 19 | + public void onMessage(ConfigRefreshMessage message) { |
| 20 | log.info("[onMessage][收到 Config 刷新消息]"); | 20 | log.info("[onMessage][收到 Config 刷新消息]"); |
| 21 | DBConfigRepository.noticeSync(); | 21 | DBConfigRepository.noticeSync(); |
| 22 | } | 22 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/message/config/InfConfigRefreshMessage.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/message/config/ConfigRefreshMessage.java
| @@ -7,7 +7,7 @@ import lombok.Data; | @@ -7,7 +7,7 @@ import lombok.Data; | ||
| 7 | * 配置数据刷新 Message | 7 | * 配置数据刷新 Message |
| 8 | */ | 8 | */ |
| 9 | @Data | 9 | @Data |
| 10 | -public class InfConfigRefreshMessage extends AbstractChannelMessage { | 10 | +public class ConfigRefreshMessage extends AbstractChannelMessage { |
| 11 | 11 | ||
| 12 | @Override | 12 | @Override |
| 13 | public String getChannel() { | 13 | public String getChannel() { |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/producer/config/InfConfigProducer.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/producer/config/ConfigProducer.java
| 1 | package cn.iocoder.yudao.module.infra.mq.producer.config; | 1 | package cn.iocoder.yudao.module.infra.mq.producer.config; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.infra.mq.message.config.InfConfigRefreshMessage; | 3 | +import cn.iocoder.yudao.module.infra.mq.message.config.ConfigRefreshMessage; |
| 4 | import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; | 4 | import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; |
| 5 | import org.springframework.stereotype.Component; | 5 | import org.springframework.stereotype.Component; |
| 6 | 6 | ||
| @@ -10,16 +10,16 @@ import javax.annotation.Resource; | @@ -10,16 +10,16 @@ import javax.annotation.Resource; | ||
| 10 | * Config 配置相关消息的 Producer | 10 | * Config 配置相关消息的 Producer |
| 11 | */ | 11 | */ |
| 12 | @Component | 12 | @Component |
| 13 | -public class InfConfigProducer { | 13 | +public class ConfigProducer { |
| 14 | 14 | ||
| 15 | @Resource | 15 | @Resource |
| 16 | private RedisMQTemplate redisMQTemplate; | 16 | private RedisMQTemplate redisMQTemplate; |
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | - * 发送 {@link InfConfigRefreshMessage} 消息 | 19 | + * 发送 {@link ConfigRefreshMessage} 消息 |
| 20 | */ | 20 | */ |
| 21 | public void sendConfigRefreshMessage() { | 21 | public void sendConfigRefreshMessage() { |
| 22 | - InfConfigRefreshMessage message = new InfConfigRefreshMessage(); | 22 | + ConfigRefreshMessage message = new ConfigRefreshMessage(); |
| 23 | redisMQTemplate.send(message); | 23 | redisMQTemplate.send(message); |
| 24 | } | 24 | } |
| 25 | 25 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/InfConfigService.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java
| 1 | package cn.iocoder.yudao.module.infra.service.config; | 1 | package cn.iocoder.yudao.module.infra.service.config; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; | 4 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; |
| 6 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; | 5 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; |
| 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; | 6 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; |
| 8 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; | 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; |
| 8 | +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; | ||
| 9 | 9 | ||
| 10 | import javax.validation.Valid; | 10 | import javax.validation.Valid; |
| 11 | import java.util.List; | 11 | import java.util.List; |
| @@ -15,7 +15,7 @@ import java.util.List; | @@ -15,7 +15,7 @@ import java.util.List; | ||
| 15 | * | 15 | * |
| 16 | * @author 芋道源码 | 16 | * @author 芋道源码 |
| 17 | */ | 17 | */ |
| 18 | -public interface InfConfigService { | 18 | +public interface ConfigService { |
| 19 | 19 | ||
| 20 | /** | 20 | /** |
| 21 | * 创建参数配置 | 21 | * 创建参数配置 |
| @@ -45,7 +45,7 @@ public interface InfConfigService { | @@ -45,7 +45,7 @@ public interface InfConfigService { | ||
| 45 | * @param id 配置编号 | 45 | * @param id 配置编号 |
| 46 | * @return 参数配置 | 46 | * @return 参数配置 |
| 47 | */ | 47 | */ |
| 48 | - InfConfigDO getConfig(Long id); | 48 | + ConfigDO getConfig(Long id); |
| 49 | 49 | ||
| 50 | /** | 50 | /** |
| 51 | * 根据参数键,获得参数配置 | 51 | * 根据参数键,获得参数配置 |
| @@ -53,7 +53,7 @@ public interface InfConfigService { | @@ -53,7 +53,7 @@ public interface InfConfigService { | ||
| 53 | * @param key 配置键 | 53 | * @param key 配置键 |
| 54 | * @return 参数配置 | 54 | * @return 参数配置 |
| 55 | */ | 55 | */ |
| 56 | - InfConfigDO getConfigByKey(String key); | 56 | + ConfigDO getConfigByKey(String key); |
| 57 | 57 | ||
| 58 | /** | 58 | /** |
| 59 | * 获得参数配置分页列表 | 59 | * 获得参数配置分页列表 |
| @@ -61,7 +61,7 @@ public interface InfConfigService { | @@ -61,7 +61,7 @@ public interface InfConfigService { | ||
| 61 | * @param reqVO 分页条件 | 61 | * @param reqVO 分页条件 |
| 62 | * @return 分页列表 | 62 | * @return 分页列表 |
| 63 | */ | 63 | */ |
| 64 | - PageResult<InfConfigDO> getConfigPage(@Valid ConfigPageReqVO reqVO); | 64 | + PageResult<ConfigDO> getConfigPage(@Valid ConfigPageReqVO reqVO); |
| 65 | 65 | ||
| 66 | /** | 66 | /** |
| 67 | * 获得参数配置列表 | 67 | * 获得参数配置列表 |
| @@ -69,7 +69,7 @@ public interface InfConfigService { | @@ -69,7 +69,7 @@ public interface InfConfigService { | ||
| 69 | * @param reqVO 列表 | 69 | * @param reqVO 列表 |
| 70 | * @return 列表 | 70 | * @return 列表 |
| 71 | */ | 71 | */ |
| 72 | - List<InfConfigDO> getConfigList(@Valid ConfigExportReqVO reqVO); | 72 | + List<ConfigDO> getConfigList(@Valid ConfigExportReqVO reqVO); |
| 73 | 73 | ||
| 74 | 74 | ||
| 75 | } | 75 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/impl/InfConfigServiceImpl.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceImpl.java
| 1 | -package cn.iocoder.yudao.module.infra.service.config.impl; | 1 | +package cn.iocoder.yudao.module.infra.service.config; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; | ||
| 4 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; | 3 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; | 5 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; |
| 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; | 6 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; |
| 8 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; | 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; |
| 9 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; | 8 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; |
| 10 | -import cn.iocoder.yudao.module.infra.convert.config.InfConfigConvert; | ||
| 11 | -import cn.iocoder.yudao.module.infra.dal.mysql.config.InfConfigMapper; | ||
| 12 | -import cn.iocoder.yudao.module.infra.enums.config.InfConfigTypeEnum; | ||
| 13 | -import cn.iocoder.yudao.module.infra.mq.producer.config.InfConfigProducer; | ||
| 14 | -import cn.iocoder.yudao.module.infra.service.config.InfConfigService; | ||
| 15 | -import cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants; | 9 | +import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert; |
| 10 | +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; | ||
| 11 | +import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper; | ||
| 12 | +import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants; | ||
| 13 | +import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum; | ||
| 14 | +import cn.iocoder.yudao.module.infra.mq.producer.config.ConfigProducer; | ||
| 16 | import com.google.common.annotations.VisibleForTesting; | 15 | import com.google.common.annotations.VisibleForTesting; |
| 17 | import lombok.extern.slf4j.Slf4j; | 16 | import lombok.extern.slf4j.Slf4j; |
| 18 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
| 19 | import org.springframework.validation.annotation.Validated; | 18 | import org.springframework.validation.annotation.Validated; |
| 20 | 19 | ||
| 21 | import javax.annotation.Resource; | 20 | import javax.annotation.Resource; |
| 22 | - | ||
| 23 | import java.util.List; | 21 | import java.util.List; |
| 24 | 22 | ||
| 25 | /** | 23 | /** |
| @@ -28,21 +26,21 @@ import java.util.List; | @@ -28,21 +26,21 @@ import java.util.List; | ||
| 28 | @Service | 26 | @Service |
| 29 | @Slf4j | 27 | @Slf4j |
| 30 | @Validated | 28 | @Validated |
| 31 | -public class InfConfigServiceImpl implements InfConfigService { | 29 | +public class ConfigServiceImpl implements ConfigService { |
| 32 | 30 | ||
| 33 | @Resource | 31 | @Resource |
| 34 | - private InfConfigMapper configMapper; | 32 | + private ConfigMapper configMapper; |
| 35 | 33 | ||
| 36 | @Resource | 34 | @Resource |
| 37 | - private InfConfigProducer configProducer; | 35 | + private ConfigProducer configProducer; |
| 38 | 36 | ||
| 39 | @Override | 37 | @Override |
| 40 | public Long createConfig(ConfigCreateReqVO reqVO) { | 38 | public Long createConfig(ConfigCreateReqVO reqVO) { |
| 41 | // 校验正确性 | 39 | // 校验正确性 |
| 42 | checkCreateOrUpdate(null, reqVO.getKey()); | 40 | checkCreateOrUpdate(null, reqVO.getKey()); |
| 43 | // 插入参数配置 | 41 | // 插入参数配置 |
| 44 | - InfConfigDO config = InfConfigConvert.INSTANCE.convert(reqVO); | ||
| 45 | - config.setType(InfConfigTypeEnum.CUSTOM.getType()); | 42 | + ConfigDO config = ConfigConvert.INSTANCE.convert(reqVO); |
| 43 | + config.setType(ConfigTypeEnum.CUSTOM.getType()); | ||
| 46 | configMapper.insert(config); | 44 | configMapper.insert(config); |
| 47 | // 发送刷新消息 | 45 | // 发送刷新消息 |
| 48 | configProducer.sendConfigRefreshMessage(); | 46 | configProducer.sendConfigRefreshMessage(); |
| @@ -54,7 +52,7 @@ public class InfConfigServiceImpl implements InfConfigService { | @@ -54,7 +52,7 @@ public class InfConfigServiceImpl implements InfConfigService { | ||
| 54 | // 校验正确性 | 52 | // 校验正确性 |
| 55 | checkCreateOrUpdate(reqVO.getId(), null); // 不允许更新 key | 53 | checkCreateOrUpdate(reqVO.getId(), null); // 不允许更新 key |
| 56 | // 更新参数配置 | 54 | // 更新参数配置 |
| 57 | - InfConfigDO updateObj = InfConfigConvert.INSTANCE.convert(reqVO); | 55 | + ConfigDO updateObj = ConfigConvert.INSTANCE.convert(reqVO); |
| 58 | configMapper.updateById(updateObj); | 56 | configMapper.updateById(updateObj); |
| 59 | // 发送刷新消息 | 57 | // 发送刷新消息 |
| 60 | configProducer.sendConfigRefreshMessage(); | 58 | configProducer.sendConfigRefreshMessage(); |
| @@ -63,10 +61,10 @@ public class InfConfigServiceImpl implements InfConfigService { | @@ -63,10 +61,10 @@ public class InfConfigServiceImpl implements InfConfigService { | ||
| 63 | @Override | 61 | @Override |
| 64 | public void deleteConfig(Long id) { | 62 | public void deleteConfig(Long id) { |
| 65 | // 校验配置存在 | 63 | // 校验配置存在 |
| 66 | - InfConfigDO config = checkConfigExists(id); | 64 | + ConfigDO config = checkConfigExists(id); |
| 67 | // 内置配置,不允许删除 | 65 | // 内置配置,不允许删除 |
| 68 | - if (InfConfigTypeEnum.SYSTEM.getType().equals(config.getType())) { | ||
| 69 | - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE); | 66 | + if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) { |
| 67 | + throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE); | ||
| 70 | } | 68 | } |
| 71 | // 删除 | 69 | // 删除 |
| 72 | configMapper.deleteById(id); | 70 | configMapper.deleteById(id); |
| @@ -75,22 +73,22 @@ public class InfConfigServiceImpl implements InfConfigService { | @@ -75,22 +73,22 @@ public class InfConfigServiceImpl implements InfConfigService { | ||
| 75 | } | 73 | } |
| 76 | 74 | ||
| 77 | @Override | 75 | @Override |
| 78 | - public InfConfigDO getConfig(Long id) { | 76 | + public ConfigDO getConfig(Long id) { |
| 79 | return configMapper.selectById(id); | 77 | return configMapper.selectById(id); |
| 80 | } | 78 | } |
| 81 | 79 | ||
| 82 | @Override | 80 | @Override |
| 83 | - public InfConfigDO getConfigByKey(String key) { | 81 | + public ConfigDO getConfigByKey(String key) { |
| 84 | return configMapper.selectByKey(key); | 82 | return configMapper.selectByKey(key); |
| 85 | } | 83 | } |
| 86 | 84 | ||
| 87 | @Override | 85 | @Override |
| 88 | - public PageResult<InfConfigDO> getConfigPage(ConfigPageReqVO reqVO) { | 86 | + public PageResult<ConfigDO> getConfigPage(ConfigPageReqVO reqVO) { |
| 89 | return configMapper.selectPage(reqVO); | 87 | return configMapper.selectPage(reqVO); |
| 90 | } | 88 | } |
| 91 | 89 | ||
| 92 | @Override | 90 | @Override |
| 93 | - public List<InfConfigDO> getConfigList(ConfigExportReqVO reqVO) { | 91 | + public List<ConfigDO> getConfigList(ConfigExportReqVO reqVO) { |
| 94 | return configMapper.selectList(reqVO); | 92 | return configMapper.selectList(reqVO); |
| 95 | } | 93 | } |
| 96 | 94 | ||
| @@ -102,29 +100,29 @@ public class InfConfigServiceImpl implements InfConfigService { | @@ -102,29 +100,29 @@ public class InfConfigServiceImpl implements InfConfigService { | ||
| 102 | } | 100 | } |
| 103 | 101 | ||
| 104 | @VisibleForTesting | 102 | @VisibleForTesting |
| 105 | - public InfConfigDO checkConfigExists(Long id) { | 103 | + public ConfigDO checkConfigExists(Long id) { |
| 106 | if (id == null) { | 104 | if (id == null) { |
| 107 | return null; | 105 | return null; |
| 108 | } | 106 | } |
| 109 | - InfConfigDO config = configMapper.selectById(id); | 107 | + ConfigDO config = configMapper.selectById(id); |
| 110 | if (config == null) { | 108 | if (config == null) { |
| 111 | - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_NOT_EXISTS); | 109 | + throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_NOT_EXISTS); |
| 112 | } | 110 | } |
| 113 | return config; | 111 | return config; |
| 114 | } | 112 | } |
| 115 | 113 | ||
| 116 | @VisibleForTesting | 114 | @VisibleForTesting |
| 117 | public void checkConfigKeyUnique(Long id, String key) { | 115 | public void checkConfigKeyUnique(Long id, String key) { |
| 118 | - InfConfigDO config = configMapper.selectByKey(key); | 116 | + ConfigDO config = configMapper.selectByKey(key); |
| 119 | if (config == null) { | 117 | if (config == null) { |
| 120 | return; | 118 | return; |
| 121 | } | 119 | } |
| 122 | // 如果 id 为空,说明不用比较是否为相同 id 的参数配置 | 120 | // 如果 id 为空,说明不用比较是否为相同 id 的参数配置 |
| 123 | if (id == null) { | 121 | if (id == null) { |
| 124 | - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_KEY_DUPLICATE); | 122 | + throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_KEY_DUPLICATE); |
| 125 | } | 123 | } |
| 126 | if (!config.getId().equals(id)) { | 124 | if (!config.getId().equals(id)) { |
| 127 | - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_KEY_DUPLICATE); | 125 | + throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_KEY_DUPLICATE); |
| 128 | } | 126 | } |
| 129 | } | 127 | } |
| 130 | 128 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/InfFileCoreService.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java
| 1 | package cn.iocoder.yudao.module.infra.service.file; | 1 | package cn.iocoder.yudao.module.infra.service.file; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; | 3 | +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO; |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; | ||
| 4 | 6 | ||
| 5 | /** | 7 | /** |
| 6 | - * core service 文件接口 | 8 | + * 文件 Service 接口 |
| 7 | * | 9 | * |
| 8 | - * @author 宋天 | 10 | + * @author 芋道源码 |
| 9 | */ | 11 | */ |
| 10 | -public interface InfFileCoreService { | 12 | +public interface FileService { |
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 获得文件分页 | ||
| 16 | + * | ||
| 17 | + * @param pageReqVO 分页查询 | ||
| 18 | + * @return 文件分页 | ||
| 19 | + */ | ||
| 20 | + PageResult<FileDO> getFilePage(FilePageReqVO pageReqVO); | ||
| 11 | 21 | ||
| 12 | /** | 22 | /** |
| 13 | * 保存文件,并返回文件的访问路径 | 23 | * 保存文件,并返回文件的访问路径 |
| @@ -31,5 +41,6 @@ public interface InfFileCoreService { | @@ -31,5 +41,6 @@ public interface InfFileCoreService { | ||
| 31 | * @param path 文件路径 | 41 | * @param path 文件路径 |
| 32 | * @return 文件 | 42 | * @return 文件 |
| 33 | */ | 43 | */ |
| 34 | - InfFileDO getFile(String path); | 44 | + FileDO getFile(String path); |
| 45 | + | ||
| 35 | } | 46 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/impl/InfFileCoreServiceImpl.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java
| 1 | -package cn.iocoder.yudao.module.infra.service.file.impl; | 1 | +package cn.iocoder.yudao.module.infra.service.file; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.io.FileTypeUtil; | 3 | import cn.hutool.core.io.FileTypeUtil; |
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; | ||
| 5 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper; | ||
| 6 | -import cn.iocoder.yudao.coreservice.modules.infra.framework.file.config.FileProperties; | ||
| 7 | -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; | 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; | ||
| 7 | +import cn.iocoder.yudao.module.infra.dal.mysql.file.FileMapper; | ||
| 8 | +import cn.iocoder.yudao.module.infra.framework.file.config.FileProperties; | ||
| 8 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
| 9 | 10 | ||
| 10 | import javax.annotation.Resource; | 11 | import javax.annotation.Resource; |
| 11 | import java.io.ByteArrayInputStream; | 12 | import java.io.ByteArrayInputStream; |
| 12 | 13 | ||
| 13 | -import static cn.iocoder.yudao.coreservice.modules.infra.enums.SysErrorCodeConstants.*; | ||
| 14 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 14 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 15 | +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; | ||
| 15 | 16 | ||
| 16 | /** | 17 | /** |
| 17 | - * core service 文件实现类 | 18 | + * 文件 Service 实现类 |
| 18 | * | 19 | * |
| 19 | - * @author 宋天 | 20 | + * @author 芋道源码 |
| 20 | */ | 21 | */ |
| 21 | @Service | 22 | @Service |
| 22 | -public class InfFileCoreServiceImpl implements InfFileCoreService { | 23 | +public class FileServiceImpl implements FileService { |
| 23 | 24 | ||
| 24 | @Resource | 25 | @Resource |
| 25 | - private InfFileCoreMapper fileMapper; | 26 | + private FileMapper fileMapper; |
| 26 | 27 | ||
| 27 | @Resource | 28 | @Resource |
| 28 | private FileProperties fileProperties; | 29 | private FileProperties fileProperties; |
| 29 | 30 | ||
| 30 | @Override | 31 | @Override |
| 32 | + public PageResult<FileDO> getFilePage(FilePageReqVO pageReqVO) { | ||
| 33 | + return fileMapper.selectPage(pageReqVO); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @Override | ||
| 31 | public String createFile(String path, byte[] content) { | 37 | public String createFile(String path, byte[] content) { |
| 32 | if (fileMapper.selectCountById(path) > 0) { | 38 | if (fileMapper.selectCountById(path) > 0) { |
| 33 | throw exception(FILE_PATH_EXISTS); | 39 | throw exception(FILE_PATH_EXISTS); |
| 34 | } | 40 | } |
| 35 | // 保存到数据库 | 41 | // 保存到数据库 |
| 36 | - InfFileDO file = new InfFileDO(); | 42 | + FileDO file = new FileDO(); |
| 37 | file.setId(path); | 43 | file.setId(path); |
| 38 | file.setType(FileTypeUtil.getType(new ByteArrayInputStream(content))); | 44 | file.setType(FileTypeUtil.getType(new ByteArrayInputStream(content))); |
| 39 | file.setContent(content); | 45 | file.setContent(content); |
| @@ -57,7 +63,7 @@ public class InfFileCoreServiceImpl implements InfFileCoreService { | @@ -57,7 +63,7 @@ public class InfFileCoreServiceImpl implements InfFileCoreService { | ||
| 57 | } | 63 | } |
| 58 | 64 | ||
| 59 | @Override | 65 | @Override |
| 60 | - public InfFileDO getFile(String path) { | 66 | + public FileDO getFile(String path) { |
| 61 | return fileMapper.selectByPath(path); | 67 | return fileMapper.selectByPath(path); |
| 62 | } | 68 | } |
| 63 | 69 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/InfFileService.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.file; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO; | ||
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; | ||
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * 文件 Service 接口 | ||
| 9 | - * | ||
| 10 | - * @author 芋道源码 | ||
| 11 | - */ | ||
| 12 | -public interface InfFileService { | ||
| 13 | - | ||
| 14 | - /** | ||
| 15 | - * 获得文件分页 | ||
| 16 | - * | ||
| 17 | - * @param pageReqVO 分页查询 | ||
| 18 | - * @return 文件分页 | ||
| 19 | - */ | ||
| 20 | - PageResult<InfFileDO> getFilePage(InfFilePageReqVO pageReqVO); | ||
| 21 | - | ||
| 22 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/impl/InfFileServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.file.impl; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.module.infra.dal.mysql.file.InfFileMapper; | ||
| 4 | -import cn.iocoder.yudao.module.infra.service.file.InfFileService; | ||
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO; | ||
| 6 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; | ||
| 7 | -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; | ||
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 9 | -import org.springframework.stereotype.Service; | ||
| 10 | - | ||
| 11 | -import javax.annotation.Resource; | ||
| 12 | - | ||
| 13 | -/** | ||
| 14 | - * 文件 Service 实现类 | ||
| 15 | - * | ||
| 16 | - * @author 芋道源码 | ||
| 17 | - */ | ||
| 18 | -@Service | ||
| 19 | -public class InfFileServiceImpl implements InfFileService { | ||
| 20 | - | ||
| 21 | - @Resource | ||
| 22 | - private InfFileMapper fileMapper; | ||
| 23 | - | ||
| 24 | - @Override | ||
| 25 | - public PageResult<InfFileDO> getFilePage(InfFilePageReqVO pageReqVO) { | ||
| 26 | - return fileMapper.selectPage(pageReqVO); | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/InfJobLogService.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogService.java
| @@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.infra.service.job; | @@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.infra.service.job; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.quartz.core.service.JobLogFrameworkService; | 4 | import cn.iocoder.yudao.framework.quartz.core.service.JobLogFrameworkService; |
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO; | 5 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; |
| 6 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; | ||
| 8 | 8 | ||
| 9 | import java.util.Collection; | 9 | import java.util.Collection; |
| 10 | import java.util.List; | 10 | import java.util.List; |
| @@ -14,7 +14,7 @@ import java.util.List; | @@ -14,7 +14,7 @@ import java.util.List; | ||
| 14 | * | 14 | * |
| 15 | * @author 芋道源码 | 15 | * @author 芋道源码 |
| 16 | */ | 16 | */ |
| 17 | -public interface InfJobLogService extends JobLogFrameworkService { | 17 | +public interface JobLogService extends JobLogFrameworkService { |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | * 获得定时任务 | 20 | * 获得定时任务 |
| @@ -22,7 +22,7 @@ public interface InfJobLogService extends JobLogFrameworkService { | @@ -22,7 +22,7 @@ public interface InfJobLogService extends JobLogFrameworkService { | ||
| 22 | * @param id 编号 | 22 | * @param id 编号 |
| 23 | * @return 定时任务 | 23 | * @return 定时任务 |
| 24 | */ | 24 | */ |
| 25 | - InfJobLogDO getJobLog(Long id); | 25 | + JobLogDO getJobLog(Long id); |
| 26 | 26 | ||
| 27 | /** | 27 | /** |
| 28 | * 获得定时任务列表 | 28 | * 获得定时任务列表 |
| @@ -30,7 +30,7 @@ public interface InfJobLogService extends JobLogFrameworkService { | @@ -30,7 +30,7 @@ public interface InfJobLogService extends JobLogFrameworkService { | ||
| 30 | * @param ids 编号 | 30 | * @param ids 编号 |
| 31 | * @return 定时任务列表 | 31 | * @return 定时任务列表 |
| 32 | */ | 32 | */ |
| 33 | - List<InfJobLogDO> getJobLogList(Collection<Long> ids); | 33 | + List<JobLogDO> getJobLogList(Collection<Long> ids); |
| 34 | 34 | ||
| 35 | /** | 35 | /** |
| 36 | * 获得定时任务分页 | 36 | * 获得定时任务分页 |
| @@ -38,7 +38,7 @@ public interface InfJobLogService extends JobLogFrameworkService { | @@ -38,7 +38,7 @@ public interface InfJobLogService extends JobLogFrameworkService { | ||
| 38 | * @param pageReqVO 分页查询 | 38 | * @param pageReqVO 分页查询 |
| 39 | * @return 定时任务分页 | 39 | * @return 定时任务分页 |
| 40 | */ | 40 | */ |
| 41 | - PageResult<InfJobLogDO> getJobLogPage(InfJobLogPageReqVO pageReqVO); | 41 | + PageResult<JobLogDO> getJobLogPage(JobLogPageReqVO pageReqVO); |
| 42 | 42 | ||
| 43 | /** | 43 | /** |
| 44 | * 获得定时任务列表, 用于 Excel 导出 | 44 | * 获得定时任务列表, 用于 Excel 导出 |
| @@ -46,6 +46,6 @@ public interface InfJobLogService extends JobLogFrameworkService { | @@ -46,6 +46,6 @@ public interface InfJobLogService extends JobLogFrameworkService { | ||
| 46 | * @param exportReqVO 查询条件 | 46 | * @param exportReqVO 查询条件 |
| 47 | * @return 定时任务分页 | 47 | * @return 定时任务分页 |
| 48 | */ | 48 | */ |
| 49 | - List<InfJobLogDO> getJobLogList(InfJobLogExportReqVO exportReqVO); | 49 | + List<JobLogDO> getJobLogList(JobLogExportReqVO exportReqVO); |
| 50 | 50 | ||
| 51 | } | 51 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/impl/InfJobLogServiceImpl.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java
| 1 | -package cn.iocoder.yudao.module.infra.service.job.impl; | 1 | +package cn.iocoder.yudao.module.infra.service.job; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO; | ||
| 7 | -import cn.iocoder.yudao.module.infra.dal.mysql.job.InfJobLogMapper; | ||
| 8 | -import cn.iocoder.yudao.module.infra.enums.job.InfJobLogStatusEnum; | ||
| 9 | -import cn.iocoder.yudao.module.infra.service.job.InfJobLogService; | 4 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; |
| 5 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; | ||
| 7 | +import cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper; | ||
| 8 | +import cn.iocoder.yudao.module.infra.enums.job.JobLogStatusEnum; | ||
| 10 | import lombok.extern.slf4j.Slf4j; | 9 | import lombok.extern.slf4j.Slf4j; |
| 11 | import org.springframework.scheduling.annotation.Async; | 10 | import org.springframework.scheduling.annotation.Async; |
| 12 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| @@ -25,15 +24,15 @@ import java.util.List; | @@ -25,15 +24,15 @@ import java.util.List; | ||
| 25 | @Service | 24 | @Service |
| 26 | @Validated | 25 | @Validated |
| 27 | @Slf4j | 26 | @Slf4j |
| 28 | -public class InfJobLogServiceImpl implements InfJobLogService { | 27 | +public class JobLogServiceImpl implements JobLogService { |
| 29 | 28 | ||
| 30 | @Resource | 29 | @Resource |
| 31 | - private InfJobLogMapper jobLogMapper; | 30 | + private JobLogMapper jobLogMapper; |
| 32 | 31 | ||
| 33 | @Override | 32 | @Override |
| 34 | public Long createJobLog(Long jobId, Date beginTime, String jobHandlerName, String jobHandlerParam, Integer executeIndex) { | 33 | public Long createJobLog(Long jobId, Date beginTime, String jobHandlerName, String jobHandlerParam, Integer executeIndex) { |
| 35 | - InfJobLogDO log = InfJobLogDO.builder().jobId(jobId).handlerName(jobHandlerName).handlerParam(jobHandlerParam).executeIndex(executeIndex) | ||
| 36 | - .beginTime(beginTime).status(InfJobLogStatusEnum.RUNNING.getStatus()).build(); | 34 | + JobLogDO log = JobLogDO.builder().jobId(jobId).handlerName(jobHandlerName).handlerParam(jobHandlerParam).executeIndex(executeIndex) |
| 35 | + .beginTime(beginTime).status(JobLogStatusEnum.RUNNING.getStatus()).build(); | ||
| 37 | jobLogMapper.insert(log); | 36 | jobLogMapper.insert(log); |
| 38 | return log.getId(); | 37 | return log.getId(); |
| 39 | } | 38 | } |
| @@ -42,8 +41,8 @@ public class InfJobLogServiceImpl implements InfJobLogService { | @@ -42,8 +41,8 @@ public class InfJobLogServiceImpl implements InfJobLogService { | ||
| 42 | @Async | 41 | @Async |
| 43 | public void updateJobLogResultAsync(Long logId, Date endTime, Integer duration, boolean success, String result) { | 42 | public void updateJobLogResultAsync(Long logId, Date endTime, Integer duration, boolean success, String result) { |
| 44 | try { | 43 | try { |
| 45 | - InfJobLogDO updateObj = InfJobLogDO.builder().id(logId).endTime(endTime).duration(duration) | ||
| 46 | - .status(success ? InfJobLogStatusEnum.SUCCESS.getStatus() : InfJobLogStatusEnum.FAILURE.getStatus()).result(result).build(); | 44 | + JobLogDO updateObj = JobLogDO.builder().id(logId).endTime(endTime).duration(duration) |
| 45 | + .status(success ? JobLogStatusEnum.SUCCESS.getStatus() : JobLogStatusEnum.FAILURE.getStatus()).result(result).build(); | ||
| 47 | jobLogMapper.updateById(updateObj); | 46 | jobLogMapper.updateById(updateObj); |
| 48 | } catch (Exception ex) { | 47 | } catch (Exception ex) { |
| 49 | log.error("[updateJobLogResultAsync][logId({}) endTime({}) duration({}) success({}) result({})]", | 48 | log.error("[updateJobLogResultAsync][logId({}) endTime({}) duration({}) success({}) result({})]", |
| @@ -52,22 +51,22 @@ public class InfJobLogServiceImpl implements InfJobLogService { | @@ -52,22 +51,22 @@ public class InfJobLogServiceImpl implements InfJobLogService { | ||
| 52 | } | 51 | } |
| 53 | 52 | ||
| 54 | @Override | 53 | @Override |
| 55 | - public InfJobLogDO getJobLog(Long id) { | 54 | + public JobLogDO getJobLog(Long id) { |
| 56 | return jobLogMapper.selectById(id); | 55 | return jobLogMapper.selectById(id); |
| 57 | } | 56 | } |
| 58 | 57 | ||
| 59 | @Override | 58 | @Override |
| 60 | - public List<InfJobLogDO> getJobLogList(Collection<Long> ids) { | 59 | + public List<JobLogDO> getJobLogList(Collection<Long> ids) { |
| 61 | return jobLogMapper.selectBatchIds(ids); | 60 | return jobLogMapper.selectBatchIds(ids); |
| 62 | } | 61 | } |
| 63 | 62 | ||
| 64 | @Override | 63 | @Override |
| 65 | - public PageResult<InfJobLogDO> getJobLogPage(InfJobLogPageReqVO pageReqVO) { | 64 | + public PageResult<JobLogDO> getJobLogPage(JobLogPageReqVO pageReqVO) { |
| 66 | return jobLogMapper.selectPage(pageReqVO); | 65 | return jobLogMapper.selectPage(pageReqVO); |
| 67 | } | 66 | } |
| 68 | 67 | ||
| 69 | @Override | 68 | @Override |
| 70 | - public List<InfJobLogDO> getJobLogList(InfJobLogExportReqVO exportReqVO) { | 69 | + public List<JobLogDO> getJobLogList(JobLogExportReqVO exportReqVO) { |
| 71 | return jobLogMapper.selectList(exportReqVO); | 70 | return jobLogMapper.selectList(exportReqVO); |
| 72 | } | 71 | } |
| 73 | 72 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/InfJobService.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobService.java
| 1 | package cn.iocoder.yudao.module.infra.service.job; | 1 | package cn.iocoder.yudao.module.infra.service.job; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobCreateReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExportReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobPageReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobUpdateReqVO; | ||
| 8 | -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO; | 4 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO; |
| 5 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; | ||
| 9 | import org.quartz.SchedulerException; | 9 | import org.quartz.SchedulerException; |
| 10 | 10 | ||
| 11 | import javax.validation.Valid; | 11 | import javax.validation.Valid; |
| @@ -17,7 +17,7 @@ import java.util.List; | @@ -17,7 +17,7 @@ import java.util.List; | ||
| 17 | * | 17 | * |
| 18 | * @author 芋道源码 | 18 | * @author 芋道源码 |
| 19 | */ | 19 | */ |
| 20 | -public interface InfJobService { | 20 | +public interface JobService { |
| 21 | 21 | ||
| 22 | /** | 22 | /** |
| 23 | * 创建定时任务 | 23 | * 创建定时任务 |
| @@ -25,14 +25,14 @@ public interface InfJobService { | @@ -25,14 +25,14 @@ public interface InfJobService { | ||
| 25 | * @param createReqVO 创建信息 | 25 | * @param createReqVO 创建信息 |
| 26 | * @return 编号 | 26 | * @return 编号 |
| 27 | */ | 27 | */ |
| 28 | - Long createJob(@Valid InfJobCreateReqVO createReqVO) throws SchedulerException; | 28 | + Long createJob(@Valid JobCreateReqVO createReqVO) throws SchedulerException; |
| 29 | 29 | ||
| 30 | /** | 30 | /** |
| 31 | * 更新定时任务 | 31 | * 更新定时任务 |
| 32 | * | 32 | * |
| 33 | * @param updateReqVO 更新信息 | 33 | * @param updateReqVO 更新信息 |
| 34 | */ | 34 | */ |
| 35 | - void updateJob(@Valid InfJobUpdateReqVO updateReqVO) throws SchedulerException; | 35 | + void updateJob(@Valid JobUpdateReqVO updateReqVO) throws SchedulerException; |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| 38 | * 更新定时任务的状态 | 38 | * 更新定时任务的状态 |
| @@ -62,7 +62,7 @@ public interface InfJobService { | @@ -62,7 +62,7 @@ public interface InfJobService { | ||
| 62 | * @param id 编号 | 62 | * @param id 编号 |
| 63 | * @return 定时任务 | 63 | * @return 定时任务 |
| 64 | */ | 64 | */ |
| 65 | - InfJobDO getJob(Long id); | 65 | + JobDO getJob(Long id); |
| 66 | 66 | ||
| 67 | /** | 67 | /** |
| 68 | * 获得定时任务列表 | 68 | * 获得定时任务列表 |
| @@ -70,7 +70,7 @@ public interface InfJobService { | @@ -70,7 +70,7 @@ public interface InfJobService { | ||
| 70 | * @param ids 编号 | 70 | * @param ids 编号 |
| 71 | * @return 定时任务列表 | 71 | * @return 定时任务列表 |
| 72 | */ | 72 | */ |
| 73 | - List<InfJobDO> getJobList(Collection<Long> ids); | 73 | + List<JobDO> getJobList(Collection<Long> ids); |
| 74 | 74 | ||
| 75 | /** | 75 | /** |
| 76 | * 获得定时任务分页 | 76 | * 获得定时任务分页 |
| @@ -78,7 +78,7 @@ public interface InfJobService { | @@ -78,7 +78,7 @@ public interface InfJobService { | ||
| 78 | * @param pageReqVO 分页查询 | 78 | * @param pageReqVO 分页查询 |
| 79 | * @return 定时任务分页 | 79 | * @return 定时任务分页 |
| 80 | */ | 80 | */ |
| 81 | - PageResult<InfJobDO> getJobPage(InfJobPageReqVO pageReqVO); | 81 | + PageResult<JobDO> getJobPage(JobPageReqVO pageReqVO); |
| 82 | 82 | ||
| 83 | /** | 83 | /** |
| 84 | * 获得定时任务列表, 用于 Excel 导出 | 84 | * 获得定时任务列表, 用于 Excel 导出 |
| @@ -86,6 +86,6 @@ public interface InfJobService { | @@ -86,6 +86,6 @@ public interface InfJobService { | ||
| 86 | * @param exportReqVO 查询条件 | 86 | * @param exportReqVO 查询条件 |
| 87 | * @return 定时任务分页 | 87 | * @return 定时任务分页 |
| 88 | */ | 88 | */ |
| 89 | - List<InfJobDO> getJobList(InfJobExportReqVO exportReqVO); | 89 | + List<JobDO> getJobList(JobExportReqVO exportReqVO); |
| 90 | 90 | ||
| 91 | } | 91 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/impl/InfJobServiceImpl.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImpl.java
| 1 | -package cn.iocoder.yudao.module.infra.service.job.impl; | 1 | +package cn.iocoder.yudao.module.infra.service.job; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager; | 4 | import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager; |
| 5 | import cn.iocoder.yudao.framework.quartz.core.util.CronUtils; | 5 | import cn.iocoder.yudao.framework.quartz.core.util.CronUtils; |
| 6 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobCreateReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExportReqVO; | ||
| 8 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobPageReqVO; | ||
| 9 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobUpdateReqVO; | ||
| 10 | -import cn.iocoder.yudao.module.infra.convert.job.InfJobConvert; | ||
| 11 | -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO; | ||
| 12 | -import cn.iocoder.yudao.module.infra.dal.mysql.job.InfJobMapper; | ||
| 13 | -import cn.iocoder.yudao.module.infra.enums.job.InfJobStatusEnum; | ||
| 14 | -import cn.iocoder.yudao.module.infra.service.job.InfJobService; | 6 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO; |
| 7 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.infra.convert.job.JobConvert; | ||
| 11 | +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; | ||
| 12 | +import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper; | ||
| 13 | +import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum; | ||
| 15 | import org.quartz.SchedulerException; | 14 | import org.quartz.SchedulerException; |
| 16 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
| 17 | import org.springframework.transaction.annotation.Transactional; | 16 | import org.springframework.transaction.annotation.Transactional; |
| @@ -22,7 +21,7 @@ import java.util.Collection; | @@ -22,7 +21,7 @@ import java.util.Collection; | ||
| 22 | import java.util.List; | 21 | import java.util.List; |
| 23 | 22 | ||
| 24 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 23 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 25 | -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.*; | 24 | +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; |
| 26 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.containsAny; | 25 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.containsAny; |
| 27 | 26 | ||
| 28 | /** | 27 | /** |
| @@ -32,25 +31,25 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. | @@ -32,25 +31,25 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. | ||
| 32 | */ | 31 | */ |
| 33 | @Service | 32 | @Service |
| 34 | @Validated | 33 | @Validated |
| 35 | -public class InfJobServiceImpl implements InfJobService { | 34 | +public class JobServiceImpl implements JobService { |
| 36 | 35 | ||
| 37 | @Resource | 36 | @Resource |
| 38 | - private InfJobMapper jobMapper; | 37 | + private JobMapper jobMapper; |
| 39 | 38 | ||
| 40 | @Resource | 39 | @Resource |
| 41 | private SchedulerManager schedulerManager; | 40 | private SchedulerManager schedulerManager; |
| 42 | 41 | ||
| 43 | @Override | 42 | @Override |
| 44 | @Transactional(rollbackFor = Exception.class) | 43 | @Transactional(rollbackFor = Exception.class) |
| 45 | - public Long createJob(InfJobCreateReqVO createReqVO) throws SchedulerException { | 44 | + public Long createJob(JobCreateReqVO createReqVO) throws SchedulerException { |
| 46 | validateCronExpression(createReqVO.getCronExpression()); | 45 | validateCronExpression(createReqVO.getCronExpression()); |
| 47 | // 校验唯一性 | 46 | // 校验唯一性 |
| 48 | if (jobMapper.selectByHandlerName(createReqVO.getHandlerName()) != null) { | 47 | if (jobMapper.selectByHandlerName(createReqVO.getHandlerName()) != null) { |
| 49 | throw exception(JOB_HANDLER_EXISTS); | 48 | throw exception(JOB_HANDLER_EXISTS); |
| 50 | } | 49 | } |
| 51 | // 插入 | 50 | // 插入 |
| 52 | - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); | ||
| 53 | - job.setStatus(InfJobStatusEnum.INIT.getStatus()); | 51 | + JobDO job = JobConvert.INSTANCE.convert(createReqVO); |
| 52 | + job.setStatus(JobStatusEnum.INIT.getStatus()); | ||
| 54 | fillJobMonitorTimeoutEmpty(job); | 53 | fillJobMonitorTimeoutEmpty(job); |
| 55 | jobMapper.insert(job); | 54 | jobMapper.insert(job); |
| 56 | 55 | ||
| @@ -58,7 +57,7 @@ public class InfJobServiceImpl implements InfJobService { | @@ -58,7 +57,7 @@ public class InfJobServiceImpl implements InfJobService { | ||
| 58 | schedulerManager.addJob(job.getId(), job.getHandlerName(), job.getHandlerParam(), job.getCronExpression(), | 57 | schedulerManager.addJob(job.getId(), job.getHandlerName(), job.getHandlerParam(), job.getCronExpression(), |
| 59 | createReqVO.getRetryCount(), createReqVO.getRetryInterval()); | 58 | createReqVO.getRetryCount(), createReqVO.getRetryInterval()); |
| 60 | // 更新 | 59 | // 更新 |
| 61 | - InfJobDO updateObj = InfJobDO.builder().id(job.getId()).status(InfJobStatusEnum.NORMAL.getStatus()).build(); | 60 | + JobDO updateObj = JobDO.builder().id(job.getId()).status(JobStatusEnum.NORMAL.getStatus()).build(); |
| 62 | jobMapper.updateById(updateObj); | 61 | jobMapper.updateById(updateObj); |
| 63 | 62 | ||
| 64 | // 返回 | 63 | // 返回 |
| @@ -67,16 +66,16 @@ public class InfJobServiceImpl implements InfJobService { | @@ -67,16 +66,16 @@ public class InfJobServiceImpl implements InfJobService { | ||
| 67 | 66 | ||
| 68 | @Override | 67 | @Override |
| 69 | @Transactional(rollbackFor = Exception.class) | 68 | @Transactional(rollbackFor = Exception.class) |
| 70 | - public void updateJob(InfJobUpdateReqVO updateReqVO) throws SchedulerException { | 69 | + public void updateJob(JobUpdateReqVO updateReqVO) throws SchedulerException { |
| 71 | validateCronExpression(updateReqVO.getCronExpression()); | 70 | validateCronExpression(updateReqVO.getCronExpression()); |
| 72 | // 校验存在 | 71 | // 校验存在 |
| 73 | - InfJobDO job = this.validateJobExists(updateReqVO.getId()); | 72 | + JobDO job = this.validateJobExists(updateReqVO.getId()); |
| 74 | // 只有开启状态,才可以修改.原因是,如果出暂停状态,修改 Quartz Job 时,会导致任务又开始执行 | 73 | // 只有开启状态,才可以修改.原因是,如果出暂停状态,修改 Quartz Job 时,会导致任务又开始执行 |
| 75 | - if (!job.getStatus().equals(InfJobStatusEnum.NORMAL.getStatus())) { | 74 | + if (!job.getStatus().equals(JobStatusEnum.NORMAL.getStatus())) { |
| 76 | throw exception(JOB_UPDATE_ONLY_NORMAL_STATUS); | 75 | throw exception(JOB_UPDATE_ONLY_NORMAL_STATUS); |
| 77 | } | 76 | } |
| 78 | // 更新 | 77 | // 更新 |
| 79 | - InfJobDO updateObj = InfJobConvert.INSTANCE.convert(updateReqVO); | 78 | + JobDO updateObj = JobConvert.INSTANCE.convert(updateReqVO); |
| 80 | fillJobMonitorTimeoutEmpty(updateObj); | 79 | fillJobMonitorTimeoutEmpty(updateObj); |
| 81 | jobMapper.updateById(updateObj); | 80 | jobMapper.updateById(updateObj); |
| 82 | 81 | ||
| @@ -89,21 +88,21 @@ public class InfJobServiceImpl implements InfJobService { | @@ -89,21 +88,21 @@ public class InfJobServiceImpl implements InfJobService { | ||
| 89 | @Transactional(rollbackFor = Exception.class) | 88 | @Transactional(rollbackFor = Exception.class) |
| 90 | public void updateJobStatus(Long id, Integer status) throws SchedulerException { | 89 | public void updateJobStatus(Long id, Integer status) throws SchedulerException { |
| 91 | // 校验 status | 90 | // 校验 status |
| 92 | - if (!containsAny(status, InfJobStatusEnum.NORMAL.getStatus(), InfJobStatusEnum.STOP.getStatus())) { | 91 | + if (!containsAny(status, JobStatusEnum.NORMAL.getStatus(), JobStatusEnum.STOP.getStatus())) { |
| 93 | throw exception(JOB_CHANGE_STATUS_INVALID); | 92 | throw exception(JOB_CHANGE_STATUS_INVALID); |
| 94 | } | 93 | } |
| 95 | // 校验存在 | 94 | // 校验存在 |
| 96 | - InfJobDO job = this.validateJobExists(id); | 95 | + JobDO job = this.validateJobExists(id); |
| 97 | // 校验是否已经为当前状态 | 96 | // 校验是否已经为当前状态 |
| 98 | if (job.getStatus().equals(status)) { | 97 | if (job.getStatus().equals(status)) { |
| 99 | throw exception(JOB_CHANGE_STATUS_EQUALS); | 98 | throw exception(JOB_CHANGE_STATUS_EQUALS); |
| 100 | } | 99 | } |
| 101 | // 更新 Job 状态 | 100 | // 更新 Job 状态 |
| 102 | - InfJobDO updateObj = InfJobDO.builder().id(id).status(status).build(); | 101 | + JobDO updateObj = JobDO.builder().id(id).status(status).build(); |
| 103 | jobMapper.updateById(updateObj); | 102 | jobMapper.updateById(updateObj); |
| 104 | 103 | ||
| 105 | // 更新状态 Job 到 Quartz 中 | 104 | // 更新状态 Job 到 Quartz 中 |
| 106 | - if (InfJobStatusEnum.NORMAL.getStatus().equals(status)) { // 开启 | 105 | + if (JobStatusEnum.NORMAL.getStatus().equals(status)) { // 开启 |
| 107 | schedulerManager.resumeJob(job.getHandlerName()); | 106 | schedulerManager.resumeJob(job.getHandlerName()); |
| 108 | } else { // 暂停 | 107 | } else { // 暂停 |
| 109 | schedulerManager.pauseJob(job.getHandlerName()); | 108 | schedulerManager.pauseJob(job.getHandlerName()); |
| @@ -113,7 +112,7 @@ public class InfJobServiceImpl implements InfJobService { | @@ -113,7 +112,7 @@ public class InfJobServiceImpl implements InfJobService { | ||
| 113 | @Override | 112 | @Override |
| 114 | public void triggerJob(Long id) throws SchedulerException { | 113 | public void triggerJob(Long id) throws SchedulerException { |
| 115 | // 校验存在 | 114 | // 校验存在 |
| 116 | - InfJobDO job = this.validateJobExists(id); | 115 | + JobDO job = this.validateJobExists(id); |
| 117 | 116 | ||
| 118 | // 触发 Quartz 中的 Job | 117 | // 触发 Quartz 中的 Job |
| 119 | schedulerManager.triggerJob(job.getId(), job.getHandlerName(), job.getHandlerParam()); | 118 | schedulerManager.triggerJob(job.getId(), job.getHandlerName(), job.getHandlerParam()); |
| @@ -123,7 +122,7 @@ public class InfJobServiceImpl implements InfJobService { | @@ -123,7 +122,7 @@ public class InfJobServiceImpl implements InfJobService { | ||
| 123 | @Transactional(rollbackFor = Exception.class) | 122 | @Transactional(rollbackFor = Exception.class) |
| 124 | public void deleteJob(Long id) throws SchedulerException { | 123 | public void deleteJob(Long id) throws SchedulerException { |
| 125 | // 校验存在 | 124 | // 校验存在 |
| 126 | - InfJobDO job = this.validateJobExists(id); | 125 | + JobDO job = this.validateJobExists(id); |
| 127 | // 更新 | 126 | // 更新 |
| 128 | jobMapper.deleteById(id); | 127 | jobMapper.deleteById(id); |
| 129 | 128 | ||
| @@ -131,8 +130,8 @@ public class InfJobServiceImpl implements InfJobService { | @@ -131,8 +130,8 @@ public class InfJobServiceImpl implements InfJobService { | ||
| 131 | schedulerManager.deleteJob(job.getHandlerName()); | 130 | schedulerManager.deleteJob(job.getHandlerName()); |
| 132 | } | 131 | } |
| 133 | 132 | ||
| 134 | - private InfJobDO validateJobExists(Long id) { | ||
| 135 | - InfJobDO job = jobMapper.selectById(id); | 133 | + private JobDO validateJobExists(Long id) { |
| 134 | + JobDO job = jobMapper.selectById(id); | ||
| 136 | if (job == null) { | 135 | if (job == null) { |
| 137 | throw exception(JOB_NOT_EXISTS); | 136 | throw exception(JOB_NOT_EXISTS); |
| 138 | } | 137 | } |
| @@ -146,26 +145,26 @@ public class InfJobServiceImpl implements InfJobService { | @@ -146,26 +145,26 @@ public class InfJobServiceImpl implements InfJobService { | ||
| 146 | } | 145 | } |
| 147 | 146 | ||
| 148 | @Override | 147 | @Override |
| 149 | - public InfJobDO getJob(Long id) { | 148 | + public JobDO getJob(Long id) { |
| 150 | return jobMapper.selectById(id); | 149 | return jobMapper.selectById(id); |
| 151 | } | 150 | } |
| 152 | 151 | ||
| 153 | @Override | 152 | @Override |
| 154 | - public List<InfJobDO> getJobList(Collection<Long> ids) { | 153 | + public List<JobDO> getJobList(Collection<Long> ids) { |
| 155 | return jobMapper.selectBatchIds(ids); | 154 | return jobMapper.selectBatchIds(ids); |
| 156 | } | 155 | } |
| 157 | 156 | ||
| 158 | @Override | 157 | @Override |
| 159 | - public PageResult<InfJobDO> getJobPage(InfJobPageReqVO pageReqVO) { | 158 | + public PageResult<JobDO> getJobPage(JobPageReqVO pageReqVO) { |
| 160 | return jobMapper.selectPage(pageReqVO); | 159 | return jobMapper.selectPage(pageReqVO); |
| 161 | } | 160 | } |
| 162 | 161 | ||
| 163 | @Override | 162 | @Override |
| 164 | - public List<InfJobDO> getJobList(InfJobExportReqVO exportReqVO) { | 163 | + public List<JobDO> getJobList(JobExportReqVO exportReqVO) { |
| 165 | return jobMapper.selectList(exportReqVO); | 164 | return jobMapper.selectList(exportReqVO); |
| 166 | } | 165 | } |
| 167 | 166 | ||
| 168 | - private static void fillJobMonitorTimeoutEmpty(InfJobDO job) { | 167 | + private static void fillJobMonitorTimeoutEmpty(JobDO job) { |
| 169 | if (job.getMonitorTimeout() == null) { | 168 | if (job.getMonitorTimeout() == null) { |
| 170 | job.setMonitorTimeout(0); | 169 | job.setMonitorTimeout(0); |
| 171 | } | 170 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogService.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogService.java
| 1 | package cn.iocoder.yudao.module.infra.service.logger; | 1 | package cn.iocoder.yudao.module.infra.service.logger; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; | ||
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; | ||
| 5 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | 3 | +import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService; |
| 4 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; | ||
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; | ||
| 7 | 8 | ||
| 8 | import java.util.List; | 9 | import java.util.List; |
| 9 | 10 | ||
| @@ -12,7 +13,7 @@ import java.util.List; | @@ -12,7 +13,7 @@ import java.util.List; | ||
| 12 | * | 13 | * |
| 13 | * @author 芋道源码 | 14 | * @author 芋道源码 |
| 14 | */ | 15 | */ |
| 15 | -public interface InfApiAccessLogService { | 16 | +public interface ApiAccessLogService extends ApiAccessLogFrameworkService { |
| 16 | 17 | ||
| 17 | /** | 18 | /** |
| 18 | * 获得 API 访问日志分页 | 19 | * 获得 API 访问日志分页 |
| @@ -20,7 +21,7 @@ public interface InfApiAccessLogService { | @@ -20,7 +21,7 @@ public interface InfApiAccessLogService { | ||
| 20 | * @param pageReqVO 分页查询 | 21 | * @param pageReqVO 分页查询 |
| 21 | * @return API 访问日志分页 | 22 | * @return API 访问日志分页 |
| 22 | */ | 23 | */ |
| 23 | - PageResult<InfApiAccessLogDO> getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO); | 24 | + PageResult<ApiAccessLogDO> getApiAccessLogPage(ApiAccessLogPageReqVO pageReqVO); |
| 24 | 25 | ||
| 25 | /** | 26 | /** |
| 26 | * 获得 API 访问日志列表, 用于 Excel 导出 | 27 | * 获得 API 访问日志列表, 用于 Excel 导出 |
| @@ -28,6 +29,6 @@ public interface InfApiAccessLogService { | @@ -28,6 +29,6 @@ public interface InfApiAccessLogService { | ||
| 28 | * @param exportReqVO 查询条件 | 29 | * @param exportReqVO 查询条件 |
| 29 | * @return API 访问日志分页 | 30 | * @return API 访问日志分页 |
| 30 | */ | 31 | */ |
| 31 | - List<InfApiAccessLogDO> getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO); | 32 | + List<ApiAccessLogDO> getApiAccessLogList(ApiAccessLogExportReqVO exportReqVO); |
| 32 | 33 | ||
| 33 | } | 34 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiAccessLogServiceImpl.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java
| 1 | -package cn.iocoder.yudao.module.infra.service.logger.impl; | 1 | +package cn.iocoder.yudao.module.infra.service.logger; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; | ||
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.infra.dal.mysql.logger.InfApiAccessLogMapper; | ||
| 6 | -import cn.iocoder.yudao.module.infra.service.logger.InfApiAccessLogService; | ||
| 7 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | 3 | +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO; |
| 4 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.infra.convert.logger.ApiAccessLogConvert; | ||
| 7 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; | ||
| 8 | +import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiAccessLogMapper; | ||
| 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 9 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 10 | +import org.springframework.scheduling.annotation.Async; | ||
| 9 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 10 | import org.springframework.validation.annotation.Validated; | 12 | import org.springframework.validation.annotation.Validated; |
| 11 | 13 | ||
| @@ -19,19 +21,26 @@ import java.util.List; | @@ -19,19 +21,26 @@ import java.util.List; | ||
| 19 | */ | 21 | */ |
| 20 | @Service | 22 | @Service |
| 21 | @Validated | 23 | @Validated |
| 22 | -public class InfApiAccessLogServiceImpl implements InfApiAccessLogService { | 24 | +public class ApiAccessLogServiceImpl implements ApiAccessLogService { |
| 23 | 25 | ||
| 24 | @Resource | 26 | @Resource |
| 25 | - private InfApiAccessLogMapper apiAccessLogMapper; | 27 | + private ApiAccessLogMapper apiAccessLogMapper; |
| 26 | 28 | ||
| 27 | @Override | 29 | @Override |
| 28 | - public PageResult<InfApiAccessLogDO> getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO) { | 30 | + public PageResult<ApiAccessLogDO> getApiAccessLogPage(ApiAccessLogPageReqVO pageReqVO) { |
| 29 | return apiAccessLogMapper.selectPage(pageReqVO); | 31 | return apiAccessLogMapper.selectPage(pageReqVO); |
| 30 | } | 32 | } |
| 31 | 33 | ||
| 32 | @Override | 34 | @Override |
| 33 | - public List<InfApiAccessLogDO> getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO) { | 35 | + public List<ApiAccessLogDO> getApiAccessLogList(ApiAccessLogExportReqVO exportReqVO) { |
| 34 | return apiAccessLogMapper.selectList(exportReqVO); | 36 | return apiAccessLogMapper.selectList(exportReqVO); |
| 35 | } | 37 | } |
| 36 | 38 | ||
| 39 | + @Override | ||
| 40 | + @Async | ||
| 41 | + public void createApiAccessLogAsync(ApiAccessLogCreateReqDTO createDTO) { | ||
| 42 | + ApiAccessLogDO apiAccessLog = ApiAccessLogConvert.INSTANCE.convert(createDTO); | ||
| 43 | + apiAccessLogMapper.insert(apiAccessLog); | ||
| 44 | + } | ||
| 45 | + | ||
| 37 | } | 46 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogService.java renamed to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogService.java
| 1 | package cn.iocoder.yudao.module.infra.service.logger; | 1 | package cn.iocoder.yudao.module.infra.service.logger; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExportReqVO; | ||
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogPageReqVO; | ||
| 5 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; | 3 | +import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; | ||
| 7 | 8 | ||
| 8 | import java.util.List; | 9 | import java.util.List; |
| 9 | 10 | ||
| @@ -12,7 +13,7 @@ import java.util.List; | @@ -12,7 +13,7 @@ import java.util.List; | ||
| 12 | * | 13 | * |
| 13 | * @author 芋道源码 | 14 | * @author 芋道源码 |
| 14 | */ | 15 | */ |
| 15 | -public interface InfApiErrorLogService { | 16 | +public interface ApiErrorLogService extends ApiErrorLogFrameworkService { |
| 16 | 17 | ||
| 17 | /** | 18 | /** |
| 18 | * 获得 API 错误日志分页 | 19 | * 获得 API 错误日志分页 |
| @@ -20,7 +21,7 @@ public interface InfApiErrorLogService { | @@ -20,7 +21,7 @@ public interface InfApiErrorLogService { | ||
| 20 | * @param pageReqVO 分页查询 | 21 | * @param pageReqVO 分页查询 |
| 21 | * @return API 错误日志分页 | 22 | * @return API 错误日志分页 |
| 22 | */ | 23 | */ |
| 23 | - PageResult<InfApiErrorLogDO> getApiErrorLogPage(InfApiErrorLogPageReqVO pageReqVO); | 24 | + PageResult<ApiErrorLogDO> getApiErrorLogPage(ApiErrorLogPageReqVO pageReqVO); |
| 24 | 25 | ||
| 25 | /** | 26 | /** |
| 26 | * 获得 API 错误日志列表, 用于 Excel 导出 | 27 | * 获得 API 错误日志列表, 用于 Excel 导出 |
| @@ -28,7 +29,7 @@ public interface InfApiErrorLogService { | @@ -28,7 +29,7 @@ public interface InfApiErrorLogService { | ||
| 28 | * @param exportReqVO 查询条件 | 29 | * @param exportReqVO 查询条件 |
| 29 | * @return API 错误日志分页 | 30 | * @return API 错误日志分页 |
| 30 | */ | 31 | */ |
| 31 | - List<InfApiErrorLogDO> getApiErrorLogList(InfApiErrorLogExportReqVO exportReqVO); | 32 | + List<ApiErrorLogDO> getApiErrorLogList(ApiErrorLogExportReqVO exportReqVO); |
| 32 | 33 | ||
| 33 | /** | 34 | /** |
| 34 | * 更新 API 错误日志已处理 | 35 | * 更新 API 错误日志已处理 |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.infra.service.logger; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO; | ||
| 4 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.infra.convert.logger.ApiErrorLogConvert; | ||
| 7 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; | ||
| 8 | +import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper; | ||
| 9 | +import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; | ||
| 10 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 11 | +import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants; | ||
| 12 | +import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum; | ||
| 13 | +import org.springframework.scheduling.annotation.Async; | ||
| 14 | +import org.springframework.stereotype.Service; | ||
| 15 | +import org.springframework.validation.annotation.Validated; | ||
| 16 | + | ||
| 17 | +import javax.annotation.Resource; | ||
| 18 | +import java.util.Date; | ||
| 19 | +import java.util.List; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * API 错误日志 Service 实现类 | ||
| 23 | + * | ||
| 24 | + * @author 芋道源码 | ||
| 25 | + */ | ||
| 26 | +@Service | ||
| 27 | +@Validated | ||
| 28 | +public class ApiErrorLogServiceImpl implements ApiErrorLogService { | ||
| 29 | + | ||
| 30 | + @Resource | ||
| 31 | + private ApiErrorLogMapper apiErrorLogMapper; | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + public PageResult<ApiErrorLogDO> getApiErrorLogPage(ApiErrorLogPageReqVO pageReqVO) { | ||
| 35 | + return apiErrorLogMapper.selectPage(pageReqVO); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @Override | ||
| 39 | + public List<ApiErrorLogDO> getApiErrorLogList(ApiErrorLogExportReqVO exportReqVO) { | ||
| 40 | + return apiErrorLogMapper.selectList(exportReqVO); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) { | ||
| 45 | + ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id); | ||
| 46 | + if (errorLog == null) { | ||
| 47 | + throw ServiceExceptionUtil.exception(ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND); | ||
| 48 | + } | ||
| 49 | + if (!ApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) { | ||
| 50 | + throw ServiceExceptionUtil.exception(ErrorCodeConstants.API_ERROR_LOG_PROCESSED); | ||
| 51 | + } | ||
| 52 | + // 标记处理 | ||
| 53 | + apiErrorLogMapper.updateById(ApiErrorLogDO.builder().id(id).processStatus(processStatus) | ||
| 54 | + .processUserId(processUserId).processTime(new Date()).build()); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + @Async | ||
| 59 | + public void createApiErrorLogAsync(ApiErrorLogCreateReqDTO createDTO) { | ||
| 60 | + ApiErrorLogDO apiErrorLog = ApiErrorLogConvert.INSTANCE.convert(createDTO); | ||
| 61 | + apiErrorLog.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); | ||
| 62 | + apiErrorLogMapper.insert(apiErrorLog); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | +} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogCoreService.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.logger; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService; | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | - * API 访问日志 Service 接口 | ||
| 7 | - * | ||
| 8 | - * @author 芋道源码 | ||
| 9 | - */ | ||
| 10 | -public interface InfApiAccessLogCoreService extends ApiAccessLogFrameworkService { | ||
| 11 | - | ||
| 12 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogCoreService.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.logger; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService; | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | - * API 错误日志 Service 接口 | ||
| 7 | - * | ||
| 8 | - * @author 芋道源码 | ||
| 9 | - */ | ||
| 10 | -public interface InfApiErrorLogCoreService extends ApiErrorLogFrameworkService { | ||
| 11 | - | ||
| 12 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiAccessLogCoreServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.logger.impl; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.convert.logger.InfApiAccessLogCoreConvert; | ||
| 4 | -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO; | ||
| 5 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | ||
| 6 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiAccessLogCoreMapper; | ||
| 7 | -import cn.iocoder.yudao.coreservice.modules.infra.service.logger.InfApiAccessLogCoreService; | ||
| 8 | -import lombok.extern.slf4j.Slf4j; | ||
| 9 | -import org.springframework.scheduling.annotation.Async; | ||
| 10 | -import org.springframework.stereotype.Service; | ||
| 11 | -import org.springframework.validation.annotation.Validated; | ||
| 12 | - | ||
| 13 | -import javax.annotation.Resource; | ||
| 14 | - | ||
| 15 | -/** | ||
| 16 | - * API 访问日志 Service 实现类 | ||
| 17 | - * | ||
| 18 | - * @author 芋道源码 | ||
| 19 | - */ | ||
| 20 | -@Service | ||
| 21 | -@Validated | ||
| 22 | -@Slf4j | ||
| 23 | -public class InfApiAccessLogCoreServiceImpl implements InfApiAccessLogCoreService { | ||
| 24 | - | ||
| 25 | - @Resource | ||
| 26 | - private InfApiAccessLogCoreMapper apiAccessLogMapper; | ||
| 27 | - | ||
| 28 | - @Override | ||
| 29 | - @Async | ||
| 30 | - public void createApiAccessLogAsync(ApiAccessLogCreateReqDTO createDTO) { | ||
| 31 | - InfApiAccessLogDO apiAccessLog = InfApiAccessLogCoreConvert.INSTANCE.convert(createDTO); | ||
| 32 | - apiAccessLogMapper.insert(apiAccessLog); | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiErrorLogCoreServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.logger.impl; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.convert.logger.InfApiErrorLogCoreConvert; | ||
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; | ||
| 5 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiErrorLogCoreMapper; | ||
| 6 | -import cn.iocoder.yudao.coreservice.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum; | ||
| 7 | -import cn.iocoder.yudao.coreservice.modules.infra.service.logger.InfApiErrorLogCoreService; | ||
| 8 | -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO; | ||
| 9 | -import lombok.extern.slf4j.Slf4j; | ||
| 10 | -import org.springframework.scheduling.annotation.Async; | ||
| 11 | -import org.springframework.stereotype.Service; | ||
| 12 | -import org.springframework.validation.annotation.Validated; | ||
| 13 | - | ||
| 14 | -import javax.annotation.Resource; | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * API 错误日志 Service 实现类 | ||
| 18 | - * | ||
| 19 | - * @author 芋道源码 | ||
| 20 | - */ | ||
| 21 | -@Service | ||
| 22 | -@Validated | ||
| 23 | -@Slf4j | ||
| 24 | -public class InfApiErrorLogCoreServiceImpl implements InfApiErrorLogCoreService { | ||
| 25 | - | ||
| 26 | - @Resource | ||
| 27 | - private InfApiErrorLogCoreMapper apiErrorLogMapper; | ||
| 28 | - | ||
| 29 | - @Override | ||
| 30 | - @Async | ||
| 31 | - public void createApiErrorLogAsync(ApiErrorLogCreateReqDTO createDTO) { | ||
| 32 | - InfApiErrorLogDO apiErrorLog = InfApiErrorLogCoreConvert.INSTANCE.convert(createDTO); | ||
| 33 | - apiErrorLog.setProcessStatus(InfApiErrorLogProcessStatusEnum.INIT.getStatus()); | ||
| 34 | - apiErrorLogMapper.insert(apiErrorLog); | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | -} |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiErrorLogServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.logger.impl; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExportReqVO; | ||
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogPageReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.infra.dal.mysql.logger.InfApiErrorLogMapper; | ||
| 6 | -import cn.iocoder.yudao.module.infra.enums.logger.InfApiErrorLogProcessStatusEnum; | ||
| 7 | -import cn.iocoder.yudao.module.infra.service.logger.InfApiErrorLogService; | ||
| 8 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; | ||
| 9 | -import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; | ||
| 10 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 11 | -import cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants; | ||
| 12 | -import org.springframework.stereotype.Service; | ||
| 13 | -import org.springframework.validation.annotation.Validated; | ||
| 14 | - | ||
| 15 | -import javax.annotation.Resource; | ||
| 16 | -import java.util.Date; | ||
| 17 | -import java.util.List; | ||
| 18 | - | ||
| 19 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 20 | - | ||
| 21 | -/** | ||
| 22 | - * API 错误日志 Service 实现类 | ||
| 23 | - * | ||
| 24 | - * @author 芋道源码 | ||
| 25 | - */ | ||
| 26 | -@Service | ||
| 27 | -@Validated | ||
| 28 | -public class InfApiErrorLogServiceImpl implements InfApiErrorLogService { | ||
| 29 | - | ||
| 30 | - @Resource | ||
| 31 | - private InfApiErrorLogMapper apiErrorLogMapper; | ||
| 32 | - | ||
| 33 | - @Override | ||
| 34 | - public PageResult<InfApiErrorLogDO> getApiErrorLogPage(InfApiErrorLogPageReqVO pageReqVO) { | ||
| 35 | - return apiErrorLogMapper.selectPage(pageReqVO); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - @Override | ||
| 39 | - public List<InfApiErrorLogDO> getApiErrorLogList(InfApiErrorLogExportReqVO exportReqVO) { | ||
| 40 | - return apiErrorLogMapper.selectList(exportReqVO); | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - @Override | ||
| 44 | - public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) { | ||
| 45 | - InfApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id); | ||
| 46 | - if (errorLog == null) { | ||
| 47 | - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.API_ERROR_LOG_NOT_FOUND); | ||
| 48 | - } | ||
| 49 | - if (!InfApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) { | ||
| 50 | - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.API_ERROR_LOG_PROCESSED); | ||
| 51 | - } | ||
| 52 | - // 标记处理 | ||
| 53 | - apiErrorLogMapper.updateById(InfApiErrorLogDO.builder().id(id).processStatus(processStatus) | ||
| 54 | - .processUserId(processUserId).processTime(new Date()).build()); | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | -} |
yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/package-info.java deleted
| 1 | -package cn.iocoder.yudao.module.infra; |
yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/config/InfConfigServiceTest.java renamed to yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceTest.java
| 1 | package cn.iocoder.yudao.module.infra.service.config; | 1 | package cn.iocoder.yudao.module.infra.service.config; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; | ||
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | +import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; | ||
| 5 | +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | ||
| 6 | import cn.iocoder.yudao.framework.test.core.util.RandomUtils; | 6 | import cn.iocoder.yudao.framework.test.core.util.RandomUtils; |
| 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; | 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; |
| 8 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; | 8 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; |
| 9 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; | 9 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; |
| 10 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; | 10 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; |
| 11 | -import cn.iocoder.yudao.module.infra.dal.mysql.config.InfConfigMapper; | ||
| 12 | -import cn.iocoder.yudao.module.infra.enums.config.InfConfigTypeEnum; | ||
| 13 | -import cn.iocoder.yudao.module.infra.mq.producer.config.InfConfigProducer; | ||
| 14 | -import cn.iocoder.yudao.module.infra.service.config.impl.InfConfigServiceImpl; | ||
| 15 | -import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; | ||
| 16 | -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | 11 | +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; |
| 12 | +import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper; | ||
| 13 | +import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum; | ||
| 14 | +import cn.iocoder.yudao.module.infra.mq.producer.config.ConfigProducer; | ||
| 15 | +import cn.iocoder.yudao.module.infra.test.BaseDbUnitTest; | ||
| 17 | import org.junit.jupiter.api.Assertions; | 16 | import org.junit.jupiter.api.Assertions; |
| 18 | import org.junit.jupiter.api.Test; | 17 | import org.junit.jupiter.api.Test; |
| 19 | import org.springframework.boot.test.mock.mockito.MockBean; | 18 | import org.springframework.boot.test.mock.mockito.MockBean; |
| @@ -24,30 +23,25 @@ import java.util.List; | @@ -24,30 +23,25 @@ import java.util.List; | ||
| 24 | import java.util.function.Consumer; | 23 | import java.util.function.Consumer; |
| 25 | 24 | ||
| 26 | import static cn.hutool.core.util.RandomUtil.randomEle; | 25 | import static cn.hutool.core.util.RandomUtil.randomEle; |
| 27 | -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.*; | 26 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; |
| 28 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | 27 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 29 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | 28 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; |
| 30 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; | ||
| 31 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | 29 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 30 | +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; | ||
| 32 | import static org.junit.jupiter.api.Assertions.*; | 31 | import static org.junit.jupiter.api.Assertions.*; |
| 33 | import static org.mockito.Mockito.times; | 32 | import static org.mockito.Mockito.times; |
| 34 | import static org.mockito.Mockito.verify; | 33 | import static org.mockito.Mockito.verify; |
| 35 | 34 | ||
| 36 | -/** | ||
| 37 | - * {@link InfConfigServiceImpl} 的单元测试类 | ||
| 38 | - * | ||
| 39 | - * @author 芋道源码 | ||
| 40 | - */ | ||
| 41 | -@Import(InfConfigServiceImpl.class) | ||
| 42 | -public class InfConfigServiceTest extends BaseDbUnitTest { | 35 | +@Import(ConfigServiceImpl.class) |
| 36 | +public class ConfigServiceTest extends BaseDbUnitTest { | ||
| 43 | 37 | ||
| 44 | @Resource | 38 | @Resource |
| 45 | - private InfConfigServiceImpl configService; | 39 | + private ConfigServiceImpl configService; |
| 46 | 40 | ||
| 47 | @Resource | 41 | @Resource |
| 48 | - private InfConfigMapper configMapper; | 42 | + private ConfigMapper configMapper; |
| 49 | @MockBean | 43 | @MockBean |
| 50 | - private InfConfigProducer configProducer; | 44 | + private ConfigProducer configProducer; |
| 51 | 45 | ||
| 52 | @Test | 46 | @Test |
| 53 | public void testCreateConfig_success() { | 47 | public void testCreateConfig_success() { |
| @@ -59,9 +53,9 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -59,9 +53,9 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 59 | // 断言 | 53 | // 断言 |
| 60 | assertNotNull(configId); | 54 | assertNotNull(configId); |
| 61 | // 校验记录的属性是否正确 | 55 | // 校验记录的属性是否正确 |
| 62 | - InfConfigDO config = configMapper.selectById(configId); | 56 | + ConfigDO config = configMapper.selectById(configId); |
| 63 | assertPojoEquals(reqVO, config); | 57 | assertPojoEquals(reqVO, config); |
| 64 | - Assertions.assertEquals(InfConfigTypeEnum.CUSTOM.getType(), config.getType()); | 58 | + Assertions.assertEquals(ConfigTypeEnum.CUSTOM.getType(), config.getType()); |
| 65 | // 校验调用 | 59 | // 校验调用 |
| 66 | verify(configProducer, times(1)).sendConfigRefreshMessage(); | 60 | verify(configProducer, times(1)).sendConfigRefreshMessage(); |
| 67 | } | 61 | } |
| @@ -69,7 +63,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -69,7 +63,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 69 | @Test | 63 | @Test |
| 70 | public void testUpdateConfig_success() { | 64 | public void testUpdateConfig_success() { |
| 71 | // mock 数据 | 65 | // mock 数据 |
| 72 | - InfConfigDO dbConfig = randomInfConfigDO(); | 66 | + ConfigDO dbConfig = randomConfigDO(); |
| 73 | configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 | 67 | configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 |
| 74 | // 准备参数 | 68 | // 准备参数 |
| 75 | ConfigUpdateReqVO reqVO = randomPojo(ConfigUpdateReqVO.class, o -> { | 69 | ConfigUpdateReqVO reqVO = randomPojo(ConfigUpdateReqVO.class, o -> { |
| @@ -79,7 +73,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -79,7 +73,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 79 | // 调用 | 73 | // 调用 |
| 80 | configService.updateConfig(reqVO); | 74 | configService.updateConfig(reqVO); |
| 81 | // 校验是否更新正确 | 75 | // 校验是否更新正确 |
| 82 | - InfConfigDO config = configMapper.selectById(reqVO.getId()); // 获取最新的 | 76 | + ConfigDO config = configMapper.selectById(reqVO.getId()); // 获取最新的 |
| 83 | assertPojoEquals(reqVO, config); | 77 | assertPojoEquals(reqVO, config); |
| 84 | // 校验调用 | 78 | // 校验调用 |
| 85 | verify(configProducer, times(1)).sendConfigRefreshMessage(); | 79 | verify(configProducer, times(1)).sendConfigRefreshMessage(); |
| @@ -88,8 +82,8 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -88,8 +82,8 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 88 | @Test | 82 | @Test |
| 89 | public void testDeleteConfig_success() { | 83 | public void testDeleteConfig_success() { |
| 90 | // mock 数据 | 84 | // mock 数据 |
| 91 | - InfConfigDO dbConfig = randomInfConfigDO(o -> { | ||
| 92 | - o.setType(InfConfigTypeEnum.CUSTOM.getType()); // 只能删除 CUSTOM 类型 | 85 | + ConfigDO dbConfig = randomConfigDO(o -> { |
| 86 | + o.setType(ConfigTypeEnum.CUSTOM.getType()); // 只能删除 CUSTOM 类型 | ||
| 93 | }); | 87 | }); |
| 94 | configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 | 88 | configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 |
| 95 | // 准备参数 | 89 | // 准备参数 |
| @@ -106,8 +100,8 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -106,8 +100,8 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 106 | @Test | 100 | @Test |
| 107 | public void testDeleteConfig_canNotDeleteSystemType() { | 101 | public void testDeleteConfig_canNotDeleteSystemType() { |
| 108 | // mock 数据 | 102 | // mock 数据 |
| 109 | - InfConfigDO dbConfig = randomInfConfigDO(o -> { | ||
| 110 | - o.setType(InfConfigTypeEnum.SYSTEM.getType()); // SYSTEM 不允许删除 | 103 | + ConfigDO dbConfig = randomConfigDO(o -> { |
| 104 | + o.setType(ConfigTypeEnum.SYSTEM.getType()); // SYSTEM 不允许删除 | ||
| 111 | }); | 105 | }); |
| 112 | configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 | 106 | configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 |
| 113 | // 准备参数 | 107 | // 准备参数 |
| @@ -120,7 +114,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -120,7 +114,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 120 | @Test | 114 | @Test |
| 121 | public void testCheckConfigExists_success() { | 115 | public void testCheckConfigExists_success() { |
| 122 | // mock 数据 | 116 | // mock 数据 |
| 123 | - InfConfigDO dbConfigDO = randomInfConfigDO(); | 117 | + ConfigDO dbConfigDO = randomConfigDO(); |
| 124 | configMapper.insert(dbConfigDO);// @Sql: 先插入出一条存在的数据 | 118 | configMapper.insert(dbConfigDO);// @Sql: 先插入出一条存在的数据 |
| 125 | 119 | ||
| 126 | // 调用成功 | 120 | // 调用成功 |
| @@ -143,7 +137,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -143,7 +137,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 143 | // 准备参数 | 137 | // 准备参数 |
| 144 | String key = randomString(); | 138 | String key = randomString(); |
| 145 | // mock 数据 | 139 | // mock 数据 |
| 146 | - configMapper.insert(randomInfConfigDO(o -> o.setKey(key))); | 140 | + configMapper.insert(randomConfigDO(o -> o.setKey(key))); |
| 147 | 141 | ||
| 148 | // 调用,校验异常 | 142 | // 调用,校验异常 |
| 149 | assertServiceException(() -> configService.checkConfigKeyUnique(null, key), | 143 | assertServiceException(() -> configService.checkConfigKeyUnique(null, key), |
| @@ -156,7 +150,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -156,7 +150,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 156 | Long id = randomLongId(); | 150 | Long id = randomLongId(); |
| 157 | String key = randomString(); | 151 | String key = randomString(); |
| 158 | // mock 数据 | 152 | // mock 数据 |
| 159 | - configMapper.insert(randomInfConfigDO(o -> o.setKey(key))); | 153 | + configMapper.insert(randomConfigDO(o -> o.setKey(key))); |
| 160 | 154 | ||
| 161 | // 调用,校验异常 | 155 | // 调用,校验异常 |
| 162 | assertServiceException(() -> configService.checkConfigKeyUnique(id, key), | 156 | assertServiceException(() -> configService.checkConfigKeyUnique(id, key), |
| @@ -166,10 +160,10 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -166,10 +160,10 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 166 | @Test | 160 | @Test |
| 167 | public void testGetConfigPage() { | 161 | public void testGetConfigPage() { |
| 168 | // mock 数据 | 162 | // mock 数据 |
| 169 | - InfConfigDO dbConfig = randomInfConfigDO(o -> { // 等会查询到 | 163 | + ConfigDO dbConfig = randomConfigDO(o -> { // 等会查询到 |
| 170 | o.setName("芋艿"); | 164 | o.setName("芋艿"); |
| 171 | o.setKey("yunai"); | 165 | o.setKey("yunai"); |
| 172 | - o.setType(InfConfigTypeEnum.SYSTEM.getType()); | 166 | + o.setType(ConfigTypeEnum.SYSTEM.getType()); |
| 173 | o.setCreateTime(buildTime(2021, 2, 1)); | 167 | o.setCreateTime(buildTime(2021, 2, 1)); |
| 174 | }); | 168 | }); |
| 175 | configMapper.insert(dbConfig); | 169 | configMapper.insert(dbConfig); |
| @@ -178,19 +172,19 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -178,19 +172,19 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 178 | // 测试 key 不匹配 | 172 | // 测试 key 不匹配 |
| 179 | configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setKey("tudou"))); | 173 | configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setKey("tudou"))); |
| 180 | // 测试 type 不匹配 | 174 | // 测试 type 不匹配 |
| 181 | - configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(InfConfigTypeEnum.CUSTOM.getType()))); | 175 | + configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType()))); |
| 182 | // 测试 createTime 不匹配 | 176 | // 测试 createTime 不匹配 |
| 183 | configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1)))); | 177 | configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1)))); |
| 184 | // 准备参数 | 178 | // 准备参数 |
| 185 | ConfigPageReqVO reqVO = new ConfigPageReqVO(); | 179 | ConfigPageReqVO reqVO = new ConfigPageReqVO(); |
| 186 | reqVO.setName("艿"); | 180 | reqVO.setName("艿"); |
| 187 | reqVO.setKey("nai"); | 181 | reqVO.setKey("nai"); |
| 188 | - reqVO.setType(InfConfigTypeEnum.SYSTEM.getType()); | 182 | + reqVO.setType(ConfigTypeEnum.SYSTEM.getType()); |
| 189 | reqVO.setBeginTime(buildTime(2021, 1, 15)); | 183 | reqVO.setBeginTime(buildTime(2021, 1, 15)); |
| 190 | reqVO.setEndTime(buildTime(2021, 2, 15)); | 184 | reqVO.setEndTime(buildTime(2021, 2, 15)); |
| 191 | 185 | ||
| 192 | // 调用 | 186 | // 调用 |
| 193 | - PageResult<InfConfigDO> pageResult = configService.getConfigPage(reqVO); | 187 | + PageResult<ConfigDO> pageResult = configService.getConfigPage(reqVO); |
| 194 | // 断言 | 188 | // 断言 |
| 195 | assertEquals(1, pageResult.getTotal()); | 189 | assertEquals(1, pageResult.getTotal()); |
| 196 | assertEquals(1, pageResult.getList().size()); | 190 | assertEquals(1, pageResult.getList().size()); |
| @@ -200,10 +194,10 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -200,10 +194,10 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 200 | @Test | 194 | @Test |
| 201 | public void testGetConfigList() { | 195 | public void testGetConfigList() { |
| 202 | // mock 数据 | 196 | // mock 数据 |
| 203 | - InfConfigDO dbConfig = randomInfConfigDO(o -> { // 等会查询到 | 197 | + ConfigDO dbConfig = randomConfigDO(o -> { // 等会查询到 |
| 204 | o.setName("芋艿"); | 198 | o.setName("芋艿"); |
| 205 | o.setKey("yunai"); | 199 | o.setKey("yunai"); |
| 206 | - o.setType(InfConfigTypeEnum.SYSTEM.getType()); | 200 | + o.setType(ConfigTypeEnum.SYSTEM.getType()); |
| 207 | o.setCreateTime(buildTime(2021, 2, 1)); | 201 | o.setCreateTime(buildTime(2021, 2, 1)); |
| 208 | }); | 202 | }); |
| 209 | configMapper.insert(dbConfig); | 203 | configMapper.insert(dbConfig); |
| @@ -212,19 +206,19 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -212,19 +206,19 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 212 | // 测试 key 不匹配 | 206 | // 测试 key 不匹配 |
| 213 | configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setKey("tudou"))); | 207 | configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setKey("tudou"))); |
| 214 | // 测试 type 不匹配 | 208 | // 测试 type 不匹配 |
| 215 | - configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(InfConfigTypeEnum.CUSTOM.getType()))); | 209 | + configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType()))); |
| 216 | // 测试 createTime 不匹配 | 210 | // 测试 createTime 不匹配 |
| 217 | configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1)))); | 211 | configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1)))); |
| 218 | // 准备参数 | 212 | // 准备参数 |
| 219 | ConfigExportReqVO reqVO = new ConfigExportReqVO(); | 213 | ConfigExportReqVO reqVO = new ConfigExportReqVO(); |
| 220 | reqVO.setName("艿"); | 214 | reqVO.setName("艿"); |
| 221 | reqVO.setKey("nai"); | 215 | reqVO.setKey("nai"); |
| 222 | - reqVO.setType(InfConfigTypeEnum.SYSTEM.getType()); | 216 | + reqVO.setType(ConfigTypeEnum.SYSTEM.getType()); |
| 223 | reqVO.setBeginTime(buildTime(2021, 1, 15)); | 217 | reqVO.setBeginTime(buildTime(2021, 1, 15)); |
| 224 | reqVO.setEndTime(buildTime(2021, 2, 15)); | 218 | reqVO.setEndTime(buildTime(2021, 2, 15)); |
| 225 | 219 | ||
| 226 | // 调用 | 220 | // 调用 |
| 227 | - List<InfConfigDO> list = configService.getConfigList(reqVO); | 221 | + List<ConfigDO> list = configService.getConfigList(reqVO); |
| 228 | // 断言 | 222 | // 断言 |
| 229 | assertEquals(1, list.size()); | 223 | assertEquals(1, list.size()); |
| 230 | assertPojoEquals(dbConfig, list.get(0)); | 224 | assertPojoEquals(dbConfig, list.get(0)); |
| @@ -233,13 +227,13 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -233,13 +227,13 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 233 | @Test | 227 | @Test |
| 234 | public void testGetConfigByKey() { | 228 | public void testGetConfigByKey() { |
| 235 | // mock 数据 | 229 | // mock 数据 |
| 236 | - InfConfigDO dbConfig = randomInfConfigDO(); | 230 | + ConfigDO dbConfig = randomConfigDO(); |
| 237 | configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 | 231 | configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 |
| 238 | // 准备参数 | 232 | // 准备参数 |
| 239 | String key = dbConfig.getKey(); | 233 | String key = dbConfig.getKey(); |
| 240 | 234 | ||
| 241 | // 调用 | 235 | // 调用 |
| 242 | - InfConfigDO config = configService.getConfigByKey(key); | 236 | + ConfigDO config = configService.getConfigByKey(key); |
| 243 | // 断言 | 237 | // 断言 |
| 244 | assertNotNull(config); | 238 | assertNotNull(config); |
| 245 | assertPojoEquals(dbConfig, config); | 239 | assertPojoEquals(dbConfig, config); |
| @@ -248,11 +242,11 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | @@ -248,11 +242,11 @@ public class InfConfigServiceTest extends BaseDbUnitTest { | ||
| 248 | // ========== 随机对象 ========== | 242 | // ========== 随机对象 ========== |
| 249 | 243 | ||
| 250 | @SafeVarargs | 244 | @SafeVarargs |
| 251 | - private static InfConfigDO randomInfConfigDO(Consumer<InfConfigDO>... consumers) { | ||
| 252 | - Consumer<InfConfigDO> consumer = (o) -> { | ||
| 253 | - o.setType(randomEle(InfConfigTypeEnum.values()).getType()); // 保证 key 的范围 | 245 | + private static ConfigDO randomConfigDO(Consumer<ConfigDO>... consumers) { |
| 246 | + Consumer<ConfigDO> consumer = (o) -> { | ||
| 247 | + o.setType(randomEle(ConfigTypeEnum.values()).getType()); // 保证 key 的范围 | ||
| 254 | }; | 248 | }; |
| 255 | - return RandomUtils.randomPojo(InfConfigDO.class, ArrayUtils.append(consumer, consumers)); | 249 | + return RandomUtils.randomPojo(ConfigDO.class, ArrayUtils.append(consumer, consumers)); |
| 256 | } | 250 | } |
| 257 | 251 | ||
| 258 | } | 252 | } |
yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreServiceTest.java renamed to yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java
| 1 | -package cn.iocoder.yudao.coreservice.modules.infra.service.file; | 1 | +package cn.iocoder.yudao.module.infra.service.file; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.io.resource.ResourceUtil; | 3 | import cn.hutool.core.io.resource.ResourceUtil; |
| 4 | -import cn.iocoder.yudao.coreservice.BaseDbUnitTest; | ||
| 5 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; | ||
| 6 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper; | ||
| 7 | -import cn.iocoder.yudao.coreservice.modules.infra.framework.file.config.FileProperties; | ||
| 8 | -import cn.iocoder.yudao.coreservice.modules.infra.service.file.impl.InfFileCoreServiceImpl; | 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | ||
| 6 | +import cn.iocoder.yudao.framework.test.core.util.AssertUtils; | ||
| 7 | +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; | ||
| 9 | +import cn.iocoder.yudao.module.infra.dal.mysql.file.FileMapper; | ||
| 10 | +import cn.iocoder.yudao.module.infra.framework.file.config.FileProperties; | ||
| 11 | +import cn.iocoder.yudao.module.infra.test.BaseDbUnitTest; | ||
| 9 | import org.junit.jupiter.api.Test; | 12 | import org.junit.jupiter.api.Test; |
| 10 | import org.springframework.boot.test.mock.mockito.MockBean; | 13 | import org.springframework.boot.test.mock.mockito.MockBean; |
| 11 | import org.springframework.context.annotation.Import; | 14 | import org.springframework.context.annotation.Import; |
| 12 | 15 | ||
| 13 | import javax.annotation.Resource; | 16 | import javax.annotation.Resource; |
| 14 | 17 | ||
| 15 | -import static cn.iocoder.yudao.coreservice.modules.infra.enums.SysErrorCodeConstants.*; | 18 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; |
| 16 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | 19 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; |
| 17 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | 20 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| 18 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString; | 21 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString; |
| 22 | +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; | ||
| 19 | import static org.junit.jupiter.api.Assertions.*; | 23 | import static org.junit.jupiter.api.Assertions.*; |
| 20 | 24 | ||
| 21 | -@Import({InfFileCoreServiceImpl.class, FileProperties.class}) | ||
| 22 | -public class InfFileCoreServiceTest extends BaseDbUnitTest { | 25 | +@Import({FileServiceImpl.class, FileProperties.class}) |
| 26 | +public class FileServiceTest extends BaseDbUnitTest { | ||
| 23 | 27 | ||
| 24 | @Resource | 28 | @Resource |
| 25 | - private InfFileCoreService fileCoreService; | 29 | + private FileService fileService; |
| 26 | 30 | ||
| 27 | @MockBean | 31 | @MockBean |
| 28 | private FileProperties fileProperties; | 32 | private FileProperties fileProperties; |
| 29 | 33 | ||
| 30 | @Resource | 34 | @Resource |
| 31 | - private InfFileCoreMapper fileMapper; | 35 | + private FileMapper fileMapper; |
| 36 | + | ||
| 37 | + @Test | ||
| 38 | + public void testGetFilePage() { | ||
| 39 | + // mock 数据 | ||
| 40 | + FileDO dbFile = randomPojo(FileDO.class, o -> { // 等会查询到 | ||
| 41 | + o.setId("yudao"); | ||
| 42 | + o.setType("jpg"); | ||
| 43 | + o.setCreateTime(buildTime(2021, 1, 15)); | ||
| 44 | + }); | ||
| 45 | + fileMapper.insert(dbFile); | ||
| 46 | + // 测试 id 不匹配 | ||
| 47 | + fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> o.setId("tudou"))); | ||
| 48 | + // 测试 type 不匹配 | ||
| 49 | + fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> { | ||
| 50 | + o.setId("yudao02"); | ||
| 51 | + o.setType("png"); | ||
| 52 | + })); | ||
| 53 | + // 测试 createTime 不匹配 | ||
| 54 | + fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> { | ||
| 55 | + o.setId("yudao03"); | ||
| 56 | + o.setCreateTime(buildTime(2020, 1, 15)); | ||
| 57 | + })); | ||
| 58 | + // 准备参数 | ||
| 59 | + FilePageReqVO reqVO = new FilePageReqVO(); | ||
| 60 | + reqVO.setId("yudao"); | ||
| 61 | + reqVO.setType("jp"); | ||
| 62 | + reqVO.setBeginCreateTime(buildTime(2021, 1, 10)); | ||
| 63 | + reqVO.setEndCreateTime(buildTime(2021, 1, 20)); | ||
| 64 | + | ||
| 65 | + // 调用 | ||
| 66 | + PageResult<FileDO> pageResult = fileService.getFilePage(reqVO); | ||
| 67 | + // 断言 | ||
| 68 | + assertEquals(1, pageResult.getTotal()); | ||
| 69 | + assertEquals(1, pageResult.getList().size()); | ||
| 70 | + AssertUtils.assertPojoEquals(dbFile, pageResult.getList().get(0), "content"); | ||
| 71 | + } | ||
| 32 | 72 | ||
| 33 | @Test | 73 | @Test |
| 34 | public void testCreateFile_success() { | 74 | public void testCreateFile_success() { |
| @@ -37,11 +77,11 @@ public class InfFileCoreServiceTest extends BaseDbUnitTest { | @@ -37,11 +77,11 @@ public class InfFileCoreServiceTest extends BaseDbUnitTest { | ||
| 37 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); | 77 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); |
| 38 | 78 | ||
| 39 | // 调用 | 79 | // 调用 |
| 40 | - String url = fileCoreService.createFile(path, content); | 80 | + String url = fileService.createFile(path, content); |
| 41 | // 断言 | 81 | // 断言 |
| 42 | assertEquals(fileProperties.getBasePath() + path, url); | 82 | assertEquals(fileProperties.getBasePath() + path, url); |
| 43 | // 校验数据 | 83 | // 校验数据 |
| 44 | - InfFileDO file = fileMapper.selectById(path); | 84 | + FileDO file = fileMapper.selectById(path); |
| 45 | assertEquals(path, file.getId()); | 85 | assertEquals(path, file.getId()); |
| 46 | assertEquals("jpg", file.getType()); | 86 | assertEquals("jpg", file.getType()); |
| 47 | assertArrayEquals(content, file.getContent()); | 87 | assertArrayEquals(content, file.getContent()); |
| @@ -50,26 +90,26 @@ public class InfFileCoreServiceTest extends BaseDbUnitTest { | @@ -50,26 +90,26 @@ public class InfFileCoreServiceTest extends BaseDbUnitTest { | ||
| 50 | @Test | 90 | @Test |
| 51 | public void testCreateFile_exists() { | 91 | public void testCreateFile_exists() { |
| 52 | // mock 数据 | 92 | // mock 数据 |
| 53 | - InfFileDO dbFile = randomPojo(InfFileDO.class); | 93 | + FileDO dbFile = randomPojo(FileDO.class); |
| 54 | fileMapper.insert(dbFile); | 94 | fileMapper.insert(dbFile); |
| 55 | // 准备参数 | 95 | // 准备参数 |
| 56 | String path = dbFile.getId(); // 模拟已存在 | 96 | String path = dbFile.getId(); // 模拟已存在 |
| 57 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); | 97 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); |
| 58 | 98 | ||
| 59 | // 调用,并断言异常 | 99 | // 调用,并断言异常 |
| 60 | - assertServiceException(() -> fileCoreService.createFile(path, content), FILE_PATH_EXISTS); | 100 | + assertServiceException(() -> fileService.createFile(path, content), FILE_PATH_EXISTS); |
| 61 | } | 101 | } |
| 62 | 102 | ||
| 63 | @Test | 103 | @Test |
| 64 | public void testDeleteFile_success() { | 104 | public void testDeleteFile_success() { |
| 65 | // mock 数据 | 105 | // mock 数据 |
| 66 | - InfFileDO dbFile = randomPojo(InfFileDO.class); | 106 | + FileDO dbFile = randomPojo(FileDO.class); |
| 67 | fileMapper.insert(dbFile);// @Sql: 先插入出一条存在的数据 | 107 | fileMapper.insert(dbFile);// @Sql: 先插入出一条存在的数据 |
| 68 | // 准备参数 | 108 | // 准备参数 |
| 69 | String id = dbFile.getId(); | 109 | String id = dbFile.getId(); |
| 70 | 110 | ||
| 71 | // 调用 | 111 | // 调用 |
| 72 | - fileCoreService.deleteFile(id); | 112 | + fileService.deleteFile(id); |
| 73 | // 校验数据不存在了 | 113 | // 校验数据不存在了 |
| 74 | assertNull(fileMapper.selectById(id)); | 114 | assertNull(fileMapper.selectById(id)); |
| 75 | } | 115 | } |
| @@ -80,7 +120,7 @@ public class InfFileCoreServiceTest extends BaseDbUnitTest { | @@ -80,7 +120,7 @@ public class InfFileCoreServiceTest extends BaseDbUnitTest { | ||
| 80 | String id = randomString(); | 120 | String id = randomString(); |
| 81 | 121 | ||
| 82 | // 调用, 并断言异常 | 122 | // 调用, 并断言异常 |
| 83 | - assertServiceException(() -> fileCoreService.deleteFile(id), FILE_NOT_EXISTS); | 123 | + assertServiceException(() -> fileService.deleteFile(id), FILE_NOT_EXISTS); |
| 84 | } | 124 | } |
| 85 | 125 | ||
| 86 | } | 126 | } |
yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/InfFileServiceTest.java deleted
| 1 | -package cn.iocoder.yudao.module.infra.service.file; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; | ||
| 4 | -import cn.iocoder.yudao.framework.test.core.util.AssertUtils; | ||
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.infra.service.file.impl.InfFileServiceImpl; | ||
| 7 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; | ||
| 8 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper; | ||
| 9 | -import cn.iocoder.yudao.coreservice.modules.infra.framework.file.config.FileProperties; | ||
| 10 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 11 | -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | ||
| 12 | -import org.junit.jupiter.api.Test; | ||
| 13 | -import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 14 | -import org.springframework.context.annotation.Import; | ||
| 15 | - | ||
| 16 | -import javax.annotation.Resource; | ||
| 17 | - | ||
| 18 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; | ||
| 19 | -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | ||
| 20 | -import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| 21 | - | ||
| 22 | -@Import({InfFileServiceImpl.class, FileProperties.class}) | ||
| 23 | -public class InfFileServiceTest extends BaseDbUnitTest { | ||
| 24 | - | ||
| 25 | - @Resource | ||
| 26 | - private InfFileService fileService; | ||
| 27 | - | ||
| 28 | - @MockBean | ||
| 29 | - private FileProperties fileProperties; | ||
| 30 | - | ||
| 31 | - @Resource | ||
| 32 | - private InfFileCoreMapper fileMapper; | ||
| 33 | - | ||
| 34 | - @Test | ||
| 35 | - public void testGetFilePage() { | ||
| 36 | - // mock 数据 | ||
| 37 | - InfFileDO dbFile = randomPojo(InfFileDO.class, o -> { // 等会查询到 | ||
| 38 | - o.setId("yudao"); | ||
| 39 | - o.setType("jpg"); | ||
| 40 | - o.setCreateTime(buildTime(2021, 1, 15)); | ||
| 41 | - }); | ||
| 42 | - fileMapper.insert(dbFile); | ||
| 43 | - // 测试 id 不匹配 | ||
| 44 | - fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> o.setId("tudou"))); | ||
| 45 | - // 测试 type 不匹配 | ||
| 46 | - fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> { | ||
| 47 | - o.setId("yudao02"); | ||
| 48 | - o.setType("png"); | ||
| 49 | - })); | ||
| 50 | - // 测试 createTime 不匹配 | ||
| 51 | - fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> { | ||
| 52 | - o.setId("yudao03"); | ||
| 53 | - o.setCreateTime(buildTime(2020, 1, 15)); | ||
| 54 | - })); | ||
| 55 | - // 准备参数 | ||
| 56 | - InfFilePageReqVO reqVO = new InfFilePageReqVO(); | ||
| 57 | - reqVO.setId("yudao"); | ||
| 58 | - reqVO.setType("jp"); | ||
| 59 | - reqVO.setBeginCreateTime(buildTime(2021, 1, 10)); | ||
| 60 | - reqVO.setEndCreateTime(buildTime(2021, 1, 20)); | ||
| 61 | - | ||
| 62 | - // 调用 | ||
| 63 | - PageResult<InfFileDO> pageResult = fileService.getFilePage(reqVO); | ||
| 64 | - // 断言 | ||
| 65 | - assertEquals(1, pageResult.getTotal()); | ||
| 66 | - assertEquals(1, pageResult.getList().size()); | ||
| 67 | - AssertUtils.assertPojoEquals(dbFile, pageResult.getList().get(0), "content"); | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | -} |
yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/InfJobLogServiceTest.java renamed to yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceTest.java
| @@ -14,36 +14,30 @@ import java.util.List; | @@ -14,36 +14,30 @@ import java.util.List; | ||
| 14 | 14 | ||
| 15 | import javax.annotation.Resource; | 15 | import javax.annotation.Resource; |
| 16 | 16 | ||
| 17 | +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; | ||
| 18 | +import cn.iocoder.yudao.module.infra.test.BaseDbUnitTest; | ||
| 17 | import org.junit.jupiter.api.Test; | 19 | import org.junit.jupiter.api.Test; |
| 18 | import org.springframework.context.annotation.Import; | 20 | import org.springframework.context.annotation.Import; |
| 19 | 21 | ||
| 20 | -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; | ||
| 21 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 22 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 22 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO; | ||
| 23 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO; | ||
| 24 | -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO; | ||
| 25 | -import cn.iocoder.yudao.module.infra.dal.mysql.job.InfJobLogMapper; | ||
| 26 | -import cn.iocoder.yudao.module.infra.enums.job.InfJobLogStatusEnum; | ||
| 27 | -import cn.iocoder.yudao.module.infra.service.job.impl.InfJobLogServiceImpl; | 23 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; |
| 24 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; | ||
| 25 | +import cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper; | ||
| 26 | +import cn.iocoder.yudao.module.infra.enums.job.JobLogStatusEnum; | ||
| 28 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | 27 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 29 | 28 | ||
| 30 | -/** | ||
| 31 | - * {@link InfJobLogServiceImpl} 的单元测试 | ||
| 32 | - * | ||
| 33 | - * @author neilz | ||
| 34 | - */ | ||
| 35 | -@Import(InfJobLogServiceImpl.class) | ||
| 36 | -public class InfJobLogServiceTest extends BaseDbUnitTest { | 29 | +@Import(JobLogServiceImpl.class) |
| 30 | +public class JobLogServiceTest extends BaseDbUnitTest { | ||
| 37 | 31 | ||
| 38 | @Resource | 32 | @Resource |
| 39 | - private InfJobLogServiceImpl jobLogService; | 33 | + private JobLogServiceImpl jobLogService; |
| 40 | @Resource | 34 | @Resource |
| 41 | - private InfJobLogMapper jobLogMapper; | 35 | + private JobLogMapper jobLogMapper; |
| 42 | 36 | ||
| 43 | @Test | 37 | @Test |
| 44 | public void testCreateJobLog_success() { | 38 | public void testCreateJobLog_success() { |
| 45 | // 准备参数 | 39 | // 准备参数 |
| 46 | - InfJobLogDO reqVO = randomPojo(InfJobLogDO.class, o -> { | 40 | + JobLogDO reqVO = randomPojo(JobLogDO.class, o -> { |
| 47 | o.setExecuteIndex(1); | 41 | o.setExecuteIndex(1); |
| 48 | }); | 42 | }); |
| 49 | // 调用 | 43 | // 调用 |
| @@ -51,40 +45,40 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { | @@ -51,40 +45,40 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { | ||
| 51 | // 断言 | 45 | // 断言 |
| 52 | assertNotNull(jobLogId); | 46 | assertNotNull(jobLogId); |
| 53 | // 校验记录的属性是否正确 | 47 | // 校验记录的属性是否正确 |
| 54 | - InfJobLogDO job = jobLogMapper.selectById(jobLogId); | ||
| 55 | - assertEquals(InfJobLogStatusEnum.RUNNING.getStatus(), job.getStatus()); | 48 | + JobLogDO job = jobLogMapper.selectById(jobLogId); |
| 49 | + assertEquals(JobLogStatusEnum.RUNNING.getStatus(), job.getStatus()); | ||
| 56 | } | 50 | } |
| 57 | 51 | ||
| 58 | @Test | 52 | @Test |
| 59 | public void testUpdateJobLogResultAsync_success() { | 53 | public void testUpdateJobLogResultAsync_success() { |
| 60 | // 准备参数 | 54 | // 准备参数 |
| 61 | - InfJobLogDO reqVO = randomPojo(InfJobLogDO.class, o -> { | 55 | + JobLogDO reqVO = randomPojo(JobLogDO.class, o -> { |
| 62 | o.setExecuteIndex(1); | 56 | o.setExecuteIndex(1); |
| 63 | }); | 57 | }); |
| 64 | - InfJobLogDO log = InfJobLogDO.builder().jobId(reqVO.getJobId()).handlerName(reqVO.getHandlerName()).handlerParam(reqVO.getHandlerParam()).executeIndex(reqVO.getExecuteIndex()) | ||
| 65 | - .beginTime(reqVO.getBeginTime()).status(InfJobLogStatusEnum.RUNNING.getStatus()).build(); | 58 | + JobLogDO log = JobLogDO.builder().jobId(reqVO.getJobId()).handlerName(reqVO.getHandlerName()).handlerParam(reqVO.getHandlerParam()).executeIndex(reqVO.getExecuteIndex()) |
| 59 | + .beginTime(reqVO.getBeginTime()).status(JobLogStatusEnum.RUNNING.getStatus()).build(); | ||
| 66 | jobLogMapper.insert(log); | 60 | jobLogMapper.insert(log); |
| 67 | // 调用 | 61 | // 调用 |
| 68 | jobLogService.updateJobLogResultAsync(log.getId(), reqVO.getBeginTime(), reqVO.getDuration(), true,reqVO.getResult()); | 62 | jobLogService.updateJobLogResultAsync(log.getId(), reqVO.getBeginTime(), reqVO.getDuration(), true,reqVO.getResult()); |
| 69 | // 校验记录的属性是否正确 | 63 | // 校验记录的属性是否正确 |
| 70 | - InfJobLogDO job = jobLogMapper.selectById(log.getId()); | ||
| 71 | - assertEquals(InfJobLogStatusEnum.SUCCESS.getStatus(), job.getStatus()); | 64 | + JobLogDO job = jobLogMapper.selectById(log.getId()); |
| 65 | + assertEquals(JobLogStatusEnum.SUCCESS.getStatus(), job.getStatus()); | ||
| 72 | 66 | ||
| 73 | // 调用 | 67 | // 调用 |
| 74 | jobLogService.updateJobLogResultAsync(log.getId(), reqVO.getBeginTime(), reqVO.getDuration(), false,reqVO.getResult()); | 68 | jobLogService.updateJobLogResultAsync(log.getId(), reqVO.getBeginTime(), reqVO.getDuration(), false,reqVO.getResult()); |
| 75 | // 校验记录的属性是否正确 | 69 | // 校验记录的属性是否正确 |
| 76 | - InfJobLogDO job2 = jobLogMapper.selectById(log.getId()); | ||
| 77 | - assertEquals(InfJobLogStatusEnum.FAILURE.getStatus(), job2.getStatus()); | 70 | + JobLogDO job2 = jobLogMapper.selectById(log.getId()); |
| 71 | + assertEquals(JobLogStatusEnum.FAILURE.getStatus(), job2.getStatus()); | ||
| 78 | } | 72 | } |
| 79 | 73 | ||
| 80 | @Test | 74 | @Test |
| 81 | public void testGetJobLogListByIds_success() { | 75 | public void testGetJobLogListByIds_success() { |
| 82 | // mock 数据 | 76 | // mock 数据 |
| 83 | - InfJobLogDO dbJobLog = randomPojo(InfJobLogDO.class, o -> { | 77 | + JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { |
| 84 | o.setExecuteIndex(1); | 78 | o.setExecuteIndex(1); |
| 85 | - o.setStatus(randomEle(InfJobLogStatusEnum.values()).getStatus()); // 保证 status 的范围 | 79 | + o.setStatus(randomEle(JobLogStatusEnum.values()).getStatus()); // 保证 status 的范围 |
| 86 | }); | 80 | }); |
| 87 | - InfJobLogDO cloneJobLog = ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())); | 81 | + JobLogDO cloneJobLog = ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())); |
| 88 | jobLogMapper.insert(dbJobLog); | 82 | jobLogMapper.insert(dbJobLog); |
| 89 | // 测试 handlerName 不匹配 | 83 | // 测试 handlerName 不匹配 |
| 90 | jobLogMapper.insert(cloneJobLog); | 84 | jobLogMapper.insert(cloneJobLog); |
| @@ -93,7 +87,7 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { | @@ -93,7 +87,7 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { | ||
| 93 | ids.add(dbJobLog.getId()); | 87 | ids.add(dbJobLog.getId()); |
| 94 | ids.add(cloneJobLog.getId()); | 88 | ids.add(cloneJobLog.getId()); |
| 95 | // 调用 | 89 | // 调用 |
| 96 | - List<InfJobLogDO> list = jobLogService.getJobLogList(ids); | 90 | + List<JobLogDO> list = jobLogService.getJobLogList(ids); |
| 97 | // 断言 | 91 | // 断言 |
| 98 | assertEquals(2, list.size()); | 92 | assertEquals(2, list.size()); |
| 99 | assertPojoEquals(dbJobLog, list.get(0)); | 93 | assertPojoEquals(dbJobLog, list.get(0)); |
| @@ -102,10 +96,10 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { | @@ -102,10 +96,10 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { | ||
| 102 | @Test | 96 | @Test |
| 103 | public void testGetJobPage_success() { | 97 | public void testGetJobPage_success() { |
| 104 | // mock 数据 | 98 | // mock 数据 |
| 105 | - InfJobLogDO dbJobLog = randomPojo(InfJobLogDO.class, o -> { | 99 | + JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { |
| 106 | o.setExecuteIndex(1); | 100 | o.setExecuteIndex(1); |
| 107 | o.setHandlerName("handlerName 单元测试"); | 101 | o.setHandlerName("handlerName 单元测试"); |
| 108 | - o.setStatus(InfJobLogStatusEnum.SUCCESS.getStatus()); | 102 | + o.setStatus(JobLogStatusEnum.SUCCESS.getStatus()); |
| 109 | o.setBeginTime(buildTime(2021, 1, 8)); | 103 | o.setBeginTime(buildTime(2021, 1, 8)); |
| 110 | o.setEndTime(buildTime(2021, 1, 8)); | 104 | o.setEndTime(buildTime(2021, 1, 8)); |
| 111 | }); | 105 | }); |
| @@ -119,16 +113,16 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { | @@ -119,16 +113,16 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { | ||
| 119 | // 测试 endTime 不匹配 | 113 | // 测试 endTime 不匹配 |
| 120 | jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9)))); | 114 | jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9)))); |
| 121 | // 测试 status 不匹配 | 115 | // 测试 status 不匹配 |
| 122 | - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(InfJobLogStatusEnum.FAILURE.getStatus()))); | 116 | + jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus()))); |
| 123 | // 准备参数 | 117 | // 准备参数 |
| 124 | - InfJobLogPageReqVO reqVo = new InfJobLogPageReqVO(); | 118 | + JobLogPageReqVO reqVo = new JobLogPageReqVO(); |
| 125 | reqVo.setJobId(dbJobLog.getJobId()); | 119 | reqVo.setJobId(dbJobLog.getJobId()); |
| 126 | reqVo.setHandlerName("单元"); | 120 | reqVo.setHandlerName("单元"); |
| 127 | reqVo.setBeginTime(dbJobLog.getBeginTime()); | 121 | reqVo.setBeginTime(dbJobLog.getBeginTime()); |
| 128 | reqVo.setEndTime(dbJobLog.getEndTime()); | 122 | reqVo.setEndTime(dbJobLog.getEndTime()); |
| 129 | - reqVo.setStatus(InfJobLogStatusEnum.SUCCESS.getStatus()); | 123 | + reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus()); |
| 130 | // 调用 | 124 | // 调用 |
| 131 | - PageResult<InfJobLogDO> pageResult = jobLogService.getJobLogPage(reqVo); | 125 | + PageResult<JobLogDO> pageResult = jobLogService.getJobLogPage(reqVo); |
| 132 | // 断言 | 126 | // 断言 |
| 133 | assertEquals(1, pageResult.getTotal()); | 127 | assertEquals(1, pageResult.getTotal()); |
| 134 | assertEquals(1, pageResult.getList().size()); | 128 | assertEquals(1, pageResult.getList().size()); |
| @@ -138,10 +132,10 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { | @@ -138,10 +132,10 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { | ||
| 138 | @Test | 132 | @Test |
| 139 | public void testGetJobListForExport_success() { | 133 | public void testGetJobListForExport_success() { |
| 140 | // mock 数据 | 134 | // mock 数据 |
| 141 | - InfJobLogDO dbJobLog = randomPojo(InfJobLogDO.class, o -> { | 135 | + JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { |
| 142 | o.setExecuteIndex(1); | 136 | o.setExecuteIndex(1); |
| 143 | o.setHandlerName("handlerName 单元测试"); | 137 | o.setHandlerName("handlerName 单元测试"); |
| 144 | - o.setStatus(InfJobLogStatusEnum.SUCCESS.getStatus()); | 138 | + o.setStatus(JobLogStatusEnum.SUCCESS.getStatus()); |
| 145 | o.setBeginTime(buildTime(2021, 1, 8)); | 139 | o.setBeginTime(buildTime(2021, 1, 8)); |
| 146 | o.setEndTime(buildTime(2021, 1, 8)); | 140 | o.setEndTime(buildTime(2021, 1, 8)); |
| 147 | }); | 141 | }); |
| @@ -155,16 +149,16 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { | @@ -155,16 +149,16 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { | ||
| 155 | // 测试 endTime 不匹配 | 149 | // 测试 endTime 不匹配 |
| 156 | jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9)))); | 150 | jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9)))); |
| 157 | // 测试 status 不匹配 | 151 | // 测试 status 不匹配 |
| 158 | - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(InfJobLogStatusEnum.FAILURE.getStatus()))); | 152 | + jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus()))); |
| 159 | // 准备参数 | 153 | // 准备参数 |
| 160 | - InfJobLogExportReqVO reqVo = new InfJobLogExportReqVO(); | 154 | + JobLogExportReqVO reqVo = new JobLogExportReqVO(); |
| 161 | reqVo.setJobId(dbJobLog.getJobId()); | 155 | reqVo.setJobId(dbJobLog.getJobId()); |
| 162 | reqVo.setHandlerName("单元"); | 156 | reqVo.setHandlerName("单元"); |
| 163 | reqVo.setBeginTime(dbJobLog.getBeginTime()); | 157 | reqVo.setBeginTime(dbJobLog.getBeginTime()); |
| 164 | reqVo.setEndTime(dbJobLog.getEndTime()); | 158 | reqVo.setEndTime(dbJobLog.getEndTime()); |
| 165 | - reqVo.setStatus(InfJobLogStatusEnum.SUCCESS.getStatus()); | 159 | + reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus()); |
| 166 | // 调用 | 160 | // 调用 |
| 167 | - List<InfJobLogDO> list = jobLogService.getJobLogList(reqVo); | 161 | + List<JobLogDO> list = jobLogService.getJobLogList(reqVo); |
| 168 | // 断言 | 162 | // 断言 |
| 169 | assertEquals(1, list.size()); | 163 | assertEquals(1, list.size()); |
| 170 | assertPojoEquals(dbJobLog, list.get(0)); | 164 | assertPojoEquals(dbJobLog, list.get(0)); |
yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/InfJobServiceTest.java renamed to yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobServiceTest.java
| 1 | package cn.iocoder.yudao.module.infra.service.job; | 1 | package cn.iocoder.yudao.module.infra.service.job; |
| 2 | 2 | ||
| 3 | import static cn.hutool.core.util.RandomUtil.randomEle; | 3 | import static cn.hutool.core.util.RandomUtil.randomEle; |
| 4 | -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.JOB_CHANGE_STATUS_EQUALS; | ||
| 5 | -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.JOB_CHANGE_STATUS_INVALID; | ||
| 6 | -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.JOB_CRON_EXPRESSION_VALID; | ||
| 7 | -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.JOB_HANDLER_EXISTS; | ||
| 8 | -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.JOB_NOT_EXISTS; | ||
| 9 | -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.JOB_UPDATE_ONLY_NORMAL_STATUS; | 4 | +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; |
| 10 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | 5 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 11 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | 6 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; |
| 12 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | 7 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| @@ -23,44 +18,38 @@ import java.util.List; | @@ -23,44 +18,38 @@ import java.util.List; | ||
| 23 | 18 | ||
| 24 | import javax.annotation.Resource; | 19 | import javax.annotation.Resource; |
| 25 | 20 | ||
| 21 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO; | ||
| 22 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO; | ||
| 23 | +import cn.iocoder.yudao.module.infra.convert.job.JobConvert; | ||
| 24 | +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; | ||
| 25 | +import cn.iocoder.yudao.module.infra.test.BaseDbUnitTest; | ||
| 26 | import org.junit.jupiter.api.Test; | 26 | import org.junit.jupiter.api.Test; |
| 27 | import org.quartz.SchedulerException; | 27 | import org.quartz.SchedulerException; |
| 28 | import org.springframework.boot.test.mock.mockito.MockBean; | 28 | import org.springframework.boot.test.mock.mockito.MockBean; |
| 29 | import org.springframework.context.annotation.Import; | 29 | import org.springframework.context.annotation.Import; |
| 30 | 30 | ||
| 31 | -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; | ||
| 32 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 31 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 33 | import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager; | 32 | import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager; |
| 34 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobCreateReqVO; | ||
| 35 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExportReqVO; | ||
| 36 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobPageReqVO; | ||
| 37 | -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobUpdateReqVO; | ||
| 38 | -import cn.iocoder.yudao.module.infra.convert.job.InfJobConvert; | ||
| 39 | -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO; | ||
| 40 | -import cn.iocoder.yudao.module.infra.dal.mysql.job.InfJobMapper; | ||
| 41 | -import cn.iocoder.yudao.module.infra.enums.job.InfJobStatusEnum; | ||
| 42 | -import cn.iocoder.yudao.module.infra.service.job.impl.InfJobServiceImpl; | 33 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO; |
| 34 | +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO; | ||
| 35 | +import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper; | ||
| 36 | +import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum; | ||
| 43 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | 37 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 44 | 38 | ||
| 45 | -/** | ||
| 46 | - * {@link InfJobServiceImpl} 的单元测试 | ||
| 47 | - * | ||
| 48 | - * @author neilz | ||
| 49 | - */ | ||
| 50 | -@Import(InfJobServiceImpl.class) | ||
| 51 | -public class InfJobServiceTest extends BaseDbUnitTest { | 39 | +@Import(JobServiceImpl.class) |
| 40 | +public class JobServiceTest extends BaseDbUnitTest { | ||
| 52 | 41 | ||
| 53 | @Resource | 42 | @Resource |
| 54 | - private InfJobServiceImpl jobService; | 43 | + private JobServiceImpl jobService; |
| 55 | @Resource | 44 | @Resource |
| 56 | - private InfJobMapper jobMapper; | 45 | + private JobMapper jobMapper; |
| 57 | @MockBean | 46 | @MockBean |
| 58 | private SchedulerManager schedulerManager; | 47 | private SchedulerManager schedulerManager; |
| 59 | 48 | ||
| 60 | @Test | 49 | @Test |
| 61 | public void testCreateJob_cronExpressionValid() { | 50 | public void testCreateJob_cronExpressionValid() { |
| 62 | // 准备参数。Cron 表达式为 String 类型,默认随机字符串。 | 51 | // 准备参数。Cron 表达式为 String 类型,默认随机字符串。 |
| 63 | - InfJobCreateReqVO reqVO = randomPojo(InfJobCreateReqVO.class); | 52 | + JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class); |
| 64 | // 调用,并断言异常 | 53 | // 调用,并断言异常 |
| 65 | assertServiceException(() -> jobService.createJob(reqVO), JOB_CRON_EXPRESSION_VALID); | 54 | assertServiceException(() -> jobService.createJob(reqVO), JOB_CRON_EXPRESSION_VALID); |
| 66 | } | 55 | } |
| @@ -68,7 +57,7 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -68,7 +57,7 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 68 | @Test | 57 | @Test |
| 69 | public void testCreateJob_jobHandlerExists() throws SchedulerException { | 58 | public void testCreateJob_jobHandlerExists() throws SchedulerException { |
| 70 | // 准备参数 指定 Cron 表达式 | 59 | // 准备参数 指定 Cron 表达式 |
| 71 | - InfJobCreateReqVO reqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); | 60 | + JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); |
| 72 | // 调用 | 61 | // 调用 |
| 73 | jobService.createJob(reqVO); | 62 | jobService.createJob(reqVO); |
| 74 | // 调用,并断言异常 | 63 | // 调用,并断言异常 |
| @@ -78,15 +67,15 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -78,15 +67,15 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 78 | @Test | 67 | @Test |
| 79 | public void testCreateJob_success() throws SchedulerException { | 68 | public void testCreateJob_success() throws SchedulerException { |
| 80 | // 准备参数 指定 Cron 表达式 | 69 | // 准备参数 指定 Cron 表达式 |
| 81 | - InfJobCreateReqVO reqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); | 70 | + JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); |
| 82 | // 调用 | 71 | // 调用 |
| 83 | Long jobId = jobService.createJob(reqVO); | 72 | Long jobId = jobService.createJob(reqVO); |
| 84 | // 断言 | 73 | // 断言 |
| 85 | assertNotNull(jobId); | 74 | assertNotNull(jobId); |
| 86 | // 校验记录的属性是否正确 | 75 | // 校验记录的属性是否正确 |
| 87 | - InfJobDO job = jobMapper.selectById(jobId); | 76 | + JobDO job = jobMapper.selectById(jobId); |
| 88 | assertPojoEquals(reqVO, job); | 77 | assertPojoEquals(reqVO, job); |
| 89 | - assertEquals(InfJobStatusEnum.NORMAL.getStatus(), job.getStatus()); | 78 | + assertEquals(JobStatusEnum.NORMAL.getStatus(), job.getStatus()); |
| 90 | // 校验调用 | 79 | // 校验调用 |
| 91 | verify(schedulerManager, times(1)).addJob(eq(job.getId()), eq(job.getHandlerName()), eq(job.getHandlerParam()), eq(job.getCronExpression()), | 80 | verify(schedulerManager, times(1)).addJob(eq(job.getId()), eq(job.getHandlerName()), eq(job.getHandlerParam()), eq(job.getCronExpression()), |
| 92 | eq(reqVO.getRetryCount()), eq(reqVO.getRetryInterval())); | 81 | eq(reqVO.getRetryCount()), eq(reqVO.getRetryInterval())); |
| @@ -95,7 +84,7 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -95,7 +84,7 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 95 | @Test | 84 | @Test |
| 96 | public void testUpdateJob_jobNotExists(){ | 85 | public void testUpdateJob_jobNotExists(){ |
| 97 | // 准备参数 | 86 | // 准备参数 |
| 98 | - InfJobUpdateReqVO reqVO = randomPojo(InfJobUpdateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); | 87 | + JobUpdateReqVO reqVO = randomPojo(JobUpdateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); |
| 99 | // 调用,并断言异常 | 88 | // 调用,并断言异常 |
| 100 | assertServiceException(() -> jobService.updateJob(reqVO), JOB_NOT_EXISTS); | 89 | assertServiceException(() -> jobService.updateJob(reqVO), JOB_NOT_EXISTS); |
| 101 | } | 90 | } |
| @@ -103,13 +92,13 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -103,13 +92,13 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 103 | @Test | 92 | @Test |
| 104 | public void testUpdateJob_onlyNormalStatus(){ | 93 | public void testUpdateJob_onlyNormalStatus(){ |
| 105 | // mock 数据 | 94 | // mock 数据 |
| 106 | - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); | ||
| 107 | - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); | ||
| 108 | - job.setStatus(InfJobStatusEnum.INIT.getStatus()); | 95 | + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); |
| 96 | + JobDO job = JobConvert.INSTANCE.convert(createReqVO); | ||
| 97 | + job.setStatus(JobStatusEnum.INIT.getStatus()); | ||
| 109 | fillJobMonitorTimeoutEmpty(job); | 98 | fillJobMonitorTimeoutEmpty(job); |
| 110 | jobMapper.insert(job); | 99 | jobMapper.insert(job); |
| 111 | // 准备参数 | 100 | // 准备参数 |
| 112 | - InfJobUpdateReqVO updateReqVO = randomPojo(InfJobUpdateReqVO.class, o -> { | 101 | + JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> { |
| 113 | o.setId(job.getId()); | 102 | o.setId(job.getId()); |
| 114 | o.setName(createReqVO.getName()); | 103 | o.setName(createReqVO.getName()); |
| 115 | o.setCronExpression(createReqVO.getCronExpression()); | 104 | o.setCronExpression(createReqVO.getCronExpression()); |
| @@ -121,13 +110,13 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -121,13 +110,13 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 121 | @Test | 110 | @Test |
| 122 | public void testUpdateJob_success() throws SchedulerException { | 111 | public void testUpdateJob_success() throws SchedulerException { |
| 123 | // mock 数据 | 112 | // mock 数据 |
| 124 | - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); | ||
| 125 | - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); | ||
| 126 | - job.setStatus(InfJobStatusEnum.NORMAL.getStatus()); | 113 | + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); |
| 114 | + JobDO job = JobConvert.INSTANCE.convert(createReqVO); | ||
| 115 | + job.setStatus(JobStatusEnum.NORMAL.getStatus()); | ||
| 127 | fillJobMonitorTimeoutEmpty(job); | 116 | fillJobMonitorTimeoutEmpty(job); |
| 128 | jobMapper.insert(job); | 117 | jobMapper.insert(job); |
| 129 | // 准备参数 | 118 | // 准备参数 |
| 130 | - InfJobUpdateReqVO updateReqVO = randomPojo(InfJobUpdateReqVO.class, o -> { | 119 | + JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> { |
| 131 | o.setId(job.getId()); | 120 | o.setId(job.getId()); |
| 132 | o.setName(createReqVO.getName()); | 121 | o.setName(createReqVO.getName()); |
| 133 | o.setCronExpression(createReqVO.getCronExpression()); | 122 | o.setCronExpression(createReqVO.getCronExpression()); |
| @@ -135,7 +124,7 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -135,7 +124,7 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 135 | // 调用 | 124 | // 调用 |
| 136 | jobService.updateJob(updateReqVO); | 125 | jobService.updateJob(updateReqVO); |
| 137 | // 校验记录的属性是否正确 | 126 | // 校验记录的属性是否正确 |
| 138 | - InfJobDO updateJob = jobMapper.selectById(updateReqVO.getId()); | 127 | + JobDO updateJob = jobMapper.selectById(updateReqVO.getId()); |
| 139 | assertPojoEquals(updateReqVO, updateJob); | 128 | assertPojoEquals(updateReqVO, updateJob); |
| 140 | // 校验调用 | 129 | // 校验调用 |
| 141 | verify(schedulerManager, times(1)).updateJob(eq(job.getHandlerName()), eq(updateReqVO.getHandlerParam()), eq(updateReqVO.getCronExpression()), | 130 | verify(schedulerManager, times(1)).updateJob(eq(job.getHandlerName()), eq(updateReqVO.getHandlerParam()), eq(updateReqVO.getCronExpression()), |
| @@ -145,15 +134,15 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -145,15 +134,15 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 145 | @Test | 134 | @Test |
| 146 | public void testUpdateJobStatus_changeStatusInvalid() { | 135 | public void testUpdateJobStatus_changeStatusInvalid() { |
| 147 | // 调用,并断言异常 | 136 | // 调用,并断言异常 |
| 148 | - assertServiceException(() -> jobService.updateJobStatus(1l, InfJobStatusEnum.INIT.getStatus()), JOB_CHANGE_STATUS_INVALID); | 137 | + assertServiceException(() -> jobService.updateJobStatus(1L, JobStatusEnum.INIT.getStatus()), JOB_CHANGE_STATUS_INVALID); |
| 149 | } | 138 | } |
| 150 | 139 | ||
| 151 | @Test | 140 | @Test |
| 152 | public void testUpdateJobStatus_changeStatusEquals() { | 141 | public void testUpdateJobStatus_changeStatusEquals() { |
| 153 | // mock 数据 | 142 | // mock 数据 |
| 154 | - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); | ||
| 155 | - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); | ||
| 156 | - job.setStatus(InfJobStatusEnum.NORMAL.getStatus()); | 143 | + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); |
| 144 | + JobDO job = JobConvert.INSTANCE.convert(createReqVO); | ||
| 145 | + job.setStatus(JobStatusEnum.NORMAL.getStatus()); | ||
| 157 | fillJobMonitorTimeoutEmpty(job); | 146 | fillJobMonitorTimeoutEmpty(job); |
| 158 | jobMapper.insert(job); | 147 | jobMapper.insert(job); |
| 159 | // 调用,并断言异常 | 148 | // 调用,并断言异常 |
| @@ -163,16 +152,16 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -163,16 +152,16 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 163 | @Test | 152 | @Test |
| 164 | public void testUpdateJobStatus_NormalToStop_success() throws SchedulerException { | 153 | public void testUpdateJobStatus_NormalToStop_success() throws SchedulerException { |
| 165 | // mock 数据 | 154 | // mock 数据 |
| 166 | - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); | ||
| 167 | - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); | ||
| 168 | - job.setStatus(InfJobStatusEnum.NORMAL.getStatus()); | 155 | + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); |
| 156 | + JobDO job = JobConvert.INSTANCE.convert(createReqVO); | ||
| 157 | + job.setStatus(JobStatusEnum.NORMAL.getStatus()); | ||
| 169 | fillJobMonitorTimeoutEmpty(job); | 158 | fillJobMonitorTimeoutEmpty(job); |
| 170 | jobMapper.insert(job); | 159 | jobMapper.insert(job); |
| 171 | // 调用 | 160 | // 调用 |
| 172 | - jobService.updateJobStatus(job.getId(), InfJobStatusEnum.STOP.getStatus()); | 161 | + jobService.updateJobStatus(job.getId(), JobStatusEnum.STOP.getStatus()); |
| 173 | // 校验记录的属性是否正确 | 162 | // 校验记录的属性是否正确 |
| 174 | - InfJobDO updateJob = jobMapper.selectById(job.getId()); | ||
| 175 | - assertEquals(InfJobStatusEnum.STOP.getStatus(), updateJob.getStatus()); | 163 | + JobDO updateJob = jobMapper.selectById(job.getId()); |
| 164 | + assertEquals(JobStatusEnum.STOP.getStatus(), updateJob.getStatus()); | ||
| 176 | // 校验调用 | 165 | // 校验调用 |
| 177 | verify(schedulerManager, times(1)).pauseJob(eq(job.getHandlerName())); | 166 | verify(schedulerManager, times(1)).pauseJob(eq(job.getHandlerName())); |
| 178 | } | 167 | } |
| @@ -180,16 +169,16 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -180,16 +169,16 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 180 | @Test | 169 | @Test |
| 181 | public void testUpdateJobStatus_StopToNormal_success() throws SchedulerException { | 170 | public void testUpdateJobStatus_StopToNormal_success() throws SchedulerException { |
| 182 | // mock 数据 | 171 | // mock 数据 |
| 183 | - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); | ||
| 184 | - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); | ||
| 185 | - job.setStatus(InfJobStatusEnum.STOP.getStatus()); | 172 | + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); |
| 173 | + JobDO job = JobConvert.INSTANCE.convert(createReqVO); | ||
| 174 | + job.setStatus(JobStatusEnum.STOP.getStatus()); | ||
| 186 | fillJobMonitorTimeoutEmpty(job); | 175 | fillJobMonitorTimeoutEmpty(job); |
| 187 | jobMapper.insert(job); | 176 | jobMapper.insert(job); |
| 188 | // 调用 | 177 | // 调用 |
| 189 | - jobService.updateJobStatus(job.getId(), InfJobStatusEnum.NORMAL.getStatus()); | 178 | + jobService.updateJobStatus(job.getId(), JobStatusEnum.NORMAL.getStatus()); |
| 190 | // 校验记录的属性是否正确 | 179 | // 校验记录的属性是否正确 |
| 191 | - InfJobDO updateJob = jobMapper.selectById(job.getId()); | ||
| 192 | - assertEquals(InfJobStatusEnum.NORMAL.getStatus(), updateJob.getStatus()); | 180 | + JobDO updateJob = jobMapper.selectById(job.getId()); |
| 181 | + assertEquals(JobStatusEnum.NORMAL.getStatus(), updateJob.getStatus()); | ||
| 193 | // 校验调用 | 182 | // 校验调用 |
| 194 | verify(schedulerManager, times(1)).resumeJob(eq(job.getHandlerName())); | 183 | verify(schedulerManager, times(1)).resumeJob(eq(job.getHandlerName())); |
| 195 | } | 184 | } |
| @@ -197,9 +186,9 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -197,9 +186,9 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 197 | @Test | 186 | @Test |
| 198 | public void testTriggerJob_success() throws SchedulerException { | 187 | public void testTriggerJob_success() throws SchedulerException { |
| 199 | // mock 数据 | 188 | // mock 数据 |
| 200 | - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); | ||
| 201 | - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); | ||
| 202 | - job.setStatus(InfJobStatusEnum.NORMAL.getStatus()); | 189 | + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); |
| 190 | + JobDO job = JobConvert.INSTANCE.convert(createReqVO); | ||
| 191 | + job.setStatus(JobStatusEnum.NORMAL.getStatus()); | ||
| 203 | fillJobMonitorTimeoutEmpty(job); | 192 | fillJobMonitorTimeoutEmpty(job); |
| 204 | jobMapper.insert(job); | 193 | jobMapper.insert(job); |
| 205 | // 调用 | 194 | // 调用 |
| @@ -211,9 +200,9 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -211,9 +200,9 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 211 | @Test | 200 | @Test |
| 212 | public void testDeleteJob_success() throws SchedulerException { | 201 | public void testDeleteJob_success() throws SchedulerException { |
| 213 | // mock 数据 | 202 | // mock 数据 |
| 214 | - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); | ||
| 215 | - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); | ||
| 216 | - job.setStatus(InfJobStatusEnum.NORMAL.getStatus()); | 203 | + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); |
| 204 | + JobDO job = JobConvert.INSTANCE.convert(createReqVO); | ||
| 205 | + job.setStatus(JobStatusEnum.NORMAL.getStatus()); | ||
| 217 | fillJobMonitorTimeoutEmpty(job); | 206 | fillJobMonitorTimeoutEmpty(job); |
| 218 | jobMapper.insert(job); | 207 | jobMapper.insert(job); |
| 219 | // 调用 UPDATE inf_job SET deleted=1 WHERE id=? AND deleted=0 | 208 | // 调用 UPDATE inf_job SET deleted=1 WHERE id=? AND deleted=0 |
| @@ -227,19 +216,19 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -227,19 +216,19 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 227 | @Test | 216 | @Test |
| 228 | public void testGetJobListByIds_success() { | 217 | public void testGetJobListByIds_success() { |
| 229 | // mock 数据 | 218 | // mock 数据 |
| 230 | - InfJobDO dbJob = randomPojo(InfJobDO.class, o -> { | ||
| 231 | - o.setStatus(randomEle(InfJobStatusEnum.values()).getStatus()); // 保证 status 的范围 | 219 | + JobDO dbJob = randomPojo(JobDO.class, o -> { |
| 220 | + o.setStatus(randomEle(JobStatusEnum.values()).getStatus()); // 保证 status 的范围 | ||
| 232 | }); | 221 | }); |
| 233 | - InfJobDO cloneJob = ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString())); | 222 | + JobDO cloneJob = ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString())); |
| 234 | jobMapper.insert(dbJob); | 223 | jobMapper.insert(dbJob); |
| 235 | // 测试 handlerName 不匹配 | 224 | // 测试 handlerName 不匹配 |
| 236 | jobMapper.insert(cloneJob); | 225 | jobMapper.insert(cloneJob); |
| 237 | // 准备参数 | 226 | // 准备参数 |
| 238 | - ArrayList ids = new ArrayList<>(); | 227 | + ArrayList<Long> ids = new ArrayList<>(); |
| 239 | ids.add(dbJob.getId()); | 228 | ids.add(dbJob.getId()); |
| 240 | ids.add(cloneJob.getId()); | 229 | ids.add(cloneJob.getId()); |
| 241 | // 调用 | 230 | // 调用 |
| 242 | - List<InfJobDO> list = jobService.getJobList(ids); | 231 | + List<JobDO> list = jobService.getJobList(ids); |
| 243 | // 断言 | 232 | // 断言 |
| 244 | assertEquals(2, list.size()); | 233 | assertEquals(2, list.size()); |
| 245 | assertPojoEquals(dbJob, list.get(0)); | 234 | assertPojoEquals(dbJob, list.get(0)); |
| @@ -248,25 +237,25 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -248,25 +237,25 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 248 | @Test | 237 | @Test |
| 249 | public void testGetJobPage_success() { | 238 | public void testGetJobPage_success() { |
| 250 | // mock 数据 | 239 | // mock 数据 |
| 251 | - InfJobDO dbJob = randomPojo(InfJobDO.class, o -> { | 240 | + JobDO dbJob = randomPojo(JobDO.class, o -> { |
| 252 | o.setName("定时任务测试"); | 241 | o.setName("定时任务测试"); |
| 253 | o.setHandlerName("handlerName 单元测试"); | 242 | o.setHandlerName("handlerName 单元测试"); |
| 254 | - o.setStatus(InfJobStatusEnum.INIT.getStatus()); | 243 | + o.setStatus(JobStatusEnum.INIT.getStatus()); |
| 255 | }); | 244 | }); |
| 256 | jobMapper.insert(dbJob); | 245 | jobMapper.insert(dbJob); |
| 257 | // 测试 name 不匹配 | 246 | // 测试 name 不匹配 |
| 258 | jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setName("土豆"))); | 247 | jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setName("土豆"))); |
| 259 | // 测试 status 不匹配 | 248 | // 测试 status 不匹配 |
| 260 | - jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setStatus(InfJobStatusEnum.NORMAL.getStatus()))); | 249 | + jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()))); |
| 261 | // 测试 handlerName 不匹配 | 250 | // 测试 handlerName 不匹配 |
| 262 | jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString()))); | 251 | jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString()))); |
| 263 | // 准备参数 | 252 | // 准备参数 |
| 264 | - InfJobPageReqVO reqVo = new InfJobPageReqVO(); | 253 | + JobPageReqVO reqVo = new JobPageReqVO(); |
| 265 | reqVo.setName("定时"); | 254 | reqVo.setName("定时"); |
| 266 | - reqVo.setStatus(InfJobStatusEnum.INIT.getStatus()); | 255 | + reqVo.setStatus(JobStatusEnum.INIT.getStatus()); |
| 267 | reqVo.setHandlerName("单元"); | 256 | reqVo.setHandlerName("单元"); |
| 268 | // 调用 | 257 | // 调用 |
| 269 | - PageResult<InfJobDO> pageResult = jobService.getJobPage(reqVo); | 258 | + PageResult<JobDO> pageResult = jobService.getJobPage(reqVo); |
| 270 | // 断言 | 259 | // 断言 |
| 271 | assertEquals(1, pageResult.getTotal()); | 260 | assertEquals(1, pageResult.getTotal()); |
| 272 | assertEquals(1, pageResult.getList().size()); | 261 | assertEquals(1, pageResult.getList().size()); |
| @@ -276,31 +265,31 @@ public class InfJobServiceTest extends BaseDbUnitTest { | @@ -276,31 +265,31 @@ public class InfJobServiceTest extends BaseDbUnitTest { | ||
| 276 | @Test | 265 | @Test |
| 277 | public void testGetJobListForExport_success() { | 266 | public void testGetJobListForExport_success() { |
| 278 | // mock 数据 | 267 | // mock 数据 |
| 279 | - InfJobDO dbJob = randomPojo(InfJobDO.class, o -> { | 268 | + JobDO dbJob = randomPojo(JobDO.class, o -> { |
| 280 | o.setName("定时任务测试"); | 269 | o.setName("定时任务测试"); |
| 281 | o.setHandlerName("handlerName 单元测试"); | 270 | o.setHandlerName("handlerName 单元测试"); |
| 282 | - o.setStatus(InfJobStatusEnum.INIT.getStatus()); | 271 | + o.setStatus(JobStatusEnum.INIT.getStatus()); |
| 283 | }); | 272 | }); |
| 284 | jobMapper.insert(dbJob); | 273 | jobMapper.insert(dbJob); |
| 285 | // 测试 name 不匹配 | 274 | // 测试 name 不匹配 |
| 286 | jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setName("土豆"))); | 275 | jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setName("土豆"))); |
| 287 | // 测试 status 不匹配 | 276 | // 测试 status 不匹配 |
| 288 | - jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setStatus(InfJobStatusEnum.NORMAL.getStatus()))); | 277 | + jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()))); |
| 289 | // 测试 handlerName 不匹配 | 278 | // 测试 handlerName 不匹配 |
| 290 | jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString()))); | 279 | jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString()))); |
| 291 | // 准备参数 | 280 | // 准备参数 |
| 292 | - InfJobExportReqVO reqVo = new InfJobExportReqVO(); | 281 | + JobExportReqVO reqVo = new JobExportReqVO(); |
| 293 | reqVo.setName("定时"); | 282 | reqVo.setName("定时"); |
| 294 | - reqVo.setStatus(InfJobStatusEnum.INIT.getStatus()); | 283 | + reqVo.setStatus(JobStatusEnum.INIT.getStatus()); |
| 295 | reqVo.setHandlerName("单元"); | 284 | reqVo.setHandlerName("单元"); |
| 296 | // 调用 | 285 | // 调用 |
| 297 | - List<InfJobDO> list = jobService.getJobList(reqVo); | 286 | + List<JobDO> list = jobService.getJobList(reqVo); |
| 298 | // 断言 | 287 | // 断言 |
| 299 | assertEquals(1, list.size()); | 288 | assertEquals(1, list.size()); |
| 300 | assertPojoEquals(dbJob, list.get(0)); | 289 | assertPojoEquals(dbJob, list.get(0)); |
| 301 | } | 290 | } |
| 302 | 291 | ||
| 303 | - private static void fillJobMonitorTimeoutEmpty(InfJobDO job) { | 292 | + private static void fillJobMonitorTimeoutEmpty(JobDO job) { |
| 304 | if (job.getMonitorTimeout() == null) { | 293 | if (job.getMonitorTimeout() == null) { |
| 305 | job.setMonitorTimeout(0); | 294 | job.setMonitorTimeout(0); |
| 306 | } | 295 | } |
yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogServiceImplTest.java renamed to yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImplTest.java
| 1 | package cn.iocoder.yudao.module.infra.service.logger; | 1 | package cn.iocoder.yudao.module.infra.service.logger; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; | ||
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | 3 | +import cn.hutool.core.util.RandomUtil; |
| 4 | +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO; | ||
| 5 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | 5 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 6 | import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; | 6 | import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; |
| 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 8 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; | ||
| 9 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; | ||
| 10 | -import cn.iocoder.yudao.module.infra.dal.mysql.logger.InfApiAccessLogMapper; | ||
| 11 | -import cn.iocoder.yudao.module.infra.service.logger.impl.InfApiAccessLogServiceImpl; | ||
| 12 | -import cn.iocoder.yudao.framework.test.core.util.RandomUtils; | ||
| 13 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | 8 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 9 | +import cn.iocoder.yudao.framework.test.core.util.RandomUtils; | ||
| 10 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO; | ||
| 11 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; | ||
| 13 | +import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiAccessLogMapper; | ||
| 14 | +import cn.iocoder.yudao.module.infra.test.BaseDbUnitTest; | ||
| 14 | import org.junit.jupiter.api.Test; | 15 | import org.junit.jupiter.api.Test; |
| 15 | import org.springframework.context.annotation.Import; | 16 | import org.springframework.context.annotation.Import; |
| 16 | 17 | ||
| @@ -18,22 +19,19 @@ import javax.annotation.Resource; | @@ -18,22 +19,19 @@ import javax.annotation.Resource; | ||
| 18 | import java.util.Date; | 19 | import java.util.Date; |
| 19 | import java.util.List; | 20 | import java.util.List; |
| 20 | 21 | ||
| 21 | -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | ||
| 22 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; | 22 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; |
| 23 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | ||
| 23 | import static org.junit.jupiter.api.Assertions.assertEquals; | 24 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 24 | import static org.junit.jupiter.api.Assertions.assertNotNull; | 25 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 25 | 26 | ||
| 26 | -/** | ||
| 27 | - * {@link InfApiAccessLogServiceImpl} 单元测试 | ||
| 28 | - */ | ||
| 29 | -@Import(InfApiAccessLogServiceImpl.class) | ||
| 30 | -public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | 27 | +@Import(ApiAccessLogServiceImpl.class) |
| 28 | +public class ApiAccessLogServiceImplTest extends BaseDbUnitTest { | ||
| 31 | 29 | ||
| 32 | @Resource | 30 | @Resource |
| 33 | - private InfApiAccessLogService infApiAccessLogServiceImpl; | 31 | + private ApiAccessLogService apiAccessLogService; |
| 34 | 32 | ||
| 35 | @Resource | 33 | @Resource |
| 36 | - private InfApiAccessLogMapper infApiAccessLogMapper; | 34 | + private ApiAccessLogMapper apiAccessLogMapper; |
| 37 | 35 | ||
| 38 | @Test | 36 | @Test |
| 39 | public void testGetApiAccessLogPage() { | 37 | public void testGetApiAccessLogPage() { |
| @@ -46,7 +44,7 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | @@ -46,7 +44,7 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | ||
| 46 | int duration = 1000; | 44 | int duration = 1000; |
| 47 | int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode(); | 45 | int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode(); |
| 48 | 46 | ||
| 49 | - InfApiAccessLogDO infApiAccessLogDO = RandomUtils.randomPojo(InfApiAccessLogDO.class, dto -> { | 47 | + ApiAccessLogDO infApiAccessLogDO = RandomUtils.randomPojo(ApiAccessLogDO.class, dto -> { |
| 50 | dto.setUserId(userId); | 48 | dto.setUserId(userId); |
| 51 | dto.setUserType(userType); | 49 | dto.setUserType(userType); |
| 52 | dto.setApplicationName(applicationName); | 50 | dto.setApplicationName(applicationName); |
| @@ -55,26 +53,26 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | @@ -55,26 +53,26 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | ||
| 55 | dto.setDuration(duration); | 53 | dto.setDuration(duration); |
| 56 | dto.setResultCode(resultCode); | 54 | dto.setResultCode(resultCode); |
| 57 | }); | 55 | }); |
| 58 | - infApiAccessLogMapper.insert(infApiAccessLogDO); | 56 | + apiAccessLogMapper.insert(infApiAccessLogDO); |
| 59 | 57 | ||
| 60 | // 下面几个都是不匹配的数据 | 58 | // 下面几个都是不匹配的数据 |
| 61 | // userId 不同的 | 59 | // userId 不同的 |
| 62 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L))); | 60 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L))); |
| 63 | // userType | 61 | // userType |
| 64 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue()))); | 62 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue()))); |
| 65 | // applicationName 不同的 | 63 | // applicationName 不同的 |
| 66 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test"))); | 64 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test"))); |
| 67 | // requestUrl 不同的 | 65 | // requestUrl 不同的 |
| 68 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar"))); | 66 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar"))); |
| 69 | // 构造一个早期时间 2021-02-06 00:00:00 | 67 | // 构造一个早期时间 2021-02-06 00:00:00 |
| 70 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6)))); | 68 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6)))); |
| 71 | // duration 不同的 | 69 | // duration 不同的 |
| 72 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100))); | 70 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100))); |
| 73 | // resultCode 不同的 | 71 | // resultCode 不同的 |
| 74 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setResultCode(2))); | 72 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setResultCode(2))); |
| 75 | 73 | ||
| 76 | // 构造调用参数 | 74 | // 构造调用参数 |
| 77 | - InfApiAccessLogPageReqVO reqVO = new InfApiAccessLogPageReqVO(); | 75 | + ApiAccessLogPageReqVO reqVO = new ApiAccessLogPageReqVO(); |
| 78 | reqVO.setUserId(userId); | 76 | reqVO.setUserId(userId); |
| 79 | reqVO.setUserType(userType); | 77 | reqVO.setUserType(userType); |
| 80 | reqVO.setApplicationName(applicationName); | 78 | reqVO.setApplicationName(applicationName); |
| @@ -85,7 +83,7 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | @@ -85,7 +83,7 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | ||
| 85 | reqVO.setResultCode(resultCode); | 83 | reqVO.setResultCode(resultCode); |
| 86 | 84 | ||
| 87 | // 调用service方法 | 85 | // 调用service方法 |
| 88 | - PageResult<InfApiAccessLogDO> pageResult = infApiAccessLogServiceImpl.getApiAccessLogPage(reqVO); | 86 | + PageResult<ApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(reqVO); |
| 89 | 87 | ||
| 90 | // 断言,只查到了一条符合条件的 | 88 | // 断言,只查到了一条符合条件的 |
| 91 | assertEquals(1, pageResult.getTotal()); | 89 | assertEquals(1, pageResult.getTotal()); |
| @@ -104,7 +102,7 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | @@ -104,7 +102,7 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | ||
| 104 | int duration = 1000; | 102 | int duration = 1000; |
| 105 | int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode(); | 103 | int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode(); |
| 106 | 104 | ||
| 107 | - InfApiAccessLogDO infApiAccessLogDO = RandomUtils.randomPojo(InfApiAccessLogDO.class, dto -> { | 105 | + ApiAccessLogDO infApiAccessLogDO = RandomUtils.randomPojo(ApiAccessLogDO.class, dto -> { |
| 108 | dto.setUserId(userId); | 106 | dto.setUserId(userId); |
| 109 | dto.setUserType(userType); | 107 | dto.setUserType(userType); |
| 110 | dto.setApplicationName(applicationName); | 108 | dto.setApplicationName(applicationName); |
| @@ -113,26 +111,26 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | @@ -113,26 +111,26 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | ||
| 113 | dto.setDuration(duration); | 111 | dto.setDuration(duration); |
| 114 | dto.setResultCode(resultCode); | 112 | dto.setResultCode(resultCode); |
| 115 | }); | 113 | }); |
| 116 | - infApiAccessLogMapper.insert(infApiAccessLogDO); | 114 | + apiAccessLogMapper.insert(infApiAccessLogDO); |
| 117 | 115 | ||
| 118 | // 下面几个都是不匹配的数据 | 116 | // 下面几个都是不匹配的数据 |
| 119 | // userId 不同的 | 117 | // userId 不同的 |
| 120 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L))); | 118 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L))); |
| 121 | // userType | 119 | // userType |
| 122 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue()))); | 120 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue()))); |
| 123 | // applicationName 不同的 | 121 | // applicationName 不同的 |
| 124 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test"))); | 122 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test"))); |
| 125 | // requestUrl 不同的 | 123 | // requestUrl 不同的 |
| 126 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar"))); | 124 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar"))); |
| 127 | // 构造一个早期时间 2021-02-06 00:00:00 | 125 | // 构造一个早期时间 2021-02-06 00:00:00 |
| 128 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6)))); | 126 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6)))); |
| 129 | // duration 不同的 | 127 | // duration 不同的 |
| 130 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100))); | 128 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100))); |
| 131 | // resultCode 不同的 | 129 | // resultCode 不同的 |
| 132 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setResultCode(2))); | 130 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setResultCode(2))); |
| 133 | 131 | ||
| 134 | // 构造调用参数 | 132 | // 构造调用参数 |
| 135 | - InfApiAccessLogExportReqVO reqVO = new InfApiAccessLogExportReqVO(); | 133 | + ApiAccessLogExportReqVO reqVO = new ApiAccessLogExportReqVO(); |
| 136 | reqVO.setUserId(userId); | 134 | reqVO.setUserId(userId); |
| 137 | reqVO.setUserType(userType); | 135 | reqVO.setUserType(userType); |
| 138 | reqVO.setApplicationName(applicationName); | 136 | reqVO.setApplicationName(applicationName); |
| @@ -143,11 +141,26 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | @@ -143,11 +141,26 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { | ||
| 143 | reqVO.setResultCode(resultCode); | 141 | reqVO.setResultCode(resultCode); |
| 144 | 142 | ||
| 145 | // 调用service方法 | 143 | // 调用service方法 |
| 146 | - List<InfApiAccessLogDO> list = infApiAccessLogServiceImpl.getApiAccessLogList(reqVO); | 144 | + List<ApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(reqVO); |
| 147 | 145 | ||
| 148 | // 断言,只查到了一条符合条件的 | 146 | // 断言,只查到了一条符合条件的 |
| 149 | assertEquals(1, list.size()); | 147 | assertEquals(1, list.size()); |
| 150 | assertPojoEquals(infApiAccessLogDO, list.get(0)); | 148 | assertPojoEquals(infApiAccessLogDO, list.get(0)); |
| 151 | } | 149 | } |
| 152 | 150 | ||
| 151 | + @Test | ||
| 152 | + public void testCreateApiAccessLogAsync() { | ||
| 153 | + // 准备参数 | ||
| 154 | + ApiAccessLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiAccessLogCreateReqDTO.class, | ||
| 155 | + dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); | ||
| 156 | + | ||
| 157 | + // 调用 | ||
| 158 | + apiAccessLogService.createApiAccessLogAsync(createDTO); | ||
| 159 | + // 断言 | ||
| 160 | + ApiAccessLogDO infApiAccessLogDO = apiAccessLogMapper.selectOne(null); | ||
| 161 | + assertNotNull(infApiAccessLogDO); | ||
| 162 | + assertPojoEquals(createDTO, infApiAccessLogDO); | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + | ||
| 153 | } | 166 | } |
yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogServiceImplTest.java renamed to yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImplTest.java
| 1 | package cn.iocoder.yudao.module.infra.service.logger; | 1 | package cn.iocoder.yudao.module.infra.service.logger; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; | ||
| 4 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExportReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogPageReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.infra.dal.mysql.logger.InfApiErrorLogMapper; | ||
| 7 | -import cn.iocoder.yudao.module.infra.enums.logger.InfApiErrorLogProcessStatusEnum; | ||
| 8 | -import cn.iocoder.yudao.module.infra.service.logger.impl.InfApiErrorLogServiceImpl; | ||
| 9 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; | 3 | +import cn.hutool.core.util.RandomUtil; |
| 4 | +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO; | ||
| 10 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | 5 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 11 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 12 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | 7 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 13 | import cn.iocoder.yudao.framework.test.core.util.RandomUtils; | 8 | import cn.iocoder.yudao.framework.test.core.util.RandomUtils; |
| 9 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; | ||
| 11 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; | ||
| 12 | +import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper; | ||
| 13 | +import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum; | ||
| 14 | +import cn.iocoder.yudao.module.infra.test.BaseDbUnitTest; | ||
| 14 | import org.junit.jupiter.api.Assertions; | 15 | import org.junit.jupiter.api.Assertions; |
| 15 | import org.junit.jupiter.api.Test; | 16 | import org.junit.jupiter.api.Test; |
| 16 | import org.springframework.context.annotation.Import; | 17 | import org.springframework.context.annotation.Import; |
| @@ -19,24 +20,22 @@ import javax.annotation.Resource; | @@ -19,24 +20,22 @@ import javax.annotation.Resource; | ||
| 19 | import java.util.Date; | 20 | import java.util.Date; |
| 20 | import java.util.List; | 21 | import java.util.List; |
| 21 | 22 | ||
| 22 | -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.API_ERROR_LOG_NOT_FOUND; | ||
| 23 | -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.API_ERROR_LOG_PROCESSED; | ||
| 24 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; | 23 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; |
| 25 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | 24 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 26 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | 25 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; |
| 26 | +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND; | ||
| 27 | +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_PROCESSED; | ||
| 27 | import static org.junit.jupiter.api.Assertions.assertEquals; | 28 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 29 | +import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
| 28 | 30 | ||
| 29 | -/** | ||
| 30 | - * {@link InfApiErrorLogServiceImpl} 单元测试 | ||
| 31 | - */ | ||
| 32 | -@Import(InfApiErrorLogServiceImpl.class) | ||
| 33 | -public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | 31 | +@Import(ApiErrorLogServiceImpl.class) |
| 32 | +public class ApiErrorLogServiceImplTest extends BaseDbUnitTest { | ||
| 34 | 33 | ||
| 35 | @Resource | 34 | @Resource |
| 36 | - private InfApiErrorLogService infApiErrorLogServiceImpl; | 35 | + private ApiErrorLogServiceImpl apiErrorLogService; |
| 37 | 36 | ||
| 38 | @Resource | 37 | @Resource |
| 39 | - private InfApiErrorLogMapper infApiErrorLogMapper; | 38 | + private ApiErrorLogMapper infApiErrorLogMapper; |
| 40 | 39 | ||
| 41 | @Test | 40 | @Test |
| 42 | public void testGetApiErrorLogPage() { | 41 | public void testGetApiErrorLogPage() { |
| @@ -46,9 +45,9 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | @@ -46,9 +45,9 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | ||
| 46 | String applicationName = "yudao-test"; | 45 | String applicationName = "yudao-test"; |
| 47 | String requestUrl = "foo"; | 46 | String requestUrl = "foo"; |
| 48 | Date beginTime = buildTime(2021, 3, 13); | 47 | Date beginTime = buildTime(2021, 3, 13); |
| 49 | - int progressStatus = InfApiErrorLogProcessStatusEnum.INIT.getStatus(); | 48 | + int progressStatus = ApiErrorLogProcessStatusEnum.INIT.getStatus(); |
| 50 | 49 | ||
| 51 | - InfApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(InfApiErrorLogDO.class, logDO -> { | 50 | + ApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> { |
| 52 | logDO.setUserId(userId); | 51 | logDO.setUserId(userId); |
| 53 | logDO.setUserType(userType); | 52 | logDO.setUserType(userType); |
| 54 | logDO.setApplicationName(applicationName); | 53 | logDO.setApplicationName(applicationName); |
| @@ -70,10 +69,10 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | @@ -70,10 +69,10 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | ||
| 70 | // 构造一个早期时间 2021-02-06 00:00:00 | 69 | // 构造一个早期时间 2021-02-06 00:00:00 |
| 71 | infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6)))); | 70 | infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6)))); |
| 72 | // progressStatus 不同的 | 71 | // progressStatus 不同的 |
| 73 | - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(InfApiErrorLogProcessStatusEnum.DONE.getStatus()))); | 72 | + infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus()))); |
| 74 | 73 | ||
| 75 | // 构造调用参数 | 74 | // 构造调用参数 |
| 76 | - InfApiErrorLogPageReqVO reqVO = new InfApiErrorLogPageReqVO(); | 75 | + ApiErrorLogPageReqVO reqVO = new ApiErrorLogPageReqVO(); |
| 77 | reqVO.setUserId(userId); | 76 | reqVO.setUserId(userId); |
| 78 | reqVO.setUserType(userType); | 77 | reqVO.setUserType(userType); |
| 79 | reqVO.setApplicationName(applicationName); | 78 | reqVO.setApplicationName(applicationName); |
| @@ -83,7 +82,7 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | @@ -83,7 +82,7 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | ||
| 83 | reqVO.setProcessStatus(progressStatus); | 82 | reqVO.setProcessStatus(progressStatus); |
| 84 | 83 | ||
| 85 | // 调用service方法 | 84 | // 调用service方法 |
| 86 | - PageResult<InfApiErrorLogDO> pageResult = infApiErrorLogServiceImpl.getApiErrorLogPage(reqVO); | 85 | + PageResult<ApiErrorLogDO> pageResult = apiErrorLogService.getApiErrorLogPage(reqVO); |
| 87 | 86 | ||
| 88 | // 断言,只查到了一条符合条件的 | 87 | // 断言,只查到了一条符合条件的 |
| 89 | assertEquals(1, pageResult.getTotal()); | 88 | assertEquals(1, pageResult.getTotal()); |
| @@ -99,9 +98,9 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | @@ -99,9 +98,9 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | ||
| 99 | String applicationName = "yudao-test"; | 98 | String applicationName = "yudao-test"; |
| 100 | String requestUrl = "foo"; | 99 | String requestUrl = "foo"; |
| 101 | Date beginTime = buildTime(2021, 3, 13); | 100 | Date beginTime = buildTime(2021, 3, 13); |
| 102 | - int progressStatus = InfApiErrorLogProcessStatusEnum.INIT.getStatus(); | 101 | + int progressStatus = ApiErrorLogProcessStatusEnum.INIT.getStatus(); |
| 103 | 102 | ||
| 104 | - InfApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(InfApiErrorLogDO.class, logDO -> { | 103 | + ApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> { |
| 105 | logDO.setUserId(userId); | 104 | logDO.setUserId(userId); |
| 106 | logDO.setUserType(userType); | 105 | logDO.setUserType(userType); |
| 107 | logDO.setApplicationName(applicationName); | 106 | logDO.setApplicationName(applicationName); |
| @@ -123,10 +122,10 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | @@ -123,10 +122,10 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | ||
| 123 | // 构造一个早期时间 2021-02-06 00:00:00 | 122 | // 构造一个早期时间 2021-02-06 00:00:00 |
| 124 | infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6)))); | 123 | infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6)))); |
| 125 | // progressStatus 不同的 | 124 | // progressStatus 不同的 |
| 126 | - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(InfApiErrorLogProcessStatusEnum.DONE.getStatus()))); | 125 | + infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus()))); |
| 127 | 126 | ||
| 128 | // 构造调用参数 | 127 | // 构造调用参数 |
| 129 | - InfApiErrorLogExportReqVO reqVO = new InfApiErrorLogExportReqVO(); | 128 | + ApiErrorLogExportReqVO reqVO = new ApiErrorLogExportReqVO(); |
| 130 | reqVO.setUserId(userId); | 129 | reqVO.setUserId(userId); |
| 131 | reqVO.setUserType(userType); | 130 | reqVO.setUserType(userType); |
| 132 | reqVO.setApplicationName(applicationName); | 131 | reqVO.setApplicationName(applicationName); |
| @@ -136,7 +135,7 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | @@ -136,7 +135,7 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | ||
| 136 | reqVO.setProcessStatus(progressStatus); | 135 | reqVO.setProcessStatus(progressStatus); |
| 137 | 136 | ||
| 138 | // 调用service方法 | 137 | // 调用service方法 |
| 139 | - List<InfApiErrorLogDO> list = infApiErrorLogServiceImpl.getApiErrorLogList(reqVO); | 138 | + List<ApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(reqVO); |
| 140 | 139 | ||
| 141 | // 断言,只查到了一条符合条件的 | 140 | // 断言,只查到了一条符合条件的 |
| 142 | assertEquals(1, list.size()); | 141 | assertEquals(1, list.size()); |
| @@ -144,22 +143,23 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | @@ -144,22 +143,23 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | ||
| 144 | } | 143 | } |
| 145 | 144 | ||
| 146 | 145 | ||
| 146 | + // TODO 芋艿:单元测试,可以拆小一点 | ||
| 147 | @Test | 147 | @Test |
| 148 | public void testUpdateApiErrorLogProcess() { | 148 | public void testUpdateApiErrorLogProcess() { |
| 149 | // 先构造两条数据,第一条用于抛出异常,第二条用于正常的执行update操作 | 149 | // 先构造两条数据,第一条用于抛出异常,第二条用于正常的执行update操作 |
| 150 | Long processUserId = 2233L; | 150 | Long processUserId = 2233L; |
| 151 | 151 | ||
| 152 | - InfApiErrorLogDO first = RandomUtils.randomPojo(InfApiErrorLogDO.class, logDO -> { | 152 | + ApiErrorLogDO first = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> { |
| 153 | logDO.setProcessUserId(processUserId); | 153 | logDO.setProcessUserId(processUserId); |
| 154 | logDO.setUserType(UserTypeEnum.ADMIN.getValue()); | 154 | logDO.setUserType(UserTypeEnum.ADMIN.getValue()); |
| 155 | - logDO.setProcessStatus(InfApiErrorLogProcessStatusEnum.DONE.getStatus()); | 155 | + logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus()); |
| 156 | }); | 156 | }); |
| 157 | infApiErrorLogMapper.insert(first); | 157 | infApiErrorLogMapper.insert(first); |
| 158 | 158 | ||
| 159 | - InfApiErrorLogDO second = RandomUtils.randomPojo(InfApiErrorLogDO.class, logDO -> { | 159 | + ApiErrorLogDO second = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> { |
| 160 | logDO.setProcessUserId(1122L); | 160 | logDO.setProcessUserId(1122L); |
| 161 | logDO.setUserType(UserTypeEnum.ADMIN.getValue()); | 161 | logDO.setUserType(UserTypeEnum.ADMIN.getValue()); |
| 162 | - logDO.setProcessStatus(InfApiErrorLogProcessStatusEnum.INIT.getStatus()); | 162 | + logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); |
| 163 | }); | 163 | }); |
| 164 | infApiErrorLogMapper.insert(second); | 164 | infApiErrorLogMapper.insert(second); |
| 165 | 165 | ||
| @@ -167,17 +167,31 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | @@ -167,17 +167,31 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { | ||
| 167 | Long secondId = second.getId(); | 167 | Long secondId = second.getId(); |
| 168 | 168 | ||
| 169 | // 执行正常的 update 操作 | 169 | // 执行正常的 update 操作 |
| 170 | - infApiErrorLogServiceImpl.updateApiErrorLogProcess(secondId, InfApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId); | ||
| 171 | - InfApiErrorLogDO secondSelect = infApiErrorLogMapper.selectOne("id", secondId); | 170 | + apiErrorLogService.updateApiErrorLogProcess(secondId, ApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId); |
| 171 | + ApiErrorLogDO secondSelect = infApiErrorLogMapper.selectOne("id", secondId); | ||
| 172 | 172 | ||
| 173 | // id 为 0 查询不到,应该抛出异常 API_ERROR_LOG_NOT_FOUND | 173 | // id 为 0 查询不到,应该抛出异常 API_ERROR_LOG_NOT_FOUND |
| 174 | - assertServiceException(() -> infApiErrorLogServiceImpl.updateApiErrorLogProcess(0L, InfApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId), API_ERROR_LOG_NOT_FOUND); | 174 | + assertServiceException(() -> apiErrorLogService.updateApiErrorLogProcess(0L, ApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId), API_ERROR_LOG_NOT_FOUND); |
| 175 | // id 为 first 的 progressStatus 为 DONE ,应该抛出 API_ERROR_LOG_PROCESSED | 175 | // id 为 first 的 progressStatus 为 DONE ,应该抛出 API_ERROR_LOG_PROCESSED |
| 176 | - assertServiceException(() -> infApiErrorLogServiceImpl.updateApiErrorLogProcess(firstId, InfApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId), API_ERROR_LOG_PROCESSED); | 176 | + assertServiceException(() -> apiErrorLogService.updateApiErrorLogProcess(firstId, ApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId), API_ERROR_LOG_PROCESSED); |
| 177 | // 验证 progressStatus 是否修改成功 | 177 | // 验证 progressStatus 是否修改成功 |
| 178 | - Assertions.assertEquals(InfApiErrorLogProcessStatusEnum.DONE.getStatus(), secondSelect.getProcessStatus()); | 178 | + Assertions.assertEquals(ApiErrorLogProcessStatusEnum.DONE.getStatus(), secondSelect.getProcessStatus()); |
| 179 | // 验证 progressUserId 是否修改成功 | 179 | // 验证 progressUserId 是否修改成功 |
| 180 | Assertions.assertEquals(processUserId, secondSelect.getProcessUserId()); | 180 | Assertions.assertEquals(processUserId, secondSelect.getProcessUserId()); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | + @Test | ||
| 184 | + public void testCreateApiErrorLogAsync() { | ||
| 185 | + // 准备参数 | ||
| 186 | + ApiErrorLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiErrorLogCreateReqDTO.class, | ||
| 187 | + dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); | ||
| 188 | + | ||
| 189 | + // 调用 | ||
| 190 | + apiErrorLogService.createApiErrorLogAsync(createDTO); | ||
| 191 | + // 断言 | ||
| 192 | + ApiErrorLogDO infApiErrorLogDO = infApiErrorLogMapper.selectOne(null); | ||
| 193 | + assertNotNull(infApiErrorLogDO); | ||
| 194 | + assertPojoEquals(createDTO, infApiErrorLogDO); | ||
| 195 | + } | ||
| 196 | + | ||
| 183 | } | 197 | } |
yudao-module-infra/yudao-module-infra-impl/src/test/resources/application-unit-test.yaml
0 → 100644
| 1 | +spring: | ||
| 2 | + main: | ||
| 3 | + lazy-initialization: true # 开启懒加载,加快速度 | ||
| 4 | + banner-mode: off # 单元测试,禁用 Banner | ||
| 5 | + | ||
| 6 | +--- #################### 数据库相关配置 #################### | ||
| 7 | + | ||
| 8 | +spring: | ||
| 9 | + # 数据源配置项 | ||
| 10 | + datasource: | ||
| 11 | + name: ruoyi-vue-pro | ||
| 12 | + url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false; # MODE 使用 MySQL 模式;DATABASE_TO_UPPER 配置表和字段使用小写 | ||
| 13 | + driver-class-name: org.h2.Driver | ||
| 14 | + username: sa | ||
| 15 | + password: | ||
| 16 | + schema: classpath:sql/create_tables.sql # MySQL 转 H2 的语句,使用 https://www.jooq.org/translate/ 工具 | ||
| 17 | + druid: | ||
| 18 | + async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度 | ||
| 19 | + initial-size: 1 # 单元测试,配置为 1,提升启动速度 | ||
| 20 | + | ||
| 21 | + # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 | ||
| 22 | + redis: | ||
| 23 | + host: 127.0.0.1 # 地址 | ||
| 24 | + port: 16379 # 端口(单元测试,使用 16379 端口) | ||
| 25 | + database: 0 # 数据库索引 | ||
| 26 | + | ||
| 27 | +mybatis: | ||
| 28 | + lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试 | ||
| 29 | + | ||
| 30 | +--- #################### 定时任务相关配置 #################### | ||
| 31 | + | ||
| 32 | +--- #################### 配置中心相关配置 #################### | ||
| 33 | + | ||
| 34 | +--- #################### 服务保障相关配置 #################### | ||
| 35 | + | ||
| 36 | +# Lock4j 配置项(单元测试,禁用 Lock4j) | ||
| 37 | + | ||
| 38 | +# Resilience4j 配置项 | ||
| 39 | + | ||
| 40 | +--- #################### 监控相关配置 #################### | ||
| 41 | + | ||
| 42 | +--- #################### 芋道相关配置 #################### | ||
| 43 | + | ||
| 44 | +# 芋道配置项,设置当前项目所有自定义的配置 | ||
| 45 | +yudao: | ||
| 46 | + info: | ||
| 47 | + base-package: cn.iocoder.yudao.module.member.dal.mysql | ||
| 48 | + base-package2: cn.iocoder.yudao.module | ||
| 49 | + core-service: | ||
| 50 | + base-package: cn.iocoder.yudao.module.member.dal.mysql # TODO 芋艿:要清理掉 | ||
| 51 | + captcha: | ||
| 52 | + timeout: 5m | ||
| 53 | + width: 160 | ||
| 54 | + height: 60 |
yudao-module-infra/yudao-module-infra-impl/src/test/resources/logback-spring.xml
0 → 100644
yudao-module-infra/yudao-module-infra-impl/src/test/resources/sql/clean.sql
0 → 100644
yudao-module-infra/yudao-module-infra-impl/src/test/resources/sql/create_tables.sql
0 → 100644
| 1 | + | ||
| 2 | +CREATE TABLE IF NOT EXISTS "infra_config" ( | ||
| 3 | + "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY, | ||
| 4 | + "group" varchar(50) NOT NULL, | ||
| 5 | + "type" tinyint NOT NULL, | ||
| 6 | + "name" varchar(100) NOT NULL DEFAULT '', | ||
| 7 | + "key" varchar(100) NOT NULL DEFAULT '', | ||
| 8 | + "value" varchar(500) NOT NULL DEFAULT '', | ||
| 9 | + "sensitive" bit NOT NULL, | ||
| 10 | + "remark" varchar(500) DEFAULT NULL, | ||
| 11 | + "creator" varchar(64) DEFAULT '', | ||
| 12 | + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 13 | + "updater" varchar(64) DEFAULT '', | ||
| 14 | + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 15 | + "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 16 | + PRIMARY KEY ("id") | ||
| 17 | + ) COMMENT '参数配置表'; | ||
| 18 | + | ||
| 19 | +CREATE TABLE IF NOT EXISTS "infra_file" ( | ||
| 20 | + "id" varchar(188) NOT NULL, | ||
| 21 | + "type" varchar(63) DEFAULT NULL, | ||
| 22 | + "content" blob NOT NULL, | ||
| 23 | + "creator" varchar(64) DEFAULT '', | ||
| 24 | + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 25 | + "updater" varchar(64) DEFAULT '', | ||
| 26 | + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| 27 | + "deleted" bit NOT NULL DEFAULT FALSE, | ||
| 28 | + "tenant_id" bigint not null default '0', | ||
| 29 | + PRIMARY KEY ("id") | ||
| 30 | + ) COMMENT '文件表'; | ||
| 31 | + | ||
| 32 | +CREATE TABLE IF NOT EXISTS "infra_job" ( | ||
| 33 | + "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '任务编号', | ||
| 34 | + "name" varchar(32) NOT NULL COMMENT '任务名称', | ||
| 35 | + "status" tinyint(4) NOT NULL COMMENT '任务状态', | ||
| 36 | + "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字', | ||
| 37 | + "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数', | ||
| 38 | + "cron_expression" varchar(32) NOT NULL COMMENT 'CRON 表达式', | ||
| 39 | + "retry_count" int(11) NOT NULL DEFAULT '0' COMMENT '重试次数', | ||
| 40 | + "retry_interval" int(11) NOT NULL DEFAULT '0' COMMENT '重试间隔', | ||
| 41 | + "monitor_timeout" int(11) NOT NULL DEFAULT '0' COMMENT '监控超时时间', | ||
| 42 | + "creator" varchar(64) DEFAULT '' COMMENT '创建者', | ||
| 43 | + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 44 | + "updater" varchar(64) DEFAULT '' COMMENT '更新者', | ||
| 45 | + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 46 | + "deleted" bit NOT NULL DEFAULT FALSE COMMENT '是否删除', | ||
| 47 | + PRIMARY KEY ("id") | ||
| 48 | + ) COMMENT='定时任务表'; | ||
| 49 | + | ||
| 50 | +CREATE TABLE IF NOT EXISTS "infra_job_log" ( | ||
| 51 | + "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '日志编号', | ||
| 52 | + "job_id" bigint(20) NOT NULL COMMENT '任务编号', | ||
| 53 | + "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字', | ||
| 54 | + "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数', | ||
| 55 | + "execute_index" tinyint(4) NOT NULL DEFAULT '1' COMMENT '第几次执行', | ||
| 56 | + "begin_time" datetime NOT NULL COMMENT '开始执行时间', | ||
| 57 | + "end_time" datetime DEFAULT NULL COMMENT '结束执行时间', | ||
| 58 | + "duration" int(11) DEFAULT NULL COMMENT '执行时长', | ||
| 59 | + "status" tinyint(4) NOT NULL COMMENT '任务状态', | ||
| 60 | + "result" varchar(4000) DEFAULT '' COMMENT '结果数据', | ||
| 61 | + "creator" varchar(64) DEFAULT '' COMMENT '创建者', | ||
| 62 | + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 63 | + "updater" varchar(64) DEFAULT '' COMMENT '更新者', | ||
| 64 | + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 65 | + "deleted" bit(1) NOT NULL DEFAULT FALSE COMMENT '是否删除', | ||
| 66 | + PRIMARY KEY ("id") | ||
| 67 | + )COMMENT='定时任务日志表'; |
yudao-module-member/yudao-module-member-impl/pom.xml
| @@ -23,28 +23,30 @@ | @@ -23,28 +23,30 @@ | ||
| 23 | <artifactId>yudao-module-member-api</artifactId> | 23 | <artifactId>yudao-module-member-api</artifactId> |
| 24 | <version>${revision}</version> | 24 | <version>${revision}</version> |
| 25 | </dependency> | 25 | </dependency> |
| 26 | - | ||
| 27 | <dependency> | 26 | <dependency> |
| 28 | <groupId>cn.iocoder.boot</groupId> | 27 | <groupId>cn.iocoder.boot</groupId> |
| 29 | <artifactId>yudao-module-system-api</artifactId> | 28 | <artifactId>yudao-module-system-api</artifactId> |
| 30 | <version>${revision}</version> | 29 | <version>${revision}</version> |
| 31 | </dependency> | 30 | </dependency> |
| 32 | - | ||
| 33 | - <!-- 业务组件 --> | ||
| 34 | <dependency> | 31 | <dependency> |
| 35 | <groupId>cn.iocoder.boot</groupId> | 32 | <groupId>cn.iocoder.boot</groupId> |
| 36 | - <artifactId>yudao-core-service</artifactId> | 33 | + <artifactId>yudao-module-infra-api</artifactId> |
| 34 | + <version>${revision}</version> | ||
| 37 | </dependency> | 35 | </dependency> |
| 38 | 36 | ||
| 37 | + <!-- 业务组件 --> | ||
| 39 | <dependency> | 38 | <dependency> |
| 40 | <groupId>cn.iocoder.boot</groupId> | 39 | <groupId>cn.iocoder.boot</groupId> |
| 41 | <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> | 40 | <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> |
| 42 | </dependency> | 41 | </dependency> |
| 43 | - | ||
| 44 | <dependency> | 42 | <dependency> |
| 45 | <groupId>cn.iocoder.boot</groupId> | 43 | <groupId>cn.iocoder.boot</groupId> |
| 46 | <artifactId>yudao-spring-boot-starter-biz-weixin</artifactId> | 44 | <artifactId>yudao-spring-boot-starter-biz-weixin</artifactId> |
| 47 | </dependency> | 45 | </dependency> |
| 46 | + <dependency> | ||
| 47 | + <groupId>cn.iocoder.boot</groupId> | ||
| 48 | + <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | ||
| 49 | + </dependency> | ||
| 48 | 50 | ||
| 49 | <!-- Web 相关 --> | 51 | <!-- Web 相关 --> |
| 50 | <dependency> | 52 | <dependency> |
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java
| @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.member.service.user; | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.member.service.user; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.io.IoUtil; | 3 | import cn.hutool.core.io.IoUtil; |
| 4 | import cn.hutool.core.util.IdUtil; | 4 | import cn.hutool.core.util.IdUtil; |
| 5 | -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; | ||
| 6 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | +import cn.iocoder.yudao.module.infra.api.file.FileApi; | ||
| 7 | import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO; | 7 | import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO; |
| 8 | import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; | 8 | import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; |
| 9 | import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; | 9 | import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; |
| @@ -39,7 +39,7 @@ public class MemberUserServiceImpl implements MemberUserService { | @@ -39,7 +39,7 @@ public class MemberUserServiceImpl implements MemberUserService { | ||
| 39 | private MemberUserMapper memberUserMapper; | 39 | private MemberUserMapper memberUserMapper; |
| 40 | 40 | ||
| 41 | @Resource | 41 | @Resource |
| 42 | - private InfFileCoreService fileCoreService; | 42 | + private FileApi fileApi; |
| 43 | @Resource | 43 | @Resource |
| 44 | private SmsCodeApi smsCodeApi; | 44 | private SmsCodeApi smsCodeApi; |
| 45 | 45 | ||
| @@ -103,7 +103,7 @@ public class MemberUserServiceImpl implements MemberUserService { | @@ -103,7 +103,7 @@ public class MemberUserServiceImpl implements MemberUserService { | ||
| 103 | public String updateUserAvatar(Long userId, InputStream avatarFile) { | 103 | public String updateUserAvatar(Long userId, InputStream avatarFile) { |
| 104 | this.checkUserExists(userId); | 104 | this.checkUserExists(userId); |
| 105 | // 创建文件 | 105 | // 创建文件 |
| 106 | - String avatar = fileCoreService.createFile(IdUtil.fastUUID(), IoUtil.readBytes(avatarFile)); | 106 | + String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile)); |
| 107 | // 更新头像路径 | 107 | // 更新头像路径 |
| 108 | memberUserMapper.updateById(MemberUserDO.builder().id(userId).avatar(avatar).build()); | 108 | memberUserMapper.updateById(MemberUserDO.builder().id(userId).avatar(avatar).build()); |
| 109 | return avatar; | 109 | return avatar; |
yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImplTest.java
| 1 | package cn.iocoder.yudao.module.member.service.user; | 1 | package cn.iocoder.yudao.module.member.service.user; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.RandomUtil; | 3 | import cn.hutool.core.util.RandomUtil; |
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; | ||
| 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 4 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; | 5 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; |
| 7 | import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; | 6 | import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; |
| 7 | +import cn.iocoder.yudao.module.infra.api.file.FileApi; | ||
| 8 | import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO; | 8 | import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO; |
| 9 | import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; | 9 | import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; |
| 10 | import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; | 10 | import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; |
| @@ -49,13 +49,12 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest { | @@ -49,13 +49,12 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest { | ||
| 49 | private MemberAuthServiceImpl authService; | 49 | private MemberAuthServiceImpl authService; |
| 50 | 50 | ||
| 51 | @MockBean | 51 | @MockBean |
| 52 | - private InfFileCoreService fileCoreService; | ||
| 53 | - | ||
| 54 | - @MockBean | ||
| 55 | private PasswordEncoder passwordEncoder; | 52 | private PasswordEncoder passwordEncoder; |
| 56 | 53 | ||
| 57 | @MockBean | 54 | @MockBean |
| 58 | private SmsCodeApi smsCodeApi; | 55 | private SmsCodeApi smsCodeApi; |
| 56 | + @MockBean | ||
| 57 | + private FileApi fileApi; | ||
| 59 | 58 | ||
| 60 | @Test | 59 | @Test |
| 61 | public void testUpdateNickName_success(){ | 60 | public void testUpdateNickName_success(){ |
| @@ -86,7 +85,7 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest { | @@ -86,7 +85,7 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest { | ||
| 86 | ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes); | 85 | ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes); |
| 87 | // mock 方法 | 86 | // mock 方法 |
| 88 | String avatar = randomString(); | 87 | String avatar = randomString(); |
| 89 | - when(fileCoreService.createFile(anyString(), eq(avatarFileBytes))).thenReturn(avatar); | 88 | + when(fileApi.createFile(eq(avatarFileBytes))).thenReturn(avatar); |
| 90 | // 调用 | 89 | // 调用 |
| 91 | String str = memberUserService.updateUserAvatar(userId, avatarFile); | 90 | String str = memberUserService.updateUserAvatar(userId, avatarFile); |
| 92 | // 断言 | 91 | // 断言 |
yudao-module-member/yudao-module-member-impl/src/test/resources/application-unit-test.yaml
| @@ -45,7 +45,6 @@ mybatis: | @@ -45,7 +45,6 @@ mybatis: | ||
| 45 | yudao: | 45 | yudao: |
| 46 | info: | 46 | info: |
| 47 | base-package: cn.iocoder.yudao.module.member.dal.mysql | 47 | base-package: cn.iocoder.yudao.module.member.dal.mysql |
| 48 | - member-package: cn.iocoder.yudao.module.member # TODO 芋艿:要清理掉 | ||
| 49 | - system-package: cn.iocoder.yudao.module.system # TODO 芋艿:要清理掉 | 48 | + base-package2: cn.iocoder.yudao.module |
| 50 | core-service: | 49 | core-service: |
| 51 | base-package: cn.iocoder.yudao.module.member.dal.mysql # TODO 芋艿:要清理掉 | 50 | base-package: cn.iocoder.yudao.module.member.dal.mysql # TODO 芋艿:要清理掉 |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java renamed to yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java
| @@ -15,7 +15,6 @@ public interface DictTypeConstants { | @@ -15,7 +15,6 @@ public interface DictTypeConstants { | ||
| 15 | String LOGIN_TYPE = "sys_login_type"; // 登录日志的类型 | 15 | String LOGIN_TYPE = "sys_login_type"; // 登录日志的类型 |
| 16 | String LOGIN_RESULT = "sys_login_result"; // 登录结果 | 16 | String LOGIN_RESULT = "sys_login_result"; // 登录结果 |
| 17 | 17 | ||
| 18 | - | ||
| 19 | String SMS_CHANNEL_CODE = "sys_sms_channel_code"; // 短信渠道编码 | 18 | String SMS_CHANNEL_CODE = "sys_sms_channel_code"; // 短信渠道编码 |
| 20 | String SMS_TEMPLATE_TYPE = "sys_sms_template_type"; // 短信模板类型 | 19 | String SMS_TEMPLATE_TYPE = "sys_sms_template_type"; // 短信模板类型 |
| 21 | String SMS_SEND_STATUS = "sys_sms_send_status"; // 短信发送状态 | 20 | String SMS_SEND_STATUS = "sys_sms_send_status"; // 短信发送状态 |
yudao-module-system/yudao-module-system-impl/pom.xml
| @@ -28,13 +28,13 @@ | @@ -28,13 +28,13 @@ | ||
| 28 | <artifactId>yudao-module-member-api</artifactId> | 28 | <artifactId>yudao-module-member-api</artifactId> |
| 29 | <version>${revision}</version> | 29 | <version>${revision}</version> |
| 30 | </dependency> | 30 | </dependency> |
| 31 | - | ||
| 32 | - <!-- 业务组件 --> | ||
| 33 | <dependency> | 31 | <dependency> |
| 34 | <groupId>cn.iocoder.boot</groupId> | 32 | <groupId>cn.iocoder.boot</groupId> |
| 35 | - <artifactId>yudao-core-service</artifactId> | 33 | + <artifactId>yudao-module-infra-api</artifactId> |
| 34 | + <version>${revision}</version> | ||
| 36 | </dependency> | 35 | </dependency> |
| 37 | 36 | ||
| 37 | + <!-- 业务组件 --> | ||
| 38 | <dependency> | 38 | <dependency> |
| 39 | <groupId>cn.iocoder.boot</groupId> | 39 | <groupId>cn.iocoder.boot</groupId> |
| 40 | <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> | 40 | <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> |
| @@ -45,8 +45,20 @@ | @@ -45,8 +45,20 @@ | ||
| 45 | </dependency> | 45 | </dependency> |
| 46 | <dependency> | 46 | <dependency> |
| 47 | <groupId>cn.iocoder.boot</groupId> | 47 | <groupId>cn.iocoder.boot</groupId> |
| 48 | + <artifactId>yudao-spring-boot-starter-biz-dict</artifactId> | ||
| 49 | + </dependency> | ||
| 50 | + <dependency> | ||
| 51 | + <groupId>cn.iocoder.boot</groupId> | ||
| 48 | <artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId> | 52 | <artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId> |
| 49 | </dependency> | 53 | </dependency> |
| 54 | + <dependency> | ||
| 55 | + <groupId>cn.iocoder.boot</groupId> | ||
| 56 | + <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | ||
| 57 | + </dependency> | ||
| 58 | + <dependency> | ||
| 59 | + <groupId>cn.iocoder.boot</groupId> | ||
| 60 | + <artifactId>yudao-spring-boot-starter-biz-social</artifactId> | ||
| 61 | + </dependency> | ||
| 50 | 62 | ||
| 51 | <!-- Web 相关 --> | 63 | <!-- Web 相关 --> |
| 52 | <dependency> | 64 | <dependency> |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/common/CaptchaController.http
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java
| @@ -4,11 +4,11 @@ import cn.hutool.core.collection.CollUtil; | @@ -4,11 +4,11 @@ import cn.hutool.core.collection.CollUtil; | ||
| 4 | import cn.hutool.core.io.IoUtil; | 4 | import cn.hutool.core.io.IoUtil; |
| 5 | import cn.hutool.core.util.IdUtil; | 5 | import cn.hutool.core.util.IdUtil; |
| 6 | import cn.hutool.core.util.StrUtil; | 6 | import cn.hutool.core.util.StrUtil; |
| 7 | -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; | ||
| 8 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 7 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 9 | import cn.iocoder.yudao.framework.common.exception.ServiceException; | 8 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 10 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 9 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 11 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 10 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 11 | +import cn.iocoder.yudao.module.infra.api.file.FileApi; | ||
| 12 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; | 12 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; |
| 13 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; | 13 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; |
| 14 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; | 14 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; |
| @@ -56,8 +56,9 @@ public class AdminUserServiceImpl implements AdminUserService { | @@ -56,8 +56,9 @@ public class AdminUserServiceImpl implements AdminUserService { | ||
| 56 | private PermissionService permissionService; | 56 | private PermissionService permissionService; |
| 57 | @Resource | 57 | @Resource |
| 58 | private PasswordEncoder passwordEncoder; | 58 | private PasswordEncoder passwordEncoder; |
| 59 | + | ||
| 59 | @Resource | 60 | @Resource |
| 60 | - private InfFileCoreService fileService; | 61 | + private FileApi fileApi; |
| 61 | 62 | ||
| 62 | @Override | 63 | @Override |
| 63 | public Long createUser(UserCreateReqVO reqVO) { | 64 | public Long createUser(UserCreateReqVO reqVO) { |
| @@ -111,7 +112,7 @@ public class AdminUserServiceImpl implements AdminUserService { | @@ -111,7 +112,7 @@ public class AdminUserServiceImpl implements AdminUserService { | ||
| 111 | public String updateUserAvatar(Long id, InputStream avatarFile) { | 112 | public String updateUserAvatar(Long id, InputStream avatarFile) { |
| 112 | this.checkUserExists(id); | 113 | this.checkUserExists(id); |
| 113 | // 存储文件 | 114 | // 存储文件 |
| 114 | - String avatar = fileService.createFile(IdUtil.fastUUID(), IoUtil.readBytes(avatarFile)); | 115 | + String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile)); |
| 115 | // 更新路径 | 116 | // 更新路径 |
| 116 | AdminUserDO sysUserDO = new AdminUserDO(); | 117 | AdminUserDO sysUserDO = new AdminUserDO(); |
| 117 | sysUserDO.setId(id); | 118 | sysUserDO.setId(id); |
yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java
| 1 | package cn.iocoder.yudao.module.system.service.user; | 1 | package cn.iocoder.yudao.module.system.service.user; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.RandomUtil; | 3 | import cn.hutool.core.util.RandomUtil; |
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; | ||
| 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 4 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | import cn.iocoder.yudao.framework.common.exception.ServiceException; | 5 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 8 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; | 7 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; |
| 9 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 8 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 10 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | 9 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 10 | +import cn.iocoder.yudao.module.infra.api.file.FileApi; | ||
| 11 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; | 11 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; |
| 12 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; | 12 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; |
| 13 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; | 13 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; |
| @@ -63,7 +63,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { | @@ -63,7 +63,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { | ||
| 63 | @MockBean | 63 | @MockBean |
| 64 | private PasswordEncoder passwordEncoder; | 64 | private PasswordEncoder passwordEncoder; |
| 65 | @MockBean | 65 | @MockBean |
| 66 | - private InfFileCoreService fileService; | 66 | + private FileApi fileApi; |
| 67 | 67 | ||
| 68 | @Test | 68 | @Test |
| 69 | public void testCreatUser_success() { | 69 | public void testCreatUser_success() { |
| @@ -182,7 +182,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { | @@ -182,7 +182,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { | ||
| 182 | ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes); | 182 | ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes); |
| 183 | // mock 方法 | 183 | // mock 方法 |
| 184 | String avatar = randomString(); | 184 | String avatar = randomString(); |
| 185 | - when(fileService.createFile(anyString(), eq(avatarFileBytes))).thenReturn(avatar); | 185 | + when(fileApi.createFile(eq(avatarFileBytes))).thenReturn(avatar); |
| 186 | 186 | ||
| 187 | // 调用 | 187 | // 调用 |
| 188 | userService.updateUserAvatar(userId, avatarFile); | 188 | userService.updateUserAvatar(userId, avatarFile); |
yudao-module-system/yudao-module-system-impl/src/test/resources/application-unit-test.yaml
| @@ -45,8 +45,7 @@ mybatis: | @@ -45,8 +45,7 @@ mybatis: | ||
| 45 | yudao: | 45 | yudao: |
| 46 | info: | 46 | info: |
| 47 | base-package: cn.iocoder.yudao.module.member.dal.mysql | 47 | base-package: cn.iocoder.yudao.module.member.dal.mysql |
| 48 | - member-package: cn.iocoder.yudao.module.member # TODO 芋艿:要清理掉 | ||
| 49 | - system-package: cn.iocoder.yudao.module.system # TODO 芋艿:要清理掉 | 48 | + base-package2: cn.iocoder.yudao.module |
| 50 | core-service: | 49 | core-service: |
| 51 | base-package: cn.iocoder.yudao.module.member.dal.mysql # TODO 芋艿:要清理掉 | 50 | base-package: cn.iocoder.yudao.module.member.dal.mysql # TODO 芋艿:要清理掉 |
| 52 | captcha: | 51 | captcha: |
更新日志.md