ソースを参照

fix 订单金额打折优惠顺序

zoujiajian 3 年 前
コミット
caccddd26e

+ 15 - 14
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -1983,6 +1983,21 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			orderDon.setCouponMoney(couponMoney);
 			orderDon.setCouponUserId(couponUser.getId());
 		}
+		//特殊渠道推广优惠. 360
+		if (orderDon.getPopularizeId() != null && orderDon.getPopularizeId() != 0L) {
+			//使用了优惠券 不再使用360渠道 折扣
+			if (couponUser == null && goodsType == 1) {
+				String name = channelPopularizeMapper.selectChannelByPid(orderDon.getPopularizeId());
+				if (Constant.CHANNEL_NAME_360.equals(name)) {
+					SysConfig sysConfig = sysConfigService.getBaseMapper().selectOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, Constant.CHANNEL_360_DISCOUNT));
+					if (sysConfig != null) {
+						BigDecimal discountMoney = orderDon.getMoney().multiply(BigDecimal.valueOf(Double.valueOf(sysConfig.getSysValue())));
+						orderDon.setMoney(discountMoney);
+					}
+				}
+			}
+		}
+
 		//存在余额
 		if (balance != null && balance.compareTo(BigDecimal.ZERO) > 0) {
 			BigDecimal money = orderDon.getMoney();
@@ -2002,20 +2017,6 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			orderDon.setBalance(balance);
 			userBenefitsService.recordBalanceBySource(user.getId(), BigDecimal.valueOf(-balance.longValue()), UserBalanceSourceRecord.Source.payment);
 		}
-		//特殊渠道推广优惠. 360
-		if (orderDon.getPopularizeId() != null && orderDon.getPopularizeId() != 0L) {
-			//使用了优惠券 不再使用360渠道 折扣
-			if (couponUser == null && goodsType == 1) {
-				String name = channelPopularizeMapper.selectChannelByPid(orderDon.getPopularizeId());
-				if (Constant.CHANNEL_NAME_360.equals(name)) {
-					SysConfig sysConfig = sysConfigService.getBaseMapper().selectOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, Constant.CHANNEL_360_DISCOUNT));
-					if (sysConfig != null) {
-						BigDecimal discountMoney = orderDon.getMoney().multiply(BigDecimal.valueOf(Double.valueOf(sysConfig.getSysValue())));
-						orderDon.setMoney(discountMoney);
-					}
-				}
-			}
-		}
 	}
 
 	/**