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

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

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