mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-07 21:17:42 +00:00
feat(checkout): 新增收银台配置和支付功能
- 添加收银台配置相关枚举类 - 实现收银台配置和支付的接口和逻辑 - 新增聚合支付配置和支付方式 - 优化收银台订单和配置信息的获取
This commit is contained in:
@@ -11,8 +11,8 @@ import org.dromara.daxpay.service.param.config.cashier.CashierCodeConfigParam;
|
||||
import org.dromara.daxpay.service.param.config.cashier.CashierCodeTypeConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.cashier.CashierCodeConfigResult;
|
||||
import org.dromara.daxpay.service.result.config.cashier.CashierCodeTypeConfigResult;
|
||||
import org.dromara.daxpay.service.service.config.CashierCodeConfigService;
|
||||
import org.dromara.daxpay.service.service.config.CashierCodeTypeConfigService;
|
||||
import org.dromara.daxpay.service.service.config.cashier.CashierCodeConfigService;
|
||||
import org.dromara.daxpay.service.service.config.cashier.CashierCodeTypeConfigService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
@@ -0,0 +1,170 @@
|
||||
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 io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutAggregateConfigParam;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutConfigParam;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutGroupConfigParam;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutItemConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutAggregateConfigVo;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutConfigVo;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutGroupConfigVo;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutItemConfigVo;
|
||||
import org.dromara.daxpay.service.service.config.checkout.CheckoutConfigQueryService;
|
||||
import org.dromara.daxpay.service.service.config.checkout.CheckoutConfigService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 支付配置控制器
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@Tag(name = "收银台配置配置")
|
||||
@RestController
|
||||
@RequestGroup(groupCode = "channelConfig", groupName = "通道配置", moduleCode = "PayConfig", moduleName = "支付配置")
|
||||
@RequestMapping("/checkout/config")
|
||||
@RequiredArgsConstructor
|
||||
public class CheckoutConfigController {
|
||||
private final CheckoutConfigQueryService checkoutConfigQueryService;
|
||||
private final CheckoutConfigService checkoutConfigService;
|
||||
|
||||
@RequestPath("获取收银台配置")
|
||||
@Operation(summary = "获取收银台配置")
|
||||
@GetMapping("/get")
|
||||
public Result<CheckoutConfigVo> getConfig(String appid) {
|
||||
return Res.ok(checkoutConfigQueryService.getConfig(appid));
|
||||
}
|
||||
|
||||
@RequestPath("保存收银台配置")
|
||||
@Operation(summary = "保存收银台配置")
|
||||
@PostMapping("/save")
|
||||
public Result<Void> saveConfig(@RequestBody CheckoutConfigParam param) {
|
||||
checkoutConfigService.saveCheckoutConfig(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("更新收银台配置")
|
||||
@Operation(summary = "更新收银台配置")
|
||||
@PostMapping("/update")
|
||||
public Result<Void> updateConfig(@RequestBody CheckoutConfigParam param) {
|
||||
checkoutConfigService.updateCheckoutConfig(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
|
||||
@RequestPath("获取分组配置")
|
||||
@Operation(summary = "获取分组配置")
|
||||
@GetMapping("/group/get")
|
||||
public Result<List<CheckoutGroupConfigVo>> getGroupConfigs(String appid, String checkoutType) {
|
||||
return Res.ok(checkoutConfigQueryService.getGroupConfigs(appid,checkoutType));
|
||||
}
|
||||
|
||||
@RequestPath("保存分组配置")
|
||||
@Operation(summary = "保存分组配置")
|
||||
@PostMapping("/group/save")
|
||||
public Result<Void> saveCheckoutGroupConfig(@RequestBody CheckoutGroupConfigParam param) {
|
||||
checkoutConfigService.saveCheckoutGroupConfig(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("更新分组配置")
|
||||
@Operation(summary = "更新分组配置")
|
||||
@PostMapping("/group/update")
|
||||
public Result<Void> updateCheckoutGroupConfig(@RequestBody CheckoutGroupConfigParam param) {
|
||||
checkoutConfigService.updateCheckoutGroupConfig(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("删除分组配置")
|
||||
@Operation(summary = "删除分组配置")
|
||||
@PostMapping("/group/delete")
|
||||
public Result<Void> deleteCheckoutGroupConfig(Long id) {
|
||||
checkoutConfigService.deleteCheckoutGroupConfig(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("获取配置项配置")
|
||||
@Operation(summary = "获取配置项配置")
|
||||
@GetMapping("/item/get")
|
||||
public Result<List<CheckoutItemConfigVo>> getItemConfigs(Long groupId) {
|
||||
return Res.ok(checkoutConfigQueryService.getItemConfigs(groupId));
|
||||
}
|
||||
|
||||
@RequestPath("保存配置项配置")
|
||||
@Operation(summary = "保存配置项配置")
|
||||
@PostMapping("/item/save")
|
||||
public Result<Void> saveCheckoutItemConfig(@RequestBody CheckoutItemConfigParam param) {
|
||||
checkoutConfigService.saveCheckoutItemConfig(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("更新配置项配置")
|
||||
@Operation(summary = "更新配置项配置")
|
||||
@PostMapping("/item/update")
|
||||
public Result<Void> updateCheckoutItemConfig(@RequestBody CheckoutItemConfigParam param) {
|
||||
checkoutConfigService.updateCheckoutItemConfig(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("删除配置项配置")
|
||||
@Operation(summary = "删除配置项配置")
|
||||
@PostMapping("/item/delete")
|
||||
public Result<Void> deleteCheckoutItemConfig(Long id) {
|
||||
checkoutConfigService.deleteCheckoutItemConfig(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("获取聚合支付配置")
|
||||
@Operation(summary = "获取聚合支付配置")
|
||||
@GetMapping("/aggregate/get")
|
||||
public Result<List<CheckoutAggregateConfigVo>> getAggregateConfigs(String appid) {
|
||||
return Res.ok(checkoutConfigQueryService.getAggregateConfigs(appid));
|
||||
}
|
||||
|
||||
@RequestPath("聚合支付配置是否存在")
|
||||
@Operation(summary = "聚合支付配置是否存在")
|
||||
@GetMapping("/aggregate/exists")
|
||||
public Result<Boolean> existsAggregateConfig(String appId, String type) {
|
||||
return Res.ok(checkoutConfigQueryService.existsByAppIdAndType(appId,type));
|
||||
}
|
||||
|
||||
@RequestPath("聚合支付配置是否存在")
|
||||
@Operation(summary = "聚合支付配置是否存在")
|
||||
@GetMapping("/aggregate/existsNotId")
|
||||
public Result<Boolean> existsAggregateConfig(String appId, String type, Long id) {
|
||||
return Res.ok(checkoutConfigQueryService.existsByAppIdAndType(appId,type,id));
|
||||
}
|
||||
|
||||
@RequestPath("保存聚合支付配置")
|
||||
@Operation(summary = "保存聚合支付配置")
|
||||
@PostMapping("/aggregate/save")
|
||||
public Result<Void> saveCheckoutAggregateConfig(@RequestBody CheckoutAggregateConfigParam param) {
|
||||
checkoutConfigService.saveCheckoutAggregateConfig(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("更新聚合支付配置")
|
||||
@Operation(summary = "更新聚合支付配置")
|
||||
@PostMapping("/aggregate/update")
|
||||
public Result<Void> updateCheckoutAggregateConfig(@RequestBody CheckoutAggregateConfigParam param) {
|
||||
checkoutConfigService.updateCheckoutAggregateConfig(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@RequestPath("删除聚合支付配置")
|
||||
@Operation(summary = "删除聚合支付配置")
|
||||
@PostMapping("/aggregate/delete")
|
||||
public Result<Void> deleteCheckoutAggregateConfig(Long id) {
|
||||
checkoutConfigService.deleteCheckoutAggregateConfig(id);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -15,7 +15,7 @@ import org.dromara.daxpay.core.result.cashier.CashierCodeResult;
|
||||
import org.dromara.daxpay.core.result.trade.pay.PayResult;
|
||||
import org.dromara.daxpay.service.param.cashier.CashierCodeAuthCodeParam;
|
||||
import org.dromara.daxpay.service.service.cashier.CashierCodeService;
|
||||
import org.dromara.daxpay.service.service.config.CashierCodeConfigService;
|
||||
import org.dromara.daxpay.service.service.config.cashier.CashierCodeConfigService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
|
@@ -8,9 +8,11 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.daxpay.core.param.cashier.CheckoutParam;
|
||||
import org.dromara.daxpay.core.param.cashier.CheckoutPayParam;
|
||||
import org.dromara.daxpay.core.result.DaxResult;
|
||||
import org.dromara.daxpay.core.result.cashier.CheckoutUrlResult;
|
||||
import org.dromara.daxpay.core.result.checkout.CheckoutOrderAndConfigResult;
|
||||
import org.dromara.daxpay.core.result.checkout.CheckoutUrlResult;
|
||||
import org.dromara.daxpay.core.util.DaxRes;
|
||||
import org.dromara.daxpay.service.common.anno.PaymentVerify;
|
||||
import org.dromara.daxpay.service.service.cashier.CheckoutQueryService;
|
||||
import org.dromara.daxpay.service.service.cashier.CheckoutService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RequiredArgsConstructor
|
||||
public class CheckoutController {
|
||||
private final CheckoutService checkoutService;
|
||||
private final CheckoutQueryService checkoutQueryService;
|
||||
|
||||
@PaymentVerify
|
||||
@Operation(summary = "创建一个收银台链接")
|
||||
@@ -33,10 +36,16 @@ public class CheckoutController {
|
||||
return DaxRes.ok(checkoutService.creat(checkoutParam));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取收银台订单信息")
|
||||
@GetMapping("/info")
|
||||
public Result<Void> getInfo(){
|
||||
return Res.ok();
|
||||
@Operation(summary = "获取收银台订单和配置信息")
|
||||
@GetMapping("/getOrderAndConfig")
|
||||
public Result<CheckoutOrderAndConfigResult> getOrderAndConfig(String orderNo, String checkoutType){
|
||||
return Res.ok(checkoutQueryService.getOrderAndConfig(orderNo, checkoutType));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取聚合支付配置")
|
||||
@GetMapping("/getOrderAndConfig")
|
||||
public Result<String> getCheckoutUrl(String orderNo, String checkoutType){
|
||||
return Res.ok(checkoutService.getCheckoutUrl(orderNo, checkoutType));
|
||||
}
|
||||
|
||||
@Operation(summary = "发起支付")
|
||||
|
@@ -0,0 +1,24 @@
|
||||
package org.dromara.daxpay.service.convert.config;
|
||||
|
||||
import org.dromara.daxpay.core.result.checkout.CheckoutAggregateConfigResult;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutAggregateConfig;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutAggregateConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutAggregateConfigVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@Mapper
|
||||
public interface CheckoutAggregateConfigConvert {
|
||||
CheckoutAggregateConfigConvert CONVERT = Mappers.getMapper(CheckoutAggregateConfigConvert.class);
|
||||
|
||||
CheckoutAggregateConfigResult toResult(CheckoutAggregateConfig param);
|
||||
|
||||
CheckoutAggregateConfigVo toVo(CheckoutAggregateConfig param);
|
||||
|
||||
CheckoutAggregateConfig toEntity(CheckoutAggregateConfigParam param);
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package org.dromara.daxpay.service.convert.config;
|
||||
|
||||
import org.dromara.daxpay.core.result.checkout.CheckoutConfigResult;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutConfig;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutConfigVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@Mapper
|
||||
public interface CheckoutConfigConvert {
|
||||
CheckoutConfigConvert CONVERT = Mappers.getMapper(CheckoutConfigConvert.class);
|
||||
|
||||
CheckoutConfigResult toResult(CheckoutConfig in);
|
||||
|
||||
CheckoutConfigVo toVo(CheckoutConfig in);
|
||||
|
||||
CheckoutConfig toEntity(CheckoutConfigParam in);
|
||||
|
||||
|
||||
}
|
@@ -2,7 +2,8 @@ package org.dromara.daxpay.service.convert.config;
|
||||
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutGroupConfig;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutGroupConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutGroupConfigResult;
|
||||
import org.dromara.daxpay.core.result.checkout.CheckoutGroupConfigResult;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutGroupConfigVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -19,5 +20,7 @@ public interface CheckoutGroupConfigConvert {
|
||||
|
||||
CheckoutGroupConfigResult toResult(CheckoutGroupConfig entity);
|
||||
|
||||
CheckoutGroupConfigVo toVo(CheckoutGroupConfig entity);
|
||||
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,8 @@ package org.dromara.daxpay.service.convert.config;
|
||||
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutItemConfig;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutItemConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutItemConfigResult;
|
||||
import org.dromara.daxpay.core.result.checkout.CheckoutItemConfigResult;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutItemConfigVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -18,4 +19,6 @@ public interface CheckoutItemConfigConvert {
|
||||
CheckoutItemConfig toEntity(CheckoutItemConfigParam param);
|
||||
|
||||
CheckoutItemConfigResult toResult(CheckoutItemConfig entity);
|
||||
|
||||
CheckoutItemConfigVo toVo(CheckoutItemConfig entity);
|
||||
}
|
||||
|
@@ -0,0 +1,61 @@
|
||||
package org.dromara.daxpay.service.dao.config.checkout;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutAggregateConfig;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 收银台聚合支付配置
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CheckoutAggregateConfigManager extends BaseManager<CheckoutAggregateConfigMapper, CheckoutAggregateConfig> {
|
||||
|
||||
/**
|
||||
* 查询配置
|
||||
*/
|
||||
public List<CheckoutAggregateConfig> findAllByAppId(String appId) {
|
||||
return lambdaQuery()
|
||||
.eq(CheckoutAggregateConfig::getAppId, appId)
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用ID和类型查询配置
|
||||
*/
|
||||
public Optional<CheckoutAggregateConfig> findByAppIdAndType(String appId, String type) {
|
||||
return lambdaQuery()
|
||||
.eq(CheckoutAggregateConfig::getAppId, appId)
|
||||
.eq(CheckoutAggregateConfig::getType, type)
|
||||
.oneOpt();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用ID和类型查询配置是否存在
|
||||
*/
|
||||
public boolean existsByAppIdAndType(String appId, String type){
|
||||
return lambdaQuery()
|
||||
.eq(CheckoutAggregateConfig::getAppId, appId)
|
||||
.eq(CheckoutAggregateConfig::getType, type)
|
||||
.exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用ID和类型查询配置是否存在
|
||||
*/
|
||||
public boolean existsByAppIdAndType(String appId, String type, Long id){
|
||||
return lambdaQuery()
|
||||
.eq(CheckoutAggregateConfig::getAppId, appId)
|
||||
.eq(CheckoutAggregateConfig::getType, type)
|
||||
.ne(CheckoutAggregateConfig::getId, id)
|
||||
.exists();
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.config.checkout;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutAggregateConfig;
|
||||
|
||||
/**
|
||||
* 收银台聚合支付配置
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@Mapper
|
||||
public interface CheckoutAggregateConfigMapper extends MPJBaseMapper<CheckoutAggregateConfig> {
|
||||
}
|
@@ -3,16 +3,33 @@ package org.dromara.daxpay.service.dao.config.checkout;
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutConfig;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* 收银台配置
|
||||
* @author xxm
|
||||
* @since 2024/11/25
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class CheckoutConfigManager extends BaseManager<CheckoutConfigMapper, CheckoutConfig> {
|
||||
|
||||
/**
|
||||
* 查询配置
|
||||
*/
|
||||
public Optional<CheckoutConfig> findByAppId(String appId) {
|
||||
return findByField(MchAppBaseEntity::getAppId,appId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判重
|
||||
*/
|
||||
public boolean existsByAppId(String appId){
|
||||
return existedByField(MchAppBaseEntity::getAppId, appId);
|
||||
}
|
||||
}
|
||||
|
@@ -4,10 +4,10 @@ import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutConfig;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/11/25
|
||||
/**
|
||||
* 收银台配置
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@Mapper
|
||||
public interface CheckoutConfigMapper extends MPJBaseMapper<CheckoutConfig> {
|
||||
|
@@ -6,6 +6,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutGroupConfig;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 收银台类目配置
|
||||
* @author xxm
|
||||
@@ -15,4 +17,25 @@ import org.springframework.stereotype.Repository;
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class CheckoutGroupConfigManager extends BaseManager<CheckoutGroupConfigMapper, CheckoutGroupConfig> {
|
||||
|
||||
/**
|
||||
* 查询指定类型的分组, 并进行排序
|
||||
*/
|
||||
public List<CheckoutGroupConfig> findAllSortByAppIdAndType(String appId, String type){
|
||||
return lambdaQuery()
|
||||
.eq(CheckoutGroupConfig::getAppId, appId)
|
||||
.eq(CheckoutGroupConfig::getType, type)
|
||||
.orderByDesc(CheckoutGroupConfig::getSort)
|
||||
.list();
|
||||
}
|
||||
/**
|
||||
* 查询指定类型的分组, 不进行排序
|
||||
*/
|
||||
public List<CheckoutGroupConfig> findAllByAppIdAndType(String appId, String type){
|
||||
return lambdaQuery()
|
||||
.eq(CheckoutGroupConfig::getAppId, appId)
|
||||
.eq(CheckoutGroupConfig::getType, type)
|
||||
.list();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,6 +6,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutItemConfig;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 收银台配置项
|
||||
* @author xxm
|
||||
@@ -15,4 +18,40 @@ import org.springframework.stereotype.Repository;
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class CheckoutItemConfigManager extends BaseManager<CheckoutItemConfigMapper, CheckoutItemConfig> {
|
||||
|
||||
/**
|
||||
* 根据id和appId查询
|
||||
*/
|
||||
public Optional<CheckoutItemConfig> findByIdAndAppId(Long id, String appId) {
|
||||
return lambdaQuery()
|
||||
.eq(CheckoutItemConfig::getId, id)
|
||||
.eq(CheckoutItemConfig::getAppId, appId)
|
||||
.oneOpt();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分组查询
|
||||
*/
|
||||
public List<CheckoutItemConfig> findAllByGroupId(Long groupId) {
|
||||
return lambdaQuery()
|
||||
.eq(CheckoutItemConfig::getGroupId, groupId)
|
||||
.list();
|
||||
}
|
||||
/**
|
||||
* 根据分组列表查询
|
||||
*/
|
||||
public List<CheckoutItemConfig> findAllByGroupIds(List<Long> groupIds) {
|
||||
return lambdaQuery()
|
||||
.in(CheckoutItemConfig::getGroupId, groupIds)
|
||||
.orderByDesc(CheckoutItemConfig::getSort)
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断分组是否有数据
|
||||
*/
|
||||
public boolean existedByGroupId(Long groupId) {
|
||||
return existedByField(CheckoutItemConfig::getGroupId, groupId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,57 @@
|
||||
package org.dromara.daxpay.service.entity.config.checkout;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.function.ToResult;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.ChannelEnum;
|
||||
import org.dromara.daxpay.core.enums.CheckoutAggregateEnum;
|
||||
import org.dromara.daxpay.core.enums.PayMethodEnum;
|
||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||
import org.dromara.daxpay.service.convert.config.CheckoutAggregateConfigConvert;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutAggregateConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutAggregateConfigVo;
|
||||
|
||||
/**
|
||||
* 收银台聚合扫码支付配置
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CheckoutAggregateConfig extends MchAppBaseEntity implements ToResult<CheckoutAggregateConfigVo> {
|
||||
|
||||
/**
|
||||
* 支付类型
|
||||
* @see CheckoutAggregateEnum
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 通道
|
||||
* @see ChannelEnum
|
||||
*/
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
* @see PayMethodEnum
|
||||
*/
|
||||
private String payMethod;
|
||||
|
||||
/** 自动拉起支付 */
|
||||
private boolean autoLaunch;
|
||||
|
||||
public static CheckoutAggregateConfig init(CheckoutAggregateConfigParam param){
|
||||
return CheckoutAggregateConfigConvert.CONVERT.toEntity(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换
|
||||
*/
|
||||
@Override
|
||||
public CheckoutAggregateConfigVo toResult() {
|
||||
return CheckoutAggregateConfigConvert.CONVERT.toVo(this);
|
||||
}
|
||||
}
|
@@ -1,20 +1,41 @@
|
||||
package org.dromara.daxpay.service.entity.config.checkout;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.function.ToResult;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||
import org.dromara.daxpay.service.convert.config.CheckoutConfigConvert;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutConfigVo;
|
||||
|
||||
/**
|
||||
* 收银台配置
|
||||
* @author xxm
|
||||
* @since 2024/11/22
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CheckoutConfig extends MchAppBaseEntity {
|
||||
@Schema(title = "收银台配置")
|
||||
public class CheckoutConfig extends MchAppBaseEntity implements ToResult<CheckoutConfigVo> {
|
||||
|
||||
/** 收银台名称 */
|
||||
private String name;
|
||||
|
||||
/** PC收银台是否同时显示聚合收银码 */
|
||||
private boolean aggregateShow;
|
||||
|
||||
/** h5收银台自动升级升聚合支付 */
|
||||
private boolean h5AutoUpgrade;
|
||||
|
||||
public static CheckoutConfig init(CheckoutConfigParam param) {
|
||||
return CheckoutConfigConvert.CONVERT.toEntity(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckoutConfigVo toResult() {
|
||||
return CheckoutConfigConvert.CONVERT.toVo(this);
|
||||
}
|
||||
}
|
||||
|
@@ -4,10 +4,11 @@ import cn.bootx.platform.common.mybatisplus.function.ToResult;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.CheckoutTypeEnum;
|
||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||
import org.dromara.daxpay.service.convert.config.CheckoutGroupConfigConvert;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutGroupConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutGroupConfigResult;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutGroupConfigVo;
|
||||
|
||||
/**
|
||||
* 收银台类目配置
|
||||
@@ -17,14 +18,20 @@ import org.dromara.daxpay.service.result.config.checkout.CheckoutGroupConfigResu
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CheckoutGroupConfig extends MchAppBaseEntity implements ToResult<CheckoutGroupConfigResult> {
|
||||
public class CheckoutGroupConfig extends MchAppBaseEntity implements ToResult<CheckoutGroupConfigVo> {
|
||||
|
||||
/** 类型 web/h5/小程序 */
|
||||
/**
|
||||
* 类型 web/h5/小程序
|
||||
* @see CheckoutTypeEnum
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/** 名称 */
|
||||
private String name;
|
||||
|
||||
/** 图标 */
|
||||
private String icon;
|
||||
|
||||
/** 排序 */
|
||||
private Double sort;
|
||||
|
||||
@@ -36,7 +43,7 @@ public class CheckoutGroupConfig extends MchAppBaseEntity implements ToResult<Ch
|
||||
* 转换
|
||||
*/
|
||||
@Override
|
||||
public CheckoutGroupConfigResult toResult() {
|
||||
return CheckoutGroupConfigConvert.CONVERT.toResult(this);
|
||||
public CheckoutGroupConfigVo toResult() {
|
||||
return CheckoutGroupConfigConvert.CONVERT.toVo(this);
|
||||
}
|
||||
}
|
||||
|
@@ -5,11 +5,12 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.ChannelEnum;
|
||||
import org.dromara.daxpay.core.enums.CheckoutCallTypeEnum;
|
||||
import org.dromara.daxpay.core.enums.PayMethodEnum;
|
||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||
import org.dromara.daxpay.service.convert.config.CheckoutItemConfigConvert;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutItemConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutItemConfigResult;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutItemConfigVo;
|
||||
|
||||
/**
|
||||
* 收银台配置项
|
||||
@@ -19,14 +20,26 @@ import org.dromara.daxpay.service.result.config.checkout.CheckoutItemConfigResul
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CheckoutItemConfig extends MchAppBaseEntity implements ToResult<CheckoutItemConfigResult> {
|
||||
public class CheckoutItemConfig extends MchAppBaseEntity implements ToResult<CheckoutItemConfigVo> {
|
||||
|
||||
/** 类目配置Id */
|
||||
private Long classifyId;
|
||||
private Long groupId;
|
||||
|
||||
/** 名称 */
|
||||
private String name;
|
||||
|
||||
/** 图标 */
|
||||
private String icon;
|
||||
|
||||
/** 排序 */
|
||||
private Double sort;
|
||||
|
||||
/**
|
||||
* 发起调用的类型
|
||||
* @see CheckoutCallTypeEnum
|
||||
*/
|
||||
private String callType;
|
||||
|
||||
/**
|
||||
* 支付通道
|
||||
* @see ChannelEnum
|
||||
@@ -42,16 +55,6 @@ public class CheckoutItemConfig extends MchAppBaseEntity implements ToResult<Che
|
||||
/** 是否开启分账 */
|
||||
private boolean allocation;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
* 1. 扫码支付
|
||||
* 2. 条码支付
|
||||
* 3. 跳转链接
|
||||
* 4. 小程序支付
|
||||
* 5. 聚合支付
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
*/
|
||||
@@ -63,7 +66,7 @@ public class CheckoutItemConfig extends MchAppBaseEntity implements ToResult<Che
|
||||
* 转换
|
||||
*/
|
||||
@Override
|
||||
public CheckoutItemConfigResult toResult() {
|
||||
return CheckoutItemConfigConvert.CONVERT.toResult(this);
|
||||
public CheckoutItemConfigVo toResult() {
|
||||
return CheckoutItemConfigConvert.CONVERT.toVo(this);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,52 @@
|
||||
package org.dromara.daxpay.service.param.config.checkout;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.ChannelEnum;
|
||||
import org.dromara.daxpay.core.enums.CheckoutAggregateEnum;
|
||||
import org.dromara.daxpay.core.enums.PayMethodEnum;
|
||||
|
||||
/**
|
||||
* 收银台聚合支付配置参数
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "收银台聚合支付配置参数")
|
||||
public class CheckoutAggregateConfigParam {
|
||||
|
||||
/** 主键 */
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 支付类型
|
||||
* @see CheckoutAggregateEnum
|
||||
*/
|
||||
@Schema(description = "支付类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 通道
|
||||
* @see ChannelEnum
|
||||
*/
|
||||
@Schema(description = "通道")
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
* @see PayMethodEnum
|
||||
*/
|
||||
@Schema(description = "支付方式")
|
||||
private String payMethod;
|
||||
|
||||
/** 自动拉起支付 */
|
||||
@Schema(description = "自动拉起支付")
|
||||
private boolean autoLaunch;
|
||||
|
||||
/** 应用号 */
|
||||
@Schema(description = "应用号")
|
||||
private String appId;
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package org.dromara.daxpay.service.param.config.checkout;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 收银台配置
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "收银台配置")
|
||||
public class CheckoutConfigParam {
|
||||
|
||||
/** 主键 */
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
/** 收银台名称 */
|
||||
@Schema(description = "收银台名称")
|
||||
private String name;
|
||||
|
||||
/** PC收银台是否同时显示聚合收银码 */
|
||||
@Schema(description = "PC收银台是否同时显示聚合收银码")
|
||||
private boolean aggregateShow;
|
||||
|
||||
/** h5收银台自动升级升聚合支付 */
|
||||
@Schema(description = "h5收银台自动升级升聚合支付")
|
||||
private boolean h5AutoUpgrade;
|
||||
|
||||
/** 应用号 */
|
||||
@Schema(description = "应用号")
|
||||
private String appId;
|
||||
}
|
@@ -3,6 +3,7 @@ package org.dromara.daxpay.service.param.config.checkout;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.CheckoutTypeEnum;
|
||||
|
||||
/**
|
||||
* 收银台分组配置参数
|
||||
@@ -13,4 +14,31 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "收银台分组配置参数")
|
||||
public class CheckoutGroupConfigParam {
|
||||
|
||||
/** 主键 */
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类型 web/h5/小程序
|
||||
* @see CheckoutTypeEnum
|
||||
*/
|
||||
@Schema(description = "类型 web/h5/小程序")
|
||||
private String type;
|
||||
|
||||
/** 名称 */
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
/** 图标 */
|
||||
@Schema(description = "图标")
|
||||
private String icon;
|
||||
|
||||
/** 排序 */
|
||||
@Schema(description = "排序")
|
||||
private Double sort;
|
||||
|
||||
/** 应用号 */
|
||||
@Schema(description = "应用号")
|
||||
private String appId;
|
||||
}
|
||||
|
@@ -3,6 +3,9 @@ package org.dromara.daxpay.service.param.config.checkout;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.ChannelEnum;
|
||||
import org.dromara.daxpay.core.enums.CheckoutCallTypeEnum;
|
||||
import org.dromara.daxpay.core.enums.PayMethodEnum;
|
||||
|
||||
/**
|
||||
* 收银台配置项参数
|
||||
@@ -13,4 +16,53 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "收银台配置项参数")
|
||||
public class CheckoutItemConfigParam {
|
||||
|
||||
/** 主键 */
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
/** 类目配置Id */
|
||||
@Schema(description = "类目配置Id")
|
||||
private Long groupId;
|
||||
|
||||
/** 名称 */
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
/** 图标 */
|
||||
@Schema(description = "图标")
|
||||
private String icon;
|
||||
|
||||
/** 排序 */
|
||||
@Schema(description = "排序")
|
||||
private Double sort;
|
||||
|
||||
/**
|
||||
* 发起调用的类型
|
||||
* @see CheckoutCallTypeEnum
|
||||
*/
|
||||
@Schema(description = "发起调用的类型")
|
||||
private String callType;
|
||||
|
||||
/**
|
||||
* 支付通道
|
||||
* @see ChannelEnum
|
||||
*/
|
||||
@Schema(description = "支付通道")
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
* @see PayMethodEnum
|
||||
*/
|
||||
@Schema(description = "支付方式")
|
||||
private String payMethod;
|
||||
|
||||
/** 是否开启分账 */
|
||||
@Schema(description = "是否开启分账")
|
||||
private boolean allocation;
|
||||
|
||||
/** 应用号 */
|
||||
@Schema(description = "应用号")
|
||||
private String appId;
|
||||
}
|
||||
|
@@ -7,13 +7,13 @@ import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.result.MchAppResult;
|
||||
|
||||
/**
|
||||
* 收银台配置项
|
||||
* 收银台聚合支付配置
|
||||
* @author xxm
|
||||
* @since 2024/11/26
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "收银台配置项")
|
||||
public class CheckoutItemConfigResult extends MchAppResult {
|
||||
@Schema(title = "收银台聚合支付配置")
|
||||
public class CheckoutAggregateConfigVo extends MchAppResult {
|
||||
}
|
@@ -7,13 +7,13 @@ import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.result.MchAppResult;
|
||||
|
||||
/**
|
||||
* 收银台分类配置
|
||||
* 收银台配置
|
||||
* @author xxm
|
||||
* @since 2024/11/26
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "")
|
||||
public class CheckoutGroupConfigResult extends MchAppResult {
|
||||
@Schema(title = "收银台配置")
|
||||
public class CheckoutConfigVo extends MchAppResult {
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
package org.dromara.daxpay.service.result.config.checkout;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.CheckoutTypeEnum;
|
||||
import org.dromara.daxpay.core.result.MchAppResult;
|
||||
|
||||
/**
|
||||
* 收银台分类配置
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "收银台分类配置")
|
||||
public class CheckoutGroupConfigVo extends MchAppResult {
|
||||
|
||||
/**
|
||||
* 类型 web/h5/小程序
|
||||
* @see CheckoutTypeEnum
|
||||
*/
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
/** 名称 */
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
/** 排序 */
|
||||
@Schema(description = "排序")
|
||||
private Double sort;
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
package org.dromara.daxpay.service.result.config.checkout;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.ChannelEnum;
|
||||
import org.dromara.daxpay.core.enums.CheckoutCallTypeEnum;
|
||||
import org.dromara.daxpay.core.enums.PayMethodEnum;
|
||||
import org.dromara.daxpay.core.result.MchAppResult;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "收银台配置项")
|
||||
public class CheckoutItemConfigVo extends MchAppResult {
|
||||
|
||||
/** 类目配置Id */
|
||||
@Schema(description = "类目配置Id")
|
||||
private Long groupId;
|
||||
|
||||
/** 排序 */
|
||||
@Schema(description = "排序")
|
||||
private Double sort;
|
||||
|
||||
/**
|
||||
* 发起调用的类型
|
||||
* @see CheckoutCallTypeEnum
|
||||
*/
|
||||
@Schema(description = "发起调用的类型")
|
||||
private String callType;
|
||||
|
||||
/**
|
||||
* 支付通道
|
||||
* @see ChannelEnum
|
||||
*/
|
||||
@Schema(description = "支付通道")
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
* @see PayMethodEnum
|
||||
*/
|
||||
@Schema(description = "支付方式")
|
||||
private String payMethod;
|
||||
|
||||
/** 是否开启分账 */
|
||||
@Schema(description = "是否开启分账")
|
||||
private boolean allocation;
|
||||
|
||||
}
|
@@ -15,7 +15,7 @@ import org.dromara.daxpay.core.result.trade.pay.PayResult;
|
||||
import org.dromara.daxpay.core.util.TradeNoGenerateUtil;
|
||||
import org.dromara.daxpay.service.param.cashier.CashierCodeAuthCodeParam;
|
||||
import org.dromara.daxpay.service.service.assist.PaymentAssistService;
|
||||
import org.dromara.daxpay.service.service.config.CashierCodeConfigService;
|
||||
import org.dromara.daxpay.service.service.config.cashier.CashierCodeConfigService;
|
||||
import org.dromara.daxpay.service.service.trade.pay.PayService;
|
||||
import org.dromara.daxpay.service.strategy.AbsChannelCashierStrategy;
|
||||
import org.dromara.daxpay.service.util.PaymentStrategyFactory;
|
||||
@@ -51,7 +51,6 @@ public class CashierCodeService {
|
||||
return cashierStrategy.generateAuthUrl(param);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 授权结果
|
||||
*/
|
||||
@@ -99,5 +98,4 @@ public class CashierCodeService {
|
||||
// 发起支付
|
||||
return payService.pay(payParam);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,121 @@
|
||||
package org.dromara.daxpay.service.service.cashier;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
|
||||
import cn.bootx.platform.core.exception.DataNotExistException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.daxpay.core.result.checkout.*;
|
||||
import org.dromara.daxpay.service.convert.config.CheckoutAggregateConfigConvert;
|
||||
import org.dromara.daxpay.service.convert.config.CheckoutConfigConvert;
|
||||
import org.dromara.daxpay.service.convert.config.CheckoutGroupConfigConvert;
|
||||
import org.dromara.daxpay.service.convert.config.CheckoutItemConfigConvert;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutAggregateConfigManager;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutConfigManager;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutGroupConfigManager;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutItemConfigManager;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutAggregateConfig;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutItemConfig;
|
||||
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CheckoutQueryService {
|
||||
private final CheckoutConfigManager checkoutConfigManager;
|
||||
private final CheckoutGroupConfigManager checkoutGroupConfigManager;
|
||||
private final CheckoutItemConfigManager checkoutItemConfigManager;
|
||||
private final CheckoutAggregateConfigManager checkoutAggregateConfigManager;
|
||||
private final CheckoutAssistService checkoutAssistService;
|
||||
|
||||
/**
|
||||
* 获取收银台配置
|
||||
*/
|
||||
public CheckoutConfigResult getConfig(String appId){
|
||||
// 查询配置
|
||||
return checkoutConfigManager.findByAppId(appId)
|
||||
.map(CheckoutConfigConvert.CONVERT::toResult)
|
||||
.orElseThrow(() -> new DataNotExistException("未查询到收银台配置"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取收银台分组配置, 包含明细配置
|
||||
*/
|
||||
public List<CheckoutGroupConfigResult> getGroupConfigs(String appId, String checkoutType){
|
||||
// 查询类目
|
||||
var groups = checkoutGroupConfigManager.findAllSortByAppIdAndType(appId, checkoutType);
|
||||
if (groups.isEmpty()){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
var groupIds = groups.stream()
|
||||
.map(MpIdEntity::getId)
|
||||
.toList();
|
||||
// 查询明细配置
|
||||
List<CheckoutItemConfig> itemConfigs = checkoutItemConfigManager.findAllByGroupIds(groupIds);
|
||||
// 分组
|
||||
var itemGroupMap = itemConfigs.stream()
|
||||
.collect(Collectors.groupingBy(CheckoutItemConfig::getGroupId, LinkedHashMap::new, Collectors.toList()));
|
||||
// 转换
|
||||
return groups.stream()
|
||||
.map(o->{
|
||||
var result = CheckoutGroupConfigConvert.CONVERT.toResult(o);
|
||||
result.setItems(itemGroupMap.get(o.getId()).stream().map(CheckoutItemConfigConvert.CONVERT::toResult).toList());
|
||||
return result;
|
||||
})
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取收银台配置和订单相关信息, 不需要签名和鉴权
|
||||
*/
|
||||
public CheckoutOrderAndConfigResult getOrderAndConfig(String orderNo, String checkoutType){
|
||||
CheckoutOrderAndConfigResult checkoutInfoResult = new CheckoutOrderAndConfigResult();
|
||||
// 订单信息
|
||||
PayOrder payOrder = checkoutAssistService.getOrderAndCheck(orderNo);
|
||||
CheckoutOrderResult order = new CheckoutOrderResult()
|
||||
.setTitle(payOrder.getTitle())
|
||||
.setDescription(payOrder.getDescription())
|
||||
.setAmount(payOrder.getAmount())
|
||||
.setBizOrderNo(payOrder.getBizOrderNo())
|
||||
.setOrderNo(payOrder.getOrderNo());
|
||||
// 获取收银台配置
|
||||
checkoutInfoResult.setConfig(this.getConfig(payOrder.getAppId()));
|
||||
// 获取分组和明细配置
|
||||
checkoutInfoResult.setGroupConfigs(this.getGroupConfigs(payOrder.getAppId(), checkoutType));
|
||||
return checkoutInfoResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 收银台聚合支付配置
|
||||
*/
|
||||
public CheckoutAggregateResult getAggregateConfig(String orderNo, String aggregateType){
|
||||
var checkoutInfoResult = new CheckoutAggregateResult();
|
||||
// 订单信息
|
||||
PayOrder payOrder = checkoutAssistService.getOrderAndCheck(orderNo);
|
||||
CheckoutOrderResult order = new CheckoutOrderResult()
|
||||
.setTitle(payOrder.getTitle())
|
||||
.setDescription(payOrder.getDescription())
|
||||
.setAmount(payOrder.getAmount())
|
||||
.setBizOrderNo(payOrder.getBizOrderNo())
|
||||
.setOrderNo(payOrder.getOrderNo());
|
||||
// 获取收银台配置
|
||||
checkoutInfoResult.setConfig(this.getConfig(payOrder.getAppId()));
|
||||
// 获取聚合支付配置
|
||||
CheckoutAggregateConfig aggregateConfig = checkoutAggregateConfigManager.findByAppIdAndType(payOrder.getAppId(), aggregateType)
|
||||
.orElseThrow(() -> new DataNotExistException("聚合支付配置"));
|
||||
checkoutInfoResult.setAggregateConfig(CheckoutAggregateConfigConvert.CONVERT.toResult(aggregateConfig));
|
||||
return checkoutInfoResult;
|
||||
}
|
||||
}
|
@@ -5,15 +5,18 @@ import com.baomidou.lock.LockInfo;
|
||||
import com.baomidou.lock.LockTemplate;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.daxpay.core.enums.CheckoutCallTypeEnum;
|
||||
import org.dromara.daxpay.core.enums.CheckoutTypeEnum;
|
||||
import org.dromara.daxpay.core.exception.TradeProcessingException;
|
||||
import org.dromara.daxpay.core.exception.UnsupportedAbilityException;
|
||||
import org.dromara.daxpay.core.param.cashier.CheckoutParam;
|
||||
import org.dromara.daxpay.core.result.cashier.CheckoutUrlResult;
|
||||
import org.dromara.daxpay.core.param.cashier.CheckoutPayParam;
|
||||
import org.dromara.daxpay.core.result.checkout.CheckoutOrderAndConfigResult;
|
||||
import org.dromara.daxpay.core.result.checkout.CheckoutUrlResult;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutItemConfigManager;
|
||||
import org.dromara.daxpay.service.entity.config.PlatformConfig;
|
||||
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
||||
import org.dromara.daxpay.service.service.assist.PaymentAssistService;
|
||||
import org.dromara.daxpay.service.service.config.CheckoutConfigService;
|
||||
import org.dromara.daxpay.service.service.config.PlatformConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -28,20 +31,21 @@ import java.util.Objects;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CheckoutService {
|
||||
private final CheckoutAssistService payAssistService;
|
||||
private final CheckoutAssistService checkoutAssistService;
|
||||
private final LockTemplate lockTemplate;
|
||||
private final PlatformConfigService platformConfigService;
|
||||
private final PaymentAssistService paymentAssistService;
|
||||
private final CheckoutConfigService checkoutConfigService;
|
||||
private final CheckoutQueryService checkoutQueryService;
|
||||
private final CheckoutItemConfigManager checkoutItemConfigManager;
|
||||
|
||||
/**
|
||||
* 生成收银台链接
|
||||
*/
|
||||
public CheckoutUrlResult creat(CheckoutParam checkoutParam){
|
||||
// 校验支付限额
|
||||
payAssistService.validationLimitAmount(checkoutParam);
|
||||
checkoutAssistService.validationLimitAmount(checkoutParam);
|
||||
// 校验超时时间, 不可早于当前
|
||||
payAssistService.validationExpiredTime(checkoutParam);
|
||||
checkoutAssistService.validationExpiredTime(checkoutParam);
|
||||
// 获取商户订单号
|
||||
String bizOrderNo = checkoutParam.getBizOrderNo();
|
||||
// 加锁
|
||||
@@ -52,11 +56,11 @@ public class CheckoutService {
|
||||
}
|
||||
try {
|
||||
// 查询并检查订单
|
||||
PayOrder payOrder = payAssistService.getOrderAndCheck(checkoutParam);
|
||||
PayOrder payOrder = checkoutAssistService.getOrderAndCheck(checkoutParam);
|
||||
// 订单已经存在直接返回链接, 不存在创建订单后返回链接
|
||||
if (Objects.isNull(payOrder)){
|
||||
// 执行支付前的保存动作, 保存支付订单和扩展记录
|
||||
payOrder = payAssistService.createPayOrder(checkoutParam);
|
||||
payOrder = checkoutAssistService.createPayOrder(checkoutParam);
|
||||
String checkoutUrl = this.getCheckoutUrl(payOrder.getOrderNo(), checkoutParam.getCheckoutType());
|
||||
return new CheckoutUrlResult().setUrl(checkoutUrl);
|
||||
} else {
|
||||
@@ -72,34 +76,53 @@ public class CheckoutService {
|
||||
/**
|
||||
* 获取收银台链接
|
||||
*/
|
||||
public String getCheckoutUrl(String code, String checkoutType){
|
||||
public String getCheckoutUrl(String orderNo, String checkoutType){
|
||||
CheckoutTypeEnum checkoutTypeEnum = CheckoutTypeEnum.findBuyCode(checkoutType);
|
||||
|
||||
PlatformConfig config = platformConfigService.getConfig();
|
||||
|
||||
switch (checkoutTypeEnum) {
|
||||
case H5 -> {
|
||||
return StrUtil.format("{}/checkout/{}",config.getGatewayMobileUrl(), code);
|
||||
return StrUtil.format("{}/checkout/{}",config.getGatewayMobileUrl(), orderNo);
|
||||
}
|
||||
case PC -> {
|
||||
return StrUtil.format("{}/checkout/{}",config.getGatewayPcUrl(), code);
|
||||
return StrUtil.format("{}/checkout/{}",config.getGatewayPcUrl(), orderNo);
|
||||
}
|
||||
case MINI_APP -> {
|
||||
throw new UnsupportedAbilityException("暂不支持小程序收银台");
|
||||
case AGGREGATE -> {
|
||||
return StrUtil.format("{}/aggregate/{}",config.getGatewayPcUrl(), orderNo);
|
||||
}
|
||||
case MINI_APP -> throw new UnsupportedAbilityException("暂不支持小程序收银台");
|
||||
default -> throw new UnsupportedAbilityException("不支持的收银台类型");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取收银台相关信息, 不需要签名和鉴权
|
||||
* 支付调用
|
||||
*/
|
||||
public void info(String orderNo){
|
||||
public void pay(CheckoutPayParam param){
|
||||
// 订单信息
|
||||
PayOrder orderAndCheck = payAssistService.getOrderAndCheck(orderNo);
|
||||
// 配置信息
|
||||
paymentAssistService.initMchApp(orderAndCheck.getAppId());
|
||||
// 获取相关配置
|
||||
PayOrder order = checkoutAssistService.getOrderAndCheck(param.getOrderNo());
|
||||
paymentAssistService.initMchApp(order.getAppId());
|
||||
// 获取配置项
|
||||
var itemConfig = checkoutItemConfigManager.findByIdAndAppId(param.getItemId(),order.getAppId())
|
||||
.orElseThrow(() -> new TradeProcessingException("支付配置项不存在"));
|
||||
// 判断支付调用类型
|
||||
CheckoutCallTypeEnum callTypeEnum = CheckoutCallTypeEnum.findBuyCode(itemConfig.getCallType());
|
||||
switch (callTypeEnum) {
|
||||
case SCAN -> {
|
||||
// 根据通道和支付方式返回扫码链接
|
||||
}
|
||||
case BAR_CODE -> {
|
||||
// 调用支付逻辑直接进行支付
|
||||
}
|
||||
case LINK -> {
|
||||
// 返回支付链接
|
||||
}
|
||||
case AGGREGATE -> {
|
||||
// 直接返回手机端的聚合收银台链接, 如何判断
|
||||
}
|
||||
default -> throw new UnsupportedAbilityException("不支持的支付调用类型");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,26 +0,0 @@
|
||||
package org.dromara.daxpay.service.service.config;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutConfigManager;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutGroupConfigManager;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutItemConfigManager;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 收银台配置
|
||||
* @author xxm
|
||||
* @since 2024/11/26
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CheckoutConfigService {
|
||||
private final CheckoutConfigManager checkoutConfigManager;
|
||||
private final CheckoutGroupConfigManager checkoutGroupConfigManager;
|
||||
private final CheckoutItemConfigManager checkoutItemConfigManager;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package org.dromara.daxpay.service.service.config;
|
||||
package org.dromara.daxpay.service.service.config.cashier;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.exception.DataNotExistException;
|
||||
@@ -17,6 +17,7 @@ import org.dromara.daxpay.service.entity.config.cashier.CashierCodeTypeConfig;
|
||||
import org.dromara.daxpay.service.entity.config.PlatformConfig;
|
||||
import org.dromara.daxpay.service.param.config.cashier.CashierCodeConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.cashier.CashierCodeConfigResult;
|
||||
import org.dromara.daxpay.service.service.config.PlatformConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package org.dromara.daxpay.service.service.config;
|
||||
package org.dromara.daxpay.service.service.config.cashier;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.exception.DataNotExistException;
|
@@ -0,0 +1,75 @@
|
||||
package org.dromara.daxpay.service.service.config.checkout;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutAggregateConfigManager;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutConfigManager;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutGroupConfigManager;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutItemConfigManager;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutConfig;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutAggregateConfigVo;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutConfigVo;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutGroupConfigVo;
|
||||
import org.dromara.daxpay.service.result.config.checkout.CheckoutItemConfigVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 收银台配置查询服务
|
||||
* @author xxm
|
||||
* @since 2024/11/26
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CheckoutConfigQueryService {
|
||||
private final CheckoutConfigManager checkoutConfigManager;
|
||||
private final CheckoutGroupConfigManager checkoutGroupConfigManager;
|
||||
private final CheckoutItemConfigManager checkoutItemConfigManager;
|
||||
private final CheckoutAggregateConfigManager checkoutAggregateConfigManager;
|
||||
|
||||
/**
|
||||
* 收银台配置
|
||||
*/
|
||||
public CheckoutConfigVo getConfig(String appid){
|
||||
return checkoutConfigManager.findByAppId(appid).map(CheckoutConfig::toResult)
|
||||
.orElse(new CheckoutConfigVo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定类型收银台分组列表
|
||||
*/
|
||||
public List<CheckoutGroupConfigVo> getGroupConfigs(String appid, String checkoutType){
|
||||
return MpUtil.toListResult(checkoutGroupConfigManager.findAllByAppIdAndType(appid, checkoutType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取明细配置列表
|
||||
*/
|
||||
public List<CheckoutItemConfigVo> getItemConfigs(Long groupId){
|
||||
return MpUtil.toListResult(checkoutItemConfigManager.findAllByGroupId(groupId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取聚合支付配置列表
|
||||
*/
|
||||
public List<CheckoutAggregateConfigVo> getAggregateConfigs(String appid){
|
||||
return MpUtil.toListResult(checkoutAggregateConfigManager.findAllByAppId(appid));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用ID和类型查询配置是否存在
|
||||
*/
|
||||
public boolean existsByAppIdAndType(String appId, String type){
|
||||
return checkoutAggregateConfigManager.existsByAppIdAndType(appId, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用ID和类型查询配置是否存在
|
||||
*/
|
||||
public boolean existsByAppIdAndType(String appId, String type, Long id){
|
||||
return checkoutAggregateConfigManager.existsByAppIdAndType(appId, type, id);
|
||||
}
|
||||
}
|
@@ -0,0 +1,155 @@
|
||||
package org.dromara.daxpay.service.service.config.checkout;
|
||||
|
||||
import cn.bootx.platform.core.exception.DataNotExistException;
|
||||
import cn.bootx.platform.core.exception.RepetitiveOperationException;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.daxpay.core.exception.OperationFailException;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutAggregateConfigManager;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutConfigManager;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutGroupConfigManager;
|
||||
import org.dromara.daxpay.service.dao.config.checkout.CheckoutItemConfigManager;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutAggregateConfig;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutConfig;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutGroupConfig;
|
||||
import org.dromara.daxpay.service.entity.config.checkout.CheckoutItemConfig;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutAggregateConfigParam;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutConfigParam;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutGroupConfigParam;
|
||||
import org.dromara.daxpay.service.param.config.checkout.CheckoutItemConfigParam;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 收银台配置服务
|
||||
* @author xxm
|
||||
* @since 2024/11/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CheckoutConfigService {
|
||||
|
||||
private final CheckoutConfigManager checkoutConfigManager;
|
||||
private final CheckoutGroupConfigManager checkoutGroupConfigManager;
|
||||
private final CheckoutItemConfigManager checkoutItemConfigManager;
|
||||
private final CheckoutAggregateConfigManager checkoutAggregateConfigManager;
|
||||
|
||||
/**
|
||||
* 保存收银台配置
|
||||
*/
|
||||
public void saveCheckoutConfig(CheckoutConfigParam param) {
|
||||
// 判断是否已经存在
|
||||
if (checkoutConfigManager.existsByAppId(param.getAppId())){
|
||||
throw new RepetitiveOperationException("该应用已存在收银台配置");
|
||||
}
|
||||
checkoutConfigManager.save(CheckoutConfig.init(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新收银台配置
|
||||
*/
|
||||
public void updateCheckoutConfig(CheckoutConfigParam param) {
|
||||
CheckoutConfig checkoutConfig = checkoutConfigManager.findById(param.getId())
|
||||
.orElseThrow(() -> new DataNotExistException("收银台配置不存在"));
|
||||
BeanUtil.copyProperties(param, checkoutConfig, CopyOptions.create().ignoreNullValue());
|
||||
checkoutConfigManager.updateById(checkoutConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存分组配置
|
||||
*/
|
||||
public void saveCheckoutGroupConfig(CheckoutGroupConfigParam param) {
|
||||
checkoutGroupConfigManager.save(CheckoutGroupConfig.init(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新分组配置
|
||||
*/
|
||||
public void updateCheckoutGroupConfig(CheckoutGroupConfigParam param) {
|
||||
CheckoutGroupConfig checkoutGroupConfig = checkoutGroupConfigManager.findById(param.getId())
|
||||
.orElseThrow(() -> new DataNotExistException("分组配置不存在"));
|
||||
BeanUtil.copyProperties(param, checkoutGroupConfig, CopyOptions.create().ignoreNullValue());
|
||||
checkoutGroupConfigManager.updateById(checkoutGroupConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分组配置
|
||||
*/
|
||||
public void deleteCheckoutGroupConfig(Long id) {
|
||||
if (!checkoutGroupConfigManager.existedById(id)){
|
||||
throw new DataNotExistException("分组配置不存在");
|
||||
}
|
||||
|
||||
if (checkoutItemConfigManager.existedByGroupId(id)){
|
||||
throw new OperationFailException("该分组下存在配置项,请先删除配置项");
|
||||
}
|
||||
checkoutGroupConfigManager.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存配置项
|
||||
*/
|
||||
public void saveCheckoutItemConfig(CheckoutItemConfigParam param) {
|
||||
if (!checkoutGroupConfigManager.existedById(param.getGroupId())){
|
||||
throw new DataNotExistException("所属分组配置不存在");
|
||||
}
|
||||
checkoutItemConfigManager.save(CheckoutItemConfig.init(param));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新配置项
|
||||
*/
|
||||
public void updateCheckoutItemConfig(CheckoutItemConfigParam param) {
|
||||
CheckoutItemConfig checkoutItemConfig = checkoutItemConfigManager.findById(param.getId())
|
||||
.orElseThrow(() -> new DataNotExistException("配置项不存在"));
|
||||
BeanUtil.copyProperties(param, checkoutItemConfig, CopyOptions.create().ignoreNullValue());
|
||||
checkoutItemConfigManager.updateById(checkoutItemConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除配置项
|
||||
*/
|
||||
public void deleteCheckoutItemConfig(Long id) {
|
||||
if (!checkoutItemConfigManager.existedById(id)){
|
||||
throw new DataNotExistException("配置项不存在");
|
||||
}
|
||||
checkoutItemConfigManager.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增聚合配置
|
||||
*/
|
||||
public void saveCheckoutAggregateConfig(CheckoutAggregateConfigParam param) {
|
||||
// 判断支付类型是否已经存在
|
||||
if (checkoutAggregateConfigManager.existsByAppIdAndType(param.getAppId(), param.getType())){
|
||||
throw new RepetitiveOperationException("该应用已存在该聚合支付类型配置");
|
||||
}
|
||||
checkoutAggregateConfigManager.save(CheckoutAggregateConfig.init(param));
|
||||
}
|
||||
/**
|
||||
* 更新聚合配置
|
||||
*/
|
||||
public void updateCheckoutAggregateConfig(CheckoutAggregateConfigParam param) {
|
||||
// 判断支付类型是否已经存在
|
||||
if (checkoutAggregateConfigManager.existsByAppIdAndType(param.getAppId(), param.getType(), param.getId())){
|
||||
throw new RepetitiveOperationException("该应用已存在该聚合支付类型配置");
|
||||
}
|
||||
CheckoutAggregateConfig checkoutAggregateConfig = checkoutAggregateConfigManager.findById(param.getId())
|
||||
.orElseThrow(() -> new DataNotExistException("聚合支付配置不存在"));
|
||||
BeanUtil.copyProperties(param, checkoutAggregateConfig, CopyOptions.create().ignoreNullValue());
|
||||
checkoutAggregateConfigManager.updateById(checkoutAggregateConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除聚合配置
|
||||
*/
|
||||
public void deleteCheckoutAggregateConfig(Long id) {
|
||||
if (!checkoutAggregateConfigManager.existedById(id)){
|
||||
throw new DataNotExistException("聚合支付配置不存在");
|
||||
}
|
||||
checkoutAggregateConfigManager.deleteById(id);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user