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 | 99 | <artifactId>yudao-spring-boot-starter-redis</artifactId> |
| 100 | 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 | 102 | <!-- Job 定时任务相关 --> |
| 109 | 103 | <dependency> |
| 110 | 104 | <groupId>cn.iocoder.boot</groupId> |
| ... | ... | @@ -152,11 +146,6 @@ |
| 152 | 146 | <artifactId>velocity-engine-core</artifactId> |
| 153 | 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 | 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 | 5 | |
| 6 | 6 | @SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${yudao.info.base-package} 和 ${yudao.core-service.base-package} |
| 7 | 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 | 9 | public class AdminServerApplication { |
| 10 | 10 | |
| 11 | 11 | public static void main(String[] args) { | ... | ... |
yudao-admin-server/src/main/resources/application-dev.yaml
| ... | ... | @@ -100,7 +100,7 @@ apollo: |
| 100 | 100 | eagerLoad: |
| 101 | 101 | enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置 |
| 102 | 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 | 104 | url: ${spring.datasource.dynamic.datasource.master.url} |
| 105 | 105 | username: ${spring.datasource.dynamic.datasource.master.username} |
| 106 | 106 | password: ${spring.datasource.dynamic.datasource.master.password} | ... | ... |
yudao-admin-server/src/main/resources/application-local.yaml
| ... | ... | @@ -113,7 +113,7 @@ apollo: |
| 113 | 113 | eagerLoad: |
| 114 | 114 | enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置 |
| 115 | 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 | 117 | url: ${spring.datasource.dynamic.datasource.master.url} |
| 118 | 118 | username: ${spring.datasource.dynamic.datasource.master.username} |
| 119 | 119 | password: ${spring.datasource.dynamic.datasource.master.password} | ... | ... |
yudao-admin-server/src/main/resources/application.yaml
| ... | ... | @@ -48,17 +48,16 @@ yudao: |
| 48 | 48 | info: |
| 49 | 49 | version: 1.0.0 |
| 50 | 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 | 52 | core-service: |
| 54 | 53 | base-package: cn.iocoder.yudao.coreservice |
| 55 | 54 | web: |
| 56 | 55 | admin-api: |
| 57 | 56 | prefix: /admin-api |
| 58 | - controller: cn.iocoder.yudao.module.system.controller.admin # TODO 芋艿:需要改造 | |
| 57 | + controller: '**.controller.admin.**' | |
| 59 | 58 | app-api: |
| 60 | 59 | prefix: /app-api |
| 61 | - controller: cn.iocoder.yudao.module.member.controller.app # TODO 芋艿:需要改造 | |
| 60 | + controller: '**.controller.app.**' | |
| 62 | 61 | |
| 63 | 62 | swagger: |
| 64 | 63 | title: 管理后台 | ... | ... |
yudao-admin-server/src/test/resources/sql/clean.sql
yudao-admin-server/src/test/resources/sql/create_tables.sql
| 1 | 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 | 4 | CREATE TABLE IF NOT EXISTS "pay_merchant" |
| 71 | 5 | ( | ... | ... |
yudao-core-service/pom.xml
| ... | ... | @@ -40,10 +40,6 @@ |
| 40 | 40 | <groupId>cn.iocoder.boot</groupId> |
| 41 | 41 | <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> |
| 42 | 42 | </dependency> |
| 43 | - <dependency> | |
| 44 | - <groupId>cn.iocoder.boot</groupId> | |
| 45 | - <artifactId>yudao-spring-boot-starter-biz-social</artifactId> | |
| 46 | - </dependency> | |
| 47 | 43 | |
| 48 | 44 | <!-- Web 相关 --> |
| 49 | 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 | 24 | import java.util.Properties; |
| 25 | 25 | import java.util.concurrent.Executors; |
| 26 | 26 | import java.util.concurrent.ScheduledExecutorService; |
| 27 | +import java.util.function.Predicate; | |
| 27 | 28 | |
| 28 | 29 | @Slf4j |
| 29 | 30 | public class DBConfigRepository extends AbstractConfigRepository { |
| ... | ... | @@ -135,7 +136,7 @@ public class DBConfigRepository extends AbstractConfigRepository { |
| 135 | 136 | |
| 136 | 137 | private Properties buildProperties(List<ConfigRespDTO> configs) { |
| 137 | 138 | Properties properties = propertiesFactory.getPropertiesInstance(); |
| 138 | - configs.stream().filter(ConfigRespDTO::getDeleted) // 过滤掉被删除的配置 | |
| 139 | + configs.stream().filter(config -> !config.getDeleted()) // 过滤掉被删除的配置 | |
| 139 | 140 | .forEach(config -> properties.put(config.getKey(), config.getValue())); |
| 140 | 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 | 16 | */ |
| 17 | 17 | @Configuration |
| 18 | 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 | 20 | annotationClass = Mapper.class, |
| 21 | 21 | lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试 |
| 22 | 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 | 36 | private String prefix; |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * Controller 所在包 | |
| 39 | + * Controller 所在包的 Ant 路径规则 | |
| 40 | 40 | * |
| 41 | 41 | * 主要目的是,给该 Controller 设置指定的 {@link #prefix} |
| 42 | - * | |
| 43 | - * 因为我们有多个 modules 包里会包含 Controller,所以只需要写到 cn.iocoder.yudao 这样的层级 | |
| 44 | 42 | */ |
| 45 | 43 | @NotEmpty(message = "Controller 所在包不能为空") |
| 46 | 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 | 13 | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| 14 | 14 | import org.springframework.context.annotation.Bean; |
| 15 | 15 | import org.springframework.context.annotation.Configuration; |
| 16 | +import org.springframework.util.AntPathMatcher; | |
| 16 | 17 | import org.springframework.util.PathMatcher; |
| 17 | 18 | import org.springframework.web.bind.annotation.RestController; |
| 18 | 19 | import org.springframework.web.cors.CorsConfiguration; |
| ... | ... | @@ -49,8 +50,9 @@ public class YudaoWebAutoConfiguration implements WebMvcConfigurer { |
| 49 | 50 | * @param api API 配置 |
| 50 | 51 | */ |
| 51 | 52 | private void configurePathMatch(PathMatchConfigurer configurer, WebProperties.Api api) { |
| 53 | + AntPathMatcher antPathMatcher = new AntPathMatcher("."); | |
| 52 | 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 | 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 | * |
| 8 | 8 | * infra 系统,使用 1-001-000-000 段 |
| 9 | 9 | */ |
| 10 | -public interface InfErrorCodeConstants { | |
| 10 | +public interface ErrorCodeConstants { | |
| 11 | 11 | |
| 12 | 12 | // ========== 参数配置 1001000000 ========== |
| 13 | 13 | ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(1001000001, "参数配置不存在"); |
| ... | ... | @@ -27,4 +27,8 @@ public interface InfErrorCodeConstants { |
| 27 | 27 | ErrorCode API_ERROR_LOG_NOT_FOUND = new ErrorCode(1001002000, "API 错误日志不存在"); |
| 28 | 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 | 23 | <artifactId>yudao-module-member-api</artifactId> |
| 24 | 24 | <version>${revision}</version> |
| 25 | 25 | </dependency> |
| 26 | - | |
| 27 | 26 | <dependency> |
| 28 | 27 | <groupId>cn.iocoder.boot</groupId> |
| 29 | 28 | <artifactId>yudao-module-system-api</artifactId> |
| 30 | 29 | <version>${revision}</version> |
| 31 | 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 | 38 | <dependency> |
| 36 | 39 | <groupId>cn.iocoder.boot</groupId> |
| 37 | 40 | <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> |
| 38 | 41 | </dependency> |
| 42 | + <dependency> | |
| 43 | + <groupId>cn.iocoder.boot</groupId> | |
| 44 | + <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | |
| 45 | + </dependency> | |
| 39 | 46 | |
| 40 | 47 | <!-- Web 相关 --> |
| 41 | 48 | <dependency> |
| ... | ... | @@ -54,6 +61,12 @@ |
| 54 | 61 | <artifactId>yudao-spring-boot-starter-redis</artifactId> |
| 55 | 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 | 71 | <dependency> |
| 59 | 72 | <groupId>cn.iocoder.boot</groupId> |
| ... | ... | @@ -73,6 +86,10 @@ |
| 73 | 86 | <artifactId>yudao-spring-boot-starter-excel</artifactId> |
| 74 | 87 | </dependency> |
| 75 | 88 | |
| 89 | + <dependency> | |
| 90 | + <groupId>cn.smallbun.screw</groupId> | |
| 91 | + <artifactId>screw-core</artifactId> <!-- 实现数据库文档 --> | |
| 92 | + </dependency> | |
| 76 | 93 | </dependencies> |
| 77 | 94 | |
| 78 | 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 | 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 | 3 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; |
| 5 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 6 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 8 | 7 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 9 | -import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.*; | |
| 10 | 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 | 13 | import io.swagger.annotations.Api; |
| 16 | 14 | import io.swagger.annotations.ApiImplicitParam; |
| 17 | 15 | import io.swagger.annotations.ApiOperation; |
| ... | ... | @@ -25,18 +23,17 @@ import javax.validation.Valid; |
| 25 | 23 | import java.io.IOException; |
| 26 | 24 | import java.util.List; |
| 27 | 25 | |
| 28 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 29 | 26 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 30 | 27 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 31 | 28 | |
| 32 | -@Api(tags = "参数配置") | |
| 29 | +@Api(tags = "管理后台 - 参数配置") | |
| 33 | 30 | @RestController |
| 34 | 31 | @RequestMapping("/infra/config") |
| 35 | 32 | @Validated |
| 36 | 33 | public class ConfigController { |
| 37 | 34 | |
| 38 | 35 | @Resource |
| 39 | - private InfConfigService configService; | |
| 36 | + private ConfigService configService; | |
| 40 | 37 | |
| 41 | 38 | @PostMapping("/create") |
| 42 | 39 | @ApiOperation("创建参数配置") |
| ... | ... | @@ -67,19 +64,19 @@ public class ConfigController { |
| 67 | 64 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 68 | 65 | @PreAuthorize("@ss.hasPermission('infra:config:query')") |
| 69 | 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 | 70 | @GetMapping(value = "/get-value-by-key") |
| 74 | 71 | @ApiOperation(value = "根据参数键名查询参数值", notes = "敏感配置,不允许返回给前端") |
| 75 | 72 | @ApiImplicitParam(name = "key", value = "参数键", required = true, example = "yunai.biz.username", dataTypeClass = String.class) |
| 76 | 73 | public CommonResult<String> getConfigKey(@RequestParam("key") String key) { |
| 77 | - InfConfigDO config = configService.getConfigByKey(key); | |
| 74 | + ConfigDO config = configService.getConfigByKey(key); | |
| 78 | 75 | if (config == null) { |
| 79 | 76 | return null; |
| 80 | 77 | } |
| 81 | 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 | 81 | return success(config.getValue()); |
| 85 | 82 | } |
| ... | ... | @@ -88,8 +85,8 @@ public class ConfigController { |
| 88 | 85 | @ApiOperation("获取参数配置分页") |
| 89 | 86 | @PreAuthorize("@ss.hasPermission('infra:config:query')") |
| 90 | 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 | 92 | @GetMapping("/export") |
| ... | ... | @@ -98,9 +95,9 @@ public class ConfigController { |
| 98 | 95 | @OperateLog(type = EXPORT) |
| 99 | 96 | public void exportSysConfig(@Valid ConfigExportReqVO reqVO, |
| 100 | 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 | 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 | 9 | |
| 10 | 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 | 13 | @Data |
| 14 | 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 | 12 | |
| 13 | 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 | 16 | @Data |
| 17 | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | 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 | 9 | import javax.validation.constraints.Size; |
| 10 | 10 | import java.util.Date; |
| 11 | 11 | |
| 12 | -@ApiModel("参数配置信息 Response VO") | |
| 12 | +@ApiModel("管理后台 - 参数配置信息 Response VO") | |
| 13 | 13 | @Data |
| 14 | 14 | @EqualsAndHashCode(callSuper = true) |
| 15 | 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
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 | 16 | import io.swagger.annotations.Api; |
| 17 | 17 | import io.swagger.annotations.ApiImplicitParam; |
| 18 | 18 | import io.swagger.annotations.ApiOperation; |
| 19 | -import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; | |
| 20 | 19 | import org.springframework.web.bind.annotation.GetMapping; |
| 21 | 20 | import org.springframework.web.bind.annotation.RequestMapping; |
| 22 | 21 | import org.springframework.web.bind.annotation.RequestParam; |
| ... | ... | @@ -28,10 +27,10 @@ import java.io.File; |
| 28 | 27 | import java.io.IOException; |
| 29 | 28 | import java.util.Collections; |
| 30 | 29 | |
| 31 | -@Api(tags = "数据库文档") | |
| 30 | +@Api(tags = "管理后台 - 数据库文档") | |
| 32 | 31 | @RestController |
| 33 | 32 | @RequestMapping("/infra/db-doc") |
| 34 | -public class InfDbDocController { | |
| 33 | +public class DbDocController { | |
| 35 | 34 | |
| 36 | 35 | @Resource |
| 37 | 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 | 1 | package cn.iocoder.yudao.module.infra.controller.admin.file; |
| 2 | 2 | |
| 3 | 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 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 10 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 11 | -import cn.iocoder.yudao.module.infra.convert.file.InfFileConvert; | |
| 12 | 6 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |
| 13 | 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 | 13 | import io.swagger.annotations.Api; |
| 15 | 14 | import io.swagger.annotations.ApiImplicitParam; |
| 16 | 15 | import io.swagger.annotations.ApiImplicitParams; |
| ... | ... | @@ -29,17 +28,15 @@ import java.io.IOException; |
| 29 | 28 | |
| 30 | 29 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 31 | 30 | |
| 32 | -@Api(tags = "文件存储") | |
| 31 | +@Api(tags = "管理后台 - 文件存储") | |
| 33 | 32 | @RestController |
| 34 | 33 | @RequestMapping("/infra/file") |
| 35 | 34 | @Validated |
| 36 | 35 | @Slf4j |
| 37 | -public class InfFileController { | |
| 36 | +public class FileController { | |
| 38 | 37 | |
| 39 | 38 | @Resource |
| 40 | - private InfFileService fileService; | |
| 41 | - @Resource | |
| 42 | - private InfFileCoreService fileCoreService; | |
| 39 | + private FileService fileService; | |
| 43 | 40 | |
| 44 | 41 | @PostMapping("/upload") |
| 45 | 42 | @ApiOperation("上传文件") |
| ... | ... | @@ -49,7 +46,7 @@ public class InfFileController { |
| 49 | 46 | }) |
| 50 | 47 | public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file, |
| 51 | 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 | 52 | @DeleteMapping("/delete") |
| ... | ... | @@ -57,7 +54,7 @@ public class InfFileController { |
| 57 | 54 | @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = String.class) |
| 58 | 55 | @PreAuthorize("@ss.hasPermission('infra:file:delete')") |
| 59 | 56 | public CommonResult<Boolean> deleteFile(@RequestParam("id") String id) { |
| 60 | - fileCoreService.deleteFile(id); | |
| 57 | + fileService.deleteFile(id); | |
| 61 | 58 | return success(true); |
| 62 | 59 | } |
| 63 | 60 | |
| ... | ... | @@ -66,7 +63,7 @@ public class InfFileController { |
| 66 | 63 | @ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class) |
| 67 | 64 | public void getFile(HttpServletResponse response, @PathVariable("path") String path) throws IOException { |
| 68 | 65 | TenantContextHolder.setNullTenantId(); |
| 69 | - InfFileDO file = fileCoreService.getFile(path); | |
| 66 | + FileDO file = fileService.getFile(path); | |
| 70 | 67 | if (file == null) { |
| 71 | 68 | log.warn("[getFile][path({}) 文件不存在]", path); |
| 72 | 69 | response.setStatus(HttpStatus.NOT_FOUND.value()); |
| ... | ... | @@ -78,9 +75,9 @@ public class InfFileController { |
| 78 | 75 | @GetMapping("/page") |
| 79 | 76 | @ApiOperation("获得文件分页") |
| 80 | 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 | 12 | |
| 13 | 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 | 16 | @Data |
| 17 | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | 18 | @ToString(callSuper = true) |
| 19 | -public class InfFilePageReqVO extends PageParam { | |
| 19 | +public class FilePageReqVO extends PageParam { | |
| 20 | 20 | |
| 21 | 21 | @ApiModelProperty(value = "文件路径", example = "yudao", notes = "模糊匹配") |
| 22 | 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 | 3 | import io.swagger.annotations.ApiModel; |
| 4 | 4 | import io.swagger.annotations.ApiModelProperty; |
| ... | ... | @@ -6,9 +6,9 @@ import lombok.Data; |
| 6 | 6 | |
| 7 | 7 | import java.util.Date; |
| 8 | 8 | |
| 9 | -@ApiModel(value = "文件 Response VO", description = "不返回 content 字段,太大") | |
| 9 | +@ApiModel(value = "管理后台 - 文件 Response VO", description = "不返回 content 字段,太大") | |
| 10 | 10 | @Data |
| 11 | -public class InfFileRespVO { | |
| 11 | +public class FileRespVO { | |
| 12 | 12 | |
| 13 | 13 | @ApiModelProperty(value = "文件路径", required = true, example = "yudao.jpg") |
| 14 | 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 | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 6 | 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 7 | 7 | import cn.iocoder.yudao.framework.quartz.core.util.CronUtils; |
| 8 | -import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*; | |
| 9 | 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 | 12 | import io.swagger.annotations.Api; |
| 15 | 13 | import io.swagger.annotations.ApiImplicitParam; |
| 16 | 14 | import io.swagger.annotations.ApiImplicitParams; |
| ... | ... | @@ -32,19 +30,19 @@ import java.util.List; |
| 32 | 30 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 33 | 31 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 34 | 32 | |
| 35 | -@Api(tags = "定时任务") | |
| 33 | +@Api(tags = "管理后台 - 定时任务") | |
| 36 | 34 | @RestController |
| 37 | 35 | @RequestMapping("/infra/job") |
| 38 | 36 | @Validated |
| 39 | -public class InfJobController { | |
| 37 | +public class JobController { | |
| 40 | 38 | |
| 41 | 39 | @Resource |
| 42 | - private InfJobService jobService; | |
| 40 | + private JobService jobService; | |
| 43 | 41 | |
| 44 | 42 | @PostMapping("/create") |
| 45 | 43 | @ApiOperation("创建定时任务") |
| 46 | 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 | 46 | throws SchedulerException { |
| 49 | 47 | return success(jobService.createJob(createReqVO)); |
| 50 | 48 | } |
| ... | ... | @@ -52,7 +50,7 @@ public class InfJobController { |
| 52 | 50 | @PutMapping("/update") |
| 53 | 51 | @ApiOperation("更新定时任务") |
| 54 | 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 | 54 | throws SchedulerException { |
| 57 | 55 | jobService.updateJob(updateReqVO); |
| 58 | 56 | return success(true); |
| ... | ... | @@ -94,38 +92,38 @@ public class InfJobController { |
| 94 | 92 | @ApiOperation("获得定时任务") |
| 95 | 93 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 96 | 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 | 100 | @GetMapping("/list") |
| 103 | 101 | @ApiOperation("获得定时任务列表") |
| 104 | 102 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, dataTypeClass = List.class) |
| 105 | 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 | 109 | @GetMapping("/page") |
| 112 | 110 | @ApiOperation("获得定时任务分页") |
| 113 | 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 | 117 | @GetMapping("/export-excel") |
| 120 | 118 | @ApiOperation("导出定时任务 Excel") |
| 121 | 119 | @PreAuthorize("@ss.hasPermission('infra:job:export')") |
| 122 | 120 | @OperateLog(type = EXPORT) |
| 123 | - public void exportJobExcel(@Valid InfJobExportReqVO exportReqVO, | |
| 121 | + public void exportJobExcel(@Valid JobExportReqVO exportReqVO, | |
| 124 | 122 | HttpServletResponse response) throws IOException { |
| 125 | - List<InfJobDO> list = jobService.getJobList(exportReqVO); | |
| 123 | + List<JobDO> list = jobService.getJobList(exportReqVO); | |
| 126 | 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 | 129 | @GetMapping("/get_next_times") |
| ... | ... | @@ -137,7 +135,7 @@ public class InfJobController { |
| 137 | 135 | @PreAuthorize("@ss.hasPermission('infra:job:query')") |
| 138 | 136 | public CommonResult<List<Date>> getJobNextTimes(@RequestParam("id") Long id, |
| 139 | 137 | @RequestParam(value = "count", required = false, defaultValue = "5") Integer count) { |
| 140 | - InfJobDO job = jobService.getJob(id); | |
| 138 | + JobDO job = jobService.getJob(id); | |
| 141 | 139 | if (job == null) { |
| 142 | 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 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 6 | 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 | 14 | import io.swagger.annotations.Api; |
| 15 | 15 | import io.swagger.annotations.ApiImplicitParam; |
| 16 | 16 | import io.swagger.annotations.ApiOperation; |
| ... | ... | @@ -31,51 +31,51 @@ import java.util.List; |
| 31 | 31 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 32 | 32 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 33 | 33 | |
| 34 | -@Api(tags = "定时任务日志") | |
| 34 | +@Api(tags = "管理后台 - 定时任务日志") | |
| 35 | 35 | @RestController |
| 36 | 36 | @RequestMapping("/infra/job-log") |
| 37 | 37 | @Validated |
| 38 | -public class InfJobLogController { | |
| 38 | +public class JobLogController { | |
| 39 | 39 | |
| 40 | 40 | @Resource |
| 41 | - private InfJobLogService jobLogService; | |
| 41 | + private JobLogService jobLogService; | |
| 42 | 42 | |
| 43 | 43 | @GetMapping("/get") |
| 44 | 44 | @ApiOperation("获得定时任务日志") |
| 45 | 45 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 46 | 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 | 52 | @GetMapping("/list") |
| 53 | 53 | @ApiOperation("获得定时任务日志列表") |
| 54 | 54 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) |
| 55 | 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 | 61 | @GetMapping("/page") |
| 62 | 62 | @ApiOperation("获得定时任务日志分页") |
| 63 | 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 | 69 | @GetMapping("/export-excel") |
| 70 | 70 | @ApiOperation("导出定时任务日志 Excel") |
| 71 | 71 | @PreAuthorize("@ss.hasPermission('infra:job:export')") |
| 72 | 72 | @OperateLog(type = EXPORT) |
| 73 | - public void exportJobLogExcel(@Valid InfJobLogExportReqVO exportReqVO, | |
| 73 | + public void exportJobLogExcel(@Valid JobLogExportReqVO exportReqVO, | |
| 74 | 74 | HttpServletResponse response) throws IOException { |
| 75 | - List<InfJobLogDO> list = jobLogService.getJobLogList(exportReqVO); | |
| 75 | + List<JobLogDO> list = jobLogService.getJobLogList(exportReqVO); | |
| 76 | 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 | 10 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 11 | 11 | */ |
| 12 | 12 | @Data |
| 13 | -public class InfJobBaseVO { | |
| 13 | +public class JobBaseVO { | |
| 14 | 14 | |
| 15 | 15 | @ApiModelProperty(value = "任务名称", required = true, example = "测试任务") |
| 16 | 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 | 8 | |
| 9 | 9 | import javax.validation.constraints.NotNull; |
| 10 | 10 | |
| 11 | -@ApiModel("定时任务创建 Request VO") | |
| 11 | +@ApiModel("管理后台 - 定时任务创建 Request VO") | |
| 12 | 12 | @Data |
| 13 | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | 14 | @ToString(callSuper = true) |
| 15 | -public class InfJobCreateReqVO extends InfJobBaseVO { | |
| 15 | +public class JobCreateReqVO extends JobBaseVO { | |
| 16 | 16 | |
| 17 | 17 | @ApiModelProperty(value = "处理器的名字", required = true, example = "sysUserSessionTimeoutJob") |
| 18 | 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
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 | 4 | import io.swagger.annotations.ApiModelProperty; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | |
| 7 | -@ApiModel(value = "定时任务 Excel 导出 Request VO", description = "参数和 InfJobPageReqVO 是一致的") | |
| 7 | +@ApiModel(value = "管理后台 - 定时任务 Excel 导出 Request VO", description = "参数和 InfJobPageReqVO 是一致的") | |
| 8 | 8 | @Data |
| 9 | -public class InfJobExportReqVO { | |
| 9 | +public class JobExportReqVO { | |
| 10 | 10 | |
| 11 | 11 | @ApiModelProperty(value = "任务名称", example = "测试任务", notes = "模糊匹配") |
| 12 | 12 | private String name; |
| 13 | 13 | |
| 14 | - @ApiModelProperty(value = "任务状态", example = "1", notes = "参见 InfJobStatusEnum 枚举") | |
| 14 | + @ApiModelProperty(value = "任务状态", example = "1", notes = "参见 JobStatusEnum 枚举") | |
| 15 | 15 | private Integer status; |
| 16 | 16 | |
| 17 | - @ApiModelProperty(value = "处理器的名字", example = "sysUserSessionTimeoutJob", notes = "模糊匹配") | |
| 17 | + @ApiModelProperty(value = "处理器的名字", example = "UserSessionTimeoutJob", notes = "模糊匹配") | |
| 18 | 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 | 7 | import lombok.EqualsAndHashCode; |
| 8 | 8 | import lombok.ToString; |
| 9 | 9 | |
| 10 | -@ApiModel("定时任务分页 Request VO") | |
| 10 | +@ApiModel("管理后台 - 定时任务分页 Request VO") | |
| 11 | 11 | @Data |
| 12 | 12 | @EqualsAndHashCode(callSuper = true) |
| 13 | 13 | @ToString(callSuper = true) |
| 14 | -public class InfJobPageReqVO extends PageParam { | |
| 14 | +public class JobPageReqVO extends PageParam { | |
| 15 | 15 | |
| 16 | 16 | @ApiModelProperty(value = "任务名称", example = "测试任务", notes = "模糊匹配") |
| 17 | 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 | 9 | import javax.validation.constraints.NotNull; |
| 10 | 10 | import java.util.Date; |
| 11 | 11 | |
| 12 | -@ApiModel("定时任务 Response VO") | |
| 12 | +@ApiModel("管理后台 - 定时任务 Response VO") | |
| 13 | 13 | @Data |
| 14 | 14 | @EqualsAndHashCode(callSuper = true) |
| 15 | 15 | @ToString(callSuper = true) |
| 16 | -public class InfJobRespVO extends InfJobBaseVO { | |
| 16 | +public class JobRespVO extends JobBaseVO { | |
| 17 | 17 | |
| 18 | 18 | @ApiModelProperty(value = "任务编号", required = true, example = "1024") |
| 19 | 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 | 8 | |
| 9 | 9 | import javax.validation.constraints.NotNull; |
| 10 | 10 | |
| 11 | -@ApiModel("定时任务更新 Request VO") | |
| 11 | +@ApiModel("管理后台 - 定时任务更新 Request VO") | |
| 12 | 12 | @Data |
| 13 | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | 14 | @ToString(callSuper = true) |
| 15 | -public class InfJobUpdateReqVO extends InfJobBaseVO { | |
| 15 | +public class JobUpdateReqVO extends JobBaseVO { | |
| 16 | 16 | |
| 17 | 17 | @ApiModelProperty(value = "任务编号", required = true, example = "1024") |
| 18 | 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 | 14 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 15 | 15 | */ |
| 16 | 16 | @Data |
| 17 | -public class InfJobLogBaseVO { | |
| 17 | +public class JobLogBaseVO { | |
| 18 | 18 | |
| 19 | 19 | @ApiModelProperty(value = "任务编号", required = true, example = "1024") |
| 20 | 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
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 | |
| 10 | 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 | 13 | @Data |
| 14 | -public class InfJobLogExportReqVO { | |
| 14 | +public class JobLogExportReqVO { | |
| 15 | 15 | |
| 16 | 16 | @ApiModelProperty(value = "任务编号", example = "10") |
| 17 | 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 | 12 | |
| 13 | 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 | 16 | @Data |
| 17 | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | 18 | @ToString(callSuper = true) |
| 19 | -public class InfJobLogPageReqVO extends PageParam { | |
| 19 | +public class JobLogPageReqVO extends PageParam { | |
| 20 | 20 | |
| 21 | 21 | @ApiModelProperty(value = "任务编号", example = "10") |
| 22 | 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 | 8 | |
| 9 | 9 | import java.util.Date; |
| 10 | 10 | |
| 11 | -@ApiModel("定时任务日志 Response VO") | |
| 11 | +@ApiModel("管理后台 - 定时任务日志 Response VO") | |
| 12 | 12 | @Data |
| 13 | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | 14 | @ToString(callSuper = true) |
| 15 | -public class InfJobLogRespVO extends InfJobLogBaseVO { | |
| 15 | +public class JobLogRespVO extends JobLogBaseVO { | |
| 16 | 16 | |
| 17 | 17 | @ApiModelProperty(value = "日志编号", required = true, example = "1024") |
| 18 | 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 | 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 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 7 | 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 | 14 | import io.swagger.annotations.Api; |
| 15 | 15 | import io.swagger.annotations.ApiOperation; |
| 16 | 16 | import org.springframework.security.access.prepost.PreAuthorize; |
| ... | ... | @@ -28,33 +28,33 @@ import java.util.List; |
| 28 | 28 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 29 | 29 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 30 | 30 | |
| 31 | -@Api(tags = "API 访问日志") | |
| 31 | +@Api(tags = "管理后台 - API 访问日志") | |
| 32 | 32 | @RestController |
| 33 | 33 | @RequestMapping("/infra/api-access-log") |
| 34 | 34 | @Validated |
| 35 | -public class InfApiAccessLogController { | |
| 35 | +public class ApiAccessLogController { | |
| 36 | 36 | |
| 37 | 37 | @Resource |
| 38 | - private InfApiAccessLogService apiAccessLogService; | |
| 38 | + private ApiAccessLogService apiAccessLogService; | |
| 39 | 39 | |
| 40 | 40 | @GetMapping("/page") |
| 41 | 41 | @ApiOperation("获得API 访问日志分页") |
| 42 | 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 | 48 | @GetMapping("/export-excel") |
| 49 | 49 | @ApiOperation("导出API 访问日志 Excel") |
| 50 | 50 | @PreAuthorize("@ss.hasPermission('infra:api-access-log:export')") |
| 51 | 51 | @OperateLog(type = EXPORT) |
| 52 | - public void exportApiAccessLogExcel(@Valid InfApiAccessLogExportReqVO exportReqVO, | |
| 52 | + public void exportApiAccessLogExcel(@Valid ApiAccessLogExportReqVO exportReqVO, | |
| 53 | 53 | HttpServletResponse response) throws IOException { |
| 54 | - List<InfApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(exportReqVO); | |
| 54 | + List<ApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(exportReqVO); | |
| 55 | 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 | 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 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 7 | 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 | 14 | import io.swagger.annotations.Api; |
| 15 | 15 | import io.swagger.annotations.ApiImplicitParam; |
| 16 | 16 | import io.swagger.annotations.ApiImplicitParams; |
| ... | ... | @@ -29,14 +29,14 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 29 | 29 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 30 | 30 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 31 | 31 | |
| 32 | -@Api(tags = "API 错误日志") | |
| 32 | +@Api(tags = "管理后台 - API 错误日志") | |
| 33 | 33 | @RestController |
| 34 | 34 | @RequestMapping("/infra/api-error-log") |
| 35 | 35 | @Validated |
| 36 | -public class InfApiErrorLogController { | |
| 36 | +public class ApiErrorLogController { | |
| 37 | 37 | |
| 38 | 38 | @Resource |
| 39 | - private InfApiErrorLogService apiErrorLogService; | |
| 39 | + private ApiErrorLogService apiErrorLogService; | |
| 40 | 40 | |
| 41 | 41 | @PutMapping("/update-status") |
| 42 | 42 | @ApiOperation("更新 API 错误日志的状态") |
| ... | ... | @@ -54,21 +54,21 @@ public class InfApiErrorLogController { |
| 54 | 54 | @GetMapping("/page") |
| 55 | 55 | @ApiOperation("获得 API 错误日志分页") |
| 56 | 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 | 62 | @GetMapping("/export-excel") |
| 63 | 63 | @ApiOperation("导出 API 错误日志 Excel") |
| 64 | 64 | @PreAuthorize("@ss.hasPermission('infra:api-error-log:export')") |
| 65 | 65 | @OperateLog(type = EXPORT) |
| 66 | - public void exportApiErrorLogExcel(@Valid InfApiErrorLogExportReqVO exportReqVO, | |
| 66 | + public void exportApiErrorLogExcel(@Valid ApiErrorLogExportReqVO exportReqVO, | |
| 67 | 67 | HttpServletResponse response) throws IOException { |
| 68 | - List<InfApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(exportReqVO); | |
| 68 | + List<ApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(exportReqVO); | |
| 69 | 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 | 14 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 15 | 15 | */ |
| 16 | 16 | @Data |
| 17 | -public class InfApiAccessLogBaseVO { | |
| 17 | +public class ApiAccessLogBaseVO { | |
| 18 | 18 | |
| 19 | 19 | @ApiModelProperty(value = "链路追踪编号", required = true, example = "66600cb6-7852-11eb-9439-0242ac130002") |
| 20 | 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
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 | |
| 10 | 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 | 13 | @Data |
| 14 | -public class InfApiAccessLogExportReqVO { | |
| 14 | +public class ApiAccessLogExportReqVO { | |
| 15 | 15 | |
| 16 | 16 | @ApiModelProperty(value = "用户编号", example = "666") |
| 17 | 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 | 12 | |
| 13 | 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 | 16 | @Data |
| 17 | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | 18 | @ToString(callSuper = true) |
| 19 | -public class InfApiAccessLogPageReqVO extends PageParam { | |
| 19 | +public class ApiAccessLogPageReqVO extends PageParam { | |
| 20 | 20 | |
| 21 | 21 | @ApiModelProperty(value = "用户编号", example = "666") |
| 22 | 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 | 8 | |
| 9 | 9 | import java.util.Date; |
| 10 | 10 | |
| 11 | -@ApiModel("API 访问日志 Response VO") | |
| 11 | +@ApiModel("管理后台 - API 访问日志 Response VO") | |
| 12 | 12 | @Data |
| 13 | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | 14 | @ToString(callSuper = true) |
| 15 | -public class InfApiAccessLogRespVO extends InfApiAccessLogBaseVO { | |
| 15 | +public class ApiAccessLogRespVO extends ApiAccessLogBaseVO { | |
| 16 | 16 | |
| 17 | 17 | @ApiModelProperty(value = "日志主键", required = true, example = "1024") |
| 18 | 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 | 14 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 15 | 15 | */ |
| 16 | 16 | @Data |
| 17 | -public class InfApiErrorLogBaseVO { | |
| 17 | +public class ApiErrorLogBaseVO { | |
| 18 | 18 | |
| 19 | 19 | @ApiModelProperty(value = "链路追踪编号", required = true, example = "66600cb6-7852-11eb-9439-0242ac130002") |
| 20 | 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 | 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 5 | 5 | import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; |
| 6 | -import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | |
| 7 | 6 | import com.alibaba.excel.annotation.ExcelProperty; |
| 8 | 7 | import lombok.Data; |
| 9 | 8 | |
| ... | ... | @@ -15,7 +14,7 @@ import java.util.Date; |
| 15 | 14 | * @author 芋道源码 |
| 16 | 15 | */ |
| 17 | 16 | @Data |
| 18 | -public class InfApiErrorLogExcelVO { | |
| 17 | +public class ApiErrorLogExcelVO { | |
| 19 | 18 | |
| 20 | 19 | @ExcelProperty("编号") |
| 21 | 20 | private Integer id; |
| ... | ... | @@ -27,7 +26,7 @@ public class InfApiErrorLogExcelVO { |
| 27 | 26 | private Integer userId; |
| 28 | 27 | |
| 29 | 28 | @ExcelProperty(value = "用户类型", converter = DictConvert.class) |
| 30 | - @DictFormat(DictTypeConstants.USER_TYPE) | |
| 29 | + @DictFormat(cn.iocoder.yudao.module.system.enums.DictTypeConstants.USER_TYPE) | |
| 31 | 30 | private Integer userType; |
| 32 | 31 | |
| 33 | 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 | |
| 10 | 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 | 13 | @Data |
| 14 | -public class InfApiErrorLogExportReqVO { | |
| 14 | +public class ApiErrorLogExportReqVO { | |
| 15 | 15 | |
| 16 | 16 | @ApiModelProperty(value = "用户编号", example = "666") |
| 17 | 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 | 12 | |
| 13 | 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 | 16 | @Data |
| 17 | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | 18 | @ToString(callSuper = true) |
| 19 | -public class InfApiErrorLogPageReqVO extends PageParam { | |
| 19 | +public class ApiErrorLogPageReqVO extends PageParam { | |
| 20 | 20 | |
| 21 | 21 | @ApiModelProperty(value = "用户编号", example = "666") |
| 22 | 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 | 8 | |
| 9 | 9 | import java.util.Date; |
| 10 | 10 | |
| 11 | -@ApiModel("API 错误日志 Response VO") | |
| 11 | +@ApiModel("管理后台 - API 错误日志 Response VO") | |
| 12 | 12 | @Data |
| 13 | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | 14 | @ToString(callSuper = true) |
| 15 | -public class InfApiErrorLogRespVO extends InfApiErrorLogBaseVO { | |
| 15 | +public class ApiErrorLogRespVO extends ApiErrorLogBaseVO { | |
| 16 | 16 | |
| 17 | 17 | @ApiModelProperty(value = "编号", required = true, example = "1024") |
| 18 | 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 | 1 | ### 请求 /infra/redis/get-monitor-info 接口 => 成功 |
| 2 | 2 | GET {{baseUrl}}/infra/redis/get-monitor-info |
| 3 | 3 | Authorization: Bearer {{token}} |
| 4 | +tenant-id: {{adminTenentId}} | |
| 4 | 5 | |
| 5 | 6 | ### 请求 /infra/redis/get-key-list 接口 => 成功 |
| 6 | 7 | GET {{baseUrl}}/infra/redis/get-key-list |
| 7 | 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 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; |
| 5 | 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 | 8 | import cn.iocoder.yudao.module.infra.convert.redis.RedisConvert; |
| 9 | 9 | import io.swagger.annotations.Api; |
| 10 | 10 | import io.swagger.annotations.ApiOperation; |
| ... | ... | @@ -22,7 +22,7 @@ import java.util.Properties; |
| 22 | 22 | |
| 23 | 23 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 24 | 24 | |
| 25 | -@Api(tags = "Redis 监控") | |
| 25 | +@Api(tags = "管理后台 - Redis 监控") | |
| 26 | 26 | @RestController |
| 27 | 27 | @RequestMapping("/infra/redis") |
| 28 | 28 | public class RedisController { |
| ... | ... | @@ -33,7 +33,7 @@ public class RedisController { |
| 33 | 33 | @GetMapping("/get-monitor-info") |
| 34 | 34 | @ApiOperation("获得 Redis 监控信息") |
| 35 | 35 | @PreAuthorize("@ss.hasPermission('infra:redis:get-monitor-info')") |
| 36 | - public CommonResult<InfRedisMonitorRespVO> getRedisMonitorInfo() { | |
| 36 | + public CommonResult<RedisMonitorRespVO> getRedisMonitorInfo() { | |
| 37 | 37 | // 获得 Redis 统计信息 |
| 38 | 38 | Properties info = stringRedisTemplate.execute((RedisCallback<Properties>) RedisServerCommands::info); |
| 39 | 39 | Long dbSize = stringRedisTemplate.execute(RedisServerCommands::dbSize); |
| ... | ... | @@ -47,7 +47,7 @@ public class RedisController { |
| 47 | 47 | @GetMapping("/get-key-list") |
| 48 | 48 | @ApiOperation("获得 Redis Key 列表") |
| 49 | 49 | @PreAuthorize("@ss.hasPermission('infra:redis:get-key-list')") |
| 50 | - public CommonResult<List<InfRedisKeyRespVO>> getKeyList() { | |
| 50 | + public CommonResult<List<RedisKeyRespVO>> getKeyList() { | |
| 51 | 51 | List<RedisKeyDefine> keyDefines = RedisKeyRegistry.list(); |
| 52 | 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 | 9 | |
| 10 | 10 | import java.time.Duration; |
| 11 | 11 | |
| 12 | -@ApiModel("Redis Key 信息 Response VO") | |
| 12 | +@ApiModel("管理后台 - Redis Key 信息 Response VO") | |
| 13 | 13 | @Data |
| 14 | 14 | @Builder |
| 15 | 15 | @AllArgsConstructor |
| 16 | -public class InfRedisKeyRespVO { | |
| 16 | +public class RedisKeyRespVO { | |
| 17 | 17 | |
| 18 | 18 | @ApiModelProperty(value = "login_user:%s", required = true, example = "String") |
| 19 | 19 | private String keyTemplate; |
| ... | ... | @@ -22,7 +22,7 @@ public class InfRedisKeyRespVO { |
| 22 | 22 | private RedisKeyDefine.KeyTypeEnum keyType; |
| 23 | 23 | |
| 24 | 24 | @ApiModelProperty(value = "Value 类型", required = true, example = "java.lang.String") |
| 25 | - private Class valueType; | |
| 25 | + private Class<?> valueType; | |
| 26 | 26 | |
| 27 | 27 | @ApiModelProperty(value = "超时类型", required = true, example = "1") |
| 28 | 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 | 9 | import java.util.List; |
| 10 | 10 | import java.util.Properties; |
| 11 | 11 | |
| 12 | -@ApiModel("Redis 监控信息 Response VO") | |
| 12 | +@ApiModel("管理后台 - Redis 监控信息 Response VO") | |
| 13 | 13 | @Data |
| 14 | 14 | @Builder |
| 15 | 15 | @AllArgsConstructor |
| 16 | -public class InfRedisMonitorRespVO { | |
| 16 | +public class RedisMonitorRespVO { | |
| 17 | 17 | |
| 18 | 18 | @ApiModelProperty(value = "Redis info 指令结果", required = true, notes = "具体字段,查看 Redis 文档") |
| 19 | 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 | 1 | package cn.iocoder.yudao.module.infra.convert.config; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; | |
| 4 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 4 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; |
| 6 | 5 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExcelVO; |
| 7 | 6 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigRespVO; |
| 8 | 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 | import org.mapstruct.Mapper; |
| 10 | 10 | import org.mapstruct.factory.Mappers; |
| 11 | 11 | |
| 12 | 12 | import java.util.List; |
| 13 | 13 | |
| 14 | 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 | 1 | package cn.iocoder.yudao.module.infra.convert.job; |
| 2 | 2 | |
| 3 | 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 | 7 | import org.mapstruct.Mapper; |
| 8 | 8 | import org.mapstruct.factory.Mappers; |
| 9 | 9 | |
| ... | ... | @@ -15,16 +15,16 @@ import java.util.List; |
| 15 | 15 | * @author 芋艿 |
| 16 | 16 | */ |
| 17 | 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 | 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 | 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 | 8 | import org.mapstruct.Mapper; |
| 8 | 9 | import org.mapstruct.factory.Mappers; |
| 9 | 10 | |
| ... | ... | @@ -15,14 +16,16 @@ import java.util.List; |
| 15 | 16 | * @author 芋道源码 |
| 16 | 17 | */ |
| 17 | 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 | 2 | |
| 3 | 3 | import cn.hutool.core.util.StrUtil; |
| 4 | 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 | 7 | import org.mapstruct.Mapper; |
| 8 | 8 | import org.mapstruct.factory.Mappers; |
| 9 | 9 | |
| ... | ... | @@ -16,11 +16,11 @@ public interface RedisConvert { |
| 16 | 16 | |
| 17 | 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 | 21 | .commandStats(new ArrayList<>(commandStats.size())).build(); |
| 22 | 22 | commandStats.forEach((key, value) -> { |
| 23 | - respVO.getCommandStats().add(InfRedisMonitorRespVO.CommandStat.builder() | |
| 23 | + respVO.getCommandStats().add(RedisMonitorRespVO.CommandStat.builder() | |
| 24 | 24 | .command(StrUtil.subAfter((String) key, "cmdstat_", false)) |
| 25 | 25 | .calls(Integer.valueOf(StrUtil.subBetween((String) value, "calls=", ","))) |
| 26 | 26 | .usec(Long.valueOf(StrUtil.subBetween((String) value, "usec=", ","))) |
| ... | ... | @@ -29,6 +29,6 @@ public interface RedisConvert { |
| 29 | 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 | 13 | * |
| 14 | 14 | * @author 芋道源码 |
| 15 | 15 | */ |
| 16 | -@TableName("inf_config") | |
| 16 | +@TableName("infra_config") | |
| 17 | 17 | @Data |
| 18 | 18 | @EqualsAndHashCode(callSuper = true) |
| 19 | 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 | 1 | package cn.iocoder.yudao.module.infra.dal.dataobject.file; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | 3 | import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; |
| 5 | 4 | import com.baomidou.mybatisplus.annotation.IdType; |
| 6 | 5 | import com.baomidou.mybatisplus.annotation.TableField; |
| ... | ... | @@ -16,13 +15,13 @@ import java.io.InputStream; |
| 16 | 15 | * @author 芋道源码 |
| 17 | 16 | */ |
| 18 | 17 | @Data |
| 19 | -@TableName("inf_file") | |
| 18 | +@TableName("infra_file") | |
| 20 | 19 | @EqualsAndHashCode(callSuper = true) |
| 21 | 20 | @ToString(callSuper = true) |
| 22 | 21 | @Builder |
| 23 | 22 | @NoArgsConstructor |
| 24 | 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 | 1 | package cn.iocoder.yudao.module.infra.dal.dataobject.job; |
| 2 | 2 | |
| 3 | 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 | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | 7 | import lombok.*; |
| ... | ... | @@ -11,14 +11,14 @@ import lombok.*; |
| 11 | 11 | * |
| 12 | 12 | * @author 芋道源码 |
| 13 | 13 | */ |
| 14 | -@TableName("inf_job") | |
| 14 | +@TableName("infra_job") | |
| 15 | 15 | @Data |
| 16 | 16 | @EqualsAndHashCode(callSuper = true) |
| 17 | 17 | @ToString(callSuper = true) |
| 18 | 18 | @Builder |
| 19 | 19 | @NoArgsConstructor |
| 20 | 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 | 32 | /** |
| 33 | 33 | * 任务状态 |
| 34 | 34 | * |
| 35 | - * 枚举 {@link InfJobStatusEnum} | |
| 35 | + * 枚举 {@link JobStatusEnum} | |
| 36 | 36 | */ |
| 37 | 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 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 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 | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | 7 | import lombok.*; |
| 8 | 8 | |
| ... | ... | @@ -13,14 +13,14 @@ import java.util.Date; |
| 13 | 13 | * |
| 14 | 14 | * @author 芋道源码 |
| 15 | 15 | */ |
| 16 | -@TableName("inf_job_log") | |
| 16 | +@TableName("infra_job_log") | |
| 17 | 17 | @Data |
| 18 | 18 | @EqualsAndHashCode(callSuper = true) |
| 19 | 19 | @ToString(callSuper = true) |
| 20 | 20 | @Builder |
| 21 | 21 | @NoArgsConstructor |
| 22 | 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 | 29 | /** |
| 30 | 30 | * 任务编号 |
| 31 | 31 | * |
| 32 | - * 关联 {@link InfJobDO#getId()} | |
| 32 | + * 关联 {@link JobDO#getId()} | |
| 33 | 33 | */ |
| 34 | 34 | private Long jobId; |
| 35 | 35 | /** |
| 36 | 36 | * 处理器的名字 |
| 37 | 37 | * |
| 38 | - * 冗余字段 {@link InfJobDO#getHandlerName()} | |
| 38 | + * 冗余字段 {@link JobDO#getHandlerName()} | |
| 39 | 39 | */ |
| 40 | 40 | private String handlerName; |
| 41 | 41 | /** |
| 42 | 42 | * 处理器的参数 |
| 43 | 43 | * |
| 44 | - * 冗余字段 {@link InfJobDO#getHandlerParam()} | |
| 44 | + * 冗余字段 {@link JobDO#getHandlerParam()} | |
| 45 | 45 | */ |
| 46 | 46 | private String handlerParam; |
| 47 | 47 | /** |
| ... | ... | @@ -66,7 +66,7 @@ public class InfJobLogDO extends BaseDO { |
| 66 | 66 | /** |
| 67 | 67 | * 状态 |
| 68 | 68 | * |
| 69 | - * 枚举 {@link InfJobLogStatusEnum} | |
| 69 | + * 枚举 {@link JobLogStatusEnum} | |
| 70 | 70 | */ |
| 71 | 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 | * |
| 15 | 15 | * @author 芋道源码 |
| 16 | 16 | */ |
| 17 | -@TableName("inf_api_access_log") | |
| 17 | +@TableName("infra_api_access_log") | |
| 18 | 18 | @Data |
| 19 | 19 | @EqualsAndHashCode(callSuper = true) |
| 20 | 20 | @ToString(callSuper = true) |
| 21 | 21 | @Builder |
| 22 | 22 | @NoArgsConstructor |
| 23 | 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 | 1 | package cn.iocoder.yudao.module.infra.dal.dataobject.logger; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum; | |
| 4 | 3 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 5 | 4 | import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; |
| 6 | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
| ... | ... | @@ -14,14 +13,14 @@ import java.util.Date; |
| 14 | 13 | * |
| 15 | 14 | * @author 芋道源码 |
| 16 | 15 | */ |
| 17 | -@TableName("inf_api_error_log") | |
| 16 | +@TableName("infra_api_error_log") | |
| 18 | 17 | @Data |
| 19 | 18 | @EqualsAndHashCode(callSuper = true) |
| 20 | 19 | @ToString(callSuper = true) |
| 21 | 20 | @Builder |
| 22 | 21 | @NoArgsConstructor |
| 23 | 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 | 16 | * |
| 17 | 17 | * @author 芋道源码 |
| 18 | 18 | */ |
| 19 | -public class InfConfigCoreDAOImpl implements ConfigFrameworkDAO { | |
| 19 | +public class ConfigCoreDAOImpl implements ConfigFrameworkDAO { | |
| 20 | 20 | |
| 21 | 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 | 24 | DataSource dataSource = new DriverManagerDataSource(jdbcUrl, username, password); |
| 25 | 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 | 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 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; |
| 7 | 6 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; |
| 8 | 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; |
| 8 | +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; | |
| 9 | 9 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 10 | 10 | import org.apache.ibatis.annotations.Mapper; |
| 11 | 11 | |
| 12 | 12 | import java.util.List; |
| 13 | 13 | |
| 14 | 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 | 23 | .likeIfPresent("name", reqVO.getName()) |
| 24 | 24 | .likeIfPresent("`key`", reqVO.getKey()) |
| 25 | 25 | .eqIfPresent("`type`", reqVO.getType()) |
| 26 | 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 | 31 | .likeIfPresent("name", reqVO.getName()) |
| 32 | 32 | .likeIfPresent("`key`", reqVO.getKey()) |
| 33 | 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 | 1 | package cn.iocoder.yudao.module.infra.dal.mysql.file; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 3 | 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 | 8 | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| 6 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 7 | 10 | |
| 11 | +/** | |
| 12 | + * 文件操作 Mapper | |
| 13 | + * | |
| 14 | + * @author 芋道源码 | |
| 15 | + */ | |
| 8 | 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 | 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 | 37 | * @return 文件 |
| 22 | 38 | */ |
| 23 | 39 | @InterceptorIgnore(tenantLine = "true") |
| 24 | - default InfFileDO selectByPath(String path) { | |
| 40 | + default FileDO selectByPath(String path) { | |
| 25 | 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 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 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 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | |
| 11 | 11 | import java.util.List; |
| ... | ... | @@ -16,10 +16,10 @@ import java.util.List; |
| 16 | 16 | * @author 芋道源码 |
| 17 | 17 | */ |
| 18 | 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 | 23 | .eqIfPresent("job_id", reqVO.getJobId()) |
| 24 | 24 | .likeIfPresent("handler_name", reqVO.getHandlerName()) |
| 25 | 25 | .geIfPresent("begin_time", reqVO.getBeginTime()) |
| ... | ... | @@ -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 | 34 | .eqIfPresent("job_id", reqVO.getJobId()) |
| 35 | 35 | .likeIfPresent("handler_name", reqVO.getHandlerName()) |
| 36 | 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 | 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 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 7 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 8 | 8 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| ... | ... | @@ -16,25 +16,25 @@ import java.util.List; |
| 16 | 16 | * @author 芋道源码 |
| 17 | 17 | */ |
| 18 | 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 | 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 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 6 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 8 | 7 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; |
| 8 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; | |
| 9 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | |
| 11 | 11 | import java.util.List; |
| ... | ... | @@ -16,10 +16,10 @@ import java.util.List; |
| 16 | 16 | * @author 芋道源码 |
| 17 | 17 | */ |
| 18 | 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 | 23 | .eqIfPresent("user_id", reqVO.getUserId()) |
| 24 | 24 | .eqIfPresent("user_type", reqVO.getUserType()) |
| 25 | 25 | .eqIfPresent("application_name", reqVO.getApplicationName()) |
| ... | ... | @@ -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 | 36 | .eqIfPresent("user_id", reqVO.getUserId()) |
| 37 | 37 | .eqIfPresent("user_type", reqVO.getUserType()) |
| 38 | 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 | 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 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | 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 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | |
| 11 | 11 | import java.util.List; |
| ... | ... | @@ -16,10 +16,10 @@ import java.util.List; |
| 16 | 16 | * @author 芋道源码 |
| 17 | 17 | */ |
| 18 | 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 | 23 | .eqIfPresent("user_id", reqVO.getUserId()) |
| 24 | 24 | .eqIfPresent("user_type", reqVO.getUserType()) |
| 25 | 25 | .eqIfPresent("application_name", reqVO.getApplicationName()) |
| ... | ... | @@ -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 | 35 | .eqIfPresent("user_id", reqVO.getUserId()) |
| 36 | 36 | .eqIfPresent("user_type", reqVO.getUserType()) |
| 37 | 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
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 | 3 | import com.google.common.collect.Sets; |
| 4 | 4 | import lombok.AllArgsConstructor; |
| 5 | 5 | import lombok.Getter; |
| 6 | +import org.quartz.impl.jdbcjobstore.Constants; | |
| 6 | 7 | |
| 7 | 8 | import java.util.Collections; |
| 8 | 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 | 15 | */ |
| 17 | 16 | @Getter |
| 18 | 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
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
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
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
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 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.apollo.internals.DBConfigRepository; |
| 4 | 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 | 6 | import lombok.extern.slf4j.Slf4j; |
| 7 | 7 | import org.springframework.stereotype.Component; |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | - * 针对 {@link InfConfigRefreshMessage} 的消费者 | |
| 10 | + * 针对 {@link ConfigRefreshMessage} 的消费者 | |
| 11 | 11 | * |
| 12 | 12 | * @author 芋道源码 |
| 13 | 13 | */ |
| 14 | 14 | @Component |
| 15 | 15 | @Slf4j |
| 16 | -public class InfConfigRefreshConsumer extends AbstractChannelMessageListener<InfConfigRefreshMessage> { | |
| 16 | +public class ConfigRefreshConsumer extends AbstractChannelMessageListener<ConfigRefreshMessage> { | |
| 17 | 17 | |
| 18 | 18 | @Override |
| 19 | - public void onMessage(InfConfigRefreshMessage message) { | |
| 19 | + public void onMessage(ConfigRefreshMessage message) { | |
| 20 | 20 | log.info("[onMessage][收到 Config 刷新消息]"); |
| 21 | 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
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 | 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 | 4 | import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; |
| 5 | 5 | import org.springframework.stereotype.Component; |
| 6 | 6 | |
| ... | ... | @@ -10,16 +10,16 @@ import javax.annotation.Resource; |
| 10 | 10 | * Config 配置相关消息的 Producer |
| 11 | 11 | */ |
| 12 | 12 | @Component |
| 13 | -public class InfConfigProducer { | |
| 13 | +public class ConfigProducer { | |
| 14 | 14 | |
| 15 | 15 | @Resource |
| 16 | 16 | private RedisMQTemplate redisMQTemplate; |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * 发送 {@link InfConfigRefreshMessage} 消息 | |
| 19 | + * 发送 {@link ConfigRefreshMessage} 消息 | |
| 20 | 20 | */ |
| 21 | 21 | public void sendConfigRefreshMessage() { |
| 22 | - InfConfigRefreshMessage message = new InfConfigRefreshMessage(); | |
| 22 | + ConfigRefreshMessage message = new ConfigRefreshMessage(); | |
| 23 | 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 | 1 | package cn.iocoder.yudao.module.infra.service.config; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; | |
| 4 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 4 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; |
| 6 | 5 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; |
| 7 | 6 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; |
| 8 | 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 | 10 | import javax.validation.Valid; |
| 11 | 11 | import java.util.List; |
| ... | ... | @@ -15,7 +15,7 @@ import java.util.List; |
| 15 | 15 | * |
| 16 | 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 | 45 | * @param id 配置编号 |
| 46 | 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 | 53 | * @param key 配置键 |
| 54 | 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 | 61 | * @param reqVO 分页条件 |
| 62 | 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 | 69 | * @param reqVO 列表 |
| 70 | 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 | 3 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; |
| 5 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 5 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; |
| 7 | 6 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; |
| 8 | 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; |
| 9 | 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 | 15 | import com.google.common.annotations.VisibleForTesting; |
| 17 | 16 | import lombok.extern.slf4j.Slf4j; |
| 18 | 17 | import org.springframework.stereotype.Service; |
| 19 | 18 | import org.springframework.validation.annotation.Validated; |
| 20 | 19 | |
| 21 | 20 | import javax.annotation.Resource; |
| 22 | - | |
| 23 | 21 | import java.util.List; |
| 24 | 22 | |
| 25 | 23 | /** |
| ... | ... | @@ -28,21 +26,21 @@ import java.util.List; |
| 28 | 26 | @Service |
| 29 | 27 | @Slf4j |
| 30 | 28 | @Validated |
| 31 | -public class InfConfigServiceImpl implements InfConfigService { | |
| 29 | +public class ConfigServiceImpl implements ConfigService { | |
| 32 | 30 | |
| 33 | 31 | @Resource |
| 34 | - private InfConfigMapper configMapper; | |
| 32 | + private ConfigMapper configMapper; | |
| 35 | 33 | |
| 36 | 34 | @Resource |
| 37 | - private InfConfigProducer configProducer; | |
| 35 | + private ConfigProducer configProducer; | |
| 38 | 36 | |
| 39 | 37 | @Override |
| 40 | 38 | public Long createConfig(ConfigCreateReqVO reqVO) { |
| 41 | 39 | // 校验正确性 |
| 42 | 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 | 44 | configMapper.insert(config); |
| 47 | 45 | // 发送刷新消息 |
| 48 | 46 | configProducer.sendConfigRefreshMessage(); |
| ... | ... | @@ -54,7 +52,7 @@ public class InfConfigServiceImpl implements InfConfigService { |
| 54 | 52 | // 校验正确性 |
| 55 | 53 | checkCreateOrUpdate(reqVO.getId(), null); // 不允许更新 key |
| 56 | 54 | // 更新参数配置 |
| 57 | - InfConfigDO updateObj = InfConfigConvert.INSTANCE.convert(reqVO); | |
| 55 | + ConfigDO updateObj = ConfigConvert.INSTANCE.convert(reqVO); | |
| 58 | 56 | configMapper.updateById(updateObj); |
| 59 | 57 | // 发送刷新消息 |
| 60 | 58 | configProducer.sendConfigRefreshMessage(); |
| ... | ... | @@ -63,10 +61,10 @@ public class InfConfigServiceImpl implements InfConfigService { |
| 63 | 61 | @Override |
| 64 | 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 | 70 | configMapper.deleteById(id); |
| ... | ... | @@ -75,22 +73,22 @@ public class InfConfigServiceImpl implements InfConfigService { |
| 75 | 73 | } |
| 76 | 74 | |
| 77 | 75 | @Override |
| 78 | - public InfConfigDO getConfig(Long id) { | |
| 76 | + public ConfigDO getConfig(Long id) { | |
| 79 | 77 | return configMapper.selectById(id); |
| 80 | 78 | } |
| 81 | 79 | |
| 82 | 80 | @Override |
| 83 | - public InfConfigDO getConfigByKey(String key) { | |
| 81 | + public ConfigDO getConfigByKey(String key) { | |
| 84 | 82 | return configMapper.selectByKey(key); |
| 85 | 83 | } |
| 86 | 84 | |
| 87 | 85 | @Override |
| 88 | - public PageResult<InfConfigDO> getConfigPage(ConfigPageReqVO reqVO) { | |
| 86 | + public PageResult<ConfigDO> getConfigPage(ConfigPageReqVO reqVO) { | |
| 89 | 87 | return configMapper.selectPage(reqVO); |
| 90 | 88 | } |
| 91 | 89 | |
| 92 | 90 | @Override |
| 93 | - public List<InfConfigDO> getConfigList(ConfigExportReqVO reqVO) { | |
| 91 | + public List<ConfigDO> getConfigList(ConfigExportReqVO reqVO) { | |
| 94 | 92 | return configMapper.selectList(reqVO); |
| 95 | 93 | } |
| 96 | 94 | |
| ... | ... | @@ -102,29 +100,29 @@ public class InfConfigServiceImpl implements InfConfigService { |
| 102 | 100 | } |
| 103 | 101 | |
| 104 | 102 | @VisibleForTesting |
| 105 | - public InfConfigDO checkConfigExists(Long id) { | |
| 103 | + public ConfigDO checkConfigExists(Long id) { | |
| 106 | 104 | if (id == null) { |
| 107 | 105 | return null; |
| 108 | 106 | } |
| 109 | - InfConfigDO config = configMapper.selectById(id); | |
| 107 | + ConfigDO config = configMapper.selectById(id); | |
| 110 | 108 | if (config == null) { |
| 111 | - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_NOT_EXISTS); | |
| 109 | + throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_NOT_EXISTS); | |
| 112 | 110 | } |
| 113 | 111 | return config; |
| 114 | 112 | } |
| 115 | 113 | |
| 116 | 114 | @VisibleForTesting |
| 117 | 115 | public void checkConfigKeyUnique(Long id, String key) { |
| 118 | - InfConfigDO config = configMapper.selectByKey(key); | |
| 116 | + ConfigDO config = configMapper.selectByKey(key); | |
| 119 | 117 | if (config == null) { |
| 120 | 118 | return; |
| 121 | 119 | } |
| 122 | 120 | // 如果 id 为空,说明不用比较是否为相同 id 的参数配置 |
| 123 | 121 | if (id == null) { |
| 124 | - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_KEY_DUPLICATE); | |
| 122 | + throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_KEY_DUPLICATE); | |
| 125 | 123 | } |
| 126 | 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 | 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 | 41 | * @param path 文件路径 |
| 32 | 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 | 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 | 9 | import org.springframework.stereotype.Service; |
| 9 | 10 | |
| 10 | 11 | import javax.annotation.Resource; |
| 11 | 12 | import java.io.ByteArrayInputStream; |
| 12 | 13 | |
| 13 | -import static cn.iocoder.yudao.coreservice.modules.infra.enums.SysErrorCodeConstants.*; | |
| 14 | 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 | 22 | @Service |
| 22 | -public class InfFileCoreServiceImpl implements InfFileCoreService { | |
| 23 | +public class FileServiceImpl implements FileService { | |
| 23 | 24 | |
| 24 | 25 | @Resource |
| 25 | - private InfFileCoreMapper fileMapper; | |
| 26 | + private FileMapper fileMapper; | |
| 26 | 27 | |
| 27 | 28 | @Resource |
| 28 | 29 | private FileProperties fileProperties; |
| 29 | 30 | |
| 30 | 31 | @Override |
| 32 | + public PageResult<FileDO> getFilePage(FilePageReqVO pageReqVO) { | |
| 33 | + return fileMapper.selectPage(pageReqVO); | |
| 34 | + } | |
| 35 | + | |
| 36 | + @Override | |
| 31 | 37 | public String createFile(String path, byte[] content) { |
| 32 | 38 | if (fileMapper.selectCountById(path) > 0) { |
| 33 | 39 | throw exception(FILE_PATH_EXISTS); |
| 34 | 40 | } |
| 35 | 41 | // 保存到数据库 |
| 36 | - InfFileDO file = new InfFileDO(); | |
| 42 | + FileDO file = new FileDO(); | |
| 37 | 43 | file.setId(path); |
| 38 | 44 | file.setType(FileTypeUtil.getType(new ByteArrayInputStream(content))); |
| 39 | 45 | file.setContent(content); |
| ... | ... | @@ -57,7 +63,7 @@ public class InfFileCoreServiceImpl implements InfFileCoreService { |
| 57 | 63 | } |
| 58 | 64 | |
| 59 | 65 | @Override |
| 60 | - public InfFileDO getFile(String path) { | |
| 66 | + public FileDO getFile(String path) { | |
| 61 | 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 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 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 | 9 | import java.util.Collection; |
| 10 | 10 | import java.util.List; |
| ... | ... | @@ -14,7 +14,7 @@ import java.util.List; |
| 14 | 14 | * |
| 15 | 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 | 22 | * @param id 编号 |
| 23 | 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 | 30 | * @param ids 编号 |
| 31 | 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 | 38 | * @param pageReqVO 分页查询 |
| 39 | 39 | * @return 定时任务分页 |
| 40 | 40 | */ |
| 41 | - PageResult<InfJobLogDO> getJobLogPage(InfJobLogPageReqVO pageReqVO); | |
| 41 | + PageResult<JobLogDO> getJobLogPage(JobLogPageReqVO pageReqVO); | |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * 获得定时任务列表, 用于 Excel 导出 |
| ... | ... | @@ -46,6 +46,6 @@ public interface InfJobLogService extends JobLogFrameworkService { |
| 46 | 46 | * @param exportReqVO 查询条件 |
| 47 | 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 | 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 | 9 | import lombok.extern.slf4j.Slf4j; |
| 11 | 10 | import org.springframework.scheduling.annotation.Async; |
| 12 | 11 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -25,15 +24,15 @@ import java.util.List; |
| 25 | 24 | @Service |
| 26 | 25 | @Validated |
| 27 | 26 | @Slf4j |
| 28 | -public class InfJobLogServiceImpl implements InfJobLogService { | |
| 27 | +public class JobLogServiceImpl implements JobLogService { | |
| 29 | 28 | |
| 30 | 29 | @Resource |
| 31 | - private InfJobLogMapper jobLogMapper; | |
| 30 | + private JobLogMapper jobLogMapper; | |
| 32 | 31 | |
| 33 | 32 | @Override |
| 34 | 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 | 36 | jobLogMapper.insert(log); |
| 38 | 37 | return log.getId(); |
| 39 | 38 | } |
| ... | ... | @@ -42,8 +41,8 @@ public class InfJobLogServiceImpl implements InfJobLogService { |
| 42 | 41 | @Async |
| 43 | 42 | public void updateJobLogResultAsync(Long logId, Date endTime, Integer duration, boolean success, String result) { |
| 44 | 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 | 46 | jobLogMapper.updateById(updateObj); |
| 48 | 47 | } catch (Exception ex) { |
| 49 | 48 | log.error("[updateJobLogResultAsync][logId({}) endTime({}) duration({}) success({}) result({})]", |
| ... | ... | @@ -52,22 +51,22 @@ public class InfJobLogServiceImpl implements InfJobLogService { |
| 52 | 51 | } |
| 53 | 52 | |
| 54 | 53 | @Override |
| 55 | - public InfJobLogDO getJobLog(Long id) { | |
| 54 | + public JobLogDO getJobLog(Long id) { | |
| 56 | 55 | return jobLogMapper.selectById(id); |
| 57 | 56 | } |
| 58 | 57 | |
| 59 | 58 | @Override |
| 60 | - public List<InfJobLogDO> getJobLogList(Collection<Long> ids) { | |
| 59 | + public List<JobLogDO> getJobLogList(Collection<Long> ids) { | |
| 61 | 60 | return jobLogMapper.selectBatchIds(ids); |
| 62 | 61 | } |
| 63 | 62 | |
| 64 | 63 | @Override |
| 65 | - public PageResult<InfJobLogDO> getJobLogPage(InfJobLogPageReqVO pageReqVO) { | |
| 64 | + public PageResult<JobLogDO> getJobLogPage(JobLogPageReqVO pageReqVO) { | |
| 66 | 65 | return jobLogMapper.selectPage(pageReqVO); |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | 68 | @Override |
| 70 | - public List<InfJobLogDO> getJobLogList(InfJobLogExportReqVO exportReqVO) { | |
| 69 | + public List<JobLogDO> getJobLogList(JobLogExportReqVO exportReqVO) { | |
| 71 | 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 | 1 | package cn.iocoder.yudao.module.infra.service.job; |
| 2 | 2 | |
| 3 | 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 | 9 | import org.quartz.SchedulerException; |
| 10 | 10 | |
| 11 | 11 | import javax.validation.Valid; |
| ... | ... | @@ -17,7 +17,7 @@ import java.util.List; |
| 17 | 17 | * |
| 18 | 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 | 25 | * @param createReqVO 创建信息 |
| 26 | 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 | 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 | 62 | * @param id 编号 |
| 63 | 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 | 70 | * @param ids 编号 |
| 71 | 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 | 78 | * @param pageReqVO 分页查询 |
| 79 | 79 | * @return 定时任务分页 |
| 80 | 80 | */ |
| 81 | - PageResult<InfJobDO> getJobPage(InfJobPageReqVO pageReqVO); | |
| 81 | + PageResult<JobDO> getJobPage(JobPageReqVO pageReqVO); | |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * 获得定时任务列表, 用于 Excel 导出 |
| ... | ... | @@ -86,6 +86,6 @@ public interface InfJobService { |
| 86 | 86 | * @param exportReqVO 查询条件 |
| 87 | 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 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager; |
| 5 | 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 | 14 | import org.quartz.SchedulerException; |
| 16 | 15 | import org.springframework.stereotype.Service; |
| 17 | 16 | import org.springframework.transaction.annotation.Transactional; |
| ... | ... | @@ -22,7 +21,7 @@ import java.util.Collection; |
| 22 | 21 | import java.util.List; |
| 23 | 22 | |
| 24 | 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 | 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 | 31 | */ |
| 33 | 32 | @Service |
| 34 | 33 | @Validated |
| 35 | -public class InfJobServiceImpl implements InfJobService { | |
| 34 | +public class JobServiceImpl implements JobService { | |
| 36 | 35 | |
| 37 | 36 | @Resource |
| 38 | - private InfJobMapper jobMapper; | |
| 37 | + private JobMapper jobMapper; | |
| 39 | 38 | |
| 40 | 39 | @Resource |
| 41 | 40 | private SchedulerManager schedulerManager; |
| 42 | 41 | |
| 43 | 42 | @Override |
| 44 | 43 | @Transactional(rollbackFor = Exception.class) |
| 45 | - public Long createJob(InfJobCreateReqVO createReqVO) throws SchedulerException { | |
| 44 | + public Long createJob(JobCreateReqVO createReqVO) throws SchedulerException { | |
| 46 | 45 | validateCronExpression(createReqVO.getCronExpression()); |
| 47 | 46 | // 校验唯一性 |
| 48 | 47 | if (jobMapper.selectByHandlerName(createReqVO.getHandlerName()) != null) { |
| 49 | 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 | 53 | fillJobMonitorTimeoutEmpty(job); |
| 55 | 54 | jobMapper.insert(job); |
| 56 | 55 | |
| ... | ... | @@ -58,7 +57,7 @@ public class InfJobServiceImpl implements InfJobService { |
| 58 | 57 | schedulerManager.addJob(job.getId(), job.getHandlerName(), job.getHandlerParam(), job.getCronExpression(), |
| 59 | 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 | 61 | jobMapper.updateById(updateObj); |
| 63 | 62 | |
| 64 | 63 | // 返回 |
| ... | ... | @@ -67,16 +66,16 @@ public class InfJobServiceImpl implements InfJobService { |
| 67 | 66 | |
| 68 | 67 | @Override |
| 69 | 68 | @Transactional(rollbackFor = Exception.class) |
| 70 | - public void updateJob(InfJobUpdateReqVO updateReqVO) throws SchedulerException { | |
| 69 | + public void updateJob(JobUpdateReqVO updateReqVO) throws SchedulerException { | |
| 71 | 70 | validateCronExpression(updateReqVO.getCronExpression()); |
| 72 | 71 | // 校验存在 |
| 73 | - InfJobDO job = this.validateJobExists(updateReqVO.getId()); | |
| 72 | + JobDO job = this.validateJobExists(updateReqVO.getId()); | |
| 74 | 73 | // 只有开启状态,才可以修改.原因是,如果出暂停状态,修改 Quartz Job 时,会导致任务又开始执行 |
| 75 | - if (!job.getStatus().equals(InfJobStatusEnum.NORMAL.getStatus())) { | |
| 74 | + if (!job.getStatus().equals(JobStatusEnum.NORMAL.getStatus())) { | |
| 76 | 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 | 79 | fillJobMonitorTimeoutEmpty(updateObj); |
| 81 | 80 | jobMapper.updateById(updateObj); |
| 82 | 81 | |
| ... | ... | @@ -89,21 +88,21 @@ public class InfJobServiceImpl implements InfJobService { |
| 89 | 88 | @Transactional(rollbackFor = Exception.class) |
| 90 | 89 | public void updateJobStatus(Long id, Integer status) throws SchedulerException { |
| 91 | 90 | // 校验 status |
| 92 | - if (!containsAny(status, InfJobStatusEnum.NORMAL.getStatus(), InfJobStatusEnum.STOP.getStatus())) { | |
| 91 | + if (!containsAny(status, JobStatusEnum.NORMAL.getStatus(), JobStatusEnum.STOP.getStatus())) { | |
| 93 | 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 | 97 | if (job.getStatus().equals(status)) { |
| 99 | 98 | throw exception(JOB_CHANGE_STATUS_EQUALS); |
| 100 | 99 | } |
| 101 | 100 | // 更新 Job 状态 |
| 102 | - InfJobDO updateObj = InfJobDO.builder().id(id).status(status).build(); | |
| 101 | + JobDO updateObj = JobDO.builder().id(id).status(status).build(); | |
| 103 | 102 | jobMapper.updateById(updateObj); |
| 104 | 103 | |
| 105 | 104 | // 更新状态 Job 到 Quartz 中 |
| 106 | - if (InfJobStatusEnum.NORMAL.getStatus().equals(status)) { // 开启 | |
| 105 | + if (JobStatusEnum.NORMAL.getStatus().equals(status)) { // 开启 | |
| 107 | 106 | schedulerManager.resumeJob(job.getHandlerName()); |
| 108 | 107 | } else { // 暂停 |
| 109 | 108 | schedulerManager.pauseJob(job.getHandlerName()); |
| ... | ... | @@ -113,7 +112,7 @@ public class InfJobServiceImpl implements InfJobService { |
| 113 | 112 | @Override |
| 114 | 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 | 117 | // 触发 Quartz 中的 Job |
| 119 | 118 | schedulerManager.triggerJob(job.getId(), job.getHandlerName(), job.getHandlerParam()); |
| ... | ... | @@ -123,7 +122,7 @@ public class InfJobServiceImpl implements InfJobService { |
| 123 | 122 | @Transactional(rollbackFor = Exception.class) |
| 124 | 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 | 127 | jobMapper.deleteById(id); |
| 129 | 128 | |
| ... | ... | @@ -131,8 +130,8 @@ public class InfJobServiceImpl implements InfJobService { |
| 131 | 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 | 135 | if (job == null) { |
| 137 | 136 | throw exception(JOB_NOT_EXISTS); |
| 138 | 137 | } |
| ... | ... | @@ -146,26 +145,26 @@ public class InfJobServiceImpl implements InfJobService { |
| 146 | 145 | } |
| 147 | 146 | |
| 148 | 147 | @Override |
| 149 | - public InfJobDO getJob(Long id) { | |
| 148 | + public JobDO getJob(Long id) { | |
| 150 | 149 | return jobMapper.selectById(id); |
| 151 | 150 | } |
| 152 | 151 | |
| 153 | 152 | @Override |
| 154 | - public List<InfJobDO> getJobList(Collection<Long> ids) { | |
| 153 | + public List<JobDO> getJobList(Collection<Long> ids) { | |
| 155 | 154 | return jobMapper.selectBatchIds(ids); |
| 156 | 155 | } |
| 157 | 156 | |
| 158 | 157 | @Override |
| 159 | - public PageResult<InfJobDO> getJobPage(InfJobPageReqVO pageReqVO) { | |
| 158 | + public PageResult<JobDO> getJobPage(JobPageReqVO pageReqVO) { | |
| 160 | 159 | return jobMapper.selectPage(pageReqVO); |
| 161 | 160 | } |
| 162 | 161 | |
| 163 | 162 | @Override |
| 164 | - public List<InfJobDO> getJobList(InfJobExportReqVO exportReqVO) { | |
| 163 | + public List<JobDO> getJobList(JobExportReqVO exportReqVO) { | |
| 165 | 164 | return jobMapper.selectList(exportReqVO); |
| 166 | 165 | } |
| 167 | 166 | |
| 168 | - private static void fillJobMonitorTimeoutEmpty(InfJobDO job) { | |
| 167 | + private static void fillJobMonitorTimeoutEmpty(JobDO job) { | |
| 169 | 168 | if (job.getMonitorTimeout() == null) { |
| 170 | 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 | 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 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; | |
| 7 | 8 | |
| 8 | 9 | import java.util.List; |
| 9 | 10 | |
| ... | ... | @@ -12,7 +13,7 @@ import java.util.List; |
| 12 | 13 | * |
| 13 | 14 | * @author 芋道源码 |
| 14 | 15 | */ |
| 15 | -public interface InfApiAccessLogService { | |
| 16 | +public interface ApiAccessLogService extends ApiAccessLogFrameworkService { | |
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * 获得 API 访问日志分页 |
| ... | ... | @@ -20,7 +21,7 @@ public interface InfApiAccessLogService { |
| 20 | 21 | * @param pageReqVO 分页查询 |
| 21 | 22 | * @return API 访问日志分页 |
| 22 | 23 | */ |
| 23 | - PageResult<InfApiAccessLogDO> getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO); | |
| 24 | + PageResult<ApiAccessLogDO> getApiAccessLogPage(ApiAccessLogPageReqVO pageReqVO); | |
| 24 | 25 | |
| 25 | 26 | /** |
| 26 | 27 | * 获得 API 访问日志列表, 用于 Excel 导出 |
| ... | ... | @@ -28,6 +29,6 @@ public interface InfApiAccessLogService { |
| 28 | 29 | * @param exportReqVO 查询条件 |
| 29 | 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 | 9 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 10 | +import org.springframework.scheduling.annotation.Async; | |
| 9 | 11 | import org.springframework.stereotype.Service; |
| 10 | 12 | import org.springframework.validation.annotation.Validated; |
| 11 | 13 | |
| ... | ... | @@ -19,19 +21,26 @@ import java.util.List; |
| 19 | 21 | */ |
| 20 | 22 | @Service |
| 21 | 23 | @Validated |
| 22 | -public class InfApiAccessLogServiceImpl implements InfApiAccessLogService { | |
| 24 | +public class ApiAccessLogServiceImpl implements ApiAccessLogService { | |
| 23 | 25 | |
| 24 | 26 | @Resource |
| 25 | - private InfApiAccessLogMapper apiAccessLogMapper; | |
| 27 | + private ApiAccessLogMapper apiAccessLogMapper; | |
| 26 | 28 | |
| 27 | 29 | @Override |
| 28 | - public PageResult<InfApiAccessLogDO> getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO) { | |
| 30 | + public PageResult<ApiAccessLogDO> getApiAccessLogPage(ApiAccessLogPageReqVO pageReqVO) { | |
| 29 | 31 | return apiAccessLogMapper.selectPage(pageReqVO); |
| 30 | 32 | } |
| 31 | 33 | |
| 32 | 34 | @Override |
| 33 | - public List<InfApiAccessLogDO> getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO) { | |
| 35 | + public List<ApiAccessLogDO> getApiAccessLogList(ApiAccessLogExportReqVO exportReqVO) { | |
| 34 | 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 | 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 | 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 | 9 | import java.util.List; |
| 9 | 10 | |
| ... | ... | @@ -12,7 +13,7 @@ import java.util.List; |
| 12 | 13 | * |
| 13 | 14 | * @author 芋道源码 |
| 14 | 15 | */ |
| 15 | -public interface InfApiErrorLogService { | |
| 16 | +public interface ApiErrorLogService extends ApiErrorLogFrameworkService { | |
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * 获得 API 错误日志分页 |
| ... | ... | @@ -20,7 +21,7 @@ public interface InfApiErrorLogService { |
| 20 | 21 | * @param pageReqVO 分页查询 |
| 21 | 22 | * @return API 错误日志分页 |
| 22 | 23 | */ |
| 23 | - PageResult<InfApiErrorLogDO> getApiErrorLogPage(InfApiErrorLogPageReqVO pageReqVO); | |
| 24 | + PageResult<ApiErrorLogDO> getApiErrorLogPage(ApiErrorLogPageReqVO pageReqVO); | |
| 24 | 25 | |
| 25 | 26 | /** |
| 26 | 27 | * 获得 API 错误日志列表, 用于 Excel 导出 |
| ... | ... | @@ -28,7 +29,7 @@ public interface InfApiErrorLogService { |
| 28 | 29 | * @param exportReqVO 查询条件 |
| 29 | 30 | * @return API 错误日志分页 |
| 30 | 31 | */ |
| 31 | - List<InfApiErrorLogDO> getApiErrorLogList(InfApiErrorLogExportReqVO exportReqVO); | |
| 32 | + List<ApiErrorLogDO> getApiErrorLogList(ApiErrorLogExportReqVO exportReqVO); | |
| 32 | 33 | |
| 33 | 34 | /** |
| 34 | 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 | 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 | 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 | 6 | import cn.iocoder.yudao.framework.test.core.util.RandomUtils; |
| 7 | 7 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; |
| 8 | 8 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; |
| 9 | 9 | import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; |
| 10 | 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 | 16 | import org.junit.jupiter.api.Assertions; |
| 18 | 17 | import org.junit.jupiter.api.Test; |
| 19 | 18 | import org.springframework.boot.test.mock.mockito.MockBean; |
| ... | ... | @@ -24,30 +23,25 @@ import java.util.List; |
| 24 | 23 | import java.util.function.Consumer; |
| 25 | 24 | |
| 26 | 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 | 27 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 29 | 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 | 29 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 30 | +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; | |
| 32 | 31 | import static org.junit.jupiter.api.Assertions.*; |
| 33 | 32 | import static org.mockito.Mockito.times; |
| 34 | 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 | 38 | @Resource |
| 45 | - private InfConfigServiceImpl configService; | |
| 39 | + private ConfigServiceImpl configService; | |
| 46 | 40 | |
| 47 | 41 | @Resource |
| 48 | - private InfConfigMapper configMapper; | |
| 42 | + private ConfigMapper configMapper; | |
| 49 | 43 | @MockBean |
| 50 | - private InfConfigProducer configProducer; | |
| 44 | + private ConfigProducer configProducer; | |
| 51 | 45 | |
| 52 | 46 | @Test |
| 53 | 47 | public void testCreateConfig_success() { |
| ... | ... | @@ -59,9 +53,9 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 59 | 53 | // 断言 |
| 60 | 54 | assertNotNull(configId); |
| 61 | 55 | // 校验记录的属性是否正确 |
| 62 | - InfConfigDO config = configMapper.selectById(configId); | |
| 56 | + ConfigDO config = configMapper.selectById(configId); | |
| 63 | 57 | assertPojoEquals(reqVO, config); |
| 64 | - Assertions.assertEquals(InfConfigTypeEnum.CUSTOM.getType(), config.getType()); | |
| 58 | + Assertions.assertEquals(ConfigTypeEnum.CUSTOM.getType(), config.getType()); | |
| 65 | 59 | // 校验调用 |
| 66 | 60 | verify(configProducer, times(1)).sendConfigRefreshMessage(); |
| 67 | 61 | } |
| ... | ... | @@ -69,7 +63,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 69 | 63 | @Test |
| 70 | 64 | public void testUpdateConfig_success() { |
| 71 | 65 | // mock 数据 |
| 72 | - InfConfigDO dbConfig = randomInfConfigDO(); | |
| 66 | + ConfigDO dbConfig = randomConfigDO(); | |
| 73 | 67 | configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 |
| 74 | 68 | // 准备参数 |
| 75 | 69 | ConfigUpdateReqVO reqVO = randomPojo(ConfigUpdateReqVO.class, o -> { |
| ... | ... | @@ -79,7 +73,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 79 | 73 | // 调用 |
| 80 | 74 | configService.updateConfig(reqVO); |
| 81 | 75 | // 校验是否更新正确 |
| 82 | - InfConfigDO config = configMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 76 | + ConfigDO config = configMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 83 | 77 | assertPojoEquals(reqVO, config); |
| 84 | 78 | // 校验调用 |
| 85 | 79 | verify(configProducer, times(1)).sendConfigRefreshMessage(); |
| ... | ... | @@ -88,8 +82,8 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 88 | 82 | @Test |
| 89 | 83 | public void testDeleteConfig_success() { |
| 90 | 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 | 88 | configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 |
| 95 | 89 | // 准备参数 |
| ... | ... | @@ -106,8 +100,8 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 106 | 100 | @Test |
| 107 | 101 | public void testDeleteConfig_canNotDeleteSystemType() { |
| 108 | 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 | 106 | configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 |
| 113 | 107 | // 准备参数 |
| ... | ... | @@ -120,7 +114,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 120 | 114 | @Test |
| 121 | 115 | public void testCheckConfigExists_success() { |
| 122 | 116 | // mock 数据 |
| 123 | - InfConfigDO dbConfigDO = randomInfConfigDO(); | |
| 117 | + ConfigDO dbConfigDO = randomConfigDO(); | |
| 124 | 118 | configMapper.insert(dbConfigDO);// @Sql: 先插入出一条存在的数据 |
| 125 | 119 | |
| 126 | 120 | // 调用成功 |
| ... | ... | @@ -143,7 +137,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 143 | 137 | // 准备参数 |
| 144 | 138 | String key = randomString(); |
| 145 | 139 | // mock 数据 |
| 146 | - configMapper.insert(randomInfConfigDO(o -> o.setKey(key))); | |
| 140 | + configMapper.insert(randomConfigDO(o -> o.setKey(key))); | |
| 147 | 141 | |
| 148 | 142 | // 调用,校验异常 |
| 149 | 143 | assertServiceException(() -> configService.checkConfigKeyUnique(null, key), |
| ... | ... | @@ -156,7 +150,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 156 | 150 | Long id = randomLongId(); |
| 157 | 151 | String key = randomString(); |
| 158 | 152 | // mock 数据 |
| 159 | - configMapper.insert(randomInfConfigDO(o -> o.setKey(key))); | |
| 153 | + configMapper.insert(randomConfigDO(o -> o.setKey(key))); | |
| 160 | 154 | |
| 161 | 155 | // 调用,校验异常 |
| 162 | 156 | assertServiceException(() -> configService.checkConfigKeyUnique(id, key), |
| ... | ... | @@ -166,10 +160,10 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 166 | 160 | @Test |
| 167 | 161 | public void testGetConfigPage() { |
| 168 | 162 | // mock 数据 |
| 169 | - InfConfigDO dbConfig = randomInfConfigDO(o -> { // 等会查询到 | |
| 163 | + ConfigDO dbConfig = randomConfigDO(o -> { // 等会查询到 | |
| 170 | 164 | o.setName("芋艿"); |
| 171 | 165 | o.setKey("yunai"); |
| 172 | - o.setType(InfConfigTypeEnum.SYSTEM.getType()); | |
| 166 | + o.setType(ConfigTypeEnum.SYSTEM.getType()); | |
| 173 | 167 | o.setCreateTime(buildTime(2021, 2, 1)); |
| 174 | 168 | }); |
| 175 | 169 | configMapper.insert(dbConfig); |
| ... | ... | @@ -178,19 +172,19 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 178 | 172 | // 测试 key 不匹配 |
| 179 | 173 | configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setKey("tudou"))); |
| 180 | 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 | 176 | // 测试 createTime 不匹配 |
| 183 | 177 | configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1)))); |
| 184 | 178 | // 准备参数 |
| 185 | 179 | ConfigPageReqVO reqVO = new ConfigPageReqVO(); |
| 186 | 180 | reqVO.setName("艿"); |
| 187 | 181 | reqVO.setKey("nai"); |
| 188 | - reqVO.setType(InfConfigTypeEnum.SYSTEM.getType()); | |
| 182 | + reqVO.setType(ConfigTypeEnum.SYSTEM.getType()); | |
| 189 | 183 | reqVO.setBeginTime(buildTime(2021, 1, 15)); |
| 190 | 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 | 189 | assertEquals(1, pageResult.getTotal()); |
| 196 | 190 | assertEquals(1, pageResult.getList().size()); |
| ... | ... | @@ -200,10 +194,10 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 200 | 194 | @Test |
| 201 | 195 | public void testGetConfigList() { |
| 202 | 196 | // mock 数据 |
| 203 | - InfConfigDO dbConfig = randomInfConfigDO(o -> { // 等会查询到 | |
| 197 | + ConfigDO dbConfig = randomConfigDO(o -> { // 等会查询到 | |
| 204 | 198 | o.setName("芋艿"); |
| 205 | 199 | o.setKey("yunai"); |
| 206 | - o.setType(InfConfigTypeEnum.SYSTEM.getType()); | |
| 200 | + o.setType(ConfigTypeEnum.SYSTEM.getType()); | |
| 207 | 201 | o.setCreateTime(buildTime(2021, 2, 1)); |
| 208 | 202 | }); |
| 209 | 203 | configMapper.insert(dbConfig); |
| ... | ... | @@ -212,19 +206,19 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 212 | 206 | // 测试 key 不匹配 |
| 213 | 207 | configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setKey("tudou"))); |
| 214 | 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 | 210 | // 测试 createTime 不匹配 |
| 217 | 211 | configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1)))); |
| 218 | 212 | // 准备参数 |
| 219 | 213 | ConfigExportReqVO reqVO = new ConfigExportReqVO(); |
| 220 | 214 | reqVO.setName("艿"); |
| 221 | 215 | reqVO.setKey("nai"); |
| 222 | - reqVO.setType(InfConfigTypeEnum.SYSTEM.getType()); | |
| 216 | + reqVO.setType(ConfigTypeEnum.SYSTEM.getType()); | |
| 223 | 217 | reqVO.setBeginTime(buildTime(2021, 1, 15)); |
| 224 | 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 | 223 | assertEquals(1, list.size()); |
| 230 | 224 | assertPojoEquals(dbConfig, list.get(0)); |
| ... | ... | @@ -233,13 +227,13 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 233 | 227 | @Test |
| 234 | 228 | public void testGetConfigByKey() { |
| 235 | 229 | // mock 数据 |
| 236 | - InfConfigDO dbConfig = randomInfConfigDO(); | |
| 230 | + ConfigDO dbConfig = randomConfigDO(); | |
| 237 | 231 | configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 |
| 238 | 232 | // 准备参数 |
| 239 | 233 | String key = dbConfig.getKey(); |
| 240 | 234 | |
| 241 | 235 | // 调用 |
| 242 | - InfConfigDO config = configService.getConfigByKey(key); | |
| 236 | + ConfigDO config = configService.getConfigByKey(key); | |
| 243 | 237 | // 断言 |
| 244 | 238 | assertNotNull(config); |
| 245 | 239 | assertPojoEquals(dbConfig, config); |
| ... | ... | @@ -248,11 +242,11 @@ public class InfConfigServiceTest extends BaseDbUnitTest { |
| 248 | 242 | // ========== 随机对象 ========== |
| 249 | 243 | |
| 250 | 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 | 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 | 12 | import org.junit.jupiter.api.Test; |
| 10 | 13 | import org.springframework.boot.test.mock.mockito.MockBean; |
| 11 | 14 | import org.springframework.context.annotation.Import; |
| 12 | 15 | |
| 13 | 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 | 19 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; |
| 17 | 20 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| 18 | 21 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString; |
| 22 | +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; | |
| 19 | 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 | 28 | @Resource |
| 25 | - private InfFileCoreService fileCoreService; | |
| 29 | + private FileService fileService; | |
| 26 | 30 | |
| 27 | 31 | @MockBean |
| 28 | 32 | private FileProperties fileProperties; |
| 29 | 33 | |
| 30 | 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 | 73 | @Test |
| 34 | 74 | public void testCreateFile_success() { |
| ... | ... | @@ -37,11 +77,11 @@ public class InfFileCoreServiceTest extends BaseDbUnitTest { |
| 37 | 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 | 82 | assertEquals(fileProperties.getBasePath() + path, url); |
| 43 | 83 | // 校验数据 |
| 44 | - InfFileDO file = fileMapper.selectById(path); | |
| 84 | + FileDO file = fileMapper.selectById(path); | |
| 45 | 85 | assertEquals(path, file.getId()); |
| 46 | 86 | assertEquals("jpg", file.getType()); |
| 47 | 87 | assertArrayEquals(content, file.getContent()); |
| ... | ... | @@ -50,26 +90,26 @@ public class InfFileCoreServiceTest extends BaseDbUnitTest { |
| 50 | 90 | @Test |
| 51 | 91 | public void testCreateFile_exists() { |
| 52 | 92 | // mock 数据 |
| 53 | - InfFileDO dbFile = randomPojo(InfFileDO.class); | |
| 93 | + FileDO dbFile = randomPojo(FileDO.class); | |
| 54 | 94 | fileMapper.insert(dbFile); |
| 55 | 95 | // 准备参数 |
| 56 | 96 | String path = dbFile.getId(); // 模拟已存在 |
| 57 | 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 | 103 | @Test |
| 64 | 104 | public void testDeleteFile_success() { |
| 65 | 105 | // mock 数据 |
| 66 | - InfFileDO dbFile = randomPojo(InfFileDO.class); | |
| 106 | + FileDO dbFile = randomPojo(FileDO.class); | |
| 67 | 107 | fileMapper.insert(dbFile);// @Sql: 先插入出一条存在的数据 |
| 68 | 108 | // 准备参数 |
| 69 | 109 | String id = dbFile.getId(); |
| 70 | 110 | |
| 71 | 111 | // 调用 |
| 72 | - fileCoreService.deleteFile(id); | |
| 112 | + fileService.deleteFile(id); | |
| 73 | 113 | // 校验数据不存在了 |
| 74 | 114 | assertNull(fileMapper.selectById(id)); |
| 75 | 115 | } |
| ... | ... | @@ -80,7 +120,7 @@ public class InfFileCoreServiceTest extends BaseDbUnitTest { |
| 80 | 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 | 14 | |
| 15 | 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 | 19 | import org.junit.jupiter.api.Test; |
| 18 | 20 | import org.springframework.context.annotation.Import; |
| 19 | 21 | |
| 20 | -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; | |
| 21 | 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 | 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 | 32 | @Resource |
| 39 | - private InfJobLogServiceImpl jobLogService; | |
| 33 | + private JobLogServiceImpl jobLogService; | |
| 40 | 34 | @Resource |
| 41 | - private InfJobLogMapper jobLogMapper; | |
| 35 | + private JobLogMapper jobLogMapper; | |
| 42 | 36 | |
| 43 | 37 | @Test |
| 44 | 38 | public void testCreateJobLog_success() { |
| 45 | 39 | // 准备参数 |
| 46 | - InfJobLogDO reqVO = randomPojo(InfJobLogDO.class, o -> { | |
| 40 | + JobLogDO reqVO = randomPojo(JobLogDO.class, o -> { | |
| 47 | 41 | o.setExecuteIndex(1); |
| 48 | 42 | }); |
| 49 | 43 | // 调用 |
| ... | ... | @@ -51,40 +45,40 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { |
| 51 | 45 | // 断言 |
| 52 | 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 | 52 | @Test |
| 59 | 53 | public void testUpdateJobLogResultAsync_success() { |
| 60 | 54 | // 准备参数 |
| 61 | - InfJobLogDO reqVO = randomPojo(InfJobLogDO.class, o -> { | |
| 55 | + JobLogDO reqVO = randomPojo(JobLogDO.class, o -> { | |
| 62 | 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 | 60 | jobLogMapper.insert(log); |
| 67 | 61 | // 调用 |
| 68 | 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 | 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 | 74 | @Test |
| 81 | 75 | public void testGetJobLogListByIds_success() { |
| 82 | 76 | // mock 数据 |
| 83 | - InfJobLogDO dbJobLog = randomPojo(InfJobLogDO.class, o -> { | |
| 77 | + JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { | |
| 84 | 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 | 82 | jobLogMapper.insert(dbJobLog); |
| 89 | 83 | // 测试 handlerName 不匹配 |
| 90 | 84 | jobLogMapper.insert(cloneJobLog); |
| ... | ... | @@ -93,7 +87,7 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { |
| 93 | 87 | ids.add(dbJobLog.getId()); |
| 94 | 88 | ids.add(cloneJobLog.getId()); |
| 95 | 89 | // 调用 |
| 96 | - List<InfJobLogDO> list = jobLogService.getJobLogList(ids); | |
| 90 | + List<JobLogDO> list = jobLogService.getJobLogList(ids); | |
| 97 | 91 | // 断言 |
| 98 | 92 | assertEquals(2, list.size()); |
| 99 | 93 | assertPojoEquals(dbJobLog, list.get(0)); |
| ... | ... | @@ -102,10 +96,10 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { |
| 102 | 96 | @Test |
| 103 | 97 | public void testGetJobPage_success() { |
| 104 | 98 | // mock 数据 |
| 105 | - InfJobLogDO dbJobLog = randomPojo(InfJobLogDO.class, o -> { | |
| 99 | + JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { | |
| 106 | 100 | o.setExecuteIndex(1); |
| 107 | 101 | o.setHandlerName("handlerName 单元测试"); |
| 108 | - o.setStatus(InfJobLogStatusEnum.SUCCESS.getStatus()); | |
| 102 | + o.setStatus(JobLogStatusEnum.SUCCESS.getStatus()); | |
| 109 | 103 | o.setBeginTime(buildTime(2021, 1, 8)); |
| 110 | 104 | o.setEndTime(buildTime(2021, 1, 8)); |
| 111 | 105 | }); |
| ... | ... | @@ -119,16 +113,16 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { |
| 119 | 113 | // 测试 endTime 不匹配 |
| 120 | 114 | jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9)))); |
| 121 | 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 | 119 | reqVo.setJobId(dbJobLog.getJobId()); |
| 126 | 120 | reqVo.setHandlerName("单元"); |
| 127 | 121 | reqVo.setBeginTime(dbJobLog.getBeginTime()); |
| 128 | 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 | 127 | assertEquals(1, pageResult.getTotal()); |
| 134 | 128 | assertEquals(1, pageResult.getList().size()); |
| ... | ... | @@ -138,10 +132,10 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { |
| 138 | 132 | @Test |
| 139 | 133 | public void testGetJobListForExport_success() { |
| 140 | 134 | // mock 数据 |
| 141 | - InfJobLogDO dbJobLog = randomPojo(InfJobLogDO.class, o -> { | |
| 135 | + JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { | |
| 142 | 136 | o.setExecuteIndex(1); |
| 143 | 137 | o.setHandlerName("handlerName 单元测试"); |
| 144 | - o.setStatus(InfJobLogStatusEnum.SUCCESS.getStatus()); | |
| 138 | + o.setStatus(JobLogStatusEnum.SUCCESS.getStatus()); | |
| 145 | 139 | o.setBeginTime(buildTime(2021, 1, 8)); |
| 146 | 140 | o.setEndTime(buildTime(2021, 1, 8)); |
| 147 | 141 | }); |
| ... | ... | @@ -155,16 +149,16 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { |
| 155 | 149 | // 测试 endTime 不匹配 |
| 156 | 150 | jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9)))); |
| 157 | 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 | 155 | reqVo.setJobId(dbJobLog.getJobId()); |
| 162 | 156 | reqVo.setHandlerName("单元"); |
| 163 | 157 | reqVo.setBeginTime(dbJobLog.getBeginTime()); |
| 164 | 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 | 163 | assertEquals(1, list.size()); |
| 170 | 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 | 1 | package cn.iocoder.yudao.module.infra.service.job; |
| 2 | 2 | |
| 3 | 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 | 5 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 11 | 6 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; |
| 12 | 7 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| ... | ... | @@ -23,44 +18,38 @@ import java.util.List; |
| 23 | 18 | |
| 24 | 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 | 26 | import org.junit.jupiter.api.Test; |
| 27 | 27 | import org.quartz.SchedulerException; |
| 28 | 28 | import org.springframework.boot.test.mock.mockito.MockBean; |
| 29 | 29 | import org.springframework.context.annotation.Import; |
| 30 | 30 | |
| 31 | -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; | |
| 32 | 31 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 33 | 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 | 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 | 42 | @Resource |
| 54 | - private InfJobServiceImpl jobService; | |
| 43 | + private JobServiceImpl jobService; | |
| 55 | 44 | @Resource |
| 56 | - private InfJobMapper jobMapper; | |
| 45 | + private JobMapper jobMapper; | |
| 57 | 46 | @MockBean |
| 58 | 47 | private SchedulerManager schedulerManager; |
| 59 | 48 | |
| 60 | 49 | @Test |
| 61 | 50 | public void testCreateJob_cronExpressionValid() { |
| 62 | 51 | // 准备参数。Cron 表达式为 String 类型,默认随机字符串。 |
| 63 | - InfJobCreateReqVO reqVO = randomPojo(InfJobCreateReqVO.class); | |
| 52 | + JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class); | |
| 64 | 53 | // 调用,并断言异常 |
| 65 | 54 | assertServiceException(() -> jobService.createJob(reqVO), JOB_CRON_EXPRESSION_VALID); |
| 66 | 55 | } |
| ... | ... | @@ -68,7 +57,7 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 68 | 57 | @Test |
| 69 | 58 | public void testCreateJob_jobHandlerExists() throws SchedulerException { |
| 70 | 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 | 62 | jobService.createJob(reqVO); |
| 74 | 63 | // 调用,并断言异常 |
| ... | ... | @@ -78,15 +67,15 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 78 | 67 | @Test |
| 79 | 68 | public void testCreateJob_success() throws SchedulerException { |
| 80 | 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 | 72 | Long jobId = jobService.createJob(reqVO); |
| 84 | 73 | // 断言 |
| 85 | 74 | assertNotNull(jobId); |
| 86 | 75 | // 校验记录的属性是否正确 |
| 87 | - InfJobDO job = jobMapper.selectById(jobId); | |
| 76 | + JobDO job = jobMapper.selectById(jobId); | |
| 88 | 77 | assertPojoEquals(reqVO, job); |
| 89 | - assertEquals(InfJobStatusEnum.NORMAL.getStatus(), job.getStatus()); | |
| 78 | + assertEquals(JobStatusEnum.NORMAL.getStatus(), job.getStatus()); | |
| 90 | 79 | // 校验调用 |
| 91 | 80 | verify(schedulerManager, times(1)).addJob(eq(job.getId()), eq(job.getHandlerName()), eq(job.getHandlerParam()), eq(job.getCronExpression()), |
| 92 | 81 | eq(reqVO.getRetryCount()), eq(reqVO.getRetryInterval())); |
| ... | ... | @@ -95,7 +84,7 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 95 | 84 | @Test |
| 96 | 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 | 89 | assertServiceException(() -> jobService.updateJob(reqVO), JOB_NOT_EXISTS); |
| 101 | 90 | } |
| ... | ... | @@ -103,13 +92,13 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 103 | 92 | @Test |
| 104 | 93 | public void testUpdateJob_onlyNormalStatus(){ |
| 105 | 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 | 98 | fillJobMonitorTimeoutEmpty(job); |
| 110 | 99 | jobMapper.insert(job); |
| 111 | 100 | // 准备参数 |
| 112 | - InfJobUpdateReqVO updateReqVO = randomPojo(InfJobUpdateReqVO.class, o -> { | |
| 101 | + JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> { | |
| 113 | 102 | o.setId(job.getId()); |
| 114 | 103 | o.setName(createReqVO.getName()); |
| 115 | 104 | o.setCronExpression(createReqVO.getCronExpression()); |
| ... | ... | @@ -121,13 +110,13 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 121 | 110 | @Test |
| 122 | 111 | public void testUpdateJob_success() throws SchedulerException { |
| 123 | 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 | 116 | fillJobMonitorTimeoutEmpty(job); |
| 128 | 117 | jobMapper.insert(job); |
| 129 | 118 | // 准备参数 |
| 130 | - InfJobUpdateReqVO updateReqVO = randomPojo(InfJobUpdateReqVO.class, o -> { | |
| 119 | + JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> { | |
| 131 | 120 | o.setId(job.getId()); |
| 132 | 121 | o.setName(createReqVO.getName()); |
| 133 | 122 | o.setCronExpression(createReqVO.getCronExpression()); |
| ... | ... | @@ -135,7 +124,7 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 135 | 124 | // 调用 |
| 136 | 125 | jobService.updateJob(updateReqVO); |
| 137 | 126 | // 校验记录的属性是否正确 |
| 138 | - InfJobDO updateJob = jobMapper.selectById(updateReqVO.getId()); | |
| 127 | + JobDO updateJob = jobMapper.selectById(updateReqVO.getId()); | |
| 139 | 128 | assertPojoEquals(updateReqVO, updateJob); |
| 140 | 129 | // 校验调用 |
| 141 | 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 | 134 | @Test |
| 146 | 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 | 140 | @Test |
| 152 | 141 | public void testUpdateJobStatus_changeStatusEquals() { |
| 153 | 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 | 146 | fillJobMonitorTimeoutEmpty(job); |
| 158 | 147 | jobMapper.insert(job); |
| 159 | 148 | // 调用,并断言异常 |
| ... | ... | @@ -163,16 +152,16 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 163 | 152 | @Test |
| 164 | 153 | public void testUpdateJobStatus_NormalToStop_success() throws SchedulerException { |
| 165 | 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 | 158 | fillJobMonitorTimeoutEmpty(job); |
| 170 | 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 | 166 | verify(schedulerManager, times(1)).pauseJob(eq(job.getHandlerName())); |
| 178 | 167 | } |
| ... | ... | @@ -180,16 +169,16 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 180 | 169 | @Test |
| 181 | 170 | public void testUpdateJobStatus_StopToNormal_success() throws SchedulerException { |
| 182 | 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 | 175 | fillJobMonitorTimeoutEmpty(job); |
| 187 | 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 | 183 | verify(schedulerManager, times(1)).resumeJob(eq(job.getHandlerName())); |
| 195 | 184 | } |
| ... | ... | @@ -197,9 +186,9 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 197 | 186 | @Test |
| 198 | 187 | public void testTriggerJob_success() throws SchedulerException { |
| 199 | 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 | 192 | fillJobMonitorTimeoutEmpty(job); |
| 204 | 193 | jobMapper.insert(job); |
| 205 | 194 | // 调用 |
| ... | ... | @@ -211,9 +200,9 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 211 | 200 | @Test |
| 212 | 201 | public void testDeleteJob_success() throws SchedulerException { |
| 213 | 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 | 206 | fillJobMonitorTimeoutEmpty(job); |
| 218 | 207 | jobMapper.insert(job); |
| 219 | 208 | // 调用 UPDATE inf_job SET deleted=1 WHERE id=? AND deleted=0 |
| ... | ... | @@ -227,19 +216,19 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 227 | 216 | @Test |
| 228 | 217 | public void testGetJobListByIds_success() { |
| 229 | 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 | 223 | jobMapper.insert(dbJob); |
| 235 | 224 | // 测试 handlerName 不匹配 |
| 236 | 225 | jobMapper.insert(cloneJob); |
| 237 | 226 | // 准备参数 |
| 238 | - ArrayList ids = new ArrayList<>(); | |
| 227 | + ArrayList<Long> ids = new ArrayList<>(); | |
| 239 | 228 | ids.add(dbJob.getId()); |
| 240 | 229 | ids.add(cloneJob.getId()); |
| 241 | 230 | // 调用 |
| 242 | - List<InfJobDO> list = jobService.getJobList(ids); | |
| 231 | + List<JobDO> list = jobService.getJobList(ids); | |
| 243 | 232 | // 断言 |
| 244 | 233 | assertEquals(2, list.size()); |
| 245 | 234 | assertPojoEquals(dbJob, list.get(0)); |
| ... | ... | @@ -248,25 +237,25 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 248 | 237 | @Test |
| 249 | 238 | public void testGetJobPage_success() { |
| 250 | 239 | // mock 数据 |
| 251 | - InfJobDO dbJob = randomPojo(InfJobDO.class, o -> { | |
| 240 | + JobDO dbJob = randomPojo(JobDO.class, o -> { | |
| 252 | 241 | o.setName("定时任务测试"); |
| 253 | 242 | o.setHandlerName("handlerName 单元测试"); |
| 254 | - o.setStatus(InfJobStatusEnum.INIT.getStatus()); | |
| 243 | + o.setStatus(JobStatusEnum.INIT.getStatus()); | |
| 255 | 244 | }); |
| 256 | 245 | jobMapper.insert(dbJob); |
| 257 | 246 | // 测试 name 不匹配 |
| 258 | 247 | jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setName("土豆"))); |
| 259 | 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 | 250 | // 测试 handlerName 不匹配 |
| 262 | 251 | jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString()))); |
| 263 | 252 | // 准备参数 |
| 264 | - InfJobPageReqVO reqVo = new InfJobPageReqVO(); | |
| 253 | + JobPageReqVO reqVo = new JobPageReqVO(); | |
| 265 | 254 | reqVo.setName("定时"); |
| 266 | - reqVo.setStatus(InfJobStatusEnum.INIT.getStatus()); | |
| 255 | + reqVo.setStatus(JobStatusEnum.INIT.getStatus()); | |
| 267 | 256 | reqVo.setHandlerName("单元"); |
| 268 | 257 | // 调用 |
| 269 | - PageResult<InfJobDO> pageResult = jobService.getJobPage(reqVo); | |
| 258 | + PageResult<JobDO> pageResult = jobService.getJobPage(reqVo); | |
| 270 | 259 | // 断言 |
| 271 | 260 | assertEquals(1, pageResult.getTotal()); |
| 272 | 261 | assertEquals(1, pageResult.getList().size()); |
| ... | ... | @@ -276,31 +265,31 @@ public class InfJobServiceTest extends BaseDbUnitTest { |
| 276 | 265 | @Test |
| 277 | 266 | public void testGetJobListForExport_success() { |
| 278 | 267 | // mock 数据 |
| 279 | - InfJobDO dbJob = randomPojo(InfJobDO.class, o -> { | |
| 268 | + JobDO dbJob = randomPojo(JobDO.class, o -> { | |
| 280 | 269 | o.setName("定时任务测试"); |
| 281 | 270 | o.setHandlerName("handlerName 单元测试"); |
| 282 | - o.setStatus(InfJobStatusEnum.INIT.getStatus()); | |
| 271 | + o.setStatus(JobStatusEnum.INIT.getStatus()); | |
| 283 | 272 | }); |
| 284 | 273 | jobMapper.insert(dbJob); |
| 285 | 274 | // 测试 name 不匹配 |
| 286 | 275 | jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setName("土豆"))); |
| 287 | 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 | 278 | // 测试 handlerName 不匹配 |
| 290 | 279 | jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString()))); |
| 291 | 280 | // 准备参数 |
| 292 | - InfJobExportReqVO reqVo = new InfJobExportReqVO(); | |
| 281 | + JobExportReqVO reqVo = new JobExportReqVO(); | |
| 293 | 282 | reqVo.setName("定时"); |
| 294 | - reqVo.setStatus(InfJobStatusEnum.INIT.getStatus()); | |
| 283 | + reqVo.setStatus(JobStatusEnum.INIT.getStatus()); | |
| 295 | 284 | reqVo.setHandlerName("单元"); |
| 296 | 285 | // 调用 |
| 297 | - List<InfJobDO> list = jobService.getJobList(reqVo); | |
| 286 | + List<JobDO> list = jobService.getJobList(reqVo); | |
| 298 | 287 | // 断言 |
| 299 | 288 | assertEquals(1, list.size()); |
| 300 | 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 | 293 | if (job.getMonitorTimeout() == null) { |
| 305 | 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 | 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 | 5 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; |
| 7 | 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 | 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 | 15 | import org.junit.jupiter.api.Test; |
| 15 | 16 | import org.springframework.context.annotation.Import; |
| 16 | 17 | |
| ... | ... | @@ -18,22 +19,19 @@ import javax.annotation.Resource; |
| 18 | 19 | import java.util.Date; |
| 19 | 20 | import java.util.List; |
| 20 | 21 | |
| 21 | -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | |
| 22 | 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 | 24 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 24 | 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 | 30 | @Resource |
| 33 | - private InfApiAccessLogService infApiAccessLogServiceImpl; | |
| 31 | + private ApiAccessLogService apiAccessLogService; | |
| 34 | 32 | |
| 35 | 33 | @Resource |
| 36 | - private InfApiAccessLogMapper infApiAccessLogMapper; | |
| 34 | + private ApiAccessLogMapper apiAccessLogMapper; | |
| 37 | 35 | |
| 38 | 36 | @Test |
| 39 | 37 | public void testGetApiAccessLogPage() { |
| ... | ... | @@ -46,7 +44,7 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { |
| 46 | 44 | int duration = 1000; |
| 47 | 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 | 48 | dto.setUserId(userId); |
| 51 | 49 | dto.setUserType(userType); |
| 52 | 50 | dto.setApplicationName(applicationName); |
| ... | ... | @@ -55,26 +53,26 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { |
| 55 | 53 | dto.setDuration(duration); |
| 56 | 54 | dto.setResultCode(resultCode); |
| 57 | 55 | }); |
| 58 | - infApiAccessLogMapper.insert(infApiAccessLogDO); | |
| 56 | + apiAccessLogMapper.insert(infApiAccessLogDO); | |
| 59 | 57 | |
| 60 | 58 | // 下面几个都是不匹配的数据 |
| 61 | 59 | // userId 不同的 |
| 62 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L))); | |
| 60 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L))); | |
| 63 | 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 | 63 | // applicationName 不同的 |
| 66 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test"))); | |
| 64 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test"))); | |
| 67 | 65 | // requestUrl 不同的 |
| 68 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar"))); | |
| 66 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar"))); | |
| 69 | 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 | 69 | // duration 不同的 |
| 72 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100))); | |
| 70 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100))); | |
| 73 | 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 | 76 | reqVO.setUserId(userId); |
| 79 | 77 | reqVO.setUserType(userType); |
| 80 | 78 | reqVO.setApplicationName(applicationName); |
| ... | ... | @@ -85,7 +83,7 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { |
| 85 | 83 | reqVO.setResultCode(resultCode); |
| 86 | 84 | |
| 87 | 85 | // 调用service方法 |
| 88 | - PageResult<InfApiAccessLogDO> pageResult = infApiAccessLogServiceImpl.getApiAccessLogPage(reqVO); | |
| 86 | + PageResult<ApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(reqVO); | |
| 89 | 87 | |
| 90 | 88 | // 断言,只查到了一条符合条件的 |
| 91 | 89 | assertEquals(1, pageResult.getTotal()); |
| ... | ... | @@ -104,7 +102,7 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { |
| 104 | 102 | int duration = 1000; |
| 105 | 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 | 106 | dto.setUserId(userId); |
| 109 | 107 | dto.setUserType(userType); |
| 110 | 108 | dto.setApplicationName(applicationName); |
| ... | ... | @@ -113,26 +111,26 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { |
| 113 | 111 | dto.setDuration(duration); |
| 114 | 112 | dto.setResultCode(resultCode); |
| 115 | 113 | }); |
| 116 | - infApiAccessLogMapper.insert(infApiAccessLogDO); | |
| 114 | + apiAccessLogMapper.insert(infApiAccessLogDO); | |
| 117 | 115 | |
| 118 | 116 | // 下面几个都是不匹配的数据 |
| 119 | 117 | // userId 不同的 |
| 120 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L))); | |
| 118 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L))); | |
| 121 | 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 | 121 | // applicationName 不同的 |
| 124 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test"))); | |
| 122 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test"))); | |
| 125 | 123 | // requestUrl 不同的 |
| 126 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar"))); | |
| 124 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar"))); | |
| 127 | 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 | 127 | // duration 不同的 |
| 130 | - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100))); | |
| 128 | + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100))); | |
| 131 | 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 | 134 | reqVO.setUserId(userId); |
| 137 | 135 | reqVO.setUserType(userType); |
| 138 | 136 | reqVO.setApplicationName(applicationName); |
| ... | ... | @@ -143,11 +141,26 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { |
| 143 | 141 | reqVO.setResultCode(resultCode); |
| 144 | 142 | |
| 145 | 143 | // 调用service方法 |
| 146 | - List<InfApiAccessLogDO> list = infApiAccessLogServiceImpl.getApiAccessLogList(reqVO); | |
| 144 | + List<ApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(reqVO); | |
| 147 | 145 | |
| 148 | 146 | // 断言,只查到了一条符合条件的 |
| 149 | 147 | assertEquals(1, list.size()); |
| 150 | 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 | 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 | 5 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 11 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 12 | 7 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 13 | 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 | 15 | import org.junit.jupiter.api.Assertions; |
| 15 | 16 | import org.junit.jupiter.api.Test; |
| 16 | 17 | import org.springframework.context.annotation.Import; |
| ... | ... | @@ -19,24 +20,22 @@ import javax.annotation.Resource; |
| 19 | 20 | import java.util.Date; |
| 20 | 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 | 23 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; |
| 25 | 24 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 26 | 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 | 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 | 34 | @Resource |
| 36 | - private InfApiErrorLogService infApiErrorLogServiceImpl; | |
| 35 | + private ApiErrorLogServiceImpl apiErrorLogService; | |
| 37 | 36 | |
| 38 | 37 | @Resource |
| 39 | - private InfApiErrorLogMapper infApiErrorLogMapper; | |
| 38 | + private ApiErrorLogMapper infApiErrorLogMapper; | |
| 40 | 39 | |
| 41 | 40 | @Test |
| 42 | 41 | public void testGetApiErrorLogPage() { |
| ... | ... | @@ -46,9 +45,9 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { |
| 46 | 45 | String applicationName = "yudao-test"; |
| 47 | 46 | String requestUrl = "foo"; |
| 48 | 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 | 51 | logDO.setUserId(userId); |
| 53 | 52 | logDO.setUserType(userType); |
| 54 | 53 | logDO.setApplicationName(applicationName); |
| ... | ... | @@ -70,10 +69,10 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { |
| 70 | 69 | // 构造一个早期时间 2021-02-06 00:00:00 |
| 71 | 70 | infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6)))); |
| 72 | 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 | 76 | reqVO.setUserId(userId); |
| 78 | 77 | reqVO.setUserType(userType); |
| 79 | 78 | reqVO.setApplicationName(applicationName); |
| ... | ... | @@ -83,7 +82,7 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { |
| 83 | 82 | reqVO.setProcessStatus(progressStatus); |
| 84 | 83 | |
| 85 | 84 | // 调用service方法 |
| 86 | - PageResult<InfApiErrorLogDO> pageResult = infApiErrorLogServiceImpl.getApiErrorLogPage(reqVO); | |
| 85 | + PageResult<ApiErrorLogDO> pageResult = apiErrorLogService.getApiErrorLogPage(reqVO); | |
| 87 | 86 | |
| 88 | 87 | // 断言,只查到了一条符合条件的 |
| 89 | 88 | assertEquals(1, pageResult.getTotal()); |
| ... | ... | @@ -99,9 +98,9 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { |
| 99 | 98 | String applicationName = "yudao-test"; |
| 100 | 99 | String requestUrl = "foo"; |
| 101 | 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 | 104 | logDO.setUserId(userId); |
| 106 | 105 | logDO.setUserType(userType); |
| 107 | 106 | logDO.setApplicationName(applicationName); |
| ... | ... | @@ -123,10 +122,10 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { |
| 123 | 122 | // 构造一个早期时间 2021-02-06 00:00:00 |
| 124 | 123 | infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6)))); |
| 125 | 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 | 129 | reqVO.setUserId(userId); |
| 131 | 130 | reqVO.setUserType(userType); |
| 132 | 131 | reqVO.setApplicationName(applicationName); |
| ... | ... | @@ -136,7 +135,7 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { |
| 136 | 135 | reqVO.setProcessStatus(progressStatus); |
| 137 | 136 | |
| 138 | 137 | // 调用service方法 |
| 139 | - List<InfApiErrorLogDO> list = infApiErrorLogServiceImpl.getApiErrorLogList(reqVO); | |
| 138 | + List<ApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(reqVO); | |
| 140 | 139 | |
| 141 | 140 | // 断言,只查到了一条符合条件的 |
| 142 | 141 | assertEquals(1, list.size()); |
| ... | ... | @@ -144,22 +143,23 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { |
| 144 | 143 | } |
| 145 | 144 | |
| 146 | 145 | |
| 146 | + // TODO 芋艿:单元测试,可以拆小一点 | |
| 147 | 147 | @Test |
| 148 | 148 | public void testUpdateApiErrorLogProcess() { |
| 149 | 149 | // 先构造两条数据,第一条用于抛出异常,第二条用于正常的执行update操作 |
| 150 | 150 | Long processUserId = 2233L; |
| 151 | 151 | |
| 152 | - InfApiErrorLogDO first = RandomUtils.randomPojo(InfApiErrorLogDO.class, logDO -> { | |
| 152 | + ApiErrorLogDO first = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> { | |
| 153 | 153 | logDO.setProcessUserId(processUserId); |
| 154 | 154 | logDO.setUserType(UserTypeEnum.ADMIN.getValue()); |
| 155 | - logDO.setProcessStatus(InfApiErrorLogProcessStatusEnum.DONE.getStatus()); | |
| 155 | + logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus()); | |
| 156 | 156 | }); |
| 157 | 157 | infApiErrorLogMapper.insert(first); |
| 158 | 158 | |
| 159 | - InfApiErrorLogDO second = RandomUtils.randomPojo(InfApiErrorLogDO.class, logDO -> { | |
| 159 | + ApiErrorLogDO second = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> { | |
| 160 | 160 | logDO.setProcessUserId(1122L); |
| 161 | 161 | logDO.setUserType(UserTypeEnum.ADMIN.getValue()); |
| 162 | - logDO.setProcessStatus(InfApiErrorLogProcessStatusEnum.INIT.getStatus()); | |
| 162 | + logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); | |
| 163 | 163 | }); |
| 164 | 164 | infApiErrorLogMapper.insert(second); |
| 165 | 165 | |
| ... | ... | @@ -167,17 +167,31 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { |
| 167 | 167 | Long secondId = second.getId(); |
| 168 | 168 | |
| 169 | 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 | 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 | 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 | 177 | // 验证 progressStatus 是否修改成功 |
| 178 | - Assertions.assertEquals(InfApiErrorLogProcessStatusEnum.DONE.getStatus(), secondSelect.getProcessStatus()); | |
| 178 | + Assertions.assertEquals(ApiErrorLogProcessStatusEnum.DONE.getStatus(), secondSelect.getProcessStatus()); | |
| 179 | 179 | // 验证 progressUserId 是否修改成功 |
| 180 | 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 | 23 | <artifactId>yudao-module-member-api</artifactId> |
| 24 | 24 | <version>${revision}</version> |
| 25 | 25 | </dependency> |
| 26 | - | |
| 27 | 26 | <dependency> |
| 28 | 27 | <groupId>cn.iocoder.boot</groupId> |
| 29 | 28 | <artifactId>yudao-module-system-api</artifactId> |
| 30 | 29 | <version>${revision}</version> |
| 31 | 30 | </dependency> |
| 32 | - | |
| 33 | - <!-- 业务组件 --> | |
| 34 | 31 | <dependency> |
| 35 | 32 | <groupId>cn.iocoder.boot</groupId> |
| 36 | - <artifactId>yudao-core-service</artifactId> | |
| 33 | + <artifactId>yudao-module-infra-api</artifactId> | |
| 34 | + <version>${revision}</version> | |
| 37 | 35 | </dependency> |
| 38 | 36 | |
| 37 | + <!-- 业务组件 --> | |
| 39 | 38 | <dependency> |
| 40 | 39 | <groupId>cn.iocoder.boot</groupId> |
| 41 | 40 | <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> |
| 42 | 41 | </dependency> |
| 43 | - | |
| 44 | 42 | <dependency> |
| 45 | 43 | <groupId>cn.iocoder.boot</groupId> |
| 46 | 44 | <artifactId>yudao-spring-boot-starter-biz-weixin</artifactId> |
| 47 | 45 | </dependency> |
| 46 | + <dependency> | |
| 47 | + <groupId>cn.iocoder.boot</groupId> | |
| 48 | + <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | |
| 49 | + </dependency> | |
| 48 | 50 | |
| 49 | 51 | <!-- Web 相关 --> |
| 50 | 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 | 2 | |
| 3 | 3 | import cn.hutool.core.io.IoUtil; |
| 4 | 4 | import cn.hutool.core.util.IdUtil; |
| 5 | -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; | |
| 6 | 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | +import cn.iocoder.yudao.module.infra.api.file.FileApi; | |
| 7 | 7 | import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO; |
| 8 | 8 | import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; |
| 9 | 9 | import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; |
| ... | ... | @@ -39,7 +39,7 @@ public class MemberUserServiceImpl implements MemberUserService { |
| 39 | 39 | private MemberUserMapper memberUserMapper; |
| 40 | 40 | |
| 41 | 41 | @Resource |
| 42 | - private InfFileCoreService fileCoreService; | |
| 42 | + private FileApi fileApi; | |
| 43 | 43 | @Resource |
| 44 | 44 | private SmsCodeApi smsCodeApi; |
| 45 | 45 | |
| ... | ... | @@ -103,7 +103,7 @@ public class MemberUserServiceImpl implements MemberUserService { |
| 103 | 103 | public String updateUserAvatar(Long userId, InputStream avatarFile) { |
| 104 | 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 | 108 | memberUserMapper.updateById(MemberUserDO.builder().id(userId).avatar(avatar).build()); |
| 109 | 109 | return avatar; | ... | ... |
yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImplTest.java
| 1 | 1 | package cn.iocoder.yudao.module.member.service.user; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.util.RandomUtil; |
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; | |
| 5 | 4 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | 5 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; |
| 7 | 6 | import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; |
| 7 | +import cn.iocoder.yudao.module.infra.api.file.FileApi; | |
| 8 | 8 | import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO; |
| 9 | 9 | import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; |
| 10 | 10 | import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; |
| ... | ... | @@ -49,13 +49,12 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest { |
| 49 | 49 | private MemberAuthServiceImpl authService; |
| 50 | 50 | |
| 51 | 51 | @MockBean |
| 52 | - private InfFileCoreService fileCoreService; | |
| 53 | - | |
| 54 | - @MockBean | |
| 55 | 52 | private PasswordEncoder passwordEncoder; |
| 56 | 53 | |
| 57 | 54 | @MockBean |
| 58 | 55 | private SmsCodeApi smsCodeApi; |
| 56 | + @MockBean | |
| 57 | + private FileApi fileApi; | |
| 59 | 58 | |
| 60 | 59 | @Test |
| 61 | 60 | public void testUpdateNickName_success(){ |
| ... | ... | @@ -86,7 +85,7 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest { |
| 86 | 85 | ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes); |
| 87 | 86 | // mock 方法 |
| 88 | 87 | String avatar = randomString(); |
| 89 | - when(fileCoreService.createFile(anyString(), eq(avatarFileBytes))).thenReturn(avatar); | |
| 88 | + when(fileApi.createFile(eq(avatarFileBytes))).thenReturn(avatar); | |
| 90 | 89 | // 调用 |
| 91 | 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 | 45 | yudao: |
| 46 | 46 | info: |
| 47 | 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 | 49 | core-service: |
| 51 | 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 | 15 | String LOGIN_TYPE = "sys_login_type"; // 登录日志的类型 |
| 16 | 16 | String LOGIN_RESULT = "sys_login_result"; // 登录结果 |
| 17 | 17 | |
| 18 | - | |
| 19 | 18 | String SMS_CHANNEL_CODE = "sys_sms_channel_code"; // 短信渠道编码 |
| 20 | 19 | String SMS_TEMPLATE_TYPE = "sys_sms_template_type"; // 短信模板类型 |
| 21 | 20 | String SMS_SEND_STATUS = "sys_sms_send_status"; // 短信发送状态 | ... | ... |
yudao-module-system/yudao-module-system-impl/pom.xml
| ... | ... | @@ -28,13 +28,13 @@ |
| 28 | 28 | <artifactId>yudao-module-member-api</artifactId> |
| 29 | 29 | <version>${revision}</version> |
| 30 | 30 | </dependency> |
| 31 | - | |
| 32 | - <!-- 业务组件 --> | |
| 33 | 31 | <dependency> |
| 34 | 32 | <groupId>cn.iocoder.boot</groupId> |
| 35 | - <artifactId>yudao-core-service</artifactId> | |
| 33 | + <artifactId>yudao-module-infra-api</artifactId> | |
| 34 | + <version>${revision}</version> | |
| 36 | 35 | </dependency> |
| 37 | 36 | |
| 37 | + <!-- 业务组件 --> | |
| 38 | 38 | <dependency> |
| 39 | 39 | <groupId>cn.iocoder.boot</groupId> |
| 40 | 40 | <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> |
| ... | ... | @@ -45,8 +45,20 @@ |
| 45 | 45 | </dependency> |
| 46 | 46 | <dependency> |
| 47 | 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 | 52 | <artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId> |
| 49 | 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 | 63 | <!-- Web 相关 --> |
| 52 | 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 | 4 | import cn.hutool.core.io.IoUtil; |
| 5 | 5 | import cn.hutool.core.util.IdUtil; |
| 6 | 6 | import cn.hutool.core.util.StrUtil; |
| 7 | -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; | |
| 8 | 7 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 9 | 8 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 10 | 9 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 11 | 10 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 11 | +import cn.iocoder.yudao.module.infra.api.file.FileApi; | |
| 12 | 12 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; |
| 13 | 13 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; |
| 14 | 14 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; |
| ... | ... | @@ -56,8 +56,9 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 56 | 56 | private PermissionService permissionService; |
| 57 | 57 | @Resource |
| 58 | 58 | private PasswordEncoder passwordEncoder; |
| 59 | + | |
| 59 | 60 | @Resource |
| 60 | - private InfFileCoreService fileService; | |
| 61 | + private FileApi fileApi; | |
| 61 | 62 | |
| 62 | 63 | @Override |
| 63 | 64 | public Long createUser(UserCreateReqVO reqVO) { |
| ... | ... | @@ -111,7 +112,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 111 | 112 | public String updateUserAvatar(Long id, InputStream avatarFile) { |
| 112 | 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 | 117 | AdminUserDO sysUserDO = new AdminUserDO(); |
| 117 | 118 | sysUserDO.setId(id); | ... | ... |
yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java
| 1 | 1 | package cn.iocoder.yudao.module.system.service.user; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.util.RandomUtil; |
| 4 | -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; | |
| 5 | 4 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | 5 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 7 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 8 | 7 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; |
| 9 | 8 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 10 | 9 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 10 | +import cn.iocoder.yudao.module.infra.api.file.FileApi; | |
| 11 | 11 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; |
| 12 | 12 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; |
| 13 | 13 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; |
| ... | ... | @@ -63,7 +63,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { |
| 63 | 63 | @MockBean |
| 64 | 64 | private PasswordEncoder passwordEncoder; |
| 65 | 65 | @MockBean |
| 66 | - private InfFileCoreService fileService; | |
| 66 | + private FileApi fileApi; | |
| 67 | 67 | |
| 68 | 68 | @Test |
| 69 | 69 | public void testCreatUser_success() { |
| ... | ... | @@ -182,7 +182,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { |
| 182 | 182 | ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes); |
| 183 | 183 | // mock 方法 |
| 184 | 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 | 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 | 45 | yudao: |
| 46 | 46 | info: |
| 47 | 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 | 49 | core-service: |
| 51 | 50 | base-package: cn.iocoder.yudao.module.member.dal.mysql # TODO 芋艿:要清理掉 |
| 52 | 51 | captcha: | ... | ... |