|
@@ -10,10 +10,12 @@ import com.neko.domain.dto.userDto.WxLoginDto;
|
|
import com.neko.domain.dto.friendDto.UserPwdDto;
|
|
import com.neko.domain.dto.friendDto.UserPwdDto;
|
|
import com.neko.domain.dto.userDto.PhoneLoginDto;
|
|
import com.neko.domain.dto.userDto.PhoneLoginDto;
|
|
import com.neko.domain.dto.userDto.YanDto;
|
|
import com.neko.domain.dto.userDto.YanDto;
|
|
|
|
+import com.neko.domain.pojo.FriendRelation;
|
|
import com.neko.domain.pojo.User;
|
|
import com.neko.domain.pojo.User;
|
|
import com.neko.domain.pojo.UserLog;
|
|
import com.neko.domain.pojo.UserLog;
|
|
import com.neko.domain.pojo.UserProfile;
|
|
import com.neko.domain.pojo.UserProfile;
|
|
import com.neko.face.FaceUtil;
|
|
import com.neko.face.FaceUtil;
|
|
|
|
+import com.neko.mapper.FriendRelationMapper;
|
|
import com.neko.mapper.UserLogMapper;
|
|
import com.neko.mapper.UserLogMapper;
|
|
import com.neko.mapper.UserProfileMapper;
|
|
import com.neko.mapper.UserProfileMapper;
|
|
import com.neko.miniofile.service.FileService;
|
|
import com.neko.miniofile.service.FileService;
|
|
@@ -22,7 +24,10 @@ import com.neko.mapper.UserMapper;
|
|
import com.neko.utils.*;
|
|
import com.neko.utils.*;
|
|
import io.jsonwebtoken.Claims;
|
|
import io.jsonwebtoken.Claims;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import net.sourceforge.pinyin4j.PinyinHelper;
|
|
import org.apache.http.HttpResponse;
|
|
import org.apache.http.HttpResponse;
|
|
|
|
+import org.apache.kafka.common.protocol.types.Field;
|
|
|
|
+import org.checkerframework.checker.units.qual.A;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -37,6 +42,7 @@ import java.net.InetAddress;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author 金聪
|
|
* @author 金聪
|
|
@@ -59,6 +65,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User>
|
|
UserLogMapper userLogMapper;
|
|
UserLogMapper userLogMapper;
|
|
@Autowired
|
|
@Autowired
|
|
FileService fileService;
|
|
FileService fileService;
|
|
|
|
+ @Autowired
|
|
|
|
+ FriendRelationMapper friendRelationMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResultVo phoenLogin(PhoneLoginDto dto) throws Exception {
|
|
public ResultVo phoenLogin(PhoneLoginDto dto) throws Exception {
|
|
@@ -535,6 +543,30 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User>
|
|
return ResultVo.error(ApiServiceExceptionEnum.LOGIN_ERROR);
|
|
return ResultVo.error(ApiServiceExceptionEnum.LOGIN_ERROR);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResultVo friendAll(String token) {
|
|
|
|
+ Claims claims = AppJwtUtil.getClaimsBody(token);
|
|
|
|
+ String id = claims.get("id").toString();
|
|
|
|
+ QueryWrapper<FriendRelation> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.lambda().eq(FriendRelation::getUserId,id);
|
|
|
|
+ List<FriendRelation> list = friendRelationMapper.selectList(queryWrapper);
|
|
|
|
+ for(FriendRelation f : list){
|
|
|
|
+ if(f.getRemark()==null || f.getRemark().isEmpty()) return ResultVo.success("#");
|
|
|
|
+ char firstChar = f.getRemark().charAt(0);
|
|
|
|
+ if(Character.toString(firstChar).matches("[\\u4E08-\\u9FA5]")){
|
|
|
|
+ String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(firstChar);
|
|
|
|
+ if(pinyinArray != null && pinyinArray.length>0){
|
|
|
|
+ f.setLetter(pinyinArray[0].substring(0,1).toUpperCase());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<FriendRelation> fList = list.stream()
|
|
|
|
+ .sorted(Comparator.comparing(FriendRelation::getLetter))
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ return ResultVo.success(ApiServiceExceptionEnum.RESULT_SUCCES,fList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|