Commit e13c2dad authored by guangjing.gao's avatar guangjing.gao

根据用户ID或手机号查询微信openId

parent 77bd5624
package cn.quantgroup.xyqb.controller.middleoffice.wx; package cn.quantgroup.xyqb.controller.middleoffice.wx;
import cn.quantgroup.xyqb.entity.User;
import cn.quantgroup.xyqb.entity.WechatUserInfo; import cn.quantgroup.xyqb.entity.WechatUserInfo;
import cn.quantgroup.xyqb.model.JsonResult; import cn.quantgroup.xyqb.model.JsonResult;
import cn.quantgroup.xyqb.service.user.ITenantService; import cn.quantgroup.xyqb.service.user.ITenantService;
...@@ -48,9 +47,8 @@ public class WxController { ...@@ -48,9 +47,8 @@ public class WxController {
} }
/* 校验租户ID */ /* 校验租户ID */
if (TenantUtil.validationTenantIdIsNullOrZero(tenantId)) { if (TenantUtil.validationTenantIdIsNullOrZero(tenantId)) {
User user = userService.findById(userId); wechatUserInfo = tenantService.getTenantCustomerInfo(wechatUserInfo, tenantId);
user = tenantService.getTenantUser(user, tenantId); if (wechatUserInfo == null) {
if (user == null) {
return JsonResult.buildSuccessResult(); return JsonResult.buildSuccessResult();
} }
} }
...@@ -83,9 +81,8 @@ public class WxController { ...@@ -83,9 +81,8 @@ public class WxController {
} }
/* 校验租户ID */ /* 校验租户ID */
if (TenantUtil.validationTenantIdIsNullOrZero(tenantId)) { if (TenantUtil.validationTenantIdIsNullOrZero(tenantId)) {
User user = userService.findByPhoneInDb(phoneNo); wechatUserInfo = tenantService.getTenantCustomerInfo(wechatUserInfo, tenantId);
user = tenantService.getTenantUser(user, tenantId); if (wechatUserInfo == null) {
if (user == null) {
return JsonResult.buildSuccessResult(); return JsonResult.buildSuccessResult();
} }
} }
......
...@@ -2,6 +2,7 @@ package cn.quantgroup.xyqb.service.user; ...@@ -2,6 +2,7 @@ package cn.quantgroup.xyqb.service.user;
import cn.quantgroup.xyqb.entity.User; import cn.quantgroup.xyqb.entity.User;
import cn.quantgroup.xyqb.entity.UserDetail; import cn.quantgroup.xyqb.entity.UserDetail;
import cn.quantgroup.xyqb.entity.WechatUserInfo;
import cn.quantgroup.xyqb.model.UserBrief; import cn.quantgroup.xyqb.model.UserBrief;
import java.util.List; import java.util.List;
...@@ -17,6 +18,9 @@ public interface ITenantService { ...@@ -17,6 +18,9 @@ public interface ITenantService {
UserBrief getTenantCustomerInfo(UserDetail userDetail, Integer tenantId); UserBrief getTenantCustomerInfo(UserDetail userDetail, Integer tenantId);
WechatUserInfo getTenantCustomerInfo(WechatUserInfo wechatUserInfo, Integer tenantId);
/** /**
* @author -REYLI * @author -REYLI
* @createTime 2021-11-17 * @createTime 2021-11-17
......
...@@ -101,6 +101,26 @@ public class TenantServiceImpl implements ITenantService { ...@@ -101,6 +101,26 @@ public class TenantServiceImpl implements ITenantService {
return null; return null;
} }
@Override
public WechatUserInfo getTenantCustomerInfo(WechatUserInfo wechatUserInfo, Integer tenantId) {
OauthClientDetailsEntity oauthClientDetails = oauthClientDetailsService.findFirstByClientId(tenantId);
if (oauthClientDetails != null) {
ProductLoginEntity productLogin = productLoginService.findSlaveByPloginInfo(oauthClientDetails.getInstitutionId(), oauthClientDetails.getProductId(), wechatUserInfo.getUserId());
if (productLogin != null) {
if (!wechatUserInfo.getPhoneNo().equals(productLogin.getPhoneNo())) {
return null;
}
CustomerInfoEntity customerInfo = customerInfoService.findSlaveByCustomerId(productLogin.getCustomerId());
if (customerInfo == null) {
return null;
}
return wechatUserInfo;
}
}
return null;
}
@Override @Override
public List<User> selectUsersByTenantId(List<User> users, Integer tenantId) { public List<User> selectUsersByTenantId(List<User> users, Integer tenantId) {
List<User> result = new ArrayList<>(); List<User> result = new ArrayList<>();
......
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