|
|
@@ -160,12 +160,16 @@ public class VipFrontServiceImpl implements VipFrontService {
|
|
|
if (chatgptUser != null) {
|
|
|
//获取抵扣金额
|
|
|
deductMoney = deductMoney.add(getFinalDeductMoney(relationId, relation.getSkuId(), chatgptUser.getRenewSkuId(), chatgptUser.getRenewOrderId(), chatgptUser.getRenewExpiryTime(), relation.getStartTime(), relationExpiryTime, now, userIdList));
|
|
|
+ } else {
|
|
|
+ throw BusinessRuntimeException.getInstance("请先前往车票页");
|
|
|
}
|
|
|
} else if (goodsId == Constant.CLAUDE_PRO_GID) {
|
|
|
ClaudeUser claudeUser = claudeUserMapper.selectOne(Wrappers.lambdaQuery(ClaudeUser.class).eq(ClaudeUser::getRelationId, relationId).last("limit 1"));
|
|
|
if (claudeUser != null) {
|
|
|
//获取抵扣金额
|
|
|
deductMoney = deductMoney.add(getFinalDeductMoney(relationId, relation.getSkuId(), claudeUser.getRenewSkuId(), claudeUser.getRenewOrderId(), claudeUser.getRenewExpiryTime(), relation.getStartTime(), relationExpiryTime, now, userIdList));
|
|
|
+ } else {
|
|
|
+ throw BusinessRuntimeException.getInstance("请先前往车票页");
|
|
|
}
|
|
|
} else {
|
|
|
//该车票抵扣金额
|
|
|
@@ -295,13 +299,22 @@ public class VipFrontServiceImpl implements VipFrontService {
|
|
|
.eq(OrderDon::getSkuId, skuId)
|
|
|
.notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
.orderByDesc(OrderDon::getId));
|
|
|
+ //部分退款
|
|
|
+ if (orderDonList.isEmpty()) {
|
|
|
+ orderDonList = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
+ .eq(OrderDon::getRelationId, relationId)
|
|
|
+ .in(OrderDon::getUserId, userIdList)
|
|
|
+ .eq(OrderDon::getSkuId, skuId)
|
|
|
+ .notIn(OrderDon::getStatus, Constant.noOrderStatus)
|
|
|
+ .orderByDesc(OrderDon::getId));
|
|
|
+ }
|
|
|
//原车票订单总实付金额
|
|
|
BigDecimal totalOrderMoney = BigDecimal.ZERO;
|
|
|
//原车票订单总天数
|
|
|
Integer totalDays = 0;
|
|
|
for (OrderDon orderDon : orderDonList) {
|
|
|
GoodsDonSku sku = skuMapper.selectById(skuId);
|
|
|
- BigDecimal thisOrderMoney = orderDon.getMoney().add(Optional.ofNullable(orderDon.getBalance()).orElse(BigDecimal.ZERO));
|
|
|
+ BigDecimal thisOrderMoney = orderDon.getMoney().add(Optional.ofNullable(orderDon.getBalance()).orElse(BigDecimal.ZERO)).subtract(Optional.ofNullable(orderDon.getRefundMoney()).orElse(BigDecimal.ZERO));
|
|
|
if (thisOrderMoney.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
thisOrderMoney = sku.getPrice();
|
|
|
}
|