fix: 退款修改
This commit is contained in:
@@ -1283,6 +1283,8 @@ public class PayService {
|
||||
BigDecimal saleAmount = BigDecimal.ZERO;
|
||||
ArrayList<TbOrderDetail> remainOrderDetailList = new ArrayList<>();
|
||||
boolean hasNormalReturn = false;
|
||||
|
||||
ArrayList<TbOrderDetail> copyDetailList = new ArrayList<>();
|
||||
for (TbOrderDetail orderDetail : detailList) {
|
||||
// 原始金额
|
||||
BigDecimal originalAmount = orderDetail.getPriceAmount();
|
||||
@@ -1374,6 +1376,11 @@ public class PayService {
|
||||
orderDetail.setReturnAmount(returnAmount);
|
||||
// orderDetail.setStatus(isOnline ? "refunding" : "refund");
|
||||
orderDetail.setStatus("refund");
|
||||
|
||||
TbOrderDetail returnOrderDetailCopy = new TbOrderDetail();
|
||||
cn.hutool.core.bean.BeanUtil.copyProperties(orderDetail, returnOrderDetailCopy);
|
||||
returnOrderDetailCopy.setId(null);
|
||||
copyDetailList.add(returnOrderDetailCopy);
|
||||
}
|
||||
|
||||
if (returnAmount.compareTo(BigDecimal.ZERO) < 0) {
|
||||
@@ -1411,6 +1418,9 @@ public class PayService {
|
||||
returnOrder.setSettlementAmount(returnAmount);
|
||||
returnOrder.setPayAmount(returnAmount);
|
||||
mPOrderInfoMapper.insert(returnOrder);
|
||||
// 保存新的退款detail信息
|
||||
copyDetailList.forEach(item -> item.setOrderId(returnOrder.getId()));
|
||||
mpOrderDetailService.saveBatch(copyDetailList);
|
||||
|
||||
updateStockAndRecord(detailList);
|
||||
mpOrderDetailService.updateBatchById(detailList);
|
||||
|
||||
@@ -115,7 +115,6 @@
|
||||
<if test="orderNo != null and orderNo != ''">
|
||||
and toi.order_no = #{orderNo}
|
||||
</if>
|
||||
and toi.source is null
|
||||
group by toi.id,toi.shop_id
|
||||
order by toi.id desc
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user