Merge branch 'master' of https://gitee.com/liu-jiangs-project/RuoYi-Vue
commit
30b62e574f
|
|
@ -179,6 +179,7 @@ public class AssetController extends XktBaseController {
|
|||
rechargeAddDTO.setAmount(vo.getAmount());
|
||||
rechargeAddDTO.setPayChannel(EPayChannel.of(vo.getPayChannel()));
|
||||
rechargeAddDTO.setPayPage(EPayPage.of(vo.getPayPage()));
|
||||
rechargeAddDTO.setReturnUrl(vo.getReturnUrl());
|
||||
RechargeAddResult result = assetService.rechargeByStore(rechargeAddDTO);
|
||||
return success(new StoreRechargeRespVO(result.getBillNo(), result.getPayRtnStr()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,7 @@ public class StoreRechargeReqVO {
|
|||
@NotNull(message = "支付来源不能为空")
|
||||
@ApiModelProperty(value = "支付来源[1:电脑网站 2:手机网站 3:APP]", required = true)
|
||||
private Integer payPage;
|
||||
|
||||
@ApiModelProperty(value = "支付完成后跳转url,若为空默认跳转商城首页")
|
||||
private String returnUrl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -25,4 +25,7 @@ public class StoreOrderPayReqVO {
|
|||
@NotNull(message = "支付来源不能为空")
|
||||
@ApiModelProperty(value = "支付来源[1:电脑网站 2:手机网站]", required = true)
|
||||
private Integer payPage;
|
||||
|
||||
@ApiModelProperty(value = "支付完成后跳转url,若为空默认跳转商城首页")
|
||||
private String returnUrl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -274,7 +274,8 @@ alipay:
|
|||
rootCertPath: C:/alipay/test/alipayRootCert.crt
|
||||
alipayPublicCertPath: C:/alipay/test/alipayPublicCert.crt
|
||||
notifyUrl: http://101.34.251.164:9310/rest/v1/alipay-callback/notify
|
||||
returnUrl:
|
||||
defaultReturnUrl: http://121.40.214.172/index.html
|
||||
orderReturnUrl: http://121.40.214.172/index.html
|
||||
signType: RSA2
|
||||
charset: UTF-8
|
||||
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do
|
||||
|
|
|
|||
|
|
@ -274,7 +274,8 @@ alipay:
|
|||
rootCertPath: /alipay/test/alipayRootCert.crt
|
||||
alipayPublicCertPath: /alipay/test/alipayPublicCert.crt
|
||||
notifyUrl: http://121.40.117.244:9310/rest/v1/alipay-callback/notify
|
||||
returnUrl:
|
||||
defaultReturnUrl: http://121.40.214.172/index.html
|
||||
orderReturnUrl: http://121.40.214.172/index.html
|
||||
signType: RSA2
|
||||
charset: UTF-8
|
||||
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do
|
||||
|
|
|
|||
|
|
@ -923,7 +923,7 @@ public class XktTask {
|
|||
public void autoCloseTimeoutStoreOrder() {
|
||||
log.info("-------------自动关闭超时订单开始-------------");
|
||||
Integer batchCount = 20;
|
||||
Date beforeDate = DateUtil.offset(new Date(), DateField.MINUTE, 60);
|
||||
Date beforeDate = DateUtil.offset(new Date(), DateField.MINUTE, -60);
|
||||
List<Long> storeOrderIds = storeOrderService.listNeedAutoCloseOrder(beforeDate, batchCount);
|
||||
for (Long storeOrderId : storeOrderIds) {
|
||||
log.info("开始处理: {}", storeOrderId);
|
||||
|
|
@ -943,7 +943,7 @@ public class XktTask {
|
|||
public void autoCompleteStoreOrder() {
|
||||
log.info("-------------自动完成订单开始-------------");
|
||||
Integer batchCount = 20;
|
||||
Date beforeDate = DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, 14);
|
||||
Date beforeDate = DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, -14);
|
||||
List<Long> storeOrderIds = storeOrderService.listNeedAutoCompleteOrder(beforeDate, batchCount);
|
||||
for (Long storeOrderId : storeOrderIds) {
|
||||
log.info("开始处理: {}", storeOrderId);
|
||||
|
|
|
|||
|
|
@ -28,4 +28,8 @@ public class RechargeAddDTO {
|
|||
* 支付来源
|
||||
*/
|
||||
private EPayPage payPage;
|
||||
/**
|
||||
* 支付完成后跳转url,若为空默认跳转商城首页
|
||||
*/
|
||||
private String returnUrl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,18 +29,20 @@ public interface PaymentManager {
|
|||
* @param subject
|
||||
* @param payPage
|
||||
* @param expireTime
|
||||
* @param returnUrl
|
||||
* @return 跳转页面数据/签名字符串/支付跳转链接/预支付交易会话标识(根据支付渠道&支付来源确定)
|
||||
*/
|
||||
String pay(String tradeNo, BigDecimal amount, String subject, EPayPage payPage, Date expireTime);
|
||||
String pay(String tradeNo, BigDecimal amount, String subject, EPayPage payPage, Date expireTime, String returnUrl);
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
*
|
||||
* @param order
|
||||
* @param payPage
|
||||
* @param returnUrl
|
||||
* @return 跳转页面数据/签名字符串/支付跳转链接/预支付交易会话标识(根据支付渠道&支付来源确定)
|
||||
*/
|
||||
String payStoreOrder(StoreOrderExt order, EPayPage payPage);
|
||||
String payStoreOrder(StoreOrderExt order, EPayPage payPage, String returnUrl);
|
||||
|
||||
/**
|
||||
* 订单退款
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.xkt.manager.impl;
|
|||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
|
|
@ -61,8 +62,11 @@ public class AliPaymentMangerImpl implements PaymentManager, InitializingBean {
|
|||
@Value("${alipay.notifyUrl:}")
|
||||
private String notifyUrl;
|
||||
|
||||
@Value("${alipay.returnUrl:}")
|
||||
private String returnUrl;
|
||||
@Value("${alipay.defaultReturnUrl:}")
|
||||
private String defaultReturnUrl;
|
||||
|
||||
@Value("${alipay.orderReturnUrl:}")
|
||||
private String orderReturnUrl;
|
||||
|
||||
@Value("${alipay.signType:}")
|
||||
private String signType;
|
||||
|
|
@ -109,7 +113,8 @@ public class AliPaymentMangerImpl implements PaymentManager, InitializingBean {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String pay(String tradeNo, BigDecimal amount, String subject, EPayPage payPage, Date expireTime) {
|
||||
public String pay(String tradeNo, BigDecimal amount, String subject, EPayPage payPage, Date expireTime,
|
||||
String returnUrl) {
|
||||
Assert.notEmpty(tradeNo);
|
||||
Assert.notNull(amount);
|
||||
Assert.notEmpty(subject);
|
||||
|
|
@ -120,7 +125,9 @@ public class AliPaymentMangerImpl implements PaymentManager, InitializingBean {
|
|||
reqDTO.setSubject(subject);
|
||||
reqDTO.setEnablePayChannels("balance,moneyFund,bankPay,debitCardExpress");
|
||||
reqDTO.setTimeExpire(DateUtil.formatDateTime(expireTime));
|
||||
|
||||
if (StrUtil.isBlank(returnUrl)) {
|
||||
returnUrl = defaultReturnUrl;
|
||||
}
|
||||
switch (payPage) {
|
||||
case WEB:
|
||||
reqDTO.setProductCode("FAST_INSTANT_TRADE_PAY");
|
||||
|
|
@ -188,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);
|
||||
"代发订单" + orderExt.getOrder().getOrderNo(), payPage, null,
|
||||
StrUtil.isBlank(returnUrl) ? orderReturnUrl : returnUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
/**
|
||||
* 更新订单
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ public class AssetServiceImpl implements IAssetService {
|
|||
7, TimeUnit.DAYS);
|
||||
PaymentManager paymentManager = getPaymentManager(rechargeAddDTO.getPayChannel());
|
||||
String payRtnStr = paymentManager.pay(billNo, rechargeAddDTO.getAmount(),
|
||||
"档口充值", rechargeAddDTO.getPayPage(), null);
|
||||
"档口充值", rechargeAddDTO.getPayPage(), null, rechargeAddDTO.getReturnUrl());
|
||||
return new RechargeAddResult(billNo, payRtnStr);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue