MALL-PROMOTION:同步 jdk21 boot 最新代码

pull/95/MERGE
YunaiV 2024-01-19 21:46:18 +08:00
parent f612b6ebdd
commit b71180ef47
162 changed files with 2204 additions and 639 deletions

View File

@ -116,4 +116,13 @@ public interface ErrorCodeConstants {
// ========== 文章管理 1-013-016-000 ========== // ========== 文章管理 1-013-016-000 ==========
ErrorCode ARTICLE_NOT_EXISTS = new ErrorCode(1_013_016_000, "文章不存在"); ErrorCode ARTICLE_NOT_EXISTS = new ErrorCode(1_013_016_000, "文章不存在");
// ========== 装修模板 1-013-017-000 ==========
ErrorCode DIY_TEMPLATE_NOT_EXISTS = new ErrorCode(1_013_017_000, "装修模板不存在");
ErrorCode DIY_TEMPLATE_NAME_USED = new ErrorCode(1_013_017_001, "装修模板名称({})已经被使用");
ErrorCode DIY_TEMPLATE_USED_CANNOT_DELETE = new ErrorCode(1_013_017_002, "不能删除正在使用的装修模板");
// ========== 装修页面 1-013-018-000 ==========
ErrorCode DIY_PAGE_NOT_EXISTS = new ErrorCode(1_013_018_000, "装修页面不存在");
ErrorCode DIY_PAGE_NAME_USED = new ErrorCode(1_013_018_001, "装修页面名称({})已经被使用");
} }

View File

@ -6,6 +6,7 @@ import lombok.Getter;
import java.util.Arrays; import java.util.Arrays;
// TODO 芋艿:弱化这个状态
/** /**
* *
* *

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.promotion.enums.diy;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
*
*
* @author jason
*/
@AllArgsConstructor
@Getter
public enum DiyPageEnum implements IntArrayValuable {
INDEX(1, "首页"),
MY(2, "我的"),
;
private static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DiyPageEnum::getPage).toArray();
/**
*
*/
private final Integer page;
/**
*
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -27,22 +27,22 @@ import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.COMBINA
public class CombinationRecordApiImpl implements CombinationRecordApi { public class CombinationRecordApiImpl implements CombinationRecordApi {
@Resource @Resource
private CombinationRecordService recordService; private CombinationRecordService combinationRecordService;
@Override @Override
public CommonResult<Boolean> validateCombinationRecord(Long userId, Long activityId, Long headId, Long skuId, Integer count) { public CommonResult<Boolean> validateCombinationRecord(Long userId, Long activityId, Long headId, Long skuId, Integer count) {
recordService.validateCombinationRecord(userId, activityId, headId, skuId, count); combinationRecordService.validateCombinationRecord(userId, activityId, headId, skuId, count);
return success(true); return success(true);
} }
@Override @Override
public CommonResult<CombinationRecordCreateRespDTO> createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) { public CommonResult<CombinationRecordCreateRespDTO> createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) {
return success(CombinationActivityConvert.INSTANCE.convert4(recordService.createCombinationRecord(reqDTO))); return success(CombinationActivityConvert.INSTANCE.convert4(combinationRecordService.createCombinationRecord(reqDTO)));
} }
@Override @Override
public CommonResult<Boolean> isCombinationRecordSuccess(Long userId, Long orderId) { public CommonResult<Boolean> isCombinationRecordSuccess(Long userId, Long orderId) {
CombinationRecordDO record = recordService.getCombinationRecord(userId, orderId); CombinationRecordDO record = combinationRecordService.getCombinationRecord(userId, orderId);
if (record == null) { if (record == null) {
throw exception(COMBINATION_RECORD_NOT_EXISTS); throw exception(COMBINATION_RECORD_NOT_EXISTS);
} }
@ -52,7 +52,7 @@ public class CombinationRecordApiImpl implements CombinationRecordApi {
@Override @Override
public CommonResult<CombinationValidateJoinRespDTO> validateJoinCombination( public CommonResult<CombinationValidateJoinRespDTO> validateJoinCombination(
Long userId, Long activityId, Long headId, Long skuId, Integer count) { Long userId, Long activityId, Long headId, Long skuId, Integer count) {
return success(recordService.validateJoinCombination(userId, activityId, headId, skuId, count)); return success(combinationRecordService.validateJoinCombination(userId, activityId, headId, skuId, count));
} }
} }

View File

@ -10,12 +10,12 @@ import cn.iocoder.yudao.module.promotion.service.article.ArticleCategoryService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;

View File

@ -12,13 +12,12 @@ import cn.iocoder.yudao.module.promotion.service.article.ArticleService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 文章管理") @Tag(name = "管理后台 - 文章管理")

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article; package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
/** /**
* Base VO VO 使 * Base VO VO 使

View File

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article; package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 文章管理更新 Request VO") @Schema(description = "管理后台 - 文章管理更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category; package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
/** /**
* Base VO VO 使 * Base VO VO 使

View File

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category; package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 文章分类更新 Request VO") @Schema(description = "管理后台 - 文章分类更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -12,13 +12,12 @@ import cn.iocoder.yudao.module.promotion.service.banner.BannerService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - Banner 管理") @Tag(name = "管理后台 - Banner 管理")

View File

@ -4,9 +4,8 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.enums.banner.BannerPositionEnum; import cn.iocoder.yudao.module.promotion.enums.banner.BannerPositionEnum;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
/** /**
* Banner Base VO VO 使 * Banner Base VO VO 使

View File

@ -19,11 +19,10 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true) @ToString(callSuper = true)
public class BannerPageReqVO extends PageParam { public class BannerPageReqVO extends PageParam {
// TODO @puhui999example @Schema(description = "标题", example = "这是一个标题")
@Schema(description = "标题")
private String title; private String title;
@Schema(description = "状态") @Schema(description = "状态", example = "1")
@InEnum(CommonStatusEnum.class) @InEnum(CommonStatusEnum.class)
private Integer status; private Integer status;

View File

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.admin.banner.vo; package cn.iocoder.yudao.module.promotion.controller.admin.banner.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotNull;
/** /**
* @author xia * @author xia
*/ */

View File

@ -15,12 +15,12 @@ import cn.iocoder.yudao.module.promotion.service.bargain.BargainRecordService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -59,6 +59,15 @@ public class BargainActivityController {
return success(true); return success(true);
} }
@PutMapping("/close")
@Operation(summary = "关闭砍价活动")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('promotion:bargain-activity:close')")
public CommonResult<Boolean> closeSeckillActivity(@RequestParam("id") Long id) {
bargainActivityService.closeBargainActivityById(id);
return success(true);
}
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除砍价活动") @Operation(summary = "删除砍价活动")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)

View File

@ -12,14 +12,14 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainHelpDO;
import cn.iocoder.yudao.module.promotion.service.bargain.BargainHelpService; import cn.iocoder.yudao.module.promotion.service.bargain.BargainHelpService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.Map; import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

View File

@ -15,14 +15,14 @@ import cn.iocoder.yudao.module.promotion.service.bargain.BargainHelpService;
import cn.iocoder.yudao.module.promotion.service.bargain.BargainRecordService; import cn.iocoder.yudao.module.promotion.service.bargain.BargainRecordService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity; package cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity; package cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "管理后台 - 砍价活动的分页项 Response VO") @Schema(description = "管理后台 - 砍价活动的分页项 Response VO")

View File

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity; package cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 砍价活动更新 Request VO") @Schema(description = "管理后台 - 砍价活动更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -1,7 +1,10 @@
package cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.help; package cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.help;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "管理后台 - 砍价助力 Response VO") @Schema(description = "管理后台 - 砍价助力 Response VO")

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.recrod; package cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.recrod;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

View File

@ -16,12 +16,12 @@ import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordSe
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -59,6 +59,15 @@ public class CombinationActivityController {
return success(true); return success(true);
} }
@PutMapping("/close")
@Operation(summary = "关闭拼团活动")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('promotion:combination-activity:close')")
public CommonResult<Boolean> closeCombinationActivity(@RequestParam("id") Long id) {
combinationActivityService.closeCombinationActivityById(id);
return success(true);
}
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除拼团活动") @Operation(summary = "删除拼团活动")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)

View File

@ -14,6 +14,8 @@ import cn.iocoder.yudao.module.promotion.service.combination.CombinationActivity
import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordService; import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -21,8 +23,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -43,7 +43,8 @@ public class CombinationRecordController {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得拼团记录分页") @Operation(summary = "获得拼团记录分页")
@PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')")
public CommonResult<PageResult<CombinationRecordPageItemRespVO>> getBargainRecordPage(@Valid CombinationRecordReqPageVO pageVO) { public CommonResult<PageResult<CombinationRecordPageItemRespVO>> getCombinationRecordPage(
@Valid CombinationRecordReqPageVO pageVO) {
PageResult<CombinationRecordDO> recordPage = combinationRecordService.getCombinationRecordPage(pageVO); PageResult<CombinationRecordDO> recordPage = combinationRecordService.getCombinationRecordPage(pageVO);
// 拼接数据 // 拼接数据
List<CombinationActivityDO> activities = combinationActivityService.getCombinationActivityListByIds( List<CombinationActivityDO> activities = combinationActivityService.getCombinationActivityListByIds(

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity; package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

View File

@ -2,11 +2,11 @@ package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activi
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductBaseVO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductBaseVO;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.Valid;
import java.util.List; import java.util.List;
@Schema(description = "管理后台 - 拼团活动创建 Request VO") @Schema(description = "管理后台 - 拼团活动创建 Request VO")

View File

@ -2,12 +2,12 @@ package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activi
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductBaseVO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductBaseVO;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.List; import java.util.List;
@Schema(description = "管理后台 - 拼团活动更新 Request VO") @Schema(description = "管理后台 - 拼团活动更新 Request VO")

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product; package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
/** /**
* Base VO VO 使 * Base VO VO 使

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod; package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

View File

@ -2,12 +2,11 @@ package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 拼团记录分页 Request VO") @Schema(description = "管理后台 - 拼团记录分页 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -15,12 +15,12 @@ import cn.iocoder.yudao.module.promotion.service.coupon.CouponService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.Map; import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

View File

@ -9,12 +9,14 @@ import cn.iocoder.yudao.module.promotion.service.coupon.CouponTemplateService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource; import java.util.Collection;
import jakarta.validation.Valid; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -75,4 +77,14 @@ public class CouponTemplateController {
PageResult<CouponTemplateDO> pageResult = couponTemplateService.getCouponTemplatePage(pageVO); PageResult<CouponTemplateDO> pageResult = couponTemplateService.getCouponTemplatePage(pageVO);
return success(CouponTemplateConvert.INSTANCE.convertPage(pageResult)); return success(CouponTemplateConvert.INSTANCE.convertPage(pageResult));
} }
@GetMapping("/list")
@Operation(summary = "获得优惠劵模板列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('promotion:coupon-template:query')")
public CommonResult<List<CouponTemplateRespVO>> getCouponTemplateList(@RequestParam("ids") Collection<Long> ids) {
List<CouponTemplateDO> list = couponTemplateService.getCouponTemplateList(ids);
return success(CouponTemplateConvert.INSTANCE.convertList(list));
}
} }

View File

@ -5,11 +5,11 @@ import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum; import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon; package cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.Set; import java.util.Set;
@Schema(description = "管理后台 - 优惠劵发放 Request VO") @Schema(description = "管理后台 - 优惠劵发放 Request VO")

View File

@ -9,12 +9,12 @@ import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTemplateValidityType
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.AssertTrue; import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Min; import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;

View File

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template; package cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 优惠劵模板更新 Request VO") @Schema(description = "管理后台 - 优惠劵模板更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -3,9 +3,8 @@ package cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "管理后台 - 优惠劵模板更新状态 Request VO") @Schema(description = "管理后台 - 优惠劵模板更新状态 Request VO")
@Data @Data

View File

@ -1,18 +0,0 @@
### /promotion/decorate/save 保存页面装修组件
POST {{baseUrl}}/promotion/decorate/save
Content-Type: application/json
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
{
"page": 1,
"code": "slide-show",
"status": 0,
"value": "null"
}
### /promotion/decorate/list 获取指定页面的组件列表
GET {{baseUrl}}/promotion/decorate/list?page=1
Content-Type: application/json
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}

View File

@ -1,50 +0,0 @@
package cn.iocoder.yudao.module.promotion.controller.admin.decorate;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentRespVO;
import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO;
import cn.iocoder.yudao.module.promotion.convert.decorate.DecorateComponentConvert;
import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum;
import cn.iocoder.yudao.module.promotion.service.decorate.DecorateComponentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 店铺页面装修")
@RestController
@RequestMapping("/promotion/decorate")
@Validated
public class DecorateComponentController {
@Resource
private DecorateComponentService decorateComponentService;
@PostMapping("/save")
@Operation(summary = "保存页面装修组件")
@PreAuthorize("@ss.hasPermission('promotion:decorate:save')")
public CommonResult<Boolean> saveDecorateComponent(@Valid @RequestBody DecorateComponentSaveReqVO reqVO) {
decorateComponentService.saveDecorateComponent(reqVO);
return success(true);
}
@GetMapping("/list")
@Operation(summary = "获取指定页面的组件列表")
@Parameter(name = "page", description = "页面 id", required = true)
@PreAuthorize("@ss.hasPermission('promotion:decorate:query')")
public CommonResult<List<DecorateComponentRespVO>> getDecorateComponentListByPage(
@RequestParam("page") @InEnum(DecoratePageEnum.class) Integer page) {
return success(DecorateComponentConvert.INSTANCE.convertList02(
decorateComponentService.getDecorateComponentListByPage(page, null)));
}
}

View File

@ -1,19 +0,0 @@
package cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 页面装修 Resp VO")
@Data
public class DecorateComponentRespVO {
@Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu")
private String code;
@Schema(description = "组件的内容配置项", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "TODO")
private String value;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status;
}

View File

@ -1,31 +0,0 @@
package cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 页面装修的保存 Request VO ")
@Data
public class DecorateComponentSaveReqVO {
@Schema(description = "页面 id ", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "页面 id 不能为空")
@InEnum(DecoratePageEnum.class)
private Integer page;
@Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu")
@NotEmpty(message = "组件编码不能为空")
private String code;
@Schema(description = "组件对应值, json 字符串, 含内容配置,具体数据", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "组件值为空")
private String value;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status;
}

View File

@ -13,12 +13,12 @@ import cn.iocoder.yudao.module.promotion.service.discount.DiscountActivityServic
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

View File

@ -5,12 +5,12 @@ import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum; import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.AssertTrue; import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Min; import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

View File

@ -1,12 +1,12 @@
package cn.iocoder.yudao.module.promotion.controller.admin.discount.vo; package cn.iocoder.yudao.module.promotion.controller.admin.discount.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import java.util.List; import java.util.List;
@Schema(description = "管理后台 - 限时折扣活动创建 Request VO") @Schema(description = "管理后台 - 限时折扣活动创建 Request VO")

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.admin.discount.vo; package cn.iocoder.yudao.module.promotion.controller.admin.discount.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@ -30,7 +30,7 @@ public class DiscountActivityRespVO extends DiscountActivityBaseVO {
private Long spuId; private Long spuId;
@Schema(description = "限时折扣商品", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "限时折扣商品", requiredMode = Schema.RequiredMode.REQUIRED)
private List<DiscountActivityBaseVO.Product> products; private List<Product> products;
// ========== 商品字段 ========== // ========== 商品字段 ==========

View File

@ -1,13 +1,13 @@
package cn.iocoder.yudao.module.promotion.controller.admin.discount.vo; package cn.iocoder.yudao.module.promotion.controller.admin.discount.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.List; import java.util.List;
@Schema(description = "管理后台 - 限时折扣活动更新 Request VO") @Schema(description = "管理后台 - 限时折扣活动更新 Request VO")
@ -25,6 +25,6 @@ public class DiscountActivityUpdateReqVO extends DiscountActivityBaseVO {
*/ */
@NotEmpty(message = "商品列表不能为空") @NotEmpty(message = "商品列表不能为空")
@Valid @Valid
private List<DiscountActivityCreateReqVO.Product> products; private List<Product> products;
} }

View File

@ -0,0 +1,99 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.*;
import cn.iocoder.yudao.module.promotion.convert.diy.DiyPageConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO;
import cn.iocoder.yudao.module.promotion.service.diy.DiyPageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 装修页面")
@RestController
@RequestMapping("/promotion/diy-page")
@Validated
public class DiyPageController {
@Resource
private DiyPageService diyPageService;
@PostMapping("/create")
@Operation(summary = "创建装修页面")
@PreAuthorize("@ss.hasPermission('promotion:diy-page:create')")
public CommonResult<Long> createDiyPage(@Valid @RequestBody DiyPageCreateReqVO createReqVO) {
return success(diyPageService.createDiyPage(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新装修页面")
@PreAuthorize("@ss.hasPermission('promotion:diy-page:update')")
public CommonResult<Boolean> updateDiyPage(@Valid @RequestBody DiyPageUpdateReqVO updateReqVO) {
diyPageService.updateDiyPage(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除装修页面")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('promotion:diy-page:delete')")
public CommonResult<Boolean> deleteDiyPage(@RequestParam("id") Long id) {
diyPageService.deleteDiyPage(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得装修页面")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('promotion:diy-page:query')")
public CommonResult<DiyPageRespVO> getDiyPage(@RequestParam("id") Long id) {
DiyPageDO diyPage = diyPageService.getDiyPage(id);
return success(DiyPageConvert.INSTANCE.convert(diyPage));
}
@GetMapping("/list")
@Operation(summary = "获得装修页面列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('promotion:diy-page:query')")
public CommonResult<List<DiyPageRespVO>> getDiyPageList(@RequestParam("ids") Collection<Long> ids) {
List<DiyPageDO> list = diyPageService.getDiyPageList(ids);
return success(DiyPageConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得装修页面分页")
@PreAuthorize("@ss.hasPermission('promotion:diy-page:query')")
public CommonResult<PageResult<DiyPageRespVO>> getDiyPagePage(@Valid DiyPagePageReqVO pageVO) {
PageResult<DiyPageDO> pageResult = diyPageService.getDiyPagePage(pageVO);
return success(DiyPageConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/get-property")
@Operation(summary = "获得装修页面属性")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('promotion:diy-page:query')")
public CommonResult<DiyPagePropertyRespVO> getDiyPageProperty(@RequestParam("id") Long id) {
DiyPageDO diyPage = diyPageService.getDiyPage(id);
return success(DiyPageConvert.INSTANCE.convertPropertyVo(diyPage));
}
@PutMapping("/update-property")
@Operation(summary = "更新装修页面属性")
@PreAuthorize("@ss.hasPermission('promotion:diy-page:update')")
public CommonResult<Boolean> updateDiyPageProperty(@Valid @RequestBody DiyPagePropertyUpdateRequestVO updateReqVO) {
diyPageService.updateDiyPageProperty(updateReqVO);
return success(true);
}
}

View File

@ -0,0 +1,104 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.*;
import cn.iocoder.yudao.module.promotion.convert.diy.DiyTemplateConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO;
import cn.iocoder.yudao.module.promotion.service.diy.DiyPageService;
import cn.iocoder.yudao.module.promotion.service.diy.DiyTemplateService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 装修模板")
@RestController
@RequestMapping("/promotion/diy-template")
@Validated
public class DiyTemplateController {
@Resource
private DiyTemplateService diyTemplateService;
@Resource
private DiyPageService diyPageService;
@PostMapping("/create")
@Operation(summary = "创建装修模板")
@PreAuthorize("@ss.hasPermission('promotion:diy-template:create')")
public CommonResult<Long> createDiyTemplate(@Valid @RequestBody DiyTemplateCreateReqVO createReqVO) {
return success(diyTemplateService.createDiyTemplate(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新装修模板")
@PreAuthorize("@ss.hasPermission('promotion:diy-template:update')")
public CommonResult<Boolean> updateDiyTemplate(@Valid @RequestBody DiyTemplateUpdateReqVO updateReqVO) {
diyTemplateService.updateDiyTemplate(updateReqVO);
return success(true);
}
@PutMapping("/use")
@Operation(summary = "使用装修模板")
@PreAuthorize("@ss.hasPermission('promotion:diy-template:use')")
public CommonResult<Boolean> useDiyTemplate(@RequestParam("id") Long id) {
diyTemplateService.useDiyTemplate(id);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除装修模板")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('promotion:diy-template:delete')")
public CommonResult<Boolean> deleteDiyTemplate(@RequestParam("id") Long id) {
diyTemplateService.deleteDiyTemplate(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得装修模板")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('promotion:diy-template:query')")
public CommonResult<DiyTemplateRespVO> getDiyTemplate(@RequestParam("id") Long id) {
DiyTemplateDO diyTemplate = diyTemplateService.getDiyTemplate(id);
return success(DiyTemplateConvert.INSTANCE.convert(diyTemplate));
}
@GetMapping("/page")
@Operation(summary = "获得装修模板分页")
@PreAuthorize("@ss.hasPermission('promotion:diy-template:query')")
public CommonResult<PageResult<DiyTemplateRespVO>> getDiyTemplatePage(@Valid DiyTemplatePageReqVO pageVO) {
PageResult<DiyTemplateDO> pageResult = diyTemplateService.getDiyTemplatePage(pageVO);
return success(DiyTemplateConvert.INSTANCE.convertPage(pageResult));
}
// TODO @疯狂:这个要不和 getDiyTemplate 合并,然后 DiyTemplateRespVO 里面直接把 DiyPagePropertyRespVO 也加上。减少 VO 好了,管理后台 get 多返回点数据,也问题不大的。目的,还是想尽可能降低大家的理解成本哈;
@GetMapping("/get-property")
@Operation(summary = "获得装修模板属性")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('promotion:diy-template:query')")
public CommonResult<DiyTemplatePropertyRespVO> getDiyTemplateProperty(@RequestParam("id") Long id) {
DiyTemplateDO diyTemplate = diyTemplateService.getDiyTemplate(id);
List<DiyPageDO> pages = diyPageService.getDiyPageByTemplateId(id);
return success(DiyTemplateConvert.INSTANCE.convertPropertyVo(diyTemplate, pages));
}
// TODO @疯狂:这个接口,要不和 useDiyTemplate 合并成一个,然后 VO 改成我们新的 VO 规范。不改的字段,就不传递。
@PutMapping("/update-property")
@Operation(summary = "更新装修模板属性")
@PreAuthorize("@ss.hasPermission('promotion:diy-template:update')")
public CommonResult<Boolean> updateDiyTemplateProperty(@Valid @RequestBody DiyTemplatePropertyUpdateRequestVO updateReqVO) {
diyTemplateService.updateDiyTemplateProperty(updateReqVO);
return success(true);
}
}

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.List;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class DiyPageBaseVO {
@Schema(description = "装修模板编号", example = "26179")
private Long templateId;
@Schema(description = "页面名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotNull(message = "页面名称不能为空")
private String name;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "预览图")
private List<String> previewPicUrls;
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 装修页面创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DiyPageCreateReqVO extends DiyPageBaseVO {
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 装修页面分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DiyPagePageReqVO extends PageParam {
@Schema(description = "页面名称", example = "王五")
private String name;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 装修页面属性 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DiyPagePropertyRespVO extends DiyPageBaseVO {
@Schema(description = "装修页面编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31209")
private Long id;
@Schema(description = "页面属性", example = "[]")
private String property;
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.ToString;
@Schema(description = "管理后台 - 装修页面属性更新 Request VO")
@Data
@ToString(callSuper = true)
public class DiyPagePropertyUpdateRequestVO {
@Schema(description = "装修页面编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31209")
@NotNull(message = "装修页面编号不能为空")
private Long id;
@Schema(description = "页面属性JSON 格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}")
@NotBlank(message = "页面属性不能为空")
private String property;
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 装修页面 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DiyPageRespVO extends DiyPageBaseVO {
@Schema(description = "装修页面编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12082")
private Long id;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 装修页面更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DiyPageUpdateReqVO extends DiyPageBaseVO {
@Schema(description = "装修页面编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12082")
@NotNull(message = "装修页面编号不能为空")
private Long id;
}

View File

@ -0,0 +1,26 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import java.util.List;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class DiyTemplateBaseVO {
@Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "默认主题")
@NotEmpty(message = "模板名称不能为空")
private String name;
@Schema(description = "备注", example = "默认主题")
private String remark;
@Schema(description = "预览图", example = "[https://www.iocoder.cn/1.jpg]")
private List<String> previewPicUrls;
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 装修模板创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DiyTemplateCreateReqVO extends DiyTemplateBaseVO {
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 装修模板分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DiyTemplatePageReqVO extends PageParam {
@Schema(description = "模板名称", example = "默认主题")
private String name;
@Schema(description = "是否使用", example = "true")
private Boolean used;
@Schema(description = "使用时间", example = "使用时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] usedTime;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,26 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template;
import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPagePropertyRespVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.List;
@Schema(description = "管理后台 - 装修模板属性 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DiyTemplatePropertyRespVO extends DiyTemplateBaseVO {
@Schema(description = "装修模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31209")
private Long id;
@Schema(description = "模板属性JSON 格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}")
private String property;
@Schema(description = "模板页面", requiredMode = Schema.RequiredMode.REQUIRED, example = "[]")
private List<DiyPagePropertyRespVO> pages;
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.ToString;
@Schema(description = "管理后台 - 装修模板属性更新 Request VO")
@Data
@ToString(callSuper = true)
public class DiyTemplatePropertyUpdateRequestVO {
@Schema(description = "装修模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31209")
@NotNull(message = "装修模板编号不能为空")
private Long id;
@Schema(description = "模板属性JSON 格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}")
@NotBlank(message = "模板属性不能为空")
private String property;
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 装修模板 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DiyTemplateRespVO extends DiyTemplateBaseVO {
@Schema(description = "装修模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31209")
private Long id;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "是否使用", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
private Boolean used;
@Schema(description = "使用时间", example = "使用时间")
private LocalDateTime usedTime;
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 装修模板更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DiyTemplateUpdateReqVO extends DiyTemplateBaseVO {
@Schema(description = "装修模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31209")
@NotNull(message = "装修模板编号不能为空")
private Long id;
}

View File

@ -12,13 +12,12 @@ import cn.iocoder.yudao.module.promotion.service.reward.RewardActivityService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 满减送活动") @Tag(name = "管理后台 - 满减送活动")

View File

@ -3,16 +3,17 @@ package cn.iocoder.yudao.module.promotion.controller.admin.reward.vo;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionConditionTypeEnum; import cn.iocoder.yudao.module.promotion.enums.common.PromotionConditionTypeEnum;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.AssertTrue; import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Future; import jakarta.validation.constraints.Future;
import jakarta.validation.constraints.Min; import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@ -50,7 +51,7 @@ public class RewardActivityBaseVO {
@Schema(description = "商品范围", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "商品范围", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "商品范围不能为空") @NotNull(message = "商品范围不能为空")
@InEnum(value = PromotionConditionTypeEnum.class, message = "商品范围必须是 {value}") @InEnum(value = PromotionProductScopeEnum.class, message = "商品范围必须是 {value}")
private Integer productScope; private Integer productScope;
@Schema(description = "商品 SPU 编号的数组", example = "1,2,3") @Schema(description = "商品 SPU 编号的数组", example = "1,2,3")

View File

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.admin.reward.vo; package cn.iocoder.yudao.module.promotion.controller.admin.reward.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 满减送活动更新 Request VO") @Schema(description = "管理后台 - 满减送活动更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -13,12 +13,12 @@ import cn.iocoder.yudao.module.promotion.service.seckill.SeckillActivityService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

View File

@ -10,12 +10,12 @@ import cn.iocoder.yudao.module.promotion.service.seckill.SeckillConfigService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity; package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;

View File

@ -2,10 +2,10 @@ package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.AssertTrue; import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.List; import java.util.List;

View File

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config; package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 秒杀时段配置精简信息 Response VO") @Schema(description = "管理后台 - 秒杀时段配置精简信息 Response VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config; package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 秒杀时段更新 Request VO") @Schema(description = "管理后台 - 秒杀时段更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -3,9 +3,8 @@ package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "管理后台 - 修改时段配置状态 Request VO") @Schema(description = "管理后台 - 修改时段配置状态 Request VO")
@Data @Data

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product; package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
/** /**
* Base VO VO 使 * Base VO VO 使

View File

@ -7,26 +7,33 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.controller.app.activity.vo.AppActivityRespVO; import cn.iocoder.yudao.module.promotion.controller.app.activity.vo.AppActivityRespVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.discount.DiscountActivityDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.discount.DiscountProductDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.reward.RewardActivityDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillActivityDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillActivityDO;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionActivityStatusEnum;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionTypeEnum; import cn.iocoder.yudao.module.promotion.enums.common.PromotionTypeEnum;
import cn.iocoder.yudao.module.promotion.service.bargain.BargainActivityService; import cn.iocoder.yudao.module.promotion.service.bargain.BargainActivityService;
import cn.iocoder.yudao.module.promotion.service.combination.CombinationActivityService; import cn.iocoder.yudao.module.promotion.service.combination.CombinationActivityService;
import cn.iocoder.yudao.module.promotion.service.discount.DiscountActivityService;
import cn.iocoder.yudao.module.promotion.service.reward.RewardActivityService;
import cn.iocoder.yudao.module.promotion.service.seckill.SeckillActivityService; import cn.iocoder.yudao.module.promotion.service.seckill.SeckillActivityService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
@Tag(name = "用户 APP - 营销活动") // 用于提供跨多个活动的 HTTP 接口 @Tag(name = "用户 APP - 营销活动") // 用于提供跨多个活动的 HTTP 接口
@RestController @RestController
@ -40,6 +47,10 @@ public class AppActivityController {
private SeckillActivityService seckillActivityService; private SeckillActivityService seckillActivityService;
@Resource @Resource
private BargainActivityService bargainActivityService; private BargainActivityService bargainActivityService;
@Resource
private DiscountActivityService discountActivityService;
@Resource
private RewardActivityService rewardActivityService;
@GetMapping("/list-by-spu-id") @GetMapping("/list-by-spu-id")
@Operation(summary = "获得单个商品,近期参与的每个活动") @Operation(summary = "获得单个商品,近期参与的每个活动")
@ -64,42 +75,98 @@ public class AppActivityController {
if (CollUtil.isEmpty(spuIds)) { if (CollUtil.isEmpty(spuIds)) {
return new ArrayList<>(); return new ArrayList<>();
} }
LocalDateTime now = LocalDateTime.now(); // 获取开启的且开始的且没有结束的活动
List<AppActivityRespVO> activityList = new ArrayList<>(); List<AppActivityRespVO> activityList = new ArrayList<>();
LocalDateTime now = LocalDateTime.now();
// 1. 拼团活动 - 获取开启的且开始的且没有结束的活动 // 1. 拼团活动
List<CombinationActivityDO> combinationActivities = combinationActivityService.getCombinationActivityBySpuIdsAndStatusAndDateTimeLt( getCombinationActivities(spuIds, now, activityList);
spuIds, CommonStatusEnum.ENABLE.getStatus(), now); // 2. 秒杀活动
if (CollUtil.isNotEmpty(combinationActivities)) { getSeckillActivities(spuIds, now, activityList);
combinationActivities.forEach(item -> { // 3. 砍价活动
activityList.add(new AppActivityRespVO().setId(item.getId()) getBargainActivities(spuIds, now, activityList);
.setType(PromotionTypeEnum.COMBINATION_ACTIVITY.getType()).setName(item.getName()) // 4. 限时折扣活动
.setSpuId(item.getSpuId()).setStartTime(item.getStartTime()).setEndTime(item.getEndTime())); getDiscountActivities(spuIds, now, activityList);
}); // 5. 满减送活动
} getRewardActivities(spuIds, now, activityList);
// 2. 秒杀活动 - 获取开启的且开始的且没有结束的活动
List<SeckillActivityDO> seckillActivities = seckillActivityService.getSeckillActivityBySpuIdsAndStatusAndDateTimeLt(
spuIds, CommonStatusEnum.ENABLE.getStatus(), now);
if (CollUtil.isNotEmpty(seckillActivities)) {
seckillActivities.forEach(item -> {
activityList.add(new AppActivityRespVO().setId(item.getId())
.setType(PromotionTypeEnum.SECKILL_ACTIVITY.getType()).setName(item.getName())
.setSpuId(item.getSpuId()).setStartTime(item.getStartTime()).setEndTime(item.getEndTime()));
});
}
// 3. 砍价活动 - 获取开启的且开始的且没有结束的活动
List<BargainActivityDO> bargainActivities = bargainActivityService.getBargainActivityBySpuIdsAndStatusAndDateTimeLt(
spuIds, CommonStatusEnum.ENABLE.getStatus(), now);
if (CollUtil.isNotEmpty(bargainActivities)) {
bargainActivities.forEach(item -> {
activityList.add(new AppActivityRespVO().setId(item.getId())
.setType(PromotionTypeEnum.BARGAIN_ACTIVITY.getType()).setName(item.getName())
.setSpuId(item.getSpuId()).setStartTime(item.getStartTime()).setEndTime(item.getEndTime()));
});
}
return activityList; return activityList;
} }
private void getCombinationActivities(Collection<Long> spuIds, LocalDateTime now, List<AppActivityRespVO> activityList) {
List<CombinationActivityDO> combinationActivities = combinationActivityService.getCombinationActivityBySpuIdsAndStatusAndDateTimeLt(
spuIds, CommonStatusEnum.ENABLE.getStatus(), now);
if (CollUtil.isEmpty(combinationActivities)) {
return;
}
combinationActivities.forEach(item -> {
activityList.add(new AppActivityRespVO(item.getId(), PromotionTypeEnum.COMBINATION_ACTIVITY.getType(),
item.getName(), item.getSpuId(), item.getStartTime(), item.getEndTime()));
});
}
private void getSeckillActivities(Collection<Long> spuIds, LocalDateTime now, List<AppActivityRespVO> activityList) {
List<SeckillActivityDO> seckillActivities = seckillActivityService.getSeckillActivityBySpuIdsAndStatusAndDateTimeLt(
spuIds, CommonStatusEnum.ENABLE.getStatus(), now);
if (CollUtil.isEmpty(seckillActivities)) {
return;
}
seckillActivities.forEach(item -> {
activityList.add(new AppActivityRespVO(item.getId(), PromotionTypeEnum.SECKILL_ACTIVITY.getType(),
item.getName(), item.getSpuId(), item.getStartTime(), item.getEndTime()));
});
}
private void getBargainActivities(Collection<Long> spuIds, LocalDateTime now, List<AppActivityRespVO> activityList) {
List<BargainActivityDO> bargainActivities = bargainActivityService.getBargainActivityBySpuIdsAndStatusAndDateTimeLt(
spuIds, CommonStatusEnum.ENABLE.getStatus(), now);
if (CollUtil.isNotEmpty(bargainActivities)) {
return;
}
bargainActivities.forEach(item -> {
activityList.add(new AppActivityRespVO(item.getId(), PromotionTypeEnum.BARGAIN_ACTIVITY.getType(),
item.getName(), item.getSpuId(), item.getStartTime(), item.getEndTime()));
});
}
private void getDiscountActivities(Collection<Long> spuIds, LocalDateTime now, List<AppActivityRespVO> activityList) {
List<DiscountActivityDO> discountActivities = discountActivityService.getDiscountActivityBySpuIdsAndStatusAndDateTimeLt(
spuIds, CommonStatusEnum.ENABLE.getStatus(), now);
if (CollUtil.isEmpty(discountActivities)) {
return;
}
List<DiscountProductDO> products = discountActivityService.getDiscountProductsByActivityId(
convertSet(discountActivities, DiscountActivityDO::getId));
Map<Long, Long> productMap = convertMap(products, DiscountProductDO::getActivityId, DiscountProductDO::getSpuId);
discountActivities.forEach(item -> activityList.add(new AppActivityRespVO(item.getId(), PromotionTypeEnum.DISCOUNT_ACTIVITY.getType(),
item.getName(), productMap.get(item.getId()), item.getStartTime(), item.getEndTime())));
}
private void getRewardActivities(Collection<Long> spuIds, LocalDateTime now, List<AppActivityRespVO> activityList) {
// TODO @puhui999有 3 范围,不只 spuId还有 categoryId全部
List<RewardActivityDO> rewardActivityList = rewardActivityService.getRewardActivityBySpuIdsAndStatusAndDateTimeLt(
spuIds, PromotionActivityStatusEnum.RUN.getStatus(), now);
if (CollUtil.isEmpty(rewardActivityList)) {
return;
}
Map<Long, Optional<RewardActivityDO>> spuIdAndActivityMap = spuIds.stream()
.collect(Collectors.toMap(
spuId -> spuId,
spuId -> rewardActivityList.stream()
.filter(activity -> activity.getProductSpuIds().contains(spuId))
.max(Comparator.comparing(RewardActivityDO::getCreateTime))));
for (Long supId : spuIdAndActivityMap.keySet()) {
if (spuIdAndActivityMap.get(supId).isEmpty()) {
continue;
}
RewardActivityDO rewardActivityDO = spuIdAndActivityMap.get(supId).get();
activityList.add(new AppActivityRespVO(rewardActivityDO.getId(), PromotionTypeEnum.REWARD_ACTIVITY.getType(),
rewardActivityDO.getName(), supId, rewardActivityDO.getStartTime(), rewardActivityDO.getEndTime()));
}
}
} }

View File

@ -1,11 +1,15 @@
package cn.iocoder.yudao.module.promotion.controller.app.activity.vo; package cn.iocoder.yudao.module.promotion.controller.app.activity.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "用户 App - 营销活动 Response VO") @Schema(description = "用户 App - 营销活动 Response VO")
@AllArgsConstructor
@NoArgsConstructor
@Data @Data
public class AppActivityRespVO { public class AppActivityRespVO {

View File

@ -8,11 +8,11 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryD
import cn.iocoder.yudao.module.promotion.service.article.ArticleCategoryService; import cn.iocoder.yudao.module.promotion.service.article.ArticleCategoryService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;

View File

@ -2,21 +2,23 @@ package cn.iocoder.yudao.module.promotion.controller.app.article;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO;
import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticleRespVO; import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticleRespVO;
import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert; import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
import cn.iocoder.yudao.module.promotion.service.article.ArticleService; import cn.iocoder.yudao.module.promotion.service.article.ArticleService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -51,9 +53,15 @@ public class AppArticleController {
@RequestMapping("/get") @RequestMapping("/get")
@Operation(summary = "获得文章详情") @Operation(summary = "获得文章详情")
@Parameter(name = "id", description = "文章编号", example = "1024") @Parameters({
public CommonResult<AppArticleRespVO> getArticlePage(@RequestParam("id") Long id) { @Parameter(name = "id", description = "文章编号", example = "1024"),
return success(ArticleConvert.INSTANCE.convert01(articleService.getArticle(id))); @Parameter(name = "title", description = "文章标题", example = "1024"),
})
public CommonResult<AppArticleRespVO> getArticle(@RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "title", required = false) String title) {
ArticleDO article = id != null ? articleService.getArticle(id)
: articleService.getLastArticleByTitle(title);
return success(BeanUtils.toBean(article, AppArticleRespVO.class));
} }
@PutMapping("/add-browse-count") @PutMapping("/add-browse-count")
@ -64,4 +72,4 @@ public class AppArticleController {
return success(true); return success(true);
} }
} }

View File

@ -28,7 +28,7 @@ public class AppArticleRespVO {
private String introduction; private String introduction;
@Schema(description = "文章内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是详细") @Schema(description = "文章内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是详细")
private String description; private String content;
@Schema(description = "发布时间", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "发布时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime; private LocalDateTime createTime;

View File

@ -8,10 +8,10 @@ import cn.iocoder.yudao.module.promotion.service.banner.BannerService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.promotion.controller.app.banner.vo; package cn.iocoder.yudao.module.promotion.controller.app.banner.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "用户 App - Banner Response VO") @Schema(description = "用户 App - Banner Response VO")
@Data @Data

View File

@ -18,13 +18,13 @@ import com.google.common.cache.LoadingCache;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import java.time.Duration; import java.time.Duration;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;

View File

@ -12,10 +12,10 @@ import cn.iocoder.yudao.module.promotion.service.bargain.BargainHelpService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@ -27,10 +27,10 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@ -42,9 +42,6 @@ public class AppBargainActivityDetailRespVO {
@Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "50") // 从 SPU 的 marketPrice 读取 @Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "50") // 从 SPU 的 marketPrice 读取
private Integer marketPrice; private Integer marketPrice;
@Schema(description = "商品单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "个") // 从 SPU 的 unit 读取,然后转换
private String unitName;
@Schema(description = "砍价起始价格,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "200") @Schema(description = "砍价起始价格,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
private Integer bargainFirstPrice; private Integer bargainFirstPrice;

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help; package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "用户 App - 砍价助力的创建 Request VO") @Schema(description = "用户 App - 砍价助力的创建 Request VO")
@Data @Data

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record; package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "用户 App - 砍价记录的创建 Request VO") @Schema(description = "用户 App - 砍价记录的创建 Request VO")
@Data @Data

View File

@ -19,13 +19,13 @@ import com.google.common.cache.LoadingCache;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import java.time.Duration; import java.time.Duration;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;

View File

@ -1,7 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.app.combination; package cn.iocoder.yudao.module.promotion.controller.app.combination;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordDetailRespVO; import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordDetailRespVO;
import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordPageReqVO;
import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordRespVO; import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordRespVO;
import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordSummaryRespVO; import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordSummaryRespVO;
import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert; import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert;
@ -13,6 +17,9 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Max;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -20,8 +27,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.Max;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -73,8 +78,18 @@ public class AppCombinationRecordController {
@RequestParam(value = "activityId", required = false) Long activityId, @RequestParam(value = "activityId", required = false) Long activityId,
@RequestParam("status") Integer status, @RequestParam("status") Integer status,
@RequestParam(value = "count", defaultValue = "20") @Max(20) Integer count) { @RequestParam(value = "count", defaultValue = "20") @Max(20) Integer count) {
return success(CombinationActivityConvert.INSTANCE.convertList3( List<CombinationRecordDO> list = combinationRecordService.getHeadCombinationRecordList(activityId, status, count);
combinationRecordService.getHeadCombinationRecordList(activityId, status, count))); return success(BeanUtils.toBean(list, AppCombinationRecordRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得我的拼团记录分页")
@PreAuthenticated
public CommonResult<PageResult<AppCombinationRecordRespVO>> getCombinationRecordPage(
@Valid AppCombinationRecordPageReqVO pageReqVO) {
PageResult<CombinationRecordDO> pageResult = combinationRecordService.getCombinationRecordPage(
getLoginUserId(), pageReqVO);
return success(BeanUtils.toBean(pageResult, AppCombinationRecordRespVO.class));
} }
@GetMapping("/get-detail") @GetMapping("/get-detail")

View File

@ -0,0 +1,21 @@
package cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "用户 App - 拼团记录分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class AppCombinationRecordPageReqVO extends PageParam {
@Schema(description = "拼团状态", example = "1")
@InEnum(value = CombinationRecordStatusEnum.class, message = "拼团状态必须是 {value}")
private Integer status;
}

View File

@ -33,12 +33,18 @@ public class AppCombinationRecordRespVO {
@Schema(description = "拼团状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "拼团状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status; private Integer status;
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
private Long orderId;
@Schema(description = "商品名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是大黄豆") @Schema(description = "商品名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是大黄豆")
private String spuName; private String spuName;
@Schema(description = "商品图片", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") @Schema(description = "商品图片", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png")
private String picUrl; private String picUrl;
@Schema(description = "购买的商品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Integer count;
@Schema(description = "拼团金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") @Schema(description = "拼团金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
private Integer combinationPrice; private Integer combinationPrice;

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.promotion.controller.app.coupon;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.promotion.controller.app.coupon.vo.coupon.*; import cn.iocoder.yudao.module.promotion.controller.app.coupon.vo.coupon.*;
import cn.iocoder.yudao.module.promotion.convert.coupon.CouponConvert; import cn.iocoder.yudao.module.promotion.convert.coupon.CouponConvert;
@ -14,11 +15,11 @@ import cn.iocoder.yudao.module.promotion.service.coupon.CouponTemplateService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -59,7 +60,8 @@ public class AppCouponController {
@Operation(summary = "获得匹配指定商品的优惠劵列表", description = "用于下单页,展示优惠劵列表") @Operation(summary = "获得匹配指定商品的优惠劵列表", description = "用于下单页,展示优惠劵列表")
public CommonResult<List<AppCouponMatchRespVO>> getMatchCouponList(AppCouponMatchReqVO matchReqVO) { public CommonResult<List<AppCouponMatchRespVO>> getMatchCouponList(AppCouponMatchReqVO matchReqVO) {
// todo: 优化:优惠金额倒序 // todo: 优化:优惠金额倒序
return success(CouponConvert.INSTANCE.convertList(couponService.getMatchCouponList(getLoginUserId(), matchReqVO))); List<CouponDO> list = couponService.getMatchCouponList(getLoginUserId(), matchReqVO);
return success(BeanUtils.toBean(list, AppCouponMatchRespVO.class));
} }
@GetMapping("/page") @GetMapping("/page")
@ -68,7 +70,16 @@ public class AppCouponController {
public CommonResult<PageResult<AppCouponRespVO>> getCouponPage(AppCouponPageReqVO pageReqVO) { public CommonResult<PageResult<AppCouponRespVO>> getCouponPage(AppCouponPageReqVO pageReqVO) {
PageResult<CouponDO> pageResult = couponService.getCouponPage( PageResult<CouponDO> pageResult = couponService.getCouponPage(
CouponConvert.INSTANCE.convert(pageReqVO, Collections.singleton(getLoginUserId()))); CouponConvert.INSTANCE.convert(pageReqVO, Collections.singleton(getLoginUserId())));
return success(CouponConvert.INSTANCE.convertAppPage(pageResult)); return success(BeanUtils.toBean(pageResult, AppCouponRespVO.class));
}
@GetMapping("/get")
@Operation(summary = "获得优惠劵")
@Parameter(name = "id", description = "优惠劵编号", required = true, example = "1024")
@PreAuthenticated
public CommonResult<AppCouponRespVO> getCoupon(@RequestParam("id") Long id) {
CouponDO coupon = couponService.getCoupon(getLoginUserId(), id);
return success(BeanUtils.toBean(coupon, AppCouponRespVO.class));
} }
@GetMapping(value = "/get-unused-count") @GetMapping(value = "/get-unused-count")

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.promotion.controller.app.coupon;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi;
import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
@ -17,17 +18,21 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource; import java.util.List;
import java.util.*; import java.util.Map;
import java.util.Objects;
import java.util.Set;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
import static java.util.Collections.singletonList;
@Tag(name = "用户 App - 优惠劵模板") @Tag(name = "用户 App - 优惠劵模板")
@RestController @RestController
@ -43,11 +48,25 @@ public class AppCouponTemplateController {
@Resource @Resource
private ProductSpuApi productSpuApi; private ProductSpuApi productSpuApi;
@GetMapping("/get")
@Operation(summary = "获得优惠劵模版")
@Parameter(name = "id", description = "优惠券模板编号", required = true, example = "1024")
public CommonResult<AppCouponTemplateRespVO> getCouponTemplate(Long id) {
CouponTemplateDO template = couponTemplateService.getCouponTemplate(id);
if (template == null) {
return success(null);
}
// 处理是否可领取
Map<Long, Boolean> canCanTakeMap = couponService.getUserCanCanTakeMap(getLoginUserId(), singletonList(template));
return success(BeanUtils.toBean(template, AppCouponTemplateRespVO.class)
.setCanTake(canCanTakeMap.get(template.getId())));
}
@GetMapping("/list") @GetMapping("/list")
@Operation(summary = "获得优惠劵模版列表") @Operation(summary = "获得优惠劵模版列表")
@Parameters({ @Parameters({
@Parameter(name = "spuId", description = "商品 SPU 编号"), // 目前主要给商品详情使用 @Parameter(name = "spuId", description = "商品 SPU 编号"), // 目前主要给商品详情使用
@Parameter(name = "useType", description = "使用类型"), @Parameter(name = "productScope", description = "使用类型"),
@Parameter(name = "count", description = "数量", required = true) @Parameter(name = "count", description = "数量", required = true)
}) })
public CommonResult<List<AppCouponTemplateRespVO>> getCouponTemplateList( public CommonResult<List<AppCouponTemplateRespVO>> getCouponTemplateList(
@ -57,7 +76,7 @@ public class AppCouponTemplateController {
// 1.1 处理查询条件:商品范围编号 // 1.1 处理查询条件:商品范围编号
Long productScopeValue = getProductScopeValue(productScope, spuId); Long productScopeValue = getProductScopeValue(productScope, spuId);
// 1.2 处理查询条件:领取方式 = 直接领取 // 1.2 处理查询条件:领取方式 = 直接领取
List<Integer> canTakeTypes = Collections.singletonList(CouponTakeTypeEnum.USER.getValue()); List<Integer> canTakeTypes = singletonList(CouponTakeTypeEnum.USER.getValue());
// 2. 查询 // 2. 查询
List<CouponTemplateDO> list = couponTemplateService.getCouponTemplateList(canTakeTypes, productScope, List<CouponTemplateDO> list = couponTemplateService.getCouponTemplateList(canTakeTypes, productScope,
@ -69,13 +88,27 @@ public class AppCouponTemplateController {
return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap)); return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap));
} }
@GetMapping("/list-by-ids")
@Operation(summary = "获得优惠劵模版列表")
@Parameter(name = "ids", description = "优惠券模板编号列表")
public CommonResult<List<AppCouponTemplateRespVO>> getCouponTemplateList(
@RequestParam(value = "ids", required = false) Set<Long> ids) {
// 1. 查询
List<CouponTemplateDO> list = couponTemplateService.getCouponTemplateList(ids);
// 2.1 领取数量
Map<Long, Boolean> canCanTakeMap = couponService.getUserCanCanTakeMap(getLoginUserId(), list);
// 2.2 拼接返回
return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap));
}
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得优惠劵模版分页") @Operation(summary = "获得优惠劵模版分页")
public CommonResult<PageResult<AppCouponTemplateRespVO>> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) { public CommonResult<PageResult<AppCouponTemplateRespVO>> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) {
// 1.1 处理查询条件:商品范围编号 // 1.1 处理查询条件:商品范围编号
Long productScopeValue = getProductScopeValue(pageReqVO.getProductScope(), pageReqVO.getSpuId()); Long productScopeValue = getProductScopeValue(pageReqVO.getProductScope(), pageReqVO.getSpuId());
// 1.2 处理查询条件:领取方式 = 直接领取 // 1.2 处理查询条件:领取方式 = 直接领取
List<Integer> canTakeTypes = Collections.singletonList(CouponTakeTypeEnum.USER.getValue()); List<Integer> canTakeTypes = singletonList(CouponTakeTypeEnum.USER.getValue());
// 2. 分页查询 // 2. 分页查询
PageResult<CouponTemplateDO> pageResult = couponTemplateService.getCouponTemplatePage( PageResult<CouponTemplateDO> pageResult = couponTemplateService.getCouponTemplatePage(

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.promotion.controller.app.coupon.vo.coupon; package cn.iocoder.yudao.module.promotion.controller.app.coupon.vo.coupon;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.List; import java.util.List;
@Schema(description = "用户 App - 优惠劵的匹配 Request VO") @Schema(description = "用户 App - 优惠劵的匹配 Request VO")

View File

@ -1,10 +1,11 @@
package cn.iocoder.yudao.module.promotion.controller.app.coupon.vo.coupon; package cn.iocoder.yudao.module.promotion.controller.app.coupon.vo.coupon;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import lombok.Data; import lombok.Data;
import jakarta.validation.constraints.Min;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "用户 App - 优惠劵 Response VO") @Schema(description = "用户 App - 优惠劵 Response VO")
@Data @Data
@ -19,10 +20,15 @@ public class AppCouponRespVO {
@Schema(description = "优惠劵状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") // 参见 CouponStatusEnum 枚举 @Schema(description = "优惠劵状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") // 参见 CouponStatusEnum 枚举
private Integer status; private Integer status;
@Schema(description = "是否设置满多少金额可用", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") @Schema(description = "是否设置满多少金额可用", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") // 单位0 - 不限制
// 单位0 - 不限制
private Integer usePrice; private Integer usePrice;
@Schema(description = "商品范围", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer productScope;
@Schema(description = "商品范围编号的数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private List<Long> productScopeValues;
@Schema(description = "固定日期 - 生效开始时间") @Schema(description = "固定日期 - 生效开始时间")
private LocalDateTime validStartTime; private LocalDateTime validStartTime;

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.promotion.controller.app.coupon.vo.coupon; package cn.iocoder.yudao.module.promotion.controller.app.coupon.vo.coupon;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "用户 App - 优惠劵领取 Request VO") @Schema(description = "用户 App - 优惠劵领取 Request VO")
@Data @Data

View File

@ -5,6 +5,7 @@ import lombok.Data;
import jakarta.validation.constraints.Min; import jakarta.validation.constraints.Min;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "用户 App - 优惠劵模板 Response VO") @Schema(description = "用户 App - 优惠劵模板 Response VO")
@Data @Data
@ -19,10 +20,15 @@ public class AppCouponTemplateRespVO {
@Schema(description = "每人限领个数", requiredMode = Schema.RequiredMode.REQUIRED, example = "66") // -1 - 则表示不限制 @Schema(description = "每人限领个数", requiredMode = Schema.RequiredMode.REQUIRED, example = "66") // -1 - 则表示不限制
private Integer takeLimitCount; private Integer takeLimitCount;
@Schema(description = "是否设置满多少金额可用", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") @Schema(description = "是否设置满多少金额可用", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") // 单位0 - 不限制
// 单位0 - 不限制
private Integer usePrice; private Integer usePrice;
@Schema(description = "商品范围", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer productScope;
@Schema(description = "商品范围编号的数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private List<Long> productScopeValues;
@Schema(description = "生效日期类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "生效日期类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer validityType; private Integer validityType;

View File

@ -1,42 +0,0 @@
package cn.iocoder.yudao.module.promotion.controller.app.decorate;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.controller.app.decorate.vo.AppDecorateComponentRespVO;
import cn.iocoder.yudao.module.promotion.convert.decorate.DecorateComponentConvert;
import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum;
import cn.iocoder.yudao.module.promotion.service.decorate.DecorateComponentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "用户 APP - 店铺装修")
@RestController
@RequestMapping("/promotion/decorate")
@Validated
public class AppDecorateController {
@Resource
private DecorateComponentService decorateComponentService;
@GetMapping("/list")
@Operation(summary = "获取指定页面的组件列表")
@Parameter(name = "page", description = "页面编号", required = true)
public CommonResult<List<AppDecorateComponentRespVO>> getDecorateComponentListByPage(
@RequestParam("page") @InEnum(DecoratePageEnum.class) Integer page) {
return success(DecorateComponentConvert.INSTANCE.convertList(
decorateComponentService.getDecorateComponentListByPage(page, CommonStatusEnum.ENABLE.getStatus())));
}
}

View File

@ -1,16 +0,0 @@
package cn.iocoder.yudao.module.promotion.controller.app.decorate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "用户 App - 页面组件 Resp VO")
@Data
public class AppDecorateComponentRespVO {
@Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu")
private String code;
@Schema(description = "组件的内容配置项", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "TODO")
private String value;
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.promotion.controller.app.diy;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.promotion.controller.app.diy.vo.AppDiyPagePropertyRespVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO;
import cn.iocoder.yudao.module.promotion.service.diy.DiyPageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "用户 APP - 装修页面")
@RestController
@RequestMapping("/promotion/diy-page")
@Validated
public class AppDiyPageController {
@Resource
private DiyPageService diyPageService;
@GetMapping("/get")
@Operation(summary = "获得装修页面")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<AppDiyPagePropertyRespVO> getDiyPage(@RequestParam("id") Long id) {
DiyPageDO diyPage = diyPageService.getDiyPage(id);
return success(BeanUtils.toBean(diyPage, AppDiyPagePropertyRespVO.class));
}
}

View File

@ -0,0 +1,65 @@
package cn.iocoder.yudao.module.promotion.controller.app.diy;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.controller.app.diy.vo.AppDiyTemplatePropertyRespVO;
import cn.iocoder.yudao.module.promotion.convert.diy.DiyTemplateConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO;
import cn.iocoder.yudao.module.promotion.enums.diy.DiyPageEnum;
import cn.iocoder.yudao.module.promotion.service.diy.DiyPageService;
import cn.iocoder.yudao.module.promotion.service.diy.DiyTemplateService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.findFirst;
@Tag(name = "用户 APP - 装修模板")
@RestController
@RequestMapping("/promotion/diy-template")
@Validated
public class AppDiyTemplateController {
@Resource
private DiyTemplateService diyTemplateService;
@Resource
private DiyPageService diyPageService;
// TODO @疯狂:要不要把 used 和 get 接口合并哈;不传递 id直接拿默认
@GetMapping("/used")
@Operation(summary = "使用中的装修模板")
public CommonResult<AppDiyTemplatePropertyRespVO> getUsedDiyTemplate() {
DiyTemplateDO diyTemplate = diyTemplateService.getUsedDiyTemplate();
return success(buildVo(diyTemplate));
}
@GetMapping("/get")
@Operation(summary = "获得装修模板")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<AppDiyTemplatePropertyRespVO> getDiyTemplate(@RequestParam("id") Long id) {
DiyTemplateDO diyTemplate = diyTemplateService.getDiyTemplate(id);
return success(buildVo(diyTemplate));
}
private AppDiyTemplatePropertyRespVO buildVo(DiyTemplateDO diyTemplate) {
if (diyTemplate == null) {
return null;
}
// 查询模板下的页面
List<DiyPageDO> pages = diyPageService.getDiyPageByTemplateId(diyTemplate.getId());
String home = findFirst(pages, page -> DiyPageEnum.INDEX.getName().equals(page.getName()), DiyPageDO::getProperty);
String user = findFirst(pages, page -> DiyPageEnum.MY.getName().equals(page.getName()), DiyPageDO::getProperty);
// 拼接返回
return DiyTemplateConvert.INSTANCE.convertPropertyVo2(diyTemplate, home, user);
}
}

Some files were not shown because too many files have changed in this diff Show More