|
|
@@ -33,6 +33,7 @@ import org.springframework.data.redis.core.BoundValueOperations;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.scheduling.TaskScheduler;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
@@ -455,4 +456,17 @@ public class CollectionService {
|
|
|
rocketMQTemplate.convertAndSend(generalProperties.getUpdateQuotaTopic(), id);
|
|
|
return stock;
|
|
|
}
|
|
|
+
|
|
|
+ @Cacheable(value = "recommendLegacy", key = "#type")
|
|
|
+ public List<CollectionDTO> recommendLegacy(@RequestParam String type) {
|
|
|
+ return collectionRepo.recommend(type).stream().map(rc -> {
|
|
|
+ if (StringUtils.isNotBlank(rc.getRecommend().getPic())) {
|
|
|
+ rc.getCollection().setPic(Collections.singletonList(new FileObject(null, rc.getRecommend()
|
|
|
+ .getPic(), null, null)));
|
|
|
+ }
|
|
|
+ CollectionDTO collectionDTO = new CollectionDTO();
|
|
|
+ BeanUtils.copyProperties(rc.getCollection(), collectionDTO);
|
|
|
+ return collectionDTO;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
}
|