促销相关代码批量提交
This commit is contained in:
parent
7276824a18
commit
e141d22504
@ -72,7 +72,7 @@ public class AfterSaleBuyerController {
|
||||
})
|
||||
@GetMapping(value = "/applyAfterSaleInfo/{sn}")
|
||||
public ResultMessage<AfterSaleApplyVO> applyAfterSaleInfo(@PathVariable String sn) {
|
||||
return ResultUtil.data(afterSaleService.getAfterSaleDTO(sn));
|
||||
return ResultUtil.data(afterSaleService.getAfterSaleVO(sn));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/save/{orderItemSn}")
|
||||
|
@ -96,7 +96,7 @@ public class PromotionEverydayExecute implements EveryDayExecute {
|
||||
query.addCriteria(Criteria.where("promotionStatus").ne(PromotionStatusEnum.END.name())
|
||||
.orOperator(Criteria.where("promotionStatus").ne(PromotionStatusEnum.CLOSE.name())));
|
||||
//结束条件 活动结束时间大于当前时间
|
||||
query.addCriteria(Criteria.where("endTime").lt(new Date()));
|
||||
query.addCriteria(Criteria.where("endTime").lte(new Date()));
|
||||
|
||||
//结束满减活动
|
||||
endFullDiscount(query);
|
||||
|
@ -14,6 +14,7 @@ public enum PromotionTypeEnum {
|
||||
PINTUAN("拼团"),
|
||||
SECKILL("秒杀"),
|
||||
COUPON("优惠券"),
|
||||
PLATFORM_COUPON("平台优惠券"),
|
||||
FULL_DISCOUNT("满减"),
|
||||
POINTS_GOODS("积分商品"),
|
||||
KANJIA("砍价"),
|
||||
|
@ -268,7 +268,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
public Integer todayUpperNum() {
|
||||
LambdaQueryWrapper<Goods> queryWrapper = Wrappers.lambdaQuery();
|
||||
queryWrapper.eq(Goods::getMarketEnable, GoodsStatusEnum.UPPER.name());
|
||||
queryWrapper.gt(Goods::getCreateTime, DateUtil.beginOfDay(new DateTime()));
|
||||
queryWrapper.ge(Goods::getCreateTime, DateUtil.beginOfDay(new DateTime()));
|
||||
return this.count(queryWrapper);
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ public class MemberEvaluationServiceImpl extends ServiceImpl<MemberEvaluationMap
|
||||
|
||||
@Override
|
||||
public Integer todayMemberEvaluation() {
|
||||
return this.count(new LambdaQueryWrapper<MemberEvaluation>().gt(MemberEvaluation::getCreateTime, DateUtil.beginOfDay(new DateTime())));
|
||||
return this.count(new LambdaQueryWrapper<MemberEvaluation>().ge(MemberEvaluation::getCreateTime, DateUtil.beginOfDay(new DateTime())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,9 +8,9 @@ public enum RenderStepEnums {
|
||||
CHECK_DATA("校验商品"),
|
||||
CHECKED_FILTER("选择商品过滤"),
|
||||
COUPON("优惠券价格渲染"),
|
||||
SKU_FREIGHT("运费计算"),
|
||||
SKU_PROMOTION("商品促销计算"),
|
||||
FULL_DISCOUNT("满减计算"),
|
||||
SKU_FREIGHT("运费计算"),
|
||||
DISTRIBUTION("分配需要分配的促销金额"),
|
||||
PLATFORM_COMMISSION("平台佣金"),
|
||||
CART_PRICE("购物车金额计算"),
|
||||
|
@ -45,6 +45,9 @@ public class CartSkuVO extends CartBase implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "小记")
|
||||
private Double subTotal;
|
||||
|
||||
@ApiModelProperty(value = "小记")
|
||||
private Double utilPrice;
|
||||
/**
|
||||
* 是否选中,要去结算 0:未选中 1:已选中,默认
|
||||
*/
|
||||
@ -55,7 +58,7 @@ public class CartSkuVO extends CartBase implements Serializable {
|
||||
private Boolean isFreeFreight;
|
||||
|
||||
@ApiModelProperty(value = "积分购买 积分数量")
|
||||
private Integer point;
|
||||
private Long point;
|
||||
|
||||
@ApiModelProperty(value = "是否失效 ")
|
||||
private Boolean invalid;
|
||||
@ -101,6 +104,7 @@ public class CartSkuVO extends CartBase implements Serializable {
|
||||
this.isShip = true;
|
||||
this.purchasePrice = goodsSku.getIsPromotion() != null && goodsSku.getIsPromotion() ? goodsSku.getPromotionPrice() : goodsSku.getPrice();
|
||||
this.isFreeFreight = false;
|
||||
this.utilPrice = 0D;
|
||||
this.setStoreId(goodsSku.getStoreId());
|
||||
this.setStoreName(goodsSku.getStoreName());
|
||||
}
|
||||
|
@ -98,4 +98,5 @@ public class CartVO extends CartBase implements Serializable {
|
||||
this.goodsNum += goodsNum;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -66,6 +66,11 @@ public class CartPriceRender implements CartRenderStep {
|
||||
cartVO.getSkuList().stream().filter(CartSkuVO::getChecked)
|
||||
.map(CartSkuVO::getPriceDetailDTO).collect(Collectors.toList())
|
||||
);
|
||||
List<Integer> skuNum = cartVO.getSkuList().stream().filter(CartSkuVO::getChecked)
|
||||
.map(CartSkuVO::getNum).collect(Collectors.toList());
|
||||
for (Integer num : skuNum) {
|
||||
cartVO.addGoodsNum(num);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@ import cn.lili.modules.promotion.service.PointsGoodsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -67,7 +66,6 @@ public class CommissionRender implements CartRenderStep {
|
||||
//计算购物车价格
|
||||
for (CartVO cart : cartVOS) {
|
||||
//累加价格
|
||||
List<PriceDetailDTO> priceDetailDTOS = new ArrayList<>();
|
||||
for (CartSkuVO cartSkuVO : cart.getSkuList()) {
|
||||
|
||||
PriceDetailDTO priceDetailDTO = cartSkuVO.getPriceDetailDTO();
|
||||
|
@ -85,7 +85,9 @@ public class CouponRender implements CartRenderStep {
|
||||
//减免现金,则按照商品价格计算 需要通过工具类进行优惠金额的分发,分发给每个商品
|
||||
if (coupon.getCouponType().equals(CouponTypeEnum.PRICE.name())) {
|
||||
//分发优惠券
|
||||
promotionPriceUtil.recountPrice(tradeDTO, memberCouponDTO.getSkuDetail(), memberCouponDTO.getMemberCoupon().getPrice(), PromotionTypeEnum.COUPON);
|
||||
promotionPriceUtil.recountPrice(tradeDTO, memberCouponDTO.getSkuDetail(), memberCouponDTO.getMemberCoupon().getPrice(),
|
||||
coupon.getIsPlatform() ?
|
||||
PromotionTypeEnum.PLATFORM_COUPON : PromotionTypeEnum.COUPON);
|
||||
//如果是平台券 则需要计算商家承担比例
|
||||
if (coupon.getIsPlatform() && coupon.getStoreCommission() > 0) {
|
||||
|
||||
@ -95,7 +97,7 @@ public class CouponRender implements CartRenderStep {
|
||||
for (CartSkuVO cartSkuVO : tradeDTO.getSkuList()) {
|
||||
//写入平台优惠券承担比例
|
||||
if (cartSkuVO.getGoodsSku().getId().equals(skuId)) {
|
||||
cartSkuVO.getPriceDetailDTO().setSiteCouponPrice(cartSkuVO.getPriceDetailDTO().getSiteCouponPrice());
|
||||
//写入店铺承担比例
|
||||
cartSkuVO.getPriceDetailDTO().setSiteCouponPoint(coupon.getStoreCommission());
|
||||
}
|
||||
}
|
||||
|
@ -109,8 +109,8 @@ public class FullDiscountRender implements CartRenderStep {
|
||||
for (PromotionGoods promotionGoods : fullDiscount.getPromotionGoodsList()) {
|
||||
//sku 集合判定
|
||||
for (CartSkuVO cartSkuVO : cartSkuVOS) {
|
||||
//如果参加,则记录商品sku
|
||||
if (cartSkuVO.getGoodsSku().getId().equals(promotionGoods.getSkuId())) {
|
||||
// 如果参加满减,并且购物车选中状态 ,则记录商品sku
|
||||
if (cartSkuVO.getChecked() && cartSkuVO.getGoodsSku().getId().equals(promotionGoods.getSkuId())) {
|
||||
skuPriceDetail.put(cartSkuVO.getGoodsSku().getId(), cartSkuVO.getPriceDetailDTO().getGoodsPrice());
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.lili.modules.order.cart.render.impl;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.lili.common.utils.CurrencyUtil;
|
||||
import cn.lili.modules.member.entity.dos.MemberAddress;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
@ -13,7 +12,6 @@ import cn.lili.modules.store.entity.enums.FreightTemplateEnum;
|
||||
import cn.lili.modules.store.entity.vos.FreightTemplateVO;
|
||||
import cn.lili.modules.store.service.FreightTemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -96,14 +94,8 @@ public class SkuFreightRender implements CartRenderStep {
|
||||
|
||||
//计算运费
|
||||
Double countFreight = countFreight(count, freightTemplateChildDTO);
|
||||
//写入运费
|
||||
//写入SKU运费
|
||||
cartSkuVO.getPriceDetailDTO().setFreightPrice(countFreight);
|
||||
//运费逻辑处理
|
||||
if (tradeDTO.getPriceDetailDTO().getFreightPrice() != null) {
|
||||
tradeDTO.getPriceDetailDTO().setFreightPrice(CurrencyUtil.add(tradeDTO.getPriceDetailDTO().getFreightPrice(), countFreight));
|
||||
} else {
|
||||
tradeDTO.getPriceDetailDTO().setFreightPrice(countFreight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,14 +110,19 @@ public class SkuFreightRender implements CartRenderStep {
|
||||
private Double countFreight(Double count, FreightTemplateChildDTO template) {
|
||||
try {
|
||||
Double finalFreight = template.getFirstPrice();
|
||||
//不满首重
|
||||
//不满首重 / 首件
|
||||
if (template.getFirstCompany() >= count) {
|
||||
return finalFreight;
|
||||
}
|
||||
//如果续重/续件,费用不为空,则返回
|
||||
if (template.getContinuedCompany() == 0 || template.getContinuedPrice() == 0) {
|
||||
return finalFreight;
|
||||
}
|
||||
|
||||
//计算 续重 / 续件 价格
|
||||
Double continuedCount = count - template.getFirstCompany();
|
||||
//计算续重价格
|
||||
return CurrencyUtil.add(finalFreight,
|
||||
CurrencyUtil.mul(NumberUtil.parseInt(String.valueOf((continuedCount / template.getContinuedCompany()))), template.getContinuedPrice()));
|
||||
CurrencyUtil.mul(Math.ceil(continuedCount / template.getContinuedCompany()), template.getContinuedPrice()));
|
||||
} catch (Exception e) {
|
||||
return 0D;
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ public class SkuPromotionRender implements CartRenderStep {
|
||||
cartVO -> {
|
||||
cartVO.getSkuList().forEach(cartSkuVO -> {
|
||||
PriceDetailDTO priceDetailDTO = cartSkuVO.getPriceDetailDTO();
|
||||
priceDetailDTO.setOriginalPrice(CurrencyUtil.mul(cartSkuVO.getGoodsSku().getPrice(), cartSkuVO.getNum()));
|
||||
priceDetailDTO.setGoodsPrice(cartSkuVO.getSubTotal());
|
||||
priceDetailDTO.setDiscountPrice(CurrencyUtil.sub(priceDetailDTO.getOriginalPrice(), cartSkuVO.getSubTotal()));
|
||||
});
|
||||
|
@ -141,6 +141,13 @@ public class PromotionPriceUtil {
|
||||
|
||||
cartSkuVO.getPriceDetailDTO().setCouponPrice(
|
||||
CurrencyUtil.add(cartSkuVO.getPriceDetailDTO().getCouponPrice(), skuDiscountPrice));
|
||||
} else if (promotionTypeEnum == PromotionTypeEnum.PLATFORM_COUPON) {
|
||||
|
||||
cartSkuVO.getPriceDetailDTO().setSiteCouponPrice(
|
||||
CurrencyUtil.add(cartSkuVO.getPriceDetailDTO().getCouponPrice(), skuDiscountPrice));
|
||||
|
||||
cartSkuVO.getPriceDetailDTO().setCouponPrice(
|
||||
CurrencyUtil.add(cartSkuVO.getPriceDetailDTO().getCouponPrice(), cartSkuVO.getPriceDetailDTO().getSiteCouponPrice()));
|
||||
} else {
|
||||
cartSkuVO.getPriceDetailDTO().setDiscountPrice(
|
||||
CurrencyUtil.add(cartSkuVO.getPriceDetailDTO().getDiscountPrice(), skuDiscountPrice));
|
||||
|
@ -32,6 +32,7 @@ import cn.lili.modules.promotion.entity.dto.KanjiaActivityGoodsDTO;
|
||||
import cn.lili.modules.promotion.entity.enums.CouponScopeTypeEnum;
|
||||
import cn.lili.modules.promotion.entity.enums.KanJiaStatusEnum;
|
||||
import cn.lili.modules.promotion.entity.enums.MemberCouponStatusEnum;
|
||||
import cn.lili.modules.promotion.entity.vos.PointsGoodsVO;
|
||||
import cn.lili.modules.promotion.entity.vos.kanjia.KanjiaActivitySearchParams;
|
||||
import cn.lili.modules.promotion.service.*;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
@ -76,6 +77,11 @@ public class CartServiceImpl implements CartService {
|
||||
*/
|
||||
@Autowired
|
||||
private PromotionGoodsService promotionGoodsService;
|
||||
/**
|
||||
* 促销商品
|
||||
*/
|
||||
@Autowired
|
||||
private PointsGoodsService pointsGoodsService;
|
||||
/**
|
||||
* 会员地址
|
||||
*/
|
||||
@ -565,6 +571,9 @@ public class CartServiceImpl implements CartService {
|
||||
|
||||
//循环符合优惠券的商品
|
||||
for (CartSkuVO cartSkuVO : cartSkuVOS) {
|
||||
if (!cartSkuVO.getChecked()) {
|
||||
continue;
|
||||
}
|
||||
//获取商品的促销信息
|
||||
Optional<PromotionGoods> promotionOptional =
|
||||
cartSkuVO.getPromotions().parallelStream().filter(promotionGoods ->
|
||||
@ -649,6 +658,9 @@ public class CartServiceImpl implements CartService {
|
||||
} else if (cartTypeEnum.equals(CartTypeEnum.KANJIA)) {
|
||||
//检测购物车的数量
|
||||
checkKanjia(cartSkuVO);
|
||||
} else if (cartTypeEnum.equals(CartTypeEnum.POINTS)) {
|
||||
//检测购物车的数量
|
||||
checkPoint(cartSkuVO);
|
||||
}
|
||||
}
|
||||
|
||||
@ -658,7 +670,6 @@ public class CartServiceImpl implements CartService {
|
||||
* @param cartSkuVO 购物车信息
|
||||
*/
|
||||
private void checkPintuan(CartSkuVO cartSkuVO) {
|
||||
|
||||
//拼团活动,需要对限购数量进行判定
|
||||
//获取拼团信息
|
||||
List<PromotionGoods> currentPromotion = cartSkuVO.getPromotions().stream().filter(
|
||||
@ -666,8 +677,12 @@ public class CartServiceImpl implements CartService {
|
||||
.collect(Collectors.toList());
|
||||
//拼团活动判定
|
||||
if (!currentPromotion.isEmpty()) {
|
||||
PromotionGoods promotionGoods = currentPromotion.get(0);
|
||||
//写入拼团信息
|
||||
cartSkuVO.setPintuanId(currentPromotion.get(0).getPromotionId());
|
||||
cartSkuVO.setPintuanId(promotionGoods.getPromotionId());
|
||||
//写入成交信息
|
||||
cartSkuVO.setUtilPrice(promotionGoods.getPrice());
|
||||
cartSkuVO.setPurchasePrice(promotionGoods.getPrice());
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.CART_PINTUAN_NOT_EXIST_ERROR);
|
||||
}
|
||||
@ -702,9 +717,26 @@ public class CartServiceImpl implements CartService {
|
||||
throw new ServiceException(ResultCode.KANJIA_ACTIVITY_NOT_FOUND_ERROR);
|
||||
//判断砍价活动是否已满足条件
|
||||
} else if (!KanJiaStatusEnum.SUCCESS.name().equals(kanjiaActivity.getStatus())) {
|
||||
cartSkuVO.setKanjiaId(kanjiaActivity.getKanjiaActivityGoodsId());
|
||||
cartSkuVO.setPurchasePrice(0D);
|
||||
throw new ServiceException(ResultCode.KANJIA_ACTIVITY_NOT_PASS_ERROR);
|
||||
}
|
||||
//砍价商品默认一件货物
|
||||
cartSkuVO.setNum(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验积分商品信息
|
||||
*
|
||||
* @param cartSkuVO 购物车信息
|
||||
*/
|
||||
private void checkPoint(CartSkuVO cartSkuVO) {
|
||||
|
||||
PointsGoodsVO pointsGoodsVO = pointsGoodsService.getPointsGoodsVOByMongo(cartSkuVO.getGoodsSku().getId());
|
||||
|
||||
if (pointsGoodsVO != null) {
|
||||
cartSkuVO.setPoint(pointsGoodsVO.getPoints());
|
||||
cartSkuVO.setPurchasePrice(0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -143,6 +143,7 @@ public class PriceDetailDTO implements Serializable {
|
||||
*/
|
||||
public void setUpdatePrice(Double updatePrice) {
|
||||
this.updatePrice = updatePrice;
|
||||
this.recount();
|
||||
}
|
||||
|
||||
|
||||
@ -155,8 +156,8 @@ public class PriceDetailDTO implements Serializable {
|
||||
CurrencyUtil.add(goodsPrice, freightPrice),
|
||||
CurrencyUtil.add(discountPrice,
|
||||
couponPrice != null ? couponPrice : 0));
|
||||
if (updatePrice > 0) {
|
||||
CurrencyUtil.add(flowPrice, updatePrice);
|
||||
if (updatePrice != 0) {
|
||||
flowPrice = CurrencyUtil.add(flowPrice, updatePrice);
|
||||
}
|
||||
|
||||
//计算平台佣金 流水金额*平台佣金比例
|
||||
@ -190,7 +191,8 @@ public class PriceDetailDTO implements Serializable {
|
||||
platFormCommission = CurrencyUtil.add(platFormCommission, priceDetailDTO.getPlatFormCommission());
|
||||
|
||||
siteCouponPrice = CurrencyUtil.add(siteCouponPrice, priceDetailDTO.getSiteCouponPrice());
|
||||
siteCouponPoint = CurrencyUtil.add(siteCouponPoint, priceDetailDTO.getSiteCouponPoint());
|
||||
//平台优惠券一笔交易只有一个,所以这里直接移值就好了
|
||||
siteCouponPoint = priceDetailDTO.getSiteCouponPoint();
|
||||
siteCouponCommission = CurrencyUtil.add(siteCouponCommission, priceDetailDTO.getSiteCouponCommission());
|
||||
|
||||
updatePrice = CurrencyUtil.add(updatePrice, priceDetailDTO.getUpdatePrice());
|
||||
@ -326,7 +328,7 @@ public class PriceDetailDTO implements Serializable {
|
||||
this.siteCouponPoint = siteCouponPoint;
|
||||
|
||||
if (siteCouponPoint != null && siteCouponPoint != 0) {
|
||||
this.siteCouponCommission = CurrencyUtil.mul(siteCouponPrice, siteCouponPoint);
|
||||
this.siteCouponCommission = CurrencyUtil.div(CurrencyUtil.mul(siteCouponPrice, siteCouponPoint), 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public interface AfterSaleService extends IService<AfterSale> {
|
||||
* @param sn 订单编号
|
||||
* @return
|
||||
*/
|
||||
AfterSaleApplyVO getAfterSaleDTO(String sn);
|
||||
AfterSaleApplyVO getAfterSaleVO(String sn);
|
||||
|
||||
/**
|
||||
* 售后申请
|
||||
|
@ -121,7 +121,7 @@ public class AfterSaleServiceImpl extends ServiceImpl<AfterSaleMapper, AfterSale
|
||||
}
|
||||
|
||||
@Override
|
||||
public AfterSaleApplyVO getAfterSaleDTO(String sn) {
|
||||
public AfterSaleApplyVO getAfterSaleVO(String sn) {
|
||||
|
||||
AfterSaleApplyVO afterSaleApplyVO = new AfterSaleApplyVO();
|
||||
|
||||
@ -429,8 +429,15 @@ public class AfterSaleServiceImpl extends ServiceImpl<AfterSaleMapper, AfterSale
|
||||
if (afterSaleDTO.getImages() != null) {
|
||||
afterSale.setAfterSaleImage(afterSaleDTO.getImages());
|
||||
}
|
||||
//计算退回金额
|
||||
afterSale.setApplyRefundPrice(CurrencyUtil.mul(orderItem.getUnitPrice(), afterSale.getNum()));
|
||||
|
||||
if (afterSale.getNum().equals(orderItem.getNum())) {
|
||||
//计算退回金额
|
||||
afterSale.setApplyRefundPrice(orderItem.getFlowPrice());
|
||||
} else {
|
||||
//单价计算
|
||||
Double utilPrice = CurrencyUtil.div(orderItem.getPriceDetailDTO().getFlowPrice(), orderItem.getNum());
|
||||
afterSale.setApplyRefundPrice(CurrencyUtil.mul(afterSale.getNum(), utilPrice));
|
||||
}
|
||||
//添加售后
|
||||
this.save(afterSale);
|
||||
//发送售后消息
|
||||
|
@ -156,7 +156,7 @@ public class OrderPriceServiceImpl implements OrderPriceService {
|
||||
Double priceFluctuationRatio = CurrencyUtil.div(priceDetailDTO.getOriginalPrice(), order.getPriceDetailDTO().getOriginalPrice(), 4);
|
||||
|
||||
//记录修改金额
|
||||
priceDetailDTO.setUpdatePrice(CurrencyUtil.sub(order.getUpdatePrice(), priceFluctuationRatio));
|
||||
priceDetailDTO.setUpdatePrice(CurrencyUtil.mul(order.getUpdatePrice(), priceFluctuationRatio));
|
||||
|
||||
//修改订单货物金额
|
||||
orderItem.setFlowPrice(priceDetailDTO.getFlowPrice());
|
||||
|
@ -70,7 +70,7 @@ public class SystemLogServiceImpl implements SystemLogService {
|
||||
//时间有效性判定
|
||||
if (searchVo.getConvertStartDate() != null && searchVo.getConvertEndDate() != null) {
|
||||
//大于方法
|
||||
Criteria gt = Criteria.where("createTime").gt(searchVo.getConvertStartDate());
|
||||
Criteria gt = Criteria.where("createTime").gte(searchVo.getConvertStartDate());
|
||||
//小于方法
|
||||
Criteria lt = Criteria.where("createTime").lte(searchVo.getConvertEndDate());
|
||||
query.addCriteria(new Criteria().andOperator(gt, lt));
|
||||
|
@ -5,7 +5,6 @@ import cn.lili.modules.promotion.entity.enums.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
|
||||
@ -189,25 +188,25 @@ public class CouponSearchParams implements Serializable {
|
||||
if (CharSequenceUtil.isNotEmpty(price)) {
|
||||
String[] s = price.split("_");
|
||||
if (s.length > 1) {
|
||||
query.addCriteria(Criteria.where(PRICE_COLUMN).gt(s[1]));
|
||||
query.addCriteria(Criteria.where(PRICE_COLUMN).gte(s[1]));
|
||||
} else {
|
||||
query.addCriteria(Criteria.where(PRICE_COLUMN).lt(s[0]));
|
||||
query.addCriteria(Criteria.where(PRICE_COLUMN).lte(s[0]));
|
||||
}
|
||||
}
|
||||
if (CharSequenceUtil.isNotEmpty(publishNum)) {
|
||||
String[] s = publishNum.split("_");
|
||||
if (s.length > 1) {
|
||||
query.addCriteria(Criteria.where("publishNum").gt(s[1]));
|
||||
query.addCriteria(Criteria.where("publishNum").gte(s[1]));
|
||||
} else {
|
||||
query.addCriteria(Criteria.where("publishNum").lt(s[0]));
|
||||
query.addCriteria(Criteria.where("publishNum").lte(s[0]));
|
||||
}
|
||||
}
|
||||
if (CharSequenceUtil.isNotEmpty(receivedNum)) {
|
||||
String[] s = receivedNum.split("_");
|
||||
if (s.length > 1) {
|
||||
query.addCriteria(Criteria.where("receivedNum").gt(s[1]));
|
||||
query.addCriteria(Criteria.where("receivedNum").gte(s[1]));
|
||||
} else {
|
||||
query.addCriteria(Criteria.where("receivedNum").lt(s[0]));
|
||||
query.addCriteria(Criteria.where("receivedNum").lte(s[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -364,8 +364,8 @@ public class FullDiscountServiceImpl extends ServiceImpl<FullDiscountMapper, Ful
|
||||
Query query = new Query();
|
||||
Date now = new Date();
|
||||
query.addCriteria(Criteria.where(PROMOTION_STATUS_COLUMN).is(PromotionStatusEnum.START.name()));
|
||||
query.addCriteria(Criteria.where("startTime").lt(now));
|
||||
query.addCriteria(Criteria.where("endTime").gt(now));
|
||||
query.addCriteria(Criteria.where("startTime").lte(now));
|
||||
query.addCriteria(Criteria.where("endTime").gte(now));
|
||||
return query;
|
||||
}
|
||||
}
|
@ -105,7 +105,7 @@ public class MemberCouponServiceImpl extends ServiceImpl<MemberCouponMapper, Mem
|
||||
.or(j -> j.eq(MemberCoupon::getScopeType, CouponScopeTypeEnum.ALL.name())));
|
||||
queryWrapper.eq(MemberCoupon::getMemberCouponStatus, MemberCouponStatusEnum.NEW.name());
|
||||
queryWrapper.le(MemberCoupon::getConsumeThreshold, totalPrice);
|
||||
queryWrapper.gt(MemberCoupon::getEndTime, new Date());
|
||||
queryWrapper.ge(MemberCoupon::getEndTime, new Date());
|
||||
return this.page(PageUtil.initPage(pageVo), queryWrapper);
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ public class MemberCouponServiceImpl extends ServiceImpl<MemberCouponMapper, Mem
|
||||
queryWrapper.in(MemberCoupon::getCouponId, couponIds);
|
||||
queryWrapper.ne(MemberCoupon::getScopeType, CouponScopeTypeEnum.ALL.name());
|
||||
queryWrapper.le(MemberCoupon::getConsumeThreshold, totalPrice);
|
||||
queryWrapper.gt(MemberCoupon::getEndTime, new Date());
|
||||
queryWrapper.ge(MemberCoupon::getEndTime, new Date());
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ public class MemberCouponServiceImpl extends ServiceImpl<MemberCouponMapper, Mem
|
||||
queryWrapper.eq(MemberCoupon::getMemberId, memberId);
|
||||
queryWrapper.eq(MemberCoupon::getMemberCouponStatus, MemberCouponStatusEnum.NEW.name());
|
||||
queryWrapper.eq(MemberCoupon::getScopeType, CouponScopeTypeEnum.ALL.name());
|
||||
queryWrapper.gt(MemberCoupon::getEndTime, new Date()).and(i -> i.in(MemberCoupon::getStoreId, storeId).or(j -> j.eq(MemberCoupon::getIsPlatform, true)));
|
||||
queryWrapper.ge(MemberCoupon::getEndTime, new Date()).and(i -> i.in(MemberCoupon::getStoreId, storeId).or(j -> j.eq(MemberCoupon::getIsPlatform, true)));
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
|
@ -216,8 +216,8 @@ public class PromotionGoodsServiceImpl extends ServiceImpl<PromotionGoodsMapper,
|
||||
promotionGoodsPage.setCurrent(pageVo.getPageNumber());
|
||||
Date now = new Date();
|
||||
Query query = new Query();
|
||||
query.addCriteria(Criteria.where("startTime").lt(now));
|
||||
query.addCriteria(Criteria.where("endTime").gt(now));
|
||||
query.addCriteria(Criteria.where("startTime").lte(now));
|
||||
query.addCriteria(Criteria.where("endTime").gte(now));
|
||||
List<PromotionGoodsDTO> promotionGoodsDTOList = new ArrayList<>();
|
||||
int total = 0;
|
||||
//根据促销活动类型的不同,将满足当前促销活动类型且正在进行的促销商品返回出去
|
||||
|
@ -154,8 +154,8 @@ public class PromotionServiceImpl implements PromotionService {
|
||||
Map<String, Object> resultMap = new HashMap<>(16);
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("promotion_status", PromotionStatusEnum.START.name());
|
||||
queryWrapper.gt("start_time", new Date());
|
||||
queryWrapper.lt("end_time", new Date());
|
||||
queryWrapper.ge("start_time", new Date());
|
||||
queryWrapper.le("end_time", new Date());
|
||||
//获取当前进行的秒杀活动活动
|
||||
List<Seckill> seckillList = seckillService.list(queryWrapper);
|
||||
if (seckillList != null && !seckillList.isEmpty()) {
|
||||
@ -192,7 +192,7 @@ public class PromotionServiceImpl implements PromotionService {
|
||||
Query query = new Query();
|
||||
query.addCriteria(Criteria.where("deleteFlag").is(false));
|
||||
query.addCriteria(Criteria.where("promotionStatus").is(PromotionStatusEnum.START.name()));
|
||||
query.addCriteria(Criteria.where("endTime").gt(new Date()));
|
||||
query.addCriteria(Criteria.where("endTime").gte(new Date()));
|
||||
List<FullDiscountVO> fullDiscountVOS = mongoTemplate.find(query, FullDiscountVO.class);
|
||||
for (FullDiscountVO fullDiscountVO : fullDiscountVOS) {
|
||||
if (fullDiscountVO.getPromotionGoodsList() == null) {
|
||||
@ -211,13 +211,13 @@ public class PromotionServiceImpl implements PromotionService {
|
||||
}
|
||||
}
|
||||
}
|
||||
LambdaQueryWrapper<PromotionGoods> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(PromotionGoods::getDeleteFlag, false);
|
||||
queryWrapper1.eq(PromotionGoods::getPromotionStatus, PromotionStatusEnum.START.name());
|
||||
queryWrapper1.gt(PromotionGoods::getEndTime, new Date());
|
||||
queryWrapper1.eq(PromotionGoods::getSkuId, index.getId());
|
||||
List<PromotionGoods> list1 = promotionGoodsService.list(queryWrapper1);
|
||||
for (PromotionGoods promotionGoods : list1) {
|
||||
LambdaQueryWrapper<PromotionGoods> promotionGoodsQuery = new LambdaQueryWrapper<>();
|
||||
promotionGoodsQuery.eq(PromotionGoods::getDeleteFlag, false);
|
||||
promotionGoodsQuery.eq(PromotionGoods::getPromotionStatus, PromotionStatusEnum.START.name());
|
||||
promotionGoodsQuery.ge(PromotionGoods::getEndTime, new Date());
|
||||
promotionGoodsQuery.eq(PromotionGoods::getSkuId, index.getId());
|
||||
List<PromotionGoods> promotionGoodsList = promotionGoodsService.list(promotionGoodsQuery);
|
||||
for (PromotionGoods promotionGoods : promotionGoodsList) {
|
||||
String esPromotionKey = promotionGoods.getPromotionType() + "-" + promotionGoods.getPromotionId();
|
||||
switch (PromotionTypeEnum.valueOf(promotionGoods.getPromotionType())) {
|
||||
case COUPON:
|
||||
|
@ -277,7 +277,7 @@ public class SeckillApplyServiceImpl extends ServiceImpl<SeckillApplyMapper, Sec
|
||||
List<SeckillTimelineVO> timelineList = new ArrayList<>();
|
||||
LambdaQueryWrapper<Seckill> queryWrapper = new LambdaQueryWrapper<>();
|
||||
//查询当天时间段内的且状态不为结束或关闭的秒杀活动活动
|
||||
queryWrapper.gt(Seckill::getStartTime, new Date(cn.lili.common.utils.DateUtil.startOfTodDay() * 1000)).lt(Seckill::getEndTime, cn.lili.common.utils.DateUtil.endOfDate())
|
||||
queryWrapper.ge(Seckill::getStartTime, new Date(cn.lili.common.utils.DateUtil.startOfTodDay() * 1000)).le(Seckill::getEndTime, cn.lili.common.utils.DateUtil.endOfDate())
|
||||
.and(i -> i.eq(Seckill::getPromotionStatus, PromotionStatusEnum.NEW.name())
|
||||
.or(j -> j.eq(Seckill::getPromotionStatus, PromotionStatusEnum.START.name())));
|
||||
List<Seckill> seckillList = seckillService.list(queryWrapper);
|
||||
@ -326,7 +326,7 @@ public class SeckillApplyServiceImpl extends ServiceImpl<SeckillApplyMapper, Sec
|
||||
private List<SeckillGoodsVO> wrapperSeckillGoods(Integer startTimeline) {
|
||||
List<SeckillGoodsVO> seckillGoodsVoS = new ArrayList<>();
|
||||
LambdaQueryWrapper<Seckill> seckillLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
seckillLambdaQueryWrapper.gt(Seckill::getStartTime, new Date(cn.lili.common.utils.DateUtil.startOfTodDay() * 1000)).lt(Seckill::getEndTime, cn.lili.common.utils.DateUtil.endOfDate())
|
||||
seckillLambdaQueryWrapper.ge(Seckill::getStartTime, new Date(cn.lili.common.utils.DateUtil.startOfTodDay() * 1000)).le(Seckill::getEndTime, cn.lili.common.utils.DateUtil.endOfDate())
|
||||
.and(i -> i.eq(Seckill::getPromotionStatus, PromotionStatusEnum.NEW.name())
|
||||
.or(j -> j.eq(Seckill::getPromotionStatus, PromotionStatusEnum.START.name())));
|
||||
List<Seckill> seckillList = this.seckillService.list(seckillLambdaQueryWrapper);
|
||||
|
@ -35,14 +35,14 @@ public class MemberStatisticsDataServiceImpl extends ServiceImpl<MemberStatistic
|
||||
@Override
|
||||
public Integer todayMemberNum() {
|
||||
QueryWrapper queryWrapper = Wrappers.query();
|
||||
queryWrapper.gt("create_time", DateUtil.beginOfDay(new Date()));
|
||||
queryWrapper.ge("create_time", DateUtil.beginOfDay(new Date()));
|
||||
return this.baseMapper.customSqlQuery(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer memberCount(Date endTime) {
|
||||
QueryWrapper queryWrapper = Wrappers.query();
|
||||
queryWrapper.lt("create_time", endTime);
|
||||
queryWrapper.le("create_time", endTime);
|
||||
return this.baseMapper.customSqlQuery(queryWrapper);
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ public class OrderStatisticsDataServiceImpl extends ServiceImpl<OrderStatisticsD
|
||||
queryWrapper.eq("store_id", authUser.getStoreId());
|
||||
}
|
||||
//大于今天凌晨
|
||||
queryWrapper.gt("create_time", DateUtil.startOfTodDayTime());
|
||||
queryWrapper.ge("create_time", DateUtil.startOfTodDayTime());
|
||||
|
||||
queryWrapper.select("SUM(final_price) AS price , COUNT(0) AS num");
|
||||
return this.getMap(queryWrapper);
|
||||
|
@ -302,7 +302,7 @@ public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements
|
||||
public Integer todayStoreNum() {
|
||||
LambdaQueryWrapper<Store> queryWrapper = Wrappers.lambdaQuery();
|
||||
queryWrapper.eq(Store::getStoreDisable, StoreStatusEnum.OPEN.name());
|
||||
queryWrapper.gt(Store::getCreateTime, DateUtil.beginOfDay(new DateTime()));
|
||||
queryWrapper.ge(Store::getCreateTime, DateUtil.beginOfDay(new DateTime()));
|
||||
return this.count(queryWrapper);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user