mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-02 02:34:34 +00:00
ref controller控制器移植
This commit is contained in:
@@ -20,16 +20,16 @@ spring:
|
||||
redis:
|
||||
host: redis
|
||||
port: 6379
|
||||
database: 4
|
||||
database: 5
|
||||
password: bootx123
|
||||
lettuce:
|
||||
pool:
|
||||
max-wait: 1000ms
|
||||
# 开发时显示debug日志
|
||||
# 开发时显示debug日志 org.dromara.daxpay
|
||||
logging:
|
||||
level:
|
||||
cn.bootx.**: debug
|
||||
cn.daxpay.**: debug
|
||||
org.dromara.**: debug
|
||||
org.springframework.jdbc.core: debug
|
||||
# 接口文档配置
|
||||
springdoc:
|
||||
@@ -41,8 +41,8 @@ bootx-platform:
|
||||
# swagger相关配置
|
||||
swagger:
|
||||
author: DaxPay
|
||||
title: 开源支付平台-多商户版-管理端
|
||||
description: 开源支付平台-多商户版-管理端
|
||||
title: 开源支付平台-单商户服务端
|
||||
description: 开源支付平台-单商户服务端
|
||||
version: 0.0.1
|
||||
base-packages:
|
||||
"[BootxPlatform接口]":
|
||||
@@ -52,8 +52,7 @@ bootx-platform:
|
||||
- cn.bootx.platform.baseapi
|
||||
- cn.bootx.platform.notice
|
||||
"[支付管理平台接口]":
|
||||
- org.dromara.daxpay.admin
|
||||
- org.dromara.daxpay.channel
|
||||
- org.dromara.daxpay
|
||||
starter:
|
||||
auth:
|
||||
enable-admin: true
|
||||
@@ -77,7 +76,7 @@ bootx-platform:
|
||||
forward-server-url: http://127.0.0.1:9999
|
||||
dax-pay:
|
||||
env: DEV_
|
||||
machine-no: 70
|
||||
machine-no: 60
|
||||
dromara:
|
||||
# 注意, 不要设置 domain 访问路径, 自行进行拼接访问路径, 来保证可迁移性
|
||||
x-file-storage:
|
||||
|
@@ -38,5 +38,4 @@ easy-trans:
|
||||
# 平台配置
|
||||
bootx-platform:
|
||||
config:
|
||||
# 不可以进行更改, 内部会根据终端编码进行处理
|
||||
client-code: dax-pay-server
|
||||
|
@@ -0,0 +1,77 @@
|
||||
package org.dromara.daxpay.service.controller;
|
||||
|
||||
import cn.bootx.platform.core.annotation.IgnoreAuth;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import cn.bootx.platform.starter.redis.delay.annotation.DelayEventListener;
|
||||
import cn.bootx.platform.starter.redis.delay.annotation.DelayJobEvent;
|
||||
import cn.bootx.platform.starter.redis.delay.bean.DelayJob;
|
||||
import cn.bootx.platform.starter.redis.delay.service.DelayJobService;
|
||||
import org.dromara.daxpay.core.result.assist.AuthResult;
|
||||
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/4
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@Slf4j
|
||||
@Tag(name = "测试服务")
|
||||
@RestController
|
||||
@RequestMapping("/test")
|
||||
@RequiredArgsConstructor
|
||||
public class TestController {
|
||||
|
||||
private final RedisTemplate<String, Object> objectRedisTemplate;
|
||||
|
||||
private final DelayJobService delayJobService;
|
||||
|
||||
|
||||
@Operation(summary = "测试redis")
|
||||
@GetMapping("/redis")
|
||||
public Result<Object> redis(){
|
||||
PayOrder payOrder = new PayOrder();
|
||||
payOrder.setOrderNo("123");
|
||||
// redisTemplate.opsForValue().set("payOrder",new AuthResult().setStatus("123"),60000L);
|
||||
objectRedisTemplate.opsForValue().set("payOrder",new AuthResult().setStatus("123"),600, TimeUnit.MILLISECONDS);
|
||||
// objectRedisTemplate.opsForValue().set("payOrder",payOrder);
|
||||
var payOrder1 = objectRedisTemplate.opsForValue().get("payOrder");
|
||||
return Res.ok(payOrder1);
|
||||
}
|
||||
|
||||
@Operation(summary = "添加测试延时任务")
|
||||
@PostMapping(value = "addTest")
|
||||
public Result<Void> addDefJobTest() {
|
||||
for (int i = 0; i < 100; i++){
|
||||
DelayJob<PayOrder> delayJob = new DelayJob<>();
|
||||
delayJobService.register(delayJob, "hello", RandomUtil.randomInt(10000,90000));
|
||||
delayJobService.register(delayJob, "hello", LocalDateTime.now().plusSeconds(20));
|
||||
}
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
|
||||
@DelayEventListener("hello")
|
||||
public void hello(DelayJobEvent<PayOrder> event) {
|
||||
if (RandomUtil.randomBoolean()){
|
||||
throw new RuntimeException("测试异常");
|
||||
}
|
||||
log.info("接收到消息:{}",event);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
package org.dromara.daxpay.service.controller.assist;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.daxpay.core.param.assist.GenerateAuthUrlParam;
|
||||
import org.dromara.daxpay.core.result.assist.AuthResult;
|
||||
import org.dromara.daxpay.core.result.assist.AuthUrlResult;
|
||||
import org.dromara.daxpay.service.service.assist.ChannelAuthService;
|
||||
import org.dromara.daxpay.service.service.assist.PaymentAssistService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 通道认证服务
|
||||
* @author xxm
|
||||
* @since 2024/9/24
|
||||
*/
|
||||
@Tag(name = "通道认证服务")
|
||||
@RestController
|
||||
@RequestGroup(groupCode = "ChannelAuth", groupName = "通道认证", moduleCode = "assist", moduleName = "辅助功能")
|
||||
@RequestMapping("/assist/channel/auth")
|
||||
@RequiredArgsConstructor
|
||||
public class ChannelAuthController {
|
||||
|
||||
private final ChannelAuthService channelAuthService;
|
||||
|
||||
private final PaymentAssistService paymentAssistService;
|
||||
|
||||
@RequestPath("获取授权链接")
|
||||
@Operation(summary = "获取授权链接")
|
||||
@PostMapping("/generateAuthUrl")
|
||||
public Result<AuthUrlResult> generateAuthUrl(@RequestBody GenerateAuthUrlParam param){
|
||||
paymentAssistService.initMchApp(param.getAppId());
|
||||
return Res.ok(channelAuthService.generateAuthUrl(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过查询码获取认证结果")
|
||||
@RequestPath("通过查询码获取认证结果")
|
||||
@GetMapping("/queryAuthResult")
|
||||
public Result<AuthResult> queryAuthResult(String queryCode) {
|
||||
return Res.ok(channelAuthService.queryAuthResult(queryCode));
|
||||
}
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
package org.dromara.daxpay.service.controller.config;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.config.ChannelCashierConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.ChannelCashierConfigResult;
|
||||
import org.dromara.daxpay.service.service.config.ChannelCashierConfigService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/9/28
|
||||
*/
|
||||
@Tag(name = "通道支付收银台配置")
|
||||
@RestController
|
||||
@RequestGroup(groupCode = "ChannelCashierConfig", groupName = "通道支付收银台配置", moduleCode = "PayConfig", moduleName = "支付配置")
|
||||
@RequestMapping("/channel/cashier/config")
|
||||
@RequiredArgsConstructor
|
||||
public class ChannelCashierConfigController {
|
||||
private final ChannelCashierConfigService channelCashierConfigService;
|
||||
|
||||
@RequestPath("配置列表")
|
||||
@Operation(summary = "配置列表")
|
||||
@GetMapping("/findByAppId")
|
||||
public Result<List<ChannelCashierConfigResult>> findByAppId(String appId) {
|
||||
return Res.ok(channelCashierConfigService.findByAppId(appId));
|
||||
}
|
||||
|
||||
@RequestPath("配置详情")
|
||||
@Operation(summary = "配置详情")
|
||||
@GetMapping("/findById")
|
||||
public Result<ChannelCashierConfigResult> findById(Long id) {
|
||||
return Res.ok(channelCashierConfigService.findById(id));
|
||||
}
|
||||
|
||||
@RequestPath("配置保存")
|
||||
@Operation(summary = "配置保存")
|
||||
@PostMapping("/save")
|
||||
public Result<Void> save(@RequestBody ChannelCashierConfigParam param) {
|
||||
channelCashierConfigService.save(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("配置更新")
|
||||
@Operation(summary = "配置更新")
|
||||
@PostMapping("/update")
|
||||
public Result<Void> update(@RequestBody ChannelCashierConfigParam param) {
|
||||
channelCashierConfigService.update(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("配置是否存在")
|
||||
@Operation(summary = "配置是否存在")
|
||||
@GetMapping("/existsByType")
|
||||
public Result<Boolean> existsByType(String type, String appId) {
|
||||
return Res.ok(channelCashierConfigService.existsByType(type, appId));
|
||||
}
|
||||
|
||||
@RequestPath("配置是否存在(不包括自身)")
|
||||
@Operation(summary = "配置是否存在(不包括自身)")
|
||||
@GetMapping("/existsByTypeNotId")
|
||||
public Result<Boolean> existsByTypeNotId(String type, String appId, Long id) {
|
||||
return Res.ok(channelCashierConfigService.existsByType(type, appId, id));
|
||||
}
|
||||
|
||||
@RequestPath("配置删除")
|
||||
@Operation(summary = "配置删除")
|
||||
@PostMapping("/delete")
|
||||
public Result<Void> delete(Long id) {
|
||||
channelCashierConfigService.delete(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("获取码牌地址")
|
||||
@Operation(summary = "获取码牌地址")
|
||||
@GetMapping("/qrCodeUrl")
|
||||
public Result<String> qrCodeUrl(String appId) {
|
||||
return Res.ok(channelCashierConfigService.qrCodeUrl(appId));
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package org.dromara.daxpay.service.controller.config;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.result.config.ChannelConfigResult;
|
||||
import org.dromara.daxpay.service.service.config.ChannelConfigService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通道配置
|
||||
* @author xxm
|
||||
* @since 2024/6/25
|
||||
*/
|
||||
@Tag(name = "通道配置")
|
||||
@RestController
|
||||
@RequestGroup(groupCode = "channelConfig", groupName = "通道配置", moduleCode = "PayConfig", moduleName = "支付配置")
|
||||
@RequestMapping("/channel/config")
|
||||
@RequiredArgsConstructor
|
||||
public class ChannelConfigController {
|
||||
private final ChannelConfigService channelConfigService;
|
||||
|
||||
@RequestPath("根据应用AppId查询配置列表")
|
||||
@Operation(summary = "根据应用AppId查询配置列表")
|
||||
@GetMapping("/findAllByAppId")
|
||||
public Result<List<ChannelConfigResult>> findAllByAppId(String appId){
|
||||
return Res.ok(channelConfigService.findAllByAppId(appId));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package org.dromara.daxpay.service.controller.config;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import cn.bootx.platform.core.util.ValidationUtil;
|
||||
import org.dromara.daxpay.service.result.config.MerchantNotifyConfigResult;
|
||||
import org.dromara.daxpay.service.service.config.MerchantNotifyConfigService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.daxpay.service.param.config.NotifySubscribeParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商户通知配置控制器
|
||||
* @author xxm
|
||||
* @since 2024/8/2
|
||||
*/
|
||||
@RequestGroup(groupCode = "MerchantNotifyConfig", groupName = "商户通知配置", moduleCode = "PayConfig")
|
||||
@Tag(name = "商户订阅通知配置")
|
||||
@RestController
|
||||
@RequestMapping("/merchant/notify/config")
|
||||
@RequiredArgsConstructor
|
||||
public class MerchantNotifyConfigController {
|
||||
private final MerchantNotifyConfigService service;
|
||||
|
||||
@RequestPath("查询列表")
|
||||
@Operation(summary = "查询列表")
|
||||
@GetMapping("/findAllByAppId")
|
||||
public Result<List<MerchantNotifyConfigResult>> findAllByAppId(String appId) {
|
||||
return Res.ok(service.findAllByAppId(appId));
|
||||
}
|
||||
|
||||
@RequestPath("商户消息订阅配置")
|
||||
@Operation(summary = "商户消息订阅配置")
|
||||
@PostMapping("/subscribe")
|
||||
public Result<Void> subscribe(@RequestBody NotifySubscribeParam param) {
|
||||
ValidationUtil.validateParam(param);
|
||||
service.subscribe(param.getAppId(), param.getNotifyType(), param.isSubscribe());
|
||||
return Res.ok();
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package org.dromara.daxpay.service.controller.config;
|
||||
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.config.PlatformConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.PlatformConfigResult;
|
||||
import org.dromara.daxpay.service.service.config.PlatformConfigService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 平台配置
|
||||
* @author xxm
|
||||
* @since 2024/9/20
|
||||
*/
|
||||
@Tag(name = "平台配置")
|
||||
@RestController
|
||||
@RequestMapping("/platform/config")
|
||||
@RequiredArgsConstructor
|
||||
public class PlatformConfigController {
|
||||
private final PlatformConfigService platformConfigService;
|
||||
|
||||
@Operation(summary = "获取配置")
|
||||
@GetMapping("/get")
|
||||
public Result<PlatformConfigResult> get() {
|
||||
return Res.ok(platformConfigService.getConfig().toResult());
|
||||
}
|
||||
|
||||
@Operation(summary = "更新配置")
|
||||
@PostMapping("/update")
|
||||
public Result<Void> update(@RequestBody PlatformConfigParam param) {
|
||||
platformConfigService.update(param);
|
||||
return Res.ok();
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package org.dromara.daxpay.service.controller.constant;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.constant.ApiConstQuery;
|
||||
import org.dromara.daxpay.service.result.constant.ApiConstResult;
|
||||
import org.dromara.daxpay.service.service.constant.ApiConstService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 支付开放接口控制器
|
||||
* @author xxm
|
||||
* @since 2024/7/14
|
||||
*/
|
||||
@Tag(name = "支付开放接口控制器")
|
||||
@RestController
|
||||
@RequestMapping("/const/api")
|
||||
@RequiredArgsConstructor
|
||||
@RequestGroup(groupCode = "PayConst", groupName = "支付常量", moduleCode = "PayConfig")
|
||||
public class ApiConstController {
|
||||
private final ApiConstService apiConstService;
|
||||
|
||||
@RequestPath("支付开放接口分页")
|
||||
@Operation(summary = "支付开放接口分页")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<ApiConstResult>> page(PageParam pageParam, ApiConstQuery query) {
|
||||
return Res.ok(apiConstService.page(pageParam, query));
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package org.dromara.daxpay.service.controller.constant;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.constant.ChannelConstQuery;
|
||||
import org.dromara.daxpay.service.result.constant.ChannelConstResult;
|
||||
import org.dromara.daxpay.service.service.constant.ChannelConstService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 支付通道常量控制器
|
||||
* @author xxm
|
||||
* @since 2024/7/14
|
||||
*/
|
||||
@Tag(name = "支付通道常量控制器")
|
||||
@RestController
|
||||
@RequestMapping("/const/channel")
|
||||
@RequiredArgsConstructor
|
||||
@RequestGroup(groupCode = "PayConst", moduleCode = "PayConfig")
|
||||
public class ChannelConstController {
|
||||
private final ChannelConstService channelConstService;
|
||||
|
||||
@RequestPath("支付通道分页")
|
||||
@Operation(summary = "支付通道分页")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<ChannelConstResult>> page(PageParam pageParam, ChannelConstQuery query) {
|
||||
return Res.ok(channelConstService.page(pageParam, query));
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package org.dromara.daxpay.service.controller.constant;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.constant.MerchantNotifyConstQuery;
|
||||
import org.dromara.daxpay.service.result.constant.MerchantNotifyConstResult;
|
||||
import org.dromara.daxpay.service.service.constant.MerchantNotifyConstService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 商户订阅通知类型
|
||||
* @author xxm
|
||||
* @since 2024/8/5
|
||||
*/
|
||||
@RequestGroup(groupCode = "PayConst", moduleCode = "PayConfig")
|
||||
@Tag(name = "商户订阅通知类型")
|
||||
@RestController
|
||||
@RequestMapping("/const/merchant/notify")
|
||||
@RequiredArgsConstructor
|
||||
public class MerchantNotifyConstController {
|
||||
|
||||
private final MerchantNotifyConstService merchantNotifyConstService;
|
||||
|
||||
@RequestPath("商户订阅通知类型分页")
|
||||
@Operation(summary = "商户订阅通知类型分页")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<MerchantNotifyConstResult>> page(PageParam pageParam, MerchantNotifyConstQuery query) {
|
||||
return Res.ok(merchantNotifyConstService.page(pageParam, query));
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package org.dromara.daxpay.service.controller.constant;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.constant.MethodConstQuery;
|
||||
import org.dromara.daxpay.service.result.constant.MethodConstResult;
|
||||
import org.dromara.daxpay.service.service.constant.MethodConstService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 支付方式常量控制器
|
||||
* @author xxm
|
||||
* @since 2024/7/14
|
||||
*/
|
||||
@Tag(name = "支付方式常量控制器")
|
||||
@RestController
|
||||
@RequestMapping("/const/method")
|
||||
@RequiredArgsConstructor
|
||||
@RequestGroup(groupCode = "PayConst", moduleCode = "PayConfig")
|
||||
public class MethodConstController {
|
||||
private final MethodConstService methodConstService;
|
||||
|
||||
@RequestPath("支付方式分页")
|
||||
@Operation(summary = "支付方式分页")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<MethodConstResult>> page(PageParam pageParam, MethodConstQuery query) {
|
||||
return Res.ok(methodConstService.page(pageParam, query));
|
||||
}
|
||||
}
|
@@ -0,0 +1,81 @@
|
||||
package org.dromara.daxpay.service.controller.develop;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.core.param.trade.pay.PayParam;
|
||||
import org.dromara.daxpay.core.param.trade.refund.RefundParam;
|
||||
import org.dromara.daxpay.core.param.trade.transfer.TransferParam;
|
||||
import org.dromara.daxpay.core.result.trade.pay.PayResult;
|
||||
import org.dromara.daxpay.core.result.trade.refund.RefundResult;
|
||||
import org.dromara.daxpay.core.result.trade.transfer.TransferResult;
|
||||
import org.dromara.daxpay.service.service.develop.DevelopTradeService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 开发调试服务商
|
||||
* @author xxm
|
||||
* @since 2024/9/6
|
||||
*/
|
||||
@Validated
|
||||
@Tag(name = "交易开发调试服务")
|
||||
@RestController
|
||||
@RequestGroup(groupCode = "DevelopTrade", groupName = "交易开发调试服务", moduleCode = "develop", moduleName = "开发调试功能")
|
||||
@RequestMapping("/develop/trade")
|
||||
@RequiredArgsConstructor
|
||||
public class DevelopTradeController {
|
||||
private final DevelopTradeService developTradeService;
|
||||
|
||||
|
||||
@Operation(summary = "支付参数签名")
|
||||
@RequestPath("支付参数签名")
|
||||
@PostMapping("/sign/pay")
|
||||
public Result<String> paySign(@RequestBody PayParam param) {
|
||||
return Res.ok(developTradeService.genSign(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "退款参数签名")
|
||||
@RequestPath("退款参数签名")
|
||||
@PostMapping("/sign/refund")
|
||||
public Result<String> refundSign(@RequestBody RefundParam param) {
|
||||
return Res.ok(developTradeService.genSign(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "转账参数签名")
|
||||
@RequestPath("转账参数签名")
|
||||
@PostMapping("/sign/transfer")
|
||||
public Result<String> transferSign(@RequestBody TransferParam param) {
|
||||
return Res.ok(developTradeService.genSign(param));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "支付接口")
|
||||
@RequestPath("支付接口")
|
||||
@PostMapping("/pay")
|
||||
public Result<PayResult> pay(@RequestBody @Validated PayParam param){
|
||||
return Res.ok(developTradeService.pay(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "退款接口")
|
||||
@RequestPath("退款接口")
|
||||
@PostMapping("/refund")
|
||||
public Result<RefundResult> refund(@RequestBody @Validated RefundParam param){
|
||||
return Res.ok(developTradeService.refund(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "转账接口")
|
||||
@RequestPath("转账接口")
|
||||
@PostMapping("/transfer")
|
||||
public Result<TransferResult> transfer(@RequestBody @Validated TransferParam param){
|
||||
return Res.ok(developTradeService.transfer(param));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,85 @@
|
||||
package org.dromara.daxpay.service.controller.merchant;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.dto.LabelValue;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import cn.bootx.platform.core.util.ValidationUtil;
|
||||
import cn.bootx.platform.core.validation.ValidationGroup;
|
||||
import org.dromara.daxpay.service.param.merchant.MchAppParam;
|
||||
import org.dromara.daxpay.service.param.merchant.MchAppQuery;
|
||||
import org.dromara.daxpay.service.result.merchant.MchAppResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.daxpay.service.service.merchant.MchAppService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商户应用控制器
|
||||
* @author xxm
|
||||
* @since 2024/6/25
|
||||
*/
|
||||
@Validated
|
||||
@Tag(name = "商户应用控制器")
|
||||
@RestController
|
||||
@RequestMapping("/mch/app")
|
||||
@RequestGroup(groupCode = "merchant", groupName = "商户配置", moduleCode = "PayConfig")
|
||||
@RequiredArgsConstructor
|
||||
public class MchAppController {
|
||||
private final MchAppService mchAppService;
|
||||
|
||||
@RequestPath("新增商户应用")
|
||||
@Operation(summary = "新增商户应用")
|
||||
@PostMapping("/add")
|
||||
public Result<Void> add(@RequestBody MchAppParam param){
|
||||
ValidationUtil.validateParam(param, ValidationGroup.add.class);
|
||||
mchAppService.add(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("修改商户应用")
|
||||
@Operation(summary = "修改商户应用")
|
||||
@PostMapping("/update")
|
||||
public Result<Void> update(@RequestBody MchAppParam param){
|
||||
ValidationUtil.validateParam(param, ValidationGroup.edit.class);
|
||||
mchAppService.update(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("商户应用分页")
|
||||
@Operation(summary = "商户应用分页")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<MchAppResult>> page(PageParam pageParam, MchAppQuery param){
|
||||
return Res.ok(mchAppService.page(pageParam, param));
|
||||
}
|
||||
|
||||
@RequestPath("根据id查询商户应用")
|
||||
@Operation(summary = "根据id查询商户应用")
|
||||
@GetMapping("/findById")
|
||||
public Result<MchAppResult> findById(@NotNull(message = "id不可为空")Long id){
|
||||
return Res.ok(mchAppService.findById(id));
|
||||
}
|
||||
|
||||
@RequestPath("删除商户应用")
|
||||
@Operation(summary = "删除商户应用")
|
||||
@PostMapping("/delete")
|
||||
public Result<Void> delete(@NotNull(message = "id不可为空") Long id){
|
||||
mchAppService.delete(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("根据商户号查询商户应用下拉列表")
|
||||
@Operation(summary = "根据商户号查询商户应用下拉列表")
|
||||
@GetMapping("/dropdown")
|
||||
public Result<List<LabelValue>> dropdown(){
|
||||
return Res.ok(mchAppService.dropdown());
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
package org.dromara.daxpay.service.controller.notice;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.notice.callback.MerchantCallbackTaskQuery;
|
||||
import org.dromara.daxpay.service.result.notice.callback.MerchantCallbackRecordResult;
|
||||
import org.dromara.daxpay.service.result.notice.callback.MerchantCallbackTaskResult;
|
||||
import org.dromara.daxpay.service.service.notice.callback.MerchantCallbackQueryService;
|
||||
import org.dromara.daxpay.service.service.notice.callback.MerchantCallbackSendService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 商户回调消息控制器
|
||||
* @author xxm
|
||||
* @since 2024/8/5
|
||||
*/
|
||||
@RequestGroup(groupCode = "MerchantCallback", groupName = "商户回调通知", moduleCode = "MerchantNotice", moduleName = "商户通知")
|
||||
@Tag(name = "商户回调通知控制器")
|
||||
@RestController
|
||||
@RequestMapping("/merchant/notice/callback")
|
||||
@RequiredArgsConstructor
|
||||
public class MerchantCallbackController {
|
||||
|
||||
private final MerchantCallbackQueryService queryService;
|
||||
|
||||
private final MerchantCallbackSendService sendService;
|
||||
|
||||
@RequestPath("发送回调消息")
|
||||
@Operation(summary = "发送回调消息")
|
||||
@PostMapping("/send")
|
||||
public Result<Void> send(Long taskId) {
|
||||
sendService.send(taskId);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("任务分页")
|
||||
@Operation(summary = "任务分页")
|
||||
@GetMapping("/task/page")
|
||||
public Result<PageResult<MerchantCallbackTaskResult>> page(PageParam param, MerchantCallbackTaskQuery query) {
|
||||
return Res.ok(queryService.page(param,query));
|
||||
}
|
||||
|
||||
@RequestPath("任务详情")
|
||||
@Operation(summary = "任务详情")
|
||||
@GetMapping("/task/findById")
|
||||
public Result<MerchantCallbackTaskResult> findById(Long id) {
|
||||
return Res.ok(queryService.findById(id));
|
||||
}
|
||||
|
||||
@RequestPath("发送记录分页")
|
||||
@Operation(summary = "发送记录分页")
|
||||
@GetMapping("/record/page")
|
||||
public Result<PageResult<MerchantCallbackRecordResult>> pageRecord(PageParam param, Long taskId) {
|
||||
return Res.ok(queryService.pageRecord(param,taskId));
|
||||
}
|
||||
|
||||
@RequestPath("发送记录详情")
|
||||
@Operation(summary = "发送记录详情")
|
||||
@GetMapping("/record/findById")
|
||||
public Result<MerchantCallbackRecordResult> findRecordById(Long id) {
|
||||
return Res.ok(queryService.findRecordById(id));
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
package org.dromara.daxpay.service.controller.notice;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.notice.notify.MerchantNotifyTaskQuery;
|
||||
import org.dromara.daxpay.service.result.notice.notify.MerchantNotifyRecordResult;
|
||||
import org.dromara.daxpay.service.result.notice.notify.MerchantNotifyTaskResult;
|
||||
import org.dromara.daxpay.service.service.notice.notify.MerchantNotifyQueryService;
|
||||
import org.dromara.daxpay.service.service.notice.notify.MerchantNotifySendService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 商户订阅通知消息控制器
|
||||
* @author xxm
|
||||
* @since 2024/8/5
|
||||
*/
|
||||
@RequestGroup(groupCode = "MerchantNotify", groupName = "商户订阅通知", moduleCode = "MerchantNotice")
|
||||
@Tag(name = "商户订阅通知控制器")
|
||||
@RestController
|
||||
@RequestMapping("/merchant/notice/notify")
|
||||
@RequiredArgsConstructor
|
||||
public class MerchantNotifyController {
|
||||
private final MerchantNotifyQueryService queryService;
|
||||
|
||||
private final MerchantNotifySendService sendService;
|
||||
|
||||
@RequestPath("发送订阅消息")
|
||||
@Operation(summary = "发送订阅消息")
|
||||
@PostMapping("/send")
|
||||
public Result<Void> send(Long taskId) {
|
||||
sendService.send(taskId);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("任务分页")
|
||||
@Operation(summary = "任务分页")
|
||||
@GetMapping("/task/page")
|
||||
public Result<PageResult<MerchantNotifyTaskResult>> page(PageParam param, MerchantNotifyTaskQuery query) {
|
||||
return Res.ok(queryService.page(param,query));
|
||||
}
|
||||
|
||||
@RequestPath("任务详情")
|
||||
@Operation(summary = "任务详情")
|
||||
@GetMapping("/task/findById")
|
||||
public Result<MerchantNotifyTaskResult> findById(Long id) {
|
||||
return Res.ok(queryService.findById(id));
|
||||
}
|
||||
|
||||
@RequestPath("发送记录分页")
|
||||
@Operation(summary = "发送记录分页")
|
||||
@GetMapping("/record/page")
|
||||
public Result<PageResult<MerchantNotifyRecordResult>> pageRecord(PageParam param, Long taskId) {
|
||||
return Res.ok(queryService.pageRecord(param,taskId));
|
||||
}
|
||||
|
||||
@RequestPath("发送记录详情")
|
||||
@Operation(summary = "发送记录详情")
|
||||
@GetMapping("/record/findById")
|
||||
public Result<MerchantNotifyRecordResult> findRecordById(Long id) {
|
||||
return Res.ok(queryService.findRecordById(id));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,100 @@
|
||||
package org.dromara.daxpay.service.controller.order;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.exception.DataNotExistException;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
||||
import org.dromara.daxpay.service.param.order.pay.PayOrderQuery;
|
||||
import org.dromara.daxpay.service.result.order.pay.PayOrderVo;
|
||||
import org.dromara.daxpay.service.service.order.pay.PayOrderQueryService;
|
||||
import org.dromara.daxpay.service.service.order.pay.PayOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 支付订单控制器
|
||||
* @author xxm
|
||||
* @since 2024/1/9
|
||||
*/
|
||||
@Validated
|
||||
@Tag(name = "支付订单控制器")
|
||||
@RestController
|
||||
@RequestMapping("/order/pay")
|
||||
@RequestGroup(moduleCode = "TradeOrder", moduleName = "交易订单", groupCode = "PayOrder", groupName = "支付订单")
|
||||
@RequiredArgsConstructor
|
||||
public class PayOrderController {
|
||||
private final PayOrderQueryService queryService;
|
||||
private final PayOrderService payOrderService;
|
||||
|
||||
@RequestPath("分页查询")
|
||||
@Operation(summary = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<PayOrderVo>> page(PageParam pageParam, PayOrderQuery param){
|
||||
return Res.ok(queryService.page(pageParam,param));
|
||||
}
|
||||
|
||||
@RequestPath("查询订单详情")
|
||||
@Operation(summary = "查询订单详情")
|
||||
@GetMapping("/findById")
|
||||
public Result<PayOrderVo> findById(@NotNull(message = "支付订单id不能为空") Long id){
|
||||
PayOrderVo order = queryService.findById(id)
|
||||
.map(PayOrder::toResult)
|
||||
.orElseThrow(() -> new DataNotExistException("支付订单不存在"));
|
||||
return Res.ok(order);
|
||||
}
|
||||
|
||||
@RequestPath("根据订单号查询详情")
|
||||
@Operation(summary = "根据订单号查询详情")
|
||||
@GetMapping("/findByOrderNo")
|
||||
public Result<PayOrderVo> findByOrderNo(@NotBlank(message = "支付订单号不能为空") String orderNo){
|
||||
PayOrderVo order = queryService.findByOrderNo(orderNo)
|
||||
.map(PayOrder::toResult)
|
||||
.orElseThrow(() -> new DataNotExistException("支付订单不存在"));
|
||||
return Res.ok(order);
|
||||
}
|
||||
|
||||
@RequestPath("查询金额汇总")
|
||||
@Operation(summary = "查询金额汇总")
|
||||
@GetMapping("/getTotalAmount")
|
||||
public Result<BigDecimal> getTotalAmount(PayOrderQuery param){
|
||||
return Res.ok(queryService.getTotalAmount(param));
|
||||
}
|
||||
|
||||
@RequestPath("同步支付订单状态")
|
||||
@Operation(summary = "同步支付订单状态")
|
||||
@PostMapping("/sync")
|
||||
public Result<Void> sync(@NotNull(message = "支付订单id不能为空") Long id){
|
||||
payOrderService.sync(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("关闭支付订单")
|
||||
@Operation(summary = "关闭支付订单")
|
||||
@PostMapping("/close")
|
||||
public Result<Void> close(@NotNull(message = "支付订单id不能为空") Long id){
|
||||
payOrderService.close(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("撤销支付订单")
|
||||
@Operation(summary = "撤销支付订单")
|
||||
@PostMapping("/cancel")
|
||||
public Result<Void> cancel(@NotNull(message = "支付订单id不能为空") Long id){
|
||||
payOrderService.cancel(id);
|
||||
return Res.ok();
|
||||
}
|
||||
}
|
@@ -0,0 +1,99 @@
|
||||
package org.dromara.daxpay.service.controller.order;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.order.refund.RefundCreateParam;
|
||||
import org.dromara.daxpay.service.param.order.refund.RefundOrderQuery;
|
||||
import org.dromara.daxpay.service.result.order.refund.RefundOrderVo;
|
||||
import org.dromara.daxpay.service.service.order.refund.RefundOrderQueryService;
|
||||
import org.dromara.daxpay.service.service.order.refund.RefundOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 支付退款控制器
|
||||
* @author xxm
|
||||
* @since 2024/1/9
|
||||
*/
|
||||
@Validated
|
||||
@Tag(name = "退款订单控制器")
|
||||
@RestController
|
||||
@RequestMapping("/order/refund")
|
||||
@RequestGroup(moduleCode = "TradeOrder", groupCode = "RefundOrder", groupName = "退款订单")
|
||||
@RequiredArgsConstructor
|
||||
public class RefundOrderController {
|
||||
private final RefundOrderQueryService queryService;
|
||||
private final RefundOrderService refundOrderService;
|
||||
|
||||
@RequestPath("退款订单分页查询")
|
||||
@Operation(summary = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<RefundOrderVo>> page(PageParam pageParam, RefundOrderQuery query){
|
||||
return Res.ok(queryService.page(pageParam, query));
|
||||
}
|
||||
|
||||
@RequestPath("根据商户退款号查询")
|
||||
@Operation(summary = "查询退款订单详情")
|
||||
@GetMapping("/findByRefundNo")
|
||||
public Result<RefundOrderVo> findByRefundNo(@NotBlank(message = "退款号不可为空") String refundNo){
|
||||
return Res.ok(queryService.findByRefundNo(refundNo));
|
||||
}
|
||||
|
||||
@RequestPath("根据ID查询")
|
||||
@Operation(summary = "查询单条")
|
||||
@GetMapping("/findById")
|
||||
public Result<RefundOrderVo> findById(@NotNull(message = "退款ID不可为空") Long id){
|
||||
return Res.ok(queryService.findById(id));
|
||||
}
|
||||
|
||||
@RequestPath("查询金额汇总")
|
||||
@Operation(summary = "查询金额汇总")
|
||||
@GetMapping("/getTotalAmount")
|
||||
public Result<BigDecimal> getTotalAmount(RefundOrderQuery param){
|
||||
return Res.ok(queryService.getTotalAmount(param));
|
||||
}
|
||||
|
||||
@RequestPath("发起退款")
|
||||
@Operation(summary = "发起退款")
|
||||
@PostMapping("/create")
|
||||
public Result<Void> create(@Validated @RequestBody RefundCreateParam param){
|
||||
refundOrderService.create(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("退款同步")
|
||||
@Operation(summary = "退款同步")
|
||||
@PostMapping("/sync")
|
||||
public Result<Void> sync(@NotNull(message = "退款ID不可为空") Long id){
|
||||
refundOrderService.sync(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("退款重试")
|
||||
@Operation(summary = "退款重试")
|
||||
@PostMapping("/retry")
|
||||
public Result<Void> retry(@NotNull(message = "退款ID不可为空") Long id){
|
||||
refundOrderService.retry(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("退款关闭")
|
||||
@Operation(summary = "退款关闭")
|
||||
@PostMapping("/close")
|
||||
public Result<Void> close(@NotNull(message = "退款ID不可为空") Long id){
|
||||
refundOrderService.close(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,98 @@
|
||||
package org.dromara.daxpay.service.controller.order;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.order.transfer.TransferOrderQuery;
|
||||
import org.dromara.daxpay.service.result.order.transfer.TransferOrderVo;
|
||||
import org.dromara.daxpay.service.service.order.transfer.TransferOrderQueryService;
|
||||
import org.dromara.daxpay.service.service.order.transfer.TransferOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 转账订单控制器
|
||||
* @author xxm
|
||||
* @since 2024/6/17
|
||||
*/
|
||||
@Tag(name = "转账订单控制器")
|
||||
@RestController
|
||||
@RequestMapping("/order/transfer")
|
||||
@RequestGroup(moduleCode = "TradeOrder", groupCode = "TransferOrder", groupName = "转账订单")
|
||||
@RequiredArgsConstructor
|
||||
public class TransferOrderController {
|
||||
private final TransferOrderQueryService queryService;
|
||||
private final TransferOrderService transferOrderService;
|
||||
|
||||
@RequestPath("分页查询")
|
||||
@Operation(summary = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<TransferOrderVo>> page(PageParam pageParam, TransferOrderQuery query){
|
||||
return Res.ok(queryService.page(pageParam, query));
|
||||
}
|
||||
|
||||
@RequestPath("根据转账号查询")
|
||||
@Operation(summary = "根据转账号查询")
|
||||
@GetMapping("/findByTransferNo")
|
||||
public Result<TransferOrderVo> findByTransferNo(String transferNo){
|
||||
return Res.ok(queryService.findByTransferNo(transferNo));
|
||||
}
|
||||
|
||||
@RequestPath("根据商户转账号查询")
|
||||
@Operation(summary = "根据商户转账号查询")
|
||||
@GetMapping("/findByBizTransferNo")
|
||||
public Result<TransferOrderVo> findByBizTransferNo(String bizTransferNo){
|
||||
return Res.ok(queryService.findByBizTransferNo(bizTransferNo));
|
||||
}
|
||||
|
||||
@RequestPath("查询单条")
|
||||
@Operation(summary = "查询单条")
|
||||
@GetMapping("/findById")
|
||||
public Result<TransferOrderVo> findById(Long id){
|
||||
return Res.ok(queryService.findById(id));
|
||||
}
|
||||
|
||||
|
||||
@RequestPath("查询金额汇总")
|
||||
@Operation(summary = "查询金额汇总")
|
||||
@GetMapping("/getTotalAmount")
|
||||
public Result<BigDecimal> getTotalAmount(TransferOrderQuery param){
|
||||
return Res.ok(queryService.getTotalAmount(param));
|
||||
}
|
||||
|
||||
|
||||
@RequestPath("转账同步")
|
||||
@Operation(summary = "转账同步")
|
||||
@PostMapping("/sync")
|
||||
public Result<Void> sync(@NotNull(message = "转账ID不可为空") Long id){
|
||||
transferOrderService.sync(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("转账重试")
|
||||
@Operation(summary = "转账重试")
|
||||
@PostMapping("/retry")
|
||||
public Result<Void> retry(@NotNull(message = "转账ID不可为空") Long id){
|
||||
transferOrderService.retry(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("转账关闭")
|
||||
@Operation(summary = "转账关闭")
|
||||
@PostMapping("/close")
|
||||
public Result<Void> close(@NotNull(message = "转账ID不可为空") Long id){
|
||||
transferOrderService.close(id);
|
||||
return Res.ok();
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
package org.dromara.daxpay.service.controller.reconcile;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.reconcile.ReconcileDiscrepancyQuery;
|
||||
import org.dromara.daxpay.service.result.reconcile.ReconcileDiscrepancyResult;
|
||||
import org.dromara.daxpay.service.service.reconcile.ReconcileDiscrepancyService;
|
||||
import com.fhs.core.trans.anno.TransMethodResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 对账差异记录
|
||||
* @author xxm
|
||||
* @since 2024/8/7
|
||||
*/
|
||||
@RequestGroup(moduleCode = "reconcile",moduleName = "对账服务", groupCode = "ReconcileDiscrepancy", groupName = "对账差异记录")
|
||||
@Tag(name = "对账差异记录")
|
||||
@RestController
|
||||
@RequestMapping("/reconcile/discrepancy")
|
||||
@RequiredArgsConstructor
|
||||
public class ReconcileDiscrepancyController {
|
||||
private final ReconcileDiscrepancyService reconcileDiscrepancyService;
|
||||
|
||||
@TransMethodResult
|
||||
@RequestPath("对账差异记录分页")
|
||||
@Operation(summary = "对账差异记录分页")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<ReconcileDiscrepancyResult>> page(PageParam pageParam, ReconcileDiscrepancyQuery query){
|
||||
return Res.ok(reconcileDiscrepancyService.page(pageParam,query));
|
||||
}
|
||||
|
||||
@TransMethodResult
|
||||
@RequestPath("查询对账差异记录")
|
||||
@Operation(summary = "查询对账差异记录")
|
||||
@GetMapping("/findById")
|
||||
public Result<ReconcileDiscrepancyResult> findById(Long id){
|
||||
return Res.ok(reconcileDiscrepancyService.findById(id));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package org.dromara.daxpay.service.controller.reconcile;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.reconcile.ReconcileCreatParam;
|
||||
import org.dromara.daxpay.service.service.reconcile.ReconcileStatementService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 对账服务控制器(管理端)
|
||||
* @author xxm
|
||||
* @since 2024/8/7
|
||||
*/
|
||||
@Validated
|
||||
@RequestGroup(moduleCode = "reconcile",moduleName = "对账服务", groupCode = "ReconcileStatement", groupName = "对账单")
|
||||
@Tag(name = "对账服务控制器")
|
||||
@RestController
|
||||
@RequestMapping("/reconcile/statement")
|
||||
@RequiredArgsConstructor
|
||||
public class ReconcileStatementAdminController {
|
||||
private final ReconcileStatementService statementService;
|
||||
|
||||
@RequestPath("手动创建对账订单")
|
||||
@Operation(summary = "手动创建对账订单")
|
||||
@PostMapping("/create")
|
||||
public Result<Void> create(@RequestBody @Validated ReconcileCreatParam param){
|
||||
statementService.create(param);
|
||||
return Res.ok();
|
||||
}
|
||||
}
|
@@ -0,0 +1,76 @@
|
||||
package org.dromara.daxpay.service.controller.reconcile;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import cn.bootx.platform.core.util.ValidationUtil;
|
||||
import org.dromara.daxpay.service.param.reconcile.ReconcileStatementQuery;
|
||||
import org.dromara.daxpay.service.param.reconcile.ReconcileUploadParam;
|
||||
import org.dromara.daxpay.service.result.reconcile.ReconcileStatementResult;
|
||||
import org.dromara.daxpay.service.service.reconcile.ReconcileStatementQueryService;
|
||||
import org.dromara.daxpay.service.service.reconcile.ReconcileStatementService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 对账服务控制器
|
||||
* @author xxm
|
||||
* @since 2024/8/7
|
||||
*/
|
||||
@Validated
|
||||
@RequestGroup(moduleCode = "reconcile",moduleName = "对账服务", groupCode = "ReconcileStatement", groupName = "对账单")
|
||||
@Tag(name = "对账服务控制器")
|
||||
@RestController
|
||||
@RequestMapping("/reconcile/statement")
|
||||
@RequiredArgsConstructor
|
||||
public class ReconcileStatementController {
|
||||
private final ReconcileStatementService statementService;
|
||||
private final ReconcileStatementQueryService queryService;
|
||||
|
||||
@RequestPath("手动触发对账文件下载")
|
||||
@Operation(summary = "手动触发对账文件下载")
|
||||
@PostMapping("/downAndSave")
|
||||
public Result<Void> downAndSave(@NotNull(message = "对账单ID不能为空") Long id){
|
||||
statementService.downAndSave(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("手动上传交易对账单文件")
|
||||
@Operation(summary = "手动上传交易对账单文件")
|
||||
@PostMapping("/upload")
|
||||
public Result<Void> upload(ReconcileUploadParam param, @RequestPart MultipartFile file){
|
||||
ValidationUtil.validateParam(param);
|
||||
statementService.uploadAndSave(param,file);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("手动触发交易对账单比对")
|
||||
@Operation(summary = "手动触发交易对账单比对")
|
||||
@PostMapping("/compare")
|
||||
public Result<Void> compare(@NotNull(message = "对账单ID不能为空") Long id){
|
||||
statementService.compare(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("对账单分页")
|
||||
@Operation(summary = "对账单分页")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<ReconcileStatementResult>> page(PageParam pageParam, ReconcileStatementQuery query){
|
||||
return Res.ok(queryService.page(pageParam,query));
|
||||
}
|
||||
|
||||
@RequestPath("查询对账单")
|
||||
@Operation(summary = "查询对账单")
|
||||
@GetMapping("/findById")
|
||||
public Result<ReconcileStatementResult> findById(@NotNull(message = "对账单ID不能为空") Long id){
|
||||
return Res.ok(queryService.findById(id));
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package org.dromara.daxpay.service.controller.record;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.record.TradeCallbackRecordQuery;
|
||||
import org.dromara.daxpay.service.result.record.callback.TradeCallbackRecordResult;
|
||||
import org.dromara.daxpay.service.service.record.callback.TradeCallbackRecordService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 交易记录
|
||||
* @author xxm
|
||||
* @since 2024/7/24
|
||||
*/
|
||||
@Tag(name = "交易记录")
|
||||
@RestController
|
||||
@RequestGroup(moduleCode = "TradeRecord", moduleName = "交易记录", groupCode = "TradeCallback", groupName = "交易回调记录")
|
||||
@RequestMapping("/record/callback")
|
||||
@RequiredArgsConstructor
|
||||
public class CallbackRecordController {
|
||||
private final TradeCallbackRecordService service;
|
||||
|
||||
@RequestPath("分页查询")
|
||||
@Operation(summary = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<TradeCallbackRecordResult>> page(PageParam pageParam, TradeCallbackRecordQuery query){
|
||||
return Res.ok(service.page(pageParam, query));
|
||||
}
|
||||
|
||||
@RequestPath("查询单条")
|
||||
@Operation(summary = "查询单条")
|
||||
@GetMapping("/findById")
|
||||
public Result<TradeCallbackRecordResult> findById(Long id){
|
||||
return Res.ok(service.findById(id));
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package org.dromara.daxpay.service.controller.record;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.record.PayCloseRecordQuery;
|
||||
import org.dromara.daxpay.service.result.record.close.PayCloseRecordResult;
|
||||
import org.dromara.daxpay.service.service.record.close.PayCloseRecordService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 支付订单关闭记录
|
||||
* @author xxm
|
||||
* @since 2024/1/9
|
||||
*/
|
||||
@Tag(name = "支付订单关闭记录")
|
||||
@RestController
|
||||
@RequestMapping("/record/close")
|
||||
@RequestGroup(moduleCode = "TradeRecord", groupCode = "CloseRecord", groupName = "支付关闭记录")
|
||||
@RequiredArgsConstructor
|
||||
public class PayCloseRecordController {
|
||||
private final PayCloseRecordService service;
|
||||
|
||||
@RequestPath("分页查询")
|
||||
@Operation(summary = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<PayCloseRecordResult>> page(PageParam pageParam, PayCloseRecordQuery query){
|
||||
return Res.ok(service.page(pageParam, query));
|
||||
}
|
||||
|
||||
@RequestPath("查询单条")
|
||||
@Operation(summary = "查询单条")
|
||||
@GetMapping("/findById")
|
||||
public Result<PayCloseRecordResult> findById(Long id){
|
||||
return Res.ok(service.findById(id));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package org.dromara.daxpay.service.controller.record;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.record.TradeFlowRecordQuery;
|
||||
import org.dromara.daxpay.service.result.record.flow.TradeFlowAmountResult;
|
||||
import org.dromara.daxpay.service.result.record.flow.TradeFlowRecordResult;
|
||||
import org.dromara.daxpay.service.service.record.flow.TradeFlowRecordService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 交易流水记录控制器
|
||||
* @author xxm
|
||||
* @since 2024/5/17
|
||||
*/
|
||||
@Tag(name = "交易流水记录控制器")
|
||||
@RestController
|
||||
@RequestMapping("/record/flow")
|
||||
@RequestGroup(moduleCode = "TradeRecord", groupCode = "TradeFlow", groupName = "交易流水记录")
|
||||
@RequiredArgsConstructor
|
||||
public class TradeFlowRecordController {
|
||||
private final TradeFlowRecordService service;
|
||||
|
||||
@RequestPath("分页查询")
|
||||
@Operation(summary = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<TradeFlowRecordResult>> page(PageParam pageParam, TradeFlowRecordQuery query) {
|
||||
return Res.ok(service.page(pageParam, query));
|
||||
}
|
||||
|
||||
@RequestPath("查询单条")
|
||||
@Operation(summary = "查询单条")
|
||||
@GetMapping("/findById")
|
||||
public Result<TradeFlowRecordResult> findById(Long id) {
|
||||
return Res.ok(service.findById(id));
|
||||
}
|
||||
|
||||
@RequestPath("查询各类金额汇总")
|
||||
@Operation(summary = "查询各类金额汇总")
|
||||
@GetMapping("/summary")
|
||||
public Result<TradeFlowAmountResult> summary(TradeFlowRecordQuery query) {
|
||||
return Res.ok(service.summary(query));
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package org.dromara.daxpay.service.controller.record;
|
||||
|
||||
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||
import cn.bootx.platform.core.annotation.RequestPath;
|
||||
import cn.bootx.platform.core.rest.Res;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.bootx.platform.core.rest.result.Result;
|
||||
import org.dromara.daxpay.service.param.record.TradeSyncRecordQuery;
|
||||
import org.dromara.daxpay.service.result.record.sync.TradeSyncRecordResult;
|
||||
import org.dromara.daxpay.service.service.record.sync.TradeSyncRecordService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 交易同步记录
|
||||
* @author xxm
|
||||
* @since 2024/8/17
|
||||
*/
|
||||
@Tag(name = "交易同步记录")
|
||||
@RestController
|
||||
@RequestGroup(moduleCode = "TradeRecord", groupCode = "TradeSync", groupName = "交易同步记录")
|
||||
@RequestMapping("/record/sync")
|
||||
@RequiredArgsConstructor
|
||||
public class TradeSyncRecordController {
|
||||
private final TradeSyncRecordService service;
|
||||
|
||||
|
||||
@RequestPath("分页查询")
|
||||
@Operation(summary = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<TradeSyncRecordResult>> page(PageParam pageParam, TradeSyncRecordQuery query) {
|
||||
return Res.ok(service.page(pageParam, query));
|
||||
}
|
||||
|
||||
@RequestPath("查询单条")
|
||||
@Operation(summary = "查询单条")
|
||||
@GetMapping("/findById")
|
||||
public Result<TradeSyncRecordResult> findById(Long id) {
|
||||
return Res.ok(service.findById(id));
|
||||
}
|
||||
}
|
@@ -0,0 +1,113 @@
|
||||
package org.dromara.daxpay.service.service.merchant;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.exception.BizException;
|
||||
import cn.bootx.platform.core.rest.dto.LabelValue;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.core.rest.result.PageResult;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.daxpay.core.exception.ConfigNotExistException;
|
||||
import org.dromara.daxpay.core.exception.OperationFailException;
|
||||
import org.dromara.daxpay.service.convert.merchant.MchAppConvert;
|
||||
import org.dromara.daxpay.service.dao.config.ChannelConfigManager;
|
||||
import org.dromara.daxpay.service.dao.merchant.MchAppManager;
|
||||
import org.dromara.daxpay.service.entity.config.ChannelConfig;
|
||||
import org.dromara.daxpay.service.entity.merchant.MchApp;
|
||||
import org.dromara.daxpay.service.enums.MchAppStautsEnum;
|
||||
import org.dromara.daxpay.service.param.merchant.MchAppParam;
|
||||
import org.dromara.daxpay.service.param.merchant.MchAppQuery;
|
||||
import org.dromara.daxpay.service.result.merchant.MchAppResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 商户应用服务类
|
||||
* @author xxm
|
||||
* @since 2024/5/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MchAppService {
|
||||
|
||||
private final MchAppManager mchAppManager;
|
||||
|
||||
private final ChannelConfigManager channelConfigManager;
|
||||
|
||||
/**
|
||||
* 添加应用
|
||||
*/
|
||||
public void add(MchAppParam param) {
|
||||
MchApp entity = MchAppConvert.CONVERT.toEntity(param);
|
||||
// 生成应用号
|
||||
entity.setAppId(this.generateAppId())
|
||||
.setStatus(MchAppStautsEnum.ENABLE.getCode());
|
||||
mchAppManager.save(entity);
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public void update(MchAppParam param) {
|
||||
MchApp mchApp = mchAppManager.findById(param.getId()).orElseThrow(ConfigNotExistException::new);
|
||||
BeanUtil.copyProperties(param, mchApp, CopyOptions.create().ignoreNullValue());
|
||||
mchAppManager.updateById(mchApp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public PageResult<MchAppResult> page(PageParam pageParam, MchAppQuery query) {
|
||||
return MpUtil.toPageResult(mchAppManager.page(pageParam, query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条
|
||||
*/
|
||||
public MchAppResult findById(Long id) {
|
||||
return mchAppManager.findById(id).map(MchApp::toResult).orElseThrow(ConfigNotExistException::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉列表
|
||||
*/
|
||||
public List<LabelValue> dropdown(){
|
||||
return mchAppManager.findAll().stream()
|
||||
.map(o->new LabelValue(o.getAppName(),o.getAppId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public void delete(Long id) {
|
||||
MchApp mchApp = mchAppManager.findById(id)
|
||||
.orElseThrow(ConfigNotExistException::new);
|
||||
|
||||
// 查看是否有配置的支付配置
|
||||
if (channelConfigManager.existedByField(ChannelConfig::getAppId, mchApp.getAppId())){
|
||||
throw new OperationFailException("该商户应用已绑定支付配置,请先删除支付配置");
|
||||
}
|
||||
|
||||
mchAppManager.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成应用号
|
||||
*/
|
||||
private String generateAppId() {
|
||||
String mchNo = RandomUtil.randomNumbers(16);
|
||||
for (int i = 0; i < 10; i++){
|
||||
if (!mchAppManager.existedByField(MchApp::getAppId, mchNo)){
|
||||
return "A"+mchNo;
|
||||
}
|
||||
mchNo = String.valueOf(System.currentTimeMillis());
|
||||
}
|
||||
throw new BizException("应用号生成失败");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user