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

绑定逻辑判断

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