付款 活动最佳优惠接口
This commit is contained in:
parent
b840bd3e99
commit
9a96d26d8d
@ -105,7 +105,7 @@
|
||||
<span>满</span> <el-input-number v-model="item.amount" :min="0" :max="99999" label="0"></el-input-number> <span>元</span>
|
||||
</div>
|
||||
<div style="width: 25%;display: flex; align-items: center;">
|
||||
<span>打</span> <el-input-number v-model="item.discount" :min="0" :max="10" placeholder="1 ~ 9.9" label=""></el-input-number> <span>折</span>
|
||||
<span>打</span> <el-input-number v-model="item.discount" :min="0" :max="9.9" placeholder="1 ~ 9.9" label=""></el-input-number> <span>折</span>
|
||||
|
||||
</div>
|
||||
<div @click="deleteactiveDiscountChildList(index)">
|
||||
|
@ -174,12 +174,12 @@
|
||||
<el-form-item label="满足金额" prop="satisfiedAmount" v-if="form.discountType == 1">
|
||||
<el-input v-model="form.satisfiedAmount" placeholder="请输入满足金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠折扣" prop="specialDiscount" v-if="form.discountType == 1">
|
||||
<el-input v-model="form.specialDiscount" placeholder="请输入优惠折扣" />
|
||||
<el-form-item label="优惠折扣" prop="specialDiscount" v-if="form.discountType == 1">
|
||||
<el-input-number v-model="form.specialDiscount" :min="0" :max="9.9" placeholder="1 ~ 9.9"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="折扣抵消" prop="discountOffset" v-if="form.discountType == 1">
|
||||
<!-- <el-form-item label="折扣抵消" prop="discountOffset" v-if="form.discountType == 1">
|
||||
<el-input v-model="form.discountOffset" placeholder="请输入折扣抵消" />
|
||||
</el-form-item>
|
||||
</el-form-item>-->
|
||||
<el-form-item label="生效日期" prop="timeType">
|
||||
<el-radio-group v-model="form.timeType">
|
||||
<!-- 0 -->
|
||||
@ -460,9 +460,6 @@ export default {
|
||||
checkTime: [
|
||||
{ required: true, message: '不能为空', trigger: 'change' }
|
||||
],
|
||||
exclusiveFunction: [
|
||||
{ required: true, message: '不能为空', trigger: 'change' }
|
||||
],
|
||||
claimRule: [
|
||||
{ required: true, message: '不能为空', trigger: 'change' }
|
||||
],
|
||||
|
@ -9,14 +9,28 @@ import java.math.BigDecimal;
|
||||
public class ActiveDiscountPayVO implements Serializable {
|
||||
//活动id
|
||||
private Integer activeId;
|
||||
//1满减2折扣
|
||||
private String type;
|
||||
//活动名称
|
||||
private String activeName;
|
||||
//满足金额
|
||||
private BigDecimal amount;
|
||||
//折扣
|
||||
//总折扣
|
||||
private BigDecimal discount;
|
||||
//活动优惠价格
|
||||
private BigDecimal activeDiscount;
|
||||
//折扣
|
||||
private double discounts;
|
||||
//可用油品
|
||||
private String oilId;
|
||||
//适用会员
|
||||
private String adaptUser;
|
||||
//参与条件 0:不限制 1:优惠订单不参与
|
||||
private String participationCondition;
|
||||
//优惠券id
|
||||
private Integer couponId;
|
||||
//优惠券金额
|
||||
private BigDecimal cardFavorableAmount;
|
||||
//优惠券信息
|
||||
private String cardFavorableInfo;
|
||||
}
|
||||
|
@ -93,12 +93,12 @@ public class ActiveExchangeController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* test
|
||||
* 满减折扣优惠券会员等级总优惠
|
||||
* @param paymentActiveDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("test")
|
||||
public ResponseObject paymentActiveVO(@RequestBody PaymentActiveDTO paymentActiveDTO) {
|
||||
@GetMapping("getPaymentActive")
|
||||
public ResponseObject getPaymentActive(PaymentActiveDTO paymentActiveDTO) {
|
||||
return getSuccessResult(this.activeExchangeService.paymentActive(paymentActiveDTO));
|
||||
}
|
||||
|
||||
|
@ -17,4 +17,6 @@ public class PaymentActiveDTO implements Serializable {
|
||||
private Integer storeId;
|
||||
//会员等级
|
||||
private Integer mtUserLevel;
|
||||
//用户id
|
||||
private Integer userId;
|
||||
}
|
||||
|
@ -56,4 +56,10 @@ public interface ActiveExchangeService {
|
||||
* @return
|
||||
*/
|
||||
PaymentActiveVO paymentActive(PaymentActiveDTO paymentActiveDTO);
|
||||
|
||||
/**
|
||||
* 消费有礼后续处理
|
||||
* @param paymentActiveDTO
|
||||
*/
|
||||
void activeConsumption(PaymentActiveDTO paymentActiveDTO);
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.fuint.business.marketingActivity.activeExchange.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
@ -32,8 +34,11 @@ import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeReco
|
||||
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.vo.CouponVO;
|
||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
||||
import com.fuint.business.marketingActivity.cardValue.service.CardValueService;
|
||||
import com.fuint.business.marketingActivity.cardValue.vo.CardValueAppletVO;
|
||||
@ -41,10 +46,14 @@ import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrde
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.mapper.CardValueOrdersMapper;
|
||||
import com.fuint.business.order.mapper.OilOrderMapper;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilName;
|
||||
import com.fuint.business.petrolStationManagement.mapper.OilNameMapper;
|
||||
import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
|
||||
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||
import com.fuint.business.storeInformation.service.ILJStoreService;
|
||||
import com.fuint.business.userManager.entity.LJUser;
|
||||
import com.fuint.business.userManager.entity.LJUserGrade;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.business.userManager.mapper.LJUserGradeMapper;
|
||||
import com.fuint.business.userManager.mapper.LJUserMapper;
|
||||
import com.fuint.business.userManager.service.LJUserGradeService;
|
||||
import com.fuint.business.userManager.service.LJUserService;
|
||||
@ -53,6 +62,7 @@ import com.fuint.business.userManager.vo.LJUserVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -60,9 +70,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@ -82,6 +91,8 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
||||
@Resource
|
||||
private LJUserGradeService userGradeService;
|
||||
@Resource
|
||||
private LJUserGradeMapper ljUserGradeMapper;
|
||||
@Resource
|
||||
private CardFavorableService cardFavorableService;
|
||||
@Resource
|
||||
private ActiveConsumptionService activeConsumptionService;
|
||||
@ -94,15 +105,17 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
||||
@Resource
|
||||
private OilOrderMapper oilOrderMapper;
|
||||
@Resource
|
||||
private LJUserMapper ljUserMapper;
|
||||
@Resource
|
||||
private UserBalanceService userBalanceService;
|
||||
@Resource
|
||||
private ILJStoreService iljStoreService;
|
||||
@Autowired
|
||||
private LJUserService userService;
|
||||
@Resource
|
||||
private CardValueOrdersMapper cardValueOrdersMapper;
|
||||
private CardFavorableRecordMapper cardFavorableRecordMapper;
|
||||
@Resource
|
||||
private OilNameMapper oilNameMapper;
|
||||
@Resource
|
||||
private OilNumberMapper oilNumberMapper;
|
||||
/**
|
||||
* 分页查询所有
|
||||
* @param
|
||||
@ -423,49 +436,311 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
||||
public PaymentActiveVO paymentActive(PaymentActiveDTO paymentActiveDTO) {
|
||||
PaymentActiveVO paymentActiveVO = new PaymentActiveVO();
|
||||
Integer storeId = paymentActiveDTO.getStoreId();
|
||||
BigDecimal amount = new BigDecimal(0.00);
|
||||
BigDecimal fullAmount = new BigDecimal(0.00);
|
||||
BigDecimal a = new BigDecimal(0.1);
|
||||
BigDecimal b = new BigDecimal(10);
|
||||
double finalAmount = 0.00;
|
||||
Integer userId = TokenUtil.getNowAccountInfo().getId();
|
||||
//折扣
|
||||
List<ActiveDiscountPayVO> activeDiscountVOList = oilOrderMapper.selectActiveDiscount(storeId,paymentActiveDTO.getAmount(),paymentActiveDTO.getOilId(),paymentActiveDTO.getMtUserLevel());
|
||||
//满减
|
||||
List<ActiveDiscountPayVO> activeFuletVOList = oilOrderMapper.selectActiveFule(storeId,paymentActiveDTO.getAmount(),paymentActiveDTO.getOilId(),paymentActiveDTO.getMtUserLevel());
|
||||
//优惠券
|
||||
paymentActiveDTO.setUserId(userId);
|
||||
List<CardFavorableRecordVO> canUserCardFavorableList = cardFavorableRecordMapper.getCanUserCardFavorableList(paymentActiveDTO);
|
||||
//会员等级当前优惠力度最大
|
||||
|
||||
//无限制条件的活动列表
|
||||
List<ActiveDiscountPayVO> resList =new ArrayList<>();
|
||||
//无限制条件的优惠券的列表
|
||||
ArrayList<CardFavorableRecordVO> cardFavorableRecordVOS = new ArrayList<>();
|
||||
//优惠券和折扣活动的组合列表
|
||||
ArrayList<ActiveDiscountPayVO> cardAndDisPays = new ArrayList<>();
|
||||
//优惠券和满减活动的组合列表
|
||||
ArrayList<ActiveDiscountPayVO> cardAndComPays = new ArrayList<>();
|
||||
//折扣
|
||||
List<ActiveDiscountPayVO> activeDiscountVOList = oilOrderMapper.selectActiveDiscount(storeId,paymentActiveDTO.getAmount());
|
||||
if (CollectionUtils.isNotEmpty(activeDiscountVOList)){
|
||||
for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) {
|
||||
if (activeDiscountPayVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) &&
|
||||
activeDiscountPayVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString())){
|
||||
if (activeDiscountPayVO.getAmount().multiply(activeDiscountPayVO.getDiscount()).compareTo(amount) > 0){
|
||||
amount = paymentActiveDTO.getAmount().subtract(((b.subtract(activeDiscountPayVO.getDiscount())).multiply(paymentActiveDTO.getAmount()).multiply(a)));
|
||||
paymentActiveVO.setActiveId(activeDiscountPayVO.getActiveId());
|
||||
paymentActiveVO.setAmount(amount);
|
||||
paymentActiveVO.setFavorableAmount((b.subtract(activeDiscountPayVO.getDiscount())).multiply(activeDiscountPayVO.getAmount()).multiply(a));
|
||||
}
|
||||
if (activeDiscountPayVO.getParticipationCondition().equals("0")){
|
||||
activeDiscountPayVO.setType("2");
|
||||
activeDiscountPayVO.setActiveDiscount(activeDiscountPayVO.getDiscount());
|
||||
resList.add(activeDiscountPayVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
//满减
|
||||
List<ActiveDiscountPayVO> activeFuletVOList = oilOrderMapper.selectActiveFule(storeId,paymentActiveDTO.getAmount());
|
||||
if (CollectionUtils.isNotEmpty(activeFuletVOList)){
|
||||
for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOList) {
|
||||
if (activeDiscountPayVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) &&
|
||||
activeDiscountPayVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString())){
|
||||
//如果满足条件
|
||||
if ((paymentActiveDTO.getAmount()).compareTo(activeDiscountPayVO.getAmount()) >= 0){
|
||||
fullAmount = paymentActiveDTO.getAmount().subtract(activeDiscountPayVO.getDiscount());
|
||||
if (amount.compareTo(fullAmount) > 0){
|
||||
amount = paymentActiveDTO.getAmount().subtract(activeDiscountPayVO.getDiscount());
|
||||
paymentActiveVO.setActiveId(activeDiscountPayVO.getActiveId());
|
||||
paymentActiveVO.setAmount(amount);
|
||||
paymentActiveVO.setFavorableAmount(paymentActiveDTO.getAmount().subtract(fullAmount));
|
||||
}
|
||||
}
|
||||
if (activeDiscountPayVO.getParticipationCondition().equals("0")){
|
||||
activeDiscountPayVO.setActiveDiscount(activeDiscountPayVO.getDiscount());
|
||||
activeDiscountPayVO.setType("1");
|
||||
resList.add(activeDiscountPayVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
//优惠券
|
||||
if (CollectionUtils.isNotEmpty(canUserCardFavorableList)){
|
||||
for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) {
|
||||
if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")){
|
||||
cardFavorableRecordVOS.add(cardFavorableRecordVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
//折扣+优惠券
|
||||
for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) {
|
||||
for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) {
|
||||
if(cardFavorableRecordVO.getType().equals("2") && !cardFavorableRecordVO.getExclusiveFunction().equals("0")){
|
||||
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
|
||||
BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1);
|
||||
activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId());
|
||||
double discountAmount = cardFavorableRecordVO.getDiscountAmount();
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount);
|
||||
activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount());
|
||||
BigDecimal discount = activeDiscountPayVO1.getDiscount();
|
||||
activeDiscountPayVO1.setDiscount(bigDecimal.add(discount));
|
||||
|
||||
activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
|
||||
activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName());
|
||||
cardAndDisPays.add(activeDiscountPayVO1);
|
||||
}else if( !cardFavorableRecordVO.getExclusiveFunction().equals("0")){
|
||||
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
|
||||
BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1);
|
||||
String[] split = cardFavorableRecordVO.getOilType().split(",");
|
||||
if(paymentActiveDTO.getOilId().equals(split)){
|
||||
activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId());
|
||||
double discountAmount = cardFavorableRecordVO.getDiscountAmount();
|
||||
activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount());
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount);
|
||||
BigDecimal discount = activeDiscountPayVO1.getDiscount();
|
||||
activeDiscountPayVO1.setDiscount(bigDecimal.add(discount));
|
||||
activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
|
||||
activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName());
|
||||
cardAndDisPays.add(activeDiscountPayVO1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//满减+优惠券
|
||||
for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOList) {
|
||||
for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) {
|
||||
if(cardFavorableRecordVO.getType().equals("2") && !cardFavorableRecordVO.getExclusiveFunction().equals("0")){
|
||||
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
|
||||
BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1);
|
||||
activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId());
|
||||
double discountAmount = cardFavorableRecordVO.getDiscountAmount();
|
||||
activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount());
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount);
|
||||
BigDecimal discount = activeDiscountPayVO1.getDiscount();
|
||||
activeDiscountPayVO1.setDiscount(bigDecimal.add(discount));
|
||||
activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
|
||||
activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName());
|
||||
cardAndComPays.add(activeDiscountPayVO1);
|
||||
}else if (!cardFavorableRecordVO.getExclusiveFunction().equals("0")){
|
||||
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
|
||||
BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1);
|
||||
String[] split = cardFavorableRecordVO.getOilType().split(",");
|
||||
if(paymentActiveDTO.getOilId().equals(split)){
|
||||
activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId());
|
||||
double discountAmount = cardFavorableRecordVO.getDiscountAmount();
|
||||
activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount());
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount);
|
||||
BigDecimal discount = activeDiscountPayVO1.getDiscount();
|
||||
activeDiscountPayVO1.setDiscount(bigDecimal.add(discount));
|
||||
activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
|
||||
activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName());
|
||||
cardAndComPays.add(activeDiscountPayVO1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
for (ActiveDiscountPayVO activeDiscountPayVO : resList) {
|
||||
double v = activeDiscountPayVO.getDiscount().doubleValue();
|
||||
activeDiscountPayVO.setDiscounts(v);
|
||||
}
|
||||
for (ActiveDiscountPayVO activeDiscountPayVO : cardAndDisPays) {
|
||||
double v = activeDiscountPayVO.getDiscount().doubleValue();
|
||||
activeDiscountPayVO.setDiscounts(v);
|
||||
}
|
||||
for (ActiveDiscountPayVO activeDiscountPayVO : cardAndComPays) {
|
||||
double v = activeDiscountPayVO.getDiscount().doubleValue();
|
||||
activeDiscountPayVO.setDiscounts(v);
|
||||
}
|
||||
|
||||
ArrayList<ActiveDiscountPayVO> activeDiscountPayVOS = new ArrayList<>();
|
||||
//1.无限制条件的活动和优惠券分别选出一个优惠最大的来
|
||||
//活动
|
||||
ActiveDiscountPayVO activeDiscountPayVO = resList.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get();
|
||||
activeDiscountPayVOS.add(activeDiscountPayVO);
|
||||
//优惠券
|
||||
CardFavorableRecordVO cardFavorableRecordVO = new CardFavorableRecordVO();
|
||||
if (CollectionUtils.isNotEmpty(cardFavorableRecordVOS)){
|
||||
cardFavorableRecordVO = cardFavorableRecordVOS.stream().max(Comparator.comparingDouble(CardFavorableRecordVO::getDiscountAmount)).get();
|
||||
}
|
||||
//2.有限制条件的活动和优惠券组合比较出一个优惠最大的来
|
||||
//满减+优惠券
|
||||
if (CollectionUtils.isNotEmpty(cardAndDisPays)){
|
||||
ActiveDiscountPayVO activeDiscountPayVO1 = cardAndDisPays.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get();
|
||||
activeDiscountPayVOS.add(activeDiscountPayVO1);
|
||||
}
|
||||
//折扣+优惠券
|
||||
if (CollectionUtils.isNotEmpty(cardAndComPays)){
|
||||
ActiveDiscountPayVO activeDiscountPayVO2 = cardAndComPays.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get();
|
||||
activeDiscountPayVOS.add(activeDiscountPayVO2);
|
||||
}
|
||||
//3.活动和活动+优惠券的组合比较
|
||||
if (CollectionUtils.isNotEmpty(activeDiscountPayVOS)){
|
||||
ActiveDiscountPayVO activeDiscountPayVO3 = activeDiscountPayVOS.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get();
|
||||
//4. 3和优惠券比较
|
||||
if(ObjectUtils.isNotEmpty(activeDiscountPayVO3)){
|
||||
finalAmount = activeDiscountPayVO3.getDiscounts();
|
||||
if (ObjectUtils.isNotEmpty(cardFavorableRecordVO) && finalAmount < cardFavorableRecordVO.getDiscountAmount()){
|
||||
PaymentActiveVO paymentActiveVO1 = new PaymentActiveVO();
|
||||
//单用优惠券优惠力度最大
|
||||
paymentActiveVO1.setCardFavorableId(cardFavorableRecordVO.getId());
|
||||
//金额
|
||||
paymentActiveVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
|
||||
//优惠券名字
|
||||
paymentActiveVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName() + "满"+cardFavorableRecordVO.getSatisfiedAmount() + "减" + cardFavorableRecordVO.getDiscountAmount() + "元");
|
||||
BeanUtils.copyProperties(paymentActiveVO1,paymentActiveVO);
|
||||
//return paymentActiveVO1;
|
||||
}else {
|
||||
PaymentActiveVO paymentActiveVO2 = new PaymentActiveVO();
|
||||
//活动或活动+优惠券优惠力度最大
|
||||
paymentActiveVO2.setActiveId(activeDiscountPayVO3.getActiveId());
|
||||
paymentActiveVO2.setActiveInfo(activeDiscountPayVO3.getActiveName());
|
||||
paymentActiveVO2.setType(activeDiscountPayVO3.getType());
|
||||
paymentActiveVO2.setActiveFavorableAmount(activeDiscountPayVO3.getActiveDiscount());
|
||||
|
||||
paymentActiveVO2.setCardFavorableId(activeDiscountPayVO3.getCouponId());
|
||||
paymentActiveVO2.setCardFavorableInfo(activeDiscountPayVO3.getCardFavorableInfo());
|
||||
paymentActiveVO2.setCardFavorableAmount(activeDiscountPayVO3.getCardFavorableAmount());
|
||||
BeanUtils.copyProperties(paymentActiveVO2,paymentActiveVO);
|
||||
//return paymentActiveVO2;
|
||||
}
|
||||
}
|
||||
}
|
||||
//会员等级优惠
|
||||
|
||||
Integer oilId = paymentActiveDTO.getOilId();
|
||||
double oilPriceById = oilNumberMapper.getOilPriceById(oilId,storeId);
|
||||
BigDecimal bigDecimal1 = BigDecimal.valueOf(oilPriceById);
|
||||
String oilTypebyId = oilNameMapper.getOilTypebyId(oilId);
|
||||
|
||||
String gradeId = ljUserGradeMapper.selectByUserId(paymentActiveDTO.getStoreId(), userId);
|
||||
if (StringUtils.isNotEmpty(gradeId)){
|
||||
LJUserGrade ljUserGrade = ljUserGradeMapper.selectAllByGradeId(gradeId);
|
||||
if (ObjectUtils.isNotEmpty(ljUserGrade)){
|
||||
if (oilTypebyId.equals("汽油")){
|
||||
if (ljUserGrade.getGasolineDiscount().equals("无优惠")){
|
||||
|
||||
}else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")){
|
||||
String gasolineRule = ljUserGrade.getGasolineRule();
|
||||
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
||||
for (JSONObject jsonObject : jsonObjects) {
|
||||
Integer gasolineRule1 = jsonObject.getInteger("gasolineRule1");
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
|
||||
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
|
||||
//升数
|
||||
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1,2,RoundingMode.HALF_UP);
|
||||
Integer gasolineRule3 = jsonObject.getInteger("gasolineRule3");
|
||||
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
|
||||
BigDecimal multiply = divide.multiply(bigDecimal2);
|
||||
paymentActiveVO.setMemberFavorableAmount(multiply);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
String gasolineRule = ljUserGrade.getGasolineRule();
|
||||
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
||||
for (JSONObject jsonObject : jsonObjects) {
|
||||
Integer gasolineRule1 = jsonObject.getInteger("gasolineRule1");
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
|
||||
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
|
||||
//升数
|
||||
Integer gasolineRule3 = jsonObject.getInteger("gasolineRule2");
|
||||
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
|
||||
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (oilTypebyId.equals("柴油")){
|
||||
if (ljUserGrade.getGasolineDiscount().equals("无优惠")){
|
||||
|
||||
}else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")){
|
||||
String gasolineRule = ljUserGrade.getDieselRule();
|
||||
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
||||
for (JSONObject jsonObject : jsonObjects) {
|
||||
Integer gasolineRule1 = jsonObject.getInteger("dieselRule1");
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
|
||||
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
|
||||
//升数
|
||||
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1,2,RoundingMode.HALF_UP);
|
||||
Integer gasolineRule3 = jsonObject.getInteger("dieselRule3");
|
||||
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
|
||||
BigDecimal multiply = divide.multiply(bigDecimal2);
|
||||
paymentActiveVO.setMemberFavorableAmount(multiply);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
String gasolineRule = ljUserGrade.getDieselRule();
|
||||
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
||||
for (JSONObject jsonObject : jsonObjects) {
|
||||
Integer gasolineRule1 = jsonObject.getInteger("dieselRule1");
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
|
||||
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
|
||||
//升数
|
||||
Integer gasolineRule3 = jsonObject.getInteger("dieselRule3");
|
||||
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
|
||||
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (oilTypebyId.equals("天然气")){
|
||||
if (ljUserGrade.getGasolineDiscount().equals("无优惠")){
|
||||
|
||||
}else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")){
|
||||
String gasolineRule = ljUserGrade.getNaturalGasRule();
|
||||
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
||||
for (JSONObject jsonObject : jsonObjects) {
|
||||
Integer gasolineRule1 = jsonObject.getInteger("naturalGas1");
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
|
||||
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
|
||||
//升数
|
||||
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1,2,RoundingMode.HALF_UP);
|
||||
Integer gasolineRule3 = jsonObject.getInteger("naturalGas3");
|
||||
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
|
||||
BigDecimal multiply = divide.multiply(bigDecimal2);
|
||||
paymentActiveVO.setMemberFavorableAmount(multiply);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
String gasolineRule = ljUserGrade.getGasolineRule();
|
||||
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
||||
for (JSONObject jsonObject : jsonObjects) {
|
||||
Integer gasolineRule1 = jsonObject.getInteger("naturalGas1");
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
|
||||
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
|
||||
//升数
|
||||
Integer gasolineRule3 = jsonObject.getInteger("naturalGas3");
|
||||
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
|
||||
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return paymentActiveVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activeConsumption(PaymentActiveDTO paymentActiveDTO) {
|
||||
//消费有礼
|
||||
List<ActiveConsumptionVO> activeConsumptionVOS = oilOrderMapper.selectActiveConsumption(storeId, paymentActiveDTO.getAmount());
|
||||
List<ActiveConsumptionVO> activeConsumptionVOS = oilOrderMapper.selectActiveConsumption(paymentActiveDTO.getStoreId(), paymentActiveDTO.getAmount());
|
||||
//连锁店信息
|
||||
LJUser ljUserVo = userService.queryUserByUserId(TokenUtil.getNowAccountInfo().getId());
|
||||
String accountName = TokenUtil.getNowAccountInfo().getAccountName();
|
||||
Integer storeId1 = paymentActiveDTO.getStoreId();
|
||||
Integer chainStoreId = iljStoreService.selectStoreByStoreId(storeId1).getChainStoreId();
|
||||
//用户余额
|
||||
@ -519,6 +794,5 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
||||
}
|
||||
}
|
||||
}
|
||||
return paymentActiveVO;
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,18 @@ import java.math.BigDecimal;
|
||||
public class PaymentActiveVO implements Serializable {
|
||||
//活动id
|
||||
private Integer activeId;
|
||||
//应付金额
|
||||
private BigDecimal amount;
|
||||
//优惠金额
|
||||
private BigDecimal favorableAmount;
|
||||
//活动信息
|
||||
private String activeInfo;
|
||||
//1满减2折扣
|
||||
private String type;
|
||||
//活动优惠金额
|
||||
private BigDecimal activeFavorableAmount;
|
||||
//优惠券id
|
||||
private Integer cardFavorableId;
|
||||
//优惠券信息
|
||||
private String cardFavorableInfo;
|
||||
//优惠券金额
|
||||
private BigDecimal cardFavorableAmount;
|
||||
//等级会员优惠金额
|
||||
private BigDecimal memberFavorableAmount;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public class CardFavorableController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
*查询我的优惠券接口(小程序端)
|
||||
*查询我的卡券接口(小程序端)
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param cardFavorableDTOS
|
||||
|
@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.cardFavorable.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.activeExchange.dto.PaymentActiveDTO;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTOS;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -35,5 +36,7 @@ public interface CardFavorableRecordMapper extends BaseMapper<CardFavorableRecor
|
||||
*/
|
||||
// List<CouponVO> selectAllByCondition(Integer id);
|
||||
IPage<CouponVO> selectAllByCondition(@Param("page") Page page, @Param("cardFavorableDTOS") CardFavorableDTOS cardFavorableDTOS);
|
||||
|
||||
List<CardFavorableRecordVO> getCanUserCardFavorableList(@Param("paymentActiveDTO") PaymentActiveDTO paymentActiveDTO);
|
||||
}
|
||||
|
||||
|
@ -116,5 +116,30 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getCanUserCardFavorableList" resultType="com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO">
|
||||
SELECT
|
||||
cf.id id,
|
||||
cf.NAME cardFavorableName,
|
||||
cf.type type,
|
||||
cf.discount_amount discountAmount,
|
||||
cf.oil_type oilType,
|
||||
cf.satisfied_amount satisfiedAmount,
|
||||
cf.exclusive_function exclusiveFunction,
|
||||
(case discount_type when'1'then cf.satisfied_amount * (1-(cf.special_discount * ${paymentActiveDTO.amount}))
|
||||
when '0' then cf.discount_amount
|
||||
else 10 end) as amount
|
||||
FROM
|
||||
card_favorable cf
|
||||
LEFT JOIN card_favorable_record cfr ON cf.id = cfr.card_favorable_id
|
||||
WHERE
|
||||
cfr.mt_user_id = #{paymentActiveDTO.userId}
|
||||
AND cfr.store_id = #{paymentActiveDTO.storeId}
|
||||
AND cf.type != 1
|
||||
AND cf.satisfied_amount <![CDATA[ <= ]]> 350
|
||||
AND now() BETWEEN cfr.start_time
|
||||
AND cfr.end_time
|
||||
AND cfr.status = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
@ -17,6 +17,7 @@ import com.fuint.business.store.service.StoreService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -145,9 +146,11 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
|
||||
CardFavorable favorable = getById(id);
|
||||
BeanUtils.copyProperties(favorable,cardFavorableVO);
|
||||
//获取油号
|
||||
cardFavorableVO.setOilType(Arrays.stream(favorable.getOilType().split(","))
|
||||
.map(Integer::valueOf)
|
||||
.toArray(Integer[]::new));
|
||||
if (StringUtils.isNotEmpty(favorable.getOilType())){
|
||||
cardFavorableVO.setOilType(Arrays.stream(favorable.getOilType().split(","))
|
||||
.map(Integer::valueOf)
|
||||
.toArray(Integer[]::new));
|
||||
}
|
||||
return cardFavorableVO;
|
||||
}
|
||||
|
||||
@ -162,10 +165,12 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
|
||||
BeanUtils.copyProperties(cardFavorableDTO,cardFavorable);
|
||||
//转换油品类型格式
|
||||
String oil = "";
|
||||
for (String s : cardFavorableDTO.getOilType()) {
|
||||
oil += s + ",";
|
||||
if (ObjectUtils.isNotEmpty(cardFavorableDTO.getOilType())){
|
||||
for (String s : cardFavorableDTO.getOilType()) {
|
||||
oil += s + ",";
|
||||
}
|
||||
cardFavorable.setOilType(oil);
|
||||
}
|
||||
cardFavorable.setOilType(oil);
|
||||
if (cardFavorableDTO.getIsonline().equals("1")){
|
||||
cardFavorable.setStatus("1");
|
||||
}
|
||||
|
@ -11,25 +11,37 @@ public class CardFavorableRecordVO extends CardFavorableRecord {
|
||||
*/
|
||||
private String cardFavorableName;
|
||||
/**
|
||||
* 优惠券类型
|
||||
* 优惠券类型 0:油品券 1:商品券 2:通用券
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 满减金额
|
||||
*/
|
||||
private String fullDeduction;
|
||||
private double fullDeduction;
|
||||
/**
|
||||
* 优惠金额
|
||||
*/
|
||||
private String discountAmount;
|
||||
private double discountAmount;
|
||||
/**
|
||||
* 优惠折扣
|
||||
*/
|
||||
private double specialDiscount;
|
||||
/**
|
||||
* 可用时段
|
||||
*
|
||||
*/
|
||||
private String availablePeriod;
|
||||
/**
|
||||
* 互斥功能 0:满减活动 1:储值卡付款
|
||||
*/
|
||||
private String exclusiveFunction;
|
||||
/**
|
||||
* 可用油品
|
||||
*/
|
||||
private String oilType;
|
||||
private String oilName;
|
||||
//优惠类型 0:满减券 1:折扣券
|
||||
private String discountType;
|
||||
//满足金额
|
||||
private double satisfiedAmount;
|
||||
}
|
||||
|
@ -5,12 +5,9 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
import com.fuint.api.fuyou.entity.ReceiveParameter;
|
||||
import com.fuint.api.fuyou.entity.ReturnParameter;
|
||||
@ -18,8 +15,6 @@ import com.fuint.api.fuyou.service.FyPayService;
|
||||
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||
import com.fuint.business.integral.entity.IntegralDetail;
|
||||
import com.fuint.business.integral.service.IntegralDetailService;
|
||||
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||
import com.fuint.business.marketingActivity.cardFule.dto.CardFuelRecordDTO;
|
||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelChange;
|
||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||
@ -30,15 +25,9 @@ import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselServi
|
||||
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
|
||||
import com.fuint.business.marketingActivity.cardFuleOrders.entity.CardFuleOrders;
|
||||
import com.fuint.business.marketingActivity.cardFuleOrders.service.CardFuleOrdersService;
|
||||
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
|
||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
|
||||
import com.fuint.business.marketingActivity.cardValue.vo.CardValueVO;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
|
||||
import com.fuint.business.member.entity.LJStaff;
|
||||
import com.fuint.business.member.service.ILJStaffService;
|
||||
import com.fuint.business.oilDepotConfiguration.entity.OilDepotConfig;
|
||||
import com.fuint.business.order.entity.AllOrderInfo;
|
||||
import com.fuint.business.order.entity.CardBalanceChange;
|
||||
import com.fuint.business.order.entity.OilBalanceChange;
|
||||
import com.fuint.business.order.service.AllOrderInfoService;
|
||||
import com.fuint.business.order.service.OilBalanceChangeService;
|
||||
|
@ -90,7 +90,7 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
List<ActiveDiscountPayVO> selectActiveDiscount(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount);
|
||||
List<ActiveDiscountPayVO> selectActiveDiscount(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId);
|
||||
|
||||
/**
|
||||
* 满减
|
||||
@ -98,7 +98,7 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
List<ActiveDiscountPayVO> selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount);
|
||||
List<ActiveDiscountPayVO> selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId);
|
||||
|
||||
/**
|
||||
* 消费有礼
|
||||
|
@ -349,14 +349,22 @@
|
||||
ad.NAME activeName,
|
||||
ad.diesel_user_level adaptUser,
|
||||
ad.adapt_oil oilId,
|
||||
adc.amount amount,
|
||||
adc.discount discount
|
||||
ad.limit_acount as limitAcount,
|
||||
ad.participation_condition,
|
||||
(case ad.store_id when ${storeId} then adc.amount * (1-(adc.discount * 0.1))
|
||||
end) as discount
|
||||
FROM
|
||||
active_discount ad
|
||||
LEFT JOIN active_discount_child adc ON ad.id = adc.active_discount_id
|
||||
where ad.store_id = #{storeId}
|
||||
and adc.amount <= #{amount}
|
||||
and ad.status = 0
|
||||
LEFT JOIN active_discount_child adc ON ad.id = adc.active_discount_id
|
||||
WHERE
|
||||
ad.store_id = #{storeId}
|
||||
AND adc.amount <![CDATA[ <= ]]> #{amount}
|
||||
and now() BETWEEN ad.active_start_time
|
||||
AND ad.active_end_time
|
||||
AND ad.STATUS = 0
|
||||
AND concat(',',ad.adapt_oil,',') like concat('%',#{oilId},'%')
|
||||
AND concat(',',ad.diesel_user_level,',') like concat('%',#{levelId},'%')
|
||||
GROUP BY ad.id
|
||||
</select>
|
||||
|
||||
<select id="selectActiveFule" resultType="com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountPayVO">
|
||||
@ -365,14 +373,21 @@
|
||||
af.NAME activeName,
|
||||
af.diesel_user_level adaptUser,
|
||||
af.adapt_oil oilId,
|
||||
adc.amount amount,
|
||||
af.limit_acount as limitAcount,
|
||||
af.participation_condition,
|
||||
adc.deduction_amount discount
|
||||
FROM
|
||||
active_fullminus af
|
||||
LEFT JOIN active_discount_child adc ON af.id = adc.active_fullminus_id
|
||||
where af.store_id = #{storeId}
|
||||
and adc.amount <= #{amount}
|
||||
and status = 0
|
||||
WHERE
|
||||
af.store_id = #{storeId}
|
||||
AND adc.amount <![CDATA[ <= ]]> #{amount}
|
||||
and now() BETWEEN af.active_start_time
|
||||
AND af.active_end_time
|
||||
AND af.STATUS = 0
|
||||
AND concat(',',af.adapt_oil,',') like concat('%',#{oilId},'%')
|
||||
AND concat(',',af.diesel_user_level,',') like concat('%',#{levelId},'%')
|
||||
GROUP BY af.id
|
||||
</select>
|
||||
|
||||
<select id="selectActiveConsumption" resultType="com.fuint.business.marketingActivity.activeDiscount.vo.ActiveConsumptionVO">
|
||||
|
@ -17,4 +17,6 @@ public interface OilNameMapper extends BaseMapper<OilName> {
|
||||
public List<OilName> getAllOilNameGroup();
|
||||
|
||||
public OilName selectOilNameById(@Param("id") int id);
|
||||
|
||||
String getOilTypebyId(Integer oilId);
|
||||
}
|
||||
|
@ -62,5 +62,6 @@ public interface OilNumberMapper extends BaseMapper<OilNumber> {
|
||||
*/
|
||||
List<OilNumberNameVo> selectOilNumberNameByStoreId(@Param("storeId") Integer storeId);
|
||||
|
||||
double getOilPriceById(@Param("oilId") Integer oilId,@Param("storeId") Integer storeId);
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,9 @@
|
||||
parameterType="int">
|
||||
select id, oil_type, oil_name from oil_name where id = #{id}
|
||||
</select>
|
||||
<select id="getOilTypebyId" resultType="String">
|
||||
select oil_type from oil_name where id = #{oilId}
|
||||
</select>
|
||||
<select id="getAllOilNameGroup" resultType="com.fuint.business.petrolStationManagement.entity.OilName">
|
||||
select id, oil_type, oil_name from oil_name group by oil_name
|
||||
</select>
|
||||
@ -34,4 +37,4 @@
|
||||
<!-- LEFT JOIN (-->
|
||||
<!-- SELECT dict_label,dict_value FROM sys_dict_data WHERE dict_type = 'oil_type'-->
|
||||
<!-- ) dict ON NA.oil_type = dict.dict_value;-->
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
@ -145,4 +145,8 @@
|
||||
onu.store_id = #{storeId} and onu.state = '启用'
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getOilPriceById" resultType="double">
|
||||
select oil_price from oil_number where oil_name = #{oilId} and store_id = #{storeId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -18,4 +18,8 @@ public interface LJUserGradeMapper extends BaseMapper<LJUserGrade> {
|
||||
* @return
|
||||
*/
|
||||
public IPage<LJUserGrade> selectUserGradeList(Page page, @Param("userGrade") LJUserGrade userGrade);
|
||||
|
||||
String selectByUserId(@Param("storeId") Integer storeId, @Param("userId") Integer userId);
|
||||
|
||||
LJUserGrade selectAllByGradeId(String gradeId);
|
||||
}
|
||||
|
@ -12,4 +12,12 @@
|
||||
</where>
|
||||
order by grade
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
<select id="selectByUserId" resultType="String">
|
||||
select grade_id from mt_user_balance where mt_user_id = #{userId} and store_id = #{storeId}
|
||||
</select>
|
||||
|
||||
<select id="selectAllByGradeId" resultType="com.fuint.business.userManager.entity.LJUserGrade">
|
||||
select * from mt_user_grade where id = #{gradeId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -129,7 +129,7 @@ public class LJUserGradeServiceImpl extends ServiceImpl<LJUserGradeMapper, LJUse
|
||||
res.put("userGrade",baseMapper.selectById(Integer.valueOf(gradeId)));
|
||||
return res;
|
||||
}else {
|
||||
return null;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user