mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-24 16:05:08 +08:00
Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/user-social
Conflicts: yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/service/auth/impl/SysAuthServiceImpl.java yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/auth/SysAuthServiceImplTest.java yudao-dependencies/pom.xml yudao-framework/pom.xml yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/auth/impl/SysAuthServiceImpl.java
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@ -21,7 +22,7 @@ import java.io.InputStream;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InfFileDO extends BaseDO {
|
||||
public class InfFileDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
|
@ -2,7 +2,7 @@ package cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
@ -21,7 +21,7 @@ import java.util.Date;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InfApiAccessLogDO extends BaseDO {
|
||||
public class InfApiAccessLogDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
@ -21,7 +21,7 @@ import java.util.Date;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InfApiErrorLogDO extends BaseDO {
|
||||
public class InfApiErrorLogDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
@ -22,7 +22,7 @@ import java.util.Date;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MbrUserDO extends BaseDO {
|
||||
public class MbrUserDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@ -25,7 +25,7 @@ import java.util.Date;
|
||||
@Data
|
||||
@Builder
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysUserSessionDO extends BaseDO {
|
||||
public class SysUserSessionDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 会话编号, 即 sessionId
|
||||
|
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 租户 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName(value = "sys_tenant", autoResultMap = true)
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SysTenantDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 租户编号,自增
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 租户名,唯一
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
private String contactName;
|
||||
/**
|
||||
* 联系手机
|
||||
*/
|
||||
private String contactMobile;
|
||||
/**
|
||||
* 帐号状态
|
||||
*
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -2,8 +2,8 @@ package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.system.enums.common.SysSexEnum;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@ -24,7 +24,7 @@ import java.util.Set;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysUserDO extends BaseDO {
|
||||
public class SysUserDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
|
@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.tenant;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysTenantCoreMapper extends BaseMapperX<SysTenantDO> {
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
package cn.iocoder.yudao.coreservice.modules.system.mq.message.sms;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
||||
import cn.iocoder.yudao.framework.mq.core.stream.StreamMessage;
|
||||
import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessage;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
@ -13,7 +14,8 @@ import java.util.List;
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class SysSmsSendMessage implements StreamMessage {
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysSmsSendMessage extends AbstractStreamMessage {
|
||||
|
||||
/**
|
||||
* 短信日志编号
|
||||
|
@ -2,9 +2,8 @@ package cn.iocoder.yudao.coreservice.modules.system.mq.producer.sms;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.system.mq.message.sms.SysSmsSendMessage;
|
||||
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
||||
import cn.iocoder.yudao.framework.mq.core.util.RedisMessageUtils;
|
||||
import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -21,7 +20,7 @@ import java.util.List;
|
||||
public class SysSmsCoreProducer {
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
private RedisMQTemplate redisMQTemplate;
|
||||
|
||||
/**
|
||||
* 发送 {@link SysSmsSendMessage} 消息
|
||||
@ -36,7 +35,7 @@ public class SysSmsCoreProducer {
|
||||
Long channelId, String apiTemplateId, List<KeyValue<String, Object>> templateParams) {
|
||||
SysSmsSendMessage message = new SysSmsSendMessage().setLogId(logId).setMobile(mobile);
|
||||
message.setChannelId(channelId).setApiTemplateId(apiTemplateId).setTemplateParams(templateParams);
|
||||
RedisMessageUtils.sendStreamMessage(stringRedisTemplate, message);
|
||||
redisMQTemplate.send(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package cn.iocoder.yudao.coreservice.modules.system.service.tenant;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkService;
|
||||
|
||||
/**
|
||||
* 租户 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface SysTenantCoreService extends TenantFrameworkService {
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.coreservice.modules.system.service.tenant.impl;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.tenant.SysTenantCoreMapper;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.service.tenant.SysTenantCoreService;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租户 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
public class SysTenantCoreServiceImpl implements SysTenantCoreService {
|
||||
|
||||
@Resource
|
||||
private SysTenantCoreMapper tenantCoreMapper;
|
||||
|
||||
@Override
|
||||
public List<Long> getTenantIds() {
|
||||
List<SysTenantDO> tenants = tenantCoreMapper.selectList();
|
||||
return CollectionUtils.convertList(tenants, SysTenantDO::getId);
|
||||
}
|
||||
|
||||
}
|
@ -90,3 +90,6 @@ yudao:
|
||||
base-package: cn.iocoder.yudao.adminserver
|
||||
core-service:
|
||||
base-package: cn.iocoder.yudao.coreservice
|
||||
pay:
|
||||
pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify
|
||||
refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify
|
||||
|
@ -42,7 +42,10 @@ public class SysUserSessionCoreServiceTest extends BaseDbAndRedisUnitTest {
|
||||
// 准备参数
|
||||
String userIp = randomString();
|
||||
String userAgent = randomString();
|
||||
LoginUser loginUser = randomPojo(LoginUser.class, o -> o.setUserType(randomEle(UserTypeEnum.values()).getValue()));
|
||||
LoginUser loginUser = randomPojo(LoginUser.class, o -> {
|
||||
o.setUserType(randomEle(UserTypeEnum.values()).getValue());
|
||||
o.setTenantId(0L); // 租户设置为 0,因为暂未启用多租户组件
|
||||
});
|
||||
// mock 方法
|
||||
when(securityProperties.getSessionTimeout()).thenReturn(Duration.ofDays(1));
|
||||
|
||||
|
@ -9,6 +9,7 @@ CREATE TABLE IF NOT EXISTS "inf_file" (
|
||||
"updater" varchar(64) DEFAULT '',
|
||||
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||
"tenant_id" bigint not null default '0',
|
||||
PRIMARY KEY ("id")
|
||||
) COMMENT '文件表';
|
||||
|
||||
@ -27,6 +28,7 @@ CREATE TABLE IF NOT EXISTS `sys_user_session` (
|
||||
`updater` varchar(64) DEFAULT '' ,
|
||||
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||
"tenant_id" bigint not null default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT '用户在线 Session';
|
||||
|
||||
@ -67,6 +69,7 @@ CREATE TABLE IF NOT EXISTS "inf_api_access_log" (
|
||||
"updater" varchar(64) default '',
|
||||
"update_time" timestamp not null default current_timestamp,
|
||||
"deleted" bit not null default false,
|
||||
"tenant_id" bigint not null default '0',
|
||||
primary key ("id")
|
||||
) COMMENT 'API 访问日志表';
|
||||
|
||||
@ -98,6 +101,7 @@ CREATE TABLE IF NOT EXISTS "inf_api_error_log" (
|
||||
"updater" varchar(64) default '',
|
||||
"update_time" timestamp not null default current_timestamp,
|
||||
"deleted" bit not null default false,
|
||||
"tenant_id" bigint not null default '0',
|
||||
primary key ("id")
|
||||
) COMMENT '系统异常日志';
|
||||
|
||||
@ -151,6 +155,7 @@ CREATE TABLE IF NOT EXISTS "sys_sms_log" (
|
||||
"updater" varchar(64) DEFAULT '',
|
||||
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||
"tenant_id" bigint not null default '0',
|
||||
PRIMARY KEY ("id")
|
||||
) COMMENT '短信日志';
|
||||
|
||||
@ -169,5 +174,6 @@ CREATE TABLE IF NOT EXISTS `sys_login_log` (
|
||||
`updater` varchar(64) DEFAULT '',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`deleted` bit(1) NOT NULL DEFAULT '0',
|
||||
"tenant_id" bigint not null default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT ='系统访问记录';
|
||||
|
Reference in New Issue
Block a user