Commit 60ef85fc by huluobin

卡券修改

parent 1fb2e031
...@@ -17,6 +17,7 @@ import com.gogirl.infrastructure.mapper.market.coupon.CouponCustomerRelevanceMap ...@@ -17,6 +17,7 @@ import com.gogirl.infrastructure.mapper.market.coupon.CouponCustomerRelevanceMap
import com.gogirl.infrastructure.mapper.market.coupon.CouponMapper; import com.gogirl.infrastructure.mapper.market.coupon.CouponMapper;
import com.gogirl.infrastructure.mapper.market.timescard.TimesCardCustomerRelevanceMapper; import com.gogirl.infrastructure.mapper.market.timescard.TimesCardCustomerRelevanceMapper;
import com.gogirl.infrastructure.mapper.market.timescard.TimesCardOrderServeDetailMapper; import com.gogirl.infrastructure.mapper.market.timescard.TimesCardOrderServeDetailMapper;
import com.gogirl.infrastructure.mapper.market.timescard.TimesCardUsedRecordMapper;
import com.gogirl.infrastructure.mapper.order.serve.OrderManageMapper; import com.gogirl.infrastructure.mapper.order.serve.OrderManageMapper;
import com.gogirl.infrastructure.mapper.order.serve.OrderServeMapper; import com.gogirl.infrastructure.mapper.order.serve.OrderServeMapper;
import com.gogirl.shared.market.command.SetTimesCardCommand; import com.gogirl.shared.market.command.SetTimesCardCommand;
...@@ -245,6 +246,8 @@ public class MarketServiceImpl implements MarketService { ...@@ -245,6 +246,8 @@ public class MarketServiceImpl implements MarketService {
} }
@Resource @Resource
TimesCardUsedRecordMapper timesCardUsedRecordMapper;
@Resource
TimesCardOrderServeDetailMapper timesCardOrderServeDetailMapper; TimesCardOrderServeDetailMapper timesCardOrderServeDetailMapper;
/** /**
...@@ -329,6 +332,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -329,6 +332,7 @@ public class MarketServiceImpl implements MarketService {
List<Integer> serveIds = timesCardCustomerRelevanceMapper.queryTimesCardServeIds(timesCardUsedRecord.getCardTypeId()); List<Integer> serveIds = timesCardCustomerRelevanceMapper.queryTimesCardServeIds(timesCardUsedRecord.getCardTypeId());
//抵扣的服务为 作用范围内支付金额最高的服务 //抵扣的服务为 作用范围内支付金额最高的服务
OrderServe orderServe = this.queryMaxPayPrice(orderManage, serveIds); OrderServe orderServe = this.queryMaxPayPrice(orderManage, serveIds);
if (orderServe != null) {
//如果有属于这个服务的辅助服务 就查出来一起折扣 //如果有属于这个服务的辅助服务 就查出来一起折扣
OrderServe supportServe = this.querySupportServe(orderManage, orderServe); OrderServe supportServe = this.querySupportServe(orderManage, orderServe);
...@@ -390,6 +394,10 @@ public class MarketServiceImpl implements MarketService { ...@@ -390,6 +394,10 @@ public class MarketServiceImpl implements MarketService {
timesCardCustomerRelevance.setStatus(2); timesCardCustomerRelevance.setStatus(2);
} }
timesCardCustomerRelevanceService.updateById(timesCardCustomerRelevance); timesCardCustomerRelevanceService.updateById(timesCardCustomerRelevance);
} else {
timesCardUsedRecord.setOrderId(null);
timesCardUsedRecordMapper.updateById(timesCardUsedRecord);
}
}); });
} }
...@@ -412,12 +420,14 @@ public class MarketServiceImpl implements MarketService { ...@@ -412,12 +420,14 @@ public class MarketServiceImpl implements MarketService {
.sorted(Comparator.comparing(CouponCustomerRelevance::getDiscountAmount).reversed()) .sorted(Comparator.comparing(CouponCustomerRelevance::getDiscountAmount).reversed())
.forEach(couponCustomerRelevance -> { .forEach(couponCustomerRelevance -> {
//外部券能用的服务id //外部券能用的服务id
List<Integer> serveIds = couponCustomerRelevanceMapper.queryCouponCustomerServeRelevance(couponCustomerRelevance.getCouponId()); List<Integer> serveIds = couponCustomerRelevanceMapper.queryCouponCustomerServeRelevance(couponCustomerRelevance.getCouponId());
//抵扣的服务为 作用范围内支付金额最高的服务 //抵扣的服务为 作用范围内支付金额最高的服务
OrderServe orderServe = this.queryMaxPayPrice(orderManage, serveIds); OrderServe orderServe = this.queryMaxPayPrice(orderManage, serveIds);
if(orderServe!=null){
//如果有属于这个服务的辅助服务 就查出来一起折扣 //如果有属于这个服务的辅助服务 就查出来一起折扣
OrderServe supportServe = this.querySupportServe(orderManage, orderServe); OrderServe supportServe = this.querySupportServe(orderManage, orderServe);
...@@ -482,6 +492,12 @@ public class MarketServiceImpl implements MarketService { ...@@ -482,6 +492,12 @@ public class MarketServiceImpl implements MarketService {
orderManage.addDiscountPrice(actualSupportServeDiscountAmount); orderManage.addDiscountPrice(actualSupportServeDiscountAmount);
orderServe.setBindCoupon(1); orderServe.setBindCoupon(1);
} }
}
else {
couponCustomerRelevance.setOrderId(null);
couponCustomerRelevanceMapper.updateById(couponCustomerRelevance);
}
}); });
} }
//5.内部券 //5.内部券
...@@ -590,6 +606,9 @@ public class MarketServiceImpl implements MarketService { ...@@ -590,6 +606,9 @@ public class MarketServiceImpl implements MarketService {
return orderManage.getListOrderServer() return orderManage.getListOrderServer()
.stream() .stream()
.filter(orderServe -> serveIds.contains(orderServe.getServeId())) .filter(orderServe -> serveIds.contains(orderServe.getServeId()))
.filter(orderServe -> orderServe.getLeisureDiscountConfigId() == null)
.filter(orderServe -> orderServe.getProducePromotionTimeId() == null)
.filter(orderServe -> orderServe.getProduceCurrentPrice() == null)
.filter(orderServe -> orderServe.getBindCoupon() != 1) .filter(orderServe -> orderServe.getBindCoupon() != 1)
.max(Comparator.comparing(OrderServe::getPayPrice)) .max(Comparator.comparing(OrderServe::getPayPrice))
.orElseThrow(RRException::new); .orElseThrow(RRException::new);
......
package com.gogirl.domain.market.timescard; package com.gogirl.domain.market.timescard;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -44,6 +41,7 @@ public class TimesCardUsedRecord { ...@@ -44,6 +41,7 @@ public class TimesCardUsedRecord {
@ApiModelProperty("1.购卡记录;2;用卡记录") @ApiModelProperty("1.购卡记录;2;用卡记录")
private Integer type; private Integer type;
@TableField(strategy = FieldStrategy.IGNORED)
@ApiModelProperty("订单id") @ApiModelProperty("订单id")
private Integer orderId; private Integer orderId;
......
...@@ -191,6 +191,10 @@ public class OrderServe implements Serializable { ...@@ -191,6 +191,10 @@ public class OrderServe implements Serializable {
@ApiModelProperty("是否已经被卡券或者次卡折扣过 1-已经绑定了次卡或者优惠券 2-未绑定") @ApiModelProperty("是否已经被卡券或者次卡折扣过 1-已经绑定了次卡或者优惠券 2-未绑定")
private Integer bindCoupon = 2; private Integer bindCoupon = 2;
private BigDecimal promotionPrice;
private Integer producePromotionTimeId;
public void addDiscountPrice(BigDecimal discountPrice) { public void addDiscountPrice(BigDecimal discountPrice) {
this.discountPrice = this.discountPrice.add(discountPrice); this.discountPrice = this.discountPrice.add(discountPrice);
this.payPrice = this.price.subtract(discountPrice); this.payPrice = this.price.subtract(discountPrice);
......
...@@ -177,7 +177,6 @@ public class ScheduleServe implements Serializable { ...@@ -177,7 +177,6 @@ public class ScheduleServe implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private Integer actualServeDuration; private Integer actualServeDuration;
private BigDecimal promotionPrice; private BigDecimal promotionPrice;
private Integer producePromotionTimeId; private Integer producePromotionTimeId;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment