Kaynağa Gözat

Merge branch 'develop' of gitadmin/tuoheng_oidc into release

tags/v2.4.1
xuziqing 1 yıl önce
ebeveyn
işleme
901aeef483
1 değiştirilmiş dosya ile 25 ekleme ve 6 silme
  1. +25
    -6
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java

+ 25
- 6
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java Dosyayı Görüntüle

@@ -42,6 +42,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -343,13 +345,14 @@ public class TenantServiceImpl implements TenantService {
Long day = null;
//超过有效期则为flase
//截止时间的凌晨
DateTime dateTime = DateUtil.endOfDay(tenantItem.getEndTime());
boolean flag = tenantItem.getBeginTime().after(DateUtil.date());
boolean flag2 = dateTime.after(DateUtil.date());
DateTime endTime = DateUtil.endOfDay(tenantItem.getEndTime());
DateTime beginTime = DateUtil.beginOfDay(tenantItem.getBeginTime());
boolean flag = beginTime.after(DateUtil.date());
boolean flag2 = endTime.after(DateUtil.date());
if (!flag) {
day = DateUtil.between(DateUtil.date(), dateTime, DateUnit.DAY);
day = getDay(DateUtil.date(), endTime);
} else {
day = DateUtil.between(tenantItem.getBeginTime(), dateTime, DateUnit.DAY);
day = getDay(beginTime, endTime);
}
if (!flag2) {
day = 0L;
@@ -387,6 +390,20 @@ public class TenantServiceImpl implements TenantService {
return JsonResult.success(pageData);
}

/**
* 根据有效期变更剩余天数逻辑
* @param beginTime
* @param endTime
* @return
*/
private Long getDay(DateTime beginTime, DateTime endTime) {
Long day;
day = DateUtil.between(beginTime, endTime, DateUnit.HOUR);
BigDecimal divide = BigDecimal.valueOf(day).divide(new BigDecimal(24), CommonConstant.ZERO, RoundingMode.UP);
day = divide.longValue();
return day;
}

/**
* 根据id查询出租户详情
*
@@ -624,8 +641,10 @@ public class TenantServiceImpl implements TenantService {
log.info("业务系统新增租户成功");
//原有集合
List<ClientRoleDto> clientRoleDtos = getClientRoleDtos(dto.getClientRoleDtoList());
//新的租户关联的平台集合
List<ClientRoleDto> finalClientRoleDtoList = getClientRoleDtos(clientRoleDtoList);
clientRoleDtos= clientRoleDtos.stream().filter(t -> !finalClientRoleDtoList.contains(t)).collect(Collectors.toList());
//筛选出一样的则不做相关操作
clientRoleDtos = clientRoleDtos.stream().filter(t -> !finalClientRoleDtoList.contains(t)).collect(Collectors.toList());

List<AuthoritiesPo> authoritiesPos = new ArrayList<>();
List<ClientUserRolePo> clientUserRolePoArrayList = new ArrayList<>();

Yükleniyor…
İptal
Kaydet