master:系统调优;

pull/1121/head
liujiang 2025-06-09 09:03:56 +08:00
parent 53ddb0cc98
commit 0f82d6e749
5 changed files with 21 additions and 16 deletions

View File

@ -65,13 +65,13 @@ public class StoreProductController extends XktBaseController {
}
/**
* 广20
* 广30
*/
@ApiOperation(value = "推广营销(新品馆)模糊查询最新20天上新商品", httpMethod = "GET", response = R.class)
@GetMapping(value = "/fuzzy/latest20")
public R<List<StoreProdFuzzyLatest20ResVO>> fuzzyQueryLatest20List(@RequestParam(value = "prodArtNum", required = false) String prodArtNum,
@ApiOperation(value = "推广营销(新品馆)模糊查询最新30天上新商品", httpMethod = "GET", response = R.class)
@GetMapping(value = "/fuzzy/latest30")
public R<List<StoreProdFuzzyLatest20ResVO>> fuzzyQueryLatest30List(@RequestParam(value = "prodArtNum", required = false) String prodArtNum,
@RequestParam("storeId") Long storeId) {
return R.ok(BeanUtil.copyToList(storeProdService.fuzzyQueryLatest20List(storeId, prodArtNum), StoreProdFuzzyLatest20ResVO.class));
return R.ok(BeanUtil.copyToList(storeProdService.fuzzyQueryLatest30List(storeId, prodArtNum), StoreProdFuzzyLatest20ResVO.class));
}

View File

@ -151,11 +151,11 @@ public interface IStoreProductService {
Integer batchDelete(StoreProdDeleteDTO deleteDTO) throws IOException;
/**
* 广20
* 广30
*
* @param storeId ID
* @param prodArtNum
* @return List<StoreProdFuzzyLatest20ResDTO>
*/
List<StoreProdFuzzyLatest20ResDTO> fuzzyQueryLatest20List(Long storeId, String prodArtNum);
List<StoreProdFuzzyLatest20ResDTO> fuzzyQueryLatest30List(Long storeId, String prodArtNum);
}

View File

@ -181,10 +181,15 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
Map<Long, StoreProdPriceAndMainPicAndTagDTO> attrMap = attrList.stream()
.collect(Collectors.toMap(StoreProdPriceAndMainPicAndTagDTO::getStoreProdId, Function.identity()));
return recommendList.stream().map(x -> {
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(x.getBizId());
final List<String> tags = ObjectUtils.isNotEmpty(dto) && StringUtils.isNotBlank(dto.getTagStr()) ? Arrays.asList(dto.getTagStr().split(",")) : null;
return BeanUtil.toBean(dto, StoreRecommendResDTO.class).setTags(tags);
}).collect(Collectors.toList());
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(x.getBizId());
if (ObjectUtils.isEmpty(dto)) {
return null;
}
final List<String> tags = ObjectUtils.isNotEmpty(dto) && StringUtils.isNotBlank(dto.getTagStr()) ? Arrays.asList(dto.getTagStr().split(",")) : null;
return BeanUtil.toBean(dto, StoreRecommendResDTO.class).setTags(tags);
})
.filter(ObjectUtils::isNotEmpty)
.collect(Collectors.toList());
}
/**

View File

@ -483,8 +483,8 @@ public class StoreProductServiceImpl implements IStoreProductService {
*/
@Override
@Transactional(readOnly = true)
public List<StoreProdFuzzyLatest20ResDTO> fuzzyQueryLatest20List(Long storeId, String prodArtNum) {
LocalDateTime daysAgo = LocalDateTime.now().minusDays(20).withHour(0).withMinute(0).withSecond(0);
public List<StoreProdFuzzyLatest20ResDTO> fuzzyQueryLatest30List(Long storeId, String prodArtNum) {
LocalDateTime daysAgo = LocalDateTime.now().minusDays(30).withHour(0).withMinute(0).withSecond(0);
LambdaQueryWrapper<StoreProduct> queryWrapper = new LambdaQueryWrapper<StoreProduct>()
.eq(StoreProduct::getStoreId, storeId).eq(StoreProduct::getDelFlag, Constants.UNDELETED)
.between(StoreProduct::getCreateTime, daysAgo, LocalDateTime.now());

View File

@ -1666,12 +1666,12 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
.build();
boolQuery.filter(f -> f.terms(t -> t.field("season.keyword").terms(termsQueryField)));
}
// 如果是按照时间过滤,则表明是“新品”,则限制 时间范围 20天前到现在
// 如果是按照时间过滤,则表明是“新品”,则限制 时间范围 30天前到现在
if (Objects.equals(searchDTO.getSort(), "createTime")) {
// 当前时间
final String nowStr = DateUtils.getTime();
// 当前时间往前推20天获取当天的0点0分0秒
LocalDateTime ago = LocalDateTime.now().minusDays(20).withHour(0).withMinute(0).withSecond(0);
// 当前时间往前推30天获取当天的0点0分0秒
LocalDateTime ago = LocalDateTime.now().minusDays(30).withHour(0).withMinute(0).withSecond(0);
// ago 转化为 yyyy-MM-dd HH:mm:ss
String agoStr = ago.format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS));
RangeQuery.Builder builder = new RangeQuery.Builder();