记得上下班打卡 | git大法好,push需谨慎

Commit 1df07d97 authored by 张国柄's avatar 张国柄

fix:绑定多个同类型第三方账号;

parent f2c26e4b
...@@ -18,5 +18,5 @@ public interface IAdamThirdPartyService extends IService<AdamThirdParty> { ...@@ -18,5 +18,5 @@ public interface IAdamThirdPartyService extends IService<AdamThirdParty> {
List<AdamThirdPartInfoVo> queryByUid(String uid); List<AdamThirdPartInfoVo> queryByUid(String uid);
AdamThirdPartInfoVo queryByOpenId(String openId, String platform); AdamThirdPartInfoVo queryByUidAndPlatform(String uid, String platform);
} }
...@@ -12,6 +12,7 @@ public class AdamRedisConst { ...@@ -12,6 +12,7 @@ public class AdamRedisConst {
public static final String INFO_USER = ADAM.concat(":list:user"); public static final String INFO_USER = ADAM.concat(":list:user");
public static final String INFO_REAL_NAME = ADAM.concat(":list:real_name"); public static final String INFO_REAL_NAME = ADAM.concat(":list:real_name");
public static final String INFO_THIRD_PARTY = ADAM.concat(":list:third_party"); public static final String INFO_THIRD_PARTY = ADAM.concat(":list:third_party");
public static final String INFO_ENTERS = ADAM.concat(":list:enters:"); public static final String INFO_ENTERS = ADAM.concat(":list:enters:");
public static final String INFO_ADDRESSES = ADAM.concat(":list:addresses:"); public static final String INFO_ADDRESSES = ADAM.concat(":list:addresses:");
......
...@@ -13,6 +13,7 @@ import com.liquidnet.service.adam.service.IAdamRealNameService; ...@@ -13,6 +13,7 @@ import com.liquidnet.service.adam.service.IAdamRealNameService;
import com.liquidnet.service.adam.service.IAdamThirdPartyService; import com.liquidnet.service.adam.service.IAdamThirdPartyService;
import com.liquidnet.service.adam.service.IAdamUserInfoService; import com.liquidnet.service.adam.service.IAdamUserInfoService;
import com.liquidnet.service.adam.service.IAdamUserService; import com.liquidnet.service.adam.service.IAdamUserService;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -25,7 +26,6 @@ import org.springframework.core.env.Environment; ...@@ -25,7 +26,6 @@ import org.springframework.core.env.Environment;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
@ApiSupport(order = 10020) @ApiSupport(order = 10020)
...@@ -107,19 +107,6 @@ public class AdamUserController { ...@@ -107,19 +107,6 @@ public class AdamUserController {
tagSexVoList.add(AdamTagVo.getNew().setVal("MS09").setDesc("不确定性别")); tagSexVoList.add(AdamTagVo.getNew().setVal("MS09").setDesc("不确定性别"));
tagSexVoList.add(AdamTagVo.getNew().setVal("MS10").setDesc("不在乎性别")); tagSexVoList.add(AdamTagVo.getNew().setVal("MS10").setDesc("不在乎性别"));
return ResponseDto.success(tagSexVoList); return ResponseDto.success(tagSexVoList);
// Map<String, String> tagSexVos = new HashMap<>();
// tagSexVos.put("MS00", "其他性别");
// tagSexVos.put("MS01", "男性");
// tagSexVos.put("MS02", "女性");
// tagSexVos.put("MS03", "跨性别女性");
// tagSexVos.put("MS04", "跨性别男性");
// tagSexVos.put("MS05", "双性别者");
// tagSexVos.put("MS06", "性别模糊");
// tagSexVos.put("MS07", "性别流动");
// tagSexVos.put("MS08", "无性别者");
// tagSexVos.put("MS09", "不确定性别");
// tagSexVos.put("MS10", "不在乎性别");
// return ResponseDto.success(tagSexVos);
} }
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
...@@ -133,7 +120,7 @@ public class AdamUserController { ...@@ -133,7 +120,7 @@ public class AdamUserController {
// TODO: 2021/5/10 // TODO: 2021/5/10
log.info("mobile:{},code:{}", mobile, code); log.info("mobile:{},code:{}", mobile, code);
if (!this.checkSmsCode(mobile, code)) return ResponseDto.failure("验证码无效"); if (!this.checkSmsCode(mobile, code)) return ResponseDto.failure(ErrorMapping.get("10002"));
String uid = CurrentUtil.getCurrentUid(); String uid = CurrentUtil.getCurrentUid();
...@@ -192,8 +179,13 @@ public class AdamUserController { ...@@ -192,8 +179,13 @@ public class AdamUserController {
if (null != force && force) {// 强制解绑,并重新绑定当前账号 if (null != force && force) {// 强制解绑,并重新绑定当前账号
return ResponseDto.success(adamUserService.bindTpaForce(currentUid, existUid, parameter)); return ResponseDto.success(adamUserService.bindTpaForce(currentUid, existUid, parameter));
} }
return ResponseDto.failure("第三方账号已绑定其它手机号"); return ResponseDto.failure(ErrorMapping.get("10007"));
} }
// 判断该用户是否已绑定同类型第三方账号
AdamThirdPartInfoVo bindThirdPartVo = adamThirdPartyService.queryByUidAndPlatform(currentUid, parameter.getPlatform());
if (null != bindThirdPartVo) return ResponseDto.failure(ErrorMapping.get("10008"));
adamUserService.bindTpa(currentUid, parameter); adamUserService.bindTpa(currentUid, parameter);
return ResponseDto.success(adamThirdPartyService.queryByUid(currentUid)); return ResponseDto.success(adamThirdPartyService.queryByUid(currentUid));
} }
......
...@@ -43,10 +43,15 @@ public class AdamThirdPartyServiceImpl extends ServiceImpl<AdamThirdPartyMapper, ...@@ -43,10 +43,15 @@ public class AdamThirdPartyServiceImpl extends ServiceImpl<AdamThirdPartyMapper,
return thirdPartInfoVos; return thirdPartInfoVos;
} }
@Override public AdamThirdPartInfoVo queryByUidAndPlatform(String uid, String platform) {
public AdamThirdPartInfoVo queryByOpenId(String openId, String platform) { List<AdamThirdPartInfoVo> voList = this.queryByUid(uid);
return mongoTemplate.findOne(Query.query(Criteria.where("openId").is(openId) if (!CollectionUtils.isEmpty(voList)) {
.and("platform").is(platform).and("state").is(1)), for (AdamThirdPartInfoVo vo : voList) {
AdamThirdPartInfoVo.class, AdamThirdPartInfoVo.class.getSimpleName()); if (platform.equals(vo.getPlatform())) {
return vo;
}
}
}
return null;
} }
} }
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
10004= 10004=
10005=手机号获取失败,请更换登录方式 10005=手机号获取失败,请更换登录方式
10006=第三方账号未注册 10006=第三方账号未注册
10007= 10007=第三方账号已绑定其它账号
10008=已绑定同类型第三方账号
10101= 10101=
......
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