|
|
@ -27,6 +27,8 @@ import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
|
import org.springframework.data.mongodb.core.aggregation.Aggregation;
|
|
|
|
import org.springframework.data.mongodb.core.aggregation.Aggregation;
|
|
|
|
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
|
|
|
|
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
|
|
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
|
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
@ -64,7 +66,6 @@ import io.swagger.annotations.ApiParam;
|
|
|
|
import lombok.SneakyThrows;
|
|
|
|
import lombok.SneakyThrows;
|
|
|
|
import util.DateUtil;
|
|
|
|
import util.DateUtil;
|
|
|
|
import util.IdWorker;
|
|
|
|
import util.IdWorker;
|
|
|
|
import util.ScaleFilter;
|
|
|
|
|
|
|
|
import util.StringTools;
|
|
|
|
import util.StringTools;
|
|
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
@ -72,6 +73,7 @@ import util.StringTools;
|
|
|
|
@RequestMapping("/my")
|
|
|
|
@RequestMapping("/my")
|
|
|
|
@Api(tags = "MyController")
|
|
|
|
@Api(tags = "MyController")
|
|
|
|
public class MyController extends BaseController {
|
|
|
|
public class MyController extends BaseController {
|
|
|
|
|
|
|
|
private static final String REDIS_KEY_THANKS = "thanks";
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private S3Service s3Service;
|
|
|
|
private S3Service s3Service;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
@ -96,6 +98,9 @@ public class MyController extends BaseController {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private SensitiveWordBs sensitiveWordBs;
|
|
|
|
private SensitiveWordBs sensitiveWordBs;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private RedisTemplate redisTemplate;
|
|
|
|
|
|
|
|
|
|
|
|
public static String USER_AVATAR_DIRECTORY = "user/avatar/";
|
|
|
|
public static String USER_AVATAR_DIRECTORY = "user/avatar/";
|
|
|
|
public static String USER_FEEDBACK_IMAGE_DIRECTORY = "user/feedback/";
|
|
|
|
public static String USER_FEEDBACK_IMAGE_DIRECTORY = "user/feedback/";
|
|
|
|
|
|
|
|
|
|
|
@ -400,8 +405,17 @@ public class MyController extends BaseController {
|
|
|
|
@ApiOperation(value = "11.感谢", notes = "贡献者列表")
|
|
|
|
@ApiOperation(value = "11.感谢", notes = "贡献者列表")
|
|
|
|
@GetMapping("/thanks")
|
|
|
|
@GetMapping("/thanks")
|
|
|
|
public Result<List<UserRespDTO>> getThanks() {
|
|
|
|
public Result<List<UserRespDTO>> getThanks() {
|
|
|
|
List<UserRespDTO> list=userInfoService.getThanks().stream().sorted(Comparator.comparing(u->getIndex(u))).map(user->getUserRespDTO(user, false, Collections.emptySet())).collect(Collectors.toList());
|
|
|
|
return Result.success(getThankList());
|
|
|
|
return Result.success(list);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
|
|
|
private List<UserRespDTO> getThankList() {
|
|
|
|
|
|
|
|
List<UserRespDTO> thanks = (List<UserRespDTO>) redisTemplate.opsForValue().get(REDIS_KEY_THANKS);
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(thanks)) {
|
|
|
|
|
|
|
|
thanks = userInfoService.getThanks().stream().sorted(Comparator.comparing(u->getIndex(u))).map(user->getUserRespDTO(user, false, Collections.emptySet())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
redisTemplate.opsForValue().set(REDIS_KEY_THANKS, thanks);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return thanks;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Integer getIndex(UserInfo u) {
|
|
|
|
private Integer getIndex(UserInfo u) {
|
|
|
|