|
|
|
@ -22,6 +22,7 @@ import org.apache.commons.collections4.MapUtils; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Isolation; |
|
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
@ -57,6 +58,7 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(propagation = Propagation.NOT_SUPPORTED, isolation = Isolation.READ_UNCOMMITTED) |
|
|
|
|
public boolean refundMoney(BsOrderRefund orderRefund) { |
|
|
|
|
try { |
|
|
|
|
if (OrderPayChannelEnum.type1.getCode() == orderRefund.getRefundPayChannel()) { |
|
|
|
@ -81,7 +83,7 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService { |
|
|
|
|
} else if (OrderPayChannelEnum.type3.getCode() ==orderRefund.getRefundPayChannel()) { |
|
|
|
|
// TODO 暂无该支付方式
|
|
|
|
|
}*/ else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!未知的支付方式"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!该支付方式暂不支持退款"); |
|
|
|
|
} |
|
|
|
|
} catch (BaseException e) { |
|
|
|
|
orderRefund.setRefundStatus(OrderRefundStatusEnum.status3.getCode()); |
|
|
|
@ -125,13 +127,14 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class}) |
|
|
|
|
public BsOrderRefund tradeOrderChildRefund(String childOrderNo, Integer productCount, String remark) { |
|
|
|
|
// 查询子订单
|
|
|
|
|
OrderChildModel orderChild = orderChildService.getDetail(childOrderNo); |
|
|
|
|
if (orderChild == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的子订单"); |
|
|
|
|
} |
|
|
|
|
if (productCount > orderChild.getProductCount()) { |
|
|
|
|
if (productCount > orderChild.getSurplusRefundCount()) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!退货数量超过子订单可退数量"); |
|
|
|
|
} |
|
|
|
|
// 查询交易订单
|
|
|
|
@ -179,10 +182,10 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService { |
|
|
|
|
orderChild.setSurplusRefundCount(orderChild.getSurplusRefundCount() - productCount); |
|
|
|
|
orderChild.setSurplusRefundPrice(orderChild.getSurplusRefundPrice().subtract(orderRefund.getRefundPrice())); |
|
|
|
|
orderChild.setSurplusRefundIntegral(orderChild.getSurplusRefundIntegral() - orderRefund.getRefundIntegral()); |
|
|
|
|
orderChild.setStatus(orderChild.getProductCount()==0?OrderChildStatusEnum.status4.getCode():orderChild.getStatus()); |
|
|
|
|
orderChild.setStatus(orderChild.getSurplusRefundCount()==0?OrderChildStatusEnum.status4.getCode():orderChild.getStatus()); |
|
|
|
|
orderChildService.editData(orderChild); |
|
|
|
|
} |
|
|
|
|
return orderRefund; |
|
|
|
|
return orderRefund; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|