完善空指针异常处理

This commit is contained in:
easonzhu 2025-02-06 19:32:15 +08:00
parent 9604c14dce
commit 94383b9e23
4 changed files with 16 additions and 3 deletions

View File

@ -112,7 +112,10 @@ public class AuthFilter implements Filter {
if (expireCheck(req, resp, token)) {
return;
}
if (frontUserVO.getClientType() == ClientType.H5.value() || frontUserVO.getClientType() == ClientType.Web.value()) {
if (frontUserVO.getClientType() == null) {
handlerExceptionResolver.resolveException(req, resp, null, new BizException(ResponseStatus.TOKEN_DATA_ERROR));
return;
} else if (frontUserVO.getClientType() == ClientType.H5.value() || frontUserVO.getClientType() == ClientType.Web.value()) {
if (StrUtil.isBlank(frontUserVO.getReCookie()) || StrUtil.isBlank(frontUserVO.getCookie())) {
handlerExceptionResolver.resolveException(req, resp, null, new BizException(ResponseStatus.TOKEN_DATA_ERROR));
return;
@ -206,4 +209,5 @@ public class AuthFilter implements Filter {
}
return JSON.parseObject(user, BackendUserVO.class);
}
}

View File

@ -1,5 +1,8 @@
package com.upchina.group.constant;
import com.upchina.common.handler.BizException;
import com.upchina.common.result.ResponseStatus;
//查询类型:1全部;2投顾;3用户;4精选
public enum QueryGroupMessageType {
ALL(1, "全部"),
@ -19,7 +22,7 @@ public enum QueryGroupMessageType {
public static QueryGroupMessageType fromValue(Integer value) {
if (value == null) {
return null;
throw new BizException(ResponseStatus.PARM_ERROR, "消息类型错误");
}
for (QueryGroupMessageType type : values()) {
if (type.value.equals(value)) {

View File

@ -2,6 +2,8 @@ package com.upchina.group.query.message;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
public class ListGroupMessageAppQuery {
@ -14,6 +16,9 @@ public class ListGroupMessageAppQuery {
private Integer lastId;
@ApiModelProperty("查询类型:1全部;2投顾;3用户;4精选;5私聊")
@NotNull
@Min(1)
@Max(5)
private Integer type;
@ApiModelProperty("每页大小")

View File

@ -404,7 +404,8 @@ public class AppVideoInfoService {
List<Integer> advisorIds = vos.stream().map(AdvisorInfoAppVO::getId).collect(Collectors.toList());
List<VideoSortEntity> videoList = videoCacheService.getVideoList();
List<VideoSortEntity> videoPlanList = videoList.stream()
.filter(item -> item.getStartTime().toLocalDate().equals(LocalDate.now()))
.filter(item -> item != null && item.getStartTime() != null &&
item.getStartTime().toLocalDate().equals(LocalDate.now()))
.collect(Collectors.toList());
SortedSet<VideoSortEntity> sortedSet = new TreeSet<>(AbstractVideoSortComparator.VIDEO_COMP_PLAN_LIST);