Kaynağa Gözat

百度投放免登录链接 下单后赠送优惠券

zoujiajian 2 yıl önce
ebeveyn
işleme
3cc1c492fa

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/dto/ChannelBaiDuDiscountDto.java

@@ -18,4 +18,6 @@ public class ChannelBaiDuDiscountDto {
 	private List<Long> popularizeIds;
 
 	private BigDecimal discount;
+
+	private List<Long> couponIds;
 }

+ 26 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -69,6 +69,7 @@ import com.cyksj.service.exchange.ExchangeCodeService;
 import com.cyksj.service.giftcard.GiftCardOrderUseRecordService;
 import com.cyksj.service.giftcard.GiftCardUserRecordService;
 import com.cyksj.service.groups.GroupsFuncService;
+import com.cyksj.service.mange.coupon.CouponCommonService;
 import com.cyksj.service.market.MarketFrontService;
 import com.cyksj.service.market.task.TaskService;
 import com.cyksj.service.order.OrderCommonService;
@@ -244,6 +245,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 
 	private final AccountMapper accountMapper;
 
+	private final CouponCommonService couponCommonService;
+
 	private final List<String> noChekGoodsTemp = List.of("Apple One", "Youtube", "Spotify");
 
 	@Transactional(rollbackFor = Throwable.class)
@@ -2026,7 +2029,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 						}
 					}
 				} 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));
@@ -2227,6 +2230,28 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				sendTelegramMsg(orderDon, goodsDon, sku);
 			});
 		}
+		if (orderDon.getPopularizeId() != null && orderDon.getPopularizeId() != 0 && StrUtil.isNotEmpty(orderDon.getPhone())) {
+			//百度渠道 专门优惠链接
+			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> couponIds = baiDuDiscountDto.getCouponIds();
+						//下单成功后 发送优惠券
+						if (CollUtil.isNotEmpty(couponIds)) {
+							List<Long> baiduPopularizeIds = baiDuDiscountDto.getPopularizeIds();
+							if (baiduPopularizeIds.contains(orderDon.getPopularizeId())) {
+								couponIds.forEach(couponId -> couponCommonService.sendCouponToUser(orderDon.getUserId(), couponId, null, null, null, CouponUser.Channel.manual));
+							}
+						}
+					} catch (Exception e) {
+					}
+				}
+			}
+		}
 	}
 
 	private void deductGiftCardCash(Long userId, Long gcId, BigDecimal deductCash, BigDecimal gcRemainCash, List<GiftCardOrderUseRecord> gcUseRecords, Boolean isUsed) {