提交 692ebac1 编写于 作者: wangyongbo's avatar wangyongbo

绑定逻辑判断

上级 af8358e1
流水线 #30507 已失败 于阶段
in 0 second
......@@ -485,7 +485,8 @@ public class LoginServiceImpl implements LoginService {
result.setMobile(request.getMobile());
AccountInfoEntity accountInfo = accountInfoDetailMapper.selectByMobile(AESUtil.encryptV0(request.getMobile()));
Integer acctId = accountInfo.getId();
processAccountUnion(acctId, request.getUnionId(), request.getProductType());
AccountWeChatInfoEntity entity = accountWeChatInfoMapper.selectByUnionId(request.getUnionId());
processAccountUnion(acctId, request.getUnionId(), request.getProductType(), entity);
return result;
}
......@@ -519,7 +520,7 @@ public class LoginServiceImpl implements LoginService {
updateWechatInfoUser(entity, weChatUserInfoEntity);
}
Integer acctId = doctorInfoMapper.getAcctIdByDoctorId(doctorId);
processAccountUnion(acctId, unionId, request.getProductType());
processAccountUnion(acctId, unionId, request.getProductType(), entity);
return weChatUserInfoEntity.getNickname();
}
......@@ -540,7 +541,7 @@ public class LoginServiceImpl implements LoginService {
updateWechatInfoUser(entity, weChatUserInfoEntity);
}
Integer acctId = doctorInfoMapper.getAcctIdByDoctorId(doctorId);
processAccountUnion(acctId, unionId, request.getProductType());
processAccountUnion(acctId, unionId, request.getProductType(), entity);
Map<String,String> rtnMap = new HashMap();
rtnMap.put("openId",weChatEntity.getOpenid());
rtnMap.put("nickname",weChatUserInfoEntity.getNickname());
......@@ -554,7 +555,7 @@ public class LoginServiceImpl implements LoginService {
* @param acctId
* @param unionId
*/
private void processAccountUnion(Integer acctId, String unionId, Integer productType) {
private void processAccountUnion(Integer acctId, String unionId, Integer productType, AccountWeChatInfoEntity entity) {
//接入新旭事务一致性
String batchNo = IntactUtils.getUUID();
if(null == acctId || 0 == acctId){
......@@ -564,7 +565,7 @@ public class LoginServiceImpl implements LoginService {
intactUtil.sendIntact(batchNo,"processAccountUnion",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_1,"acctId:"+acctId+",unionId:"+unionId+",productType:"+productType);
//先查询当前产品线是否有记录?如果有就更新成delete_flag=2; 然后在插入新的绑定记录
AccountUnionEntity accountUnionResult = accountUnionMapper.selectByUnionId(unionId);
if (accountUnionResult != null) {
if (accountUnionResult != null && entity != null) {
intactUtil.sendIntact(batchNo,"processAccountUnion",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,"该微信号已绑定其他云鹊医账户,你可以使用微信登录云鹊医,在「设置」页解除绑定");
throw new PicaException(AccountExceptionEnum.PICA_WECHAT_UNBIND.getCode(), AccountExceptionEnum.PICA_WECHAT_UNBIND.getMessage());
......@@ -573,25 +574,36 @@ public class LoginServiceImpl implements LoginService {
map.put("acctId", acctId);
map.put("unionType", AccountTypeEnum.UNION_LOGIN_WE_CHAT.getCode());
AccountUnionEntity accountUnionEntityAccount = accountUnionMapper.selectByAcctId(map);
AccountWeChatInfoEntity entity2 = null;
if (accountUnionEntityAccount != null) {
intactUtil.sendIntact(batchNo,"processAccountUnion",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,"该手机号已绑定其他微信号,你可以在「设置」页解除绑定");
throw new PicaException(AccountExceptionEnum.PICA_WECHAT_BIND_OTHER.getCode(), AccountExceptionEnum.PICA_WECHAT_BIND_OTHER.getMessage());
/**判断微信信息表是否存在 */
entity2 = accountWeChatInfoMapper.selectByUnionId(accountUnionEntityAccount.getUnionId());
if(entity2 != null) {
intactUtil.sendIntact(batchNo,"processAccountUnion",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,"该手机号已绑定其他微信号,你可以在「设置」页解除绑定");
throw new PicaException(AccountExceptionEnum.PICA_WECHAT_BIND_OTHER.getCode(), AccountExceptionEnum.PICA_WECHAT_BIND_OTHER.getMessage());
}
}
AccountUnionEntity accountUnionEntity = new AccountUnionEntity();
accountUnionEntity.setAcctId(acctId.longValue());
accountUnionEntity.setDeleteFlag(1);
accountUnionEntity.setUnionId(unionId);
accountUnionEntity.setCreatedTime(new Date());
accountUnionEntity.setModifiedTime(new Date());
accountUnionEntity.setCreatedId(acctId);
accountUnionEntity.setModifiedId(acctId);
accountUnionEntity.setUnionType(AccountTypeEnum.UNION_LOGIN_WE_CHAT.getCode());
accountUnionMapper.insertSelective(accountUnionEntity);
if (doubleWritingMode) { //双写模式
doctorService.bindWeChat(acctId, unionId);
if (accountUnionResult == null || accountUnionEntityAccount == null) {
AccountUnionEntity accountUnionEntity = new AccountUnionEntity();
accountUnionEntity.setAcctId(acctId.longValue());
accountUnionEntity.setDeleteFlag(1);
accountUnionEntity.setUnionId(unionId);
accountUnionEntity.setCreatedTime(new Date());
accountUnionEntity.setModifiedTime(new Date());
accountUnionEntity.setCreatedId(acctId);
accountUnionEntity.setModifiedId(acctId);
accountUnionEntity.setUnionType(AccountTypeEnum.UNION_LOGIN_WE_CHAT.getCode());
accountUnionMapper.insertSelective(accountUnionEntity);
if (doubleWritingMode) { //双写模式
doctorService.bindWeChat(acctId, unionId);
}
intactUtil.sendIntact(batchNo, "processAccountUnion", com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3, "acctId:" + acctId + ",unionId:" + unionId + ",productType:" + productType);
}
intactUtil.sendIntact(batchNo,"processAccountUnion",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,"acctId:"+acctId+",unionId:"+unionId+",productType:"+productType);
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册