退款bugfix

This commit is contained in:
taozi
2023-04-09 22:01:11 +08:00
parent 265d2e567b
commit 0e70360afd
6 changed files with 40 additions and 25 deletions

View File

@ -62,11 +62,13 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
/**
* 确认订单退款
*
* @param orderId 单号
* @param price 金额
* @param type ShopCommonEnum
* @param price 金额
* @param type ShopCommonEnum
* @param salesId 售后id
*/
void orderRefund(String orderId, BigDecimal price, Integer type);
void orderRefund(String orderId, BigDecimal price, Integer type,Long salesId);
/**
* 订单发货

View File

@ -636,9 +636,10 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
* @param orderId 单号
* @param price 金额
* @param type ShopCommonEnum
* @param salesId 售后id
*/
@Override
public void orderRefund(String orderId, BigDecimal price, Integer type) {
public void orderRefund(String orderId, BigDecimal price, Integer type, Long salesId) {
YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId, null);
if (ObjectUtil.isNull(orderQueryVo)) {
@ -664,14 +665,18 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
if (ShopCommonEnum.AGREE_2.getValue().equals(type)) {
storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue());
yxStoreOrderMapper.updateById(storeOrder);
StoreAfterSales storeAfterSales = storeAfterSalesService.lambdaQuery()
.eq(StoreAfterSales::getUserId, orderQueryVo.getUid())
.eq(StoreAfterSales::getOrderCode, orderQueryVo.getOrderId()).one();
if (ObjectUtil.isNotNull(storeAfterSales)) {
storeAfterSalesService.lambdaUpdate()
.eq(StoreAfterSales::getId, storeAfterSales.getId())
.set(StoreAfterSales::getSalesState, ShopCommonEnum.AGREE_2.getValue())
.update();
if (null != salesId) {
StoreAfterSales storeAfterSales = storeAfterSalesService.lambdaQuery()
.eq(StoreAfterSales::getUserId, orderQueryVo.getUid())
.eq(StoreAfterSales::getOrderCode, orderQueryVo.getOrderId())
.eq(StoreAfterSales::getId, salesId)
.one();
if (ObjectUtil.isNotNull(storeAfterSales)) {
storeAfterSalesService.lambdaUpdate()
.eq(StoreAfterSales::getId, storeAfterSales.getId())
.set(StoreAfterSales::getSalesState, ShopCommonEnum.AGREE_2.getValue())
.update();
}
}
return;
}
@ -691,14 +696,19 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
NumberUtil.add(price, userQueryVo.getNowMoney()).doubleValue(),
"订单退款到余额" + price + "", orderQueryVo.getId().toString());
this.returnStock(orderQueryVo.getOrderId());
StoreAfterSales storeAfterSales = storeAfterSalesService.lambdaQuery()
.eq(StoreAfterSales::getUserId, orderQueryVo.getUid())
.eq(StoreAfterSales::getOrderCode, orderQueryVo.getOrderId()).one();
if (ObjectUtil.isNotNull(storeAfterSales)) {
storeAfterSalesService.lambdaUpdate()
.eq(StoreAfterSales::getId, storeAfterSales.getId())
.set(StoreAfterSales::getState, AfterSalesStatusEnum.STATUS_3.getValue())
.update();
if (null != salesId) {
StoreAfterSales storeAfterSales = storeAfterSalesService.lambdaQuery()
.eq(StoreAfterSales::getUserId, orderQueryVo.getUid())
.eq(StoreAfterSales::getOrderCode, orderQueryVo.getOrderId())
.eq(StoreAfterSales::getId, salesId)
.one();
if (ObjectUtil.isNotNull(storeAfterSales)) {
storeAfterSalesService.lambdaUpdate()
.eq(StoreAfterSales::getId, storeAfterSales.getId())
.set(StoreAfterSales::getState, AfterSalesStatusEnum.STATUS_3.getValue())
.update();
}
}
} else if (PayTypeEnum.INTEGRAL.getValue().equals(orderQueryVo.getPayType())) {