Commit e4be7e12 by huluobin

Merge branch 'master' into 3.5

parents 8dd18820 d9ceb47c
...@@ -305,7 +305,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -305,7 +305,7 @@ public class MarketServiceImpl implements MarketService {
orderServe.setBindOuterCoupon(2); orderServe.setBindOuterCoupon(2);
}); });
//1.改价结算 //1改价结算
//总支付金额等于 总价格+总改价 //总支付金额等于 总价格+总改价
orderManage.setTotalPaymentAmount(orderManage.getTotalPrice().add(orderManage.getChangePrice())); orderManage.setTotalPaymentAmount(orderManage.getTotalPrice().add(orderManage.getChangePrice()));
//总折扣金额 //总折扣金额
...@@ -325,7 +325,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -325,7 +325,7 @@ public class MarketServiceImpl implements MarketService {
} }
}); });
//3.次卡 //2、次卡
if (ListUtil.isNotEmpty(timesCardUsedRecordList)) { if (ListUtil.isNotEmpty(timesCardUsedRecordList)) {
//次卡使用记录 //次卡使用记录
timesCardUsedRecordList.forEach(timesCardUsedRecord -> timesCardUsedRecord.setStatus(TimesCardUsedRecord.STATUS_CHOSE)); timesCardUsedRecordList.forEach(timesCardUsedRecord -> timesCardUsedRecord.setStatus(TimesCardUsedRecord.STATUS_CHOSE));
...@@ -396,7 +396,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -396,7 +396,7 @@ public class MarketServiceImpl implements MarketService {
couponOrderRelevanceService.remove(new LambdaQueryWrapper<CouponOrderRelevance>() couponOrderRelevanceService.remove(new LambdaQueryWrapper<CouponOrderRelevance>()
.eq(CouponOrderRelevance::getOrderId, orderId)); .eq(CouponOrderRelevance::getOrderId, orderId));
//4。外部券 //3、外部券
if (ListUtil.isNotEmpty(outerCouponCustomerRelevanceServiceList)) { if (ListUtil.isNotEmpty(outerCouponCustomerRelevanceServiceList)) {
//删除之前的外部券抵扣情况记录 //删除之前的外部券抵扣情况记录
...@@ -418,10 +418,11 @@ public class MarketServiceImpl implements MarketService { ...@@ -418,10 +418,11 @@ public class MarketServiceImpl implements MarketService {
OrderServe orderServe = this.queryMaxPayPrice(orderManage, serveIds); OrderServe orderServe = this.queryMaxPayPrice(orderManage, serveIds);
if (orderServe != null) { if (orderServe != null) {
//如果有属于这个服务的辅助服务 就查出来一起折扣 BigDecimal discountAmount = couponCustomerRelevance.getDiscountAmount();
OrderServe supportServe = this.querySupportServe(orderManage, orderServe); // if (couponCustomerRelevance.getType() == 5) {
// discountAmount = orderServe.getPrice().multiply(BigDecimal.ONE.subtract(couponCustomerRelevance.getDiscountPercent()));
BigDecimal actualDiscountAmount = orderServe.getPayPrice().min(couponCustomerRelevance.getDiscountAmount()); // }
BigDecimal actualDiscountAmount = orderServe.getPayPrice().min(discountAmount);
//新增外部券抵扣情况记录 //新增外部券抵扣情况记录
CouponOrderRelevance couponOrderRelevance = CouponOrderRelevance.builder() CouponOrderRelevance couponOrderRelevance = CouponOrderRelevance.builder()
...@@ -462,7 +463,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -462,7 +463,7 @@ public class MarketServiceImpl implements MarketService {
}); });
} }
//5.内部券 //4、内部券
if (ListUtil.isNotEmpty(innerCouponCustomerRelevanceServiceList)) { if (ListUtil.isNotEmpty(innerCouponCustomerRelevanceServiceList)) {
//删除之前的内部券抵扣情况记录 //删除之前的内部券抵扣情况记录
...@@ -484,12 +485,14 @@ public class MarketServiceImpl implements MarketService { ...@@ -484,12 +485,14 @@ public class MarketServiceImpl implements MarketService {
if (!total.setScale(2, BigDecimal.ROUND_HALF_UP).equals(BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP))) { if (!total.setScale(2, BigDecimal.ROUND_HALF_UP).equals(BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP))) {
//卡券的总折扣金额 //卡券的总折扣金额
BigDecimal totalCouponDiscount = couponCustomerRelevance.getDiscountAmount(); BigDecimal totalCouponDiscount = couponCustomerRelevance.getDiscountAmount();
// if (couponCustomerRelevance.getType() == 5) {
// totalCouponDiscount = canUserOrderServeList.stream().map(OrderServe::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add)
// .multiply(BigDecimal.ONE.subtract(couponCustomerRelevance.getDiscountPercent()));
// }
//卡券总支付金额 //卡券总支付金额
BigDecimal totalCouponPay = couponCustomerRelevance.getPayAmount(); BigDecimal totalCouponPay = couponCustomerRelevance.getPayAmount();
//计算参数(最后一个订单服务的折扣金额要用总折扣金额减 防止除法计算精度问题) //计算参数(最后一个订单服务的折扣金额要用总折扣金额减 防止除法计算精度问题)
BigDecimal discountCalc = BigDecimal.ZERO; BigDecimal discountCalc = BigDecimal.ZERO;
//计算参数(最后一个订单服务的实际支付要用总实际支付金额减 防止除法计算精度问题) //计算参数(最后一个订单服务的实际支付要用总实际支付金额减 防止除法计算精度问题)
BigDecimal payCalc = BigDecimal.ZERO; BigDecimal payCalc = BigDecimal.ZERO;
...@@ -499,15 +502,13 @@ public class MarketServiceImpl implements MarketService { ...@@ -499,15 +502,13 @@ public class MarketServiceImpl implements MarketService {
BigDecimal discountAmount = orderServe.getPayPrice().multiply(totalCouponDiscount).divide(total, 2, BigDecimal.ROUND_HALF_UP); BigDecimal discountAmount = orderServe.getPayPrice().multiply(totalCouponDiscount).divide(total, 2, BigDecimal.ROUND_HALF_UP);
//每个服务的卡券实际支付金额 //每个服务的卡券实际支付金额
BigDecimal payAmount = orderServe.getPayPrice().multiply(totalCouponPay).divide(total, 2, BigDecimal.ROUND_HALF_UP); BigDecimal payAmount = orderServe.getPayPrice().multiply(totalCouponPay).divide(total, 2, BigDecimal.ROUND_HALF_UP);
//最后一个服务使用总额减法而不是除法 //最后一个服务使用总额减法而不是除法
if (canUserOrderServeList.lastIndexOf(orderServe) == canUserOrderServeList.size() - 1) { if (canUserOrderServeList.lastIndexOf(orderServe) == canUserOrderServeList.size() - 1) {
discountAmount = totalCouponDiscount.subtract(discountCalc); discountAmount = totalCouponDiscount.subtract(discountCalc);
payAmount = totalCouponPay.subtract(payCalc); payAmount = totalCouponPay.subtract(payCalc);
} }
BigDecimal actualDiscountAmount = discountAmount.min(orderServe.getPayPrice());
BigDecimal actualDiscountAmount = discountAmount.min(orderServe.getPayPrice());
//卡券在订单服务上的抵扣情况 //卡券在订单服务上的抵扣情况
CouponOrderRelevance couponOrderRelevance = CouponOrderRelevance.builder() CouponOrderRelevance couponOrderRelevance = CouponOrderRelevance.builder()
.discountAmount(actualDiscountAmount) .discountAmount(actualDiscountAmount)
......
...@@ -23,9 +23,11 @@ public class StoreClassesServiceImpl extends ServiceImpl<StoreClassesMapper, Sto ...@@ -23,9 +23,11 @@ public class StoreClassesServiceImpl extends ServiceImpl<StoreClassesMapper, Sto
@Override @Override
public List<StoreClassesTechnician> queryMonthClasses(Integer technicianId, Integer departmentId, String month) { public List<StoreClassesTechnician> queryMonthClasses(Integer technicianId, Integer departmentId, String month) {
List<StoreClasses> classList = this.list(new LambdaQueryWrapper<StoreClasses>().eq(StoreClasses::getDepartmentId, departmentId)); List<StoreClasses> classList = this.list(new LambdaQueryWrapper<StoreClasses>()
.eq(StoreClasses::getDepartmentId, departmentId));
Map<Integer, Integer> map = new HashMap<Integer, Integer>();//处理一个对应关系只返回012 //处理一个对应关系只返回012
Map<Integer, Integer> map = new HashMap<>();
map.put(0, 0); map.put(0, 0);
for (int i = 0; i < classList.size(); i++) { for (int i = 0; i < classList.size(); i++) {
StoreClasses item = classList.get(i); StoreClasses item = classList.get(i);
......
...@@ -83,7 +83,7 @@ public class CouponCustomerRelevance implements Serializable { ...@@ -83,7 +83,7 @@ public class CouponCustomerRelevance implements Serializable {
@ApiModelProperty("优惠折扣") @ApiModelProperty("优惠折扣")
private BigDecimal discountPercent; private BigDecimal discountPercent;
@ApiModelProperty("优惠券类型:1.现金抵扣券;2.免单券;3满减券;4卸甲券") @ApiModelProperty("优惠券类型:1.现金抵扣券;2.免单券;3满减券;4卸甲券 5折扣券")
private Integer type; private Integer type;
@ApiModelProperty("0 = 内部券 1 = 外部券") @ApiModelProperty("0 = 内部券 1 = 外部券")
......
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