diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityCreateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityCreateReqVO.java index 19d39121c..41d4304e1 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityCreateReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityCreateReqVO.java @@ -16,6 +16,13 @@ import java.util.List; @ToString(callSuper = true) public class SeckillActivityCreateReqVO extends SeckillActivityBaseVO { + /** + * 秒杀活动商品 + */ + @Schema(description = "秒杀活动商品", example = "1") + @NotNull(message = "秒杀活动商品不能为空") + private Long spuId; + @Schema(description = "备注", example = "限时秒杀活动") private String remark; @@ -25,7 +32,7 @@ public class SeckillActivityCreateReqVO extends SeckillActivityBaseVO { @Schema(description = "秒杀时段id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,3") @NotEmpty(message = "参与场次不能为空") - private List timeIds; + private List configIds; /** * 商品列表 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityPageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityPageReqVO.java index f0299377d..ac634a7b2 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityPageReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityPageReqVO.java @@ -26,7 +26,7 @@ public class SeckillActivityPageReqVO extends PageParam { private Integer status; @Schema(description = "秒杀时段id", example = "1") - private Long timeId; + private Long configId; @Schema(description = "创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityRespVO.java index 09258f596..1f806a0e2 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityRespVO.java @@ -17,7 +17,7 @@ public class SeckillActivityRespVO extends SeckillActivityBaseVO { @Schema(description = "秒杀活动id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") private Long id; - @Schema(description = "付款订单数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @Schema(description = "新增订单数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") private Integer orderCount; @Schema(description = "付款人数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @@ -27,7 +27,7 @@ public class SeckillActivityRespVO extends SeckillActivityBaseVO { private LocalDateTime createTime; @Schema(description = "秒杀时段id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,3") - private List timeIds; + private List configIds; @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") private Integer sort; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityUpdateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityUpdateReqVO.java index 56cc119db..dd08892ab 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityUpdateReqVO.java @@ -29,7 +29,7 @@ public class SeckillActivityUpdateReqVO extends SeckillActivityBaseVO { @Schema(description = "秒杀时段id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,3") @NotEmpty(message = "秒杀时段id不能为空") - private List timeIds; + private List configIds; /** * 商品列表 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigBaseVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigBaseVO.java index bb6012015..27b69b2b1 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigBaseVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigBaseVO.java @@ -2,12 +2,8 @@ package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotNull; -import java.time.LocalTime; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_HOUR_MINUTE_SECOND; /** * 秒杀时段 Base VO,提供给添加、修改、详细的子 VO 使用 @@ -24,13 +20,11 @@ public class SeckillConfigBaseVO { @Schema(description = "开始时间点", requiredMode = Schema.RequiredMode.REQUIRED, example = "09:00:00") @NotNull(message = "开始时间点不能为空") - @DateTimeFormat(pattern = FORMAT_HOUR_MINUTE_SECOND) - private LocalTime startTime; + private String startTime; @Schema(description = "结束时间点", requiredMode = Schema.RequiredMode.REQUIRED, example = "16:00:00") @NotNull(message = "结束时间点不能为空") - @DateTimeFormat(pattern = FORMAT_HOUR_MINUTE_SECOND) - private LocalTime endTime; + private String endTime; @Schema(description = "秒杀主图", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn") @NotNull(message = "秒杀主图不能为空") diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigPageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigPageReqVO.java index f743885af..e7b29ad29 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigPageReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigPageReqVO.java @@ -5,9 +5,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import org.springframework.format.annotation.DateTimeFormat; - -import java.time.LocalTime; /** * 管理后台 - 秒杀时段分页 Request VO @@ -26,12 +23,4 @@ public class SeckillConfigPageReqVO extends PageParam { @Schema(description = "状态", example = "0") private Integer status; - @Schema(description = "开始时间点", example = "16:30:40") - @DateTimeFormat(pattern = "HH:mm:ss") - private LocalTime[] startTime; - - @Schema(description = "结束时间点", example = "16:30:40") - @DateTimeFormat(pattern = "HH:mm:ss") - private LocalTime[] endTime; - } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java index 0294c248b..40e3c60cf 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java @@ -55,7 +55,7 @@ public interface SeckillActivityConvert { return ObjectUtil.equals(productDO.getSpuId(), productVO.getSpuId()) && ObjectUtil.equals(productDO.getSkuId(), productVO.getSkuId()) && ObjectUtil.equals(productDO.getSeckillPrice(), productVO.getSeckillPrice()) - && ObjectUtil.equals(productDO.getStock(), productVO.getStock()) + && ObjectUtil.equals(productDO.getQuota(), productVO.getQuota()) && ObjectUtil.equals(productDO.getLimitCount(), productVO.getLimitCount()); } @@ -70,14 +70,14 @@ public interface SeckillActivityConvert { return ObjectUtil.equals(productDO.getSpuId(), productVO.getSpuId()) && ObjectUtil.equals(productDO.getSkuId(), productVO.getSkuId()) && ObjectUtil.equals(productDO.getSeckillPrice(), productVO.getSeckillPrice()) - && ObjectUtil.equals(productDO.getStock(), productVO.getStock()) + && ObjectUtil.equals(productDO.getQuota(), productVO.getQuota()) && ObjectUtil.equals(productDO.getLimitCount(), productVO.getLimitCount()); } default List convertList(List products, SeckillActivityDO seckillActivity) { return CollectionUtils.convertList(products, product -> convert(product) - .setActivityId(seckillActivity.getId()).setTimeIds(seckillActivity.getTimeIds())); + .setActivityId(seckillActivity.getId()).setConfigIds(seckillActivity.getConfigIds())); } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillconfig/SeckillConfigConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillconfig/SeckillConfigConvert.java index f2a7283e4..0c753afde 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillconfig/SeckillConfigConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillconfig/SeckillConfigConvert.java @@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.Seck import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigUpdateReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillconfig.SeckillConfigDO; import org.mapstruct.Mapper; -import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; import java.util.List; @@ -25,7 +24,6 @@ public interface SeckillConfigConvert { SeckillConfigDO convert(SeckillConfigUpdateReqVO bean); - @Mapping(target = "s") SeckillConfigRespVO convert(SeckillConfigDO bean); List convertList(List list); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillactivity/SeckillActivityDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillactivity/SeckillActivityDO.java index 2a0dcd70b..d5a874df4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillactivity/SeckillActivityDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillactivity/SeckillActivityDO.java @@ -31,13 +31,17 @@ public class SeckillActivityDO extends BaseDO { */ @TableId private Long id; + /** + * 秒杀活动商品 + */ + private Long spuId; /** * 秒杀活动名称 */ private String name; /** * 活动状态 - * + *

* 枚举 {@link PromotionActivityStatusEnum 对应的类} */ private Integer status; @@ -61,9 +65,9 @@ public class SeckillActivityDO extends BaseDO { * 秒杀时段 id */ @TableField(typeHandler = LongListTypeHandler.class) - private List timeIds; + private List configIds; /** - * 付款订单数 + * 新增订单数 */ private Integer orderCount; /** diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillactivity/SeckillProductDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillactivity/SeckillProductDO.java index 921679df7..1bfb9832a 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillactivity/SeckillProductDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillactivity/SeckillProductDO.java @@ -21,6 +21,7 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class SeckillProductDO extends BaseDO { + /** * 秒杀参与商品编号 */ @@ -36,7 +37,7 @@ public class SeckillProductDO extends BaseDO { * 秒杀时段id */ @TableField(typeHandler = LongListTypeHandler.class) - private List timeIds; + private List configIds; /** * 商品id @@ -53,9 +54,8 @@ public class SeckillProductDO extends BaseDO { */ private Integer seckillPrice; - // TODO @芋艿:改成 quota 限量库存;每次购买时,需要减小; /** - * 秒杀库存 + * 秒杀库存 限量库存;每次购买时,需要减小; */ private Integer quota; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillconfig/SeckillConfigDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillconfig/SeckillConfigDO.java index 8b64ab10f..971083cbf 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillconfig/SeckillConfigDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillconfig/SeckillConfigDO.java @@ -9,8 +9,6 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.time.LocalTime; - /** * 秒杀时段 DO * @@ -35,11 +33,11 @@ public class SeckillConfigDO extends BaseDO { /** * 开始时间点 */ - private LocalTime startTime; + private String startTime; /** * 结束时间点 */ - private LocalTime endTime; + private String endTime; /** * 秒杀主图 */ diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java index c01676c2a..6bad96ff9 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java @@ -20,7 +20,7 @@ public interface SeckillActivityMapper extends BaseMapperX { .likeIfPresent(SeckillActivityDO::getName, reqVO.getName()) .eqIfPresent(SeckillActivityDO::getStatus, reqVO.getStatus()) .betweenIfPresent(SeckillActivityDO::getCreateTime, reqVO.getCreateTime()) - .apply(ObjectUtil.isNotNull(reqVO.getTimeId()),"FIND_IN_SET(" + reqVO.getTimeId() + ",time_ids) > 0") + .apply(ObjectUtil.isNotNull(reqVO.getConfigId()), "FIND_IN_SET(" + reqVO.getConfigId() + ",time_ids) > 0") .orderByDesc(SeckillActivityDO::getId)); } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillProductMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillProductMapper.java index a590de1a5..fd6d87bdf 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillProductMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillProductMapper.java @@ -27,7 +27,7 @@ public interface SeckillProductMapper extends BaseMapperX { default void updateTimeIdsByActivityId(Long id, List timeIds) { new LambdaUpdateChainWrapper<>(this) - .set(SeckillProductDO::getTimeIds, CollUtil.join(timeIds, ",")) + .set(SeckillProductDO::getConfigIds, CollUtil.join(timeIds, ",")) .eq(SeckillProductDO::getActivityId, id) .update(); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillconfig/SeckillConfigMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillconfig/SeckillConfigMapper.java index 639991551..9c712bbfb 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillconfig/SeckillConfigMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillconfig/SeckillConfigMapper.java @@ -36,8 +36,6 @@ public interface SeckillConfigMapper extends BaseMapperX { default PageResult selectPage(SeckillConfigPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(SeckillConfigDO::getName, reqVO.getName()) - .betweenIfPresent(SeckillConfigDO::getStartTime, reqVO.getStartTime()) - .betweenIfPresent(SeckillConfigDO::getEndTime, reqVO.getEndTime()) .eqIfPresent(SeckillConfigDO::getStatus, reqVO.getStatus()) .orderByDesc(SeckillConfigDO::getId)); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillactivity/SeckillActivityServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillactivity/SeckillActivityServiceImpl.java index 4e14ed723..d856c9cad 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillactivity/SeckillActivityServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillactivity/SeckillActivityServiceImpl.java @@ -47,7 +47,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { // 校验商品是否冲突 validateSeckillActivityProductConflicts(null, createReqVO.getProducts()); // 校验秒杀时段是否存在 - seckillConfigService.validateSeckillConfigExists(createReqVO.getTimeIds()); + seckillConfigService.validateSeckillConfigExists(createReqVO.getConfigIds()); // 插入秒杀活动 SeckillActivityDO seckillActivity = SeckillActivityConvert.INSTANCE.convert(createReqVO) @@ -57,7 +57,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { List productDOs = SeckillActivityConvert.INSTANCE.convertList(createReqVO.getProducts(), seckillActivity); seckillProductMapper.insertBatch(productDOs); // 更新秒杀时段的秒杀活动数量 - seckillConfigService.seckillActivityCountIncr(createReqVO.getTimeIds()); + seckillConfigService.seckillActivityCountIncr(createReqVO.getConfigIds()); return seckillActivity.getId(); } @@ -78,7 +78,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { // 更新商品 updateSeckillProduct(updateReqVO); // 更新秒杀时段的秒杀活动数量 - updateSeckillConfigActivityCount(seckillActivity, updateReqVO.getTimeIds()); + updateSeckillConfigActivityCount(seckillActivity, updateReqVO.getConfigIds()); } /** @@ -89,7 +89,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { */ private void updateSeckillConfigActivityCount(SeckillActivityDO seckillActivity, List updateTimeIds) { // 查询出 timeIds - List existsTimeIds = seckillActivity.getTimeIds(); + List existsTimeIds = seckillActivity.getConfigIds(); // 需要减少的时间段 Collection reduceIds = CollUtil.filterNew(existsTimeIds, existsTimeId -> !updateTimeIds.contains(existsTimeId)); // 需要添加的时间段 @@ -134,7 +134,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { } //全量更新当前活动商品的秒杀时段id列表(timeIds) - seckillProductMapper.updateTimeIdsByActivityId(updateReqVO.getId(), updateReqVO.getTimeIds()); + seckillProductMapper.updateTimeIdsByActivityId(updateReqVO.getId(), updateReqVO.getConfigIds()); } /** @@ -190,7 +190,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { throw exception(SECKILL_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END); } // 更新秒杀时段的秒杀活动数量 - seckillConfigService.seckillActivityCountDecr(seckillActivity.getTimeIds()); + seckillConfigService.seckillActivityCountDecr(seckillActivity.getConfigIds()); // 删除 seckillActivityMapper.deleteById(id); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillconfig/SeckillConfigServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillconfig/SeckillConfigServiceImpl.java index 27497bea2..d3fc3eddd 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillconfig/SeckillConfigServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillconfig/SeckillConfigServiceImpl.java @@ -36,7 +36,8 @@ public class SeckillConfigServiceImpl implements SeckillConfigService { @Override public Long createSeckillConfig(SeckillConfigCreateReqVO createReqVO) { // 校验时间段是否冲突 - validateSeckillConfigConflict(null, createReqVO.getStartTime(), createReqVO.getEndTime()); + //validateSeckillConfigConflict(null, createReqVO.getStartTime(), createReqVO.getEndTime()); + // 插入 SeckillConfigDO seckillConfig = SeckillConfigConvert.INSTANCE.convert(createReqVO); seckillConfigMapper.insert(seckillConfig); @@ -49,7 +50,8 @@ public class SeckillConfigServiceImpl implements SeckillConfigService { // 校验存在 this.validateSeckillConfigExists(updateReqVO.getId()); // 校验时间段是否冲突 - validateSeckillConfigConflict(updateReqVO.getId(), updateReqVO.getStartTime(), updateReqVO.getEndTime()); + //validateSeckillConfigConflict(updateReqVO.getId(), updateReqVO.getStartTime(), updateReqVO.getEndTime()); + // 更新 SeckillConfigDO updateObj = SeckillConfigConvert.INSTANCE.convert(updateReqVO); seckillConfigMapper.updateById(updateObj); @@ -77,6 +79,7 @@ public class SeckillConfigServiceImpl implements SeckillConfigService { */ private void validateSeckillConfigConflict(Long id, LocalTime startTime, LocalTime endTime) { //查询开始时间,结束时间,是否在别人的时间段内 + // TODO 为什么要检查这个时间段是否冲突 比如早上 09:00:00 - 10:00:00 我再添加一个 09:00:00 - 09:30:00 不可以这样吗? List startTimeList = seckillConfigMapper.selectListByTime(startTime); List endTimeList = seckillConfigMapper.selectListByTime(endTime); //查询自己时间段内是否有时间段 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/seckillactivity/SeckillActivityServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/seckillactivity/SeckillActivityServiceImplTest.java index 5ce68e346..667fc1d24 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/seckillactivity/SeckillActivityServiceImplTest.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/seckillactivity/SeckillActivityServiceImplTest.java @@ -108,7 +108,7 @@ public class SeckillActivityServiceImplTest extends BaseDbUnitTest { SeckillActivityDO dbSeckillActivity = randomPojo(SeckillActivityDO.class, o -> { // 等会查询到 o.setName(null); o.setStatus(null); - o.setTimeIds(null); + o.setConfigIds(null); o.setCreateTime(null); }); seckillActivityMapper.insert(dbSeckillActivity); @@ -117,15 +117,15 @@ public class SeckillActivityServiceImplTest extends BaseDbUnitTest { // 测试 status 不匹配 seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setStatus(null))); // 测试 timeId 不匹配 - seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setTimeIds(null))); + seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setConfigIds(null))); // 测试 createTime 不匹配 seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setCreateTime(null))); // 准备参数 SeckillActivityPageReqVO reqVO = new SeckillActivityPageReqVO(); reqVO.setName(null); - reqVO.setStatus(null); - reqVO.setTimeId(null); - reqVO.setCreateTime((new LocalDateTime[]{})); + reqVO.setStatus(null); + reqVO.setConfigId(null); + reqVO.setCreateTime((new LocalDateTime[]{})); // 调用 PageResult pageResult = seckillActivityService.getSeckillActivityPage(reqVO); @@ -142,7 +142,7 @@ public class SeckillActivityServiceImplTest extends BaseDbUnitTest { SeckillActivityDO dbSeckillActivity = randomPojo(SeckillActivityDO.class, o -> { // 等会查询到 o.setName(null); o.setStatus(null); - o.setTimeIds(null); + o.setConfigIds(null); o.setCreateTime(null); }); seckillActivityMapper.insert(dbSeckillActivity); @@ -151,7 +151,7 @@ public class SeckillActivityServiceImplTest extends BaseDbUnitTest { // 测试 status 不匹配 seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setStatus(null))); // 测试 timeId 不匹配 - seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setTimeIds(null))); + seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setConfigIds(null))); // 测试 createTime 不匹配 seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setCreateTime(null))); // 准备参数