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