Browse Source

完成查询租户信息的基本详情信息添加租户的状态筛选

tags/v2.4.1
xiaoying 1 year ago
parent
commit
a08d8d8bb4
6 changed files with 45 additions and 7 deletions
  1. +4
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/query/TenantQuery.java
  2. +20
    -1
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/vo/TenantVo.java
  3. +14
    -2
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java
  4. +5
    -2
      tuoheng_oidc_admin/src/main/resources/mapper/TenantMapper.xml
  5. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/model/vo/TenantVo.class
  6. +2
    -2
      tuoheng_oidc_admin/target/classes/mapper/TenantMapper.xml

+ 4
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/query/TenantQuery.java View File

@@ -21,4 +21,8 @@ public class TenantQuery extends BaseQuery {
* 平台标识
*/
private String clientId;
/**
* 状态 1启用 0禁用
*/
private Integer status;
}

+ 20
- 1
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/vo/TenantVo.java View File

@@ -73,6 +73,25 @@ public class TenantVo {
private Date updateTime;

private Long userId;

/**
* 1,启用 0禁用
*/
private Integer status;
/**
* 客户联系人
*/
private String customer;
/**
* 客户联系方式
*/
private String customerPhone;
/**
* 剩余天数
*/
private Long remainDays;
/**
* 系统有效期
*/
private String effectiveDate;

}

+ 14
- 2
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java View File

@@ -1,6 +1,7 @@
package com.tuoheng.service.impl;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -121,6 +122,7 @@ public class TenantServiceImpl implements TenantService {
vo.setEffectiveDate(DateUtil.formatDate(tenantItem.getBeginTime()) + CommonConstant.TILDE + DateUtil.formatDate(tenantItem.getEndTime()));
log.info("租户项目表添加完毕");

StringBuilder PlatformName = new StringBuilder();
for (ClientRoleDto clientRoleDto : createClientTenantDto.getClientRoleDtoList()) {
//获取clientId查询对应平台获取平台名称
Platform platform = platformMapper.selectOne(Wrappers.<Platform>lambdaQuery()
@@ -130,7 +132,8 @@ public class TenantServiceImpl implements TenantService {
return JsonResult.error("该业务平台不存在");
}
//添加相关对应
vo.setPlatformName(platform.getPlatformName() + CommonConstant.SIGN);
PlatformName.append(platform.getPlatformName());
PlatformName.append(CommonConstant.SIGN);
//添加租户对应服务的相关表数据
TenantEmploy tenantEmploy = new TenantEmploy();
tenantEmploy.setTenantId(tenantPo.getId());
@@ -139,7 +142,7 @@ public class TenantServiceImpl implements TenantService {
tenantEmployMapper.insert(tenantEmploy);
}
//拼接
vo.setPlatformName(vo.getPlatformName().substring(CommonConstant.ZERO, vo.getPlatformName().lastIndexOf(CommonConstant.SIGN)));
vo.setPlatformName(PlatformName.substring(CommonConstant.ZERO, PlatformName.lastIndexOf(CommonConstant.SIGN)));
log.info("租户客户表添加完毕");
//1.开始判断租户对应需要的平台并进行匹对
List<ClientRoleDto> clientRoleDtoList = getClientRoleDtos(createClientTenantDto);
@@ -321,7 +324,16 @@ public class TenantServiceImpl implements TenantService {
List<TenantVo> collect = pageData.getRecords().stream().map(x -> {
TenantVo vo = new TenantVo();
BeanUtils.copyProperties(x, vo);
//并不是真正意义上的租户id
vo.setTenantId(x.getUserId());
TenantItem tenantItem = tenantItemMapper.selectOne(Wrappers.<TenantItem>lambdaQuery().eq(TenantItem::getTenantId, x.getId()));
if (ObjectUtil.isNotNull(tenantItem)) {
//获取有效期等
vo.setEffectiveDate(DateUtil.formatDate(tenantItem.getBeginTime()) + CommonConstant.TILDE + DateUtil.formatDate(tenantItem.getEndTime()));
//获取剩余天数
long day = DateUtil.between(tenantItem.getBeginTime(), tenantItem.getEndTime(), DateUnit.DAY);
vo.setRemainDays(day);
}
//此处userId = tenantId 效果一致
List<AuthoritiesPo> poList = authoritiesMapper.selectListByUserIdAndClientId(x.getUserId(), query);
if (ObjectUtil.isEmpty(poList)) {

+ 5
- 2
tuoheng_oidc_admin/src/main/resources/mapper/TenantMapper.xml View File

@@ -34,8 +34,8 @@
</select>
<select id="findList" resultType="com.tuoheng.model.vo.TenantVo">
SELECT t.id, t.user_id userId, t.remark, t.code tenantCode,
t.name
tenantName,t.province_code,t.province_name,t.city_code,t.city_name,t.district_code,t.district_name,u.username
t.name tenantName,t.status,t.customer,t.customer_phone
,t.province_code,t.province_name,t.city_code,t.city_name,t.district_code,t.district_name,u.username
username,t.update_time updateTime,t.create_time createTime
FROM t_tenant t,users u
WHERE t.enabled = 1 and u.enabled =1 and t.user_id =u.id
@@ -45,6 +45,9 @@
<if test="query.username != null and query.username != ''">
and u.username LIKE concat('%',#{query.username},'%')
</if>
<if test="query.username != null">
and t.status =#{query.status}
</if>
ORDER BY t.create_time desc
</select>
<select id="selectById" resultType="com.tuoheng.model.po.TenantPo">

BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/model/vo/TenantVo.class View File


+ 2
- 2
tuoheng_oidc_admin/target/classes/mapper/TenantMapper.xml View File

@@ -34,8 +34,8 @@
</select>
<select id="findList" resultType="com.tuoheng.model.vo.TenantVo">
SELECT t.id, t.user_id userId, t.remark, t.code tenantCode,
t.name
tenantName,t.province_code,t.province_name,t.city_code,t.city_name,t.district_code,t.district_name,u.username
t.name tenantName,t.status,t.customer,t.customer_phone
,t.province_code,t.province_name,t.city_code,t.city_name,t.district_code,t.district_name,u.username
username,t.update_time updateTime,t.create_time createTime
FROM t_tenant t,users u
WHERE t.enabled = 1 and u.enabled =1 and t.user_id =u.id

Loading…
Cancel
Save