【同步】BOOT 和 CLOUD 的功能

This commit is contained in:
YunaiV
2026-06-27 08:38:59 -07:00
parent ac1ded1aaf
commit edb292f622
62 changed files with 1400 additions and 1068 deletions
@@ -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);