Commit 0a835a71 by huluobin

update

parent 9a97a874
...@@ -1080,72 +1080,6 @@ public class MarketServiceImpl implements MarketService { ...@@ -1080,72 +1080,6 @@ public class MarketServiceImpl implements MarketService {
} }
}); });
//2、次卡
if (ListUtil.isNotEmpty(timesCardUsedRecordList)) {
//次卡使用记录
timesCardUsedRecordList.forEach(timesCardUsedRecord -> timesCardUsedRecord.setStatus(TimesCardUsedRecord.STATUS_CHOSE));
timesCardUsedRecordList.stream()
.sorted(Comparator.comparing(TimesCardUsedRecord::getDiscountAmount))
.forEach(timesCardUsedRecord -> {
timesCardOrderServeDetailMapper.delete(new LambdaQueryWrapper<TimesCardOrderServeDetail>().eq(TimesCardOrderServeDetail::getOrderId, orderId));
//次卡能用的服务id
List<Integer> serveIds = timesCardCustomerRelevanceMapper.queryTimesCardServeIds(timesCardUsedRecord.getCardTypeId());
//抵扣的服务为 作用范围内支付金额最高的服务
OrderServe orderServe = this.queryMaxPayPrice(orderManage, serveIds);
if (orderServe != null) {
BigDecimal actualDiscountAmount = orderServe.getPayPrice().min(timesCardUsedRecord.getDiscountAmount());
//更新次卡记录 已使用
timesCardUsedRecord.setStatus(TimesCardUsedRecord.STATUS_USED);
//次卡对应订单服务的美甲师
timesCardUsedRecord.setTechnicianName(orderServe.getTechnicianName());
//次卡店铺名称
timesCardUsedRecord.setDepartmentName(orderManage.getDepartmentName());
//次卡店铺id
timesCardUsedRecord.setDepartmentId(orderManage.getDepartmentId());
//次卡折扣的
timesCardUsedRecord.setServeName(orderServe.getServeName());
//次卡作用的服务id
timesCardUsedRecord.setOrderServeId(orderServe.getServeId());
timesCardUsedRecord.setOrderId(orderId);
timesCardUsedRecord.setActualDiscountAmount(actualDiscountAmount);
timesCardUsedRecordService.updateById(timesCardUsedRecord);
//在主服务上折扣的钱
TimesCardOrderServeDetail timesCardOrderServeDetail = new TimesCardOrderServeDetail();
timesCardOrderServeDetail.setDiscountAmount(actualDiscountAmount);
timesCardOrderServeDetail.setOrderServeId(orderServe.getId());
timesCardOrderServeDetail.setOrderId(orderId);
timesCardOrderServeDetail.setTimesCardUserRecordId(timesCardUsedRecord.getOrderServeId());
//业绩
timesCardOrderServeDetail.setAchievement(timesCardUsedRecord.getPayAmount());
timesCardOrderServeDetailMapper.insert(timesCardOrderServeDetail);
//订单折扣金额更新
orderServe.setBindTimesCard(1);
orderServe.addDiscountPrice(actualDiscountAmount);
//业绩
orderServe.setAchievement(orderServe.getAchievement().subtract(actualDiscountAmount).add(timesCardUsedRecord.getPayAmount()));
orderManage.addDiscountPrice(actualDiscountAmount);
// //更新使用次数
// TimesCardCustomerRelevance timesCardCustomerRelevance = timesCardCustomerRelevanceService.getById(timesCardUsedRecord.getCardRelevanceCustomerId());
// timesCardCustomerRelevance.setUsedTimes(timesCardCustomerRelevance.getUsedTimes() + 1);
// if (timesCardCustomerRelevance.getUsedTimes().equals(timesCardCustomerRelevance.getSumTimes())) {
// //次数用完
// timesCardCustomerRelevance.setStatus(2);
// }
// timesCardCustomerRelevanceService.updateById(timesCardCustomerRelevance);
} else {
throw new RRException("次卡冲突");
}
});
}
//卡券之前删除订单服务和卡券关联 //卡券之前删除订单服务和卡券关联
couponOrderRelevanceService.remove(new LambdaQueryWrapper<CouponOrderRelevance>() couponOrderRelevanceService.remove(new LambdaQueryWrapper<CouponOrderRelevance>()
...@@ -1317,6 +1251,74 @@ public class MarketServiceImpl implements MarketService { ...@@ -1317,6 +1251,74 @@ public class MarketServiceImpl implements MarketService {
.collect(Collectors.toList()); .collect(Collectors.toList());
freeInnerCouponCustomerRelevanceServiceList.forEach(couponCustomerRelevanceConsumer); freeInnerCouponCustomerRelevanceServiceList.forEach(couponCustomerRelevanceConsumer);
//2、次卡
if (ListUtil.isNotEmpty(timesCardUsedRecordList)) {
//次卡使用记录
timesCardUsedRecordList.forEach(timesCardUsedRecord -> timesCardUsedRecord.setStatus(TimesCardUsedRecord.STATUS_CHOSE));
timesCardUsedRecordList.stream()
.sorted(Comparator.comparing(TimesCardUsedRecord::getDiscountAmount))
.forEach(timesCardUsedRecord -> {
timesCardOrderServeDetailMapper.delete(new LambdaQueryWrapper<TimesCardOrderServeDetail>().eq(TimesCardOrderServeDetail::getOrderId, orderId));
//次卡能用的服务id
List<Integer> serveIds = timesCardCustomerRelevanceMapper.queryTimesCardServeIds(timesCardUsedRecord.getCardTypeId());
//抵扣的服务为 作用范围内支付金额最高的服务
OrderServe orderServe = this.queryMaxPayPrice(orderManage, serveIds);
if (orderServe != null) {
BigDecimal actualDiscountAmount = orderServe.getPayPrice().min(timesCardUsedRecord.getDiscountAmount());
//更新次卡记录 已使用
timesCardUsedRecord.setStatus(TimesCardUsedRecord.STATUS_USED);
//次卡对应订单服务的美甲师
timesCardUsedRecord.setTechnicianName(orderServe.getTechnicianName());
//次卡店铺名称
timesCardUsedRecord.setDepartmentName(orderManage.getDepartmentName());
//次卡店铺id
timesCardUsedRecord.setDepartmentId(orderManage.getDepartmentId());
//次卡折扣的
timesCardUsedRecord.setServeName(orderServe.getServeName());
//次卡作用的服务id
timesCardUsedRecord.setOrderServeId(orderServe.getServeId());
timesCardUsedRecord.setOrderId(orderId);
timesCardUsedRecord.setActualDiscountAmount(actualDiscountAmount);
timesCardUsedRecordService.updateById(timesCardUsedRecord);
//在主服务上折扣的钱
TimesCardOrderServeDetail timesCardOrderServeDetail = new TimesCardOrderServeDetail();
timesCardOrderServeDetail.setDiscountAmount(actualDiscountAmount);
timesCardOrderServeDetail.setOrderServeId(orderServe.getId());
timesCardOrderServeDetail.setOrderId(orderId);
timesCardOrderServeDetail.setTimesCardUserRecordId(timesCardUsedRecord.getOrderServeId());
//业绩
timesCardOrderServeDetail.setAchievement(timesCardUsedRecord.getPayAmount());
timesCardOrderServeDetailMapper.insert(timesCardOrderServeDetail);
//订单折扣金额更新
orderServe.setBindTimesCard(1);
orderServe.addDiscountPrice(actualDiscountAmount);
//业绩
orderServe.setAchievement(orderServe.getAchievement().subtract(actualDiscountAmount).add(timesCardUsedRecord.getPayAmount()));
orderManage.addDiscountPrice(actualDiscountAmount);
// //更新使用次数
// TimesCardCustomerRelevance timesCardCustomerRelevance = timesCardCustomerRelevanceService.getById(timesCardUsedRecord.getCardRelevanceCustomerId());
// timesCardCustomerRelevance.setUsedTimes(timesCardCustomerRelevance.getUsedTimes() + 1);
// if (timesCardCustomerRelevance.getUsedTimes().equals(timesCardCustomerRelevance.getSumTimes())) {
// //次数用完
// timesCardCustomerRelevance.setStatus(2);
// }
// timesCardCustomerRelevanceService.updateById(timesCardCustomerRelevance);
} else {
throw new RRException("次卡冲突");
}
});
}
//6、普通内部券 //6、普通内部券
List<CouponCustomerRelevance> normalInnerCouponCustomerRelevanceServiceList = innerCouponCustomerRelevanceServiceList List<CouponCustomerRelevance> normalInnerCouponCustomerRelevanceServiceList = innerCouponCustomerRelevanceServiceList
.stream() .stream()
......
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