Commit 0f248091 authored by 唐峰's avatar 唐峰

处理微信unionId查询无用户设为静默异常,处理极验响应异常导致的空指针

parent ab2c4a61
...@@ -168,7 +168,7 @@ public class UserApiV2Controller implements IBaseController { ...@@ -168,7 +168,7 @@ public class UserApiV2Controller implements IBaseController {
wechatUserInfo = wechatService.findWechatUserInfoFromDb(batchInfoReq.getOpenIds(), batchInfoReq.getAppId(), tenantId); wechatUserInfo = wechatService.findWechatUserInfoFromDb(batchInfoReq.getOpenIds(), batchInfoReq.getAppId(), tenantId);
List<Long> userIds = wechatUserInfo.stream().map(WechatUserInfo::getUserId).collect(Collectors.toList()); List<Long> userIds = wechatUserInfo.stream().map(WechatUserInfo::getUserId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(wechatUserInfo) || CollectionUtils.isEmpty(userIds)) { if (CollectionUtils.isEmpty(wechatUserInfo) || CollectionUtils.isEmpty(userIds)) {
throw new BizException(BizExceptionEnum.UN_EXIT_USER); throw new SilentBizException(BizExceptionEnum.UN_EXIT_USER);
} }
userList = userRepository.findByIdInAndTenantId(userIds, tenantId); userList = userRepository.findByIdInAndTenantId(userIds, tenantId);
...@@ -178,7 +178,7 @@ public class UserApiV2Controller implements IBaseController { ...@@ -178,7 +178,7 @@ public class UserApiV2Controller implements IBaseController {
wechatUserInfo = wechatService.findUnionIdsAndOpenIdAndTenantId(batchInfoReq.getUnionIds(), batchInfoReq.getAppId(), tenantId); wechatUserInfo = wechatService.findUnionIdsAndOpenIdAndTenantId(batchInfoReq.getUnionIds(), batchInfoReq.getAppId(), tenantId);
List<Long> userIds = wechatUserInfo.stream().filter(e->e.getUserId() != null).map(WechatUserInfo::getUserId).collect(Collectors.toList()); List<Long> userIds = wechatUserInfo.stream().filter(e->e.getUserId() != null).map(WechatUserInfo::getUserId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(wechatUserInfo) || CollectionUtils.isEmpty(userIds)) { if (CollectionUtils.isEmpty(wechatUserInfo) || CollectionUtils.isEmpty(userIds)) {
throw new BizException(BizExceptionEnum.UN_EXIT_USER); throw new SilentBizException(BizExceptionEnum.UN_EXIT_USER);
} }
userList = userRepository.findByIdInAndTenantId(userIds, tenantId); userList = userRepository.findByIdInAndTenantId(userIds, tenantId);
......
...@@ -299,6 +299,7 @@ public class GeetestLib { ...@@ -299,6 +299,7 @@ public class GeetestLib {
String return_seccode = ""; String return_seccode = "";
try { try {
JSONObject return_map = JSONObject.parseObject(response); JSONObject return_map = JSONObject.parseObject(response);
return_map = return_map == null ? new JSONObject(): return_map;
return_seccode = return_map.getString("seccode"); return_seccode = return_map.getString("seccode");
gtlog("md5: " + Md5Util.build(return_seccode)); gtlog("md5: " + Md5Util.build(return_seccode));
if (return_seccode.equals(Md5Util.build(seccode))) { if (return_seccode.equals(Md5Util.build(seccode))) {
...@@ -446,4 +447,11 @@ public class GeetestLib { ...@@ -446,4 +447,11 @@ public class GeetestLib {
} }
} }
public static void main(String[] args) {
JSONObject return_map = JSONObject.parseObject("");
return_map = return_map == null ? new JSONObject(): return_map;
System.out.println(return_map.toString());
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment