pull/1121/head
梁宇奇 2025-09-04 19:33:25 +08:00
parent dbfaec2830
commit 6954b4d34b
9 changed files with 34 additions and 25 deletions

View File

@ -84,7 +84,7 @@ public class StoreOrderController extends XktBaseController {
dto.setOrderUserId(SecurityUtils.getUserId());
//创建订单并根据参数决定是否发起支付
StoreOrderAddResult result = storeOrderService.createOrder(dto, vo.getBeginPay(),
EPayChannel.of(vo.getPayChannel()), EPayPage.of(vo.getPayPage()));
EPayChannel.of(vo.getPayChannel()), EPayPage.of(vo.getPayPage()), vo.getReturnUrl());
//返回信息
StoreOrderPayRespVO respVO = new StoreOrderPayRespVO(result.getOrderExt().getOrder().getId(),
result.getPayRtnStr());
@ -116,7 +116,7 @@ public class StoreOrderController extends XktBaseController {
//订单支付状态->支付中
StoreOrderExt orderExt = storeOrderService.preparePayOrder(vo.getStoreOrderId(), payChannel);
//调用支付
String rtnStr = paymentManager.payStoreOrder(orderExt, EPayPage.of(vo.getPayPage()));
String rtnStr = paymentManager.payStoreOrder(orderExt, EPayPage.of(vo.getPayPage()), vo.getReturnUrl());
StoreOrderPayRespVO respVO = new StoreOrderPayRespVO(vo.getStoreOrderId(), rtnStr);
return success(respVO);
}

View File

@ -25,6 +25,6 @@ public class StoreRechargeReqVO {
@ApiModelProperty(value = "支付来源[1:电脑网站 2:手机网站 3:APP]", required = true)
private Integer payPage;
@ApiModelProperty(value = "支付完成后跳转url")
@ApiModelProperty(value = "支付完成后跳转url,若为空默认跳转商城首页")
private String returnUrl;
}

View File

@ -101,6 +101,9 @@ public class StoreOrderAddReqVO {
@ApiModelProperty(value = "支付来源[1:电脑网站 2:手机网站 3:APP]", required = true)
private Integer payPage;
@ApiModelProperty(value = "支付完成后跳转url若为空默认跳转商城首页")
private String returnUrl;
@ApiModel(value = "明细")
@Data
public static class Detail {

View File

@ -25,4 +25,7 @@ public class StoreOrderPayReqVO {
@NotNull(message = "支付来源不能为空")
@ApiModelProperty(value = "支付来源[1:电脑网站 2:手机网站]", required = true)
private Integer payPage;
@ApiModelProperty(value = "支付完成后跳转url若为空默认跳转商城首页")
private String returnUrl;
}

View File

@ -29,7 +29,7 @@ public class RechargeAddDTO {
*/
private EPayPage payPage;
/**
* url
* url
*/
private String returnUrl;
}

View File

@ -39,9 +39,10 @@ public interface PaymentManager {
*
* @param order
* @param payPage
* @param returnUrl
* @return ///&
*/
String payStoreOrder(StoreOrderExt order, EPayPage payPage);
String payStoreOrder(StoreOrderExt order, EPayPage payPage, String returnUrl);
/**
* 退

View File

@ -195,14 +195,15 @@ public class AliPaymentMangerImpl implements PaymentManager, InitializingBean {
}
@Override
public String payStoreOrder(StoreOrderExt orderExt, EPayPage payPage) {
public String payStoreOrder(StoreOrderExt orderExt, EPayPage payPage, String returnUrl) {
Assert.notNull(orderExt);
Assert.notNull(payPage);
if (!EPayStatus.PAYING.getValue().equals(orderExt.getOrder().getPayStatus())) {
throw new ServiceException("订单[" + orderExt.getOrder().getOrderNo() + "]支付状态异常");
}
return pay(orderExt.getOrder().getOrderNo(), orderExt.getOrder().getTotalAmount(),
"代发订单" + orderExt.getOrder().getOrderNo(), payPage, null, orderReturnUrl);
"代发订单" + orderExt.getOrder().getOrderNo(), payPage, null,
StrUtil.isBlank(returnUrl) ? orderReturnUrl : returnUrl);
}
@Override

View File

@ -26,10 +26,11 @@ public interface IStoreOrderService {
* @param beginPay
* @param payChannel
* @param payPage
* @param returnUrl url
* @return
*/
StoreOrderAddResult createOrder(StoreOrderAddDTO storeOrderAddDTO, boolean beginPay, EPayChannel payChannel,
EPayPage payPage);
EPayPage payPage, String returnUrl);
/**
*

View File

@ -94,7 +94,7 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
@Transactional(rollbackFor = Exception.class)
@Override
public StoreOrderAddResult createOrder(StoreOrderAddDTO storeOrderAddDTO, boolean beginPay, EPayChannel payChannel,
EPayPage payPage) {
EPayPage payPage, String returnUrl) {
Long orderUserId = storeOrderAddDTO.getOrderUserId();
Long storeId = storeOrderAddDTO.getStoreId();
Long expressId = storeOrderAddDTO.getExpressId();
@ -221,7 +221,7 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
if (beginPay) {
//发起支付
PaymentManager paymentManager = getPaymentManager(payChannel);
rtnStr = paymentManager.payStoreOrder(orderExt, payPage);
rtnStr = paymentManager.payStoreOrder(orderExt, payPage, returnUrl);
}
return new StoreOrderAddResult(orderExt, rtnStr);
}
@ -403,7 +403,7 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
List<Long> spIds = detailInfos.stream().map(StoreOrderDetailInfoDTO::getStoreProdId).distinct()
.collect(Collectors.toList());
Map<Long, String> mainPicMap = storeProductFileMapper.selectMainPicByStoreProdIdList(spIds,
FileType.MAIN_PIC.getValue(), ORDER_NUM_1).stream()
FileType.MAIN_PIC.getValue(), ORDER_NUM_1).stream()
.collect(Collectors.toMap(StoreProdMainPicDTO::getStoreProdId, StoreProdMainPicDTO::getFileUrl,
(o, n) -> n));
for (StoreOrderDetailInfoDTO detailInfo : detailInfos) {
@ -447,8 +447,8 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
return ListUtil.empty();
}
Map<String, Date> printTimeMap = expressShippingLabelMapper.selectList(Wrappers
.lambdaQuery(ExpressShippingLabel.class)
.in(ExpressShippingLabel::getExpressWaybillNo, expressWaybillNos))
.lambdaQuery(ExpressShippingLabel.class)
.in(ExpressShippingLabel::getExpressWaybillNo, expressWaybillNos))
.stream()
.collect(Collectors.toMap(ExpressShippingLabel::getExpressWaybillNo,
ExpressShippingLabel::getLastPrintTime));
@ -487,9 +487,9 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
//物流信息
Map<Long, String> expressNameMap = expressService.getAllExpressNameMap();
Map<String, List<StoreOrderDetail>> expressWaybillGroupMap = storeOrderDetailMapper.selectList(Wrappers
.lambdaQuery(StoreOrderDetail.class)
.eq(StoreOrderDetail::getStoreOrderId, storeOrderId)
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED))
.lambdaQuery(StoreOrderDetail.class)
.eq(StoreOrderDetail::getStoreOrderId, storeOrderId)
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED))
.stream()
.filter(o -> StrUtil.isNotEmpty(o.getExpressWaybillNo()))
.collect(Collectors.groupingBy(StoreOrderDetail::getExpressWaybillNo));
@ -560,7 +560,7 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
List<Long> spIds = orderDetailList.stream().map(StoreOrderDetailInfoDTO::getStoreProdId).distinct()
.collect(Collectors.toList());
Map<Long, String> mainPicMap = storeProductFileMapper.selectMainPicByStoreProdIdList(spIds,
FileType.MAIN_PIC.getValue(), ORDER_NUM_1).stream()
FileType.MAIN_PIC.getValue(), ORDER_NUM_1).stream()
.collect(Collectors.toMap(StoreProdMainPicDTO::getStoreProdId, StoreProdMainPicDTO::getFileUrl,
(o, n) -> n));
Map<Long, List<StoreOrderDetailInfoDTO>> orderDetailGroup = orderDetailList
@ -1133,9 +1133,9 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
List<Long> afterSaleOrderIds = afterSaleOrderList.stream().map(SimpleEntity::getId)
.collect(Collectors.toList());
Map<Long, List<StoreOrderDetail>> afterSaleOrderDetailGroupMap = storeOrderDetailMapper.selectList(
Wrappers.lambdaQuery(StoreOrderDetail.class)
.in(StoreOrderDetail::getStoreOrderId, afterSaleOrderIds)
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED))
Wrappers.lambdaQuery(StoreOrderDetail.class)
.in(StoreOrderDetail::getStoreOrderId, afterSaleOrderIds)
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED))
.stream()
.filter(o -> {
if (!EOrderStatus.AFTER_SALE_COMPLETED.getValue().equals(o.getDetailStatus())) {
@ -1502,9 +1502,9 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
public void refundSuccess(Long storeOrderId, List<Long> storeOrderDetailIds, Long operatorId) {
StoreOrder order = getAndBaseCheck(storeOrderId);
Map<Long, StoreOrderDetail> orderDetailMap = storeOrderDetailMapper.selectList(Wrappers
.lambdaQuery(StoreOrderDetail.class)
.eq(StoreOrderDetail::getStoreOrderId, order.getId())
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED))
.lambdaQuery(StoreOrderDetail.class)
.eq(StoreOrderDetail::getStoreOrderId, order.getId())
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED))
.stream()
.collect(Collectors.toMap(SimpleEntity::getId, Function.identity()));
for (Long storeOrderDetailId : storeOrderDetailIds) {
@ -1890,8 +1890,8 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
.collect(Collectors.toMap(StoreProductColorSize::getId, o -> o));
//下单商品档口颜色
Map<Long, StoreColor> scMap = storeColorMapper.selectByIds(spcsMap.values().stream()
.map(StoreProductColorSize::getStoreColorId)
.collect(Collectors.toSet())).stream()
.map(StoreProductColorSize::getStoreColorId)
.collect(Collectors.toSet())).stream()
.collect(Collectors.toMap(StoreColor::getId, Function.identity()));
//下单商品
List<Long> spIdList = spcsMap.values().stream()