Merge remote-tracking branch 'origin/fix_793' into dev

This commit is contained in:
冷冷 committed 2020-02-24 22:23:37 +08:00
commit dcc969bf32
2 files changed
+12 -8

No files matched your search

@@ -28,10 +28,13 @@ import com.pig4cloud.pigx.common.security.annotation.Inner;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.util.List;
import java.util.stream.Collectors;
/**
* 租户管理
@@ -120,9 +123,13 @@ public class SysTenantController {
*/
@Inner(value = false)
@GetMapping("/list")
@Cacheable(value = CacheConstants.TENANT_DETAILS)
public R list() {
return R.ok(sysTenantService.getNormal());
final LocalDate today = LocalDate.now();
List<SysTenant> tenants = sysTenantService.getNormal()
.stream()
.filter(sysTenant -> (sysTenant.getStartTime().isAfter(today) && sysTenant.getEndTime().isBefore(today)))
.collect(Collectors.toList());
return R.ok(tenants);
}
}
@@ -32,13 +32,12 @@ import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.springframework.beans.BeanUtils;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import springfox.documentation.annotations.Cacheable;
import java.time.LocalDate;
import java.util.List;
import java.util.stream.Collectors;
@@ -75,9 +74,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
@Cacheable(value = CacheConstants.TENANT_DETAILS)
public List<SysTenant> getNormal() {
return list(Wrappers.<SysTenant>lambdaQuery()
.eq(SysTenant::getStatus, CommonConstants.STATUS_NORMAL)
.le(SysTenant::getStartTime, LocalDate.now())
.ge(SysTenant::getEndTime, LocalDate.now()));
.eq(SysTenant::getStatus, CommonConstants.STATUS_NORMAL));
}
/**