Commit 01fca4e9c78515349c54eedf897fa031e92f7f6d
Committed by
Gitee
!1151 【缺陷修复】商城:订单支付后
Merge pull request !1151 from puhui999/develop2
Showing
7 changed files
with
43 additions
and
20 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuRespVO.java
| ... | ... | @@ -48,4 +48,9 @@ public class AppProductSpuRespVO { |
| 48 | 48 | @Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 49 | 49 | private Integer salesCount; |
| 50 | 50 | |
| 51 | + // ========== 物流相关字段 ========= | |
| 52 | + | |
| 53 | + @Schema(description = "配送方式数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 54 | + private List<Integer> deliveryTypes; | |
| 55 | + | |
| 51 | 56 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java
| ... | ... | @@ -152,7 +152,7 @@ public class CouponServiceImpl implements CouponService { |
| 152 | 152 | findAndThen(userCouponIdsMap, userId, couponIds::addAll); |
| 153 | 153 | } |
| 154 | 154 | } catch (Exception e) { |
| 155 | - log.error("[takeCouponsByAdmin][coupon({}) 优惠券发放失败]", entry, e); | |
| 155 | + log.error("[takeCouponsByAdmin][coupon({}) 优惠券发放失败 userId({})]", entry, userId, e); | |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | return couponIds; | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageRecordServiceImpl.java
| ... | ... | @@ -2,7 +2,10 @@ package cn.iocoder.yudao.module.trade.service.brokerage; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | -import cn.hutool.core.util.*; | |
| 5 | +import cn.hutool.core.util.ArrayUtil; | |
| 6 | +import cn.hutool.core.util.BooleanUtil; | |
| 7 | +import cn.hutool.core.util.ObjUtil; | |
| 8 | +import cn.hutool.core.util.ObjectUtil; | |
| 6 | 9 | import cn.hutool.extra.spring.SpringUtil; |
| 7 | 10 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 8 | 11 | import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; |
| ... | ... | @@ -26,12 +29,12 @@ import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageAddReqBO; |
| 26 | 29 | import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryRespBO; |
| 27 | 30 | import cn.iocoder.yudao.module.trade.service.config.TradeConfigService; |
| 28 | 31 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 32 | +import jakarta.annotation.Resource; | |
| 29 | 33 | import lombok.extern.slf4j.Slf4j; |
| 30 | 34 | import org.springframework.stereotype.Service; |
| 31 | 35 | import org.springframework.transaction.annotation.Transactional; |
| 32 | 36 | import org.springframework.validation.annotation.Validated; |
| 33 | 37 | |
| 34 | -import jakarta.annotation.Resource; | |
| 35 | 38 | import java.time.LocalDateTime; |
| 36 | 39 | import java.util.*; |
| 37 | 40 | |
| ... | ... | @@ -79,7 +82,7 @@ public class BrokerageRecordServiceImpl implements BrokerageRecordService { |
| 79 | 82 | TradeConfigDO memberConfig = tradeConfigService.getTradeConfig(); |
| 80 | 83 | // 0 未启用分销功能 |
| 81 | 84 | if (memberConfig == null || !BooleanUtil.isTrue(memberConfig.getBrokerageEnabled())) { |
| 82 | - log.warn("[addBrokerage][增加佣金失败:brokerageEnabled 未配置,userId({})", userId); | |
| 85 | + log.error("[addBrokerage][增加佣金失败:brokerageEnabled 未配置,userId({}) bizType({}) list({})", userId, bizType, list); | |
| 83 | 86 | return; |
| 84 | 87 | } |
| 85 | 88 | |
| ... | ... | @@ -180,7 +183,10 @@ public class BrokerageRecordServiceImpl implements BrokerageRecordService { |
| 180 | 183 | } else if (Objects.equals(sourceUserLevel, 2)) { |
| 181 | 184 | fixedPrice = item.getSecondFixedPrice(); |
| 182 | 185 | } else { |
| 183 | - throw new IllegalArgumentException(StrUtil.format("用户等级({}) 不合法", sourceUserLevel)); | |
| 186 | + log.error("[addBrokerage][user({}) list({}) brokerageFrozenDays({}) brokeragePercent({}) " + | |
| 187 | + "bizType({}) 用户等级sourceUserLevel({}) 不合法]", user, list, brokerageFrozenDays, | |
| 188 | + brokeragePercent, bizType, sourceUserLevel); | |
| 189 | + return; | |
| 184 | 190 | } |
| 185 | 191 | int brokeragePrice = calculatePrice(item.getBasePrice(), brokeragePercent, fixedPrice); |
| 186 | 192 | if (brokeragePrice <= 0) { | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java
| ... | ... | @@ -329,7 +329,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { |
| 329 | 329 | /** |
| 330 | 330 | * 校验支付订单的合法性 |
| 331 | 331 | * |
| 332 | - * @param order 交易订单 | |
| 332 | + * @param order 交易订单 | |
| 333 | 333 | * @param payOrderId 支付订单编号 |
| 334 | 334 | * @return 支付订单 |
| 335 | 335 | */ |
| ... | ... | @@ -747,7 +747,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { |
| 747 | 747 | } |
| 748 | 748 | DeliveryPickUpStoreDO deliveryPickUpStore = pickUpStoreService.getDeliveryPickUpStore(order.getPickUpStoreId()); |
| 749 | 749 | if (deliveryPickUpStore == null |
| 750 | - || !CollUtil.contains(deliveryPickUpStore.getVerifyUserIds(), userId)) { | |
| 750 | + || !CollUtil.contains(deliveryPickUpStore.getVerifyUserIds(), userId)) { | |
| 751 | 751 | throw exception(ORDER_PICK_UP_FAIL_NOT_VERIFY_USER); |
| 752 | 752 | } |
| 753 | 753 | |
| ... | ... | @@ -920,7 +920,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { |
| 920 | 920 | // 1. 检验订单存在 |
| 921 | 921 | TradeOrderDO order = tradeOrderMapper.selectOrderByIdAndUserId(orderId, userId); |
| 922 | 922 | if (order == null) { |
| 923 | - throw exception(ORDER_NOT_FOUND); | |
| 923 | + log.error("[updateOrderGiveCouponIds][userId({}) orderId({}) giveCouponIds({}) {}]", userId, orderId, | |
| 924 | + giveCouponIds, ORDER_NOT_FOUND); | |
| 925 | + return; | |
| 924 | 926 | } |
| 925 | 927 | |
| 926 | 928 | // 2. 更新订单赠送的优惠券编号列表 | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/level/MemberLevelApiImpl.java
| ... | ... | @@ -4,12 +4,11 @@ import cn.iocoder.yudao.module.member.api.level.dto.MemberLevelRespDTO; |
| 4 | 4 | import cn.iocoder.yudao.module.member.convert.level.MemberLevelConvert; |
| 5 | 5 | import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum; |
| 6 | 6 | import cn.iocoder.yudao.module.member.service.level.MemberLevelService; |
| 7 | +import jakarta.annotation.Resource; | |
| 8 | +import lombok.extern.slf4j.Slf4j; | |
| 7 | 9 | import org.springframework.stereotype.Service; |
| 8 | 10 | import org.springframework.validation.annotation.Validated; |
| 9 | 11 | |
| 10 | -import jakarta.annotation.Resource; | |
| 11 | - | |
| 12 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 13 | 12 | import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.EXPERIENCE_BIZ_NOT_SUPPORT; |
| 14 | 13 | |
| 15 | 14 | /** |
| ... | ... | @@ -17,6 +16,7 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.EXPERIENCE |
| 17 | 16 | * |
| 18 | 17 | * @author owen |
| 19 | 18 | */ |
| 19 | +@Slf4j | |
| 20 | 20 | @Service |
| 21 | 21 | @Validated |
| 22 | 22 | public class MemberLevelApiImpl implements MemberLevelApi { |
| ... | ... | @@ -33,7 +33,9 @@ public class MemberLevelApiImpl implements MemberLevelApi { |
| 33 | 33 | public void addExperience(Long userId, Integer experience, Integer bizType, String bizId) { |
| 34 | 34 | MemberExperienceBizTypeEnum bizTypeEnum = MemberExperienceBizTypeEnum.getByType(bizType); |
| 35 | 35 | if (bizTypeEnum == null) { |
| 36 | - throw exception(EXPERIENCE_BIZ_NOT_SUPPORT); | |
| 36 | + log.error("[addExperience][userId({}) experience({}) bizType({}) bizId({}) {}]", userId, experience, bizType, | |
| 37 | + bizId, EXPERIENCE_BIZ_NOT_SUPPORT); | |
| 38 | + return; | |
| 37 | 39 | } |
| 38 | 40 | memberLevelService.addExperience(userId, experience, bizTypeEnum, bizId); |
| 39 | 41 | } | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/point/MemberPointApiImpl.java
| ... | ... | @@ -3,11 +3,11 @@ package cn.iocoder.yudao.module.member.api.point; |
| 3 | 3 | import cn.hutool.core.lang.Assert; |
| 4 | 4 | import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum; |
| 5 | 5 | import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService; |
| 6 | +import jakarta.annotation.Resource; | |
| 7 | +import lombok.extern.slf4j.Slf4j; | |
| 6 | 8 | import org.springframework.stereotype.Service; |
| 7 | 9 | import org.springframework.validation.annotation.Validated; |
| 8 | 10 | |
| 9 | -import jakarta.annotation.Resource; | |
| 10 | - | |
| 11 | 11 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 12 | 12 | import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.POINT_RECORD_BIZ_NOT_SUPPORT; |
| 13 | 13 | |
| ... | ... | @@ -16,6 +16,7 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.POINT_RECO |
| 16 | 16 | * |
| 17 | 17 | * @author owen |
| 18 | 18 | */ |
| 19 | +@Slf4j | |
| 19 | 20 | @Service |
| 20 | 21 | @Validated |
| 21 | 22 | public class MemberPointApiImpl implements MemberPointApi { |
| ... | ... | @@ -28,7 +29,9 @@ public class MemberPointApiImpl implements MemberPointApi { |
| 28 | 29 | Assert.isTrue(point > 0); |
| 29 | 30 | MemberPointBizTypeEnum bizTypeEnum = MemberPointBizTypeEnum.getByType(bizType); |
| 30 | 31 | if (bizTypeEnum == null) { |
| 31 | - throw exception(POINT_RECORD_BIZ_NOT_SUPPORT); | |
| 32 | + log.error("[addPoint][userId({}) point({}) bizType({}) bizId({}) {}]", userId, point, bizType, bizId, | |
| 33 | + POINT_RECORD_BIZ_NOT_SUPPORT); | |
| 34 | + return; | |
| 32 | 35 | } |
| 33 | 36 | memberPointRecordService.createPointRecord(userId, point, bizTypeEnum, bizId); |
| 34 | 37 | } |
| ... | ... | @@ -38,7 +41,9 @@ public class MemberPointApiImpl implements MemberPointApi { |
| 38 | 41 | Assert.isTrue(point > 0); |
| 39 | 42 | MemberPointBizTypeEnum bizTypeEnum = MemberPointBizTypeEnum.getByType(bizType); |
| 40 | 43 | if (bizTypeEnum == null) { |
| 41 | - throw exception(POINT_RECORD_BIZ_NOT_SUPPORT); | |
| 44 | + log.error("[addPoint][userId({}) point({}) bizType({}) bizId({}) {}]", userId, point, bizType, bizId, | |
| 45 | + POINT_RECORD_BIZ_NOT_SUPPORT); | |
| 46 | + return; | |
| 42 | 47 | } |
| 43 | 48 | memberPointRecordService.createPointRecord(userId, -point, bizTypeEnum, bizId); |
| 44 | 49 | } | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordServiceImpl.java
| ... | ... | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.member.service.point; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.util.ObjectUtil; |
| 4 | 4 | import cn.hutool.core.util.StrUtil; |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 6 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 6 | import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO; |
| 8 | 7 | import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordPageReqVO; |
| ... | ... | @@ -11,6 +10,7 @@ import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; |
| 11 | 10 | import cn.iocoder.yudao.module.member.dal.mysql.point.MemberPointRecordMapper; |
| 12 | 11 | import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum; |
| 13 | 12 | import cn.iocoder.yudao.module.member.service.user.MemberUserService; |
| 13 | +import jakarta.annotation.Resource; | |
| 14 | 14 | import lombok.extern.slf4j.Slf4j; |
| 15 | 15 | import org.apache.commons.lang3.StringUtils; |
| 16 | 16 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -18,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional; |
| 18 | 18 | import org.springframework.util.CollectionUtils; |
| 19 | 19 | import org.springframework.validation.annotation.Validated; |
| 20 | 20 | |
| 21 | -import jakarta.annotation.Resource; | |
| 22 | 21 | import java.util.List; |
| 23 | 22 | import java.util.Set; |
| 24 | 23 | |
| ... | ... | @@ -75,13 +74,17 @@ public class MemberPointRecordServiceImpl implements MemberPointRecordService { |
| 75 | 74 | Integer userPoint = ObjectUtil.defaultIfNull(user.getPoint(), 0); |
| 76 | 75 | int totalPoint = userPoint + point; // 用户变动后的积分 |
| 77 | 76 | if (totalPoint < 0) { |
| 78 | - throw exception(USER_POINT_NOT_ENOUGH); | |
| 77 | + log.error("[createPointRecord][userId({}) point({}) bizType({}) bizId({}) {}]", userId, point, bizType, bizId, | |
| 78 | + USER_POINT_NOT_ENOUGH); | |
| 79 | + return; | |
| 79 | 80 | } |
| 80 | 81 | |
| 81 | 82 | // 2. 更新用户积分 |
| 82 | 83 | boolean success = memberUserService.updateUserPoint(userId, point); |
| 83 | 84 | if (!success) { |
| 84 | - throw exception(USER_POINT_NOT_ENOUGH); | |
| 85 | + log.error("[createPointRecord][userId({}) point({}) bizType({}) bizId({}) {}]", userId, point, bizType, bizId, | |
| 86 | + USER_POINT_NOT_ENOUGH); | |
| 87 | + return; | |
| 85 | 88 | } |
| 86 | 89 | |
| 87 | 90 | // 3. 增加积分记录 | ... | ... |