merge branch "master"
This commit is contained in:
commit
2af334d793
@ -37,6 +37,5 @@ public class RegisteredCouponActivityExecute implements MemberRegisterEvent {
|
|||||||
.eq("coupon_activity_type", CouponActivityTypeEnum.REGISTERED.name())
|
.eq("coupon_activity_type", CouponActivityTypeEnum.REGISTERED.name())
|
||||||
.and(PromotionTools.queryPromotionStatus(PromotionsStatusEnum.START)));
|
.and(PromotionTools.queryPromotionStatus(PromotionsStatusEnum.START)));
|
||||||
couponActivityService.registered(couponActivities, member);
|
couponActivityService.registered(couponActivities, member);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,14 +349,30 @@ public class PriceDetailDTO implements Serializable {
|
|||||||
|
|
||||||
public void setDiscountPrice(Double discountPrice) {
|
public void setDiscountPrice(Double discountPrice) {
|
||||||
this.discountPrice = discountPrice;
|
this.discountPrice = discountPrice;
|
||||||
|
promotionPriceHandler();
|
||||||
this.recount();
|
this.recount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCouponPrice(Double couponPrice) {
|
public void setCouponPrice(Double couponPrice) {
|
||||||
this.couponPrice = couponPrice;
|
this.couponPrice = couponPrice;
|
||||||
|
promotionPriceHandler();
|
||||||
this.recount();
|
this.recount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果促销金额+优惠券金额大于商品金额问题处理
|
||||||
|
*/
|
||||||
|
private void promotionPriceHandler() {
|
||||||
|
if (couponPrice == null || discountPrice == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//如果订单优惠总额>商品金额,则处理一下数据,使得两数相加<=商品金额
|
||||||
|
if (CurrencyUtil.add(couponPrice, discountPrice) > goodsPrice) {
|
||||||
|
couponPrice = CurrencyUtil.sub(goodsPrice, discountPrice);
|
||||||
|
this.setCouponPrice(couponPrice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setDistributionCommission(Double distributionCommission) {
|
public void setDistributionCommission(Double distributionCommission) {
|
||||||
this.distributionCommission = distributionCommission;
|
this.distributionCommission = distributionCommission;
|
||||||
this.recount();
|
this.recount();
|
||||||
|
@ -121,6 +121,8 @@ public class PromotionGoods extends BaseEntity {
|
|||||||
this.promotionId = pointsGoods.getId();
|
this.promotionId = pointsGoods.getId();
|
||||||
this.quantity = pointsGoods.getActiveStock();
|
this.quantity = pointsGoods.getActiveStock();
|
||||||
this.originalPrice = sku.getPrice();
|
this.originalPrice = sku.getPrice();
|
||||||
|
this.promotionType = PromotionTypeEnum.POINTS_GOODS.name();
|
||||||
|
this.scopeId = sku.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import cn.lili.modules.promotion.service.KanjiaActivityGoodsService;
|
|||||||
import cn.lili.modules.promotion.service.PromotionGoodsService;
|
import cn.lili.modules.promotion.service.PromotionGoodsService;
|
||||||
import cn.lili.modules.promotion.tools.PromotionTools;
|
import cn.lili.modules.promotion.tools.PromotionTools;
|
||||||
import cn.lili.mybatis.util.PageUtil;
|
import cn.lili.mybatis.util.PageUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@ -32,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -214,7 +216,11 @@ public class KanjiaActivityGoodsServiceImpl extends AbstractPromotionsServiceImp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KanjiaActivityGoods getKanjiaGoodsBySkuId(String skuId) {
|
public KanjiaActivityGoods getKanjiaGoodsBySkuId(String skuId) {
|
||||||
KanjiaActivityGoods kanjiaActivityGoods = this.getOne(new QueryWrapper<KanjiaActivityGoods>().eq("sku_id", skuId), false);
|
KanjiaActivityGoods kanjiaActivityGoods = this.getOne(
|
||||||
|
new LambdaQueryWrapper<KanjiaActivityGoods>()
|
||||||
|
.eq(KanjiaActivityGoods::getSkuId, skuId)
|
||||||
|
.ge(KanjiaActivityGoods::getEndTime, new Date())
|
||||||
|
.le(KanjiaActivityGoods::getStartTime, new Date()));
|
||||||
if (kanjiaActivityGoods != null && PromotionsStatusEnum.START.name().equals(kanjiaActivityGoods.getPromotionStatus())) {
|
if (kanjiaActivityGoods != null && PromotionsStatusEnum.START.name().equals(kanjiaActivityGoods.getPromotionStatus())) {
|
||||||
return kanjiaActivityGoods;
|
return kanjiaActivityGoods;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ public class SeckillServiceImpl extends AbstractPromotionsServiceImpl<SeckillMap
|
|||||||
if (seckillApply.getPromotionApplyStatus().equals(PromotionsApplyStatusEnum.PASS.name())) {
|
if (seckillApply.getPromotionApplyStatus().equals(PromotionsApplyStatusEnum.PASS.name())) {
|
||||||
this.setSeckillApplyTime(seckill, seckillApply);
|
this.setSeckillApplyTime(seckill, seckillApply);
|
||||||
log.info("更新限时抢购商品状态:{}", seckill);
|
log.info("更新限时抢购商品状态:{}", seckill);
|
||||||
String promotionKey = PromotionTypeEnum.SECKILL.name() + "-" + seckillApply.getTimeLine();
|
String promotionKey = PromotionTypeEnum.SECKILL.name() + "-" + seckill.getId();
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
// es促销key
|
// es促销key
|
||||||
map.put("esPromotionKey", promotionKey);
|
map.put("esPromotionKey", promotionKey);
|
||||||
|
@ -315,7 +315,7 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
|
|||||||
resultMap.put(KEY_SUCCESS, 0);
|
resultMap.put(KEY_SUCCESS, 0);
|
||||||
resultMap.put(KEY_FAIL, 0);
|
resultMap.put(KEY_FAIL, 0);
|
||||||
resultMap.put(KEY_PROCESSED, 0);
|
resultMap.put(KEY_PROCESSED, 0);
|
||||||
cache.put(CachePrefix.INIT_INDEX_PROCESS.getPrefix() + "", resultMap);
|
cache.put(CachePrefix.INIT_INDEX_PROCESS.getPrefix(), resultMap);
|
||||||
if (!goodsIndexList.isEmpty()) {
|
if (!goodsIndexList.isEmpty()) {
|
||||||
goodsIndexRepository.deleteAll();
|
goodsIndexRepository.deleteAll();
|
||||||
for (EsGoodsIndex goodsIndex : goodsIndexList) {
|
for (EsGoodsIndex goodsIndex : goodsIndexList) {
|
||||||
|
@ -15,6 +15,7 @@ import cn.lili.modules.search.entity.dto.HotWordsDTO;
|
|||||||
import cn.lili.modules.search.entity.dto.ParamOptions;
|
import cn.lili.modules.search.entity.dto.ParamOptions;
|
||||||
import cn.lili.modules.search.entity.dto.SelectorOptions;
|
import cn.lili.modules.search.entity.dto.SelectorOptions;
|
||||||
import cn.lili.modules.search.service.EsGoodsSearchService;
|
import cn.lili.modules.search.service.EsGoodsSearchService;
|
||||||
|
import com.alibaba.druid.util.StringUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.lucene.search.join.ScoreMode;
|
import org.apache.lucene.search.join.ScoreMode;
|
||||||
import org.elasticsearch.common.lucene.search.function.FieldValueFactorFunction;
|
import org.elasticsearch.common.lucene.search.function.FieldValueFactorFunction;
|
||||||
@ -222,6 +223,7 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
|||||||
for (int i = 0; i < brandBuckets.size(); i++) {
|
for (int i = 0; i < brandBuckets.size(); i++) {
|
||||||
String brandId = brandBuckets.get(i).getKey().toString();
|
String brandId = brandBuckets.get(i).getKey().toString();
|
||||||
//当商品品牌id为0时,代表商品没有选择品牌,所以过滤掉品牌选择器
|
//当商品品牌id为0时,代表商品没有选择品牌,所以过滤掉品牌选择器
|
||||||
|
//当品牌id为空并且
|
||||||
if (brandId.equals("0") ||
|
if (brandId.equals("0") ||
|
||||||
(CharSequenceUtil.isNotEmpty(goodsSearch.getBrandId())
|
(CharSequenceUtil.isNotEmpty(goodsSearch.getBrandId())
|
||||||
&& Arrays.asList(goodsSearch.getBrandId().split("@")).contains(brandId))) {
|
&& Arrays.asList(goodsSearch.getBrandId().split("@")).contains(brandId))) {
|
||||||
@ -231,6 +233,9 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
|||||||
String brandName = "";
|
String brandName = "";
|
||||||
if (brandBuckets.get(i).getAggregations() != null && brandBuckets.get(i).getAggregations().get(ATTR_BRAND_NAME) != null) {
|
if (brandBuckets.get(i).getAggregations() != null && brandBuckets.get(i).getAggregations().get(ATTR_BRAND_NAME) != null) {
|
||||||
brandName = this.getAggregationsBrandOptions(brandBuckets.get(i).getAggregations().get(ATTR_BRAND_NAME));
|
brandName = this.getAggregationsBrandOptions(brandBuckets.get(i).getAggregations().get(ATTR_BRAND_NAME));
|
||||||
|
if (StringUtils.isEmpty(brandName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String brandUrl = "";
|
String brandUrl = "";
|
||||||
@ -238,6 +243,9 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
|||||||
brandUrlBuckets.get(i).getAggregations() != null &&
|
brandUrlBuckets.get(i).getAggregations() != null &&
|
||||||
brandUrlBuckets.get(i).getAggregations().get(ATTR_BRAND_URL) != null) {
|
brandUrlBuckets.get(i).getAggregations().get(ATTR_BRAND_URL) != null) {
|
||||||
brandUrl = this.getAggregationsBrandOptions(brandUrlBuckets.get(i).getAggregations().get(ATTR_BRAND_URL));
|
brandUrl = this.getAggregationsBrandOptions(brandUrlBuckets.get(i).getAggregations().get(ATTR_BRAND_URL));
|
||||||
|
if (StringUtils.isEmpty(brandUrl)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SelectorOptions so = new SelectorOptions();
|
SelectorOptions so = new SelectorOptions();
|
||||||
so.setName(brandName);
|
so.setName(brandName);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user