|
|
@@ -332,7 +332,7 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
String outNo = orderRefundService.centerRefund(refundReq, orderDon);
|
|
|
orderDon.setRefundDesc(refundReq.getRefundDesc());
|
|
|
//记录退款信息
|
|
|
- commonRefund(orderDon, refundReq.getRefundMoney(), refundReq.getOperator(), goodsDon, sku, outNo, refundType);
|
|
|
+ commonRefund(orderDon, refundReq.getRefundMoney(), refundReq.getOperator(), goodsDon, sku, outNo, refundType, refundReq.getIsOnly(), refundReq.getRefundBalance());
|
|
|
//修改订单状态
|
|
|
orderDon.setStatus(OrderDon.Status.refund);
|
|
|
orderDonMapper.updateById(orderDon);
|
|
|
@@ -695,7 +695,7 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
/**
|
|
|
* 退款后 处理关联
|
|
|
*/
|
|
|
- public void commonRefund(OrderDon orderDon, BigDecimal refundMoney,String operator, GoodsDon goodsDon, GoodsDonSku sku, String outNo, String refundType) {
|
|
|
+ public void commonRefund(OrderDon orderDon, BigDecimal refundMoney, String operator, GoodsDon goodsDon, GoodsDonSku sku, String outNo, String refundType, Boolean isOnly, BigDecimal refundBalance) {
|
|
|
TASK_POOL.execute(() -> {
|
|
|
orderRefundService.refundRecord(orderDon, refundMoney, operator, goodsDon, sku, outNo, refundType);
|
|
|
//退款一次
|
|
|
@@ -710,10 +710,18 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
if (orderDon.getCouponUserId() != 0) {
|
|
|
couponFontService.updateOrderDonCouponStatus(orderDon);
|
|
|
}
|
|
|
+ //退等比例
|
|
|
+ if (isOnly != null && isOnly) {
|
|
|
+ userBenefitsService.addUserBalance(orderDon.getUserId(), refundBalance, UserBalanceSourceRecord.Source.refund, orderDon.getYhsId(), orderDon.getId(), goodsDon.getTitle() + UserBalanceSourceRecord.Source.refund.getDesc(), true);
|
|
|
+ BigDecimal orderDonRefundBalance = Optional.ofNullable(orderDon.getRefundBalance()).orElse(BigDecimal.ZERO);
|
|
|
+ orderDon.setRefundBalance(orderDonRefundBalance.add(refundBalance));
|
|
|
+ }
|
|
|
+
|
|
|
//若存在余额支付,退还余额
|
|
|
- if (orderDon.getBalance().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ if (isOnly == null && orderDon.getBalance().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
userBenefitsService.addUserBalance(orderDon.getUserId(), orderDon.getBalance(), UserBalanceSourceRecord.Source.refund, orderDon.getYhsId(), orderDon.getId(), goodsDon.getTitle() + UserBalanceSourceRecord.Source.refund.getDesc(), true);
|
|
|
}
|
|
|
+
|
|
|
try {
|
|
|
marketFrontService.subSpecificChanceNum(orderDon.getUserId(), orderDon.getId(), orderDon.getGoodsId(), orderDon.getUpdateTime());
|
|
|
if (goodsDon.getType() == 2) {
|
|
|
@@ -725,7 +733,7 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
log.error("wx减少抽奖机会错误,orderId:{},error:{}", orderDon.getId(), e);
|
|
|
}
|
|
|
if (OrderDon.Type.BALANCE.getType().equals(refundType)) {
|
|
|
- if (orderDon.getMoney().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ if (isOnly == null && orderDon.getMoney().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
userBenefitsService.addUserBalance(orderDon.getUserId(), orderDon.getRefundBalance(), UserBalanceSourceRecord.Source.refund, orderDon.getYhsId(), orderDon.getId(), goodsDon.getTitle() + UserBalanceSourceRecord.Source.refund.getDesc(), true);
|
|
|
}
|
|
|
} else {
|
|
|
@@ -783,7 +791,7 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
List<OrderDon> relate_orderDons = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
.in(OrderDon::getId, plusOrderIdList)
|
|
|
.notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
- relate_orderDons.forEach(relate_o->{
|
|
|
+ relate_orderDons.forEach(relate_o -> {
|
|
|
//扣除用户自身实物权益
|
|
|
userRealOrderBenefitsService.deductUserRealGoodsBenefits(relate_o.getId());
|
|
|
});
|
|
|
@@ -803,10 +811,10 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
.in(GroupsRelationExpiryRecord::getReBuyOrderId, orderDon.getId())
|
|
|
.eq(GroupsRelationExpiryRecord::getRelationId, orderDon.getRelationId()).last("limit 1"));
|
|
|
if (groupsRelationExpiryRecord == null) {
|
|
|
- log.info("订单orderId:{}退款,同步是否有重购记录不是直接续费车票",orderDon.getId());
|
|
|
+ log.info("订单orderId:{}退款,同步是否有重购记录不是直接续费车票", orderDon.getId());
|
|
|
List<GroupsRelationExpiryRecord> groupsRelationExpiryRecords = groupsRelationExpiryRecordService.list(Wrappers.lambdaQuery(GroupsRelationExpiryRecord.class)
|
|
|
.in(GroupsRelationExpiryRecord::getReBuyOrderId, orderDon.getId()));
|
|
|
- log.info("订单orderId:{}退款,重购记录不是直接续费车票大小:{}",groupsRelationExpiryRecords.size());
|
|
|
+ log.info("订单orderId:{}退款,重购记录不是直接续费车票大小:{}", groupsRelationExpiryRecords.size());
|
|
|
if (CollUtil.isNotEmpty(groupsRelationExpiryRecords)) {
|
|
|
groupsRelationExpiryRecords.forEach(data -> {
|
|
|
data.setIsReBuy(false);
|