Commit 174fbcaa by 吕明尚

修改最优优惠券排序

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