fix 登录就绑定微信,并解绑之前的
This commit is contained in:
+7
-6
@@ -259,14 +259,15 @@ public class CompanyLoginController {
|
|||||||
LambdaQueryWrapper<PayContactsManagement> queryWrapper1 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<PayContactsManagement> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||||
queryWrapper1.eq(PayContactsManagement::getOpenId, PasswordUtil.encrypt(openId));
|
queryWrapper1.eq(PayContactsManagement::getOpenId, PasswordUtil.encrypt(openId));
|
||||||
PayContactsManagement contactsManagement1 = payContactsManagementService.getOne(queryWrapper1);
|
PayContactsManagement contactsManagement1 = payContactsManagementService.getOne(queryWrapper1);
|
||||||
//没有绑定过就绑定
|
//绑定过就解绑重新绑定
|
||||||
if (contactsManagement1 == null){
|
if (contactsManagement1 != null){
|
||||||
contactsManagement.setOpenId(PasswordUtil.encrypt(openId));
|
contactsManagement1.setOpenId(null);
|
||||||
payContactsManagementService.updateById(contactsManagement);
|
payContactsManagementService.updateById(contactsManagement);
|
||||||
//绑定过就判断是否是当前用户,如果不是就报错
|
|
||||||
}else if (!Objects.equals(contactsManagement1.getPhone(),contactsManagement.getPhone())){
|
|
||||||
throw new JeroBootException("微信已经绑定过其他账号");
|
|
||||||
}
|
}
|
||||||
|
//绑定微信
|
||||||
|
contactsManagement.setOpenId(PasswordUtil.encrypt(openId));
|
||||||
|
payContactsManagementService.updateById(contactsManagement);
|
||||||
|
|
||||||
baseCommonService.addLog("手机号: " + PasswordUtil.decrypt(contactsManagement.getPhone()) + ",绑定微信成功!", CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_3, loginUser);
|
baseCommonService.addLog("手机号: " + PasswordUtil.decrypt(contactsManagement.getPhone()) + ",绑定微信成功!", CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_3, loginUser);
|
||||||
//update-end--Author:wangshuai Date:20200714 for:登录日志没有记录人员
|
//update-end--Author:wangshuai Date:20200714 for:登录日志没有记录人员
|
||||||
return Result.OK("绑定微信成功");
|
return Result.OK("绑定微信成功");
|
||||||
|
|||||||
Reference in New Issue
Block a user