|
|
@@ -5,6 +5,7 @@ import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
|
|
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
|
|
|
import com.izouma.nineth.config.Constants;
|
|
|
import com.izouma.nineth.domain.Follow;
|
|
|
+import com.izouma.nineth.domain.IdentityAuth;
|
|
|
import com.izouma.nineth.domain.User;
|
|
|
import com.izouma.nineth.dto.PageQuery;
|
|
|
import com.izouma.nineth.dto.UserDTO;
|
|
|
@@ -13,6 +14,7 @@ import com.izouma.nineth.enums.AuthStatus;
|
|
|
import com.izouma.nineth.enums.AuthorityName;
|
|
|
import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.FollowRepo;
|
|
|
+import com.izouma.nineth.repo.IdentityAuthRepo;
|
|
|
import com.izouma.nineth.repo.UserRepo;
|
|
|
import com.izouma.nineth.security.Authority;
|
|
|
import com.izouma.nineth.security.JwtTokenUtil;
|
|
|
@@ -47,15 +49,16 @@ import java.util.stream.Collectors;
|
|
|
@Slf4j
|
|
|
@AllArgsConstructor
|
|
|
public class UserService {
|
|
|
- private UserRepo userRepo;
|
|
|
- private WxMaService wxMaService;
|
|
|
- private WxMpService wxMpService;
|
|
|
- private SmsService smsService;
|
|
|
- private StorageService storageService;
|
|
|
- private JwtTokenUtil jwtTokenUtil;
|
|
|
- private CaptchaService captchaService;
|
|
|
- private FollowService followService;
|
|
|
- private FollowRepo followRepo;
|
|
|
+ private UserRepo userRepo;
|
|
|
+ private WxMaService wxMaService;
|
|
|
+ private WxMpService wxMpService;
|
|
|
+ private SmsService smsService;
|
|
|
+ private StorageService storageService;
|
|
|
+ private JwtTokenUtil jwtTokenUtil;
|
|
|
+ private CaptchaService captchaService;
|
|
|
+ private FollowService followService;
|
|
|
+ private FollowRepo followRepo;
|
|
|
+ private IdentityAuthRepo identityAuthRepo;
|
|
|
|
|
|
@CacheEvict(value = "user", key = "#user.username")
|
|
|
public User update(User user) {
|
|
|
@@ -366,11 +369,14 @@ public class UserService {
|
|
|
if (AuthStatus.SUCCESS != user.getAuthStatus()) {
|
|
|
throw new BusinessException("用户不存在或未认证");
|
|
|
}
|
|
|
+ String realName = identityAuthRepo.findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(
|
|
|
+ user.getId(), AuthStatus.SUCCESS)
|
|
|
+ .map(IdentityAuth::getRealName).orElse("").replaceAll(".*(?=.)", "**");
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("id", user.getId());
|
|
|
map.put("avatar", user.getAvatar());
|
|
|
- map.put("phone", user.getPhone().replaceAll("(?<=.{3}).*(?=.{4})", "****"));
|
|
|
- map.put("realName", Optional.ofNullable(user.getRealName()).orElse("").replaceAll(".*(?=.)", "**"));
|
|
|
+ map.put("phone", user.getPhone().replaceAll("(?<=.{3}).*(?=.{4})", "**"));
|
|
|
+ map.put("realName", realName);
|
|
|
return map;
|
|
|
}
|
|
|
|