|
|
@@ -1,6 +1,7 @@ |
|
|
|
package com.tuoheng.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
|
import cn.hutool.core.date.DateUnit; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
@@ -10,7 +11,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.tuoheng.common.CommonConfig; |
|
|
|
import com.tuoheng.common.ServiceException; |
|
|
|
import com.tuoheng.common.ServiceExceptionEnum; |
|
|
|
import com.tuoheng.constant.*; |
|
|
|
import com.tuoheng.enums.MarkTypeEnum; |
|
|
|
import com.tuoheng.mapper.*; |
|
|
|
import com.tuoheng.model.dto.*; |
|
|
|
import com.tuoheng.model.entity.TenantEmploy; |
|
|
@@ -40,10 +43,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.client.RestTemplate; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@@ -208,7 +208,7 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
//暂时河湖长,动态匹配其他平台 |
|
|
|
case HhzUrlConstant.HHZ_CLIENT: |
|
|
|
addClientRoleDtoList(HhzUrlConstant.HHZ_CLIENT_MP, dto, clientRoleDtoList); |
|
|
|
addClientRoleDtoList(HhzUrlConstant.HHZ_CLIENT_ADMIN,dto, clientRoleDtoList); |
|
|
|
addClientRoleDtoList(HhzUrlConstant.HHZ_CLIENT_ADMIN, dto, clientRoleDtoList); |
|
|
|
break; |
|
|
|
case PilotConstant.PILOT_CLIENT: |
|
|
|
addClientRoleDtoList(PilotConstant.PILOT_CLIENT_ADMIN, dto, clientRoleDtoList); |
|
|
@@ -420,6 +420,42 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
return JsonResult.success(dto); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 更新租户状态(1 启用 0禁用) |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @param loginUser |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public JsonResult updateStatus(CreateClientTenantDto dto, LoginUser loginUser) { |
|
|
|
|
|
|
|
if (ObjectUtil.isNull(dto.getId())) { |
|
|
|
return JsonResult.error("租户id不能为空"); |
|
|
|
} |
|
|
|
TenantPo tenantPo = tenantMapper.selectById(dto.getId()); |
|
|
|
|
|
|
|
if (CommonConstant.ONE.equals(dto.getStatus())) { |
|
|
|
//启用 ->判断当前需要启用的系统是否过了有效期 |
|
|
|
TenantItem tenantItem = tenantItemMapper.selectOne(Wrappers.<TenantItem>lambdaQuery().eq(TenantItem::getTenantId, dto.getId())); |
|
|
|
//超过有效期则为flase |
|
|
|
boolean flag = tenantItem.getEndTime().after(DateUtil.date()); |
|
|
|
//则不给启用 |
|
|
|
if (!flag) { |
|
|
|
//有效期已过 |
|
|
|
return JsonResult.error(ServiceExceptionEnum.EXPIRATION_DATE.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
UserPo userPo = clientUserMapper.selectByUserId(tenantPo.getUserId()); |
|
|
|
//1正常 0禁用 |
|
|
|
userPo.setEnabled(dto.getStatus()); |
|
|
|
clientUserMapper.updatePass(userPo); |
|
|
|
tenantPo.setStatus(dto.getStatus()); |
|
|
|
tenantMapper.updateById(tenantPo); |
|
|
|
|
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 封装返回展示类 |