|
@@ -6,11 +6,11 @@ import com.alibaba.fastjson.TypeReference;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.google.common.collect.ImmutableMap;
|
|
import com.google.common.collect.ImmutableMap;
|
|
import com.smcic.api.conference.dto.WxPhoneDTO;
|
|
import com.smcic.api.conference.dto.WxPhoneDTO;
|
|
-import com.smcic.api.conference.entity.ConferenceWxAccount;
|
|
|
|
import com.smcic.api.conference.entity.ConferenceUserThird;
|
|
import com.smcic.api.conference.entity.ConferenceUserThird;
|
|
|
|
+import com.smcic.api.conference.entity.ConferenceWxAccount;
|
|
import com.smcic.api.conference.mapper.ConferenceUserThirdMapper;
|
|
import com.smcic.api.conference.mapper.ConferenceUserThirdMapper;
|
|
import com.smcic.api.conference.service.IUserThirdService;
|
|
import com.smcic.api.conference.service.IUserThirdService;
|
|
-import com.smcic.core.advice.APIException;
|
|
|
|
|
|
+import com.smcic.core.advice.BizException;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.http.util.TextUtils;
|
|
import org.apache.http.util.TextUtils;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
@@ -59,7 +59,7 @@ public class UserThirdServiceImpl extends ServiceImpl<ConferenceUserThirdMapper,
|
|
}
|
|
}
|
|
ConferenceWxAccount wxAccount = conferenceWxAccountService.getById(cid);
|
|
ConferenceWxAccount wxAccount = conferenceWxAccountService.getById(cid);
|
|
if (wxAccount == null) {
|
|
if (wxAccount == null) {
|
|
- throw new APIException("请先配置会议微信账号");
|
|
|
|
|
|
+ throw new BizException("请先配置会议微信账号");
|
|
}
|
|
}
|
|
String token;
|
|
String token;
|
|
if (!access_token.containsKey(cid)){
|
|
if (!access_token.containsKey(cid)){
|
|
@@ -73,7 +73,7 @@ public class UserThirdServiceImpl extends ServiceImpl<ConferenceUserThirdMapper,
|
|
WxPhoneDTO wxPhoneDTO = JSON.parseObject(response, WxPhoneDTO.class);
|
|
WxPhoneDTO wxPhoneDTO = JSON.parseObject(response, WxPhoneDTO.class);
|
|
log.info("获取wx手机号{}", response);
|
|
log.info("获取wx手机号{}", response);
|
|
if (wxPhoneDTO.getErrcode() != 0){
|
|
if (wxPhoneDTO.getErrcode() != 0){
|
|
- throw new APIException("获取用户手机号失败");
|
|
|
|
|
|
+ throw new BizException("获取用户手机号失败");
|
|
}
|
|
}
|
|
redisTemplate.opsForValue().set("WX_CODE_" + code, wxPhoneDTO.getPhoneInfo().getPhoneNumber(), 60 * 60 * 24 * 30); // 30天过期
|
|
redisTemplate.opsForValue().set("WX_CODE_" + code, wxPhoneDTO.getPhoneInfo().getPhoneNumber(), 60 * 60 * 24 * 30); // 30天过期
|
|
return wxPhoneDTO.getPhoneInfo().getPhoneNumber();
|
|
return wxPhoneDTO.getPhoneInfo().getPhoneNumber();
|
|
@@ -89,7 +89,7 @@ public class UserThirdServiceImpl extends ServiceImpl<ConferenceUserThirdMapper,
|
|
public ConferenceUserThird info(Long cid , String code){
|
|
public ConferenceUserThird info(Long cid , String code){
|
|
String phone = redisTemplate.opsForValue().get("WX_CODE_" + code);
|
|
String phone = redisTemplate.opsForValue().get("WX_CODE_" + code);
|
|
if(TextUtils.isEmpty(phone)){
|
|
if(TextUtils.isEmpty(phone)){
|
|
- throw new APIException("请先登录");
|
|
|
|
|
|
+ throw new BizException("请先登录");
|
|
}
|
|
}
|
|
return lambdaQuery().eq(ConferenceUserThird::getConferenceId, cid).eq(ConferenceUserThird::getPhone, phone).one();
|
|
return lambdaQuery().eq(ConferenceUserThird::getConferenceId, cid).eq(ConferenceUserThird::getPhone, phone).one();
|
|
}
|
|
}
|
|
@@ -97,7 +97,7 @@ public class UserThirdServiceImpl extends ServiceImpl<ConferenceUserThirdMapper,
|
|
public void create(ConferenceUserThird userThird){
|
|
public void create(ConferenceUserThird userThird){
|
|
boolean exists = lambdaQuery().eq(ConferenceUserThird::getConferenceId, userThird.getConferenceId()).eq(ConferenceUserThird::getPhone, userThird.getPhone()).exists();
|
|
boolean exists = lambdaQuery().eq(ConferenceUserThird::getConferenceId, userThird.getConferenceId()).eq(ConferenceUserThird::getPhone, userThird.getPhone()).exists();
|
|
if (exists){
|
|
if (exists){
|
|
- throw new APIException(400, "手机号已存在");
|
|
|
|
|
|
+ throw new BizException(400, "手机号已存在");
|
|
}
|
|
}
|
|
userThird.setCreateTime(LocalDateTime.now());
|
|
userThird.setCreateTime(LocalDateTime.now());
|
|
save(userThird);
|
|
save(userThird);
|