Browse Source

更新剩余天数相关逻辑

tags/v2.4.1
xiaoying 1 year ago
parent
commit
85c9dfef53
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java

+ 9
- 3
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java View File

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

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
@@ -341,12 +342,14 @@ public class TenantServiceImpl implements TenantService {
vo.setEffectiveDate(DateUtil.formatDate(tenantItem.getBeginTime()) + CommonConstant.TILDE + DateUtil.formatDate(tenantItem.getEndTime()));
Long day = null;
//超过有效期则为flase
//截止时间的凌晨
DateTime dateTime = DateUtil.endOfDay(tenantItem.getEndTime());
boolean flag = tenantItem.getBeginTime().after(DateUtil.date());
boolean flag2 = tenantItem.getEndTime().after(DateUtil.date());
boolean flag2 = dateTime.after(DateUtil.date());
if (!flag) {
day = DateUtil.between(DateUtil.date(), tenantItem.getEndTime(), DateUnit.DAY);
day = DateUtil.between(DateUtil.date(), dateTime, DateUnit.DAY);
} else {
day = DateUtil.between(tenantItem.getBeginTime(), tenantItem.getEndTime(), DateUnit.DAY);
day = DateUtil.between(tenantItem.getBeginTime(), dateTime, DateUnit.DAY);
}
if (!flag2) {
day = 0L;
@@ -531,6 +534,9 @@ public class TenantServiceImpl implements TenantService {
//默认密码
dto.setPassword(passward);
TenantPo tenant = tenantMapper.selectById(dto.getId());
if (ObjectUtil.isNull(tenant)) {
throw new ServiceException(ServiceExceptionEnum.GET_NO_DATA);
}
//租户对应的业务平台相关信息
//删除这个租户原本存在的所有业务平台下的信息
List<ClientRoleDto> clientRoleDtoList = new ArrayList<>();

Loading…
Cancel
Save