mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-10-14 13:50:25 +00:00
refactor(allocation): 重构分账相关代码
- 优化分账配置功能 - 重命名相关类和接口,使其命名更加清晰和统一
This commit is contained in:
@@ -6,14 +6,14 @@ spring:
|
|||||||
master:
|
master:
|
||||||
# Postgresql连接
|
# Postgresql连接
|
||||||
driver-class-name: org.postgresql.Driver
|
driver-class-name: org.postgresql.Driver
|
||||||
url: jdbc:postgresql://127.0.0.1:5432/dax-pay-single?serverTimezone=Asia/Shanghai&autoReconnect=true&reWriteBatchedInserts=true
|
url: jdbc:postgresql://postgresql:5432/dax-pay-single?serverTimezone=Asia/Shanghai&autoReconnect=true&reWriteBatchedInserts=true
|
||||||
username: bootx
|
username: bootx
|
||||||
password: bootx123
|
password: bootx123
|
||||||
# MySQL连接
|
# MySQL连接
|
||||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
# url: jdbc:mysql://127.0.0.1:3306/dax-pay-single?serverTimezone=GMT%2B8&characterEncoding=utf8&allowMultiQueries=true&useSSL=false&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
# url: jdbc:mysql://mysql:3306/dax-pay-single?serverTimezone=GMT%2B8&characterEncoding=utf8&allowMultiQueries=true&useSSL=false&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
# username: root
|
# username: root
|
||||||
# password: root
|
# password: bootx123
|
||||||
hikari:
|
hikari:
|
||||||
keepalive-time: 300000
|
keepalive-time: 300000
|
||||||
data:
|
data:
|
||||||
|
@@ -10,7 +10,7 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum AllocTransactionResultEnum {
|
public enum AllocationResultEnum {
|
||||||
|
|
||||||
ALL_PENDING("all_pending", "处理中"),
|
ALL_PENDING("all_pending", "处理中"),
|
||||||
ALL_SUCCESS("all_success", "全部成功"),
|
ALL_SUCCESS("all_success", "全部成功"),
|
@@ -10,12 +10,12 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum AllocTransactionStatusEnum {
|
public enum AllocationStatusEnum {
|
||||||
|
|
||||||
ALLOC_PROCESSING("alloc_processing", "分账处理中"),
|
PROCESSING("processing", "分账处理中"),
|
||||||
ALLOC_END("alloc_end", "分账完成"),
|
ALLOC_END("alloc_end", "分账处理完成"),
|
||||||
ALLOC_FAILED("alloc_failed", "分账失败"),
|
ALLOC_FAILED("alloc_failed", "分账失败"),
|
||||||
FINISH("finish", "完结"),
|
FINISH("finish", "分账完结"),
|
||||||
FINISH_FAILED("finish_failed", "完结失败"),
|
FINISH_FAILED("finish_failed", "完结失败"),
|
||||||
IGNORE("ignore", "忽略"),
|
IGNORE("ignore", "忽略"),
|
||||||
;
|
;
|
@@ -13,7 +13,7 @@ import org.dromara.daxpay.core.param.PaymentCommonParam;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@Schema(title = "支付订单查询参数")
|
@Schema(title = "支付订单查询参数")
|
||||||
public class QueryAllocTransactionParam extends PaymentCommonParam {
|
public class QueryAllocOrderParam extends PaymentCommonParam {
|
||||||
|
|
||||||
@Schema(description = "分账单号")
|
@Schema(description = "分账单号")
|
||||||
private String allocNo;
|
private String allocNo;
|
@@ -1,4 +1,4 @@
|
|||||||
package org.dromara.daxpay.core.result.allocation.transaction;
|
package org.dromara.daxpay.core.result.allocation.order;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
@@ -1,24 +1,24 @@
|
|||||||
package org.dromara.daxpay.core.result.allocation.transaction;
|
package org.dromara.daxpay.core.result.allocation.order;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.dromara.daxpay.core.enums.AllocTransactionResultEnum;
|
import org.dromara.daxpay.core.enums.AllocationResultEnum;
|
||||||
import org.dromara.daxpay.core.enums.AllocTransactionStatusEnum;
|
import org.dromara.daxpay.core.enums.AllocationStatusEnum;
|
||||||
import org.dromara.daxpay.core.enums.ChannelEnum;
|
import org.dromara.daxpay.core.enums.ChannelEnum;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分账订单返回结果
|
* 分账订单
|
||||||
* @author xxm
|
* @author xxm
|
||||||
* @since 2024/5/21
|
* @since 2024/5/21
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@Schema(title = "分账订单返回结果")
|
@Schema(title = "分账订单")
|
||||||
public class AllocTransactionResult {
|
public class AllocOrderResult {
|
||||||
|
|
||||||
/** 分账单号 */
|
/** 分账单号 */
|
||||||
@Schema(description = "分账单号")
|
@Schema(description = "分账单号")
|
||||||
@@ -73,14 +73,14 @@ public class AllocTransactionResult {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
* @see AllocTransactionStatusEnum
|
* @see AllocationStatusEnum
|
||||||
*/
|
*/
|
||||||
@Schema(description = "状态")
|
@Schema(description = "状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理结果
|
* 处理结果
|
||||||
* @see AllocTransactionResultEnum
|
* @see AllocationResultEnum
|
||||||
*/
|
*/
|
||||||
@Schema(description = "处理结果")
|
@Schema(description = "处理结果")
|
||||||
private String result;
|
private String result;
|
@@ -1,9 +1,9 @@
|
|||||||
package org.dromara.daxpay.core.result.allocation.transaction;
|
package org.dromara.daxpay.core.result.allocation.order;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.dromara.daxpay.core.enums.AllocTransactionStatusEnum;
|
import org.dromara.daxpay.core.enums.AllocationStatusEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分账请求结果
|
* 分账请求结果
|
||||||
@@ -13,7 +13,7 @@ import org.dromara.daxpay.core.enums.AllocTransactionStatusEnum;
|
|||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@Schema(title = "分账请求结果")
|
@Schema(title = "分账请求结果")
|
||||||
public class AllocResult {
|
public class AllocationResult {
|
||||||
/** 分账订单号 */
|
/** 分账订单号 */
|
||||||
@Schema(description = "分账订单号")
|
@Schema(description = "分账订单号")
|
||||||
private String allocNo;
|
private String allocNo;
|
||||||
@@ -24,7 +24,7 @@ public class AllocResult {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 分账状态
|
* 分账状态
|
||||||
* @see AllocTransactionStatusEnum
|
* @see AllocationStatusEnum
|
||||||
*/
|
*/
|
||||||
@Schema(description = "分账状态")
|
@Schema(description = "分账状态")
|
||||||
private String status;
|
private String status;
|
@@ -1,4 +1,4 @@
|
|||||||
package org.dromara.daxpay.service.bo.allocation.receiver;
|
package org.dromara.daxpay.service.bo.allocation;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
@@ -0,0 +1,52 @@
|
|||||||
|
package org.dromara.daxpay.service.controller.allocation;
|
||||||
|
|
||||||
|
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.allocation.AllocConfigParam;
|
||||||
|
import org.dromara.daxpay.service.result.allocation.AllocConfigResult;
|
||||||
|
import org.dromara.daxpay.service.service.allocation.AllocConfigService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账配置
|
||||||
|
* @author xxm
|
||||||
|
* @since 2024/12/9
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@Tag(name = "分账配置")
|
||||||
|
@RestController
|
||||||
|
@RequestGroup(groupCode = "AllocConfig", groupName = "分账配置", moduleCode = "Alloc", moduleName = "分账管理" )
|
||||||
|
@RequestMapping("/allocation/config")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AllocController {
|
||||||
|
private final AllocConfigService allocConfigService;
|
||||||
|
|
||||||
|
@RequestPath("保存")
|
||||||
|
@Operation(summary = "修改")
|
||||||
|
@PostMapping("/save")
|
||||||
|
public Result<Void> add(@Validated @RequestBody AllocConfigParam param) {
|
||||||
|
allocConfigService.save(param);
|
||||||
|
return Res.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestPath("修改")
|
||||||
|
@Operation(summary = "修改")
|
||||||
|
@PostMapping("/update")
|
||||||
|
public Result<Void> update(@Validated @RequestBody AllocConfigParam param) {
|
||||||
|
allocConfigService.update(param);
|
||||||
|
return Res.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestPath("根据应用ID查询详情")
|
||||||
|
@Operation(summary = "根据应用ID查询详情")
|
||||||
|
@GetMapping("/findByAppId")
|
||||||
|
public Result<AllocConfigResult> findByAppId(String appId) {
|
||||||
|
return Res.ok(allocConfigService.findByAppId(appId));
|
||||||
|
}
|
||||||
|
}
|
@@ -10,12 +10,12 @@ import cn.bootx.platform.core.util.ValidationUtil;
|
|||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocGroupResultBo;
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocGroupVo;
|
||||||
import org.dromara.daxpay.service.param.allocation.group.AllocGroupBindParam;
|
import org.dromara.daxpay.service.param.allocation.group.AllocGroupBindParam;
|
||||||
import org.dromara.daxpay.service.param.allocation.group.AllocGroupParam;
|
import org.dromara.daxpay.service.param.allocation.group.AllocGroupParam;
|
||||||
import org.dromara.daxpay.service.param.allocation.group.AllocGroupQuery;
|
import org.dromara.daxpay.service.param.allocation.group.AllocGroupQuery;
|
||||||
import org.dromara.daxpay.service.param.allocation.group.AllocGroupUnbindParam;
|
import org.dromara.daxpay.service.param.allocation.group.AllocGroupUnbindParam;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocGroupReceiverResultBo;
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocGroupReceiverVo;
|
||||||
import org.dromara.daxpay.service.service.allocation.receiver.AllocGroupService;
|
import org.dromara.daxpay.service.service.allocation.receiver.AllocGroupService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -40,14 +40,14 @@ public class AllocGroupController {
|
|||||||
@RequestPath("分页")
|
@RequestPath("分页")
|
||||||
@Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public Result<PageResult<AllocGroupResultBo>> page(PageParam pageParam, AllocGroupQuery query){
|
public Result<PageResult<AllocGroupVo>> page(PageParam pageParam, AllocGroupQuery query){
|
||||||
return Res.ok(allocGroupService.page(pageParam,query));
|
return Res.ok(allocGroupService.page(pageParam,query));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestPath("查询详情")
|
@RequestPath("查询详情")
|
||||||
@Operation(summary = "查询详情")
|
@Operation(summary = "查询详情")
|
||||||
@GetMapping("/findById")
|
@GetMapping("/findById")
|
||||||
public Result<AllocGroupResultBo> findById(Long id){
|
public Result<AllocGroupVo> findById(Long id){
|
||||||
return Res.ok(allocGroupService.findById(id));
|
return Res.ok(allocGroupService.findById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ public class AllocGroupController {
|
|||||||
@RequestPath("查询分账接收方信息")
|
@RequestPath("查询分账接收方信息")
|
||||||
@Operation(summary = "查询分账接收方信息")
|
@Operation(summary = "查询分账接收方信息")
|
||||||
@GetMapping("/findReceiversByGroups")
|
@GetMapping("/findReceiversByGroups")
|
||||||
public Result<List<AllocGroupReceiverResultBo>> findReceiversByGroups(Long groupId){
|
public Result<List<AllocGroupReceiverVo>> findReceiversByGroups(Long groupId){
|
||||||
return Res.ok(allocGroupService.findReceiversByGroups(groupId));
|
return Res.ok(allocGroupService.findReceiversByGroups(groupId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.daxpay.service.controller.allocation;
|
package org.dromara.daxpay.service.controller.allocation;
|
||||||
|
|
||||||
|
import cn.bootx.platform.core.annotation.RequestGroup;
|
||||||
import cn.bootx.platform.core.rest.Res;
|
import cn.bootx.platform.core.rest.Res;
|
||||||
import cn.bootx.platform.core.rest.param.PageParam;
|
import cn.bootx.platform.core.rest.param.PageParam;
|
||||||
import cn.bootx.platform.core.rest.result.PageResult;
|
import cn.bootx.platform.core.rest.result.PageResult;
|
||||||
@@ -8,11 +9,11 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.daxpay.core.param.allocation.transaction.AllocFinishParam;
|
import org.dromara.daxpay.core.param.allocation.transaction.AllocFinishParam;
|
||||||
import org.dromara.daxpay.core.result.allocation.transaction.AllocDetailResult;
|
import org.dromara.daxpay.core.result.allocation.order.AllocDetailResult;
|
||||||
import org.dromara.daxpay.core.result.allocation.transaction.AllocTransactionResult;
|
import org.dromara.daxpay.core.result.allocation.order.AllocOrderResult;
|
||||||
import org.dromara.daxpay.service.param.order.allocation.AllocOrderQuery;
|
import org.dromara.daxpay.service.param.order.allocation.AllocOrderQuery;
|
||||||
import org.dromara.daxpay.service.service.allocation.AllocationService;
|
import org.dromara.daxpay.service.service.allocation.AllocationService;
|
||||||
import org.dromara.daxpay.service.service.allocation.transaction.AllocQueryService;
|
import org.dromara.daxpay.service.service.allocation.order.AllocOrderQueryService;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -27,17 +28,18 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Tag(name = "分账订单控制器")
|
@Tag(name = "分账订单控制器")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/allocation/transaction")
|
@RequestGroup(groupCode = "AllocOrder", groupName = "分账订单", moduleCode = "Alloc", moduleName = "分账管理" )
|
||||||
|
@RequestMapping("/allocation/order")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AllocTransactionController {
|
public class AllocOrderController {
|
||||||
|
|
||||||
private final AllocQueryService queryService;
|
private final AllocOrderQueryService queryService;
|
||||||
|
|
||||||
private final AllocationService allocationService;
|
private final AllocationService allocationService;
|
||||||
|
|
||||||
@Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public Result<PageResult<AllocTransactionResult>> page(PageParam pageParam, AllocOrderQuery param){
|
public Result<PageResult<AllocOrderResult>> page(PageParam pageParam, AllocOrderQuery param){
|
||||||
return Res.ok(queryService.page(pageParam,param));
|
return Res.ok(queryService.page(pageParam,param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +51,7 @@ public class AllocTransactionController {
|
|||||||
|
|
||||||
@Operation(summary = "查询详情")
|
@Operation(summary = "查询详情")
|
||||||
@GetMapping("/findById")
|
@GetMapping("/findById")
|
||||||
public Result<AllocTransactionResult> findById(Long id){
|
public Result<AllocOrderResult> findById(Long id){
|
||||||
return Res.ok(queryService.findById(id));
|
return Res.ok(queryService.findById(id));
|
||||||
}
|
}
|
||||||
|
|
@@ -14,7 +14,7 @@ import jakarta.validation.constraints.NotBlank;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverAddParam;
|
import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverAddParam;
|
||||||
import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverRemoveParam;
|
import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverRemoveParam;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocReceiverResultBo;
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocReceiverVo;
|
||||||
import org.dromara.daxpay.service.param.allocation.receiver.AllocReceiverQuery;
|
import org.dromara.daxpay.service.param.allocation.receiver.AllocReceiverQuery;
|
||||||
import org.dromara.daxpay.service.service.allocation.receiver.AllocReceiverService;
|
import org.dromara.daxpay.service.service.allocation.receiver.AllocReceiverService;
|
||||||
import org.dromara.daxpay.service.service.assist.PaymentAssistService;
|
import org.dromara.daxpay.service.service.assist.PaymentAssistService;
|
||||||
@@ -42,14 +42,14 @@ public class AllocReceiverController {
|
|||||||
@RequestPath("分页")
|
@RequestPath("分页")
|
||||||
@Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public Result<PageResult<AllocReceiverResultBo>> page(PageParam pageParam, AllocReceiverQuery query){
|
public Result<PageResult<AllocReceiverVo>> page(PageParam pageParam, AllocReceiverQuery query){
|
||||||
return Res.ok(receiverService.page(pageParam, query));
|
return Res.ok(receiverService.page(pageParam, query));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestPath("查询详情")
|
@RequestPath("查询详情")
|
||||||
@Operation(summary = "查询详情")
|
@Operation(summary = "查询详情")
|
||||||
@GetMapping("/findById")
|
@GetMapping("/findById")
|
||||||
public Result<AllocReceiverResultBo> findById(Long id){
|
public Result<AllocReceiverVo> findById(Long id){
|
||||||
return Res.ok(receiverService.findById(id));
|
return Res.ok(receiverService.findById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,11 +9,11 @@ import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverQueryParam
|
|||||||
import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverRemoveParam;
|
import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverRemoveParam;
|
||||||
import org.dromara.daxpay.core.param.allocation.transaction.AllocFinishParam;
|
import org.dromara.daxpay.core.param.allocation.transaction.AllocFinishParam;
|
||||||
import org.dromara.daxpay.core.param.allocation.transaction.AllocationParam;
|
import org.dromara.daxpay.core.param.allocation.transaction.AllocationParam;
|
||||||
import org.dromara.daxpay.core.param.allocation.transaction.QueryAllocTransactionParam;
|
import org.dromara.daxpay.core.param.allocation.transaction.QueryAllocOrderParam;
|
||||||
import org.dromara.daxpay.core.result.DaxResult;
|
import org.dromara.daxpay.core.result.DaxResult;
|
||||||
|
import org.dromara.daxpay.core.result.allocation.order.AllocOrderResult;
|
||||||
|
import org.dromara.daxpay.core.result.allocation.order.AllocationResult;
|
||||||
import org.dromara.daxpay.core.result.allocation.receiver.AllocReceiverResult;
|
import org.dromara.daxpay.core.result.allocation.receiver.AllocReceiverResult;
|
||||||
import org.dromara.daxpay.core.result.allocation.transaction.AllocResult;
|
|
||||||
import org.dromara.daxpay.core.result.allocation.transaction.AllocTransactionResult;
|
|
||||||
import org.dromara.daxpay.core.util.DaxRes;
|
import org.dromara.daxpay.core.util.DaxRes;
|
||||||
import org.dromara.daxpay.service.common.anno.PaymentVerify;
|
import org.dromara.daxpay.service.common.anno.PaymentVerify;
|
||||||
import org.dromara.daxpay.service.service.allocation.AllocationService;
|
import org.dromara.daxpay.service.service.allocation.AllocationService;
|
||||||
@@ -40,20 +40,20 @@ public class UniAllocationController {
|
|||||||
|
|
||||||
@Operation(summary = "发起分账接口")
|
@Operation(summary = "发起分账接口")
|
||||||
@PostMapping("/start")
|
@PostMapping("/start")
|
||||||
public DaxResult<AllocResult> start(@RequestBody AllocationParam param){
|
public DaxResult<AllocationResult> start(@RequestBody AllocationParam param){
|
||||||
return DaxRes.ok(allocationService.allocation(param));
|
return DaxRes.ok(allocationService.allocation(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "分账完结接口")
|
@Operation(summary = "分账完结接口")
|
||||||
@PostMapping("/finish")
|
@PostMapping("/finish")
|
||||||
public DaxResult<AllocResult> finish(AllocFinishParam param){
|
public DaxResult<AllocationResult> finish(AllocFinishParam param){
|
||||||
return DaxRes.ok(allocationService.finish(param));
|
return DaxRes.ok(allocationService.finish(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "分账写你查询接口")
|
@Operation(summary = "分账写你查询接口")
|
||||||
@PostMapping("/query")
|
@PostMapping("/query")
|
||||||
public DaxResult<AllocTransactionResult> query(@RequestBody QueryAllocTransactionParam param){
|
public DaxResult<AllocOrderResult> query(@RequestBody QueryAllocOrderParam param){
|
||||||
return DaxRes.ok(allocationService.queryAllocTransaction(param));
|
return DaxRes.ok(allocationService.queryAllocOrder(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "分账接收方查询接口")
|
@Operation(summary = "分账接收方查询接口")
|
||||||
|
@@ -0,0 +1,22 @@
|
|||||||
|
package org.dromara.daxpay.service.convert.allocation;
|
||||||
|
|
||||||
|
import org.dromara.daxpay.service.entity.allocation.AllocConfig;
|
||||||
|
import org.dromara.daxpay.service.param.allocation.AllocConfigParam;
|
||||||
|
import org.dromara.daxpay.service.result.allocation.AllocConfigResult;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账配置
|
||||||
|
* @author xxm
|
||||||
|
* @since 2024/12/9
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface AllocConfigConvert {
|
||||||
|
|
||||||
|
AllocConfigConvert CONVERT = Mappers.getMapper(AllocConfigConvert.class);
|
||||||
|
|
||||||
|
AllocConfigResult toResult(AllocConfig in);
|
||||||
|
|
||||||
|
AllocConfig toEntity(AllocConfigParam in);
|
||||||
|
}
|
@@ -2,7 +2,7 @@ package org.dromara.daxpay.service.convert.allocation;
|
|||||||
|
|
||||||
import org.dromara.daxpay.service.entity.allocation.receiver.AllocGroup;
|
import org.dromara.daxpay.service.entity.allocation.receiver.AllocGroup;
|
||||||
import org.dromara.daxpay.service.param.allocation.group.AllocGroupParam;
|
import org.dromara.daxpay.service.param.allocation.group.AllocGroupParam;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocGroupResultBo;
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocGroupVo;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ import org.mapstruct.factory.Mappers;
|
|||||||
public interface AllocGroupConvert {
|
public interface AllocGroupConvert {
|
||||||
AllocGroupConvert CONVERT = Mappers.getMapper(AllocGroupConvert.class);
|
AllocGroupConvert CONVERT = Mappers.getMapper(AllocGroupConvert.class);
|
||||||
|
|
||||||
AllocGroupResultBo convert(AllocGroup in);
|
AllocGroupVo toVo(AllocGroup in);
|
||||||
|
|
||||||
AllocGroup convert(AllocGroupParam in);
|
AllocGroup toEntity(AllocGroupParam in);
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package org.dromara.daxpay.service.convert.allocation;
|
package org.dromara.daxpay.service.convert.allocation;
|
||||||
|
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocGroupReceiverResultBo;
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocGroupReceiverVo;
|
||||||
import org.dromara.daxpay.service.entity.allocation.receiver.AllocGroupReceiver;
|
import org.dromara.daxpay.service.entity.allocation.receiver.AllocGroupReceiver;
|
||||||
import org.dromara.daxpay.service.param.allocation.group.AllocGroupReceiverParam;
|
import org.dromara.daxpay.service.param.allocation.group.AllocGroupReceiverParam;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
@@ -15,7 +15,7 @@ import org.mapstruct.factory.Mappers;
|
|||||||
public interface AllocGroupReceiverConvert {
|
public interface AllocGroupReceiverConvert {
|
||||||
AllocGroupReceiverConvert CONVERT = Mappers.getMapper(AllocGroupReceiverConvert.class);
|
AllocGroupReceiverConvert CONVERT = Mappers.getMapper(AllocGroupReceiverConvert.class);
|
||||||
|
|
||||||
AllocGroupReceiverResultBo convert(AllocGroupReceiver in);
|
AllocGroupReceiverVo toVo(AllocGroupReceiver in);
|
||||||
|
|
||||||
AllocGroupReceiver convert(AllocGroupReceiverParam in);
|
AllocGroupReceiver toEntity(AllocGroupReceiverParam in);
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,28 @@
|
|||||||
|
package org.dromara.daxpay.service.convert.allocation;
|
||||||
|
|
||||||
|
import org.dromara.daxpay.core.result.allocation.order.AllocDetailResult;
|
||||||
|
import org.dromara.daxpay.core.result.allocation.order.AllocOrderResult;
|
||||||
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocDetail;
|
||||||
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocOrder;
|
||||||
|
import org.dromara.daxpay.service.result.allocation.order.AllocDetailVo;
|
||||||
|
import org.dromara.daxpay.service.result.allocation.order.AllocOrderVo;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author xxm
|
||||||
|
* @since 2024/11/15
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface AllocOrderConvert {
|
||||||
|
AllocOrderConvert CONVERT = Mappers.getMapper(AllocOrderConvert.class);
|
||||||
|
|
||||||
|
AllocOrderResult toResult(AllocOrder in);
|
||||||
|
|
||||||
|
AllocDetailResult toResult(AllocDetail in);
|
||||||
|
|
||||||
|
AllocOrderVo toVo(AllocOrder in);
|
||||||
|
|
||||||
|
AllocDetailVo toVo(AllocDetail in);
|
||||||
|
}
|
@@ -2,7 +2,7 @@ package org.dromara.daxpay.service.convert.allocation;
|
|||||||
|
|
||||||
import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverAddParam;
|
import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverAddParam;
|
||||||
import org.dromara.daxpay.core.result.allocation.receiver.AllocReceiverResult;
|
import org.dromara.daxpay.core.result.allocation.receiver.AllocReceiverResult;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocReceiverResultBo;
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocReceiverVo;
|
||||||
import org.dromara.daxpay.service.entity.allocation.receiver.AllocReceiver;
|
import org.dromara.daxpay.service.entity.allocation.receiver.AllocReceiver;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@@ -20,7 +20,7 @@ public interface AllocReceiverConvert {
|
|||||||
|
|
||||||
AllocReceiver convert(AllocReceiverAddParam in);
|
AllocReceiver convert(AllocReceiverAddParam in);
|
||||||
|
|
||||||
AllocReceiverResultBo toBo(AllocReceiver in);
|
AllocReceiverVo toBo(AllocReceiver in);
|
||||||
|
|
||||||
AllocReceiverResult toResult(AllocReceiver in);
|
AllocReceiverResult toResult(AllocReceiver in);
|
||||||
|
|
||||||
|
@@ -1,22 +0,0 @@
|
|||||||
package org.dromara.daxpay.service.convert.allocation;
|
|
||||||
|
|
||||||
import org.dromara.daxpay.core.result.allocation.transaction.AllocDetailResult;
|
|
||||||
import org.dromara.daxpay.core.result.allocation.transaction.AllocTransactionResult;
|
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocDetail;
|
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocTransaction;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author xxm
|
|
||||||
* @since 2024/11/15
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface AllocTransactionConvert {
|
|
||||||
AllocTransactionConvert CONVERT = Mappers.getMapper(AllocTransactionConvert.class);
|
|
||||||
|
|
||||||
AllocTransactionResult toResult(AllocTransaction in);
|
|
||||||
|
|
||||||
AllocDetailResult toResult(AllocDetail in);
|
|
||||||
}
|
|
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocTransaction;
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocOrder;
|
||||||
import org.dromara.daxpay.service.param.order.allocation.AllocOrderQuery;
|
import org.dromara.daxpay.service.param.order.allocation.AllocOrderQuery;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@@ -23,23 +23,23 @@ import java.util.Optional;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Repository
|
@Repository
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AllocTransactionManager extends BaseManager<AllocTransactionMapper, AllocTransaction> {
|
public class AllocOrderManager extends BaseManager<AllocOrderMapper, AllocOrder> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
*/
|
*/
|
||||||
public Page<AllocTransaction> page(PageParam pageParam, AllocOrderQuery param){
|
public Page<AllocOrder> page(PageParam pageParam, AllocOrderQuery param){
|
||||||
Page<AllocTransaction> mpPage = MpUtil.getMpPage(pageParam, AllocTransaction.class);
|
Page<AllocOrder> mpPage = MpUtil.getMpPage(pageParam, AllocOrder.class);
|
||||||
QueryWrapper<AllocTransaction> generator = QueryGenerator.generator(param);
|
QueryWrapper<AllocOrder> generator = QueryGenerator.generator(param);
|
||||||
return this.page(mpPage, generator);
|
return this.page(mpPage, generator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据商户分账单号查询数据
|
* 根据商户分账单号查询数据
|
||||||
*/
|
*/
|
||||||
public Optional<AllocTransaction> findByBizAllocNo(String bizAllocNo, String appId) {
|
public Optional<AllocOrder> findByBizAllocNo(String bizAllocNo, String appId) {
|
||||||
return lambdaQuery()
|
return lambdaQuery()
|
||||||
.eq(AllocTransaction::getBizAllocNo, bizAllocNo)
|
.eq(AllocOrder::getBizAllocNo, bizAllocNo)
|
||||||
.eq(MchAppBaseEntity::getAppId, appId)
|
.eq(MchAppBaseEntity::getAppId, appId)
|
||||||
.oneOpt();
|
.oneOpt();
|
||||||
}
|
}
|
||||||
@@ -47,9 +47,9 @@ public class AllocTransactionManager extends BaseManager<AllocTransactionMapper,
|
|||||||
/**
|
/**
|
||||||
* 根据分账单号查询数据
|
* 根据分账单号查询数据
|
||||||
*/
|
*/
|
||||||
public Optional<AllocTransaction> findByAllocNo(String allocNo, String appId) {
|
public Optional<AllocOrder> findByAllocNo(String allocNo, String appId) {
|
||||||
return lambdaQuery()
|
return lambdaQuery()
|
||||||
.eq(AllocTransaction::getAllocNo, allocNo)
|
.eq(AllocOrder::getAllocNo, allocNo)
|
||||||
.eq(MchAppBaseEntity::getAppId, appId)
|
.eq(MchAppBaseEntity::getAppId, appId)
|
||||||
.oneOpt();
|
.oneOpt();
|
||||||
}
|
}
|
@@ -2,7 +2,7 @@ package org.dromara.daxpay.service.dao.allocation.transaction;
|
|||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocTransaction;
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocOrder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -10,5 +10,5 @@ import org.dromara.daxpay.service.entity.allocation.transaction.AllocTransaction
|
|||||||
* @since 2024/11/14
|
* @since 2024/11/14
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface AllocTransactionMapper extends MPJBaseMapper<AllocTransaction> {
|
public interface AllocOrderMapper extends MPJBaseMapper<AllocOrder> {
|
||||||
}
|
}
|
@@ -3,11 +3,14 @@ package org.dromara.daxpay.service.dao.config;
|
|||||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.daxpay.service.entity.config.AllocConfig;
|
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||||
|
import org.dromara.daxpay.service.entity.allocation.AllocConfig;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 分账配置
|
||||||
* @author xxm
|
* @author xxm
|
||||||
* @since 2024/10/6
|
* @since 2024/10/6
|
||||||
*/
|
*/
|
||||||
@@ -15,4 +18,18 @@ import org.springframework.stereotype.Repository;
|
|||||||
@Repository
|
@Repository
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AllocConfigManger extends BaseManager<AllocConfigMapper, AllocConfig> {
|
public class AllocConfigManger extends BaseManager<AllocConfigMapper, AllocConfig> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是都已经存在数据
|
||||||
|
*/
|
||||||
|
public boolean existsByAppId(String appId) {
|
||||||
|
return existedByField(MchAppBaseEntity::getAppId, appId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据应用ID进行查询
|
||||||
|
*/
|
||||||
|
public Optional<AllocConfig> findByAppId(String appId) {
|
||||||
|
return findByField(MchAppBaseEntity::getAppId, appId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@ package org.dromara.daxpay.service.dao.config;
|
|||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.dromara.daxpay.service.entity.config.AllocConfig;
|
import org.dromara.daxpay.service.entity.allocation.AllocConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@@ -0,0 +1,46 @@
|
|||||||
|
package org.dromara.daxpay.service.entity.allocation;
|
||||||
|
|
||||||
|
import cn.bootx.platform.common.mybatisplus.function.ToResult;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||||
|
import org.dromara.daxpay.service.convert.allocation.AllocConfigConvert;
|
||||||
|
import org.dromara.daxpay.service.param.allocation.AllocConfigParam;
|
||||||
|
import org.dromara.daxpay.service.result.allocation.AllocConfigResult;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账配置
|
||||||
|
* @author xxm
|
||||||
|
* @since 2024/10/6
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("pay_alloc_config")
|
||||||
|
public class AllocConfig extends MchAppBaseEntity implements ToResult<AllocConfigResult> {
|
||||||
|
|
||||||
|
/** 是否自动分账 */
|
||||||
|
private Boolean autoAlloc;
|
||||||
|
|
||||||
|
/** 分账起始额 */
|
||||||
|
private BigDecimal minAmount;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建对象
|
||||||
|
*/
|
||||||
|
public static AllocConfig init(AllocConfigParam param) {
|
||||||
|
return AllocConfigConvert.CONVERT.toEntity(param);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 转换
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AllocConfigResult toResult() {
|
||||||
|
return AllocConfigConvert.CONVERT.toResult(this);
|
||||||
|
}
|
||||||
|
}
|
@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocGroupResultBo;
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocGroupVo;
|
||||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||||
import org.dromara.daxpay.service.convert.allocation.AllocGroupConvert;
|
import org.dromara.daxpay.service.convert.allocation.AllocGroupConvert;
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ import java.math.BigDecimal;
|
|||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("pay_alloc_group")
|
@TableName("pay_alloc_group")
|
||||||
public class AllocGroup extends MchAppBaseEntity implements ToResult<AllocGroupResultBo> {
|
public class AllocGroup extends MchAppBaseEntity implements ToResult<AllocGroupVo> {
|
||||||
|
|
||||||
/** 分账组编码 */
|
/** 分账组编码 */
|
||||||
private String groupNo;
|
private String groupNo;
|
||||||
@@ -44,7 +44,7 @@ public class AllocGroup extends MchAppBaseEntity implements ToResult<AllocGroupR
|
|||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AllocGroupResultBo toResult() {
|
public AllocGroupVo toResult() {
|
||||||
return AllocGroupConvert.CONVERT.convert(this);
|
return AllocGroupConvert.CONVERT.toVo(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocGroupReceiverResultBo;
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocGroupReceiverVo;
|
||||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||||
import org.dromara.daxpay.service.convert.allocation.AllocGroupReceiverConvert;
|
import org.dromara.daxpay.service.convert.allocation.AllocGroupReceiverConvert;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ import java.math.BigDecimal;
|
|||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("pay_alloc_group_receiver")
|
@TableName("pay_alloc_group_receiver")
|
||||||
public class AllocGroupReceiver extends MchAppBaseEntity implements ToResult<AllocGroupReceiverResultBo> {
|
public class AllocGroupReceiver extends MchAppBaseEntity implements ToResult<AllocGroupReceiverVo> {
|
||||||
|
|
||||||
/** 分账组ID */
|
/** 分账组ID */
|
||||||
private Long groupId;
|
private Long groupId;
|
||||||
@@ -32,7 +32,7 @@ public class AllocGroupReceiver extends MchAppBaseEntity implements ToResult<All
|
|||||||
private BigDecimal rate;
|
private BigDecimal rate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AllocGroupReceiverResultBo toResult() {
|
public AllocGroupReceiverVo toResult() {
|
||||||
return AllocGroupReceiverConvert.CONVERT.convert(this);
|
return AllocGroupReceiverConvert.CONVERT.toVo(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.dromara.daxpay.service.convert.allocation.AllocReceiverConvert;
|
import org.dromara.daxpay.service.convert.allocation.AllocReceiverConvert;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocReceiverResultBo;
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocReceiverVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分账接收方
|
* 分账接收方
|
||||||
@@ -23,7 +23,7 @@ import org.dromara.daxpay.service.bo.allocation.receiver.AllocReceiverResultBo;
|
|||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("pay_alloc_receiver")
|
@TableName("pay_alloc_receiver")
|
||||||
public class AllocReceiver extends MchAppBaseEntity implements ToResult<AllocReceiverResultBo> {
|
public class AllocReceiver extends MchAppBaseEntity implements ToResult<AllocReceiverVo> {
|
||||||
|
|
||||||
/** 分账接收方编号, 需要保证唯一 */
|
/** 分账接收方编号, 需要保证唯一 */
|
||||||
private String receiverNo;
|
private String receiverNo;
|
||||||
@@ -58,7 +58,7 @@ public class AllocReceiver extends MchAppBaseEntity implements ToResult<AllocRec
|
|||||||
private String relationName;
|
private String relationName;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AllocReceiverResultBo toResult() {
|
public AllocReceiverVo toResult() {
|
||||||
return AllocReceiverConvert.CONVERT.toBo(this);
|
return AllocReceiverConvert.CONVERT.toBo(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,5 +7,4 @@ import java.util.List;
|
|||||||
* @author xxm
|
* @author xxm
|
||||||
* @since 2024/11/14
|
* @since 2024/11/14
|
||||||
*/
|
*/
|
||||||
public record TransactionAndDetail(AllocTransaction transaction,
|
public record AllocAndDetail(AllocOrder transaction, List<AllocDetail> details) {}
|
||||||
List<AllocDetail> details) {}
|
|
@@ -7,9 +7,9 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.dromara.daxpay.core.enums.AllocDetailResultEnum;
|
import org.dromara.daxpay.core.enums.AllocDetailResultEnum;
|
||||||
import org.dromara.daxpay.core.enums.AllocReceiverTypeEnum;
|
import org.dromara.daxpay.core.enums.AllocReceiverTypeEnum;
|
||||||
import org.dromara.daxpay.core.result.allocation.transaction.AllocDetailResult;
|
import org.dromara.daxpay.core.result.allocation.order.AllocDetailResult;
|
||||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||||
import org.dromara.daxpay.service.convert.allocation.AllocTransactionConvert;
|
import org.dromara.daxpay.service.convert.allocation.AllocOrderConvert;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -72,6 +72,6 @@ public class AllocDetail extends MchAppBaseEntity implements ToResult<AllocDetai
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AllocDetailResult toResult() {
|
public AllocDetailResult toResult() {
|
||||||
return AllocTransactionConvert.CONVERT.toResult(this);
|
return AllocOrderConvert.CONVERT.toResult(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,12 +7,12 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.dromara.daxpay.core.enums.AllocTransactionResultEnum;
|
import org.dromara.daxpay.core.enums.AllocationResultEnum;
|
||||||
import org.dromara.daxpay.core.enums.AllocTransactionStatusEnum;
|
import org.dromara.daxpay.core.enums.AllocationStatusEnum;
|
||||||
import org.dromara.daxpay.core.enums.ChannelEnum;
|
import org.dromara.daxpay.core.enums.ChannelEnum;
|
||||||
import org.dromara.daxpay.core.result.allocation.transaction.AllocTransactionResult;
|
import org.dromara.daxpay.core.result.allocation.order.AllocOrderResult;
|
||||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||||
import org.dromara.daxpay.service.convert.allocation.AllocTransactionConvert;
|
import org.dromara.daxpay.service.convert.allocation.AllocOrderConvert;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -26,7 +26,7 @@ import java.time.LocalDateTime;
|
|||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("pay_alloc_transaction")
|
@TableName("pay_alloc_transaction")
|
||||||
public class AllocTransaction extends MchAppBaseEntity implements ToResult<AllocTransactionResult> {
|
public class AllocOrder extends MchAppBaseEntity implements ToResult<AllocOrderResult> {
|
||||||
|
|
||||||
/** 分账单号 */
|
/** 分账单号 */
|
||||||
private String allocNo;
|
private String allocNo;
|
||||||
@@ -70,13 +70,13 @@ public class AllocTransaction extends MchAppBaseEntity implements ToResult<Alloc
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
* @see AllocTransactionStatusEnum
|
* @see AllocationStatusEnum
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理结果
|
* 处理结果
|
||||||
* @see AllocTransactionResultEnum
|
* @see AllocationResultEnum
|
||||||
*/
|
*/
|
||||||
private String result;
|
private String result;
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ public class AllocTransaction extends MchAppBaseEntity implements ToResult<Alloc
|
|||||||
* 转换
|
* 转换
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AllocTransactionResult toResult() {
|
public AllocOrderResult toResult() {
|
||||||
return AllocTransactionConvert.CONVERT.toResult(this);
|
return AllocOrderConvert.CONVERT.toResult(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,33 +0,0 @@
|
|||||||
package org.dromara.daxpay.service.entity.config;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分账配置
|
|
||||||
* @author xxm
|
|
||||||
* @since 2024/10/6
|
|
||||||
*/
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("pay_alloc_config")
|
|
||||||
public class AllocConfig extends MchAppBaseEntity {
|
|
||||||
|
|
||||||
/** 是否自动分账 */
|
|
||||||
private Boolean autoAlloc;
|
|
||||||
|
|
||||||
/** 开启分账最低额 */
|
|
||||||
private Boolean enableAllocLimit;
|
|
||||||
|
|
||||||
/** 大于多少开启分账 */
|
|
||||||
private BigDecimal minAmount;
|
|
||||||
|
|
||||||
/** 分账时机类型 立即/定期/延时 */
|
|
||||||
private String allocTimeType;
|
|
||||||
}
|
|
@@ -0,0 +1,34 @@
|
|||||||
|
package org.dromara.daxpay.service.param.allocation;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账配置参数
|
||||||
|
* @author xxm
|
||||||
|
* @since 2024/12/9
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(title = "分账配置参数")
|
||||||
|
public class AllocConfigParam {
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
@Schema(description = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 是否自动分账 */
|
||||||
|
@Schema(description = "是否自动分账")
|
||||||
|
private Boolean autoAlloc;
|
||||||
|
|
||||||
|
/** 分账起始额 */
|
||||||
|
@Schema(description = "分账起始额")
|
||||||
|
private BigDecimal minAmount;
|
||||||
|
|
||||||
|
@Schema(description = "应用AppId")
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,27 @@
|
|||||||
|
package org.dromara.daxpay.service.result.allocation;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.dromara.daxpay.core.result.MchAppResult;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账配置
|
||||||
|
* @author xxm
|
||||||
|
* @since 2024/12/9
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(title = "分账配置")
|
||||||
|
public class AllocConfigResult extends MchAppResult {
|
||||||
|
|
||||||
|
@Schema(description = "是否自动分账")
|
||||||
|
private Boolean autoAlloc;
|
||||||
|
|
||||||
|
@Schema(description = "分账起始额")
|
||||||
|
private BigDecimal minAmount;
|
||||||
|
}
|
@@ -0,0 +1,68 @@
|
|||||||
|
package org.dromara.daxpay.service.result.allocation.order;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.dromara.daxpay.core.enums.AllocDetailResultEnum;
|
||||||
|
import org.dromara.daxpay.core.enums.AllocReceiverTypeEnum;
|
||||||
|
import org.dromara.daxpay.core.result.MchAppResult;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账订单明细
|
||||||
|
* @author xxm
|
||||||
|
* @since 2024/5/21
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(title = "分账订单明细")
|
||||||
|
public class AllocDetailVo extends MchAppResult {
|
||||||
|
|
||||||
|
@Schema(description = "分账接收方编号")
|
||||||
|
private String receiverNo;
|
||||||
|
|
||||||
|
/** 分账金额 */
|
||||||
|
@Schema(description = "分账金额")
|
||||||
|
private Integer amount;
|
||||||
|
|
||||||
|
/** 分账比例 */
|
||||||
|
@Schema(description = "分账比例(万分之多少)")
|
||||||
|
private Integer rate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账接收方类型
|
||||||
|
* @see AllocReceiverTypeEnum
|
||||||
|
*/
|
||||||
|
@Schema(description = "分账接收方类型")
|
||||||
|
private String receiverType;
|
||||||
|
|
||||||
|
/** 接收方账号 */
|
||||||
|
@Schema(description = "接收方账号")
|
||||||
|
private String receiverAccount;
|
||||||
|
|
||||||
|
/** 接收方姓名 */
|
||||||
|
@Schema(description = "接收方姓名")
|
||||||
|
private String receiverName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账结果
|
||||||
|
* @see AllocDetailResultEnum
|
||||||
|
*/
|
||||||
|
@Schema(description = "分账结果")
|
||||||
|
private String result;
|
||||||
|
|
||||||
|
/** 错误代码 */
|
||||||
|
@Schema(description = "错误代码")
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/** 错误原因 */
|
||||||
|
@Schema(description = "错误原因")
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
|
/** 分账完成时间 */
|
||||||
|
@Schema(description = "分账完成时间")
|
||||||
|
private LocalDateTime finishTime;
|
||||||
|
}
|
@@ -0,0 +1,111 @@
|
|||||||
|
package org.dromara.daxpay.service.result.allocation.order;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.dromara.daxpay.core.enums.AllocationResultEnum;
|
||||||
|
import org.dromara.daxpay.core.enums.AllocationStatusEnum;
|
||||||
|
import org.dromara.daxpay.core.enums.ChannelEnum;
|
||||||
|
import org.dromara.daxpay.core.result.MchAppResult;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账订单
|
||||||
|
* @author xxm
|
||||||
|
* @since 2024/5/21
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(title = "分账订单")
|
||||||
|
public class AllocOrderVo extends MchAppResult {
|
||||||
|
|
||||||
|
/** 分账单号 */
|
||||||
|
@Schema(description = "分账单号")
|
||||||
|
private String allocNo;
|
||||||
|
|
||||||
|
/** 商户分账单号 */
|
||||||
|
@Schema(description = "商户分账单号")
|
||||||
|
private String bizAllocNo;
|
||||||
|
|
||||||
|
/** 通道分账号 */
|
||||||
|
@Schema(description = "通道分账号")
|
||||||
|
private String outAllocNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付订单号
|
||||||
|
*/
|
||||||
|
@Schema(description = "支付订单号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
/** 商户支付订单号 */
|
||||||
|
@Schema(description = "商户支付订单号")
|
||||||
|
private String bizOrderNo;
|
||||||
|
|
||||||
|
/** 通道支付订单号 */
|
||||||
|
@Schema(description = "通道支付订单号")
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付订单标题
|
||||||
|
*/
|
||||||
|
@Schema(description = "支付订单标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属通道
|
||||||
|
* @see ChannelEnum
|
||||||
|
*/
|
||||||
|
@Schema(description = "所属通道")
|
||||||
|
private String channel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总分账金额
|
||||||
|
*/
|
||||||
|
@Schema(description = "总分账金额")
|
||||||
|
private Integer amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账描述
|
||||||
|
*/
|
||||||
|
@Schema(description = "分账描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
* @see AllocationStatusEnum
|
||||||
|
*/
|
||||||
|
@Schema(description = "状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理结果
|
||||||
|
* @see AllocationResultEnum
|
||||||
|
*/
|
||||||
|
@Schema(description = "处理结果")
|
||||||
|
private String result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误码
|
||||||
|
*/
|
||||||
|
@Schema(description = "错误码")
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误信息
|
||||||
|
*/
|
||||||
|
@Schema(description = "错误原因")
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
|
/** 分账订单完成时间 */
|
||||||
|
@Schema(description = "分账订单完成时间")
|
||||||
|
private LocalDateTime finishTime;
|
||||||
|
|
||||||
|
/** 分账明细 */
|
||||||
|
@Schema(description = "分账明细")
|
||||||
|
private List<AllocDetailVo> details;
|
||||||
|
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
package org.dromara.daxpay.service.bo.allocation.receiver;
|
package org.dromara.daxpay.service.result.allocation.receiver;
|
||||||
|
|
||||||
import cn.bootx.platform.common.jackson.sensitive.SensitiveInfo;
|
import cn.bootx.platform.common.jackson.sensitive.SensitiveInfo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -19,7 +19,7 @@ import java.math.BigDecimal;
|
|||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@Schema(title = "分账组接收方信息")
|
@Schema(title = "分账组接收方信息")
|
||||||
public class AllocGroupReceiverResultBo extends MchAppResult {
|
public class AllocGroupReceiverVo extends MchAppResult {
|
||||||
|
|
||||||
@Schema(description = "接收方ID")
|
@Schema(description = "接收方ID")
|
||||||
private Long receiverId;
|
private Long receiverId;
|
@@ -1,4 +1,4 @@
|
|||||||
package org.dromara.daxpay.service.bo.allocation.receiver;
|
package org.dromara.daxpay.service.result.allocation.receiver;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -17,7 +17,7 @@ import java.math.BigDecimal;
|
|||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@Schema(title = "分账组")
|
@Schema(title = "分账组")
|
||||||
public class AllocGroupResultBo extends MchAppResult {
|
public class AllocGroupVo extends MchAppResult {
|
||||||
|
|
||||||
@Schema(description = "分账组编号")
|
@Schema(description = "分账组编号")
|
||||||
private String groupNo;
|
private String groupNo;
|
@@ -1,4 +1,4 @@
|
|||||||
package org.dromara.daxpay.service.bo.allocation.receiver;
|
package org.dromara.daxpay.service.result.allocation.receiver;
|
||||||
|
|
||||||
import cn.bootx.platform.common.jackson.sensitive.SensitiveInfo;
|
import cn.bootx.platform.common.jackson.sensitive.SensitiveInfo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -17,7 +17,7 @@ import org.dromara.daxpay.core.result.MchAppResult;
|
|||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@Schema(title = "分账接收方")
|
@Schema(title = "分账接收方")
|
||||||
public class AllocReceiverResultBo extends MchAppResult {
|
public class AllocReceiverVo extends MchAppResult {
|
||||||
|
|
||||||
@Schema(description = "接收方编号")
|
@Schema(description = "接收方编号")
|
||||||
private String receiverNo;
|
private String receiverNo;
|
@@ -0,0 +1,59 @@
|
|||||||
|
package org.dromara.daxpay.service.service.allocation;
|
||||||
|
|
||||||
|
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.service.convert.allocation.AllocConfigConvert;
|
||||||
|
import org.dromara.daxpay.service.dao.config.AllocConfigManger;
|
||||||
|
import org.dromara.daxpay.service.entity.allocation.AllocConfig;
|
||||||
|
import org.dromara.daxpay.service.param.allocation.AllocConfigParam;
|
||||||
|
import org.dromara.daxpay.service.result.allocation.AllocConfigResult;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账配置
|
||||||
|
* @author xxm
|
||||||
|
* @since 2024/12/9
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AllocConfigService {
|
||||||
|
private final AllocConfigManger allocConfigManger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
public void save(AllocConfigParam param) {
|
||||||
|
// 判断是否已经存在
|
||||||
|
if (allocConfigManger.existsByAppId(param.getAppId())){
|
||||||
|
throw new RepetitiveOperationException("该应用已存在收银台配置");
|
||||||
|
}
|
||||||
|
|
||||||
|
AllocConfig entity = AllocConfigConvert.CONVERT.toEntity(param);
|
||||||
|
allocConfigManger.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
public void update(AllocConfigParam param) {
|
||||||
|
AllocConfig config = allocConfigManger.findById(param.getId())
|
||||||
|
.orElseThrow(() -> new DataNotExistException("分账配置不存在"));
|
||||||
|
BeanUtil.copyProperties(config, param, CopyOptions.create().ignoreNullValue());
|
||||||
|
allocConfigManger.updateById(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据AppId查询
|
||||||
|
*/
|
||||||
|
public AllocConfigResult findByAppId(String appId) {
|
||||||
|
return allocConfigManger.findByAppId(appId).map(AllocConfig::toResult)
|
||||||
|
.orElse(new AllocConfigResult().setAutoAlloc(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -6,24 +6,24 @@ import com.baomidou.lock.LockInfo;
|
|||||||
import com.baomidou.lock.LockTemplate;
|
import com.baomidou.lock.LockTemplate;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.daxpay.core.enums.AllocTransactionResultEnum;
|
import org.dromara.daxpay.core.enums.AllocationResultEnum;
|
||||||
import org.dromara.daxpay.core.enums.AllocTransactionStatusEnum;
|
import org.dromara.daxpay.core.enums.AllocationStatusEnum;
|
||||||
import org.dromara.daxpay.core.exception.DataErrorException;
|
import org.dromara.daxpay.core.exception.DataErrorException;
|
||||||
import org.dromara.daxpay.core.exception.TradeStatusErrorException;
|
import org.dromara.daxpay.core.exception.TradeStatusErrorException;
|
||||||
import org.dromara.daxpay.core.param.allocation.transaction.AllocFinishParam;
|
import org.dromara.daxpay.core.param.allocation.transaction.AllocFinishParam;
|
||||||
import org.dromara.daxpay.core.param.allocation.transaction.AllocationParam;
|
import org.dromara.daxpay.core.param.allocation.transaction.AllocationParam;
|
||||||
import org.dromara.daxpay.core.param.allocation.transaction.QueryAllocTransactionParam;
|
import org.dromara.daxpay.core.param.allocation.transaction.QueryAllocOrderParam;
|
||||||
import org.dromara.daxpay.core.result.allocation.transaction.AllocResult;
|
import org.dromara.daxpay.core.result.allocation.order.AllocOrderResult;
|
||||||
import org.dromara.daxpay.core.result.allocation.transaction.AllocTransactionResult;
|
import org.dromara.daxpay.core.result.allocation.order.AllocationResult;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocStartResultBo;
|
import org.dromara.daxpay.service.bo.allocation.AllocStartResultBo;
|
||||||
import org.dromara.daxpay.service.convert.allocation.AllocTransactionConvert;
|
import org.dromara.daxpay.service.convert.allocation.AllocOrderConvert;
|
||||||
import org.dromara.daxpay.service.dao.allocation.transaction.AllocDetailManager;
|
import org.dromara.daxpay.service.dao.allocation.transaction.AllocDetailManager;
|
||||||
import org.dromara.daxpay.service.dao.allocation.transaction.AllocTransactionManager;
|
import org.dromara.daxpay.service.dao.allocation.transaction.AllocOrderManager;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocDetail;
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocDetail;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocTransaction;
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocOrder;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.TransactionAndDetail;
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocAndDetail;
|
||||||
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
||||||
import org.dromara.daxpay.service.service.allocation.transaction.AllocAssistService;
|
import org.dromara.daxpay.service.service.allocation.order.AllocationAssistService;
|
||||||
import org.dromara.daxpay.service.strategy.AbsAllocationStrategy;
|
import org.dromara.daxpay.service.strategy.AbsAllocationStrategy;
|
||||||
import org.dromara.daxpay.service.util.PaymentStrategyFactory;
|
import org.dromara.daxpay.service.util.PaymentStrategyFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -34,8 +34,8 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.dromara.daxpay.core.enums.AllocTransactionStatusEnum.ALLOC_END;
|
import static org.dromara.daxpay.core.enums.AllocationStatusEnum.ALLOC_END;
|
||||||
import static org.dromara.daxpay.core.enums.AllocTransactionStatusEnum.FINISH_FAILED;
|
import static org.dromara.daxpay.core.enums.AllocationStatusEnum.FINISH_FAILED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分账处理
|
* 分账处理
|
||||||
@@ -47,11 +47,11 @@ import static org.dromara.daxpay.core.enums.AllocTransactionStatusEnum.FINISH_FA
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AllocationService {
|
public class AllocationService {
|
||||||
|
|
||||||
private final AllocTransactionManager allocationOrderManager;
|
private final AllocOrderManager allocationOrderManager;
|
||||||
|
|
||||||
private final AllocDetailManager allocOrderDetailManager;
|
private final AllocDetailManager allocOrderDetailManager;
|
||||||
|
|
||||||
private final AllocAssistService allocationAssistService;
|
private final AllocationAssistService allocationAssistService;
|
||||||
|
|
||||||
private final LockTemplate lockTemplate;
|
private final LockTemplate lockTemplate;
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ public class AllocationService {
|
|||||||
* 开启分账 多次请求只会分账一次
|
* 开启分账 多次请求只会分账一次
|
||||||
* 优先级 分账接收方列表 > 分账组编号 > 默认分账组
|
* 优先级 分账接收方列表 > 分账组编号 > 默认分账组
|
||||||
*/
|
*/
|
||||||
public AllocResult allocation(AllocationParam param) {
|
public AllocationResult allocation(AllocationParam param) {
|
||||||
// 判断是否已经有分账订单
|
// 判断是否已经有分账订单
|
||||||
var allocOrder = allocationOrderManager.findByBizAllocNo(param.getBizAllocNo(), param.getAppId()).orElse(null);
|
var allocOrder = allocationOrderManager.findByBizAllocNo(param.getBizAllocNo(), param.getAppId()).orElse(null);
|
||||||
if (Objects.nonNull(allocOrder)){
|
if (Objects.nonNull(allocOrder)){
|
||||||
@@ -75,20 +75,20 @@ public class AllocationService {
|
|||||||
/**
|
/**
|
||||||
* 开启分账 优先级 分账接收方列表 > 分账组编号 > 默认分账组
|
* 开启分账 优先级 分账接收方列表 > 分账组编号 > 默认分账组
|
||||||
*/
|
*/
|
||||||
public AllocResult allocation(AllocationParam param, PayOrder payOrder) {
|
public AllocationResult allocation(AllocationParam param, PayOrder payOrder) {
|
||||||
LockInfo lock = lockTemplate.lock("payment:allocation:" + payOrder.getId(),10000,200);
|
LockInfo lock = lockTemplate.lock("payment:allocation:" + payOrder.getId(),10000,200);
|
||||||
if (Objects.isNull(lock)){
|
if (Objects.isNull(lock)){
|
||||||
throw new RepetitiveOperationException("分账发起处理中,请勿重复操作");
|
throw new RepetitiveOperationException("分账发起处理中,请勿重复操作");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// 构建分账订单相关信息
|
// 构建分账订单相关信息
|
||||||
TransactionAndDetail orderAndDetail = allocationAssistService.checkAndCreateAlloc(param, payOrder);
|
AllocAndDetail orderAndDetail = allocationAssistService.checkAndCreateAlloc(param, payOrder);
|
||||||
// 检查是否需要进行分账
|
// 检查是否需要进行分账
|
||||||
var order = orderAndDetail.transaction();
|
var order = orderAndDetail.transaction();
|
||||||
List<AllocDetail> details = orderAndDetail.details();
|
List<AllocDetail> details = orderAndDetail.details();
|
||||||
// 无需进行分账,
|
// 无需进行分账,
|
||||||
if (Objects.equals(order.getStatus(), AllocTransactionStatusEnum.IGNORE.getCode())){
|
if (Objects.equals(order.getStatus(), AllocationStatusEnum.IGNORE.getCode())){
|
||||||
return new AllocResult()
|
return new AllocationResult()
|
||||||
.setAllocNo(order.getAllocNo())
|
.setAllocNo(order.getAllocNo())
|
||||||
.setBizAllocNo(order.getBizAllocNo())
|
.setBizAllocNo(order.getBizAllocNo())
|
||||||
.setStatus(order.getStatus());
|
.setStatus(order.getStatus());
|
||||||
@@ -102,19 +102,19 @@ public class AllocationService {
|
|||||||
// 分账处理
|
// 分账处理
|
||||||
AllocStartResultBo result = allocationStrategy.start();
|
AllocStartResultBo result = allocationStrategy.start();
|
||||||
// 执行中
|
// 执行中
|
||||||
order.setStatus(AllocTransactionStatusEnum.ALLOC_PROCESSING.getCode())
|
order.setStatus(AllocationStatusEnum.PROCESSING.getCode())
|
||||||
.setResult(AllocTransactionResultEnum.ALL_PENDING.getCode())
|
.setResult(AllocationResultEnum.ALL_PENDING.getCode())
|
||||||
.setOutAllocNo(result.getOutAllocNo())
|
.setOutAllocNo(result.getOutAllocNo())
|
||||||
.setErrorMsg(null);
|
.setErrorMsg(null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("分账出现错误:", e);
|
log.error("分账出现错误:", e);
|
||||||
// 失败
|
// 失败
|
||||||
order.setStatus(AllocTransactionStatusEnum.ALLOC_FAILED.getCode())
|
order.setStatus(AllocationStatusEnum.ALLOC_FAILED.getCode())
|
||||||
.setErrorMsg(e.getMessage());
|
.setErrorMsg(e.getMessage());
|
||||||
// TODO 返回异常处理
|
// TODO 返回异常处理
|
||||||
}
|
}
|
||||||
allocationOrderManager.updateById(order);
|
allocationOrderManager.updateById(order);
|
||||||
return new AllocResult()
|
return new AllocationResult()
|
||||||
.setAllocNo(order.getAllocNo())
|
.setAllocNo(order.getAllocNo())
|
||||||
.setBizAllocNo(order.getBizAllocNo())
|
.setBizAllocNo(order.getBizAllocNo())
|
||||||
.setStatus(order.getStatus());
|
.setStatus(order.getStatus());
|
||||||
@@ -126,7 +126,7 @@ public class AllocationService {
|
|||||||
/**
|
/**
|
||||||
* 重新分账
|
* 重新分账
|
||||||
*/
|
*/
|
||||||
private AllocResult retryAlloc(AllocationParam param, AllocTransaction order){
|
private AllocationResult retryAlloc(AllocationParam param, AllocOrder order){
|
||||||
LockInfo lock = lockTemplate.lock("payment:allocation:" + order.getOrderId(),10000,200);
|
LockInfo lock = lockTemplate.lock("payment:allocation:" + order.getOrderId(),10000,200);
|
||||||
if (Objects.isNull(lock)){
|
if (Objects.isNull(lock)){
|
||||||
throw new RepetitiveOperationException("分账发起处理中,请勿重复操作");
|
throw new RepetitiveOperationException("分账发起处理中,请勿重复操作");
|
||||||
@@ -134,8 +134,8 @@ public class AllocationService {
|
|||||||
try {
|
try {
|
||||||
// 需要是分账中分账中或者完成状态才能重新分账
|
// 需要是分账中分账中或者完成状态才能重新分账
|
||||||
List<String> list = Arrays.asList(ALLOC_END.getCode(),
|
List<String> list = Arrays.asList(ALLOC_END.getCode(),
|
||||||
AllocTransactionStatusEnum.ALLOC_FAILED.getCode(),
|
AllocationStatusEnum.ALLOC_FAILED.getCode(),
|
||||||
AllocTransactionStatusEnum.ALLOC_PROCESSING.getCode());
|
AllocationStatusEnum.PROCESSING.getCode());
|
||||||
if (!list.contains(order.getStatus())){
|
if (!list.contains(order.getStatus())){
|
||||||
throw new TradeStatusErrorException("分账单状态错误,无法重试");
|
throw new TradeStatusErrorException("分账单状态错误,无法重试");
|
||||||
}
|
}
|
||||||
@@ -150,16 +150,16 @@ public class AllocationService {
|
|||||||
try {
|
try {
|
||||||
// 重复分账处理
|
// 重复分账处理
|
||||||
allocationStrategy.start();
|
allocationStrategy.start();
|
||||||
order.setStatus(AllocTransactionStatusEnum.ALLOC_PROCESSING.getCode())
|
order.setStatus(AllocationStatusEnum.PROCESSING.getCode())
|
||||||
.setErrorMsg(null);
|
.setErrorMsg(null);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("重新分账出现错误:", e);
|
log.error("重新分账出现错误:", e);
|
||||||
order.setStatus(AllocTransactionStatusEnum.ALLOC_FAILED.getCode())
|
order.setStatus(AllocationStatusEnum.ALLOC_FAILED.getCode())
|
||||||
.setErrorMsg(e.getMessage());
|
.setErrorMsg(e.getMessage());
|
||||||
}
|
}
|
||||||
allocationOrderManager.updateById(order);
|
allocationOrderManager.updateById(order);
|
||||||
return new AllocResult()
|
return new AllocationResult()
|
||||||
.setAllocNo(order.getAllocNo())
|
.setAllocNo(order.getAllocNo())
|
||||||
.setBizAllocNo(order.getBizAllocNo())
|
.setBizAllocNo(order.getBizAllocNo())
|
||||||
.setStatus(order.getStatus());
|
.setStatus(order.getStatus());
|
||||||
@@ -171,8 +171,8 @@ public class AllocationService {
|
|||||||
/**
|
/**
|
||||||
* 分账完结
|
* 分账完结
|
||||||
*/
|
*/
|
||||||
public AllocResult finish(AllocFinishParam param) {
|
public AllocationResult finish(AllocFinishParam param) {
|
||||||
AllocTransaction allocOrder;
|
AllocOrder allocOrder;
|
||||||
if (Objects.nonNull(param.getAllocNo())){
|
if (Objects.nonNull(param.getAllocNo())){
|
||||||
allocOrder = allocationOrderManager.findByAllocNo(param.getAllocNo(), param.getAppId())
|
allocOrder = allocationOrderManager.findByAllocNo(param.getAllocNo(), param.getAppId())
|
||||||
.orElseThrow(() -> new DataNotExistException("未查询到分账单信息"));
|
.orElseThrow(() -> new DataNotExistException("未查询到分账单信息"));
|
||||||
@@ -186,7 +186,7 @@ public class AllocationService {
|
|||||||
/**
|
/**
|
||||||
* 分账完结
|
* 分账完结
|
||||||
*/
|
*/
|
||||||
public AllocResult finish(AllocTransaction allocOrder) {
|
public AllocationResult finish(AllocOrder allocOrder) {
|
||||||
// 只有分账结束后才可以完结
|
// 只有分账结束后才可以完结
|
||||||
if (!Arrays.asList(ALLOC_END.getCode(),FINISH_FAILED.getCode()).contains(allocOrder.getStatus())) {
|
if (!Arrays.asList(ALLOC_END.getCode(),FINISH_FAILED.getCode()).contains(allocOrder.getStatus())) {
|
||||||
throw new TradeStatusErrorException("分账单状态错误");
|
throw new TradeStatusErrorException("分账单状态错误");
|
||||||
@@ -203,7 +203,7 @@ public class AllocationService {
|
|||||||
// 完结处理
|
// 完结处理
|
||||||
allocationStrategy.finish();
|
allocationStrategy.finish();
|
||||||
// 完结状态
|
// 完结状态
|
||||||
allocOrder.setStatus(AllocTransactionStatusEnum.FINISH.getCode())
|
allocOrder.setStatus(AllocationStatusEnum.FINISH.getCode())
|
||||||
.setFinishTime(LocalDateTime.now())
|
.setFinishTime(LocalDateTime.now())
|
||||||
.setErrorMsg(null);
|
.setErrorMsg(null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -213,7 +213,7 @@ public class AllocationService {
|
|||||||
.setErrorMsg(e.getMessage());
|
.setErrorMsg(e.getMessage());
|
||||||
}
|
}
|
||||||
allocationOrderManager.updateById(allocOrder);
|
allocationOrderManager.updateById(allocOrder);
|
||||||
return new AllocResult()
|
return new AllocationResult()
|
||||||
.setAllocNo(allocOrder.getAllocNo())
|
.setAllocNo(allocOrder.getAllocNo())
|
||||||
.setBizAllocNo(allocOrder.getBizAllocNo())
|
.setBizAllocNo(allocOrder.getBizAllocNo())
|
||||||
.setStatus(allocOrder.getStatus());
|
.setStatus(allocOrder.getStatus());
|
||||||
@@ -223,14 +223,14 @@ public class AllocationService {
|
|||||||
/**
|
/**
|
||||||
* 查询分账结果
|
* 查询分账结果
|
||||||
*/
|
*/
|
||||||
public AllocTransactionResult queryAllocTransaction(QueryAllocTransactionParam param) {
|
public AllocOrderResult queryAllocOrder(QueryAllocOrderParam param) {
|
||||||
// 查询分账单
|
// 查询分账单
|
||||||
var allocOrder = allocationOrderManager.findByAllocNo(param.getAllocNo(), param.getAppId())
|
var allocOrder = allocationOrderManager.findByAllocNo(param.getAllocNo(), param.getAppId())
|
||||||
.orElseThrow(() -> new DataErrorException("分账单不存在"));
|
.orElseThrow(() -> new DataErrorException("分账单不存在"));
|
||||||
var result = AllocTransactionConvert.CONVERT.toResult(allocOrder);
|
var result = AllocOrderConvert.CONVERT.toResult(allocOrder);
|
||||||
// 查询分账单明细
|
// 查询分账单明细
|
||||||
var details = allocOrderDetailManager.findAllByOrderId(allocOrder.getId()).stream()
|
var details = allocOrderDetailManager.findAllByOrderId(allocOrder.getId()).stream()
|
||||||
.map(AllocTransactionConvert.CONVERT::toResult)
|
.map(AllocOrderConvert.CONVERT::toResult)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
result.setDetails(details);
|
result.setDetails(details);
|
||||||
return result;
|
return result;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
package org.dromara.daxpay.service.service.allocation.transaction;
|
package org.dromara.daxpay.service.service.allocation.order;
|
||||||
|
|
||||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||||
import cn.bootx.platform.core.exception.DataNotExistException;
|
import cn.bootx.platform.core.exception.DataNotExistException;
|
||||||
@@ -6,12 +6,12 @@ import cn.bootx.platform.core.rest.param.PageParam;
|
|||||||
import cn.bootx.platform.core.rest.result.PageResult;
|
import cn.bootx.platform.core.rest.result.PageResult;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.daxpay.core.result.allocation.transaction.AllocDetailResult;
|
import org.dromara.daxpay.core.result.allocation.order.AllocDetailResult;
|
||||||
import org.dromara.daxpay.core.result.allocation.transaction.AllocTransactionResult;
|
import org.dromara.daxpay.core.result.allocation.order.AllocOrderResult;
|
||||||
import org.dromara.daxpay.service.dao.allocation.transaction.AllocDetailManager;
|
import org.dromara.daxpay.service.dao.allocation.transaction.AllocDetailManager;
|
||||||
import org.dromara.daxpay.service.dao.allocation.transaction.AllocTransactionManager;
|
import org.dromara.daxpay.service.dao.allocation.transaction.AllocOrderManager;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocDetail;
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocDetail;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocTransaction;
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocOrder;
|
||||||
import org.dromara.daxpay.service.param.order.allocation.AllocOrderQuery;
|
import org.dromara.daxpay.service.param.order.allocation.AllocOrderQuery;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -25,24 +25,24 @@ import java.util.List;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AllocQueryService {
|
public class AllocOrderQueryService {
|
||||||
|
|
||||||
private final AllocDetailManager allocOrderDetailManager;
|
private final AllocDetailManager allocOrderDetailManager;
|
||||||
|
|
||||||
private final AllocTransactionManager allocationOrderManager;
|
private final AllocOrderManager allocationOrderManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*/
|
*/
|
||||||
public PageResult<AllocTransactionResult> page(PageParam pageParam, AllocOrderQuery param){
|
public PageResult<AllocOrderResult> page(PageParam pageParam, AllocOrderQuery param){
|
||||||
return MpUtil.toPageResult(allocationOrderManager.page(pageParam, param));
|
return MpUtil.toPageResult(allocationOrderManager.page(pageParam, param));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询详情
|
* 查询详情
|
||||||
*/
|
*/
|
||||||
public AllocTransactionResult findById(Long id) {
|
public AllocOrderResult findById(Long id) {
|
||||||
return allocationOrderManager.findById(id).map(AllocTransaction::toResult).orElseThrow(() -> new DataNotExistException("分账订单不存在"));
|
return allocationOrderManager.findById(id).map(AllocOrder::toResult).orElseThrow(() -> new DataNotExistException("分账订单不存在"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@@ -1,4 +1,4 @@
|
|||||||
package org.dromara.daxpay.service.service.allocation.transaction;
|
package org.dromara.daxpay.service.service.allocation.order;
|
||||||
|
|
||||||
import cn.bootx.platform.core.exception.ValidationFailedException;
|
import cn.bootx.platform.core.exception.ValidationFailedException;
|
||||||
import cn.bootx.platform.core.util.BigDecimalUtil;
|
import cn.bootx.platform.core.util.BigDecimalUtil;
|
||||||
@@ -6,20 +6,20 @@ import cn.hutool.core.util.IdUtil;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.daxpay.core.enums.AllocDetailResultEnum;
|
import org.dromara.daxpay.core.enums.AllocDetailResultEnum;
|
||||||
import org.dromara.daxpay.core.enums.AllocTransactionResultEnum;
|
import org.dromara.daxpay.core.enums.AllocationResultEnum;
|
||||||
import org.dromara.daxpay.core.enums.AllocTransactionStatusEnum;
|
import org.dromara.daxpay.core.enums.AllocationStatusEnum;
|
||||||
import org.dromara.daxpay.core.enums.PayAllocStatusEnum;
|
import org.dromara.daxpay.core.enums.PayAllocStatusEnum;
|
||||||
import org.dromara.daxpay.core.param.allocation.transaction.ReceiverParam;
|
import org.dromara.daxpay.core.param.allocation.transaction.ReceiverParam;
|
||||||
import org.dromara.daxpay.core.param.allocation.transaction.AllocationParam;
|
import org.dromara.daxpay.core.param.allocation.transaction.AllocationParam;
|
||||||
import org.dromara.daxpay.core.util.TradeNoGenerateUtil;
|
import org.dromara.daxpay.core.util.TradeNoGenerateUtil;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocGroupReceiverResultBo;
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocDetail;
|
||||||
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocOrder;
|
||||||
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocGroupReceiverVo;
|
||||||
import org.dromara.daxpay.service.dao.allocation.receiver.AllocReceiverManager;
|
import org.dromara.daxpay.service.dao.allocation.receiver.AllocReceiverManager;
|
||||||
import org.dromara.daxpay.service.dao.allocation.transaction.AllocDetailManager;
|
import org.dromara.daxpay.service.dao.allocation.transaction.AllocDetailManager;
|
||||||
import org.dromara.daxpay.service.dao.allocation.transaction.AllocTransactionManager;
|
import org.dromara.daxpay.service.dao.allocation.transaction.AllocOrderManager;
|
||||||
import org.dromara.daxpay.service.dao.order.pay.PayOrderManager;
|
import org.dromara.daxpay.service.dao.order.pay.PayOrderManager;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocTransaction;
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocAndDetail;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocDetail;
|
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.TransactionAndDetail;
|
|
||||||
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -39,11 +39,11 @@ import java.util.stream.Collectors;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AllocTransactionService {
|
public class AllocOrderService {
|
||||||
|
|
||||||
private final AllocReceiverManager receiverManager;
|
private final AllocReceiverManager receiverManager;
|
||||||
|
|
||||||
private final AllocTransactionManager transactionManager;
|
private final AllocOrderManager transactionManager;
|
||||||
|
|
||||||
private final AllocDetailManager transactionDetailManager;
|
private final AllocDetailManager transactionDetailManager;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ public class AllocTransactionService {
|
|||||||
* 生成分账订单, 根据分账组创建
|
* 生成分账订单, 根据分账组创建
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public TransactionAndDetail createAndUpdate(AllocationParam param, PayOrder payOrder, List<AllocGroupReceiverResultBo> receiversByGroups) {
|
public AllocAndDetail createAndUpdate(AllocationParam param, PayOrder payOrder, List<AllocGroupReceiverVo> receiversByGroups) {
|
||||||
// 订单明细
|
// 订单明细
|
||||||
List<AllocDetail> details = receiversByGroups.stream()
|
List<AllocDetail> details = receiversByGroups.stream()
|
||||||
.map(o -> {
|
.map(o -> {
|
||||||
@@ -88,7 +88,7 @@ public class AllocTransactionService {
|
|||||||
* 生成分账订单, 通过传入的分账方创建
|
* 生成分账订单, 通过传入的分账方创建
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public TransactionAndDetail createAndUpdate(AllocationParam param, PayOrder payOrder) {
|
public AllocAndDetail createAndUpdate(AllocationParam param, PayOrder payOrder) {
|
||||||
List<String> receiverNos = param.getReceivers()
|
List<String> receiverNos = param.getReceivers()
|
||||||
.stream()
|
.stream()
|
||||||
.map(ReceiverParam::getReceiverNo)
|
.map(ReceiverParam::getReceiverNo)
|
||||||
@@ -140,7 +140,7 @@ public class AllocTransactionService {
|
|||||||
/**
|
/**
|
||||||
* 保存分账相关订单信息
|
* 保存分账相关订单信息
|
||||||
*/
|
*/
|
||||||
private TransactionAndDetail saveAllocOrder(AllocationParam param, PayOrder payOrder, List<AllocDetail> details) {
|
private AllocAndDetail saveAllocOrder(AllocationParam param, PayOrder payOrder, List<AllocDetail> details) {
|
||||||
long allocId = IdUtil.getSnowflakeNextId();
|
long allocId = IdUtil.getSnowflakeNextId();
|
||||||
// 分账明细设置ID
|
// 分账明细设置ID
|
||||||
details.forEach(o -> o.setAllocationId(allocId));
|
details.forEach(o -> o.setAllocationId(allocId));
|
||||||
@@ -149,7 +149,7 @@ public class AllocTransactionService {
|
|||||||
.map(AllocDetail::getAmount)
|
.map(AllocDetail::getAmount)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
// 分账订单
|
// 分账订单
|
||||||
var allocOrder = new AllocTransaction()
|
var allocOrder = new AllocOrder()
|
||||||
.setOrderId(payOrder.getId())
|
.setOrderId(payOrder.getId())
|
||||||
.setOrderNo(payOrder.getOrderNo())
|
.setOrderNo(payOrder.getOrderNo())
|
||||||
.setBizOrderNo(payOrder.getBizOrderNo())
|
.setBizOrderNo(payOrder.getBizOrderNo())
|
||||||
@@ -159,17 +159,17 @@ public class AllocTransactionService {
|
|||||||
.setBizAllocNo(param.getBizAllocNo())
|
.setBizAllocNo(param.getBizAllocNo())
|
||||||
.setChannel(payOrder.getChannel())
|
.setChannel(payOrder.getChannel())
|
||||||
.setDescription(param.getDescription())
|
.setDescription(param.getDescription())
|
||||||
.setStatus(AllocTransactionStatusEnum.ALLOC_PROCESSING.getCode())
|
.setStatus(AllocationStatusEnum.PROCESSING.getCode())
|
||||||
.setResult(AllocTransactionResultEnum.ALL_PENDING.getCode())
|
.setResult(AllocationResultEnum.ALL_PENDING.getCode())
|
||||||
.setAmount(sumAmount)
|
.setAmount(sumAmount)
|
||||||
.setNotifyUrl(param.getNotifyUrl())
|
.setNotifyUrl(param.getNotifyUrl())
|
||||||
.setAttach(param.getAttach())
|
.setAttach(param.getAttach())
|
||||||
.setClientIp(param.getClientIp());
|
.setClientIp(param.getClientIp());
|
||||||
// 如果分账订单金额为0, 设置为忽略状态
|
// 如果分账订单金额为0, 设置为忽略状态
|
||||||
if (BigDecimalUtil.isEqual(sumAmount, BigDecimal.ZERO)) {
|
if (BigDecimalUtil.isEqual(sumAmount, BigDecimal.ZERO)) {
|
||||||
allocOrder.setStatus(AllocTransactionStatusEnum.IGNORE.getCode())
|
allocOrder.setStatus(AllocationStatusEnum.IGNORE.getCode())
|
||||||
.setFinishTime(LocalDateTime.now())
|
.setFinishTime(LocalDateTime.now())
|
||||||
.setResult(AllocTransactionStatusEnum.ALLOC_FAILED.getCode())
|
.setResult(AllocationStatusEnum.ALLOC_FAILED.getCode())
|
||||||
.setErrorMsg("分账比例有误或金额太小, 无法进行分账");
|
.setErrorMsg("分账比例有误或金额太小, 无法进行分账");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ public class AllocTransactionService {
|
|||||||
payOrderManager.updateById(payOrder);
|
payOrderManager.updateById(payOrder);
|
||||||
transactionDetailManager.saveAll(details);
|
transactionDetailManager.saveAll(details);
|
||||||
transactionManager.save(allocOrder);
|
transactionManager.save(allocOrder);
|
||||||
return new TransactionAndDetail(allocOrder,details);
|
return new AllocAndDetail(allocOrder,details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
package org.dromara.daxpay.service.service.allocation.transaction;
|
package org.dromara.daxpay.service.service.allocation.order;
|
||||||
|
|
||||||
import cn.bootx.platform.core.exception.ValidationFailedException;
|
import cn.bootx.platform.core.exception.ValidationFailedException;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
@@ -13,11 +13,11 @@ import org.dromara.daxpay.core.exception.TradeStatusErrorException;
|
|||||||
import org.dromara.daxpay.core.param.allocation.transaction.AllocationParam;
|
import org.dromara.daxpay.core.param.allocation.transaction.AllocationParam;
|
||||||
import org.dromara.daxpay.service.dao.allocation.receiver.AllocGroupManager;
|
import org.dromara.daxpay.service.dao.allocation.receiver.AllocGroupManager;
|
||||||
import org.dromara.daxpay.service.dao.allocation.transaction.AllocDetailManager;
|
import org.dromara.daxpay.service.dao.allocation.transaction.AllocDetailManager;
|
||||||
import org.dromara.daxpay.service.dao.allocation.transaction.AllocTransactionManager;
|
import org.dromara.daxpay.service.dao.allocation.transaction.AllocOrderManager;
|
||||||
import org.dromara.daxpay.service.entity.allocation.receiver.AllocGroup;
|
import org.dromara.daxpay.service.entity.allocation.receiver.AllocGroup;
|
||||||
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocOrder;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocDetail;
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocDetail;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocTransaction;
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocAndDetail;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.TransactionAndDetail;
|
|
||||||
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
||||||
import org.dromara.daxpay.service.service.allocation.receiver.AllocGroupService;
|
import org.dromara.daxpay.service.service.allocation.receiver.AllocGroupService;
|
||||||
import org.dromara.daxpay.service.service.order.pay.PayOrderQueryService;
|
import org.dromara.daxpay.service.service.order.pay.PayOrderQueryService;
|
||||||
@@ -36,9 +36,9 @@ import java.util.stream.Collectors;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AllocAssistService {
|
public class AllocationAssistService {
|
||||||
|
|
||||||
private final AllocTransactionManager transactionManager;
|
private final AllocOrderManager transactionManager;
|
||||||
|
|
||||||
private final PayOrderQueryService payOrderQueryService;
|
private final PayOrderQueryService payOrderQueryService;
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public class AllocAssistService {
|
|||||||
|
|
||||||
private final AllocGroupService allocationGroupService;
|
private final AllocGroupService allocationGroupService;
|
||||||
|
|
||||||
private final AllocTransactionService allocOrderService;
|
private final AllocOrderService allocOrderService;
|
||||||
|
|
||||||
private final AllocDetailManager allocOrderDetailManager;
|
private final AllocDetailManager allocOrderDetailManager;
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ public class AllocAssistService {
|
|||||||
* 根据新传入的分账订单更新订单信息
|
* 根据新传入的分账订单更新订单信息
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateOrder(AllocationParam allocationParam, AllocTransaction orderExtra) {
|
public void updateOrder(AllocationParam allocationParam, AllocOrder orderExtra) {
|
||||||
// 扩展信息
|
// 扩展信息
|
||||||
orderExtra.setClientIp(allocationParam.getClientIp())
|
orderExtra.setClientIp(allocationParam.getClientIp())
|
||||||
.setNotifyUrl(allocationParam.getNotifyUrl())
|
.setNotifyUrl(allocationParam.getNotifyUrl())
|
||||||
@@ -85,9 +85,9 @@ public class AllocAssistService {
|
|||||||
/**
|
/**
|
||||||
* 构建分账订单相关信息
|
* 构建分账订单相关信息
|
||||||
*/
|
*/
|
||||||
public TransactionAndDetail checkAndCreateAlloc(AllocationParam param, PayOrder payOrder){
|
public AllocAndDetail checkAndCreateAlloc(AllocationParam param, PayOrder payOrder){
|
||||||
// 创建分账单和明细并保存, 同时更新支付订单状态 使用事务
|
// 创建分账单和明细并保存, 同时更新支付订单状态 使用事务
|
||||||
TransactionAndDetail orderAndDetail;
|
AllocAndDetail orderAndDetail;
|
||||||
// 判断是否传输了分账接收方列表
|
// 判断是否传输了分账接收方列表
|
||||||
if (CollUtil.isNotEmpty(param.getReceivers())) {
|
if (CollUtil.isNotEmpty(param.getReceivers())) {
|
||||||
orderAndDetail = allocOrderService.createAndUpdate(param, payOrder);
|
orderAndDetail = allocOrderService.createAndUpdate(param, payOrder);
|
@@ -10,7 +10,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocGroupReceiverResultBo;
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocGroupReceiverVo;
|
||||||
import org.dromara.daxpay.service.convert.allocation.AllocGroupConvert;
|
import org.dromara.daxpay.service.convert.allocation.AllocGroupConvert;
|
||||||
import org.dromara.daxpay.service.dao.allocation.receiver.AllocGroupManager;
|
import org.dromara.daxpay.service.dao.allocation.receiver.AllocGroupManager;
|
||||||
import org.dromara.daxpay.service.dao.allocation.receiver.AllocGroupReceiverManager;
|
import org.dromara.daxpay.service.dao.allocation.receiver.AllocGroupReceiverManager;
|
||||||
@@ -19,7 +19,7 @@ import org.dromara.daxpay.service.entity.allocation.receiver.AllocGroup;
|
|||||||
import org.dromara.daxpay.service.entity.allocation.receiver.AllocGroupReceiver;
|
import org.dromara.daxpay.service.entity.allocation.receiver.AllocGroupReceiver;
|
||||||
import org.dromara.daxpay.service.entity.allocation.receiver.AllocReceiver;
|
import org.dromara.daxpay.service.entity.allocation.receiver.AllocReceiver;
|
||||||
import org.dromara.daxpay.service.param.allocation.group.*;
|
import org.dromara.daxpay.service.param.allocation.group.*;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocGroupResultBo;
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocGroupVo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -46,21 +46,21 @@ public class AllocGroupService {
|
|||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
*/
|
*/
|
||||||
public PageResult<AllocGroupResultBo> page(PageParam pageParam, AllocGroupQuery query){
|
public PageResult<AllocGroupVo> page(PageParam pageParam, AllocGroupQuery query){
|
||||||
return MpUtil.toPageResult(groupManager.page(pageParam, query));
|
return MpUtil.toPageResult(groupManager.page(pageParam, query));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询详情
|
* 查询详情
|
||||||
*/
|
*/
|
||||||
public AllocGroupResultBo findById(Long id){
|
public AllocGroupVo findById(Long id){
|
||||||
return groupManager.findById(id).map(AllocGroup::toResult).orElseThrow(()->new DataNotExistException("分账组不存在"));
|
return groupManager.findById(id).map(AllocGroup::toResult).orElseThrow(()->new DataNotExistException("分账组不存在"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询分账接收方
|
* 查询分账接收方
|
||||||
*/
|
*/
|
||||||
public List<AllocGroupReceiverResultBo> findReceiversByGroups(Long groupId){
|
public List<AllocGroupReceiverVo> findReceiversByGroups(Long groupId){
|
||||||
List<AllocGroupReceiver> groupReceivers = groupReceiverManager.findByGroupId(groupId);
|
List<AllocGroupReceiver> groupReceivers = groupReceiverManager.findByGroupId(groupId);
|
||||||
List<Long> receiverIds = groupReceivers.stream()
|
List<Long> receiverIds = groupReceivers.stream()
|
||||||
.map(AllocGroupReceiver::getReceiverId)
|
.map(AllocGroupReceiver::getReceiverId)
|
||||||
@@ -73,7 +73,7 @@ public class AllocGroupService {
|
|||||||
return groupReceivers.stream()
|
return groupReceivers.stream()
|
||||||
.map(o -> {
|
.map(o -> {
|
||||||
AllocReceiver receiver = receiverMap.get(o.getReceiverId());
|
AllocReceiver receiver = receiverMap.get(o.getReceiverId());
|
||||||
AllocGroupReceiverResultBo result = new AllocGroupReceiverResultBo()
|
AllocGroupReceiverVo result = new AllocGroupReceiverVo()
|
||||||
.setReceiverId(receiver.getId())
|
.setReceiverId(receiver.getId())
|
||||||
.setReceiverNo(receiver.getReceiverNo())
|
.setReceiverNo(receiver.getReceiverNo())
|
||||||
.setReceiverAccount(receiver.getReceiverAccount())
|
.setReceiverAccount(receiver.getReceiverAccount())
|
||||||
@@ -92,7 +92,7 @@ public class AllocGroupService {
|
|||||||
* 创建分账组
|
* 创建分账组
|
||||||
*/
|
*/
|
||||||
public void create(AllocGroupParam param){
|
public void create(AllocGroupParam param){
|
||||||
AllocGroup group = AllocGroupConvert.CONVERT.convert(param);
|
AllocGroup group = AllocGroupConvert.CONVERT.toEntity(param);
|
||||||
group.setTotalRate(BigDecimal.ZERO);
|
group.setTotalRate(BigDecimal.ZERO);
|
||||||
groupManager.save(group);
|
groupManager.save(group);
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package org.dromara.daxpay.service.service.allocation.receiver;
|
package org.dromara.daxpay.service.service.allocation.receiver;
|
||||||
|
|
||||||
import cn.bootx.platform.baseapi.service.dict.DictionaryItemService;
|
|
||||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||||
import cn.bootx.platform.core.exception.DataNotExistException;
|
import cn.bootx.platform.core.exception.DataNotExistException;
|
||||||
import cn.bootx.platform.core.exception.ValidationFailedException;
|
import cn.bootx.platform.core.exception.ValidationFailedException;
|
||||||
@@ -8,7 +7,6 @@ import cn.bootx.platform.core.rest.dto.LabelValue;
|
|||||||
import cn.bootx.platform.core.rest.param.PageParam;
|
import cn.bootx.platform.core.rest.param.PageParam;
|
||||||
import cn.bootx.platform.core.rest.result.PageResult;
|
import cn.bootx.platform.core.rest.result.PageResult;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
|
||||||
import com.baomidou.lock.LockInfo;
|
import com.baomidou.lock.LockInfo;
|
||||||
import com.baomidou.lock.LockTemplate;
|
import com.baomidou.lock.LockTemplate;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -20,14 +18,15 @@ import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverAddParam;
|
|||||||
import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverQueryParam;
|
import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverQueryParam;
|
||||||
import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverRemoveParam;
|
import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverRemoveParam;
|
||||||
import org.dromara.daxpay.core.result.allocation.receiver.AllocReceiverResult;
|
import org.dromara.daxpay.core.result.allocation.receiver.AllocReceiverResult;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocReceiverResultBo;
|
|
||||||
import org.dromara.daxpay.service.convert.allocation.AllocReceiverConvert;
|
import org.dromara.daxpay.service.convert.allocation.AllocReceiverConvert;
|
||||||
import org.dromara.daxpay.service.dao.allocation.receiver.AllocGroupReceiverManager;
|
import org.dromara.daxpay.service.dao.allocation.receiver.AllocGroupReceiverManager;
|
||||||
import org.dromara.daxpay.service.dao.allocation.receiver.AllocReceiverManager;
|
import org.dromara.daxpay.service.dao.allocation.receiver.AllocReceiverManager;
|
||||||
|
import org.dromara.daxpay.service.dao.constant.ChannelConstManager;
|
||||||
import org.dromara.daxpay.service.entity.allocation.receiver.AllocReceiver;
|
import org.dromara.daxpay.service.entity.allocation.receiver.AllocReceiver;
|
||||||
|
import org.dromara.daxpay.service.entity.constant.ChannelConst;
|
||||||
import org.dromara.daxpay.service.param.allocation.receiver.AllocReceiverQuery;
|
import org.dromara.daxpay.service.param.allocation.receiver.AllocReceiverQuery;
|
||||||
|
import org.dromara.daxpay.service.result.allocation.receiver.AllocReceiverVo;
|
||||||
import org.dromara.daxpay.service.strategy.AbsAllocReceiverStrategy;
|
import org.dromara.daxpay.service.strategy.AbsAllocReceiverStrategy;
|
||||||
import org.dromara.daxpay.service.strategy.PaymentStrategy;
|
|
||||||
import org.dromara.daxpay.service.util.PaymentStrategyFactory;
|
import org.dromara.daxpay.service.util.PaymentStrategyFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -50,20 +49,21 @@ public class AllocReceiverService {
|
|||||||
|
|
||||||
private final AllocReceiverManager allocReceiverManager;
|
private final AllocReceiverManager allocReceiverManager;
|
||||||
|
|
||||||
|
private final ChannelConstManager channelConstManager;
|
||||||
|
|
||||||
private final LockTemplate lockTemplate;
|
private final LockTemplate lockTemplate;
|
||||||
private final DictionaryItemService dictionaryItemService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
*/
|
*/
|
||||||
public PageResult<AllocReceiverResultBo> page(PageParam pageParam, AllocReceiverQuery query) {
|
public PageResult<AllocReceiverVo> page(PageParam pageParam, AllocReceiverQuery query) {
|
||||||
return MpUtil.toPageResult(allocReceiverManager.page(pageParam, query));
|
return MpUtil.toPageResult(allocReceiverManager.page(pageParam, query));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询详情
|
* 查询详情
|
||||||
*/
|
*/
|
||||||
public AllocReceiverResultBo findById(Long id) {
|
public AllocReceiverVo findById(Long id) {
|
||||||
return allocReceiverManager.findById(id)
|
return allocReceiverManager.findById(id)
|
||||||
.map(AllocReceiver::toResult)
|
.map(AllocReceiver::toResult)
|
||||||
.orElseThrow(() -> new DataNotExistException("分账接收方不存在"));
|
.orElseThrow(() -> new DataNotExistException("分账接收方不存在"));
|
||||||
@@ -156,14 +156,8 @@ public class AllocReceiverService {
|
|||||||
* 可分账的通道列表
|
* 可分账的通道列表
|
||||||
*/
|
*/
|
||||||
public List<LabelValue> findChannels() {
|
public List<LabelValue> findChannels() {
|
||||||
// 先查询策略, 然后查询通道并进行过滤
|
return channelConstManager.findAllByEnable().stream()
|
||||||
List<String> channelCodes = SpringUtil.getBeansOfType(AbsAllocReceiverStrategy.class)
|
.filter(ChannelConst::isAllocatable)
|
||||||
.values()
|
|
||||||
.stream()
|
|
||||||
.map(PaymentStrategy::getChannel)
|
|
||||||
.toList();
|
|
||||||
return dictionaryItemService.findEnableByDictCode("channel").stream()
|
|
||||||
.filter(item -> channelCodes.contains(item.getCode()))
|
|
||||||
.map(item->new LabelValue(item.getName(), item.getCode()))
|
.map(item->new LabelValue(item.getName(), item.getCode()))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
@@ -82,6 +82,6 @@ public class DevelopTradeService {
|
|||||||
paymentAssistService.initMchApp(param.getAppId());
|
paymentAssistService.initMchApp(param.getAppId());
|
||||||
// 签名校验
|
// 签名校验
|
||||||
paymentAssistService.signVerify(param);
|
paymentAssistService.signVerify(param);
|
||||||
return checkoutService.creat(param);
|
return checkoutService.create(param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,9 +3,9 @@ package org.dromara.daxpay.service.strategy;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.daxpay.service.bo.allocation.receiver.AllocStartResultBo;
|
import org.dromara.daxpay.service.bo.allocation.AllocStartResultBo;
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocTransaction;
|
|
||||||
import org.dromara.daxpay.service.entity.allocation.transaction.AllocDetail;
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocDetail;
|
||||||
|
import org.dromara.daxpay.service.entity.allocation.transaction.AllocOrder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -18,14 +18,14 @@ import java.util.List;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public abstract class AbsAllocationStrategy implements PaymentStrategy{
|
public abstract class AbsAllocationStrategy implements PaymentStrategy{
|
||||||
private AllocTransaction transaction;
|
private AllocOrder transaction;
|
||||||
|
|
||||||
private List<AllocDetail> details;
|
private List<AllocDetail> details;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化参数
|
* 初始化参数
|
||||||
*/
|
*/
|
||||||
public void initParam(AllocTransaction transaction, List<AllocDetail> details) {
|
public void initParam(AllocOrder transaction, List<AllocDetail> details) {
|
||||||
this.transaction = transaction;
|
this.transaction = transaction;
|
||||||
this.details = details;
|
this.details = details;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user