|
@@ -20,6 +20,7 @@ import com.fdkankan.tk.service.IWxService;
|
|
|
import com.fdkankan.tk.service.IWxUserService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.tk.util.MD5Utils;
|
|
|
+import jdk.nashorn.internal.ir.LabelNode;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -30,6 +31,8 @@ import javax.annotation.Resource;
|
|
|
import java.security.spec.ECField;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -100,6 +103,13 @@ public class WxUserServiceImpl extends ServiceImpl<IWxUserMapper, WxUser> implem
|
|
|
if(StringUtils.isBlank(param.getWxUserId())){
|
|
|
throw new BusinessException(ResultCode.PARAM_MISS);
|
|
|
}
|
|
|
+ if(StringUtils.isNotBlank(param.getPhoneNumber())){
|
|
|
+ List<WxUser> wxUsers = this.getByPhone(param.getPhoneNumber());
|
|
|
+ List<String> collect = wxUsers.stream().map(WxUser::getWxUserId).collect(Collectors.toList());
|
|
|
+ if(!collect.contains(param.getWxUserId()) || collect.size() != 1){
|
|
|
+ throw new BusinessException(ResultCode.WX_PHONE_EXIST);
|
|
|
+ }
|
|
|
+ }
|
|
|
WxUser wxUser = new WxUser();
|
|
|
BeanUtils.copyProperties(param,wxUser);
|
|
|
wxUser.setUpdateTime(new Date());
|
|
@@ -110,6 +120,12 @@ public class WxUserServiceImpl extends ServiceImpl<IWxUserMapper, WxUser> implem
|
|
|
this.updateById(wxUser);
|
|
|
}
|
|
|
|
|
|
+ private List<WxUser> getByPhone(String phoneNumber) {
|
|
|
+ LambdaQueryWrapper<WxUser> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(WxUser::getPhoneNumber,phoneNumber);
|
|
|
+ return this.list(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Object getPhone(String code,Integer reCount) {
|