Commit ce77d510bb7cc5a375960fa3615de9d7f89f779e
1 parent
3d51c67f
拼团记录:添加拼团记录后台管理接口
Showing
7 changed files
with
303 additions
and
0 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.admin.combination; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.map.MapUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | +import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO; | ||
| 7 | +import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordRespVO; | ||
| 8 | +import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert; | ||
| 9 | +import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordService; | ||
| 10 | +import com.google.common.cache.CacheLoader; | ||
| 11 | +import com.google.common.cache.LoadingCache; | ||
| 12 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 15 | +import org.springframework.validation.annotation.Validated; | ||
| 16 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 17 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 18 | +import org.springframework.web.bind.annotation.RestController; | ||
| 19 | + | ||
| 20 | +import javax.annotation.Resource; | ||
| 21 | +import javax.validation.Valid; | ||
| 22 | +import java.time.Duration; | ||
| 23 | +import java.util.Map; | ||
| 24 | + | ||
| 25 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 26 | +import static cn.iocoder.yudao.framework.common.util.cache.CacheUtils.buildAsyncReloadingCache; | ||
| 27 | + | ||
| 28 | +@Tag(name = "管理后台 - 拼团记录") | ||
| 29 | +@RestController | ||
| 30 | +@RequestMapping("/promotion/combination-record") | ||
| 31 | +@Validated | ||
| 32 | +public class CombinationRecordController { | ||
| 33 | + | ||
| 34 | + @Resource | ||
| 35 | + private CombinationRecordService combinationRecordService; | ||
| 36 | + /** | ||
| 37 | + * {@link Map} 缓存,通过它异步刷新 {@link #getCombinationRecordSummary0()} 所要的拼团记录统计数据 | ||
| 38 | + */ | ||
| 39 | + private final LoadingCache<String, Map<String, Long>> combinationRecordSummary = buildAsyncReloadingCache(Duration.ofSeconds(60L), | ||
| 40 | + new CacheLoader<String, Map<String, Long>>() { | ||
| 41 | + | ||
| 42 | + @Override | ||
| 43 | + public Map<String, Long> load(String key) { | ||
| 44 | + return getCombinationRecordSummary0(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + }); | ||
| 48 | + | ||
| 49 | + @GetMapping("/page") | ||
| 50 | + @Operation(summary = "获得拼团记录分页") | ||
| 51 | + @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") | ||
| 52 | + public CommonResult<PageResult<CombinationRecordRespVO>> getBargainRecordPage(@Valid CombinationRecordReqPageVO pageVO) { | ||
| 53 | + return success(CombinationActivityConvert.INSTANCE.convert( | ||
| 54 | + combinationRecordService.getBargainRecordPage(pageVO))); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @GetMapping("/get-summary") | ||
| 58 | + @Operation(summary = "获得拼团记录的概要信息", description = "用于拼团记录页面展示") | ||
| 59 | + @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") | ||
| 60 | + public CommonResult<Map<String, Long>> getCombinationRecordSummary() { | ||
| 61 | + return success(combinationRecordSummary.getUnchecked("")); // 缓存 | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @GetMapping("/get-count") | ||
| 65 | + @Operation(summary = "获得拼团记录分页 tab count") | ||
| 66 | + @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") | ||
| 67 | + public CommonResult<Map<String, Long>> getSpuCount() { | ||
| 68 | + Map<String, Long> hashMap = MapUtil.newHashMap(7); | ||
| 69 | + hashMap.put("all", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.ALL));// 全部 | ||
| 70 | + hashMap.put("toDay", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.TO_DAY));// 今天 | ||
| 71 | + hashMap.put("yesterday", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.YESTERDAY));// 昨天 | ||
| 72 | + hashMap.put("lastSevenDays", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.LAST_SEVEN_DAYS));// 最近七天 | ||
| 73 | + hashMap.put("last30Days", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.LAST_30_DAYS));// 最近 30 天 | ||
| 74 | + hashMap.put("thisMonth", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.THIS_MONTH));// 本月 | ||
| 75 | + hashMap.put("thisYear", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.THIS_YEAR));// 本年 | ||
| 76 | + return success(hashMap); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + private Map<String, Long> getCombinationRecordSummary0() { | ||
| 80 | + Map<String, Long> hashMap = MapUtil.newHashMap(3); | ||
| 81 | + hashMap.put("userCount", combinationRecordService.getRecordsCount());// 获取所有拼团记录 | ||
| 82 | + hashMap.put("successCount", combinationRecordService.getRecordsSuccessCount());// 获取成团记录 | ||
| 83 | + hashMap.put("virtualGroupCount", combinationRecordService.getRecordsVirtualGroupCount());// 获取虚拟成团记录 | ||
| 84 | + return hashMap; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | +} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/recrod/CombinationRecordReqPageVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | +import lombok.ToString; | ||
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | + | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 13 | + | ||
| 14 | +@Schema(description = "管理后台 - 拼团记录分页 Request VO") | ||
| 15 | +@Data | ||
| 16 | +@EqualsAndHashCode(callSuper = true) | ||
| 17 | +@ToString(callSuper = true) | ||
| 18 | +public class CombinationRecordReqPageVO extends PageParam { | ||
| 19 | + | ||
| 20 | + public static final Integer ALL = 0; // 全部 | ||
| 21 | + public static final Integer TO_DAY = 1; // 今天 | ||
| 22 | + public static final Integer YESTERDAY = 2; // 昨天 | ||
| 23 | + public static final Integer LAST_SEVEN_DAYS = 3; // 最近七天 | ||
| 24 | + public static final Integer LAST_30_DAYS = 4; // 最近 30 天 | ||
| 25 | + public static final Integer THIS_MONTH = 5; // 本月 | ||
| 26 | + public static final Integer THIS_YEAR = 6; // 本年 | ||
| 27 | + | ||
| 28 | + @Schema(description = "日期类型", example = "0") | ||
| 29 | + private Integer dateType; | ||
| 30 | + | ||
| 31 | + @Schema(description = "活动状态", example = "0") | ||
| 32 | + private Integer status; | ||
| 33 | + | ||
| 34 | + @Schema(description = "创建时间") | ||
| 35 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 36 | + private LocalDateTime[] createTime; | ||
| 37 | + | ||
| 38 | +} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/vo/recrod/CombinationRecordRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 6 | + | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 10 | + | ||
| 11 | +@Schema(description = "管理后台 - 拼团记录 Response VO") | ||
| 12 | +@Data | ||
| 13 | +public class CombinationRecordRespVO { | ||
| 14 | + | ||
| 15 | + @Schema(description = "拼团记录编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | + @Schema(description = "拼团活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 19 | + private Long activityId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "花开富贵") | ||
| 22 | + private String nickname; | ||
| 23 | + | ||
| 24 | + @Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") | ||
| 25 | + private String avatar; | ||
| 26 | + | ||
| 27 | + @Schema(description = "团长编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 28 | + private Long headId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 31 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 32 | + private LocalDateTime expireTime; | ||
| 33 | + | ||
| 34 | + @Schema(description = "可参团人数", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | ||
| 35 | + private Integer userSize; | ||
| 36 | + | ||
| 37 | + @Schema(description = "已参团人数", requiredMode = Schema.RequiredMode.REQUIRED, example = "5") | ||
| 38 | + private Integer userCount; | ||
| 39 | + | ||
| 40 | + @Schema(description = "拼团状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 41 | + private Integer status; | ||
| 42 | + | ||
| 43 | + @Schema(description = "商品名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是大黄豆") | ||
| 44 | + private String spuName; | ||
| 45 | + | ||
| 46 | + @Schema(description = "商品图片", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") | ||
| 47 | + private String picUrl; | ||
| 48 | + | ||
| 49 | + @Schema(description = "是否虚拟成团", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") | ||
| 50 | + private Boolean virtualGroup; | ||
| 51 | + | ||
| 52 | + @Schema(description = "开始时间 (订单付款后开始的时间)", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 53 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 54 | + private LocalDateTime startTime; | ||
| 55 | + | ||
| 56 | + @Schema(description = "结束时间(成团时间/失败时间)", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 57 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 58 | + private LocalDateTime endTime; | ||
| 59 | + | ||
| 60 | +} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java
| @@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activit | @@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activit | ||
| 12 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityUpdateReqVO; | 12 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityUpdateReqVO; |
| 13 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductBaseVO; | 13 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductBaseVO; |
| 14 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductRespVO; | 14 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductRespVO; |
| 15 | +import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordRespVO; | ||
| 15 | import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityDetailRespVO; | 16 | import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityDetailRespVO; |
| 16 | import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityRespVO; | 17 | import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityRespVO; |
| 17 | import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordRespVO; | 18 | import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordRespVO; |
| @@ -146,4 +147,6 @@ public interface CombinationActivityConvert { | @@ -146,4 +147,6 @@ public interface CombinationActivityConvert { | ||
| 146 | 147 | ||
| 147 | AppCombinationRecordRespVO convert(CombinationRecordDO record); | 148 | AppCombinationRecordRespVO convert(CombinationRecordDO record); |
| 148 | 149 | ||
| 150 | + PageResult<CombinationRecordRespVO> convert(PageResult<CombinationRecordDO> result); | ||
| 151 | + | ||
| 149 | } | 152 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java
| 1 | package cn.iocoder.yudao.module.promotion.dal.mysql.combination; | 1 | package cn.iocoder.yudao.module.promotion.dal.mysql.combination; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.util.ObjectUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO; | ||
| 5 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; | 8 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; |
| 6 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 7 | 10 | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | +import java.time.LocalTime; | ||
| 8 | import java.util.List; | 13 | import java.util.List; |
| 9 | 14 | ||
| 10 | /** | 15 | /** |
| @@ -90,4 +95,60 @@ public interface CombinationRecordMapper extends BaseMapperX<CombinationRecordDO | @@ -90,4 +95,60 @@ public interface CombinationRecordMapper extends BaseMapperX<CombinationRecordDO | ||
| 90 | .last("LIMIT " + count)); | 95 | .last("LIMIT " + count)); |
| 91 | } | 96 | } |
| 92 | 97 | ||
| 98 | + static LocalDateTime[] builderQueryTime(Integer dateType) { | ||
| 99 | + LocalDateTime now = LocalDateTime.now(); | ||
| 100 | + LocalDateTime[] createTime = null; // 全部时间段 | ||
| 101 | + // 今天-一天开始到结束 | ||
| 102 | + if (ObjectUtil.equal(dateType, CombinationRecordReqPageVO.TO_DAY)) { | ||
| 103 | + createTime = new LocalDateTime[]{now.toLocalDate().atStartOfDay(), now.toLocalDate().atTime(LocalTime.MAX)}; | ||
| 104 | + } | ||
| 105 | + // 昨天-昨天开始和结束 | ||
| 106 | + if (ObjectUtil.equal(dateType, CombinationRecordReqPageVO.YESTERDAY)) { | ||
| 107 | + createTime = new LocalDateTime[]{now.minusDays(1).toLocalDate().atStartOfDay(), | ||
| 108 | + now.minusDays(1).toLocalDate().atTime(LocalTime.MAX)}; | ||
| 109 | + } | ||
| 110 | + // 最近七天 | ||
| 111 | + if (ObjectUtil.equal(dateType, CombinationRecordReqPageVO.LAST_SEVEN_DAYS)) { | ||
| 112 | + createTime = new LocalDateTime[]{now.minusDays(7).toLocalDate().atStartOfDay(), | ||
| 113 | + now.toLocalDate().atTime(LocalTime.MAX)}; | ||
| 114 | + } | ||
| 115 | + // 最近 30 天 | ||
| 116 | + if (ObjectUtil.equal(dateType, CombinationRecordReqPageVO.LAST_30_DAYS)) { | ||
| 117 | + createTime = new LocalDateTime[]{now.minusDays(30).toLocalDate().atStartOfDay(), | ||
| 118 | + now.toLocalDate().atTime(LocalTime.MAX)}; | ||
| 119 | + } | ||
| 120 | + // 本月 | ||
| 121 | + if (ObjectUtil.equal(dateType, CombinationRecordReqPageVO.THIS_MONTH)) { | ||
| 122 | + // 获取本月的开始时间 | ||
| 123 | + LocalDateTime startTime = now.withDayOfMonth(1).toLocalDate().atStartOfDay(); | ||
| 124 | + // 获取下个月的开始时间,然后减去一秒以获取本月的结束时间 | ||
| 125 | + LocalDateTime endTime = now.withDayOfMonth(1).plusMonths(1).toLocalDate().atStartOfDay().minusSeconds(1); | ||
| 126 | + createTime = new LocalDateTime[]{startTime, endTime}; | ||
| 127 | + } | ||
| 128 | + // 本年 | ||
| 129 | + if (ObjectUtil.equal(dateType, CombinationRecordReqPageVO.THIS_YEAR)) { | ||
| 130 | + // 获取本年的开始时间 | ||
| 131 | + LocalDateTime startTime = now.withDayOfYear(1).toLocalDate().atStartOfDay(); | ||
| 132 | + // 获取下一年的开始时间,然后减去一秒以获取本年的结束时间 | ||
| 133 | + LocalDateTime endTime = now.withDayOfYear(1).plusYears(1).toLocalDate().atStartOfDay().minusSeconds(1); | ||
| 134 | + createTime = new LocalDateTime[]{startTime, endTime}; | ||
| 135 | + } | ||
| 136 | + return createTime; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + default PageResult<CombinationRecordDO> selectPage(CombinationRecordReqPageVO pageVO) { | ||
| 140 | + // 兼容自选时间段 | ||
| 141 | + if (pageVO.getDateType() != null) { | ||
| 142 | + pageVO.setCreateTime(builderQueryTime(pageVO.getDateType())); | ||
| 143 | + } | ||
| 144 | + return selectPage(pageVO, new LambdaQueryWrapperX<CombinationRecordDO>() | ||
| 145 | + .eqIfPresent(CombinationRecordDO::getStatus, pageVO.getStatus()) | ||
| 146 | + .betweenIfPresent(CombinationRecordDO::getCreateTime, pageVO.getCreateTime())); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + default Long selectCount(Integer dateType) { | ||
| 150 | + return selectCount(new LambdaQueryWrapperX<CombinationRecordDO>() | ||
| 151 | + .betweenIfPresent(CombinationRecordDO::getCreateTime, builderQueryTime(dateType))); | ||
| 152 | + } | ||
| 153 | + | ||
| 93 | } | 154 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java
| 1 | package cn.iocoder.yudao.module.promotion.service.combination; | 1 | package cn.iocoder.yudao.module.promotion.service.combination; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.core.KeyValue; | 3 | import cn.iocoder.yudao.framework.common.core.KeyValue; |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; | 5 | import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; |
| 5 | import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO; | 6 | import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO; |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO; | ||
| 6 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; | 8 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; |
| 7 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; | 9 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; |
| 8 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; | 10 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; |
| @@ -94,6 +96,28 @@ public interface CombinationRecordService { | @@ -94,6 +96,28 @@ public interface CombinationRecordService { | ||
| 94 | Long getRecordsCount(); | 96 | Long getRecordsCount(); |
| 95 | 97 | ||
| 96 | /** | 98 | /** |
| 99 | + * 获取成功记录数 | ||
| 100 | + * | ||
| 101 | + * @return 记录数 | ||
| 102 | + */ | ||
| 103 | + Long getRecordsSuccessCount(); | ||
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * 获取虚拟成团记录数 | ||
| 107 | + * | ||
| 108 | + * @return 记录数 | ||
| 109 | + */ | ||
| 110 | + Long getRecordsVirtualGroupCount(); | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * 获取指定日期类型的记录数,比如说获取最近七天的拼团记录数 | ||
| 114 | + * | ||
| 115 | + * @param dateType 日期类型 | ||
| 116 | + * @return 记录数 | ||
| 117 | + */ | ||
| 118 | + Long getRecordsCountByDateType(Integer dateType); | ||
| 119 | + | ||
| 120 | + /** | ||
| 97 | * 获取最近的 count 条拼团记录 | 121 | * 获取最近的 count 条拼团记录 |
| 98 | * | 122 | * |
| 99 | * @param count 限制数量 | 123 | * @param count 限制数量 |
| @@ -127,4 +151,12 @@ public interface CombinationRecordService { | @@ -127,4 +151,12 @@ public interface CombinationRecordService { | ||
| 127 | */ | 151 | */ |
| 128 | List<CombinationRecordDO> getRecordListByHeadId(Long headId); | 152 | List<CombinationRecordDO> getRecordListByHeadId(Long headId); |
| 129 | 153 | ||
| 154 | + /** | ||
| 155 | + * 获取拼团记录分页数据 | ||
| 156 | + * | ||
| 157 | + * @param pageVO 分页请求 | ||
| 158 | + * @return 拼团记录分页数据 | ||
| 159 | + */ | ||
| 160 | + PageResult<CombinationRecordDO> getBargainRecordPage(CombinationRecordReqPageVO pageVO); | ||
| 161 | + | ||
| 130 | } | 162 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java
| @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; | @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; | ||
| 4 | import cn.hutool.core.util.ObjectUtil; | 4 | import cn.hutool.core.util.ObjectUtil; |
| 5 | import cn.iocoder.yudao.framework.common.core.KeyValue; | 5 | import cn.iocoder.yudao.framework.common.core.KeyValue; |
| 6 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 6 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 7 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; | 8 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; |
| 8 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | 9 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 9 | import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi; | 10 | import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi; |
| @@ -12,6 +13,7 @@ import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; | @@ -12,6 +13,7 @@ import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; | ||
| 12 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; | 13 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; |
| 13 | import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; | 14 | import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; |
| 14 | import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO; | 15 | import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO; |
| 16 | +import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO; | ||
| 15 | import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert; | 17 | import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert; |
| 16 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; | 18 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; |
| 17 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; | 19 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; |
| @@ -226,6 +228,21 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { | @@ -226,6 +228,21 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { | ||
| 226 | } | 228 | } |
| 227 | 229 | ||
| 228 | @Override | 230 | @Override |
| 231 | + public Long getRecordsSuccessCount() { | ||
| 232 | + return recordMapper.selectCount(CombinationRecordDO::getStatus, CombinationRecordStatusEnum.SUCCESS.getStatus()); | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + @Override | ||
| 236 | + public Long getRecordsVirtualGroupCount() { | ||
| 237 | + return recordMapper.selectCount(CombinationRecordDO::getVirtualGroup, true); | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + @Override | ||
| 241 | + public Long getRecordsCountByDateType(Integer dateType) { | ||
| 242 | + return recordMapper.selectCount(dateType); | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + @Override | ||
| 229 | public List<CombinationRecordDO> getLatestRecordList(int count) { | 246 | public List<CombinationRecordDO> getLatestRecordList(int count) { |
| 230 | return recordMapper.selectLatestList(count); | 247 | return recordMapper.selectLatestList(count); |
| 231 | } | 248 | } |
| @@ -245,4 +262,9 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { | @@ -245,4 +262,9 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { | ||
| 245 | return recordMapper.selectList(CombinationRecordDO::getHeadId, headId); | 262 | return recordMapper.selectList(CombinationRecordDO::getHeadId, headId); |
| 246 | } | 263 | } |
| 247 | 264 | ||
| 265 | + @Override | ||
| 266 | + public PageResult<CombinationRecordDO> getBargainRecordPage(CombinationRecordReqPageVO pageVO) { | ||
| 267 | + return recordMapper.selectPage(pageVO); | ||
| 268 | + } | ||
| 269 | + | ||
| 248 | } | 270 | } |