Commit c766f7daa573cc194eee3f7da6b0a4ac2d14fb28
1 parent
1b154699
code review:砍价、秒杀的逻辑
Showing
18 changed files
with
68 additions
and
51 deletions
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java
| @@ -50,6 +50,7 @@ public class LocalDateTimeUtils { | @@ -50,6 +50,7 @@ public class LocalDateTimeUtils { | ||
| 50 | * @return 指定时间 | 50 | * @return 指定时间 |
| 51 | */ | 51 | */ |
| 52 | public static LocalDateTime buildTime(String timeStr) { | 52 | public static LocalDateTime buildTime(String timeStr) { |
| 53 | + // TODO @puhui999:这个方法的实现,和 LocalDateTimeUtil.parse() 的差异点是啥呀 | ||
| 53 | return LocalDateTime.of(LocalDate.now(), LocalTime.parse(timeStr)); | 54 | return LocalDateTime.of(LocalDate.now(), LocalTime.parse(timeStr)); |
| 54 | } | 55 | } |
| 55 | 56 |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java
| @@ -31,7 +31,7 @@ public interface CombinationRecordApi { | @@ -31,7 +31,7 @@ public interface CombinationRecordApi { | ||
| 31 | boolean isCombinationRecordSuccess(Long userId, Long orderId); | 31 | boolean isCombinationRecordSuccess(Long userId, Long orderId); |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | - * 更新拼团状态为 成功 | 34 | + * 更新拼团状态为【成功】 |
| 35 | * | 35 | * |
| 36 | * @param userId 用户编号 | 36 | * @param userId 用户编号 |
| 37 | * @param orderId 订单编号 | 37 | * @param orderId 订单编号 |
| @@ -39,7 +39,7 @@ public interface CombinationRecordApi { | @@ -39,7 +39,7 @@ public interface CombinationRecordApi { | ||
| 39 | void updateRecordStatusToSuccess(Long userId, Long orderId); | 39 | void updateRecordStatusToSuccess(Long userId, Long orderId); |
| 40 | 40 | ||
| 41 | /** | 41 | /** |
| 42 | - * 更新拼团状态为 失败 | 42 | + * 更新拼团状态为【失败】 |
| 43 | * | 43 | * |
| 44 | * @param userId 用户编号 | 44 | * @param userId 用户编号 |
| 45 | * @param orderId 订单编号 | 45 | * @param orderId 订单编号 |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/seckill/SeckillActivityApi.java
| @@ -7,6 +7,7 @@ package cn.iocoder.yudao.module.promotion.api.seckill; | @@ -7,6 +7,7 @@ package cn.iocoder.yudao.module.promotion.api.seckill; | ||
| 7 | */ | 7 | */ |
| 8 | public interface SeckillActivityApi { | 8 | public interface SeckillActivityApi { |
| 9 | 9 | ||
| 10 | + // TODO @puhui999:activityId 改成 id 好点哈; | ||
| 10 | /** | 11 | /** |
| 11 | * 更新秒杀库存 | 12 | * 更新秒杀库存 |
| 12 | * | 13 | * |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/bargain/BargainActivityController.java
| @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.promotion.controller.admin.bargain; | @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.promotion.controller.admin.bargain; | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 7 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; | 6 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; |
| 8 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; | 7 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; |
| 9 | import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.BargainActivityCreateReqVO; | 8 | import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.BargainActivityCreateReqVO; |
| @@ -25,6 +24,7 @@ import javax.validation.Valid; | @@ -25,6 +24,7 @@ import javax.validation.Valid; | ||
| 25 | import java.util.List; | 24 | import java.util.List; |
| 26 | 25 | ||
| 27 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 26 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 27 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | ||
| 28 | 28 | ||
| 29 | @Tag(name = "管理后台 - 砍价活动") | 29 | @Tag(name = "管理后台 - 砍价活动") |
| 30 | @RestController | 30 | @RestController |
| @@ -79,7 +79,9 @@ public class BargainActivityController { | @@ -79,7 +79,9 @@ public class BargainActivityController { | ||
| 79 | if (CollUtil.isEmpty(pageResult.getList())) { | 79 | if (CollUtil.isEmpty(pageResult.getList())) { |
| 80 | return success(PageResult.empty(pageResult.getTotal())); | 80 | return success(PageResult.empty(pageResult.getTotal())); |
| 81 | } | 81 | } |
| 82 | - List<ProductSpuRespDTO> spuList = spuApi.getSpuList(CollectionUtils.convertList(pageResult.getList(), BargainActivityDO::getSpuId)); | 82 | + |
| 83 | + // 拼接数据 | ||
| 84 | + List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(pageResult.getList(), BargainActivityDO::getSpuId)); | ||
| 83 | return success(BargainActivityConvert.INSTANCE.convertPage(pageResult, spuList)); | 85 | return success(BargainActivityConvert.INSTANCE.convertPage(pageResult, spuList)); |
| 84 | } | 86 | } |
| 85 | 87 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainActivityController.java
| @@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil; | @@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 8 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; | 7 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; |
| 9 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; | 8 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; |
| 10 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity.AppBargainActivityDetailRespVO; | 9 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity.AppBargainActivityDetailRespVO; |
| @@ -25,6 +24,7 @@ import javax.annotation.Resource; | @@ -25,6 +24,7 @@ import javax.annotation.Resource; | ||
| 25 | import java.util.List; | 24 | import java.util.List; |
| 26 | 25 | ||
| 27 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 26 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 27 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | ||
| 28 | 28 | ||
| 29 | @Tag(name = "用户 App - 砍价活动") | 29 | @Tag(name = "用户 App - 砍价活动") |
| 30 | @RestController | 30 | @RestController |
| @@ -39,27 +39,27 @@ public class AppBargainActivityController { | @@ -39,27 +39,27 @@ public class AppBargainActivityController { | ||
| 39 | @GetMapping("/page") | 39 | @GetMapping("/page") |
| 40 | @Operation(summary = "获得砍价活动分页") | 40 | @Operation(summary = "获得砍价活动分页") |
| 41 | public CommonResult<PageResult<AppBargainActivityRespVO>> getBargainActivityPage(PageParam pageReqVO) { | 41 | public CommonResult<PageResult<AppBargainActivityRespVO>> getBargainActivityPage(PageParam pageReqVO) { |
| 42 | - PageResult<BargainActivityDO> result = bargainActivityService.getBargainActivityAppPage(pageReqVO); | 42 | + PageResult<BargainActivityDO> result = bargainActivityService.getBargainActivityPageForApp(pageReqVO); |
| 43 | if (CollUtil.isEmpty(result.getList())) { | 43 | if (CollUtil.isEmpty(result.getList())) { |
| 44 | return success(PageResult.empty(result.getTotal())); | 44 | return success(PageResult.empty(result.getTotal())); |
| 45 | } | 45 | } |
| 46 | - | ||
| 47 | - List<ProductSpuRespDTO> spuList = spuApi.getSpuList(CollectionUtils.convertList(result.getList(), BargainActivityDO::getSpuId)); | 46 | + // 拼接数据 |
| 47 | + List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(result.getList(), BargainActivityDO::getSpuId)); | ||
| 48 | return success(BargainActivityConvert.INSTANCE.convertAppPage(result, spuList)); | 48 | return success(BargainActivityConvert.INSTANCE.convertAppPage(result, spuList)); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | + // TODO 芋艿:增加 Spring Cache | ||
| 51 | @GetMapping("/list") | 52 | @GetMapping("/list") |
| 52 | @Operation(summary = "获得砍价活动列表", description = "用于小程序首页") | 53 | @Operation(summary = "获得砍价活动列表", description = "用于小程序首页") |
| 53 | @Parameter(name = "count", description = "需要展示的数量", example = "6") | 54 | @Parameter(name = "count", description = "需要展示的数量", example = "6") |
| 54 | public CommonResult<List<AppBargainActivityRespVO>> getBargainActivityList( | 55 | public CommonResult<List<AppBargainActivityRespVO>> getBargainActivityList( |
| 55 | @RequestParam(name = "count", defaultValue = "6") Integer count) { | 56 | @RequestParam(name = "count", defaultValue = "6") Integer count) { |
| 56 | - List<BargainActivityDO> list = bargainActivityService.getBargainActivityAppList(count); | 57 | + List<BargainActivityDO> list = bargainActivityService.getBargainActivityListForApp(count); |
| 57 | if (CollUtil.isEmpty(list)) { | 58 | if (CollUtil.isEmpty(list)) { |
| 58 | return success(BargainActivityConvert.INSTANCE.convertAppList(list)); | 59 | return success(BargainActivityConvert.INSTANCE.convertAppList(list)); |
| 59 | } | 60 | } |
| 60 | - | ||
| 61 | - List<ProductSpuRespDTO> spuList = spuApi.getSpuList(CollectionUtils.convertList(list, BargainActivityDO::getSpuId)); | ||
| 62 | - // TODO 芋艿:增加 Spring Cache | 61 | + // 拼接数据 |
| 62 | + List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(list, BargainActivityDO::getSpuId)); | ||
| 63 | return success(BargainActivityConvert.INSTANCE.convertAppList(list, spuList)); | 63 | return success(BargainActivityConvert.INSTANCE.convertAppList(list, spuList)); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| @@ -71,9 +71,9 @@ public class AppBargainActivityController { | @@ -71,9 +71,9 @@ public class AppBargainActivityController { | ||
| 71 | if (activity == null) { | 71 | if (activity == null) { |
| 72 | return success(null); | 72 | return success(null); |
| 73 | } | 73 | } |
| 74 | - | 74 | + // 拼接数据 |
| 75 | ProductSpuRespDTO spu = spuApi.getSpu(activity.getSpuId()); | 75 | ProductSpuRespDTO spu = spuApi.getSpu(activity.getSpuId()); |
| 76 | - return success(BargainActivityConvert.INSTANCE.convert1(activity, spu)); | 76 | + return success(BargainActivityConvert.INSTANCE.convert(activity, spu)); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | } | 79 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java
| @@ -4,7 +4,6 @@ import cn.hutool.core.util.ObjectUtil; | @@ -4,7 +4,6 @@ import cn.hutool.core.util.ObjectUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 4 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 8 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; | 7 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; |
| 9 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; | 8 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; |
| 10 | import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppSeckillActivityDetailRespVO; | 9 | import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppSeckillActivityDetailRespVO; |
| @@ -33,8 +32,7 @@ import java.util.List; | @@ -33,8 +32,7 @@ import java.util.List; | ||
| 33 | 32 | ||
| 34 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 33 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 35 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 34 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 36 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList; | ||
| 37 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.findFirst; | 35 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| 38 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.isBetween; | 36 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.isBetween; |
| 39 | import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.SECKILL_ACTIVITY_FAIL_STATUS_CLOSED; | 37 | import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.SECKILL_ACTIVITY_FAIL_STATUS_CLOSED; |
| 40 | 38 | ||
| @@ -56,30 +54,33 @@ public class AppSeckillActivityController { | @@ -56,30 +54,33 @@ public class AppSeckillActivityController { | ||
| 56 | @Operation(summary = "获得当前秒杀活动") // 提供给首页使用 | 54 | @Operation(summary = "获得当前秒杀活动") // 提供给首页使用 |
| 57 | // TODO 芋艿:需要增加 spring cache | 55 | // TODO 芋艿:需要增加 spring cache |
| 58 | public CommonResult<AppSeckillActivityNowRespVO> getNowSeckillActivity() { | 56 | public CommonResult<AppSeckillActivityNowRespVO> getNowSeckillActivity() { |
| 59 | - // 1、获取当前时间处在哪个秒杀阶段 | 57 | + // 1. 获取当前时间处在哪个秒杀阶段 |
| 58 | + // TODO @puhui999:可以考虑在 service 写个方法;这样 controller 不用关注过多逻辑 | ||
| 60 | List<SeckillConfigDO> configList = configService.getSeckillConfigList(); | 59 | List<SeckillConfigDO> configList = configService.getSeckillConfigList(); |
| 61 | SeckillConfigDO filteredConfig = findFirst(configList, config -> ObjectUtil.equal(config.getStatus(), | 60 | SeckillConfigDO filteredConfig = findFirst(configList, config -> ObjectUtil.equal(config.getStatus(), |
| 62 | CommonStatusEnum.ENABLE.getStatus()) && isBetween(config.getStartTime(), config.getEndTime())); | 61 | CommonStatusEnum.ENABLE.getStatus()) && isBetween(config.getStartTime(), config.getEndTime())); |
| 63 | - // 1、1 时段不存在直接返回 null | ||
| 64 | - if (filteredConfig == null) { | 62 | + if (filteredConfig == null) { // 时段不存在直接返回 null |
| 65 | return success(null); | 63 | return success(null); |
| 66 | } | 64 | } |
| 67 | 65 | ||
| 68 | - // 2、查询满足当前阶段的活动 | 66 | + // 2. 查询满足当前阶段的活动 |
| 67 | + // TODO @puhui999:最好直接返回开启的;不多查询数据 | ||
| 69 | List<SeckillActivityDO> activityList = activityService.getSeckillActivityListByConfigIds(Arrays.asList(filteredConfig.getId())); | 68 | List<SeckillActivityDO> activityList = activityService.getSeckillActivityListByConfigIds(Arrays.asList(filteredConfig.getId())); |
| 70 | List<SeckillActivityDO> filteredList = filterList(activityList, item -> ObjectUtil.equal(item.getStatus(), CommonStatusEnum.ENABLE.getStatus())); | 69 | List<SeckillActivityDO> filteredList = filterList(activityList, item -> ObjectUtil.equal(item.getStatus(), CommonStatusEnum.ENABLE.getStatus())); |
| 71 | - // 2、1 获取 spu 信息 | ||
| 72 | - List<ProductSpuRespDTO> spuList = spuApi.getSpuList(CollectionUtils.convertList(filteredList, SeckillActivityDO::getSpuId)); | 70 | + |
| 71 | + // 3. 拼接数据 | ||
| 72 | + List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(filteredList, SeckillActivityDO::getSpuId)); | ||
| 73 | return success(SeckillActivityConvert.INSTANCE.convert(filteredConfig, filteredList, spuList)); | 73 | return success(SeckillActivityConvert.INSTANCE.convert(filteredConfig, filteredList, spuList)); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | @GetMapping("/page") | 76 | @GetMapping("/page") |
| 77 | @Operation(summary = "获得秒杀活动分页") | 77 | @Operation(summary = "获得秒杀活动分页") |
| 78 | public CommonResult<PageResult<AppSeckillActivityRespVO>> getSeckillActivityPage(AppSeckillActivityPageReqVO pageReqVO) { | 78 | public CommonResult<PageResult<AppSeckillActivityRespVO>> getSeckillActivityPage(AppSeckillActivityPageReqVO pageReqVO) { |
| 79 | - // 1、查询满足当前阶段的活动 | 79 | + // 1. 查询满足当前阶段的活动 |
| 80 | PageResult<SeckillActivityDO> pageResult = activityService.getSeckillActivityAppPageByConfigId(pageReqVO); | 80 | PageResult<SeckillActivityDO> pageResult = activityService.getSeckillActivityAppPageByConfigId(pageReqVO); |
| 81 | - // 1、1 获取 spu 信息 | ||
| 82 | - List<ProductSpuRespDTO> spuList = spuApi.getSpuList(CollectionUtils.convertList(pageResult.getList(), SeckillActivityDO::getSpuId)); | 81 | + |
| 82 | + // 2. 拼接数据 | ||
| 83 | + List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(pageResult.getList(), SeckillActivityDO::getSpuId)); | ||
| 83 | return success(SeckillActivityConvert.INSTANCE.convertPage(pageResult, spuList)); | 84 | return success(SeckillActivityConvert.INSTANCE.convertPage(pageResult, spuList)); |
| 84 | } | 85 | } |
| 85 | 86 | ||
| @@ -88,15 +89,15 @@ public class AppSeckillActivityController { | @@ -88,15 +89,15 @@ public class AppSeckillActivityController { | ||
| 88 | @Parameter(name = "id", description = "活动编号", required = true, example = "1024") | 89 | @Parameter(name = "id", description = "活动编号", required = true, example = "1024") |
| 89 | public CommonResult<AppSeckillActivityDetailRespVO> getSeckillActivity(@RequestParam("id") Long id) { | 90 | public CommonResult<AppSeckillActivityDetailRespVO> getSeckillActivity(@RequestParam("id") Long id) { |
| 90 | // 1、获取当前时间处在哪个秒杀阶段 | 91 | // 1、获取当前时间处在哪个秒杀阶段 |
| 92 | + // TODO puhui999:这里,和 58 行是雷同的 | ||
| 91 | List<SeckillConfigDO> configList = configService.getSeckillConfigList(); | 93 | List<SeckillConfigDO> configList = configService.getSeckillConfigList(); |
| 92 | SeckillConfigDO filteredConfig = findFirst(configList, config -> ObjectUtil.equal(config.getStatus(), | 94 | SeckillConfigDO filteredConfig = findFirst(configList, config -> ObjectUtil.equal(config.getStatus(), |
| 93 | CommonStatusEnum.ENABLE.getStatus()) && isBetween(config.getStartTime(), config.getEndTime())); | 95 | CommonStatusEnum.ENABLE.getStatus()) && isBetween(config.getStartTime(), config.getEndTime())); |
| 94 | - // 1、1 时段不存在直接返回 null | ||
| 95 | - if (filteredConfig == null) { | 96 | + if (filteredConfig == null) { // 时段不存在直接返回 null |
| 96 | return success(null); | 97 | return success(null); |
| 97 | } | 98 | } |
| 98 | 99 | ||
| 99 | - // 2、获取活动 | 100 | + // 2. 获取活动 |
| 100 | SeckillActivityDO seckillActivity = activityService.getSeckillActivity(id); | 101 | SeckillActivityDO seckillActivity = activityService.getSeckillActivity(id); |
| 101 | if (seckillActivity == null) { | 102 | if (seckillActivity == null) { |
| 102 | return success(null); | 103 | return success(null); |
| @@ -106,7 +107,7 @@ public class AppSeckillActivityController { | @@ -106,7 +107,7 @@ public class AppSeckillActivityController { | ||
| 106 | throw exception(SECKILL_ACTIVITY_FAIL_STATUS_CLOSED); | 107 | throw exception(SECKILL_ACTIVITY_FAIL_STATUS_CLOSED); |
| 107 | } | 108 | } |
| 108 | 109 | ||
| 109 | - // 3、获取活动商品 | 110 | + // 3. 拼接数据 |
| 110 | List<SeckillProductDO> products = activityService.getSeckillProductListByActivityId(seckillActivity.getId()); | 111 | List<SeckillProductDO> products = activityService.getSeckillProductListByActivityId(seckillActivity.getId()); |
| 111 | return success(SeckillActivityConvert.INSTANCE.convert3(seckillActivity, products, filteredConfig)); | 112 | return success(SeckillActivityConvert.INSTANCE.convert3(seckillActivity, products, filteredConfig)); |
| 112 | } | 113 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillConfigController.java
| @@ -32,19 +32,12 @@ public class AppSeckillConfigController { | @@ -32,19 +32,12 @@ public class AppSeckillConfigController { | ||
| 32 | @Operation(summary = "获得秒杀时间段列表") | 32 | @Operation(summary = "获得秒杀时间段列表") |
| 33 | public CommonResult<List<AppSeckillConfigRespVO>> getSeckillConfigList() { | 33 | public CommonResult<List<AppSeckillConfigRespVO>> getSeckillConfigList() { |
| 34 | List<SeckillConfigDO> list = configService.getSeckillConfigListByStatus(CommonStatusEnum.ENABLE.getStatus()); | 34 | List<SeckillConfigDO> list = configService.getSeckillConfigListByStatus(CommonStatusEnum.ENABLE.getStatus()); |
| 35 | + // TODO @puhui999:如果这种,不用判空也问题不大; | ||
| 35 | if (CollectionUtil.isEmpty(list)) { | 36 | if (CollectionUtil.isEmpty(list)) { |
| 36 | return success(Collections.emptyList()); | 37 | return success(Collections.emptyList()); |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | return success(SeckillConfigConvert.INSTANCE.convertList2(list)); | 40 | return success(SeckillConfigConvert.INSTANCE.convertList2(list)); |
| 40 | - //return success(Arrays.asList( | ||
| 41 | - // new AppSeckillConfigRespVO().setId(1L).setStartTime("00:00").setEndTime("09:59") | ||
| 42 | - // .setSliderPicUrls(Arrays.asList("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg", | ||
| 43 | - // "https://static.iocoder.cn/mall/132.jpeg")), | ||
| 44 | - // new AppSeckillConfigRespVO().setId(2L).setStartTime("10:00").setEndTime("12:59"), | ||
| 45 | - // new AppSeckillConfigRespVO().setId(2L).setStartTime("13:00").setEndTime("22:59"), | ||
| 46 | - // new AppSeckillConfigRespVO().setId(2L).setStartTime("23:00").setEndTime("23:59") | ||
| 47 | - //)); | ||
| 48 | } | 41 | } |
| 49 | 42 | ||
| 50 | } | 43 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/bargain/BargainActivityConvert.java
| @@ -42,9 +42,11 @@ public interface BargainActivityConvert { | @@ -42,9 +42,11 @@ public interface BargainActivityConvert { | ||
| 42 | 42 | ||
| 43 | default PageResult<BargainActivityRespVO> convertPage(PageResult<BargainActivityDO> page, List<ProductSpuRespDTO> spuList) { | 43 | default PageResult<BargainActivityRespVO> convertPage(PageResult<BargainActivityDO> page, List<ProductSpuRespDTO> spuList) { |
| 44 | PageResult<BargainActivityRespVO> result = convertPage(page); | 44 | PageResult<BargainActivityRespVO> result = convertPage(page); |
| 45 | + // 拼接关联属性 | ||
| 45 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); | 46 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 46 | List<BargainActivityRespVO> list = CollectionUtils.convertList(result.getList(), item -> { | 47 | List<BargainActivityRespVO> list = CollectionUtils.convertList(result.getList(), item -> { |
| 47 | findAndThen(spuMap, item.getSpuId(), spu -> { | 48 | findAndThen(spuMap, item.getSpuId(), spu -> { |
| 49 | + // TODO @puhui999:这里可以使用链式哈 | ||
| 48 | item.setPicUrl(spu.getPicUrl()); | 50 | item.setPicUrl(spu.getPicUrl()); |
| 49 | item.setSpuName(spu.getName()); | 51 | item.setSpuName(spu.getName()); |
| 50 | }); | 52 | }); |
| @@ -56,7 +58,7 @@ public interface BargainActivityConvert { | @@ -56,7 +58,7 @@ public interface BargainActivityConvert { | ||
| 56 | 58 | ||
| 57 | AppBargainActivityDetailRespVO convert1(BargainActivityDO bean); | 59 | AppBargainActivityDetailRespVO convert1(BargainActivityDO bean); |
| 58 | 60 | ||
| 59 | - default AppBargainActivityDetailRespVO convert1(BargainActivityDO bean, ProductSpuRespDTO spu) { | 61 | + default AppBargainActivityDetailRespVO convert(BargainActivityDO bean, ProductSpuRespDTO spu) { |
| 60 | AppBargainActivityDetailRespVO detail = convert1(bean); | 62 | AppBargainActivityDetailRespVO detail = convert1(bean); |
| 61 | if (spu != null) { | 63 | if (spu != null) { |
| 62 | detail.setPicUrl(spu.getPicUrl()); | 64 | detail.setPicUrl(spu.getPicUrl()); |
| @@ -70,9 +72,11 @@ public interface BargainActivityConvert { | @@ -70,9 +72,11 @@ public interface BargainActivityConvert { | ||
| 70 | 72 | ||
| 71 | default PageResult<AppBargainActivityRespVO> convertAppPage(PageResult<BargainActivityDO> page, List<ProductSpuRespDTO> spuList) { | 73 | default PageResult<AppBargainActivityRespVO> convertAppPage(PageResult<BargainActivityDO> page, List<ProductSpuRespDTO> spuList) { |
| 72 | PageResult<AppBargainActivityRespVO> result = convertAppPage(page); | 74 | PageResult<AppBargainActivityRespVO> result = convertAppPage(page); |
| 75 | + // 拼接关联属性 | ||
| 73 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); | 76 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 74 | List<AppBargainActivityRespVO> list = CollectionUtils.convertList(result.getList(), item -> { | 77 | List<AppBargainActivityRespVO> list = CollectionUtils.convertList(result.getList(), item -> { |
| 75 | findAndThen(spuMap, item.getSpuId(), spu -> { | 78 | findAndThen(spuMap, item.getSpuId(), spu -> { |
| 79 | + // TODO @puhui999:这里可以使用链式哈 | ||
| 76 | item.setPicUrl(spu.getPicUrl()); | 80 | item.setPicUrl(spu.getPicUrl()); |
| 77 | item.setMarketPrice(spu.getMarketPrice()); | 81 | item.setMarketPrice(spu.getMarketPrice()); |
| 78 | }); | 82 | }); |
| @@ -89,6 +93,7 @@ public interface BargainActivityConvert { | @@ -89,6 +93,7 @@ public interface BargainActivityConvert { | ||
| 89 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); | 93 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 90 | return CollectionUtils.convertList(activityList, item -> { | 94 | return CollectionUtils.convertList(activityList, item -> { |
| 91 | findAndThen(spuMap, item.getSpuId(), spu -> { | 95 | findAndThen(spuMap, item.getSpuId(), spu -> { |
| 96 | + // TODO @puhui999:这里可以使用链式哈 | ||
| 92 | item.setPicUrl(spu.getPicUrl()); | 97 | item.setPicUrl(spu.getPicUrl()); |
| 93 | item.setMarketPrice(spu.getMarketPrice()); | 98 | item.setMarketPrice(spu.getMarketPrice()); |
| 94 | }); | 99 | }); |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java
| @@ -94,8 +94,10 @@ public interface CombinationActivityConvert { | @@ -94,8 +94,10 @@ public interface CombinationActivityConvert { | ||
| 94 | 94 | ||
| 95 | CombinationRecordDO convert(CombinationRecordCreateReqDTO reqDTO); | 95 | CombinationRecordDO convert(CombinationRecordCreateReqDTO reqDTO); |
| 96 | 96 | ||
| 97 | - default CombinationRecordDO convert1(CombinationRecordCreateReqDTO reqDTO, CombinationActivityDO activity, MemberUserRespDTO user, | ||
| 98 | - ProductSpuRespDTO spu, ProductSkuRespDTO sku) { | 97 | + default CombinationRecordDO convert(CombinationRecordCreateReqDTO reqDTO, |
| 98 | + CombinationActivityDO activity, MemberUserRespDTO user, | ||
| 99 | + ProductSpuRespDTO spu, ProductSkuRespDTO sku) { | ||
| 100 | + // TODO @puhui999:搞成链式的 set;这样会更规整一点; | ||
| 99 | CombinationRecordDO record = convert(reqDTO); | 101 | CombinationRecordDO record = convert(reqDTO); |
| 100 | record.setVirtualGroup(false); | 102 | record.setVirtualGroup(false); |
| 101 | record.setExpireTime(record.getStartTime().plusHours(activity.getLimitDuration())); | 103 | record.setExpireTime(record.getStartTime().plusHours(activity.getLimitDuration())); |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java
| @@ -98,6 +98,7 @@ public interface SeckillActivityConvert { | @@ -98,6 +98,7 @@ public interface SeckillActivityConvert { | ||
| 98 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); | 98 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 99 | respVO.setActivities(CollectionUtils.convertList(convertList3(activityList), item -> { | 99 | respVO.setActivities(CollectionUtils.convertList(convertList3(activityList), item -> { |
| 100 | findAndThen(spuMap, item.getSpuId(), spu -> { | 100 | findAndThen(spuMap, item.getSpuId(), spu -> { |
| 101 | + // TODO @puhui999:可以尝试链式 set 哈; | ||
| 101 | item.setPicUrl(spu.getPicUrl()); | 102 | item.setPicUrl(spu.getPicUrl()); |
| 102 | item.setMarketPrice(spu.getMarketPrice()); | 103 | item.setMarketPrice(spu.getMarketPrice()); |
| 103 | item.setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); | 104 | item.setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); |
| @@ -114,6 +115,7 @@ public interface SeckillActivityConvert { | @@ -114,6 +115,7 @@ public interface SeckillActivityConvert { | ||
| 114 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); | 115 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 115 | List<AppSeckillActivityRespVO> list = CollectionUtils.convertList(result.getList(), item -> { | 116 | List<AppSeckillActivityRespVO> list = CollectionUtils.convertList(result.getList(), item -> { |
| 116 | findAndThen(spuMap, item.getSpuId(), spu -> { | 117 | findAndThen(spuMap, item.getSpuId(), spu -> { |
| 118 | + // TODO @puhui999:可以尝试链式 set 哈; | ||
| 117 | item.setPicUrl(spu.getPicUrl()); | 119 | item.setPicUrl(spu.getPicUrl()); |
| 118 | item.setMarketPrice(spu.getMarketPrice()); | 120 | item.setMarketPrice(spu.getMarketPrice()); |
| 119 | item.setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); | 121 | item.setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); |
| @@ -131,6 +133,7 @@ public interface SeckillActivityConvert { | @@ -131,6 +133,7 @@ public interface SeckillActivityConvert { | ||
| 131 | default AppSeckillActivityDetailRespVO convert3(SeckillActivityDO seckillActivity, List<SeckillProductDO> products, SeckillConfigDO filteredConfig) { | 133 | default AppSeckillActivityDetailRespVO convert3(SeckillActivityDO seckillActivity, List<SeckillProductDO> products, SeckillConfigDO filteredConfig) { |
| 132 | AppSeckillActivityDetailRespVO respVO = convert2(seckillActivity); | 134 | AppSeckillActivityDetailRespVO respVO = convert2(seckillActivity); |
| 133 | respVO.setProducts(convertList1(products)); | 135 | respVO.setProducts(convertList1(products)); |
| 136 | + // TODO @puhui999:可以尝试链式 set 哈; | ||
| 134 | respVO.setStartTime(buildTime(filteredConfig.getStartTime())); | 137 | respVO.setStartTime(buildTime(filteredConfig.getStartTime())); |
| 135 | respVO.setEndTime(buildTime(filteredConfig.getEndTime())); | 138 | respVO.setEndTime(buildTime(filteredConfig.getEndTime())); |
| 136 | return respVO; | 139 | return respVO; |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java
| @@ -41,7 +41,7 @@ public interface BargainActivityMapper extends BaseMapperX<BargainActivityDO> { | @@ -41,7 +41,7 @@ public interface BargainActivityMapper extends BaseMapperX<BargainActivityDO> { | ||
| 41 | default int updateActivityStock(Long id, int count) { | 41 | default int updateActivityStock(Long id, int count) { |
| 42 | return update(null, new LambdaUpdateWrapper<BargainActivityDO>() | 42 | return update(null, new LambdaUpdateWrapper<BargainActivityDO>() |
| 43 | .eq(BargainActivityDO::getId, id) | 43 | .eq(BargainActivityDO::getId, id) |
| 44 | - .gt(BargainActivityDO::getStock, count) | 44 | + .ge(BargainActivityDO::getStock, count) |
| 45 | .setSql("stock = stock - " + count)); | 45 | .setSql("stock = stock - " + count)); |
| 46 | } | 46 | } |
| 47 | 47 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java
| @@ -52,6 +52,7 @@ public interface SeckillActivityMapper extends BaseMapperX<SeckillActivityDO> { | @@ -52,6 +52,7 @@ public interface SeckillActivityMapper extends BaseMapperX<SeckillActivityDO> { | ||
| 52 | default PageResult<SeckillActivityDO> selectPage(AppSeckillActivityPageReqVO pageReqVO, Integer status) { | 52 | default PageResult<SeckillActivityDO> selectPage(AppSeckillActivityPageReqVO pageReqVO, Integer status) { |
| 53 | return selectPage(pageReqVO, new LambdaQueryWrapperX<SeckillActivityDO>() | 53 | return selectPage(pageReqVO, new LambdaQueryWrapperX<SeckillActivityDO>() |
| 54 | .eqIfPresent(SeckillActivityDO::getStatus, status) | 54 | .eqIfPresent(SeckillActivityDO::getStatus, status) |
| 55 | + // TODO 芋艿:对 find in set 的想法; | ||
| 55 | .apply(ObjectUtil.isNotNull(pageReqVO.getConfigId()), "FIND_IN_SET(" + pageReqVO.getConfigId() + ",config_ids) > 0")); | 56 | .apply(ObjectUtil.isNotNull(pageReqVO.getConfigId()), "FIND_IN_SET(" + pageReqVO.getConfigId() + ",config_ids) > 0")); |
| 56 | } | 57 | } |
| 57 | 58 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityService.java
| @@ -63,19 +63,22 @@ public interface BargainActivityService { | @@ -63,19 +63,22 @@ public interface BargainActivityService { | ||
| 63 | */ | 63 | */ |
| 64 | PageResult<BargainActivityDO> getBargainActivityPage(BargainActivityPageReqVO pageReqVO); | 64 | PageResult<BargainActivityDO> getBargainActivityPage(BargainActivityPageReqVO pageReqVO); |
| 65 | 65 | ||
| 66 | + // TODO @puhui999:这里可以改成进行中的活动;尽量避免专门为 app 定制,或者类似的名字哈;mapper 那也是 | ||
| 67 | + | ||
| 66 | /** | 68 | /** |
| 67 | * 获取 APP 端活动分页数据 | 69 | * 获取 APP 端活动分页数据 |
| 68 | * | 70 | * |
| 69 | * @param pageReqVO 分页请求 | 71 | * @param pageReqVO 分页请求 |
| 70 | * @return 砍价活动分页 | 72 | * @return 砍价活动分页 |
| 71 | */ | 73 | */ |
| 72 | - PageResult<BargainActivityDO> getBargainActivityAppPage(PageParam pageReqVO); | 74 | + PageResult<BargainActivityDO> getBargainActivityPageForApp(PageParam pageReqVO); |
| 73 | 75 | ||
| 74 | /** | 76 | /** |
| 75 | * 获取 APP 端活动展示数据 | 77 | * 获取 APP 端活动展示数据 |
| 76 | * | 78 | * |
| 77 | * @param count 需要的数量 | 79 | * @param count 需要的数量 |
| 78 | - * @return | 80 | + * @return 砍价活动分页 |
| 79 | */ | 81 | */ |
| 80 | - List<BargainActivityDO> getBargainActivityAppList(Integer count); | 82 | + List<BargainActivityDO> getBargainActivityListForApp(Integer count); |
| 83 | + | ||
| 81 | } | 84 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityServiceImpl.java
| @@ -142,18 +142,20 @@ public class BargainActivityServiceImpl implements BargainActivityService { | @@ -142,18 +142,20 @@ public class BargainActivityServiceImpl implements BargainActivityService { | ||
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | @Override | 144 | @Override |
| 145 | - public PageResult<BargainActivityDO> getBargainActivityAppPage(PageParam pageReqVO) { | 145 | + public PageResult<BargainActivityDO> getBargainActivityPageForApp(PageParam pageReqVO) { |
| 146 | // 只查询进行中,且在时间范围内的 | 146 | // 只查询进行中,且在时间范围内的 |
| 147 | return bargainActivityMapper.selectAppPage(pageReqVO, CommonStatusEnum.ENABLE.getStatus(), LocalDateTime.now()); | 147 | return bargainActivityMapper.selectAppPage(pageReqVO, CommonStatusEnum.ENABLE.getStatus(), LocalDateTime.now()); |
| 148 | - | ||
| 149 | } | 148 | } |
| 150 | 149 | ||
| 151 | @Override | 150 | @Override |
| 152 | - public List<BargainActivityDO> getBargainActivityAppList(Integer count) { | 151 | + public List<BargainActivityDO> getBargainActivityListForApp(Integer count) { |
| 152 | + // TODO @puhui999:这种 default count 的逻辑,可以放到 controller 哈;然后可以使用 ObjectUtils.default 方法 | ||
| 153 | if (count == null) { | 153 | if (count == null) { |
| 154 | count = 6; | 154 | count = 6; |
| 155 | } | 155 | } |
| 156 | - PageResult<BargainActivityDO> result = bargainActivityMapper.selectAppPage(new PageParam().setPageSize(count), CommonStatusEnum.ENABLE.getStatus(), LocalDateTime.now()); | 156 | + // TODO @puhui999:这种不要用 page;会浪费一次 count; |
| 157 | + PageResult<BargainActivityDO> result = bargainActivityMapper.selectAppPage(new PageParam().setPageSize(count), | ||
| 158 | + CommonStatusEnum.ENABLE.getStatus(), LocalDateTime.now()); | ||
| 157 | return result.getList(); | 159 | return result.getList(); |
| 158 | } | 160 | } |
| 159 | 161 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityService.java
| @@ -74,6 +74,7 @@ public interface CombinationActivityService { | @@ -74,6 +74,7 @@ public interface CombinationActivityService { | ||
| 74 | 74 | ||
| 75 | /** | 75 | /** |
| 76 | * 校验是否满足拼团条件 | 76 | * 校验是否满足拼团条件 |
| 77 | + * 如果不满足,会抛出异常 | ||
| 77 | * | 78 | * |
| 78 | * @param activityId 活动编号 | 79 | * @param activityId 活动编号 |
| 79 | * @param userId 用户编号 | 80 | * @param userId 用户编号 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java
| @@ -223,6 +223,7 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic | @@ -223,6 +223,7 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic | ||
| 223 | throw exception(COMBINATION_ACTIVITY_STATUS_DISABLE); | 223 | throw exception(COMBINATION_ACTIVITY_STATUS_DISABLE); |
| 224 | } | 224 | } |
| 225 | // 1.3 校验是否超出单次限购数量 | 225 | // 1.3 校验是否超出单次限购数量 |
| 226 | + // TODO puhui999:count > activity.getSingleLimitCount() 会更好理解点; | ||
| 226 | if (activity.getSingleLimitCount() < count) { | 227 | if (activity.getSingleLimitCount() < count) { |
| 227 | throw exception(COMBINATION_RECORD_FAILED_SINGLE_LIMIT_COUNT_EXCEED); | 228 | throw exception(COMBINATION_RECORD_FAILED_SINGLE_LIMIT_COUNT_EXCEED); |
| 228 | } | 229 | } |
| @@ -242,7 +243,6 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic | @@ -242,7 +243,6 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic | ||
| 242 | if (activity.getTotalLimitCount() < countSum) { | 243 | if (activity.getTotalLimitCount() < countSum) { |
| 243 | throw exception(COMBINATION_RECORD_FAILED_TOTAL_LIMIT_COUNT_EXCEED); | 244 | throw exception(COMBINATION_RECORD_FAILED_TOTAL_LIMIT_COUNT_EXCEED); |
| 244 | } | 245 | } |
| 245 | - | ||
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | } | 248 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java
| @@ -132,7 +132,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { | @@ -132,7 +132,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { | ||
| 132 | MemberUserRespDTO user = memberUserApi.getUser(reqDTO.getUserId()); | 132 | MemberUserRespDTO user = memberUserApi.getUser(reqDTO.getUserId()); |
| 133 | ProductSpuRespDTO spu = productSpuApi.getSpu(reqDTO.getSpuId()); | 133 | ProductSpuRespDTO spu = productSpuApi.getSpu(reqDTO.getSpuId()); |
| 134 | ProductSkuRespDTO sku = productSkuApi.getSku(reqDTO.getSkuId()); | 134 | ProductSkuRespDTO sku = productSkuApi.getSku(reqDTO.getSkuId()); |
| 135 | - recordMapper.insert(CombinationActivityConvert.INSTANCE.convert1(reqDTO, activity, user, spu, sku)); | 135 | + recordMapper.insert(CombinationActivityConvert.INSTANCE.convert(reqDTO, activity, user, spu, sku)); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | @Override | 138 | @Override |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/bo/TradeBeforeOrderCreateReqBO.java
| @@ -14,6 +14,8 @@ import javax.validation.constraints.NotNull; | @@ -14,6 +14,8 @@ import javax.validation.constraints.NotNull; | ||
| 14 | @Data | 14 | @Data |
| 15 | public class TradeBeforeOrderCreateReqBO { | 15 | public class TradeBeforeOrderCreateReqBO { |
| 16 | 16 | ||
| 17 | + // TODO @puhui999:注释也写下哈;bo 还是写注释噢 | ||
| 18 | + | ||
| 17 | @NotNull(message = "订单类型不能为空") | 19 | @NotNull(message = "订单类型不能为空") |
| 18 | private Integer orderType; | 20 | private Integer orderType; |
| 19 | 21 |