From 5a5f92d2e9e158665f99a46735c9aef532a7a065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=AE=E6=A2=A6?= Date: Mon, 25 Sep 2023 15:51:48 +0800 Subject: [PATCH 01/13] =?UTF-8?q?feat:=20=E6=B5=8B=E8=AF=95=E7=AB=99?= =?UTF-8?q?=E5=86=85=E4=BF=A1=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0Member=20?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=B1=BB=E5=9E=8B=E7=9A=84=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/notify/NotifyTemplateController.java | 11 ++++++++--- .../notify/vo/template/NotifyTemplateSendReqVO.java | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java index 0299836d7..b5152e25b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.notify; +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.*; @@ -76,8 +77,12 @@ public class NotifyTemplateController { @Operation(summary = "发送站内信") @PreAuthorize("@ss.hasPermission('system:notify-template:send-notify')") public CommonResult sendNotify(@Valid @RequestBody NotifyTemplateSendReqVO sendReqVO) { - return success(notifySendService.sendSingleNotifyToAdmin(sendReqVO.getUserId(), - sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams())); + if (UserTypeEnum.MEMBER.getValue().equals(sendReqVO.getUserType())) { + return success(notifySendService.sendSingleNotifyToMember(sendReqVO.getUserId(), + sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams())); + } else { + return success(notifySendService.sendSingleNotifyToAdmin(sendReqVO.getUserId(), + sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams())); + } } - } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateSendReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateSendReqVO.java index d04c609f5..6a47e8ba9 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateSendReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateSendReqVO.java @@ -15,6 +15,10 @@ public class NotifyTemplateSendReqVO { @NotNull(message = "用户id不能为空") private Long userId; + @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "用户类型不能为空") + private Integer userType; + @Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "01") @NotEmpty(message = "模板编码不能为空") private String templateCode; From a4613f0af9eaedaba79e9b22e17ca3b6ca91fe6d Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 13 Oct 2023 12:07:28 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E6=8B=BC=E5=9B=A2=E6=B4=BB=E5=8A=A8:=20?= =?UTF-8?q?=E5=AE=8C=E5=96=84=20review=20=E6=8F=90=E5=88=B0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/combination/CombinationRecordApi.java | 6 +- .../dto/CombinationRecordCreateRespDTO.java | 32 +++++++++++ .../combination/CombinationRecordApiImpl.java | 8 +-- .../CombinationRecordController.java | 20 ++----- .../vo/recrod/CombinationRecordReqPageVO.java | 3 + .../AppCombinationRecordController.java | 2 +- .../CombinationActivityConvert.java | 12 +++- .../mysql/bargain/BargainActivityMapper.java | 2 +- .../combination/CombinationRecordMapper.java | 37 ++++++------ .../combination/CombinationRecordService.java | 22 ++++---- .../CombinationRecordServiceImpl.java | 56 ++++++++++--------- .../dal/mysql/order/TradeOrderMapper.java | 19 ++++--- .../handler/TradeCombinationOrderHandler.java | 10 ++-- 13 files changed, 135 insertions(+), 94 deletions(-) create mode 100644 yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/dto/CombinationRecordCreateRespDTO.java diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java index 4b42aca07..2274d45fd 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.promotion.api.combination; -import cn.iocoder.yudao.framework.common.core.KeyValue; import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; +import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateRespDTO; import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO; import javax.validation.Valid; @@ -28,9 +28,9 @@ public interface CombinationRecordApi { * 创建开团记录 * * @param reqDTO 请求 DTO - * @return key 开团记录编号、value 团长编号 + * @return 团信息 */ - KeyValue createCombinationRecord(@Valid CombinationRecordCreateReqDTO reqDTO); + CombinationRecordCreateRespDTO createCombinationRecord(@Valid CombinationRecordCreateReqDTO reqDTO); /** * 查询拼团记录是否成功 diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/dto/CombinationRecordCreateRespDTO.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/dto/CombinationRecordCreateRespDTO.java new file mode 100644 index 000000000..5f4ea2afd --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/dto/CombinationRecordCreateRespDTO.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.promotion.api.combination.dto; + +import lombok.Data; + +/** + * 拼团记录的创建 Response DTO + * + * @author HUIHUI + */ +@Data +public class CombinationRecordCreateRespDTO { + + /** + * 拼团活动编号 + * + * 关联 CombinationActivityDO 的 id 字段 + */ + private Long combinationActivityId; + /** + * 拼团团长编号 + * + * 关联 CombinationRecordDO 的 headId 字段 + */ + private Long combinationHeadId; + /** + * 拼团记录编号 + * + * 关联 CombinationRecordDO 的 id 字段 + */ + private Long combinationRecordId; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java index 5588f3735..5f586dd7d 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java @@ -1,8 +1,9 @@ package cn.iocoder.yudao.module.promotion.api.combination; -import cn.iocoder.yudao.framework.common.core.KeyValue; import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; +import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateRespDTO; import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO; +import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordService; @@ -29,10 +30,9 @@ public class CombinationRecordApiImpl implements CombinationRecordApi { recordService.validateCombinationRecord(userId, activityId, headId, skuId, count); } - // TODO @puhui999:搞个创建的 RespDTO 哈; @Override - public KeyValue createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) { - return recordService.createCombinationRecord(reqDTO); + public CombinationRecordCreateRespDTO createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) { + return CombinationActivityConvert.INSTANCE.convert4(recordService.createCombinationRecord(reqDTO)); } @Override diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java index 8f2b3fe99..dfb8ec889 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java @@ -3,11 +3,11 @@ package cn.iocoder.yudao.module.promotion.controller.admin.combination; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordPageItemRespVO; -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPage2VO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordSummaryVO; import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; import cn.iocoder.yudao.module.promotion.service.combination.CombinationActivityService; @@ -40,7 +40,6 @@ public class CombinationRecordController { @Lazy private CombinationRecordService combinationRecordService; - // TODO @puhui999:getBargainRecordPage 和 getBargainRecordPage 是不是可以合并;然后 CombinationRecordReqPageVO 加一个 headId; // 然后如果 headId 非空,并且第一页,单独多查询一条 head ;放到第 0 个位置;相当于说,第一页特殊一点; @GetMapping("/page") @@ -48,21 +47,12 @@ public class CombinationRecordController { @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") public CommonResult> getBargainRecordPage(@Valid CombinationRecordReqPageVO pageVO) { PageResult recordPage = combinationRecordService.getCombinationRecordPage(pageVO); + // 拼接数据 List activities = combinationActivityService.getCombinationActivityListByIds( convertSet(recordPage.getList(), CombinationRecordDO::getActivityId)); - // TODO @puhui999:商品没读取 - return success(CombinationActivityConvert.INSTANCE.convert(recordPage, activities)); - } - - @GetMapping("/page-by-headId") - @Operation(summary = "获得拼团记录分页") - @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") - public CommonResult> getBargainRecordPage(@Valid CombinationRecordReqPage2VO pageVO) { - // 包含团长和团员的分页记录 - PageResult recordPage = combinationRecordService.getCombinationRecordPage2(pageVO); - List activities = combinationActivityService.getCombinationActivityListByIds( + List products = combinationActivityService.getCombinationProductListByActivityIds( convertSet(recordPage.getList(), CombinationRecordDO::getActivityId)); - return success(CombinationActivityConvert.INSTANCE.convert(recordPage, activities)); + return success(CombinationActivityConvert.INSTANCE.convert(recordPage, activities, products)); } @GetMapping("/get-summary") @@ -70,7 +60,7 @@ public class CombinationRecordController { @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") public CommonResult getCombinationRecordSummary() { CombinationRecordSummaryVO summaryVO = new CombinationRecordSummaryVO(); - summaryVO.setUserCount(combinationRecordService.getCombinationRecordCount(null, null, null)); // 获取拼团用户参与数量 + summaryVO.setUserCount(combinationRecordService.getCombinationUserCount()); // 获取拼团用户参与数量 summaryVO.setSuccessCount(combinationRecordService.getCombinationRecordCount( // 获取成团记录 CombinationRecordStatusEnum.SUCCESS.getStatus(), null, CombinationRecordDO.HEAD_ID_GROUP)); summaryVO.setVirtualGroupCount(combinationRecordService.getCombinationRecordCount(// 获取虚拟成团记录 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/recrod/CombinationRecordReqPageVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/recrod/CombinationRecordReqPageVO.java index 9e1423a41..a66795d64 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/recrod/CombinationRecordReqPageVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/recrod/CombinationRecordReqPageVO.java @@ -23,6 +23,9 @@ public class CombinationRecordReqPageVO extends PageParam { @InEnum(BargainRecordStatusEnum.class) private Integer status; + @Schema(description = "团长编号", example = "1024") + private Long headId; + @Schema(description = "创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] createTime; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java index 684c7ce9b..e242569ac 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java @@ -47,7 +47,7 @@ public class AppCombinationRecordController { public CommonResult getCombinationRecordSummary() { AppCombinationRecordSummaryRespVO summary = new AppCombinationRecordSummaryRespVO(); // 1. 获得拼团参与用户数量 - Long count = combinationRecordService.getCombinationRecordCount(null, null, null); + Long count = combinationRecordService.getCombinationUserCount(); if (count == 0) { summary.setAvatars(Collections.emptyList()); summary.setUserCount(count); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java index 03cac269f..aad8281d6 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java +++ b/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.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO; import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; +import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateRespDTO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityCreateReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityPageItemRespVO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityRespVO; @@ -109,6 +110,11 @@ public interface CombinationActivityConvert { CombinationRecordDO convert(CombinationRecordCreateReqDTO reqDTO); + default CombinationRecordCreateRespDTO convert4(CombinationRecordDO combinationRecord) { + return new CombinationRecordCreateRespDTO().setCombinationActivityId(combinationRecord.getActivityId()) + .setCombinationRecordId(combinationRecord.getId()).setCombinationHeadId(combinationRecord.getHeadId()); + } + default CombinationRecordDO convert(CombinationRecordCreateReqDTO reqDTO, CombinationActivityDO activity, MemberUserRespDTO user, ProductSpuRespDTO spu, ProductSkuRespDTO sku) { @@ -172,12 +178,14 @@ public interface CombinationActivityConvert { PageResult convert(PageResult result); - default PageResult convert(PageResult recordPage, List activities) { + default PageResult convert(PageResult recordPage, List activities, List products) { PageResult result = convert(recordPage); + // 拼接关联属性 Map activityMap = convertMap(activities, CombinationActivityDO::getId); + Map> productsMap = convertMultiMap(products, CombinationProductDO::getActivityId); result.setList(CollectionUtils.convertList(result.getList(), item -> { findAndThen(activityMap, item.getActivityId(), activity -> { - item.setActivity(convert(activity)); + item.setActivity(convert(activity).setProducts(convertList2(productsMap.get(item.getActivityId())))); }); return item; })); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java index 0d4b85cd3..1015d1413 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java @@ -86,7 +86,7 @@ public interface BargainActivityMapper extends BaseMapperX { .last("LIMIT " + count)); } - // TODO @puhui999:是不是返回 BargainActivityDO 更干净哈? + // TODO @puhui999:是不是返回 BargainActivityDO 更干净哈?分组后返回 DO 的话需要联表查询 /** * 查询出指定 spuId 的 spu 参加的活动最接近现在的一条记录。多个的话,一个 spuId 对应一个最近的活动编号 * diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java index 5d85c8938..56ec0361a 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java @@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPage2VO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -97,21 +96,19 @@ public interface CombinationRecordMapper extends BaseMapperX selectPage(CombinationRecordReqPageVO pageVO) { - return selectPage(pageVO, new LambdaQueryWrapperX() + LambdaQueryWrapperX queryWrapper = new LambdaQueryWrapperX() .eqIfPresent(CombinationRecordDO::getStatus, pageVO.getStatus()) - .betweenIfPresent(CombinationRecordDO::getCreateTime, pageVO.getCreateTime())); - } - - default PageResult selectPage(CombinationRecordReqPage2VO pageVO) { - return selectPage(pageVO, new LambdaQueryWrapperX() - .eq(CombinationRecordDO::getId, pageVO.getHeadId()) - .or() - .eq(CombinationRecordDO::getHeadId, pageVO.getHeadId())); + .betweenIfPresent(CombinationRecordDO::getCreateTime, pageVO.getCreateTime()); + if (pageVO.getHeadId() != null) { + queryWrapper.eq(CombinationRecordDO::getId, pageVO.getHeadId()) + .or() + .eq(CombinationRecordDO::getHeadId, pageVO.getHeadId()); + } + return selectPage(pageVO, queryWrapper); } /** * 查询指定条件的记录数 - * 如果参数都为 null 时则查询用户拼团记录(DISTINCT 去重),也就是说查询会员表中的用户有多少人参与过拼团活动每个人只统计一次 * * @param status 状态,可为 null * @param virtualGroup 是否虚拟成团,可为 null @@ -119,12 +116,20 @@ public interface CombinationRecordMapper extends BaseMapperX() + .eqIfPresent(CombinationRecordDO::getStatus, status) + .eqIfPresent(CombinationRecordDO::getVirtualGroup, virtualGroup) + .eqIfPresent(CombinationRecordDO::getHeadId, headId)); + } + + /** + * 查询用户拼团记录(DISTINCT 去重),也就是说查询会员表中的用户有多少人参与过拼团活动每个人只统计一次 + * + * @return 参加过拼团的用户数 + */ + default Long selectUserDistinctCount() { return selectCount(new QueryWrapper() - // TODO @puhui999:这种偏逻辑性的,不要给 mapper 哈;可以考虑拆成 2 个 mapper,上层也是 2 个 service; - .select(status == null && virtualGroup == null && headId == null, "DISTINCT (user_id)") - .eq(status != null, "status", status) - .eq(virtualGroup != null, "virtual_group", virtualGroup) - .eq(headId != null, "head_id", headId) + .select("DISTINCT (user_id)") .groupBy("user_id")); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java index e6200c4d0..5e6770061 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java @@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.core.KeyValue; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO; -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPage2VO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; @@ -50,9 +49,9 @@ public interface CombinationRecordService { * 创建拼团记录 * * @param reqDTO 创建信息 - * @return key 开团记录编号 value 团长编号 + * @return 团信息 */ - KeyValue createCombinationRecord(CombinationRecordCreateReqDTO reqDTO); + CombinationRecordDO createCombinationRecord(CombinationRecordCreateReqDTO reqDTO); /** * 获得拼团记录 @@ -94,7 +93,14 @@ public interface CombinationRecordService { * @param headId 团长编号,允许空。目的 headId 设置为 {@link CombinationRecordDO#HEAD_ID_GROUP} 时,可以设置 * @return 记录数 */ - Long getCombinationRecordCount(@Nullable Integer status, @Nullable Boolean virtualGroup, @Nullable Long headId); + Long getCombinationRecordCount(@Nullable Integer status, @Nullable Boolean virtualGroup, Long headId); + + /** + * 查询用户拼团记录(DISTINCT 去重),也就是说查询会员表中的用户有多少人参与过拼团活动每个人只统计一次 + * + * @return 参加过拼团的用户数 + */ + Long getCombinationUserCount(); /** * 获取最近的 count 条拼团记录 @@ -138,14 +144,6 @@ public interface CombinationRecordService { */ PageResult getCombinationRecordPage(CombinationRecordReqPageVO pageVO); - /** - * 获取拼团记录分页数据(通过团长查询) - * - * @param pageVO 分页请求 - * @return 拼团记录分页数据(包括团长的) - */ - PageResult getCombinationRecordPage2(CombinationRecordReqPage2VO pageVO); - /** * 【拼团活动】获得拼团记录数量 Map * diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java index 17b8a6ef4..82baf1931 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java @@ -14,7 +14,6 @@ import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO; -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPage2VO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO; import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; @@ -23,7 +22,6 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationR import cn.iocoder.yudao.module.promotion.dal.mysql.combination.CombinationRecordMapper; import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; @@ -72,9 +70,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { CombinationRecordDO record = validateCombinationRecord(userId, orderId); // 更新状态 - // TODO @puhui999:不要整个更新,new 一个出来;why?例如说,两个线程都去更新,这样存在相互覆盖的问题 - record.setStatus(status); - combinationRecordMapper.updateById(record); + combinationRecordMapper.updateById(new CombinationRecordDO().setId(record.getId()).setStatus(status)); } private CombinationRecordDO validateCombinationRecord(Long userId, Long orderId) { @@ -164,7 +160,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { @Override @Transactional(rollbackFor = Exception.class) - public KeyValue createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) { + public CombinationRecordDO createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) { // 1. 校验拼团活动 KeyValue keyValue = validateCombinationRecord(reqDTO.getUserId(), reqDTO.getActivityId(), reqDTO.getHeadId(), reqDTO.getSkuId(), reqDTO.getCount()); @@ -191,7 +187,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { if (ObjUtil.notEqual(CombinationRecordDO.HEAD_ID_GROUP, record.getHeadId())) { updateCombinationRecordWhenCreate(reqDTO.getHeadId(), keyValue.getKey()); } - return new KeyValue<>(record.getId(), record.getHeadId()); + return record; } /** @@ -249,6 +245,11 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { return combinationRecordMapper.selectCountByHeadAndStatusAndVirtualGroup(status, virtualGroup, headId); } + @Override + public Long getCombinationUserCount() { + return combinationRecordMapper.selectUserDistinctCount(); + } + @Override public List getLatestCombinationRecordList(int count) { return combinationRecordMapper.selectLatestList(count); @@ -275,11 +276,6 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { return combinationRecordMapper.selectPage(pageVO); } - @Override - public PageResult getCombinationRecordPage2(CombinationRecordReqPage2VO pageVO) { - return combinationRecordMapper.selectPage(pageVO); - } - @Override public Map getCombinationRecordCountMapByActivity(Collection activityIds, @Nullable Integer status, @Nullable Long headId) { @@ -343,32 +339,28 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { @Override public KeyValue expireCombinationRecord() { - // TODO @puhui999:数字一般是 1. 2. 这种格式哈 - // 1。获取所有正在进行中的过期的父拼团 + // 1.获取所有正在进行中的过期的父拼团 List headExpireRecords = combinationRecordMapper.selectListByHeadIdAndStatusAndExpireTimeLt( CombinationRecordDO.HEAD_ID_GROUP, CombinationRecordStatusEnum.IN_PROGRESS.getStatus(), LocalDateTime.now()); if (CollUtil.isEmpty(headExpireRecords)) { return new KeyValue<>(0, 0); } - // 2. 获取拼团活动 - // TODO @puhui999:在自己模块里,变量可以简略点;例如说 activityList - List combinationActivities = combinationActivityService.getCombinationActivityListByIds( + // 2.获取拼团活动 + List activities = combinationActivityService.getCombinationActivityListByIds( convertSet(headExpireRecords, CombinationRecordDO::getActivityId)); - Map activityMap = convertMap(combinationActivities, CombinationActivityDO::getId); + Map activityMap = convertMap(activities, CombinationActivityDO::getId); - // TODO @puhui999:job 一般不建议异步跑;因为可能下次跑,结果上次还没跑完; - // TODO 这里,我们可以每个 record 处理下;然后按照是否需要虚拟拼团,各搞一个方法逻辑 + 事务;这样,保证 job 里面尽量不要大事务,而是 n 个独立小事务的处理。 - // 3. 校验是否虚拟成团 + // 3.校验是否虚拟成团 List virtualGroupHeadRecords = new ArrayList<>(); // 虚拟成团 for (Iterator iterator = headExpireRecords.iterator(); iterator.hasNext(); ) { CombinationRecordDO record = iterator.next(); - // 3.1 不匹配,则直接跳过 + // 3.1.不匹配,则直接跳过 CombinationActivityDO activity = activityMap.get(record.getActivityId()); if (activity == null || !activity.getVirtualGroup()) { // 取不到活动的或者不是虚拟拼团的 continue; } - // 3.2 匹配,则移除,添加到虚拟成团中,并结束寻找 + // 3.2.匹配,则移除,添加到虚拟成团中,并结束寻找 virtualGroupHeadRecords.add(record); iterator.remove(); break; @@ -381,8 +373,13 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { return new KeyValue<>(headExpireRecords.size(), virtualGroupHeadRecords.size()); } - @Async - protected void handleExpireRecord(List headExpireRecords) { + /** + * 处理过期拼团 + * + * @param headExpireRecords 过期拼团团长记录列表 + */ + @Transactional(rollbackFor = Exception.class) + public void handleExpireRecord(List headExpireRecords) { if (CollUtil.isEmpty(headExpireRecords)) { return; } @@ -400,8 +397,13 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { }); } - @Async - protected void handleVirtualGroupRecord(List virtualGroupHeadRecords) { + /** + * 处理虚拟拼团 + * + * @param virtualGroupHeadRecords 虚拟成团团长记录列表 + */ + @Transactional(rollbackFor = Exception.class) + public void handleVirtualGroupRecord(List virtualGroupHeadRecords) { if (CollUtil.isEmpty(virtualGroupHeadRecords)) { return; } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java index d1b3dc2f8..d942fd853 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java @@ -93,16 +93,19 @@ public interface TradeOrderMapper extends BaseMapperX { return selectOne(TradeOrderDO::getPickUpVerifyCode, pickUpVerifyCode); } - // TODO @hui999:是不是只针对 combinationActivityId 的查询呀? + /** + * 只针对 combinationActivityId 的查询 + * + * @param userId 用户编号 + * @param activityId 拼团活动编号 + * @param status 订单状态 + * @return 交易订单 + */ default TradeOrderDO selectByUserIdAndActivityIdAndStatus(Long userId, Long activityId, Integer status) { return selectOne(new LambdaQueryWrapperX() - .and(q -> q.eq(TradeOrderDO::getUserId, userId) - .eq(TradeOrderDO::getStatus, status)) - .and(q -> q.eq(TradeOrderDO::getCombinationActivityId, activityId) - .or() - .eq(TradeOrderDO::getSeckillActivityId, activityId) - .or() - .eq(TradeOrderDO::getBargainActivityId, activityId)) + .eq(TradeOrderDO::getUserId, userId) + .eq(TradeOrderDO::getStatus, status) + .eq(TradeOrderDO::getCombinationActivityId, activityId) ); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java index 9d32190fb..7efdc1650 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java @@ -1,8 +1,8 @@ package cn.iocoder.yudao.module.trade.service.order.handler; import cn.hutool.core.lang.Assert; -import cn.iocoder.yudao.framework.common.core.KeyValue; import cn.iocoder.yudao.module.promotion.api.combination.CombinationRecordApi; +import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateRespDTO; import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert; import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; @@ -49,7 +49,6 @@ public class TradeCombinationOrderHandler implements TradeOrderHandler { order.getCombinationHeadId(), item.getSkuId(), item.getCount()); // 2. 校验该用户是否存在未支付的拼团活动订单,避免一个拼团可以下多个单子了 - // TODO @puhui999:只校验未支付的拼团订单噢 TradeOrderDO activityOrder = orderQueryService.getActivityOrderByUserIdAndActivityIdAndStatus( order.getUserId(), order.getCombinationActivityId(), TradeOrderStatusEnum.UNPAID.getStatus()); if (activityOrder != null) { @@ -67,13 +66,14 @@ public class TradeCombinationOrderHandler implements TradeOrderHandler { // 2. 创建拼团记录 TradeOrderItemDO item = orderItems.get(0); - KeyValue recordIdAndHeadId = combinationRecordApi.createCombinationRecord( + CombinationRecordCreateRespDTO combinationRecord = combinationRecordApi.createCombinationRecord( TradeOrderConvert.INSTANCE.convert(order, item)); // 3. 更新拼团相关信息到订单 - // TODO 芋艿,只需要更新 record + // TODO 芋艿,只需要更新 record。 如果创建订单时自己是团长的情况下 combinationHeadId 是为 null 的, + // 设置团长编号这个操作时在订单是否后创建拼团记录时才设置的,所以支付完创建拼团记录后需要设置一下记录编号和团长编号 orderUpdateService.updateOrderCombinationInfo(order.getId(), order.getCombinationActivityId(), - recordIdAndHeadId.getKey(), recordIdAndHeadId.getValue()); + combinationRecord.getCombinationRecordId(), combinationRecord.getCombinationHeadId()); } @Override From 970e524088ff7aafdcac22cd725f2dc69750c023 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 14 Oct 2023 13:15:14 +0800 Subject: [PATCH 03/13] =?UTF-8?q?code=20review=EF=BC=9A=E4=BA=A4=E6=98=93?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trade/TradeStatisticsController.java | 5 ++ .../trade/vo/TradeTrendSummaryRespVO.java | 21 ++++---- .../dataobject/trade/TradeStatisticsDO.java | 1 + .../infra/ApiAccessLogStatisticsMapper.java | 1 + .../mysql/pay/PayWalletStatisticsMapper.java | 3 ++ .../trade/AfterSaleStatisticsMapper.java | 1 + .../trade/TradeOrderStatisticsMapper.java | 2 + .../mysql/trade/TradeStatisticsMapper.java | 1 + .../pay/PayWalletStatisticsService.java | 2 + .../trade/AfterSaleStatisticsService.java | 1 + .../trade/BrokerageStatisticsService.java | 1 + .../service/trade/TradeStatisticsService.java | 1 + .../trade/TradeStatisticsServiceImpl.java | 52 ++++++++++--------- .../mapper/pay/PayWalletStatisticsMapper.xml | 1 + .../mapper/trade/TradeStatisticsMapper.xml | 1 + 15 files changed, 60 insertions(+), 34 deletions(-) diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/TradeStatisticsController.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/TradeStatisticsController.java index aa5b711cb..84a83d499 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/TradeStatisticsController.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/TradeStatisticsController.java @@ -36,9 +36,11 @@ public class TradeStatisticsController { @Operation(summary = "获得交易统计") @PreAuthorize("@ss.hasPermission('statistics:trade:query')") public CommonResult> getTradeSummaryComparison() { + // TODO @疯狂:这个要不要 tradeStatisticsService 调用里面的多个方法,组合出最终的 TradeSummaryRespVO; return success(tradeStatisticsService.getTradeSummaryComparison()); } + // TODO @疯狂:【晚点再改和讨论;等首页的接口出来】这个要不还是叫 analyse,对比选中的时间段,和上一个时间段;类似 MemberStatisticsController 的 getMemberAnalyse @GetMapping("/trend/summary") @Operation(summary = "获得交易状况统计") @PreAuthorize("@ss.hasPermission('statistics:trade:query')") @@ -48,6 +50,8 @@ public class TradeStatisticsController { ArrayUtil.get(reqVO.getTimes(), 1))); } + // TODO 芋艿:已经 review + // TODO @疯狂:这个要不直接叫 list;它即使就是把每条统计拿出来 @GetMapping("/trend/list") @Operation(summary = "获得交易状况明细") @PreAuthorize("@ss.hasPermission('statistics:trade:query')") @@ -57,6 +61,7 @@ public class TradeStatisticsController { ArrayUtil.get(reqVO.getTimes(), 1))); } + // TODO @疯狂:这个要不直接叫 export;它即使就是把每条统计导出 @GetMapping("/trend/export-excel") @Operation(summary = "导出获得交易状况明细 Excel") @PreAuthorize("@ss.hasPermission('statistics:trade:export')") diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/vo/TradeTrendSummaryRespVO.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/vo/TradeTrendSummaryRespVO.java index ea05fdd95..79f5583e6 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/vo/TradeTrendSummaryRespVO.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/vo/TradeTrendSummaryRespVO.java @@ -16,25 +16,26 @@ public class TradeTrendSummaryRespVO { @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY) private LocalDate date; + // TODO @疯狂,要不加个 turnoverPrice? @Schema(description = "营业额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private Integer turnover; + private Integer turnover; // 营业额 = 商品支付金额 + 充值金额 - @Schema(description = "商品支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @Schema(description = "订单支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") private Integer orderPayPrice; + @Schema(description = "订单退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Integer orderRefundPrice; + + @Schema(description = "支付佣金金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Integer brokerageSettlementPrice; + @Schema(description = "充值金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") private Integer rechargePrice; @Schema(description = "支出金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private Integer expensePrice; + private Integer expensePrice; // 余额支付金额 + 支付佣金金额 + 商品退款金额 @Schema(description = "余额支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private Integer balancePrice; - - @Schema(description = "支付佣金金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private Integer brokerageSettlementPrice; - - @Schema(description = "商品退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private Integer orderRefundPrice; + private Integer balancePrice; // TODO @疯狂:这个字段要不改成:walletPayPrice } diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/dataobject/trade/TradeStatisticsDO.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/dataobject/trade/TradeStatisticsDO.java index f2ab1a63d..f007aa21b 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/dataobject/trade/TradeStatisticsDO.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/dataobject/trade/TradeStatisticsDO.java @@ -48,6 +48,7 @@ public class TradeStatisticsDO extends TenantBaseDO { * 总支付金额,单位:分 */ private Integer orderPayPrice; + // TODO @疯狂:这个字段改成 walletPayPrice,然后挪到 rechargePayCount 前面; /** * 总支付金额(余额),单位:分 */ diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/infra/ApiAccessLogStatisticsMapper.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/infra/ApiAccessLogStatisticsMapper.java index 250e89125..37b04cfc2 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/infra/ApiAccessLogStatisticsMapper.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/infra/ApiAccessLogStatisticsMapper.java @@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param; import java.time.LocalDateTime; +// TODO @芋艿:api 访问日志,现在会清理,可能要单独有个偏业务的访问表; /** * API 访问日志的统计 Mapper * diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java index 32922814b..61f713d2c 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java @@ -17,14 +17,17 @@ import java.time.LocalDateTime; @Mapper public interface PayWalletStatisticsMapper extends BaseMapperX { + // TODO 芋艿:已经 review; WalletSummaryRespBO selectRechargeSummaryByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime, @Param("payStatus") Boolean payStatus); + // TODO 芋艿:已经 review; WalletSummaryRespBO selectRechargeSummaryByRefundTimeBetween(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime, @Param("refundStatus") Integer refundStatus); + // TODO 芋艿:已经 review; Integer selectPriceSummaryByBizTypeAndCreateTimeBetween(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime, @Param("bizType") Integer bizType); diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/AfterSaleStatisticsMapper.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/AfterSaleStatisticsMapper.java index e5f9d1905..a166be0ab 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/AfterSaleStatisticsMapper.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/AfterSaleStatisticsMapper.java @@ -16,6 +16,7 @@ import java.time.LocalDateTime; @Mapper public interface AfterSaleStatisticsMapper extends BaseMapperX { + // TODO 芋艿:已 review AfterSaleSummaryRespBO selectSummaryByRefundTimeBetween(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/TradeOrderStatisticsMapper.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/TradeOrderStatisticsMapper.java index bea5ba8e2..42207319f 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/TradeOrderStatisticsMapper.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/TradeOrderStatisticsMapper.java @@ -20,9 +20,11 @@ public interface TradeOrderStatisticsMapper extends BaseMapperX selectSummaryListByAreaId(); + // TODO 芋艿:已经 review Integer selectCountByCreateTimeBetween(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); + // TODO 芋艿:已经 review Integer selectCountByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/TradeStatisticsMapper.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/TradeStatisticsMapper.java index dae0f31bc..d07caa43e 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/TradeStatisticsMapper.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/trade/TradeStatisticsMapper.java @@ -24,6 +24,7 @@ public interface TradeStatisticsMapper extends BaseMapperX { TradeTrendSummaryRespVO selectByTimeBetween(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); + // TODO @芋艿:已经 review List selectListByTimeBetween(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsService.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsService.java index b1d3f3773..17e6c253c 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsService.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsService.java @@ -12,6 +12,7 @@ import java.time.LocalDateTime; */ public interface PayWalletStatisticsService { + // TODO 芋艿:已经 review /** * 获取钱包统计 * @@ -21,6 +22,7 @@ public interface PayWalletStatisticsService { */ WalletSummaryRespBO getWalletSummary(LocalDateTime beginTime, LocalDateTime endTime); + // TODO 芋艿:已经 review /** * 获取钱包充值统计 * diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/AfterSaleStatisticsService.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/AfterSaleStatisticsService.java index ea805967b..7b8593f44 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/AfterSaleStatisticsService.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/AfterSaleStatisticsService.java @@ -11,6 +11,7 @@ import java.time.LocalDateTime; */ public interface AfterSaleStatisticsService { + // TODO 芋艿:已经 review /** * 获取售后单统计 * diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/BrokerageStatisticsService.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/BrokerageStatisticsService.java index 7d1bfa347..6da8e1c2e 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/BrokerageStatisticsService.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/BrokerageStatisticsService.java @@ -9,6 +9,7 @@ import java.time.LocalDateTime; */ public interface BrokerageStatisticsService { + // TODO 芋艿:已经 review /** * 获取已结算的佣金金额 * diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsService.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsService.java index 1663ea27d..cf0477455 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsService.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsService.java @@ -45,6 +45,7 @@ public interface TradeStatisticsService { */ List getTradeStatisticsList(LocalDateTime beginTime, LocalDateTime endTime); + // TODO 芋艿:已经 review; /** * 统计昨日交易 * diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsServiceImpl.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsServiceImpl.java index 6a751a0cd..e2f89eb41 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsServiceImpl.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsServiceImpl.java @@ -57,6 +57,30 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { return TradeStatisticsConvert.INSTANCE.convert(yesterdayData, beforeYesterdayData, monthData, lastMonthData); } + /** + * 统计指定日期的交易数据 + * + * @param days 增加的天数 + * @return 交易数据 + */ + private TradeSummaryRespBO getTradeSummaryByDays(int days) { + LocalDateTime date = LocalDateTime.now().plusDays(days); + return tradeStatisticsMapper.selectOrderCreateCountSumAndOrderPayPriceSumByTimeBetween( + LocalDateTimeUtil.beginOfDay(date), LocalDateTimeUtil.endOfDay(date)); + } + + /** + * 统计指定月份的交易数据 + * + * @param months 增加的月数 + * @return 交易数据 + */ + private TradeSummaryRespBO getTradeSummaryByMonths(int months) { + LocalDateTime monthDate = LocalDateTime.now().plusMonths(months); + return tradeStatisticsMapper.selectOrderCreateCountSumAndOrderPayPriceSumByTimeBetween( + LocalDateTimeUtils.beginOfMonth(monthDate), LocalDateTimeUtils.endOfMonth(monthDate)); + } + @Override public TradeStatisticsComparisonRespVO getTradeTrendSummaryComparison(LocalDateTime beginTime, LocalDateTime endTime) { @@ -73,6 +97,7 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { return tradeStatisticsMapper.selectExpensePriceByTimeBetween(beginTime, endTime); } + // TODO @疯狂:是不是直接返回 TradeStatisticsDO;上层在去聚合? @Override public List getTradeStatisticsList(LocalDateTime beginTime, LocalDateTime endTime) { return tradeStatisticsMapper.selectListByTimeBetween(beginTime, endTime); @@ -80,6 +105,9 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { @Override public String statisticsYesterdayTrade() { + // TODO @疯狂:如果已经统计,则跳过; + // TODO @疯狂:改成 statisticsTrade,然后传入 days,统计多少天;days 通过 job 传参;方便把历史给统计出来;或者大家有的时候要修复数据(会 fix 业务数据,然后清理统计表),重新统计的时候; + // 1. 从各个数据表,统计对应数据 LocalDateTime yesterday = LocalDateTime.now().minusDays(1); LocalDateTime beginTime = LocalDateTimeUtil.beginOfDay(yesterday); LocalDateTime endTime = LocalDateTimeUtil.endOfDay(yesterday); @@ -108,28 +136,4 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { return stopWatch.prettyPrint(); } - /** - * 统计指定日期的交易数据 - * - * @param days 增加的天数 - * @return 交易数据 - */ - private TradeSummaryRespBO getTradeSummaryByDays(int days) { - LocalDateTime date = LocalDateTime.now().plusDays(days); - return tradeStatisticsMapper.selectOrderCreateCountSumAndOrderPayPriceSumByTimeBetween( - LocalDateTimeUtil.beginOfDay(date), LocalDateTimeUtil.endOfDay(date)); - } - - /** - * 统计指定月份的交易数据 - * - * @param months 增加的月数 - * @return 交易数据 - */ - private TradeSummaryRespBO getTradeSummaryByMonths(int months) { - LocalDateTime monthDate = LocalDateTime.now().plusMonths(months); - return tradeStatisticsMapper.selectOrderCreateCountSumAndOrderPayPriceSumByTimeBetween( - LocalDateTimeUtils.beginOfMonth(monthDate), LocalDateTimeUtils.endOfMonth(monthDate)); - } - } diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/pay/PayWalletStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/pay/PayWalletStatisticsMapper.xml index 16cfe3be4..cc9408356 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/pay/PayWalletStatisticsMapper.xml +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/pay/PayWalletStatisticsMapper.xml @@ -1,6 +1,7 @@ + From 3110e427fb6554941ef30f4c81cf145206f93d55 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 14 Oct 2023 17:45:49 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E5=90=8C=E6=AD=A5=20https://gitee.com/zh?= =?UTF-8?q?ijiantianya/ruoyi-vue-pro/pulls/647/files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trade/enums/order/TradeOrderOperateTypeEnum.java | 3 ++- .../controller/admin/order/TradeOrderController.java | 8 +++++++- .../trade/service/order/TradeOrderUpdateService.java | 6 +++--- .../service/order/TradeOrderUpdateServiceImpl.java | 8 ++++---- .../system/controller/admin/auth/AuthController.java | 10 +++++++--- .../yudao/module/system/convert/auth/AuthConvert.java | 4 ++++ 6 files changed, 27 insertions(+), 12 deletions(-) diff --git a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderOperateTypeEnum.java b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderOperateTypeEnum.java index c4c7974aa..9bae36588 100644 --- a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderOperateTypeEnum.java +++ b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderOperateTypeEnum.java @@ -20,7 +20,8 @@ public enum TradeOrderOperateTypeEnum { ADMIN_DELIVERY(20, "已发货,快递公司:{deliveryName},快递单号:{logisticsNo}"), MEMBER_RECEIVE(30, "用户已收货"), SYSTEM_RECEIVE(31, "到期未收货,系统自动确认收货"), - PICK_UP_RECEIVE(32, "自提收货"), + ADMIN_PICK_UP_RECEIVE(32, "管理员自提收货"), + MEMBER_PICK_UP_RECEIVE(32, "用户自提收货"), MEMBER_COMMENT(33, "用户评价"), SYSTEM_COMMENT(34, "到期未评价,系统自动评价"), MEMBER_CANCEL(40, "取消订单"), diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java index bea620af8..3dae95f3a 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java @@ -126,11 +126,17 @@ public class TradeOrderController { return success(true); } + // TODO @疯狂:1、在【订单列表】界面,增加一个【核销按钮】。点击后,弹窗出一个核销码输入的窗口。 + // + //2、输入核销码后,点击确认,基于 code 查询对应的订单,之后弹窗展示。 + // + //3、新的弹窗,下面有个【确认核销】按钮。确认后,进行订单核销逻辑。注意,只有门店自提的订单,才可以核销。 + // TODO 这里的 id 应该是 pickUpVerifyCode 参数哈; @PutMapping("/pick-up") @Operation(summary = "订单核销") @PreAuthorize("@ss.hasPermission('trade:order:pick-up')") public CommonResult pickUpOrder(@RequestParam("id") Long id) { - tradeOrderUpdateService.pickUpOrder(id); + tradeOrderUpdateService.pickUpOrderByMember(id); return success(true); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateService.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateService.java index 607128992..42d3e6b65 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateService.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateService.java @@ -120,14 +120,14 @@ public interface TradeOrderUpdateService { * * @param id 订单编号 */ - void pickUpOrder(Long id); + void pickUpOrderByMember(Long id); /** * 【管理员】核销订单 * * @param pickUpVerifyCode 自提核销码 */ - void pickUpOrder(String pickUpVerifyCode); + void pickUpOrderByAdmin(String pickUpVerifyCode); // =================== Order Item =================== @@ -178,9 +178,9 @@ public interface TradeOrderUpdateService { * @param combinationRecordId 拼团记录编号 * @param headId 团长编号 */ - // TODO 芋艿:再 review 拼团 void updateOrderCombinationInfo(Long orderId, Long activityId, Long combinationRecordId, Long headId); + // TODO 芋艿:拼团取消,不调这个接口哈; /** * 取消支付订单 * diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java index 765b84e8b..8d5727e84 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java @@ -670,17 +670,18 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { } @Override - public void pickUpOrder(Long id) { + @TradeOrderLog(operateType = TradeOrderOperateTypeEnum.MEMBER_PICK_UP_RECEIVE) + public void pickUpOrderByMember(Long id) { getSelf().pickUpOrder(tradeOrderMapper.selectById(id)); } @Override - public void pickUpOrder(String pickUpVerifyCode) { + @TradeOrderLog(operateType = TradeOrderOperateTypeEnum.ADMIN_PICK_UP_RECEIVE) + public void pickUpOrderByAdmin(String pickUpVerifyCode) { getSelf().pickUpOrder(tradeOrderMapper.selectOneByPickUpVerifyCode(pickUpVerifyCode)); } @Transactional(rollbackFor = Exception.class) - @TradeOrderLog(operateType = TradeOrderOperateTypeEnum.PICK_UP_RECEIVE) public void pickUpOrder(TradeOrderDO order) { if (order == null) { throw exception(ORDER_NOT_FOUND); @@ -688,7 +689,6 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { if (ObjUtil.notEqual(DeliveryTypeEnum.PICK_UP.getType(), order.getDeliveryType())) { throw exception(ORDER_RECEIVE_FAIL_DELIVERY_TYPE_NOT_PICK_UP); } - // todo 校验核销操作人? receiveOrder0(order); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java index 99ed5764d..e7fad37e1 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java @@ -18,10 +18,10 @@ import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.permission.RoleService; import cn.iocoder.yudao.module.system.service.social.SocialUserService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; -import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -30,6 +30,7 @@ import javax.annotation.Resource; import javax.annotation.security.PermitAll; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; +import java.util.Collections; import java.util.List; import java.util.Set; @@ -101,6 +102,9 @@ public class AuthController { // 1.2 获得角色列表 Set roleIds = permissionService.getUserRoleIdListByUserId(getLoginUserId()); + if (CollUtil.isEmpty(roleIds)) { + return success(AuthConvert.INSTANCE.convert(user, Collections.emptyList(), Collections.emptyList())); + } List roles = roleService.getRoleList(roleIds); roles.removeIf(role -> !CommonStatusEnum.ENABLE.getStatus().equals(role.getStatus())); // 移除禁用的角色 @@ -154,4 +158,4 @@ public class AuthController { return success(authService.socialLogin(reqVO)); } -} \ No newline at end of file +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java index 1b79036fa..8343547d9 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.convert.auth; +import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO; import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO; import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO; @@ -46,6 +47,9 @@ public interface AuthConvert { * @return 菜单树 */ default List buildMenuTree(List menuList) { + if (CollUtil.isEmpty(menuList)) { + return Collections.emptyList(); + } // 移除按钮 menuList.removeIf(menu -> menu.getType().equals(MenuTypeEnum.BUTTON.getType())); // 排序,保证菜单的有序性 From ca5e3f7bd175e4dd1ce8a45575690b86be5c7cc1 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 14 Oct 2023 22:00:30 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E5=95=86=E5=9F=8E=E7=9A=84=20sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql/ruoyi-vue-pro.sql | 129 ++++++++++++++---- .../discount/DiscountActivityDO.java | 1 - .../discount/DiscountProductDO.java | 24 +++- .../dataobject/reward/RewardActivityDO.java | 1 - 4 files changed, 129 insertions(+), 26 deletions(-) diff --git a/sql/mysql/ruoyi-vue-pro.sql b/sql/mysql/ruoyi-vue-pro.sql index 6a9206a6c..d5bb7ca45 100644 --- a/sql/mysql/ruoyi-vue-pro.sql +++ b/sql/mysql/ruoyi-vue-pro.sql @@ -11,7 +11,7 @@ Target Server Version : 80034 File Encoding : 65001 - Date: 05/10/2023 12:42:16 + Date: 14/10/2023 20:04:17 */ SET NAMES utf8mb4; @@ -384,7 +384,7 @@ CREATE TABLE `infra_api_error_log` ( `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1662 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志'; +) ENGINE = InnoDB AUTO_INCREMENT = 1734 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志'; -- ---------------------------- -- Records of infra_api_error_log @@ -422,7 +422,7 @@ CREATE TABLE `infra_codegen_column` ( `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1778 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表字段定义'; +) ENGINE = InnoDB AUTO_INCREMENT = 1805 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表字段定义'; -- ---------------------------- -- Records of infra_codegen_column @@ -455,7 +455,7 @@ CREATE TABLE `infra_codegen_table` ( `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 135 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表定义'; +) ENGINE = InnoDB AUTO_INCREMENT = 137 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表定义'; -- ---------------------------- -- Records of infra_codegen_table @@ -709,7 +709,7 @@ CREATE TABLE `member_address` ( `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE, INDEX `idx_userId`(`user_id` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址'; +) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址'; -- ---------------------------- -- Records of member_address @@ -717,6 +717,33 @@ CREATE TABLE `member_address` ( BEGIN; INSERT INTO `member_address` (`id`, `user_id`, `name`, `mobile`, `area_id`, `detail_address`, `default_status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (21, 247, 'yunai', '15601691300', 140302, '芋道源码 233 号 666 室', b'1', '1', '2022-08-01 22:46:35', '247', '2023-06-26 19:47:46', b'0', 1); INSERT INTO `member_address` (`id`, `user_id`, `name`, `mobile`, `area_id`, `detail_address`, `default_status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (23, 247, '测试', '15601691300', 120103, '13232312', b'0', '247', '2023-06-26 19:47:40', '247', '2023-06-26 19:47:46', b'0', 1); +INSERT INTO `member_address` (`id`, `user_id`, `name`, `mobile`, `area_id`, `detail_address`, `default_status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (24, 248, '芋头', '15601691234', 110101, '灌灌灌灌灌', b'1', '248', '2023-10-06 10:08:24', '248', '2023-10-06 10:08:24', b'0', 1); +COMMIT; + +-- ---------------------------- +-- Table structure for member_config +-- ---------------------------- +DROP TABLE IF EXISTS `member_config`; +CREATE TABLE `member_config` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增主键', + `point_trade_deduct_enable` bit(1) NOT NULL COMMENT '是否开启积分抵扣', + `point_trade_deduct_unit_price` int NOT NULL COMMENT '积分抵扣(单位:分)', + `point_trade_deduct_max_price` int NULL DEFAULT NULL COMMENT '积分抵扣最大值', + `point_trade_give_point` bigint NULL DEFAULT NULL COMMENT '1 元赠送多少分', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员配置表'; + +-- ---------------------------- +-- Records of member_config +-- ---------------------------- +BEGIN; +INSERT INTO `member_config` (`id`, `point_trade_deduct_enable`, `point_trade_deduct_unit_price`, `point_trade_deduct_max_price`, `point_trade_give_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (5, b'1', 100, 2, 3, '1', '2023-08-20 09:54:42', '1', '2023-10-01 23:44:01', b'0', 1); COMMIT; -- ---------------------------- @@ -741,7 +768,7 @@ CREATE TABLE `member_experience_record` ( PRIMARY KEY (`id`) USING BTREE, INDEX `idx_user_id`(`user_id` ASC) USING BTREE COMMENT '会员经验记录-用户编号', INDEX `idx_user_biz_type`(`user_id` ASC, `biz_type` ASC) USING BTREE COMMENT '会员经验记录-用户业务类型' -) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员经验记录'; +) ENGINE = InnoDB AUTO_INCREMENT = 41 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员经验记录'; -- ---------------------------- -- Records of member_experience_record @@ -759,6 +786,27 @@ INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, ` INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (10, 247, '97', 2, '下单奖励', '下单获得 384945 经验', 384945, 5529343, NULL, '2023-10-02 10:21:12', NULL, '2023-10-02 10:21:12', b'0', 1); INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (11, 247, '11', 3, '退单扣除', '退单获得 -699900 经验', -699900, 4829443, NULL, '2023-10-02 15:19:37', NULL, '2023-10-02 15:19:37', b'0', 1); INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (12, 247, '98', 2, '下单奖励', '下单获得 384945 经验', 384945, 5214388, NULL, '2023-10-02 15:38:39', NULL, '2023-10-02 15:38:39', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (13, 247, '102', 2, '下单奖励', '下单获得 201 经验', 201, 5214589, NULL, '2023-10-05 23:05:29', NULL, '2023-10-05 23:05:29', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (14, 247, '107', 2, '下单奖励', '下单获得 201 经验', 201, 5214790, NULL, '2023-10-05 23:23:00', NULL, '2023-10-05 23:23:00', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (15, 248, '108', 2, '下单奖励', '下单获得 275 经验', 275, 275, NULL, '2023-10-06 10:13:44', NULL, '2023-10-06 10:13:44', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (16, 248, '118', 2, '下单奖励', '下单获得 203 经验', 203, 478, NULL, '2023-10-07 06:58:52', NULL, '2023-10-07 06:58:52', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (17, 248, '119', 2, '下单奖励', '下单获得 700100 经验', 700100, 700578, NULL, '2023-10-10 23:02:36', NULL, '2023-10-10 23:02:36', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (21, 248, '15', 3, '退单扣除', '退单获得 -700100 经验', -700100, 478, '1', '2023-10-10 23:11:19', '1', '2023-10-10 23:11:19', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (22, 248, '119', 3, '退单扣除', '退单获得 -700100 经验', -700100, 0, '1', '2023-10-10 23:11:23', '1', '2023-10-10 23:11:23', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (23, 248, '120', 2, '下单奖励', '下单获得 700100 经验', 700100, 700100, NULL, '2023-10-10 23:16:09', NULL, '2023-10-10 23:16:09', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (24, 248, '16', 3, '退单扣除', '退单获得 -700100 经验', -700100, 0, '1', '2023-10-10 23:20:10', '1', '2023-10-10 23:20:10', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (25, 248, '120', 3, '退单扣除', '退单获得 -700100 经验', -700100, 0, '1', '2023-10-10 23:20:16', '1', '2023-10-10 23:20:16', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (26, 248, '121', 2, '下单奖励', '下单获得 700100 经验', 700100, 700100, NULL, '2023-10-10 23:23:30', NULL, '2023-10-10 23:23:30', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (27, 248, '17', 3, '退单扣除', '退单获得 -700100 经验', -700100, 0, '1', '2023-10-10 23:23:50', '1', '2023-10-10 23:23:50', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (28, 248, '121', 3, '退单扣除', '退单获得 -700100 经验', -700100, 0, '1', '2023-10-10 23:23:55', '1', '2023-10-10 23:23:55', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (29, 248, '122', 2, '下单奖励', '下单获得 700100 经验', 700100, 700100, NULL, '2023-10-10 23:28:07', NULL, '2023-10-10 23:28:07', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (30, 248, '18', 3, '退单扣除', '退单获得 -700100 经验', -700100, 0, '1', '2023-10-10 23:29:55', '1', '2023-10-10 23:29:55', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (31, 248, '123', 2, '下单奖励', '下单获得 300 经验', 300, 300, NULL, '2023-10-10 23:44:45', NULL, '2023-10-10 23:44:45', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (32, 248, '124', 2, '下单奖励', '下单获得 560120 经验', 560120, 560420, NULL, '2023-10-11 07:03:46', NULL, '2023-10-11 07:03:46', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (33, 248, '19', 3, '退单扣除', '退单获得 -300 经验', -300, 560120, '1', '2023-10-11 07:04:28', '1', '2023-10-11 07:04:28', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (34, 248, '125', 11, '下单奖励', '下单获得 700100 经验', 700100, 700100, NULL, '2023-10-11 07:33:29', NULL, '2023-10-11 07:33:29', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (37, 248, '127', 11, '下单奖励', '下单获得 385145 经验', 385145, 385145, NULL, '2023-10-11 07:36:44', NULL, '2023-10-11 07:36:44', b'0', 1); +INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (40, 248, '120', 13, '下单奖励(单个取消)', '退款订单获得 -385145 经验', -385145, 0, '1', '2023-10-11 07:39:26', '1', '2023-10-11 07:39:26', b'0', 1); COMMIT; -- ---------------------------- @@ -835,7 +883,7 @@ CREATE TABLE `member_level_record` ( `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE, INDEX `idx_user_id`(`user_id` ASC) USING BTREE COMMENT '会员等级记录-用户编号' -) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员等级记录'; +) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员等级记录'; -- ---------------------------- -- Records of member_level_record @@ -865,7 +913,7 @@ CREATE TABLE `member_point_record` ( PRIMARY KEY (`id`) USING BTREE, INDEX `index_userId`(`user_id` ASC) USING BTREE, INDEX `index_title`(`title` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户积分记录'; +) ENGINE = InnoDB AUTO_INCREMENT = 60 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户积分记录'; -- ---------------------------- -- Records of member_point_record @@ -902,6 +950,27 @@ INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (29, 247, '96', 10, '订单奖励', '下单获得 20997 积分', 20997, 10547883, NULL, '2023-10-02 09:40:20', NULL, '2023-10-02 09:40:20', b'0', 1); INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (30, 247, '97', 10, '订单奖励', '下单获得 11548 积分', 11548, 10559431, NULL, '2023-10-02 10:21:12', NULL, '2023-10-02 10:21:12', b'0', 1); INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (31, 247, '98', 10, '订单奖励', '下单获得 11548 积分', 11548, 10570979, NULL, '2023-10-02 15:38:39', NULL, '2023-10-02 15:38:39', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (32, 247, '102', 10, '订单奖励', '下单获得 6 积分', 6, 10570985, NULL, '2023-10-05 23:05:29', NULL, '2023-10-05 23:05:29', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (33, 247, '107', 10, '订单奖励', '下单获得 6 积分', 6, 10570991, NULL, '2023-10-05 23:23:00', NULL, '2023-10-05 23:23:00', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (34, 248, '108', 10, '订单奖励', '下单获得 8 积分', 8, 8, NULL, '2023-10-06 10:13:44', NULL, '2023-10-06 10:13:44', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (35, 248, '118', 10, '订单奖励', '下单获得 6 积分', 6, 14, NULL, '2023-10-07 06:58:51', NULL, '2023-10-07 06:58:51', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (36, 248, '119', 10, '订单奖励', '下单获得 21003 积分', 21003, 21017, NULL, '2023-10-10 23:02:35', NULL, '2023-10-10 23:02:35', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (40, 248, '15', 14, '订单退款', '订单退款,扣除赠送的 -21003 积分', -21003, 2080697, '1', '2023-10-10 23:11:19', '1', '2023-10-10 23:11:19', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (41, 248, '119', 11, '订单取消', '订单取消,退还 -21003 积分', -21003, 2059694, '1', '2023-10-10 23:11:23', '1', '2023-10-10 23:11:23', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (42, 248, '120', 10, '订单奖励', '下单获得 21003 积分', 21003, 2080697, NULL, '2023-10-10 23:16:09', NULL, '2023-10-10 23:16:09', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (43, 248, '16', 14, '订单退款', '订单退款,扣除赠送的 -21003 积分', -21003, 2059694, '1', '2023-10-10 23:20:10', '1', '2023-10-10 23:20:10', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (44, 248, '120', 11, '订单取消', '订单取消,退还 -21003 积分', -21003, 2038691, '1', '2023-10-10 23:20:16', '1', '2023-10-10 23:20:16', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (45, 248, '121', 10, '订单奖励', '下单获得 21003 积分', 21003, 2059694, NULL, '2023-10-10 23:23:30', NULL, '2023-10-10 23:23:30', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (46, 248, '17', 14, '订单退款', '订单退款,扣除赠送的 -21003 积分', -21003, 2038691, '1', '2023-10-10 23:23:50', '1', '2023-10-10 23:23:50', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (47, 248, '121', 11, '订单取消', '订单取消,退还 -21003 积分', -21003, 2017688, '1', '2023-10-10 23:23:55', '1', '2023-10-10 23:23:55', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (48, 248, '122', 10, '订单奖励', '下单获得 21003 积分', 21003, 2038691, NULL, '2023-10-10 23:28:07', NULL, '2023-10-10 23:28:07', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (49, 248, '18', 14, '订单退款', '订单退款,扣除赠送的 -21003 积分', -21003, 2017688, '1', '2023-10-10 23:29:55', '1', '2023-10-10 23:29:55', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (50, 248, '123', 10, '订单奖励', '下单获得 9 积分', 9, 2017697, NULL, '2023-10-10 23:44:45', NULL, '2023-10-10 23:44:45', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (51, 248, '124', 10, '订单奖励', '下单获得 16803 积分', 16803, 2034500, NULL, '2023-10-11 07:03:46', NULL, '2023-10-11 07:03:46', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (52, 248, '19', 14, '订单退款', '订单退款,扣除赠送的 -9 积分', -9, 2034491, '1', '2023-10-11 07:04:28', '1', '2023-10-11 07:04:28', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (53, 248, '125', 21, '订单积分奖励', '下单获得 21003 积分', 21003, 21003, NULL, '2023-10-11 07:33:29', NULL, '2023-10-11 07:33:29', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (56, 248, '127', 21, '订单积分奖励', '下单获得 11554 积分', 11554, 11554, NULL, '2023-10-11 07:36:44', NULL, '2023-10-11 07:36:44', b'0', 1); +INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (59, 248, '120', 23, '订单积分奖励(单个退款)', '订单退款,扣除赠送的 -11554 积分', -11554, 0, '1', '2023-10-11 07:39:26', '1', '2023-10-11 07:39:26', b'0', 1); COMMIT; -- ---------------------------- @@ -1092,7 +1161,7 @@ CREATE TABLE `system_dict_data` ( `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1386 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典数据表'; +) ENGINE = InnoDB AUTO_INCREMENT = 1398 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典数据表'; -- ---------------------------- -- Records of system_dict_data @@ -1298,7 +1367,7 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1244, 0, '按件', '1', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:40', '1', '2023-05-21 22:46:40', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1245, 1, '按重量', '2', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:58', '1', '2023-05-21 22:46:58', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1246, 2, '按体积', '3', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:47:18', '1', '2023-05-21 22:47:18', b'0'); -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1335, 11, '订单消费', '11', 'member_point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:27', '1', '2023-08-20 11:59:47', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1335, 11, '订单积分抵扣', '11', 'member_point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:27', '1', '2023-10-11 07:41:43', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1336, 1, '签到', '1', 'member_point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:48', '1', '2023-08-20 11:59:53', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1341, 20, '已退款', '20', 'pay_order_status', 0, 'danger', '', '已退款', '1', '2023-07-19 18:05:37', '1', '2023-07-19 18:05:37', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1342, 21, '请求成功,但是结果失败', '21', 'pay_notify_status', 0, 'warning', '', '请求成功,但是结果失败', '1', '2023-07-19 18:10:47', '1', '2023-07-19 18:11:38', b'0'); @@ -1308,11 +1377,11 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1346, 1, '支付单', '1', 'pay_notify_type', 0, 'primary', '', '支付单', '1', '2023-07-20 12:23:17', '1', '2023-07-20 12:23:17', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1347, 2, '退款单', '2', 'pay_notify_type', 0, 'danger', '', NULL, '1', '2023-07-20 12:23:26', '1', '2023-07-20 12:23:26', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1348, 20, '模拟支付', 'mock', 'pay_channel_code', 0, 'default', '', '模拟支付', '1', '2023-07-29 11:10:51', '1', '2023-07-29 03:14:10', b'0'); -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1349, 12, '订单取消', '12', 'member_point_biz_type', 0, '', '', '', '1', '2023-08-20 12:00:03', '1', '2023-08-20 12:00:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1349, 12, '订单积分抵扣(整单取消)', '12', 'member_point_biz_type', 0, '', '', '', '1', '2023-08-20 12:00:03', '1', '2023-10-11 07:42:01', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1350, 0, '管理员调整', '0', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1351, 1, '邀新奖励', '1', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1352, 2, '下单奖励', '2', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1353, 3, '退单扣除', '3', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1352, 11, '下单奖励', '11', 'member_experience_biz_type', 0, 'success', '', NULL, '', '2023-08-22 12:41:01', '1', '2023-10-11 07:45:09', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1353, 12, '下单奖励(整单取消)', '12', 'member_experience_biz_type', 0, 'warning', '', NULL, '', '2023-08-22 12:41:01', '1', '2023-10-11 07:45:01', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1354, 4, '签到奖励', '4', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1355, 5, '抽奖奖励', '5', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1356, 1, '快递发货', '1', 'trade_delivery_type', 0, '', '', '', '1', '2023-08-23 00:04:55', '1', '2023-08-23 00:04:55', b'0'); @@ -1348,6 +1417,15 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1386, 1, '砍价中', '1', 'promotion_bargain_record_status', 0, 'default', '', '', '1', '2023-10-05 10:41:26', '1', '2023-10-05 10:41:26', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1387, 2, '砍价成功', '2', 'promotion_bargain_record_status', 0, 'success', '', '', '1', '2023-10-05 10:41:39', '1', '2023-10-05 10:41:39', b'0'); INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1388, 3, '砍价失败', '3', 'promotion_bargain_record_status', 0, 'warning', '', '', '1', '2023-10-05 10:41:57', '1', '2023-10-05 10:41:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1389, 1, '拼团中', '1', 'promotion_combination_record_status', 0, '', '', '', '1', '2023-10-08 07:24:44', '1', '2023-10-08 07:24:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1390, 2, '拼团成功', '2', 'promotion_combination_record_status', 0, 'success', '', '', '1', '2023-10-08 07:24:56', '1', '2023-10-08 07:24:56', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1391, 3, '拼团失败', '3', 'promotion_combination_record_status', 0, 'warning', '', '', '1', '2023-10-08 07:25:11', '1', '2023-10-08 07:25:11', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1392, 2, '管理员修改', '2', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:41:34', '1', '2023-10-11 07:41:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1393, 13, '订单积分抵扣(单个退款)', '13', 'member_point_biz_type', 0, '', '', '', '1', '2023-10-11 07:42:29', '1', '2023-10-11 07:42:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1394, 21, '订单积分奖励', '21', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:42:44', '1', '2023-10-11 07:42:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1395, 22, '订单积分奖励(整单取消)', '22', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:42:55', '1', '2023-10-11 07:43:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1396, 23, '订单积分奖励(单个退款)', '23', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:43:16', '1', '2023-10-11 07:43:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1397, 13, '下单奖励(单个退款)', '13', 'member_experience_biz_type', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); COMMIT; -- ---------------------------- @@ -1368,7 +1446,7 @@ CREATE TABLE `system_dict_type` ( `deleted_time` datetime NULL DEFAULT NULL COMMENT '删除时间', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `dict_type`(`type` ASC) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 183 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典类型表'; +) ENGINE = InnoDB AUTO_INCREMENT = 185 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典类型表'; -- ---------------------------- -- Records of system_dict_type @@ -1441,6 +1519,7 @@ INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creat INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (181, '佣金提现状态', 'brokerage_withdraw_status', 0, NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0', NULL); INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (182, '佣金提现银行', 'brokerage_bank_name', 0, NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0', NULL); INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (183, '砍价记录的状态', 'promotion_bargain_record_status', 0, '', '1', '2023-10-05 10:41:08', '1', '2023-10-05 10:41:08', b'0', '1970-01-01 00:00:00'); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (184, '拼团记录的状态', 'promotion_combination_record_status', 0, '', '1', '2023-10-08 07:24:25', '1', '2023-10-08 07:24:25', b'0', '1970-01-01 00:00:00'); COMMIT; -- ---------------------------- @@ -1489,7 +1568,7 @@ CREATE TABLE `system_login_log` ( `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2516 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录'; +) ENGINE = InnoDB AUTO_INCREMENT = 2561 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录'; -- ---------------------------- -- Records of system_login_log @@ -1619,7 +1698,7 @@ CREATE TABLE `system_menu` ( `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2366 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表'; +) ENGINE = InnoDB AUTO_INCREMENT = 2377 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表'; -- ---------------------------- -- Records of system_menu @@ -2037,7 +2116,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2306, '拼团活动创建', 'promotion:combination-activity:create', 3, 2, 2304, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-08-12 17:54:49', '1', '2023-08-12 17:54:49', b'0'); INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2307, '拼团活动更新', 'promotion:combination-activity:update', 3, 3, 2304, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-08-12 17:55:04', '1', '2023-08-12 17:55:04', b'0'); INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2308, '拼团活动删除', 'promotion:combination-activity:delete', 3, 4, 2304, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-08-12 17:55:23', '1', '2023-08-12 17:55:23', b'0'); -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2309, '秒杀活动关闭', 'promotion:combination-activity:close ', 3, 5, 2304, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-08-12 17:55:37', '1', '2023-08-12 17:55:37', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2309, '拼团活动关闭', 'promotion:combination-activity:close', 3, 5, 2304, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-08-12 17:55:37', '1', '2023-10-06 10:51:57', b'0'); INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2310, '砍价活动', '', 2, 4, 2030, 'bargain', 'ep:box', '', '', 0, b'1', b'1', b'1', '1', '2023-08-13 00:27:25', '1', '2023-08-13 00:27:25', b'0'); INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2311, '砍价商品', '', 2, 1, 2310, 'activity', 'ep:burger', 'mall/promotion/bargain/activity/index', 'PromotionBargainActivity', 0, b'1', b'1', b'1', '1', '2023-08-13 00:28:49', '1', '2023-10-05 01:16:23', b'0'); INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2312, '砍价活动查询', 'promotion:bargain-activity:query', 3, 1, 2311, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-08-13 00:32:30', '1', '2023-08-13 00:32:30', b'0'); @@ -2097,6 +2176,10 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2366, '砍价记录', '', 2, 2, 2310, 'record', 'ep:list', 'mall/promotion/bargain/record/index', 'PromotionBargainRecord', 0, b'1', b'1', b'1', '', '2023-10-05 02:49:06', '1', '2023-10-05 10:50:38', b'0'); INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2367, '砍价记录查询', 'promotion:bargain-record:query', 3, 1, 2366, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-05 02:49:06', '', '2023-10-05 02:49:06', b'0'); INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2368, '助力记录查询', 'promotion:bargain-help:query', 3, 2, 2366, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-10-05 12:27:49', '1', '2023-10-05 12:27:49', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2369, '拼团记录', 'promotion:combination-record:query', 2, 2, 2303, 'record', 'ep:avatar', 'mall/promotion/combination/record/index.vue', 'PromotionCombinationRecord', 0, b'1', b'1', b'1', '1', '2023-10-08 07:10:22', '1', '2023-10-08 07:34:11', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2374, '会员统计', '', 2, 2, 2358, 'member', 'ep:avatar', 'statistics/member/index', 'MemberStatistics', 0, b'1', b'1', b'1', '', '2023-10-11 04:39:24', '1', '2023-10-11 12:50:22', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2375, '会员统计查询', 'statistics:member:query', 3, 1, 2374, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-11 04:39:24', '', '2023-10-11 04:39:24', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2376, '订单核销', 'trade:order:pick-up', 3, 10, 2076, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-10-14 17:11:58', '1', '2023-10-14 17:11:58', b'0'); COMMIT; -- ---------------------------- @@ -2215,7 +2298,7 @@ CREATE TABLE `system_oauth2_access_token` ( `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2880 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌'; +) ENGINE = InnoDB AUTO_INCREMENT = 3022 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌'; -- ---------------------------- -- Records of system_oauth2_access_token @@ -2337,7 +2420,7 @@ CREATE TABLE `system_oauth2_refresh_token` ( `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1014 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌'; +) ENGINE = InnoDB AUTO_INCREMENT = 1049 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌'; -- ---------------------------- -- Records of system_oauth2_refresh_token @@ -2377,7 +2460,7 @@ CREATE TABLE `system_operate_log` ( `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 8643 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录'; +) ENGINE = InnoDB AUTO_INCREMENT = 8718 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录'; -- ---------------------------- -- Records of system_operate_log @@ -3385,7 +3468,7 @@ CREATE TABLE `system_sms_code` ( `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE, INDEX `idx_mobile`(`mobile` ASC) USING BTREE COMMENT '手机号' -) ENGINE = InnoDB AUTO_INCREMENT = 515 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '手机验证码'; +) ENGINE = InnoDB AUTO_INCREMENT = 531 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '手机验证码'; -- ---------------------------- -- Records of system_sms_code @@ -3428,7 +3511,7 @@ CREATE TABLE `system_sms_log` ( `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 426 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志'; +) ENGINE = InnoDB AUTO_INCREMENT = 442 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志'; -- ---------------------------- -- Records of system_sms_log @@ -3701,7 +3784,7 @@ CREATE TABLE `system_users` ( -- Records of system_users -- ---------------------------- BEGIN; -INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'admin', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '15612345678', 1, 'http://test.yudao.iocoder.cn/e1fdd7271685ec143a0900681606406621717a666ad0b2798b096df41422b32f.png', 0, '0:0:0:0:0:0:0:1', '2023-10-05 12:34:11', 'admin', '2021-01-05 17:03:47', NULL, '2023-10-05 12:34:11', b'0', 1); +INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'admin', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '15612345678', 1, 'http://test.yudao.iocoder.cn/e1fdd7271685ec143a0900681606406621717a666ad0b2798b096df41422b32f.png', 0, '0:0:0:0:0:0:0:1', '2023-10-14 17:12:19', 'admin', '2021-01-05 17:03:47', NULL, '2023-10-14 17:12:19', b'0', 1); INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (100, 'yudao', '$2a$10$11U48RhyJ5pSBYWSn12AD./ld671.ycSzJHbyrtpeoMeYiw31eo8a', '芋道', '不要吓我', 104, '[1]', 'yudao@iocoder.cn', '15601691300', 1, '', 1, '127.0.0.1', '2022-07-09 23:03:33', '', '2021-01-07 09:07:17', NULL, '2022-07-09 23:03:33', b'0', 1); INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (103, 'yuanma', '$2a$10$YMpimV4T6BtDhIaA8jSW.u8UTGBeGhc/qwXP4oxoMr4mOw9.qttt6', '源码', NULL, 106, NULL, 'yuanma@iocoder.cn', '15601701300', 0, '', 0, '127.0.0.1', '2022-07-08 01:26:27', '', '2021-01-13 23:50:35', NULL, '2022-07-08 01:26:27', b'0', 1); INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (104, 'test', '$2a$10$GP8zvqHB//TekuzYZSBYAuBQJiNq1.fxQVDYJ.uBCOnWCtDVKE4H6', '测试号', NULL, 107, '[1,2]', '111@qq.com', '15601691200', 1, '', 0, '0:0:0:0:0:0:0:1', '2023-09-24 18:21:19', '', '2021-01-21 02:13:53', NULL, '2023-09-24 18:21:19', b'0', 1); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/discount/DiscountActivityDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/discount/DiscountActivityDO.java index fd0726e39..956a223be 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/discount/DiscountActivityDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/discount/DiscountActivityDO.java @@ -33,7 +33,6 @@ public class DiscountActivityDO extends BaseDO { * 活动标题 */ private String name; - // TODO 芋艿:状态调整,只有开启和关闭; /** * 状态 * diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/discount/DiscountProductDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/discount/DiscountProductDO.java index 7f61f7f6d..fcff9a382 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/discount/DiscountProductDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/discount/DiscountProductDO.java @@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import java.time.LocalDateTime; + /** * 限时折扣商品 DO * @@ -25,7 +27,6 @@ public class DiscountProductDO extends BaseDO { @TableId private Long id; - // TODO 芋艿:把 activity 所有的字段冗余过来 /** * 限时折扣活动的编号 * @@ -33,6 +34,7 @@ public class DiscountProductDO extends BaseDO { */ private Long activityId; + /** * 商品 SPU 编号 * @@ -65,4 +67,24 @@ public class DiscountProductDO extends BaseDO { */ private Integer discountPrice; + // TODO 芋艿:这几个字段,要新增下; + /** + * 活动状态 + * + * 关联 {@link DiscountActivityDO#getStatus()} + */ + private Integer activityStatus; + /** + * 活动开始时间点 + * + * 冗余 {@link DiscountActivityDO#getStartTime()} + */ + private LocalDateTime activityStartTime; + /** + * 活动结束时间点 + * + * 冗余 {@link DiscountActivityDO#getEndTime()} + */ + private LocalDateTime activityEndTime; + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/reward/RewardActivityDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/reward/RewardActivityDO.java index a066d2f26..0c0b477ef 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/reward/RewardActivityDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/reward/RewardActivityDO.java @@ -38,7 +38,6 @@ public class RewardActivityDO extends BaseDO { * 活动标题 */ private String name; - // TODO @芋艿:改成开启、禁用两种状态 /** * 状态 * From a47ab328005727c501f06eb9f4bda189b4a2a91d Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 15 Oct 2023 01:29:30 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E8=90=A5=E9=94=80=E6=B4=BB=E5=8A=A8:=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E7=AB=A0=E5=88=86=E7=B1=BB=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/enums/DictTypeConstants.java | 10 + .../promotion/enums/ErrorCodeConstants.java | 3 + .../ArticleCategoryController.java | 111 +++++++++++ .../vo/ArticleCategoryBaseVO.java | 30 +++ .../vo/ArticleCategoryCreateReqVO.java | 14 ++ .../vo/ArticleCategoryExcelVO.java | 39 ++++ .../vo/ArticleCategoryExportReqVO.java | 25 +++ .../vo/ArticleCategoryPageReqVO.java | 30 +++ .../vo/ArticleCategoryRespVO.java | 22 +++ .../vo/ArticleCategorySimpleRespVO.java | 16 ++ .../vo/ArticleCategoryUpdateReqVO.java | 20 ++ .../ArticleCategoryConvert.java | 35 ++++ .../articlecategory/ArticleCategoryDO.java | 49 +++++ .../ArticleCategoryMapper.java | 37 ++++ .../ArticleCategoryService.java | 83 +++++++++ .../ArticleCategoryServiceImpl.java | 95 ++++++++++ .../ArticleCategoryServiceImplTest.java | 175 ++++++++++++++++++ .../src/test/resources/sql/clean.sql | 2 + .../src/test/resources/sql/create_tables.sql | 18 +- 19 files changed, 813 insertions(+), 1 deletion(-) create mode 100644 yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/DictTypeConstants.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/ArticleCategoryController.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryBaseVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryCreateReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExcelVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExportReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryPageReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryRespVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategorySimpleRespVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryUpdateReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/articlecategory/ArticleCategoryConvert.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/articlecategory/ArticleCategoryDO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/articlecategory/ArticleCategoryMapper.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryService.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImpl.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImplTest.java diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/DictTypeConstants.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/DictTypeConstants.java new file mode 100644 index 000000000..f377ca239 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/DictTypeConstants.java @@ -0,0 +1,10 @@ +package cn.iocoder.yudao.module.promotion.enums; + +/** + * promotion 字典类型的枚举类 + * + * @author HUIHUI + */ +public class DictTypeConstants { + +} diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java index dc4f0ee08..3772295b4 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java @@ -110,4 +110,7 @@ public interface ErrorCodeConstants { ErrorCode BARGAIN_HELP_CREATE_FAIL_CONFLICT = new ErrorCode(1_013_014_003, "助力失败,请重试"); ErrorCode BARGAIN_HELP_CREATE_FAIL_HELP_EXISTS = new ErrorCode(1_013_014_004, "助力失败,您已经助力过了"); + // ========== 文章分类 1-013-015-000 ========== + ErrorCode ARTICLE_CATEGORY_NOT_EXISTS = new ErrorCode(1_013_015_000, "分类不存在"); + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/ArticleCategoryController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/ArticleCategoryController.java new file mode 100644 index 000000000..0fe84a428 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/ArticleCategoryController.java @@ -0,0 +1,111 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory; + +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.*; +import cn.iocoder.yudao.module.promotion.convert.articlecategory.ArticleCategoryConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory.ArticleCategoryDO; +import cn.iocoder.yudao.module.promotion.service.articlecategory.ArticleCategoryService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Collection; +import java.util.Comparator; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +@Tag(name = "管理后台 - 文章分类") +@RestController +@RequestMapping("/promotion/article-category") +@Validated +public class ArticleCategoryController { + + @Resource + private ArticleCategoryService articleCategoryService; + + @PostMapping("/create") + @Operation(summary = "创建文章分类") + @PreAuthorize("@ss.hasPermission('promotion:article-category:create')") + public CommonResult createArticleCategory(@Valid @RequestBody ArticleCategoryCreateReqVO createReqVO) { + return success(articleCategoryService.createArticleCategory(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新文章分类") + @PreAuthorize("@ss.hasPermission('promotion:article-category:update')") + public CommonResult updateArticleCategory(@Valid @RequestBody ArticleCategoryUpdateReqVO updateReqVO) { + articleCategoryService.updateArticleCategory(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除文章分类") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('promotion:article-category:delete')") + public CommonResult deleteArticleCategory(@RequestParam("id") Long id) { + articleCategoryService.deleteArticleCategory(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得文章分类") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('promotion:article-category:query')") + public CommonResult getArticleCategory(@RequestParam("id") Long id) { + ArticleCategoryDO articleCategory = articleCategoryService.getArticleCategory(id); + return success(ArticleCategoryConvert.INSTANCE.convert(articleCategory)); + } + + @GetMapping("/list") + @Operation(summary = "获得文章分类列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('promotion:article-category:query')") + public CommonResult> getArticleCategoryList(@RequestParam("ids") Collection ids) { + List list = articleCategoryService.getArticleCategoryList(ids); + return success(ArticleCategoryConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/list-all-simple") + @Operation(summary = "获取文章分类精简信息列表", description = "只包含被开启的文章分类,主要用于前端的下拉选项") + public CommonResult> getSimpleDeptList() { + // 获得部门列表,只要开启状态的 + List list = articleCategoryService.getArticleCategoryListByStatus(CommonStatusEnum.ENABLE.getStatus()); + // 降序排序后,返回给前端 + list.sort(Comparator.comparing(ArticleCategoryDO::getSort).reversed()); + return success(ArticleCategoryConvert.INSTANCE.convertList03(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得文章分类分页") + @PreAuthorize("@ss.hasPermission('promotion:article-category:query')") + public CommonResult> getArticleCategoryPage(@Valid ArticleCategoryPageReqVO pageVO) { + PageResult pageResult = articleCategoryService.getArticleCategoryPage(pageVO); + return success(ArticleCategoryConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出文章分类 Excel") + @PreAuthorize("@ss.hasPermission('promotion:article-category:export')") + @OperateLog(type = EXPORT) + public void exportArticleCategoryExcel(@Valid ArticleCategoryExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = articleCategoryService.getArticleCategoryList(exportReqVO); + // 导出 Excel + List datas = ArticleCategoryConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "文章分类.xls", "数据", ArticleCategoryExcelVO.class, datas); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryBaseVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryBaseVO.java new file mode 100644 index 000000000..f034d2336 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryBaseVO.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * 文章分类 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class ArticleCategoryBaseVO { + + @Schema(description = "文章分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "秒杀") + @NotNull(message = "文章分类名称不能为空") + private String name; + + @Schema(description = "图标地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn") + private String picUrl; + + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态不能为空") + private Integer status; + + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "排序不能为空") + private Integer sort; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryCreateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryCreateReqVO.java new file mode 100644 index 000000000..0d0cf50b9 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - 文章分类创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ArticleCategoryCreateReqVO extends ArticleCategoryBaseVO { + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExcelVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExcelVO.java new file mode 100644 index 000000000..a341be6f9 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExcelVO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; + +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + + +/** + * 文章分类 Excel VO + * + * @author HUIHUI + */ +@Data +public class ArticleCategoryExcelVO { + + @ExcelProperty("文章分类编号") + private Long id; + + @ExcelProperty("文章分类名称") + private String name; + + @ExcelProperty("图标地址") + private String picUrl; + + @ExcelProperty(value = "状态", converter = DictConvert.class) + @DictFormat(DictTypeConstants.COMMON_STATUS) + private Integer status; + + @ExcelProperty("排序") + private Integer sort; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExportReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExportReqVO.java new file mode 100644 index 000000000..d04325e6a --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExportReqVO.java @@ -0,0 +1,25 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 文章分类 Excel 导出 Request VO,参数和 ArticleCategoryPageReqVO 是一致的") +@Data +public class ArticleCategoryExportReqVO { + + @Schema(description = "文章分类名称", example = "秒杀") + private String name; + + @Schema(description = "状态", example = "1") + private Integer status; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryPageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryPageReqVO.java new file mode 100644 index 000000000..2adf432b0 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryPageReqVO.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 文章分类分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ArticleCategoryPageReqVO extends PageParam { + + @Schema(description = "文章分类名称", example = "秒杀") + private String name; + + @Schema(description = "状态", example = "1") + private Integer status; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryRespVO.java new file mode 100644 index 000000000..85d38503f --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryRespVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 文章分类 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ArticleCategoryRespVO extends ArticleCategoryBaseVO { + + @Schema(description = "文章分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "19490") + private Long id; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategorySimpleRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategorySimpleRespVO.java new file mode 100644 index 000000000..279fe078c --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategorySimpleRespVO.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 文章分类精简信息 Response VO") +@Data +public class ArticleCategorySimpleRespVO { + + @Schema(description = "文章分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "19490") + private Long id; + + @Schema(description = "文章分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "秒杀") + private String name; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryUpdateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryUpdateReqVO.java new file mode 100644 index 000000000..d60ccdeb9 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryUpdateReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 文章分类更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ArticleCategoryUpdateReqVO extends ArticleCategoryBaseVO { + + @Schema(description = "文章分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "19490") + @NotNull(message = "文章分类编号不能为空") + private Long id; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/articlecategory/ArticleCategoryConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/articlecategory/ArticleCategoryConvert.java new file mode 100644 index 000000000..5c68b12e3 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/articlecategory/ArticleCategoryConvert.java @@ -0,0 +1,35 @@ +package cn.iocoder.yudao.module.promotion.convert.articlecategory; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.*; +import cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory.ArticleCategoryDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 文章分类 Convert + * + * @author HUIHUI + */ +@Mapper +public interface ArticleCategoryConvert { + + ArticleCategoryConvert INSTANCE = Mappers.getMapper(ArticleCategoryConvert.class); + + ArticleCategoryDO convert(ArticleCategoryCreateReqVO bean); + + ArticleCategoryDO convert(ArticleCategoryUpdateReqVO bean); + + ArticleCategoryRespVO convert(ArticleCategoryDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + + List convertList03(List list); + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/articlecategory/ArticleCategoryDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/articlecategory/ArticleCategoryDO.java new file mode 100644 index 000000000..b0bd063a5 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/articlecategory/ArticleCategoryDO.java @@ -0,0 +1,49 @@ +package cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory; + +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 文章分类 DO + * + * @author HUIHUI + */ +@TableName("promotion_article_category") +@KeySequence("promotion_article_category_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ArticleCategoryDO extends BaseDO { + + /** + * 文章分类编号 + */ + @TableId + private Long id; + /** + * 文章分类名称 + */ + private String name; + /** + * 图标地址 + */ + private String picUrl; + /** + * 状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + /** + * 排序 + */ + private Integer sort; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/articlecategory/ArticleCategoryMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/articlecategory/ArticleCategoryMapper.java new file mode 100644 index 000000000..91e8e763d --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/articlecategory/ArticleCategoryMapper.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.promotion.dal.mysql.articlecategory; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryPageReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory.ArticleCategoryDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 文章分类 Mapper + * + * @author HUIHUI + */ +@Mapper +public interface ArticleCategoryMapper extends BaseMapperX { + + default PageResult selectPage(ArticleCategoryPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(ArticleCategoryDO::getName, reqVO.getName()) + .eqIfPresent(ArticleCategoryDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(ArticleCategoryDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ArticleCategoryDO::getSort)); + } + + default List selectList(ArticleCategoryExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(ArticleCategoryDO::getName, reqVO.getName()) + .eqIfPresent(ArticleCategoryDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(ArticleCategoryDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ArticleCategoryDO::getSort)); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryService.java new file mode 100644 index 000000000..697a10aff --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryService.java @@ -0,0 +1,83 @@ +package cn.iocoder.yudao.module.promotion.service.articlecategory; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryPageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory.ArticleCategoryDO; + +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + +/** + * 文章分类 Service 接口 + * + * @author HUIHUI + */ +public interface ArticleCategoryService { + + /** + * 创建文章分类 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createArticleCategory(@Valid ArticleCategoryCreateReqVO createReqVO); + + /** + * 更新文章分类 + * + * @param updateReqVO 更新信息 + */ + void updateArticleCategory(@Valid ArticleCategoryUpdateReqVO updateReqVO); + + /** + * 删除文章分类 + * + * @param id 编号 + */ + void deleteArticleCategory(Long id); + + /** + * 获得文章分类 + * + * @param id 编号 + * @return 文章分类 + */ + ArticleCategoryDO getArticleCategory(Long id); + + /** + * 获得文章分类列表 + * + * @param ids 编号 + * @return 文章分类列表 + */ + List getArticleCategoryList(Collection ids); + + /** + * 获得文章分类分页 + * + * @param pageReqVO 分页查询 + * @return 文章分类分页 + */ + PageResult getArticleCategoryPage(ArticleCategoryPageReqVO pageReqVO); + + /** + * 获得文章分类列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 文章分类列表 + */ + List getArticleCategoryList(ArticleCategoryExportReqVO exportReqVO); + + /** + * 获得指定状态的文章分类列表 + * + * @param status 状态 + * @return 文章分类列表 + */ + List getArticleCategoryListByStatus(Integer status); + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImpl.java new file mode 100644 index 000000000..28d5d6f87 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImpl.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.promotion.service.articlecategory; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryPageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryUpdateReqVO; +import cn.iocoder.yudao.module.promotion.convert.articlecategory.ArticleCategoryConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory.ArticleCategoryDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.articlecategory.ArticleCategoryMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_CATEGORY_NOT_EXISTS; + +/** + * 文章分类 Service 实现类 + * + * @author HUIHUI + */ +@Service +@Validated +public class ArticleCategoryServiceImpl implements ArticleCategoryService { + + @Resource + private ArticleCategoryMapper articleCategoryMapper; + + @Override + public Long createArticleCategory(ArticleCategoryCreateReqVO createReqVO) { + // 插入 + ArticleCategoryDO articleCategory = ArticleCategoryConvert.INSTANCE.convert(createReqVO); + articleCategoryMapper.insert(articleCategory); + // 返回 + return articleCategory.getId(); + } + + @Override + public void updateArticleCategory(ArticleCategoryUpdateReqVO updateReqVO) { + // 校验存在 + validateArticleCategoryExists(updateReqVO.getId()); + // 更新 + ArticleCategoryDO updateObj = ArticleCategoryConvert.INSTANCE.convert(updateReqVO); + articleCategoryMapper.updateById(updateObj); + } + + @Override + public void deleteArticleCategory(Long id) { + // 校验存在 + validateArticleCategoryExists(id); + // 删除 + articleCategoryMapper.deleteById(id); + } + + private void validateArticleCategoryExists(Long id) { + if (articleCategoryMapper.selectById(id) == null) { + throw exception(ARTICLE_CATEGORY_NOT_EXISTS); + } + } + + @Override + public ArticleCategoryDO getArticleCategory(Long id) { + return articleCategoryMapper.selectById(id); + } + + @Override + public List getArticleCategoryList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return ListUtil.empty(); + } + return articleCategoryMapper.selectBatchIds(ids); + } + + @Override + public PageResult getArticleCategoryPage(ArticleCategoryPageReqVO pageReqVO) { + return articleCategoryMapper.selectPage(pageReqVO); + } + + @Override + public List getArticleCategoryList(ArticleCategoryExportReqVO exportReqVO) { + return articleCategoryMapper.selectList(exportReqVO); + } + + @Override + public List getArticleCategoryListByStatus(Integer status) { + return articleCategoryMapper.selectList(ArticleCategoryDO::getStatus, status); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImplTest.java new file mode 100644 index 000000000..6edbf15ba --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImplTest.java @@ -0,0 +1,175 @@ +package cn.iocoder.yudao.module.promotion.service.articlecategory; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryPageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory.ArticleCategoryDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.articlecategory.ArticleCategoryMapper; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.Import; + +import javax.annotation.Resource; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_CATEGORY_NOT_EXISTS; +import static org.junit.jupiter.api.Assertions.*; + +/** + * {@link ArticleCategoryServiceImpl} 的单元测试类 + * + * @author HUIHUI + */ +@Import(ArticleCategoryServiceImpl.class) +public class ArticleCategoryServiceImplTest extends BaseDbUnitTest { + + @Resource + private ArticleCategoryServiceImpl articleCategoryService; + + @Resource + private ArticleCategoryMapper articleCategoryMapper; + + @Test + public void testCreateArticleCategory_success() { + // 准备参数 + ArticleCategoryCreateReqVO reqVO = randomPojo(ArticleCategoryCreateReqVO.class); + + // 调用 + Long articleCategoryId = articleCategoryService.createArticleCategory(reqVO); + // 断言 + assertNotNull(articleCategoryId); + // 校验记录的属性是否正确 + ArticleCategoryDO articleCategory = articleCategoryMapper.selectById(articleCategoryId); + assertPojoEquals(reqVO, articleCategory); + } + + @Test + public void testUpdateArticleCategory_success() { + // mock 数据 + ArticleCategoryDO dbArticleCategory = randomPojo(ArticleCategoryDO.class); + articleCategoryMapper.insert(dbArticleCategory);// @Sql: 先插入出一条存在的数据 + // 准备参数 + ArticleCategoryUpdateReqVO reqVO = randomPojo(ArticleCategoryUpdateReqVO.class, o -> { + o.setId(dbArticleCategory.getId()); // 设置更新的 ID + }); + + // 调用 + articleCategoryService.updateArticleCategory(reqVO); + // 校验是否更新正确 + ArticleCategoryDO articleCategory = articleCategoryMapper.selectById(reqVO.getId()); // 获取最新的 + assertPojoEquals(reqVO, articleCategory); + } + + @Test + public void testUpdateArticleCategory_notExists() { + // 准备参数 + ArticleCategoryUpdateReqVO reqVO = randomPojo(ArticleCategoryUpdateReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> articleCategoryService.updateArticleCategory(reqVO), ARTICLE_CATEGORY_NOT_EXISTS); + } + + @Test + public void testDeleteArticleCategory_success() { + // mock 数据 + ArticleCategoryDO dbArticleCategory = randomPojo(ArticleCategoryDO.class); + articleCategoryMapper.insert(dbArticleCategory);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbArticleCategory.getId(); + + // 调用 + articleCategoryService.deleteArticleCategory(id); + // 校验数据不存在了 + assertNull(articleCategoryMapper.selectById(id)); + } + + @Test + public void testDeleteArticleCategory_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> articleCategoryService.deleteArticleCategory(id), ARTICLE_CATEGORY_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetArticleCategoryPage() { + // mock 数据 + ArticleCategoryDO dbArticleCategory = randomPojo(ArticleCategoryDO.class, o -> { // 等会查询到 + o.setName(null); + o.setPicUrl(null); + o.setStatus(null); + o.setSort(null); + o.setCreateTime(null); + }); + articleCategoryMapper.insert(dbArticleCategory); + // 测试 name 不匹配 + articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setName(null))); + // 测试 picUrl 不匹配 + articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setPicUrl(null))); + // 测试 status 不匹配 + articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setStatus(null))); + // 测试 sort 不匹配 + articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setSort(null))); + // 测试 createTime 不匹配 + articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setCreateTime(null))); + // 准备参数 + ArticleCategoryPageReqVO reqVO = new ArticleCategoryPageReqVO(); + reqVO.setName(null); + reqVO.setStatus(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + + // 调用 + PageResult pageResult = articleCategoryService.getArticleCategoryPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbArticleCategory, pageResult.getList().get(0)); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetArticleCategoryList() { + // mock 数据 + ArticleCategoryDO dbArticleCategory = randomPojo(ArticleCategoryDO.class, o -> { // 等会查询到 + o.setName(null); + o.setPicUrl(null); + o.setStatus(null); + o.setSort(null); + o.setCreateTime(null); + }); + articleCategoryMapper.insert(dbArticleCategory); + // 测试 name 不匹配 + articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setName(null))); + // 测试 picUrl 不匹配 + articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setPicUrl(null))); + // 测试 status 不匹配 + articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setStatus(null))); + // 测试 sort 不匹配 + articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setSort(null))); + // 测试 createTime 不匹配 + articleCategoryMapper.insert(cloneIgnoreId(dbArticleCategory, o -> o.setCreateTime(null))); + // 准备参数 + ArticleCategoryExportReqVO reqVO = new ArticleCategoryExportReqVO(); + reqVO.setName(null); + reqVO.setStatus(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + + // 调用 + List list = articleCategoryService.getArticleCategoryList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbArticleCategory, list.get(0)); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql index 7f3ace7b6..0c563c2e6 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql @@ -6,3 +6,5 @@ DELETE FROM "promotion_discount_activity"; DELETE FROM "promotion_discount_product"; DELETE FROM "promotion_seckill_config"; DELETE FROM "promotion_combination_activity"; +DELETE +FROM "promotion_article_category"; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql index c7a3b56da..1cc09dfca 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql @@ -180,4 +180,20 @@ CREATE TABLE IF NOT EXISTS "promotion_combination_activity" "deleted" bit NOT NULL DEFAULT FALSE, "tenant_id" bigint NOT NULL, PRIMARY KEY ("id") -) COMMENT '拼团活动'; \ No newline at end of file +) COMMENT '拼团活动'; + +CREATE TABLE IF NOT EXISTS "promotion_article_category" +( + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, + "name" varchar NOT NULL, + "pic_url" varchar, + "status" int NOT NULL, + "sort" int NOT NULL, + "creator" varchar DEFAULT '', + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updater" varchar DEFAULT '', + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + "deleted" bit NOT NULL DEFAULT FALSE, + "tenant_id" bigint NOT NULL, + PRIMARY KEY ("id") +) COMMENT '文章分类表'; \ No newline at end of file From 55eed1377af431143be12dd0de0bc7a1577cde78 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 15 Oct 2023 16:16:41 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E8=90=A5=E9=94=80=E6=B4=BB=E5=8A=A8:=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E7=AB=A0=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/spu/ProductSpuController.java | 8 +- .../service/spu/ProductSpuService.java | 6 +- .../service/spu/ProductSpuServiceImpl.java | 4 +- .../promotion/enums/ErrorCodeConstants.java | 3 + .../admin/article/ArticleController.java | 99 ++++++++ .../admin/article/vo/ArticleBaseVO.java | 60 +++++ .../admin/article/vo/ArticleCreateReqVO.java | 14 ++ .../admin/article/vo/ArticleExcelVO.java | 63 +++++ .../admin/article/vo/ArticleExportReqVO.java | 40 +++ .../admin/article/vo/ArticlePageReqVO.java | 45 ++++ .../admin/article/vo/ArticleRespVO.java | 22 ++ .../admin/article/vo/ArticleUpdateReqVO.java | 20 ++ .../convert/article/ArticleConvert.java | 36 +++ .../dal/dataobject/article/ArticleDO.java | 81 ++++++ .../dal/mysql/article/ArticleMapper.java | 47 ++++ .../service/article/ArticleService.java | 75 ++++++ .../service/article/ArticleServiceImpl.java | 90 +++++++ .../article/ArticleServiceImplTest.java | 233 ++++++++++++++++++ .../src/test/resources/sql/clean.sql | 2 + .../src/test/resources/sql/create_tables.sql | 26 +- .../src/main/resources/application-local.yaml | 8 +- 21 files changed, 971 insertions(+), 11 deletions(-) create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleController.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleBaseVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleCreateReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExcelVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExportReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticlePageReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleRespVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleUpdateReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleConvert.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/article/ArticleDO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleMapper.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleService.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImpl.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImplTest.java diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java index e1c70f01c..7f88dd8c6 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java @@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; +import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; import io.swagger.v3.oas.annotations.Operation; @@ -22,6 +23,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.util.Collection; +import java.util.Comparator; import java.util.List; import java.util.Map; @@ -88,11 +90,13 @@ public class ProductSpuController { return success(ProductSpuConvert.INSTANCE.convertForSpuDetailRespVO(spu, skus)); } - @GetMapping("/get-simple-list") + @GetMapping("/list-all-simple") @Operation(summary = "获得商品 SPU 精简列表") @PreAuthorize("@ss.hasPermission('product:spu:query')") public CommonResult> getSpuSimpleList() { - List list = productSpuService.getSpuList(); + List list = productSpuService.getSpuListByStatus(ProductSpuStatusEnum.ENABLE.getStatus()); + // 降序排序后,返回给前端 + list.sort(Comparator.comparing(ProductSpuDO::getSort).reversed()); return success(ProductSpuConvert.INSTANCE.convertList02(list)); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java index 25cf853a2..68232e0f2 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java @@ -68,11 +68,12 @@ public interface ProductSpuService { } /** - * 获得所有商品 SPU 列表 + * 获得指定状态的商品 SPU 列表 * + * @param status 状态 * @return 商品 SPU 列表 */ - List getSpuList(); + List getSpuListByStatus(Integer status); /** * 获得所有商品 SPU 列表 @@ -146,4 +147,5 @@ public interface ProductSpuService { * @return 商品 SPU 列表 */ List validateSpuList(Collection ids); + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java index 4c3f238dc..521a5fefe 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java @@ -196,8 +196,8 @@ public class ProductSpuServiceImpl implements ProductSpuService { } @Override - public List getSpuList() { - return productSpuMapper.selectList(); + public List getSpuListByStatus(Integer status) { + return productSpuMapper.selectList(ProductSpuDO::getStatus, status); } @Override diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java index 3772295b4..99c5a17e7 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java @@ -113,4 +113,7 @@ public interface ErrorCodeConstants { // ========== 文章分类 1-013-015-000 ========== ErrorCode ARTICLE_CATEGORY_NOT_EXISTS = new ErrorCode(1_013_015_000, "分类不存在"); + // ========== 文章管理 1-013-016-000 ========== + ErrorCode ARTICLE_NOT_EXISTS = new ErrorCode(1_013_016_000, "文章管理不存在"); + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleController.java new file mode 100644 index 000000000..7d6e99c87 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleController.java @@ -0,0 +1,99 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.article; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.*; +import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; +import cn.iocoder.yudao.module.promotion.service.article.ArticleService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +@Tag(name = "管理后台 - 文章管理") +@RestController +@RequestMapping("/promotion/article") +@Validated +public class ArticleController { + + @Resource + private ArticleService articleService; + + @PostMapping("/create") + @Operation(summary = "创建文章管理") + @PreAuthorize("@ss.hasPermission('promotion:article:create')") + public CommonResult createArticle(@Valid @RequestBody ArticleCreateReqVO createReqVO) { + return success(articleService.createArticle(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新文章管理") + @PreAuthorize("@ss.hasPermission('promotion:article:update')") + public CommonResult updateArticle(@Valid @RequestBody ArticleUpdateReqVO updateReqVO) { + articleService.updateArticle(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除文章管理") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('promotion:article:delete')") + public CommonResult deleteArticle(@RequestParam("id") Long id) { + articleService.deleteArticle(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得文章管理") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('promotion:article:query')") + public CommonResult getArticle(@RequestParam("id") Long id) { + ArticleDO article = articleService.getArticle(id); + return success(ArticleConvert.INSTANCE.convert(article)); + } + + @GetMapping("/list") + @Operation(summary = "获得文章管理列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('promotion:article:query')") + public CommonResult> getArticleList(@RequestParam("ids") Collection ids) { + List list = articleService.getArticleList(ids); + return success(ArticleConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得文章管理分页") + @PreAuthorize("@ss.hasPermission('promotion:article:query')") + public CommonResult> getArticlePage(@Valid ArticlePageReqVO pageVO) { + PageResult pageResult = articleService.getArticlePage(pageVO); + return success(ArticleConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出文章管理 Excel") + @PreAuthorize("@ss.hasPermission('promotion:article:export')") + @OperateLog(type = EXPORT) + public void exportArticleExcel(@Valid ArticleExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = articleService.getArticleList(exportReqVO); + // 导出 Excel + List datas = ArticleConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "文章管理.xls", "数据", ArticleExcelVO.class, datas); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleBaseVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleBaseVO.java new file mode 100644 index 000000000..1a1f2bdd8 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleBaseVO.java @@ -0,0 +1,60 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * 文章管理 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class ArticleBaseVO { + + @Schema(description = "文章分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15458") + @NotNull(message = "文章分类编号不能为空") + private Long categoryId; + + @Schema(description = "关联商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22378") + @NotNull(message = "关联商品不能为空") + private Long spuId; + + @Schema(description = "文章标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "这是一个标题") + @NotNull(message = "文章标题不能为空") + private String title; + + @Schema(description = "文章作者", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") + private String author; + + @Schema(description = "文章封面图片地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn") + @NotNull(message = "文章封面图片地址不能为空") + private String picUrl; + + @Schema(description = "文章简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "这是一个简介") + private String introduction; + + @Schema(description = "浏览次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") + private String browseCount; + + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "排序不能为空") + private Integer sort; + + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "状态不能为空") + private Integer status; + + @Schema(description = "是否热门(小程序)", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + @NotNull(message = "是否热门(小程序)不能为空") + private Boolean recommendHot; + + @Schema(description = "是否轮播图(小程序)", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + @NotNull(message = "是否轮播图(小程序)不能为空") + private Boolean recommendBanner; + + @Schema(description = "文章内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "这是文章内容") + @NotNull(message = "文章内容不能为空") + private String content; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleCreateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleCreateReqVO.java new file mode 100644 index 000000000..6de506fbe --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - 文章管理创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ArticleCreateReqVO extends ArticleBaseVO { + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExcelVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExcelVO.java new file mode 100644 index 000000000..cc9523a4c --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExcelVO.java @@ -0,0 +1,63 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; + +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + + +/** + * 文章管理 Excel VO + * + * @author HUIHUI + */ +@Data +public class ArticleExcelVO { + + @ExcelProperty("文章编号") + private Long id; + + @ExcelProperty("文章分类编号") + private Long categoryId; + + @ExcelProperty("关联商品编号") + private Long spuId; + + @ExcelProperty("文章标题") + private String title; + + @ExcelProperty("文章作者") + private String author; + + @ExcelProperty("文章封面图片地址") + private String picUrl; + + @ExcelProperty("文章简介") + private String introduction; + + @ExcelProperty("浏览次数") + private String browseCount; + + @ExcelProperty("排序") + private Integer sort; + + @ExcelProperty(value = "状态", converter = DictConvert.class) + @DictFormat(DictTypeConstants.COMMON_STATUS) + private Integer status; + + @ExcelProperty("是否热门(小程序)") + private Boolean recommendHot; + + @ExcelProperty("是否轮播图(小程序)") + private Boolean recommendBanner; + + @ExcelProperty("文章内容") + private String content; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExportReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExportReqVO.java new file mode 100644 index 000000000..7c8e50049 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleExportReqVO.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 文章管理 Excel 导出 Request VO,参数和 ArticlePageReqVO 是一致的") +@Data +public class ArticleExportReqVO { + + @Schema(description = "文章分类编号", example = "15458") + private Long categoryId; + + @Schema(description = "关联商品编号", example = "22378") + private Long spuId; + + @Schema(description = "文章标题") + private String title; + + @Schema(description = "文章作者") + private String author; + + @Schema(description = "状态", example = "2") + private Integer status; + + @Schema(description = "是否热门(小程序)") + private Boolean recommendHot; + + @Schema(description = "是否轮播图(小程序)") + private Boolean recommendBanner; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticlePageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticlePageReqVO.java new file mode 100644 index 000000000..4dbd806c6 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticlePageReqVO.java @@ -0,0 +1,45 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 文章管理分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ArticlePageReqVO extends PageParam { + + @Schema(description = "文章分类编号", example = "15458") + private Long categoryId; + + @Schema(description = "关联商品编号", example = "22378") + private Long spuId; + + @Schema(description = "文章标题") + private String title; + + @Schema(description = "文章作者") + private String author; + + @Schema(description = "状态", example = "2") + private Integer status; + + @Schema(description = "是否热门(小程序)") + private Boolean recommendHot; + + @Schema(description = "是否轮播图(小程序)") + private Boolean recommendBanner; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleRespVO.java new file mode 100644 index 000000000..58653af2f --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleRespVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 文章管理 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ArticleRespVO extends ArticleBaseVO { + + @Schema(description = "文章编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8606") + private Long id; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleUpdateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleUpdateReqVO.java new file mode 100644 index 000000000..c50d5e996 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/ArticleUpdateReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 文章管理更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ArticleUpdateReqVO extends ArticleBaseVO { + + @Schema(description = "文章编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8606") + @NotNull(message = "文章编号不能为空") + private Long id; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleConvert.java new file mode 100644 index 000000000..6fb1cf850 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleConvert.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.module.promotion.convert.article; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExcelVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleRespVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 文章管理 Convert + * + * @author HUIHUI + */ +@Mapper +public interface ArticleConvert { + + ArticleConvert INSTANCE = Mappers.getMapper(ArticleConvert.class); + + ArticleDO convert(ArticleCreateReqVO bean); + + ArticleDO convert(ArticleUpdateReqVO bean); + + ArticleRespVO convert(ArticleDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/article/ArticleDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/article/ArticleDO.java new file mode 100644 index 000000000..078bde94f --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/article/ArticleDO.java @@ -0,0 +1,81 @@ +package cn.iocoder.yudao.module.promotion.dal.dataobject.article; + +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 文章管理 DO + * + * @author HUIHUI + */ +@TableName("promotion_article") +@KeySequence("promotion_article_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ArticleDO extends BaseDO { + + /** + * 文章管理编号 + */ + @TableId + private Long id; + /** + * 分类编号 ArticleCategoryDO#id + */ + private Long categoryId; + /** + * 关联商品编号 ProductSpuDO#id + */ + private Long spuId; + /** + * 文章标题 + */ + private String title; + /** + * 文章作者 + */ + private String author; + /** + * 文章封面图片地址 + */ + private String picUrl; + /** + * 文章简介 + */ + private String introduction; + /** + * 浏览次数 + */ + private String browseCount; + /** + * 排序 + */ + private Integer sort; + /** + * 状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + /** + * 是否热门(小程序) + */ + private Boolean recommendHot; + /** + * 是否轮播图(小程序) + */ + private Boolean recommendBanner; + /** + * 文章内容 + */ + private String content; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleMapper.java new file mode 100644 index 000000000..778c85f7b --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleMapper.java @@ -0,0 +1,47 @@ +package cn.iocoder.yudao.module.promotion.dal.mysql.article; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 文章管理 Mapper + * + * @author HUIHUI + */ +@Mapper +public interface ArticleMapper extends BaseMapperX { + + default PageResult selectPage(ArticlePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ArticleDO::getCategoryId, reqVO.getCategoryId()) + .eqIfPresent(ArticleDO::getTitle, reqVO.getTitle()) + .eqIfPresent(ArticleDO::getAuthor, reqVO.getAuthor()) + .eqIfPresent(ArticleDO::getStatus, reqVO.getStatus()) + .eqIfPresent(ArticleDO::getSpuId, reqVO.getSpuId()) + .eqIfPresent(ArticleDO::getRecommendHot, reqVO.getRecommendHot()) + .eqIfPresent(ArticleDO::getRecommendBanner, reqVO.getRecommendBanner()) + .betweenIfPresent(ArticleDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ArticleDO::getId)); + } + + default List selectList(ArticleExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(ArticleDO::getCategoryId, reqVO.getCategoryId()) + .eqIfPresent(ArticleDO::getTitle, reqVO.getTitle()) + .eqIfPresent(ArticleDO::getAuthor, reqVO.getAuthor()) + .eqIfPresent(ArticleDO::getStatus, reqVO.getStatus()) + .eqIfPresent(ArticleDO::getSpuId, reqVO.getSpuId()) + .eqIfPresent(ArticleDO::getRecommendHot, reqVO.getRecommendHot()) + .eqIfPresent(ArticleDO::getRecommendBanner, reqVO.getRecommendBanner()) + .betweenIfPresent(ArticleDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ArticleDO::getId)); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleService.java new file mode 100644 index 000000000..2828dad2c --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleService.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.promotion.service.article; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; + +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + +/** + * 文章管理 Service 接口 + * + * @author HUIHUI + */ +public interface ArticleService { + + /** + * 创建文章管理 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createArticle(@Valid ArticleCreateReqVO createReqVO); + + /** + * 更新文章管理 + * + * @param updateReqVO 更新信息 + */ + void updateArticle(@Valid ArticleUpdateReqVO updateReqVO); + + /** + * 删除文章管理 + * + * @param id 编号 + */ + void deleteArticle(Long id); + + /** + * 获得文章管理 + * + * @param id 编号 + * @return 文章管理 + */ + ArticleDO getArticle(Long id); + + /** + * 获得文章管理列表 + * + * @param ids 编号 + * @return 文章管理列表 + */ + List getArticleList(Collection ids); + + /** + * 获得文章管理分页 + * + * @param pageReqVO 分页查询 + * @return 文章管理分页 + */ + PageResult getArticlePage(ArticlePageReqVO pageReqVO); + + /** + * 获得文章管理列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 文章管理列表 + */ + List getArticleList(ArticleExportReqVO exportReqVO); + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImpl.java new file mode 100644 index 000000000..82cf3f38b --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImpl.java @@ -0,0 +1,90 @@ +package cn.iocoder.yudao.module.promotion.service.article; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO; +import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_NOT_EXISTS; + +/** + * 文章管理 Service 实现类 + * + * @author HUIHUI + */ +@Service +@Validated +public class ArticleServiceImpl implements ArticleService { + + @Resource + private ArticleMapper articleMapper; + + @Override + public Long createArticle(ArticleCreateReqVO createReqVO) { + // 插入 + ArticleDO article = ArticleConvert.INSTANCE.convert(createReqVO); + articleMapper.insert(article); + // 返回 + return article.getId(); + } + + @Override + public void updateArticle(ArticleUpdateReqVO updateReqVO) { + // 校验存在 + validateArticleExists(updateReqVO.getId()); + // 更新 + ArticleDO updateObj = ArticleConvert.INSTANCE.convert(updateReqVO); + articleMapper.updateById(updateObj); + } + + @Override + public void deleteArticle(Long id) { + // 校验存在 + validateArticleExists(id); + // 删除 + articleMapper.deleteById(id); + } + + private void validateArticleExists(Long id) { + if (articleMapper.selectById(id) == null) { + throw exception(ARTICLE_NOT_EXISTS); + } + } + + @Override + public ArticleDO getArticle(Long id) { + return articleMapper.selectById(id); + } + + @Override + public List getArticleList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return ListUtil.empty(); + } + return articleMapper.selectBatchIds(ids); + } + + @Override + public PageResult getArticlePage(ArticlePageReqVO pageReqVO) { + return articleMapper.selectPage(pageReqVO); + } + + @Override + public List getArticleList(ArticleExportReqVO exportReqVO) { + return articleMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImplTest.java new file mode 100644 index 000000000..d47c54453 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImplTest.java @@ -0,0 +1,233 @@ +package cn.iocoder.yudao.module.promotion.service.article; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticlePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.Import; + +import javax.annotation.Resource; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_NOT_EXISTS; +import static org.junit.jupiter.api.Assertions.*; + +/** + * {@link ArticleServiceImpl} 的单元测试类 + * + * @author HUIHUI + */ +@Import(ArticleServiceImpl.class) +public class ArticleServiceImplTest extends BaseDbUnitTest { + + @Resource + private ArticleServiceImpl articleService; + + @Resource + private ArticleMapper articleMapper; + + @Test + public void testCreateArticle_success() { + // 准备参数 + ArticleCreateReqVO reqVO = randomPojo(ArticleCreateReqVO.class); + + // 调用 + Long articleId = articleService.createArticle(reqVO); + // 断言 + assertNotNull(articleId); + // 校验记录的属性是否正确 + ArticleDO article = articleMapper.selectById(articleId); + assertPojoEquals(reqVO, article); + } + + @Test + public void testUpdateArticle_success() { + // mock 数据 + ArticleDO dbArticle = randomPojo(ArticleDO.class); + articleMapper.insert(dbArticle);// @Sql: 先插入出一条存在的数据 + // 准备参数 + ArticleUpdateReqVO reqVO = randomPojo(ArticleUpdateReqVO.class, o -> { + o.setId(dbArticle.getId()); // 设置更新的 ID + }); + + // 调用 + articleService.updateArticle(reqVO); + // 校验是否更新正确 + ArticleDO article = articleMapper.selectById(reqVO.getId()); // 获取最新的 + assertPojoEquals(reqVO, article); + } + + @Test + public void testUpdateArticle_notExists() { + // 准备参数 + ArticleUpdateReqVO reqVO = randomPojo(ArticleUpdateReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> articleService.updateArticle(reqVO), ARTICLE_NOT_EXISTS); + } + + @Test + public void testDeleteArticle_success() { + // mock 数据 + ArticleDO dbArticle = randomPojo(ArticleDO.class); + articleMapper.insert(dbArticle);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbArticle.getId(); + + // 调用 + articleService.deleteArticle(id); + // 校验数据不存在了 + assertNull(articleMapper.selectById(id)); + } + + @Test + public void testDeleteArticle_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> articleService.deleteArticle(id), ARTICLE_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetArticlePage() { + // mock 数据 + ArticleDO dbArticle = randomPojo(ArticleDO.class, o -> { // 等会查询到 + o.setCategoryId(null); + o.setTitle(null); + o.setAuthor(null); + o.setPicUrl(null); + o.setIntroduction(null); + o.setBrowseCount(null); + o.setSort(null); + o.setStatus(null); + o.setSpuId(null); + o.setRecommendHot(null); + o.setRecommendBanner(null); + o.setContent(null); + o.setCreateTime(null); + }); + articleMapper.insert(dbArticle); + // 测试 categoryId 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setCategoryId(null))); + // 测试 title 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setTitle(null))); + // 测试 author 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setAuthor(null))); + // 测试 picUrl 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setPicUrl(null))); + // 测试 introduction 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setIntroduction(null))); + // 测试 browseCount 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setBrowseCount(null))); + // 测试 sort 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setSort(null))); + // 测试 status 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setStatus(null))); + // 测试 spuId 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setSpuId(null))); + // 测试 recommendHot 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setRecommendHot(null))); + // 测试 recommendBanner 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setRecommendBanner(null))); + // 测试 content 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setContent(null))); + // 测试 createTime 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setCreateTime(null))); + // 准备参数 + ArticlePageReqVO reqVO = new ArticlePageReqVO(); + reqVO.setCategoryId(null); + reqVO.setTitle(null); + reqVO.setAuthor(null); + reqVO.setStatus(null); + reqVO.setSpuId(null); + reqVO.setRecommendHot(null); + reqVO.setRecommendBanner(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + + // 调用 + PageResult pageResult = articleService.getArticlePage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbArticle, pageResult.getList().get(0)); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetArticleList() { + // mock 数据 + ArticleDO dbArticle = randomPojo(ArticleDO.class, o -> { // 等会查询到 + o.setCategoryId(null); + o.setTitle(null); + o.setAuthor(null); + o.setPicUrl(null); + o.setIntroduction(null); + o.setBrowseCount(null); + o.setSort(null); + o.setStatus(null); + o.setSpuId(null); + o.setRecommendHot(null); + o.setRecommendBanner(null); + o.setContent(null); + o.setCreateTime(null); + }); + articleMapper.insert(dbArticle); + // 测试 categoryId 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setCategoryId(null))); + // 测试 title 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setTitle(null))); + // 测试 author 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setAuthor(null))); + // 测试 picUrl 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setPicUrl(null))); + // 测试 introduction 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setIntroduction(null))); + // 测试 browseCount 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setBrowseCount(null))); + // 测试 sort 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setSort(null))); + // 测试 status 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setStatus(null))); + // 测试 spuId 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setSpuId(null))); + // 测试 recommendHot 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setRecommendHot(null))); + // 测试 recommendBanner 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setRecommendBanner(null))); + // 测试 content 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setContent(null))); + // 测试 createTime 不匹配 + articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setCreateTime(null))); + // 准备参数 + ArticleExportReqVO reqVO = new ArticleExportReqVO(); + reqVO.setCategoryId(null); + reqVO.setTitle(null); + reqVO.setAuthor(null); + reqVO.setStatus(null); + reqVO.setSpuId(null); + reqVO.setRecommendHot(null); + reqVO.setRecommendBanner(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + + // 调用 + List list = articleService.getArticleList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbArticle, list.get(0)); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql index 0c563c2e6..5e02a9f04 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql @@ -8,3 +8,5 @@ DELETE FROM "promotion_seckill_config"; DELETE FROM "promotion_combination_activity"; DELETE FROM "promotion_article_category"; +DELETE +FROM "promotion_article"; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql index 1cc09dfca..a60f6c9e7 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql @@ -196,4 +196,28 @@ CREATE TABLE IF NOT EXISTS "promotion_article_category" "deleted" bit NOT NULL DEFAULT FALSE, "tenant_id" bigint NOT NULL, PRIMARY KEY ("id") -) COMMENT '文章分类表'; \ No newline at end of file +) COMMENT '文章分类表'; + +CREATE TABLE IF NOT EXISTS "promotion_article" +( + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, + "category_id" bigint NOT NULL, + "title" varchar NOT NULL, + "author" varchar, + "pic_url" varchar NOT NULL, + "introduction" varchar, + "browse_count" varchar, + "sort" int NOT NULL, + "status" int NOT NULL, + "spu_id" bigint NOT NULL, + "recommend_hot" bit NOT NULL, + "recommend_banner" bit NOT NULL, + "content" varchar NOT NULL, + "creator" varchar DEFAULT '', + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updater" varchar DEFAULT '', + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + "deleted" bit NOT NULL DEFAULT FALSE, + "tenant_id" bigint NOT NULL, + PRIMARY KEY ("id") +) COMMENT '文章管理表'; \ No newline at end of file diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 0dcc2d4a6..96ce32830 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -48,7 +48,7 @@ spring: primary: master datasource: master: - name: ruoyi-vue-pro + name: ruoyi-vue-pro2 url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例 @@ -59,7 +59,7 @@ spring: # username: sa # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W slave: # 模拟从库,可根据自己需要修改 - name: ruoyi-vue-pro + name: ruoyi-vue-pro2 lazy: true # 开启懒加载,保证启动速度 url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 @@ -75,8 +75,8 @@ spring: redis: host: 127.0.0.1 # 地址 port: 6379 # 端口 - database: 0 # 数据库索引 -# password: dev # 密码,建议生产环境开启 + database: 5 # 数据库索引 + password: 123456 # 密码,建议生产环境开启 --- #################### 定时任务相关配置 #################### From 26d367266888e3b42cfb9359a47be43e8dc0622c Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 15 Oct 2023 16:40:27 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E8=90=A5=E9=94=80=E6=B4=BB=E5=8A=A8:=20?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E5=88=86=E7=B1=BB=E7=AE=A1=E7=90=86=E8=BD=AF?= =?UTF-8?q?=E4=BB=B6=E5=8C=85=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ArticleCategoryController.java | 10 +++++----- .../vo/category}/ArticleCategoryBaseVO.java | 2 +- .../vo/category}/ArticleCategoryCreateReqVO.java | 2 +- .../vo/category}/ArticleCategoryExcelVO.java | 2 +- .../vo/category}/ArticleCategoryExportReqVO.java | 2 +- .../vo/category}/ArticleCategoryPageReqVO.java | 2 +- .../vo/category}/ArticleCategoryRespVO.java | 2 +- .../category}/ArticleCategorySimpleRespVO.java | 2 +- .../vo/category}/ArticleCategoryUpdateReqVO.java | 2 +- .../ArticleCategoryConvert.java | 6 +++--- .../ArticleCategoryDO.java | 2 +- .../ArticleCategoryMapper.java | 8 ++++---- .../ArticleCategoryService.java | 12 ++++++------ .../ArticleCategoryServiceImpl.java | 16 ++++++++-------- .../ArticleCategoryServiceImplTest.java | 14 +++++++------- 15 files changed, 42 insertions(+), 42 deletions(-) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{articlecategory => article}/ArticleCategoryController.java (94%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{articlecategory/vo => article/vo/category}/ArticleCategoryBaseVO.java (98%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{articlecategory/vo => article/vo/category}/ArticleCategoryCreateReqVO.java (96%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{articlecategory/vo => article/vo/category}/ArticleCategoryExcelVO.java (98%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{articlecategory/vo => article/vo/category}/ArticleCategoryExportReqVO.java (98%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{articlecategory/vo => article/vo/category}/ArticleCategoryPageReqVO.java (98%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{articlecategory/vo => article/vo/category}/ArticleCategoryRespVO.java (97%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{articlecategory/vo => article/vo/category}/ArticleCategorySimpleRespVO.java (97%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{articlecategory/vo => article/vo/category}/ArticleCategoryUpdateReqVO.java (97%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/{articlecategory => article}/ArticleCategoryConvert.java (84%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/{articlecategory => article}/ArticleCategoryDO.java (99%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/{articlecategory => article}/ArticleCategoryMapper.java (86%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/{articlecategory => article}/ArticleCategoryService.java (86%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/{articlecategory => article}/ArticleCategoryServiceImpl.java (85%) rename yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/{articlecategory => article}/ArticleCategoryServiceImplTest.java (94%) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/ArticleCategoryController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleCategoryController.java similarity index 94% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/ArticleCategoryController.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleCategoryController.java index 0fe84a428..68d891498 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/ArticleCategoryController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/ArticleCategoryController.java @@ -1,14 +1,14 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory; +package cn.iocoder.yudao.module.promotion.controller.admin.article; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.*; -import cn.iocoder.yudao.module.promotion.convert.articlecategory.ArticleCategoryConvert; -import cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory.ArticleCategoryDO; -import cn.iocoder.yudao.module.promotion.service.articlecategory.ArticleCategoryService; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.*; +import cn.iocoder.yudao.module.promotion.convert.article.ArticleCategoryConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; +import cn.iocoder.yudao.module.promotion.service.article.ArticleCategoryService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryBaseVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryBaseVO.java similarity index 98% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryBaseVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryBaseVO.java index f034d2336..42bf116c4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryBaseVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryCreateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryCreateReqVO.java similarity index 96% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryCreateReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryCreateReqVO.java index 0d0cf50b9..a8dc1f2e1 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryCreateReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryCreateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExcelVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryExcelVO.java similarity index 98% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExcelVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryExcelVO.java index a341be6f9..dec4c7d88 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExcelVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryExcelVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExportReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryExportReqVO.java similarity index 98% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExportReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryExportReqVO.java index d04325e6a..1e20cbcd2 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryExportReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryPageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryPageReqVO.java similarity index 98% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryPageReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryPageReqVO.java index 2adf432b0..b161aae08 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryPageReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryPageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category; import cn.iocoder.yudao.framework.common.pojo.PageParam; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryRespVO.java similarity index 97% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryRespVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryRespVO.java index 85d38503f..af4b045a7 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategorySimpleRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategorySimpleRespVO.java similarity index 97% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategorySimpleRespVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategorySimpleRespVO.java index 279fe078c..4e43326c9 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategorySimpleRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategorySimpleRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryUpdateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryUpdateReqVO.java similarity index 97% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryUpdateReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryUpdateReqVO.java index d60ccdeb9..72a1b3506 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/articlecategory/vo/ArticleCategoryUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/article/vo/category/ArticleCategoryUpdateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/articlecategory/ArticleCategoryConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleCategoryConvert.java similarity index 84% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/articlecategory/ArticleCategoryConvert.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleCategoryConvert.java index 5c68b12e3..3762bf8a9 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/articlecategory/ArticleCategoryConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleCategoryConvert.java @@ -1,8 +1,8 @@ -package cn.iocoder.yudao.module.promotion.convert.articlecategory; +package cn.iocoder.yudao.module.promotion.convert.article; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.*; -import cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory.ArticleCategoryDO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.*; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/articlecategory/ArticleCategoryDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/article/ArticleCategoryDO.java similarity index 99% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/articlecategory/ArticleCategoryDO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/article/ArticleCategoryDO.java index b0bd063a5..c79b86d66 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/articlecategory/ArticleCategoryDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/article/ArticleCategoryDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory; +package cn.iocoder.yudao.module.promotion.dal.dataobject.article; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/articlecategory/ArticleCategoryMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleCategoryMapper.java similarity index 86% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/articlecategory/ArticleCategoryMapper.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleCategoryMapper.java index 91e8e763d..c55447c4c 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/articlecategory/ArticleCategoryMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleCategoryMapper.java @@ -1,11 +1,11 @@ -package cn.iocoder.yudao.module.promotion.dal.mysql.articlecategory; +package cn.iocoder.yudao.module.promotion.dal.mysql.article; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryExportReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryPageReqVO; -import cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory.ArticleCategoryDO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; import org.apache.ibatis.annotations.Mapper; import java.util.List; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryService.java similarity index 86% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryService.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryService.java index 697a10aff..23424369b 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryService.java @@ -1,11 +1,11 @@ -package cn.iocoder.yudao.module.promotion.service.articlecategory; +package cn.iocoder.yudao.module.promotion.service.article; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryExportReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryPageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryUpdateReqVO; -import cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory.ArticleCategoryDO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; import javax.validation.Valid; import java.util.Collection; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImpl.java similarity index 85% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImpl.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImpl.java index 28d5d6f87..32bf60ee4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImpl.java @@ -1,15 +1,15 @@ -package cn.iocoder.yudao.module.promotion.service.articlecategory; +package cn.iocoder.yudao.module.promotion.service.article; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.ListUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryExportReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryPageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryUpdateReqVO; -import cn.iocoder.yudao.module.promotion.convert.articlecategory.ArticleCategoryConvert; -import cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory.ArticleCategoryDO; -import cn.iocoder.yudao.module.promotion.dal.mysql.articlecategory.ArticleCategoryMapper; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryUpdateReqVO; +import cn.iocoder.yudao.module.promotion.convert.article.ArticleCategoryConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleCategoryMapper; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImplTest.java similarity index 94% rename from yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImplTest.java rename to yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImplTest.java index 6edbf15ba..c9a5e1e15 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/articlecategory/ArticleCategoryServiceImplTest.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImplTest.java @@ -1,13 +1,13 @@ -package cn.iocoder.yudao.module.promotion.service.articlecategory; +package cn.iocoder.yudao.module.promotion.service.article; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryExportReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryPageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.articlecategory.vo.ArticleCategoryUpdateReqVO; -import cn.iocoder.yudao.module.promotion.dal.dataobject.articlecategory.ArticleCategoryDO; -import cn.iocoder.yudao.module.promotion.dal.mysql.articlecategory.ArticleCategoryMapper; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryExportReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleCategoryMapper; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; From b009f0b058db21ff7813c903b273c6778bfadcdf Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 15 Oct 2023 16:43:04 +0800 Subject: [PATCH 09/13] =?UTF-8?q?application-local.yaml=20=E6=81=A2?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-local.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 96ce32830..e98110a40 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -48,7 +48,7 @@ spring: primary: master datasource: master: - name: ruoyi-vue-pro2 + name: ruoyi-vue-pro url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.master.name} # PostgreSQL 连接的示例 @@ -59,7 +59,7 @@ spring: # username: sa # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W slave: # 模拟从库,可根据自己需要修改 - name: ruoyi-vue-pro2 + name: ruoyi-vue-pro lazy: true # 开启懒加载,保证启动速度 url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 @@ -75,8 +75,8 @@ spring: redis: host: 127.0.0.1 # 地址 port: 6379 # 端口 - database: 5 # 数据库索引 - password: 123456 # 密码,建议生产环境开启 + database: 0 # 数据库索引 +# password: dev # 密码,建议生产环境开启 --- #################### 定时任务相关配置 #################### @@ -174,8 +174,8 @@ debug: false --- #################### 微信公众号、小程序相关配置 #################### wx: mp: # 公众号配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档 -# app-id: wx041349c6f39b268b -# secret: 5abee519483bc9f8cb37ce280e814bd0 + # app-id: wx041349c6f39b268b + # secret: 5abee519483bc9f8cb37ce280e814bd0 app-id: wx5b23ba7a5589ecbb # 测试号 secret: 2a7b3b20c537e52e74afd395eb85f61f # 存储配置,解决 AccessToken 的跨节点的共享 @@ -184,8 +184,8 @@ wx: key-prefix: wx # Redis Key 的前缀 http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台 miniapp: # 小程序配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-miniapp-spring-boot-starter/README.md 文档 -# appid: wx62056c0d5e8db250 -# secret: 333ae72f41552af1e998fe1f54e1584a + # appid: wx62056c0d5e8db250 + # secret: 333ae72f41552af1e998fe1f54e1584a appid: wx63c280fe3248a3e7 # wenhualian的接口测试号 secret: 6f270509224a7ae1296bbf1c8cb97aed config-storage: From 7cb8f8fab9a6ead6bd752701b9507356f9a6e84b Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Sun, 15 Oct 2023 17:33:55 +0800 Subject: [PATCH 10/13] =?UTF-8?q?wallet=20-=20=E7=AE=A1=E7=90=86=E7=AB=AF?= =?UTF-8?q?=20=E9=92=B1=E5=8C=85=E4=BD=99=E9=A2=9D=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/wallet/PayWalletController.java | 15 +++++++++-- .../vo/{ => balance}/PayWalletBaseVO.java | 4 +-- .../wallet/vo/balance/PayWalletPageReqVO.java | 27 +++++++++++++++++++ .../vo/{ => balance}/PayWalletRespVO.java | 2 +- .../vo/{ => balance}/PayWalletUserReqVO.java | 2 +- .../pay/convert/wallet/PayWalletConvert.java | 5 +++- .../pay/dal/mysql/wallet/PayWalletMapper.java | 11 ++++++++ .../pay/service/wallet/PayWalletService.java | 11 ++++++++ .../service/wallet/PayWalletServiceImpl.java | 7 +++++ 9 files changed, 77 insertions(+), 7 deletions(-) rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/{ => balance}/PayWalletBaseVO.java (93%) create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletPageReqVO.java rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/{ => balance}/PayWalletRespVO.java (89%) rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/{ => balance}/PayWalletUserReqVO.java (91%) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java index 7474cae35..8eddec6b3 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java @@ -1,8 +1,10 @@ package cn.iocoder.yudao.module.pay.controller.admin.wallet; import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.PayWalletRespVO; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.PayWalletUserReqVO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletRespVO; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletUserReqVO; import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; @@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import javax.validation.Valid; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -37,4 +40,12 @@ public class PayWalletController { return success(PayWalletConvert.INSTANCE.convert02(wallet)); } + @GetMapping("/page") + @Operation(summary = "获得会员钱包分页") + @PreAuthorize("@ss.hasPermission('pay:wallet:query')") + public CommonResult> getWalletPage(@Valid PayWalletPageReqVO pageVO) { + PageResult pageResult = payWalletService.getWalletPage(pageVO); + return success(PayWalletConvert.INSTANCE.convertPage(pageResult)); + } + } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/PayWalletBaseVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletBaseVO.java similarity index 93% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/PayWalletBaseVO.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletBaseVO.java index f255c88fd..1d29ae92a 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/PayWalletBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo; +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -18,7 +18,7 @@ public class PayWalletBaseVO { @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @NotNull(message = "用户类型不能为空") - private Byte userType; + private Integer userType; @Schema(description = "余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "余额,单位分不能为空") diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletPageReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletPageReqVO.java new file mode 100644 index 000000000..61ce1f436 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletPageReqVO.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 会员钱包分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PayWalletPageReqVO extends PageParam { + + @Schema(description = "用户编号", example = "14138") + private Long userId; + + @Schema(description = "用户类型", example = "1") + private Integer userType; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/PayWalletRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletRespVO.java similarity index 89% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/PayWalletRespVO.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletRespVO.java index f7bc7822f..e6b6db4ab 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/PayWalletRespVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo; +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/PayWalletUserReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletUserReqVO.java similarity index 91% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/PayWalletUserReqVO.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletUserReqVO.java index cace4f859..723a3deca 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/PayWalletUserReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletUserReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo; +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java index 7cdd8a81e..660183aca 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.pay.convert.wallet; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.PayWalletRespVO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletRespVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import org.mapstruct.Mapper; @@ -14,4 +15,6 @@ public interface PayWalletConvert { AppPayWalletRespVO convert(PayWalletDO bean); PayWalletRespVO convert02(PayWalletDO wallet); + + PageResult convertPage(PageResult page); } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java index 11fc6edbb..e6ba1a838 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java @@ -1,7 +1,10 @@ package cn.iocoder.yudao.module.pay.dal.mysql.wallet; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletPageReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; @@ -14,6 +17,14 @@ public interface PayWalletMapper extends BaseMapperX { PayWalletDO::getUserType, userType); } + default PageResult selectPage(PayWalletPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(PayWalletDO::getUserId, reqVO.getUserId()) + .eqIfPresent(PayWalletDO::getUserType, reqVO.getUserType()) + .betweenIfPresent(PayWalletDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PayWalletDO::getId)); + } + /** * 当消费退款时候, 更新钱包 * diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java index 508822551..5a690b7d4 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.pay.service.wallet; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletPageReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; @@ -28,6 +30,15 @@ public interface PayWalletService { */ PayWalletDO getWallet(Long walletId); + + /** + * 获得会员钱包分页 + * + * @param pageReqVO 分页查询 + * @return 会员钱包分页 + */ + PageResult getWalletPage(PayWalletPageReqVO pageReqVO); + /** * 钱包订单支付 * diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java index c14d20cfa..02c78449c 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java @@ -1,6 +1,8 @@ package cn.iocoder.yudao.module.pay.service.wallet; import cn.hutool.core.lang.Assert; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletPageReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; @@ -60,6 +62,11 @@ public class PayWalletServiceImpl implements PayWalletService { return walletMapper.selectById(walletId); } + @Override + public PageResult getWalletPage(PayWalletPageReqVO pageReqVO) { + return walletMapper.selectPage(pageReqVO); + } + @Override @Transactional(rollbackFor = Exception.class) public PayWalletTransactionDO orderPay(Long userId, Integer userType, String outTradeNo, Integer price) { From 4f7c7f56193cf2f49c5cf937bb766ccbce740fd0 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Mon, 16 Oct 2023 08:36:28 +0800 Subject: [PATCH 11/13] =?UTF-8?q?wallet=20-=20=E7=AE=A1=E7=90=86=E7=AB=AF?= =?UTF-8?q?=20=E9=92=B1=E5=8C=85=E4=BD=99=E9=A2=9D=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/wallet/PayWalletController.java | 6 +-- .../PayWalletTransactionController.java | 40 +++++++++++++++++++ .../PayWalletTransactionPageReqVO.java | 13 ++++++ .../PayWalletTransactionRespVO.java | 29 ++++++++++++++ .../{balance => wallet}/PayWalletBaseVO.java | 2 +- .../PayWalletPageReqVO.java | 2 +- .../{balance => wallet}/PayWalletRespVO.java | 2 +- .../PayWalletUserReqVO.java | 2 +- .../AppPayWalletTransactionRespVO.java | 3 -- .../pay/convert/wallet/PayWalletConvert.java | 2 +- .../wallet/PayWalletTransactionConvert.java | 3 ++ .../pay/dal/mysql/wallet/PayWalletMapper.java | 2 +- .../wallet/PayWalletTransactionMapper.java | 13 +++--- .../pay/service/wallet/PayWalletService.java | 2 +- .../service/wallet/PayWalletServiceImpl.java | 2 +- .../wallet/PayWalletTransactionService.java | 8 ++++ .../PayWalletTransactionServiceImpl.java | 8 +++- 17 files changed, 118 insertions(+), 21 deletions(-) create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletTransactionController.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/transaction/PayWalletTransactionPageReqVO.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/transaction/PayWalletTransactionRespVO.java rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/{balance => wallet}/PayWalletBaseVO.java (95%) rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/{balance => wallet}/PayWalletPageReqVO.java (92%) rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/{balance => wallet}/PayWalletRespVO.java (89%) rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/{balance => wallet}/PayWalletUserReqVO.java (91%) diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java index 8eddec6b3..7deed8eb7 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java @@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.pay.controller.admin.wallet; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletPageReqVO; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletRespVO; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletUserReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserReqVO; import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletTransactionController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletTransactionController.java new file mode 100644 index 000000000..8354ad1ce --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletTransactionController.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.pay.controller.admin.wallet; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionRespVO; +import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; +import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.validation.Valid; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 钱包余额明细") +@RestController +@RequestMapping("/pay/wallet-transaction") +@Validated +@Slf4j +public class PayWalletTransactionController { + + @Resource + private PayWalletTransactionService payWalletTransactionService; + + @GetMapping("/page") + @Operation(summary = "获得钱包流水分页") + public CommonResult> getWalletTransactionPage( + @Valid PayWalletTransactionPageReqVO pageReqVO) { + PageResult result = payWalletTransactionService.getWalletTransactionPage(pageReqVO); + return success(PayWalletTransactionConvert.INSTANCE.convertPage2(result)); + } +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/transaction/PayWalletTransactionPageReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/transaction/PayWalletTransactionPageReqVO.java new file mode 100644 index 000000000..82122f2b3 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/transaction/PayWalletTransactionPageReqVO.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 钱包流水分页 Request VO") +@Data +public class PayWalletTransactionPageReqVO extends PageParam { + + @Schema(description = "钱包编号", example = "1") + private Long walletId; +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/transaction/PayWalletTransactionRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/transaction/PayWalletTransactionRespVO.java new file mode 100644 index 000000000..d82dfaab0 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/transaction/PayWalletTransactionRespVO.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "用户 APP - 钱包流水分页 Response VO") +@Data +public class PayWalletTransactionRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long id; + + @Schema(description = "钱包编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5") + private Long walletId; + + @Schema(description = "业务分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer bizType; + + @Schema(description = "交易金额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") + private Long price; + + @Schema(description = "流水标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "土豆土豆") + private String title; + + @Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletBaseVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletBaseVO.java similarity index 95% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletBaseVO.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletBaseVO.java index 1d29ae92a..a45ea8b90 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance; +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletPageReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletPageReqVO.java similarity index 92% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletPageReqVO.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletPageReqVO.java index 61ce1f436..d511ea409 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletPageReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletPageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance; +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet; import lombok.*; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletRespVO.java similarity index 89% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletRespVO.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletRespVO.java index e6b6db4ab..01b35fb3f 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletRespVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance; +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletUserReqVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserReqVO.java similarity index 91% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletUserReqVO.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserReqVO.java index 723a3deca..84507497b 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletUserReqVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance; +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionRespVO.java index 9d17c346e..5c20188eb 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionRespVO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionRespVO.java @@ -9,9 +9,6 @@ import java.time.LocalDateTime; @Data public class AppPayWalletTransactionRespVO { - @Schema(description = "交易金额, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") - private Integer amount; - @Schema(description = "业务分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") private Integer bizType; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java index 660183aca..c64efc517 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.pay.convert.wallet; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletRespVO; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import org.mapstruct.Mapper; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletTransactionConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletTransactionConvert.java index 4b3a150f8..f956f8d56 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletTransactionConvert.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletTransactionConvert.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.pay.convert.wallet; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionRespVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO; @@ -14,6 +15,8 @@ public interface PayWalletTransactionConvert { PageResult convertPage(PageResult page); + PageResult convertPage2(PageResult page); + PayWalletTransactionDO convert(WalletTransactionCreateReqBO bean); } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java index e6ba1a838..0089b286f 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java @@ -4,7 +4,7 @@ package cn.iocoder.yudao.module.pay.dal.mysql.wallet; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java index 7831e77bd..41d7dbeb4 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.pay.dal.mysql.wallet; +import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -13,17 +14,17 @@ import java.util.Objects; @Mapper public interface PayWalletTransactionMapper extends BaseMapperX { - default PageResult selectPage(Long walletId, - AppPayWalletTransactionPageReqVO pageReqVO) { + default PageResult selectPage(Long walletId, Integer type, + PageParam pageParam) { LambdaQueryWrapperX query = new LambdaQueryWrapperX() - .eq(PayWalletTransactionDO::getWalletId, walletId); - if (Objects.equals(pageReqVO.getType(), AppPayWalletTransactionPageReqVO.TYPE_INCOME)) { + .eqIfPresent(PayWalletTransactionDO::getWalletId, walletId); + if (Objects.equals(type, AppPayWalletTransactionPageReqVO.TYPE_INCOME)) { query.gt(PayWalletTransactionDO::getPrice, 0); - } else if (Objects.equals(pageReqVO.getType(), AppPayWalletTransactionPageReqVO.TYPE_EXPENSE)) { + } else if (Objects.equals(type, AppPayWalletTransactionPageReqVO.TYPE_EXPENSE)) { query.lt(PayWalletTransactionDO::getPrice, 0); } query.orderByDesc(PayWalletTransactionDO::getId); - return selectPage(pageReqVO, query); + return selectPage(pageParam, query); } default PayWalletTransactionDO selectByNo(String no) { diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java index 5a690b7d4..3e72099b4 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.pay.service.wallet; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java index 02c78449c..6f52abd67 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.pay.service.wallet; import cn.hutool.core.lang.Assert; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java index 8a112b6c6..166071677 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.pay.service.wallet; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; @@ -25,6 +26,13 @@ public interface PayWalletTransactionService { PageResult getWalletTransactionPage(Long userId, Integer userType, AppPayWalletTransactionPageReqVO pageVO); + /** + * 查询钱包余额流水分页 + * + * @param pageVO 分页查询参数 + */ + PageResult getWalletTransactionPage(PayWalletTransactionPageReqVO pageVO); + /** * 新增钱包余额流水 * diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java index ad802be41..fd02b4976 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.pay.service.wallet; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; @@ -39,7 +40,12 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ public PageResult getWalletTransactionPage(Long userId, Integer userType, AppPayWalletTransactionPageReqVO pageVO) { PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType); - return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO); + return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO.getType(), pageVO); + } + + @Override + public PageResult getWalletTransactionPage(PayWalletTransactionPageReqVO pageVO) { + return payWalletTransactionMapper.selectPage(pageVO.getWalletId(), null, pageVO); } @Override From fcbbbc737d9cd65c37cb8bef3357049510634f16 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Mon, 16 Oct 2023 08:46:27 +0800 Subject: [PATCH 12/13] =?UTF-8?q?wallet=20-=20=E7=AE=A1=E7=90=86=E7=AB=AF,?= =?UTF-8?q?=20=E5=85=85=E5=80=BC=E5=A5=97=E9=A4=90=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql/pay_wallet.sql | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/sql/mysql/pay_wallet.sql b/sql/mysql/pay_wallet.sql index 3f5ed2f31..84b55d3bd 100644 --- a/sql/mysql/pay_wallet.sql +++ b/sql/mysql/pay_wallet.sql @@ -125,3 +125,58 @@ CREATE TABLE `pay_wallet_recharge` ( `tenant_id` bigint(0) NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员钱包充值' ROW_FORMAT = Dynamic; + +-- 钱包充值套餐菜单脚本 + +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status, component_name +) +VALUES ( + '钱包管理', '', 1, 5, 1117, + 'wallet', 'ep:caret-right', '', 0, '' + ); +SELECT @parentId := LAST_INSERT_ID(); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status, component_name +) +VALUES ( + '充值套餐', '', 2, 2, @parentId, + 'wallet-recharge-package', 'fa:leaf', 'pay/wallet/rechargePackage/index', 0, 'WalletRechargePackage' + ); +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '钱包充值套餐查询', 'pay:wallet-recharge-package:query', 3, 1, @parentId, + '', '', '', 0 + ); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '钱包充值套餐创建', 'pay:wallet-recharge-package:create', 3, 2, @parentId, + '', '', '', 0 + ); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '钱包充值套餐更新', 'pay:wallet-recharge-package:update', 3, 3, @parentId, + '', '', '', 0 + ); +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '钱包充值套餐删除', 'pay:wallet-recharge-package:delete', 3, 4, @parentId, + '', '', '', 0 + ); From 4359c584bb2b970f33df78fd0a5f5f9f24567e1f Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 16 Oct 2023 09:07:02 +0800 Subject: [PATCH 13/13] =?UTF-8?q?code=20review=EF=BC=9A=E6=8B=BC=E5=9B=A2?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/api/combination/CombinationRecordApi.java | 2 +- .../admin/combination/CombinationRecordController.java | 2 -- .../app/combination/AppCombinationRecordController.java | 8 ++++---- .../convert/combination/CombinationActivityConvert.java | 1 - .../dal/mysql/combination/CombinationRecordMapper.java | 7 ++++--- .../service/combination/CombinationRecordServiceImpl.java | 7 ++++--- .../module/trade/dal/mysql/order/TradeOrderMapper.java | 1 + .../order/handler/TradeCombinationOrderHandler.java | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java index 2274d45fd..05dfb8b6e 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java @@ -28,7 +28,7 @@ public interface CombinationRecordApi { * 创建开团记录 * * @param reqDTO 请求 DTO - * @return 团信息 + * @return 拼团信息 */ CombinationRecordCreateRespDTO createCombinationRecord(@Valid CombinationRecordCreateReqDTO reqDTO); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java index dfb8ec889..8f6962d00 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java @@ -40,8 +40,6 @@ public class CombinationRecordController { @Lazy private CombinationRecordService combinationRecordService; - // 然后如果 headId 非空,并且第一页,单独多查询一条 head ;放到第 0 个位置;相当于说,第一页特殊一点; - @GetMapping("/page") @Operation(summary = "获得拼团记录分页") @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java index e242569ac..0da03e050 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java @@ -47,13 +47,13 @@ public class AppCombinationRecordController { public CommonResult getCombinationRecordSummary() { AppCombinationRecordSummaryRespVO summary = new AppCombinationRecordSummaryRespVO(); // 1. 获得拼团参与用户数量 - Long count = combinationRecordService.getCombinationUserCount(); - if (count == 0) { + Long userCount = combinationRecordService.getCombinationUserCount(); + if (userCount == 0) { summary.setAvatars(Collections.emptyList()); - summary.setUserCount(count); + summary.setUserCount(userCount); return success(summary); } - summary.setUserCount(count); + summary.setUserCount(userCount); // 2. 获得拼团记录头像 List records = combinationRecordService.getLatestCombinationRecordList( diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java index aad8281d6..84f7e5d46 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java @@ -192,7 +192,6 @@ public interface CombinationActivityConvert { return result; } - default AppCombinationRecordDetailRespVO convert(Long userId, CombinationRecordDO headRecord, List memberRecords) { AppCombinationRecordDetailRespVO respVO = new AppCombinationRecordDetailRespVO() .setHeadRecord(convert(headRecord)).setMemberRecords(convertList3(memberRecords)); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java index 56ec0361a..f633edc90 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java @@ -99,10 +99,10 @@ public interface CombinationRecordMapper extends BaseMapperX queryWrapper = new LambdaQueryWrapperX() .eqIfPresent(CombinationRecordDO::getStatus, pageVO.getStatus()) .betweenIfPresent(CombinationRecordDO::getCreateTime, pageVO.getCreateTime()); + // 如果 headId 非空,说明查询指定团的团长 + 团员的拼团记录 if (pageVO.getHeadId() != null) { - queryWrapper.eq(CombinationRecordDO::getId, pageVO.getHeadId()) - .or() - .eq(CombinationRecordDO::getHeadId, pageVO.getHeadId()); + queryWrapper.eq(CombinationRecordDO::getId, pageVO.getHeadId()) // 团长 + .or().eq(CombinationRecordDO::getHeadId, pageVO.getHeadId()); // 团员 } return selectPage(pageVO, queryWrapper); } @@ -127,6 +127,7 @@ public interface CombinationRecordMapper extends BaseMapperX() .select("DISTINCT (user_id)") diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java index 82baf1931..2d10d1e70 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java @@ -339,19 +339,20 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { @Override public KeyValue expireCombinationRecord() { - // 1.获取所有正在进行中的过期的父拼团 + // 1. 获取所有正在进行中的过期的父拼团 List headExpireRecords = combinationRecordMapper.selectListByHeadIdAndStatusAndExpireTimeLt( CombinationRecordDO.HEAD_ID_GROUP, CombinationRecordStatusEnum.IN_PROGRESS.getStatus(), LocalDateTime.now()); if (CollUtil.isEmpty(headExpireRecords)) { return new KeyValue<>(0, 0); } - // 2.获取拼团活动 + // 2. 获取拼团活动 List activities = combinationActivityService.getCombinationActivityListByIds( convertSet(headExpireRecords, CombinationRecordDO::getActivityId)); Map activityMap = convertMap(activities, CombinationActivityDO::getId); - // 3.校验是否虚拟成团 + // TODO @puhui999:这里可以改成“每个团”,处理一次哈;这样 handleExpireRecord、handleVirtualGroupRecord 都改成按团处理,每个是一个小事务; + // 3. 校验是否虚拟成团 List virtualGroupHeadRecords = new ArrayList<>(); // 虚拟成团 for (Iterator iterator = headExpireRecords.iterator(); iterator.hasNext(); ) { CombinationRecordDO record = iterator.next(); diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java index d942fd853..8719730b9 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java @@ -93,6 +93,7 @@ public interface TradeOrderMapper extends BaseMapperX { return selectOne(TradeOrderDO::getPickUpVerifyCode, pickUpVerifyCode); } + // TODO @puhui999:selectByUserIdAndCombinationActivityIdAndStatus,这样更容易理解哈。 /** * 只针对 combinationActivityId 的查询 * diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java index 7efdc1650..6a530dc89 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java @@ -70,8 +70,8 @@ public class TradeCombinationOrderHandler implements TradeOrderHandler { TradeOrderConvert.INSTANCE.convert(order, item)); // 3. 更新拼团相关信息到订单 - // TODO 芋艿,只需要更新 record。 如果创建订单时自己是团长的情况下 combinationHeadId 是为 null 的, - // 设置团长编号这个操作时在订单是否后创建拼团记录时才设置的,所以支付完创建拼团记录后需要设置一下记录编号和团长编号 + // 为什么几个字段都要更新?原因是: + // 如果创建订单时自己是团长的情况下 combinationHeadId 是为 null 的,设置团长编号这个操作时在订单是否后创建拼团记录时才设置的。 orderUpdateService.updateOrderCombinationInfo(order.getId(), order.getCombinationActivityId(), combinationRecord.getCombinationRecordId(), combinationRecord.getCombinationHeadId()); }