diff --git a/yudao-framework/yudao-spring-boot-starter-biz-ip/src/main/java/cn/iocoder/yudao/framework/ip/core/utils/AreaUtils.java b/yudao-framework/yudao-spring-boot-starter-biz-ip/src/main/java/cn/iocoder/yudao/framework/ip/core/utils/AreaUtils.java index 8455dff9a..552bfc9be 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-ip/src/main/java/cn/iocoder/yudao/framework/ip/core/utils/AreaUtils.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-ip/src/main/java/cn/iocoder/yudao/framework/ip/core/utils/AreaUtils.java @@ -132,7 +132,9 @@ public class AreaUtils { return convertList(areas.values(), func, area -> type.getType().equals(area.getType())); } + // TODO @疯狂:注释写下; public static Integer getParentIdByType(Integer id, @NonNull AreaTypeEnum type) { + // TODO @疯狂:这种不要用 while true;因为万一脏数据,可能会死循环;可以转换成 for (int i = 0; i < Byte.MAX; i++) 一般是优先层级; do { Area area = AreaUtils.getArea(id); if (area == null) { diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java index f45b0be1f..4b42aca07 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java @@ -6,8 +6,6 @@ import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidate import javax.validation.Valid; -// TODO @芋艿:后面也再撸撸这几个接口 - /** * 拼团记录 API 接口 * @@ -30,7 +28,7 @@ public interface CombinationRecordApi { * 创建开团记录 * * @param reqDTO 请求 DTO - * @return key 开团记录编号 value 团长编号 + * @return key 开团记录编号、value 团长编号 */ KeyValue createCombinationRecord(@Valid CombinationRecordCreateReqDTO reqDTO); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java index 4a3f1dbd5..5588f3735 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java @@ -29,6 +29,7 @@ public class CombinationRecordApiImpl implements CombinationRecordApi { recordService.validateCombinationRecord(userId, activityId, headId, skuId, count); } + // TODO @puhui999:搞个创建的 RespDTO 哈; @Override public KeyValue createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) { return recordService.createCombinationRecord(reqDTO); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java index 98a4f3cdd..8f2b3fe99 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java @@ -40,6 +40,9 @@ public class CombinationRecordController { @Lazy private CombinationRecordService combinationRecordService; + // TODO @puhui999:getBargainRecordPage 和 getBargainRecordPage 是不是可以合并;然后 CombinationRecordReqPageVO 加一个 headId; + // 然后如果 headId 非空,并且第一页,单独多查询一条 head ;放到第 0 个位置;相当于说,第一页特殊一点; + @GetMapping("/page") @Operation(summary = "获得拼团记录分页") @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") @@ -47,6 +50,7 @@ public class CombinationRecordController { PageResult recordPage = combinationRecordService.getCombinationRecordPage(pageVO); List activities = combinationActivityService.getCombinationActivityListByIds( convertSet(recordPage.getList(), CombinationRecordDO::getActivityId)); + // TODO @puhui999:商品没读取 return success(CombinationActivityConvert.INSTANCE.convert(recordPage, activities)); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java index e09e9fdb8..b4805e6f9 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java @@ -27,7 +27,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.context.annotation.Lazy; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -49,20 +48,15 @@ public class AppBargainRecordController { @Resource private BargainHelpService bargainHelpService; @Resource - @Lazy private BargainRecordService bargainRecordService; @Resource - @Lazy private BargainActivityService bargainActivityService; - @Resource private TradeOrderApi tradeOrderApi; @Resource - @Lazy private MemberUserApi memberUserApi; @Resource - @Lazy private ProductSpuApi productSpuApi; @GetMapping("/get-summary") diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java index ea62b2005..0d4b85cd3 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java @@ -9,7 +9,6 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityD import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; import java.time.LocalDateTime; import java.util.Collection; @@ -87,6 +86,7 @@ public interface BargainActivityMapper extends BaseMapperX { .last("LIMIT " + count)); } + // TODO @puhui999:是不是返回 BargainActivityDO 更干净哈? /** * 查询出指定 spuId 的 spu 参加的活动最接近现在的一条记录。多个的话,一个 spuId 对应一个最近的活动编号 * @@ -94,7 +94,7 @@ public interface BargainActivityMapper extends BaseMapperX { * @param status 状态 * @return 包含 spuId 和 activityId 的 map 对象列表 */ - default List> selectSpuIdAndActivityIdMapsBySpuIdsAndStatus(@Param("spuIds") Collection spuIds, @Param("status") Integer status) { + default List> selectSpuIdAndActivityIdMapsBySpuIdsAndStatus(Collection spuIds, Integer status) { return selectMaps(new QueryWrapper() .select("spu_id AS spuId, MAX(DISTINCT(id)) AS activityId") // 时间越大 id 也越大 直接用 id .in("spu_id", spuIds) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java index c232fb9d9..5d85c8938 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java @@ -120,6 +120,7 @@ public interface CombinationRecordMapper extends BaseMapperX() + // TODO @puhui999:这种偏逻辑性的,不要给 mapper 哈;可以考虑拆成 2 个 mapper,上层也是 2 个 service; .select(status == null && virtualGroup == null && headId == null, "DISTINCT (user_id)") .eq(status != null, "status", status) .eq(virtualGroup != null, "virtual_group", virtualGroup) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/job/combination/CombinationRecordExpireJob.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/job/combination/CombinationRecordExpireJob.java index 2ee6e8b63..fc0e4c6bc 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/job/combination/CombinationRecordExpireJob.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/job/combination/CombinationRecordExpireJob.java @@ -22,7 +22,7 @@ public class CombinationRecordExpireJob implements JobHandler { @Override @TenantJob - public String execute(String param) throws Exception { + public String execute(String param) { KeyValue keyValue = combinationRecordService.expireCombinationRecord(); return StrUtil.format("过期拼团 {} 个, 虚拟成团 {} 个", keyValue.getKey(), keyValue.getValue()); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityServiceImpl.java index 364cdf9ee..d43c98ba4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityServiceImpl.java @@ -94,7 +94,6 @@ public class BargainActivityServiceImpl implements BargainActivityService { } else if (count > 0) { bargainActivityMapper.updateStock(id, count); } - } private void validateBargainConflict(Long spuId, Long activityId) { @@ -184,12 +183,13 @@ public class BargainActivityServiceImpl implements BargainActivityService { @Override public List getBargainActivityBySpuIdsAndStatus(Collection spuIds, Integer status) { - // 1.查询出指定 spuId 的 spu 参加的活动最接近现在的一条记录。多个的话,一个 spuId 对应一个最近的活动编号 + // 1. 查询出指定 spuId 的 spu 参加的活动最接近现在的一条记录。多个的话,一个 spuId 对应一个最近的活动编号 + // TODO @puhui999:我想了下,这种是不是只展示当前正在进行中的。已经结束、或者未开始的,可能没啥意义? List> spuIdAndActivityIdMaps = bargainActivityMapper.selectSpuIdAndActivityIdMapsBySpuIdsAndStatus(spuIds, status); if (CollUtil.isEmpty(spuIdAndActivityIdMaps)) { return Collections.emptyList(); } - // 2.查询活动详情 + // 2. 查询活动详情 return bargainActivityMapper.selectListByIds(convertSet(spuIdAndActivityIdMaps, map -> MapUtil.getLong(map, "activityId"))); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java index 68cdde760..e6200c4d0 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java @@ -146,7 +146,6 @@ public interface CombinationRecordService { */ PageResult getCombinationRecordPage2(CombinationRecordReqPage2VO pageVO); - /** * 【拼团活动】获得拼团记录数量 Map * @@ -159,7 +158,6 @@ public interface CombinationRecordService { @Nullable Integer status, @Nullable Long headId); - /** * 获取拼团记录 * diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java index 76122fa39..17b8a6ef4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java @@ -23,7 +23,6 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationR import cn.iocoder.yudao.module.promotion.dal.mysql.combination.CombinationRecordMapper; import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi; -import org.springframework.context.annotation.Lazy; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -52,7 +51,6 @@ import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*; public class CombinationRecordServiceImpl implements CombinationRecordService { @Resource - @Lazy private CombinationActivityService combinationActivityService; @Resource private CombinationRecordMapper combinationRecordMapper; @@ -60,16 +58,13 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { @Resource private MemberUserApi memberUserApi; @Resource - @Lazy private ProductSpuApi productSpuApi; @Resource - @Lazy private ProductSkuApi productSkuApi; @Resource private TradeOrderApi tradeOrderApi; - // TODO @芋艿:在详细预览下; @Override @Transactional(rollbackFor = Exception.class) public void updateCombinationRecordStatusByUserIdAndOrderId(Integer status, Long userId, Long orderId) { @@ -77,6 +72,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { CombinationRecordDO record = validateCombinationRecord(userId, orderId); // 更新状态 + // TODO @puhui999:不要整个更新,new 一个出来;why?例如说,两个线程都去更新,这样存在相互覆盖的问题 record.setStatus(status); combinationRecordMapper.updateById(record); } @@ -169,16 +165,16 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { @Override @Transactional(rollbackFor = Exception.class) public KeyValue createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) { - // 1.校验拼团活动 + // 1. 校验拼团活动 KeyValue keyValue = validateCombinationRecord(reqDTO.getUserId(), reqDTO.getActivityId(), reqDTO.getHeadId(), reqDTO.getSkuId(), reqDTO.getCount()); - // 2.组合数据创建拼团记录 + // 2. 组合数据创建拼团记录 MemberUserRespDTO user = memberUserApi.getUser(reqDTO.getUserId()); ProductSpuRespDTO spu = productSpuApi.getSpu(reqDTO.getSpuId()); ProductSkuRespDTO sku = productSkuApi.getSku(reqDTO.getSkuId()); CombinationRecordDO record = CombinationActivityConvert.INSTANCE.convert(reqDTO, keyValue.getKey(), user, spu, sku); - // 2.1.如果是团长需要设置 headId 为 CombinationRecordDO#HEAD_ID_GROUP + // 2.1. 如果是团长需要设置 headId 为 CombinationRecordDO#HEAD_ID_GROUP if (record.getHeadId() == null) { record.setStartTime(LocalDateTime.now()) .setExpireTime(keyValue.getKey().getStartTime().plusHours(keyValue.getKey().getLimitDuration())) @@ -191,12 +187,10 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { } combinationRecordMapper.insert(record); - if (ObjUtil.equal(CombinationRecordDO.HEAD_ID_GROUP, record.getHeadId())) { - return new KeyValue<>(record.getId(), record.getHeadId()); + // 3. 更新拼团记录 + if (ObjUtil.notEqual(CombinationRecordDO.HEAD_ID_GROUP, record.getHeadId())) { + updateCombinationRecordWhenCreate(reqDTO.getHeadId(), keyValue.getKey()); } - - // 3、更新拼团记录 - updateCombinationRecordWhenCreate(reqDTO.getHeadId(), keyValue.getKey()); return new KeyValue<>(record.getId(), record.getHeadId()); } @@ -349,6 +343,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { @Override public KeyValue expireCombinationRecord() { + // TODO @puhui999:数字一般是 1. 2. 这种格式哈 // 1。获取所有正在进行中的过期的父拼团 List headExpireRecords = combinationRecordMapper.selectListByHeadIdAndStatusAndExpireTimeLt( CombinationRecordDO.HEAD_ID_GROUP, CombinationRecordStatusEnum.IN_PROGRESS.getStatus(), LocalDateTime.now()); @@ -356,18 +351,21 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { return new KeyValue<>(0, 0); } - // 2.获取拼团活动 + // 2. 获取拼团活动 + // TODO @puhui999:在自己模块里,变量可以简略点;例如说 activityList List combinationActivities = combinationActivityService.getCombinationActivityListByIds( convertSet(headExpireRecords, CombinationRecordDO::getActivityId)); Map activityMap = convertMap(combinationActivities, CombinationActivityDO::getId); - // 3.校验是否虚拟成团 + // TODO @puhui999:job 一般不建议异步跑;因为可能下次跑,结果上次还没跑完; + // TODO 这里,我们可以每个 record 处理下;然后按照是否需要虚拟拼团,各搞一个方法逻辑 + 事务;这样,保证 job 里面尽量不要大事务,而是 n 个独立小事务的处理。 + // 3. 校验是否虚拟成团 List virtualGroupHeadRecords = new ArrayList<>(); // 虚拟成团 for (Iterator iterator = headExpireRecords.iterator(); iterator.hasNext(); ) { CombinationRecordDO record = iterator.next(); // 3.1 不匹配,则直接跳过 - CombinationActivityDO activityDO = activityMap.get(record.getActivityId()); - if (activityDO == null || !activityDO.getVirtualGroup()) { // 取不到活动的或者不是虚拟拼团的 + CombinationActivityDO activity = activityMap.get(record.getActivityId()); + if (activity == null || !activity.getVirtualGroup()) { // 取不到活动的或者不是虚拟拼团的 continue; } // 3.2 匹配,则移除,添加到虚拟成团中,并结束寻找 @@ -380,7 +378,6 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { getSelf().handleExpireRecord(headExpireRecords); // 5.虚拟成团 getSelf().handleVirtualGroupRecord(virtualGroupHeadRecords); - return new KeyValue<>(headExpireRecords.size(), virtualGroupHeadRecords.size()); } @@ -401,7 +398,6 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { headsAndRecords.forEach(item -> { tradeOrderApi.cancelPaidOrder(item.getUserId(), item.getOrderId()); }); - } @Async @@ -410,9 +406,9 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { return; } - // 1.团员补齐 + // 1. 团员补齐 combinationRecordMapper.insertBatch(CombinationActivityConvert.INSTANCE.convertVirtualGroupList(virtualGroupHeadRecords)); - // 2.更新拼团记录 + // 2. 更新拼团记录 updateBatchCombinationRecords(virtualGroupHeadRecords, CombinationRecordStatusEnum.SUCCESS); } diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/infra/ApiAccessLogStatisticsMapper.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/infra/ApiAccessLogStatisticsMapper.java index 0e8d719ad..757b8f544 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/infra/ApiAccessLogStatisticsMapper.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/infra/ApiAccessLogStatisticsMapper.java @@ -7,15 +7,17 @@ import org.apache.ibatis.annotations.Param; import java.time.LocalDateTime; /** - * API 访问日志统计 Mapper + * API 访问日志的统计 Mapper * * @author owen */ @Mapper public interface ApiAccessLogStatisticsMapper extends BaseMapperX { - Integer selectCountByIp(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); + Integer selectCountByIp(@Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); - Integer selectCountByUserId(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); + Integer selectCountByUserId(@Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); } diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/member/MemberStatisticsMapper.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/member/MemberStatisticsMapper.java index 22a89ea9d..ca6c6d362 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/member/MemberStatisticsMapper.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/member/MemberStatisticsMapper.java @@ -10,7 +10,7 @@ import java.time.LocalDateTime; import java.util.List; /** - * 会员统计 Mapper + * 会员信息的统计 Mapper * * @author owen */ @@ -21,6 +21,7 @@ public interface MemberStatisticsMapper extends BaseMapperX { List selectSummaryListBySex(); - Integer selectUserCount(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); + Integer selectUserCount(@Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); } diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java index 75e6a4ae1..4aff0ab8d 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/mysql/pay/PayWalletStatisticsMapper.java @@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Param; import java.time.LocalDateTime; /** - * 交易统计 Mapper + * 支付钱包的统计 Mapper * * @author owen */ @@ -29,6 +29,7 @@ public interface PayWalletStatisticsMapper extends BaseMapperX { + // TODO @疯狂:这个要不要也挪到 xml 里,保持统一? @Select("SELECT IFNULL(SUM(order_create_count), 0) AS count, IFNULL(SUM(order_pay_price), 0) AS summary " + "FROM trade_statistics " + "WHERE time BETWEEN #{beginTime} AND #{endTime} AND deleted = FALSE") @@ -33,4 +34,5 @@ public interface TradeStatisticsMapper extends BaseMapperX { Integer selectExpensePriceByTimeBetween(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime); + } diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/infra/ApiAccessLogStatisticsService.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/infra/ApiAccessLogStatisticsService.java index c83f4da82..e29f5fd9c 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/infra/ApiAccessLogStatisticsService.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/infra/ApiAccessLogStatisticsService.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.statistics.service.infra; import java.time.LocalDateTime; /** - * API 访问日志统计 Service 接口 + * API 访问日志的统计 Service 接口 * * @author owen */ diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/infra/ApiAccessLogStatisticsServiceImpl.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/infra/ApiAccessLogStatisticsServiceImpl.java index 4c9fb08e2..be920169f 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/infra/ApiAccessLogStatisticsServiceImpl.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/infra/ApiAccessLogStatisticsServiceImpl.java @@ -8,7 +8,7 @@ import javax.annotation.Resource; import java.time.LocalDateTime; /** - * API 访问日志统计 Service 实现类 + * API 访问日志的统计 Service 实现类 * * @author owen */ diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsService.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsService.java index 2c84c3616..7c60affeb 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsService.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsService.java @@ -9,7 +9,7 @@ import java.time.LocalDateTime; import java.util.List; /** - * 会员统计 Service 接口 + * 会员信息的统计 Service 接口 * * @author owen */ diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsServiceImpl.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsServiceImpl.java index 153e7c581..02623e7de 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsServiceImpl.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsServiceImpl.java @@ -24,7 +24,7 @@ import java.util.Optional; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; /** - * 会员统计 Service 实现类 + * 会员信息的统计 Service 实现类 * * @author owen */ diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsService.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsService.java index 77e3e4fd2..09285f88f 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsService.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsService.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; import java.time.LocalDateTime; /** - * 钱包统计 Service 接口 + * 钱包的统计 Service 接口 * * @author owen */ diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsServiceImpl.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsServiceImpl.java index 28b1f434e..f2cfd5bf7 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsServiceImpl.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/pay/PayWalletStatisticsServiceImpl.java @@ -12,7 +12,7 @@ import javax.annotation.Resource; import java.time.LocalDateTime; /** - * 钱包统计 Service 实现类 + * 钱包的统计 Service 实现类 * * @author owen */ @@ -31,11 +31,10 @@ public class PayWalletStatisticsServiceImpl implements PayWalletStatisticsServic beginTime, endTime, PayRefundStatusEnum.SUCCESS.getStatus()); Integer walletPayPrice = payWalletStatisticsMapper.selectPriceSummaryByBizTypeAndCreateTimeBetween( beginTime, endTime, PayWalletBizTypeEnum.PAYMENT.getType()); - - paySummary.setOrderWalletPayPrice(walletPayPrice); - paySummary.setRechargeRefundCount(refundSummary.getRechargeRefundCount()); - paySummary.setRechargeRefundPrice(refundSummary.getRechargeRefundPrice()); - + // 拼接 + paySummary.setOrderWalletPayPrice(walletPayPrice) + .setRechargeRefundCount(refundSummary.getRechargeRefundCount()) + .setRechargeRefundPrice(refundSummary.getRechargeRefundPrice()); return paySummary; } diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeOrderStatisticsService.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeOrderStatisticsService.java index b02745e6f..9388fe76c 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeOrderStatisticsService.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeOrderStatisticsService.java @@ -7,7 +7,7 @@ import java.time.LocalDateTime; import java.util.List; /** - * 交易订单统计 Service 接口 + * 交易订单的统计 Service 接口 * * @author owen */ diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsServiceImpl.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsServiceImpl.java index 7a25dfe89..6a751a0cd 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsServiceImpl.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsServiceImpl.java @@ -45,16 +45,15 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { @Override public TradeStatisticsComparisonRespVO getTradeSummaryComparison() { - // 昨天的数据 + // 1.1 昨天的数据 TradeSummaryRespBO yesterdayData = getTradeSummaryByDays(-1); - // 前天的数据(用于对照昨天的数据) + // 1.2 前天的数据(用于对照昨天的数据) TradeSummaryRespBO beforeYesterdayData = getTradeSummaryByDays(-2); - - // 本月数据; + // 2.1 本月数据 TradeSummaryRespBO monthData = getTradeSummaryByMonths(0); - // 上月数据(用于对照本月的数据) + // 2.2 上月数据(用于对照本月的数据) TradeSummaryRespBO lastMonthData = getTradeSummaryByMonths(-1); - + // 转换返回 return TradeStatisticsConvert.INSTANCE.convert(yesterdayData, beforeYesterdayData, monthData, lastMonthData); } @@ -81,31 +80,31 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { @Override public String statisticsYesterdayTrade() { - // 处理统计参数 LocalDateTime yesterday = LocalDateTime.now().minusDays(1); LocalDateTime beginTime = LocalDateTimeUtil.beginOfDay(yesterday); LocalDateTime endTime = LocalDateTimeUtil.endOfDay(yesterday); - // 统计 + // 1.1 统计订单 StopWatch stopWatch = new StopWatch("交易统计"); stopWatch.start("统计订单"); TradeOrderSummaryRespBO orderSummary = tradeOrderStatisticsService.getOrderSummary(beginTime, endTime); stopWatch.stop(); - + // 1.2 统计售后 stopWatch.start("统计售后"); AfterSaleSummaryRespBO afterSaleSummary = afterSaleStatisticsService.getAfterSaleSummary(beginTime, endTime); stopWatch.stop(); - + // 1.3 统计佣金 stopWatch.start("统计佣金"); Integer brokerageSettlementPrice = brokerageStatisticsService.getBrokerageSettlementPriceSummary(beginTime, endTime); stopWatch.stop(); - + // 1.4 统计充值 stopWatch.start("统计充值"); WalletSummaryRespBO walletSummary = payWalletStatisticsService.getWalletSummary(beginTime, endTime); stopWatch.stop(); - // 插入数据 - TradeStatisticsDO entity = TradeStatisticsConvert.INSTANCE.convert(yesterday, orderSummary, afterSaleSummary, brokerageSettlementPrice, walletSummary); + + // 2. 插入数据 + TradeStatisticsDO entity = TradeStatisticsConvert.INSTANCE.convert(yesterday, orderSummary, afterSaleSummary, + brokerageSettlementPrice, walletSummary); tradeStatisticsMapper.insert(entity); - // 返回计时结果 return stopWatch.prettyPrint(); } diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/bo/WalletSummaryRespBO.java b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/bo/WalletSummaryRespBO.java index 97e319722..ada494e30 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/bo/WalletSummaryRespBO.java +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/bo/WalletSummaryRespBO.java @@ -9,6 +9,7 @@ import lombok.Data; */ @Data public class WalletSummaryRespBO { + /** * 总支付金额(余额),单位:分 */ diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/infra/ApiAccessLogStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/infra/ApiAccessLogStatisticsMapper.xml index 2ef803ac1..6ff6c1307 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/infra/ApiAccessLogStatisticsMapper.xml +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/infra/ApiAccessLogStatisticsMapper.xml @@ -1,20 +1,22 @@ + + diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/member/MemberStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/member/MemberStatisticsMapper.xml index decdd78a6..f739656d7 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/member/MemberStatisticsMapper.xml +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/member/MemberStatisticsMapper.xml @@ -8,6 +8,7 @@ FROM member_user WHERE deleted = FALSE GROUP BY area_id + ORDER BY userCount DESC @@ -17,6 +18,7 @@ FROM member_user WHERE deleted = FALSE GROUP BY sex + ORDER BY userCount DESC @@ -31,4 +33,5 @@ AND create_time <= #{endTime} - \ No newline at end of file + + diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/pay/PayWalletStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/pay/PayWalletStatisticsMapper.xml index e03f490a3..a8acb056f 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/pay/PayWalletStatisticsMapper.xml +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/pay/PayWalletStatisticsMapper.xml @@ -7,8 +7,8 @@ SUM(pay_price) AS rechargePayPrice FROM pay_wallet_recharge WHERE pay_status = #{payStatus} - AND deleted = FALSE AND pay_time BETWEEN #{beginTime} AND #{endTime} + AND deleted = FALSE SELECT SUM(price) FROM pay_wallet_transaction WHERE biz_type = #{bizType} - AND deleted = FALSE AND create_time BETWEEN #{beginTime} AND #{endTime} + AND deleted = FALSE + diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/AfterSaleStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/AfterSaleStatisticsMapper.xml index c89fe9ed4..000cb26fd 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/AfterSaleStatisticsMapper.xml +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/AfterSaleStatisticsMapper.xml @@ -1,12 +1,14 @@ + + diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/BrokerageStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/BrokerageStatisticsMapper.xml index ae19fcef4..f8f9b2c11 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/BrokerageStatisticsMapper.xml +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/BrokerageStatisticsMapper.xml @@ -1,12 +1,14 @@ + + diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/TradeOrderStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/TradeOrderStatisticsMapper.xml index 0d585f2a2..dbc3a11c7 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/TradeOrderStatisticsMapper.xml +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/TradeOrderStatisticsMapper.xml @@ -1,6 +1,7 @@ + SELECT COUNT(1) FROM trade_order - WHERE deleted = FALSE + WHERE pay_time BETWEEN #{beginTime} AND #{endTime} AND pay_status = TRUE - AND pay_time BETWEEN #{beginTime} AND #{endTime} + AND deleted = FALSE GROUP BY user_id + diff --git a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/TradeStatisticsMapper.xml b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/TradeStatisticsMapper.xml index 06f8cf993..5ca3c38ed 100644 --- a/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/TradeStatisticsMapper.xml +++ b/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/trade/TradeStatisticsMapper.xml @@ -1,6 +1,7 @@ + + diff --git a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/aftersale/TradeAfterSaleApi.java b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/aftersale/TradeAfterSaleApi.java deleted file mode 100644 index 5f58b5393..000000000 --- a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/aftersale/TradeAfterSaleApi.java +++ /dev/null @@ -1,10 +0,0 @@ -package cn.iocoder.yudao.module.trade.api.aftersale; - -/** - * 售后 API 接口 - * - * @author owen - */ -public interface TradeAfterSaleApi { - -} diff --git a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/brokerage/TradeBrokerageApi.java b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/brokerage/TradeBrokerageApi.java deleted file mode 100644 index 8628098a3..000000000 --- a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/brokerage/TradeBrokerageApi.java +++ /dev/null @@ -1,10 +0,0 @@ -package cn.iocoder.yudao.module.trade.api.brokerage; - -/** - * 分销 API 接口 - * - * @author owen - */ -public interface TradeBrokerageApi { - -} diff --git a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApi.java b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApi.java index 6de900bfa..744a7b8fd 100644 --- a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApi.java +++ b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApi.java @@ -28,16 +28,7 @@ public interface TradeOrderApi { */ TradeOrderRespDTO getOrder(Long id); - /** - * 更新拼团相关信息到订单 - * - * @param orderId 订单编号 - * @param activityId 拼团活动编号 - * @param combinationRecordId 拼团记录编号 - * @param headId 团长编号 - */ - void updateOrderCombinationInfo(Long orderId, Long activityId, Long combinationRecordId, Long headId); - + // TODO 芋艿:需要优化下; /** * 取消支付订单 * diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/aftersale/TradeAfterSaleApiImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/aftersale/TradeAfterSaleApiImpl.java deleted file mode 100644 index 474943e38..000000000 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/aftersale/TradeAfterSaleApiImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.iocoder.yudao.module.trade.api.aftersale; - -import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleService; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.annotation.Resource; - -/** - * 售后 API 接口实现类 - * - * @author owen - */ -@Service -@Validated -public class TradeAfterSaleApiImpl implements TradeAfterSaleApi { - - @Resource - private AfterSaleService afterSaleService; - -} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/brokerage/TradeBrokerageApiImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/brokerage/TradeBrokerageApiImpl.java deleted file mode 100644 index c860d4b7f..000000000 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/brokerage/TradeBrokerageApiImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.iocoder.yudao.module.trade.api.brokerage; - -import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.annotation.Resource; - -/** - * 订单 API 接口实现类 - * - * @author HUIHUI - */ -@Service -@Validated -public class TradeBrokerageApiImpl implements TradeBrokerageApi { - - @Resource - private BrokerageRecordService brokerageRecordService; - -} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApiImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApiImpl.java index 87489972b..3cb7bbae7 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApiImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApiImpl.java @@ -2,10 +2,8 @@ package cn.iocoder.yudao.module.trade.api.order; import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert; -import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService; -import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -13,9 +11,6 @@ import javax.annotation.Resource; import java.util.Collection; import java.util.List; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_NOT_FOUND; - /** * 订单 API 接口实现类 * @@ -28,7 +23,6 @@ public class TradeOrderApiImpl implements TradeOrderApi { @Resource private TradeOrderUpdateService tradeOrderUpdateService; @Resource - @Lazy private TradeOrderQueryService tradeOrderQueryService; @Override @@ -41,11 +35,6 @@ public class TradeOrderApiImpl implements TradeOrderApi { return TradeOrderConvert.INSTANCE.convert(tradeOrderQueryService.getOrder(id)); } - @Override - public void updateOrderCombinationInfo(Long orderId, Long activityId, Long combinationRecordId, Long headId) { - tradeOrderUpdateService.updateOrderCombinationInfo(orderId, activityId, combinationRecordId, headId); - } - @Override public void cancelPaidOrder(Long userId, Long orderId) { tradeOrderUpdateService.cancelPaidOrder(userId, orderId); diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java index 20bd9cb7f..d1b3dc2f8 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java @@ -93,6 +93,7 @@ public interface TradeOrderMapper extends BaseMapperX { return selectOne(TradeOrderDO::getPickUpVerifyCode, pickUpVerifyCode); } + // TODO @hui999:是不是只针对 combinationActivityId 的查询呀? default TradeOrderDO selectByUserIdAndActivityIdAndStatus(Long userId, Long activityId, Integer status) { return selectOne(new LambdaQueryWrapperX() .and(q -> q.eq(TradeOrderDO::getUserId, userId) diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java index 352d0083c..765b84e8b 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java @@ -657,7 +657,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { public void updateOrderAddress(TradeOrderUpdateAddressReqVO reqVO) { // 校验交易订单 TradeOrderDO order = validateOrderExists(reqVO.getId()); - // 只有待发货状态才可以修改订单收货地址; + // 只有待发货状态,才可以修改订单收货地址; if (!TradeOrderStatusEnum.isUndelivered(order.getStatus())) { throw exception(ORDER_UPDATE_ADDRESS_FAIL_STATUS_NOT_DELIVERED); } @@ -823,11 +823,11 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { @Override @Transactional(rollbackFor = Exception.class) public void cancelPaidOrder(Long userId, Long orderId) { + // TODO 芋艿:这里实现要优化下; TradeOrderDO order = tradeOrderMapper.selectOrderByIdAndUserId(orderId, userId); if (order == null) { throw exception(ORDER_NOT_FOUND); } - cancelOrder0(order, TradeOrderCancelTypeEnum.MEMBER_CANCEL); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java index 5c00e5a12..9d32190fb 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java @@ -10,7 +10,6 @@ import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService; -import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -29,14 +28,11 @@ import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_DELIV public class TradeCombinationOrderHandler implements TradeOrderHandler { @Resource - @Lazy private TradeOrderUpdateService orderUpdateService; @Resource - @Lazy private TradeOrderQueryService orderQueryService; @Resource - @Lazy private CombinationRecordApi combinationRecordApi; @Override @@ -51,7 +47,9 @@ public class TradeCombinationOrderHandler implements TradeOrderHandler { TradeOrderItemDO item = orderItems.get(0); combinationRecordApi.validateCombinationRecord(order.getUserId(), order.getCombinationActivityId(), order.getCombinationHeadId(), item.getSkuId(), item.getCount()); - // 2. 校验该用户是否存在未支付的拼团活动订单;就是还没支付的时候,重复下单了;需要校验下;不然的话,一个拼团可以下多个单子了; + + // 2. 校验该用户是否存在未支付的拼团活动订单,避免一个拼团可以下多个单子了 + // TODO @puhui999:只校验未支付的拼团订单噢 TradeOrderDO activityOrder = orderQueryService.getActivityOrderByUserIdAndActivityIdAndStatus( order.getUserId(), order.getCombinationActivityId(), TradeOrderStatusEnum.UNPAID.getStatus()); if (activityOrder != null) { diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/wallet/PayWalletApi.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/wallet/PayWalletApi.java deleted file mode 100644 index 5bb50bf6d..000000000 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/api/wallet/PayWalletApi.java +++ /dev/null @@ -1,10 +0,0 @@ -package cn.iocoder.yudao.module.pay.api.wallet; - -/** - * 钱包 API 接口 - * - * @author owen - */ -public interface PayWalletApi { - -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/api/wallet/PayWalletApiImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/api/wallet/PayWalletApiImpl.java deleted file mode 100644 index 89be2a25e..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/api/wallet/PayWalletApiImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.iocoder.yudao.module.pay.api.wallet; - -import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargeService; -import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.annotation.Resource; - -/** - * 钱包 API 接口实现类 - * - * @author owen - */ -@Service -@Validated -public class PayWalletApiImpl implements PayWalletApi { - - @Resource - private PayWalletRechargeService payWalletRechargeService; - @Resource - private PayWalletTransactionService payWalletTransactionService; - -}