zoujiajian 2 lat temu
rodzic
commit
a1de123cfe

+ 35 - 27
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -2192,43 +2192,51 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		}
 		//特殊渠道推广优惠. 360
 		if (orderDon.getPopularizeId() != null && orderDon.getPopularizeId() != 0L) {
+			String name = channelPopularizeMapper.selectChannelByPid(orderDon.getPopularizeId());
 			//使用了优惠券 不再使用360渠道 折扣
 			if (couponUser == null && goodsType == 1) {
-				//百度渠道 专门优惠链接
-				SysConfig baiduConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
-						.eq(SysConfig::getSysKey, Constant.CHANNEL_BAIDU_DISCOUNT_KEY).last("limit 1"));
-				if (baiduConfig != null) {
-					String sysValue = baiduConfig.getSysValue();
-					if (StrUtil.isNotBlank(sysValue)) {
-						try {
-							ChannelBaiDuDiscountDto baiDuDiscountDto = Jsons.parseObject(sysValue, ChannelBaiDuDiscountDto.class);
-							List<Long> baiduPopularizeIds = baiDuDiscountDto.getPopularizeIds();
-							BigDecimal discount = baiDuDiscountDto.getDiscount();
-							if (CollUtil.isNotEmpty(baiduPopularizeIds) && discount != null && discount.compareTo(BigDecimal.ZERO) > 0) {
-								if (baiduPopularizeIds.contains(orderDon.getPopularizeId())) {
-									BigDecimal discountMoney = orderDon.getMoney().multiply(discount);
-									orderDon.setMoney(discountMoney);
+				if (name.contains(Constant.NO_SIGN_CHANNEL_NAMES.get(0)) || name.contains(Constant.NO_SIGN_CHANNEL_NAMES.get(1))) {
+					String key;
+					if (name.contains(Constant.NO_SIGN_CHANNEL_NAMES.get(0))) {
+						//百度渠道 专门优惠链接
+						key = Constant.CHANNEL_BAIDU_DISCOUNT_KEY;
+					} else {
+						//抖音
+						key = Constant.CHANNEL_DY_DISCOUNT_KEY;
+					}
+					SysConfig channelNoSignConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
+							.eq(SysConfig::getSysKey, key).last("limit 1"));
+					if (channelNoSignConfig != null) {
+						String sysValue = channelNoSignConfig.getSysValue();
+						if (StrUtil.isNotBlank(sysValue)) {
+							try {
+								ChannelBaiDuDiscountDto baiDuDiscountDto = Jsons.parseObject(sysValue, ChannelBaiDuDiscountDto.class);
+								List<Long> baiduPopularizeIds = baiDuDiscountDto.getPopularizeIds();
+								BigDecimal discount = baiDuDiscountDto.getDiscount();
+								if (CollUtil.isNotEmpty(baiduPopularizeIds) && discount != null && discount.compareTo(BigDecimal.ZERO) > 0) {
+									if (baiduPopularizeIds.contains(orderDon.getPopularizeId())) {
+										BigDecimal discountMoney = orderDon.getMoney().multiply(discount);
+										orderDon.setMoney(discountMoney);
+									}
 								}
-							}
 
-						} catch (Exception e) {
+							} catch (Exception e) {
+							}
 						}
 					}
-				} else {
-					//360
-					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);
-						}
+				}
+			} else {
+				//360
+				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);
 					}
 				}
-
 			}
-		}
 
+		}
 		//存在余额
 		deductBalancePayOrderMoney(orderDon, balance, user);
 	}