前端随机立减金额获取
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
package com.czg.service.market.service.impl;
|
||||
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.constant.TableValueConstant;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.market.entity.MkConsumeDiscountRandom;
|
||||
import com.czg.market.service.MkConsumeDiscountService;
|
||||
import com.czg.market.vo.MkConsumeDiscountVO;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.market.entity.MkShopConsumeDiscountRecord;
|
||||
import com.czg.market.service.MkShopConsumeDiscountRecordService;
|
||||
import com.czg.service.market.mapper.MkShopConsumeDiscountRecordMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -26,8 +30,18 @@ import java.util.Random;
|
||||
public class MkShopConsumeDiscountRecordServiceImpl extends ServiceImpl<MkShopConsumeDiscountRecordMapper, MkShopConsumeDiscountRecord> implements MkShopConsumeDiscountRecordService{
|
||||
@Resource
|
||||
private MkConsumeDiscountService consumeDiscountService;
|
||||
@DubboReference
|
||||
private ShopUserService shopUserService;
|
||||
@Override
|
||||
public MkShopConsumeDiscountRecord get(Long shopId) {
|
||||
public MkShopConsumeDiscountRecord get(Long shopId, Long userId, Long orderId) {
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getUserId, userId).eq(ShopUser::getShopId, shopId));
|
||||
MkShopConsumeDiscountRecord discountRecord = getOne(new QueryWrapper().eq(MkShopConsumeDiscountRecord::getShopId, shopId)
|
||||
.eq(MkShopConsumeDiscountRecord::getOrderId, orderId)
|
||||
.eq(MkShopConsumeDiscountRecord::getShopUserId, shopUser.getId()));
|
||||
if (discountRecord != null) {
|
||||
return discountRecord;
|
||||
}
|
||||
|
||||
MkConsumeDiscountVO consumeDiscountVO = consumeDiscountService.detail(shopId);
|
||||
if (consumeDiscountVO.getIsEnable() != 1) {
|
||||
throw new ApiNotPrintException("新客立减未开启");
|
||||
@@ -35,6 +49,8 @@ public class MkShopConsumeDiscountRecordServiceImpl extends ServiceImpl<MkShopCo
|
||||
|
||||
MkShopConsumeDiscountRecord shopConsumeDiscountRecord = new MkShopConsumeDiscountRecord();
|
||||
shopConsumeDiscountRecord.setShopId(shopId);
|
||||
shopConsumeDiscountRecord.setShopUserId(shopUser.getId());
|
||||
shopConsumeDiscountRecord.setOrderId(orderId);
|
||||
shopConsumeDiscountRecord.setConsumeDiscountId(consumeDiscountVO.getId());
|
||||
|
||||
// 固定金额
|
||||
|
||||
Reference in New Issue
Block a user