mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-02 02:34:34 +00:00
feat 对账处理
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
2.0.5:
|
||||
- [ ] 资金流水优化
|
||||
- [ ] 支持分账
|
||||
- [ ] 分账功能开发
|
||||
- [ ] 支付通道配置是否支持分账
|
||||
- [ ] 分账接收方管理
|
||||
- [ ] 分账订单管理
|
||||
- [ ] 增加撤销功能,用于处理线下支付订单的情况
|
||||
- [ ] 统计报表功能
|
||||
- [x] 修复创建支付订单报错时, 订单保存数据不完整
|
||||
|
@@ -0,0 +1,21 @@
|
||||
package cn.bootx.platform.daxpay.admin.controller.allocation;
|
||||
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.service.AllocationReceiverService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 对账接收方控制器
|
||||
* @author xxm
|
||||
* @since 2024/3/28
|
||||
*/
|
||||
@Tag(name = "对账接收方控制器")
|
||||
@RestController
|
||||
@RequestMapping("/allocation/receiver")
|
||||
@RequiredArgsConstructor
|
||||
public class AllocationReceiverController {
|
||||
|
||||
private final AllocationReceiverService allocationReceiverService;
|
||||
}
|
@@ -41,6 +41,10 @@ public class AliPayConfig extends MpBaseEntity implements EntityBaseFunction<Ali
|
||||
@DbColumn(comment = "是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
/** 是否支付分账 */
|
||||
@DbColumn(comment = "是否支付分账")
|
||||
private Boolean allocation;
|
||||
|
||||
/** 支付限额 */
|
||||
@DbColumn(comment = "支付限额")
|
||||
private Integer singleLimit;
|
||||
|
@@ -0,0 +1,40 @@
|
||||
package cn.bootx.platform.daxpay.service.core.channel.alipay.service;
|
||||
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.entity.AllocationReceiver;
|
||||
import com.alipay.api.domain.AlipayTradeRoyaltyRelationBindModel;
|
||||
import com.alipay.api.domain.RoyaltyEntity;
|
||||
import com.alipay.api.response.AlipayTradeRoyaltyRelationBindResponse;
|
||||
import com.ijpay.alipay.AliPayApi;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* 支付宝分账
|
||||
* @author xxm
|
||||
* @since 2024/3/28
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AliPayAllocationReceiverService {
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
@SneakyThrows
|
||||
public void bind(AllocationReceiver allocationReceiver){
|
||||
AlipayTradeRoyaltyRelationBindModel model = new AlipayTradeRoyaltyRelationBindModel();
|
||||
model.setOutRequestNo(String.valueOf(allocationReceiver.getId()));
|
||||
|
||||
RoyaltyEntity entity = new RoyaltyEntity();
|
||||
entity.setAccount(allocationReceiver.getReceiverAccount());
|
||||
entity.setMemo(allocationReceiver.getRelationName());
|
||||
|
||||
model.setReceiverList(Collections.singletonList(entity));
|
||||
AlipayTradeRoyaltyRelationBindResponse response = AliPayApi.tradeRoyaltyRelationBind(model);
|
||||
}
|
||||
}
|
@@ -46,6 +46,10 @@ public class WeChatPayConfig extends MpBaseEntity implements EntityBaseFunction<
|
||||
@DbColumn(comment = "是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
/** 是否支付分账 */
|
||||
@DbColumn(comment = "是否支付分账")
|
||||
private Boolean allocation;
|
||||
|
||||
/** 支付限额 */
|
||||
@DbColumn(comment = "支付限额")
|
||||
private Integer singleLimit;
|
||||
|
@@ -0,0 +1,21 @@
|
||||
package cn.bootx.platform.daxpay.service.core.payment.allocation.convert;
|
||||
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.entity.AllocationReceiver;
|
||||
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationReceiverDto;
|
||||
import cn.bootx.platform.daxpay.service.param.allocation.AllocationReceiverParam;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/28
|
||||
*/
|
||||
@Mapper
|
||||
public interface AllocationReceiverConvert {
|
||||
AllocationReceiverConvert CONVERT = Mappers.getMapper(AllocationReceiverConvert.class);
|
||||
|
||||
AllocationReceiverDto convert(AllocationReceiver in);
|
||||
|
||||
AllocationReceiver convert(AllocationReceiverParam in);
|
||||
}
|
@@ -6,10 +6,10 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/27
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
|
@@ -6,10 +6,10 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/27
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
|
@@ -4,10 +4,10 @@ import cn.bootx.platform.daxpay.service.core.payment.allocation.entity.Allocatio
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/27
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/27
|
||||
*/
|
||||
@Mapper
|
||||
public interface AllocationReceiverGroupMapper extends BaseMapper<AllocationReceiverGroup> {
|
||||
|
@@ -6,10 +6,10 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/27
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
|
@@ -4,10 +4,10 @@ import cn.bootx.platform.daxpay.service.core.payment.allocation.entity.Allocatio
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/27
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/27
|
||||
*/
|
||||
@Mapper
|
||||
public interface AllocationReceiverMapper extends BaseMapper<AllocationReceiver> {
|
||||
|
@@ -1,8 +1,14 @@
|
||||
package cn.bootx.platform.daxpay.service.core.payment.allocation.entity;
|
||||
|
||||
import cn.bootx.platform.common.core.function.EntityBaseFunction;
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
|
||||
import cn.bootx.platform.daxpay.code.AllocationRelationTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.convert.AllocationReceiverConvert;
|
||||
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationReceiverDto;
|
||||
import cn.bootx.table.modify.annotation.DbColumn;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -15,36 +21,58 @@ import lombok.experimental.Accessors;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AllocationReceiver extends MpBaseEntity {
|
||||
public class AllocationReceiver extends MpBaseEntity implements EntityBaseFunction<AllocationReceiverDto> {
|
||||
|
||||
@DbColumn(name = "账号别名")
|
||||
@DbColumn(comment = "账号别名")
|
||||
private String name;
|
||||
|
||||
@DbColumn(name = "所属通道")
|
||||
/**
|
||||
* @see PayChannelEnum
|
||||
*/
|
||||
@DbColumn(comment = "所属通道")
|
||||
@TableField(updateStrategy = FieldStrategy.NEVER)
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* 分账接收方类型 个人/商户
|
||||
*/
|
||||
@DbColumn(name = "分账接收方类型")
|
||||
@DbColumn(comment = "分账接收方类型")
|
||||
@TableField(updateStrategy = FieldStrategy.NEVER)
|
||||
private String receiverType;
|
||||
|
||||
|
||||
@DbColumn(name = "接收方账号")
|
||||
@DbColumn(comment = "接收方账号")
|
||||
@TableField(updateStrategy = FieldStrategy.NEVER)
|
||||
private String receiverAccount;
|
||||
|
||||
@DbColumn(comment = "账号类型")
|
||||
private String accountType;
|
||||
|
||||
/** 接收方姓名 */
|
||||
@DbColumn(name = "接收方姓名")
|
||||
@DbColumn(comment = "接收方姓名")
|
||||
@TableField(updateStrategy = FieldStrategy.NEVER)
|
||||
private String receiverName;
|
||||
|
||||
/**
|
||||
* 分账关系类型
|
||||
* @see AllocationRelationTypeEnum
|
||||
*/
|
||||
@DbColumn(name = "分账关系类型")
|
||||
@DbColumn(comment = "分账关系类型")
|
||||
@TableField(updateStrategy = FieldStrategy.NEVER)
|
||||
private String relationType;
|
||||
|
||||
@DbColumn(name = "关系名称")
|
||||
@DbColumn(comment = "关系名称")
|
||||
@TableField(updateStrategy = FieldStrategy.NEVER)
|
||||
private String relationName;
|
||||
|
||||
@DbColumn(comment = "是否已经同步到网关")
|
||||
private boolean sync;
|
||||
|
||||
/**
|
||||
* 转换
|
||||
*/
|
||||
@Override
|
||||
public AllocationReceiverDto toDto() {
|
||||
return AllocationReceiverConvert.CONVERT.convert(this);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,9 @@
|
||||
package cn.bootx.platform.daxpay.service.core.payment.allocation.service;
|
||||
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.convert.AllocationReceiverConvert;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.dao.AllocationReceiverManager;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.entity.AllocationReceiver;
|
||||
import cn.bootx.platform.daxpay.service.param.allocation.AllocationReceiverParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -13,4 +17,47 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AllocationReceiverService {
|
||||
|
||||
private final AllocationReceiverManager manager;
|
||||
|
||||
/**
|
||||
* 添加分账接收方
|
||||
*/
|
||||
public void add(AllocationReceiverParam param){
|
||||
// 首先添加网关的分账接收方
|
||||
AllocationReceiver receiver = AllocationReceiverConvert.CONVERT.convert(param);
|
||||
receiver.setSync(false);
|
||||
manager.save(receiver);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public void update(AllocationReceiverParam param){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分账接收方
|
||||
*/
|
||||
public void remove(Long id){
|
||||
// 首先删除网关的分账接收方
|
||||
|
||||
// 然后删除本地数据
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步到三方支付系统中
|
||||
*/
|
||||
public void registerByGateway(Long id){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 从三方支付系统中删除
|
||||
*/
|
||||
public void removeByGateway(Long id){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,60 @@
|
||||
package cn.bootx.platform.daxpay.service.dto.allocation;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.daxpay.code.AllocationRelationTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 分账接收方参数
|
||||
* @author xxm
|
||||
* @since 2024/3/28
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "分账接收方参数")
|
||||
public class AllocationReceiverDto extends BaseDto {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "账号别名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* @see PayChannelEnum
|
||||
*/
|
||||
@Schema(description = "所属通道")
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* 分账接收方类型 个人/商户
|
||||
*/
|
||||
@Schema(description = "分账接收方类型")
|
||||
private String receiverType;
|
||||
|
||||
|
||||
@Schema(description = "接收方账号")
|
||||
private String receiverAccount;
|
||||
|
||||
/** 接收方姓名 */
|
||||
@Schema(description = "接收方姓名")
|
||||
private String receiverName;
|
||||
|
||||
/**
|
||||
* 分账关系类型
|
||||
* @see AllocationRelationTypeEnum
|
||||
*/
|
||||
@Schema(description = "分账关系类型")
|
||||
private String relationType;
|
||||
|
||||
@Schema(description = "关系名称")
|
||||
private String relationName;
|
||||
|
||||
@Schema(description = "是否已经同步到网关")
|
||||
private boolean sync;
|
||||
}
|
@@ -29,6 +29,9 @@ public class AliPayConfigDto extends BaseDto implements Serializable {
|
||||
@Schema(description = "是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
@Schema(description = "是否支付分账")
|
||||
private Boolean allocation;
|
||||
|
||||
@Schema(description = "支付限额")
|
||||
private Integer singleLimit;
|
||||
|
||||
|
@@ -31,6 +31,9 @@ public class WeChatPayConfigDto extends BaseDto implements Serializable {
|
||||
@Schema(description = "是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
@Schema(description = "是否支付分账")
|
||||
private Boolean allocation;
|
||||
|
||||
@Schema(description = "支付限额")
|
||||
private Integer singleLimit;
|
||||
|
||||
|
@@ -0,0 +1,58 @@
|
||||
package cn.bootx.platform.daxpay.service.param.allocation;
|
||||
|
||||
import cn.bootx.platform.daxpay.code.AllocationRelationTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 分账接收方参数
|
||||
* @author xxm
|
||||
* @since 2024/3/28
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "分账接收方参数")
|
||||
public class AllocationReceiverParam {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "账号别名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* @see PayChannelEnum
|
||||
*/
|
||||
@Schema(description = "所属通道")
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* 分账接收方类型 个人/商户
|
||||
*/
|
||||
@Schema(description = "分账接收方类型")
|
||||
private String receiverType;
|
||||
|
||||
|
||||
@Schema(description = "接收方账号")
|
||||
private String receiverAccount;
|
||||
|
||||
/** 接收方姓名 */
|
||||
@Schema(description = "接收方姓名")
|
||||
private String receiverName;
|
||||
|
||||
/**
|
||||
* 分账关系类型
|
||||
* @see AllocationRelationTypeEnum
|
||||
*/
|
||||
@Schema(description = "分账关系类型")
|
||||
private String relationType;
|
||||
|
||||
@Schema(description = "关系名称")
|
||||
private String relationName;
|
||||
|
||||
@Schema(description = "是否已经同步到网关")
|
||||
private boolean sync;
|
||||
|
||||
}
|
@@ -21,6 +21,9 @@ public class AliPayConfigParam {
|
||||
@Schema(description = "是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
@Schema(description = "是否支付分账")
|
||||
private Boolean allocation;
|
||||
|
||||
@Schema(description = "支付限额")
|
||||
private Integer singleLimit;
|
||||
|
||||
|
@@ -29,6 +29,9 @@ public class WeChatPayConfigParam {
|
||||
@DbColumn(comment = "是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
@Schema(description = "是否支付分账")
|
||||
private Boolean allocation;
|
||||
|
||||
@Schema(description = "支付限额")
|
||||
private Integer singleLimit;
|
||||
|
||||
|
Reference in New Issue
Block a user