新增uid:第三方系统的用户ID
This commit is contained in:
@@ -148,6 +148,12 @@ public class WxLoginController extends BaseController {
|
|||||||
if(userParam.getPhone() != null){
|
if(userParam.getPhone() != null){
|
||||||
addUser.setPhone(userParam.getPhone());
|
addUser.setPhone(userParam.getPhone());
|
||||||
}
|
}
|
||||||
|
if(StrUtil.isNotBlank(userParam.getOpenid())){
|
||||||
|
addUser.setOpenid(userParam.getOpenid());
|
||||||
|
}
|
||||||
|
if(StrUtil.isNotBlank(userParam.getUnionid())){
|
||||||
|
addUser.setUnionid(userParam.getUnionid());
|
||||||
|
}
|
||||||
addUser.setPassword(userService.encodePassword(CommonUtil.randomUUID16()));
|
addUser.setPassword(userService.encodePassword(CommonUtil.randomUUID16()));
|
||||||
addUser.setTenantId(getTenantId());
|
addUser.setTenantId(getTenantId());
|
||||||
addUser.setRecommend(1);
|
addUser.setRecommend(1);
|
||||||
@@ -380,18 +386,16 @@ public class WxLoginController extends BaseController {
|
|||||||
String sessionKey = jsonObject.getString("session_key");
|
String sessionKey = jsonObject.getString("session_key");
|
||||||
String unionid = jsonObject.getString("unionid");
|
String unionid = jsonObject.getString("unionid");
|
||||||
System.out.println("openid = " + openid);
|
System.out.println("openid = " + openid);
|
||||||
|
System.out.println("unionid = " + unionid);
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(openid)) {
|
if (StrUtil.isNotBlank(openid)) {
|
||||||
User user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getOpenid, openid).last("limit 1"));
|
User user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getOpenid, openid).last("limit 1"));
|
||||||
if (ObjectUtil.isEmpty(user)) {
|
if(ObjectUtil.isNotEmpty(user)){
|
||||||
// 注册新用户
|
return success("登录成功", user);
|
||||||
final UserParam param = new UserParam();
|
|
||||||
addUser(param);
|
|
||||||
user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getOpenid, openid));
|
|
||||||
}
|
}
|
||||||
return success("登录成功", user);
|
return fail("用户未注册",openid);
|
||||||
}
|
}
|
||||||
return fail("登录失败",openid);
|
return fail("openId获取失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ public class WxOfficialController extends BaseController {
|
|||||||
String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/bizsend?access_token=" + getAccessToken();
|
String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/bizsend?access_token=" + getAccessToken();
|
||||||
final UserOauth userOauth = userOauthService.getOne(new LambdaQueryWrapper<UserOauth>().eq(UserOauth::getUserId, param.getUserId()).eq(UserOauth::getOauthType,"MP-OFFICIAL").eq(UserOauth::getDeleted, 0));
|
final UserOauth userOauth = userOauthService.getOne(new LambdaQueryWrapper<UserOauth>().eq(UserOauth::getUserId, param.getUserId()).eq(UserOauth::getOauthType,"MP-OFFICIAL").eq(UserOauth::getDeleted, 0));
|
||||||
if(userOauth != null){
|
if(userOauth != null){
|
||||||
param.setOpenId(userOauth.getOauthId());
|
param.setOpenid(userOauth.getOauthId());
|
||||||
final String oauthId = userOauth.getOauthId();
|
final String oauthId = userOauth.getOauthId();
|
||||||
// 跳转小程序链接
|
// 跳转小程序链接
|
||||||
HashMap<String, String> miniprogram = new HashMap<>();
|
HashMap<String, String> miniprogram = new HashMap<>();
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ public class User implements UserDetails {
|
|||||||
@ApiModelProperty("用户编码")
|
@ApiModelProperty("用户编码")
|
||||||
private String userCode;
|
private String userCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("第三方系统的用户ID")
|
||||||
|
private Integer uid;
|
||||||
|
|
||||||
@ApiModelProperty("账号")
|
@ApiModelProperty("账号")
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,12 @@
|
|||||||
<if test="param.username != null">
|
<if test="param.username != null">
|
||||||
AND a.username LIKE CONCAT('%', #{param.username}, '%')
|
AND a.username LIKE CONCAT('%', #{param.username}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.uid != null">
|
||||||
|
AND a.uid = #{param.uid}
|
||||||
|
</if>
|
||||||
|
<if test="param.userCode != null">
|
||||||
|
AND a.user_code = #{param.userCode}
|
||||||
|
</if>
|
||||||
<if test="param.nickname != null">
|
<if test="param.nickname != null">
|
||||||
AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%')
|
AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ public class UserParam extends BaseParam {
|
|||||||
@ApiModelProperty("用户编码")
|
@ApiModelProperty("用户编码")
|
||||||
private String userCode;
|
private String userCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("第三方系统用户ID")
|
||||||
|
private Integer uid;
|
||||||
|
|
||||||
@ApiModelProperty("性别(字典)")
|
@ApiModelProperty("性别(字典)")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private String sex;
|
private String sex;
|
||||||
@@ -222,9 +225,12 @@ public class UserParam extends BaseParam {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Boolean showProfile;
|
private Boolean showProfile;
|
||||||
|
|
||||||
@ApiModelProperty("openId")
|
@ApiModelProperty("微信openid")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String openId;
|
private String openid;
|
||||||
|
|
||||||
|
@ApiModelProperty("unionid")
|
||||||
|
private String unionid;
|
||||||
|
|
||||||
@ApiModelProperty(value = "可管理的商户")
|
@ApiModelProperty(value = "可管理的商户")
|
||||||
@QueryField(type = QueryType.LIKE)
|
@QueryField(type = QueryType.LIKE)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# 端口
|
# 端口
|
||||||
server:
|
server:
|
||||||
port: 9091
|
port: 9090
|
||||||
# socketIo
|
# socketIo
|
||||||
socketio:
|
socketio:
|
||||||
port: 9191
|
port: 9191
|
||||||
|
|||||||
Reference in New Issue
Block a user