feat(system): 新增租户类型字段并支持代理钱包初始化
This commit is contained in:
@@ -50,4 +50,7 @@ public class TenantPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "父租户Id")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "租户类型", example = "代理/客户")
|
||||
private String tenantType;
|
||||
}
|
||||
|
||||
@@ -66,4 +66,7 @@ public class TenantRespVO {
|
||||
|
||||
@Schema(description = "上级租户 Id", example = "1024")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "租户类型", example = "代理/客户")
|
||||
private String tenantType;
|
||||
}
|
||||
|
||||
@@ -86,4 +86,8 @@ public class TenantSaveReqVO {
|
||||
@Schema(description = "备注", example = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "租户类型", example = "代理/客户")
|
||||
@NotNull(message = "租户类型不能为空")
|
||||
private String tenantType;
|
||||
|
||||
}
|
||||
|
||||
@@ -100,4 +100,10 @@ public class TenantDO extends BaseDO {
|
||||
*/
|
||||
|
||||
private String remark;
|
||||
|
||||
|
||||
/**
|
||||
* 租户类型
|
||||
*/
|
||||
private String tenantType;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public interface TenantMapper extends BaseMapperX<TenantDO> {
|
||||
.likeIfPresent(TenantDO::getContactName, reqVO.getContactName())
|
||||
.likeIfPresent(TenantDO::getContactMobile, reqVO.getContactMobile())
|
||||
.eqIfPresent(TenantDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(TenantDO::getTenantType, reqVO.getTenantType())
|
||||
.betweenIfPresent(TenantDO::getCreateTime, reqVO.getCreateTime())
|
||||
.betweenIfPresent(TenantDO::getAiExpireTime, reqVO.getAiExpireTime())
|
||||
.betweenIfPresent(TenantDO::getExpireTime, reqVO.getExpireTime())
|
||||
|
||||
@@ -21,7 +21,9 @@ import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenantbalance.TenantBalanceDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.tenant.TenantMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.tenantbalance.TenantBalanceMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.permission.RoleCodeEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.permission.RoleTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.service.permission.MenuService;
|
||||
@@ -74,6 +76,8 @@ public class TenantServiceImpl implements TenantService {
|
||||
private MenuService menuService;
|
||||
@Resource
|
||||
private PermissionService permissionService;
|
||||
@Resource
|
||||
private TenantBalanceMapper tenantBalanceMapper;
|
||||
|
||||
@Override
|
||||
public List<Long> getTenantIdList() {
|
||||
@@ -127,6 +131,16 @@ public class TenantServiceImpl implements TenantService {
|
||||
// 修改租户的管理员
|
||||
tenantMapper.updateById(new TenantDO().setId(tenant.getId()).setContactUserId(userId));
|
||||
});
|
||||
// 初始化代理钱包
|
||||
if (tenant.getTenantType().equals("代理")) {
|
||||
// 创建租户的钱包
|
||||
TenantBalanceDO tenantBalance = new TenantBalanceDO();
|
||||
tenantBalance.setId(tenant.getId());
|
||||
tenantBalance.setBalance(0);
|
||||
tenantBalance.setVersion(0);
|
||||
tenantBalanceMapper.insert(tenantBalance);
|
||||
}
|
||||
|
||||
return tenant.getId();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user