Commit 8b480c52ccc3b401fddeed57a06c866da80eefb0
Merge remote-tracking branch 'yudao/feature/mall_product' into feature/mall_product
# Conflicts: # yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java # yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java # yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java
Showing
33 changed files
with
412 additions
and
105 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationActivityController.java
| ... | ... | @@ -5,14 +5,14 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 6 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; |
| 7 | 7 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityCreateReqVO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityPageReqVO; | |
| 10 | -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityRespVO; | |
| 11 | -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityUpdateReqVO; | |
| 8 | +import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.*; | |
| 12 | 9 | import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert; |
| 13 | 10 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; |
| 14 | 11 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; |
| 12 | +import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; | |
| 13 | +import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; | |
| 15 | 14 | import cn.iocoder.yudao.module.promotion.service.combination.CombinationActivityService; |
| 15 | +import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordService; | |
| 16 | 16 | import io.swagger.v3.oas.annotations.Operation; |
| 17 | 17 | import io.swagger.v3.oas.annotations.Parameter; |
| 18 | 18 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -23,6 +23,8 @@ import org.springframework.web.bind.annotation.*; |
| 23 | 23 | import javax.annotation.Resource; |
| 24 | 24 | import javax.validation.Valid; |
| 25 | 25 | import java.util.List; |
| 26 | +import java.util.Map; | |
| 27 | +import java.util.Set; | |
| 26 | 28 | |
| 27 | 29 | import static cn.hutool.core.collection.CollectionUtil.newArrayList; |
| 28 | 30 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| ... | ... | @@ -36,6 +38,8 @@ public class CombinationActivityController { |
| 36 | 38 | |
| 37 | 39 | @Resource |
| 38 | 40 | private CombinationActivityService combinationActivityService; |
| 41 | + @Resource | |
| 42 | + private CombinationRecordService combinationRecordService; | |
| 39 | 43 | |
| 40 | 44 | @Resource |
| 41 | 45 | private ProductSpuApi productSpuApi; |
| ... | ... | @@ -77,7 +81,7 @@ public class CombinationActivityController { |
| 77 | 81 | @GetMapping("/page") |
| 78 | 82 | @Operation(summary = "获得拼团活动分页") |
| 79 | 83 | @PreAuthorize("@ss.hasPermission('promotion:combination-activity:query')") |
| 80 | - public CommonResult<PageResult<CombinationActivityRespVO>> getCombinationActivityPage( | |
| 84 | + public CommonResult<PageResult<CombinationActivityPageItemRespVO>> getCombinationActivityPage( | |
| 81 | 85 | @Valid CombinationActivityPageReqVO pageVO) { |
| 82 | 86 | // 查询拼团活动 |
| 83 | 87 | PageResult<CombinationActivityDO> pageResult = combinationActivityService.getCombinationActivityPage(pageVO); |
| ... | ... | @@ -85,12 +89,21 @@ public class CombinationActivityController { |
| 85 | 89 | return success(PageResult.empty(pageResult.getTotal())); |
| 86 | 90 | } |
| 87 | 91 | |
| 92 | + // 统计数据 | |
| 93 | + Set<Long> activityIds = convertSet(pageResult.getList(), CombinationActivityDO::getId); | |
| 94 | + Map<Long, Integer> groupCountMap = combinationRecordService.getCombinationRecordCountMapByActivity( | |
| 95 | + activityIds, null, CombinationRecordDO.HEAD_ID_GROUP); | |
| 96 | + Map<Long, Integer> groupSuccessCountMap = combinationRecordService.getCombinationRecordCountMapByActivity( | |
| 97 | + activityIds, CombinationRecordStatusEnum.SUCCESS.getStatus(), CombinationRecordDO.HEAD_ID_GROUP); | |
| 98 | + Map<Long, Integer> recordCountMap = combinationRecordService.getCombinationRecordCountMapByActivity( | |
| 99 | + activityIds, null, null); | |
| 88 | 100 | // 拼接数据 |
| 89 | 101 | List<CombinationProductDO> products = combinationActivityService.getCombinationProductsByActivityIds( |
| 90 | 102 | convertSet(pageResult.getList(), CombinationActivityDO::getId)); |
| 91 | 103 | List<ProductSpuRespDTO> spus = productSpuApi.getSpuList( |
| 92 | 104 | convertSet(pageResult.getList(), CombinationActivityDO::getSpuId)); |
| 93 | - return success(CombinationActivityConvert.INSTANCE.convertPage(pageResult, products, spus)); | |
| 105 | + return success(CombinationActivityConvert.INSTANCE.convertPage(pageResult, products, | |
| 106 | + groupCountMap, groupSuccessCountMap, recordCountMap, spus)); | |
| 94 | 107 | } |
| 95 | 108 | |
| 96 | 109 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/activity/CombinationActivityBaseVO.java
| ... | ... | @@ -48,6 +48,9 @@ public class CombinationActivityBaseVO { |
| 48 | 48 | @NotNull(message = "开团人数不能为空") |
| 49 | 49 | private Integer userSize; |
| 50 | 50 | |
| 51 | + @Schema(description = "虚拟成团", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | |
| 52 | + private Boolean virtualGroup = false; // TODO @puhui999:这个字段界面没做呀。 | |
| 53 | + | |
| 51 | 54 | @Schema(description = "限制时长(小时)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| 52 | 55 | @NotNull(message = "限制时长不能为空") |
| 53 | 56 | private Integer limitDuration; | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/activity/CombinationActivityPageItemRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductRespVO; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 拼团活动的分页项 Response VO") | |
| 13 | +@Data | |
| 14 | +@EqualsAndHashCode(callSuper = true) | |
| 15 | +@ToString(callSuper = true) | |
| 16 | +public class CombinationActivityPageItemRespVO extends CombinationActivityBaseVO { | |
| 17 | + | |
| 18 | + @Schema(description = "活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22901") | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 22 | + private LocalDateTime createTime; | |
| 23 | + | |
| 24 | + @Schema(description = "活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 25 | + private Integer status; | |
| 26 | + | |
| 27 | + @Schema(description = "拼团商品", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 28 | + private List<CombinationProductRespVO> products; | |
| 29 | + | |
| 30 | + // ========== 商品字段 ========== | |
| 31 | + | |
| 32 | + @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 name 读取 | |
| 33 | + example = "618大促") | |
| 34 | + private String spuName; | |
| 35 | + @Schema(description = "商品主图", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 picUrl 读取 | |
| 36 | + example = "https://www.iocoder.cn/xx.png") | |
| 37 | + private String picUrl; | |
| 38 | + @Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 marketPrice 读取 | |
| 39 | + example = "50") | |
| 40 | + private Integer marketPrice; | |
| 41 | + | |
| 42 | + // ========== 统计字段 ========== | |
| 43 | + | |
| 44 | + @Schema(description = "开团组数", requiredMode = Schema.RequiredMode.REQUIRED, example = "33") | |
| 45 | + private Integer groupCount; | |
| 46 | + | |
| 47 | + @Schema(description = "成团组数", requiredMode = Schema.RequiredMode.REQUIRED, example = "20") | |
| 48 | + private Integer groupSuccessCount; | |
| 49 | + | |
| 50 | + @Schema(description = "购买次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | |
| 51 | + private Integer recordCount; | |
| 52 | + | |
| 53 | +} | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/activity/CombinationActivityPageReqVO.java
| ... | ... | @@ -15,8 +15,7 @@ public class CombinationActivityPageReqVO extends PageParam { |
| 15 | 15 | @Schema(description = "拼团名称", example = "赵六") |
| 16 | 16 | private String name; |
| 17 | 17 | |
| 18 | - @Schema(description = "活动状态:0开启 1关闭", example = "0") | |
| 18 | + @Schema(description = "活动状态", example = "0") | |
| 19 | 19 | private Integer status; |
| 20 | 20 | |
| 21 | - | |
| 22 | 21 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/activity/CombinationActivityRespVO.java
| ... | ... | @@ -6,8 +6,6 @@ import lombok.Data; |
| 6 | 6 | import lombok.EqualsAndHashCode; |
| 7 | 7 | import lombok.ToString; |
| 8 | 8 | |
| 9 | -import javax.validation.Valid; | |
| 10 | -import javax.validation.constraints.NotNull; | |
| 11 | 9 | import java.time.LocalDateTime; |
| 12 | 10 | import java.util.List; |
| 13 | 11 | |
| ... | ... | @@ -20,30 +18,12 @@ public class CombinationActivityRespVO extends CombinationActivityBaseVO { |
| 20 | 18 | @Schema(description = "活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22901") |
| 21 | 19 | private Long id; |
| 22 | 20 | |
| 23 | - @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "618 大促") | |
| 24 | - private String spuName; | |
| 25 | - | |
| 26 | - @Schema(description = "商品主图", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xx.png") | |
| 27 | - private String picUrl; | |
| 28 | - | |
| 29 | 21 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 30 | 22 | private LocalDateTime createTime; |
| 31 | 23 | |
| 32 | 24 | @Schema(description = "开团人数", requiredMode = Schema.RequiredMode.REQUIRED, example = "666") |
| 33 | 25 | private Integer userSize; |
| 34 | 26 | |
| 35 | - @Schema(description = "开团组数", requiredMode = Schema.RequiredMode.REQUIRED, example = "33") | |
| 36 | - private Integer totalCount; | |
| 37 | - | |
| 38 | - @Schema(description = "成团组数", requiredMode = Schema.RequiredMode.REQUIRED, example = "20") | |
| 39 | - private Integer successCount; | |
| 40 | - | |
| 41 | - @Schema(description = "虚拟成团", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | |
| 42 | - private Integer virtualGroup; | |
| 43 | - | |
| 44 | - @Schema(description = "活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 45 | - private Integer status; | |
| 46 | - | |
| 47 | 27 | @Schema(description = "拼团商品", requiredMode = Schema.RequiredMode.REQUIRED) |
| 48 | 28 | private List<CombinationProductRespVO> products; |
| 49 | 29 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityRespVO.java
| ... | ... | @@ -18,16 +18,6 @@ public class SeckillActivityRespVO extends SeckillActivityBaseVO { |
| 18 | 18 | @Schema(description = "秒杀活动 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 19 | 19 | private Long id; |
| 20 | 20 | |
| 21 | - @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 name 读取 | |
| 22 | - example = "618大促") | |
| 23 | - private String spuName; | |
| 24 | - @Schema(description = "商品主图", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 picUrl 读取 | |
| 25 | - example = "https://www.iocoder.cn/xx.png") | |
| 26 | - private String picUrl; | |
| 27 | - @Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 marketPrice 读取 | |
| 28 | - example = "50") | |
| 29 | - private Integer marketPrice; | |
| 30 | - | |
| 31 | 21 | @Schema(description = "秒杀商品", requiredMode = Schema.RequiredMode.REQUIRED) |
| 32 | 22 | private List<SeckillProductRespVO> products; |
| 33 | 23 | |
| ... | ... | @@ -52,4 +42,16 @@ public class SeckillActivityRespVO extends SeckillActivityBaseVO { |
| 52 | 42 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 53 | 43 | private LocalDateTime createTime; |
| 54 | 44 | |
| 45 | + // ========== 商品字段 ========== | |
| 46 | + | |
| 47 | + @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 name 读取 | |
| 48 | + example = "618大促") | |
| 49 | + private String spuName; | |
| 50 | + @Schema(description = "商品主图", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 picUrl 读取 | |
| 51 | + example = "https://www.iocoder.cn/xx.png") | |
| 52 | + private String picUrl; | |
| 53 | + @Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 marketPrice 读取 | |
| 54 | + example = "50") | |
| 55 | + private Integer marketPrice; | |
| 56 | + | |
| 55 | 57 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainActivityController.java
| ... | ... | @@ -10,7 +10,9 @@ import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity.AppB |
| 10 | 10 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity.AppBargainActivityRespVO; |
| 11 | 11 | import cn.iocoder.yudao.module.promotion.convert.bargain.BargainActivityConvert; |
| 12 | 12 | import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityDO; |
| 13 | +import cn.iocoder.yudao.module.promotion.enums.bargain.BargainRecordStatusEnum; | |
| 13 | 14 | import cn.iocoder.yudao.module.promotion.service.bargain.BargainActivityService; |
| 15 | +import cn.iocoder.yudao.module.promotion.service.bargain.BargainRecordService; | |
| 14 | 16 | import com.google.common.cache.CacheLoader; |
| 15 | 17 | import com.google.common.cache.LoadingCache; |
| 16 | 18 | import io.swagger.v3.oas.annotations.Operation; |
| ... | ... | @@ -53,6 +55,9 @@ public class AppBargainActivityController { |
| 53 | 55 | @Resource |
| 54 | 56 | private BargainActivityService bargainActivityService; |
| 55 | 57 | @Resource |
| 58 | + private BargainRecordService bargainRecordService; | |
| 59 | + | |
| 60 | + @Resource | |
| 56 | 61 | private ProductSpuApi spuApi; |
| 57 | 62 | |
| 58 | 63 | @GetMapping("/list") |
| ... | ... | @@ -94,8 +99,9 @@ public class AppBargainActivityController { |
| 94 | 99 | return success(null); |
| 95 | 100 | } |
| 96 | 101 | // 拼接数据 |
| 102 | + Integer successUserCount = bargainRecordService.getBargainRecordUserCount(id, BargainRecordStatusEnum.SUCCESS.getStatus()); | |
| 97 | 103 | ProductSpuRespDTO spu = spuApi.getSpu(activity.getSpuId()); |
| 98 | - return success(BargainActivityConvert.INSTANCE.convert(activity, spu)); | |
| 104 | + return success(BargainActivityConvert.INSTANCE.convert(activity, successUserCount, spu)); | |
| 99 | 105 | } |
| 100 | 106 | |
| 101 | 107 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainHelpController.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.controller.app.bargain; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | +import cn.iocoder.yudao.module.member.api.user.MemberUserApi; | |
| 6 | +import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | |
| 4 | 7 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBargainHelpCreateReqVO; |
| 5 | 8 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBargainHelpRespVO; |
| 9 | +import cn.iocoder.yudao.module.promotion.convert.bargain.BargainHelpConvert; | |
| 6 | 10 | import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainHelpDO; |
| 7 | 11 | import cn.iocoder.yudao.module.promotion.service.bargain.BargainHelpService; |
| 8 | 12 | import io.swagger.v3.oas.annotations.Operation; |
| 13 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | 14 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 10 | 15 | import org.springframework.validation.annotation.Validated; |
| 11 | 16 | import org.springframework.web.bind.annotation.*; |
| 12 | 17 | |
| 13 | 18 | import javax.annotation.Resource; |
| 14 | -import java.time.LocalDateTime; | |
| 15 | -import java.util.ArrayList; | |
| 19 | +import java.util.Collections; | |
| 16 | 20 | import java.util.List; |
| 21 | +import java.util.Map; | |
| 17 | 22 | |
| 18 | 23 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 24 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 19 | 25 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 20 | 26 | |
| 21 | 27 | @Tag(name = "用户 App - 砍价助力") |
| ... | ... | @@ -27,6 +33,9 @@ public class AppBargainHelpController { |
| 27 | 33 | @Resource |
| 28 | 34 | private BargainHelpService bargainHelpService; |
| 29 | 35 | |
| 36 | + @Resource | |
| 37 | + private MemberUserApi memberUserApi; | |
| 38 | + | |
| 30 | 39 | @PostMapping("/create") |
| 31 | 40 | @Operation(summary = "创建砍价助力", description = "给拼团记录砍一刀") // 返回结果为砍价金额,单位:分 |
| 32 | 41 | public CommonResult<Integer> createBargainHelp(@RequestBody AppBargainHelpCreateReqVO reqVO) { |
| ... | ... | @@ -36,18 +45,18 @@ public class AppBargainHelpController { |
| 36 | 45 | |
| 37 | 46 | @GetMapping("/list") |
| 38 | 47 | @Operation(summary = "获得砍价助力列表") |
| 39 | - // TODO 芋艿:swagger | |
| 48 | + @Parameter(name = "recordId", description = "砍价记录编号", required = true, example = "111") | |
| 40 | 49 | public CommonResult<List<AppBargainHelpRespVO>> getBargainHelpList(@RequestParam("recordId") Long recordId) { |
| 41 | - List<AppBargainHelpRespVO> list = new ArrayList<>(); | |
| 42 | - for (int i = 0; i < 10; i++) { | |
| 43 | - AppBargainHelpRespVO vo = new AppBargainHelpRespVO(); | |
| 44 | - vo.setNickname("用户" + i); | |
| 45 | - vo.setAvatar("https://www.iocoder.cn/avatar/" + i + ".jpg"); | |
| 46 | - vo.setReducePrice((i + 1) * 100); | |
| 47 | - vo.setCreateTime(LocalDateTime.now()); | |
| 48 | - list.add(vo); | |
| 50 | + List<BargainHelpDO> helps = bargainHelpService.getBargainHelpListByRecordId(recordId); | |
| 51 | + if (CollUtil.isEmpty(helps)) { | |
| 52 | + return success(Collections.emptyList()); | |
| 49 | 53 | } |
| 50 | - return success(list); | |
| 54 | + helps.sort((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime())); // 倒序展示 | |
| 55 | + | |
| 56 | + // 拼接数据 | |
| 57 | + Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap( | |
| 58 | + convertSet(helps, BargainHelpDO::getUserId)); | |
| 59 | + return success(BargainHelpConvert.INSTANCE.convertList(helps, userMap)); | |
| 51 | 60 | } |
| 52 | 61 | |
| 53 | 62 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.controller.app.bargain; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.lang.Assert; | |
| 4 | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 6 | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | -import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; | |
| 8 | 8 | import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; |
| 9 | 9 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; |
| 10 | 10 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| ... | ... | @@ -19,16 +19,18 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityD |
| 19 | 19 | import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainRecordDO; |
| 20 | 20 | import cn.iocoder.yudao.module.promotion.enums.bargain.BargainRecordStatusEnum; |
| 21 | 21 | import cn.iocoder.yudao.module.promotion.service.bargain.BargainActivityService; |
| 22 | +import cn.iocoder.yudao.module.promotion.service.bargain.BargainHelpService; | |
| 22 | 23 | import cn.iocoder.yudao.module.promotion.service.bargain.BargainRecordService; |
| 23 | 24 | import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi; |
| 24 | 25 | import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; |
| 25 | 26 | import io.swagger.v3.oas.annotations.Operation; |
| 27 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 28 | +import io.swagger.v3.oas.annotations.Parameters; | |
| 26 | 29 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 27 | 30 | import org.springframework.validation.annotation.Validated; |
| 28 | 31 | import org.springframework.web.bind.annotation.*; |
| 29 | 32 | |
| 30 | 33 | import javax.annotation.Resource; |
| 31 | -import java.time.Duration; | |
| 32 | 34 | import java.util.Collections; |
| 33 | 35 | import java.util.List; |
| 34 | 36 | import java.util.Map; |
| ... | ... | @@ -47,6 +49,8 @@ public class AppBargainRecordController { |
| 47 | 49 | private BargainRecordService bargainRecordService; |
| 48 | 50 | @Resource |
| 49 | 51 | private BargainActivityService bargainActivityService; |
| 52 | + @Resource | |
| 53 | + private BargainHelpService bargainHelpService; | |
| 50 | 54 | |
| 51 | 55 | @Resource |
| 52 | 56 | private MemberUserApi memberUserApi; |
| ... | ... | @@ -78,23 +82,55 @@ public class AppBargainRecordController { |
| 78 | 82 | |
| 79 | 83 | @GetMapping("/get-detail") |
| 80 | 84 | @Operation(summary = "获得砍价记录的明细") |
| 81 | - // TODO 芋艿:swagger;id 和 activityId 二选一 | |
| 85 | + @Parameters({ | |
| 86 | + @Parameter(name = "id", description = "砍价记录编号", example = "111"), // 场景一:查看指定的砍价记录 | |
| 87 | + @Parameter(name = "activityId", description = "砍价活动编号", example = "222") // 场景二:查看指定的砍价活动 | |
| 88 | + }) | |
| 82 | 89 | public CommonResult<AppBargainRecordDetailRespVO> getBargainRecordDetail( |
| 83 | 90 | @RequestParam(value = "id", required = false) Long id, |
| 84 | 91 | @RequestParam(value = "activityId", required = false) Long activityId) { |
| 85 | - AppBargainRecordDetailRespVO detail = new AppBargainRecordDetailRespVO(); | |
| 86 | - detail.setId(1L); | |
| 87 | - detail.setUserId(1L); | |
| 88 | - detail.setSpuId(1L); | |
| 89 | - detail.setSkuId(1L); | |
| 90 | - detail.setPrice(500); | |
| 91 | - detail.setActivityId(1L); | |
| 92 | - detail.setBargainPrice(150); | |
| 93 | - detail.setPrice(200); | |
| 94 | - detail.setPayPrice(180); | |
| 95 | - detail.setStatus(1); | |
| 96 | - detail.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); | |
| 97 | - return success(detail); | |
| 92 | + // 1. 查询砍价记录 + 砍价活动 | |
| 93 | + Assert.isTrue(id != null || activityId != null, "砍价记录编号和活动编号不能同时为空"); | |
| 94 | + BargainRecordDO record = id != null ? bargainRecordService.getBargainRecord(id) | |
| 95 | + : bargainRecordService.getLastBargainRecord(getLoginUserId(), activityId); | |
| 96 | + if (activityId == null || record != null) { | |
| 97 | + activityId = record.getActivityId(); | |
| 98 | + } | |
| 99 | + // 2. 查询助力记录 | |
| 100 | + Long userId = getLoginUserId(); | |
| 101 | + Integer helpAction = getHelpAction(userId, record, activityId); | |
| 102 | + // 3. 如果是自己的订单,则查询订单信息 | |
| 103 | + TradeOrderRespDTO order = record != null && record.getOrderId() != null && record.getUserId().equals(getLoginUserId()) | |
| 104 | + ? tradeOrderApi.getOrder(record.getOrderId()) : null; | |
| 105 | + // TODO 继续查询别的字段 | |
| 106 | + | |
| 107 | + // 拼接返回 | |
| 108 | + return success(BargainRecordConvert.INSTANCE.convert02(record, helpAction, order)); | |
| 109 | + } | |
| 110 | + | |
| 111 | + private Integer getHelpAction(Long userId, BargainRecordDO record, Long activityId) { | |
| 112 | + // 0.1 如果没有活动,无法帮砍 | |
| 113 | + if (activityId == null) { | |
| 114 | + return null; | |
| 115 | + } | |
| 116 | + // 0.2 如果是自己的砍价记录,无法帮砍 | |
| 117 | + if (record != null && record.getUserId().equals(userId)) { | |
| 118 | + return null; | |
| 119 | + } | |
| 120 | + | |
| 121 | + // 1. 判断是否已经助力 | |
| 122 | + if (record != null | |
| 123 | + && bargainHelpService.getBargainHelp(record.getId(), userId) != null) { | |
| 124 | + return AppBargainRecordDetailRespVO.HELP_ACTION_SUCCESS; | |
| 125 | + } | |
| 126 | + // 2. 判断是否满助力 | |
| 127 | + BargainActivityDO activity = bargainActivityService.getBargainActivity(activityId); | |
| 128 | + if (activity != null | |
| 129 | + && bargainHelpService.getBargainHelpCountByActivity(activityId, userId) >= activity.getBargainCount()) { | |
| 130 | + return AppBargainRecordDetailRespVO.HELP_ACTION_FULL; | |
| 131 | + } | |
| 132 | + // 3. 允许助力 | |
| 133 | + return AppBargainRecordDetailRespVO.HELP_ACTION_NONE; | |
| 98 | 134 | } |
| 99 | 135 | |
| 100 | 136 | @GetMapping("/page") | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/activity/AppBargainActivityDetailRespVO.java
| ... | ... | @@ -45,10 +45,13 @@ public class AppBargainActivityDetailRespVO { |
| 45 | 45 | @Schema(description = "商品单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "个") // 从 SPU 的 unit 读取,然后转换 |
| 46 | 46 | private String unitName; |
| 47 | 47 | |
| 48 | + @Schema(description = "砍价起始价格,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "200") | |
| 49 | + private Integer bargainFirstPrice; | |
| 50 | + | |
| 48 | 51 | @Schema(description = "砍价最低金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") |
| 49 | - private Integer bargainPrice; | |
| 52 | + private Integer bargainMinPrice; | |
| 50 | 53 | |
| 51 | 54 | @Schema(description = "砍价成功数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") |
| 52 | - private Integer successCount; | |
| 55 | + private Integer successUserCount; | |
| 53 | 56 | |
| 54 | 57 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/help/AppBargainHelpRespVO.java
| ... | ... | @@ -9,6 +9,9 @@ import java.time.LocalDateTime; |
| 9 | 9 | @Data |
| 10 | 10 | public class AppBargainHelpRespVO { |
| 11 | 11 | |
| 12 | + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 13 | + private Long userId; | |
| 14 | + | |
| 12 | 15 | @Schema(description = "助力用户的昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 13 | 16 | private String nickname; |
| 14 | 17 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordDetailRespVO.java
| ... | ... | @@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record; |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | - | |
| 8 | 6 | @Schema(description = "用户 App - 砍价记录的明细 Response VO") |
| 9 | 7 | @Data |
| 10 | 8 | public class AppBargainRecordDetailRespVO { |
| ... | ... | @@ -13,21 +11,44 @@ public class AppBargainRecordDetailRespVO { |
| 13 | 11 | public static final int HELP_ACTION_FULL = 2; // 帮砍动作 - 未帮砍,无法帮砍(可帮砍次数已满) |
| 14 | 12 | public static final int HELP_ACTION_SUCCESS = 3; // 帮砍动作 - 已帮砍 |
| 15 | 13 | |
| 14 | + // ========== 砍价记录 ========== | |
| 15 | + | |
| 16 | + @Schema(description = "砍价记录编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 16 | 17 | private Long id; |
| 18 | + | |
| 19 | + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "666") | |
| 17 | 20 | private Long userId; |
| 21 | + | |
| 22 | + @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 18 | 23 | private Long spuId; |
| 24 | + @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 19 | 25 | private Long skuId; |
| 26 | + | |
| 27 | + @Schema(description = "活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 20 | 28 | private Long activityId; |
| 29 | + | |
| 30 | + @Schema(description = "砍价起始价格,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "23") | |
| 31 | + private Integer bargainFirstPrice; | |
| 32 | + | |
| 33 | + @Schema(description = "当前砍价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "23") | |
| 21 | 34 | private Integer bargainPrice; |
| 22 | - private Integer price; | |
| 23 | - private Integer payPrice; | |
| 35 | + | |
| 36 | + @Schema(description = "砍价记录状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 24 | 37 | private Integer status; |
| 25 | 38 | |
| 26 | - private LocalDateTime expireTime; | |
| 39 | + // ========== 订单相关 ========== 注意:只有是自己的砍价记录,才会返回,保证隐私性 | |
| 27 | 40 | |
| 41 | + @Schema(description = "订单编号", example = "1024") | |
| 28 | 42 | private Long orderId; |
| 43 | + | |
| 44 | + @Schema(description = "支付状态", example = "true") | |
| 29 | 45 | private Boolean payStatus; |
| 30 | 46 | |
| 47 | + @Schema(description = "支付订单编号", example = "1024") | |
| 48 | + private Long payOrderId; | |
| 49 | + | |
| 50 | + // ========== 助力记录 ========== | |
| 51 | + | |
| 31 | 52 | private Integer helpAction; |
| 32 | 53 | |
| 33 | 54 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/bargain/BargainActivityConvert.java
| ... | ... | @@ -61,12 +61,11 @@ public interface BargainActivityConvert { |
| 61 | 61 | |
| 62 | 62 | AppBargainActivityDetailRespVO convert1(BargainActivityDO bean); |
| 63 | 63 | |
| 64 | - default AppBargainActivityDetailRespVO convert(BargainActivityDO bean, ProductSpuRespDTO spu) { | |
| 65 | - AppBargainActivityDetailRespVO detail = convert1(bean); | |
| 64 | + default AppBargainActivityDetailRespVO convert(BargainActivityDO bean, Integer successUserCount, ProductSpuRespDTO spu) { | |
| 65 | + AppBargainActivityDetailRespVO detail = convert1(bean).setSuccessUserCount(successUserCount); | |
| 66 | 66 | if (spu != null) { |
| 67 | - detail.setPicUrl(spu.getPicUrl()); | |
| 68 | - detail.setMarketPrice(spu.getMarketPrice()); | |
| 69 | - detail.setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); | |
| 67 | + detail.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice()) | |
| 68 | + .setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); | |
| 70 | 69 | } |
| 71 | 70 | return detail; |
| 72 | 71 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/bargain/BargainHelpConvert.java
| ... | ... | @@ -4,10 +4,12 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 5 | 5 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 6 | 6 | import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.help.BargainHelpRespVO; |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBargainHelpRespVO; | |
| 7 | 8 | import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainHelpDO; |
| 8 | 9 | import org.mapstruct.Mapper; |
| 9 | 10 | import org.mapstruct.factory.Mappers; |
| 10 | 11 | |
| 12 | +import java.util.List; | |
| 11 | 13 | import java.util.Map; |
| 12 | 14 | |
| 13 | 15 | /** |
| ... | ... | @@ -31,4 +33,14 @@ public interface BargainHelpConvert { |
| 31 | 33 | } |
| 32 | 34 | PageResult<BargainHelpRespVO> convertPage(PageResult<BargainHelpDO> page); |
| 33 | 35 | |
| 36 | + default List<AppBargainHelpRespVO> convertList(List<BargainHelpDO> helps, | |
| 37 | + Map<Long, MemberUserRespDTO> userMap) { | |
| 38 | + List<AppBargainHelpRespVO> helpVOs = convertList02(helps); | |
| 39 | + helpVOs.forEach(help -> | |
| 40 | + MapUtils.findAndThen(userMap, help.getUserId(), | |
| 41 | + user -> help.setNickname(user.getNickname()).setAvatar(user.getAvatar()))); | |
| 42 | + return helpVOs; | |
| 43 | + } | |
| 44 | + List<AppBargainHelpRespVO> convertList02(List<BargainHelpDO> helps); | |
| 45 | + | |
| 34 | 46 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/bargain/BargainRecordConvert.java
| ... | ... | @@ -6,12 +6,14 @@ import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 6 | 6 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 7 | 7 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; |
| 8 | 8 | import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.recrod.BargainRecordPageItemRespVO; |
| 9 | +import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordDetailRespVO; | |
| 9 | 10 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordRespVO; |
| 10 | 11 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordSummaryRespVO; |
| 11 | 12 | import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityDO; |
| 12 | 13 | import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainRecordDO; |
| 13 | 14 | import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; |
| 14 | 15 | import org.mapstruct.Mapper; |
| 16 | +import org.mapstruct.Mapping; | |
| 15 | 17 | import org.mapstruct.factory.Mappers; |
| 16 | 18 | |
| 17 | 19 | import java.util.List; |
| ... | ... | @@ -82,4 +84,9 @@ public interface BargainRecordConvert { |
| 82 | 84 | return summary; |
| 83 | 85 | } |
| 84 | 86 | |
| 87 | + @Mapping(source = "record.id", target = "id") | |
| 88 | + @Mapping(source = "record.userId", target = "userId") | |
| 89 | + @Mapping(source = "record.status", target = "status") | |
| 90 | + AppBargainRecordDetailRespVO convert02(BargainRecordDO record, Integer helpAction, TradeOrderRespDTO order); | |
| 91 | + | |
| 85 | 92 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java
| ... | ... | @@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO; |
| 8 | 8 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; |
| 9 | 9 | import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; |
| 10 | 10 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityCreateReqVO; |
| 11 | +import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityPageItemRespVO; | |
| 11 | 12 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityRespVO; |
| 12 | 13 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityUpdateReqVO; |
| 13 | 14 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductBaseVO; |
| ... | ... | @@ -54,19 +55,27 @@ public interface CombinationActivityConvert { |
| 54 | 55 | |
| 55 | 56 | List<CombinationActivityRespVO> convertList(List<CombinationActivityDO> list); |
| 56 | 57 | |
| 57 | - PageResult<CombinationActivityRespVO> convertPage(PageResult<CombinationActivityDO> page); | |
| 58 | 58 | |
| 59 | - default PageResult<CombinationActivityRespVO> convertPage(PageResult<CombinationActivityDO> page, | |
| 60 | - List<CombinationProductDO> productList, | |
| 61 | - List<ProductSpuRespDTO> spuList) { | |
| 59 | + default PageResult<CombinationActivityPageItemRespVO> convertPage(PageResult<CombinationActivityDO> page, | |
| 60 | + List<CombinationProductDO> productList, | |
| 61 | + Map<Long, Integer> groupCountMap, | |
| 62 | + Map<Long, Integer> groupSuccessCountMap, | |
| 63 | + Map<Long, Integer> recordCountMap, | |
| 64 | + List<ProductSpuRespDTO> spuList) { | |
| 65 | + PageResult<CombinationActivityPageItemRespVO> pageResult = convertPage(page); | |
| 62 | 66 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 63 | - PageResult<CombinationActivityRespVO> pageResult = convertPage(page); | |
| 64 | 67 | pageResult.getList().forEach(item -> { |
| 65 | - MapUtils.findAndThen(spuMap, item.getSpuId(), spu -> item.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl())); | |
| 68 | + MapUtils.findAndThen(spuMap, item.getSpuId(), spu -> item.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()) | |
| 69 | + .setMarketPrice(spu.getMarketPrice())); | |
| 66 | 70 | item.setProducts(convertList2(productList)); |
| 71 | + // 设置统计字段 | |
| 72 | + item.setGroupCount(groupCountMap.getOrDefault(item.getId(), 0)) | |
| 73 | + .setGroupSuccessCount(groupSuccessCountMap.getOrDefault(item.getId(), 0)) | |
| 74 | + .setRecordCount(recordCountMap.getOrDefault(item.getId(), 0)); | |
| 67 | 75 | }); |
| 68 | 76 | return pageResult; |
| 69 | 77 | } |
| 78 | + PageResult<CombinationActivityPageItemRespVO> convertPage(PageResult<CombinationActivityDO> page); | |
| 70 | 79 | |
| 71 | 80 | List<CombinationProductRespVO> convertList2(List<CombinationProductDO> productDOs); |
| 72 | 81 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/combination/CombinationActivityDO.java
| ... | ... | @@ -60,21 +60,9 @@ public class CombinationActivityDO extends BaseDO { |
| 60 | 60 | */ |
| 61 | 61 | private Integer userSize; |
| 62 | 62 | /** |
| 63 | - * 开团组数 | |
| 64 | - */ | |
| 65 | - private Integer totalCount; | |
| 66 | - /** | |
| 67 | - * 成团组数 | |
| 68 | - */ | |
| 69 | - private Integer successCount; | |
| 70 | - /** | |
| 71 | - * 参与人数 | |
| 72 | - */ | |
| 73 | - private Integer orderUserCount; | |
| 74 | - /** | |
| 75 | 63 | * 虚拟成团 |
| 76 | 64 | */ |
| 77 | - private Integer virtualGroup; | |
| 65 | + private Boolean virtualGroup; | |
| 78 | 66 | /** |
| 79 | 67 | * 活动状态 |
| 80 | 68 | * | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/combination/CombinationRecordDO.java
| ... | ... | @@ -29,6 +29,11 @@ import java.time.LocalDateTime; |
| 29 | 29 | public class CombinationRecordDO extends BaseDO { |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | + * 团长编号 - 团长 | |
| 33 | + */ | |
| 34 | + public static final Integer HEAD_ID_GROUP = 0; | |
| 35 | + | |
| 36 | + /** | |
| 32 | 37 | * 编号,主键自增 |
| 33 | 38 | */ |
| 34 | 39 | @TableId |
| ... | ... | @@ -84,6 +89,8 @@ public class CombinationRecordDO extends BaseDO { |
| 84 | 89 | * 团长编号 |
| 85 | 90 | * |
| 86 | 91 | * 关联 {@link CombinationRecordDO#getId()} |
| 92 | + * | |
| 93 | + * 如果是团长,则它的值是 {@link #HEAD_ID_GROUP} | |
| 87 | 94 | */ |
| 88 | 95 | private Long headId; |
| 89 | 96 | /** | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainHelpMapper.java
| ... | ... | @@ -72,4 +72,9 @@ public interface BargainHelpMapper extends BaseMapperX<BargainHelpDO> { |
| 72 | 72 | .orderByDesc(BargainHelpDO::getId)); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | + default List<BargainHelpDO> selectListByRecordId(Long recordId) { | |
| 76 | + return selectList(new LambdaQueryWrapperX<BargainHelpDO>() | |
| 77 | + .eq(BargainHelpDO::getRecordId, recordId)); | |
| 78 | + } | |
| 79 | + | |
| 75 | 80 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainRecordMapper.java
| ... | ... | @@ -15,6 +15,7 @@ import org.apache.ibatis.annotations.Mapper; |
| 15 | 15 | import org.apache.ibatis.annotations.Param; |
| 16 | 16 | import org.apache.ibatis.annotations.Select; |
| 17 | 17 | |
| 18 | +import java.time.LocalDateTime; | |
| 18 | 19 | import java.util.Collection; |
| 19 | 20 | import java.util.Collections; |
| 20 | 21 | import java.util.List; |
| ... | ... | @@ -41,6 +42,14 @@ public interface BargainRecordMapper extends BaseMapperX<BargainRecordDO> { |
| 41 | 42 | .eq(BargainRecordDO::getStatus, status)); |
| 42 | 43 | } |
| 43 | 44 | |
| 45 | + default BargainRecordDO selectLastByUserIdAndActivityId(Long userId, Long activityId) { | |
| 46 | + return selectOne(new LambdaQueryWrapper<>(BargainRecordDO.class) | |
| 47 | + .eq(BargainRecordDO::getUserId, userId) | |
| 48 | + .eq(BargainRecordDO::getActivityId, activityId) | |
| 49 | + .orderByDesc(BargainRecordDO::getId) | |
| 50 | + .last("LIMIT 1")); | |
| 51 | + } | |
| 52 | + | |
| 44 | 53 | default Long selectCountByUserIdAndActivityIdAndStatus( |
| 45 | 54 | Long userId, Long activityId, Integer status) { |
| 46 | 55 | return selectCount(new LambdaQueryWrapper<>(BargainRecordDO.class) |
| ... | ... | @@ -71,9 +80,16 @@ public interface BargainRecordMapper extends BaseMapperX<BargainRecordDO> { |
| 71 | 80 | record -> MapUtil.getInt(record, "userCount" )); |
| 72 | 81 | } |
| 73 | 82 | |
| 74 | - @Select("SELECT COUNT(DISTINCT(user_id)) FROM promotion_bargain_record WHERE status = #{status}") | |
| 83 | + @Select("SELECT COUNT(DISTINCT(user_id)) FROM promotion_bargain_record " + | |
| 84 | + "WHERE status = #{status}") | |
| 75 | 85 | Integer selectUserCountByStatus(@Param("status") Integer status); |
| 76 | 86 | |
| 87 | + @Select("SELECT COUNT(DISTINCT(user_id)) FROM promotion_bargain_record " + | |
| 88 | + "WHERE activity_id = #{activityId} " + | |
| 89 | + "AND status = #{status}") | |
| 90 | + Integer selectUserCountByActivityIdAndStatus(@Param("activityId") Long activityId, | |
| 91 | + @Param("status") Integer status); | |
| 92 | + | |
| 77 | 93 | default PageResult<BargainRecordDO> selectPage(BargainRecordPageReqVO reqVO) { |
| 78 | 94 | return selectPage(reqVO, new LambdaQueryWrapperX<BargainRecordDO>() |
| 79 | 95 | .eqIfPresent(BargainRecordDO::getStatus, reqVO.getStatus()) |
| ... | ... | @@ -101,7 +117,7 @@ public interface BargainRecordMapper extends BaseMapperX<BargainRecordDO> { |
| 101 | 117 | * @return 更新数量 |
| 102 | 118 | */ |
| 103 | 119 | default int updateOrderIdById(Long id, Long orderId) { |
| 104 | - return update(new BargainRecordDO().setOrderId(orderId), | |
| 120 | + return update(new BargainRecordDO().setOrderId(orderId).setEndTime(LocalDateTime.now()), | |
| 105 | 121 | new LambdaQueryWrapper<>(BargainRecordDO.class) |
| 106 | 122 | .eq(BargainRecordDO::getId, id) |
| 107 | 123 | .isNull(BargainRecordDO::getOrderId)); | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.dal.mysql.combination; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.hutool.core.map.MapUtil; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 3 | 6 | import cn.hutool.core.util.ObjectUtil; |
| 4 | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 8 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | 9 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 7 | 10 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO; |
| 8 | 11 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; |
| 12 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 9 | 13 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 14 | |
| 11 | 15 | import java.time.LocalDateTime; |
| 12 | 16 | import java.time.LocalTime; |
| 17 | +import java.util.Collection; | |
| 18 | +import java.util.Collections; | |
| 13 | 19 | import java.util.List; |
| 20 | +import java.util.Map; | |
| 14 | 21 | |
| 15 | 22 | /** |
| 16 | 23 | * 拼团记录 Mapper |
| ... | ... | @@ -95,6 +102,24 @@ public interface CombinationRecordMapper extends BaseMapperX<CombinationRecordDO |
| 95 | 102 | .last("LIMIT " + count)); |
| 96 | 103 | } |
| 97 | 104 | |
| 105 | + default Map<Long, Integer> selectCombinationRecordCountMapByActivityIdAndStatusAndHeadId(Collection<Long> activityIds, | |
| 106 | + Integer status, Integer headId) { | |
| 107 | + // SQL count 查询 | |
| 108 | + List<Map<String, Object>> result = selectMaps(new QueryWrapper<CombinationRecordDO>() | |
| 109 | + .select("COUNT(DISTINCT(user_id)) AS recordCount, activity_id AS activityId") | |
| 110 | + .in("activity_id", activityIds) | |
| 111 | + .eq(status != null, "status", status) | |
| 112 | + .eq(headId != null, "head_id", headId) | |
| 113 | + .groupBy("activity_id")); | |
| 114 | + if (CollUtil.isEmpty(result)) { | |
| 115 | + return Collections.emptyMap(); | |
| 116 | + } | |
| 117 | + // 转换数据 | |
| 118 | + return CollectionUtils.convertMap(result, | |
| 119 | + record -> MapUtil.getLong(record, "activityId"), | |
| 120 | + record -> MapUtil.getInt(record, "recordCount" )); | |
| 121 | + } | |
| 122 | + | |
| 98 | 123 | static LocalDateTime[] builderQueryTime(Integer dateType) { |
| 99 | 124 | LocalDateTime now = LocalDateTime.now(); |
| 100 | 125 | LocalDateTime[] createTime = null; // 全部时间段 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainHelpService.java
| ... | ... | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBarga |
| 6 | 6 | import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainHelpDO; |
| 7 | 7 | |
| 8 | 8 | import java.util.Collection; |
| 9 | +import java.util.List; | |
| 9 | 10 | import java.util.Map; |
| 10 | 11 | |
| 11 | 12 | /** |
| ... | ... | @@ -41,6 +42,15 @@ public interface BargainHelpService { |
| 41 | 42 | Map<Long, Integer> getBargainHelpUserCountMapByRecord(Collection<Long> recordIds); |
| 42 | 43 | |
| 43 | 44 | /** |
| 45 | + * 【砍价活动】获得用户的助力次数 | |
| 46 | + * | |
| 47 | + * @param activityId 活动编号 | |
| 48 | + * @param userId 用户编号 | |
| 49 | + * @return 助力次数 | |
| 50 | + */ | |
| 51 | + Long getBargainHelpCountByActivity(Long activityId, Long userId); | |
| 52 | + | |
| 53 | + /** | |
| 44 | 54 | * 获得砍价助力分页 |
| 45 | 55 | * |
| 46 | 56 | * @param pageReqVO 分页查询 |
| ... | ... | @@ -48,4 +58,21 @@ public interface BargainHelpService { |
| 48 | 58 | */ |
| 49 | 59 | PageResult<BargainHelpDO> getBargainHelpPage(BargainHelpPageReqVO pageReqVO); |
| 50 | 60 | |
| 61 | + /** | |
| 62 | + * 获得指定砍价记录编号,对应的砍价助力列表 | |
| 63 | + * | |
| 64 | + * @param recordId 砍价记录编号 | |
| 65 | + * @return 砍价助力列表 | |
| 66 | + */ | |
| 67 | + List<BargainHelpDO> getBargainHelpListByRecordId(Long recordId); | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * 获得助力记录 | |
| 71 | + * | |
| 72 | + * @param recordId 砍价记录编号 | |
| 73 | + * @param userId 用户编号 | |
| 74 | + * @return 助力记录 | |
| 75 | + */ | |
| 76 | + BargainHelpDO getBargainHelp(Long recordId, Long userId); | |
| 77 | + | |
| 51 | 78 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainHelpServiceImpl.java
| ... | ... | @@ -18,6 +18,7 @@ import org.springframework.validation.annotation.Validated; |
| 18 | 18 | import javax.annotation.Resource; |
| 19 | 19 | |
| 20 | 20 | import java.util.Collection; |
| 21 | +import java.util.List; | |
| 21 | 22 | import java.util.Map; |
| 22 | 23 | |
| 23 | 24 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| ... | ... | @@ -115,8 +116,23 @@ public class BargainHelpServiceImpl implements BargainHelpService { |
| 115 | 116 | } |
| 116 | 117 | |
| 117 | 118 | @Override |
| 119 | + public Long getBargainHelpCountByActivity(Long activityId, Long userId) { | |
| 120 | + return bargainHelpMapper.selectCountByUserIdAndActivityId(userId, activityId); | |
| 121 | + } | |
| 122 | + | |
| 123 | + @Override | |
| 118 | 124 | public PageResult<BargainHelpDO> getBargainHelpPage(BargainHelpPageReqVO pageReqVO) { |
| 119 | 125 | return bargainHelpMapper.selectPage(pageReqVO); |
| 120 | 126 | } |
| 121 | 127 | |
| 128 | + @Override | |
| 129 | + public List<BargainHelpDO> getBargainHelpListByRecordId(Long recordId) { | |
| 130 | + return bargainHelpMapper.selectListByRecordId(recordId); | |
| 131 | + } | |
| 132 | + | |
| 133 | + @Override | |
| 134 | + public BargainHelpDO getBargainHelp(Long recordId, Long userId) { | |
| 135 | + return bargainHelpMapper.selectByUserIdAndRecordId(userId, recordId); | |
| 136 | + } | |
| 137 | + | |
| 122 | 138 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainRecordService.java
| ... | ... | @@ -74,6 +74,15 @@ public interface BargainRecordService { |
| 74 | 74 | BargainRecordDO getBargainRecord(Long id); |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | + * 获得用户在当前砍价活动中的最后一条砍价记录 | |
| 78 | + * | |
| 79 | + * @param userId 用户编号 | |
| 80 | + * @param activityId 砍价记录编号 | |
| 81 | + * @return 砍价记录 | |
| 82 | + */ | |
| 83 | + BargainRecordDO getLastBargainRecord(Long userId, Long activityId); | |
| 84 | + | |
| 85 | + /** | |
| 77 | 86 | * 获得砍价人数 Map |
| 78 | 87 | * |
| 79 | 88 | * @param activityIds 活动编号 |
| ... | ... | @@ -83,7 +92,7 @@ public interface BargainRecordService { |
| 83 | 92 | Map<Long, Integer> getBargainRecordUserCountMap(Collection<Long> activityIds, @Nullable Integer status); |
| 84 | 93 | |
| 85 | 94 | /** |
| 86 | - * 获得砍价人数 Map | |
| 95 | + * 获得砍价人数 | |
| 87 | 96 | * |
| 88 | 97 | * @param status 砍价记录状态 |
| 89 | 98 | * @return 砍价人数 |
| ... | ... | @@ -91,6 +100,15 @@ public interface BargainRecordService { |
| 91 | 100 | Integer getBargainRecordUserCount(Integer status); |
| 92 | 101 | |
| 93 | 102 | /** |
| 103 | + * 获得砍价人数 | |
| 104 | + * | |
| 105 | + * @param activityId 砍价活动编号 | |
| 106 | + * @param status 砍价记录状态 | |
| 107 | + * @return 砍价人数 | |
| 108 | + */ | |
| 109 | + Integer getBargainRecordUserCount(Long activityId, Integer status); | |
| 110 | + | |
| 111 | + /** | |
| 94 | 112 | * 【管理员】获得砍价记录分页 |
| 95 | 113 | * |
| 96 | 114 | * @param pageReqVO 分页查询 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainRecordServiceImpl.java
| ... | ... | @@ -115,6 +115,11 @@ public class BargainRecordServiceImpl implements BargainRecordService { |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | @Override |
| 118 | + public BargainRecordDO getLastBargainRecord(Long userId, Long activityId) { | |
| 119 | + return bargainRecordMapper.selectLastByUserIdAndActivityId(userId, activityId); | |
| 120 | + } | |
| 121 | + | |
| 122 | + @Override | |
| 118 | 123 | public Map<Long, Integer> getBargainRecordUserCountMap(Collection<Long> activityIds, @Nullable Integer status) { |
| 119 | 124 | return bargainRecordMapper.selectUserCountByActivityIdsAndStatus(activityIds, status); |
| 120 | 125 | } |
| ... | ... | @@ -125,6 +130,11 @@ public class BargainRecordServiceImpl implements BargainRecordService { |
| 125 | 130 | } |
| 126 | 131 | |
| 127 | 132 | @Override |
| 133 | + public Integer getBargainRecordUserCount(Long activityId, Integer status) { | |
| 134 | + return bargainRecordMapper.selectUserCountByActivityIdAndStatus(activityId, status); | |
| 135 | + } | |
| 136 | + | |
| 137 | + @Override | |
| 128 | 138 | public PageResult<BargainRecordDO> getBargainRecordPage(BargainRecordPageReqVO pageReqVO) { |
| 129 | 139 | return bargainRecordMapper.selectPage(pageReqVO); |
| 130 | 140 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityService.java
| ... | ... | @@ -101,7 +101,7 @@ public interface CombinationActivityService { |
| 101 | 101 | PageResult<CombinationActivityDO> getCombinationActivityPage(PageParam pageParam); |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | - * 获取指定活动指定 sku 编号的商品 | |
| 104 | + * 获取指定活动、指定 sku 编号的商品 | |
| 105 | 105 | * |
| 106 | 106 | * @param activityId 活动编号 |
| 107 | 107 | * @param skuId sku 编号 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java
| ... | ... | @@ -65,13 +65,11 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic |
| 65 | 65 | |
| 66 | 66 | // 插入拼团活动 |
| 67 | 67 | CombinationActivityDO activity = CombinationActivityConvert.INSTANCE.convert(createReqVO) |
| 68 | - .setStatus(CommonStatusEnum.ENABLE.getStatus()) | |
| 69 | - .setTotalCount(0).setSuccessCount(0).setOrderUserCount(0).setVirtualGroup(0); | |
| 68 | + .setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 70 | 69 | combinationActivityMapper.insert(activity); |
| 71 | 70 | // 插入商品 |
| 72 | 71 | List<CombinationProductDO> products = CombinationActivityConvert.INSTANCE.convertList(createReqVO.getProducts(), activity); |
| 73 | 72 | combinationProductMapper.insertBatch(products); |
| 74 | - // 返回 | |
| 75 | 73 | return activity.getId(); |
| 76 | 74 | } |
| 77 | 75 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java
| ... | ... | @@ -9,9 +9,13 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationA |
| 9 | 9 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; |
| 10 | 10 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; |
| 11 | 11 | |
| 12 | +import javax.annotation.Nullable; | |
| 12 | 13 | import java.time.LocalDateTime; |
| 14 | +import java.util.Collection; | |
| 13 | 15 | import java.util.List; |
| 16 | +import java.util.Map; | |
| 14 | 17 | |
| 18 | +// todo @PUHUI:方法名,还是带下 Combination 哈 | |
| 15 | 19 | /** |
| 16 | 20 | * 拼团记录 Service 接口 |
| 17 | 21 | * |
| ... | ... | @@ -159,4 +163,16 @@ public interface CombinationRecordService { |
| 159 | 163 | */ |
| 160 | 164 | PageResult<CombinationRecordDO> getBargainRecordPage(CombinationRecordReqPageVO pageVO); |
| 161 | 165 | |
| 166 | + /** | |
| 167 | + * 【拼团活动】获得拼团记录数量 Map | |
| 168 | + * | |
| 169 | + * @param activityIds 活动记录编号数组 | |
| 170 | + * @param status 拼团状态,允许空 | |
| 171 | + * @param headId 团长编号,允许空。目的 headId 设置为 {@link CombinationRecordDO#HEAD_ID_GROUP} 时,可以设置 | |
| 172 | + * @return 拼团记录数量 Map | |
| 173 | + */ | |
| 174 | + Map<Long, Integer> getCombinationRecordCountMapByActivity(Collection<Long> activityIds, | |
| 175 | + @Nullable Integer status, | |
| 176 | + @Nullable Integer headId); | |
| 177 | + | |
| 162 | 178 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java
| ... | ... | @@ -27,9 +27,12 @@ import org.springframework.stereotype.Service; |
| 27 | 27 | import org.springframework.transaction.annotation.Transactional; |
| 28 | 28 | import org.springframework.validation.annotation.Validated; |
| 29 | 29 | |
| 30 | +import javax.annotation.Nullable; | |
| 30 | 31 | import javax.annotation.Resource; |
| 31 | 32 | import java.time.LocalDateTime; |
| 33 | +import java.util.Collection; | |
| 32 | 34 | import java.util.List; |
| 35 | +import java.util.Map; | |
| 33 | 36 | |
| 34 | 37 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 35 | 38 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| ... | ... | @@ -205,6 +208,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { |
| 205 | 208 | |
| 206 | 209 | @Override |
| 207 | 210 | public CombinationRecordDO getCombinationRecord(Long userId, Long orderId) { |
| 211 | + // TODO puhui999:这里直接获得,不适合调用校验的接口; | |
| 208 | 212 | return validateCombinationRecord(userId, orderId); |
| 209 | 213 | } |
| 210 | 214 | |
| ... | ... | @@ -267,4 +271,10 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { |
| 267 | 271 | return recordMapper.selectPage(pageVO); |
| 268 | 272 | } |
| 269 | 273 | |
| 274 | + @Override | |
| 275 | + public Map<Long, Integer> getCombinationRecordCountMapByActivity(Collection<Long> activityIds, | |
| 276 | + @Nullable Integer status, @Nullable Integer headId) { | |
| 277 | + return recordMapper.selectCombinationRecordCountMapByActivityIdAndStatusAndHeadId(activityIds, status, headId); | |
| 278 | + } | |
| 279 | + | |
| 270 | 280 | } | ... | ... |
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApi.java
| ... | ... | @@ -22,6 +22,14 @@ public interface TradeOrderApi { |
| 22 | 22 | */ |
| 23 | 23 | List<TradeOrderRespDTO> getOrderList(Collection<Long> ids); |
| 24 | 24 | |
| 25 | + /** | |
| 26 | + * 获得订单 | |
| 27 | + * | |
| 28 | + * @param id 订单编号 | |
| 29 | + * @return 订单 | |
| 30 | + */ | |
| 31 | + TradeOrderRespDTO getOrder(Long id); | |
| 32 | + | |
| 25 | 33 | // TODO 芋艿:看看是不是可以删除掉; |
| 26 | 34 | /** |
| 27 | 35 | * 获取订单状态 | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApiImpl.java
| ... | ... | @@ -35,6 +35,11 @@ public class TradeOrderApiImpl implements TradeOrderApi { |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | @Override |
| 38 | + public TradeOrderRespDTO getOrder(Long id) { | |
| 39 | + return TradeOrderConvert.INSTANCE.convert(tradeOrderQueryService.getOrder(id)); | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 38 | 43 | public Integer getOrderStatus(Long id) { |
| 39 | 44 | TradeOrderDO order = tradeOrderQueryService.getOrder(id); |
| 40 | 45 | if (order == null) { | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java
| ... | ... | @@ -39,6 +39,7 @@ import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateRespBO; |
| 39 | 39 | import org.mapstruct.Mapper; |
| 40 | 40 | import org.mapstruct.Mapping; |
| 41 | 41 | import org.mapstruct.Mappings; |
| 42 | +import org.mapstruct.Named; | |
| 42 | 43 | import org.mapstruct.factory.Mappers; |
| 43 | 44 | |
| 44 | 45 | import java.util.ArrayList; |
| ... | ... | @@ -262,6 +263,7 @@ public interface TradeOrderConvert { |
| 262 | 263 | return bo; |
| 263 | 264 | } |
| 264 | 265 | |
| 266 | + @Named("convertList04") | |
| 265 | 267 | List<TradeOrderRespDTO> convertList04(List<TradeOrderDO> list); |
| 266 | 268 | |
| 267 | 269 | @Mappings({ | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeCombinationActivityPriceCalculator.java