mirror of
https://gitee.com/zhijiantianya/ruoyi-vue-pro.git
synced 2026-07-04 13:02:38 +08:00
feat(pay): 新增支付渠道列表接口
- 新增 GET /pay/channel/list 按 appId 返回渠道列表 - Service/Mapper 补充按应用查询全部支付渠道 - 列表转换时清空 config,避免密钥和证书配置下发到列表页 - 保持 /pay/channel/get 返回完整配置用于编辑详情
This commit is contained in:
@ -71,6 +71,15 @@ public class PayChannelController {
|
||||
return success(PayChannelConvert.INSTANCE.convert(channel));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得指定应用的支付渠道列表")
|
||||
@Parameter(name = "appId", description = "应用编号", required = true, example = "1")
|
||||
@PreAuthorize("@ss.hasPermission('pay:channel:query')")
|
||||
public CommonResult<List<PayChannelRespVO>> getChannelList(@RequestParam("appId") Long appId) {
|
||||
List<PayChannelDO> list = channelService.getChannelListByAppId(appId);
|
||||
return success(PayChannelConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/get-enable-code-list")
|
||||
@Operation(summary = "获得指定应用的开启的支付渠道编码列表")
|
||||
@Parameter(name = "appId", description = "应用编号", required = true, example = "1")
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.pay.convert.channel;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelRespVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO;
|
||||
@ -9,6 +10,8 @@ import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PayChannelConvert {
|
||||
|
||||
@ -23,6 +26,15 @@ public interface PayChannelConvert {
|
||||
@Mapping(target = "config",expression = "java(cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString(bean.getConfig()))")
|
||||
PayChannelRespVO convert(PayChannelDO bean);
|
||||
|
||||
default List<PayChannelRespVO> convertList(List<PayChannelDO> list) {
|
||||
// 列表不下发 config(密钥/证书),详情接口再返回完整配置
|
||||
return CollectionUtils.convertList(list, channel -> {
|
||||
PayChannelRespVO vo = convert(channel);
|
||||
vo.setConfig(null);
|
||||
return vo;
|
||||
});
|
||||
}
|
||||
|
||||
PageResult<PayChannelRespVO> convertPage(PageResult<PayChannelDO> page);
|
||||
|
||||
}
|
||||
|
||||
@ -28,4 +28,8 @@ public interface PayChannelMapper extends BaseMapperX<PayChannelDO> {
|
||||
.eq(PayChannelDO::getStatus, status));
|
||||
}
|
||||
|
||||
default List<PayChannelDO> selectListByAppId(Long appId) {
|
||||
return selectList(PayChannelDO::getAppId, appId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -93,6 +93,14 @@ public interface PayChannelService {
|
||||
*/
|
||||
List<PayChannelDO> getEnableChannelList(Long appId);
|
||||
|
||||
/**
|
||||
* 获得指定应用的渠道列表
|
||||
*
|
||||
* @param appId 应用编号
|
||||
* @return 渠道列表
|
||||
*/
|
||||
List<PayChannelDO> getChannelListByAppId(Long appId);
|
||||
|
||||
/**
|
||||
* 获得指定编号的支付客户端
|
||||
*
|
||||
|
||||
@ -156,6 +156,11 @@ public class PayChannelServiceImpl implements PayChannelService {
|
||||
return payChannelMapper.selectListByAppId(appId, CommonStatusEnum.ENABLE.getStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PayChannelDO> getChannelListByAppId(Long appId) {
|
||||
return payChannelMapper.selectListByAppId(appId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayClient getPayClient(Long id) {
|
||||
PayChannelDO channel = validPayChannel(id);
|
||||
|
||||
Reference in New Issue
Block a user