退款回退库存

This commit is contained in:
2025-12-12 16:33:40 +08:00
parent 03f7452c41
commit 97ffb4c1ef

View File

@@ -2,7 +2,6 @@ package com.czg.service.order.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.czg.account.entity.ShopUser;
@@ -164,6 +163,7 @@ public class PointsGoodPayServiceImpl implements PointsGoodPayService {
}
@Override
@Transactional
public boolean agreeRefund(PointGoodsRefundDTO param, Long shopId) {
MkPointsGoodsRecord record = goodsRecordService.getOne(QueryWrapper.create()
.eq(MkPointsGoodsRecord::getId, param.getRecordId())
@@ -183,6 +183,11 @@ public class PointsGoodPayServiceImpl implements PointsGoodPayService {
payService.unifyRefund(shopId, record.getId(), record.getPayOrderId(), refPayOrderNo,
StrUtil.isBlankIfStr(param.getReason()) ? "积分商品退款" : param.getReason(), record.getExtraPaymentAmount());
}
//回退 库存
MkPointsGoods goods = goodsService.getById(record.getPointsGoodsId());
if (goods != null) {
goodsService.upNumberById(goods.getId(), goods.getQuantity() + record.getNumber(), null);
}
MkPointsGoodsRecord upRecord = new MkPointsGoodsRecord();
upRecord.setId(record.getId());
upRecord.setStatus("已退款");