Commit 174fbcaa by 吕明尚

修改最优优惠券排序

parent 014d8b01
...@@ -240,9 +240,9 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -240,9 +240,9 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
} }
} }
} else { } else {
byId = null;
roomLabel = null; roomLabel = null;
if (!ObjectUtils.isEmpty(couponRequest.getPackageId())) { if (!ObjectUtils.isEmpty(couponRequest.getPackageId())) {
byId = packService.getById(couponRequest.getPackageId());
payPrice = computeTotalPrice(couponRequest.getPackageId(), totalPrice); payPrice = computeTotalPrice(couponRequest.getPackageId(), totalPrice);
couponRequest.setOrderMode(BuyTypeEnum.PACK.getCode()); couponRequest.setOrderMode(BuyTypeEnum.PACK.getCode());
} else { } else {
...@@ -258,6 +258,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -258,6 +258,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
List<SPack> sPacks = packService.list(); List<SPack> sPacks = packService.list();
//迭代 //迭代
BigDecimal finalPayPrice = payPrice; BigDecimal finalPayPrice = payPrice;
SPack finalById = byId;
sConsumerCoupons.forEach(item -> { sConsumerCoupons.forEach(item -> {
checkCoupon(item,couponRequest,sStores,sRooms,sPacks,timeLong); checkCoupon(item,couponRequest,sStores,sRooms,sPacks,timeLong);
SConsumerCouponVo vo = new SConsumerCouponVo(); SConsumerCouponVo vo = new SConsumerCouponVo();
...@@ -274,8 +275,8 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -274,8 +275,8 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
if (!ObjectUtils.isEmpty(roomLabel)) { if (!ObjectUtils.isEmpty(roomLabel)) {
vo.setBalance((roomLabel.getPromotionAmount().subtract(vo.getSalePrice())). vo.setBalance((roomLabel.getPromotionAmount().subtract(vo.getSalePrice())).
add(((DateUtils.differentHour(couponRequest.getPreStartDate(), couponRequest.getPreEndDate()).subtract(new BigDecimal(roomLabel.getPromotionDuration()))).multiply(room.getPrice()))).abs()); add(((DateUtils.differentHour(couponRequest.getPreStartDate(), couponRequest.getPreEndDate()).subtract(new BigDecimal(roomLabel.getPromotionDuration()))).multiply(room.getPrice()))).abs());
} else if (!ObjectUtils.isEmpty(byId)) { } else if (!ObjectUtils.isEmpty(finalById)) {
vo.setBalance(byId.getPrice().subtract(vo.getSalePrice())); vo.setBalance(finalById.getPrice().subtract(vo.getSalePrice()));
} }
} else { } else {
vo.setBalance(new BigDecimal("999")); vo.setBalance(new BigDecimal("999"));
......
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