master:系统调优;

pull/1121/head
liujiang 2025-09-09 23:13:16 +08:00
parent 5455992e0a
commit eae6442a45
7 changed files with 40 additions and 20 deletions

View File

@ -50,5 +50,7 @@ public class AdRoundStoreBoughtResVO {
private String biddingStatusName;
@ApiModelProperty(value = "当前播放状态")
private Integer launchStatus;
@ApiModelProperty(value = "正在播放 或 即将播放")
private Boolean activePlay;
}

View File

@ -76,12 +76,14 @@ public enum AdType {
PIC_SEARCH_PRODUCT(300, "以图搜款商品"),
// PC搜索结果
PC_SEARCH_RESULT(401, "电脑端搜索结果"),
// PC搜索右侧商品
PC_SEARCH_RIGHT_PRODUCT(401, "电脑端搜索右侧商品"),
// PC用户中心 18个位置
PC_USER_CENTER(402, "电脑端用户中心"),
// PC下载页
PC_DOWNLOAD(403, "电脑端下载页"),
// PC搜索结果商品
PC_SEARCH_RESULT_PRODUCT(404, "电脑端搜索结果商品"),
// APP首页顶部轮播图
@ -96,8 +98,8 @@ public enum AdType {
APP_HOME_POP_RECOMMEND_PROD(505, "APP首页人气榜商品列表"),
// APP首页新品榜 商品列表
APP_HOME_NEW_PROD_RECOMMEND_PROD(506, "APP首页新品榜商品列表"),
// APP搜索结果
APP_SEARCH_RESULT(507, "APP搜索结果"),
// APP搜索结果商品
APP_SEARCH_RESULT_PRODUCT(507, "APP搜索结果商品"),
// APP分类页轮播图

View File

@ -50,5 +50,7 @@ public class AdRoundStoreBoughtResDTO {
private String biddingStatusName;
@ApiModelProperty(value = "当前播放状态")
private Integer launchStatus;
@ApiModelProperty(value = "正在播放 或 即将播放")
private Boolean activePlay;
}

View File

@ -387,14 +387,26 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
.map(x -> {
// 如果是最近的播放轮次,且当前时间在 晚上10:00:01 之后到 当天23:59:59 都显示 biddingTempStatus 字段
final Integer biddingStatus = tenClockAfter && roundIdList.contains(x.getRoundId()) ? x.getBiddingTempStatus() : x.getBiddingStatus();
return BeanUtil.toBean(x, AdRoundStoreBoughtResDTO.class).setAdvertRoundId(x.getId())
.setBiddingStatus(biddingStatus).setLaunchStatus(x.getLaunchStatus())
AdRoundStoreBoughtResDTO boughtResDTO = BeanUtil.toBean(x, AdRoundStoreBoughtResDTO.class).setAdvertRoundId(x.getId())
.setBiddingStatus(biddingStatus).setLaunchStatus(x.getLaunchStatus()).setActivePlay(Boolean.FALSE)
// 如果是已出价,则显示 "已出价:50"
.setBiddingStatusName(AdBiddingStatus.of(biddingStatus).getLabel() +
(Objects.equals(biddingStatus, AdBiddingStatus.BIDDING.getValue()) ? ":" + x.getPayPrice() : ""))
.setTypeName(AdType.of(x.getTypeId()).getLabel())
// 如果是时间范围则不返回position
.setPosition(Objects.equals(x.getShowType(), AdShowType.TIME_RANGE.getValue()) ? null : x.getPosition());
// 当前为播放轮 或 当前为第二轮且开始时间为明天
if (Objects.equals(x.getRoundId(), AdRoundType.PLAY_ROUND.getValue())) {
boughtResDTO.setActivePlay(Boolean.TRUE);
// 如果是第二轮且开始时间为明天
} else if (Objects.equals(x.getRoundId(), AdRoundType.SECOND_ROUND.getValue())) {
LocalDate startTimeDate = x.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
if (LocalDate.now().plusDays(1).equals(startTimeDate)) {
boughtResDTO.setActivePlay(Boolean.TRUE);
}
}
return boughtResDTO;
})
.collect(Collectors.toList());
// showType 为 时间范围的 每一轮最高的出价map

View File

@ -216,19 +216,21 @@ public class StoreSaleServiceImpl implements IStoreSaleService {
if (CollectionUtils.isNotEmpty(exportDTO.getStoreSaleIdList())) {
return this.storeSaleMapper.selectExportList(exportDTO.getStoreSaleIdList());
} else {
// 如果是全量导出,则开始时间 和 结束时间 不能为空
// 没有传时间,则设置当前时间往前推半年
if (ObjectUtils.isEmpty(exportDTO.getVoucherDateStart()) && ObjectUtils.isEmpty(exportDTO.getVoucherDateEnd())) {
throw new ServiceException("全量导出时,开始时间和结束时间不能为空!", HttpStatus.ERROR);
}
// 开始时间和结束时间相间隔不能超过6个月
LocalDate start = exportDTO.getVoucherDateStart().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate end = exportDTO.getVoucherDateEnd().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
// 计算两个日期之间的年、月、日差值
Period period = Period.between(start, end);
// 如果总月数超过6个月则返回 true
int totalMonths = period.getYears() * 12 + period.getMonths();
if (Math.abs(totalMonths) > 6) {
throw new ServiceException("导出时间间隔不能超过6个月!", HttpStatus.ERROR);
exportDTO.setVoucherDateEnd(java.sql.Date.valueOf(LocalDate.now()));
exportDTO.setVoucherDateEnd(java.sql.Date.valueOf(LocalDate.now().minusMonths(6)));
} else {
// 开始时间和结束时间相间隔不能超过6个月
LocalDate start = exportDTO.getVoucherDateStart().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate end = exportDTO.getVoucherDateEnd().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
// 计算两个日期之间的年、月、日差值
Period period = Period.between(start, end);
// 如果总月数超过6个月则返回 true
int totalMonths = period.getYears() * 12 + period.getMonths();
if (Math.abs(totalMonths) > 6) {
throw new ServiceException("导出时间间隔不能超过6个月!", HttpStatus.ERROR);
}
}
return this.storeSaleMapper.selectExportListVoucherDateBetween(exportDTO.getVoucherDateStart(), exportDTO.getVoucherDateEnd());
}

View File

@ -359,7 +359,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
// 从数据库查首页 新品榜 推广(精准搜索是否存在推广,不存在从已过期的数据中拉数据来凑数)
List<AdvertRound> advertRoundList = this.advertRoundMapper.selectList(new LambdaQueryWrapper<AdvertRound>()
.isNotNull(AdvertRound::getStoreId).eq(AdvertRound::getDelFlag, Constants.UNDELETED)
.eq(AdvertRound::getTypeId, AdType.APP_SEARCH_RESULT.getValue())
.eq(AdvertRound::getTypeId, AdType.APP_SEARCH_RESULT_PRODUCT.getValue())
.eq(AdvertRound::getLaunchStatus, AdLaunchStatus.LAUNCHING.getValue())
.eq(AdvertRound::getBiddingStatus, AdBiddingStatus.BIDDING_SUCCESS.getValue()));
if (CollectionUtils.isNotEmpty(advertRoundList)) {

View File

@ -424,7 +424,7 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
if (ObjectUtils.isNotEmpty(searchResultAdvertList)) {
return searchResultAdvertList;
}
List<AdvertRound> oneMonthList = this.getOneMonthAdvertList(Collections.singletonList(AdType.PC_SEARCH_RESULT.getValue()));
List<AdvertRound> oneMonthList = this.getOneMonthAdvertList(Collections.singletonList(AdType.PC_SEARCH_RIGHT_PRODUCT.getValue()));
if (CollectionUtils.isEmpty(oneMonthList)) {
return new ArrayList<>();
}