|
|
@@ -1580,37 +1580,41 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
Date expiryTime = netflixRelationView.getExpiryTime();
|
|
|
//小于15
|
|
|
Long betweenDay = DateUtil.betweenDay(DateTime.now(), expiryTime, false) + 1;
|
|
|
- if (betweenDay > 15) {
|
|
|
- throw BusinessRuntimeException.getInstance("车票有效期不超过15天可退款");
|
|
|
- }
|
|
|
- List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
- OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
- .eq(OrderDon::getRelationId, relationId)
|
|
|
- .in(OrderDon::getUserId, userIdList)
|
|
|
- .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
- .orderByDesc(OrderDon::getId)
|
|
|
- .last("limit 1"));
|
|
|
- if (orderDon == null) {
|
|
|
- throw BusinessRuntimeException.getInstance("对应车票订单不存在,请联系客服");
|
|
|
- }
|
|
|
NetflixRefundInfoResp refundInfoResp = new NetflixRefundInfoResp();
|
|
|
refundInfoResp.setIsRefund(true);
|
|
|
- Long skuId = netflixRelationView.getSkuId();
|
|
|
- GoodsDonSku sku = goodsDonSkuMapper.selectById(skuId);
|
|
|
- BigDecimal orderMoney = orderDon.getMoney();
|
|
|
- if (orderMoney.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
- refundInfoResp.setIsRefund(false);
|
|
|
- }
|
|
|
- //每天单价
|
|
|
- BigDecimal dayPrice = sku.getPrice().divide(BigDecimal.valueOf(sku.getMonths() * 30), RoundingMode.DOWN);
|
|
|
- //需要退款金额
|
|
|
- BigDecimal refundMoney = dayPrice.multiply(BigDecimal.valueOf(betweenDay));
|
|
|
- if (refundMoney.compareTo(orderMoney) > 0) {
|
|
|
+ if (betweenDay > 15) {
|
|
|
refundInfoResp.setIsRefund(false);
|
|
|
}
|
|
|
if (refundInfoResp.getIsRefund()) {
|
|
|
- refundInfoResp.setPrice(refundMoney);
|
|
|
- refundInfoResp.setRemainDays(betweenDay);
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
+ OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
+ .eq(OrderDon::getRelationId, relationId)
|
|
|
+ .in(OrderDon::getUserId, userIdList)
|
|
|
+ .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
+ .orderByDesc(OrderDon::getId)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (orderDon == null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("对应车票订单不存在,请联系客服");
|
|
|
+ }
|
|
|
+ Long skuId = netflixRelationView.getSkuId();
|
|
|
+ GoodsDonSku sku = goodsDonSkuMapper.selectById(skuId);
|
|
|
+ BigDecimal orderMoney = orderDon.getMoney();
|
|
|
+ if (orderMoney.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ refundInfoResp.setIsRefund(false);
|
|
|
+ }
|
|
|
+ if (refundInfoResp.getIsRefund()) {
|
|
|
+ //每天单价
|
|
|
+ BigDecimal dayPrice = sku.getPrice().divide(BigDecimal.valueOf(sku.getMonths() * 30), RoundingMode.DOWN);
|
|
|
+ //需要退款金额
|
|
|
+ BigDecimal refundMoney = dayPrice.multiply(BigDecimal.valueOf(betweenDay));
|
|
|
+ if (refundMoney.compareTo(orderMoney) > 0) {
|
|
|
+ refundInfoResp.setIsRefund(false);
|
|
|
+ }
|
|
|
+ if (refundInfoResp.getIsRefund()) {
|
|
|
+ refundInfoResp.setPrice(refundMoney);
|
|
|
+ refundInfoResp.setRemainDays(betweenDay);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return refundInfoResp;
|
|
|
}
|