退款bugfix
This commit is contained in:
@ -164,7 +164,7 @@ public class ShoperController {
|
|||||||
@PostMapping("/admin/order/refund")
|
@PostMapping("/admin/order/refund")
|
||||||
@ApiOperation(value = "订单退款",notes = "订单退款")
|
@ApiOperation(value = "订单退款",notes = "订单退款")
|
||||||
public ApiResult<Boolean> orderRefund(@Validated @RequestBody OrderRefundParam param){
|
public ApiResult<Boolean> orderRefund(@Validated @RequestBody OrderRefundParam param){
|
||||||
storeOrderService.orderRefund(param.getOrderId(),new BigDecimal(param.getPrice()),param.getType());
|
storeOrderService.orderRefund(param.getOrderId(),new BigDecimal(param.getPrice()),param.getType(), null);
|
||||||
return ApiResult.ok();
|
return ApiResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,11 +62,13 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 确认订单退款
|
* 确认订单退款
|
||||||
|
*
|
||||||
* @param orderId 单号
|
* @param orderId 单号
|
||||||
* @param price 金额
|
* @param price 金额
|
||||||
* @param type ShopCommonEnum
|
* @param type ShopCommonEnum
|
||||||
|
* @param salesId 售后id
|
||||||
*/
|
*/
|
||||||
void orderRefund(String orderId, BigDecimal price, Integer type);
|
void orderRefund(String orderId, BigDecimal price, Integer type,Long salesId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单发货
|
* 订单发货
|
||||||
|
@ -636,9 +636,10 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
* @param orderId 单号
|
* @param orderId 单号
|
||||||
* @param price 金额
|
* @param price 金额
|
||||||
* @param type ShopCommonEnum
|
* @param type ShopCommonEnum
|
||||||
|
* @param salesId 售后id
|
||||||
*/
|
*/
|
||||||
@Override
|
@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);
|
YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId, null);
|
||||||
if (ObjectUtil.isNull(orderQueryVo)) {
|
if (ObjectUtil.isNull(orderQueryVo)) {
|
||||||
@ -664,14 +665,18 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
if (ShopCommonEnum.AGREE_2.getValue().equals(type)) {
|
if (ShopCommonEnum.AGREE_2.getValue().equals(type)) {
|
||||||
storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue());
|
storeOrder.setRefundStatus(OrderInfoEnum.REFUND_STATUS_0.getValue());
|
||||||
yxStoreOrderMapper.updateById(storeOrder);
|
yxStoreOrderMapper.updateById(storeOrder);
|
||||||
StoreAfterSales storeAfterSales = storeAfterSalesService.lambdaQuery()
|
if (null != salesId) {
|
||||||
.eq(StoreAfterSales::getUserId, orderQueryVo.getUid())
|
StoreAfterSales storeAfterSales = storeAfterSalesService.lambdaQuery()
|
||||||
.eq(StoreAfterSales::getOrderCode, orderQueryVo.getOrderId()).one();
|
.eq(StoreAfterSales::getUserId, orderQueryVo.getUid())
|
||||||
if (ObjectUtil.isNotNull(storeAfterSales)) {
|
.eq(StoreAfterSales::getOrderCode, orderQueryVo.getOrderId())
|
||||||
storeAfterSalesService.lambdaUpdate()
|
.eq(StoreAfterSales::getId, salesId)
|
||||||
.eq(StoreAfterSales::getId, storeAfterSales.getId())
|
.one();
|
||||||
.set(StoreAfterSales::getSalesState, ShopCommonEnum.AGREE_2.getValue())
|
if (ObjectUtil.isNotNull(storeAfterSales)) {
|
||||||
.update();
|
storeAfterSalesService.lambdaUpdate()
|
||||||
|
.eq(StoreAfterSales::getId, storeAfterSales.getId())
|
||||||
|
.set(StoreAfterSales::getSalesState, ShopCommonEnum.AGREE_2.getValue())
|
||||||
|
.update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -691,14 +696,19 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
NumberUtil.add(price, userQueryVo.getNowMoney()).doubleValue(),
|
NumberUtil.add(price, userQueryVo.getNowMoney()).doubleValue(),
|
||||||
"订单退款到余额" + price + "元", orderQueryVo.getId().toString());
|
"订单退款到余额" + price + "元", orderQueryVo.getId().toString());
|
||||||
this.returnStock(orderQueryVo.getOrderId());
|
this.returnStock(orderQueryVo.getOrderId());
|
||||||
StoreAfterSales storeAfterSales = storeAfterSalesService.lambdaQuery()
|
|
||||||
.eq(StoreAfterSales::getUserId, orderQueryVo.getUid())
|
if (null != salesId) {
|
||||||
.eq(StoreAfterSales::getOrderCode, orderQueryVo.getOrderId()).one();
|
StoreAfterSales storeAfterSales = storeAfterSalesService.lambdaQuery()
|
||||||
if (ObjectUtil.isNotNull(storeAfterSales)) {
|
.eq(StoreAfterSales::getUserId, orderQueryVo.getUid())
|
||||||
storeAfterSalesService.lambdaUpdate()
|
.eq(StoreAfterSales::getOrderCode, orderQueryVo.getOrderId())
|
||||||
.eq(StoreAfterSales::getId, storeAfterSales.getId())
|
.eq(StoreAfterSales::getId, salesId)
|
||||||
.set(StoreAfterSales::getState, AfterSalesStatusEnum.STATUS_3.getValue())
|
.one();
|
||||||
.update();
|
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())) {
|
} else if (PayTypeEnum.INTEGRAL.getValue().equals(orderQueryVo.getPayType())) {
|
||||||
|
@ -258,7 +258,7 @@ public class StoreOrderController {
|
|||||||
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
public ResponseEntity refund(@Validated @RequestBody YxStoreOrder resources) {
|
public ResponseEntity refund(@Validated @RequestBody YxStoreOrder resources) {
|
||||||
yxStoreOrderService.orderRefund(resources.getOrderId(),resources.getPayPrice(),
|
yxStoreOrderService.orderRefund(resources.getOrderId(),resources.getPayPrice(),
|
||||||
ShopCommonEnum.AGREE_1.getValue());
|
ShopCommonEnum.AGREE_1.getValue(), null);
|
||||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public class StoreAfterSalesController {
|
|||||||
// 回滚库存、退积分、退优惠券
|
// 回滚库存、退积分、退优惠券
|
||||||
storeOrderService.returnStock(salesCheckDto.getOrderCode());
|
storeOrderService.returnStock(salesCheckDto.getOrderCode());
|
||||||
} else {
|
} else {
|
||||||
storeOrderService.orderRefund(salesCheckDto.getOrderCode(), storeAfterSales.getRefundAmount(), 1);
|
storeOrderService.orderRefund(salesCheckDto.getOrderCode(), storeAfterSales.getRefundAmount(), 1, storeAfterSales.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(salesCheck, HttpStatus.OK);
|
return new ResponseEntity<>(salesCheck, HttpStatus.OK);
|
||||||
@ -117,7 +117,7 @@ public class StoreAfterSalesController {
|
|||||||
// 回滚库存、退积分、退优惠券
|
// 回滚库存、退积分、退优惠券
|
||||||
storeOrderService.returnStock(sales.getOrderCode());
|
storeOrderService.returnStock(sales.getOrderCode());
|
||||||
} else {
|
} else {
|
||||||
storeOrderService.orderRefund(orderCode, sales.getRefundAmount(), 1);
|
storeOrderService.orderRefund(orderCode, sales.getRefundAmount(), 1, salesId);
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,10 @@ public class WeixinPayService {
|
|||||||
if(orderInfo.getExtendOrderId()!=null){
|
if(orderInfo.getExtendOrderId()!=null){
|
||||||
orderId=orderInfo.getExtendOrderId();
|
orderId=orderInfo.getExtendOrderId();
|
||||||
}
|
}
|
||||||
WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.toType(orderInfo.getPayType()));
|
WxPayService wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WECHAT);
|
||||||
|
if (StrUtil.isEmpty(wxPayService.getConfig().getAppId())) {
|
||||||
|
wxPayService = WxPayConfiguration.getPayService(PayMethodEnum.WXAPP);
|
||||||
|
}
|
||||||
WxPayRefundRequest wxPayRefundRequest = new WxPayRefundRequest();
|
WxPayRefundRequest wxPayRefundRequest = new WxPayRefundRequest();
|
||||||
BigDecimal bigDecimal = new BigDecimal("100");
|
BigDecimal bigDecimal = new BigDecimal("100");
|
||||||
int totalFee = bigDecimal.multiply(orderInfo.getPayPrice()).intValue();
|
int totalFee = bigDecimal.multiply(orderInfo.getPayPrice()).intValue();
|
||||||
|
Reference in New Issue
Block a user