Compare commits

..

No commits in common. "d0d78d54c61f78db83a28e15461f1be10a20b19e" and "7db9d6ef8eac905f0161daf03ee5daa449fcca6a" have entirely different histories.

3 changed files with 18 additions and 32 deletions

View File

@ -30,7 +30,6 @@ 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;
/**
@ -59,9 +58,8 @@ 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(CollectionUtil.isNotEmpty(ids), GongfuDeviceType::getParentId, ids)
.in(GongfuDeviceType::getParentId, result.getRecords().stream().map(GongfuDeviceType::getId).collect(Collectors.toList()))
.list();
return ApiResult.success(convert(query, result, children));
} else {
@ -72,9 +70,8 @@ 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(CollectionUtil.isNotEmpty(ids), GongfuDeviceType::getId, ids)
.in(GongfuDeviceType::getId, children.stream().map(GongfuDeviceType::getParentId).collect(Collectors.toSet()))
.orderByDesc(GongfuDeviceType::getId)
.page(new Page<>(query.getPage(), query.getPageSize()));
return ApiResult.success(convert(query, result, children));

View File

@ -31,7 +31,6 @@
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

View File

@ -18,7 +18,6 @@ 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)
@ -27,39 +26,30 @@ 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 {
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, "请更新版本!"));
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);
} else {
if (appPlatform.startsWith("pc")) {
filterChain.doFilter(request, response);
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 {
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);
}
filterChain.doFilter(request, response);
}
}
} else {
filterChain.doFilter(request, response);
}
}