Browse Source

更新剩余天数判断

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

+ 8
- 1
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java View File

@@ -334,8 +334,15 @@ public class TenantServiceImpl implements TenantService {
if (ObjectUtil.isNotNull(tenantItem)) {
//获取有效期等
vo.setEffectiveDate(DateUtil.formatDate(tenantItem.getBeginTime()) + CommonConstant.TILDE + DateUtil.formatDate(tenantItem.getEndTime()));
Long day = null;
//超过有效期则为flase
boolean flag = tenantItem.getBeginTime().after(DateUtil.date());
if (!flag) {
day = DateUtil.between(DateUtil.date(), tenantItem.getEndTime(), DateUnit.DAY);
} else {
day = DateUtil.between(tenantItem.getBeginTime(), tenantItem.getEndTime(), DateUnit.DAY);
}
//获取剩余天数
long day = DateUtil.between(DateUtil.date(), tenantItem.getEndTime(), DateUnit.DAY);
vo.setRemainDays(day);
}
//此处userId = tenantId 效果一致

Loading…
Cancel
Save