|
|
@@ -51,6 +51,7 @@ import com.cyksj.mapper.market.task.UserBindDetailMapper;
|
|
|
import com.cyksj.mapper.shop.YhShopGoodsSkuMapper;
|
|
|
import com.cyksj.model.dto.*;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
+import com.cyksj.model.manage.dto.ChannelBaiDuDiscountDto;
|
|
|
import com.cyksj.model.manage.dto.GiftCardDto;
|
|
|
import com.cyksj.model.manage.views.GroupsRelationView;
|
|
|
import com.cyksj.model.manage.views.OrderDonView;
|
|
|
@@ -1998,14 +1999,38 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
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);
|
|
|
+ //百度渠道 专门优惠链接
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //百度
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|