Commit 31b8ee425fdd19fd13ed167faee5519d4abc1d3f
1 parent
1519c03c
reactor:移除 promotion-statistics 的 api 包
Showing
470 changed files
with
9013 additions
and
9059 deletions
Too many changes.
To preserve performance only 100 of 470 files are displayed.
yudao-module-mall/pom.xml
| ... | ... | @@ -19,8 +19,7 @@ |
| 19 | 19 | </description> |
| 20 | 20 | <modules> |
| 21 | 21 | <module>yudao-module-product</module> |
| 22 | - <module>yudao-module-promotion-api</module> | |
| 23 | - <module>yudao-module-promotion-biz</module> | |
| 22 | + <module>yudao-module-promotion</module> | |
| 24 | 23 | <module>yudao-module-trade-biz</module> |
| 25 | 24 | <module>yudao-module-statistics</module> |
| 26 | 25 | <!-- | ... | ... |
yudao-module-mall/yudao-module-promotion-api/pom.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<project xmlns="http://maven.apache.org/POM/4.0.0" | |
| 3 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 4 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 5 | - <parent> | |
| 6 | - <groupId>cn.iocoder.boot</groupId> | |
| 7 | - <artifactId>yudao-module-mall</artifactId> | |
| 8 | - <version>${revision}</version> | |
| 9 | - </parent> | |
| 10 | - <modelVersion>4.0.0</modelVersion> | |
| 11 | - <artifactId>yudao-module-promotion-api</artifactId> | |
| 12 | - <packaging>jar</packaging> | |
| 13 | - | |
| 14 | - <name>${project.artifactId}</name> | |
| 15 | - <description> | |
| 16 | - promotion 模块 API,暴露给其它模块调用 | |
| 17 | - </description> | |
| 18 | - | |
| 19 | - <dependencies> | |
| 20 | - <dependency> | |
| 21 | - <groupId>cn.iocoder.boot</groupId> | |
| 22 | - <artifactId>yudao-common</artifactId> | |
| 23 | - </dependency> | |
| 24 | - | |
| 25 | - <!-- 参数校验 --> | |
| 26 | - <dependency> | |
| 27 | - <groupId>org.springframework.boot</groupId> | |
| 28 | - <artifactId>spring-boot-starter-validation</artifactId> | |
| 29 | - <optional>true</optional> | |
| 30 | - </dependency> | |
| 31 | - | |
| 32 | - <!-- 工具类中使用了 --> | |
| 33 | - <dependency> | |
| 34 | - <groupId>com.fasterxml.jackson.core</groupId> | |
| 35 | - <artifactId>jackson-databind</artifactId> | |
| 36 | - <optional>true</optional> | |
| 37 | - </dependency> | |
| 38 | - </dependencies> | |
| 39 | - | |
| 40 | -</project> |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyPageController.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.diy; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.app.diy.vo.AppDiyPagePropertyRespVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.service.diy.DiyPageService; | |
| 8 | -import io.swagger.v3.oas.annotations.Operation; | |
| 9 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 10 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 11 | -import jakarta.annotation.Resource; | |
| 12 | -import jakarta.annotation.security.PermitAll; | |
| 13 | -import org.springframework.validation.annotation.Validated; | |
| 14 | -import org.springframework.web.bind.annotation.GetMapping; | |
| 15 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 16 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 17 | -import org.springframework.web.bind.annotation.RestController; | |
| 18 | - | |
| 19 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 20 | - | |
| 21 | -@Tag(name = "用户 APP - 装修页面") | |
| 22 | -@RestController | |
| 23 | -@RequestMapping("/promotion/diy-page") | |
| 24 | -@Validated | |
| 25 | -public class AppDiyPageController { | |
| 26 | - | |
| 27 | - @Resource | |
| 28 | - private DiyPageService diyPageService; | |
| 29 | - | |
| 30 | - @GetMapping("/get") | |
| 31 | - @Operation(summary = "获得装修页面") | |
| 32 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 33 | - @PermitAll | |
| 34 | - public CommonResult<AppDiyPagePropertyRespVO> getDiyPage(@RequestParam("id") Long id) { | |
| 35 | - DiyPageDO diyPage = diyPageService.getDiyPage(id); | |
| 36 | - return success(BeanUtils.toBean(diyPage, AppDiyPagePropertyRespVO.class)); | |
| 37 | - } | |
| 38 | - | |
| 39 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/vo/AppDiyTemplatePropertyRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.diy.vo; | |
| 2 | - | |
| 3 | -import com.fasterxml.jackson.annotation.JsonRawValue; | |
| 4 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | -import lombok.Data; | |
| 6 | -import lombok.ToString; | |
| 7 | - | |
| 8 | -@Schema(description = "用户 App - 装修模板属性 Response VO") | |
| 9 | -@Data | |
| 10 | -@ToString(callSuper = true) | |
| 11 | -public class AppDiyTemplatePropertyRespVO { | |
| 12 | - | |
| 13 | - @Schema(description = "装修模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31209") | |
| 14 | - private Long id; | |
| 15 | - | |
| 16 | - @Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "默认主题") | |
| 17 | - private String name; | |
| 18 | - | |
| 19 | - @Schema(description = "模板属性", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}") | |
| 20 | - @JsonRawValue | |
| 21 | - private String property; | |
| 22 | - | |
| 23 | - @Schema(description = "首页", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}") | |
| 24 | - @JsonRawValue | |
| 25 | - private String home; | |
| 26 | - | |
| 27 | - @Schema(description = "我的", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}") | |
| 28 | - @JsonRawValue | |
| 29 | - private String user; | |
| 30 | - | |
| 31 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/kefu/vo/message/AppKeFuMessagePageReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import jakarta.validation.constraints.Max; | |
| 5 | -import jakarta.validation.constraints.Min; | |
| 6 | -import jakarta.validation.constraints.NotNull; | |
| 7 | -import lombok.Data; | |
| 8 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | - | |
| 10 | -import java.time.LocalDateTime; | |
| 11 | - | |
| 12 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 13 | - | |
| 14 | -@Schema(description = "用户 App - 客服消息 Request VO") | |
| 15 | -@Data | |
| 16 | -public class AppKeFuMessagePageReqVO { | |
| 17 | - | |
| 18 | - private static final Integer LIMIT = 10; | |
| 19 | - | |
| 20 | - @Schema(description = "会话编号", example = "12580") | |
| 21 | - private Long conversationId; | |
| 22 | - | |
| 23 | - @Schema(description = "发送时间", example = "2024-03-27 12:00:00") | |
| 24 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 25 | - private LocalDateTime createTime; | |
| 26 | - | |
| 27 | - @Schema(description = "每次查询条数,最大值为 100", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | |
| 28 | - @NotNull(message = "每次查询条数不能为空") | |
| 29 | - @Min(value = 1, message = "每次查询条数最小值为 1") | |
| 30 | - @Max(value = 100, message = "每次查询最大值为 100") | |
| 31 | - private Integer limit = LIMIT; | |
| 32 | - | |
| 33 | -} | |
| 34 | 0 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/kefu/vo/message/AppKeFuMessageSendReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import jakarta.validation.constraints.NotEmpty; | |
| 5 | -import jakarta.validation.constraints.NotNull; | |
| 6 | -import lombok.Data; | |
| 7 | - | |
| 8 | -@Schema(description = "用户 App - 发送客服消息 Request VO") | |
| 9 | -@Data | |
| 10 | -public class AppKeFuMessageSendReqVO { | |
| 11 | - | |
| 12 | - @Schema(description = "消息类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 13 | - @NotNull(message = "消息类型不能为空") | |
| 14 | - private Integer contentType; | |
| 15 | - @Schema(description = "消息", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 16 | - @NotEmpty(message = "消息不能为空") | |
| 17 | - private String content; | |
| 18 | - | |
| 19 | - // ========== 后端设置的参数,前端无需传递 ========== | |
| 20 | - | |
| 21 | - @Schema(description = "发送人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24571", hidden = true) | |
| 22 | - private Long senderId; | |
| 23 | - @Schema(description = "发送人类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1", hidden = true) | |
| 24 | - private Integer senderType; | |
| 25 | - | |
| 26 | -} | |
| 27 | 0 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/point/vo/AppPointActivityDetailRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.point.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | - | |
| 6 | -import java.util.List; | |
| 7 | - | |
| 8 | -@Schema(description = "用户 App - 积分商城活动的详细 Response VO") | |
| 9 | -@Data | |
| 10 | -public class AppPointActivityDetailRespVO { | |
| 11 | - | |
| 12 | - @Schema(description = "积分商城活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11373") | |
| 13 | - private Long id; | |
| 14 | - | |
| 15 | - @Schema(description = "积分商城活动商品", requiredMode = Schema.RequiredMode.REQUIRED, example = "19509") | |
| 16 | - private Long spuId; | |
| 17 | - | |
| 18 | - @Schema(description = "活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 19 | - private Integer status; | |
| 20 | - | |
| 21 | - @Schema(description = "积分商城活动库存(剩余库存积分兑换时扣减)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 22 | - private Integer stock; | |
| 23 | - | |
| 24 | - @Schema(description = "积分商城活动总库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 25 | - private Integer totalStock; | |
| 26 | - | |
| 27 | - @Schema(description = "备注", example = "你说的对") | |
| 28 | - private String remark; | |
| 29 | - | |
| 30 | - @Schema(description = "商品信息数组", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 31 | - private List<Product> products; | |
| 32 | - | |
| 33 | - //======================= 显示所需兑换积分最少的 SKU 信息 ======================= | |
| 34 | - | |
| 35 | - @Schema(description = "兑换积分", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 36 | - private Integer point; | |
| 37 | - | |
| 38 | - @Schema(description = "兑换金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "15860") | |
| 39 | - private Integer price; | |
| 40 | - | |
| 41 | - @Schema(description = "商品信息") | |
| 42 | - @Data | |
| 43 | - public static class Product { | |
| 44 | - | |
| 45 | - @Schema(description = "积分商城商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31718") | |
| 46 | - private Long id; | |
| 47 | - | |
| 48 | - @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2736") | |
| 49 | - private Long skuId; | |
| 50 | - | |
| 51 | - @Schema(description = "可兑换数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "3926") | |
| 52 | - private Integer count; | |
| 53 | - | |
| 54 | - @Schema(description = "兑换积分", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 55 | - private Integer point; | |
| 56 | - | |
| 57 | - @Schema(description = "兑换金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "15860") | |
| 58 | - private Integer price; | |
| 59 | - | |
| 60 | - @Schema(description = "积分商城商品库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | |
| 61 | - private Integer stock; | |
| 62 | - | |
| 63 | - } | |
| 64 | - | |
| 65 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/point/vo/AppPointActivityRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.point.vo; | |
| 2 | - | |
| 3 | -import com.alibaba.excel.annotation.ExcelProperty; | |
| 4 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | -import lombok.Data; | |
| 6 | - | |
| 7 | -@Schema(description = "用户 App - 积分商城活动 Response VO") | |
| 8 | -@Data | |
| 9 | -public class AppPointActivityRespVO { | |
| 10 | - | |
| 11 | - @Schema(description = "积分商城活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11373") | |
| 12 | - @ExcelProperty("积分商城活动编号") | |
| 13 | - private Long id; | |
| 14 | - | |
| 15 | - @Schema(description = "积分商城活动商品", requiredMode = Schema.RequiredMode.REQUIRED, example = "19509") | |
| 16 | - @ExcelProperty("积分商城活动商品") | |
| 17 | - private Long spuId; | |
| 18 | - | |
| 19 | - @Schema(description = "活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 20 | - @ExcelProperty("活动状态") | |
| 21 | - private Integer status; | |
| 22 | - | |
| 23 | - @Schema(description = "积分商城活动库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 24 | - @ExcelProperty("积分商城活动库存") | |
| 25 | - private Integer stock; // 剩余库存积分兑换时扣减 | |
| 26 | - | |
| 27 | - @Schema(description = "积分商城活动总库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 28 | - @ExcelProperty("积分商城活动总库存") | |
| 29 | - private Integer totalStock; | |
| 30 | - | |
| 31 | - // ========== 商品字段 ========== | |
| 32 | - | |
| 33 | - @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 name 读取 | |
| 34 | - example = "618大促") | |
| 35 | - private String spuName; | |
| 36 | - @Schema(description = "商品主图", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 picUrl 读取 | |
| 37 | - example = "https://www.iocoder.cn/xx.png") | |
| 38 | - private String picUrl; | |
| 39 | - @Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 marketPrice 读取 | |
| 40 | - example = "50") | |
| 41 | - private Integer marketPrice; | |
| 42 | - | |
| 43 | - //======================= 显示所需兑换积分最少的 sku 信息 ======================= | |
| 44 | - | |
| 45 | - @Schema(description = "兑换积分", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 46 | - private Integer point; | |
| 47 | - | |
| 48 | - @Schema(description = "兑换金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "15860") | |
| 49 | - private Integer price; | |
| 50 | - | |
| 51 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/reward/AppRewardActivityController.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.reward; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.app.reward.vo.AppRewardActivityRespVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.reward.RewardActivityDO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.service.reward.RewardActivityService; | |
| 8 | -import io.swagger.v3.oas.annotations.Operation; | |
| 9 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 10 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 11 | -import jakarta.annotation.Resource; | |
| 12 | -import jakarta.annotation.security.PermitAll; | |
| 13 | -import org.springframework.validation.annotation.Validated; | |
| 14 | -import org.springframework.web.bind.annotation.GetMapping; | |
| 15 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 16 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 17 | -import org.springframework.web.bind.annotation.RestController; | |
| 18 | - | |
| 19 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 20 | - | |
| 21 | -@Tag(name = "用户 App - 满减送活动") | |
| 22 | -@RestController | |
| 23 | -@RequestMapping("/promotion/reward-activity") | |
| 24 | -@Validated | |
| 25 | -public class AppRewardActivityController { | |
| 26 | - | |
| 27 | - @Resource | |
| 28 | - private RewardActivityService rewardActivityService; | |
| 29 | - | |
| 30 | - @GetMapping("/get") | |
| 31 | - @Operation(summary = "获得满减送活动") | |
| 32 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 33 | - @PermitAll | |
| 34 | - public CommonResult<AppRewardActivityRespVO> getRewardActivity(@RequestParam("id") Long id) { | |
| 35 | - RewardActivityDO activity = rewardActivityService.getRewardActivity(id); | |
| 36 | - if (activity == null) { | |
| 37 | - return success(null); | |
| 38 | - } | |
| 39 | - // 拼接 Rule 描述 | |
| 40 | - AppRewardActivityRespVO activityVO = BeanUtils.toBean(activity, AppRewardActivityRespVO.class); | |
| 41 | - for (int i = 0; i < activityVO.getRules().size(); i++) { | |
| 42 | - AppRewardActivityRespVO.Rule ruleVO = activityVO.getRules().get(i); | |
| 43 | - RewardActivityDO.Rule rule = activity.getRules().get(i); | |
| 44 | - ruleVO.setDescription(rewardActivityService.getRewardActivityRuleDescription(activity.getConditionType(), rule)); | |
| 45 | - } | |
| 46 | - return success(activityVO); | |
| 47 | - } | |
| 48 | - | |
| 49 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/reward/vo/AppRewardActivityRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.reward.vo; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivityBaseVO; | |
| 4 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | -import lombok.Data; | |
| 6 | - | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | -import java.util.List; | |
| 9 | - | |
| 10 | -@Schema(description = "用户 App - 满减送活动 Response VO") | |
| 11 | -@Data | |
| 12 | -public class AppRewardActivityRespVO { | |
| 13 | - | |
| 14 | - @Schema(description = "活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 15 | - private Integer id; | |
| 16 | - | |
| 17 | - @Schema(description = "活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 18 | - private Integer status; | |
| 19 | - | |
| 20 | - @Schema(description = "活动标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "满啦满啦") | |
| 21 | - private String name; | |
| 22 | - | |
| 23 | - @Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 24 | - private LocalDateTime startTime; | |
| 25 | - | |
| 26 | - @Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 27 | - private LocalDateTime endTime; | |
| 28 | - | |
| 29 | - @Schema(description = "条件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 30 | - private Integer conditionType; | |
| 31 | - | |
| 32 | - @Schema(description = "商品范围", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 33 | - private Integer productScope; | |
| 34 | - | |
| 35 | - @Schema(description = "商品 SPU 编号的数组", example = "1,2,3") | |
| 36 | - private List<Long> productScopeValues; | |
| 37 | - | |
| 38 | - @Schema(description = "优惠规则的数组") | |
| 39 | - private List<Rule> rules; | |
| 40 | - | |
| 41 | - @Schema(description = "优惠规则") | |
| 42 | - @Data | |
| 43 | - public static class Rule extends RewardActivityBaseVO.Rule { | |
| 44 | - | |
| 45 | - @Schema(description = "规则描述") | |
| 46 | - private String description; // 通过 {@link #limit}、{@link #discountPrice} 等字段进行拼接 | |
| 47 | - | |
| 48 | - } | |
| 49 | - | |
| 50 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillConfigController.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.seckill; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.config.AppSeckillConfigRespVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.convert.seckill.SeckillConfigConvert; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillConfigDO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.service.seckill.SeckillConfigService; | |
| 9 | -import io.swagger.v3.oas.annotations.Operation; | |
| 10 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 11 | -import jakarta.annotation.security.PermitAll; | |
| 12 | -import org.springframework.validation.annotation.Validated; | |
| 13 | -import org.springframework.web.bind.annotation.GetMapping; | |
| 14 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 15 | -import org.springframework.web.bind.annotation.RestController; | |
| 16 | - | |
| 17 | -import jakarta.annotation.Resource; | |
| 18 | -import java.util.List; | |
| 19 | - | |
| 20 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 21 | - | |
| 22 | -@Tag(name = "用户 App - 秒杀时间段") | |
| 23 | -@RestController | |
| 24 | -@RequestMapping("/promotion/seckill-config") | |
| 25 | -@Validated | |
| 26 | -public class AppSeckillConfigController { | |
| 27 | - @Resource | |
| 28 | - private SeckillConfigService configService; | |
| 29 | - | |
| 30 | - @GetMapping("/list") | |
| 31 | - @Operation(summary = "获得秒杀时间段列表") | |
| 32 | - @PermitAll | |
| 33 | - public CommonResult<List<AppSeckillConfigRespVO>> getSeckillConfigList() { | |
| 34 | - List<SeckillConfigDO> list = configService.getSeckillConfigListByStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 35 | - return success(SeckillConfigConvert.INSTANCE.convertList2(list)); | |
| 36 | - } | |
| 37 | - | |
| 38 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityDetailRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | - | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | -import java.util.List; | |
| 8 | - | |
| 9 | -@Schema(description = "用户 App - 秒杀活动的详细 Response VO") | |
| 10 | -@Data | |
| 11 | -public class AppSeckillActivityDetailRespVO { | |
| 12 | - | |
| 13 | - @Schema(description = "秒杀活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | - private Long id; | |
| 15 | - | |
| 16 | - @Schema(description = "秒杀活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晚九点限时秒杀") | |
| 17 | - private String name; | |
| 18 | - | |
| 19 | - @Schema(description = "活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 20 | - private Integer status; | |
| 21 | - | |
| 22 | - @Schema(description = "活动开始时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 23 | - private LocalDateTime startTime; | |
| 24 | - | |
| 25 | - @Schema(description = "活动结束时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 26 | - private LocalDateTime endTime; | |
| 27 | - | |
| 28 | - @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 29 | - private Long spuId; | |
| 30 | - | |
| 31 | - @Schema(description = "总共限购数量", example = "10") | |
| 32 | - private Integer totalLimitCount; | |
| 33 | - | |
| 34 | - @Schema(description = "单次限购数量", example = "5") | |
| 35 | - private Integer singleLimitCount; | |
| 36 | - | |
| 37 | - @Schema(description = "秒杀库存(剩余)", requiredMode = Schema.RequiredMode.REQUIRED, example = "50") | |
| 38 | - private Integer stock; | |
| 39 | - | |
| 40 | - @Schema(description = "秒杀库存(总计)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | |
| 41 | - private Integer totalStock; | |
| 42 | - | |
| 43 | - @Schema(description = "商品信息数组", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 44 | - private List<Product> products; | |
| 45 | - | |
| 46 | - @Schema(description = "商品信息") | |
| 47 | - @Data | |
| 48 | - public static class Product { | |
| 49 | - | |
| 50 | - @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "4096") | |
| 51 | - private Long skuId; | |
| 52 | - | |
| 53 | - @Schema(description = "秒杀金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | |
| 54 | - private Integer seckillPrice; | |
| 55 | - | |
| 56 | - @Schema(description = "秒杀限量库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "50") | |
| 57 | - private Integer stock; | |
| 58 | - | |
| 59 | - } | |
| 60 | - | |
| 61 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityNowRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.config.AppSeckillConfigRespVO; | |
| 4 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | -import lombok.Data; | |
| 6 | - | |
| 7 | -import java.util.List; | |
| 8 | - | |
| 9 | -@Schema(description = "用户 App - 当前秒杀活动 Response VO") | |
| 10 | -@Data | |
| 11 | -public class AppSeckillActivityNowRespVO { | |
| 12 | - | |
| 13 | - @Schema(description = "秒杀时间段", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 14 | - private AppSeckillConfigRespVO config; | |
| 15 | - | |
| 16 | - @Schema(description = "秒杀活动数组", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 17 | - private List<AppSeckillActivityRespVO> activities; | |
| 18 | - | |
| 19 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityPageReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | -import lombok.Data; | |
| 6 | -import lombok.EqualsAndHashCode; | |
| 7 | -import lombok.ToString; | |
| 8 | - | |
| 9 | -@Schema(description = "用户 App - 商品评价分页 Request VO") | |
| 10 | -@Data | |
| 11 | -@EqualsAndHashCode(callSuper = true) | |
| 12 | -@ToString(callSuper = true) | |
| 13 | -public class AppSeckillActivityPageReqVO extends PageParam { | |
| 14 | - | |
| 15 | - @Schema(description = "秒杀配置编号", example = "1024") | |
| 16 | - private Long configId; | |
| 17 | - | |
| 18 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | - | |
| 6 | -@Schema(description = "用户 App - 秒杀活动 Response VO") | |
| 7 | -@Data | |
| 8 | -public class AppSeckillActivityRespVO { | |
| 9 | - | |
| 10 | - @Schema(description = "秒杀活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 11 | - private Long id; | |
| 12 | - | |
| 13 | - @Schema(description = "秒杀活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晚九点限时秒杀") | |
| 14 | - private String name; | |
| 15 | - | |
| 16 | - @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 17 | - private Long spuId; | |
| 18 | - | |
| 19 | - @Schema(description = "商品 SPU 名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "一个白菜") | |
| 20 | - private String spuName; // 从 SPU 的 name 读取 | |
| 21 | - | |
| 22 | - @Schema(description = "商品图片", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 picUrl 读取 | |
| 23 | - example = "https://www.iocoder.cn/xx.png") | |
| 24 | - private String picUrl; | |
| 25 | - | |
| 26 | - @Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 marketPrice 读取 | |
| 27 | - example = "50") | |
| 28 | - private Integer marketPrice; | |
| 29 | - | |
| 30 | - @Schema(description = "秒杀活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 31 | - private Integer status; | |
| 32 | - | |
| 33 | - @Schema(description = "秒杀库存(剩余)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | |
| 34 | - private Integer stock; | |
| 35 | - @Schema(description = "秒杀库存(总共)", requiredMode = Schema.RequiredMode.REQUIRED, example = "200") | |
| 36 | - private Integer totalStock; | |
| 37 | - | |
| 38 | - @Schema(description = "秒杀金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | |
| 39 | - private Integer seckillPrice; | |
| 40 | - | |
| 41 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/config/AppSeckillConfigRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.config; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | - | |
| 6 | -import java.util.List; | |
| 7 | - | |
| 8 | -@Schema(description = "用户 App - 秒杀时间段 Response VO") | |
| 9 | -@Data | |
| 10 | -public class AppSeckillConfigRespVO { | |
| 11 | - | |
| 12 | - @Schema(description = "秒杀时间段编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 13 | - private Long id; | |
| 14 | - | |
| 15 | - @Schema(description = "开始时间点", requiredMode = Schema.RequiredMode.REQUIRED, example = "09:00") | |
| 16 | - private String startTime; | |
| 17 | - @Schema(description = "结束时间点", requiredMode = Schema.RequiredMode.REQUIRED, example = "09:59") | |
| 18 | - private String endTime; | |
| 19 | - | |
| 20 | - @Schema(description = "轮播图", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 21 | - private List<String> sliderPicUrls; | |
| 22 | - | |
| 23 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleCategoryConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.convert.article; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.*; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.app.article.vo.category.AppArticleCategoryRespVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; | |
| 7 | -import org.mapstruct.Mapper; | |
| 8 | -import org.mapstruct.factory.Mappers; | |
| 9 | - | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 文章分类 Convert | |
| 14 | - * | |
| 15 | - * @author HUIHUI | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface ArticleCategoryConvert { | |
| 19 | - | |
| 20 | - ArticleCategoryConvert INSTANCE = Mappers.getMapper(ArticleCategoryConvert.class); | |
| 21 | - | |
| 22 | - ArticleCategoryDO convert(ArticleCategoryCreateReqVO bean); | |
| 23 | - | |
| 24 | - ArticleCategoryDO convert(ArticleCategoryUpdateReqVO bean); | |
| 25 | - | |
| 26 | - ArticleCategoryRespVO convert(ArticleCategoryDO bean); | |
| 27 | - | |
| 28 | - List<ArticleCategoryRespVO> convertList(List<ArticleCategoryDO> list); | |
| 29 | - | |
| 30 | - PageResult<ArticleCategoryRespVO> convertPage(PageResult<ArticleCategoryDO> page); | |
| 31 | - | |
| 32 | - List<ArticleCategorySimpleRespVO> convertList03(List<ArticleCategoryDO> list); | |
| 33 | - | |
| 34 | - List<AppArticleCategoryRespVO> convertList04(List<ArticleCategoryDO> categoryList); | |
| 35 | - | |
| 36 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.convert.article; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleRespVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticleRespVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; | |
| 9 | -import org.mapstruct.Mapper; | |
| 10 | -import org.mapstruct.factory.Mappers; | |
| 11 | - | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 文章管理 Convert | |
| 16 | - * | |
| 17 | - * @author HUIHUI | |
| 18 | - */ | |
| 19 | -@Mapper | |
| 20 | -public interface ArticleConvert { | |
| 21 | - | |
| 22 | - ArticleConvert INSTANCE = Mappers.getMapper(ArticleConvert.class); | |
| 23 | - | |
| 24 | - ArticleDO convert(ArticleCreateReqVO bean); | |
| 25 | - | |
| 26 | - ArticleDO convert(ArticleUpdateReqVO bean); | |
| 27 | - | |
| 28 | - ArticleRespVO convert(ArticleDO bean); | |
| 29 | - | |
| 30 | - List<ArticleRespVO> convertList(List<ArticleDO> list); | |
| 31 | - | |
| 32 | - PageResult<ArticleRespVO> convertPage(PageResult<ArticleDO> page); | |
| 33 | - | |
| 34 | - AppArticleRespVO convert01(ArticleDO article); | |
| 35 | - | |
| 36 | - PageResult<AppArticleRespVO> convertPage02(PageResult<ArticleDO> articlePage); | |
| 37 | - | |
| 38 | - List<AppArticleRespVO> convertList03(List<ArticleDO> articleCategoryListByRecommendHotAndRecommendBanner); | |
| 39 | - | |
| 40 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/banner/BannerConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.convert.banner; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerRespVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.app.banner.vo.AppBannerRespVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.banner.BannerDO; | |
| 9 | -import org.mapstruct.Mapper; | |
| 10 | -import org.mapstruct.factory.Mappers; | |
| 11 | - | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -@Mapper | |
| 15 | -public interface BannerConvert { | |
| 16 | - | |
| 17 | - BannerConvert INSTANCE = Mappers.getMapper(BannerConvert.class); | |
| 18 | - | |
| 19 | - List<BannerRespVO> convertList(List<BannerDO> list); | |
| 20 | - | |
| 21 | - PageResult<BannerRespVO> convertPage(PageResult<BannerDO> pageResult); | |
| 22 | - | |
| 23 | - BannerRespVO convert(BannerDO banner); | |
| 24 | - | |
| 25 | - BannerDO convert(BannerCreateReqVO createReqVO); | |
| 26 | - | |
| 27 | - BannerDO convert(BannerUpdateReqVO updateReqVO); | |
| 28 | - | |
| 29 | - List<AppBannerRespVO> convertList01(List<BannerDO> bannerList); | |
| 30 | - | |
| 31 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/bargain/BargainHelpConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.convert.bargain; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 5 | -import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.help.BargainHelpRespVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBargainHelpRespVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainHelpDO; | |
| 9 | -import org.mapstruct.Mapper; | |
| 10 | -import org.mapstruct.factory.Mappers; | |
| 11 | - | |
| 12 | -import java.util.List; | |
| 13 | -import java.util.Map; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * 砍价助力 Convert | |
| 17 | - * | |
| 18 | - * @author 芋道源码 | |
| 19 | - */ | |
| 20 | -@Mapper | |
| 21 | -public interface BargainHelpConvert { | |
| 22 | - | |
| 23 | - BargainHelpConvert INSTANCE = Mappers.getMapper(BargainHelpConvert.class); | |
| 24 | - | |
| 25 | - default PageResult<BargainHelpRespVO> convertPage(PageResult<BargainHelpDO> page, | |
| 26 | - Map<Long, MemberUserRespDTO> userMap) { | |
| 27 | - PageResult<BargainHelpRespVO> pageResult = convertPage(page); | |
| 28 | - // 拼接数据 | |
| 29 | - pageResult.getList().forEach(record -> | |
| 30 | - MapUtils.findAndThen(userMap, record.getUserId(), | |
| 31 | - user -> record.setNickname(user.getNickname()).setAvatar(user.getAvatar()))); | |
| 32 | - return pageResult; | |
| 33 | - } | |
| 34 | - PageResult<BargainHelpRespVO> convertPage(PageResult<BargainHelpDO> page); | |
| 35 | - | |
| 36 | - default List<AppBargainHelpRespVO> convertList(List<BargainHelpDO> helps, | |
| 37 | - Map<Long, MemberUserRespDTO> userMap) { | |
| 38 | - List<AppBargainHelpRespVO> helpVOs = convertList02(helps); | |
| 39 | - helpVOs.forEach(help -> | |
| 40 | - MapUtils.findAndThen(userMap, help.getUserId(), | |
| 41 | - user -> help.setNickname(user.getNickname()).setAvatar(user.getAvatar()))); | |
| 42 | - return helpVOs; | |
| 43 | - } | |
| 44 | - List<AppBargainHelpRespVO> convertList02(List<BargainHelpDO> helps); | |
| 45 | - | |
| 46 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/coupon/CouponConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.convert.coupon; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponRespDTO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon.CouponPageItemRespVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon.CouponPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.app.coupon.vo.coupon.AppCouponPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponDO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponTemplateDO; | |
| 10 | -import cn.iocoder.yudao.module.promotion.enums.coupon.CouponStatusEnum; | |
| 11 | -import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTemplateValidityTypeEnum; | |
| 12 | -import org.mapstruct.Mapper; | |
| 13 | -import org.mapstruct.factory.Mappers; | |
| 14 | - | |
| 15 | -import java.time.LocalDateTime; | |
| 16 | -import java.util.Collection; | |
| 17 | - | |
| 18 | -/** | |
| 19 | - * 优惠劵 Convert | |
| 20 | - * | |
| 21 | - * @author 芋道源码 | |
| 22 | - */ | |
| 23 | -@Mapper | |
| 24 | -public interface CouponConvert { | |
| 25 | - | |
| 26 | - CouponConvert INSTANCE = Mappers.getMapper(CouponConvert.class); | |
| 27 | - | |
| 28 | - PageResult<CouponPageItemRespVO> convertPage(PageResult<CouponDO> page); | |
| 29 | - | |
| 30 | - CouponRespDTO convert(CouponDO bean); | |
| 31 | - | |
| 32 | - default CouponDO convert(CouponTemplateDO template, Long userId) { | |
| 33 | - CouponDO couponDO = new CouponDO() | |
| 34 | - .setTemplateId(template.getId()) | |
| 35 | - .setName(template.getName()) | |
| 36 | - .setTakeType(template.getTakeType()) | |
| 37 | - .setUsePrice(template.getUsePrice()) | |
| 38 | - .setProductScope(template.getProductScope()) | |
| 39 | - .setProductScopeValues(template.getProductScopeValues()) | |
| 40 | - .setDiscountType(template.getDiscountType()) | |
| 41 | - .setDiscountPercent(template.getDiscountPercent()) | |
| 42 | - .setDiscountPrice(template.getDiscountPrice()) | |
| 43 | - .setDiscountLimitPrice(template.getDiscountLimitPrice()) | |
| 44 | - .setStatus(CouponStatusEnum.UNUSED.getStatus()) | |
| 45 | - .setUserId(userId); | |
| 46 | - if (CouponTemplateValidityTypeEnum.DATE.getType().equals(template.getValidityType())) { | |
| 47 | - couponDO.setValidStartTime(template.getValidStartTime()); | |
| 48 | - couponDO.setValidEndTime(template.getValidEndTime()); | |
| 49 | - } else if (CouponTemplateValidityTypeEnum.TERM.getType().equals(template.getValidityType())) { | |
| 50 | - couponDO.setValidStartTime(LocalDateTime.now().plusDays(template.getFixedStartTerm())); | |
| 51 | - couponDO.setValidEndTime(LocalDateTime.now().plusDays(template.getFixedEndTerm())); | |
| 52 | - } | |
| 53 | - return couponDO; | |
| 54 | - } | |
| 55 | - | |
| 56 | - CouponPageReqVO convert(AppCouponPageReqVO pageReqVO, Collection<Long> userIds); | |
| 57 | - | |
| 58 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/coupon/CouponTemplateConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.convert.coupon; | |
| 2 | - | |
| 3 | -import cn.hutool.core.map.MapUtil; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplateCreateReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplatePageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplateRespVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplateUpdateReqVO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.controller.app.coupon.vo.template.AppCouponTemplatePageReqVO; | |
| 10 | -import cn.iocoder.yudao.module.promotion.controller.app.coupon.vo.template.AppCouponTemplateRespVO; | |
| 11 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponTemplateDO; | |
| 12 | -import org.mapstruct.Mapper; | |
| 13 | -import org.mapstruct.factory.Mappers; | |
| 14 | - | |
| 15 | -import java.util.List; | |
| 16 | -import java.util.Map; | |
| 17 | - | |
| 18 | -/** | |
| 19 | - * 优惠劵模板 Convert | |
| 20 | - * | |
| 21 | - * @author 芋道源码 | |
| 22 | - */ | |
| 23 | -@Mapper | |
| 24 | -public interface CouponTemplateConvert { | |
| 25 | - | |
| 26 | - CouponTemplateConvert INSTANCE = Mappers.getMapper(CouponTemplateConvert.class); | |
| 27 | - | |
| 28 | - CouponTemplateDO convert(CouponTemplateCreateReqVO bean); | |
| 29 | - | |
| 30 | - CouponTemplateDO convert(CouponTemplateUpdateReqVO bean); | |
| 31 | - | |
| 32 | - CouponTemplateRespVO convert(CouponTemplateDO bean); | |
| 33 | - | |
| 34 | - PageResult<CouponTemplateRespVO> convertPage(PageResult<CouponTemplateDO> page); | |
| 35 | - | |
| 36 | - CouponTemplatePageReqVO convert(AppCouponTemplatePageReqVO pageReqVO, List<Integer> canTakeTypes, Integer productScope, Long productScopeValue); | |
| 37 | - | |
| 38 | - PageResult<AppCouponTemplateRespVO> convertAppPage(PageResult<CouponTemplateDO> pageResult); | |
| 39 | - | |
| 40 | - List<AppCouponTemplateRespVO> convertAppList(List<CouponTemplateDO> list); | |
| 41 | - | |
| 42 | - default PageResult<AppCouponTemplateRespVO> convertAppPage(PageResult<CouponTemplateDO> pageResult, Map<Long, Boolean> userCanTakeMap) { | |
| 43 | - PageResult<AppCouponTemplateRespVO> result = convertAppPage(pageResult); | |
| 44 | - copyTo(result.getList(), userCanTakeMap); | |
| 45 | - return result; | |
| 46 | - } | |
| 47 | - | |
| 48 | - default List<AppCouponTemplateRespVO> convertAppList(List<CouponTemplateDO> list, Map<Long, Boolean> userCanTakeMap) { | |
| 49 | - List<AppCouponTemplateRespVO> result = convertAppList(list); | |
| 50 | - copyTo(result, userCanTakeMap); | |
| 51 | - return result; | |
| 52 | - } | |
| 53 | - | |
| 54 | - default void copyTo(List<AppCouponTemplateRespVO> list, Map<Long, Boolean> userCanTakeMap) { | |
| 55 | - for (AppCouponTemplateRespVO template : list) { | |
| 56 | - // 检查已领取数量是否超过限领数量 | |
| 57 | - template.setCanTake(MapUtil.getBool(userCanTakeMap, template.getId(), false)); | |
| 58 | - } | |
| 59 | - } | |
| 60 | - | |
| 61 | - List<CouponTemplateRespVO> convertList(List<CouponTemplateDO> list); | |
| 62 | - | |
| 63 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/discount/DiscountActivityConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.convert.discount; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.discount.vo.DiscountActivityBaseVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.discount.vo.DiscountActivityCreateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.discount.vo.DiscountActivityRespVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.admin.discount.vo.DiscountActivityUpdateReqVO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.discount.DiscountActivityDO; | |
| 10 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.discount.DiscountProductDO; | |
| 11 | -import org.mapstruct.Mapper; | |
| 12 | -import org.mapstruct.factory.Mappers; | |
| 13 | - | |
| 14 | -import java.util.List; | |
| 15 | - | |
| 16 | -/** | |
| 17 | - * 限时折扣活动 Convert | |
| 18 | - * | |
| 19 | - * @author 芋道源码 | |
| 20 | - */ | |
| 21 | -@Mapper | |
| 22 | -public interface DiscountActivityConvert { | |
| 23 | - | |
| 24 | - DiscountActivityConvert INSTANCE = Mappers.getMapper(DiscountActivityConvert.class); | |
| 25 | - | |
| 26 | - DiscountActivityDO convert(DiscountActivityCreateReqVO bean); | |
| 27 | - | |
| 28 | - DiscountActivityDO convert(DiscountActivityUpdateReqVO bean); | |
| 29 | - | |
| 30 | - DiscountActivityRespVO convert(DiscountActivityDO bean); | |
| 31 | - | |
| 32 | - List<DiscountActivityRespVO> convertList(List<DiscountActivityDO> list); | |
| 33 | - | |
| 34 | - List<DiscountActivityBaseVO.Product> convertList2(List<DiscountProductDO> list); | |
| 35 | - | |
| 36 | - PageResult<DiscountActivityRespVO> convertPage(PageResult<DiscountActivityDO> page); | |
| 37 | - | |
| 38 | - default PageResult<DiscountActivityRespVO> convertPage(PageResult<DiscountActivityDO> page, | |
| 39 | - List<DiscountProductDO> discountProductDOList) { | |
| 40 | - PageResult<DiscountActivityRespVO> pageResult = convertPage(page); | |
| 41 | - pageResult.getList().forEach(item -> item.setProducts(convertList2(discountProductDOList))); | |
| 42 | - return pageResult; | |
| 43 | - } | |
| 44 | - | |
| 45 | - DiscountProductDO convert(DiscountActivityBaseVO.Product bean); | |
| 46 | - | |
| 47 | - default DiscountActivityRespVO convert(DiscountActivityDO activity, List<DiscountProductDO> products) { | |
| 48 | - return BeanUtils.toBean(activity, DiscountActivityRespVO.class).setProducts(convertList2(products)); | |
| 49 | - } | |
| 50 | - | |
| 51 | -} | |
| 52 | 0 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/diy/DiyPageConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.convert.diy; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.*; | |
| 5 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; | |
| 6 | -import org.mapstruct.Mapper; | |
| 7 | -import org.mapstruct.factory.Mappers; | |
| 8 | - | |
| 9 | -import java.util.List; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 装修页面 Convert | |
| 13 | - * | |
| 14 | - * @author owen | |
| 15 | - */ | |
| 16 | -@Mapper | |
| 17 | -public interface DiyPageConvert { | |
| 18 | - | |
| 19 | - DiyPageConvert INSTANCE = Mappers.getMapper(DiyPageConvert.class); | |
| 20 | - | |
| 21 | - DiyPageDO convert(DiyPageCreateReqVO bean); | |
| 22 | - | |
| 23 | - DiyPageDO convert(DiyPageUpdateReqVO bean); | |
| 24 | - | |
| 25 | - DiyPageRespVO convert(DiyPageDO bean); | |
| 26 | - | |
| 27 | - List<DiyPageRespVO> convertList(List<DiyPageDO> list); | |
| 28 | - | |
| 29 | - PageResult<DiyPageRespVO> convertPage(PageResult<DiyPageDO> page); | |
| 30 | - | |
| 31 | - DiyPageCreateReqVO convertCreateVo(Long templateId, String name, String remark); | |
| 32 | - | |
| 33 | - DiyPagePropertyRespVO convertPropertyVo(DiyPageDO diyPage); | |
| 34 | - | |
| 35 | - DiyPageDO convert(DiyPagePropertyUpdateRequestVO updateReqVO); | |
| 36 | - | |
| 37 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/diy/DiyTemplateConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.convert.diy; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.*; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.app.diy.vo.AppDiyTemplatePropertyRespVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; | |
| 8 | -import org.mapstruct.Mapper; | |
| 9 | -import org.mapstruct.factory.Mappers; | |
| 10 | - | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 装修模板 Convert | |
| 15 | - * | |
| 16 | - * @author owen | |
| 17 | - */ | |
| 18 | -@Mapper | |
| 19 | -public interface DiyTemplateConvert { | |
| 20 | - | |
| 21 | - DiyTemplateConvert INSTANCE = Mappers.getMapper(DiyTemplateConvert.class); | |
| 22 | - | |
| 23 | - DiyTemplateDO convert(DiyTemplateCreateReqVO bean); | |
| 24 | - | |
| 25 | - DiyTemplateDO convert(DiyTemplateUpdateReqVO bean); | |
| 26 | - | |
| 27 | - DiyTemplateRespVO convert(DiyTemplateDO bean); | |
| 28 | - | |
| 29 | - List<DiyTemplateRespVO> convertList(List<DiyTemplateDO> list); | |
| 30 | - | |
| 31 | - PageResult<DiyTemplateRespVO> convertPage(PageResult<DiyTemplateDO> page); | |
| 32 | - | |
| 33 | - DiyTemplatePropertyRespVO convertPropertyVo(DiyTemplateDO diyTemplate, List<DiyPageDO> pages); | |
| 34 | - | |
| 35 | - AppDiyTemplatePropertyRespVO convertPropertyVo2(DiyTemplateDO diyTemplate, String home, String user); | |
| 36 | - | |
| 37 | - DiyTemplateDO convert(DiyTemplatePropertyUpdateRequestVO updateReqVO); | |
| 38 | - | |
| 39 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/SeckillConfigConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.convert.seckill; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigRespVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigSimpleRespVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.config.AppSeckillConfigRespVO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillConfigDO; | |
| 10 | -import org.mapstruct.Mapper; | |
| 11 | -import org.mapstruct.factory.Mappers; | |
| 12 | - | |
| 13 | -import java.util.List; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * 秒杀时段 Convert | |
| 17 | - * | |
| 18 | - * @author 芋道源码 | |
| 19 | - */ | |
| 20 | -@Mapper | |
| 21 | -public interface SeckillConfigConvert { | |
| 22 | - | |
| 23 | - SeckillConfigConvert INSTANCE = Mappers.getMapper(SeckillConfigConvert.class); | |
| 24 | - | |
| 25 | - SeckillConfigDO convert(SeckillConfigCreateReqVO bean); | |
| 26 | - | |
| 27 | - SeckillConfigDO convert(SeckillConfigUpdateReqVO bean); | |
| 28 | - | |
| 29 | - SeckillConfigRespVO convert(SeckillConfigDO bean); | |
| 30 | - | |
| 31 | - List<SeckillConfigRespVO> convertList(List<SeckillConfigDO> list); | |
| 32 | - | |
| 33 | - List<SeckillConfigSimpleRespVO> convertList1(List<SeckillConfigDO> list); | |
| 34 | - | |
| 35 | - PageResult<SeckillConfigRespVO> convertPage(PageResult<SeckillConfigDO> page); | |
| 36 | - | |
| 37 | - List<AppSeckillConfigRespVO> convertList2(List<SeckillConfigDO> list); | |
| 38 | - | |
| 39 | - AppSeckillConfigRespVO convert1(SeckillConfigDO filteredConfig); | |
| 40 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/article/ArticleCategoryDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.article; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | -import lombok.*; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 文章分类 DO | |
| 12 | - * | |
| 13 | - * @author HUIHUI | |
| 14 | - */ | |
| 15 | -@TableName("promotion_article_category") | |
| 16 | -@KeySequence("promotion_article_category_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 17 | -@Data | |
| 18 | -@EqualsAndHashCode(callSuper = true) | |
| 19 | -@ToString(callSuper = true) | |
| 20 | -@Builder | |
| 21 | -@NoArgsConstructor | |
| 22 | -@AllArgsConstructor | |
| 23 | -public class ArticleCategoryDO extends BaseDO { | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 文章分类编号 | |
| 27 | - */ | |
| 28 | - @TableId | |
| 29 | - private Long id; | |
| 30 | - /** | |
| 31 | - * 文章分类名称 | |
| 32 | - */ | |
| 33 | - private String name; | |
| 34 | - /** | |
| 35 | - * 图标地址 | |
| 36 | - */ | |
| 37 | - private String picUrl; | |
| 38 | - /** | |
| 39 | - * 状态 | |
| 40 | - * | |
| 41 | - * 枚举 {@link CommonStatusEnum} | |
| 42 | - */ | |
| 43 | - private Integer status; | |
| 44 | - /** | |
| 45 | - * 排序 | |
| 46 | - */ | |
| 47 | - private Integer sort; | |
| 48 | - | |
| 49 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/article/ArticleDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.article; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | -import lombok.*; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 文章管理 DO | |
| 12 | - * | |
| 13 | - * @author HUIHUI | |
| 14 | - */ | |
| 15 | -@TableName("promotion_article") | |
| 16 | -@KeySequence("promotion_article_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 17 | -@Data | |
| 18 | -@EqualsAndHashCode(callSuper = true) | |
| 19 | -@ToString(callSuper = true) | |
| 20 | -@Builder | |
| 21 | -@NoArgsConstructor | |
| 22 | -@AllArgsConstructor | |
| 23 | -public class ArticleDO extends BaseDO { | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 文章管理编号 | |
| 27 | - */ | |
| 28 | - @TableId | |
| 29 | - private Long id; | |
| 30 | - /** | |
| 31 | - * 分类编号 ArticleCategoryDO#id | |
| 32 | - */ | |
| 33 | - private Long categoryId; | |
| 34 | - /** | |
| 35 | - * 关联商品编号 ProductSpuDO#id | |
| 36 | - */ | |
| 37 | - private Long spuId; | |
| 38 | - /** | |
| 39 | - * 文章标题 | |
| 40 | - */ | |
| 41 | - private String title; | |
| 42 | - /** | |
| 43 | - * 文章作者 | |
| 44 | - */ | |
| 45 | - private String author; | |
| 46 | - /** | |
| 47 | - * 文章封面图片地址 | |
| 48 | - */ | |
| 49 | - private String picUrl; | |
| 50 | - /** | |
| 51 | - * 文章简介 | |
| 52 | - */ | |
| 53 | - private String introduction; | |
| 54 | - /** | |
| 55 | - * 浏览次数 | |
| 56 | - */ | |
| 57 | - private Integer browseCount; | |
| 58 | - /** | |
| 59 | - * 排序 | |
| 60 | - */ | |
| 61 | - private Integer sort; | |
| 62 | - /** | |
| 63 | - * 状态 | |
| 64 | - * | |
| 65 | - * 枚举 {@link CommonStatusEnum} | |
| 66 | - */ | |
| 67 | - private Integer status; | |
| 68 | - /** | |
| 69 | - * 是否热门(小程序) | |
| 70 | - */ | |
| 71 | - private Boolean recommendHot; | |
| 72 | - /** | |
| 73 | - * 是否轮播图(小程序) | |
| 74 | - */ | |
| 75 | - private Boolean recommendBanner; | |
| 76 | - /** | |
| 77 | - * 文章内容 | |
| 78 | - */ | |
| 79 | - private String content; | |
| 80 | - | |
| 81 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/banner/BannerDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.banner; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.enums.banner.BannerPositionEnum; | |
| 6 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | -import lombok.*; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * banner DO | |
| 12 | - * | |
| 13 | - * @author xia | |
| 14 | - */ | |
| 15 | -@TableName("promotion_banner") | |
| 16 | -@KeySequence("promotion_banner_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 17 | -@Data | |
| 18 | -@EqualsAndHashCode(callSuper = true) | |
| 19 | -@ToString(callSuper = true) | |
| 20 | -@Builder | |
| 21 | -@NoArgsConstructor | |
| 22 | -@AllArgsConstructor | |
| 23 | -public class BannerDO extends BaseDO { | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 编号 | |
| 27 | - */ | |
| 28 | - private Long id; | |
| 29 | - /** | |
| 30 | - * 标题 | |
| 31 | - */ | |
| 32 | - private String title; | |
| 33 | - /** | |
| 34 | - * 跳转链接 | |
| 35 | - */ | |
| 36 | - private String url; | |
| 37 | - /** | |
| 38 | - * 图片链接 | |
| 39 | - */ | |
| 40 | - private String picUrl; | |
| 41 | - /** | |
| 42 | - * 排序 | |
| 43 | - */ | |
| 44 | - private Integer sort; | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 状态 {@link CommonStatusEnum} | |
| 48 | - */ | |
| 49 | - private Integer status; | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * 定位 {@link BannerPositionEnum} | |
| 53 | - */ | |
| 54 | - private Integer position; | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * 备注 | |
| 58 | - */ | |
| 59 | - private String memo; | |
| 60 | - | |
| 61 | - /** | |
| 62 | - * 点击次数 | |
| 63 | - */ | |
| 64 | - private Integer browseCount; | |
| 65 | - | |
| 66 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/bargain/BargainActivityDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.bargain; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | -import lombok.*; | |
| 9 | - | |
| 10 | -import java.time.LocalDateTime; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 砍价活动 DO | |
| 14 | - * | |
| 15 | - * @author HUIHUI | |
| 16 | - */ | |
| 17 | -@TableName("promotion_bargain_activity") | |
| 18 | -@KeySequence("promotion_bargain_activity_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 19 | -@Data | |
| 20 | -@EqualsAndHashCode(callSuper = true) | |
| 21 | -@ToString(callSuper = true) | |
| 22 | -@Builder | |
| 23 | -@NoArgsConstructor | |
| 24 | -@AllArgsConstructor | |
| 25 | -public class BargainActivityDO extends BaseDO { | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 砍价活动编号 | |
| 29 | - */ | |
| 30 | - @TableId | |
| 31 | - private Long id; | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * 砍价活动名称 | |
| 35 | - */ | |
| 36 | - private String name; | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 活动开始时间 | |
| 40 | - */ | |
| 41 | - private LocalDateTime startTime; | |
| 42 | - /** | |
| 43 | - * 活动结束时间 | |
| 44 | - */ | |
| 45 | - private LocalDateTime endTime; | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * 活动状态 | |
| 49 | - * | |
| 50 | - * 枚举 {@link CommonStatusEnum} | |
| 51 | - */ | |
| 52 | - private Integer status; | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * 商品 SPU 编号 | |
| 56 | - */ | |
| 57 | - private Long spuId; | |
| 58 | - /** | |
| 59 | - * 商品 SKU 编号 | |
| 60 | - */ | |
| 61 | - private Long skuId; | |
| 62 | - /** | |
| 63 | - * 砍价起始价格,单位:分 | |
| 64 | - */ | |
| 65 | - private Integer bargainFirstPrice; | |
| 66 | - /** | |
| 67 | - * 砍价底价,单位:分 | |
| 68 | - */ | |
| 69 | - private Integer bargainMinPrice; | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * 砍价库存(剩余库存砍价时扣减) | |
| 73 | - */ | |
| 74 | - private Integer stock; | |
| 75 | - /** | |
| 76 | - * 砍价总库存 | |
| 77 | - */ | |
| 78 | - private Integer totalStock; | |
| 79 | - | |
| 80 | - /** | |
| 81 | - * 砍价人数 | |
| 82 | - * | |
| 83 | - * 需要多少人,砍价才能成功,即 {@link BargainRecordDO#getStatus()} 更新为 {@link BargainRecordDO#getStatus()} 成功状态 | |
| 84 | - */ | |
| 85 | - private Integer helpMaxCount; | |
| 86 | - /** | |
| 87 | - * 帮砍次数 | |
| 88 | - * | |
| 89 | - * 单个活动,用户可以帮砍的次数。 | |
| 90 | - * 例如说:帮砍次数为 1 时,A 和 B 同时将该活动链接发给 C,C 只能帮其中一个人砍价。 | |
| 91 | - */ | |
| 92 | - private Integer bargainCount; | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * 总限购数量 | |
| 96 | - */ | |
| 97 | - private Integer totalLimitCount; | |
| 98 | - /** | |
| 99 | - * 用户每次砍价的最小金额,单位:分 | |
| 100 | - */ | |
| 101 | - private Integer randomMinPrice; | |
| 102 | - /** | |
| 103 | - * 用户每次砍价的最大金额,单位:分 | |
| 104 | - */ | |
| 105 | - private Integer randomMaxPrice; | |
| 106 | - | |
| 107 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/bargain/BargainHelpDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.bargain; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 5 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | -import lombok.*; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * 砍价助力 DO | |
| 11 | - * | |
| 12 | - * @author HUIHUI | |
| 13 | - */ | |
| 14 | -@TableName("promotion_bargain_help") | |
| 15 | -@KeySequence("promotion_bargain_help_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 16 | -@Data | |
| 17 | -@EqualsAndHashCode(callSuper = true) | |
| 18 | -@ToString(callSuper = true) | |
| 19 | -@Builder | |
| 20 | -@NoArgsConstructor | |
| 21 | -@AllArgsConstructor | |
| 22 | -public class BargainHelpDO extends BaseDO { | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 编号 | |
| 26 | - */ | |
| 27 | - @TableId | |
| 28 | - private Long id; | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * 砍价活动编号 | |
| 32 | - * | |
| 33 | - * 关联 {@link BargainActivityDO#getId()} 字段 | |
| 34 | - */ | |
| 35 | - private Long activityId; | |
| 36 | - /** | |
| 37 | - * 砍价记录编号 | |
| 38 | - * | |
| 39 | - * 关联 {@link BargainRecordDO#getId()} 字段 | |
| 40 | - */ | |
| 41 | - private Long recordId; | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * 用户编号 | |
| 45 | - */ | |
| 46 | - private Long userId; | |
| 47 | - /** | |
| 48 | - * 减少价格,单位:分 | |
| 49 | - */ | |
| 50 | - private Integer reducePrice; | |
| 51 | - | |
| 52 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/bargain/BargainRecordDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.bargain; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | -import cn.iocoder.yudao.module.promotion.enums.bargain.BargainRecordStatusEnum; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | -import lombok.*; | |
| 9 | - | |
| 10 | -import java.time.LocalDateTime; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 砍价记录 DO TODO | |
| 14 | - * | |
| 15 | - * @author HUIHUI | |
| 16 | - */ | |
| 17 | -@TableName("promotion_bargain_record") | |
| 18 | -@KeySequence("promotion_bargain_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 19 | -@Data | |
| 20 | -@EqualsAndHashCode(callSuper = true) | |
| 21 | -@ToString(callSuper = true) | |
| 22 | -@Builder | |
| 23 | -@NoArgsConstructor | |
| 24 | -@AllArgsConstructor | |
| 25 | -public class BargainRecordDO extends BaseDO { | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 编号 | |
| 29 | - */ | |
| 30 | - @TableId | |
| 31 | - private Long id; | |
| 32 | - /** | |
| 33 | - * 用户编号 | |
| 34 | - */ | |
| 35 | - private Long userId; | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * 砍价活动编号 | |
| 39 | - * | |
| 40 | - * 关联 {@link BargainActivityDO#getId()} 字段 | |
| 41 | - */ | |
| 42 | - private Long activityId; | |
| 43 | - /** | |
| 44 | - * 商品 SPU 编号 | |
| 45 | - */ | |
| 46 | - private Long spuId; | |
| 47 | - /** | |
| 48 | - * 商品 SKU 编号 | |
| 49 | - */ | |
| 50 | - private Long skuId; | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * 砍价起始价格,单位:分 | |
| 54 | - */ | |
| 55 | - private Integer bargainFirstPrice; | |
| 56 | - /** | |
| 57 | - * 当前砍价,单位:分 | |
| 58 | - */ | |
| 59 | - private Integer bargainPrice; | |
| 60 | - | |
| 61 | - /** | |
| 62 | - * 砍价状态 | |
| 63 | - * | |
| 64 | - * 砍价成功的条件是:(2 选 1) | |
| 65 | - * 1. 砍价到 {@link BargainActivityDO#getBargainMinPrice()} 底价 | |
| 66 | - * 2. 助力人数到达 {@link BargainActivityDO#getHelpMaxCount()} 人 | |
| 67 | - * | |
| 68 | - * 枚举 {@link BargainRecordStatusEnum} | |
| 69 | - */ | |
| 70 | - private Integer status; | |
| 71 | - /** | |
| 72 | - * 结束时间 | |
| 73 | - */ | |
| 74 | - private LocalDateTime endTime; | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * 订单编号 | |
| 78 | - */ | |
| 79 | - private Long orderId; | |
| 80 | - | |
| 81 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/combination/CombinationActivityDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.combination; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | -import lombok.*; | |
| 9 | - | |
| 10 | -import java.time.LocalDateTime; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 拼团活动 DO | |
| 14 | - * | |
| 15 | - * @author HUIHUI | |
| 16 | - */ | |
| 17 | -@TableName("promotion_combination_activity") | |
| 18 | -@KeySequence("promotion_combination_activity_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 19 | -@Data | |
| 20 | -@EqualsAndHashCode(callSuper = true) | |
| 21 | -@ToString(callSuper = true) | |
| 22 | -@Builder | |
| 23 | -@NoArgsConstructor | |
| 24 | -@AllArgsConstructor | |
| 25 | -public class CombinationActivityDO extends BaseDO { | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 活动编号 | |
| 29 | - */ | |
| 30 | - @TableId | |
| 31 | - private Long id; | |
| 32 | - /** | |
| 33 | - * 拼团名称 | |
| 34 | - */ | |
| 35 | - private String name; | |
| 36 | - /** | |
| 37 | - * 商品 SPU 编号 | |
| 38 | - * | |
| 39 | - * 关联 ProductSpuDO 的 id | |
| 40 | - */ | |
| 41 | - private Long spuId; | |
| 42 | - /** | |
| 43 | - * 总限购数量 | |
| 44 | - */ | |
| 45 | - private Integer totalLimitCount; | |
| 46 | - /** | |
| 47 | - * 单次限购数量 | |
| 48 | - */ | |
| 49 | - private Integer singleLimitCount; | |
| 50 | - /** | |
| 51 | - * 开始时间 | |
| 52 | - */ | |
| 53 | - private LocalDateTime startTime; | |
| 54 | - /** | |
| 55 | - * 结束时间 | |
| 56 | - */ | |
| 57 | - private LocalDateTime endTime; | |
| 58 | - /** | |
| 59 | - * 几人团 | |
| 60 | - */ | |
| 61 | - private Integer userSize; | |
| 62 | - /** | |
| 63 | - * 虚拟成团 | |
| 64 | - */ | |
| 65 | - private Boolean virtualGroup; | |
| 66 | - /** | |
| 67 | - * 活动状态 | |
| 68 | - * | |
| 69 | - * 枚举 {@link CommonStatusEnum} | |
| 70 | - */ | |
| 71 | - private Integer status; | |
| 72 | - /** | |
| 73 | - * 限制时长(小时) | |
| 74 | - */ | |
| 75 | - private Integer limitDuration; | |
| 76 | - | |
| 77 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/combination/CombinationProductDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.combination; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 5 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | -import lombok.*; | |
| 8 | - | |
| 9 | -import java.time.LocalDateTime; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 拼团商品 DO | |
| 13 | - * | |
| 14 | - * @author HUIHUI | |
| 15 | - */ | |
| 16 | -@TableName("promotion_combination_product") | |
| 17 | -@KeySequence("promotion_combination_product_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 18 | -@Data | |
| 19 | -@EqualsAndHashCode(callSuper = true) | |
| 20 | -@ToString(callSuper = true) | |
| 21 | -@Builder | |
| 22 | -@NoArgsConstructor | |
| 23 | -@AllArgsConstructor | |
| 24 | -public class CombinationProductDO extends BaseDO { | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * 编号 | |
| 28 | - */ | |
| 29 | - @TableId | |
| 30 | - private Long id; | |
| 31 | - /** | |
| 32 | - * 拼团活动编号 | |
| 33 | - */ | |
| 34 | - private Long activityId; | |
| 35 | - /** | |
| 36 | - * 商品 SPU 编号 | |
| 37 | - */ | |
| 38 | - private Long spuId; | |
| 39 | - /** | |
| 40 | - * 商品 SKU 编号 | |
| 41 | - */ | |
| 42 | - private Long skuId; | |
| 43 | - /** | |
| 44 | - * 拼团价格,单位分 | |
| 45 | - */ | |
| 46 | - private Integer combinationPrice; | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * 拼团商品状态 | |
| 50 | - * | |
| 51 | - * 关联 {@link CombinationActivityDO#getStatus()} | |
| 52 | - */ | |
| 53 | - private Integer activityStatus; | |
| 54 | - /** | |
| 55 | - * 活动开始时间点 | |
| 56 | - * | |
| 57 | - * 冗余 {@link CombinationActivityDO#getStartTime()} | |
| 58 | - */ | |
| 59 | - private LocalDateTime activityStartTime; | |
| 60 | - /** | |
| 61 | - * 活动结束时间点 | |
| 62 | - * | |
| 63 | - * 冗余 {@link CombinationActivityDO#getEndTime()} | |
| 64 | - */ | |
| 65 | - private LocalDateTime activityEndTime; | |
| 66 | - | |
| 67 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/combination/CombinationRecordDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.combination; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | -import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | -import lombok.*; | |
| 9 | - | |
| 10 | -import java.time.LocalDateTime; | |
| 11 | - | |
| 12 | -// TODO 芋艿:把字段的顺序,和 do 顺序对齐下 | |
| 13 | -/** | |
| 14 | - * 拼团记录 DO | |
| 15 | - * | |
| 16 | - * 1. 用户参与拼团时,会创建一条记录 | |
| 17 | - * 2. 团长的拼团记录,和参团人的拼团记录,通过 {@link #headId} 关联 | |
| 18 | - * | |
| 19 | - * @author HUIHUI | |
| 20 | - */ | |
| 21 | -@TableName("promotion_combination_record") | |
| 22 | -@KeySequence("promotion_combination_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 23 | -@Data | |
| 24 | -@EqualsAndHashCode(callSuper = true) | |
| 25 | -@ToString(callSuper = true) | |
| 26 | -@Builder | |
| 27 | -@NoArgsConstructor | |
| 28 | -@AllArgsConstructor | |
| 29 | -public class CombinationRecordDO extends BaseDO { | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 团长编号 - 团长 | |
| 33 | - */ | |
| 34 | - public static final Long HEAD_ID_GROUP = 0L; | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 编号,主键自增 | |
| 38 | - */ | |
| 39 | - @TableId | |
| 40 | - private Long id; | |
| 41 | - | |
| 42 | - /** | |
| 43 | - * 拼团活动编号 | |
| 44 | - * | |
| 45 | - * 关联 {@link CombinationActivityDO#getId()} | |
| 46 | - */ | |
| 47 | - private Long activityId; | |
| 48 | - /** | |
| 49 | - * 拼团商品单价 | |
| 50 | - * | |
| 51 | - * 冗余 {@link CombinationProductDO#getCombinationPrice()} | |
| 52 | - */ | |
| 53 | - private Integer combinationPrice; | |
| 54 | - /** | |
| 55 | - * SPU 编号 | |
| 56 | - */ | |
| 57 | - private Long spuId; | |
| 58 | - /** | |
| 59 | - * 商品名字 | |
| 60 | - */ | |
| 61 | - private String spuName; | |
| 62 | - /** | |
| 63 | - * 商品图片 | |
| 64 | - */ | |
| 65 | - private String picUrl; | |
| 66 | - /** | |
| 67 | - * SKU 编号 | |
| 68 | - */ | |
| 69 | - private Long skuId; | |
| 70 | - /** | |
| 71 | - * 购买的商品数量 | |
| 72 | - */ | |
| 73 | - private Integer count; | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * 用户编号 | |
| 77 | - */ | |
| 78 | - private Long userId; | |
| 79 | - | |
| 80 | - /** | |
| 81 | - * 用户昵称 | |
| 82 | - */ | |
| 83 | - private String nickname; | |
| 84 | - /** | |
| 85 | - * 用户头像 | |
| 86 | - */ | |
| 87 | - private String avatar; | |
| 88 | - | |
| 89 | - /** | |
| 90 | - * 团长编号 | |
| 91 | - * | |
| 92 | - * 关联 {@link CombinationRecordDO#getId()} | |
| 93 | - * | |
| 94 | - * 如果是团长,则它的值是 {@link #HEAD_ID_GROUP} | |
| 95 | - */ | |
| 96 | - private Long headId; | |
| 97 | - /** | |
| 98 | - * 开团状态 | |
| 99 | - * | |
| 100 | - * 关联 {@link CombinationRecordStatusEnum} | |
| 101 | - */ | |
| 102 | - private Integer status; | |
| 103 | - /** | |
| 104 | - * 订单编号 | |
| 105 | - */ | |
| 106 | - private Long orderId; | |
| 107 | - /** | |
| 108 | - * 开团需要人数 | |
| 109 | - * | |
| 110 | - * 关联 {@link CombinationActivityDO#getUserSize()} | |
| 111 | - */ | |
| 112 | - private Integer userSize; | |
| 113 | - /** | |
| 114 | - * 已加入拼团人数 | |
| 115 | - */ | |
| 116 | - private Integer userCount; | |
| 117 | - /** | |
| 118 | - * 是否虚拟成团 | |
| 119 | - * | |
| 120 | - * 默认为 false。 | |
| 121 | - * 拼团过期都还没有成功,如果 {@link CombinationActivityDO#getVirtualGroup()} 为 true,则执行虚拟成团的逻辑,才会更新该字段为 true | |
| 122 | - */ | |
| 123 | - private Boolean virtualGroup; | |
| 124 | - | |
| 125 | - /** | |
| 126 | - * 过期时间 | |
| 127 | - * | |
| 128 | - * 基于 {@link CombinationRecordDO#getStartTime()} + {@link CombinationActivityDO#getLimitDuration()} 计算 | |
| 129 | - */ | |
| 130 | - private LocalDateTime expireTime; | |
| 131 | - /** | |
| 132 | - * 开始时间 (订单付款后开始的时间) | |
| 133 | - */ | |
| 134 | - private LocalDateTime startTime; | |
| 135 | - /** | |
| 136 | - * 结束时间(成团时间/失败时间) | |
| 137 | - */ | |
| 138 | - private LocalDateTime endTime; | |
| 139 | - | |
| 140 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/coupon/CouponDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.coupon; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; | |
| 5 | -import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum; | |
| 6 | -import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum; | |
| 7 | -import cn.iocoder.yudao.module.promotion.enums.coupon.CouponStatusEnum; | |
| 8 | -import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTakeTypeEnum; | |
| 9 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 10 | -import com.baomidou.mybatisplus.annotation.TableField; | |
| 11 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 12 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 13 | -import lombok.Data; | |
| 14 | -import lombok.EqualsAndHashCode; | |
| 15 | - | |
| 16 | -import java.time.LocalDateTime; | |
| 17 | -import java.util.List; | |
| 18 | - | |
| 19 | -/** | |
| 20 | - * 优惠劵 DO | |
| 21 | - * | |
| 22 | - * @author 芋道源码 | |
| 23 | - */ | |
| 24 | -@TableName(value = "promotion_coupon", autoResultMap = true) | |
| 25 | -@KeySequence("promotion_coupon_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 26 | -@Data | |
| 27 | -@EqualsAndHashCode(callSuper = true) | |
| 28 | -public class CouponDO extends BaseDO { | |
| 29 | - | |
| 30 | - // ========== 基本信息 BEGIN ========== | |
| 31 | - /** | |
| 32 | - * 优惠劵编号 | |
| 33 | - */ | |
| 34 | - @TableId | |
| 35 | - private Long id; | |
| 36 | - /** | |
| 37 | - * 优惠劵模板编号 | |
| 38 | - * | |
| 39 | - * 关联 {@link CouponTemplateDO#getId()} | |
| 40 | - */ | |
| 41 | - private Long templateId; | |
| 42 | - /** | |
| 43 | - * 优惠劵名 | |
| 44 | - * | |
| 45 | - * 冗余 {@link CouponTemplateDO#getName()} | |
| 46 | - */ | |
| 47 | - private String name; | |
| 48 | - /** | |
| 49 | - * 优惠码状态 | |
| 50 | - * | |
| 51 | - * 枚举 {@link CouponStatusEnum} | |
| 52 | - */ | |
| 53 | - private Integer status; | |
| 54 | - | |
| 55 | - // TODO 芋艿:发放 adminid? | |
| 56 | - | |
| 57 | - // ========== 基本信息 END ========== | |
| 58 | - | |
| 59 | - // ========== 领取情况 BEGIN ========== | |
| 60 | - /** | |
| 61 | - * 用户编号 | |
| 62 | - * | |
| 63 | - * 关联 MemberUserDO 的 id 字段 | |
| 64 | - */ | |
| 65 | - private Long userId; | |
| 66 | - /** | |
| 67 | - * 领取类型 | |
| 68 | - * | |
| 69 | - * 枚举 {@link CouponTakeTypeEnum} | |
| 70 | - */ | |
| 71 | - private Integer takeType; | |
| 72 | - // ========== 领取情况 END ========== | |
| 73 | - | |
| 74 | - // ========== 使用规则 BEGIN ========== | |
| 75 | - /** | |
| 76 | - * 是否设置满多少金额可用,单位:分 | |
| 77 | - * | |
| 78 | - * 冗余 {@link CouponTemplateDO#getUsePrice()} | |
| 79 | - */ | |
| 80 | - private Integer usePrice; | |
| 81 | - /** | |
| 82 | - * 生效开始时间 | |
| 83 | - */ | |
| 84 | - private LocalDateTime validStartTime; | |
| 85 | - /** | |
| 86 | - * 生效结束时间 | |
| 87 | - */ | |
| 88 | - private LocalDateTime validEndTime; | |
| 89 | - /** | |
| 90 | - * 商品范围 | |
| 91 | - * | |
| 92 | - * 枚举 {@link PromotionProductScopeEnum} | |
| 93 | - */ | |
| 94 | - private Integer productScope; | |
| 95 | - /** | |
| 96 | - * 商品范围编号的数组 | |
| 97 | - * | |
| 98 | - * 冗余 {@link CouponTemplateDO#getProductScopeValues()} | |
| 99 | - */ | |
| 100 | - @TableField(typeHandler = LongListTypeHandler.class) | |
| 101 | - private List<Long> productScopeValues; | |
| 102 | - // ========== 使用规则 END ========== | |
| 103 | - | |
| 104 | - // ========== 使用效果 BEGIN ========== | |
| 105 | - /** | |
| 106 | - * 折扣类型 | |
| 107 | - * | |
| 108 | - * 冗余 {@link CouponTemplateDO#getDiscountType()} | |
| 109 | - */ | |
| 110 | - private Integer discountType; | |
| 111 | - /** | |
| 112 | - * 折扣百分比 | |
| 113 | - * | |
| 114 | - * 冗余 {@link CouponTemplateDO#getDiscountPercent()} | |
| 115 | - */ | |
| 116 | - private Integer discountPercent; | |
| 117 | - /** | |
| 118 | - * 优惠金额,单位:分 | |
| 119 | - * | |
| 120 | - * 冗余 {@link CouponTemplateDO#getDiscountPrice()} | |
| 121 | - */ | |
| 122 | - private Integer discountPrice; | |
| 123 | - /** | |
| 124 | - * 折扣上限,仅在 {@link #discountType} 等于 {@link PromotionDiscountTypeEnum#PERCENT} 时生效 | |
| 125 | - * | |
| 126 | - * 冗余 {@link CouponTemplateDO#getDiscountLimitPrice()} | |
| 127 | - */ | |
| 128 | - private Integer discountLimitPrice; | |
| 129 | - // ========== 使用效果 END ========== | |
| 130 | - | |
| 131 | - // ========== 使用情况 BEGIN ========== | |
| 132 | - /** | |
| 133 | - * 使用订单号 | |
| 134 | - */ | |
| 135 | - private Long useOrderId; | |
| 136 | - /** | |
| 137 | - * 使用时间 | |
| 138 | - */ | |
| 139 | - private LocalDateTime useTime; | |
| 140 | - | |
| 141 | - // ========== 使用情况 END ========== | |
| 142 | - | |
| 143 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/coupon/CouponTemplateDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.coupon; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; | |
| 6 | -import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum; | |
| 7 | -import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum; | |
| 8 | -import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTakeTypeEnum; | |
| 9 | -import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTemplateValidityTypeEnum; | |
| 10 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 11 | -import com.baomidou.mybatisplus.annotation.TableField; | |
| 12 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 13 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 14 | -import lombok.Data; | |
| 15 | -import lombok.EqualsAndHashCode; | |
| 16 | - | |
| 17 | -import java.time.LocalDateTime; | |
| 18 | -import java.util.List; | |
| 19 | - | |
| 20 | -/** | |
| 21 | - * 优惠劵模板 DO | |
| 22 | - * | |
| 23 | - * 当用户领取时,会生成 {@link CouponDO} 优惠劵 | |
| 24 | - * | |
| 25 | - * @author 芋道源码 | |
| 26 | - */ | |
| 27 | -@TableName(value = "promotion_coupon_template", autoResultMap = true) | |
| 28 | -@KeySequence("promotion_coupon_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 29 | -@Data | |
| 30 | -@EqualsAndHashCode(callSuper = true) | |
| 31 | -public class CouponTemplateDO extends BaseDO { | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * 不限制领取数量 | |
| 35 | - */ | |
| 36 | - public static final Integer TIME_LIMIT_COUNT_MAX = -1; | |
| 37 | - | |
| 38 | - // ========== 基本信息 BEGIN ========== | |
| 39 | - /** | |
| 40 | - * 模板编号,自增唯一 | |
| 41 | - */ | |
| 42 | - @TableId | |
| 43 | - private Long id; | |
| 44 | - /** | |
| 45 | - * 优惠劵名 | |
| 46 | - */ | |
| 47 | - private String name; | |
| 48 | - /** | |
| 49 | - * 优惠券说明 | |
| 50 | - */ | |
| 51 | - private String description; | |
| 52 | - /** | |
| 53 | - * 状态 | |
| 54 | - * | |
| 55 | - * 枚举 {@link CommonStatusEnum} | |
| 56 | - */ | |
| 57 | - // TODO 芋艿:要不要改成 3 个状态?? | |
| 58 | - private Integer status; | |
| 59 | - | |
| 60 | - // ========== 基本信息 END ========== | |
| 61 | - | |
| 62 | - // ========== 领取规则 BEGIN ========== | |
| 63 | - /** | |
| 64 | - * 发放数量 | |
| 65 | - * | |
| 66 | - * -1 - 则表示不限制发放数量 | |
| 67 | - */ | |
| 68 | - private Integer totalCount; | |
| 69 | - /** | |
| 70 | - * 每人限领个数 | |
| 71 | - * | |
| 72 | - * -1 - 则表示不限制 | |
| 73 | - */ | |
| 74 | - private Integer takeLimitCount; | |
| 75 | - /** | |
| 76 | - * 领取方式 | |
| 77 | - * | |
| 78 | - * 枚举 {@link CouponTakeTypeEnum} | |
| 79 | - */ | |
| 80 | - private Integer takeType; | |
| 81 | - // ========== 领取规则 END ========== | |
| 82 | - | |
| 83 | - // ========== 使用规则 BEGIN ========== | |
| 84 | - /** | |
| 85 | - * 是否设置满多少金额可用,单位:分 | |
| 86 | - * | |
| 87 | - * 0 - 不限制 | |
| 88 | - * 大于 0 - 多少金额可用 | |
| 89 | - */ | |
| 90 | - private Integer usePrice; | |
| 91 | - /** | |
| 92 | - * 商品范围 | |
| 93 | - * | |
| 94 | - * 枚举 {@link PromotionProductScopeEnum} | |
| 95 | - */ | |
| 96 | - private Integer productScope; | |
| 97 | - /** | |
| 98 | - * 商品范围编号的数组 | |
| 99 | - */ | |
| 100 | - @TableField(typeHandler = LongListTypeHandler.class) | |
| 101 | - private List<Long> productScopeValues; | |
| 102 | - /** | |
| 103 | - * 生效日期类型 | |
| 104 | - * | |
| 105 | - * 枚举 {@link CouponTemplateValidityTypeEnum} | |
| 106 | - */ | |
| 107 | - private Integer validityType; | |
| 108 | - /** | |
| 109 | - * 固定日期 - 生效开始时间 | |
| 110 | - * | |
| 111 | - * 当 {@link #validityType} 为 {@link CouponTemplateValidityTypeEnum#DATE} | |
| 112 | - */ | |
| 113 | - private LocalDateTime validStartTime; | |
| 114 | - /** | |
| 115 | - * 固定日期 - 生效结束时间 | |
| 116 | - * | |
| 117 | - * 当 {@link #validityType} 为 {@link CouponTemplateValidityTypeEnum#DATE} | |
| 118 | - */ | |
| 119 | - private LocalDateTime validEndTime; | |
| 120 | - /** | |
| 121 | - * 领取日期 - 开始天数 | |
| 122 | - * | |
| 123 | - * 当 {@link #validityType} 为 {@link CouponTemplateValidityTypeEnum#TERM} | |
| 124 | - */ | |
| 125 | - private Integer fixedStartTerm; | |
| 126 | - /** | |
| 127 | - * 领取日期 - 结束天数 | |
| 128 | - * | |
| 129 | - * 当 {@link #validityType} 为 {@link CouponTemplateValidityTypeEnum#TERM} | |
| 130 | - */ | |
| 131 | - private Integer fixedEndTerm; | |
| 132 | - // ========== 使用规则 END ========== | |
| 133 | - | |
| 134 | - // ========== 使用效果 BEGIN ========== | |
| 135 | - /** | |
| 136 | - * 折扣类型 | |
| 137 | - * | |
| 138 | - * 枚举 {@link PromotionDiscountTypeEnum} | |
| 139 | - */ | |
| 140 | - private Integer discountType; | |
| 141 | - /** | |
| 142 | - * 折扣百分比 | |
| 143 | - * | |
| 144 | - * 例如,80% 为 80 | |
| 145 | - */ | |
| 146 | - private Integer discountPercent; | |
| 147 | - /** | |
| 148 | - * 优惠金额,单位:分 | |
| 149 | - * | |
| 150 | - * 当 {@link #discountType} 为 {@link PromotionDiscountTypeEnum#PRICE} 生效 | |
| 151 | - */ | |
| 152 | - private Integer discountPrice; | |
| 153 | - /** | |
| 154 | - * 折扣上限,仅在 {@link #discountType} 等于 {@link PromotionDiscountTypeEnum#PERCENT} 时生效 | |
| 155 | - * | |
| 156 | - * 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。 | |
| 157 | - */ | |
| 158 | - private Integer discountLimitPrice; | |
| 159 | - // ========== 使用效果 END ========== | |
| 160 | - | |
| 161 | - // ========== 统计信息 BEGIN ========== | |
| 162 | - /** | |
| 163 | - * 领取优惠券的数量 | |
| 164 | - */ | |
| 165 | - private Integer takeCount; | |
| 166 | - /** | |
| 167 | - * 使用优惠券的次数 | |
| 168 | - */ | |
| 169 | - private Integer useCount; | |
| 170 | - | |
| 171 | - // ========== 统计信息 END ========== | |
| 172 | - | |
| 173 | - // TODO 芋艿:领取开始时间、领取结束时间 | |
| 174 | - | |
| 175 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/discount/DiscountActivityDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.discount; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | -import lombok.Data; | |
| 9 | -import lombok.EqualsAndHashCode; | |
| 10 | - | |
| 11 | -import java.time.LocalDateTime; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 限时折扣活动 DO | |
| 15 | - * | |
| 16 | - * 一个活动下,可以有 {@link DiscountProductDO} 商品; | |
| 17 | - * 一个商品,在指定时间段内,只能属于一个活动; | |
| 18 | - * | |
| 19 | - * @author 芋道源码 | |
| 20 | - */ | |
| 21 | -@TableName(value = "promotion_discount_activity", autoResultMap = true) | |
| 22 | -@KeySequence("promotion_discount_activity_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 23 | -@Data | |
| 24 | -@EqualsAndHashCode(callSuper = true) | |
| 25 | -public class DiscountActivityDO extends BaseDO { | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 活动编号,主键自增 | |
| 29 | - */ | |
| 30 | - @TableId | |
| 31 | - private Long id; | |
| 32 | - /** | |
| 33 | - * 活动标题 | |
| 34 | - */ | |
| 35 | - private String name; | |
| 36 | - /** | |
| 37 | - * 状态 | |
| 38 | - * | |
| 39 | - * 枚举 {@link CommonStatusEnum} | |
| 40 | - * | |
| 41 | - * 活动被关闭后,不允许再次开启。 | |
| 42 | - */ | |
| 43 | - private Integer status; | |
| 44 | - /** | |
| 45 | - * 开始时间 | |
| 46 | - */ | |
| 47 | - private LocalDateTime startTime; | |
| 48 | - /** | |
| 49 | - * 结束时间 | |
| 50 | - */ | |
| 51 | - private LocalDateTime endTime; | |
| 52 | - /** | |
| 53 | - * 备注 | |
| 54 | - */ | |
| 55 | - private String remark; | |
| 56 | - | |
| 57 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/discount/DiscountProductDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.discount; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | -import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | -import lombok.Data; | |
| 9 | -import lombok.EqualsAndHashCode; | |
| 10 | - | |
| 11 | -import java.time.LocalDateTime; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 限时折扣商品 DO | |
| 15 | - * | |
| 16 | - * @author 芋道源码 | |
| 17 | - */ | |
| 18 | -@TableName(value = "promotion_discount_product", autoResultMap = true) | |
| 19 | -@KeySequence("promotion_discount_product_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 20 | -@Data | |
| 21 | -@EqualsAndHashCode(callSuper = true) | |
| 22 | -public class DiscountProductDO extends BaseDO { | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 编号,主键自增 | |
| 26 | - */ | |
| 27 | - @TableId | |
| 28 | - private Long id; | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * 限时折扣活动的编号 | |
| 32 | - * | |
| 33 | - * 关联 {@link DiscountActivityDO#getId()} | |
| 34 | - */ | |
| 35 | - private Long activityId; | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * 商品 SPU 编号 | |
| 39 | - * | |
| 40 | - * 关联 ProductSpuDO 的 id 编号 | |
| 41 | - */ | |
| 42 | - private Long spuId; | |
| 43 | - /** | |
| 44 | - * 商品 SKU 编号 | |
| 45 | - * | |
| 46 | - * 关联 ProductSkuDO 的 id 编号 | |
| 47 | - */ | |
| 48 | - private Long skuId; | |
| 49 | - | |
| 50 | - /** | |
| 51 | - * 折扣类型 | |
| 52 | - * | |
| 53 | - * 枚举 {@link PromotionDiscountTypeEnum} | |
| 54 | - */ | |
| 55 | - private Integer discountType; | |
| 56 | - /** | |
| 57 | - * 折扣百分比 | |
| 58 | - * | |
| 59 | - * 例如,80% 为 80 | |
| 60 | - */ | |
| 61 | - private Integer discountPercent; | |
| 62 | - /** | |
| 63 | - * 优惠金额,单位:分 | |
| 64 | - * | |
| 65 | - * 当 {@link #discountType} 为 {@link PromotionDiscountTypeEnum#PRICE} 生效 | |
| 66 | - */ | |
| 67 | - private Integer discountPrice; | |
| 68 | - | |
| 69 | - /** | |
| 70 | - * 活动标题 | |
| 71 | - * | |
| 72 | - * 冗余 {@link DiscountActivityDO#getName()} | |
| 73 | - */ | |
| 74 | - private String activityName; | |
| 75 | - /** | |
| 76 | - * 活动状态 | |
| 77 | - * | |
| 78 | - * 冗余 {@link DiscountActivityDO#getStatus()} | |
| 79 | - */ | |
| 80 | - private Integer activityStatus; | |
| 81 | - /** | |
| 82 | - * 活动开始时间点 | |
| 83 | - * | |
| 84 | - * 冗余 {@link DiscountActivityDO#getStartTime()} | |
| 85 | - */ | |
| 86 | - private LocalDateTime activityStartTime; | |
| 87 | - /** | |
| 88 | - * 活动结束时间点 | |
| 89 | - * | |
| 90 | - * 冗余 {@link DiscountActivityDO#getEndTime()} | |
| 91 | - */ | |
| 92 | - private LocalDateTime activityEndTime; | |
| 93 | - | |
| 94 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyPageDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.diy; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.type.StringListTypeHandler; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableField; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 8 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 9 | -import lombok.*; | |
| 10 | - | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 装修页面 DO | |
| 15 | - * | |
| 16 | - * @author owen | |
| 17 | - */ | |
| 18 | -@TableName(value = "promotion_diy_page", autoResultMap = true) | |
| 19 | -@KeySequence("promotion_diy_page_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 20 | -@Data | |
| 21 | -@EqualsAndHashCode(callSuper = true) | |
| 22 | -@ToString(callSuper = true) | |
| 23 | -@Builder | |
| 24 | -@NoArgsConstructor | |
| 25 | -@AllArgsConstructor | |
| 26 | -public class DiyPageDO extends BaseDO { | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * 装修页面编号 | |
| 30 | - */ | |
| 31 | - @TableId | |
| 32 | - private Long id; | |
| 33 | - /** | |
| 34 | - * 装修模板编号 | |
| 35 | - * | |
| 36 | - * 关联 {@link DiyTemplateDO#getId()} | |
| 37 | - */ | |
| 38 | - private Long templateId; | |
| 39 | - /** | |
| 40 | - * 页面名称 | |
| 41 | - */ | |
| 42 | - private String name; | |
| 43 | - /** | |
| 44 | - * 备注 | |
| 45 | - */ | |
| 46 | - private String remark; | |
| 47 | - /** | |
| 48 | - * 预览图,多个逗号分隔 | |
| 49 | - */ | |
| 50 | - @TableField(typeHandler = StringListTypeHandler.class) | |
| 51 | - private List<String> previewPicUrls; | |
| 52 | - /** | |
| 53 | - * 页面属性,JSON 格式 | |
| 54 | - */ | |
| 55 | - private String property; | |
| 56 | - | |
| 57 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.diy; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.type.StringListTypeHandler; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableField; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 8 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 9 | -import lombok.*; | |
| 10 | - | |
| 11 | -import java.time.LocalDateTime; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 装修模板 DO | |
| 16 | - * | |
| 17 | - * 1. 新建一个模版,下面可以包含多个 {@link DiyPageDO} 页面,例如说首页、我的 | |
| 18 | - * 2. 如果需要使用某个模版,则将 {@link #used} 设置为 true,表示已使用,有且仅有一个 | |
| 19 | - * | |
| 20 | - * @author owen | |
| 21 | - */ | |
| 22 | -@TableName(value = "promotion_diy_template", autoResultMap = true) | |
| 23 | -@KeySequence("promotion_diy_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 24 | -@Data | |
| 25 | -@EqualsAndHashCode(callSuper = true) | |
| 26 | -@ToString(callSuper = true) | |
| 27 | -@Builder | |
| 28 | -@NoArgsConstructor | |
| 29 | -@AllArgsConstructor | |
| 30 | -public class DiyTemplateDO extends BaseDO { | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 装修模板编号 | |
| 34 | - */ | |
| 35 | - @TableId | |
| 36 | - private Long id; | |
| 37 | - /** | |
| 38 | - * 模板名称 | |
| 39 | - */ | |
| 40 | - private String name; | |
| 41 | - /** | |
| 42 | - * 是否使用 | |
| 43 | - */ | |
| 44 | - private Boolean used; | |
| 45 | - /** | |
| 46 | - * 使用时间 | |
| 47 | - */ | |
| 48 | - private LocalDateTime usedTime; | |
| 49 | - /** | |
| 50 | - * 备注 | |
| 51 | - */ | |
| 52 | - private String remark; | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * 预览图 | |
| 56 | - */ | |
| 57 | - @TableField(typeHandler = StringListTypeHandler.class) | |
| 58 | - private List<String> previewPicUrls; | |
| 59 | - /** | |
| 60 | - * uni-app 底部导航属性,JSON 格式 | |
| 61 | - */ | |
| 62 | - private String property; | |
| 63 | - | |
| 64 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/kefu/KeFuConversationDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.kefu; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | -import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.enums.kefu.KeFuMessageContentTypeEnum; | |
| 6 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 8 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 9 | -import lombok.*; | |
| 10 | - | |
| 11 | -import java.time.LocalDateTime; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 客服会话 DO | |
| 15 | - * | |
| 16 | - * @author HUIHUI | |
| 17 | - */ | |
| 18 | -@TableName("promotion_kefu_conversation") | |
| 19 | -@KeySequence("promotion_kefu_conversation_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 20 | -@Data | |
| 21 | -@EqualsAndHashCode(callSuper = true) | |
| 22 | -@ToString(callSuper = true) | |
| 23 | -@Builder | |
| 24 | -@NoArgsConstructor | |
| 25 | -@AllArgsConstructor | |
| 26 | -public class KeFuConversationDO extends BaseDO { | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * 编号 | |
| 30 | - */ | |
| 31 | - @TableId | |
| 32 | - private Long id; | |
| 33 | - /** | |
| 34 | - * 会话所属用户 | |
| 35 | - * | |
| 36 | - * 关联 {@link MemberUserRespDTO#getId()} | |
| 37 | - */ | |
| 38 | - private Long userId; | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * 最后聊天时间 | |
| 42 | - */ | |
| 43 | - private LocalDateTime lastMessageTime; | |
| 44 | - /** | |
| 45 | - * 最后聊天内容 | |
| 46 | - */ | |
| 47 | - private String lastMessageContent; | |
| 48 | - /** | |
| 49 | - * 最后发送的消息类型 | |
| 50 | - * | |
| 51 | - * 枚举 {@link KeFuMessageContentTypeEnum} | |
| 52 | - */ | |
| 53 | - private Integer lastMessageContentType; | |
| 54 | - | |
| 55 | - //======================= 会话操作相关 ======================= | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * 管理端置顶 | |
| 59 | - */ | |
| 60 | - private Boolean adminPinned; | |
| 61 | - /** | |
| 62 | - * 用户是否可见 | |
| 63 | - * | |
| 64 | - * false - 可见,默认值 | |
| 65 | - * true - 不可见,用户删除时设置为 true | |
| 66 | - */ | |
| 67 | - private Boolean userDeleted; | |
| 68 | - /** | |
| 69 | - * 管理员是否可见 | |
| 70 | - * | |
| 71 | - * false - 可见,默认值 | |
| 72 | - * true - 不可见,管理员删除时设置为 true | |
| 73 | - */ | |
| 74 | - private Boolean adminDeleted; | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * 管理员未读消息数 | |
| 78 | - * | |
| 79 | - * 用户发送消息时增加,管理员查看后扣减 | |
| 80 | - */ | |
| 81 | - private Integer adminUnreadMessageCount; | |
| 82 | - | |
| 83 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/kefu/KeFuMessageDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.kefu; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.enums.kefu.KeFuMessageContentTypeEnum; | |
| 6 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 8 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 9 | -import lombok.*; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 客服消息 DO | |
| 13 | - * | |
| 14 | - * @author HUIHUI | |
| 15 | - */ | |
| 16 | -@TableName("promotion_kefu_message") | |
| 17 | -@KeySequence("promotion_kefu_message_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 18 | -@Data | |
| 19 | -@EqualsAndHashCode(callSuper = true) | |
| 20 | -@ToString(callSuper = true) | |
| 21 | -@Builder | |
| 22 | -@NoArgsConstructor | |
| 23 | -@AllArgsConstructor | |
| 24 | -public class KeFuMessageDO extends BaseDO { | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * 编号 | |
| 28 | - */ | |
| 29 | - @TableId | |
| 30 | - private Long id; | |
| 31 | - /** | |
| 32 | - * 会话编号 | |
| 33 | - * | |
| 34 | - * 关联 {@link KeFuConversationDO#getId()} | |
| 35 | - */ | |
| 36 | - private Long conversationId; | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 发送人编号 | |
| 40 | - * | |
| 41 | - * 存储的是用户编号 | |
| 42 | - */ | |
| 43 | - private Long senderId; | |
| 44 | - /** | |
| 45 | - * 发送人类型 | |
| 46 | - * | |
| 47 | - * 枚举,{@link UserTypeEnum} | |
| 48 | - */ | |
| 49 | - private Integer senderType; | |
| 50 | - /** | |
| 51 | - * 接收人编号 | |
| 52 | - * | |
| 53 | - * 存储的是用户编号 | |
| 54 | - */ | |
| 55 | - private Long receiverId; | |
| 56 | - /** | |
| 57 | - * 接收人类型 | |
| 58 | - * | |
| 59 | - * 枚举,{@link UserTypeEnum} | |
| 60 | - */ | |
| 61 | - private Integer receiverType; | |
| 62 | - | |
| 63 | - /** | |
| 64 | - * 消息类型 | |
| 65 | - * | |
| 66 | - * 枚举 {@link KeFuMessageContentTypeEnum} | |
| 67 | - */ | |
| 68 | - private Integer contentType; | |
| 69 | - /** | |
| 70 | - * 消息 | |
| 71 | - */ | |
| 72 | - private String content; | |
| 73 | - | |
| 74 | - //======================= 消息相关状态 ======================= | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * 是/否已读 | |
| 78 | - */ | |
| 79 | - private Boolean readStatus; | |
| 80 | - | |
| 81 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/point/PointActivityDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.point; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | -import lombok.Data; | |
| 9 | -import lombok.EqualsAndHashCode; | |
| 10 | -import lombok.ToString; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 积分商城活动 DO | |
| 14 | - * | |
| 15 | - * @author HUIHUI | |
| 16 | - */ | |
| 17 | -@TableName(value = "promotion_point_activity", autoResultMap = true) | |
| 18 | -@KeySequence("promotion_point_activity_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 19 | -@Data | |
| 20 | -@EqualsAndHashCode(callSuper = true) | |
| 21 | -@ToString(callSuper = true) | |
| 22 | -public class PointActivityDO extends BaseDO { | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 积分商城活动编号 | |
| 26 | - */ | |
| 27 | - @TableId | |
| 28 | - private Long id; | |
| 29 | - /** | |
| 30 | - * 积分商城活动商品 | |
| 31 | - */ | |
| 32 | - private Long spuId; | |
| 33 | - /** | |
| 34 | - * 活动状态 | |
| 35 | - * | |
| 36 | - * 枚举 {@link CommonStatusEnum 对应的类} | |
| 37 | - */ | |
| 38 | - private Integer status; | |
| 39 | - /** | |
| 40 | - * 备注 | |
| 41 | - */ | |
| 42 | - private String remark; | |
| 43 | - /** | |
| 44 | - * 排序 | |
| 45 | - */ | |
| 46 | - private Integer sort; | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * 积分商城活动库存(剩余库存积分兑换时扣减) | |
| 50 | - */ | |
| 51 | - private Integer stock; | |
| 52 | - /** | |
| 53 | - * 积分商城活动总库存 | |
| 54 | - */ | |
| 55 | - private Integer totalStock; | |
| 56 | - | |
| 57 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/point/PointProductDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.point; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | -import lombok.*; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 积分商城商品 DO | |
| 12 | - * | |
| 13 | - * @author HUIHUI | |
| 14 | - */ | |
| 15 | -@TableName("promotion_point_product") | |
| 16 | -@KeySequence("promotion_point_product_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 17 | -@Data | |
| 18 | -@EqualsAndHashCode(callSuper = true) | |
| 19 | -@ToString(callSuper = true) | |
| 20 | -@Builder | |
| 21 | -@NoArgsConstructor | |
| 22 | -@AllArgsConstructor | |
| 23 | -public class PointProductDO extends BaseDO { | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 积分商城商品编号 | |
| 27 | - */ | |
| 28 | - @TableId | |
| 29 | - private Long id; | |
| 30 | - /** | |
| 31 | - * 积分商城活动 id | |
| 32 | - * | |
| 33 | - * 关联 {@link PointActivityDO#getId()} | |
| 34 | - */ | |
| 35 | - private Long activityId; | |
| 36 | - /** | |
| 37 | - * 商品 SPU 编号 | |
| 38 | - */ | |
| 39 | - private Long spuId; | |
| 40 | - /** | |
| 41 | - * 商品 SKU 编号 | |
| 42 | - */ | |
| 43 | - private Long skuId; | |
| 44 | - /** | |
| 45 | - * 可兑换次数 | |
| 46 | - */ | |
| 47 | - private Integer count; | |
| 48 | - /** | |
| 49 | - * 所需兑换积分 | |
| 50 | - */ | |
| 51 | - private Integer point; | |
| 52 | - /** | |
| 53 | - * 所需兑换金额,单位:分 | |
| 54 | - */ | |
| 55 | - private Integer price; | |
| 56 | - /** | |
| 57 | - * 积分商城商品库存 | |
| 58 | - */ | |
| 59 | - private Integer stock; | |
| 60 | - /** | |
| 61 | - * 积分商城商品状态 | |
| 62 | - * | |
| 63 | - * 枚举 {@link CommonStatusEnum 对应的类} | |
| 64 | - */ | |
| 65 | - private Integer activityStatus; | |
| 66 | - | |
| 67 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/reward/RewardActivityDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.reward; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; | |
| 6 | -import cn.iocoder.yudao.module.promotion.enums.common.PromotionConditionTypeEnum; | |
| 7 | -import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum; | |
| 8 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 9 | -import com.baomidou.mybatisplus.annotation.TableField; | |
| 10 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 11 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 12 | -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | |
| 13 | -import lombok.Data; | |
| 14 | -import lombok.EqualsAndHashCode; | |
| 15 | - | |
| 16 | -import java.io.Serializable; | |
| 17 | -import java.time.LocalDateTime; | |
| 18 | -import java.util.List; | |
| 19 | -import java.util.Map; | |
| 20 | - | |
| 21 | -/** | |
| 22 | - * 满减送活动 DO | |
| 23 | - * | |
| 24 | - * @author 芋道源码 | |
| 25 | - */ | |
| 26 | -@TableName(value = "promotion_reward_activity", autoResultMap = true) | |
| 27 | -@KeySequence("promotion_reward_activity_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 28 | -@Data | |
| 29 | -@EqualsAndHashCode(callSuper = true) | |
| 30 | -public class RewardActivityDO extends BaseDO { | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 活动编号,主键自增 | |
| 34 | - */ | |
| 35 | - @TableId | |
| 36 | - private Long id; | |
| 37 | - /** | |
| 38 | - * 活动标题 | |
| 39 | - */ | |
| 40 | - private String name; | |
| 41 | - /** | |
| 42 | - * 状态 | |
| 43 | - * | |
| 44 | - * 枚举 {@link CommonStatusEnum} | |
| 45 | - */ | |
| 46 | - private Integer status; | |
| 47 | - /** | |
| 48 | - * 开始时间 | |
| 49 | - */ | |
| 50 | - private LocalDateTime startTime; | |
| 51 | - /** | |
| 52 | - * 结束时间 | |
| 53 | - */ | |
| 54 | - private LocalDateTime endTime; | |
| 55 | - /** | |
| 56 | - * 备注 | |
| 57 | - */ | |
| 58 | - private String remark; | |
| 59 | - /** | |
| 60 | - * 条件类型 | |
| 61 | - * | |
| 62 | - * 枚举 {@link PromotionConditionTypeEnum} | |
| 63 | - */ | |
| 64 | - private Integer conditionType; | |
| 65 | - /** | |
| 66 | - * 商品范围 | |
| 67 | - * | |
| 68 | - * 枚举 {@link PromotionProductScopeEnum} | |
| 69 | - */ | |
| 70 | - private Integer productScope; | |
| 71 | - /** | |
| 72 | - * 商品 SPU 编号的数组 | |
| 73 | - */ | |
| 74 | - @TableField(typeHandler = LongListTypeHandler.class) | |
| 75 | - private List<Long> productScopeValues; | |
| 76 | - /** | |
| 77 | - * 优惠规则的数组 | |
| 78 | - */ | |
| 79 | - @TableField(typeHandler = JacksonTypeHandler.class) | |
| 80 | - private List<Rule> rules; | |
| 81 | - | |
| 82 | - /** | |
| 83 | - * 优惠规则 | |
| 84 | - */ | |
| 85 | - @Data | |
| 86 | - public static class Rule implements Serializable { | |
| 87 | - | |
| 88 | - /** | |
| 89 | - * 优惠门槛 | |
| 90 | - * | |
| 91 | - * 1. 满 N 元,单位:分 | |
| 92 | - * 2. 满 N 件 | |
| 93 | - */ | |
| 94 | - private Integer limit; | |
| 95 | - /** | |
| 96 | - * 优惠价格,单位:分 | |
| 97 | - */ | |
| 98 | - private Integer discountPrice; | |
| 99 | - /** | |
| 100 | - * 是否包邮 | |
| 101 | - */ | |
| 102 | - private Boolean freeDelivery; | |
| 103 | - /** | |
| 104 | - * 赠送的积分 | |
| 105 | - */ | |
| 106 | - private Integer point; | |
| 107 | - /** | |
| 108 | - * 赠送的优惠劵 | |
| 109 | - * | |
| 110 | - * key: 优惠劵模版编号 | |
| 111 | - * value:对应的优惠券数量 | |
| 112 | - * | |
| 113 | - * 目的:用于订单支付后赠送优惠券 | |
| 114 | - */ | |
| 115 | - private Map<Long, Integer> giveCouponTemplateCounts; | |
| 116 | - | |
| 117 | - } | |
| 118 | - | |
| 119 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/SeckillActivityDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.seckill; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; | |
| 6 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableField; | |
| 8 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 9 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 10 | -import lombok.Data; | |
| 11 | -import lombok.EqualsAndHashCode; | |
| 12 | -import lombok.ToString; | |
| 13 | - | |
| 14 | -import java.time.LocalDateTime; | |
| 15 | -import java.util.List; | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * 秒杀活动 DO | |
| 19 | - * | |
| 20 | - * @author halfninety | |
| 21 | - */ | |
| 22 | -@TableName(value = "promotion_seckill_activity", autoResultMap = true) | |
| 23 | -@KeySequence("promotion_seckill_activity_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 24 | -@Data | |
| 25 | -@EqualsAndHashCode(callSuper = true) | |
| 26 | -@ToString(callSuper = true) | |
| 27 | -public class SeckillActivityDO extends BaseDO { | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 秒杀活动编号 | |
| 31 | - */ | |
| 32 | - @TableId | |
| 33 | - private Long id; | |
| 34 | - /** | |
| 35 | - * 秒杀活动商品 | |
| 36 | - */ | |
| 37 | - private Long spuId; | |
| 38 | - /** | |
| 39 | - * 秒杀活动名称 | |
| 40 | - */ | |
| 41 | - private String name; | |
| 42 | - /** | |
| 43 | - * 活动状态 | |
| 44 | - * | |
| 45 | - * 枚举 {@link CommonStatusEnum 对应的类} | |
| 46 | - */ | |
| 47 | - private Integer status; | |
| 48 | - /** | |
| 49 | - * 备注 | |
| 50 | - */ | |
| 51 | - private String remark; | |
| 52 | - /** | |
| 53 | - * 活动开始时间 | |
| 54 | - */ | |
| 55 | - private LocalDateTime startTime; | |
| 56 | - /** | |
| 57 | - * 活动结束时间 | |
| 58 | - */ | |
| 59 | - private LocalDateTime endTime; | |
| 60 | - /** | |
| 61 | - * 排序 | |
| 62 | - */ | |
| 63 | - private Integer sort; | |
| 64 | - /** | |
| 65 | - * 秒杀时段 id | |
| 66 | - */ | |
| 67 | - @TableField(typeHandler = LongListTypeHandler.class) | |
| 68 | - private List<Long> configIds; | |
| 69 | - | |
| 70 | - /** | |
| 71 | - * 总限购数量 | |
| 72 | - */ | |
| 73 | - private Integer totalLimitCount; | |
| 74 | - /** | |
| 75 | - * 单次限够数量 | |
| 76 | - */ | |
| 77 | - private Integer singleLimitCount; | |
| 78 | - | |
| 79 | - /** | |
| 80 | - * 秒杀库存(剩余库存秒杀时扣减) | |
| 81 | - */ | |
| 82 | - private Integer stock; | |
| 83 | - /** | |
| 84 | - * 秒杀总库存 | |
| 85 | - */ | |
| 86 | - private Integer totalStock; | |
| 87 | - | |
| 88 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/SeckillConfigDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.seckill; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 6 | -import com.baomidou.mybatisplus.annotation.TableField; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 8 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 9 | -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | |
| 10 | -import lombok.*; | |
| 11 | - | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 秒杀时段 DO | |
| 16 | - * | |
| 17 | - * @author 芋道源码 | |
| 18 | - */ | |
| 19 | -@TableName(value = "promotion_seckill_config", autoResultMap = true) | |
| 20 | -@KeySequence("promotion_seckill_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 21 | -@Data | |
| 22 | -@EqualsAndHashCode(callSuper = true) | |
| 23 | -@ToString(callSuper = true) | |
| 24 | -@Builder | |
| 25 | -@NoArgsConstructor | |
| 26 | -@AllArgsConstructor | |
| 27 | -public class SeckillConfigDO extends BaseDO { | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 编号 | |
| 31 | - */ | |
| 32 | - @TableId | |
| 33 | - private Long id; | |
| 34 | - /** | |
| 35 | - * 秒杀时段名称 | |
| 36 | - */ | |
| 37 | - private String name; | |
| 38 | - /** | |
| 39 | - * 开始时间点 | |
| 40 | - */ | |
| 41 | - private String startTime; | |
| 42 | - /** | |
| 43 | - * 结束时间点 | |
| 44 | - */ | |
| 45 | - private String endTime; | |
| 46 | - /** | |
| 47 | - * 秒杀轮播图 | |
| 48 | - */ | |
| 49 | - @TableField(typeHandler = JacksonTypeHandler.class) | |
| 50 | - private List<String> sliderPicUrls; | |
| 51 | - /** | |
| 52 | - * 状态 | |
| 53 | - * | |
| 54 | - * 枚举 {@link CommonStatusEnum 对应的类} | |
| 55 | - */ | |
| 56 | - private Integer status; | |
| 57 | - | |
| 58 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/SeckillProductDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.seckill; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; | |
| 6 | -import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 7 | -import com.baomidou.mybatisplus.annotation.TableField; | |
| 8 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 9 | -import com.baomidou.mybatisplus.annotation.TableName; | |
| 10 | -import lombok.*; | |
| 11 | - | |
| 12 | -import java.time.LocalDateTime; | |
| 13 | -import java.util.List; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * 秒杀参与商品 DO | |
| 17 | - * | |
| 18 | - * @author HUIHUI | |
| 19 | - */ | |
| 20 | -@TableName("promotion_seckill_product") | |
| 21 | -@KeySequence("promotion_seckill_product_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 22 | -@Data | |
| 23 | -@EqualsAndHashCode(callSuper = true) | |
| 24 | -@ToString(callSuper = true) | |
| 25 | -@Builder | |
| 26 | -@NoArgsConstructor | |
| 27 | -@AllArgsConstructor | |
| 28 | -public class SeckillProductDO extends BaseDO { | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * 秒杀参与商品编号 | |
| 32 | - */ | |
| 33 | - @TableId | |
| 34 | - private Long id; | |
| 35 | - /** | |
| 36 | - * 秒杀活动 id | |
| 37 | - * | |
| 38 | - * 关联 {@link SeckillActivityDO#getId()} | |
| 39 | - */ | |
| 40 | - private Long activityId; | |
| 41 | - /** | |
| 42 | - * 秒杀时段 id | |
| 43 | - * | |
| 44 | - * 关联 {@link SeckillConfigDO#getId()} | |
| 45 | - */ | |
| 46 | - @TableField(typeHandler = LongListTypeHandler.class) | |
| 47 | - private List<Long> configIds; | |
| 48 | - /** | |
| 49 | - * 商品 SPU 编号 | |
| 50 | - */ | |
| 51 | - private Long spuId; | |
| 52 | - /** | |
| 53 | - * 商品 SKU 编号 | |
| 54 | - */ | |
| 55 | - private Long skuId; | |
| 56 | - /** | |
| 57 | - * 秒杀金额,单位:分 | |
| 58 | - */ | |
| 59 | - private Integer seckillPrice; | |
| 60 | - /** | |
| 61 | - * 秒杀库存 | |
| 62 | - */ | |
| 63 | - private Integer stock; | |
| 64 | - | |
| 65 | - /** | |
| 66 | - * 秒杀商品状态 | |
| 67 | - * | |
| 68 | - * 枚举 {@link CommonStatusEnum 对应的类} | |
| 69 | - */ | |
| 70 | - private Integer activityStatus; | |
| 71 | - /** | |
| 72 | - * 活动开始时间点 | |
| 73 | - */ | |
| 74 | - private LocalDateTime activityStartTime; | |
| 75 | - /** | |
| 76 | - * 活动结束时间点 | |
| 77 | - */ | |
| 78 | - private LocalDateTime activityEndTime; | |
| 79 | - | |
| 80 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleCategoryMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.article; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; | |
| 8 | -import org.apache.ibatis.annotations.Mapper; | |
| 9 | - | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 文章分类 Mapper | |
| 14 | - * | |
| 15 | - * @author HUIHUI | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface ArticleCategoryMapper extends BaseMapperX<ArticleCategoryDO> { | |
| 19 | - | |
| 20 | - default PageResult<ArticleCategoryDO> selectPage(ArticleCategoryPageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<ArticleCategoryDO>() | |
| 22 | - .likeIfPresent(ArticleCategoryDO::getName, reqVO.getName()) | |
| 23 | - .eqIfPresent(ArticleCategoryDO::getStatus, reqVO.getStatus()) | |
| 24 | - .betweenIfPresent(ArticleCategoryDO::getCreateTime, reqVO.getCreateTime()) | |
| 25 | - .orderByDesc(ArticleCategoryDO::getSort)); | |
| 26 | - } | |
| 27 | - | |
| 28 | - default List<ArticleCategoryDO> selectListByStatus(Integer status) { | |
| 29 | - return selectList(ArticleCategoryDO::getStatus, status); | |
| 30 | - } | |
| 31 | - | |
| 32 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.article; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; | |
| 9 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 10 | -import org.apache.ibatis.annotations.Mapper; | |
| 11 | - | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 文章管理 Mapper | |
| 16 | - * | |
| 17 | - * @author HUIHUI | |
| 18 | - */ | |
| 19 | -@Mapper | |
| 20 | -public interface ArticleMapper extends BaseMapperX<ArticleDO> { | |
| 21 | - | |
| 22 | - default PageResult<ArticleDO> selectPage(ArticlePageReqVO reqVO) { | |
| 23 | - return selectPage(reqVO, new LambdaQueryWrapperX<ArticleDO>() | |
| 24 | - .eqIfPresent(ArticleDO::getCategoryId, reqVO.getCategoryId()) | |
| 25 | - .eqIfPresent(ArticleDO::getTitle, reqVO.getTitle()) | |
| 26 | - .eqIfPresent(ArticleDO::getAuthor, reqVO.getAuthor()) | |
| 27 | - .eqIfPresent(ArticleDO::getStatus, reqVO.getStatus()) | |
| 28 | - .eqIfPresent(ArticleDO::getSpuId, reqVO.getSpuId()) | |
| 29 | - .eqIfPresent(ArticleDO::getRecommendHot, reqVO.getRecommendHot()) | |
| 30 | - .eqIfPresent(ArticleDO::getRecommendBanner, reqVO.getRecommendBanner()) | |
| 31 | - .betweenIfPresent(ArticleDO::getCreateTime, reqVO.getCreateTime()) | |
| 32 | - .orderByDesc(ArticleDO::getId)); | |
| 33 | - } | |
| 34 | - | |
| 35 | - default List<ArticleDO> selectList(Boolean recommendHot, Boolean recommendBanner) { | |
| 36 | - return selectList(new LambdaQueryWrapperX<ArticleDO>() | |
| 37 | - .eqIfPresent(ArticleDO::getRecommendHot, recommendHot) | |
| 38 | - .eqIfPresent(ArticleDO::getRecommendBanner, recommendBanner)); | |
| 39 | - } | |
| 40 | - | |
| 41 | - default List<ArticleDO> selectListByTitle(String title) { | |
| 42 | - return selectList(ArticleDO::getTitle, title); | |
| 43 | - } | |
| 44 | - | |
| 45 | - default PageResult<ArticleDO> selectPage(AppArticlePageReqVO pageReqVO) { | |
| 46 | - return selectPage(pageReqVO, new LambdaQueryWrapperX<ArticleDO>() | |
| 47 | - .eqIfPresent(ArticleDO::getCategoryId, pageReqVO.getCategoryId())); | |
| 48 | - } | |
| 49 | - | |
| 50 | - default void updateBrowseCount(Long id) { | |
| 51 | - update(null, new LambdaUpdateWrapper<ArticleDO>() | |
| 52 | - .eq(ArticleDO::getId, id) | |
| 53 | - .setSql("browse_count = browse_count + 1")); | |
| 54 | - } | |
| 55 | - | |
| 56 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/banner/BannerMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.banner; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.banner.BannerDO; | |
| 8 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | - | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * Banner Mapper | |
| 15 | - * | |
| 16 | - * @author xia | |
| 17 | - */ | |
| 18 | -@Mapper | |
| 19 | -public interface BannerMapper extends BaseMapperX<BannerDO> { | |
| 20 | - | |
| 21 | - default PageResult<BannerDO> selectPage(BannerPageReqVO reqVO) { | |
| 22 | - return selectPage(reqVO, new LambdaQueryWrapperX<BannerDO>() | |
| 23 | - .likeIfPresent(BannerDO::getTitle, reqVO.getTitle()) | |
| 24 | - .eqIfPresent(BannerDO::getStatus, reqVO.getStatus()) | |
| 25 | - .betweenIfPresent(BannerDO::getCreateTime, reqVO.getCreateTime()) | |
| 26 | - .orderByDesc(BannerDO::getSort)); | |
| 27 | - } | |
| 28 | - | |
| 29 | - default void updateBrowseCount(Long id) { | |
| 30 | - update(null, new LambdaUpdateWrapper<BannerDO>() | |
| 31 | - .eq(BannerDO::getId, id) | |
| 32 | - .setSql("browse_count = browse_count + 1")); | |
| 33 | - } | |
| 34 | - | |
| 35 | - default List<BannerDO> selectBannerListByPosition(Integer position) { | |
| 36 | - return selectList(new LambdaQueryWrapperX<BannerDO>().eq(BannerDO::getPosition, position)); | |
| 37 | - } | |
| 38 | - | |
| 39 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.bargain; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity.BargainActivityPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityDO; | |
| 9 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 10 | -import org.apache.ibatis.annotations.Mapper; | |
| 11 | - | |
| 12 | -import java.time.LocalDateTime; | |
| 13 | -import java.util.List; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * 砍价活动 Mapper | |
| 17 | - * | |
| 18 | - * @author HUIHUI | |
| 19 | - */ | |
| 20 | -@Mapper | |
| 21 | -public interface BargainActivityMapper extends BaseMapperX<BargainActivityDO> { | |
| 22 | - | |
| 23 | - default PageResult<BargainActivityDO> selectPage(BargainActivityPageReqVO reqVO) { | |
| 24 | - return selectPage(reqVO, new LambdaQueryWrapperX<BargainActivityDO>() | |
| 25 | - .likeIfPresent(BargainActivityDO::getName, reqVO.getName()) | |
| 26 | - .eqIfPresent(BargainActivityDO::getStatus, reqVO.getStatus()) | |
| 27 | - .orderByDesc(BargainActivityDO::getId)); | |
| 28 | - } | |
| 29 | - | |
| 30 | - default List<BargainActivityDO> selectListByStatus(Integer status) { | |
| 31 | - return selectList(BargainActivityDO::getStatus, status); | |
| 32 | - } | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * 更新活动库存 | |
| 36 | - * | |
| 37 | - * @param id 活动编号 | |
| 38 | - * @param count 扣减的库存数量 | |
| 39 | - * @return 影响的行数 | |
| 40 | - */ | |
| 41 | - default int updateStock(Long id, int count) { | |
| 42 | - // 情况一:增加库存 | |
| 43 | - if (count > 0) { | |
| 44 | - return update(null, new LambdaUpdateWrapper<BargainActivityDO>() | |
| 45 | - .eq(BargainActivityDO::getId, id) | |
| 46 | - .setSql("stock = stock + " + count)); | |
| 47 | - } | |
| 48 | - // 情况二:扣减库存 | |
| 49 | - count = -count; // 取正 | |
| 50 | - return update(null, new LambdaUpdateWrapper<BargainActivityDO>() | |
| 51 | - .eq(BargainActivityDO::getId, id) | |
| 52 | - .ge(BargainActivityDO::getStock, count) | |
| 53 | - .setSql("stock = stock - " + count)); | |
| 54 | - } | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * 查询处在 now 日期时间且是 status 状态的活动分页 | |
| 58 | - * | |
| 59 | - * @param pageReqVO 分页参数 | |
| 60 | - * @param status 状态 | |
| 61 | - * @param now 当前日期时间 | |
| 62 | - * @return 活动分页 | |
| 63 | - */ | |
| 64 | - default PageResult<BargainActivityDO> selectPage(PageParam pageReqVO, Integer status, LocalDateTime now) { | |
| 65 | - return selectPage(pageReqVO, new LambdaQueryWrapperX<BargainActivityDO>() | |
| 66 | - .eq(BargainActivityDO::getStatus, status) | |
| 67 | - .le(BargainActivityDO::getStartTime, now) | |
| 68 | - .ge(BargainActivityDO::getEndTime, now)); | |
| 69 | - } | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * 查询处在 now 日期时间且是 status 状态的活动分页 | |
| 73 | - * | |
| 74 | - * @param status 状态 | |
| 75 | - * @param now 当前日期时间 | |
| 76 | - * @return 活动分页 | |
| 77 | - */ | |
| 78 | - default List<BargainActivityDO> selectList(Integer count, Integer status, LocalDateTime now) { | |
| 79 | - return selectList(new LambdaQueryWrapperX<BargainActivityDO>() | |
| 80 | - .eq(BargainActivityDO::getStatus, status) | |
| 81 | - .le(BargainActivityDO::getStartTime, now) | |
| 82 | - .ge(BargainActivityDO::getEndTime, now) | |
| 83 | - .last("LIMIT " + count)); | |
| 84 | - } | |
| 85 | - | |
| 86 | - default BargainActivityDO selectBySpuIdAndStatusAndNow(Long spuId, Integer status) { | |
| 87 | - LocalDateTime now = LocalDateTime.now(); | |
| 88 | - return selectOne(new LambdaQueryWrapperX<BargainActivityDO>() | |
| 89 | - .eq(BargainActivityDO::getSpuId, spuId) | |
| 90 | - .eq(BargainActivityDO::getStatus, status) | |
| 91 | - .lt(BargainActivityDO::getStartTime, now) | |
| 92 | - .gt(BargainActivityDO::getEndTime, now)); // 开始时间 < now < 结束时间,也就是说获取指定时间段的活动 | |
| 93 | - } | |
| 94 | - | |
| 95 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainHelpMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.bargain; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.map.MapUtil; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 9 | -import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.help.BargainHelpPageReqVO; | |
| 10 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainHelpDO; | |
| 11 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 12 | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 13 | -import org.apache.ibatis.annotations.Mapper; | |
| 14 | - | |
| 15 | -import java.util.Collection; | |
| 16 | -import java.util.Collections; | |
| 17 | -import java.util.List; | |
| 18 | -import java.util.Map; | |
| 19 | - | |
| 20 | -@Mapper | |
| 21 | -public interface BargainHelpMapper extends BaseMapperX<BargainHelpDO> { | |
| 22 | - | |
| 23 | - default Long selectCountByUserIdAndActivityId(Long userId, Long activityId) { | |
| 24 | - return selectCount(new LambdaQueryWrapper<>(BargainHelpDO.class) | |
| 25 | - .eq(BargainHelpDO::getUserId, userId) | |
| 26 | - .eq(BargainHelpDO::getActivityId, activityId)); | |
| 27 | - } | |
| 28 | - | |
| 29 | - default Long selectUserCountMapByRecordId(Long recordId) { | |
| 30 | - return selectCount(BargainHelpDO::getRecordId, recordId); | |
| 31 | - } | |
| 32 | - | |
| 33 | - default BargainHelpDO selectByUserIdAndRecordId(Long userId, Long recordId) { | |
| 34 | - return selectOne(new LambdaQueryWrapper<>(BargainHelpDO.class) | |
| 35 | - .eq(BargainHelpDO::getUserId, userId) | |
| 36 | - .eq(BargainHelpDO::getRecordId, recordId)); | |
| 37 | - } | |
| 38 | - | |
| 39 | - default Map<Long, Integer> selectUserCountMapByActivityId(Collection<Long> activityIds) { | |
| 40 | - // SQL count 查询 | |
| 41 | - List<Map<String, Object>> result = selectMaps(new QueryWrapper<BargainHelpDO>() | |
| 42 | - .select("COUNT(DISTINCT(user_id)) AS userCount, activity_id AS activityId") | |
| 43 | - .in("activity_id", activityIds) | |
| 44 | - .groupBy("activity_id")); | |
| 45 | - if (CollUtil.isEmpty(result)) { | |
| 46 | - return Collections.emptyMap(); | |
| 47 | - } | |
| 48 | - // 转换数据 | |
| 49 | - return CollectionUtils.convertMap(result, | |
| 50 | - record -> MapUtil.getLong(record, "activityId"), | |
| 51 | - record -> MapUtil.getInt(record, "userCount" )); | |
| 52 | - } | |
| 53 | - | |
| 54 | - default Map<Long, Integer> selectUserCountMapByRecordId(Collection<Long> recordIds) { | |
| 55 | - // SQL count 查询 | |
| 56 | - List<Map<String, Object>> result = selectMaps(new QueryWrapper<BargainHelpDO>() | |
| 57 | - .select("COUNT(1) AS userCount, record_id AS recordId") | |
| 58 | - .in("record_id", recordIds) | |
| 59 | - .groupBy("record_id")); | |
| 60 | - if (CollUtil.isEmpty(result)) { | |
| 61 | - return Collections.emptyMap(); | |
| 62 | - } | |
| 63 | - // 转换数据 | |
| 64 | - return CollectionUtils.convertMap(result, | |
| 65 | - record -> MapUtil.getLong(record, "recordId"), | |
| 66 | - record -> MapUtil.getInt(record, "userCount" )); | |
| 67 | - } | |
| 68 | - | |
| 69 | - default PageResult<BargainHelpDO> selectPage(BargainHelpPageReqVO reqVO) { | |
| 70 | - return selectPage(reqVO, new LambdaQueryWrapperX<BargainHelpDO>() | |
| 71 | - .eqIfPresent(BargainHelpDO::getRecordId, reqVO.getRecordId()) | |
| 72 | - .orderByDesc(BargainHelpDO::getId)); | |
| 73 | - } | |
| 74 | - | |
| 75 | - default List<BargainHelpDO> selectListByRecordId(Long recordId) { | |
| 76 | - return selectList(new LambdaQueryWrapperX<BargainHelpDO>() | |
| 77 | - .eq(BargainHelpDO::getRecordId, recordId)); | |
| 78 | - } | |
| 79 | - | |
| 80 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainRecordMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.bargain; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.map.MapUtil; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 7 | -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 9 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 10 | -import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.recrod.BargainRecordPageReqVO; | |
| 11 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainRecordDO; | |
| 12 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 13 | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 14 | -import org.apache.ibatis.annotations.Mapper; | |
| 15 | -import org.apache.ibatis.annotations.Param; | |
| 16 | -import org.apache.ibatis.annotations.Select; | |
| 17 | - | |
| 18 | -import java.time.LocalDateTime; | |
| 19 | -import java.util.Collection; | |
| 20 | -import java.util.Collections; | |
| 21 | -import java.util.List; | |
| 22 | -import java.util.Map; | |
| 23 | - | |
| 24 | -/** | |
| 25 | - * 砍价记录 Mapper | |
| 26 | - * | |
| 27 | - * @author HUIHUI | |
| 28 | - */ | |
| 29 | -@Mapper | |
| 30 | -public interface BargainRecordMapper extends BaseMapperX<BargainRecordDO> { | |
| 31 | - | |
| 32 | - default BargainRecordDO selectByIdAndUserId(Long id, Long userId) { | |
| 33 | - return selectOne(BargainRecordDO::getId, id, | |
| 34 | - BargainRecordDO::getUserId, userId); | |
| 35 | - } | |
| 36 | - | |
| 37 | - default List<BargainRecordDO> selectListByUserIdAndActivityIdAndStatus( | |
| 38 | - Long userId, Long activityId, Integer status) { | |
| 39 | - return selectList(new LambdaQueryWrapper<>(BargainRecordDO.class) | |
| 40 | - .eq(BargainRecordDO::getUserId, userId) | |
| 41 | - .eq(BargainRecordDO::getActivityId, activityId) | |
| 42 | - .eq(BargainRecordDO::getStatus, status)); | |
| 43 | - } | |
| 44 | - | |
| 45 | - default BargainRecordDO selectLastByUserIdAndActivityId(Long userId, Long activityId) { | |
| 46 | - return selectOne(new LambdaQueryWrapper<>(BargainRecordDO.class) | |
| 47 | - .eq(BargainRecordDO::getUserId, userId) | |
| 48 | - .eq(BargainRecordDO::getActivityId, activityId) | |
| 49 | - .orderByDesc(BargainRecordDO::getId) | |
| 50 | - .last("LIMIT 1")); | |
| 51 | - } | |
| 52 | - | |
| 53 | - default Long selectCountByUserIdAndActivityIdAndStatus( | |
| 54 | - Long userId, Long activityId, Integer status) { | |
| 55 | - return selectCount(new LambdaQueryWrapper<>(BargainRecordDO.class) | |
| 56 | - .eq(BargainRecordDO::getUserId, userId) | |
| 57 | - .eq(BargainRecordDO::getActivityId, activityId) | |
| 58 | - .eq(BargainRecordDO::getStatus, status)); | |
| 59 | - } | |
| 60 | - | |
| 61 | - default int updateByIdAndBargainPrice(Long id, Integer whereBargainPrice, BargainRecordDO updateObj) { | |
| 62 | - return update(updateObj, new LambdaQueryWrapper<>(BargainRecordDO.class) | |
| 63 | - .eq(BargainRecordDO::getId, id) | |
| 64 | - .eq(BargainRecordDO::getBargainPrice, whereBargainPrice)); | |
| 65 | - } | |
| 66 | - | |
| 67 | - default Map<Long, Integer> selectUserCountByActivityIdsAndStatus(Collection<Long> activityIds, Integer status) { | |
| 68 | - // SQL count 查询 | |
| 69 | - List<Map<String, Object>> result = selectMaps(new QueryWrapper<BargainRecordDO>() | |
| 70 | - .select("COUNT(DISTINCT(user_id)) AS userCount, activity_id AS activityId") | |
| 71 | - .in("activity_id", activityIds) | |
| 72 | - .eq(status != null, "status", status) | |
| 73 | - .groupBy("activity_id")); | |
| 74 | - if (CollUtil.isEmpty(result)) { | |
| 75 | - return Collections.emptyMap(); | |
| 76 | - } | |
| 77 | - // 转换数据 | |
| 78 | - return CollectionUtils.convertMap(result, | |
| 79 | - record -> MapUtil.getLong(record, "activityId"), | |
| 80 | - record -> MapUtil.getInt(record, "userCount" )); | |
| 81 | - } | |
| 82 | - | |
| 83 | - @Select("SELECT COUNT(DISTINCT(user_id)) FROM promotion_bargain_record " + | |
| 84 | - "WHERE status = #{status}") | |
| 85 | - Integer selectUserCountByStatus(@Param("status") Integer status); | |
| 86 | - | |
| 87 | - @Select("SELECT COUNT(DISTINCT(user_id)) FROM promotion_bargain_record " + | |
| 88 | - "WHERE activity_id = #{activityId} " + | |
| 89 | - "AND status = #{status}") | |
| 90 | - Integer selectUserCountByActivityIdAndStatus(@Param("activityId") Long activityId, | |
| 91 | - @Param("status") Integer status); | |
| 92 | - | |
| 93 | - default PageResult<BargainRecordDO> selectPage(BargainRecordPageReqVO reqVO) { | |
| 94 | - return selectPage(reqVO, new LambdaQueryWrapperX<BargainRecordDO>() | |
| 95 | - .eqIfPresent(BargainRecordDO::getStatus, reqVO.getStatus()) | |
| 96 | - .betweenIfPresent(BargainRecordDO::getCreateTime, reqVO.getCreateTime()) | |
| 97 | - .orderByDesc(BargainRecordDO::getId)); | |
| 98 | - } | |
| 99 | - | |
| 100 | - default PageResult<BargainRecordDO> selectBargainRecordPage(Long userId, PageParam pageParam) { | |
| 101 | - return selectPage(pageParam, new LambdaQueryWrapperX<BargainRecordDO>() | |
| 102 | - .eq(BargainRecordDO::getUserId, userId) | |
| 103 | - .orderByDesc(BargainRecordDO::getId)); | |
| 104 | - } | |
| 105 | - | |
| 106 | - default List<BargainRecordDO> selectListByStatusAndCount(Integer status, Integer count) { | |
| 107 | - return selectList(new LambdaQueryWrapper<>(BargainRecordDO.class) | |
| 108 | - .eq(BargainRecordDO::getStatus, status) | |
| 109 | - .last("LIMIT " + count)); | |
| 110 | - } | |
| 111 | - | |
| 112 | - /** | |
| 113 | - * 更新砍价的订单编号,前提是 orderId 原本是空的 | |
| 114 | - * | |
| 115 | - * @param id 砍价记录编号 | |
| 116 | - * @param orderId 订单编号 | |
| 117 | - * @return 更新数量 | |
| 118 | - */ | |
| 119 | - default int updateOrderIdById(Long id, Long orderId) { | |
| 120 | - return update(new BargainRecordDO().setOrderId(orderId).setEndTime(LocalDateTime.now()), | |
| 121 | - new LambdaQueryWrapper<>(BargainRecordDO.class) | |
| 122 | - .eq(BargainRecordDO::getId, id) | |
| 123 | - .isNull(BargainRecordDO::getOrderId)); | |
| 124 | - } | |
| 125 | - | |
| 126 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationActivityMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.combination; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | - | |
| 11 | -import java.time.LocalDateTime; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 拼团活动 Mapper | |
| 16 | - * | |
| 17 | - * @author HUIHUI | |
| 18 | - */ | |
| 19 | -@Mapper | |
| 20 | -public interface CombinationActivityMapper extends BaseMapperX<CombinationActivityDO> { | |
| 21 | - | |
| 22 | - default PageResult<CombinationActivityDO> selectPage(CombinationActivityPageReqVO reqVO) { | |
| 23 | - return selectPage(reqVO, new LambdaQueryWrapperX<CombinationActivityDO>() | |
| 24 | - .likeIfPresent(CombinationActivityDO::getName, reqVO.getName()) | |
| 25 | - .eqIfPresent(CombinationActivityDO::getStatus, reqVO.getStatus()) | |
| 26 | - .orderByDesc(CombinationActivityDO::getId)); | |
| 27 | - } | |
| 28 | - | |
| 29 | - default List<CombinationActivityDO> selectListByStatus(Integer status) { | |
| 30 | - return selectList(CombinationActivityDO::getStatus, status); | |
| 31 | - } | |
| 32 | - | |
| 33 | - default PageResult<CombinationActivityDO> selectPage(PageParam pageParam, Integer status) { | |
| 34 | - return selectPage(pageParam, new LambdaQueryWrapperX<CombinationActivityDO>() | |
| 35 | - .eq(CombinationActivityDO::getStatus, status)); | |
| 36 | - } | |
| 37 | - | |
| 38 | - default CombinationActivityDO selectBySpuIdAndStatusAndNow(Long spuId, Integer status) { | |
| 39 | - LocalDateTime now = LocalDateTime.now(); | |
| 40 | - return selectOne(new LambdaQueryWrapperX<CombinationActivityDO>() | |
| 41 | - .eq(CombinationActivityDO::getSpuId, spuId) | |
| 42 | - .eq(CombinationActivityDO::getStatus, status) | |
| 43 | - .lt(CombinationActivityDO::getStartTime, now) | |
| 44 | - .gt(CombinationActivityDO::getEndTime, now)); // 开始时间 < now < 结束时间,也就是说获取指定时间段的活动 | |
| 45 | - } | |
| 46 | - | |
| 47 | -} | |
| 48 | 0 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationProductMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.combination; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; | |
| 8 | -import org.apache.ibatis.annotations.Mapper; | |
| 9 | - | |
| 10 | -import java.util.Collection; | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 拼团商品 Mapper | |
| 15 | - * | |
| 16 | - * @author HUIHUI | |
| 17 | - */ | |
| 18 | -@Mapper | |
| 19 | -public interface CombinationProductMapper extends BaseMapperX<CombinationProductDO> { | |
| 20 | - | |
| 21 | - default PageResult<CombinationProductDO> selectPage(CombinationProductPageReqVO reqVO) { | |
| 22 | - return selectPage(reqVO, new LambdaQueryWrapperX<CombinationProductDO>() | |
| 23 | - .eqIfPresent(CombinationProductDO::getActivityId, reqVO.getActivityId()) | |
| 24 | - .eqIfPresent(CombinationProductDO::getSpuId, reqVO.getSpuId()) | |
| 25 | - .eqIfPresent(CombinationProductDO::getSkuId, reqVO.getSkuId()) | |
| 26 | - .eqIfPresent(CombinationProductDO::getActivityStatus, reqVO.getActivityStatus()) | |
| 27 | - .betweenIfPresent(CombinationProductDO::getActivityStartTime, reqVO.getActivityStartTime()) | |
| 28 | - .betweenIfPresent(CombinationProductDO::getActivityEndTime, reqVO.getActivityEndTime()) | |
| 29 | - .eqIfPresent(CombinationProductDO::getCombinationPrice, reqVO.getActivePrice()) | |
| 30 | - .betweenIfPresent(CombinationProductDO::getCreateTime, reqVO.getCreateTime()) | |
| 31 | - .orderByDesc(CombinationProductDO::getId)); | |
| 32 | - } | |
| 33 | - | |
| 34 | - default List<CombinationProductDO> selectListByActivityIds(Collection<Long> ids) { | |
| 35 | - return selectList(CombinationProductDO::getActivityId, ids); | |
| 36 | - } | |
| 37 | - | |
| 38 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/coupon/CouponMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.coupon; | |
| 2 | - | |
| 3 | -import cn.hutool.core.map.MapUtil; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon.CouponPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponDO; | |
| 9 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 10 | -import com.github.yulichang.toolkit.MPJWrappers; | |
| 11 | -import org.apache.ibatis.annotations.Mapper; | |
| 12 | - | |
| 13 | -import java.time.LocalDateTime; | |
| 14 | -import java.util.Collection; | |
| 15 | -import java.util.List; | |
| 16 | -import java.util.Map; | |
| 17 | - | |
| 18 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 19 | - | |
| 20 | -/** | |
| 21 | - * 优惠劵 Mapper | |
| 22 | - * | |
| 23 | - * @author 芋道源码 | |
| 24 | - */ | |
| 25 | -@Mapper | |
| 26 | -public interface CouponMapper extends BaseMapperX<CouponDO> { | |
| 27 | - | |
| 28 | - default PageResult<CouponDO> selectPage(CouponPageReqVO reqVO) { | |
| 29 | - return selectPage(reqVO, new LambdaQueryWrapperX<CouponDO>() | |
| 30 | - .eqIfPresent(CouponDO::getTemplateId, reqVO.getTemplateId()) | |
| 31 | - .eqIfPresent(CouponDO::getStatus, reqVO.getStatus()) | |
| 32 | - .inIfPresent(CouponDO::getUserId, reqVO.getUserIds()) | |
| 33 | - .betweenIfPresent(CouponDO::getCreateTime, reqVO.getCreateTime()) | |
| 34 | - .orderByDesc(CouponDO::getId)); | |
| 35 | - } | |
| 36 | - | |
| 37 | - default List<CouponDO> selectListByUserIdAndStatus(Long userId, Integer status) { | |
| 38 | - return selectList(new LambdaQueryWrapperX<CouponDO>() | |
| 39 | - .eq(CouponDO::getUserId, userId).eq(CouponDO::getStatus, status)); | |
| 40 | - } | |
| 41 | - | |
| 42 | - default CouponDO selectByIdAndUserId(Long id, Long userId) { | |
| 43 | - return selectOne(new LambdaQueryWrapperX<CouponDO>() | |
| 44 | - .eq(CouponDO::getId, id).eq(CouponDO::getUserId, userId)); | |
| 45 | - } | |
| 46 | - | |
| 47 | - default int delete(Long id, Collection<Integer> whereStatuses) { | |
| 48 | - return update(null, new LambdaUpdateWrapper<CouponDO>() | |
| 49 | - .eq(CouponDO::getId, id).in(CouponDO::getStatus, whereStatuses) | |
| 50 | - .set(CouponDO::getDeleted, 1)); | |
| 51 | - } | |
| 52 | - | |
| 53 | - default int updateByIdAndStatus(Long id, Integer status, CouponDO updateObj) { | |
| 54 | - return update(updateObj, new LambdaUpdateWrapper<CouponDO>() | |
| 55 | - .eq(CouponDO::getId, id).eq(CouponDO::getStatus, status)); | |
| 56 | - } | |
| 57 | - | |
| 58 | - default Long selectCountByUserIdAndStatus(Long userId, Integer status) { | |
| 59 | - return selectCount(new LambdaQueryWrapperX<CouponDO>() | |
| 60 | - .eq(CouponDO::getUserId, userId) | |
| 61 | - .eq(CouponDO::getStatus, status)); | |
| 62 | - } | |
| 63 | - | |
| 64 | - default List<CouponDO> selectListByTemplateIdAndUserId(Long templateId, Collection<Long> userIds) { | |
| 65 | - return selectList(new LambdaQueryWrapperX<CouponDO>() | |
| 66 | - .eq(CouponDO::getTemplateId, templateId) | |
| 67 | - .in(CouponDO::getUserId, userIds) | |
| 68 | - ); | |
| 69 | - } | |
| 70 | - | |
| 71 | - default Map<Long, Integer> selectCountByUserIdAndTemplateIdIn(Long userId, Collection<Long> templateIds) { | |
| 72 | - String templateIdAlias = "templateId"; | |
| 73 | - String countAlias = "count"; | |
| 74 | - List<Map<String, Object>> list = selectMaps(MPJWrappers.lambdaJoin(CouponDO.class) | |
| 75 | - .selectAs(CouponDO::getTemplateId, templateIdAlias) | |
| 76 | - .selectCount(CouponDO::getId, countAlias) | |
| 77 | - .eq(CouponDO::getUserId, userId) | |
| 78 | - .in(CouponDO::getTemplateId, templateIds) | |
| 79 | - .groupBy(CouponDO::getTemplateId)); | |
| 80 | - return convertMap(list, map -> MapUtil.getLong(map, templateIdAlias), map -> MapUtil.getInt(map, countAlias)); | |
| 81 | - } | |
| 82 | - | |
| 83 | - default List<CouponDO> selectListByStatusAndValidEndTimeLe(Integer status, LocalDateTime validEndTime) { | |
| 84 | - return selectList(new LambdaQueryWrapperX<CouponDO>() | |
| 85 | - .eq(CouponDO::getStatus, status) | |
| 86 | - .le(CouponDO::getValidEndTime, validEndTime) | |
| 87 | - ); | |
| 88 | - } | |
| 89 | - | |
| 90 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/coupon/CouponTemplateMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.coupon; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplatePageReqVO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponTemplateDO; | |
| 10 | -import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTemplateValidityTypeEnum; | |
| 11 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 12 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 13 | -import org.apache.ibatis.annotations.Mapper; | |
| 14 | - | |
| 15 | -import java.time.LocalDateTime; | |
| 16 | -import java.util.List; | |
| 17 | -import java.util.function.Consumer; | |
| 18 | - | |
| 19 | -/** | |
| 20 | - * 优惠劵模板 Mapper | |
| 21 | - * | |
| 22 | - * @author 芋道源码 | |
| 23 | - */ | |
| 24 | -@Mapper | |
| 25 | -public interface CouponTemplateMapper extends BaseMapperX<CouponTemplateDO> { | |
| 26 | - | |
| 27 | - default PageResult<CouponTemplateDO> selectPage(CouponTemplatePageReqVO reqVO) { | |
| 28 | - // 构建可领取的查询条件 | |
| 29 | - Consumer<LambdaQueryWrapper<CouponTemplateDO>> canTakeConsumer = buildCanTakeQueryConsumer(reqVO.getCanTakeTypes()); | |
| 30 | - // 执行分页查询 | |
| 31 | - return selectPage(reqVO, new LambdaQueryWrapperX<CouponTemplateDO>() | |
| 32 | - .likeIfPresent(CouponTemplateDO::getName, reqVO.getName()) | |
| 33 | - .eqIfPresent(CouponTemplateDO::getStatus, reqVO.getStatus()) | |
| 34 | - .eqIfPresent(CouponTemplateDO::getDiscountType, reqVO.getDiscountType()) | |
| 35 | - .betweenIfPresent(CouponTemplateDO::getCreateTime, reqVO.getCreateTime()) | |
| 36 | - .eqIfPresent(CouponTemplateDO::getProductScope, reqVO.getProductScope()) | |
| 37 | - .and(reqVO.getProductScopeValue() != null, w -> w.apply("FIND_IN_SET({0}, product_scope_values)", | |
| 38 | - reqVO.getProductScopeValue())) | |
| 39 | - .and(canTakeConsumer != null, canTakeConsumer) | |
| 40 | - .orderByDesc(CouponTemplateDO::getId)); | |
| 41 | - } | |
| 42 | - | |
| 43 | - default void updateTakeCount(Long id, Integer incrCount) { | |
| 44 | - update(null, new LambdaUpdateWrapper<CouponTemplateDO>() | |
| 45 | - .eq(CouponTemplateDO::getId, id) | |
| 46 | - .setSql("take_count = take_count + " + incrCount)); | |
| 47 | - } | |
| 48 | - | |
| 49 | - default List<CouponTemplateDO> selectListByTakeType(Integer takeType) { | |
| 50 | - return selectList(CouponTemplateDO::getTakeType, takeType, CouponTemplateDO::getStatus, CommonStatusEnum.ENABLE.getStatus()); | |
| 51 | - } | |
| 52 | - | |
| 53 | - default List<CouponTemplateDO> selectList(List<Integer> canTakeTypes, Integer productScope, Long productScopeValue, Integer count) { | |
| 54 | - // 构建可领取的查询条件 | |
| 55 | - Consumer<LambdaQueryWrapper<CouponTemplateDO>> canTakeConsumer = buildCanTakeQueryConsumer(canTakeTypes); | |
| 56 | - return selectList(new LambdaQueryWrapperX<CouponTemplateDO>() | |
| 57 | - .eqIfPresent(CouponTemplateDO::getProductScope, productScope) | |
| 58 | - .and(productScopeValue != null, w -> w.apply("FIND_IN_SET({0}, product_scope_values)", | |
| 59 | - productScopeValue)) | |
| 60 | - .and(canTakeConsumer != null, canTakeConsumer) | |
| 61 | - .last(" LIMIT " + count) | |
| 62 | - .orderByDesc(CouponTemplateDO::getId)); | |
| 63 | - } | |
| 64 | - | |
| 65 | - static Consumer<LambdaQueryWrapper<CouponTemplateDO>> buildCanTakeQueryConsumer(List<Integer> canTakeTypes) { | |
| 66 | - Consumer<LambdaQueryWrapper<CouponTemplateDO>> canTakeConsumer = null; | |
| 67 | - if (CollUtil.isNotEmpty(canTakeTypes)) { | |
| 68 | - canTakeConsumer = w -> | |
| 69 | - w.eq(CouponTemplateDO::getStatus, CommonStatusEnum.ENABLE.getStatus()) // 1. 状态为可用的 | |
| 70 | - .in(CouponTemplateDO::getTakeType, canTakeTypes) // 2. 领取方式一致 | |
| 71 | - .and(ww -> ww.gt(CouponTemplateDO::getValidEndTime, LocalDateTime.now()) // 3.1 未过期 | |
| 72 | - .or().eq(CouponTemplateDO::getValidityType, CouponTemplateValidityTypeEnum.TERM.getType())) // 3.2 领取之后 | |
| 73 | - .apply(" (take_count < total_count OR total_count = -1)"); // 4. 剩余数量大于 0,或者无限领取 | |
| 74 | - } | |
| 75 | - return canTakeConsumer; | |
| 76 | - } | |
| 77 | - | |
| 78 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/discount/DiscountActivityMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.discount; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.discount.vo.DiscountActivityPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.discount.DiscountActivityDO; | |
| 8 | -import org.apache.ibatis.annotations.Mapper; | |
| 9 | - | |
| 10 | -import java.time.LocalDateTime; | |
| 11 | -import java.util.Collection; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 限时折扣活动 Mapper | |
| 16 | - * | |
| 17 | - * @author 芋道源码 | |
| 18 | - */ | |
| 19 | -@Mapper | |
| 20 | -public interface DiscountActivityMapper extends BaseMapperX<DiscountActivityDO> { | |
| 21 | - | |
| 22 | - default PageResult<DiscountActivityDO> selectPage(DiscountActivityPageReqVO reqVO) { | |
| 23 | - return selectPage(reqVO, new LambdaQueryWrapperX<DiscountActivityDO>() | |
| 24 | - .likeIfPresent(DiscountActivityDO::getName, reqVO.getName()) | |
| 25 | - .eqIfPresent(DiscountActivityDO::getStatus, reqVO.getStatus()) | |
| 26 | - .betweenIfPresent(DiscountActivityDO::getCreateTime, reqVO.getCreateTime()) | |
| 27 | - .orderByDesc(DiscountActivityDO::getId)); | |
| 28 | - } | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * 获取指定活动编号的活动列表且 | |
| 32 | - * 开始时间和结束时间小于给定时间 dateTime 的活动列表 | |
| 33 | - * | |
| 34 | - * @param ids 活动编号 | |
| 35 | - * @param dateTime 指定日期 | |
| 36 | - * @return 活动列表 | |
| 37 | - */ | |
| 38 | - default List<DiscountActivityDO> selectListByIdsAndDateTimeLt(Collection<Long> ids, LocalDateTime dateTime) { | |
| 39 | - return selectList(new LambdaQueryWrapperX<DiscountActivityDO>() | |
| 40 | - .in(DiscountActivityDO::getId, ids) | |
| 41 | - .lt(DiscountActivityDO::getStartTime, dateTime) | |
| 42 | - .gt(DiscountActivityDO::getEndTime, dateTime)// 开始时间 < 指定时间 < 结束时间,也就是说获取指定时间段的活动 | |
| 43 | - .orderByDesc(DiscountActivityDO::getCreateTime)); | |
| 44 | - } | |
| 45 | - | |
| 46 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/discount/DiscountProductMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.discount; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 5 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.discount.DiscountProductDO; | |
| 6 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 7 | -import org.apache.ibatis.annotations.Mapper; | |
| 8 | - | |
| 9 | -import java.time.LocalDateTime; | |
| 10 | -import java.util.Collection; | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 限时折扣商城 Mapper | |
| 15 | - * | |
| 16 | - * @author 芋道源码 | |
| 17 | - */ | |
| 18 | -@Mapper | |
| 19 | -public interface DiscountProductMapper extends BaseMapperX<DiscountProductDO> { | |
| 20 | - | |
| 21 | - default List<DiscountProductDO> selectListByActivityId(Long activityId) { | |
| 22 | - return selectList(DiscountProductDO::getActivityId, activityId); | |
| 23 | - } | |
| 24 | - | |
| 25 | - default List<DiscountProductDO> selectListByActivityId(Collection<Long> activityIds) { | |
| 26 | - return selectList(DiscountProductDO::getActivityId, activityIds); | |
| 27 | - } | |
| 28 | - | |
| 29 | - default void updateByActivityId(DiscountProductDO discountProductDO) { | |
| 30 | - update(discountProductDO, new LambdaUpdateWrapper<DiscountProductDO>() | |
| 31 | - .eq(DiscountProductDO::getActivityId, discountProductDO.getActivityId())); | |
| 32 | - } | |
| 33 | - | |
| 34 | - default void deleteByActivityId(Long activityId) { | |
| 35 | - delete(DiscountProductDO::getActivityId, activityId); | |
| 36 | - } | |
| 37 | - | |
| 38 | - default List<DiscountProductDO> selectListBySkuIdsAndStatusAndNow(Collection<Long> skuIds, Integer status) { | |
| 39 | - LocalDateTime now = LocalDateTime.now(); | |
| 40 | - return selectList(new LambdaQueryWrapperX<DiscountProductDO>() | |
| 41 | - .in(DiscountProductDO::getSkuId, skuIds) | |
| 42 | - .eq(DiscountProductDO::getActivityStatus,status) | |
| 43 | - .lt(DiscountProductDO::getActivityStartTime, now) | |
| 44 | - .gt(DiscountProductDO::getActivityEndTime, now)); | |
| 45 | - } | |
| 46 | - | |
| 47 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyPageMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.diy; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPagePageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; | |
| 8 | -import org.apache.ibatis.annotations.Mapper; | |
| 9 | - | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 装修页面 Mapper | |
| 14 | - * | |
| 15 | - * @author owen | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface DiyPageMapper extends BaseMapperX<DiyPageDO> { | |
| 19 | - | |
| 20 | - default PageResult<DiyPageDO> selectPage(DiyPagePageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<DiyPageDO>() | |
| 22 | - .likeIfPresent(DiyPageDO::getName, reqVO.getName()) | |
| 23 | - .betweenIfPresent(DiyPageDO::getCreateTime, reqVO.getCreateTime()) | |
| 24 | - // 模板下面的页面,在模板中管理 | |
| 25 | - .isNull(DiyPageDO::getTemplateId) | |
| 26 | - .orderByDesc(DiyPageDO::getId)); | |
| 27 | - } | |
| 28 | - | |
| 29 | - default List<DiyPageDO> selectListByTemplateId(Long templateId) { | |
| 30 | - return selectList(DiyPageDO::getTemplateId, templateId); | |
| 31 | - } | |
| 32 | - | |
| 33 | - default DiyPageDO selectByNameAndTemplateIdIsNull(String name) { | |
| 34 | - return selectOne(new LambdaQueryWrapperX<DiyPageDO>() | |
| 35 | - .eq(DiyPageDO::getName, name) | |
| 36 | - .isNull(DiyPageDO::getTemplateId)); | |
| 37 | - } | |
| 38 | - | |
| 39 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.diy; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplatePageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; | |
| 8 | -import org.apache.ibatis.annotations.Mapper; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 装修模板 Mapper | |
| 12 | - * | |
| 13 | - * @author owen | |
| 14 | - */ | |
| 15 | -@Mapper | |
| 16 | -public interface DiyTemplateMapper extends BaseMapperX<DiyTemplateDO> { | |
| 17 | - | |
| 18 | - default PageResult<DiyTemplateDO> selectPage(DiyTemplatePageReqVO reqVO) { | |
| 19 | - return selectPage(reqVO, new LambdaQueryWrapperX<DiyTemplateDO>() | |
| 20 | - .likeIfPresent(DiyTemplateDO::getName, reqVO.getName()) | |
| 21 | - .eqIfPresent(DiyTemplateDO::getUsed, reqVO.getUsed()) | |
| 22 | - .betweenIfPresent(DiyTemplateDO::getUsedTime, reqVO.getUsedTime()) | |
| 23 | - .betweenIfPresent(DiyTemplateDO::getCreateTime, reqVO.getCreateTime()) | |
| 24 | - .orderByDesc(DiyTemplateDO::getUsed) // 排序规则1:已使用的排到最前面 | |
| 25 | - .orderByDesc(DiyTemplateDO::getId)); // 排序规则2:新创建的排到前面 | |
| 26 | - } | |
| 27 | - | |
| 28 | - default DiyTemplateDO selectByUsed(boolean used) { | |
| 29 | - return selectOne(DiyTemplateDO::getUsed, used); | |
| 30 | - } | |
| 31 | - | |
| 32 | - default DiyTemplateDO selectByName(String name) { | |
| 33 | - return selectOne(DiyTemplateDO::getName, name); | |
| 34 | - } | |
| 35 | - | |
| 36 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/kefu/KeFuConversationMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.kefu; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 5 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuConversationDO; | |
| 6 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 7 | -import org.apache.ibatis.annotations.Mapper; | |
| 8 | - | |
| 9 | -import java.util.List; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 客服会话 Mapper | |
| 13 | - * | |
| 14 | - * @author HUIHUI | |
| 15 | - */ | |
| 16 | -@Mapper | |
| 17 | -public interface KeFuConversationMapper extends BaseMapperX<KeFuConversationDO> { | |
| 18 | - | |
| 19 | - default List<KeFuConversationDO> selectConversationList() { | |
| 20 | - return selectList(new LambdaQueryWrapperX<KeFuConversationDO>() | |
| 21 | - .eq(KeFuConversationDO::getAdminDeleted, Boolean.FALSE) | |
| 22 | - .orderByDesc(KeFuConversationDO::getCreateTime)); | |
| 23 | - } | |
| 24 | - | |
| 25 | - default void updateAdminUnreadMessageCountIncrement(Long id) { | |
| 26 | - update(new LambdaUpdateWrapper<KeFuConversationDO>() | |
| 27 | - .eq(KeFuConversationDO::getId, id) | |
| 28 | - .setSql("admin_unread_message_count = admin_unread_message_count + 1")); | |
| 29 | - } | |
| 30 | - | |
| 31 | - default KeFuConversationDO selectByUserId(Long userId) { | |
| 32 | - return selectOne(KeFuConversationDO::getUserId, userId); | |
| 33 | - } | |
| 34 | - | |
| 35 | -} | |
| 36 | 0 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/kefu/KeFuMessageMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.kefu; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageListReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; | |
| 7 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 8 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | - | |
| 11 | -import java.util.Collection; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 客服消息 Mapper | |
| 16 | - * | |
| 17 | - * @author HUIHUI | |
| 18 | - */ | |
| 19 | -@Mapper | |
| 20 | -public interface KeFuMessageMapper extends BaseMapperX<KeFuMessageDO> { | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 获得消息列表 | |
| 24 | - * 1. 第一次查询时,不带时间,默认查询最新的十条消息 | |
| 25 | - * 2. 第二次查询时,带时间,查询历史消息 | |
| 26 | - * | |
| 27 | - * @param reqVO 列表请求 | |
| 28 | - * @return 消息列表 | |
| 29 | - */ | |
| 30 | - default List<KeFuMessageDO> selectList(KeFuMessageListReqVO reqVO) { | |
| 31 | - return selectList(new QueryWrapperX<KeFuMessageDO>() | |
| 32 | - .eqIfPresent("conversation_id", reqVO.getConversationId()) | |
| 33 | - .ltIfPresent("create_time", reqVO.getCreateTime()) | |
| 34 | - .orderByDesc("create_time") | |
| 35 | - .limitN(reqVO.getLimit())); | |
| 36 | - } | |
| 37 | - | |
| 38 | - default List<KeFuMessageDO> selectListByConversationIdAndUserTypeAndReadStatus(Long conversationId, Integer userType, | |
| 39 | - Boolean readStatus) { | |
| 40 | - return selectList(new LambdaQueryWrapper<KeFuMessageDO>() | |
| 41 | - .eq(KeFuMessageDO::getConversationId, conversationId) | |
| 42 | - .ne(KeFuMessageDO::getSenderType, userType) // 管理员:查询出未读的会员消息,会员:查询出未读的客服消息 | |
| 43 | - .eq(KeFuMessageDO::getReadStatus, readStatus)); | |
| 44 | - } | |
| 45 | - | |
| 46 | - default void updateReadStatusBatchByIds(Collection<Long> ids, KeFuMessageDO keFuMessageDO) { | |
| 47 | - update(keFuMessageDO, new LambdaUpdateWrapper<KeFuMessageDO>() | |
| 48 | - .in(KeFuMessageDO::getId, ids)); | |
| 49 | - } | |
| 50 | - | |
| 51 | -} | |
| 52 | 0 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/point/PointActivityMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.point; | |
| 2 | - | |
| 3 | -import cn.hutool.core.lang.Assert; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.point.vo.activity.PointActivityPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.point.PointActivityDO; | |
| 9 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 10 | -import org.apache.ibatis.annotations.Mapper; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 积分商城活动 Mapper | |
| 14 | - * | |
| 15 | - * @author HUIHUI | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface PointActivityMapper extends BaseMapperX<PointActivityDO> { | |
| 19 | - | |
| 20 | - default PageResult<PointActivityDO> selectPage(PointActivityPageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<PointActivityDO>() | |
| 22 | - .eqIfPresent(PointActivityDO::getStatus, reqVO.getStatus()) | |
| 23 | - .orderByDesc(PointActivityDO::getSort)); | |
| 24 | - } | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * 更新活动库存(减少) | |
| 28 | - * | |
| 29 | - * @param id 活动编号 | |
| 30 | - * @param count 扣减的库存数量(正数) | |
| 31 | - * @return 影响的行数 | |
| 32 | - */ | |
| 33 | - default int updateStockDecr(Long id, int count) { | |
| 34 | - Assert.isTrue(count > 0); | |
| 35 | - return update(null, new LambdaUpdateWrapper<PointActivityDO>() | |
| 36 | - .eq(PointActivityDO::getId, id) | |
| 37 | - .ge(PointActivityDO::getStock, count) | |
| 38 | - .setSql("stock = stock - " + count)); | |
| 39 | - } | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * 更新活动库存(增加) | |
| 43 | - * | |
| 44 | - * @param id 活动编号 | |
| 45 | - * @param count 增加的库存数量(正数) | |
| 46 | - * @return 影响的行数 | |
| 47 | - */ | |
| 48 | - default int updateStockIncr(Long id, int count) { | |
| 49 | - Assert.isTrue(count > 0); | |
| 50 | - return update(null, new LambdaUpdateWrapper<PointActivityDO>() | |
| 51 | - .eq(PointActivityDO::getId, id) | |
| 52 | - .setSql("stock = stock + " + count)); | |
| 53 | - } | |
| 54 | - | |
| 55 | -} | |
| 56 | 0 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/point/PointProductMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.point; | |
| 2 | - | |
| 3 | -import cn.hutool.core.lang.Assert; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.point.PointProductDO; | |
| 6 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 7 | -import org.apache.ibatis.annotations.Mapper; | |
| 8 | - | |
| 9 | -import java.util.Collection; | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 积分商城商品 Mapper | |
| 14 | - * | |
| 15 | - * @author HUIHUI | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface PointProductMapper extends BaseMapperX<PointProductDO> { | |
| 19 | - | |
| 20 | - default List<PointProductDO> selectListByActivityId(Collection<Long> activityIds) { | |
| 21 | - return selectList(PointProductDO::getActivityId, activityIds); | |
| 22 | - } | |
| 23 | - | |
| 24 | - default List<PointProductDO> selectListByActivityId(Long activityId) { | |
| 25 | - return selectList(PointProductDO::getActivityId, activityId); | |
| 26 | - } | |
| 27 | - | |
| 28 | - default void updateByActivityId(PointProductDO pointProductDO) { | |
| 29 | - update(pointProductDO, new LambdaUpdateWrapper<PointProductDO>() | |
| 30 | - .eq(PointProductDO::getActivityId, pointProductDO.getActivityId())); | |
| 31 | - } | |
| 32 | - | |
| 33 | - default PointProductDO selectListByActivityIdAndSkuId(Long activityId, Long skuId) { | |
| 34 | - return selectOne(PointProductDO::getActivityId, activityId, | |
| 35 | - PointProductDO::getSkuId, skuId); | |
| 36 | - } | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 更新活动库存(减少) | |
| 40 | - * | |
| 41 | - * @param id 活动编号 | |
| 42 | - * @param count 扣减的库存数量(减少库存) | |
| 43 | - * @return 影响的行数 | |
| 44 | - */ | |
| 45 | - default int updateStockDecr(Long id, int count) { | |
| 46 | - Assert.isTrue(count > 0); | |
| 47 | - return update(null, new LambdaUpdateWrapper<PointProductDO>() | |
| 48 | - .eq(PointProductDO::getId, id) | |
| 49 | - .ge(PointProductDO::getStock, count) | |
| 50 | - .setSql("stock = stock - " + count)); | |
| 51 | - } | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * 更新活动库存(增加) | |
| 55 | - * | |
| 56 | - * @param id 活动编号 | |
| 57 | - * @param count 需要增加的库存(增加库存) | |
| 58 | - * @return 影响的行数 | |
| 59 | - */ | |
| 60 | - default int updateStockIncr(Long id, int count) { | |
| 61 | - Assert.isTrue(count > 0); | |
| 62 | - return update(null, new LambdaUpdateWrapper<PointProductDO>() | |
| 63 | - .eq(PointProductDO::getId, id) | |
| 64 | - .setSql("stock = stock + " + count)); | |
| 65 | - } | |
| 66 | -} | |
| 67 | 0 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/reward/RewardActivityMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.reward; | |
| 2 | - | |
| 3 | -import cn.hutool.core.util.StrUtil; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivityPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.reward.RewardActivityDO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum; | |
| 10 | -import org.apache.ibatis.annotations.Mapper; | |
| 11 | - | |
| 12 | -import java.time.LocalDateTime; | |
| 13 | -import java.util.Collection; | |
| 14 | -import java.util.List; | |
| 15 | -import java.util.function.Function; | |
| 16 | -import java.util.stream.Collectors; | |
| 17 | - | |
| 18 | -/** | |
| 19 | - * 满减送活动 Mapper | |
| 20 | - * | |
| 21 | - * @author 芋道源码 | |
| 22 | - */ | |
| 23 | -@Mapper | |
| 24 | -public interface RewardActivityMapper extends BaseMapperX<RewardActivityDO> { | |
| 25 | - | |
| 26 | - default PageResult<RewardActivityDO> selectPage(RewardActivityPageReqVO reqVO) { | |
| 27 | - return selectPage(reqVO, new LambdaQueryWrapperX<RewardActivityDO>() | |
| 28 | - .likeIfPresent(RewardActivityDO::getName, reqVO.getName()) | |
| 29 | - .eqIfPresent(RewardActivityDO::getStatus, reqVO.getStatus()) | |
| 30 | - .orderByDesc(RewardActivityDO::getId)); | |
| 31 | - } | |
| 32 | - | |
| 33 | - default List<RewardActivityDO> selectListBySpuIdAndStatusAndNow(Collection<Long> spuIds, | |
| 34 | - Collection<Long> categoryIds, | |
| 35 | - Integer status) { | |
| 36 | - LocalDateTime now = LocalDateTime.now(); | |
| 37 | - Function<Collection<Long>, String> productScopeValuesFindInSetFunc = ids -> ids.stream() | |
| 38 | - .map(id -> StrUtil.format("FIND_IN_SET({}, product_scope_values) ", id)) | |
| 39 | - .collect(Collectors.joining(" OR ")); | |
| 40 | - return selectList(new LambdaQueryWrapperX<RewardActivityDO>() | |
| 41 | - .eq(RewardActivityDO::getStatus, status) | |
| 42 | - .lt(RewardActivityDO::getStartTime, now) | |
| 43 | - .gt(RewardActivityDO::getEndTime, now) | |
| 44 | - .and(i -> i.eq(RewardActivityDO::getProductScope, PromotionProductScopeEnum.SPU.getScope()) | |
| 45 | - .and(i1 -> i1.apply(productScopeValuesFindInSetFunc.apply(spuIds))) | |
| 46 | - .or(i1 -> i1.eq(RewardActivityDO::getProductScope, PromotionProductScopeEnum.ALL.getScope())) | |
| 47 | - .or(i1 -> i1.eq(RewardActivityDO::getProductScope, PromotionProductScopeEnum.CATEGORY.getScope()) | |
| 48 | - .and(i2 -> i2.apply(productScopeValuesFindInSetFunc.apply(categoryIds))))) | |
| 49 | - .orderByDesc(RewardActivityDO::getId) | |
| 50 | - ); | |
| 51 | - } | |
| 52 | - | |
| 53 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.seckill.seckillactivity; | |
| 2 | - | |
| 3 | -import cn.hutool.core.lang.Assert; | |
| 4 | -import cn.hutool.core.util.ObjectUtil; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityPageReqVO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppSeckillActivityPageReqVO; | |
| 10 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillActivityDO; | |
| 11 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 12 | -import org.apache.ibatis.annotations.Mapper; | |
| 13 | - | |
| 14 | -import java.time.LocalDateTime; | |
| 15 | -import java.util.List; | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * 秒杀活动 Mapper | |
| 19 | - * | |
| 20 | - * @author halfninety | |
| 21 | - */ | |
| 22 | -@Mapper | |
| 23 | -public interface SeckillActivityMapper extends BaseMapperX<SeckillActivityDO> { | |
| 24 | - | |
| 25 | - default PageResult<SeckillActivityDO> selectPage(SeckillActivityPageReqVO reqVO) { | |
| 26 | - return selectPage(reqVO, new LambdaQueryWrapperX<SeckillActivityDO>() | |
| 27 | - .likeIfPresent(SeckillActivityDO::getName, reqVO.getName()) | |
| 28 | - .eqIfPresent(SeckillActivityDO::getStatus, reqVO.getStatus()) | |
| 29 | - .betweenIfPresent(SeckillActivityDO::getCreateTime, reqVO.getCreateTime()) | |
| 30 | - .apply(ObjectUtil.isNotNull(reqVO.getConfigId()), "FIND_IN_SET(" + reqVO.getConfigId() + ", config_ids) > 0") | |
| 31 | - .orderByDesc(SeckillActivityDO::getId)); | |
| 32 | - } | |
| 33 | - | |
| 34 | - default List<SeckillActivityDO> selectListBySpuIdAndStatus(Long spuId, Integer status) { | |
| 35 | - return selectList(SeckillActivityDO::getSpuId, spuId, | |
| 36 | - SeckillActivityDO::getStatus, status); | |
| 37 | - } | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 更新活动库存(减少) | |
| 41 | - * | |
| 42 | - * @param id 活动编号 | |
| 43 | - * @param count 扣减的库存数量(正数) | |
| 44 | - * @return 影响的行数 | |
| 45 | - */ | |
| 46 | - default int updateStockDecr(Long id, int count) { | |
| 47 | - Assert.isTrue(count > 0); | |
| 48 | - return update(null, new LambdaUpdateWrapper<SeckillActivityDO>() | |
| 49 | - .eq(SeckillActivityDO::getId, id) | |
| 50 | - .ge(SeckillActivityDO::getStock, count) | |
| 51 | - .setSql("stock = stock - " + count)); | |
| 52 | - } | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * 更新活动库存(增加) | |
| 56 | - * | |
| 57 | - * @param id 活动编号 | |
| 58 | - * @param count 增加的库存数量(正数) | |
| 59 | - * @return 影响的行数 | |
| 60 | - */ | |
| 61 | - default int updateStockIncr(Long id, int count) { | |
| 62 | - Assert.isTrue(count > 0); | |
| 63 | - return update(null, new LambdaUpdateWrapper<SeckillActivityDO>() | |
| 64 | - .eq(SeckillActivityDO::getId, id) | |
| 65 | - .setSql("stock = stock + " + count)); | |
| 66 | - } | |
| 67 | - | |
| 68 | - default PageResult<SeckillActivityDO> selectPage(AppSeckillActivityPageReqVO pageReqVO, Integer status, LocalDateTime dateTime) { | |
| 69 | - return selectPage(pageReqVO, new LambdaQueryWrapperX<SeckillActivityDO>() | |
| 70 | - .eqIfPresent(SeckillActivityDO::getStatus, status) | |
| 71 | - .lt(SeckillActivityDO::getStartTime, dateTime) | |
| 72 | - .gt(SeckillActivityDO::getEndTime, dateTime)// 开始时间 < 指定时间 < 结束时间,也就是说获取指定时间段的活动 | |
| 73 | - .apply(ObjectUtil.isNotNull(pageReqVO.getConfigId()), "FIND_IN_SET(" + pageReqVO.getConfigId() + ",config_ids) > 0")); | |
| 74 | - } | |
| 75 | - | |
| 76 | - default SeckillActivityDO selectBySpuIdAndStatusAndNow(Long spuId, Integer status) { | |
| 77 | - LocalDateTime now = LocalDateTime.now(); | |
| 78 | - return selectOne(new LambdaQueryWrapperX<SeckillActivityDO>() | |
| 79 | - .eq(SeckillActivityDO::getSpuId, spuId) | |
| 80 | - .eq(SeckillActivityDO::getStatus, status) | |
| 81 | - .lt(SeckillActivityDO::getStartTime, now) | |
| 82 | - .gt(SeckillActivityDO::getEndTime, now)); // 开始时间 < now < 结束时间,也就是说获取指定时间段的活动 | |
| 83 | - } | |
| 84 | - | |
| 85 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillProductMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.seckill.seckillactivity; | |
| 2 | - | |
| 3 | -import cn.hutool.core.lang.Assert; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillProductDO; | |
| 6 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 7 | -import org.apache.ibatis.annotations.Mapper; | |
| 8 | - | |
| 9 | -import java.util.Collection; | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 秒杀活动商品 Mapper | |
| 14 | - * | |
| 15 | - * @author halfninety | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface SeckillProductMapper extends BaseMapperX<SeckillProductDO> { | |
| 19 | - | |
| 20 | - default List<SeckillProductDO> selectListByActivityId(Long activityId) { | |
| 21 | - return selectList(SeckillProductDO::getActivityId, activityId); | |
| 22 | - } | |
| 23 | - | |
| 24 | - default SeckillProductDO selectByActivityIdAndSkuId(Long activityId, Long skuId) { | |
| 25 | - return selectOne(SeckillProductDO::getActivityId, activityId, | |
| 26 | - SeckillProductDO::getSkuId, skuId); | |
| 27 | - } | |
| 28 | - | |
| 29 | - default List<SeckillProductDO> selectListByActivityId(Collection<Long> ids) { | |
| 30 | - return selectList(SeckillProductDO::getActivityId, ids); | |
| 31 | - } | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * 更新活动库存(减少) | |
| 35 | - * | |
| 36 | - * @param id 活动编号 | |
| 37 | - * @param count 扣减的库存数量(减少库存) | |
| 38 | - * @return 影响的行数 | |
| 39 | - */ | |
| 40 | - default int updateStockDecr(Long id, int count) { | |
| 41 | - Assert.isTrue(count > 0); | |
| 42 | - return update(null, new LambdaUpdateWrapper<SeckillProductDO>() | |
| 43 | - .eq(SeckillProductDO::getId, id) | |
| 44 | - .ge(SeckillProductDO::getStock, count) | |
| 45 | - .setSql("stock = stock - " + count)); | |
| 46 | - } | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * 更新活动库存(增加) | |
| 50 | - * | |
| 51 | - * @param id 活动编号 | |
| 52 | - * @param count 需要增加的库存(增加库存) | |
| 53 | - * @return 影响的行数 | |
| 54 | - */ | |
| 55 | - default int updateStockIncr(Long id, int count) { | |
| 56 | - Assert.isTrue(count > 0); | |
| 57 | - return update(null, new LambdaUpdateWrapper<SeckillProductDO>() | |
| 58 | - .eq(SeckillProductDO::getId, id) | |
| 59 | - .setSql("stock = stock + " + count)); | |
| 60 | - } | |
| 61 | - | |
| 62 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillconfig/SeckillConfigMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.seckill.seckillconfig; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillConfigDO; | |
| 8 | -import org.apache.ibatis.annotations.Mapper; | |
| 9 | - | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -@Mapper | |
| 13 | -public interface SeckillConfigMapper extends BaseMapperX<SeckillConfigDO> { | |
| 14 | - | |
| 15 | - default PageResult<SeckillConfigDO> selectPage(SeckillConfigPageReqVO reqVO) { | |
| 16 | - return selectPage(reqVO, new LambdaQueryWrapperX<SeckillConfigDO>() | |
| 17 | - .likeIfPresent(SeckillConfigDO::getName, reqVO.getName()) | |
| 18 | - .eqIfPresent(SeckillConfigDO::getStatus, reqVO.getStatus()) | |
| 19 | - .orderByAsc(SeckillConfigDO::getStartTime)); | |
| 20 | - } | |
| 21 | - | |
| 22 | - default List<SeckillConfigDO> selectListByStatus(Integer status) { | |
| 23 | - return selectList(SeckillConfigDO::getStatus, status); | |
| 24 | - } | |
| 25 | - | |
| 26 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/framework/web/config/PromotionWebConfiguration.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.framework.web.config; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration; | |
| 4 | -import org.springdoc.core.models.GroupedOpenApi; | |
| 5 | -import org.springframework.context.annotation.Bean; | |
| 6 | -import org.springframework.context.annotation.Configuration; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * promotion 模块的 web 组件的 Configuration | |
| 10 | - * | |
| 11 | - * @author 芋道源码 | |
| 12 | - */ | |
| 13 | -@Configuration(proxyBeanMethods = false) | |
| 14 | -public class PromotionWebConfiguration { | |
| 15 | - | |
| 16 | - /** | |
| 17 | - * promotion 模块的 API 分组 | |
| 18 | - */ | |
| 19 | - @Bean | |
| 20 | - public GroupedOpenApi promotionGroupedOpenApi() { | |
| 21 | - return YudaoSwaggerAutoConfiguration.buildGroupedOpenApi("promotion"); | |
| 22 | - } | |
| 23 | - | |
| 24 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/framework/web/package-info.java deleted
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/job/combination/CombinationRecordExpireJob.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.job.combination; | |
| 2 | - | |
| 3 | -import cn.hutool.core.util.StrUtil; | |
| 4 | -import cn.iocoder.yudao.framework.common.core.KeyValue; | |
| 5 | -import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; | |
| 6 | -import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; | |
| 7 | -import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordService; | |
| 8 | -import org.springframework.stereotype.Component; | |
| 9 | - | |
| 10 | -import jakarta.annotation.Resource; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 拼团过期 Job | |
| 14 | - * | |
| 15 | - * @author HUIHUI | |
| 16 | - */ | |
| 17 | -@Component | |
| 18 | -public class CombinationRecordExpireJob implements JobHandler { | |
| 19 | - | |
| 20 | - @Resource | |
| 21 | - private CombinationRecordService combinationRecordService; | |
| 22 | - | |
| 23 | - @Override | |
| 24 | - @TenantJob | |
| 25 | - public String execute(String param) { | |
| 26 | - KeyValue<Integer, Integer> keyValue = combinationRecordService.expireCombinationRecord(); | |
| 27 | - return StrUtil.format("过期拼团 {} 个, 虚拟成团 {} 个", keyValue.getKey(), keyValue.getValue()); | |
| 28 | - } | |
| 29 | - | |
| 30 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/job/coupon/CouponExpireJob.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.job.coupon; | |
| 2 | - | |
| 3 | -import cn.hutool.core.util.StrUtil; | |
| 4 | -import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; | |
| 5 | -import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; | |
| 6 | -import cn.iocoder.yudao.module.promotion.service.coupon.CouponService; | |
| 7 | -import org.springframework.stereotype.Component; | |
| 8 | - | |
| 9 | -import jakarta.annotation.Resource; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 优惠券过期 Job | |
| 13 | - * | |
| 14 | - * @author owen | |
| 15 | - */ | |
| 16 | -@Component | |
| 17 | -public class CouponExpireJob implements JobHandler { | |
| 18 | - | |
| 19 | - @Resource | |
| 20 | - private CouponService couponService; | |
| 21 | - | |
| 22 | - @Override | |
| 23 | - @TenantJob | |
| 24 | - public String execute(String param) { | |
| 25 | - int count = couponService.expireCoupon(); | |
| 26 | - return StrUtil.format("过期优惠券 {} 个", count); | |
| 27 | - } | |
| 28 | - | |
| 29 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/job/package-info.java deleted
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/mq/consumer/coupon/CouponTakeByRegisterConsumer.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.mq.consumer.coupon; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.member.api.message.user.MemberUserCreateMessage; | |
| 4 | -import cn.iocoder.yudao.module.promotion.service.coupon.CouponService; | |
| 5 | -import lombok.extern.slf4j.Slf4j; | |
| 6 | -import org.springframework.context.event.EventListener; | |
| 7 | -import org.springframework.scheduling.annotation.Async; | |
| 8 | -import org.springframework.stereotype.Component; | |
| 9 | - | |
| 10 | -import jakarta.annotation.Resource; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 用户注册时,发送优惠劵的消费者,基 {@link MemberUserCreateMessage} 消息 | |
| 14 | - * | |
| 15 | - * @author owen | |
| 16 | - */ | |
| 17 | -@Component | |
| 18 | -@Slf4j | |
| 19 | -public class CouponTakeByRegisterConsumer { | |
| 20 | - | |
| 21 | - @Resource | |
| 22 | - private CouponService couponService; | |
| 23 | - | |
| 24 | - @EventListener | |
| 25 | - @Async // Spring Event 默认在 Producer 发送的线程,通过 @Async 实现异步 | |
| 26 | - public void onMessage(MemberUserCreateMessage message) { | |
| 27 | - log.info("[onMessage][消息内容({})]", message); | |
| 28 | - couponService.takeCouponByRegister(message.getUserId()); | |
| 29 | - } | |
| 30 | - | |
| 31 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/mq/consumer/package-info.java deleted
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/mq/message/package-info.java deleted
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/mq/producer/package-info.java deleted
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/package-info.java deleted
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.article; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; | |
| 8 | - | |
| 9 | -import jakarta.validation.Valid; | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 文章分类 Service 接口 | |
| 14 | - * | |
| 15 | - * @author HUIHUI | |
| 16 | - */ | |
| 17 | -public interface ArticleCategoryService { | |
| 18 | - | |
| 19 | - /** | |
| 20 | - * 创建文章分类 | |
| 21 | - * | |
| 22 | - * @param createReqVO 创建信息 | |
| 23 | - * @return 编号 | |
| 24 | - */ | |
| 25 | - Long createArticleCategory(@Valid ArticleCategoryCreateReqVO createReqVO); | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 更新文章分类 | |
| 29 | - * | |
| 30 | - * @param updateReqVO 更新信息 | |
| 31 | - */ | |
| 32 | - void updateArticleCategory(@Valid ArticleCategoryUpdateReqVO updateReqVO); | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * 删除文章分类 | |
| 36 | - * | |
| 37 | - * @param id 编号 | |
| 38 | - */ | |
| 39 | - void deleteArticleCategory(Long id); | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * 获得文章分类 | |
| 43 | - * | |
| 44 | - * @param id 编号 | |
| 45 | - * @return 文章分类 | |
| 46 | - */ | |
| 47 | - ArticleCategoryDO getArticleCategory(Long id); | |
| 48 | - | |
| 49 | - /** | |
| 50 | - * 获得文章分类分页 | |
| 51 | - * | |
| 52 | - * @param pageReqVO 分页查询 | |
| 53 | - * @return 文章分类分页 | |
| 54 | - */ | |
| 55 | - PageResult<ArticleCategoryDO> getArticleCategoryPage(ArticleCategoryPageReqVO pageReqVO); | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * 获得指定状态的文章分类列表 | |
| 59 | - * | |
| 60 | - * @param status 状态 | |
| 61 | - * @return 文章分类列表 | |
| 62 | - */ | |
| 63 | - List<ArticleCategoryDO> getArticleCategoryListByStatus(Integer status); | |
| 64 | - | |
| 65 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.article; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.convert.article.ArticleCategoryConvert; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleCategoryMapper; | |
| 10 | -import org.springframework.context.annotation.Lazy; | |
| 11 | -import org.springframework.stereotype.Service; | |
| 12 | -import org.springframework.validation.annotation.Validated; | |
| 13 | - | |
| 14 | -import jakarta.annotation.Resource; | |
| 15 | -import java.util.List; | |
| 16 | - | |
| 17 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 18 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_CATEGORY_DELETE_FAIL_HAVE_ARTICLES; | |
| 19 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_CATEGORY_NOT_EXISTS; | |
| 20 | - | |
| 21 | -/** | |
| 22 | - * 文章分类 Service 实现类 | |
| 23 | - * | |
| 24 | - * @author HUIHUI | |
| 25 | - */ | |
| 26 | -@Service | |
| 27 | -@Validated | |
| 28 | -public class ArticleCategoryServiceImpl implements ArticleCategoryService { | |
| 29 | - | |
| 30 | - @Resource | |
| 31 | - private ArticleCategoryMapper articleCategoryMapper; | |
| 32 | - | |
| 33 | - @Resource | |
| 34 | - @Lazy // 延迟加载,解决循环依赖问题 | |
| 35 | - private ArticleService articleService; | |
| 36 | - | |
| 37 | - @Override | |
| 38 | - public Long createArticleCategory(ArticleCategoryCreateReqVO createReqVO) { | |
| 39 | - // 插入 | |
| 40 | - ArticleCategoryDO category = ArticleCategoryConvert.INSTANCE.convert(createReqVO); | |
| 41 | - articleCategoryMapper.insert(category); | |
| 42 | - // 返回 | |
| 43 | - return category.getId(); | |
| 44 | - } | |
| 45 | - | |
| 46 | - @Override | |
| 47 | - public void updateArticleCategory(ArticleCategoryUpdateReqVO updateReqVO) { | |
| 48 | - // 校验存在 | |
| 49 | - validateArticleCategoryExists(updateReqVO.getId()); | |
| 50 | - // 更新 | |
| 51 | - ArticleCategoryDO updateObj = ArticleCategoryConvert.INSTANCE.convert(updateReqVO); | |
| 52 | - articleCategoryMapper.updateById(updateObj); | |
| 53 | - } | |
| 54 | - | |
| 55 | - @Override | |
| 56 | - public void deleteArticleCategory(Long id) { | |
| 57 | - // 校验存在 | |
| 58 | - validateArticleCategoryExists(id); | |
| 59 | - // 校验是不是存在关联文章 | |
| 60 | - Long count = articleService.getArticleCountByCategoryId(id); | |
| 61 | - if (count > 0) { | |
| 62 | - throw exception(ARTICLE_CATEGORY_DELETE_FAIL_HAVE_ARTICLES); | |
| 63 | - } | |
| 64 | - | |
| 65 | - // 删除 | |
| 66 | - articleCategoryMapper.deleteById(id); | |
| 67 | - } | |
| 68 | - | |
| 69 | - private void validateArticleCategoryExists(Long id) { | |
| 70 | - if (articleCategoryMapper.selectById(id) == null) { | |
| 71 | - throw exception(ARTICLE_CATEGORY_NOT_EXISTS); | |
| 72 | - } | |
| 73 | - } | |
| 74 | - | |
| 75 | - @Override | |
| 76 | - public ArticleCategoryDO getArticleCategory(Long id) { | |
| 77 | - return articleCategoryMapper.selectById(id); | |
| 78 | - } | |
| 79 | - | |
| 80 | - @Override | |
| 81 | - public PageResult<ArticleCategoryDO> getArticleCategoryPage(ArticleCategoryPageReqVO pageReqVO) { | |
| 82 | - return articleCategoryMapper.selectPage(pageReqVO); | |
| 83 | - } | |
| 84 | - | |
| 85 | - @Override | |
| 86 | - public List<ArticleCategoryDO> getArticleCategoryListByStatus(Integer status) { | |
| 87 | - return articleCategoryMapper.selectListByStatus(status); | |
| 88 | - } | |
| 89 | - | |
| 90 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.article; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; | |
| 9 | - | |
| 10 | -import jakarta.validation.Valid; | |
| 11 | -import java.util.List; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 文章 Service 接口 | |
| 15 | - * | |
| 16 | - * @author HUIHUI | |
| 17 | - */ | |
| 18 | -public interface ArticleService { | |
| 19 | - | |
| 20 | - /** | |
| 21 | - * 创建文章 | |
| 22 | - * | |
| 23 | - * @param createReqVO 创建信息 | |
| 24 | - * @return 编号 | |
| 25 | - */ | |
| 26 | - Long createArticle(@Valid ArticleCreateReqVO createReqVO); | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * 更新文章 | |
| 30 | - * | |
| 31 | - * @param updateReqVO 更新信息 | |
| 32 | - */ | |
| 33 | - void updateArticle(@Valid ArticleUpdateReqVO updateReqVO); | |
| 34 | - | |
| 35 | - /** | |
| 36 | - * 删除文章 | |
| 37 | - * | |
| 38 | - * @param id 编号 | |
| 39 | - */ | |
| 40 | - void deleteArticle(Long id); | |
| 41 | - | |
| 42 | - /** | |
| 43 | - * 获得文章 | |
| 44 | - * | |
| 45 | - * @param id 编号 | |
| 46 | - * @return 文章 | |
| 47 | - */ | |
| 48 | - ArticleDO getArticle(Long id); | |
| 49 | - | |
| 50 | - /** | |
| 51 | - * 基于标题,获得文章 | |
| 52 | - * | |
| 53 | - * 如果有重名的文章,获取最后发布的 | |
| 54 | - * | |
| 55 | - * @param title 标题 | |
| 56 | - * @return 文章 | |
| 57 | - */ | |
| 58 | - ArticleDO getLastArticleByTitle(String title); | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * 获得文章分页 | |
| 62 | - * | |
| 63 | - * @param pageReqVO 分页查询 | |
| 64 | - * @return 文章分页 | |
| 65 | - */ | |
| 66 | - PageResult<ArticleDO> getArticlePage(ArticlePageReqVO pageReqVO); | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * 获得文章列表 | |
| 70 | - * | |
| 71 | - * @param recommendHot 是否热门 | |
| 72 | - * @param recommendBanner 是否轮播图 | |
| 73 | - * @return 文章列表 | |
| 74 | - */ | |
| 75 | - List<ArticleDO> getArticleCategoryListByRecommend(Boolean recommendHot, Boolean recommendBanner); | |
| 76 | - | |
| 77 | - /** | |
| 78 | - * 获得文章分页 | |
| 79 | - * | |
| 80 | - * @param pageReqVO 分页查询 | |
| 81 | - * @return 文章分页 | |
| 82 | - */ | |
| 83 | - PageResult<ArticleDO> getArticlePage(AppArticlePageReqVO pageReqVO); | |
| 84 | - | |
| 85 | - /** | |
| 86 | - * 获得指定分类的文章数量 | |
| 87 | - * | |
| 88 | - * @param categoryId 文章分类编号 | |
| 89 | - * @return 文章数量 | |
| 90 | - */ | |
| 91 | - Long getArticleCountByCategoryId(Long categoryId); | |
| 92 | - | |
| 93 | - /** | |
| 94 | - * 增加文章浏览量 | |
| 95 | - * | |
| 96 | - * @param id 文章编号 | |
| 97 | - */ | |
| 98 | - void addArticleBrowseCount(Long id); | |
| 99 | - | |
| 100 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.article; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert; | |
| 10 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; | |
| 11 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; | |
| 12 | -import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper; | |
| 13 | -import org.springframework.stereotype.Service; | |
| 14 | -import org.springframework.validation.annotation.Validated; | |
| 15 | - | |
| 16 | -import jakarta.annotation.Resource; | |
| 17 | -import java.util.List; | |
| 18 | - | |
| 19 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 20 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_CATEGORY_NOT_EXISTS; | |
| 21 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_NOT_EXISTS; | |
| 22 | - | |
| 23 | -/** | |
| 24 | - * 文章管理 Service 实现类 | |
| 25 | - * | |
| 26 | - * @author HUIHUI | |
| 27 | - */ | |
| 28 | -@Service | |
| 29 | -@Validated | |
| 30 | -public class ArticleServiceImpl implements ArticleService { | |
| 31 | - | |
| 32 | - @Resource | |
| 33 | - private ArticleMapper articleMapper; | |
| 34 | - | |
| 35 | - @Resource | |
| 36 | - private ArticleCategoryService articleCategoryService; | |
| 37 | - | |
| 38 | - @Override | |
| 39 | - public Long createArticle(ArticleCreateReqVO createReqVO) { | |
| 40 | - // 校验分类存在 | |
| 41 | - validateArticleCategoryExists(createReqVO.getCategoryId()); | |
| 42 | - | |
| 43 | - // 插入 | |
| 44 | - ArticleDO article = ArticleConvert.INSTANCE.convert(createReqVO); | |
| 45 | - article.setBrowseCount(0); // 初始浏览量 | |
| 46 | - articleMapper.insert(article); | |
| 47 | - // 返回 | |
| 48 | - return article.getId(); | |
| 49 | - } | |
| 50 | - | |
| 51 | - @Override | |
| 52 | - public void updateArticle(ArticleUpdateReqVO updateReqVO) { | |
| 53 | - // 校验存在 | |
| 54 | - validateArticleExists(updateReqVO.getId()); | |
| 55 | - // 校验分类存在 | |
| 56 | - validateArticleCategoryExists(updateReqVO.getCategoryId()); | |
| 57 | - | |
| 58 | - // 更新 | |
| 59 | - ArticleDO updateObj = ArticleConvert.INSTANCE.convert(updateReqVO); | |
| 60 | - articleMapper.updateById(updateObj); | |
| 61 | - } | |
| 62 | - | |
| 63 | - @Override | |
| 64 | - public void deleteArticle(Long id) { | |
| 65 | - // 校验存在 | |
| 66 | - validateArticleExists(id); | |
| 67 | - // 删除 | |
| 68 | - articleMapper.deleteById(id); | |
| 69 | - } | |
| 70 | - | |
| 71 | - private void validateArticleExists(Long id) { | |
| 72 | - if (articleMapper.selectById(id) == null) { | |
| 73 | - throw exception(ARTICLE_NOT_EXISTS); | |
| 74 | - } | |
| 75 | - } | |
| 76 | - | |
| 77 | - private void validateArticleCategoryExists(Long categoryId) { | |
| 78 | - ArticleCategoryDO articleCategory = articleCategoryService.getArticleCategory(categoryId); | |
| 79 | - if (articleCategory == null) { | |
| 80 | - throw exception(ARTICLE_CATEGORY_NOT_EXISTS); | |
| 81 | - } | |
| 82 | - } | |
| 83 | - | |
| 84 | - @Override | |
| 85 | - public ArticleDO getArticle(Long id) { | |
| 86 | - return articleMapper.selectById(id); | |
| 87 | - } | |
| 88 | - | |
| 89 | - @Override | |
| 90 | - public ArticleDO getLastArticleByTitle(String title) { | |
| 91 | - List<ArticleDO> articles = articleMapper.selectListByTitle(title); | |
| 92 | - return CollUtil.getLast(articles); | |
| 93 | - } | |
| 94 | - | |
| 95 | - @Override | |
| 96 | - public PageResult<ArticleDO> getArticlePage(ArticlePageReqVO pageReqVO) { | |
| 97 | - return articleMapper.selectPage(pageReqVO); | |
| 98 | - } | |
| 99 | - | |
| 100 | - @Override | |
| 101 | - public List<ArticleDO> getArticleCategoryListByRecommend(Boolean recommendHot, Boolean recommendBanner) { | |
| 102 | - return articleMapper.selectList(recommendHot, recommendBanner); | |
| 103 | - } | |
| 104 | - | |
| 105 | - @Override | |
| 106 | - public PageResult<ArticleDO> getArticlePage(AppArticlePageReqVO pageReqVO) { | |
| 107 | - return articleMapper.selectPage(pageReqVO); | |
| 108 | - } | |
| 109 | - | |
| 110 | - @Override | |
| 111 | - public Long getArticleCountByCategoryId(Long categoryId) { | |
| 112 | - return articleMapper.selectCount(ArticleDO::getCategoryId, categoryId); | |
| 113 | - } | |
| 114 | - | |
| 115 | - @Override | |
| 116 | - public void addArticleBrowseCount(Long id) { | |
| 117 | - // 校验文章是否存在 | |
| 118 | - validateArticleExists(id); | |
| 119 | - // 增加浏览次数 | |
| 120 | - articleMapper.updateBrowseCount(id); | |
| 121 | - } | |
| 122 | - | |
| 123 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/banner/BannerService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.banner; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerPageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.banner.BannerDO; | |
| 8 | - | |
| 9 | -import jakarta.validation.Valid; | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 首页 Banner Service 接口 | |
| 14 | - * | |
| 15 | - * @author xia | |
| 16 | - */ | |
| 17 | -public interface BannerService { | |
| 18 | - | |
| 19 | - /** | |
| 20 | - * 创建 Banner | |
| 21 | - * | |
| 22 | - * @param createReqVO 创建信息 | |
| 23 | - * @return 编号 | |
| 24 | - */ | |
| 25 | - Long createBanner(@Valid BannerCreateReqVO createReqVO); | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 更新 Banner | |
| 29 | - * | |
| 30 | - * @param updateReqVO 更新信息 | |
| 31 | - */ | |
| 32 | - void updateBanner(@Valid BannerUpdateReqVO updateReqVO); | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * 删除 Banner | |
| 36 | - * | |
| 37 | - * @param id 编号 | |
| 38 | - */ | |
| 39 | - void deleteBanner(Long id); | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * 获得 Banner | |
| 43 | - * | |
| 44 | - * @param id 编号 | |
| 45 | - * @return Banner | |
| 46 | - */ | |
| 47 | - BannerDO getBanner(Long id); | |
| 48 | - | |
| 49 | - /** | |
| 50 | - * 获得 Banner 分页 | |
| 51 | - * | |
| 52 | - * @param pageReqVO 分页查询 | |
| 53 | - * @return Banner分页 | |
| 54 | - */ | |
| 55 | - PageResult<BannerDO> getBannerPage(BannerPageReqVO pageReqVO); | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * 增加 Banner 点击量 | |
| 59 | - * | |
| 60 | - * @param id Banner编号 | |
| 61 | - */ | |
| 62 | - void addBannerBrowseCount(Long id); | |
| 63 | - | |
| 64 | - /** | |
| 65 | - * 获得 Banner 列表 | |
| 66 | - * | |
| 67 | - * @param position 定位 | |
| 68 | - * @return Banner 列表 | |
| 69 | - */ | |
| 70 | - List<BannerDO> getBannerListByPosition(Integer position); | |
| 71 | - | |
| 72 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/banner/BannerServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.banner; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerPageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.convert.banner.BannerConvert; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.banner.BannerDO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.dal.mysql.banner.BannerMapper; | |
| 10 | -import org.springframework.stereotype.Service; | |
| 11 | -import org.springframework.validation.annotation.Validated; | |
| 12 | - | |
| 13 | -import jakarta.annotation.Resource; | |
| 14 | -import java.util.List; | |
| 15 | - | |
| 16 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 17 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.BANNER_NOT_EXISTS; | |
| 18 | - | |
| 19 | -/** | |
| 20 | - * 首页 banner 实现类 | |
| 21 | - * | |
| 22 | - * @author xia | |
| 23 | - */ | |
| 24 | -@Service | |
| 25 | -@Validated | |
| 26 | -public class BannerServiceImpl implements BannerService { | |
| 27 | - | |
| 28 | - @Resource | |
| 29 | - private BannerMapper bannerMapper; | |
| 30 | - | |
| 31 | - @Override | |
| 32 | - public Long createBanner(BannerCreateReqVO createReqVO) { | |
| 33 | - // 插入 | |
| 34 | - BannerDO banner = BannerConvert.INSTANCE.convert(createReqVO); | |
| 35 | - bannerMapper.insert(banner); | |
| 36 | - // 返回 | |
| 37 | - return banner.getId(); | |
| 38 | - } | |
| 39 | - | |
| 40 | - @Override | |
| 41 | - public void updateBanner(BannerUpdateReqVO updateReqVO) { | |
| 42 | - // 校验存在 | |
| 43 | - this.validateBannerExists(updateReqVO.getId()); | |
| 44 | - // 更新 | |
| 45 | - BannerDO updateObj = BannerConvert.INSTANCE.convert(updateReqVO); | |
| 46 | - bannerMapper.updateById(updateObj); | |
| 47 | - } | |
| 48 | - | |
| 49 | - @Override | |
| 50 | - public void deleteBanner(Long id) { | |
| 51 | - // 校验存在 | |
| 52 | - this.validateBannerExists(id); | |
| 53 | - // 删除 | |
| 54 | - bannerMapper.deleteById(id); | |
| 55 | - } | |
| 56 | - | |
| 57 | - private void validateBannerExists(Long id) { | |
| 58 | - if (bannerMapper.selectById(id) == null) { | |
| 59 | - throw exception(BANNER_NOT_EXISTS); | |
| 60 | - } | |
| 61 | - } | |
| 62 | - | |
| 63 | - @Override | |
| 64 | - public BannerDO getBanner(Long id) { | |
| 65 | - return bannerMapper.selectById(id); | |
| 66 | - } | |
| 67 | - | |
| 68 | - @Override | |
| 69 | - public PageResult<BannerDO> getBannerPage(BannerPageReqVO pageReqVO) { | |
| 70 | - return bannerMapper.selectPage(pageReqVO); | |
| 71 | - } | |
| 72 | - | |
| 73 | - @Override | |
| 74 | - public void addBannerBrowseCount(Long id) { | |
| 75 | - // 校验 Banner 是否存在 | |
| 76 | - validateBannerExists(id); | |
| 77 | - // 增加点击次数 | |
| 78 | - bannerMapper.updateBrowseCount(id); | |
| 79 | - } | |
| 80 | - | |
| 81 | - @Override | |
| 82 | - public List<BannerDO> getBannerListByPosition(Integer position) { | |
| 83 | - return bannerMapper.selectBannerListByPosition(position); | |
| 84 | - } | |
| 85 | - | |
| 86 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.bargain; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity.BargainActivityCreateReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity.BargainActivityPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity.BargainActivityUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityDO; | |
| 9 | -import jakarta.validation.Valid; | |
| 10 | - | |
| 11 | -import java.util.List; | |
| 12 | -import java.util.Set; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 砍价活动 Service 接口 | |
| 16 | - * | |
| 17 | - * @author HUIHUI | |
| 18 | - */ | |
| 19 | -public interface BargainActivityService { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 创建砍价活动 | |
| 23 | - * | |
| 24 | - * @param createReqVO 创建信息 | |
| 25 | - * @return 编号 | |
| 26 | - */ | |
| 27 | - Long createBargainActivity(@Valid BargainActivityCreateReqVO createReqVO); | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 更新砍价活动 | |
| 31 | - * | |
| 32 | - * @param updateReqVO 更新信息 | |
| 33 | - */ | |
| 34 | - void updateBargainActivity(@Valid BargainActivityUpdateReqVO updateReqVO); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 更新砍价活动库存 | |
| 38 | - * | |
| 39 | - * 如果更新失败(库存不足),则抛出业务异常 | |
| 40 | - * | |
| 41 | - * @param id 砍价活动编号 | |
| 42 | - * @param count 购买数量 | |
| 43 | - */ | |
| 44 | - void updateBargainActivityStock(Long id, Integer count); | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 关闭砍价活动 | |
| 48 | - * | |
| 49 | - * @param id 砍价活动编号 | |
| 50 | - */ | |
| 51 | - void closeBargainActivityById(Long id); | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * 删除砍价活动 | |
| 55 | - * | |
| 56 | - * @param id 编号 | |
| 57 | - */ | |
| 58 | - void deleteBargainActivity(Long id); | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * 获得砍价活动 | |
| 62 | - * | |
| 63 | - * @param id 编号 | |
| 64 | - * @return 砍价活动 | |
| 65 | - */ | |
| 66 | - BargainActivityDO getBargainActivity(Long id); | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * 获得砍价活动列表 | |
| 70 | - * | |
| 71 | - * @param ids 编号数组 | |
| 72 | - * @return 砍价活动列表 | |
| 73 | - */ | |
| 74 | - List<BargainActivityDO> getBargainActivityList(Set<Long> ids); | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * 校验砍价活动,是否可以参与(发起砍价、下单、帮好友砍价) | |
| 78 | - * | |
| 79 | - * @param id 编号 | |
| 80 | - * @return 砍价活动 | |
| 81 | - */ | |
| 82 | - BargainActivityDO validateBargainActivityCanJoin(Long id); | |
| 83 | - | |
| 84 | - /** | |
| 85 | - * 获得砍价活动分页 | |
| 86 | - * | |
| 87 | - * @param pageReqVO 分页查询 | |
| 88 | - * @return 砍价活动分页 | |
| 89 | - */ | |
| 90 | - PageResult<BargainActivityDO> getBargainActivityPage(BargainActivityPageReqVO pageReqVO); | |
| 91 | - | |
| 92 | - /** | |
| 93 | - * 获取正在进行的活动分页数据 | |
| 94 | - * | |
| 95 | - * @param pageReqVO 分页请求 | |
| 96 | - * @return 砍价活动分页 | |
| 97 | - */ | |
| 98 | - PageResult<BargainActivityDO> getBargainActivityPage(PageParam pageReqVO); | |
| 99 | - | |
| 100 | - /** | |
| 101 | - * 获取正在进行的活动分页数据 | |
| 102 | - * | |
| 103 | - * @param count 需要的数量 | |
| 104 | - * @return 砍价活动分页 | |
| 105 | - */ | |
| 106 | - List<BargainActivityDO> getBargainActivityListByCount(Integer count); | |
| 107 | - | |
| 108 | - /** | |
| 109 | - * 获得 SPU 进行中的砍价活动 | |
| 110 | - * | |
| 111 | - * @param spuId SPU 编号数组 | |
| 112 | - * @return 砍价活动 | |
| 113 | - */ | |
| 114 | - BargainActivityDO getMatchBargainActivityBySpuId(Long spuId); | |
| 115 | - | |
| 116 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainHelpService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.bargain; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.help.BargainHelpPageReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBargainHelpCreateReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainHelpDO; | |
| 7 | - | |
| 8 | -import java.util.Collection; | |
| 9 | -import java.util.List; | |
| 10 | -import java.util.Map; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 砍价助力 Service 接口 | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -public interface BargainHelpService { | |
| 18 | - | |
| 19 | - /** | |
| 20 | - * 创建砍价助力(帮人砍价) | |
| 21 | - * | |
| 22 | - * @param userId 用户编号 | |
| 23 | - * @param reqVO 请求信息 | |
| 24 | - * @return 砍价助力记录 | |
| 25 | - */ | |
| 26 | - BargainHelpDO createBargainHelp(Long userId, AppBargainHelpCreateReqVO reqVO); | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * 【砍价活动】获得助力人数 Map | |
| 30 | - * | |
| 31 | - * @param activityIds 活动编号 | |
| 32 | - * @return 助力人数 Map | |
| 33 | - */ | |
| 34 | - Map<Long, Integer> getBargainHelpUserCountMapByActivity(Collection<Long> activityIds); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 【砍价记录】获得助力人数 Map | |
| 38 | - * | |
| 39 | - * @param recordIds 记录编号 | |
| 40 | - * @return 助力人数 Map | |
| 41 | - */ | |
| 42 | - Map<Long, Integer> getBargainHelpUserCountMapByRecord(Collection<Long> recordIds); | |
| 43 | - | |
| 44 | - /** | |
| 45 | - * 【砍价活动】获得用户的助力次数 | |
| 46 | - * | |
| 47 | - * @param activityId 活动编号 | |
| 48 | - * @param userId 用户编号 | |
| 49 | - * @return 助力次数 | |
| 50 | - */ | |
| 51 | - Long getBargainHelpCountByActivity(Long activityId, Long userId); | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * 获得砍价助力分页 | |
| 55 | - * | |
| 56 | - * @param pageReqVO 分页查询 | |
| 57 | - * @return 砍价助力分页 | |
| 58 | - */ | |
| 59 | - PageResult<BargainHelpDO> getBargainHelpPage(BargainHelpPageReqVO pageReqVO); | |
| 60 | - | |
| 61 | - /** | |
| 62 | - * 获得指定砍价记录编号,对应的砍价助力列表 | |
| 63 | - * | |
| 64 | - * @param recordId 砍价记录编号 | |
| 65 | - * @return 砍价助力列表 | |
| 66 | - */ | |
| 67 | - List<BargainHelpDO> getBargainHelpListByRecordId(Long recordId); | |
| 68 | - | |
| 69 | - /** | |
| 70 | - * 获得助力记录 | |
| 71 | - * | |
| 72 | - * @param recordId 砍价记录编号 | |
| 73 | - * @param userId 用户编号 | |
| 74 | - * @return 助力记录 | |
| 75 | - */ | |
| 76 | - BargainHelpDO getBargainHelp(Long recordId, Long userId); | |
| 77 | - | |
| 78 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainHelpServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.bargain; | |
| 2 | - | |
| 3 | -import cn.hutool.core.lang.Assert; | |
| 4 | -import cn.hutool.core.util.ObjUtil; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.help.BargainHelpPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBargainHelpCreateReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityDO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainHelpDO; | |
| 10 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainRecordDO; | |
| 11 | -import cn.iocoder.yudao.module.promotion.dal.mysql.bargain.BargainHelpMapper; | |
| 12 | -import cn.iocoder.yudao.module.promotion.enums.bargain.BargainRecordStatusEnum; | |
| 13 | -import jodd.util.MathUtil; | |
| 14 | -import org.springframework.stereotype.Service; | |
| 15 | -import org.springframework.transaction.annotation.Transactional; | |
| 16 | -import org.springframework.validation.annotation.Validated; | |
| 17 | - | |
| 18 | -import jakarta.annotation.Resource; | |
| 19 | - | |
| 20 | -import java.util.Collection; | |
| 21 | -import java.util.List; | |
| 22 | -import java.util.Map; | |
| 23 | - | |
| 24 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 25 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*; | |
| 26 | - | |
| 27 | -/** | |
| 28 | - * 砍价助力 Service 实现类 | |
| 29 | - * | |
| 30 | - * @author 芋道源码 | |
| 31 | - */ | |
| 32 | -@Service | |
| 33 | -@Validated | |
| 34 | -public class BargainHelpServiceImpl implements BargainHelpService { | |
| 35 | - | |
| 36 | - @Resource | |
| 37 | - private BargainHelpMapper bargainHelpMapper; | |
| 38 | - | |
| 39 | - @Resource | |
| 40 | - private BargainRecordService bargainRecordService; | |
| 41 | - @Resource | |
| 42 | - private BargainActivityService bargainActivityService; | |
| 43 | - | |
| 44 | - @Override | |
| 45 | - @Transactional(rollbackFor = Exception.class) | |
| 46 | - public BargainHelpDO createBargainHelp(Long userId, AppBargainHelpCreateReqVO reqVO) { | |
| 47 | - // 1.1 校验砍价记录存在,并且处于进行中 | |
| 48 | - BargainRecordDO record = bargainRecordService.getBargainRecord(reqVO.getRecordId()); | |
| 49 | - if (record == null) { | |
| 50 | - throw exception(BARGAIN_RECORD_NOT_EXISTS); | |
| 51 | - } | |
| 52 | - if (ObjUtil.notEqual(record.getStatus(), BargainRecordStatusEnum.IN_PROGRESS.getStatus())) { | |
| 53 | - throw exception(BARGAIN_HELP_CREATE_FAIL_RECORD_NOT_IN_PROCESS); | |
| 54 | - } | |
| 55 | - // 1.2 不能自己给自己砍价 | |
| 56 | - if (ObjUtil.equal(record.getUserId(), userId)) { | |
| 57 | - throw exception(BARGAIN_HELP_CREATE_FAIL_RECORD_SELF); | |
| 58 | - } | |
| 59 | - | |
| 60 | - // 2.1 校验砍价活动 | |
| 61 | - BargainActivityDO activity = bargainActivityService.getBargainActivity(record.getActivityId()); | |
| 62 | - // 2.2 校验自己是否助力次数上限 | |
| 63 | - if (bargainHelpMapper.selectCountByUserIdAndActivityId(userId, activity.getId()) | |
| 64 | - >= activity.getBargainCount()) { | |
| 65 | - throw exception(BARGAIN_HELP_CREATE_FAIL_LIMIT); | |
| 66 | - } | |
| 67 | - // 2.3 特殊情况:砍价已经砍到最低价,不能再砍了 | |
| 68 | - if (record.getBargainPrice() <= activity.getBargainMinPrice()) { | |
| 69 | - throw exception(BARGAIN_HELP_CREATE_FAIL_RECORD_NOT_IN_PROCESS); | |
| 70 | - } | |
| 71 | - | |
| 72 | - // 3. 已经助力 | |
| 73 | - if (bargainHelpMapper.selectByUserIdAndRecordId(userId, record.getId()) != null) { | |
| 74 | - throw exception(BARGAIN_HELP_CREATE_FAIL_HELP_EXISTS); | |
| 75 | - } | |
| 76 | - | |
| 77 | - // 4.1 计算砍价金额 | |
| 78 | - Integer reducePrice = calculateReducePrice(activity, record); | |
| 79 | - Assert.isTrue(reducePrice > 0, "砍价金额必须大于 0 元"); | |
| 80 | - // 4.2 创建助力记录 | |
| 81 | - BargainHelpDO help = BargainHelpDO.builder().userId(userId).activityId(activity.getId()) | |
| 82 | - .recordId(record.getId()).reducePrice(reducePrice).build(); | |
| 83 | - bargainHelpMapper.insert(help); | |
| 84 | - | |
| 85 | - // 5. 判断砍价记录是否完成 | |
| 86 | - Boolean success = record.getBargainPrice() - reducePrice <= activity.getBargainMinPrice() // 情况一:砍价已经砍到最低价 | |
| 87 | - || bargainHelpMapper.selectUserCountMapByRecordId(reqVO.getRecordId()) >= activity.getHelpMaxCount(); // 情况二:砍价助力已经达到上限 | |
| 88 | - if (!bargainRecordService.updateBargainRecordBargainPrice( | |
| 89 | - record.getId(), record.getBargainPrice(), reducePrice, success)) { | |
| 90 | - // 多人一起砍价,需要重试 | |
| 91 | - throw exception(BARGAIN_HELP_CREATE_FAIL_CONFLICT); | |
| 92 | - } | |
| 93 | - return help; | |
| 94 | - } | |
| 95 | - | |
| 96 | - // TODO 芋艿:优化点:实现一个更随机的逻辑,可以按照你自己的业务; | |
| 97 | - private Integer calculateReducePrice(BargainActivityDO activity, BargainRecordDO record) { | |
| 98 | - // 1. 随机金额 | |
| 99 | - Integer reducePrice = MathUtil.randomInt(activity.getBargainMinPrice(), | |
| 100 | - activity.getRandomMaxPrice() + 1); // + 1 的原因是,randomInt 默认不包含第二个参数 | |
| 101 | - // 2. 校验是否超过砍价上限 | |
| 102 | - if (record.getBargainPrice() - reducePrice < activity.getBargainMinPrice()) { | |
| 103 | - reducePrice = record.getBargainPrice() - activity.getBargainMinPrice(); | |
| 104 | - } | |
| 105 | - return reducePrice; | |
| 106 | - } | |
| 107 | - | |
| 108 | - @Override | |
| 109 | - public Map<Long, Integer> getBargainHelpUserCountMapByActivity(Collection<Long> activityIds) { | |
| 110 | - return bargainHelpMapper.selectUserCountMapByActivityId(activityIds); | |
| 111 | - } | |
| 112 | - | |
| 113 | - @Override | |
| 114 | - public Map<Long, Integer> getBargainHelpUserCountMapByRecord(Collection<Long> recordIds) { | |
| 115 | - return bargainHelpMapper.selectUserCountMapByRecordId(recordIds); | |
| 116 | - } | |
| 117 | - | |
| 118 | - @Override | |
| 119 | - public Long getBargainHelpCountByActivity(Long activityId, Long userId) { | |
| 120 | - return bargainHelpMapper.selectCountByUserIdAndActivityId(userId, activityId); | |
| 121 | - } | |
| 122 | - | |
| 123 | - @Override | |
| 124 | - public PageResult<BargainHelpDO> getBargainHelpPage(BargainHelpPageReqVO pageReqVO) { | |
| 125 | - return bargainHelpMapper.selectPage(pageReqVO); | |
| 126 | - } | |
| 127 | - | |
| 128 | - @Override | |
| 129 | - public List<BargainHelpDO> getBargainHelpListByRecordId(Long recordId) { | |
| 130 | - return bargainHelpMapper.selectListByRecordId(recordId); | |
| 131 | - } | |
| 132 | - | |
| 133 | - @Override | |
| 134 | - public BargainHelpDO getBargainHelp(Long recordId, Long userId) { | |
| 135 | - return bargainHelpMapper.selectByUserIdAndRecordId(userId, recordId); | |
| 136 | - } | |
| 137 | - | |
| 138 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainRecordService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.bargain; | |
| 2 | - | |
| 3 | - | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainValidateJoinRespDTO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.recrod.BargainRecordPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordCreateReqVO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainRecordDO; | |
| 10 | - | |
| 11 | -import jakarta.annotation.Nullable; | |
| 12 | -import java.util.Collection; | |
| 13 | -import java.util.List; | |
| 14 | -import java.util.Map; | |
| 15 | - | |
| 16 | -/** | |
| 17 | - * 砍价记录 service 接口 | |
| 18 | - * | |
| 19 | - * @author HUIHUI | |
| 20 | - */ | |
| 21 | -public interface BargainRecordService { | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * 【会员】创建砍价记录(参与参加活动) | |
| 25 | - * | |
| 26 | - * @param userId 用户编号 | |
| 27 | - * @param reqVO 创建信息 | |
| 28 | - * @return 砍价记录编号 | |
| 29 | - */ | |
| 30 | - Long createBargainRecord(Long userId, AppBargainRecordCreateReqVO reqVO); | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * 更新砍价记录的砍价金额 | |
| 34 | - * | |
| 35 | - * 如果满足砍价成功的条件,则更新砍价记录的状态为成功 | |
| 36 | - * | |
| 37 | - * @param id 砍价记录编号 | |
| 38 | - * @param whereBargainPrice 当前的砍价金额 | |
| 39 | - * @param reducePrice 减少的砍价金额 | |
| 40 | - * @param success 是否砍价成功 | |
| 41 | - * @return 是否更新成功。注意,如果并发更新时,会更新失败 | |
| 42 | - */ | |
| 43 | - Boolean updateBargainRecordBargainPrice(Long id, Integer whereBargainPrice, | |
| 44 | - Integer reducePrice, Boolean success); | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 【下单前】校验是否参与砍价活动 | |
| 48 | - * <p> | |
| 49 | - * 如果校验失败,则抛出业务异常 | |
| 50 | - * | |
| 51 | - * @param userId 用户编号 | |
| 52 | - * @param bargainRecordId 砍价活动编号 | |
| 53 | - * @param skuId SKU 编号 | |
| 54 | - * @return 砍价信息 | |
| 55 | - */ | |
| 56 | - BargainValidateJoinRespDTO validateJoinBargain(Long userId, Long bargainRecordId, Long skuId); | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * 更新砍价记录的订单编号 | |
| 60 | - * | |
| 61 | - * 在砍价成功后,用户发起订单后,会记录该订单编号 | |
| 62 | - * | |
| 63 | - * @param id 砍价记录编号 | |
| 64 | - * @param orderId 订单编号 | |
| 65 | - */ | |
| 66 | - void updateBargainRecordOrderId(Long id, Long orderId); | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * 获得砍价记录 | |
| 70 | - * | |
| 71 | - * @param id 砍价记录编号 | |
| 72 | - * @return 砍价记录 | |
| 73 | - */ | |
| 74 | - BargainRecordDO getBargainRecord(Long id); | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * 获得用户在当前砍价活动中的最后一条砍价记录 | |
| 78 | - * | |
| 79 | - * @param userId 用户编号 | |
| 80 | - * @param activityId 砍价记录编号 | |
| 81 | - * @return 砍价记录 | |
| 82 | - */ | |
| 83 | - BargainRecordDO getLastBargainRecord(Long userId, Long activityId); | |
| 84 | - | |
| 85 | - /** | |
| 86 | - * 获得砍价人数 Map | |
| 87 | - * | |
| 88 | - * @param activityIds 活动编号 | |
| 89 | - * @param status 砍价记录状态 | |
| 90 | - * @return 砍价人数 Map | |
| 91 | - */ | |
| 92 | - Map<Long, Integer> getBargainRecordUserCountMap(Collection<Long> activityIds, @Nullable Integer status); | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * 获得砍价人数 | |
| 96 | - * | |
| 97 | - * @param status 砍价记录状态 | |
| 98 | - * @return 砍价人数 | |
| 99 | - */ | |
| 100 | - Integer getBargainRecordUserCount(Integer status); | |
| 101 | - | |
| 102 | - /** | |
| 103 | - * 获得砍价人数 | |
| 104 | - * | |
| 105 | - * @param activityId 砍价活动编号 | |
| 106 | - * @param status 砍价记录状态 | |
| 107 | - * @return 砍价人数 | |
| 108 | - */ | |
| 109 | - Integer getBargainRecordUserCount(Long activityId, Integer status); | |
| 110 | - | |
| 111 | - /** | |
| 112 | - * 【管理员】获得砍价记录分页 | |
| 113 | - * | |
| 114 | - * @param pageReqVO 分页查询 | |
| 115 | - * @return 砍价记录分页 | |
| 116 | - */ | |
| 117 | - PageResult<BargainRecordDO> getBargainRecordPage(BargainRecordPageReqVO pageReqVO); | |
| 118 | - | |
| 119 | - /** | |
| 120 | - * 【会员】获得砍价记录分页 | |
| 121 | - * | |
| 122 | - * @param userId 用户编号 | |
| 123 | - * @param pageParam 分页查询 | |
| 124 | - * @return 砍价记录分页 | |
| 125 | - */ | |
| 126 | - PageResult<BargainRecordDO> getBargainRecordPage(Long userId, PageParam pageParam); | |
| 127 | - | |
| 128 | - /** | |
| 129 | - * 获得砍价记录列表 | |
| 130 | - * | |
| 131 | - * @param status 砍价记录状态 | |
| 132 | - * @param count 条数 | |
| 133 | - * @return 砍价记录列表 | |
| 134 | - */ | |
| 135 | - List<BargainRecordDO> getBargainRecordList(Integer status, Integer count); | |
| 136 | - | |
| 137 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainRecordServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.bargain; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.lang.Assert; | |
| 5 | -import cn.hutool.core.util.ObjUtil; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 8 | -import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainValidateJoinRespDTO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.recrod.BargainRecordPageReqVO; | |
| 10 | -import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordCreateReqVO; | |
| 11 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityDO; | |
| 12 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainRecordDO; | |
| 13 | -import cn.iocoder.yudao.module.promotion.dal.mysql.bargain.BargainRecordMapper; | |
| 14 | -import cn.iocoder.yudao.module.promotion.enums.bargain.BargainRecordStatusEnum; | |
| 15 | -import org.springframework.stereotype.Service; | |
| 16 | -import org.springframework.transaction.annotation.Transactional; | |
| 17 | -import org.springframework.validation.annotation.Validated; | |
| 18 | - | |
| 19 | -import jakarta.annotation.Nullable; | |
| 20 | -import jakarta.annotation.Resource; | |
| 21 | -import java.util.Collection; | |
| 22 | -import java.util.List; | |
| 23 | -import java.util.Map; | |
| 24 | -import java.util.Objects; | |
| 25 | - | |
| 26 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 27 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*; | |
| 28 | - | |
| 29 | -/** | |
| 30 | - * 砍价记录 Service 实现类 | |
| 31 | - * | |
| 32 | - * @author HUIHUI | |
| 33 | - */ | |
| 34 | -@Service | |
| 35 | -@Validated | |
| 36 | -public class BargainRecordServiceImpl implements BargainRecordService { | |
| 37 | - | |
| 38 | - @Resource | |
| 39 | - private BargainActivityService bargainActivityService; | |
| 40 | - | |
| 41 | - @Resource | |
| 42 | - private BargainRecordMapper bargainRecordMapper; | |
| 43 | - | |
| 44 | - @Override | |
| 45 | - public Long createBargainRecord(Long userId, AppBargainRecordCreateReqVO reqVO) { | |
| 46 | - // 1. 校验砍价活动(包括库存) | |
| 47 | - BargainActivityDO activity = bargainActivityService.validateBargainActivityCanJoin(reqVO.getActivityId()); | |
| 48 | - | |
| 49 | - // 2.1 校验当前是否已经有参与中的砍价活动 | |
| 50 | - if (CollUtil.isNotEmpty(bargainRecordMapper.selectListByUserIdAndActivityIdAndStatus( | |
| 51 | - userId, reqVO.getActivityId(), BargainRecordStatusEnum.IN_PROGRESS.getStatus()))) { | |
| 52 | - throw exception(BARGAIN_RECORD_CREATE_FAIL_EXISTS); | |
| 53 | - } | |
| 54 | - // 2.2 是否超过参与的上限 | |
| 55 | - if (bargainRecordMapper.selectCountByUserIdAndActivityIdAndStatus( | |
| 56 | - userId, reqVO.getActivityId(), BargainRecordStatusEnum.SUCCESS.getStatus()) >= activity.getTotalLimitCount()) { | |
| 57 | - throw exception(BARGAIN_RECORD_CREATE_FAIL_LIMIT); | |
| 58 | - } | |
| 59 | - | |
| 60 | - // 3. 创建砍价记录 | |
| 61 | - BargainRecordDO record = BargainRecordDO.builder().userId(userId) | |
| 62 | - .activityId(reqVO.getActivityId()).spuId(activity.getSpuId()).skuId(activity.getSkuId()) | |
| 63 | - .bargainFirstPrice(activity.getBargainFirstPrice()).bargainPrice(activity.getBargainFirstPrice()) | |
| 64 | - .status(BargainRecordStatusEnum.IN_PROGRESS.getStatus()).build(); | |
| 65 | - bargainRecordMapper.insert(record); | |
| 66 | - return record.getId(); | |
| 67 | - } | |
| 68 | - | |
| 69 | - @Override | |
| 70 | - public Boolean updateBargainRecordBargainPrice(Long id, Integer whereBargainPrice, | |
| 71 | - Integer reducePrice, Boolean success) { | |
| 72 | - BargainRecordDO updateObj = new BargainRecordDO().setBargainPrice(whereBargainPrice - reducePrice); | |
| 73 | - if (success) { | |
| 74 | - updateObj.setStatus(BargainRecordStatusEnum.SUCCESS.getStatus()); | |
| 75 | - } | |
| 76 | - return bargainRecordMapper.updateByIdAndBargainPrice(id, whereBargainPrice, updateObj) > 0; | |
| 77 | - } | |
| 78 | - | |
| 79 | - @Override | |
| 80 | - public BargainValidateJoinRespDTO validateJoinBargain(Long userId, Long bargainRecordId, Long skuId) { | |
| 81 | - // 1.1 砍价记录不存在 | |
| 82 | - BargainRecordDO record = bargainRecordMapper.selectByIdAndUserId(bargainRecordId, userId); | |
| 83 | - if (record == null) { | |
| 84 | - throw exception(BARGAIN_RECORD_NOT_EXISTS); | |
| 85 | - } | |
| 86 | - // 1.2 砍价记录未在进行中 | |
| 87 | - if (ObjUtil.notEqual(record.getStatus(), BargainRecordStatusEnum.SUCCESS.getStatus())) { | |
| 88 | - throw exception(BARGAIN_JOIN_RECORD_NOT_SUCCESS); | |
| 89 | - } | |
| 90 | - // 1.3 砍价记录已经下单 | |
| 91 | - if (record.getOrderId() != null) { | |
| 92 | - throw exception(BARGAIN_JOIN_RECORD_ALREADY_ORDER); | |
| 93 | - } | |
| 94 | - | |
| 95 | - // 2.1 校验砍价活动(包括库存) | |
| 96 | - BargainActivityDO activity = bargainActivityService.validateBargainActivityCanJoin(record.getActivityId()); | |
| 97 | - Assert.isTrue(Objects.equals(skuId, activity.getSkuId()), "砍价商品不匹配"); // 防御性校验 | |
| 98 | - return new BargainValidateJoinRespDTO().setActivityId(activity.getId()).setName(activity.getName()) | |
| 99 | - .setBargainPrice(record.getBargainPrice()); | |
| 100 | - } | |
| 101 | - | |
| 102 | - @Override | |
| 103 | - @Transactional(rollbackFor = Exception.class) | |
| 104 | - public void updateBargainRecordOrderId(Long id, Long orderId) { | |
| 105 | - // 更新失败,说明已经下单 | |
| 106 | - int updateCount = bargainRecordMapper.updateOrderIdById(id, orderId); | |
| 107 | - if (updateCount == 0) { | |
| 108 | - throw exception(BARGAIN_JOIN_RECORD_ALREADY_ORDER); | |
| 109 | - } | |
| 110 | - } | |
| 111 | - | |
| 112 | - @Override | |
| 113 | - public BargainRecordDO getBargainRecord(Long id) { | |
| 114 | - return bargainRecordMapper.selectById(id); | |
| 115 | - } | |
| 116 | - | |
| 117 | - @Override | |
| 118 | - public BargainRecordDO getLastBargainRecord(Long userId, Long activityId) { | |
| 119 | - return bargainRecordMapper.selectLastByUserIdAndActivityId(userId, activityId); | |
| 120 | - } | |
| 121 | - | |
| 122 | - @Override | |
| 123 | - public Map<Long, Integer> getBargainRecordUserCountMap(Collection<Long> activityIds, @Nullable Integer status) { | |
| 124 | - return bargainRecordMapper.selectUserCountByActivityIdsAndStatus(activityIds, status); | |
| 125 | - } | |
| 126 | - | |
| 127 | - @Override | |
| 128 | - public Integer getBargainRecordUserCount(Integer status) { | |
| 129 | - return bargainRecordMapper.selectUserCountByStatus(status); | |
| 130 | - } | |
| 131 | - | |
| 132 | - @Override | |
| 133 | - public Integer getBargainRecordUserCount(Long activityId, Integer status) { | |
| 134 | - return bargainRecordMapper.selectUserCountByActivityIdAndStatus(activityId, status); | |
| 135 | - } | |
| 136 | - | |
| 137 | - @Override | |
| 138 | - public PageResult<BargainRecordDO> getBargainRecordPage(BargainRecordPageReqVO pageReqVO) { | |
| 139 | - return bargainRecordMapper.selectPage(pageReqVO); | |
| 140 | - } | |
| 141 | - | |
| 142 | - @Override | |
| 143 | - public PageResult<BargainRecordDO> getBargainRecordPage(Long userId, PageParam pageParam) { | |
| 144 | - return bargainRecordMapper.selectBargainRecordPage(userId, pageParam); | |
| 145 | - } | |
| 146 | - | |
| 147 | - @Override | |
| 148 | - public List<BargainRecordDO> getBargainRecordList(Integer status, Integer count) { | |
| 149 | - return bargainRecordMapper.selectListByStatusAndCount(status, count); | |
| 150 | - } | |
| 151 | - | |
| 152 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.combination; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityCreateReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; | |
| 10 | -import jakarta.validation.Valid; | |
| 11 | - | |
| 12 | -import java.util.Collection; | |
| 13 | -import java.util.Collections; | |
| 14 | -import java.util.List; | |
| 15 | - | |
| 16 | -/** | |
| 17 | - * 拼团活动 Service 接口 | |
| 18 | - * | |
| 19 | - * @author HUIHUI | |
| 20 | - */ | |
| 21 | -public interface CombinationActivityService { | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * 创建拼团活动 | |
| 25 | - * | |
| 26 | - * @param createReqVO 创建信息 | |
| 27 | - * @return 编号 | |
| 28 | - */ | |
| 29 | - Long createCombinationActivity(@Valid CombinationActivityCreateReqVO createReqVO); | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 更新拼团活动 | |
| 33 | - * | |
| 34 | - * @param updateReqVO 更新信息 | |
| 35 | - */ | |
| 36 | - void updateCombinationActivity(@Valid CombinationActivityUpdateReqVO updateReqVO); | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 关闭拼团活动 | |
| 40 | - * | |
| 41 | - * @param id 拼团活动编号 | |
| 42 | - */ | |
| 43 | - void closeCombinationActivityById(Long id); | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * 删除拼团活动 | |
| 47 | - * | |
| 48 | - * @param id 编号 | |
| 49 | - */ | |
| 50 | - void deleteCombinationActivity(Long id); | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * 校验拼团活动是否存在 | |
| 54 | - * | |
| 55 | - * @param id 编号 | |
| 56 | - * @return 拼团活动 | |
| 57 | - */ | |
| 58 | - CombinationActivityDO validateCombinationActivityExists(Long id); | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * 获得拼团活动 | |
| 62 | - * | |
| 63 | - * @param id 编号 | |
| 64 | - * @return 拼团活动 | |
| 65 | - */ | |
| 66 | - CombinationActivityDO getCombinationActivity(Long id); | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * 获得拼团活动分页 | |
| 70 | - * | |
| 71 | - * @param pageReqVO 分页查询 | |
| 72 | - * @return 拼团活动分页 | |
| 73 | - */ | |
| 74 | - PageResult<CombinationActivityDO> getCombinationActivityPage(CombinationActivityPageReqVO pageReqVO); | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * 获得拼团活动商品列表 | |
| 78 | - * | |
| 79 | - * @param activityId 拼团活动 id | |
| 80 | - * @return 拼团活动的商品列表 | |
| 81 | - */ | |
| 82 | - default List<CombinationProductDO> getCombinationProductsByActivityId(Long activityId) { | |
| 83 | - return getCombinationProductListByActivityIds(Collections.singletonList(activityId)); | |
| 84 | - } | |
| 85 | - | |
| 86 | - /** | |
| 87 | - * 获得拼团活动商品列表 | |
| 88 | - * | |
| 89 | - * @param activityIds 拼团活动 ids | |
| 90 | - * @return 拼团活动的商品列表 | |
| 91 | - */ | |
| 92 | - List<CombinationProductDO> getCombinationProductListByActivityIds(Collection<Long> activityIds); | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * 获得拼团活动列表 | |
| 96 | - * | |
| 97 | - * @param ids 拼团活动 ids | |
| 98 | - * @return 拼团活动的列表 | |
| 99 | - */ | |
| 100 | - List<CombinationActivityDO> getCombinationActivityListByIds(Collection<Long> ids); | |
| 101 | - | |
| 102 | - /** | |
| 103 | - * 获取正在进行的活动分页数据 | |
| 104 | - * | |
| 105 | - * @param pageParam 分页请求 | |
| 106 | - * @return 拼团活动分页 | |
| 107 | - */ | |
| 108 | - PageResult<CombinationActivityDO> getCombinationActivityPage(PageParam pageParam); | |
| 109 | - | |
| 110 | - /** | |
| 111 | - * 获取指定活动、指定 SKU 编号的商品 | |
| 112 | - * | |
| 113 | - * @param activityId 活动编号 | |
| 114 | - * @param skuId SKU 编号 | |
| 115 | - * @return 活动商品信息 | |
| 116 | - */ | |
| 117 | - CombinationProductDO selectByActivityIdAndSkuId(Long activityId, Long skuId); | |
| 118 | - | |
| 119 | - /** | |
| 120 | - * 获得 SPU 进行中的拼团活动 | |
| 121 | - * | |
| 122 | - * @param spuId SPU 编号数组 | |
| 123 | - * @return 拼团活动 | |
| 124 | - */ | |
| 125 | - CombinationActivityDO getMatchCombinationActivityBySpuId(Long spuId); | |
| 126 | - | |
| 127 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.combination; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.core.KeyValue; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordPageReqVO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; | |
| 10 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; | |
| 11 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; | |
| 12 | - | |
| 13 | -import jakarta.annotation.Nullable; | |
| 14 | -import java.util.Collection; | |
| 15 | -import java.util.List; | |
| 16 | -import java.util.Map; | |
| 17 | - | |
| 18 | -/** | |
| 19 | - * 拼团记录 Service 接口 | |
| 20 | - * | |
| 21 | - * @author HUIHUI | |
| 22 | - */ | |
| 23 | -public interface CombinationRecordService { | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 【下单前】校验是否满足拼团活动条件 | |
| 27 | - * | |
| 28 | - * 如果校验失败,则抛出业务异常 | |
| 29 | - * | |
| 30 | - * @param userId 用户编号 | |
| 31 | - * @param activityId 活动编号 | |
| 32 | - * @param headId 团长编号 | |
| 33 | - * @param skuId sku 编号 | |
| 34 | - * @param count 数量 | |
| 35 | - * @return 拼团信息 | |
| 36 | - */ | |
| 37 | - KeyValue<CombinationActivityDO, CombinationProductDO> validateCombinationRecord(Long userId, Long activityId, Long headId, | |
| 38 | - Long skuId, Integer count); | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * 创建拼团记录 | |
| 42 | - * | |
| 43 | - * @param reqDTO 创建信息 | |
| 44 | - * @return 团信息 | |
| 45 | - */ | |
| 46 | - CombinationRecordDO createCombinationRecord(CombinationRecordCreateReqDTO reqDTO); | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * 获得拼团记录 | |
| 50 | - * | |
| 51 | - * @param userId 用户编号 | |
| 52 | - * @param orderId 订单编号 | |
| 53 | - * @return 拼团记录 | |
| 54 | - */ | |
| 55 | - CombinationRecordDO getCombinationRecord(Long userId, Long orderId); | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * 【下单前】校验是否满足拼团活动条件 | |
| 59 | - * | |
| 60 | - * 如果校验失败,则抛出业务异常 | |
| 61 | - * | |
| 62 | - * @param userId 用户编号 | |
| 63 | - * @param activityId 活动编号 | |
| 64 | - * @param headId 团长编号 | |
| 65 | - * @param skuId sku 编号 | |
| 66 | - * @param count 数量 | |
| 67 | - * @return 拼团信息 | |
| 68 | - */ | |
| 69 | - CombinationValidateJoinRespDTO validateJoinCombination(Long userId, Long activityId, Long headId, Long skuId, Integer count); | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * 获取拼团记录数 | |
| 73 | - * | |
| 74 | - * @param status 状态-允许为空 | |
| 75 | - * @param virtualGroup 是否虚拟成团-允许为空 | |
| 76 | - * @param headId 团长编号,允许空。目的 headId 设置为 {@link CombinationRecordDO#HEAD_ID_GROUP} 时,可以设置 | |
| 77 | - * @return 记录数 | |
| 78 | - */ | |
| 79 | - Long getCombinationRecordCount(@Nullable Integer status, @Nullable Boolean virtualGroup, Long headId); | |
| 80 | - | |
| 81 | - /** | |
| 82 | - * 查询用户拼团记录(DISTINCT 去重),也就是说查询会员表中的用户有多少人参与过拼团活动每个人只统计一次 | |
| 83 | - * | |
| 84 | - * @return 参加过拼团的用户数 | |
| 85 | - */ | |
| 86 | - Long getCombinationUserCount(); | |
| 87 | - | |
| 88 | - /** | |
| 89 | - * 获取最近的 count 条拼团记录 | |
| 90 | - * | |
| 91 | - * @param count 限制数量 | |
| 92 | - * @return 拼团记录列表 | |
| 93 | - */ | |
| 94 | - List<CombinationRecordDO> getLatestCombinationRecordList(int count); | |
| 95 | - | |
| 96 | - /** | |
| 97 | - * 获得最近 n 条拼团记录(团长发起的) | |
| 98 | - * | |
| 99 | - * @param activityId 拼团活动编号 | |
| 100 | - * @param status 状态 | |
| 101 | - * @param count 数量 | |
| 102 | - * @return 拼团记录列表 | |
| 103 | - */ | |
| 104 | - List<CombinationRecordDO> getHeadCombinationRecordList(Long activityId, Integer status, Integer count); | |
| 105 | - | |
| 106 | - /** | |
| 107 | - * 获取指定编号的拼团记录 | |
| 108 | - * | |
| 109 | - * @param id 拼团记录编号 | |
| 110 | - * @return 拼团记录 | |
| 111 | - */ | |
| 112 | - CombinationRecordDO getCombinationRecordById(Long id); | |
| 113 | - | |
| 114 | - /** | |
| 115 | - * 获取指定团长编号的拼团记录 | |
| 116 | - * | |
| 117 | - * @param headId 团长编号 | |
| 118 | - * @return 拼团记录列表 | |
| 119 | - */ | |
| 120 | - List<CombinationRecordDO> getCombinationRecordListByHeadId(Long headId); | |
| 121 | - | |
| 122 | - /** | |
| 123 | - * 获取拼团记录分页数据 | |
| 124 | - * | |
| 125 | - * @param pageVO 分页请求 | |
| 126 | - * @return 拼团记录分页数据 | |
| 127 | - */ | |
| 128 | - PageResult<CombinationRecordDO> getCombinationRecordPage(CombinationRecordReqPageVO pageVO); | |
| 129 | - | |
| 130 | - /** | |
| 131 | - * 【拼团活动】获得拼团记录数量 Map | |
| 132 | - * | |
| 133 | - * @param activityIds 活动记录编号数组 | |
| 134 | - * @param status 拼团状态,允许空 | |
| 135 | - * @param headId 团长编号,允许空。目的 headId 设置为 {@link CombinationRecordDO#HEAD_ID_GROUP} 时,可以设置 | |
| 136 | - * @return 拼团记录数量 Map | |
| 137 | - */ | |
| 138 | - Map<Long, Integer> getCombinationRecordCountMapByActivity(Collection<Long> activityIds, | |
| 139 | - @Nullable Integer status, | |
| 140 | - @Nullable Long headId); | |
| 141 | - | |
| 142 | - /** | |
| 143 | - * 处理过期拼团 | |
| 144 | - * | |
| 145 | - * @return key 过期拼团数量, value 虚拟成团数量 | |
| 146 | - */ | |
| 147 | - KeyValue<Integer, Integer> expireCombinationRecord(); | |
| 148 | - | |
| 149 | - /** | |
| 150 | - * 获得拼团记录分页数据 | |
| 151 | - * | |
| 152 | - * @param userId 用户编号 | |
| 153 | - * @param pageReqVO 分页请求 | |
| 154 | - * @return 拼团记录分页数据 | |
| 155 | - */ | |
| 156 | - PageResult<CombinationRecordDO> getCombinationRecordPage(Long userId, AppCombinationRecordPageReqVO pageReqVO); | |
| 157 | - | |
| 158 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.coupon; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.map.MapUtil; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon.CouponPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponDO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponTemplateDO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTakeTypeEnum; | |
| 10 | - | |
| 11 | -import java.util.*; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 优惠劵 Service 接口 | |
| 15 | - * | |
| 16 | - * @author 芋道源码 | |
| 17 | - */ | |
| 18 | -public interface CouponService { | |
| 19 | - | |
| 20 | - /** | |
| 21 | - * 使用优惠劵 | |
| 22 | - * | |
| 23 | - * @param id 优惠劵编号 | |
| 24 | - * @param userId 用户编号 | |
| 25 | - * @param orderId 订单编号 | |
| 26 | - */ | |
| 27 | - void useCoupon(Long id, Long userId, Long orderId); | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 退还已使用的优惠券 | |
| 31 | - * | |
| 32 | - * @param id 优惠券编号 | |
| 33 | - */ | |
| 34 | - void returnUsedCoupon(Long id); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 回收优惠劵 | |
| 38 | - * | |
| 39 | - * @param id 优惠劵编号 | |
| 40 | - */ | |
| 41 | - void deleteCoupon(Long id); | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * 领取优惠券 | |
| 45 | - * | |
| 46 | - * @param templateId 优惠券模板编号 | |
| 47 | - * @param userIds 用户编号列表 | |
| 48 | - * @param takeType 领取方式 | |
| 49 | - * @return key: userId, value: 优惠券编号列表 | |
| 50 | - */ | |
| 51 | - Map<Long, List<Long>> takeCoupon(Long templateId, Set<Long> userIds, CouponTakeTypeEnum takeType); | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * 【管理员】给用户发送优惠券 | |
| 55 | - * | |
| 56 | - * @param templateId 优惠券模板编号 | |
| 57 | - * @param userIds 用户编号列表 | |
| 58 | - * @return key: userId, value: 优惠券编号列表 | |
| 59 | - */ | |
| 60 | - default Map<Long, List<Long>> takeCouponByAdmin(Long templateId, Set<Long> userIds) { | |
| 61 | - return takeCoupon(templateId, userIds, CouponTakeTypeEnum.ADMIN); | |
| 62 | - } | |
| 63 | - | |
| 64 | - /** | |
| 65 | - * 【管理员】给指定用户批量发送优惠券 | |
| 66 | - * | |
| 67 | - * @param giveCoupons key: 优惠劵模版编号,value:对应的数量 | |
| 68 | - * @param userId 用户编号 | |
| 69 | - * @return 优惠券编号列表 | |
| 70 | - */ | |
| 71 | - List<Long> takeCouponsByAdmin(Map<Long, Integer> giveCoupons, Long userId); | |
| 72 | - | |
| 73 | - /** | |
| 74 | - * 【管理员】作废指定用户的指定优惠劵 | |
| 75 | - * | |
| 76 | - * @param giveCouponIds 赠送的优惠券编号 | |
| 77 | - * @param userId 用户编号 | |
| 78 | - */ | |
| 79 | - void invalidateCouponsByAdmin(List<Long> giveCouponIds, Long userId); | |
| 80 | - | |
| 81 | - /** | |
| 82 | - * 【会员】领取优惠券 | |
| 83 | - * | |
| 84 | - * @param templateId 优惠券模板编号 | |
| 85 | - * @param userId 用户编号 | |
| 86 | - */ | |
| 87 | - default void takeCouponByUser(Long templateId, Long userId) { | |
| 88 | - takeCoupon(templateId, CollUtil.newHashSet(userId), CouponTakeTypeEnum.USER); | |
| 89 | - } | |
| 90 | - | |
| 91 | - /** | |
| 92 | - * 【系统】给用户发送新人券 | |
| 93 | - * | |
| 94 | - * @param userId 用户编号 | |
| 95 | - */ | |
| 96 | - void takeCouponByRegister(Long userId); | |
| 97 | - | |
| 98 | - /** | |
| 99 | - * 过期优惠券 | |
| 100 | - * | |
| 101 | - * @return 过期数量 | |
| 102 | - */ | |
| 103 | - int expireCoupon(); | |
| 104 | - | |
| 105 | - // ======================= 查询相关 ======================= | |
| 106 | - | |
| 107 | - /** | |
| 108 | - * 获得未使用的优惠劵数量 | |
| 109 | - * | |
| 110 | - * @param userId 用户编号 | |
| 111 | - * @return 未使用的优惠劵数量 | |
| 112 | - */ | |
| 113 | - Long getUnusedCouponCount(Long userId); | |
| 114 | - | |
| 115 | - /** | |
| 116 | - * 获得优惠劵分页 | |
| 117 | - * | |
| 118 | - * @param pageReqVO 分页查询 | |
| 119 | - * @return 优惠劵分页 | |
| 120 | - */ | |
| 121 | - PageResult<CouponDO> getCouponPage(CouponPageReqVO pageReqVO); | |
| 122 | - | |
| 123 | - /** | |
| 124 | - * 获得用户的优惠劵列表 | |
| 125 | - * | |
| 126 | - * @param userId 用户编号 | |
| 127 | - * @param status 优惠劵状态 | |
| 128 | - * @return 优惠劵列表 | |
| 129 | - */ | |
| 130 | - List<CouponDO> getCouponList(Long userId, Integer status); | |
| 131 | - | |
| 132 | - /** | |
| 133 | - * 统计会员领取优惠券的数量 | |
| 134 | - * | |
| 135 | - * @param templateIds 优惠券模板编号列表 | |
| 136 | - * @param userId 用户编号 | |
| 137 | - * @return 领取优惠券的数量 | |
| 138 | - */ | |
| 139 | - Map<Long, Integer> getTakeCountMapByTemplateIds(Collection<Long> templateIds, Long userId); | |
| 140 | - | |
| 141 | - /** | |
| 142 | - * 获取会员领取指定优惠券的数量 | |
| 143 | - * | |
| 144 | - * @param templateId 优惠券模板编号 | |
| 145 | - * @param userId 用户编号 | |
| 146 | - * @return 领取优惠券的数量 | |
| 147 | - */ | |
| 148 | - default Integer getTakeCount(Long templateId, Long userId) { | |
| 149 | - Map<Long, Integer> map = getTakeCountMapByTemplateIds(Collections.singleton(templateId), userId); | |
| 150 | - return MapUtil.getInt(map, templateId, 0); | |
| 151 | - } | |
| 152 | - | |
| 153 | - /** | |
| 154 | - * 获取用户是否可以领取优惠券 | |
| 155 | - * | |
| 156 | - * @param userId 用户编号 | |
| 157 | - * @param templates 优惠券列表 | |
| 158 | - * @return 是否可以领取 | |
| 159 | - */ | |
| 160 | - Map<Long, Boolean> getUserCanCanTakeMap(Long userId, List<CouponTemplateDO> templates); | |
| 161 | - | |
| 162 | - /** | |
| 163 | - * 获得优惠劵 | |
| 164 | - * | |
| 165 | - * @param userId 用户编号 | |
| 166 | - * @param id 编号 | |
| 167 | - * @return 优惠劵 | |
| 168 | - */ | |
| 169 | - CouponDO getCoupon(Long userId, Long id); | |
| 170 | - | |
| 171 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.coupon; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplateCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplatePageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplateUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponTemplateDO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTakeTypeEnum; | |
| 9 | - | |
| 10 | -import jakarta.validation.Valid; | |
| 11 | -import java.util.Collection; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 优惠劵模板 Service 接口 | |
| 16 | - * | |
| 17 | - * @author 芋道源码 | |
| 18 | - */ | |
| 19 | -public interface CouponTemplateService { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 创建优惠劵模板 | |
| 23 | - * | |
| 24 | - * @param createReqVO 创建信息 | |
| 25 | - * @return 编号 | |
| 26 | - */ | |
| 27 | - Long createCouponTemplate(@Valid CouponTemplateCreateReqVO createReqVO); | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 更新优惠劵模板 | |
| 31 | - * | |
| 32 | - * @param updateReqVO 更新信息 | |
| 33 | - */ | |
| 34 | - void updateCouponTemplate(@Valid CouponTemplateUpdateReqVO updateReqVO); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 更新优惠劵模板的状态 | |
| 38 | - * | |
| 39 | - * @param id 编号 | |
| 40 | - * @param status 状态 | |
| 41 | - */ | |
| 42 | - void updateCouponTemplateStatus(Long id, Integer status); | |
| 43 | - | |
| 44 | - /** | |
| 45 | - * 删除优惠劵模板 | |
| 46 | - * | |
| 47 | - * @param id 编号 | |
| 48 | - */ | |
| 49 | - void deleteCouponTemplate(Long id); | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * 获得优惠劵模板 | |
| 53 | - * | |
| 54 | - * @param id 编号 | |
| 55 | - * @return 优惠劵模板 | |
| 56 | - */ | |
| 57 | - CouponTemplateDO getCouponTemplate(Long id); | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * 获得优惠劵模板分页 | |
| 61 | - * | |
| 62 | - * @param pageReqVO 分页查询 | |
| 63 | - * @return 优惠劵模板分页 | |
| 64 | - */ | |
| 65 | - PageResult<CouponTemplateDO> getCouponTemplatePage(CouponTemplatePageReqVO pageReqVO); | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * 更新优惠劵模板的领取数量 | |
| 69 | - * | |
| 70 | - * @param id 优惠劵模板编号 | |
| 71 | - * @param incrCount 增加数量 | |
| 72 | - */ | |
| 73 | - void updateCouponTemplateTakeCount(Long id, int incrCount); | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * 获得指定领取方式的优惠券模板 | |
| 77 | - * | |
| 78 | - * @param takeType 领取方式 | |
| 79 | - * @return 优惠券模板列表 | |
| 80 | - */ | |
| 81 | - List<CouponTemplateDO> getCouponTemplateListByTakeType(CouponTakeTypeEnum takeType); | |
| 82 | - | |
| 83 | - /** | |
| 84 | - * 获得优惠券模板列表 | |
| 85 | - * | |
| 86 | - * @param canTakeTypes 可领取的类型列表 | |
| 87 | - * @param productScope 商品使用范围类型 | |
| 88 | - * @param productScopeValue 商品使用范围编号 | |
| 89 | - * @param count 查询数量 | |
| 90 | - * @return 优惠券模板列表 | |
| 91 | - */ | |
| 92 | - List<CouponTemplateDO> getCouponTemplateList(List<Integer> canTakeTypes, Integer productScope, | |
| 93 | - Long productScopeValue, Integer count); | |
| 94 | - | |
| 95 | - /** | |
| 96 | - * 获得优惠券模版列表 | |
| 97 | - * | |
| 98 | - * @param ids 优惠券模版编号 | |
| 99 | - * @return 优惠券模版列表 | |
| 100 | - */ | |
| 101 | - List<CouponTemplateDO> getCouponTemplateList(Collection<Long> ids); | |
| 102 | - | |
| 103 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.coupon; | |
| 2 | - | |
| 3 | -import cn.hutool.core.util.ObjUtil; | |
| 4 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.module.product.api.category.ProductCategoryApi; | |
| 7 | -import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; | |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplateCreateReqVO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplatePageReqVO; | |
| 10 | -import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplateUpdateReqVO; | |
| 11 | -import cn.iocoder.yudao.module.promotion.convert.coupon.CouponTemplateConvert; | |
| 12 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponTemplateDO; | |
| 13 | -import cn.iocoder.yudao.module.promotion.dal.mysql.coupon.CouponTemplateMapper; | |
| 14 | -import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum; | |
| 15 | -import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTakeTypeEnum; | |
| 16 | -import jakarta.annotation.Resource; | |
| 17 | -import org.springframework.stereotype.Service; | |
| 18 | -import org.springframework.validation.annotation.Validated; | |
| 19 | - | |
| 20 | -import java.util.Collection; | |
| 21 | -import java.util.List; | |
| 22 | -import java.util.Objects; | |
| 23 | - | |
| 24 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 25 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.COUPON_TEMPLATE_NOT_EXISTS; | |
| 26 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.COUPON_TEMPLATE_TOTAL_COUNT_TOO_SMALL; | |
| 27 | - | |
| 28 | -/** | |
| 29 | - * 优惠劵模板 Service 实现类 | |
| 30 | - * | |
| 31 | - * @author 芋道源码 | |
| 32 | - */ | |
| 33 | -@Service | |
| 34 | -@Validated | |
| 35 | -public class CouponTemplateServiceImpl implements CouponTemplateService { | |
| 36 | - | |
| 37 | - @Resource | |
| 38 | - private CouponTemplateMapper couponTemplateMapper; | |
| 39 | - | |
| 40 | - @Resource | |
| 41 | - private ProductCategoryApi productCategoryApi; | |
| 42 | - @Resource | |
| 43 | - private ProductSpuApi productSpuApi; | |
| 44 | - | |
| 45 | - @Override | |
| 46 | - public Long createCouponTemplate(CouponTemplateCreateReqVO createReqVO) { | |
| 47 | - // 校验商品范围 | |
| 48 | - validateProductScope(createReqVO.getProductScope(), createReqVO.getProductScopeValues()); | |
| 49 | - // 插入 | |
| 50 | - CouponTemplateDO couponTemplate = CouponTemplateConvert.INSTANCE.convert(createReqVO) | |
| 51 | - .setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 52 | - couponTemplateMapper.insert(couponTemplate); | |
| 53 | - // 返回 | |
| 54 | - return couponTemplate.getId(); | |
| 55 | - } | |
| 56 | - | |
| 57 | - @Override | |
| 58 | - public void updateCouponTemplate(CouponTemplateUpdateReqVO updateReqVO) { | |
| 59 | - // 校验存在 | |
| 60 | - CouponTemplateDO couponTemplate = validateCouponTemplateExists(updateReqVO.getId()); | |
| 61 | - // 校验发放数量不能过小(仅在 CouponTakeTypeEnum.USER 用户领取时) | |
| 62 | - if (CouponTakeTypeEnum.isUser(couponTemplate.getTakeType()) | |
| 63 | - && ObjUtil.notEqual(couponTemplate.getTakeLimitCount(), CouponTemplateDO.TIME_LIMIT_COUNT_MAX) // 非不限制 | |
| 64 | - && updateReqVO.getTotalCount() < couponTemplate.getTakeCount()) { | |
| 65 | - throw exception(COUPON_TEMPLATE_TOTAL_COUNT_TOO_SMALL, couponTemplate.getTakeCount()); | |
| 66 | - } | |
| 67 | - // 校验商品范围 | |
| 68 | - validateProductScope(updateReqVO.getProductScope(), updateReqVO.getProductScopeValues()); | |
| 69 | - | |
| 70 | - // 更新 | |
| 71 | - CouponTemplateDO updateObj = CouponTemplateConvert.INSTANCE.convert(updateReqVO); | |
| 72 | - couponTemplateMapper.updateById(updateObj); | |
| 73 | - } | |
| 74 | - | |
| 75 | - @Override | |
| 76 | - public void updateCouponTemplateStatus(Long id, Integer status) { | |
| 77 | - // 校验存在 | |
| 78 | - validateCouponTemplateExists(id); | |
| 79 | - // 更新 | |
| 80 | - couponTemplateMapper.updateById(new CouponTemplateDO().setId(id).setStatus(status)); | |
| 81 | - } | |
| 82 | - | |
| 83 | - @Override | |
| 84 | - public void deleteCouponTemplate(Long id) { | |
| 85 | - // 校验存在 | |
| 86 | - validateCouponTemplateExists(id); | |
| 87 | - // 删除 | |
| 88 | - couponTemplateMapper.deleteById(id); | |
| 89 | - } | |
| 90 | - | |
| 91 | - private CouponTemplateDO validateCouponTemplateExists(Long id) { | |
| 92 | - CouponTemplateDO couponTemplate = couponTemplateMapper.selectById(id); | |
| 93 | - if (couponTemplate == null) { | |
| 94 | - throw exception(COUPON_TEMPLATE_NOT_EXISTS); | |
| 95 | - } | |
| 96 | - return couponTemplate; | |
| 97 | - } | |
| 98 | - | |
| 99 | - private void validateProductScope(Integer productScope, List<Long> productScopeValues) { | |
| 100 | - if (Objects.equals(PromotionProductScopeEnum.SPU.getScope(), productScope)) { | |
| 101 | - productSpuApi.validateSpuList(productScopeValues); | |
| 102 | - } else if (Objects.equals(PromotionProductScopeEnum.CATEGORY.getScope(), productScope)) { | |
| 103 | - productCategoryApi.validateCategoryList(productScopeValues); | |
| 104 | - } | |
| 105 | - } | |
| 106 | - | |
| 107 | - @Override | |
| 108 | - public CouponTemplateDO getCouponTemplate(Long id) { | |
| 109 | - return couponTemplateMapper.selectById(id); | |
| 110 | - } | |
| 111 | - | |
| 112 | - @Override | |
| 113 | - public PageResult<CouponTemplateDO> getCouponTemplatePage(CouponTemplatePageReqVO pageReqVO) { | |
| 114 | - return couponTemplateMapper.selectPage(pageReqVO); | |
| 115 | - } | |
| 116 | - | |
| 117 | - @Override | |
| 118 | - public void updateCouponTemplateTakeCount(Long id, int incrCount) { | |
| 119 | - couponTemplateMapper.updateTakeCount(id, incrCount); | |
| 120 | - } | |
| 121 | - | |
| 122 | - @Override | |
| 123 | - public List<CouponTemplateDO> getCouponTemplateListByTakeType(CouponTakeTypeEnum takeType) { | |
| 124 | - return couponTemplateMapper.selectListByTakeType(takeType.getType()); | |
| 125 | - } | |
| 126 | - | |
| 127 | - @Override | |
| 128 | - public List<CouponTemplateDO> getCouponTemplateList(List<Integer> canTakeTypes, Integer productScope, | |
| 129 | - Long productScopeValue, Integer count) { | |
| 130 | - return couponTemplateMapper.selectList(canTakeTypes, productScope, productScopeValue, count); | |
| 131 | - } | |
| 132 | - | |
| 133 | - @Override | |
| 134 | - public List<CouponTemplateDO> getCouponTemplateList(Collection<Long> ids) { | |
| 135 | - return couponTemplateMapper.selectBatchIds(ids); | |
| 136 | - } | |
| 137 | - | |
| 138 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/discount/DiscountActivityService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.discount; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.discount.vo.DiscountActivityCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.discount.vo.DiscountActivityPageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.discount.vo.DiscountActivityUpdateReqVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.discount.DiscountActivityDO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.discount.DiscountProductDO; | |
| 9 | -import jakarta.validation.Valid; | |
| 10 | - | |
| 11 | -import java.util.Collection; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 限时折扣 Service 接口 | |
| 16 | - * | |
| 17 | - * @author 芋道源码 | |
| 18 | - */ | |
| 19 | -public interface DiscountActivityService { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 基于指定 SKU 编号数组,获得匹配的限时折扣商品 | |
| 23 | - * | |
| 24 | - * 注意,匹配的条件,仅仅是日期符合,并且处于开启状态 | |
| 25 | - * | |
| 26 | - * @param skuIds SKU 编号数组 | |
| 27 | - * @return 匹配的限时折扣商品 | |
| 28 | - */ | |
| 29 | - List<DiscountProductDO> getMatchDiscountProductListBySkuIds(Collection<Long> skuIds); | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 创建限时折扣活动 | |
| 33 | - * | |
| 34 | - * @param createReqVO 创建信息 | |
| 35 | - * @return 编号 | |
| 36 | - */ | |
| 37 | - Long createDiscountActivity(@Valid DiscountActivityCreateReqVO createReqVO); | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 更新限时折扣活动 | |
| 41 | - * | |
| 42 | - * @param updateReqVO 更新信息 | |
| 43 | - */ | |
| 44 | - void updateDiscountActivity(@Valid DiscountActivityUpdateReqVO updateReqVO); | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 关闭限时折扣活动 | |
| 48 | - * | |
| 49 | - * @param id 编号 | |
| 50 | - */ | |
| 51 | - void closeDiscountActivity(Long id); | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * 删除限时折扣活动 | |
| 55 | - * | |
| 56 | - * @param id 编号 | |
| 57 | - */ | |
| 58 | - void deleteDiscountActivity(Long id); | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * 获得限时折扣活动 | |
| 62 | - * | |
| 63 | - * @param id 编号 | |
| 64 | - * @return 限时折扣活动 | |
| 65 | - */ | |
| 66 | - DiscountActivityDO getDiscountActivity(Long id); | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * 获得限时折扣活动分页 | |
| 70 | - * | |
| 71 | - * @param pageReqVO 分页查询 | |
| 72 | - * @return 限时折扣活动分页 | |
| 73 | - */ | |
| 74 | - PageResult<DiscountActivityDO> getDiscountActivityPage(DiscountActivityPageReqVO pageReqVO); | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * 获得活动编号,对应对应的商品列表 | |
| 78 | - * | |
| 79 | - * @param activityId 活动编号 | |
| 80 | - * @return 活动的商品列表 | |
| 81 | - */ | |
| 82 | - List<DiscountProductDO> getDiscountProductsByActivityId(Long activityId); | |
| 83 | - | |
| 84 | - /** | |
| 85 | - * 获得活动编号,对应对应的商品列表 | |
| 86 | - * | |
| 87 | - * @param activityIds 活动编号 | |
| 88 | - * @return 活动的商品列表 | |
| 89 | - */ | |
| 90 | - List<DiscountProductDO> getDiscountProductsByActivityId(Collection<Long> activityIds); | |
| 91 | - | |
| 92 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyPageService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.diy; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageCreateReqVO; | |
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPagePageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPagePropertyUpdateRequestVO; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageUpdateReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; | |
| 9 | - | |
| 10 | -import jakarta.validation.Valid; | |
| 11 | -import java.util.Collection; | |
| 12 | -import java.util.List; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * 装修页面 Service 接口 | |
| 16 | - * | |
| 17 | - * @author owen | |
| 18 | - */ | |
| 19 | -public interface DiyPageService { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 创建装修页面 | |
| 23 | - * | |
| 24 | - * @param createReqVO 创建信息 | |
| 25 | - * @return 编号 | |
| 26 | - */ | |
| 27 | - Long createDiyPage(@Valid DiyPageCreateReqVO createReqVO); | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 更新装修页面 | |
| 31 | - * | |
| 32 | - * @param updateReqVO 更新信息 | |
| 33 | - */ | |
| 34 | - void updateDiyPage(@Valid DiyPageUpdateReqVO updateReqVO); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 删除装修页面 | |
| 38 | - * | |
| 39 | - * @param id 编号 | |
| 40 | - */ | |
| 41 | - void deleteDiyPage(Long id); | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * 获得装修页面 | |
| 45 | - * | |
| 46 | - * @param id 编号 | |
| 47 | - * @return 装修页面 | |
| 48 | - */ | |
| 49 | - DiyPageDO getDiyPage(Long id); | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * 获得装修页面列表 | |
| 53 | - * | |
| 54 | - * @param ids 编号 | |
| 55 | - * @return 装修页面列表 | |
| 56 | - */ | |
| 57 | - List<DiyPageDO> getDiyPageList(Collection<Long> ids); | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * 获得装修页面分页 | |
| 61 | - * | |
| 62 | - * @param pageReqVO 分页查询 | |
| 63 | - * @return 装修页面分页 | |
| 64 | - */ | |
| 65 | - PageResult<DiyPageDO> getDiyPagePage(DiyPagePageReqVO pageReqVO); | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * 更新装修页面属性 | |
| 69 | - * | |
| 70 | - * @param updateReqVO 更新信息 | |
| 71 | - */ | |
| 72 | - void updateDiyPageProperty(DiyPagePropertyUpdateRequestVO updateReqVO); | |
| 73 | - | |
| 74 | - /** | |
| 75 | - * 获得模板所属的页面列表 | |
| 76 | - * | |
| 77 | - * @param templateId 模板编号 | |
| 78 | - * @return 装修页面列表 | |
| 79 | - */ | |
| 80 | - List<DiyPageDO> getDiyPageByTemplateId(Long templateId); | |
| 81 | - | |
| 82 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyPageServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.diy; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.collection.ListUtil; | |
| 5 | -import cn.hutool.core.util.StrUtil; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 7 | -import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageCreateReqVO; | |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPagePageReqVO; | |
| 9 | -import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPagePropertyUpdateRequestVO; | |
| 10 | -import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageUpdateReqVO; | |
| 11 | -import cn.iocoder.yudao.module.promotion.convert.diy.DiyPageConvert; | |
| 12 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; | |
| 13 | -import cn.iocoder.yudao.module.promotion.dal.mysql.diy.DiyPageMapper; | |
| 14 | -import org.springframework.stereotype.Service; | |
| 15 | -import org.springframework.validation.annotation.Validated; | |
| 16 | - | |
| 17 | -import jakarta.annotation.Resource; | |
| 18 | -import java.util.Collection; | |
| 19 | -import java.util.List; | |
| 20 | - | |
| 21 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 22 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.DIY_PAGE_NAME_USED; | |
| 23 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.DIY_PAGE_NOT_EXISTS; | |
| 24 | - | |
| 25 | -/** | |
| 26 | - * 装修页面 Service 实现类 | |
| 27 | - * | |
| 28 | - * @author owen | |
| 29 | - */ | |
| 30 | -@Service | |
| 31 | -@Validated | |
| 32 | -public class DiyPageServiceImpl implements DiyPageService { | |
| 33 | - | |
| 34 | - @Resource | |
| 35 | - private DiyPageMapper diyPageMapper; | |
| 36 | - | |
| 37 | - @Override | |
| 38 | - public Long createDiyPage(DiyPageCreateReqVO createReqVO) { | |
| 39 | - // 校验名称唯一 | |
| 40 | - validateNameUnique(null, createReqVO.getTemplateId(), createReqVO.getName()); | |
| 41 | - // 插入 | |
| 42 | - DiyPageDO diyPage = DiyPageConvert.INSTANCE.convert(createReqVO); | |
| 43 | - diyPage.setProperty("{}"); | |
| 44 | - diyPageMapper.insert(diyPage); | |
| 45 | - return diyPage.getId(); | |
| 46 | - } | |
| 47 | - | |
| 48 | - @Override | |
| 49 | - public void updateDiyPage(DiyPageUpdateReqVO updateReqVO) { | |
| 50 | - // 校验存在 | |
| 51 | - validateDiyPageExists(updateReqVO.getId()); | |
| 52 | - // 校验名称唯一 | |
| 53 | - validateNameUnique(updateReqVO.getId(), updateReqVO.getTemplateId(), updateReqVO.getName()); | |
| 54 | - // 更新 | |
| 55 | - DiyPageDO updateObj = DiyPageConvert.INSTANCE.convert(updateReqVO); | |
| 56 | - diyPageMapper.updateById(updateObj); | |
| 57 | - } | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * 校验 Page 页面,在一个 template 模版下的名字是唯一的 | |
| 61 | - * | |
| 62 | - * @param id Page 编号 | |
| 63 | - * @param templateId 模版编号 | |
| 64 | - * @param name Page 名字 | |
| 65 | - */ | |
| 66 | - void validateNameUnique(Long id, Long templateId, String name) { | |
| 67 | - if (templateId != null || StrUtil.isBlank(name)) { | |
| 68 | - return; | |
| 69 | - } | |
| 70 | - DiyPageDO page = diyPageMapper.selectByNameAndTemplateIdIsNull(name); | |
| 71 | - if (page == null) { | |
| 72 | - return; | |
| 73 | - } | |
| 74 | - // 如果 id 为空,说明不用比较是否为相同 id 的页面 | |
| 75 | - if (id == null) { | |
| 76 | - throw exception(DIY_PAGE_NAME_USED, name); | |
| 77 | - } | |
| 78 | - if (!page.getId().equals(id)) { | |
| 79 | - throw exception(DIY_PAGE_NAME_USED, name); | |
| 80 | - } | |
| 81 | - } | |
| 82 | - | |
| 83 | - @Override | |
| 84 | - public void deleteDiyPage(Long id) { | |
| 85 | - // 校验存在 | |
| 86 | - validateDiyPageExists(id); | |
| 87 | - // 删除 | |
| 88 | - diyPageMapper.deleteById(id); | |
| 89 | - } | |
| 90 | - | |
| 91 | - private void validateDiyPageExists(Long id) { | |
| 92 | - if (diyPageMapper.selectById(id) == null) { | |
| 93 | - throw exception(DIY_PAGE_NOT_EXISTS); | |
| 94 | - } | |
| 95 | - } | |
| 96 | - | |
| 97 | - @Override | |
| 98 | - public DiyPageDO getDiyPage(Long id) { | |
| 99 | - return diyPageMapper.selectById(id); | |
| 100 | - } | |
| 101 | - | |
| 102 | - @Override | |
| 103 | - public List<DiyPageDO> getDiyPageList(Collection<Long> ids) { | |
| 104 | - if (CollUtil.isEmpty(ids)) { | |
| 105 | - return ListUtil.empty(); | |
| 106 | - } | |
| 107 | - return diyPageMapper.selectBatchIds(ids); | |
| 108 | - } | |
| 109 | - | |
| 110 | - @Override | |
| 111 | - public PageResult<DiyPageDO> getDiyPagePage(DiyPagePageReqVO pageReqVO) { | |
| 112 | - return diyPageMapper.selectPage(pageReqVO); | |
| 113 | - } | |
| 114 | - | |
| 115 | - @Override | |
| 116 | - public List<DiyPageDO> getDiyPageByTemplateId(Long templateId) { | |
| 117 | - return diyPageMapper.selectListByTemplateId(templateId); | |
| 118 | - } | |
| 119 | - | |
| 120 | - @Override | |
| 121 | - public void updateDiyPageProperty(DiyPagePropertyUpdateRequestVO updateReqVO) { | |
| 122 | - // 校验存在 | |
| 123 | - validateDiyPageExists(updateReqVO.getId()); | |
| 124 | - // 更新 | |
| 125 | - DiyPageDO updateObj = DiyPageConvert.INSTANCE.convert(updateReqVO); | |
| 126 | - diyPageMapper.updateById(updateObj); | |
| 127 | - } | |
| 128 | - | |
| 129 | -} |