Commit 3f33ca2d6bb1fe9c4585f3a5a9f5318145272372
1 parent
d224b6b9
mall + pay:
1、增加获得支付渠道接口
Showing
8 changed files
with
82 additions
and
88 deletions
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java
| @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.pay.core.client.PayClient; | @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.pay.core.client.PayClient; | ||
| 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; |
| 6 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | 6 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; |
| 7 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.*; | 7 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.*; |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXLitePayClient; | 8 | +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxLitePayClient; |
| 9 | import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXNativePayClient; | 9 | import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXNativePayClient; |
| 10 | import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig; | 10 | import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig; |
| 11 | import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPubPayClient; | 11 | import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPubPayClient; |
| @@ -61,7 +61,7 @@ public class PayClientFactoryImpl implements PayClientFactory { | @@ -61,7 +61,7 @@ public class PayClientFactoryImpl implements PayClientFactory { | ||
| 61 | // TODO @芋艿 WX_LITE WX_APP 如果不添加在 项目启动的时候去初始化会报错无法启动。所以我手动加了两个,具体需要你来配 | 61 | // TODO @芋艿 WX_LITE WX_APP 如果不添加在 项目启动的时候去初始化会报错无法启动。所以我手动加了两个,具体需要你来配 |
| 62 | switch (channelEnum) { | 62 | switch (channelEnum) { |
| 63 | case WX_PUB: return (AbstractPayClient<Config>) new WxPubPayClient(channelId, (WxPayClientConfig) config); | 63 | case WX_PUB: return (AbstractPayClient<Config>) new WxPubPayClient(channelId, (WxPayClientConfig) config); |
| 64 | - case WX_LITE: return (AbstractPayClient<Config>) new WXLitePayClient(channelId, (WxPayClientConfig) config); | 64 | + case WX_LITE: return (AbstractPayClient<Config>) new WxLitePayClient(channelId, (WxPayClientConfig) config); |
| 65 | case WX_APP: return (AbstractPayClient<Config>) new WxPubPayClient(channelId, (WxPayClientConfig) config); | 65 | case WX_APP: return (AbstractPayClient<Config>) new WxPubPayClient(channelId, (WxPayClientConfig) config); |
| 66 | case WX_NATIVE: return (AbstractPayClient<Config>) new WXNativePayClient(channelId, (WxPayClientConfig) config); | 66 | case WX_NATIVE: return (AbstractPayClient<Config>) new WXNativePayClient(channelId, (WxPayClientConfig) config); |
| 67 | case ALIPAY_WAP: return (AbstractPayClient<Config>) new AlipayWapPayClient(channelId, (AlipayPayClientConfig) config); | 67 | case ALIPAY_WAP: return (AbstractPayClient<Config>) new AlipayWapPayClient(channelId, (AlipayPayClientConfig) config); |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WXLitePayClient.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxLitePayClient.java
| @@ -11,9 +11,9 @@ import lombok.extern.slf4j.Slf4j; | @@ -11,9 +11,9 @@ import lombok.extern.slf4j.Slf4j; | ||
| 11 | * @author zwy | 11 | * @author zwy |
| 12 | */ | 12 | */ |
| 13 | @Slf4j | 13 | @Slf4j |
| 14 | -public class WXLitePayClient extends WxPubPayClient { | 14 | +public class WxLitePayClient extends WxPubPayClient { |
| 15 | 15 | ||
| 16 | - public WXLitePayClient(Long channelId, WxPayClientConfig config) { | 16 | + public WxLitePayClient(Long channelId, WxPayClientConfig config) { |
| 17 | super(channelId, PayChannelEnum.WX_LITE.getCode(), config); | 17 | super(channelId, PayChannelEnum.WX_LITE.getCode(), config); |
| 18 | } | 18 | } |
| 19 | 19 |
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java
| 1 | package cn.iocoder.yudao.module.pay.enums; | 1 | package cn.iocoder.yudao.module.pay.enums; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.util.ObjectUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.exception.ErrorCode; | 3 | import cn.iocoder.yudao.framework.common.exception.ErrorCode; |
| 5 | 4 | ||
| 6 | /** | 5 | /** |
| @@ -21,21 +20,15 @@ public interface ErrorCodeConstants { | @@ -21,21 +20,15 @@ public interface ErrorCodeConstants { | ||
| 21 | ErrorCode PAY_CHANNEL_CLIENT_NOT_FOUND = new ErrorCode(1007001002, "支付渠道的客户端不存在"); | 20 | ErrorCode PAY_CHANNEL_CLIENT_NOT_FOUND = new ErrorCode(1007001002, "支付渠道的客户端不存在"); |
| 22 | ErrorCode CHANNEL_NOT_EXISTS = new ErrorCode(1007001003, "支付渠道不存在"); | 21 | ErrorCode CHANNEL_NOT_EXISTS = new ErrorCode(1007001003, "支付渠道不存在"); |
| 23 | ErrorCode CHANNEL_EXIST_SAME_CHANNEL_ERROR = new ErrorCode(1007001005, "已存在相同的渠道"); | 22 | ErrorCode CHANNEL_EXIST_SAME_CHANNEL_ERROR = new ErrorCode(1007001005, "已存在相同的渠道"); |
| 24 | - ErrorCode CHANNEL_WECHAT_VERSION_2_MCH_KEY_IS_NULL = new ErrorCode(1007001006,"微信渠道v2版本中商户密钥不可为空"); | ||
| 25 | - ErrorCode CHANNEL_WECHAT_VERSION_3_PRIVATE_KEY_IS_NULL = new ErrorCode(1007001007,"微信渠道v3版本apiclient_key.pem不可为空"); | ||
| 26 | - ErrorCode CHANNEL_WECHAT_VERSION_3_CERT_KEY_IS_NULL = new ErrorCode(1007001008,"微信渠道v3版本中apiclient_cert.pem不可为空"); | ||
| 27 | - ErrorCode PAY_CHANNEL_NOTIFY_VERIFY_FAILED = new ErrorCode(1007001009, "渠道通知校验失败"); | ||
| 28 | 23 | ||
| 29 | // ========== ORDER 模块 1007002000 ========== | 24 | // ========== ORDER 模块 1007002000 ========== |
| 30 | ErrorCode PAY_ORDER_NOT_FOUND = new ErrorCode(1007002000, "支付订单不存在"); | 25 | ErrorCode PAY_ORDER_NOT_FOUND = new ErrorCode(1007002000, "支付订单不存在"); |
| 31 | ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1007002001, "支付订单不处于待支付"); | 26 | ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1007002001, "支付订单不处于待支付"); |
| 32 | ErrorCode PAY_ORDER_STATUS_IS_NOT_SUCCESS = new ErrorCode(1007002002, "支付订单不处于已支付"); | 27 | ErrorCode PAY_ORDER_STATUS_IS_NOT_SUCCESS = new ErrorCode(1007002002, "支付订单不处于已支付"); |
| 33 | - ErrorCode PAY_ORDER_ERROR_USER = new ErrorCode(1007002003, "支付订单用户不正确"); | ||
| 34 | 28 | ||
| 35 | // ========== ORDER 模块(拓展单) 1007003000 ========== | 29 | // ========== ORDER 模块(拓展单) 1007003000 ========== |
| 36 | ErrorCode PAY_ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在"); | 30 | ErrorCode PAY_ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在"); |
| 37 | ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING = new ErrorCode(1007003001, "支付交易拓展单不处于待支付"); | 31 | ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING = new ErrorCode(1007003001, "支付交易拓展单不处于待支付"); |
| 38 | - ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_SUCCESS = new ErrorCode(1007003002, "支付订单不处于已支付"); | ||
| 39 | 32 | ||
| 40 | // ========== 支付模块(退款) 1007006000 ========== | 33 | // ========== 支付模块(退款) 1007006000 ========== |
| 41 | ErrorCode PAY_REFUND_AMOUNT_EXCEED = new ErrorCode(1007006000, "退款金额超过订单可退款金额"); | 34 | ErrorCode PAY_REFUND_AMOUNT_EXCEED = new ErrorCode(1007006000, "退款金额超过订单可退款金额"); |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayChannelController.java
| 1 | package cn.iocoder.yudao.module.pay.controller.admin.merchant; | 1 | package cn.iocoder.yudao.module.pay.controller.admin.merchant; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.*; | ||
| 4 | -import cn.iocoder.yudao.module.pay.convert.channel.PayChannelConvert; | ||
| 5 | -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; | ||
| 6 | -import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService; | ||
| 7 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 10 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 11 | -import io.swagger.v3.oas.annotations.tags.Tag; | 7 | +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.*; |
| 8 | +import cn.iocoder.yudao.module.pay.convert.channel.PayChannelConvert; | ||
| 9 | +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; | ||
| 10 | +import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService; | ||
| 11 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 12 | import io.swagger.v3.oas.annotations.Parameter; | 12 | import io.swagger.v3.oas.annotations.Parameter; |
| 13 | import io.swagger.v3.oas.annotations.Parameters; | 13 | import io.swagger.v3.oas.annotations.Parameters; |
| 14 | -import io.swagger.v3.oas.annotations.Operation; | 14 | +import io.swagger.v3.oas.annotations.tags.Tag; |
| 15 | import org.springframework.security.access.prepost.PreAuthorize; | 15 | import org.springframework.security.access.prepost.PreAuthorize; |
| 16 | import org.springframework.validation.annotation.Validated; | 16 | import org.springframework.validation.annotation.Validated; |
| 17 | import org.springframework.web.bind.annotation.*; | 17 | import org.springframework.web.bind.annotation.*; |
| @@ -20,10 +20,11 @@ import javax.annotation.Resource; | @@ -20,10 +20,11 @@ import javax.annotation.Resource; | ||
| 20 | import javax.servlet.http.HttpServletResponse; | 20 | import javax.servlet.http.HttpServletResponse; |
| 21 | import javax.validation.Valid; | 21 | import javax.validation.Valid; |
| 22 | import java.io.IOException; | 22 | import java.io.IOException; |
| 23 | -import java.util.Collection; | ||
| 24 | import java.util.List; | 23 | import java.util.List; |
| 24 | +import java.util.Set; | ||
| 25 | 25 | ||
| 26 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 26 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 27 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 27 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | 28 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 28 | 29 | ||
| 29 | @Tag(name = "管理后台 - 支付渠道") | 30 | @Tag(name = "管理后台 - 支付渠道") |
| @@ -68,16 +69,6 @@ public class PayChannelController { | @@ -68,16 +69,6 @@ public class PayChannelController { | ||
| 68 | return success(PayChannelConvert.INSTANCE.convert(channel)); | 69 | return success(PayChannelConvert.INSTANCE.convert(channel)); |
| 69 | } | 70 | } |
| 70 | 71 | ||
| 71 | - @GetMapping("/list") | ||
| 72 | - @Operation(summary = "获得支付渠道列表") | ||
| 73 | - @Parameter(name = "ids", description = "编号列表", | ||
| 74 | - required = true, example = "1024,2048") | ||
| 75 | - @PreAuthorize("@ss.hasPermission('pay:channel:query')") | ||
| 76 | - public CommonResult<List<PayChannelRespVO>> getChannelList(@RequestParam("ids") Collection<Long> ids) { | ||
| 77 | - List<PayChannelDO> list = channelService.getChannelList(ids); | ||
| 78 | - return success(PayChannelConvert.INSTANCE.convertList(list)); | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | @GetMapping("/page") | 72 | @GetMapping("/page") |
| 82 | @Operation(summary = "获得支付渠道分页") | 73 | @Operation(summary = "获得支付渠道分页") |
| 83 | @PreAuthorize("@ss.hasPermission('pay:channel:query')") | 74 | @PreAuthorize("@ss.hasPermission('pay:channel:query')") |
| @@ -98,6 +89,7 @@ public class PayChannelController { | @@ -98,6 +89,7 @@ public class PayChannelController { | ||
| 98 | ExcelUtils.write(response, "支付渠道.xls", "数据", PayChannelExcelVO.class, datas); | 89 | ExcelUtils.write(response, "支付渠道.xls", "数据", PayChannelExcelVO.class, datas); |
| 99 | } | 90 | } |
| 100 | 91 | ||
| 92 | + // TODO 芋艿:需要 review 下实现 | ||
| 101 | @GetMapping("/get-channel") | 93 | @GetMapping("/get-channel") |
| 102 | @Operation(summary = "根据条件查询微信支付渠道") | 94 | @Operation(summary = "根据条件查询微信支付渠道") |
| 103 | @Parameters({ | 95 | @Parameters({ |
| @@ -121,4 +113,12 @@ public class PayChannelController { | @@ -121,4 +113,12 @@ public class PayChannelController { | ||
| 121 | return success(respVo); | 113 | return success(respVo); |
| 122 | } | 114 | } |
| 123 | 115 | ||
| 116 | + @GetMapping("/get-enable-code-list") | ||
| 117 | + @Operation(summary = "获得指定应用的开启的支付渠道编码列表") | ||
| 118 | + @Parameter(name = "appId", description = "应用编号", required = true, example = "1") | ||
| 119 | + public CommonResult<Set<String>> getEnableChannelCodeList(@RequestParam("appId") Long appId) { | ||
| 120 | + List<PayChannelDO> channels = channelService.getEnableChannelList(appId); | ||
| 121 | + return success(convertSet(channels, PayChannelDO::getCode)); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | } | 124 | } |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/channel/AppPayChannelController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.controller.app.channel; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; | ||
| 5 | +import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService; | ||
| 6 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 7 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 8 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 9 | +import org.springframework.validation.annotation.Validated; | ||
| 10 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 13 | +import org.springframework.web.bind.annotation.RestController; | ||
| 14 | + | ||
| 15 | +import javax.annotation.Resource; | ||
| 16 | +import java.util.List; | ||
| 17 | +import java.util.Set; | ||
| 18 | + | ||
| 19 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 20 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 21 | + | ||
| 22 | +@Tag(name = "用户 App - 支付渠道") | ||
| 23 | +@RestController | ||
| 24 | +@RequestMapping("/pay/channel") | ||
| 25 | +@Validated | ||
| 26 | +public class AppPayChannelController { | ||
| 27 | + | ||
| 28 | + @Resource | ||
| 29 | + private PayChannelService channelService; | ||
| 30 | + | ||
| 31 | + @GetMapping("/get-enable-code-list") | ||
| 32 | + @Operation(summary = "获得指定应用的开启的支付渠道编码列表") | ||
| 33 | + @Parameter(name = "appId", description = "应用编号", required = true, example = "1") | ||
| 34 | + public CommonResult<Set<String>> getEnableChannelCodeList(@RequestParam("appId") Long appId) { | ||
| 35 | + List<PayChannelDO> channels = channelService.getEnableChannelList(appId); | ||
| 36 | + return success(convertSet(channels, PayChannelDO::getCode)); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | +} |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayChannelMapper.java
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.dal.mysql.merchant; | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.dal.mysql.merchant; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 5 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; |
| 6 | import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelExportReqVO; | 7 | import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelExportReqVO; |
| 7 | import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelPageReqVO; | 8 | import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelPageReqVO; |
| @@ -44,21 +45,6 @@ public interface PayChannelMapper extends BaseMapperX<PayChannelDO> { | @@ -44,21 +45,6 @@ public interface PayChannelMapper extends BaseMapperX<PayChannelDO> { | ||
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | /** | 47 | /** |
| 47 | - * 根据条件获取渠道数量 | ||
| 48 | - * | ||
| 49 | - * @param merchantId 商户编号 | ||
| 50 | - * @param appid 应用编号 | ||
| 51 | - * @param code 渠道编码 | ||
| 52 | - * @return 数量 | ||
| 53 | - */ | ||
| 54 | - default Integer selectCount(Long merchantId, Long appid, String code) { | ||
| 55 | - return this.selectCount(new QueryWrapper<PayChannelDO>().lambda() | ||
| 56 | - .eq(PayChannelDO::getMerchantId, merchantId) | ||
| 57 | - .eq(PayChannelDO::getAppId, appid) | ||
| 58 | - .eq(PayChannelDO::getCode, code)).intValue(); | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - /** | ||
| 62 | * 根据条件获取渠道 | 48 | * 根据条件获取渠道 |
| 63 | * | 49 | * |
| 64 | * @param merchantId 商户编号 | 50 | * @param merchantId 商户编号 |
| @@ -86,4 +72,10 @@ public interface PayChannelMapper extends BaseMapperX<PayChannelDO> { | @@ -86,4 +72,10 @@ public interface PayChannelMapper extends BaseMapperX<PayChannelDO> { | ||
| 86 | .in(PayChannelDO::getAppId, appIds)); | 72 | .in(PayChannelDO::getAppId, appIds)); |
| 87 | } | 73 | } |
| 88 | 74 | ||
| 75 | + default List<PayChannelDO> selectListByAppId(Long appId, Integer status) { | ||
| 76 | + return selectList(new LambdaQueryWrapperX<PayChannelDO>() | ||
| 77 | + .eq(PayChannelDO::getAppId, appId) | ||
| 78 | + .eq(PayChannelDO::getStatus, status)); | ||
| 79 | + } | ||
| 80 | + | ||
| 89 | } | 81 | } |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelService.java
| @@ -55,15 +55,6 @@ public interface PayChannelService { | @@ -55,15 +55,6 @@ public interface PayChannelService { | ||
| 55 | PayChannelDO getChannel(Long id); | 55 | PayChannelDO getChannel(Long id); |
| 56 | 56 | ||
| 57 | /** | 57 | /** |
| 58 | - * 获得支付渠道列表 | ||
| 59 | - * | ||
| 60 | - * @param ids 编号 | ||
| 61 | - * @return 支付渠道 | ||
| 62 | - * 列表 | ||
| 63 | - */ | ||
| 64 | - List<PayChannelDO> getChannelList(Collection<Long> ids); | ||
| 65 | - | ||
| 66 | - /** | ||
| 67 | * 获得支付渠道分页 | 58 | * 获得支付渠道分页 |
| 68 | * | 59 | * |
| 69 | * @param pageReqVO 分页查询 | 60 | * @param pageReqVO 分页查询 |
| @@ -90,16 +81,6 @@ public interface PayChannelService { | @@ -90,16 +81,6 @@ public interface PayChannelService { | ||
| 90 | List<PayChannelDO> getChannelListByAppIds(Collection<Long> appIds); | 81 | List<PayChannelDO> getChannelListByAppIds(Collection<Long> appIds); |
| 91 | 82 | ||
| 92 | /** | 83 | /** |
| 93 | - * 根据条件获取渠道数量 | ||
| 94 | - * | ||
| 95 | - * @param merchantId 商户编号 | ||
| 96 | - * @param appid 应用编号 | ||
| 97 | - * @param code 渠道编码 | ||
| 98 | - * @return 数量 | ||
| 99 | - */ | ||
| 100 | - Integer getChannelCountByConditions(Long merchantId, Long appid, String code); | ||
| 101 | - | ||
| 102 | - /** | ||
| 103 | * 根据条件获取渠道 | 84 | * 根据条件获取渠道 |
| 104 | * | 85 | * |
| 105 | * @param merchantId 商户编号 | 86 | * @param merchantId 商户编号 |
| @@ -130,4 +111,12 @@ public interface PayChannelService { | @@ -130,4 +111,12 @@ public interface PayChannelService { | ||
| 130 | */ | 111 | */ |
| 131 | PayChannelDO validPayChannel(Long appId, String code); | 112 | PayChannelDO validPayChannel(Long appId, String code); |
| 132 | 113 | ||
| 114 | + /** | ||
| 115 | + * 获得指定应用的开启的渠道列表 | ||
| 116 | + * | ||
| 117 | + * @param appId 应用编号 | ||
| 118 | + * @return 渠道列表 | ||
| 119 | + */ | ||
| 120 | + List<PayChannelDO> getEnableChannelList(Long appId); | ||
| 121 | + | ||
| 133 | } | 122 | } |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelServiceImpl.java
| @@ -24,7 +24,6 @@ import org.springframework.validation.annotation.Validated; | @@ -24,7 +24,6 @@ import org.springframework.validation.annotation.Validated; | ||
| 24 | import javax.annotation.PostConstruct; | 24 | import javax.annotation.PostConstruct; |
| 25 | import javax.annotation.Resource; | 25 | import javax.annotation.Resource; |
| 26 | import javax.validation.Validator; | 26 | import javax.validation.Validator; |
| 27 | -import java.time.LocalDateTime; | ||
| 28 | import java.util.Collection; | 27 | import java.util.Collection; |
| 29 | import java.util.List; | 28 | import java.util.List; |
| 30 | 29 | ||
| @@ -42,11 +41,6 @@ import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.CHANNEL_NOT_E | @@ -42,11 +41,6 @@ import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.CHANNEL_NOT_E | ||
| 42 | @Validated | 41 | @Validated |
| 43 | public class PayChannelServiceImpl implements PayChannelService { | 42 | public class PayChannelServiceImpl implements PayChannelService { |
| 44 | 43 | ||
| 45 | - /** | ||
| 46 | - * 缓存菜单的最大更新时间,用于后续的增量轮询,判断是否有更新 | ||
| 47 | - */ | ||
| 48 | - private volatile LocalDateTime maxUpdateTime; | ||
| 49 | - | ||
| 50 | @Resource | 44 | @Resource |
| 51 | private PayClientFactory payClientFactory; | 45 | private PayClientFactory payClientFactory; |
| 52 | 46 | ||
| @@ -122,11 +116,6 @@ public class PayChannelServiceImpl implements PayChannelService { | @@ -122,11 +116,6 @@ public class PayChannelServiceImpl implements PayChannelService { | ||
| 122 | } | 116 | } |
| 123 | 117 | ||
| 124 | @Override | 118 | @Override |
| 125 | - public List<PayChannelDO> getChannelList(Collection<Long> ids) { | ||
| 126 | - return channelMapper.selectBatchIds(ids); | ||
| 127 | - } | ||
| 128 | - | ||
| 129 | - @Override | ||
| 130 | public PageResult<PayChannelDO> getChannelPage(PayChannelPageReqVO pageReqVO) { | 119 | public PageResult<PayChannelDO> getChannelPage(PayChannelPageReqVO pageReqVO) { |
| 131 | return channelMapper.selectPage(pageReqVO); | 120 | return channelMapper.selectPage(pageReqVO); |
| 132 | } | 121 | } |
| @@ -147,20 +136,6 @@ public class PayChannelServiceImpl implements PayChannelService { | @@ -147,20 +136,6 @@ public class PayChannelServiceImpl implements PayChannelService { | ||
| 147 | return channelMapper.getChannelListByAppIds(appIds); | 136 | return channelMapper.getChannelListByAppIds(appIds); |
| 148 | } | 137 | } |
| 149 | 138 | ||
| 150 | - | ||
| 151 | - /** | ||
| 152 | - * 根据条件获取渠道数量 | ||
| 153 | - * | ||
| 154 | - * @param merchantId 商户编号 | ||
| 155 | - * @param appid 应用编号 | ||
| 156 | - * @param code 渠道编码 | ||
| 157 | - * @return 数量 | ||
| 158 | - */ | ||
| 159 | - @Override | ||
| 160 | - public Integer getChannelCountByConditions(Long merchantId, Long appid, String code) { | ||
| 161 | - return this.channelMapper.selectCount(merchantId, appid, code); | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | /** | 139 | /** |
| 165 | * 根据条件获取渠道 | 140 | * 根据条件获取渠道 |
| 166 | * | 141 | * |
| @@ -204,10 +179,15 @@ public class PayChannelServiceImpl implements PayChannelService { | @@ -204,10 +179,15 @@ public class PayChannelServiceImpl implements PayChannelService { | ||
| 204 | @Override | 179 | @Override |
| 205 | public PayChannelDO validPayChannel(Long appId, String code) { | 180 | public PayChannelDO validPayChannel(Long appId, String code) { |
| 206 | PayChannelDO channel = channelMapper.selectByAppIdAndCode(appId, code); | 181 | PayChannelDO channel = channelMapper.selectByAppIdAndCode(appId, code); |
| 207 | - this.validPayChannel(channel); | 182 | + validPayChannel(channel); |
| 208 | return channel; | 183 | return channel; |
| 209 | } | 184 | } |
| 210 | 185 | ||
| 186 | + @Override | ||
| 187 | + public List<PayChannelDO> getEnableChannelList(Long appId) { | ||
| 188 | + return channelMapper.selectListByAppId(appId, CommonStatusEnum.ENABLE.getStatus()); | ||
| 189 | + } | ||
| 190 | + | ||
| 211 | private void validPayChannel(PayChannelDO channel) { | 191 | private void validPayChannel(PayChannelDO channel) { |
| 212 | if (channel == null) { | 192 | if (channel == null) { |
| 213 | throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_CHANNEL_NOT_FOUND); | 193 | throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_CHANNEL_NOT_FOUND); |
| @@ -216,4 +196,5 @@ public class PayChannelServiceImpl implements PayChannelService { | @@ -216,4 +196,5 @@ public class PayChannelServiceImpl implements PayChannelService { | ||
| 216 | throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_CHANNEL_IS_DISABLE); | 196 | throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_CHANNEL_IS_DISABLE); |
| 217 | } | 197 | } |
| 218 | } | 198 | } |
| 199 | + | ||
| 219 | } | 200 | } |