#1451 新增租户后,登录界面不显示

This commit is contained in:
冷冷 committed 2020-07-13 17:14:24 +08:00
1 parent d181e530a3
commit ba37cc4e06
3 files changed
+11 -7

No files matched your search

@@ -1,6 +1,7 @@
package com.pig4cloud.pigx.common.data.tenant;
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
@@ -19,7 +20,11 @@ public class TenantRequestInterceptor implements ClientHttpRequestInterceptor {
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
throws IOException {
request.getHeaders().set(CommonConstants.TENANT_ID, String.valueOf(TenantContextHolder.getTenantId()));
if (TenantContextHolder.getTenantId() != null) {
request.getHeaders().set(CommonConstants.TENANT_ID, String.valueOf(TenantContextHolder.getTenantId()));
}
return execution.execute(request, body);
}
@@ -25,7 +25,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
@@ -64,13 +63,13 @@ public class SysTenant extends Model<SysTenant> {
* 开始时间
*/
@ApiModelProperty(value = "开始时间")
private LocalDate startTime;
private LocalDateTime startTime;
/**
* 结束时间
*/
@ApiModelProperty(value = "结束时间")
private LocalDate endTime;
private LocalDateTime endTime;
/**
* 0正常 9-冻结
@@ -31,7 +31,7 @@ import org.springframework.cache.annotation.CacheEvict;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
@@ -117,8 +117,8 @@ public class SysTenantController {
@GetMapping("/list")
public R list() {
List<SysTenant> tenants = sysTenantService.getNormalTenant().stream()
.filter(tenant -> tenant.getStartTime().isBefore(LocalDate.now()))
.filter(tenant -> tenant.getEndTime().isAfter(LocalDate.now())).collect(Collectors.toList());
.filter(tenant -> tenant.getStartTime().isBefore(LocalDateTime.now()))
.filter(tenant -> tenant.getEndTime().isAfter(LocalDateTime.now())).collect(Collectors.toList());
return R.ok(tenants);
}