mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-01 02:38:43 +08:00 
			
		
		
		
	拼团记录:完善拼团记录后台管理接口
This commit is contained in:
		| @@ -51,7 +51,7 @@ public class CombinationRecordController { | ||||
|     @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") | ||||
|     public CommonResult<PageResult<CombinationRecordRespVO>> getBargainRecordPage(@Valid CombinationRecordReqPageVO pageVO) { | ||||
|         return success(CombinationActivityConvert.INSTANCE.convert( | ||||
|                 combinationRecordService.getBargainRecordPage(pageVO))); | ||||
|                 combinationRecordService.getCombinationRecordPage(pageVO))); | ||||
|     } | ||||
|  | ||||
|     @GetMapping("/get-summary") | ||||
| @@ -64,22 +64,22 @@ public class CombinationRecordController { | ||||
|     @GetMapping("/get-count") | ||||
|     @Operation(summary = "获得拼团记录分页 tab count") | ||||
|     @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") | ||||
|     public CommonResult<Map<String, Long>> getSpuCount() { | ||||
|     public CommonResult<Map<String, Long>> getCombinationRecordCount() { | ||||
|         Map<String, Long> hashMap = MapUtil.newHashMap(7); | ||||
|         hashMap.put("all", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.ALL));// 全部 | ||||
|         hashMap.put("toDay", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.TO_DAY));// 今天 | ||||
|         hashMap.put("yesterday", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.YESTERDAY));// 昨天 | ||||
|         hashMap.put("lastSevenDays", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.LAST_SEVEN_DAYS));// 最近七天 | ||||
|         hashMap.put("last30Days", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.LAST_30_DAYS));// 最近 30 天 | ||||
|         hashMap.put("thisMonth", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.THIS_MONTH));// 本月 | ||||
|         hashMap.put("thisYear", combinationRecordService.getRecordsCountByDateType(CombinationRecordReqPageVO.THIS_YEAR));// 本年 | ||||
|         hashMap.put("all", combinationRecordService.getCombinationRecordsCountByDateType(CombinationRecordReqPageVO.ALL));// 全部 | ||||
|         hashMap.put("toDay", combinationRecordService.getCombinationRecordsCountByDateType(CombinationRecordReqPageVO.TO_DAY));// 今天 | ||||
|         hashMap.put("yesterday", combinationRecordService.getCombinationRecordsCountByDateType(CombinationRecordReqPageVO.YESTERDAY));// 昨天 | ||||
|         hashMap.put("lastSevenDays", combinationRecordService.getCombinationRecordsCountByDateType(CombinationRecordReqPageVO.LAST_SEVEN_DAYS));// 最近七天 | ||||
|         hashMap.put("last30Days", combinationRecordService.getCombinationRecordsCountByDateType(CombinationRecordReqPageVO.LAST_30_DAYS));// 最近 30 天 | ||||
|         hashMap.put("thisMonth", combinationRecordService.getCombinationRecordsCountByDateType(CombinationRecordReqPageVO.THIS_MONTH));// 本月 | ||||
|         hashMap.put("thisYear", combinationRecordService.getCombinationRecordsCountByDateType(CombinationRecordReqPageVO.THIS_YEAR));// 本年 | ||||
|         return success(hashMap); | ||||
|     } | ||||
|  | ||||
|     private Map<String, Long> getCombinationRecordSummary0() { | ||||
|         Map<String, Long> hashMap = MapUtil.newHashMap(3); | ||||
|         hashMap.put("userCount", combinationRecordService.getRecordsCount());// 获取所有拼团记录 | ||||
|         hashMap.put("successCount", combinationRecordService.getRecordsSuccessCount());// 获取成团记录 | ||||
|         hashMap.put("userCount", combinationRecordService.getCombinationRecordsCount());// 获取所有拼团记录 | ||||
|         hashMap.put("successCount", combinationRecordService.getCombinationRecordsSuccessCount());// 获取成团记录 | ||||
|         hashMap.put("virtualGroupCount", combinationRecordService.getRecordsVirtualGroupCount());// 获取虚拟成团记录 | ||||
|         return hashMap; | ||||
|     } | ||||
|   | ||||
| @@ -42,7 +42,7 @@ public class AppCombinationRecordController { | ||||
|     // TODO 芋艿:增加 @Cache 缓存,1 分钟过期 | ||||
|     public CommonResult<AppCombinationRecordSummaryRespVO> getCombinationRecordSummary() { | ||||
|         // 获取所有拼团记录 | ||||
|         Long count = combinationRecordService.getRecordsCount(); | ||||
|         Long count = combinationRecordService.getCombinationRecordsCount(); | ||||
|         AppCombinationRecordSummaryRespVO summary = new AppCombinationRecordSummaryRespVO(); | ||||
|         if (count == null || count == 0L) { | ||||
|             summary.setAvatars(Collections.emptyList()); | ||||
| @@ -53,7 +53,7 @@ public class AppCombinationRecordController { | ||||
|         summary.setUserCount(count); | ||||
|         // TODO 只返回最近的 7 个 | ||||
|         int num = 7; | ||||
|         summary.setAvatars(convertList(combinationRecordService.getLatestRecordList(num), CombinationRecordDO::getAvatar)); | ||||
|         summary.setAvatars(convertList(combinationRecordService.getLatestCombinationRecordList(num), CombinationRecordDO::getAvatar)); | ||||
|         return success(summary); | ||||
|     } | ||||
|  | ||||
| @@ -69,7 +69,7 @@ public class AppCombinationRecordController { | ||||
|             @RequestParam("status") Integer status, | ||||
|             @RequestParam(value = "count", defaultValue = "20") @Max(20) Integer count) { | ||||
|         return success(CombinationActivityConvert.INSTANCE.convertList3( | ||||
|                 combinationRecordService.getRecordListWithHead(activityId, status, count))); | ||||
|                 combinationRecordService.getCombinationRecordListWithHead(activityId, status, count))); | ||||
|     } | ||||
|  | ||||
|     @GetMapping("/get-detail") | ||||
| @@ -77,7 +77,7 @@ public class AppCombinationRecordController { | ||||
|     @Parameter(name = "id", description = "拼团记录编号", required = true, example = "1024") | ||||
|     public CommonResult<AppCombinationRecordDetailRespVO> getCombinationRecordDetail(@RequestParam("id") Long id) { | ||||
|         // 1、查询这条记录 | ||||
|         CombinationRecordDO record = combinationRecordService.getRecordById(id); | ||||
|         CombinationRecordDO record = combinationRecordService.getCombinationRecordById(id); | ||||
|         if (record == null) { | ||||
|             return success(null); | ||||
|         } | ||||
| @@ -88,17 +88,17 @@ public class AppCombinationRecordController { | ||||
|         if (record.getHeadId() == null) { | ||||
|             detail.setHeadRecord(CombinationActivityConvert.INSTANCE.convert(record)); | ||||
|             // 2.1、查找团员拼团记录 | ||||
|             records = combinationRecordService.getRecordListByHeadId(record.getId()); | ||||
|             records = combinationRecordService.getCombinationRecordListByHeadId(record.getId()); | ||||
|         } else { | ||||
|             // 2.2、查找团长拼团记录 | ||||
|             CombinationRecordDO headRecord = combinationRecordService.getRecordById(record.getHeadId()); | ||||
|             CombinationRecordDO headRecord = combinationRecordService.getCombinationRecordById(record.getHeadId()); | ||||
|             if (headRecord == null) { | ||||
|                 return success(null); | ||||
|             } | ||||
|  | ||||
|             detail.setHeadRecord(CombinationActivityConvert.INSTANCE.convert(headRecord)); | ||||
|             // 2.3、查找团员拼团记录 | ||||
|             records = combinationRecordService.getRecordListByHeadId(headRecord.getId()); | ||||
|             records = combinationRecordService.getCombinationRecordListByHeadId(headRecord.getId()); | ||||
|  | ||||
|         } | ||||
|         detail.setMemberRecords(CombinationActivityConvert.INSTANCE.convertList3(records)); | ||||
|   | ||||
| @@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.promotion.dal.mysql.combination; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.map.MapUtil; | ||||
| import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||||
| import cn.hutool.core.util.ObjectUtil; | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||||
| import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||||
| import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||||
| import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO; | ||||
| @@ -32,10 +32,6 @@ public interface CombinationRecordMapper extends BaseMapperX<CombinationRecordDO | ||||
|                 CombinationRecordDO::getOrderId, orderId); | ||||
|     } | ||||
|  | ||||
|     default List<CombinationRecordDO> selectListByUserId(Long userId) { | ||||
|         return selectList(CombinationRecordDO::getUserId, userId); | ||||
|     } | ||||
|  | ||||
|     default List<CombinationRecordDO> selectListByUserIdAndStatus(Long userId, Integer status) { | ||||
|         return selectList(new LambdaQueryWrapperX<CombinationRecordDO>() | ||||
|                 .eq(CombinationRecordDO::getUserId, userId) | ||||
|   | ||||
| @@ -15,7 +15,6 @@ import java.util.Collection; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| // todo @PUHUI:方法名,还是带下 Combination 哈 | ||||
| /** | ||||
|  * 拼团记录 Service 接口 | ||||
|  * | ||||
| @@ -62,11 +61,11 @@ public interface CombinationRecordService { | ||||
|     void updateRecordStatusAndStartTimeByUserIdAndOrderId(Integer status, Long userId, Long orderId, LocalDateTime startTime); | ||||
|  | ||||
|     /** | ||||
|      * 获得拼团状态 | ||||
|      * 获得拼团记录 | ||||
|      * | ||||
|      * @param userId  用户编号 | ||||
|      * @param orderId 订单编号 | ||||
|      * @return 拼团状态 | ||||
|      * @return 拼团记录 | ||||
|      */ | ||||
|     CombinationRecordDO getCombinationRecord(Long userId, Long orderId); | ||||
|  | ||||
| @@ -77,7 +76,7 @@ public interface CombinationRecordService { | ||||
|      * @param activityId 活动 id | ||||
|      * @return 拼团记录列表 | ||||
|      */ | ||||
|     List<CombinationRecordDO> getRecordListByUserIdAndActivityId(Long userId, Long activityId); | ||||
|     List<CombinationRecordDO> getCombinationRecordListByUserIdAndActivityId(Long userId, Long activityId); | ||||
|  | ||||
|     /** | ||||
|      * 【下单前】校验是否满足拼团活动条件 | ||||
| @@ -97,14 +96,14 @@ public interface CombinationRecordService { | ||||
|      * | ||||
|      * @return 记录数 | ||||
|      */ | ||||
|     Long getRecordsCount(); | ||||
|     Long getCombinationRecordsCount(); | ||||
|  | ||||
|     /** | ||||
|      * 获取成功记录数 | ||||
|      * | ||||
|      * @return 记录数 | ||||
|      */ | ||||
|     Long getRecordsSuccessCount(); | ||||
|     Long getCombinationRecordsSuccessCount(); | ||||
|  | ||||
|     /** | ||||
|      * 获取虚拟成团记录数 | ||||
| @@ -119,7 +118,7 @@ public interface CombinationRecordService { | ||||
|      * @param dateType 日期类型 | ||||
|      * @return 记录数 | ||||
|      */ | ||||
|     Long getRecordsCountByDateType(Integer dateType); | ||||
|     Long getCombinationRecordsCountByDateType(Integer dateType); | ||||
|  | ||||
|     /** | ||||
|      * 获取最近的 count 条拼团记录 | ||||
| @@ -127,7 +126,7 @@ public interface CombinationRecordService { | ||||
|      * @param count 限制数量 | ||||
|      * @return 拼团记录列表 | ||||
|      */ | ||||
|     List<CombinationRecordDO> getLatestRecordList(int count); | ||||
|     List<CombinationRecordDO> getLatestCombinationRecordList(int count); | ||||
|  | ||||
|     /** | ||||
|      * 获得最近 n 条拼团记录(团长发起的) | ||||
| @@ -137,7 +136,7 @@ public interface CombinationRecordService { | ||||
|      * @param count      数量 | ||||
|      * @return 拼团记录列表 | ||||
|      */ | ||||
|     List<CombinationRecordDO> getRecordListWithHead(Long activityId, Integer status, Integer count); | ||||
|     List<CombinationRecordDO> getCombinationRecordListWithHead(Long activityId, Integer status, Integer count); | ||||
|  | ||||
|     /** | ||||
|      * 获取指定编号的拼团记录 | ||||
| @@ -145,7 +144,7 @@ public interface CombinationRecordService { | ||||
|      * @param id 拼团记录编号 | ||||
|      * @return 拼团记录 | ||||
|      */ | ||||
|     CombinationRecordDO getRecordById(Long id); | ||||
|     CombinationRecordDO getCombinationRecordById(Long id); | ||||
|  | ||||
|     /** | ||||
|      * 获取指定团长编号的拼团记录 | ||||
| @@ -153,7 +152,7 @@ public interface CombinationRecordService { | ||||
|      * @param headId 团长编号 | ||||
|      * @return 拼团记录列表 | ||||
|      */ | ||||
|     List<CombinationRecordDO> getRecordListByHeadId(Long headId); | ||||
|     List<CombinationRecordDO> getCombinationRecordListByHeadId(Long headId); | ||||
|  | ||||
|     /** | ||||
|      * 获取拼团记录分页数据 | ||||
| @@ -161,7 +160,7 @@ public interface CombinationRecordService { | ||||
|      * @param pageVO 分页请求 | ||||
|      * @return 拼团记录分页数据 | ||||
|      */ | ||||
|     PageResult<CombinationRecordDO> getBargainRecordPage(CombinationRecordReqPageVO pageVO); | ||||
|     PageResult<CombinationRecordDO> getCombinationRecordPage(CombinationRecordReqPageVO pageVO); | ||||
|  | ||||
|     /** | ||||
|      * 【拼团活动】获得拼团记录数量 Map | ||||
|   | ||||
| @@ -139,7 +139,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { | ||||
|             throw exception(COMBINATION_ACTIVITY_UPDATE_STOCK_FAIL); | ||||
|         } | ||||
|         // 3、校验是否有拼团记录 | ||||
|         List<CombinationRecordDO> recordList = getRecordListByUserIdAndActivityId(userId, activityId); | ||||
|         List<CombinationRecordDO> recordList = getCombinationRecordListByUserIdAndActivityId(userId, activityId); | ||||
|         if (CollUtil.isEmpty(recordList)) { | ||||
|             return new KeyValue<>(activity, product); | ||||
|         } | ||||
| @@ -213,7 +213,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CombinationRecordDO> getRecordListByUserIdAndActivityId(Long userId, Long activityId) { | ||||
|     public List<CombinationRecordDO> getCombinationRecordListByUserIdAndActivityId(Long userId, Long activityId) { | ||||
|         return recordMapper.selectListByUserIdAndActivityId(userId, activityId); | ||||
|     } | ||||
|  | ||||
| @@ -227,12 +227,12 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Long getRecordsCount() { | ||||
|     public Long getCombinationRecordsCount() { | ||||
|         return recordMapper.selectCount(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Long getRecordsSuccessCount() { | ||||
|     public Long getCombinationRecordsSuccessCount() { | ||||
|         return recordMapper.selectCount(CombinationRecordDO::getStatus, CombinationRecordStatusEnum.SUCCESS.getStatus()); | ||||
|     } | ||||
|  | ||||
| @@ -242,32 +242,32 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Long getRecordsCountByDateType(Integer dateType) { | ||||
|     public Long getCombinationRecordsCountByDateType(Integer dateType) { | ||||
|         return recordMapper.selectCount(dateType); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CombinationRecordDO> getLatestRecordList(int count) { | ||||
|     public List<CombinationRecordDO> getLatestCombinationRecordList(int count) { | ||||
|         return recordMapper.selectLatestList(count); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CombinationRecordDO> getRecordListWithHead(Long activityId, Integer status, Integer count) { | ||||
|     public List<CombinationRecordDO> getCombinationRecordListWithHead(Long activityId, Integer status, Integer count) { | ||||
|         return recordMapper.selectList(activityId, status, count); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public CombinationRecordDO getRecordById(Long id) { | ||||
|     public CombinationRecordDO getCombinationRecordById(Long id) { | ||||
|         return recordMapper.selectById(id); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CombinationRecordDO> getRecordListByHeadId(Long headId) { | ||||
|     public List<CombinationRecordDO> getCombinationRecordListByHeadId(Long headId) { | ||||
|         return recordMapper.selectList(CombinationRecordDO::getHeadId, headId); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public PageResult<CombinationRecordDO> getBargainRecordPage(CombinationRecordReqPageVO pageVO) { | ||||
|     public PageResult<CombinationRecordDO> getCombinationRecordPage(CombinationRecordReqPageVO pageVO) { | ||||
|         return recordMapper.selectPage(pageVO); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -111,9 +111,6 @@ public class CombinationActivityServiceImplTest extends BaseDbUnitTest { | ||||
|             o.setStartTime(null); | ||||
|             o.setEndTime(null); | ||||
|             o.setUserSize(null); | ||||
|             o.setTotalCount(null); | ||||
|             o.setSuccessCount(null); | ||||
|             o.setOrderUserCount(null); | ||||
|             o.setVirtualGroup(null); | ||||
|             o.setStatus(null); | ||||
|             o.setLimitDuration(null); | ||||
| @@ -134,12 +131,6 @@ public class CombinationActivityServiceImplTest extends BaseDbUnitTest { | ||||
|         combinationActivityMapper.insert(cloneIgnoreId(dbCombinationActivity, o -> o.setEndTime(null))); | ||||
|         // 测试 userSize 不匹配 | ||||
|         combinationActivityMapper.insert(cloneIgnoreId(dbCombinationActivity, o -> o.setUserSize(null))); | ||||
|         // 测试 totalNum 不匹配 | ||||
|         combinationActivityMapper.insert(cloneIgnoreId(dbCombinationActivity, o -> o.setTotalCount(null))); | ||||
|         // 测试 successNum 不匹配 | ||||
|         combinationActivityMapper.insert(cloneIgnoreId(dbCombinationActivity, o -> o.setSuccessCount(null))); | ||||
|         // 测试 orderUserCount 不匹配 | ||||
|         combinationActivityMapper.insert(cloneIgnoreId(dbCombinationActivity, o -> o.setOrderUserCount(null))); | ||||
|         // 测试 virtualGroup 不匹配 | ||||
|         combinationActivityMapper.insert(cloneIgnoreId(dbCombinationActivity, o -> o.setVirtualGroup(null))); | ||||
|         // 测试 status 不匹配 | ||||
| @@ -173,9 +164,6 @@ public class CombinationActivityServiceImplTest extends BaseDbUnitTest { | ||||
|             o.setStartTime(null); | ||||
|             o.setEndTime(null); | ||||
|             o.setUserSize(null); | ||||
|             o.setTotalCount(null); | ||||
|             o.setSuccessCount(null); | ||||
|             o.setOrderUserCount(null); | ||||
|             o.setVirtualGroup(null); | ||||
|             o.setStatus(null); | ||||
|             o.setLimitDuration(null); | ||||
| @@ -196,12 +184,6 @@ public class CombinationActivityServiceImplTest extends BaseDbUnitTest { | ||||
|         combinationActivityMapper.insert(cloneIgnoreId(dbCombinationActivity, o -> o.setEndTime(null))); | ||||
|         // 测试 userSize 不匹配 | ||||
|         combinationActivityMapper.insert(cloneIgnoreId(dbCombinationActivity, o -> o.setUserSize(null))); | ||||
|         // 测试 totalNum 不匹配 | ||||
|         combinationActivityMapper.insert(cloneIgnoreId(dbCombinationActivity, o -> o.setTotalCount(null))); | ||||
|         // 测试 successNum 不匹配 | ||||
|         combinationActivityMapper.insert(cloneIgnoreId(dbCombinationActivity, o -> o.setSuccessCount(null))); | ||||
|         // 测试 orderUserCount 不匹配 | ||||
|         combinationActivityMapper.insert(cloneIgnoreId(dbCombinationActivity, o -> o.setOrderUserCount(null))); | ||||
|         // 测试 virtualGroup 不匹配 | ||||
|         combinationActivityMapper.insert(cloneIgnoreId(dbCombinationActivity, o -> o.setVirtualGroup(null))); | ||||
|         // 测试 status 不匹配 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 puhui999
					puhui999