Compare commits
4 Commits
7db9d6ef8e
...
d0d78d54c6
| Author | SHA1 | Date |
|---|---|---|
|
|
d0d78d54c6 | |
|
|
27d6fe13e8 | |
|
|
33365d5aa9 | |
|
|
7cf1dfcf9f |
|
|
@ -30,6 +30,7 @@ import javax.validation.Valid;
|
|||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -58,8 +59,9 @@ public class DeviceTypeController extends ControllerBase {
|
|||
.eq(GongfuDeviceType::getParentId, 0)
|
||||
.orderByDesc(GongfuDeviceType::getId)
|
||||
.page(new Page<>(query.getPage(), query.getPageSize()));
|
||||
Set<Long> ids = result.getRecords().stream().map(GongfuDeviceType::getId).collect(Collectors.toSet());
|
||||
List<GongfuDeviceType> children = deviceTypeService.lambdaQuery()
|
||||
.in(GongfuDeviceType::getParentId, result.getRecords().stream().map(GongfuDeviceType::getId).collect(Collectors.toList()))
|
||||
.in(CollectionUtil.isNotEmpty(ids), GongfuDeviceType::getParentId, ids)
|
||||
.list();
|
||||
return ApiResult.success(convert(query, result, children));
|
||||
} else {
|
||||
|
|
@ -70,8 +72,9 @@ public class DeviceTypeController extends ControllerBase {
|
|||
if (CollectionUtil.isEmpty(children)) {
|
||||
return ApiResult.success(new PageData<>());
|
||||
}
|
||||
Set<Long> ids = children.stream().map(GongfuDeviceType::getParentId).collect(Collectors.toSet());
|
||||
Page<GongfuDeviceType> result = deviceTypeService.lambdaQuery()
|
||||
.in(GongfuDeviceType::getId, children.stream().map(GongfuDeviceType::getParentId).collect(Collectors.toSet()))
|
||||
.in(CollectionUtil.isNotEmpty(ids), GongfuDeviceType::getId, ids)
|
||||
.orderByDesc(GongfuDeviceType::getId)
|
||||
.page(new Page<>(query.getPage(), query.getPageSize()));
|
||||
return ApiResult.success(convert(query, result, children));
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
SELECT u.id,c.agency_company_name AS 'companyName',u.user_name AS 'name',u.user_email AS 'email',u.user_avatar AS 'avatar'
|
||||
,a.`name` AS 'areaName',0 AS 'userState',u.create_by AS 'createBy',u.create_time AS 'createTime',u.update_by AS 'updateBy'
|
||||
,u.update_time AS 'updateTime',null AS 'lastLoginTime',null AS 'expireTime',false AS 'isPrimary',0 AS 'state'
|
||||
,u.user_type as 'type'
|
||||
FROM app_user_applyfor u
|
||||
INNER JOIN t_base_customer c ON u.company_id=c.id
|
||||
INNER JOIN app_area a ON u.area_id=a.id
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Set;
|
||||
|
||||
@Slf4j
|
||||
@Order(0)
|
||||
|
|
@ -26,30 +27,39 @@ public class AppVersionFilter extends OncePerRequestFilter {
|
|||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* 因前端部分接口遗漏App-Version参数,ios打包重新审核需要很久,所以需要排除掉,否则会导致接口无法访问
|
||||
*/
|
||||
private static final Set<String> WHITE_LIST = Set.of("getTicket", "uploadSingleFile", "getInfoById", "hangUp", "exportPdf");
|
||||
|
||||
private static final String MIN_SUPPER_VERSION = "1.0.9";
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
|
||||
String appPlatform = request.getHeader("App-Platform");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
if (StrUtil.isBlank(appPlatform)) {
|
||||
log.error("请求头中未找到App-Platform");
|
||||
response.setStatus(HttpStatus.UNAUTHORIZED.value());
|
||||
out(response, ApiResult.error(STATE.ServiceConnectRefused, "请更新版本!"));
|
||||
} else {
|
||||
if (appPlatform.startsWith("pc")) {
|
||||
filterChain.doFilter(request, response);
|
||||
if (WHITE_LIST.stream().noneMatch(path -> request.getRequestURI().endsWith(path))) {
|
||||
String appPlatform = request.getHeader("App-Platform");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
if (StrUtil.isBlank(appPlatform)) {
|
||||
log.error("请求头中未找到App-Platform");
|
||||
response.setStatus(HttpStatus.UNAUTHORIZED.value());
|
||||
out(response, ApiResult.error(STATE.ServiceConnectRefused, "请更新版本!"));
|
||||
} else {
|
||||
String appVersion = request.getHeader("App-Version");
|
||||
if (StrUtil.isBlank(appVersion)) {
|
||||
log.error("请求头中未找到App-Version");
|
||||
out(response, ApiResult.error(STATE.ServiceConnectRefused, "请更新版本!"));
|
||||
} else if (VersionComparator.INSTANCE.compare(appVersion, MIN_SUPPER_VERSION) < 0) {
|
||||
out(response, ApiResult.error(STATE.ServiceConnectRefused, "版本太低,请更新版本!"));
|
||||
} else {
|
||||
if (appPlatform.startsWith("pc")) {
|
||||
filterChain.doFilter(request, response);
|
||||
} else {
|
||||
String appVersion = request.getHeader("App-Version");
|
||||
if (StrUtil.isBlank(appVersion)) {
|
||||
log.error("请求头中未找到App-Version");
|
||||
out(response, ApiResult.error(STATE.ServiceConnectRefused, "请更新版本!"));
|
||||
} else if (VersionComparator.INSTANCE.compare(appVersion, MIN_SUPPER_VERSION) < 0) {
|
||||
out(response, ApiResult.error(STATE.ServiceConnectRefused, "版本太低,请更新版本!"));
|
||||
} else {
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue