Commit 71d6311bd4aa4a547ac7f882c59044031325c6a1
1 parent
54fe0174
code review:拼团、秒杀等逻辑
Showing
15 changed files
with
46 additions
and
124 deletions
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java
| ... | ... | @@ -56,7 +56,6 @@ public interface ErrorCodeConstants { |
| 56 | 56 | ErrorCode SECKILL_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1013008004, "秒杀活动未关闭或未结束,不能删除"); |
| 57 | 57 | ErrorCode SECKILL_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1013008005, "秒杀活动已关闭,不能重复关闭"); |
| 58 | 58 | ErrorCode SECKILL_ACTIVITY_UPDATE_STOCK_FAIL = new ErrorCode(1013008006, "秒杀失败,原因秒杀库存不足"); |
| 59 | - ErrorCode SECKILL_ACTIVITY_APP_STATUS_CLOSED = new ErrorCode(1013008007, "秒杀活动已关闭"); | |
| 60 | 59 | |
| 61 | 60 | // ========== 秒杀时段 1013009000 ========== |
| 62 | 61 | ErrorCode SECKILL_CONFIG_NOT_EXISTS = new ErrorCode(1013009000, "秒杀时段不存在"); |
| ... | ... | @@ -69,7 +68,6 @@ public interface ErrorCodeConstants { |
| 69 | 68 | ErrorCode COMBINATION_ACTIVITY_STATUS_DISABLE_NOT_UPDATE = new ErrorCode(1013010002, "拼团活动已关闭不能修改"); |
| 70 | 69 | ErrorCode COMBINATION_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1013010003, "拼团活动未关闭或未结束,不能删除"); |
| 71 | 70 | ErrorCode COMBINATION_ACTIVITY_STATUS_DISABLE = new ErrorCode(1013010004, "拼团失败,原因:拼团活动已关闭"); |
| 72 | - ErrorCode COMBINATION_ACTIVITY_APP_STATUS_DISABLE = new ErrorCode(1013010005, "拼团活动已关闭"); | |
| 73 | 71 | |
| 74 | 72 | // ========== 拼团记录 1013011000 ========== |
| 75 | 73 | ErrorCode COMBINATION_RECORD_NOT_EXISTS = new ErrorCode(1013011000, "拼团不存在"); | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationActivityController.java
| ... | ... | @@ -24,14 +24,12 @@ import org.springframework.web.bind.annotation.RequestParam; |
| 24 | 24 | import org.springframework.web.bind.annotation.RestController; |
| 25 | 25 | |
| 26 | 26 | import javax.annotation.Resource; |
| 27 | -import java.util.Arrays; | |
| 27 | +import java.util.Collections; | |
| 28 | 28 | import java.util.List; |
| 29 | 29 | |
| 30 | 30 | import static cn.hutool.core.util.ObjectUtil.defaultIfNull; |
| 31 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 32 | 31 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 33 | 32 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
| 34 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.COMBINATION_ACTIVITY_APP_STATUS_DISABLE; | |
| 35 | 33 | |
| 36 | 34 | @Tag(name = "用户 APP - 拼团活动") |
| 37 | 35 | @RestController |
| ... | ... | @@ -44,7 +42,7 @@ public class AppCombinationActivityController { |
| 44 | 42 | @Resource |
| 45 | 43 | private ProductSpuApi spuApi; |
| 46 | 44 | |
| 47 | - | |
| 45 | + // TODO 芋艿:增加 Spring Cache | |
| 48 | 46 | @GetMapping("/list") |
| 49 | 47 | @Operation(summary = "获得拼团活动列表", description = "用于小程序首页") |
| 50 | 48 | @Parameter(name = "count", description = "需要展示的数量", example = "6") |
| ... | ... | @@ -52,11 +50,10 @@ public class AppCombinationActivityController { |
| 52 | 50 | @RequestParam(name = "count", defaultValue = "6") Integer count) { |
| 53 | 51 | List<CombinationActivityDO> list = activityService.getCombinationActivityListByCount(defaultIfNull(count, 6)); |
| 54 | 52 | if (CollUtil.isEmpty(list)) { |
| 55 | - return success(CombinationActivityConvert.INSTANCE.convertAppList(list)); | |
| 53 | + return success(Collections.emptyList()); | |
| 56 | 54 | } |
| 57 | - | |
| 55 | + // 拼接返回 | |
| 58 | 56 | List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(list, CombinationActivityDO::getSpuId)); |
| 59 | - // TODO 芋艿:增加 Spring Cache | |
| 60 | 57 | return success(CombinationActivityConvert.INSTANCE.convertAppList(list, spuList)); |
| 61 | 58 | } |
| 62 | 59 | |
| ... | ... | @@ -67,7 +64,7 @@ public class AppCombinationActivityController { |
| 67 | 64 | if (CollUtil.isEmpty(result.getList())) { |
| 68 | 65 | return success(PageResult.empty(result.getTotal())); |
| 69 | 66 | } |
| 70 | - | |
| 67 | + // 拼接返回 | |
| 71 | 68 | List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(result.getList(), CombinationActivityDO::getSpuId)); |
| 72 | 69 | return success(CombinationActivityConvert.INSTANCE.convertAppPage(result, spuList)); |
| 73 | 70 | } |
| ... | ... | @@ -78,15 +75,12 @@ public class AppCombinationActivityController { |
| 78 | 75 | public CommonResult<AppCombinationActivityDetailRespVO> getCombinationActivityDetail(@RequestParam("id") Long id) { |
| 79 | 76 | // 1、获取活动 |
| 80 | 77 | CombinationActivityDO combinationActivity = activityService.getCombinationActivity(id); |
| 81 | - if (combinationActivity == null) { | |
| 78 | + if (combinationActivity == null | |
| 79 | + || ObjectUtil.equal(combinationActivity.getStatus(), CommonStatusEnum.DISABLE.getStatus())) { | |
| 82 | 80 | return success(null); |
| 83 | 81 | } |
| 84 | - if (ObjectUtil.equal(combinationActivity.getStatus(), CommonStatusEnum.DISABLE.getStatus())) { | |
| 85 | - throw exception(COMBINATION_ACTIVITY_APP_STATUS_DISABLE); | |
| 86 | - } | |
| 87 | - | |
| 88 | 82 | // 2、获取活动商品 |
| 89 | - List<CombinationProductDO> products = activityService.getCombinationProductsByActivityIds(Arrays.asList(combinationActivity.getId())); | |
| 83 | + List<CombinationProductDO> products = activityService.getCombinationProductsByActivityId(combinationActivity.getId()); | |
| 90 | 84 | return success(CombinationActivityConvert.INSTANCE.convert3(combinationActivity, products)); |
| 91 | 85 | } |
| 92 | 86 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.controller.app.seckill; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.hutool.core.util.ObjectUtil; |
| 4 | 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 5 | 6 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| ... | ... | @@ -29,10 +30,8 @@ import org.springframework.web.bind.annotation.RestController; |
| 29 | 30 | import javax.annotation.Resource; |
| 30 | 31 | import java.util.List; |
| 31 | 32 | |
| 32 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 33 | 33 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 34 | 34 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
| 35 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.SECKILL_ACTIVITY_APP_STATUS_CLOSED; | |
| 36 | 35 | |
| 37 | 36 | @Tag(name = "用户 App - 秒杀活动") |
| 38 | 37 | @RestController |
| ... | ... | @@ -48,6 +47,7 @@ public class AppSeckillActivityController { |
| 48 | 47 | @Resource |
| 49 | 48 | private ProductSpuApi spuApi; |
| 50 | 49 | |
| 50 | + // TODO 芋艿:需要增加 spring cache | |
| 51 | 51 | @GetMapping("/get-now") |
| 52 | 52 | @Operation(summary = "获得当前秒杀活动", description = "获取当前正在进行的活动,提供给首页使用") |
| 53 | 53 | public CommonResult<AppSeckillActivityNowRespVO> getNowSeckillActivity() { |
| ... | ... | @@ -61,7 +61,6 @@ public class AppSeckillActivityController { |
| 61 | 61 | List<SeckillActivityDO> activityList = activityService.getSeckillActivityListByConfigIdAndStatus(configList.getId(), CommonStatusEnum.ENABLE.getStatus()); |
| 62 | 62 | // 3 获取 spu 信息 |
| 63 | 63 | List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(activityList, SeckillActivityDO::getSpuId)); |
| 64 | - // TODO 芋艿:需要增加 spring cache | |
| 65 | 64 | return success(SeckillActivityConvert.INSTANCE.convert(configList, activityList, spuList)); |
| 66 | 65 | } |
| 67 | 66 | |
| ... | ... | @@ -70,7 +69,9 @@ public class AppSeckillActivityController { |
| 70 | 69 | public CommonResult<PageResult<AppSeckillActivityRespVO>> getSeckillActivityPage(AppSeckillActivityPageReqVO pageReqVO) { |
| 71 | 70 | // 1. 查询满足当前阶段的活动 |
| 72 | 71 | PageResult<SeckillActivityDO> pageResult = activityService.getSeckillActivityAppPageByConfigId(pageReqVO); |
| 73 | - | |
| 72 | + if (CollUtil.isEmpty(pageResult.getList())) { | |
| 73 | + return success(PageResult.empty(pageResult.getTotal())); | |
| 74 | + } | |
| 74 | 75 | // 2. 拼接数据 |
| 75 | 76 | List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(pageResult.getList(), SeckillActivityDO::getSpuId)); |
| 76 | 77 | return success(SeckillActivityConvert.INSTANCE.convertPage(pageResult, spuList)); |
| ... | ... | @@ -88,16 +89,14 @@ public class AppSeckillActivityController { |
| 88 | 89 | |
| 89 | 90 | // 2. 获取活动 |
| 90 | 91 | SeckillActivityDO seckillActivity = activityService.getSeckillActivity(id); |
| 91 | - if (seckillActivity == null) { | |
| 92 | + if (seckillActivity == null | |
| 93 | + || ObjectUtil.equal(seckillActivity.getStatus(), CommonStatusEnum.DISABLE.getStatus())) { | |
| 92 | 94 | return success(null); |
| 93 | 95 | } |
| 94 | - if (ObjectUtil.equal(seckillActivity.getStatus(), CommonStatusEnum.DISABLE.getStatus())) { | |
| 95 | - throw exception(SECKILL_ACTIVITY_APP_STATUS_CLOSED); | |
| 96 | - } | |
| 97 | 96 | |
| 98 | 97 | // 3. 拼接数据 |
| 99 | - List<SeckillProductDO> products = activityService.getSeckillProductListByActivityId(seckillActivity.getId()); | |
| 100 | - return success(SeckillActivityConvert.INSTANCE.convert3(seckillActivity, products, configList)); | |
| 98 | + List<SeckillProductDO> productList = activityService.getSeckillProductListByActivityId(seckillActivity.getId()); | |
| 99 | + return success(SeckillActivityConvert.INSTANCE.convert3(seckillActivity, productList, configList)); | |
| 101 | 100 | } |
| 102 | 101 | |
| 103 | 102 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillConfigController.java
| ... | ... | @@ -28,7 +28,8 @@ public class AppSeckillConfigController { |
| 28 | 28 | @GetMapping("/list") |
| 29 | 29 | @Operation(summary = "获得秒杀时间段列表") |
| 30 | 30 | public CommonResult<List<AppSeckillConfigRespVO>> getSeckillConfigList() { |
| 31 | - return success(SeckillConfigConvert.INSTANCE.convertList2(configService.getSeckillConfigListByStatus(CommonStatusEnum.ENABLE.getStatus()))); | |
| 31 | + return success(SeckillConfigConvert.INSTANCE.convertList2( | |
| 32 | + configService.getSeckillConfigListByStatus(CommonStatusEnum.ENABLE.getStatus()))); | |
| 32 | 33 | } |
| 33 | 34 | |
| 34 | 35 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/bargain/BargainActivityConvert.java
| ... | ... | @@ -73,9 +73,7 @@ public interface BargainActivityConvert { |
| 73 | 73 | // 拼接关联属性 |
| 74 | 74 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 75 | 75 | List<AppBargainActivityRespVO> list = CollectionUtils.convertList(result.getList(), item -> { |
| 76 | - findAndThen(spuMap, item.getSpuId(), spu -> { | |
| 77 | - item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice()); | |
| 78 | - }); | |
| 76 | + findAndThen(spuMap, item.getSpuId(), spu -> item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); | |
| 79 | 77 | return item; |
| 80 | 78 | }); |
| 81 | 79 | result.setList(list); |
| ... | ... | @@ -88,9 +86,7 @@ public interface BargainActivityConvert { |
| 88 | 86 | List<AppBargainActivityRespVO> activityList = convertAppList(list); |
| 89 | 87 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 90 | 88 | return CollectionUtils.convertList(activityList, item -> { |
| 91 | - findAndThen(spuMap, item.getSpuId(), spu -> { | |
| 92 | - item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice()); | |
| 93 | - }); | |
| 89 | + findAndThen(spuMap, item.getSpuId(), spu -> item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); | |
| 94 | 90 | return item; |
| 95 | 91 | }); |
| 96 | 92 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java
| ... | ... | @@ -61,9 +61,7 @@ public interface CombinationActivityConvert { |
| 61 | 61 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 62 | 62 | PageResult<CombinationActivityRespVO> pageResult = convertPage(page); |
| 63 | 63 | pageResult.getList().forEach(item -> { |
| 64 | - MapUtils.findAndThen(spuMap, item.getSpuId(), spu -> { | |
| 65 | - item.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()); | |
| 66 | - }); | |
| 64 | + MapUtils.findAndThen(spuMap, item.getSpuId(), spu -> item.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl())); | |
| 67 | 65 | item.setProducts(convertList2(productList)); |
| 68 | 66 | }); |
| 69 | 67 | return pageResult; |
| ... | ... | @@ -118,9 +116,7 @@ public interface CombinationActivityConvert { |
| 118 | 116 | List<AppCombinationActivityRespVO> activityList = convertAppList(list); |
| 119 | 117 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 120 | 118 | return CollectionUtils.convertList(activityList, item -> { |
| 121 | - findAndThen(spuMap, item.getSpuId(), spu -> { | |
| 122 | - item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice()); | |
| 123 | - }); | |
| 119 | + findAndThen(spuMap, item.getSpuId(), spu -> item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); | |
| 124 | 120 | return item; |
| 125 | 121 | }); |
| 126 | 122 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java
| ... | ... | @@ -113,11 +113,8 @@ public interface SeckillActivityConvert { |
| 113 | 113 | PageResult<AppSeckillActivityRespVO> result = convertPage1(pageResult); |
| 114 | 114 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 115 | 115 | List<AppSeckillActivityRespVO> list = CollectionUtils.convertList(result.getList(), item -> { |
| 116 | - findAndThen(spuMap, item.getSpuId(), spu -> { | |
| 117 | - item.setPicUrl(spu.getPicUrl()) | |
| 118 | - .setMarketPrice(spu.getMarketPrice()) | |
| 119 | - .setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); | |
| 120 | - }); | |
| 116 | + findAndThen(spuMap, item.getSpuId(), spu -> item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice()) | |
| 117 | + .setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit()))); | |
| 121 | 118 | return item; |
| 122 | 119 | }); |
| 123 | 120 | result.setList(list); |
| ... | ... | @@ -131,6 +128,7 @@ public interface SeckillActivityConvert { |
| 131 | 128 | default AppSeckillActivityDetailRespVO convert3(SeckillActivityDO seckillActivity, List<SeckillProductDO> products, SeckillConfigDO filteredConfig) { |
| 132 | 129 | return convert2(seckillActivity) |
| 133 | 130 | .setProducts(convertList1(products)) |
| 131 | + // TODO @puhui999:要不要在里面 default 一个方法,处理这个事件;简洁一点; | |
| 134 | 132 | .setStartTime(LocalDateTimeUtil.parse(LocalDateTimeUtil.format(seckillActivity.getStartTime(), "yyyy-MM-dd") + " " + filteredConfig.getStartTime(), |
| 135 | 133 | "yyyy-MM-dd HH:mm:ss")) // 活动开始日期和时段结合 |
| 136 | 134 | .setEndTime(LocalDateTimeUtil.parse(LocalDateTimeUtil.format(seckillActivity.getEndTime(), "yyyy-MM-dd") + " " + filteredConfig.getEndTime(), | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationActivityMapper.java
| ... | ... | @@ -29,26 +29,12 @@ public interface CombinationActivityMapper extends BaseMapperX<CombinationActivi |
| 29 | 29 | return selectList(CombinationActivityDO::getStatus, status); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - /** | |
| 33 | - * 查询 status 状态的活动分页 | |
| 34 | - * | |
| 35 | - * @param pageParam 分页参数 | |
| 36 | - * @param status 状态 | |
| 37 | - * @return 活动分页 | |
| 38 | - */ | |
| 39 | 32 | default PageResult<CombinationActivityDO> selectPage(PageParam pageParam, Integer status) { |
| 40 | 33 | return selectPage(pageParam, new LambdaQueryWrapperX<CombinationActivityDO>() |
| 41 | 34 | .eq(CombinationActivityDO::getStatus, status)); |
| 42 | 35 | } |
| 43 | 36 | |
| 44 | - /** | |
| 45 | - * 查询 status 状态的活动分页 | |
| 46 | - * | |
| 47 | - * @param status 状态 | |
| 48 | - * @param count 限制条数 | |
| 49 | - * @return 活动分页 | |
| 50 | - */ | |
| 51 | - default List<CombinationActivityDO> selectList(Integer status, Integer count) { | |
| 37 | + default List<CombinationActivityDO> selectListByStatus(Integer status, Integer count) { | |
| 52 | 38 | return selectList(new LambdaQueryWrapperX<CombinationActivityDO>() |
| 53 | 39 | .eq(CombinationActivityDO::getStatus, status) |
| 54 | 40 | .last("LIMIT " + count)); | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityService.java
| ... | ... | @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationP |
| 10 | 10 | |
| 11 | 11 | import javax.validation.Valid; |
| 12 | 12 | import java.util.Collection; |
| 13 | +import java.util.Collections; | |
| 13 | 14 | import java.util.List; |
| 14 | 15 | |
| 15 | 16 | /** |
| ... | ... | @@ -68,6 +69,16 @@ public interface CombinationActivityService { |
| 68 | 69 | /** |
| 69 | 70 | * 获得拼团活动商品列表 |
| 70 | 71 | * |
| 72 | + * @param activityId 拼团活动 id | |
| 73 | + * @return 拼团活动的商品列表 | |
| 74 | + */ | |
| 75 | + default List<CombinationProductDO> getCombinationProductsByActivityId(Long activityId) { | |
| 76 | + return getCombinationProductsByActivityIds(Collections.singletonList(activityId)); | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 获得拼团活动商品列表 | |
| 81 | + * | |
| 71 | 82 | * @param activityIds 拼团活动 ids |
| 72 | 83 | * @return 拼团活动的商品列表 |
| 73 | 84 | */ | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java
| ... | ... | @@ -247,7 +247,7 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic |
| 247 | 247 | |
| 248 | 248 | @Override |
| 249 | 249 | public List<CombinationActivityDO> getCombinationActivityListByCount(Integer count) { |
| 250 | - return combinationActivityMapper.selectList(CommonStatusEnum.ENABLE.getStatus(), count); | |
| 250 | + return combinationActivityMapper.selectListByStatus(CommonStatusEnum.ENABLE.getStatus(), count); | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | @Override | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/TradeAfterSaleController.java
| ... | ... | @@ -8,11 +8,11 @@ import cn.iocoder.yudao.module.member.api.user.MemberUserApi; |
| 8 | 8 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 9 | 9 | import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO; |
| 10 | 10 | import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.*; |
| 11 | +import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO; | |
| 11 | 12 | import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert; |
| 12 | 13 | import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO; |
| 13 | 14 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; |
| 14 | 15 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; |
| 15 | -import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespVO; | |
| 16 | 16 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service.AfterSaleLogService; |
| 17 | 17 | import cn.iocoder.yudao.module.trade.service.aftersale.TradeAfterSaleService; |
| 18 | 18 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/TradeAfterSaleConvert.java
| ... | ... | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| 6 | 6 | import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO; |
| 7 | 7 | import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleDetailRespVO; |
| 8 | 8 | import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRespPageItemVO; |
| 9 | +import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO; | |
| 9 | 10 | import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO; |
| 10 | 11 | import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO; |
| 11 | 12 | import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderBaseVO; |
| ... | ... | @@ -15,7 +16,6 @@ import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO; |
| 15 | 16 | import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleLogDO; |
| 16 | 17 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; |
| 17 | 18 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; |
| 18 | -import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespVO; | |
| 19 | 19 | import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; |
| 20 | 20 | import org.mapstruct.Mapper; |
| 21 | 21 | import org.mapstruct.Mapping; |
| ... | ... | @@ -68,7 +68,7 @@ public interface TradeAfterSaleConvert { |
| 68 | 68 | PageResult<AppTradeAfterSaleRespVO> convertPage02(PageResult<TradeAfterSaleDO> page); |
| 69 | 69 | |
| 70 | 70 | List<TradeAfterSaleLogRespVO> convertList(List<TradeAfterSaleLogDO> list); |
| 71 | - | |
| 71 | + | |
| 72 | 72 | default TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, TradeOrderDO order, List<TradeOrderItemDO> orderItems, |
| 73 | 73 | MemberUserRespDTO user, List<TradeAfterSaleLogRespVO> logs) { |
| 74 | 74 | TradeAfterSaleDetailRespVO respVO = convert(afterSale, orderItems); |
| ... | ... | @@ -81,7 +81,7 @@ public interface TradeAfterSaleConvert { |
| 81 | 81 | return respVO; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - List<cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO> convertList1(List<TradeAfterSaleLogRespVO> list); | |
| 84 | + List<TradeAfterSaleLogRespVO> convertList1(List<TradeAfterSaleLogRespVO> list); | |
| 85 | 85 | @Mapping(target = "id", source = "afterSale.id") |
| 86 | 86 | TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, List<TradeOrderItemDO> orderItems); |
| 87 | 87 | TradeOrderBaseVO convert(TradeOrderDO order); | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/dto/TradeAfterSaleLogRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.AllArgsConstructor; | |
| 5 | -import lombok.Data; | |
| 6 | -import lombok.NoArgsConstructor; | |
| 7 | - | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 9 | -import java.time.LocalDateTime; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 贸易售后日志详情 DTO | |
| 13 | - * | |
| 14 | - * @author HUIHUI | |
| 15 | - */ | |
| 16 | -@Data | |
| 17 | -@NoArgsConstructor | |
| 18 | -@AllArgsConstructor | |
| 19 | -public class TradeAfterSaleLogRespVO { | |
| 20 | - | |
| 21 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20669") | |
| 22 | - private Long id; | |
| 23 | - | |
| 24 | - @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22634") | |
| 25 | - @NotNull(message = "用户编号不能为空") | |
| 26 | - private Long userId; | |
| 27 | - | |
| 28 | - @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 29 | - @NotNull(message = "用户类型不能为空") | |
| 30 | - private Integer userType; | |
| 31 | - | |
| 32 | - @Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3023") | |
| 33 | - @NotNull(message = "售后编号不能为空") | |
| 34 | - private Long afterSaleId; | |
| 35 | - | |
| 36 | - @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25870") | |
| 37 | - @NotNull(message = "订单编号不能为空") | |
| 38 | - private Long orderId; | |
| 39 | - | |
| 40 | - @Schema(description = "订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23154") | |
| 41 | - @NotNull(message = "订单项编号不能为空") | |
| 42 | - private Long orderItemId; | |
| 43 | - | |
| 44 | - @Schema(description = "售后状态(之前)", example = "2") | |
| 45 | - private Integer beforeStatus; | |
| 46 | - | |
| 47 | - @Schema(description = "售后状态(之后)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 48 | - @NotNull(message = "售后状态(之后)不能为空") | |
| 49 | - private Integer afterStatus; | |
| 50 | - | |
| 51 | - @Schema(description = "操作明细", requiredMode = Schema.RequiredMode.REQUIRED, example = "维权完成,退款金额:¥37776.00") | |
| 52 | - @NotNull(message = "操作明细不能为空") | |
| 53 | - private String content; | |
| 54 | - | |
| 55 | - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 56 | - private LocalDateTime createTime; | |
| 57 | - | |
| 58 | -} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/service/AfterSaleLogService.java
| 1 | 1 | package cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO; | |
| 4 | 5 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO; |
| 5 | -import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespVO; | |
| 6 | 6 | |
| 7 | 7 | import java.util.List; |
| 8 | 8 | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java
| ... | ... | @@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| 11 | 11 | import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleDisagreeReqVO; |
| 12 | 12 | import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSalePageReqVO; |
| 13 | 13 | import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRefuseReqVO; |
| 14 | +import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO; | |
| 14 | 15 | import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleCreateReqVO; |
| 15 | 16 | import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleDeliveryReqVO; |
| 16 | 17 | import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert; |
| ... | ... | @@ -26,7 +27,6 @@ import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleWayEnum; |
| 26 | 27 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum; |
| 27 | 28 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; |
| 28 | 29 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO; |
| 29 | -import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespVO; | |
| 30 | 30 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service.AfterSaleLogService; |
| 31 | 31 | import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; |
| 32 | 32 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; |
| ... | ... | @@ -449,6 +449,7 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa |
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | + // TODO @puhui999:应该返回 do 哈。 | |
| 452 | 453 | @Override |
| 453 | 454 | public List<TradeAfterSaleLogRespVO> getLog(Long afterSaleId) { |
| 454 | 455 | // TODO 不熟悉流程先这么滴 | ... | ... |