Commit 06887bff1630e13874e1b4f488ac6be5fc653baa
1 parent
cee7e507
多模块重构 4:system 模块的创建,以及将相关的代码先进行迁移
Showing
407 changed files
with
4739 additions
and
4528 deletions
Too many changes.
To preserve performance only 100 of 407 files are displayed.
pom.xml
| ... | ... | @@ -15,6 +15,8 @@ |
| 15 | 15 | <module>yudao-core-service</module> |
| 16 | 16 | <module>yudao-module-member</module> |
| 17 | 17 | <module>yudao-module-bpm</module> |
| 18 | + <module>yudao-module-system</module> | |
| 19 | + <module>yudao-module-system-api</module> | |
| 18 | 20 | </modules> |
| 19 | 21 | |
| 20 | 22 | <name>${artifactId}</name> | ... | ... |
yudao-admin-server/pom.xml
| ... | ... | @@ -27,6 +27,11 @@ |
| 27 | 27 | <artifactId>yudao-module-member-impl</artifactId> |
| 28 | 28 | <version>${revision}</version> |
| 29 | 29 | </dependency> |
| 30 | + <dependency> | |
| 31 | + <groupId>cn.iocoder.boot</groupId> | |
| 32 | + <artifactId>yudao-module-system-impl</artifactId> | |
| 33 | + <version>${revision}</version> | |
| 34 | + </dependency> | |
| 30 | 35 | |
| 31 | 36 | <!-- 业务组件 --> |
| 32 | 37 | <dependency> |
| ... | ... | @@ -50,10 +55,6 @@ |
| 50 | 55 | <groupId>cn.iocoder.boot</groupId> |
| 51 | 56 | <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> |
| 52 | 57 | </dependency> |
| 53 | - <dependency> | |
| 54 | - <groupId>cn.iocoder.boot</groupId> | |
| 55 | - <artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId> | |
| 56 | - </dependency> | |
| 57 | 58 | |
| 58 | 59 | <!-- 默认引入bpm-activiti. 可以替换为bpm-flowable --> |
| 59 | 60 | <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}"}) // TODO 芋艿:重构 | |
| 8 | + "${yudao.info.member-package}", "${yudao.info.system-package}"}) // TODO 芋艿:重构 | |
| 9 | 9 | public class AdminServerApplication { |
| 10 | 10 | |
| 11 | 11 | public static void main(String[] args) { | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/framework/captcha/config/CaptchaProperties.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.framework.captcha.config; | |
| 2 | - | |
| 3 | -import lombok.Data; | |
| 4 | -import org.springframework.boot.context.properties.ConfigurationProperties; | |
| 5 | -import org.springframework.validation.annotation.Validated; | |
| 6 | - | |
| 7 | -import javax.validation.constraints.NotNull; | |
| 8 | -import java.time.Duration; | |
| 9 | - | |
| 10 | -@ConfigurationProperties(prefix = "yudao.captcha") | |
| 11 | -@Validated | |
| 12 | -@Data | |
| 13 | -public class CaptchaProperties { | |
| 14 | - | |
| 15 | - private static final Boolean ENABLE_DEFAULT = true; | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 是否开启 | |
| 19 | - * 注意,这里仅仅是后端 Server 是否校验,暂时不控制前端的逻辑 | |
| 20 | - */ | |
| 21 | - private Boolean enable = ENABLE_DEFAULT; | |
| 22 | - /** | |
| 23 | - * 验证码的过期时间 | |
| 24 | - */ | |
| 25 | - @NotNull(message = "验证码的过期时间不为空") | |
| 26 | - private Duration timeout; | |
| 27 | - /** | |
| 28 | - * 验证码的高度 | |
| 29 | - */ | |
| 30 | - @NotNull(message = "验证码的高度不能为空") | |
| 31 | - private Integer height; | |
| 32 | - /** | |
| 33 | - * 验证码的宽度 | |
| 34 | - */ | |
| 35 | - @NotNull(message = "验证码的宽度不能为空") | |
| 36 | - private Integer width; | |
| 37 | - | |
| 38 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/framework/captcha/package-info.java deleted
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/framework/codegen/config/CodegenProperties.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.framework.codegen.config; | |
| 2 | - | |
| 3 | -import lombok.Data; | |
| 4 | -import org.springframework.boot.context.properties.ConfigurationProperties; | |
| 5 | -import org.springframework.validation.annotation.Validated; | |
| 6 | - | |
| 7 | -import javax.validation.constraints.NotEmpty; | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 9 | -import java.util.Collection; | |
| 10 | - | |
| 11 | -@ConfigurationProperties(prefix = "yudao.codegen") | |
| 12 | -@Validated | |
| 13 | -@Data | |
| 14 | -public class CodegenProperties { | |
| 15 | - | |
| 16 | - /** | |
| 17 | - * 生成的 Java 代码的基础包 | |
| 18 | - */ | |
| 19 | - @NotNull(message = "Java 代码的基础包不能为空") | |
| 20 | - private String basePackage; | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 数据库名数组 | |
| 24 | - */ | |
| 25 | - @NotEmpty(message = "数据库不能为空") | |
| 26 | - private Collection<String> dbSchemas; | |
| 27 | - | |
| 28 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/framework/codegen/package-info.java deleted
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/framework/datapermission/config/SysDataPermissionConfiguration.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.framework.datapermission.config; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; | |
| 4 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; | |
| 5 | -import cn.iocoder.yudao.framework.datapermission.core.dept.rule.DeptDataPermissionRuleCustomizer; | |
| 6 | -import org.springframework.context.annotation.Bean; | |
| 7 | -import org.springframework.context.annotation.Configuration; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * system 模块的数据权限 Configuration | |
| 11 | - * | |
| 12 | - * @author 芋道源码 | |
| 13 | - */ | |
| 14 | -@Configuration | |
| 15 | -public class SysDataPermissionConfiguration { | |
| 16 | - | |
| 17 | - @Bean | |
| 18 | - public DeptDataPermissionRuleCustomizer sysDeptDataPermissionRuleCustomizer() { | |
| 19 | - return rule -> { | |
| 20 | - rule.addDeptColumn(SysUserDO.class); | |
| 21 | - rule.addDeptColumn(SysDeptDO.class, "id"); | |
| 22 | - }; | |
| 23 | - } | |
| 24 | - | |
| 25 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/framework/datapermission/package-info.java deleted
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/job/auth/SysUserSessionTimeoutJob.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.job.auth; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.service.auth.SysUserSessionService; | |
| 5 | -import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; | |
| 6 | -import lombok.extern.slf4j.Slf4j; | |
| 7 | -import org.springframework.stereotype.Component; | |
| 8 | - | |
| 9 | -import javax.annotation.Resource; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 用户 Session 超时 Job | |
| 13 | - * | |
| 14 | - * @author 願 | |
| 15 | - */ | |
| 16 | -@Component | |
| 17 | -@TenantJob | |
| 18 | -@Slf4j | |
| 19 | -public class SysUserSessionTimeoutJob implements JobHandler { | |
| 20 | - | |
| 21 | - @Resource | |
| 22 | - private SysUserSessionService sysUserSessionService; | |
| 23 | - | |
| 24 | - @Override | |
| 25 | - public String execute(String param) throws Exception { | |
| 26 | - // 执行过期 | |
| 27 | - Long timeoutCount = sysUserSessionService.clearSessionTimeout(); | |
| 28 | - // 返回结果,记录每次的超时数量 | |
| 29 | - return String.format("移除在线会话数量为 %s 个", timeoutCount); | |
| 30 | - } | |
| 31 | - | |
| 32 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/job/package-info.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.job; |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/consumer/dept/SysDeptRefreshConsumer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.dept; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.dept.SysDeptRefreshMessage; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysDeptService; | |
| 6 | -import lombok.extern.slf4j.Slf4j; | |
| 7 | -import org.springframework.stereotype.Component; | |
| 8 | - | |
| 9 | -import javax.annotation.Resource; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 针对 {@link SysDeptRefreshMessage} 的消费者 | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -@Component | |
| 17 | -@Slf4j | |
| 18 | -public class SysDeptRefreshConsumer extends AbstractChannelMessageListener<SysDeptRefreshMessage> { | |
| 19 | - | |
| 20 | - @Resource | |
| 21 | - private SysDeptService deptService; | |
| 22 | - | |
| 23 | - @Override | |
| 24 | - public void onMessage(SysDeptRefreshMessage message) { | |
| 25 | - log.info("[onMessage][收到 Dept 刷新消息]"); | |
| 26 | - deptService.initLocalCache(); | |
| 27 | - } | |
| 28 | - | |
| 29 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/consumer/dict/SysDictDataRefreshConsumer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.dict; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.coreservice.modules.system.service.dict.SysDictDataCoreService; | |
| 4 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.dict.SysDictDataRefreshMessage; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.service.dict.SysDictDataService; | |
| 7 | -import lombok.extern.slf4j.Slf4j; | |
| 8 | -import org.springframework.stereotype.Component; | |
| 9 | - | |
| 10 | -import javax.annotation.Resource; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 针对 {@link SysDictDataRefreshMessage} 的消费者 | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -@Component | |
| 18 | -@Slf4j | |
| 19 | -public class SysDictDataRefreshConsumer extends AbstractChannelMessageListener<SysDictDataRefreshMessage> { | |
| 20 | - | |
| 21 | - @Resource | |
| 22 | - private SysDictDataCoreService dictDataCoreService; | |
| 23 | - | |
| 24 | - @Override | |
| 25 | - public void onMessage(SysDictDataRefreshMessage message) { | |
| 26 | - log.info("[onMessage][收到 DictData 刷新消息]"); | |
| 27 | - dictDataCoreService.initLocalCache(); | |
| 28 | - } | |
| 29 | - | |
| 30 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/consumer/mail/SysMailSendConsumer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.mail; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.mail.SysMailSendMessage; | |
| 5 | -import lombok.extern.slf4j.Slf4j; | |
| 6 | -import org.springframework.stereotype.Component; | |
| 7 | - | |
| 8 | -@Component | |
| 9 | -@Slf4j | |
| 10 | -public class SysMailSendConsumer extends AbstractStreamMessageListener<SysMailSendMessage> { | |
| 11 | - | |
| 12 | - @Override | |
| 13 | - public void onMessage(SysMailSendMessage message) { | |
| 14 | - log.info("[onMessage][消息内容({})]", message); | |
| 15 | - } | |
| 16 | - | |
| 17 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/consumer/permission/SysMenuRefreshConsumer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.permission; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.permission.SysMenuRefreshMessage; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysMenuService; | |
| 6 | -import lombok.extern.slf4j.Slf4j; | |
| 7 | -import org.springframework.stereotype.Component; | |
| 8 | - | |
| 9 | -import javax.annotation.Resource; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 针对 {@link SysMenuRefreshMessage} 的消费者 | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -@Component | |
| 17 | -@Slf4j | |
| 18 | -public class SysMenuRefreshConsumer extends AbstractChannelMessageListener<SysMenuRefreshMessage> { | |
| 19 | - | |
| 20 | - @Resource | |
| 21 | - private SysMenuService menuService; | |
| 22 | - | |
| 23 | - @Override | |
| 24 | - public void onMessage(SysMenuRefreshMessage message) { | |
| 25 | - log.info("[onMessage][收到 Menu 刷新消息]"); | |
| 26 | - menuService.initLocalCache(); | |
| 27 | - } | |
| 28 | - | |
| 29 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/consumer/permission/SysRoleMenuRefreshConsumer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.permission; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.permission.SysRoleMenuRefreshMessage; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysPermissionService; | |
| 6 | -import lombok.extern.slf4j.Slf4j; | |
| 7 | -import org.springframework.stereotype.Component; | |
| 8 | - | |
| 9 | -import javax.annotation.Resource; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 针对 {@link SysRoleMenuRefreshMessage} 的消费者 | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -@Component | |
| 17 | -@Slf4j | |
| 18 | -public class SysRoleMenuRefreshConsumer extends AbstractChannelMessageListener<SysRoleMenuRefreshMessage> { | |
| 19 | - | |
| 20 | - @Resource | |
| 21 | - private SysPermissionService permissionService; | |
| 22 | - | |
| 23 | - @Override | |
| 24 | - public void onMessage(SysRoleMenuRefreshMessage message) { | |
| 25 | - log.info("[onMessage][收到 Role 与 Menu 的关联刷新消息]"); | |
| 26 | - permissionService.initLocalCache(); | |
| 27 | - } | |
| 28 | - | |
| 29 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/consumer/permission/SysRoleRefreshConsumer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.permission; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.permission.SysRoleRefreshMessage; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysRoleService; | |
| 6 | -import lombok.extern.slf4j.Slf4j; | |
| 7 | -import org.springframework.stereotype.Component; | |
| 8 | - | |
| 9 | -import javax.annotation.Resource; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 针对 {@link SysRoleRefreshMessage} 的消费者 | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -@Component | |
| 17 | -@Slf4j | |
| 18 | -public class SysRoleRefreshConsumer extends AbstractChannelMessageListener<SysRoleRefreshMessage> { | |
| 19 | - | |
| 20 | - @Resource | |
| 21 | - private SysRoleService roleService; | |
| 22 | - | |
| 23 | - @Override | |
| 24 | - public void onMessage(SysRoleRefreshMessage message) { | |
| 25 | - log.info("[onMessage][收到 Role 刷新消息]"); | |
| 26 | - roleService.initLocalCache(); | |
| 27 | - } | |
| 28 | - | |
| 29 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/consumer/sms/SysSmsChannelRefreshConsumer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.sms; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.sms.SysSmsChannelRefreshMessage; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.service.sms.SysSmsChannelService; | |
| 6 | -import lombok.extern.slf4j.Slf4j; | |
| 7 | -import org.springframework.stereotype.Component; | |
| 8 | - | |
| 9 | -import javax.annotation.Resource; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 针对 {@link SysSmsChannelRefreshMessage} 的消费者 | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -@Component | |
| 17 | -@Slf4j | |
| 18 | -public class SysSmsChannelRefreshConsumer extends AbstractChannelMessageListener<SysSmsChannelRefreshMessage> { | |
| 19 | - | |
| 20 | - @Resource | |
| 21 | - private SysSmsChannelService smsChannelService; | |
| 22 | - | |
| 23 | - @Override | |
| 24 | - public void onMessage(SysSmsChannelRefreshMessage message) { | |
| 25 | - log.info("[onMessage][收到 SmsChannel 刷新消息]"); | |
| 26 | - smsChannelService.initSmsClients(); | |
| 27 | - } | |
| 28 | - | |
| 29 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/consumer/sms/SysSmsSendConsumer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.sms; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.coreservice.modules.system.mq.message.sms.SysSmsSendMessage; | |
| 4 | -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsCoreService; | |
| 5 | -import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener; | |
| 6 | -import lombok.extern.slf4j.Slf4j; | |
| 7 | -import org.springframework.stereotype.Component; | |
| 8 | - | |
| 9 | -import javax.annotation.Resource; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 针对 {@link SysSmsSendMessage} 的消费者 | |
| 13 | - * | |
| 14 | - * @author zzf | |
| 15 | - * @date 2021/3/9 16:35 | |
| 16 | - */ | |
| 17 | -@Component | |
| 18 | -@Slf4j | |
| 19 | -public class SysSmsSendConsumer extends AbstractStreamMessageListener<SysSmsSendMessage> { | |
| 20 | - | |
| 21 | - @Resource | |
| 22 | - private SysSmsCoreService smsCoreService; | |
| 23 | - | |
| 24 | - @Override | |
| 25 | - public void onMessage(SysSmsSendMessage message) { | |
| 26 | - log.info("[onMessage][消息内容({})]", message); | |
| 27 | - smsCoreService.doSendSms(message); | |
| 28 | - } | |
| 29 | - | |
| 30 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/consumer/sms/SysSmsTemplateRefreshConsumer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.sms; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.sms.SysSmsTemplateRefreshMessage; | |
| 4 | -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsTemplateCoreService; | |
| 5 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; | |
| 6 | -import lombok.extern.slf4j.Slf4j; | |
| 7 | -import org.springframework.stereotype.Component; | |
| 8 | - | |
| 9 | -import javax.annotation.Resource; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 针对 {@link SysSmsTemplateRefreshMessage} 的消费者 | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -@Component | |
| 17 | -@Slf4j | |
| 18 | -public class SysSmsTemplateRefreshConsumer extends AbstractChannelMessageListener<SysSmsTemplateRefreshMessage> { | |
| 19 | - | |
| 20 | - @Resource | |
| 21 | - private SysSmsTemplateCoreService smsTemplateCoreService; | |
| 22 | - | |
| 23 | - @Override | |
| 24 | - public void onMessage(SysSmsTemplateRefreshMessage message) { | |
| 25 | - log.info("[onMessage][收到 SmsTemplate 刷新消息]"); | |
| 26 | - smsTemplateCoreService.initLocalCache(); | |
| 27 | - } | |
| 28 | - | |
| 29 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/message/dept/SysDeptRefreshMessage.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.message.dept; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * 部门数据刷新 Message | |
| 9 | - * | |
| 10 | - * @author 芋道源码 | |
| 11 | - */ | |
| 12 | -@Data | |
| 13 | -@EqualsAndHashCode(callSuper = true) | |
| 14 | -public class SysDeptRefreshMessage extends AbstractChannelMessage { | |
| 15 | - | |
| 16 | - @Override | |
| 17 | - public String getChannel() { | |
| 18 | - return "system.dept.refresh"; | |
| 19 | - } | |
| 20 | - | |
| 21 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/message/dict/SysDictDataRefreshMessage.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.message.dict; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * 字典数据数据刷新 Message | |
| 9 | - */ | |
| 10 | -@Data | |
| 11 | -@EqualsAndHashCode(callSuper = true) | |
| 12 | -public class SysDictDataRefreshMessage extends AbstractChannelMessage { | |
| 13 | - | |
| 14 | - @Override | |
| 15 | - public String getChannel() { | |
| 16 | - return "system.dict-data.refresh"; | |
| 17 | - } | |
| 18 | - | |
| 19 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/message/mail/SysMailSendMessage.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.message.mail; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessage; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | - | |
| 7 | -import javax.validation.constraints.NotNull; | |
| 8 | -import java.util.Map; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 邮箱发送消息 | |
| 12 | - * | |
| 13 | - * @author 芋道源码 | |
| 14 | - */ | |
| 15 | -@Data | |
| 16 | -@EqualsAndHashCode(callSuper = true) | |
| 17 | -public class SysMailSendMessage extends AbstractStreamMessage { | |
| 18 | - | |
| 19 | - /** | |
| 20 | - * 邮箱地址 | |
| 21 | - */ | |
| 22 | - @NotNull(message = "邮箱地址不能为空") | |
| 23 | - private String address; | |
| 24 | - /** | |
| 25 | - * 短信模板编号 | |
| 26 | - */ | |
| 27 | - @NotNull(message = "短信模板编号不能为空") | |
| 28 | - private String templateCode; | |
| 29 | - /** | |
| 30 | - * 短信模板参数 | |
| 31 | - */ | |
| 32 | - private Map<String, Object> templateParams; | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * 用户编号,允许空 | |
| 36 | - */ | |
| 37 | - private Integer userId; | |
| 38 | - /** | |
| 39 | - * 用户类型,允许空 | |
| 40 | - */ | |
| 41 | - private Integer userType; | |
| 42 | - | |
| 43 | - @Override | |
| 44 | - public String getStreamKey() { | |
| 45 | - return "system.mail.send"; | |
| 46 | - } | |
| 47 | - | |
| 48 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/message/permission/SysMenuRefreshMessage.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.message.permission; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * 菜单数据刷新 Message | |
| 9 | - * | |
| 10 | - * @author 芋道源码 | |
| 11 | - */ | |
| 12 | -@Data | |
| 13 | -@EqualsAndHashCode(callSuper = true) | |
| 14 | -public class SysMenuRefreshMessage extends AbstractChannelMessage { | |
| 15 | - | |
| 16 | - @Override | |
| 17 | - public String getChannel() { | |
| 18 | - return "system.menu.refresh"; | |
| 19 | - } | |
| 20 | - | |
| 21 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/message/permission/SysRoleMenuRefreshMessage.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.message.permission; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * 角色与菜单数据刷新 Message | |
| 9 | - * | |
| 10 | - * @author 芋道源码 | |
| 11 | - */ | |
| 12 | -@Data | |
| 13 | -@EqualsAndHashCode(callSuper = true) | |
| 14 | -public class SysRoleMenuRefreshMessage extends AbstractChannelMessage { | |
| 15 | - | |
| 16 | - @Override | |
| 17 | - public String getChannel() { | |
| 18 | - return "system.role-menu.refresh"; | |
| 19 | - } | |
| 20 | - | |
| 21 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/message/permission/SysRoleRefreshMessage.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.message.permission; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * 角色数据刷新 Message | |
| 9 | - * | |
| 10 | - * @author 芋道源码 | |
| 11 | - */ | |
| 12 | -@Data | |
| 13 | -@EqualsAndHashCode(callSuper = true) | |
| 14 | -public class SysRoleRefreshMessage extends AbstractChannelMessage { | |
| 15 | - | |
| 16 | - @Override | |
| 17 | - public String getChannel() { | |
| 18 | - return "system.role.refresh"; | |
| 19 | - } | |
| 20 | - | |
| 21 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/message/sms/SysSmsChannelRefreshMessage.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.message.sms; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * 短信渠道的数据刷新 Message | |
| 9 | - * | |
| 10 | - * @author 芋道源码 | |
| 11 | - */ | |
| 12 | -@Data | |
| 13 | -@EqualsAndHashCode(callSuper = true) | |
| 14 | -public class SysSmsChannelRefreshMessage extends AbstractChannelMessage { | |
| 15 | - | |
| 16 | - @Override | |
| 17 | - public String getChannel() { | |
| 18 | - return "system.sms-channel.refresh"; | |
| 19 | - } | |
| 20 | - | |
| 21 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/message/sms/SysSmsTemplateRefreshMessage.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.message.sms; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage; | |
| 4 | -import lombok.Data; | |
| 5 | -import lombok.EqualsAndHashCode; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * 短信模板的数据刷新 Message | |
| 9 | - * | |
| 10 | - * @author 芋道源码 | |
| 11 | - */ | |
| 12 | -@Data | |
| 13 | -@EqualsAndHashCode(callSuper = true) | |
| 14 | -public class SysSmsTemplateRefreshMessage extends AbstractChannelMessage { | |
| 15 | - | |
| 16 | - @Override | |
| 17 | - public String getChannel() { | |
| 18 | - return "system.sms-template.refresh"; | |
| 19 | - } | |
| 20 | - | |
| 21 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/producer/dept/SysDeptProducer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.producer.dept; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.dept.SysDeptRefreshMessage; | |
| 4 | -import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; | |
| 5 | -import org.springframework.stereotype.Component; | |
| 6 | - | |
| 7 | -import javax.annotation.Resource; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * Dept 部门相关消息的 Producer | |
| 11 | - */ | |
| 12 | -@Component | |
| 13 | -public class SysDeptProducer { | |
| 14 | - | |
| 15 | - @Resource | |
| 16 | - private RedisMQTemplate redisMQTemplate; | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 发送 {@link SysDeptRefreshMessage} 消息 | |
| 20 | - */ | |
| 21 | - public void sendDeptRefreshMessage() { | |
| 22 | - SysDeptRefreshMessage message = new SysDeptRefreshMessage(); | |
| 23 | - redisMQTemplate.send(message); | |
| 24 | - } | |
| 25 | - | |
| 26 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/producer/dict/SysDictDataProducer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.producer.dict; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.dict.SysDictDataRefreshMessage; | |
| 4 | -import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; | |
| 5 | -import org.springframework.stereotype.Component; | |
| 6 | - | |
| 7 | -import javax.annotation.Resource; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * DictData 字典数据相关消息的 Producer | |
| 11 | - */ | |
| 12 | -@Component | |
| 13 | -public class SysDictDataProducer { | |
| 14 | - | |
| 15 | - @Resource | |
| 16 | - private RedisMQTemplate redisMQTemplate; | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 发送 {@link SysDictDataRefreshMessage} 消息 | |
| 20 | - */ | |
| 21 | - public void sendDictDataRefreshMessage() { | |
| 22 | - SysDictDataRefreshMessage message = new SysDictDataRefreshMessage(); | |
| 23 | - redisMQTemplate.send(message); | |
| 24 | - } | |
| 25 | - | |
| 26 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/producer/permission/SysMenuProducer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.producer.permission; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.permission.SysMenuRefreshMessage; | |
| 4 | -import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; | |
| 5 | -import org.springframework.stereotype.Component; | |
| 6 | - | |
| 7 | -import javax.annotation.Resource; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * Menu 菜单相关消息的 Producer | |
| 11 | - */ | |
| 12 | -@Component | |
| 13 | -public class SysMenuProducer { | |
| 14 | - | |
| 15 | - @Resource | |
| 16 | - private RedisMQTemplate redisMQTemplate; | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 发送 {@link SysMenuRefreshMessage} 消息 | |
| 20 | - */ | |
| 21 | - public void sendMenuRefreshMessage() { | |
| 22 | - SysMenuRefreshMessage message = new SysMenuRefreshMessage(); | |
| 23 | - redisMQTemplate.send(message); | |
| 24 | - } | |
| 25 | - | |
| 26 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/producer/permission/SysPermissionProducer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.producer.permission; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.permission.SysRoleMenuRefreshMessage; | |
| 4 | -import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; | |
| 5 | -import org.springframework.stereotype.Component; | |
| 6 | - | |
| 7 | -import javax.annotation.Resource; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * Permission 权限相关消息的 Producer | |
| 11 | - */ | |
| 12 | -@Component | |
| 13 | -public class SysPermissionProducer { | |
| 14 | - | |
| 15 | - @Resource | |
| 16 | - private RedisMQTemplate redisMQTemplate; | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 发送 {@link SysRoleMenuRefreshMessage} 消息 | |
| 20 | - */ | |
| 21 | - public void sendRoleMenuRefreshMessage() { | |
| 22 | - SysRoleMenuRefreshMessage message = new SysRoleMenuRefreshMessage(); | |
| 23 | - redisMQTemplate.send(message); | |
| 24 | - } | |
| 25 | - | |
| 26 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/producer/permission/SysRoleProducer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.producer.permission; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.permission.SysRoleRefreshMessage; | |
| 4 | -import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; | |
| 5 | -import org.springframework.stereotype.Component; | |
| 6 | - | |
| 7 | -import javax.annotation.Resource; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * Role 角色相关消息的 Producer | |
| 11 | - * | |
| 12 | - * @author 芋道源码 | |
| 13 | - */ | |
| 14 | -@Component | |
| 15 | -public class SysRoleProducer { | |
| 16 | - | |
| 17 | - @Resource | |
| 18 | - private RedisMQTemplate redisMQTemplate; | |
| 19 | - | |
| 20 | - /** | |
| 21 | - * 发送 {@link SysRoleRefreshMessage} 消息 | |
| 22 | - */ | |
| 23 | - public void sendRoleRefreshMessage() { | |
| 24 | - SysRoleRefreshMessage message = new SysRoleRefreshMessage(); | |
| 25 | - redisMQTemplate.send(message); | |
| 26 | - } | |
| 27 | - | |
| 28 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/mq/producer/sms/SysSmsProducer.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.mq.producer.sms; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.sms.SysSmsChannelRefreshMessage; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.sms.SysSmsTemplateRefreshMessage; | |
| 5 | -import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; | |
| 6 | -import lombok.extern.slf4j.Slf4j; | |
| 7 | -import org.springframework.stereotype.Component; | |
| 8 | - | |
| 9 | -import javax.annotation.Resource; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * Sms 短信相关消息的 Producer | |
| 13 | - * | |
| 14 | - * @author zzf | |
| 15 | - * @date 2021/3/9 16:35 | |
| 16 | - */ | |
| 17 | -@Slf4j | |
| 18 | -@Component | |
| 19 | -public class SysSmsProducer { | |
| 20 | - | |
| 21 | - @Resource | |
| 22 | - private RedisMQTemplate redisMQTemplate; | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 发送 {@link SysSmsChannelRefreshMessage} 消息 | |
| 26 | - */ | |
| 27 | - public void sendSmsChannelRefreshMessage() { | |
| 28 | - SysSmsChannelRefreshMessage message = new SysSmsChannelRefreshMessage(); | |
| 29 | - redisMQTemplate.send(message); | |
| 30 | - } | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 发送 {@link SysSmsTemplateRefreshMessage} 消息 | |
| 34 | - */ | |
| 35 | - public void sendSmsTemplateRefreshMessage() { | |
| 36 | - SysSmsTemplateRefreshMessage message = new SysSmsTemplateRefreshMessage(); | |
| 37 | - redisMQTemplate.send(message); | |
| 38 | - } | |
| 39 | - | |
| 40 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/package-info.java deleted
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/auth/SysAuthService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.auth; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.auth.*; | |
| 4 | -import cn.iocoder.yudao.framework.security.core.service.SecurityAuthFrameworkService; | |
| 5 | - | |
| 6 | -import javax.validation.Valid; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * 管理后台的认证 Service 接口 | |
| 10 | - * | |
| 11 | - * 提供用户的账号密码登录、token 的校验等认证相关的功能 | |
| 12 | - * | |
| 13 | - * @author 芋道源码 | |
| 14 | - */ | |
| 15 | -public interface SysAuthService extends SecurityAuthFrameworkService { | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 账号登录 | |
| 19 | - * | |
| 20 | - * @param reqVO 登录信息 | |
| 21 | - * @param userIp 用户 IP | |
| 22 | - * @param userAgent 用户 UA | |
| 23 | - * @return 身份令牌,使用 JWT 方式 | |
| 24 | - */ | |
| 25 | - String login(@Valid SysAuthLoginReqVO reqVO, String userIp, String userAgent); | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 社交登录,使用 code 授权码 | |
| 29 | - * | |
| 30 | - * @param reqVO 登录信息 | |
| 31 | - * @param userIp 用户 IP | |
| 32 | - * @param userAgent 用户 UA | |
| 33 | - * @return 身份令牌,使用 JWT 方式 | |
| 34 | - */ | |
| 35 | - String socialLogin(@Valid SysAuthSocialLoginReqVO reqVO, String userIp, String userAgent); | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * 社交登录,使用 code 授权码 + 账号密码 | |
| 39 | - * | |
| 40 | - * @param reqVO 登录信息 | |
| 41 | - * @param userIp 用户 IP | |
| 42 | - * @param userAgent 用户 UA | |
| 43 | - * @return 身份令牌,使用 JWT 方式 | |
| 44 | - */ | |
| 45 | - String socialLogin2(@Valid SysAuthSocialLogin2ReqVO reqVO, String userIp, String userAgent); | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * 社交绑定,使用 code 授权码 | |
| 49 | - * | |
| 50 | - * @param userId 用户编号 | |
| 51 | - * @param reqVO 绑定信息 | |
| 52 | - */ | |
| 53 | - void socialBind(Long userId, @Valid SysAuthSocialBindReqVO reqVO); | |
| 54 | - | |
| 55 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/auth/SysUserSessionService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.auth; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.session.SysUserSessionPageReqVO; | |
| 4 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * 在线用户 Session Service 接口 | |
| 9 | - * | |
| 10 | - * @author 芋道源码 | |
| 11 | - */ | |
| 12 | -public interface SysUserSessionService { | |
| 13 | - | |
| 14 | - /** | |
| 15 | - * 获得在线用户分页列表 | |
| 16 | - * | |
| 17 | - * @param reqVO 分页条件 | |
| 18 | - * @return 份额与列表 | |
| 19 | - */ | |
| 20 | - PageResult<SysUserSessionDO> getUserSessionPage(SysUserSessionPageReqVO reqVO); | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 移除超时的在线用户 | |
| 24 | - * | |
| 25 | - * @return {@link Long } 移出的超时用户数量 | |
| 26 | - **/ | |
| 27 | - long clearSessionTimeout(); | |
| 28 | - | |
| 29 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/auth/impl/SysUserSessionServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.auth.impl; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.util.StrUtil; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.session.SysUserSessionPageReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.auth.SysUserSessionMapper; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.enums.logger.SysLoginLogTypeEnum; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.enums.logger.SysLoginResultEnum; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.service.auth.SysUserSessionService; | |
| 10 | -import cn.iocoder.yudao.adminserver.modules.system.service.user.SysUserService; | |
| 11 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; | |
| 12 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; | |
| 13 | -import cn.iocoder.yudao.coreservice.modules.system.dal.redis.auth.SysLoginUserCoreRedisDAO; | |
| 14 | -import cn.iocoder.yudao.coreservice.modules.system.service.logger.SysLoginLogCoreService; | |
| 15 | -import cn.iocoder.yudao.coreservice.modules.system.service.logger.dto.SysLoginLogCreateReqDTO; | |
| 16 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 17 | -import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; | |
| 18 | -import com.google.common.collect.Lists; | |
| 19 | -import lombok.extern.slf4j.Slf4j; | |
| 20 | -import org.springframework.stereotype.Service; | |
| 21 | - | |
| 22 | -import javax.annotation.Resource; | |
| 23 | -import java.util.ArrayList; | |
| 24 | -import java.util.Collection; | |
| 25 | -import java.util.List; | |
| 26 | -import java.util.Map; | |
| 27 | -import java.util.stream.Collectors; | |
| 28 | - | |
| 29 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 30 | - | |
| 31 | -/** | |
| 32 | - * 在线用户 Session Service 实现类 | |
| 33 | - * | |
| 34 | - * @author 芋道源码 | |
| 35 | - */ | |
| 36 | -@Slf4j | |
| 37 | -@Service | |
| 38 | -public class SysUserSessionServiceImpl implements SysUserSessionService { | |
| 39 | - | |
| 40 | - @Resource | |
| 41 | - private SysUserSessionMapper userSessionMapper; | |
| 42 | - @Resource | |
| 43 | - private SysUserService userService; | |
| 44 | - @Resource | |
| 45 | - private SysLoginLogCoreService loginLogCoreService; | |
| 46 | - | |
| 47 | - @Resource | |
| 48 | - private SysLoginUserCoreRedisDAO loginUserCoreRedisDAO; | |
| 49 | - | |
| 50 | - @Override | |
| 51 | - public PageResult<SysUserSessionDO> getUserSessionPage(SysUserSessionPageReqVO reqVO) { | |
| 52 | - // 处理基于用户昵称的查询 | |
| 53 | - Collection<Long> userIds = null; | |
| 54 | - if (StrUtil.isNotEmpty(reqVO.getUsername())) { | |
| 55 | - userIds = convertSet(userService.getUsersByUsername(reqVO.getUsername()), SysUserDO::getId); | |
| 56 | - if (CollUtil.isEmpty(userIds)) { | |
| 57 | - return PageResult.empty(); | |
| 58 | - } | |
| 59 | - } | |
| 60 | - return userSessionMapper.selectPage(reqVO, userIds); | |
| 61 | - } | |
| 62 | - | |
| 63 | - // TODO @芋艿:优化下该方法 | |
| 64 | - @Override | |
| 65 | - public long clearSessionTimeout() { | |
| 66 | - // 获取db里已经超时的用户列表 | |
| 67 | - List<SysUserSessionDO> sessionTimeoutDOS = userSessionMapper.selectListBySessionTimoutLt(); | |
| 68 | - Map<String, SysUserSessionDO> timeoutSessionDOMap = sessionTimeoutDOS | |
| 69 | - .stream() | |
| 70 | - .filter(sessionDO -> loginUserCoreRedisDAO.get(sessionDO.getId()) == null) | |
| 71 | - .collect(Collectors.toMap(SysUserSessionDO::getId, o -> o)); | |
| 72 | - // 确认已经超时,按批次移出在线用户列表 | |
| 73 | - if (CollUtil.isNotEmpty(timeoutSessionDOMap)) { | |
| 74 | - Lists.partition(new ArrayList<>(timeoutSessionDOMap.keySet()), 100) | |
| 75 | - .forEach(userSessionMapper::deleteBatchIds); | |
| 76 | - // 记录用户超时退出日志 | |
| 77 | - createTimeoutLogoutLog(timeoutSessionDOMap.values()); | |
| 78 | - } | |
| 79 | - return timeoutSessionDOMap.size(); | |
| 80 | - } | |
| 81 | - | |
| 82 | - private void createTimeoutLogoutLog(Collection<SysUserSessionDO> timeoutSessionDOS) { | |
| 83 | - for (SysUserSessionDO timeoutSessionDO : timeoutSessionDOS) { | |
| 84 | - SysLoginLogCreateReqDTO reqDTO = new SysLoginLogCreateReqDTO(); | |
| 85 | - reqDTO.setLogType(SysLoginLogTypeEnum.LOGOUT_TIMEOUT.getType()); | |
| 86 | - reqDTO.setTraceId(TracerUtils.getTraceId()); | |
| 87 | - reqDTO.setUserId(timeoutSessionDO.getUserId()); | |
| 88 | - reqDTO.setUserType(timeoutSessionDO.getUserType()); | |
| 89 | - reqDTO.setUsername(timeoutSessionDO.getUsername()); | |
| 90 | - reqDTO.setUserAgent(timeoutSessionDO.getUserAgent()); | |
| 91 | - reqDTO.setUserIp(timeoutSessionDO.getUserIp()); | |
| 92 | - reqDTO.setResult(SysLoginResultEnum.SUCCESS.getResult()); | |
| 93 | - loginLogCoreService.createLoginLog(reqDTO); | |
| 94 | - } | |
| 95 | - } | |
| 96 | - | |
| 97 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/common/SysCaptchaService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.common; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.common.vo.SysCaptchaImageRespVO; | |
| 4 | - | |
| 5 | -/** | |
| 6 | - * 验证码 Service 接口 | |
| 7 | - */ | |
| 8 | -public interface SysCaptchaService { | |
| 9 | - | |
| 10 | - /** | |
| 11 | - * 获得验证码图片 | |
| 12 | - * | |
| 13 | - * @return 验证码图片 | |
| 14 | - */ | |
| 15 | - SysCaptchaImageRespVO getCaptchaImage(); | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 是否开启图片验证码 | |
| 19 | - * | |
| 20 | - * @return 是否 | |
| 21 | - */ | |
| 22 | - Boolean isCaptchaEnable(); | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 获得 uuid 对应的验证码 | |
| 26 | - * | |
| 27 | - * @param uuid 验证码编号 | |
| 28 | - * @return 验证码 | |
| 29 | - */ | |
| 30 | - String getCaptchaCode(String uuid); | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 删除 uuid 对应的验证码 | |
| 34 | - * | |
| 35 | - * @param uuid 验证码编号 | |
| 36 | - */ | |
| 37 | - void deleteCaptchaCode(String uuid); | |
| 38 | - | |
| 39 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/common/impl/SysCaptchaServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.common.impl; | |
| 2 | - | |
| 3 | -import cn.hutool.captcha.CaptchaUtil; | |
| 4 | -import cn.hutool.captcha.CircleCaptcha; | |
| 5 | -import cn.hutool.core.util.IdUtil; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.framework.captcha.config.CaptchaProperties; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.controller.common.vo.SysCaptchaImageRespVO; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.convert.common.SysCaptchaConvert; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.dal.redis.common.SysCaptchaRedisDAO; | |
| 10 | -import cn.iocoder.yudao.adminserver.modules.system.service.common.SysCaptchaService; | |
| 11 | -import org.springframework.stereotype.Service; | |
| 12 | - | |
| 13 | -import javax.annotation.Resource; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * 验证码 Service 实现类 | |
| 17 | - */ | |
| 18 | -@Service | |
| 19 | -public class SysCaptchaServiceImpl implements SysCaptchaService { | |
| 20 | - | |
| 21 | - @Resource | |
| 22 | - private CaptchaProperties captchaProperties; | |
| 23 | - | |
| 24 | - @Resource | |
| 25 | - private SysCaptchaRedisDAO captchaRedisDAO; | |
| 26 | - | |
| 27 | - @Override | |
| 28 | - public SysCaptchaImageRespVO getCaptchaImage() { | |
| 29 | - // 生成验证码 | |
| 30 | - CircleCaptcha captcha = CaptchaUtil.createCircleCaptcha(captchaProperties.getWidth(), captchaProperties.getHeight()); | |
| 31 | - // 缓存到 Redis 中 | |
| 32 | - String uuid = IdUtil.fastSimpleUUID(); | |
| 33 | - captchaRedisDAO.set(uuid, captcha.getCode(), captchaProperties.getTimeout()); | |
| 34 | - // 返回 | |
| 35 | - return SysCaptchaConvert.INSTANCE.convert(uuid, captcha); | |
| 36 | - } | |
| 37 | - | |
| 38 | - @Override | |
| 39 | - public Boolean isCaptchaEnable() { | |
| 40 | - return captchaProperties.getEnable(); | |
| 41 | - } | |
| 42 | - | |
| 43 | - @Override | |
| 44 | - public String getCaptchaCode(String uuid) { | |
| 45 | - return captchaRedisDAO.get(uuid); | |
| 46 | - } | |
| 47 | - | |
| 48 | - @Override | |
| 49 | - public void deleteCaptchaCode(String uuid) { | |
| 50 | - captchaRedisDAO.delete(uuid); | |
| 51 | - } | |
| 52 | - | |
| 53 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dept/SysDeptService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.dept; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.dept.SysDeptCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.dept.SysDeptListReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.dept.SysDeptUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; | |
| 8 | -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 9 | - | |
| 10 | -import java.util.Collection; | |
| 11 | -import java.util.Collections; | |
| 12 | -import java.util.List; | |
| 13 | -import java.util.Map; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * 部门 Service 接口 | |
| 17 | - * | |
| 18 | - * @author 芋道源码 | |
| 19 | - */ | |
| 20 | -public interface SysDeptService { | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 初始化部门的本地缓存 | |
| 24 | - */ | |
| 25 | - void initLocalCache(); | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 创建部门 | |
| 29 | - * | |
| 30 | - * @param reqVO 部门信息 | |
| 31 | - * @return 部门编号 | |
| 32 | - */ | |
| 33 | - Long createDept(SysDeptCreateReqVO reqVO); | |
| 34 | - | |
| 35 | - /** | |
| 36 | - * 更新部门 | |
| 37 | - * | |
| 38 | - * @param reqVO 部门信息 | |
| 39 | - */ | |
| 40 | - void updateDept(SysDeptUpdateReqVO reqVO); | |
| 41 | - | |
| 42 | - /** | |
| 43 | - * 删除部门 | |
| 44 | - * | |
| 45 | - * @param id 部门编号 | |
| 46 | - */ | |
| 47 | - void deleteDept(Long id); | |
| 48 | - | |
| 49 | - | |
| 50 | - /** | |
| 51 | - * 筛选部门列表 | |
| 52 | - * | |
| 53 | - * @param reqVO 筛选条件请求 VO | |
| 54 | - * @return 部门列表 | |
| 55 | - */ | |
| 56 | - List<SysDeptDO> getSimpleDepts(SysDeptListReqVO reqVO); | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * 获得所有子部门,从缓存中 | |
| 60 | - * | |
| 61 | - * @param parentId 部门编号 | |
| 62 | - * @param recursive 是否递归获取所有 | |
| 63 | - * @return 子部门列表 | |
| 64 | - */ | |
| 65 | - List<SysDeptDO> getDeptsByParentIdFromCache(Long parentId, boolean recursive); | |
| 66 | - | |
| 67 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dept/SysPostService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.dept; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post.SysPostCreateReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post.SysPostExportReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post.SysPostPageReqVO; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post.SysPostUpdateReqVO; | |
| 9 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; | |
| 10 | -import org.springframework.lang.Nullable; | |
| 11 | - | |
| 12 | -import java.util.Collection; | |
| 13 | -import java.util.List; | |
| 14 | - | |
| 15 | -import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet; | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * 岗位 Service 接口 | |
| 19 | - * | |
| 20 | - * @author 芋道源码 | |
| 21 | - */ | |
| 22 | -public interface SysPostService { | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 创建岗位 | |
| 26 | - * | |
| 27 | - * @param reqVO 岗位信息 | |
| 28 | - * @return 岗位编号 | |
| 29 | - */ | |
| 30 | - Long createPost(SysPostCreateReqVO reqVO); | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 更新岗位 | |
| 34 | - * | |
| 35 | - * @param reqVO 岗位信息 | |
| 36 | - */ | |
| 37 | - void updatePost(SysPostUpdateReqVO reqVO); | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 删除岗位信息 | |
| 41 | - * | |
| 42 | - * @param id 岗位编号 | |
| 43 | - */ | |
| 44 | - void deletePost(Long id); | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 获得岗位列表 | |
| 48 | - * | |
| 49 | - * @param ids 岗位编号数组。如果为空,不进行筛选 | |
| 50 | - * @return 部门列表 | |
| 51 | - */ | |
| 52 | - default List<SysPostDO> getPosts(@Nullable Collection<Long> ids) { | |
| 53 | - return getPosts(ids, asSet(CommonStatusEnum.ENABLE.getStatus(), CommonStatusEnum.DISABLE.getStatus())); | |
| 54 | - } | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * 获得符合条件的岗位列表 | |
| 58 | - * | |
| 59 | - * @param ids 岗位编号数组。如果为空,不进行筛选 | |
| 60 | - * @param statuses 状态数组。如果为空,不进行筛选 | |
| 61 | - * @return 部门列表 | |
| 62 | - */ | |
| 63 | - List<SysPostDO> getPosts(@Nullable Collection<Long> ids, @Nullable Collection<Integer> statuses); | |
| 64 | - | |
| 65 | - /** | |
| 66 | - * 获得岗位分页列表 | |
| 67 | - * | |
| 68 | - * @param reqVO 分页条件 | |
| 69 | - * @return 部门分页列表 | |
| 70 | - */ | |
| 71 | - PageResult<SysPostDO> getPostPage(SysPostPageReqVO reqVO); | |
| 72 | - | |
| 73 | - /** | |
| 74 | - * 获得岗位列表 | |
| 75 | - * | |
| 76 | - * @param reqVO 查询条件 | |
| 77 | - * @return 部门列表 | |
| 78 | - */ | |
| 79 | - List<SysPostDO> getPosts(SysPostExportReqVO reqVO); | |
| 80 | - | |
| 81 | - /** | |
| 82 | - * 获得岗位信息 | |
| 83 | - * | |
| 84 | - * @param id 岗位编号 | |
| 85 | - * @return 岗位信息 | |
| 86 | - */ | |
| 87 | - SysPostDO getPost(Long id); | |
| 88 | - | |
| 89 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dept/impl/SysPostServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.dept.impl; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post.SysPostCreateReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post.SysPostExportReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post.SysPostPageReqVO; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post.SysPostUpdateReqVO; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.convert.dept.SysPostConvert; | |
| 10 | -import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.dept.SysPostMapper; | |
| 11 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; | |
| 12 | -import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysPostService; | |
| 13 | -import org.springframework.stereotype.Service; | |
| 14 | -import org.springframework.validation.annotation.Validated; | |
| 15 | - | |
| 16 | -import javax.annotation.Resource; | |
| 17 | -import java.util.Collection; | |
| 18 | -import java.util.List; | |
| 19 | - | |
| 20 | -import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.*; | |
| 21 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 22 | - | |
| 23 | -/** | |
| 24 | - * 岗位 Service 实现类 | |
| 25 | - * | |
| 26 | - * @author 芋道源码 | |
| 27 | - */ | |
| 28 | -@Service | |
| 29 | -@Validated | |
| 30 | -public class SysPostServiceImpl implements SysPostService { | |
| 31 | - | |
| 32 | - @Resource | |
| 33 | - private SysPostMapper postMapper; | |
| 34 | - | |
| 35 | - @Override | |
| 36 | - public Long createPost(SysPostCreateReqVO reqVO) { | |
| 37 | - // 校验正确性 | |
| 38 | - this.checkCreateOrUpdate(null, reqVO.getName(), reqVO.getCode()); | |
| 39 | - // 插入岗位 | |
| 40 | - SysPostDO post = SysPostConvert.INSTANCE.convert(reqVO); | |
| 41 | - postMapper.insert(post); | |
| 42 | - return post.getId(); | |
| 43 | - } | |
| 44 | - | |
| 45 | - @Override | |
| 46 | - public void updatePost(SysPostUpdateReqVO reqVO) { | |
| 47 | - // 校验正确性 | |
| 48 | - this.checkCreateOrUpdate(reqVO.getId(), reqVO.getName(), reqVO.getCode()); | |
| 49 | - // 更新岗位 | |
| 50 | - SysPostDO updateObj = SysPostConvert.INSTANCE.convert(reqVO); | |
| 51 | - postMapper.updateById(updateObj); | |
| 52 | - } | |
| 53 | - | |
| 54 | - @Override | |
| 55 | - public void deletePost(Long id) { | |
| 56 | - // 校验是否存在 | |
| 57 | - this.checkPostExists(id); | |
| 58 | - // 删除部门 | |
| 59 | - postMapper.deleteById(id); | |
| 60 | - } | |
| 61 | - | |
| 62 | - @Override | |
| 63 | - public List<SysPostDO> getPosts(Collection<Long> ids, Collection<Integer> statuses) { | |
| 64 | - return postMapper.selectList(ids, statuses); | |
| 65 | - } | |
| 66 | - | |
| 67 | - @Override | |
| 68 | - public PageResult<SysPostDO> getPostPage(SysPostPageReqVO reqVO) { | |
| 69 | - return postMapper.selectPage(reqVO); | |
| 70 | - } | |
| 71 | - | |
| 72 | - @Override | |
| 73 | - public List<SysPostDO> getPosts(SysPostExportReqVO reqVO) { | |
| 74 | - return postMapper.selectList(reqVO); | |
| 75 | - } | |
| 76 | - | |
| 77 | - @Override | |
| 78 | - public SysPostDO getPost(Long id) { | |
| 79 | - return postMapper.selectById(id); | |
| 80 | - } | |
| 81 | - | |
| 82 | - private void checkCreateOrUpdate(Long id, String name, String code) { | |
| 83 | - // 校验自己存在 | |
| 84 | - checkPostExists(id); | |
| 85 | - // 校验岗位名的唯一性 | |
| 86 | - checkPostNameUnique(id, name); | |
| 87 | - // 校验岗位编码的唯一性 | |
| 88 | - checkPostCodeUnique(id, code); | |
| 89 | - } | |
| 90 | - | |
| 91 | - private void checkPostNameUnique(Long id, String name) { | |
| 92 | - SysPostDO post = postMapper.selectByName(name); | |
| 93 | - if (post == null) { | |
| 94 | - return; | |
| 95 | - } | |
| 96 | - // 如果 id 为空,说明不用比较是否为相同 id 的岗位 | |
| 97 | - if (id == null) { | |
| 98 | - throw ServiceExceptionUtil.exception(POST_NAME_DUPLICATE); | |
| 99 | - } | |
| 100 | - if (!post.getId().equals(id)) { | |
| 101 | - throw ServiceExceptionUtil.exception(POST_NAME_DUPLICATE); | |
| 102 | - } | |
| 103 | - } | |
| 104 | - | |
| 105 | - private void checkPostCodeUnique(Long id, String code) { | |
| 106 | - SysPostDO post = postMapper.selectByCode(code); | |
| 107 | - if (post == null) { | |
| 108 | - return; | |
| 109 | - } | |
| 110 | - // 如果 id 为空,说明不用比较是否为相同 id 的岗位 | |
| 111 | - if (id == null) { | |
| 112 | - throw ServiceExceptionUtil.exception(POST_CODE_DUPLICATE); | |
| 113 | - } | |
| 114 | - if (!post.getId().equals(id)) { | |
| 115 | - throw ServiceExceptionUtil.exception(POST_CODE_DUPLICATE); | |
| 116 | - } | |
| 117 | - } | |
| 118 | - | |
| 119 | - private void checkPostExists(Long id) { | |
| 120 | - if (id == null) { | |
| 121 | - return; | |
| 122 | - } | |
| 123 | - SysPostDO post = postMapper.selectById(id); | |
| 124 | - if (post == null) { | |
| 125 | - throw ServiceExceptionUtil.exception(POST_NOT_FOUND); | |
| 126 | - } | |
| 127 | - } | |
| 128 | - | |
| 129 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dict/SysDictDataService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.dict; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.framework.dict.core.service.DictDataFrameworkService; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.SysDictDataCreateReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.SysDictDataExportReqVO; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.SysDictDataPageReqVO; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.SysDictDataUpdateReqVO; | |
| 10 | - | |
| 11 | -import java.util.Collection; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 字典数据 Service 接口 | |
| 16 | - * | |
| 17 | - * @author ruoyi | |
| 18 | - */ | |
| 19 | -public interface SysDictDataService { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 创建字典数据 | |
| 23 | - * | |
| 24 | - * @param reqVO 字典数据信息 | |
| 25 | - * @return 字典数据编号 | |
| 26 | - */ | |
| 27 | - Long createDictData(SysDictDataCreateReqVO reqVO); | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 更新字典数据 | |
| 31 | - * | |
| 32 | - * @param reqVO 字典数据信息 | |
| 33 | - */ | |
| 34 | - void updateDictData(SysDictDataUpdateReqVO reqVO); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 删除字典数据 | |
| 38 | - * | |
| 39 | - * @param id 字典数据编号 | |
| 40 | - */ | |
| 41 | - void deleteDictData(Long id); | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * 获得字典数据列表 | |
| 45 | - * | |
| 46 | - * @return 字典数据全列表 | |
| 47 | - */ | |
| 48 | - List<SysDictDataDO> getDictDatas(); | |
| 49 | - | |
| 50 | - /** | |
| 51 | - * 获得字典数据分页列表 | |
| 52 | - * | |
| 53 | - * @param reqVO 分页请求 | |
| 54 | - * @return 字典数据分页列表 | |
| 55 | - */ | |
| 56 | - PageResult<SysDictDataDO> getDictDataPage(SysDictDataPageReqVO reqVO); | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * 获得字典数据列表 | |
| 60 | - * | |
| 61 | - * @param reqVO 列表请求 | |
| 62 | - * @return 字典数据列表 | |
| 63 | - */ | |
| 64 | - List<SysDictDataDO> getDictDatas(SysDictDataExportReqVO reqVO); | |
| 65 | - | |
| 66 | - /** | |
| 67 | - * 获得字典数据详情 | |
| 68 | - * | |
| 69 | - * @param id 字典数据编号 | |
| 70 | - * @return 字典数据 | |
| 71 | - */ | |
| 72 | - SysDictDataDO getDictData(Long id); | |
| 73 | - | |
| 74 | - /** | |
| 75 | - * 获得指定字典类型的数据数量 | |
| 76 | - * | |
| 77 | - * @param dictType 字典类型 | |
| 78 | - * @return 数据数量 | |
| 79 | - */ | |
| 80 | - int countByDictType(String dictType); | |
| 81 | - | |
| 82 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dict/SysDictTypeService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.dict; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.type.SysDictTypeExportReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.type.SysDictTypePageReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dict.SysDictTypeDO; | |
| 9 | - | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 字典类型 Service 接口 | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -public interface SysDictTypeService { | |
| 18 | - | |
| 19 | - /** | |
| 20 | - * 创建字典类型 | |
| 21 | - * | |
| 22 | - * @param reqVO 字典类型信息 | |
| 23 | - * @return 字典类型编号 | |
| 24 | - */ | |
| 25 | - Long createDictType(SysDictTypeCreateReqVO reqVO); | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 更新字典类型 | |
| 29 | - * | |
| 30 | - * @param reqVO 字典类型信息 | |
| 31 | - */ | |
| 32 | - void updateDictType(SysDictTypeUpdateReqVO reqVO); | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * 删除字典类型 | |
| 36 | - * | |
| 37 | - * @param id 字典类型编号 | |
| 38 | - */ | |
| 39 | - void deleteDictType(Long id); | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * 获得字典类型分页列表 | |
| 43 | - * | |
| 44 | - * @param reqVO 分页请求 | |
| 45 | - * @return 字典类型分页列表 | |
| 46 | - */ | |
| 47 | - PageResult<SysDictTypeDO> getDictTypePage(SysDictTypePageReqVO reqVO); | |
| 48 | - | |
| 49 | - /** | |
| 50 | - * 获得字典类型列表 | |
| 51 | - * | |
| 52 | - * @param reqVO 列表请求 | |
| 53 | - * @return 字典类型列表 | |
| 54 | - */ | |
| 55 | - List<SysDictTypeDO> getDictTypeList(SysDictTypeExportReqVO reqVO); | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * 获得字典类型详情 | |
| 59 | - * | |
| 60 | - * @param id 字典类型编号 | |
| 61 | - * @return 字典类型 | |
| 62 | - */ | |
| 63 | - SysDictTypeDO getDictType(Long id); | |
| 64 | - | |
| 65 | - /** | |
| 66 | - * 获得字典类型详情 | |
| 67 | - * | |
| 68 | - * @param type 字典类型 | |
| 69 | - * @return 字典类型详情 | |
| 70 | - */ | |
| 71 | - SysDictTypeDO getDictType(String type); | |
| 72 | - | |
| 73 | - /** | |
| 74 | - * 获得全部字典类型列表 | |
| 75 | - * | |
| 76 | - * @return 字典类型列表 | |
| 77 | - */ | |
| 78 | - List<SysDictTypeDO> getDictTypeList(); | |
| 79 | - | |
| 80 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/dict/impl/SysDictTypeServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.dict.impl; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.type.SysDictTypeExportReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.type.SysDictTypePageReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.convert.dict.SysDictTypeConvert; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dict.SysDictTypeDO; | |
| 10 | -import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.dict.SysDictTypeMapper; | |
| 11 | -import cn.iocoder.yudao.adminserver.modules.system.service.dict.SysDictDataService; | |
| 12 | -import cn.iocoder.yudao.adminserver.modules.system.service.dict.SysDictTypeService; | |
| 13 | -import com.google.common.annotations.VisibleForTesting; | |
| 14 | -import org.springframework.stereotype.Service; | |
| 15 | - | |
| 16 | -import javax.annotation.Resource; | |
| 17 | -import java.util.List; | |
| 18 | - | |
| 19 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 20 | -import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.*; | |
| 21 | - | |
| 22 | -/** | |
| 23 | - * 字典类型 Service 实现类 | |
| 24 | - * | |
| 25 | - * @author 芋道源码 | |
| 26 | - */ | |
| 27 | -@Service | |
| 28 | -public class SysDictTypeServiceImpl implements SysDictTypeService { | |
| 29 | - | |
| 30 | - @Resource | |
| 31 | - private SysDictDataService dictDataService; | |
| 32 | - | |
| 33 | - @Resource | |
| 34 | - private SysDictTypeMapper dictTypeMapper; | |
| 35 | - | |
| 36 | - @Override | |
| 37 | - public PageResult<SysDictTypeDO> getDictTypePage(SysDictTypePageReqVO reqVO) { | |
| 38 | - return dictTypeMapper.selectPage(reqVO); | |
| 39 | - } | |
| 40 | - | |
| 41 | - @Override | |
| 42 | - public List<SysDictTypeDO> getDictTypeList(SysDictTypeExportReqVO reqVO) { | |
| 43 | - return dictTypeMapper.selectList(reqVO); | |
| 44 | - } | |
| 45 | - | |
| 46 | - @Override | |
| 47 | - public SysDictTypeDO getDictType(Long id) { | |
| 48 | - return dictTypeMapper.selectById(id); | |
| 49 | - } | |
| 50 | - | |
| 51 | - @Override | |
| 52 | - public SysDictTypeDO getDictType(String type) { | |
| 53 | - return dictTypeMapper.selectByType(type); | |
| 54 | - } | |
| 55 | - | |
| 56 | - @Override | |
| 57 | - public Long createDictType(SysDictTypeCreateReqVO reqVO) { | |
| 58 | - // 校验正确性 | |
| 59 | - this.checkCreateOrUpdate(null, reqVO.getName(), reqVO.getType()); | |
| 60 | - // 插入字典类型 | |
| 61 | - SysDictTypeDO dictType = SysDictTypeConvert.INSTANCE.convert(reqVO); | |
| 62 | - dictTypeMapper.insert(dictType); | |
| 63 | - return dictType.getId(); | |
| 64 | - } | |
| 65 | - | |
| 66 | - @Override | |
| 67 | - public void updateDictType(SysDictTypeUpdateReqVO reqVO) { | |
| 68 | - // 校验正确性 | |
| 69 | - this.checkCreateOrUpdate(reqVO.getId(), reqVO.getName(), null); | |
| 70 | - // 更新字典类型 | |
| 71 | - SysDictTypeDO updateObj = SysDictTypeConvert.INSTANCE.convert(reqVO); | |
| 72 | - dictTypeMapper.updateById(updateObj); | |
| 73 | - } | |
| 74 | - | |
| 75 | - @Override | |
| 76 | - public void deleteDictType(Long id) { | |
| 77 | - // 校验是否存在 | |
| 78 | - SysDictTypeDO dictType = this.checkDictTypeExists(id); | |
| 79 | - // 校验是否有字典数据 | |
| 80 | - if (dictDataService.countByDictType(dictType.getType()) > 0) { | |
| 81 | - throw exception(DICT_TYPE_HAS_CHILDREN); | |
| 82 | - } | |
| 83 | - // 删除字典类型 | |
| 84 | - dictTypeMapper.deleteById(id); | |
| 85 | - } | |
| 86 | - | |
| 87 | - @Override | |
| 88 | - public List<SysDictTypeDO> getDictTypeList() { | |
| 89 | - return dictTypeMapper.selectList(); | |
| 90 | - } | |
| 91 | - | |
| 92 | - private void checkCreateOrUpdate(Long id, String name, String type) { | |
| 93 | - // 校验自己存在 | |
| 94 | - checkDictTypeExists(id); | |
| 95 | - // 校验字典类型的名字的唯一性 | |
| 96 | - checkDictTypeNameUnique(id, name); | |
| 97 | - // 校验字典类型的类型的唯一性 | |
| 98 | - checkDictTypeUnique(id, type); | |
| 99 | - } | |
| 100 | - | |
| 101 | - @VisibleForTesting | |
| 102 | - public void checkDictTypeNameUnique(Long id, String name) { | |
| 103 | - SysDictTypeDO dictType = dictTypeMapper.selectByName(name); | |
| 104 | - if (dictType == null) { | |
| 105 | - return; | |
| 106 | - } | |
| 107 | - // 如果 id 为空,说明不用比较是否为相同 id 的字典类型 | |
| 108 | - if (id == null) { | |
| 109 | - throw exception(DICT_TYPE_NAME_DUPLICATE); | |
| 110 | - } | |
| 111 | - if (!dictType.getId().equals(id)) { | |
| 112 | - throw exception(DICT_TYPE_NAME_DUPLICATE); | |
| 113 | - } | |
| 114 | - } | |
| 115 | - | |
| 116 | - @VisibleForTesting | |
| 117 | - public void checkDictTypeUnique(Long id, String type) { | |
| 118 | - SysDictTypeDO dictType = dictTypeMapper.selectByType(type); | |
| 119 | - if (dictType == null) { | |
| 120 | - return; | |
| 121 | - } | |
| 122 | - // 如果 id 为空,说明不用比较是否为相同 id 的字典类型 | |
| 123 | - if (id == null) { | |
| 124 | - throw exception(DICT_TYPE_TYPE_DUPLICATE); | |
| 125 | - } | |
| 126 | - if (!dictType.getId().equals(id)) { | |
| 127 | - throw exception(DICT_TYPE_TYPE_DUPLICATE); | |
| 128 | - } | |
| 129 | - } | |
| 130 | - | |
| 131 | - @VisibleForTesting | |
| 132 | - public SysDictTypeDO checkDictTypeExists(Long id) { | |
| 133 | - if (id == null) { | |
| 134 | - return null; | |
| 135 | - } | |
| 136 | - SysDictTypeDO dictType = dictTypeMapper.selectById(id); | |
| 137 | - if (dictType == null) { | |
| 138 | - throw exception(DICT_TYPE_NOT_EXISTS); | |
| 139 | - } | |
| 140 | - return dictType; | |
| 141 | - } | |
| 142 | - | |
| 143 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/errorcode/SysErrorCodeService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.errorcode; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.service.ErrorCodeFrameworkService; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.errorcode.vo.SysErrorCodeCreateReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.errorcode.vo.SysErrorCodeExportReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.controller.errorcode.vo.SysErrorCodePageReqVO; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.controller.errorcode.vo.SysErrorCodeUpdateReqVO; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.errorcode.SysErrorCodeDO; | |
| 10 | - | |
| 11 | -import javax.validation.Valid; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 错误码 Service 接口 | |
| 16 | - * | |
| 17 | - * @author 芋道源码 | |
| 18 | - */ | |
| 19 | -public interface SysErrorCodeService extends ErrorCodeFrameworkService { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 创建错误码 | |
| 23 | - * | |
| 24 | - * @param createReqVO 创建信息 | |
| 25 | - * @return 编号 | |
| 26 | - */ | |
| 27 | - Long createErrorCode(@Valid SysErrorCodeCreateReqVO createReqVO); | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 更新错误码 | |
| 31 | - * | |
| 32 | - * @param updateReqVO 更新信息 | |
| 33 | - */ | |
| 34 | - void updateErrorCode(@Valid SysErrorCodeUpdateReqVO updateReqVO); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 删除错误码 | |
| 38 | - * | |
| 39 | - * @param id 编号 | |
| 40 | - */ | |
| 41 | - void deleteErrorCode(Long id); | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * 获得错误码 | |
| 45 | - * | |
| 46 | - * @param id 编号 | |
| 47 | - * @return 错误码 | |
| 48 | - */ | |
| 49 | - SysErrorCodeDO getErrorCode(Long id); | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * 获得错误码分页 | |
| 53 | - * | |
| 54 | - * @param pageReqVO 分页查询 | |
| 55 | - * @return 错误码分页 | |
| 56 | - */ | |
| 57 | - PageResult<SysErrorCodeDO> getErrorCodePage(SysErrorCodePageReqVO pageReqVO); | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * 获得错误码列表, 用于 Excel 导出 | |
| 61 | - * | |
| 62 | - * @param exportReqVO 查询条件 | |
| 63 | - * @return 错误码列表 | |
| 64 | - */ | |
| 65 | - List<SysErrorCodeDO> getErrorCodeList(SysErrorCodeExportReqVO exportReqVO); | |
| 66 | - | |
| 67 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/logger/SysLoginLogService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.logger; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO; | |
| 5 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 7 | - | |
| 8 | -import java.util.List; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 登录日志 Service 接口 | |
| 12 | - */ | |
| 13 | -public interface SysLoginLogService { | |
| 14 | - | |
| 15 | - /** | |
| 16 | - * 获得登录日志分页 | |
| 17 | - * | |
| 18 | - * @param reqVO 分页条件 | |
| 19 | - * @return 登录日志分页 | |
| 20 | - */ | |
| 21 | - PageResult<SysLoginLogDO> getLoginLogPage(SysLoginLogPageReqVO reqVO); | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * 获得登录日志列表 | |
| 25 | - * | |
| 26 | - * @param reqVO 列表条件 | |
| 27 | - * @return 登录日志列表 | |
| 28 | - */ | |
| 29 | - List<SysLoginLogDO> getLoginLogList(SysLoginLogExportReqVO reqVO); | |
| 30 | - | |
| 31 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/logger/SysOperateLogService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.logger; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.operatelog.core.service.OperateLogFrameworkService; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.logger.SysOperateLogDO; | |
| 8 | - | |
| 9 | -import java.util.List; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 操作日志 Service 接口 | |
| 13 | - */ | |
| 14 | -public interface SysOperateLogService extends OperateLogFrameworkService { | |
| 15 | - | |
| 16 | - /** | |
| 17 | - * 获得操作日志分页列表 | |
| 18 | - * | |
| 19 | - * @param reqVO 分页条件 | |
| 20 | - * @return 操作日志分页列表 | |
| 21 | - */ | |
| 22 | - PageResult<SysOperateLogDO> getOperateLogPage(SysOperateLogPageReqVO reqVO); | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 获得操作日志列表 | |
| 26 | - * | |
| 27 | - * @param reqVO 列表条件 | |
| 28 | - * @return 日志列表 | |
| 29 | - */ | |
| 30 | - List<SysOperateLogDO> getOperateLogs(SysOperateLogExportReqVO reqVO); | |
| 31 | - | |
| 32 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/logger/impl/SysLoginLogServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.logger.impl; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.logger.SysLoginLogMapper; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.service.logger.SysLoginLogService; | |
| 7 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; | |
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | -import org.springframework.stereotype.Service; | |
| 10 | - | |
| 11 | -import javax.annotation.Resource; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 登录日志 Service 实现 | |
| 16 | - */ | |
| 17 | -@Service | |
| 18 | -public class SysLoginLogServiceImpl implements SysLoginLogService { | |
| 19 | - | |
| 20 | - @Resource | |
| 21 | - private SysLoginLogMapper loginLogMapper; | |
| 22 | - | |
| 23 | - @Override | |
| 24 | - public PageResult<SysLoginLogDO> getLoginLogPage(SysLoginLogPageReqVO reqVO) { | |
| 25 | - return loginLogMapper.selectPage(reqVO); | |
| 26 | - } | |
| 27 | - | |
| 28 | - @Override | |
| 29 | - public List<SysLoginLogDO> getLoginLogList(SysLoginLogExportReqVO reqVO) { | |
| 30 | - return loginLogMapper.selectList(reqVO); | |
| 31 | - } | |
| 32 | - | |
| 33 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/logger/impl/SysOperateLogServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.logger.impl; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.util.StrUtil; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.convert.logger.SysOperateLogConvert; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.logger.SysOperateLogDO; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.logger.SysOperateLogMapper; | |
| 10 | -import cn.iocoder.yudao.adminserver.modules.system.service.logger.SysOperateLogService; | |
| 11 | -import cn.iocoder.yudao.adminserver.modules.system.service.user.SysUserService; | |
| 12 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; | |
| 13 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 14 | -import cn.iocoder.yudao.framework.common.util.string.StrUtils; | |
| 15 | -import cn.iocoder.yudao.framework.operatelog.core.dto.OperateLogCreateReqDTO; | |
| 16 | -import lombok.extern.slf4j.Slf4j; | |
| 17 | -import org.springframework.scheduling.annotation.Async; | |
| 18 | -import org.springframework.scheduling.annotation.AsyncResult; | |
| 19 | -import org.springframework.stereotype.Service; | |
| 20 | - | |
| 21 | -import javax.annotation.Resource; | |
| 22 | -import java.util.Collection; | |
| 23 | -import java.util.Collections; | |
| 24 | -import java.util.List; | |
| 25 | -import java.util.concurrent.Future; | |
| 26 | - | |
| 27 | -import static cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.logger.SysOperateLogDO.JAVA_METHOD_ARGS_MAX_LENGTH; | |
| 28 | -import static cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.logger.SysOperateLogDO.RESULT_MAX_LENGTH; | |
| 29 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 30 | - | |
| 31 | -@Service | |
| 32 | -@Slf4j | |
| 33 | -public class SysOperateLogServiceImpl implements SysOperateLogService { | |
| 34 | - | |
| 35 | - @Resource | |
| 36 | - private SysOperateLogMapper operateLogMapper; | |
| 37 | - | |
| 38 | - @Resource | |
| 39 | - private SysUserService userService; | |
| 40 | - | |
| 41 | - @Override | |
| 42 | - @Async | |
| 43 | - public Future<Boolean> createOperateLogAsync(OperateLogCreateReqDTO reqVO) { | |
| 44 | - boolean success = false; | |
| 45 | - try { | |
| 46 | - SysOperateLogDO logDO = SysOperateLogConvert.INSTANCE.convert(reqVO); | |
| 47 | - logDO.setJavaMethodArgs(StrUtils.maxLength(logDO.getJavaMethodArgs(), JAVA_METHOD_ARGS_MAX_LENGTH)); | |
| 48 | - logDO.setResultData(StrUtils.maxLength(logDO.getResultData(), RESULT_MAX_LENGTH)); | |
| 49 | - success = operateLogMapper.insert(logDO) == 1; | |
| 50 | - } catch (Throwable throwable) { | |
| 51 | - // 仅仅打印日志,不对外抛出。原因是,还是要保留现场数据。 | |
| 52 | - log.error("[createOperateLogAsync][记录操作日志异常,日志为 ({})]", reqVO, throwable); | |
| 53 | - } | |
| 54 | - return new AsyncResult<>(success); | |
| 55 | - } | |
| 56 | - | |
| 57 | - @Override | |
| 58 | - public PageResult<SysOperateLogDO> getOperateLogPage(SysOperateLogPageReqVO reqVO) { | |
| 59 | - // 处理基于用户昵称的查询 | |
| 60 | - Collection<Long> userIds = null; | |
| 61 | - if (StrUtil.isNotEmpty(reqVO.getUserNickname())) { | |
| 62 | - userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), SysUserDO::getId); | |
| 63 | - if (CollUtil.isEmpty(userIds)) { | |
| 64 | - return PageResult.empty(); | |
| 65 | - } | |
| 66 | - } | |
| 67 | - // 查询分页 | |
| 68 | - return operateLogMapper.selectPage(reqVO, userIds); | |
| 69 | - } | |
| 70 | - | |
| 71 | - @Override | |
| 72 | - public List<SysOperateLogDO> getOperateLogs(SysOperateLogExportReqVO reqVO) { | |
| 73 | - // 处理基于用户昵称的查询 | |
| 74 | - Collection<Long> userIds = null; | |
| 75 | - if (StrUtil.isNotEmpty(reqVO.getUserNickname())) { | |
| 76 | - userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), SysUserDO::getId); | |
| 77 | - if (CollUtil.isEmpty(userIds)) { | |
| 78 | - return Collections.emptyList(); | |
| 79 | - } | |
| 80 | - } | |
| 81 | - // 查询列表 | |
| 82 | - return operateLogMapper.selectList(reqVO, userIds); | |
| 83 | - } | |
| 84 | - | |
| 85 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/notice/SysNoticeService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.notice; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticeCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticePageReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticeUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.notice.SysNoticeDO; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * 通知公告 Service 接口 | |
| 11 | - */ | |
| 12 | -public interface SysNoticeService { | |
| 13 | - | |
| 14 | - /** | |
| 15 | - * 创建岗位公告公告 | |
| 16 | - * | |
| 17 | - * @param reqVO 岗位公告公告信息 | |
| 18 | - * @return 岗位公告公告编号 | |
| 19 | - */ | |
| 20 | - Long createNotice(SysNoticeCreateReqVO reqVO); | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 更新岗位公告公告 | |
| 24 | - * | |
| 25 | - * @param reqVO 岗位公告公告信息 | |
| 26 | - */ | |
| 27 | - void updateNotice(SysNoticeUpdateReqVO reqVO); | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 删除岗位公告公告信息 | |
| 31 | - * | |
| 32 | - * @param id 岗位公告公告编号 | |
| 33 | - */ | |
| 34 | - void deleteNotice(Long id); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 获得岗位公告公告分页列表 | |
| 38 | - * | |
| 39 | - * @param reqVO 分页条件 | |
| 40 | - * @return 部门分页列表 | |
| 41 | - */ | |
| 42 | - PageResult<SysNoticeDO> pageNotices(SysNoticePageReqVO reqVO); | |
| 43 | - | |
| 44 | - /** | |
| 45 | - * 获得岗位公告公告信息 | |
| 46 | - * | |
| 47 | - * @param id 岗位公告公告编号 | |
| 48 | - * @return 岗位公告公告信息 | |
| 49 | - */ | |
| 50 | - SysNoticeDO getNotice(Long id); | |
| 51 | - | |
| 52 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/notice/impl/SysNoticeServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.notice.impl; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticeCreateReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticePageReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticeUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.convert.notice.SysNoticeConvert; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.notice.SysNoticeMapper; | |
| 10 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.notice.SysNoticeDO; | |
| 11 | -import cn.iocoder.yudao.adminserver.modules.system.service.notice.SysNoticeService; | |
| 12 | -import com.google.common.annotations.VisibleForTesting; | |
| 13 | -import org.springframework.stereotype.Service; | |
| 14 | - | |
| 15 | -import javax.annotation.Resource; | |
| 16 | - | |
| 17 | -import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.NOTICE_NOT_FOUND; | |
| 18 | - | |
| 19 | -/** | |
| 20 | - * 通知公告 Service 实现类 | |
| 21 | - * | |
| 22 | - * @author 芋道源码 | |
| 23 | - */ | |
| 24 | -@Service | |
| 25 | -public class SysNoticeServiceImpl implements SysNoticeService { | |
| 26 | - | |
| 27 | - @Resource | |
| 28 | - private SysNoticeMapper noticeMapper; | |
| 29 | - | |
| 30 | - @Override | |
| 31 | - public Long createNotice(SysNoticeCreateReqVO reqVO) { | |
| 32 | - SysNoticeDO notice = SysNoticeConvert.INSTANCE.convert(reqVO); | |
| 33 | - noticeMapper.insert(notice); | |
| 34 | - return notice.getId(); | |
| 35 | - } | |
| 36 | - | |
| 37 | - @Override | |
| 38 | - public void updateNotice(SysNoticeUpdateReqVO reqVO) { | |
| 39 | - // 校验是否存在 | |
| 40 | - this.checkNoticeExists(reqVO.getId()); | |
| 41 | - // 更新通知公告 | |
| 42 | - SysNoticeDO updateObj = SysNoticeConvert.INSTANCE.convert(reqVO); | |
| 43 | - noticeMapper.updateById(updateObj); | |
| 44 | - } | |
| 45 | - | |
| 46 | - @Override | |
| 47 | - public void deleteNotice(Long id) { | |
| 48 | - // 校验是否存在 | |
| 49 | - this.checkNoticeExists(id); | |
| 50 | - // 删除通知公告 | |
| 51 | - noticeMapper.deleteById(id); | |
| 52 | - } | |
| 53 | - | |
| 54 | - @Override | |
| 55 | - public PageResult<SysNoticeDO> pageNotices(SysNoticePageReqVO reqVO) { | |
| 56 | - return noticeMapper.selectPage(reqVO); | |
| 57 | - } | |
| 58 | - | |
| 59 | - @Override | |
| 60 | - public SysNoticeDO getNotice(Long id) { | |
| 61 | - return noticeMapper.selectById(id); | |
| 62 | - } | |
| 63 | - | |
| 64 | - @VisibleForTesting | |
| 65 | - public void checkNoticeExists(Long id) { | |
| 66 | - if (id == null) { | |
| 67 | - return; | |
| 68 | - } | |
| 69 | - SysNoticeDO notice = noticeMapper.selectById(id); | |
| 70 | - if (notice == null) { | |
| 71 | - throw ServiceExceptionUtil.exception(NOTICE_NOT_FOUND); | |
| 72 | - } | |
| 73 | - } | |
| 74 | - | |
| 75 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/permission/SysMenuService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.permission; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.menu.SysMenuCreateReqVO; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.menu.SysMenuListReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.menu.SysMenuUpdateReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysMenuDO; | |
| 7 | - | |
| 8 | -import java.util.Collection; | |
| 9 | -import java.util.List; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 菜单 Service 接口 | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -public interface SysMenuService { | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 初始化菜单的本地缓存 | |
| 20 | - */ | |
| 21 | - void initLocalCache(); | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * 创建菜单 | |
| 25 | - * | |
| 26 | - * @param reqVO 菜单信息 | |
| 27 | - * @return 创建出来的菜单编号 | |
| 28 | - */ | |
| 29 | - Long createMenu(SysMenuCreateReqVO reqVO); | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 更新菜单 | |
| 33 | - * | |
| 34 | - * @param reqVO 菜单信息 | |
| 35 | - */ | |
| 36 | - void updateMenu(SysMenuUpdateReqVO reqVO); | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 删除菜单 | |
| 40 | - * | |
| 41 | - * @param id 菜单编号 | |
| 42 | - */ | |
| 43 | - void deleteMenu(Long id); | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * 获得所有菜单列表 | |
| 47 | - * | |
| 48 | - * @return 菜单列表 | |
| 49 | - */ | |
| 50 | - List<SysMenuDO> getMenus(); | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * 筛选菜单列表 | |
| 54 | - * | |
| 55 | - * @param reqVO 筛选条件请求 VO | |
| 56 | - * @return 菜单列表 | |
| 57 | - */ | |
| 58 | - List<SysMenuDO> getMenus(SysMenuListReqVO reqVO); | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * 获得所有菜单,从缓存中 | |
| 62 | - * | |
| 63 | - * 任一参数为空时,则返回为空 | |
| 64 | - * | |
| 65 | - * @param menuTypes 菜单类型数组 | |
| 66 | - * @param menusStatuses 菜单状态数组 | |
| 67 | - * @return 菜单列表 | |
| 68 | - */ | |
| 69 | - List<SysMenuDO> listMenusFromCache(Collection<Integer> menuTypes, Collection<Integer> menusStatuses); | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * 获得指定编号的菜单数组,从缓存中 | |
| 73 | - * | |
| 74 | - * 任一参数为空时,则返回为空 | |
| 75 | - * | |
| 76 | - * @param menuIds 菜单编号数组 | |
| 77 | - * @param menuTypes 菜单类型数组 | |
| 78 | - * @param menusStatuses 菜单状态数组 | |
| 79 | - * @return 菜单数组 | |
| 80 | - */ | |
| 81 | - List<SysMenuDO> listMenusFromCache(Collection<Long> menuIds, Collection<Integer> menuTypes, | |
| 82 | - Collection<Integer> menusStatuses); | |
| 83 | - | |
| 84 | - /** | |
| 85 | - * 获得权限对应的菜单数组 | |
| 86 | - * | |
| 87 | - * @param permission 权限标识 | |
| 88 | - * @return 数组 | |
| 89 | - */ | |
| 90 | - List<SysMenuDO> getMenuListByPermissionFromCache(String permission); | |
| 91 | - | |
| 92 | - /** | |
| 93 | - * 获得菜单 | |
| 94 | - * | |
| 95 | - * @param id 菜单编号 | |
| 96 | - * @return 菜单 | |
| 97 | - */ | |
| 98 | - SysMenuDO getMenu(Long id); | |
| 99 | - | |
| 100 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/permission/SysPermissionService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.permission; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.datapermission.core.dept.service.DeptDataPermissionFrameworkService; | |
| 4 | -import cn.iocoder.yudao.framework.security.core.service.SecurityPermissionFrameworkService; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysMenuDO; | |
| 6 | -import org.springframework.lang.Nullable; | |
| 7 | - | |
| 8 | -import java.util.Collection; | |
| 9 | -import java.util.List; | |
| 10 | -import java.util.Set; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 权限 Service 接口 | |
| 14 | - * | |
| 15 | - * 提供用户-角色、角色-菜单、角色-部门的关联权限处理 | |
| 16 | - * | |
| 17 | - * @author 芋道源码 | |
| 18 | - */ | |
| 19 | -public interface SysPermissionService extends SecurityPermissionFrameworkService, DeptDataPermissionFrameworkService { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 初始化权限的本地缓存 | |
| 23 | - */ | |
| 24 | - void initLocalCache(); | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * 获得角色们拥有的菜单列表,从缓存中获取 | |
| 28 | - * | |
| 29 | - * 任一参数为空时,则返回为空 | |
| 30 | - * | |
| 31 | - * @param roleIds 角色编号数组 | |
| 32 | - * @param menuTypes 菜单类型数组 | |
| 33 | - * @param menusStatuses 菜单状态数组 | |
| 34 | - * @return 菜单列表 | |
| 35 | - */ | |
| 36 | - List<SysMenuDO> getRoleMenusFromCache(Collection<Long> roleIds, Collection<Integer> menuTypes, | |
| 37 | - Collection<Integer> menusStatuses); | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 获得用户拥有的角色编号集合 | |
| 41 | - * | |
| 42 | - * @param userId 用户编号 | |
| 43 | - * @param roleStatuses 角色状态集合. 允许为空,为空时不过滤 | |
| 44 | - * @return 角色编号集合 | |
| 45 | - */ | |
| 46 | - Set<Long> getUserRoleIds(Long userId, @Nullable Collection<Integer> roleStatuses); | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * 获得角色拥有的菜单编号集合 | |
| 50 | - * | |
| 51 | - * @param roleId 角色编号 | |
| 52 | - * @return 菜单编号集合 | |
| 53 | - */ | |
| 54 | - Set<Long> listRoleMenuIds(Long roleId); | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * 设置角色菜单 | |
| 58 | - * | |
| 59 | - * @param roleId 角色编号 | |
| 60 | - * @param menuIds 菜单编号集合 | |
| 61 | - */ | |
| 62 | - void assignRoleMenu(Long roleId, Set<Long> menuIds); | |
| 63 | - | |
| 64 | - /** | |
| 65 | - * 获得用户拥有的角色编号集合 | |
| 66 | - * | |
| 67 | - * @param userId 用户编号 | |
| 68 | - * @return 角色编号集合 | |
| 69 | - */ | |
| 70 | - Set<Long> getUserRoleIdListByUserId(Long userId); | |
| 71 | - | |
| 72 | - /** | |
| 73 | - * 获得拥有某个角色的用户编号集合 | |
| 74 | - * | |
| 75 | - * @param roleId 角色编号 | |
| 76 | - * @return 用户编号集合 | |
| 77 | - */ | |
| 78 | - Set<Long> getUserRoleIdListByRoleId(Long roleId); | |
| 79 | - | |
| 80 | - /** | |
| 81 | - * 设置用户角色 | |
| 82 | - * | |
| 83 | - * @param userId 角色编号 | |
| 84 | - * @param roleIds 角色编号集合 | |
| 85 | - */ | |
| 86 | - void assignUserRole(Long userId, Set<Long> roleIds); | |
| 87 | - | |
| 88 | - /** | |
| 89 | - * 设置角色的数据权限 | |
| 90 | - * | |
| 91 | - * @param roleId 角色编号 | |
| 92 | - * @param dataScope 数据范围 | |
| 93 | - * @param dataScopeDeptIds 部门编号数组 | |
| 94 | - */ | |
| 95 | - void assignRoleDataScope(Long roleId, Integer dataScope, Set<Long> dataScopeDeptIds); | |
| 96 | - | |
| 97 | - /** | |
| 98 | - * 处理角色删除时,删除关联授权数据 | |
| 99 | - * | |
| 100 | - * @param roleId 角色编号 | |
| 101 | - */ | |
| 102 | - void processRoleDeleted(Long roleId); | |
| 103 | - | |
| 104 | - /** | |
| 105 | - * 处理菜单删除时,删除关联授权数据 | |
| 106 | - * | |
| 107 | - * @param menuId 菜单编号 | |
| 108 | - */ | |
| 109 | - void processMenuDeleted(Long menuId); | |
| 110 | - | |
| 111 | - /** | |
| 112 | - * 处理用户删除是,删除关联授权数据 | |
| 113 | - * | |
| 114 | - * @param userId 用户编号 | |
| 115 | - */ | |
| 116 | - void processUserDeleted(Long userId); | |
| 117 | - | |
| 118 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/permission/SysRoleService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.permission; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.role.SysRoleCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.role.SysRoleExportReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.role.SysRolePageReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.role.SysRoleUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; | |
| 9 | -import org.springframework.lang.Nullable; | |
| 10 | - | |
| 11 | -import java.util.Collection; | |
| 12 | -import java.util.List; | |
| 13 | -import java.util.Set; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * 角色 Service 接口 | |
| 17 | - * | |
| 18 | - * @author 芋道源码 | |
| 19 | - */ | |
| 20 | -public interface SysRoleService { | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 初始化角色的本地缓存 | |
| 24 | - */ | |
| 25 | - void initLocalCache(); | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 创建角色 | |
| 29 | - * | |
| 30 | - * @param reqVO 创建角色信息 | |
| 31 | - * @return 角色编号 | |
| 32 | - */ | |
| 33 | - Long createRole(SysRoleCreateReqVO reqVO); | |
| 34 | - | |
| 35 | - /** | |
| 36 | - * 更新角色 | |
| 37 | - * | |
| 38 | - * @param reqVO 更新角色信息 | |
| 39 | - */ | |
| 40 | - void updateRole(SysRoleUpdateReqVO reqVO); | |
| 41 | - | |
| 42 | - /** | |
| 43 | - * 删除角色 | |
| 44 | - * | |
| 45 | - * @param id 角色编号 | |
| 46 | - */ | |
| 47 | - void deleteRole(Long id); | |
| 48 | - | |
| 49 | - /** | |
| 50 | - * 更新角色状态 | |
| 51 | - * | |
| 52 | - * @param id 角色编号 | |
| 53 | - * @param status 状态 | |
| 54 | - */ | |
| 55 | - void updateRoleStatus(Long id, Integer status); | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * 设置角色的数据权限 | |
| 59 | - * | |
| 60 | - * @param id 角色编号 | |
| 61 | - * @param dataScope 数据范围 | |
| 62 | - * @param dataScopeDeptIds 部门编号数组 | |
| 63 | - */ | |
| 64 | - void updateRoleDataScope(Long id, Integer dataScope, Set<Long> dataScopeDeptIds); | |
| 65 | - | |
| 66 | - /** | |
| 67 | - * 获得角色,从缓存中 | |
| 68 | - * | |
| 69 | - * @param id 角色编号 | |
| 70 | - * @return 角色 | |
| 71 | - */ | |
| 72 | - SysRoleDO getRoleFromCache(Long id); | |
| 73 | - | |
| 74 | - /** | |
| 75 | - * 获得角色列表 | |
| 76 | - * | |
| 77 | - * @param statuses 筛选的状态。允许空,空时不筛选 | |
| 78 | - * @return 角色列表 | |
| 79 | - */ | |
| 80 | - List<SysRoleDO> getRoles(@Nullable Collection<Integer> statuses); | |
| 81 | - | |
| 82 | - /** | |
| 83 | - * 获得角色数组,从缓存中 | |
| 84 | - * | |
| 85 | - * @param ids 角色编号数组 | |
| 86 | - * @return 角色数组 | |
| 87 | - */ | |
| 88 | - List<SysRoleDO> getRolesFromCache(Collection<Long> ids); | |
| 89 | - | |
| 90 | - /** | |
| 91 | - * 判断角色数组中,是否有管理员 | |
| 92 | - * | |
| 93 | - * @param roleList 角色数组 | |
| 94 | - * @return 是否有管理员 | |
| 95 | - */ | |
| 96 | - boolean hasAnyAdmin(Collection<SysRoleDO> roleList); | |
| 97 | - | |
| 98 | - /** | |
| 99 | - * 判断角色编号数组中,是否有管理员 | |
| 100 | - * | |
| 101 | - * @param ids 角色编号数组 | |
| 102 | - * @return 是否有管理员 | |
| 103 | - */ | |
| 104 | - default boolean hasAnyAdmin(Set<Long> ids) { | |
| 105 | - return hasAnyAdmin(getRolesFromCache(ids)); | |
| 106 | - } | |
| 107 | - | |
| 108 | - /** | |
| 109 | - * 获得角色 | |
| 110 | - * | |
| 111 | - * @param id 角色编号 | |
| 112 | - * @return 角色 | |
| 113 | - */ | |
| 114 | - SysRoleDO getRole(Long id); | |
| 115 | - | |
| 116 | - /** | |
| 117 | - * 获得角色分页 | |
| 118 | - * | |
| 119 | - * @param reqVO 角色分页查询 | |
| 120 | - * @return 角色分页结果 | |
| 121 | - */ | |
| 122 | - PageResult<SysRoleDO> getRolePage(SysRolePageReqVO reqVO); | |
| 123 | - | |
| 124 | - /** | |
| 125 | - * 获得角色列表 | |
| 126 | - * | |
| 127 | - * @param reqVO 列表查询 | |
| 128 | - * @return 角色列表 | |
| 129 | - */ | |
| 130 | - List<SysRoleDO> getRoleList(SysRoleExportReqVO reqVO); | |
| 131 | - | |
| 132 | - | |
| 133 | - | |
| 134 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/sms/SysSmsChannelService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.sms; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsChannelDO; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.channel.SysSmsChannelCreateReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.channel.SysSmsChannelPageReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.channel.SysSmsChannelUpdateReqVO; | |
| 8 | - | |
| 9 | -import javax.validation.Valid; | |
| 10 | -import java.util.Collection; | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 短信渠道 Service 接口 | |
| 15 | - * | |
| 16 | - * @author zzf | |
| 17 | - * @date 2021/1/25 9:24 | |
| 18 | - */ | |
| 19 | -public interface SysSmsChannelService { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 初始化短信客户端 | |
| 23 | - */ | |
| 24 | - void initSmsClients(); | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * 创建短信渠道 | |
| 28 | - * | |
| 29 | - * @param createReqVO 创建信息 | |
| 30 | - * @return 编号 | |
| 31 | - */ | |
| 32 | - Long createSmsChannel(@Valid SysSmsChannelCreateReqVO createReqVO); | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * 更新短信渠道 | |
| 36 | - * | |
| 37 | - * @param updateReqVO 更新信息 | |
| 38 | - */ | |
| 39 | - void updateSmsChannel(@Valid SysSmsChannelUpdateReqVO updateReqVO); | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * 删除短信渠道 | |
| 43 | - * | |
| 44 | - * @param id 编号 | |
| 45 | - */ | |
| 46 | - void deleteSmsChannel(Long id); | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * 获得短信渠道 | |
| 50 | - * | |
| 51 | - * @param id 编号 | |
| 52 | - * @return 短信渠道 | |
| 53 | - */ | |
| 54 | - SysSmsChannelDO getSmsChannel(Long id); | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * 获得短信渠道列表 | |
| 58 | - * | |
| 59 | - * @param ids 编号 | |
| 60 | - * @return 短信渠道列表 | |
| 61 | - */ | |
| 62 | - List<SysSmsChannelDO> getSmsChannelList(Collection<Long> ids); | |
| 63 | - | |
| 64 | - /** | |
| 65 | - * 获得所有短信渠道列表 | |
| 66 | - * | |
| 67 | - * @return 短信渠道列表 | |
| 68 | - */ | |
| 69 | - List<SysSmsChannelDO> getSmsChannelList(); | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * 获得短信渠道分页 | |
| 73 | - * | |
| 74 | - * @param pageReqVO 分页查询 | |
| 75 | - * @return 短信渠道分页 | |
| 76 | - */ | |
| 77 | - PageResult<SysSmsChannelDO> getSmsChannelPage(SysSmsChannelPageReqVO pageReqVO); | |
| 78 | - | |
| 79 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/sms/SysSmsLogService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.sms; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.log.SysSmsLogExportReqVO; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.log.SysSmsLogPageReqVO; | |
| 5 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsLogDO; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 7 | - | |
| 8 | -import java.util.List; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 短信日志 Service 接口 | |
| 12 | - * | |
| 13 | - * @author zzf | |
| 14 | - * @date 13:48 2021/3/2 | |
| 15 | - */ | |
| 16 | -public interface SysSmsLogService { | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 获得短信日志分页 | |
| 20 | - * | |
| 21 | - * @param pageReqVO 分页查询 | |
| 22 | - * @return 短信日志分页 | |
| 23 | - */ | |
| 24 | - PageResult<SysSmsLogDO> getSmsLogPage(SysSmsLogPageReqVO pageReqVO); | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * 获得短信日志列表, 用于 Excel 导出 | |
| 28 | - * | |
| 29 | - * @param exportReqVO 查询条件 | |
| 30 | - * @return 短信日志列表 | |
| 31 | - */ | |
| 32 | - List<SysSmsLogDO> getSmsLogList(SysSmsLogExportReqVO exportReqVO); | |
| 33 | - | |
| 34 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/sms/SysSmsTemplateService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.sms; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.template.SysSmsTemplateCreateReqVO; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.template.SysSmsTemplateExportReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.template.SysSmsTemplatePageReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.template.SysSmsTemplateUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; | |
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | - | |
| 10 | -import javax.validation.Valid; | |
| 11 | -import java.util.Collection; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 短信模板 Service 接口 | |
| 16 | - * | |
| 17 | - * @author zzf | |
| 18 | - * @date 2021/1/25 9:24 | |
| 19 | - */ | |
| 20 | -public interface SysSmsTemplateService { | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 获得短信模板 | |
| 24 | - * | |
| 25 | - * @param code 模板编码 | |
| 26 | - * @return 短信模板 | |
| 27 | - */ | |
| 28 | - SysSmsTemplateDO getSmsTemplateByCode(String code); | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * 创建短信模板 | |
| 32 | - * | |
| 33 | - * @param createReqVO 创建信息 | |
| 34 | - * @return 编号 | |
| 35 | - */ | |
| 36 | - Long createSmsTemplate(@Valid SysSmsTemplateCreateReqVO createReqVO); | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 更新短信模板 | |
| 40 | - * | |
| 41 | - * @param updateReqVO 更新信息 | |
| 42 | - */ | |
| 43 | - void updateSmsTemplate(@Valid SysSmsTemplateUpdateReqVO updateReqVO); | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * 删除短信模板 | |
| 47 | - * | |
| 48 | - * @param id 编号 | |
| 49 | - */ | |
| 50 | - void deleteSmsTemplate(Long id); | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * 获得短信模板 | |
| 54 | - * | |
| 55 | - * @param id 编号 | |
| 56 | - * @return 短信模板 | |
| 57 | - */ | |
| 58 | - SysSmsTemplateDO getSmsTemplate(Long id); | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * 获得短信模板列表 | |
| 62 | - * | |
| 63 | - * @param ids 编号 | |
| 64 | - * @return 短信模板列表 | |
| 65 | - */ | |
| 66 | - List<SysSmsTemplateDO> getSmsTemplateList(Collection<Long> ids); | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * 获得短信模板分页 | |
| 70 | - * | |
| 71 | - * @param pageReqVO 分页查询 | |
| 72 | - * @return 短信模板分页 | |
| 73 | - */ | |
| 74 | - PageResult<SysSmsTemplateDO> getSmsTemplatePage(SysSmsTemplatePageReqVO pageReqVO); | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * 获得短信模板列表, 用于 Excel 导出 | |
| 78 | - * | |
| 79 | - * @param exportReqVO 查询条件 | |
| 80 | - * @return 短信模板分页 | |
| 81 | - */ | |
| 82 | - List<SysSmsTemplateDO> getSmsTemplateList(SysSmsTemplateExportReqVO exportReqVO); | |
| 83 | - | |
| 84 | - /** | |
| 85 | - * 获得指定短信渠道下的短信模板数量 | |
| 86 | - * | |
| 87 | - * @param channelId 短信渠道编号 | |
| 88 | - * @return 数量 | |
| 89 | - */ | |
| 90 | - Integer countByChannelId(Long channelId); | |
| 91 | - | |
| 92 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/sms/impl/SysSmsLogServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.sms.impl; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.log.SysSmsLogExportReqVO; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.log.SysSmsLogPageReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.sms.SysSmsLogMapper; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.service.sms.SysSmsLogService; | |
| 7 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsLogDO; | |
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | -import lombok.extern.slf4j.Slf4j; | |
| 10 | -import org.springframework.stereotype.Service; | |
| 11 | - | |
| 12 | -import javax.annotation.Resource; | |
| 13 | -import java.util.List; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * 短信日志 Service 实现类 | |
| 17 | - * | |
| 18 | - * @author zzf | |
| 19 | - * @date 2021/1/25 9:25 | |
| 20 | - */ | |
| 21 | -@Slf4j | |
| 22 | -@Service | |
| 23 | -public class SysSmsLogServiceImpl implements SysSmsLogService { | |
| 24 | - | |
| 25 | - @Resource | |
| 26 | - private SysSmsLogMapper smsLogMapper; | |
| 27 | - | |
| 28 | - @Override | |
| 29 | - public PageResult<SysSmsLogDO> getSmsLogPage(SysSmsLogPageReqVO pageReqVO) { | |
| 30 | - return smsLogMapper.selectPage(pageReqVO); | |
| 31 | - } | |
| 32 | - | |
| 33 | - @Override | |
| 34 | - public List<SysSmsLogDO> getSmsLogList(SysSmsLogExportReqVO exportReqVO) { | |
| 35 | - return smsLogMapper.selectList(exportReqVO); | |
| 36 | - } | |
| 37 | - | |
| 38 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/tenant/SysTenantService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.tenant; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantCreateReqVO; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantExportReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantPageReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO; | |
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | - | |
| 10 | -import javax.validation.Valid; | |
| 11 | -import java.util.Collection; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 租户 Service 接口 | |
| 16 | - * | |
| 17 | - * @author 芋道源码 | |
| 18 | - */ | |
| 19 | -public interface SysTenantService { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 创建租户 | |
| 23 | - * | |
| 24 | - * @param createReqVO 创建信息 | |
| 25 | - * @return 编号 | |
| 26 | - */ | |
| 27 | - Long createTenant(@Valid SysTenantCreateReqVO createReqVO); | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 更新租户 | |
| 31 | - * | |
| 32 | - * @param updateReqVO 更新信息 | |
| 33 | - */ | |
| 34 | - void updateTenant(@Valid SysTenantUpdateReqVO updateReqVO); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 删除租户 | |
| 38 | - * | |
| 39 | - * @param id 编号 | |
| 40 | - */ | |
| 41 | - void deleteTenant(Long id); | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * 获得租户 | |
| 45 | - * | |
| 46 | - * @param id 编号 | |
| 47 | - * @return 租户 | |
| 48 | - */ | |
| 49 | - SysTenantDO getTenant(Long id); | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * 获得租户列表 | |
| 53 | - * | |
| 54 | - * @param ids 编号 | |
| 55 | - * @return 租户列表 | |
| 56 | - */ | |
| 57 | - List<SysTenantDO> getTenantList(Collection<Long> ids); | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * 获得租户分页 | |
| 61 | - * | |
| 62 | - * @param pageReqVO 分页查询 | |
| 63 | - * @return 租户分页 | |
| 64 | - */ | |
| 65 | - PageResult<SysTenantDO> getTenantPage(SysTenantPageReqVO pageReqVO); | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * 获得租户列表, 用于 Excel 导出 | |
| 69 | - * | |
| 70 | - * @param exportReqVO 查询条件 | |
| 71 | - * @return 租户列表 | |
| 72 | - */ | |
| 73 | - List<SysTenantDO> getTenantList(SysTenantExportReqVO exportReqVO); | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * 获得名字对应的租户 | |
| 77 | - * | |
| 78 | - * @param name 组户名 | |
| 79 | - * @return 租户 | |
| 80 | - */ | |
| 81 | - SysTenantDO getTenantByName(String name); | |
| 82 | - | |
| 83 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/tenant/impl/SysTenantServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.tenant.impl; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantCreateReqVO; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantExportReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantPageReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.convert.tenant.SysTenantConvert; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.tenant.SysTenantMapper; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.service.tenant.SysTenantService; | |
| 10 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO; | |
| 11 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 12 | -import org.springframework.stereotype.Service; | |
| 13 | -import org.springframework.validation.annotation.Validated; | |
| 14 | - | |
| 15 | -import javax.annotation.Resource; | |
| 16 | -import java.util.Collection; | |
| 17 | -import java.util.List; | |
| 18 | - | |
| 19 | -import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.TENANT_NOT_EXISTS; | |
| 20 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 21 | - | |
| 22 | -/** | |
| 23 | - * 租户 Service 实现类 | |
| 24 | - * | |
| 25 | - * @author 芋道源码 | |
| 26 | - */ | |
| 27 | -@Service | |
| 28 | -@Validated | |
| 29 | -public class SysTenantServiceImpl implements SysTenantService { | |
| 30 | - | |
| 31 | - @Resource | |
| 32 | - private SysTenantMapper tenantMapper; | |
| 33 | - | |
| 34 | - @Override | |
| 35 | - public Long createTenant(SysTenantCreateReqVO createReqVO) { | |
| 36 | - // 插入 | |
| 37 | - SysTenantDO tenant = SysTenantConvert.INSTANCE.convert(createReqVO); | |
| 38 | - tenantMapper.insert(tenant); | |
| 39 | - // 返回 | |
| 40 | - return tenant.getId(); | |
| 41 | - } | |
| 42 | - | |
| 43 | - @Override | |
| 44 | - public void updateTenant(SysTenantUpdateReqVO updateReqVO) { | |
| 45 | - // 校验存在 | |
| 46 | - this.validateTenantExists(updateReqVO.getId()); | |
| 47 | - // 更新 | |
| 48 | - SysTenantDO updateObj = SysTenantConvert.INSTANCE.convert(updateReqVO); | |
| 49 | - tenantMapper.updateById(updateObj); | |
| 50 | - } | |
| 51 | - | |
| 52 | - @Override | |
| 53 | - public void deleteTenant(Long id) { | |
| 54 | - // 校验存在 | |
| 55 | - this.validateTenantExists(id); | |
| 56 | - // 删除 | |
| 57 | - tenantMapper.deleteById(id); | |
| 58 | - } | |
| 59 | - | |
| 60 | - private void validateTenantExists(Long id) { | |
| 61 | - if (tenantMapper.selectById(id) == null) { | |
| 62 | - throw exception(TENANT_NOT_EXISTS); | |
| 63 | - } | |
| 64 | - } | |
| 65 | - | |
| 66 | - @Override | |
| 67 | - public SysTenantDO getTenant(Long id) { | |
| 68 | - return tenantMapper.selectById(id); | |
| 69 | - } | |
| 70 | - | |
| 71 | - @Override | |
| 72 | - public List<SysTenantDO> getTenantList(Collection<Long> ids) { | |
| 73 | - return tenantMapper.selectBatchIds(ids); | |
| 74 | - } | |
| 75 | - | |
| 76 | - @Override | |
| 77 | - public PageResult<SysTenantDO> getTenantPage(SysTenantPageReqVO pageReqVO) { | |
| 78 | - return tenantMapper.selectPage(pageReqVO); | |
| 79 | - } | |
| 80 | - | |
| 81 | - @Override | |
| 82 | - public List<SysTenantDO> getTenantList(SysTenantExportReqVO exportReqVO) { | |
| 83 | - return tenantMapper.selectList(exportReqVO); | |
| 84 | - } | |
| 85 | - | |
| 86 | - @Override | |
| 87 | - public SysTenantDO getTenantByName(String name) { | |
| 88 | - return tenantMapper.selectByName(name); | |
| 89 | - } | |
| 90 | - | |
| 91 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/user/SysUserService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.user; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.profile.SysUserProfileUpdatePasswordReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.profile.SysUserProfileUpdateReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.*; | |
| 7 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; | |
| 8 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 9 | -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 10 | - | |
| 11 | -import java.io.InputStream; | |
| 12 | -import java.util.*; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 后台用户 Service 接口 | |
| 16 | - * | |
| 17 | - * @author 芋道源码 | |
| 18 | - */ | |
| 19 | -public interface SysUserService { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 创建用户 | |
| 23 | - * | |
| 24 | - * @param reqVO 用户信息 | |
| 25 | - * @return 用户编号 | |
| 26 | - */ | |
| 27 | - Long createUser(SysUserCreateReqVO reqVO); | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 修改用户 | |
| 31 | - * | |
| 32 | - * @param reqVO 用户信息 | |
| 33 | - */ | |
| 34 | - void updateUser(SysUserUpdateReqVO reqVO); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 更新用户的最后登陆信息 | |
| 38 | - * | |
| 39 | - * @param id 用户编号 | |
| 40 | - * @param loginIp 登陆 IP | |
| 41 | - */ | |
| 42 | - void updateUserLogin(Long id, String loginIp); | |
| 43 | - | |
| 44 | - /** | |
| 45 | - * 修改用户个人信息 | |
| 46 | - * | |
| 47 | - * @param id 用户编号 | |
| 48 | - * @param reqVO 用户个人信息 | |
| 49 | - */ | |
| 50 | - void updateUserProfile(Long id, SysUserProfileUpdateReqVO reqVO); | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * 修改用户个人密码 | |
| 54 | - * | |
| 55 | - * @param id 用户编号 | |
| 56 | - * @param reqVO 更新用户个人密码 | |
| 57 | - */ | |
| 58 | - void updateUserPassword(Long id, SysUserProfileUpdatePasswordReqVO reqVO); | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * 更新用户头像 | |
| 62 | - * | |
| 63 | - * @param id 用户 id | |
| 64 | - * @param avatarFile 头像文件 | |
| 65 | - */ | |
| 66 | - String updateUserAvatar(Long id, InputStream avatarFile); | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * 修改密码 | |
| 70 | - * | |
| 71 | - * @param id 用户编号 | |
| 72 | - * @param password 密码 | |
| 73 | - */ | |
| 74 | - void updateUserPassword(Long id, String password); | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * 修改状态 | |
| 78 | - * | |
| 79 | - * @param id 用户编号 | |
| 80 | - * @param status 状态 | |
| 81 | - */ | |
| 82 | - void updateUserStatus(Long id, Integer status); | |
| 83 | - | |
| 84 | - /** | |
| 85 | - * 删除用户 | |
| 86 | - * | |
| 87 | - * @param id 用户编号 | |
| 88 | - */ | |
| 89 | - void deleteUser(Long id); | |
| 90 | - | |
| 91 | - /** | |
| 92 | - * 通过用户名查询用户 | |
| 93 | - * | |
| 94 | - * @param username 用户名 | |
| 95 | - * @return 用户对象信息 | |
| 96 | - */ | |
| 97 | - SysUserDO getUserByUsername(String username); | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * 获得用户分页列表 | |
| 101 | - * | |
| 102 | - * @param reqVO 分页条件 | |
| 103 | - * @return 分页列表 | |
| 104 | - */ | |
| 105 | - PageResult<SysUserDO> getUserPage(SysUserPageReqVO reqVO); | |
| 106 | - | |
| 107 | - /** | |
| 108 | - * 获得用户 | |
| 109 | - * | |
| 110 | - * @param id 用户编号 | |
| 111 | - * @return 用户 | |
| 112 | - */ | |
| 113 | - SysUserDO getUser(Long id); | |
| 114 | - | |
| 115 | - /** | |
| 116 | - * 获得用户列表 | |
| 117 | - * | |
| 118 | - * @param reqVO 列表请求 | |
| 119 | - * @return 用户列表 | |
| 120 | - */ | |
| 121 | - List<SysUserDO> getUsers(SysUserExportReqVO reqVO); | |
| 122 | - | |
| 123 | - | |
| 124 | - | |
| 125 | - /** | |
| 126 | - * 获得用户列表,基于昵称模糊匹配 | |
| 127 | - * | |
| 128 | - * @param nickname 昵称 | |
| 129 | - * @return 用户列表 | |
| 130 | - */ | |
| 131 | - List<SysUserDO> getUsersByNickname(String nickname); | |
| 132 | - | |
| 133 | - /** | |
| 134 | - * 获得用户列表,基于用户账号模糊匹配 | |
| 135 | - * | |
| 136 | - * @param username 用户账号 | |
| 137 | - * @return 用户列表 | |
| 138 | - */ | |
| 139 | - List<SysUserDO> getUsersByUsername(String username); | |
| 140 | - | |
| 141 | - /** | |
| 142 | - * 批量导入用户 | |
| 143 | - * | |
| 144 | - * @param importUsers 导入用户列表 | |
| 145 | - * @param isUpdateSupport 是否支持更新 | |
| 146 | - * @return 导入结果 | |
| 147 | - */ | |
| 148 | - SysUserImportRespVO importUsers(List<SysUserImportExcelVO> importUsers, boolean isUpdateSupport); | |
| 149 | - | |
| 150 | - /** | |
| 151 | - * 获得指定状态的用户们 | |
| 152 | - * | |
| 153 | - * @param status 状态 | |
| 154 | - * @return 用户们 | |
| 155 | - */ | |
| 156 | - List<SysUserDO> getUsersByStatus(Integer status); | |
| 157 | - | |
| 158 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/dal/dataobject/codegen/ToolCodegenColumnDO.java
| 1 | 1 | package cn.iocoder.yudao.adminserver.modules.tool.dal.dataobject.codegen; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dict.SysDictTypeDO; | |
| 5 | 4 | import cn.iocoder.yudao.adminserver.modules.tool.enums.codegen.ToolCodegenColumnHtmlTypeEnum; |
| 6 | 5 | import cn.iocoder.yudao.adminserver.modules.tool.enums.codegen.ToolCodegenColumnListConditionEnum; |
| 7 | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| ... | ... | @@ -80,7 +79,7 @@ public class ToolCodegenColumnDO extends BaseDO { |
| 80 | 79 | /** |
| 81 | 80 | * 字典类型 |
| 82 | 81 | * |
| 83 | - * 关联 {@link SysDictTypeDO#getType()} | |
| 82 | + * 关联 DictTypeDO 的 type 属性 | |
| 84 | 83 | */ |
| 85 | 84 | private String dictType; |
| 86 | 85 | /** | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/dal/dataobject/codegen/ToolCodegenTableDO.java
| 1 | 1 | package cn.iocoder.yudao.adminserver.modules.tool.dal.dataobject.codegen; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysMenuDO; | |
| 5 | 4 | import cn.iocoder.yudao.adminserver.modules.tool.enums.codegen.ToolCodegenTemplateTypeEnum; |
| 6 | 5 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | 6 | import lombok.Data; |
| ... | ... | @@ -89,7 +88,7 @@ public class ToolCodegenTableDO extends BaseDO { |
| 89 | 88 | /** |
| 90 | 89 | * 父菜单编号 |
| 91 | 90 | * |
| 92 | - * 关联 {@link SysMenuDO#getId()} | |
| 91 | + * 关联 MenuDO 的 id 属性 | |
| 93 | 92 | */ |
| 94 | 93 | private Long parentMenuId; |
| 95 | 94 | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/framework/codegen/config/CodegenConfiguration.java renamed to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/framework/codegen/config/CodegenConfiguration.java
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.framework.codegen.config; | |
| 1 | +package cn.iocoder.yudao.adminserver.modules.tool.framework.codegen.config; | |
| 2 | 2 | |
| 3 | 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| 4 | 4 | import org.springframework.context.annotation.Configuration; | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/framework/codegen/config/CodegenProperties.java
0 → 100644
| 1 | +package cn.iocoder.yudao.adminserver.modules.tool.framework.codegen.config; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | +import org.springframework.boot.context.properties.ConfigurationProperties; | |
| 5 | +import org.springframework.validation.annotation.Validated; | |
| 6 | + | |
| 7 | +import javax.validation.constraints.NotEmpty; | |
| 8 | +import javax.validation.constraints.NotNull; | |
| 9 | +import java.util.Collection; | |
| 10 | + | |
| 11 | +@ConfigurationProperties(prefix = "yudao.codegen") | |
| 12 | +@Validated | |
| 13 | +@Data | |
| 14 | +public class CodegenProperties { | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 生成的 Java 代码的基础包 | |
| 18 | + */ | |
| 19 | + @NotNull(message = "Java 代码的基础包不能为空") | |
| 20 | + private String basePackage; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 数据库名数组 | |
| 24 | + */ | |
| 25 | + @NotEmpty(message = "数据库不能为空") | |
| 26 | + private Collection<String> dbSchemas; | |
| 27 | + | |
| 28 | +} | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/framework/codegen/package-info.java
0 → 100644
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/framework/errorcode/config/ErrorCodeConfiguration.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.config; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.generator.ErrorCodeAutoGenerator; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.loader.ErrorCodeLoader; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.service.ErrorCodeFrameworkService; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.loader.ErrorCodeLoaderImpl; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.generator.ErrorCodeAutoGeneratorImpl; | |
| 8 | -import org.springframework.beans.factory.annotation.Value; | |
| 9 | -import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
| 10 | -import org.springframework.context.annotation.Bean; | |
| 11 | -import org.springframework.context.annotation.Configuration; | |
| 12 | -import org.springframework.scheduling.annotation.EnableScheduling; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 错误码配置类 | |
| 16 | - */ | |
| 17 | -@Configuration | |
| 18 | -@EnableConfigurationProperties(ErrorCodeProperties.class) | |
| 19 | -@EnableScheduling // 开启调度任务的功能,因为 ErrorCodeRemoteLoader 通过定时刷新错误码 | |
| 20 | -public class ErrorCodeConfiguration { | |
| 21 | - | |
| 22 | - @Bean | |
| 23 | - public ErrorCodeAutoGenerator errorCodeAutoGenerator(@Value("${spring.application.name}") String applicationName, | |
| 24 | - ErrorCodeProperties errorCodeProperties, | |
| 25 | - ErrorCodeFrameworkService errorCodeFrameworkService) { | |
| 26 | - return new ErrorCodeAutoGeneratorImpl(applicationName, errorCodeProperties.getConstantsClassList(), | |
| 27 | - errorCodeFrameworkService); | |
| 28 | - } | |
| 29 | - | |
| 30 | - @Bean | |
| 31 | - public ErrorCodeLoader errorCodeLoader(@Value("${spring.application.name}") String applicationName, | |
| 32 | - ErrorCodeFrameworkService errorCodeFrameworkService) { | |
| 33 | - return new ErrorCodeLoaderImpl(applicationName, errorCodeFrameworkService); | |
| 34 | - } | |
| 35 | - | |
| 36 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/framework/errorcode/config/ErrorCodeProperties.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.config; | |
| 2 | - | |
| 3 | -import lombok.Data; | |
| 4 | -import org.springframework.boot.context.properties.ConfigurationProperties; | |
| 5 | -import org.springframework.validation.annotation.Validated; | |
| 6 | - | |
| 7 | -import javax.validation.constraints.NotNull; | |
| 8 | -import java.util.List; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 错误码的配置属性类 | |
| 12 | - * | |
| 13 | - * @author dlyan | |
| 14 | - */ | |
| 15 | -@ConfigurationProperties("yudao.error-code") | |
| 16 | -@Data | |
| 17 | -@Validated | |
| 18 | -public class ErrorCodeProperties { | |
| 19 | - | |
| 20 | - /** | |
| 21 | - * 错误码枚举类 | |
| 22 | - */ | |
| 23 | - @NotNull(message = "错误码枚举类不能为空") | |
| 24 | - private List<String> constantsClassList; | |
| 25 | - | |
| 26 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/framework/errorcode/core/dto/ErrorCodeAutoGenerateReqDTO.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.dto; | |
| 2 | - | |
| 3 | -import lombok.Data; | |
| 4 | -import lombok.experimental.Accessors; | |
| 5 | - | |
| 6 | -import javax.validation.constraints.NotEmpty; | |
| 7 | -import javax.validation.constraints.NotNull; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * 错误码自动生成 DTO | |
| 11 | - * | |
| 12 | - * @author dylan | |
| 13 | - */ | |
| 14 | -@Data | |
| 15 | -@Accessors(chain = true) | |
| 16 | -public class ErrorCodeAutoGenerateReqDTO { | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 应用名 | |
| 20 | - */ | |
| 21 | - @NotNull(message = "应用名不能为空") | |
| 22 | - private String applicationName; | |
| 23 | - /** | |
| 24 | - * 错误码编码 | |
| 25 | - */ | |
| 26 | - @NotNull(message = "错误码编码不能为空") | |
| 27 | - private Integer code; | |
| 28 | - /** | |
| 29 | - * 错误码错误提示 | |
| 30 | - */ | |
| 31 | - @NotEmpty(message = "错误码错误提示不能为空") | |
| 32 | - private String message; | |
| 33 | - | |
| 34 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/framework/errorcode/core/dto/ErrorCodeRespDTO.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.dto; | |
| 2 | - | |
| 3 | -import lombok.Data; | |
| 4 | - | |
| 5 | -import java.util.Date; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * 错误码的 Response DTO | |
| 9 | - * | |
| 10 | - * @author 芋道源码 | |
| 11 | - */ | |
| 12 | -@Data | |
| 13 | -public class ErrorCodeRespDTO { | |
| 14 | - | |
| 15 | - /** | |
| 16 | - * 错误码编码 | |
| 17 | - */ | |
| 18 | - private Integer code; | |
| 19 | - /** | |
| 20 | - * 错误码错误提示 | |
| 21 | - */ | |
| 22 | - private String message; | |
| 23 | - /** | |
| 24 | - * 更新时间 | |
| 25 | - */ | |
| 26 | - private Date updateTime; | |
| 27 | - | |
| 28 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/framework/errorcode/core/generator/ErrorCodeAutoGenerator.java deleted
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/framework/errorcode/core/generator/ErrorCodeAutoGeneratorImpl.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.generator; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.util.ClassUtil; | |
| 5 | -import cn.hutool.core.util.ReflectUtil; | |
| 6 | -import cn.iocoder.yudao.framework.common.exception.ErrorCode; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.dto.ErrorCodeAutoGenerateReqDTO; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.service.ErrorCodeFrameworkService; | |
| 9 | -import lombok.RequiredArgsConstructor; | |
| 10 | -import lombok.extern.slf4j.Slf4j; | |
| 11 | -import org.springframework.boot.context.event.ApplicationReadyEvent; | |
| 12 | -import org.springframework.context.event.EventListener; | |
| 13 | -import org.springframework.scheduling.annotation.Async; | |
| 14 | - | |
| 15 | -import java.util.ArrayList; | |
| 16 | -import java.util.Arrays; | |
| 17 | -import java.util.List; | |
| 18 | - | |
| 19 | -/** | |
| 20 | - * ErrorCodeAutoGenerator 的实现类 | |
| 21 | - * 目的是,扫描指定的 {@link #constantsClassList} 类,写入到 system 服务中 | |
| 22 | - * | |
| 23 | - * @author dylan | |
| 24 | - */ | |
| 25 | -@RequiredArgsConstructor | |
| 26 | -@Slf4j | |
| 27 | -public class ErrorCodeAutoGeneratorImpl implements ErrorCodeAutoGenerator { | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 应用分组 | |
| 31 | - */ | |
| 32 | - private final String applicationName; | |
| 33 | - /** | |
| 34 | - * 错误码枚举类 | |
| 35 | - */ | |
| 36 | - private final List<String> constantsClassList; | |
| 37 | - /** | |
| 38 | - * 错误码 Service | |
| 39 | - */ | |
| 40 | - private final ErrorCodeFrameworkService errorCodeService; | |
| 41 | - | |
| 42 | - @Override | |
| 43 | - @EventListener(ApplicationReadyEvent.class) | |
| 44 | - @Async // 异步,保证项目的启动过程,毕竟非关键流程 | |
| 45 | - public void execute() { | |
| 46 | - // 第一步,解析错误码 | |
| 47 | - List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs = parseErrorCode(); | |
| 48 | - log.info("[execute][解析到错误码数量为 ({}) 个]", autoGenerateDTOs.size()); | |
| 49 | - | |
| 50 | - // 第二步,写入到 system 服务 | |
| 51 | - errorCodeService.autoGenerateErrorCodes(autoGenerateDTOs); | |
| 52 | - log.info("[execute][写入到 system 组件完成]"); | |
| 53 | - } | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * 解析 constantsClassList 变量,转换成错误码数组 | |
| 57 | - * | |
| 58 | - * @return 错误码数组 | |
| 59 | - */ | |
| 60 | - private List<ErrorCodeAutoGenerateReqDTO> parseErrorCode() { | |
| 61 | - // 校验 errorCodeConstantsClass 参数 | |
| 62 | - if (CollUtil.isEmpty(constantsClassList)) { | |
| 63 | - log.info("[execute][未配置 yudao.error-code.constants-class-list 配置项,不进行自动写入到 system 服务中]"); | |
| 64 | - return new ArrayList<>(); | |
| 65 | - } | |
| 66 | - | |
| 67 | - // 解析错误码 | |
| 68 | - List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs = new ArrayList<>(); | |
| 69 | - constantsClassList.forEach(constantsClass -> { | |
| 70 | - // 解析错误码枚举类 | |
| 71 | - Class<?> errorCodeConstantsClazz = ClassUtil.loadClass(constantsClass); | |
| 72 | - // 解析错误码 | |
| 73 | - autoGenerateDTOs.addAll(parseErrorCode(errorCodeConstantsClazz)); | |
| 74 | - }); | |
| 75 | - return autoGenerateDTOs; | |
| 76 | - } | |
| 77 | - | |
| 78 | - /** | |
| 79 | - * 解析错误码类,获得错误码数组 | |
| 80 | - * | |
| 81 | - * @return 错误码数组 | |
| 82 | - */ | |
| 83 | - private List<ErrorCodeAutoGenerateReqDTO> parseErrorCode(Class<?> constantsClass) { | |
| 84 | - List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs = new ArrayList<>(); | |
| 85 | - Arrays.stream(constantsClass.getFields()).forEach(field -> { | |
| 86 | - if (field.getType() != ErrorCode.class) { | |
| 87 | - return; | |
| 88 | - } | |
| 89 | - // 转换成 ErrorCodeAutoGenerateReqDTO 对象 | |
| 90 | - ErrorCode errorCode = (ErrorCode) ReflectUtil.getFieldValue(constantsClass, field); | |
| 91 | - autoGenerateDTOs.add(new ErrorCodeAutoGenerateReqDTO().setApplicationName(applicationName) | |
| 92 | - .setCode(errorCode.getCode()).setMessage(errorCode.getMsg())); | |
| 93 | - }); | |
| 94 | - return autoGenerateDTOs; | |
| 95 | - } | |
| 96 | - | |
| 97 | -} | |
| 98 | - |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/framework/errorcode/core/loader/ErrorCodeLoader.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.loader; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; | |
| 4 | - | |
| 5 | -/** | |
| 6 | - * 错误码加载器 | |
| 7 | - * | |
| 8 | - * 注意,错误码最终加载到 {@link ServiceExceptionUtil} 的 MESSAGES 变量中! | |
| 9 | - * | |
| 10 | - * @author dlyan | |
| 11 | - */ | |
| 12 | -public interface ErrorCodeLoader { | |
| 13 | - | |
| 14 | - /** | |
| 15 | - * 添加错误码 | |
| 16 | - * | |
| 17 | - * @param code 错误码的编号 | |
| 18 | - * @param msg 错误码的提示 | |
| 19 | - */ | |
| 20 | - default void putErrorCode(Integer code, String msg) { | |
| 21 | - ServiceExceptionUtil.put(code, msg); | |
| 22 | - } | |
| 23 | - | |
| 24 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.loader; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.dto.ErrorCodeRespDTO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.service.ErrorCodeFrameworkService; | |
| 6 | -import cn.iocoder.yudao.framework.common.util.date.DateUtils; | |
| 7 | -import lombok.RequiredArgsConstructor; | |
| 8 | -import lombok.extern.slf4j.Slf4j; | |
| 9 | -import org.springframework.boot.context.event.ApplicationReadyEvent; | |
| 10 | -import org.springframework.context.event.EventListener; | |
| 11 | -import org.springframework.scheduling.annotation.Scheduled; | |
| 12 | - | |
| 13 | -import java.util.Date; | |
| 14 | -import java.util.List; | |
| 15 | - | |
| 16 | -/** | |
| 17 | - * ErrorCodeLoader 的实现类,从 infra 的数据库中,加载错误码。 | |
| 18 | - * | |
| 19 | - * 考虑到错误码会刷新,所以按照 {@link #REFRESH_ERROR_CODE_PERIOD} 频率,增量加载错误码。 | |
| 20 | - * | |
| 21 | - * @author dlyan | |
| 22 | - */ | |
| 23 | -@RequiredArgsConstructor | |
| 24 | -@Slf4j | |
| 25 | -public class ErrorCodeLoaderImpl implements ErrorCodeLoader { | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 刷新错误码的频率,单位:毫秒 | |
| 29 | - */ | |
| 30 | - private static final int REFRESH_ERROR_CODE_PERIOD = 60 * 1000; | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 应用分组 | |
| 34 | - */ | |
| 35 | - private final String applicationName; | |
| 36 | - /** | |
| 37 | - * 错误码 Service | |
| 38 | - */ | |
| 39 | - private final ErrorCodeFrameworkService errorCodeService; | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * 缓存错误码的最大更新时间,用于后续的增量轮询,判断是否有更新 | |
| 43 | - */ | |
| 44 | - private Date maxUpdateTime; | |
| 45 | - | |
| 46 | - @EventListener(ApplicationReadyEvent.class) | |
| 47 | - public void loadErrorCodes() { | |
| 48 | - this.loadErrorCodes0(); | |
| 49 | - } | |
| 50 | - | |
| 51 | - @Scheduled(fixedDelay = REFRESH_ERROR_CODE_PERIOD, initialDelay = REFRESH_ERROR_CODE_PERIOD) | |
| 52 | - public void refreshErrorCodes() { | |
| 53 | - this.loadErrorCodes0(); | |
| 54 | - } | |
| 55 | - | |
| 56 | - private void loadErrorCodes0() { | |
| 57 | - // 加载错误码 | |
| 58 | - List<ErrorCodeRespDTO> errorCodeRespDTOs = errorCodeService.getErrorCodeList(applicationName, maxUpdateTime); | |
| 59 | - if (CollUtil.isEmpty(errorCodeRespDTOs)) { | |
| 60 | - return; | |
| 61 | - } | |
| 62 | - log.info("[loadErrorCodes0][加载到 ({}) 个错误码]", errorCodeRespDTOs.size()); | |
| 63 | - | |
| 64 | - // 刷新错误码的缓存 | |
| 65 | - errorCodeRespDTOs.forEach(errorCodeRespDTO -> { | |
| 66 | - // 写入到错误码的缓存 | |
| 67 | - putErrorCode(errorCodeRespDTO.getCode(), errorCodeRespDTO.getMessage()); | |
| 68 | - // 记录下更新时间,方便增量更新 | |
| 69 | - maxUpdateTime = DateUtils.max(maxUpdateTime, errorCodeRespDTO.getUpdateTime()); | |
| 70 | - }); | |
| 71 | - } | |
| 72 | - | |
| 73 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/framework/errorcode/core/service/ErrorCodeFrameworkService.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.service; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.dto.ErrorCodeAutoGenerateReqDTO; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.dto.ErrorCodeRespDTO; | |
| 5 | - | |
| 6 | -import javax.validation.Valid; | |
| 7 | -import java.util.Date; | |
| 8 | -import java.util.List; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 错误码 Framework Service 接口 | |
| 12 | - * | |
| 13 | - * @author 芋道源码 | |
| 14 | - */ | |
| 15 | -public interface ErrorCodeFrameworkService { | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 自动创建错误码 | |
| 19 | - * | |
| 20 | - * @param autoGenerateDTOs 错误码信息 | |
| 21 | - */ | |
| 22 | - void autoGenerateErrorCodes(@Valid List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs); | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 增量获得错误码数组 | |
| 26 | - * | |
| 27 | - * 如果 minUpdateTime 为空时,则获取所有错误码 | |
| 28 | - * | |
| 29 | - * @param applicationName 应用名 | |
| 30 | - * @param minUpdateTime 最小更新时间 | |
| 31 | - * @return 错误码数组 | |
| 32 | - */ | |
| 33 | - List<ErrorCodeRespDTO> getErrorCodeList(String applicationName, Date minUpdateTime); | |
| 34 | - | |
| 35 | -} |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/service/codegen/impl/ToolCodegenEngine.java
| ... | ... | @@ -9,7 +9,7 @@ import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 10 | 10 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 11 | 11 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 12 | -import cn.iocoder.yudao.adminserver.modules.system.framework.codegen.config.CodegenProperties; | |
| 12 | +import cn.iocoder.yudao.adminserver.modules.tool.framework.codegen.config.CodegenProperties; | |
| 13 | 13 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 14 | 14 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 15 | 15 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/service/codegen/impl/ToolCodegenServiceImpl.java
| ... | ... | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.adminserver.modules.tool.service.codegen.impl; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.framework.codegen.config.CodegenProperties; | |
| 5 | +import cn.iocoder.yudao.adminserver.modules.tool.framework.codegen.config.CodegenProperties; | |
| 6 | 6 | import cn.iocoder.yudao.adminserver.modules.tool.controller.codegen.vo.ToolCodegenUpdateReqVO; |
| 7 | 7 | import cn.iocoder.yudao.adminserver.modules.tool.controller.codegen.vo.table.ToolCodegenTablePageReqVO; |
| 8 | 8 | import cn.iocoder.yudao.adminserver.modules.tool.convert.codegen.ToolCodegenConvert; | ... | ... |
yudao-admin-server/src/main/resources/application.yaml
| ... | ... | @@ -49,6 +49,7 @@ yudao: |
| 49 | 49 | version: 1.0.0 |
| 50 | 50 | base-package: cn.iocoder.yudao.adminserver |
| 51 | 51 | member-package: cn.iocoder.yudao.module.member |
| 52 | + system-package: cn.iocoder.yudao.module.system | |
| 52 | 53 | core-service: |
| 53 | 54 | base-package: cn.iocoder.yudao.coreservice |
| 54 | 55 | web: |
| ... | ... | @@ -74,7 +75,7 @@ yudao: |
| 74 | 75 | error-code: # 错误码相关配置项 |
| 75 | 76 | constants-class-list: |
| 76 | 77 | - cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants |
| 77 | - - cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants | |
| 78 | + - cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants | |
| 78 | 79 | - cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants |
| 79 | 80 | tenant: # 多租户相关配置项 |
| 80 | 81 | tables: # 配置需要开启多租户的表;如果实体已经继承 TenantBaseDO 类,则无需重复配置 | ... | ... |
yudao-admin-server/src/test-integration/java/cn/iocoder/yudao/adminserver/framework/quartz/core/SchedulerManagerTest.java
| ... | ... | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.adminserver.framework.quartz.core; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.util.StrUtil; |
| 4 | 4 | import cn.iocoder.yudao.adminserver.BaseDbUnitTest; |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.job.auth.SysUserSessionTimeoutJob; | |
| 5 | +import cn.iocoder.yudao.module.system.job.auth.SysUserSessionTimeoutJob; | |
| 6 | 6 | import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager; |
| 7 | 7 | import org.junit.jupiter.api.Test; |
| 8 | 8 | import org.quartz.SchedulerException; | ... | ... |
yudao-admin-server/src/test-integration/java/cn/iocoder/yudao/adminserver/framework/redis/core/stream/RedisStreamTest.java
| ... | ... | @@ -2,9 +2,9 @@ package cn.iocoder.yudao.adminserver.framework.redis.core.stream; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.thread.ThreadUtil; |
| 4 | 4 | import cn.iocoder.yudao.adminserver.BaseRedisIntegrationTest; |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.mq.consumer.mail.SysMailSendConsumer; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.mq.consumer.sms.SysSmsSendConsumer; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.mq.message.mail.SysMailSendMessage; | |
| 5 | +import cn.iocoder.yudao.module.system.mq.consumer.mail.SysMailSendConsumer; | |
| 6 | +import cn.iocoder.yudao.module.system.mq.consumer.sms.SysSmsSendConsumer; | |
| 7 | +import cn.iocoder.yudao.module.system.mq.message.mail.SysMailSendMessage; | |
| 8 | 8 | import cn.iocoder.yudao.coreservice.modules.system.mq.message.sms.SysSmsSendMessage; |
| 9 | 9 | import cn.iocoder.yudao.framework.mq.core.util.RedisMessageUtils; |
| 10 | 10 | import org.junit.jupiter.api.Disabled; | ... | ... |
yudao-admin-server/src/test-integration/java/cn/iocoder/yudao/adminserver/modules/system/service/package-info.java
yudao-admin-server/src/test-integration/java/cn/iocoder/yudao/adminserver/modules/system/service/sms/SysSmsServiceIntegrationTest.java
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.sms; | |
| 1 | +package cn.iocoder.yudao.module.system.service.sms; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.map.MapUtil; |
| 4 | 4 | import cn.hutool.core.thread.ThreadUtil; |
| 5 | 5 | import cn.iocoder.yudao.adminserver.BaseDbAndRedisIntegrationTest; |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.mq.consumer.sms.SysSmsSendConsumer; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.mq.producer.sms.SysSmsProducer; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.service.sms.impl.SysSmsChannelServiceImpl; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.service.sms.impl.SysSmsLogServiceImpl; | |
| 10 | -import cn.iocoder.yudao.adminserver.modules.system.service.sms.impl.SysSmsTemplateServiceImpl; | |
| 11 | -import cn.iocoder.yudao.adminserver.modules.system.service.user.SysUserService; | |
| 6 | +import cn.iocoder.yudao.module.system.mq.consumer.sms.SysSmsSendConsumer; | |
| 7 | +import cn.iocoder.yudao.module.system.mq.producer.sms.SysSmsProducer; | |
| 8 | +import cn.iocoder.yudao.module.system.service.sms.impl.SysSmsChannelServiceImpl; | |
| 9 | +import cn.iocoder.yudao.module.system.service.sms.impl.SysSmsLogServiceImpl; | |
| 10 | +import cn.iocoder.yudao.module.system.service.sms.impl.SysSmsTemplateServiceImpl; | |
| 11 | +import cn.iocoder.yudao.module.system.service.user.SysUserService; | |
| 12 | 12 | import cn.iocoder.yudao.coreservice.modules.system.service.sms.impl.SysSmsCoreServiceImpl; |
| 13 | 13 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 14 | 14 | import cn.iocoder.yudao.framework.sms.config.YudaoSmsAutoConfiguration; | ... | ... |
yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/auth/SysUserSessionServiceImplTest.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.auth; | |
| 2 | - | |
| 3 | -import cn.hutool.core.date.DateUtil; | |
| 4 | -import cn.iocoder.yudao.adminserver.BaseDbAndRedisUnitTest; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.session.SysUserSessionPageReqVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.auth.SysUserSessionMapper; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.service.auth.impl.SysUserSessionServiceImpl; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.service.user.SysUserService; | |
| 9 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; | |
| 10 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; | |
| 11 | -import cn.iocoder.yudao.coreservice.modules.system.dal.redis.auth.SysLoginUserCoreRedisDAO; | |
| 12 | -import cn.iocoder.yudao.coreservice.modules.system.enums.common.SysSexEnum; | |
| 13 | -import cn.iocoder.yudao.coreservice.modules.system.service.logger.SysLoginLogCoreService; | |
| 14 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 15 | -import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 16 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 17 | -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | |
| 18 | -import cn.iocoder.yudao.framework.test.core.util.AssertUtils; | |
| 19 | -import org.junit.jupiter.api.Test; | |
| 20 | -import org.springframework.boot.test.mock.mockito.MockBean; | |
| 21 | -import org.springframework.context.annotation.Import; | |
| 22 | - | |
| 23 | -import javax.annotation.Resource; | |
| 24 | -import java.util.Date; | |
| 25 | -import java.util.List; | |
| 26 | -import java.util.stream.Collectors; | |
| 27 | -import java.util.stream.Stream; | |
| 28 | - | |
| 29 | -import static cn.hutool.core.util.RandomUtil.randomEle; | |
| 30 | -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | |
| 31 | -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | |
| 32 | -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString; | |
| 33 | -import static java.util.Collections.singletonList; | |
| 34 | -import static org.junit.jupiter.api.Assertions.assertEquals; | |
| 35 | -import static org.mockito.ArgumentMatchers.eq; | |
| 36 | -import static org.mockito.Mockito.when; | |
| 37 | - | |
| 38 | -/** | |
| 39 | - * {@link SysUserSessionServiceImpl} 的单元测试 | |
| 40 | - * | |
| 41 | - * @author Lyon | |
| 42 | - */ | |
| 43 | -@Import({SysUserSessionServiceImpl.class}) | |
| 44 | -public class SysUserSessionServiceImplTest extends BaseDbAndRedisUnitTest { | |
| 45 | - | |
| 46 | - @Resource | |
| 47 | - private SysUserSessionServiceImpl userSessionService; | |
| 48 | - | |
| 49 | - @Resource | |
| 50 | - private SysUserSessionMapper userSessionMapper; | |
| 51 | - | |
| 52 | - @MockBean | |
| 53 | - private SysUserService userService; | |
| 54 | - @MockBean | |
| 55 | - private SysLoginLogCoreService loginLogCoreService; | |
| 56 | - @MockBean | |
| 57 | - private SysLoginUserCoreRedisDAO loginUserCoreRedisDAO; | |
| 58 | - | |
| 59 | - @Test | |
| 60 | - public void testGetUserSessionPage_success() { | |
| 61 | - // mock 数据 | |
| 62 | - SysUserDO dbUser = randomPojo(SysUserDO.class, o -> { | |
| 63 | - o.setSex(randomEle(SysSexEnum.values()).getSex()); | |
| 64 | - o.setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 65 | - }); | |
| 66 | - when(userService.getUsersByUsername(eq(dbUser.getUsername()))).thenReturn(singletonList(dbUser)); | |
| 67 | - // 插入可被查询到的数据 | |
| 68 | - String userIp = randomString(); | |
| 69 | - SysUserSessionDO dbSession = randomPojo(SysUserSessionDO.class, o -> { | |
| 70 | - o.setUserId(dbUser.getId()); | |
| 71 | - o.setUserType(randomEle(UserTypeEnum.values()).getValue()); | |
| 72 | - o.setUserIp(userIp); | |
| 73 | - }); | |
| 74 | - userSessionMapper.insert(dbSession); | |
| 75 | - // 测试 username 不匹配 | |
| 76 | - userSessionMapper.insert(ObjectUtils.cloneIgnoreId(dbSession, o -> { | |
| 77 | - o.setId(randomString()); | |
| 78 | - o.setUserId(123456L); | |
| 79 | - })); | |
| 80 | - // 测试 userIp 不匹配 | |
| 81 | - userSessionMapper.insert(ObjectUtils.cloneIgnoreId(dbSession, o -> { | |
| 82 | - o.setId(randomString()); | |
| 83 | - o.setUserIp("testUserIp"); | |
| 84 | - })); | |
| 85 | - // 准备参数 | |
| 86 | - SysUserSessionPageReqVO reqVO = new SysUserSessionPageReqVO(); | |
| 87 | - reqVO.setUsername(dbUser.getUsername()); | |
| 88 | - reqVO.setUserIp(userIp); | |
| 89 | - | |
| 90 | - // 调用 | |
| 91 | - PageResult<SysUserSessionDO> pageResult = userSessionService.getUserSessionPage(reqVO); | |
| 92 | - // 断言 | |
| 93 | - assertEquals(1, pageResult.getTotal()); | |
| 94 | - assertEquals(1, pageResult.getList().size()); | |
| 95 | - assertPojoEquals(dbSession, pageResult.getList().get(0)); | |
| 96 | - } | |
| 97 | - | |
| 98 | - // TODO 芋艿:单测写的有问题 | |
| 99 | - @Test | |
| 100 | - public void testClearSessionTimeout_success() { | |
| 101 | - // 准备超时数据 120 条, 在线用户 1 条 | |
| 102 | - int expectedTimeoutCount = 120, expectedTotal = 1; | |
| 103 | - | |
| 104 | - // 准备数据 | |
| 105 | - List<SysUserSessionDO> prepareData = Stream | |
| 106 | - .iterate(0, i -> i) | |
| 107 | - .limit(expectedTimeoutCount) | |
| 108 | - .map(i -> randomPojo(SysUserSessionDO.class, o -> { | |
| 109 | - o.setUserType(randomEle(UserTypeEnum.values()).getValue()); | |
| 110 | - o.setSessionTimeout(DateUtil.offsetSecond(new Date(), -1)); | |
| 111 | - })) | |
| 112 | - .collect(Collectors.toList()); | |
| 113 | - SysUserSessionDO sessionDO = randomPojo(SysUserSessionDO.class, o -> { | |
| 114 | - o.setUserType(randomEle(UserTypeEnum.values()).getValue()); | |
| 115 | - o.setSessionTimeout(DateUtil.offsetMinute(new Date(), 30)); | |
| 116 | - }); | |
| 117 | - prepareData.add(sessionDO); | |
| 118 | - prepareData.forEach(userSessionMapper::insert); | |
| 119 | - | |
| 120 | - // 清空超时数据 | |
| 121 | - long actualTimeoutCount = userSessionService.clearSessionTimeout(); | |
| 122 | - // 校验 | |
| 123 | - assertEquals(expectedTimeoutCount, actualTimeoutCount); | |
| 124 | - List<SysUserSessionDO> userSessionDOS = userSessionMapper.selectList(); | |
| 125 | - assertEquals(expectedTotal, userSessionDOS.size()); | |
| 126 | - AssertUtils.assertPojoEquals(sessionDO, userSessionDOS.get(0), "updateTime"); | |
| 127 | - } | |
| 128 | - | |
| 129 | -} |
yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/common/SysCaptchaServiceTest.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.common; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.BaseRedisUnitTest; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.framework.captcha.config.CaptchaProperties; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.controller.common.vo.SysCaptchaImageRespVO; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.dal.redis.common.SysCaptchaRedisDAO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.service.common.impl.SysCaptchaServiceImpl; | |
| 8 | -import org.junit.jupiter.api.Test; | |
| 9 | -import org.springframework.context.annotation.Import; | |
| 10 | - | |
| 11 | -import javax.annotation.Resource; | |
| 12 | - | |
| 13 | -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString; | |
| 14 | -import static org.junit.jupiter.api.Assertions.*; | |
| 15 | - | |
| 16 | -@Import({SysCaptchaServiceImpl.class, CaptchaProperties.class, SysCaptchaRedisDAO.class}) | |
| 17 | -public class SysCaptchaServiceTest extends BaseRedisUnitTest { | |
| 18 | - | |
| 19 | - @Resource | |
| 20 | - private SysCaptchaServiceImpl captchaService; | |
| 21 | - | |
| 22 | - @Resource | |
| 23 | - private SysCaptchaRedisDAO captchaRedisDAO; | |
| 24 | - @Resource | |
| 25 | - private CaptchaProperties captchaProperties; | |
| 26 | - | |
| 27 | - @Test | |
| 28 | - public void testGetCaptchaImage() { | |
| 29 | - // 调用 | |
| 30 | - SysCaptchaImageRespVO respVO = captchaService.getCaptchaImage(); | |
| 31 | - // 断言 | |
| 32 | - assertNotNull(respVO.getUuid()); | |
| 33 | - assertNotNull(respVO.getImg()); | |
| 34 | - String captchaCode = captchaRedisDAO.get(respVO.getUuid()); | |
| 35 | - assertNotNull(captchaCode); | |
| 36 | - } | |
| 37 | - | |
| 38 | - @Test | |
| 39 | - public void testGetCaptchaCode() { | |
| 40 | - // 准备参数 | |
| 41 | - String uuid = randomString(); | |
| 42 | - String code = randomString(); | |
| 43 | - // mock 数据 | |
| 44 | - captchaRedisDAO.set(uuid, code, captchaProperties.getTimeout()); | |
| 45 | - | |
| 46 | - // 调用 | |
| 47 | - String resultCode = captchaService.getCaptchaCode(uuid); | |
| 48 | - // 断言 | |
| 49 | - assertEquals(code, resultCode); | |
| 50 | - } | |
| 51 | - | |
| 52 | - @Test | |
| 53 | - public void testDeleteCaptchaCode() { | |
| 54 | - // 准备参数 | |
| 55 | - String uuid = randomString(); | |
| 56 | - String code = randomString(); | |
| 57 | - // mock 数据 | |
| 58 | - captchaRedisDAO.set(uuid, code, captchaProperties.getTimeout()); | |
| 59 | - | |
| 60 | - // 调用 | |
| 61 | - captchaService.deleteCaptchaCode(uuid); | |
| 62 | - // 断言 | |
| 63 | - assertNull(captchaRedisDAO.get(uuid)); | |
| 64 | - } | |
| 65 | - | |
| 66 | -} |
yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/logger/SysLoginLogServiceImplTest.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.logger; | |
| 2 | - | |
| 3 | -import cn.hutool.core.util.RandomUtil; | |
| 4 | -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; | |
| 5 | -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; | |
| 6 | -import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 7 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 8 | -import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO; | |
| 10 | -import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO; | |
| 11 | -import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.logger.SysLoginLogMapper; | |
| 12 | -import cn.iocoder.yudao.adminserver.modules.system.enums.logger.SysLoginLogTypeEnum; | |
| 13 | -import cn.iocoder.yudao.adminserver.modules.system.enums.logger.SysLoginResultEnum; | |
| 14 | -import cn.iocoder.yudao.adminserver.modules.system.service.logger.impl.SysLoginLogServiceImpl; | |
| 15 | -import cn.iocoder.yudao.framework.test.core.util.RandomUtils; | |
| 16 | -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | |
| 17 | -import org.junit.jupiter.api.Test; | |
| 18 | -import org.springframework.context.annotation.Import; | |
| 19 | - | |
| 20 | -import javax.annotation.Resource; | |
| 21 | -import java.util.List; | |
| 22 | - | |
| 23 | -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | |
| 24 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; | |
| 25 | -import static org.junit.jupiter.api.Assertions.assertEquals; | |
| 26 | - | |
| 27 | -@Import(SysLoginLogServiceImpl.class) | |
| 28 | -public class SysLoginLogServiceImplTest extends BaseDbUnitTest { | |
| 29 | - | |
| 30 | - @Resource | |
| 31 | - private SysLoginLogServiceImpl sysLoginLogService; | |
| 32 | - | |
| 33 | - @Resource | |
| 34 | - private SysLoginLogMapper loginLogMapper; | |
| 35 | - | |
| 36 | - @Test | |
| 37 | - public void testGetLoginLogPage() { | |
| 38 | - // 构造测试数据 | |
| 39 | - // 登录成功的 | |
| 40 | - SysLoginLogDO loginLogDO = RandomUtils.randomPojo(SysLoginLogDO.class, logDO -> { | |
| 41 | - logDO.setLogType(RandomUtil.randomEle(SysLoginLogTypeEnum.values()).getType()); | |
| 42 | - logDO.setTraceId(TracerUtils.getTraceId()); | |
| 43 | - logDO.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue()); | |
| 44 | - | |
| 45 | - logDO.setUserIp("192.168.199.16"); | |
| 46 | - logDO.setUsername("wangkai"); | |
| 47 | - logDO.setCreateTime(buildTime(2021, 3, 6)); | |
| 48 | - logDO.setResult(SysLoginResultEnum.SUCCESS.getResult()); | |
| 49 | - }); | |
| 50 | - loginLogMapper.insert(loginLogDO); | |
| 51 | - | |
| 52 | - // 下面几个都是不匹配的数据 | |
| 53 | - // 登录失败的 | |
| 54 | - loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setResult(SysLoginResultEnum.CAPTCHA_CODE_ERROR.getResult()))); | |
| 55 | - // 不同ip段的 | |
| 56 | - loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setUserIp("192.168.128.18"))); | |
| 57 | - // 不同username | |
| 58 | - loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setUsername("yunai"))); | |
| 59 | - // 构造一个早期时间 2021-02-06 00:00:00 | |
| 60 | - loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setCreateTime(buildTime(2021, 2, 6)))); | |
| 61 | - | |
| 62 | - | |
| 63 | - // 构造调用参数 | |
| 64 | - SysLoginLogPageReqVO reqVO = new SysLoginLogPageReqVO(); | |
| 65 | - reqVO.setUsername("wangkai"); | |
| 66 | - reqVO.setUserIp("192.168.199"); | |
| 67 | - reqVO.setStatus(true); | |
| 68 | - reqVO.setBeginTime(buildTime(2021, 3, 5)); | |
| 69 | - reqVO.setEndTime(buildTime(2021, 3, 7)); | |
| 70 | - | |
| 71 | - // 调用service方法 | |
| 72 | - PageResult<SysLoginLogDO> pageResult = sysLoginLogService.getLoginLogPage(reqVO); | |
| 73 | - | |
| 74 | - // 断言,只查到了一条符合条件的 | |
| 75 | - assertEquals(1, pageResult.getTotal()); | |
| 76 | - assertEquals(1, pageResult.getList().size()); | |
| 77 | - assertPojoEquals(loginLogDO, pageResult.getList().get(0)); | |
| 78 | - } | |
| 79 | - | |
| 80 | - @Test | |
| 81 | - public void testGetLoginLogList() { | |
| 82 | - // 构造测试数据 | |
| 83 | - | |
| 84 | - // 登录成功的 | |
| 85 | - SysLoginLogDO loginLogDO = RandomUtils.randomPojo(SysLoginLogDO.class, logDO -> { | |
| 86 | - logDO.setLogType(RandomUtil.randomEle(SysLoginLogTypeEnum.values()).getType()); | |
| 87 | - logDO.setTraceId(TracerUtils.getTraceId()); | |
| 88 | - logDO.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue()); | |
| 89 | - | |
| 90 | - logDO.setUserIp("192.168.111.16"); | |
| 91 | - logDO.setUsername("wangxiaokai"); | |
| 92 | - logDO.setCreateTime(buildTime(2021, 3, 6)); | |
| 93 | - logDO.setResult(SysLoginResultEnum.SUCCESS.getResult()); | |
| 94 | - }); | |
| 95 | - loginLogMapper.insert(loginLogDO); | |
| 96 | - | |
| 97 | - // 下面几个都是不匹配的数据 | |
| 98 | - // 登录失败的 | |
| 99 | - loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setResult(SysLoginResultEnum.CAPTCHA_CODE_ERROR.getResult()))); | |
| 100 | - // 不同ip段的 | |
| 101 | - loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setUserIp("192.168.128.18"))); | |
| 102 | - // 不同username | |
| 103 | - loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setUsername("yunai"))); | |
| 104 | - // 构造一个早期时间 2021-02-06 00:00:00 | |
| 105 | - loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setCreateTime(buildTime(2021, 2, 6)))); | |
| 106 | - | |
| 107 | - | |
| 108 | - // 构造调用参数 | |
| 109 | - SysLoginLogExportReqVO reqVO = new SysLoginLogExportReqVO(); | |
| 110 | - reqVO.setUsername("wangxiaokai"); | |
| 111 | - reqVO.setUserIp("192.168.111"); | |
| 112 | - reqVO.setStatus(true); | |
| 113 | - reqVO.setBeginTime(buildTime(2021, 3, 5)); | |
| 114 | - reqVO.setEndTime(buildTime(2021, 3, 7)); | |
| 115 | - | |
| 116 | - | |
| 117 | - // 调用service方法 | |
| 118 | - List<SysLoginLogDO> loginLogList = sysLoginLogService.getLoginLogList(reqVO); | |
| 119 | - | |
| 120 | - // 断言 | |
| 121 | - assertEquals(1, loginLogList.size()); | |
| 122 | - assertPojoEquals(loginLogDO, loginLogList.get(0)); | |
| 123 | - } | |
| 124 | -} |
yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/notice/SysNoticeServiceImplTest.java deleted
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.service.notice; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; | |
| 4 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticeCreateReqVO; | |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticePageReqVO; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticeUpdateReqVO; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.notice.SysNoticeDO; | |
| 10 | -import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.notice.SysNoticeMapper; | |
| 11 | -import cn.iocoder.yudao.adminserver.modules.system.enums.notice.SysNoticeTypeEnum; | |
| 12 | -import cn.iocoder.yudao.adminserver.modules.system.service.notice.impl.SysNoticeServiceImpl; | |
| 13 | -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | |
| 14 | -import org.junit.jupiter.api.Test; | |
| 15 | -import org.springframework.context.annotation.Import; | |
| 16 | - | |
| 17 | -import javax.annotation.Resource; | |
| 18 | - | |
| 19 | -import java.util.function.Consumer; | |
| 20 | - | |
| 21 | -import static cn.hutool.core.util.RandomUtil.randomEle; | |
| 22 | -import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.NOTICE_NOT_FOUND; | |
| 23 | -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | |
| 24 | -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | |
| 25 | -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | |
| 26 | -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | |
| 27 | -import static org.junit.jupiter.api.Assertions.*; | |
| 28 | - | |
| 29 | -@Import(SysNoticeServiceImpl.class) | |
| 30 | -class SysNoticeServiceImplTest extends BaseDbUnitTest { | |
| 31 | - | |
| 32 | - @Resource | |
| 33 | - private SysNoticeServiceImpl sysNoticeService; | |
| 34 | - | |
| 35 | - @Resource | |
| 36 | - private SysNoticeMapper sysNoticeMapper; | |
| 37 | - | |
| 38 | - @Test | |
| 39 | - public void testPageNotices_success() { | |
| 40 | - // 插入前置数据 | |
| 41 | - SysNoticeDO dbNotice = randomPojo(SysNoticeDO.class, o -> { | |
| 42 | - o.setTitle("尼古拉斯赵四来啦!"); | |
| 43 | - o.setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 44 | - o.setType(randomEle(SysNoticeTypeEnum.values()).getType()); | |
| 45 | - }); | |
| 46 | - sysNoticeMapper.insert(dbNotice); | |
| 47 | - | |
| 48 | - // 测试 title 不匹配 | |
| 49 | - sysNoticeMapper.insert(ObjectUtils.cloneIgnoreId(dbNotice, o -> o.setTitle("尼古拉斯凯奇也来啦!"))); | |
| 50 | - // 测试 status 不匹配 | |
| 51 | - sysNoticeMapper.insert(ObjectUtils.cloneIgnoreId(dbNotice, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); | |
| 52 | - | |
| 53 | - | |
| 54 | - // 查询 | |
| 55 | - SysNoticePageReqVO reqVO = new SysNoticePageReqVO(); | |
| 56 | - reqVO.setTitle("尼古拉斯赵四来啦!"); | |
| 57 | - reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 58 | - PageResult<SysNoticeDO> pageResult = sysNoticeService.pageNotices(reqVO); | |
| 59 | - | |
| 60 | - // 验证查询结果经过筛选 | |
| 61 | - assertEquals(1, pageResult.getTotal()); | |
| 62 | - assertEquals(1, pageResult.getList().size()); | |
| 63 | - assertPojoEquals(dbNotice, pageResult.getList().get(0)); | |
| 64 | - | |
| 65 | - } | |
| 66 | - | |
| 67 | - @Test | |
| 68 | - public void testGetNotice_success() { | |
| 69 | - // 插入前置数据 | |
| 70 | - SysNoticeDO dbNotice = randomSysNoticeDO(); | |
| 71 | - sysNoticeMapper.insert(dbNotice); | |
| 72 | - | |
| 73 | - // 查询 | |
| 74 | - SysNoticeDO notice = sysNoticeService.getNotice(dbNotice.getId()); | |
| 75 | - | |
| 76 | - // 验证插入与读取对象是否一致 | |
| 77 | - assertNotNull(notice); | |
| 78 | - assertPojoEquals(dbNotice, notice); | |
| 79 | - } | |
| 80 | - | |
| 81 | - @Test | |
| 82 | - public void testCreateNotice_success() { | |
| 83 | - // 准备参数 | |
| 84 | - SysNoticeCreateReqVO reqVO = randomSysNoticeCreateReqVO(); | |
| 85 | - | |
| 86 | - // 校验插入是否成功 | |
| 87 | - Long noticeId = sysNoticeService.createNotice(reqVO); | |
| 88 | - assertNotNull(noticeId); | |
| 89 | - | |
| 90 | - // 校验插入属性是否正确 | |
| 91 | - SysNoticeDO notice = sysNoticeMapper.selectById(noticeId); | |
| 92 | - assertPojoEquals(reqVO, notice); | |
| 93 | - } | |
| 94 | - | |
| 95 | - @Test | |
| 96 | - public void testUpdateNotice_success() { | |
| 97 | - // 插入前置数据 | |
| 98 | - SysNoticeDO dbNoticeDO = randomSysNoticeDO(); | |
| 99 | - sysNoticeMapper.insert(dbNoticeDO); | |
| 100 | - | |
| 101 | - // 准备更新参数 | |
| 102 | - SysNoticeUpdateReqVO reqVO = randomSysNoticeUpdateReqVO(o -> o.setId(dbNoticeDO.getId())); | |
| 103 | - | |
| 104 | - // 更新 | |
| 105 | - sysNoticeService.updateNotice(reqVO); | |
| 106 | - | |
| 107 | - // 检验是否更新成功 | |
| 108 | - SysNoticeDO notice = sysNoticeMapper.selectById(reqVO.getId()); | |
| 109 | - assertPojoEquals(reqVO, notice); | |
| 110 | - } | |
| 111 | - | |
| 112 | - @Test | |
| 113 | - public void testDeleteNotice_success() { | |
| 114 | - // 插入前置数据 | |
| 115 | - SysNoticeDO dbNotice = randomSysNoticeDO(); | |
| 116 | - sysNoticeMapper.insert(dbNotice); | |
| 117 | - | |
| 118 | - // 删除 | |
| 119 | - sysNoticeService.deleteNotice(dbNotice.getId()); | |
| 120 | - | |
| 121 | - // 检查是否删除成功 | |
| 122 | - assertNull(sysNoticeMapper.selectById(dbNotice.getId())); | |
| 123 | - } | |
| 124 | - | |
| 125 | - @Test | |
| 126 | - public void checkNoticeExists_success() { | |
| 127 | - // 插入前置数据 | |
| 128 | - SysNoticeDO dbNotice = randomSysNoticeDO(); | |
| 129 | - sysNoticeMapper.insert(dbNotice); | |
| 130 | - | |
| 131 | - // 成功调用 | |
| 132 | - sysNoticeService.checkNoticeExists(dbNotice.getId()); | |
| 133 | - } | |
| 134 | - | |
| 135 | - @Test | |
| 136 | - public void checkNoticeExists_noExists() { | |
| 137 | - assertServiceException(() -> sysNoticeService.checkNoticeExists(randomLongId()), NOTICE_NOT_FOUND); | |
| 138 | - } | |
| 139 | - | |
| 140 | - @SafeVarargs | |
| 141 | - private static SysNoticeDO randomSysNoticeDO(Consumer<SysNoticeDO>... consumers) { | |
| 142 | - SysNoticeDO notice = randomPojo(SysNoticeDO.class, consumers); | |
| 143 | - notice.setType(randomEle(SysNoticeTypeEnum.values()).getType()); | |
| 144 | - notice.setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 145 | - return notice; | |
| 146 | - } | |
| 147 | - | |
| 148 | - @SafeVarargs | |
| 149 | - private static SysNoticeUpdateReqVO randomSysNoticeUpdateReqVO(Consumer<SysNoticeUpdateReqVO>... consumers) { | |
| 150 | - SysNoticeUpdateReqVO reqVO = randomPojo(SysNoticeUpdateReqVO.class, consumers); | |
| 151 | - reqVO.setType(randomEle(SysNoticeTypeEnum.values()).getType()); | |
| 152 | - reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 153 | - return reqVO; | |
| 154 | - } | |
| 155 | - | |
| 156 | - private static SysNoticeCreateReqVO randomSysNoticeCreateReqVO() { | |
| 157 | - SysNoticeCreateReqVO reqVO = randomPojo(SysNoticeCreateReqVO.class); | |
| 158 | - reqVO.setType(randomEle(SysNoticeTypeEnum.values()).getType()); | |
| 159 | - reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 160 | - return reqVO; | |
| 161 | - } | |
| 162 | - | |
| 163 | - | |
| 164 | -} |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java
| ... | ... | @@ -15,7 +15,8 @@ import org.springframework.context.annotation.Configuration; |
| 15 | 15 | * @author 芋道源码 |
| 16 | 16 | */ |
| 17 | 17 | @Configuration |
| 18 | -@MapperScan(value = {"${yudao.info.base-package}", "${yudao.core-service.base-package}", "${yudao.info.member-package}"}, | |
| 18 | +@MapperScan(value = {"${yudao.info.base-package}", "${yudao.core-service.base-package}", | |
| 19 | + "${yudao.info.member-package}", "${yudao.info.system-package}"}, | |
| 19 | 20 | annotationClass = Mapper.class, |
| 20 | 21 | lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试 |
| 21 | 22 | public class YudaoMybatisAutoConfiguration { | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/enums/SqlConstants.java renamed to yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/enums/SqlConstants.java
yudao-module-member/yudao-module-member-impl/pom.xml
| ... | ... | @@ -34,10 +34,7 @@ |
| 34 | 34 | <groupId>cn.iocoder.boot</groupId> |
| 35 | 35 | <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> |
| 36 | 36 | </dependency> |
| 37 | - <dependency> | |
| 38 | - <groupId>cn.iocoder.boot</groupId> | |
| 39 | - <artifactId>yudao-spring-boot-starter-biz-sms</artifactId> | |
| 40 | - </dependency> | |
| 37 | + | |
| 41 | 38 | <dependency> |
| 42 | 39 | <groupId>cn.iocoder.boot</groupId> |
| 43 | 40 | <artifactId>yudao-spring-boot-starter-biz-weixin</artifactId> | ... | ... |
yudao-module-system/pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | |
| 3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 5 | + <parent> | |
| 6 | + <groupId>cn.iocoder.boot</groupId> | |
| 7 | + <artifactId>yudao</artifactId> | |
| 8 | + <version>${revision}</version> | |
| 9 | + </parent> | |
| 10 | + <modelVersion>4.0.0</modelVersion> | |
| 11 | + <modules> | |
| 12 | + <module>yudao-module-system-api</module> | |
| 13 | + <module>yudao-module-system-impl</module> | |
| 14 | + </modules> | |
| 15 | + <artifactId>yudao-module-system</artifactId> | |
| 16 | + <packaging>pom</packaging> | |
| 17 | + | |
| 18 | + <name>${artifactId}</name> | |
| 19 | + <description> | |
| 20 | + system 模块下,我们放通用业务,支撑上层的核心业务。 | |
| 21 | + 例如说:用户、部门、权限、数据字典等等 | |
| 22 | + </description> | |
| 23 | + | |
| 24 | +</project> | ... | ... |
yudao-module-system/yudao-module-system-api/pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | |
| 3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 5 | + <parent> | |
| 6 | + <groupId>cn.iocoder.boot</groupId> | |
| 7 | + <artifactId>yudao-module-system</artifactId> | |
| 8 | + <version>${revision}</version> | |
| 9 | + </parent> | |
| 10 | + <modelVersion>4.0.0</modelVersion> | |
| 11 | + <artifactId>yudao-module-system-api</artifactId> | |
| 12 | + <packaging>jar</packaging> | |
| 13 | + | |
| 14 | + <name>${artifactId}</name> | |
| 15 | + <description> | |
| 16 | + system 模块 API,暴露给其它模块调用 | |
| 17 | + </description> | |
| 18 | + | |
| 19 | + <dependencies> | |
| 20 | + <dependency> | |
| 21 | + <groupId>cn.iocoder.boot</groupId> | |
| 22 | + <artifactId>yudao-common</artifactId> | |
| 23 | + </dependency> | |
| 24 | + </dependencies> | |
| 25 | + | |
| 26 | +</project> | ... | ... |
yudao-module-system/yudao-module-system-impl/pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | |
| 3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 5 | + <parent> | |
| 6 | + <groupId>cn.iocoder.boot</groupId> | |
| 7 | + <artifactId>yudao-module-system</artifactId> | |
| 8 | + <version>${revision}</version> | |
| 9 | + </parent> | |
| 10 | + <modelVersion>4.0.0</modelVersion> | |
| 11 | + <artifactId>yudao-module-system-impl</artifactId> | |
| 12 | + <packaging>jar</packaging> | |
| 13 | + | |
| 14 | + <name>${artifactId}</name> | |
| 15 | + <description> | |
| 16 | + system 模块下,我们放通用业务,支撑上层的核心业务。 | |
| 17 | + 例如说:用户、部门、权限、数据字典等等 | |
| 18 | + </description> | |
| 19 | + | |
| 20 | + <dependencies> | |
| 21 | + <dependency> | |
| 22 | + <groupId>cn.iocoder.boot</groupId> | |
| 23 | + <artifactId>yudao-module-system-api</artifactId> | |
| 24 | + <version>${revision}</version> | |
| 25 | + </dependency> | |
| 26 | + | |
| 27 | + <!-- 业务组件 --> | |
| 28 | + <dependency> | |
| 29 | + <groupId>cn.iocoder.boot</groupId> | |
| 30 | + <artifactId>yudao-core-service</artifactId> | |
| 31 | + </dependency> | |
| 32 | + | |
| 33 | + <dependency> | |
| 34 | + <groupId>cn.iocoder.boot</groupId> | |
| 35 | + <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> | |
| 36 | + </dependency> | |
| 37 | + <dependency> | |
| 38 | + <groupId>cn.iocoder.boot</groupId> | |
| 39 | + <artifactId>yudao-spring-boot-starter-biz-sms</artifactId> | |
| 40 | + </dependency> | |
| 41 | + <dependency> | |
| 42 | + <groupId>cn.iocoder.boot</groupId> | |
| 43 | + <artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId> | |
| 44 | + </dependency> | |
| 45 | + | |
| 46 | + <!-- Web 相关 --> | |
| 47 | + <dependency> | |
| 48 | + <groupId>cn.iocoder.boot</groupId> | |
| 49 | + <artifactId>yudao-spring-boot-starter-security</artifactId> | |
| 50 | + </dependency> | |
| 51 | + | |
| 52 | + <!-- DB 相关 --> | |
| 53 | + <dependency> | |
| 54 | + <groupId>cn.iocoder.boot</groupId> | |
| 55 | + <artifactId>yudao-spring-boot-starter-mybatis</artifactId> | |
| 56 | + </dependency> | |
| 57 | + | |
| 58 | + <dependency> | |
| 59 | + <groupId>cn.iocoder.boot</groupId> | |
| 60 | + <artifactId>yudao-spring-boot-starter-redis</artifactId> | |
| 61 | + </dependency> | |
| 62 | + | |
| 63 | + <!-- 消息队列相关 --> | |
| 64 | + <dependency> | |
| 65 | + <groupId>cn.iocoder.boot</groupId> | |
| 66 | + <artifactId>yudao-spring-boot-starter-mq</artifactId> | |
| 67 | + </dependency> | |
| 68 | + | |
| 69 | + <!-- Test 测试相关 --> | |
| 70 | + <dependency> | |
| 71 | + <groupId>cn.iocoder.boot</groupId> | |
| 72 | + <artifactId>yudao-spring-boot-starter-test</artifactId> | |
| 73 | + <scope>test</scope> | |
| 74 | + </dependency> | |
| 75 | + | |
| 76 | + <!-- 工具类相关 --> | |
| 77 | + <dependency> | |
| 78 | + <groupId>cn.iocoder.boot</groupId> | |
| 79 | + <artifactId>yudao-spring-boot-starter-excel</artifactId> | |
| 80 | + </dependency> | |
| 81 | + | |
| 82 | + </dependencies> | |
| 83 | + | |
| 84 | + <build> | |
| 85 | + <!-- 设置构建的 jar 包名 --> | |
| 86 | + <finalName>${artifactId}</finalName> | |
| 87 | + <plugins> | |
| 88 | + <!-- 打包 --> | |
| 89 | + <plugin> | |
| 90 | + <groupId>org.springframework.boot</groupId> | |
| 91 | + <artifactId>spring-boot-maven-plugin</artifactId> | |
| 92 | + <configuration> | |
| 93 | + <fork>true</fork> | |
| 94 | + </configuration> | |
| 95 | + <executions> | |
| 96 | + <execution> | |
| 97 | + <goals> | |
| 98 | + <goal>repackage</goal> <!-- 将引入的 jar 打入其中 --> | |
| 99 | + </goals> | |
| 100 | + </execution> | |
| 101 | + </executions> | |
| 102 | + </plugin> | |
| 103 | + </plugins> | |
| 104 | + </build> | |
| 105 | + | |
| 106 | +</project> | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/SysAuthController.http renamed to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/auth/SysAuthController.http
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/SysAuthController.java renamed to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/auth/SysAuthController.java
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.controller.auth; | |
| 1 | +package cn.iocoder.yudao.module.system.controller.auth; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.auth.*; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.convert.auth.SysAuthConvert; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysMenuDO; | |
| 3 | +import cn.iocoder.yudao.module.system.controller.auth.vo.auth.*; | |
| 4 | +import cn.iocoder.yudao.module.system.convert.auth.SysAuthConvert; | |
| 5 | +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysMenuDO; | |
| 6 | 6 | import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.enums.permission.MenuTypeEnum; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.service.auth.SysAuthService; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysPermissionService; | |
| 10 | -import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysRoleService; | |
| 7 | +import cn.iocoder.yudao.module.system.enums.permission.MenuTypeEnum; | |
| 8 | +import cn.iocoder.yudao.module.system.service.auth.SysAuthService; | |
| 9 | +import cn.iocoder.yudao.module.system.service.permission.SysPermissionService; | |
| 10 | +import cn.iocoder.yudao.module.system.service.permission.SysRoleService; | |
| 11 | 11 | import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; |
| 12 | 12 | import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService; |
| 13 | 13 | import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/SysUserSessionController.java renamed to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/auth/SysUserSessionController.java
| 1 | -package cn.iocoder.yudao.adminserver.modules.system.controller.auth; | |
| 1 | +package cn.iocoder.yudao.module.system.controller.auth; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.session.SysUserSessionPageItemRespVO; | |
| 4 | -import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.session.SysUserSessionPageReqVO; | |
| 5 | -import cn.iocoder.yudao.adminserver.modules.system.convert.auth.SysUserSessionConvert; | |
| 3 | +import cn.iocoder.yudao.module.system.controller.auth.vo.session.SysUserSessionPageItemRespVO; | |
| 4 | +import cn.iocoder.yudao.module.system.controller.auth.vo.session.SysUserSessionPageReqVO; | |
| 5 | +import cn.iocoder.yudao.module.system.convert.auth.SysUserSessionConvert; | |
| 6 | 6 | import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; |
| 7 | -import cn.iocoder.yudao.adminserver.modules.system.service.auth.SysUserSessionService; | |
| 8 | -import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysDeptService; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.system.service.user.SysUserService; | |
| 7 | +import cn.iocoder.yudao.module.system.service.auth.SysUserSessionService; | |
| 10 | 8 | import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; |
| 11 | 9 | import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; |
| 12 | 10 | import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService; | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/vo/auth/SysAuthLoginReqVO.java renamed to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/auth/vo/auth/SysAuthLoginReqVO.java
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/vo/auth/SysAuthLoginRespVO.java renamed to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/auth/vo/auth/SysAuthLoginRespVO.java
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/vo/auth/SysAuthMenuRespVO.java renamed to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/auth/vo/auth/SysAuthMenuRespVO.java