Commit 9b670bda by 吕明尚

修改订单计算价格

parent 8ccbd620
......@@ -2928,12 +2928,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setBalance(totalFee);
priceResponse.setRemainingBalance(consumerWallet.getBalance().subtract(totalFee));
priceResponse.setTotalFeeNow(totalFee);
priceResponse.setMemberDiscount(totalFee);
priceResponse.setMemberDiscount(priceResponse.getTotalFee().subtract(totalFee));
// priceResponse.setDiscount(BigDecimal.ZERO);
totalFee = new BigDecimal(0);
} else if (consumerWallet.getBalance().compareTo(totalFee) < 0) {
priceResponse.setTotalFeeNow(totalFee);
priceResponse.setMemberDiscount(totalFee);
priceResponse.setMemberDiscount(priceResponse.getTotalFee().subtract(totalFee));
priceResponse.setBalance(consumerWallet.getBalance());
totalFee = totalFee.subtract(consumerWallet.getBalance());
}
......@@ -3016,14 +3016,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (match && priceResponse.getDiscount().compareTo(activity.getDiscountRatio()) == 0) {
if (consumerWallet.getBalance().compareTo(totalFee) >= 0) {
priceResponse.setTotalFeeNow(totalFee);
priceResponse.setMemberDiscount(totalFee);
priceResponse.setMemberDiscount(priceResponse.getTotalFee().subtract(totalFee));
priceResponse.setBalance(totalFee);
// priceResponse.setDiscount(BigDecimal.ZERO);
priceResponse.setRemainingBalance(consumerWallet.getBalance().subtract(totalFee));
totalFee = new BigDecimal(0);
} else if (consumerWallet.getBalance().compareTo(totalFee) < 0) {
priceResponse.setTotalFeeNow(totalFee);
priceResponse.setMemberDiscount(totalFee);
priceResponse.setMemberDiscount(priceResponse.getTotalFee().subtract(totalFee));
priceResponse.setBalance(consumerWallet.getBalance());
priceResponse.setRemainingBalance(new BigDecimal(0));
totalFee = totalFee.subtract(consumerWallet.getBalance());
......@@ -3079,6 +3079,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
private BigDecimal getBigDecimal(OrderComputedPriceRequest request, Activity activity, BigDecimal payPrice, SConsumer user, ConsumerMember consumerMember) {
if (ObjectUtil.isNotEmpty(user)) {
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
List<MemberConfig> list = memberConfigService.list();
//获取里面等级最大的
MemberConfig maxMemberConfig = list.stream().max(Comparator.comparing(MemberConfig::getMembershipLevel)).get();
if (ObjectUtil.isNotEmpty(activity)) {
CronParser cronParser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
Cron cron = cronParser.parse(activity.getCronExpression());
......@@ -3087,7 +3090,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
queryWrapper.eq(SOrder::getConsumerId, user.getId());
queryWrapper.in(SOrder::getStatus, OrderStatusEnum.getValidOrderStatus());
queryWrapper.eq(SOrder::getPayStatus, YesNoEnum.yes.getIndex());
queryWrapper.ge(SOrder::getDiscountRatio, new BigDecimal(50));
queryWrapper.lt(SOrder::getDiscountRatio, maxMemberConfig.getDiscountRatio());
// queryWrapper.ne(SOrder::getPayPrice, new BigDecimal(0));
//预约结束时间大于等于今天的年月日
queryWrapper.ge(SOrder::getPreEndDate, DateUtils.parseDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date())));
......
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