flows;
+
+ /**
+ * 金蝶收款流水行
+ */
+ @Data
+ public static class FlowRow implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ private String receiptNoticeNo;
+ private String payerName;
+ private BigDecimal receiptAmount;
+ private String counterpartyName;
+ private String counterpartyAccount;
+ private String counterpartyBank;
+ private String summary;
+ private LocalDateTime transactionTime;
+ private String detailSerialNo;
+ private LocalDateTime sourceUpdatedTime;
+ }
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/BillLedger.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/BillLedger.java
new file mode 100644
index 0000000..bb95358
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/BillLedger.java
@@ -0,0 +1,42 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/** 汇票台账实体。 @author Chill */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_bill_ledger")
+public class BillLedger extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private String billNo;
+ private Long issuerId;
+ private String issuerName;
+ private Long receiverId;
+ private String receiverName;
+ private String billType;
+ private BigDecimal faceAmount;
+ private BigDecimal availableBalance;
+ private LocalDate issueDate;
+ private LocalDate maturityDate;
+ private String availableDeptIdsJson;
+ private String availableDeptNames;
+ private Long feeBearerId;
+ private String feeBearerName;
+ private BigDecimal confirmedDiscountRate;
+ private String issuingBank;
+ private BigDecimal bankDiscountReferenceRate;
+ private BigDecimal estimatedDiscountFee;
+ private String attachmentsJson;
+ private String remark;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/BillLedgerUsage.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/BillLedgerUsage.java
new file mode 100644
index 0000000..b52c0a8
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/BillLedgerUsage.java
@@ -0,0 +1,29 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+
+/** 汇票使用记录实体。 @author Chill */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_bill_ledger_usage")
+public class BillLedgerUsage extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private Long billLedgerId;
+ private Long paymentApplicationId;
+ private Long billPaymentId;
+ private String applicationNo;
+ private BigDecimal usedAmount;
+ private Long useDeptId;
+ private String useDeptName;
+ private String usageStatus;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/BillPayment.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/BillPayment.java
new file mode 100644
index 0000000..cf15e7f
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/BillPayment.java
@@ -0,0 +1,57 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/** 汇票付款实体。 @author Chill */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_bill_payment")
+public class BillPayment extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private String paymentNo;
+ private Long billLedgerId;
+ private String billNo;
+ private BigDecimal faceAmount;
+ private BigDecimal availableBalance;
+ private BigDecimal usedAmount;
+ private Long deptId;
+ private String deptName;
+ private LocalDate paymentDate;
+ private String approvalStatus;
+ private String currentNode;
+ private String currentProcessor;
+ private String attachmentsJson;
+ private String remark;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplication.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplication.java
new file mode 100644
index 0000000..bf03a3c
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplication.java
@@ -0,0 +1,83 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * 开票申请实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_invoice_application")
+@Schema(description = "开票申请")
+public class InvoiceApplication extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private String applicationNo;
+ private Long projectId;
+ private String projectName;
+ private Long deptId;
+ private String deptName;
+ private String issuerName;
+ private Long receiverCustomerId;
+ private String receiverName;
+ private String invoiceType;
+ private BigDecimal availableInvoiceAmount;
+ private BigDecimal invoiceAmount;
+ private LocalDate applicationDate;
+ private String applicantName;
+ private Long undertakingDeptId;
+ private String undertakingDeptName;
+ private String departmentEmails;
+ private Long receiverInvoiceInfoId;
+ private String taxpayerNo;
+ private String bankName;
+ private String bankAccount;
+ private String registeredAddress;
+ private String contactName;
+ private String contactPhone;
+ private String email;
+ private String approvalStatus;
+ private String currentNode;
+ private String currentProcessor;
+ private String kingdeeBillNo;
+ private String kingdeeStatus;
+ private LocalDateTime syncedTime;
+ private String attachmentsJson;
+ private String remark;
+ private String voidReason;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationDetail.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationDetail.java
new file mode 100644
index 0000000..4410493
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationDetail.java
@@ -0,0 +1,68 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 开票申请结算明细快照实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_invoice_application_detail")
+public class InvoiceApplicationDetail extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private Long invoiceApplicationId;
+ private Long formalSettlementId;
+ private Long formalSettlementDetailId;
+ private Integer lineNo;
+ private String documentNo;
+ private String waybillNo;
+ private String vehicleNo;
+ private String departureAddress;
+ private String arrivalAddress;
+ private LocalDateTime actualDepartureTime;
+ private LocalDateTime actualCompletionTime;
+ private String transportType;
+ private String cargoName;
+ private String cargoType;
+ private BigDecimal transportQuantity;
+ private String quantityUnit;
+ private BigDecimal mileage;
+ private String batchNo;
+ private BigDecimal freightAmount;
+ private String feeItemsJson;
+ private BigDecimal settlementAmountTax;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationLine.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationLine.java
new file mode 100644
index 0000000..1615453
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationLine.java
@@ -0,0 +1,58 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+
+/**
+ * 开票申请商品行实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_invoice_application_line")
+public class InvoiceApplicationLine extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private Long invoiceApplicationId;
+ private Long invoiceSheetId;
+ private Integer lineNo;
+ private String goodsCategory;
+ private String goodsName;
+ private String unit;
+ private BigDecimal quantity;
+ private BigDecimal unitPriceNoTax;
+ private BigDecimal amountWithTax;
+ private BigDecimal taxRate;
+ private BigDecimal taxAmount;
+ private String remark;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationRecord.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationRecord.java
new file mode 100644
index 0000000..8a411bd
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationRecord.java
@@ -0,0 +1,53 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+
+/**
+ * 开票申请操作记录实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_invoice_application_record")
+public class InvoiceApplicationRecord extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private Long invoiceApplicationId;
+ private String actionType;
+ private String actionName;
+ private String fromStatus;
+ private String toStatus;
+ private String operatorName;
+ private String reason;
+ private String kingdeeBillNo;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationSettlement.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationSettlement.java
new file mode 100644
index 0000000..57a0339
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationSettlement.java
@@ -0,0 +1,52 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+
+/**
+ * 开票申请关联结算单实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_invoice_application_settlement")
+public class InvoiceApplicationSettlement extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private Long invoiceApplicationId;
+ private Long formalSettlementId;
+ private String formalSettlementNo;
+ private BigDecimal settlementAmount;
+ private BigDecimal availableInvoiceAmount;
+ private BigDecimal allocatedInvoiceAmount;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationSheet.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationSheet.java
new file mode 100644
index 0000000..8550946
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceApplicationSheet.java
@@ -0,0 +1,49 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+
+/**
+ * 开票申请发票张次实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_invoice_application_sheet")
+public class InvoiceApplicationSheet extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private Long invoiceApplicationId;
+ private Integer sheetNo;
+ private BigDecimal invoiceAmount;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceReceipt.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceReceipt.java
new file mode 100644
index 0000000..67859e1
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceReceipt.java
@@ -0,0 +1,83 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * 收票登记实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_invoice_receipt")
+@Schema(description = "收票登记")
+public class InvoiceReceipt extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long kingdeeInvoicePoolId;
+ private String invoiceNo;
+ private LocalDate invoiceDate;
+ private String invoiceType;
+ private BigDecimal taxRate;
+ private BigDecimal invoiceAmount;
+ private BigDecimal taxAmount;
+ private String receiverName;
+ private String issuerName;
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long projectId;
+ private String projectName;
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long deptId;
+ private String deptName;
+ private String payerName;
+ private String payeeName;
+ private String bankName;
+ private String bankAccount;
+ private String issuingBank;
+ private String phone;
+ private String customerEmails;
+ private String departmentEmails;
+ private String approvalStatus;
+ private String currentNode;
+ private String currentProcessor;
+ private String kingdeeBillNo;
+ private String kingdeeStatus;
+ private String attachmentsJson;
+ private String remark;
+ private String voidReason;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceReceiptRecord.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceReceiptRecord.java
new file mode 100644
index 0000000..6e50246
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceReceiptRecord.java
@@ -0,0 +1,58 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+
+/**
+ * 收票登记操作记录实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_invoice_receipt_record")
+@Schema(description = "收票登记操作记录")
+public class InvoiceReceiptRecord extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long invoiceReceiptId;
+ private String actionType;
+ private String actionName;
+ private String fromStatus;
+ private String toStatus;
+ private String operatorName;
+ private String reason;
+ private String kingdeeBillNo;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceReceiptSettlement.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceReceiptSettlement.java
new file mode 100644
index 0000000..4f19d2d
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/InvoiceReceiptSettlement.java
@@ -0,0 +1,58 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+
+/**
+ * 收票登记结算单分摊实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_invoice_receipt_settlement")
+@Schema(description = "收票登记结算单分摊")
+public class InvoiceReceiptSettlement extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long invoiceReceiptId;
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long formalSettlementId;
+ private String formalSettlementNo;
+ private BigDecimal settlementAmount;
+ private BigDecimal receivedInvoiceAmount;
+ private BigDecimal allocatedInvoiceAmount;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/KingdeeInvoicePool.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/KingdeeInvoicePool.java
new file mode 100644
index 0000000..261110c
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/KingdeeInvoicePool.java
@@ -0,0 +1,68 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * 金蝶进项发票票据池镜像实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_kingdee_invoice_pool")
+@Schema(description = "金蝶进项发票票据池镜像")
+public class KingdeeInvoicePool extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private String invoiceNo;
+ private LocalDate invoiceDate;
+ private String invoiceType;
+ private BigDecimal taxRate;
+ private BigDecimal invoiceAmount;
+ private BigDecimal taxAmount;
+ private String receiverName;
+ private String issuerName;
+ private String bankName;
+ private String bankAccount;
+ private String issuingBank;
+ private String phone;
+ private String customerEmails;
+ private String departmentEmails;
+ private String kingdeeBillNo;
+ private String kingdeeStatus;
+ private String attachmentsJson;
+ private LocalDateTime sourceUpdatedTime;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/KingdeeReceiptFlow.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/KingdeeReceiptFlow.java
new file mode 100644
index 0000000..79b75c1
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/KingdeeReceiptFlow.java
@@ -0,0 +1,64 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 金蝶收款流水镜像实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_kingdee_receipt_flow")
+@Schema(description = "金蝶收款流水镜像")
+public class KingdeeReceiptFlow extends TenantEntity {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ private String receiptNoticeNo;
+ private String payerName;
+ private BigDecimal receiptAmount;
+ private String counterpartyName;
+ private String counterpartyAccount;
+ private String counterpartyBank;
+ private String summary;
+ private LocalDateTime transactionTime;
+ private String detailSerialNo;
+ private BigDecimal claimedAmount;
+ private String claimStatus;
+ private LocalDateTime sourceUpdatedTime;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/PaymentApplication.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/PaymentApplication.java
new file mode 100644
index 0000000..1d6d033
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/PaymentApplication.java
@@ -0,0 +1,76 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments from this software for such purposes.
+ * Copyright of this software remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/** 付款申请实体。 @author Chill */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_payment_application")
+public class PaymentApplication extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private String paymentNo;
+ private String paymentType;
+ private Long settlementId;
+ private String settlementNo;
+ private Long preSettlementId;
+ private String preSettlementNo;
+ private Long projectId;
+ private String projectName;
+ private Long deptId;
+ private String deptName;
+ private Long contractId;
+ private String contractNo;
+ private String contractName;
+ private String payerName;
+ private String payeeName;
+ private BigDecimal settlementAmount;
+ private BigDecimal payableAmount;
+ private String billType;
+ private BigDecimal paymentRatio;
+ private BigDecimal appliedAmount;
+ private String paymentMethod;
+ private Long billLedgerId;
+ private String billNo;
+ private Long receiptAccountId;
+ private String receiptAccountName;
+ private String bankName;
+ private String bankAccount;
+ private String applicantName;
+ private LocalDate applyDate;
+ private String invoiceStatus;
+ private BigDecimal matchedInvoiceAmount;
+ private BigDecimal paidAmount;
+ private String approvalStatus;
+ private String currentNode;
+ private String currentProcessor;
+ private String kingdeeBillNo;
+ private String kingdeeStatus;
+ private String attachmentsJson;
+ private String remark;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/PaymentApplicationInvoice.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/PaymentApplicationInvoice.java
new file mode 100644
index 0000000..9a6ffdb
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/PaymentApplicationInvoice.java
@@ -0,0 +1,47 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments from this software for such purposes.
+ * Copyright of this software remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/** 付款申请发票明细。 @author Chill */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_payment_application_invoice")
+public class PaymentApplicationInvoice extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private Long paymentApplicationId;
+ private Integer lineNo;
+ private String settlementNo;
+ private String invoiceNo;
+ private LocalDate invoiceDate;
+ private String invoiceType;
+ private BigDecimal taxRate;
+ private BigDecimal invoiceAmount;
+ private BigDecimal matchedAmount;
+ private String attachmentJson;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/PaymentApplicationRecord.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/PaymentApplicationRecord.java
new file mode 100644
index 0000000..1c5c1af
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/PaymentApplicationRecord.java
@@ -0,0 +1,43 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments from this software for such purposes.
+ * Copyright of this software remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/** 付款申请付款记录。 @author Chill */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_payment_application_record")
+public class PaymentApplicationRecord extends TenantEntity {
+ @Serial private static final long serialVersionUID = 1L;
+ private Long paymentApplicationId;
+ private BigDecimal paidAmount;
+ private LocalDate paidDate;
+ private String paymentNo;
+ private String voucherJson;
+ private String kingdeeBillNo;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ReceiptClaim.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ReceiptClaim.java
new file mode 100644
index 0000000..fc7f786
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ReceiptClaim.java
@@ -0,0 +1,74 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * 收款流水认领实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_receipt_claim")
+@Schema(description = "收款流水认领")
+public class ReceiptClaim extends TenantEntity {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long receiptFlowId;
+ private BigDecimal claimAmount;
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long claimerId;
+ private String claimerName;
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long claimerDeptId;
+ private String claimerDeptName;
+ private LocalDate claimDate;
+ private String attachmentsJson;
+ private String remark;
+ private String claimStatus;
+ private String kingdeeBillNo;
+ private String kingdeeBillStatus;
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long voidedBy;
+ private String voidedByName;
+ private LocalDateTime voidedTime;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ReceiptClaimSettlement.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ReceiptClaimSettlement.java
new file mode 100644
index 0000000..44df9c6
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ReceiptClaimSettlement.java
@@ -0,0 +1,63 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+
+/**
+ * 收款认领结算单分摊实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_receipt_claim_settlement")
+@Schema(description = "收款认领结算单分摊")
+public class ReceiptClaimSettlement extends TenantEntity {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long receiptClaimId;
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long receiptFlowId;
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long formalSettlementId;
+ private String formalSettlementNo;
+ private BigDecimal settlementAmount;
+ private BigDecimal claimedReceiptAmount;
+ private BigDecimal allocatedReceiptAmount;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ReceiptFlowRecord.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ReceiptFlowRecord.java
new file mode 100644
index 0000000..2fbe069
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ReceiptFlowRecord.java
@@ -0,0 +1,64 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+
+/**
+ * 收款流水操作留痕实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("blade_receipt_flow_record")
+@Schema(description = "收款流水操作留痕")
+public class ReceiptFlowRecord extends TenantEntity {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long receiptFlowId;
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long receiptClaimId;
+ private String actionType;
+ private String actionName;
+ private String fromStatus;
+ private String toStatus;
+ private BigDecimal operationAmount;
+ private String operatorName;
+ private String content;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/BillLedgerVO.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/BillLedgerVO.java
new file mode 100644
index 0000000..96cf8a4
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/BillLedgerVO.java
@@ -0,0 +1,31 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ */
+package org.springblade.transport.pojo.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.transport.pojo.entity.BillLedger;
+import org.springblade.transport.pojo.entity.BillLedgerUsage;
+
+import java.io.Serial;
+import java.time.LocalDate;
+import java.util.List;
+
+/** 汇票台账视图。 @author Chill */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class BillLedgerVO extends BillLedger {
+ @Serial private static final long serialVersionUID = 1L;
+ @TableField(exist = false) private LocalDate issueStartDate;
+ @TableField(exist = false) private LocalDate issueEndDate;
+ @TableField(exist = false) private String maturityStatus;
+ @TableField(exist = false) private String expiryShortcut;
+ @TableField(exist = false) private String billTypeName;
+ @TableField(exist = false) private String maturityStatusName;
+ @TableField(exist = false) private String createUserName;
+ @TableField(exist = false) private String updateUserName;
+ @TableField(exist = false) private List usageRecords;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/BillPaymentVO.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/BillPaymentVO.java
new file mode 100644
index 0000000..9db1628
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/BillPaymentVO.java
@@ -0,0 +1,46 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.transport.pojo.entity.BillPayment;
+
+import java.io.Serial;
+import java.time.LocalDate;
+
+/** 汇票付款视图。 @author Chill */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class BillPaymentVO extends BillPayment {
+ @Serial private static final long serialVersionUID = 1L;
+ @TableField(exist = false) private LocalDate paymentStartDate;
+ @TableField(exist = false) private LocalDate paymentEndDate;
+ @TableField(exist = false) private String approvalStatusName;
+ @TableField(exist = false) private String createUserName;
+ @TableField(exist = false) private String updateUserName;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/InvoiceApplicationSheetVO.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/InvoiceApplicationSheetVO.java
new file mode 100644
index 0000000..0b0dd2f
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/InvoiceApplicationSheetVO.java
@@ -0,0 +1,47 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.transport.pojo.entity.InvoiceApplicationLine;
+import org.springblade.transport.pojo.entity.InvoiceApplicationSheet;
+
+import java.io.Serial;
+import java.util.List;
+
+/**
+ * 开票申请发票张次视图实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class InvoiceApplicationSheetVO extends InvoiceApplicationSheet {
+ @Serial private static final long serialVersionUID = 1L;
+ @TableField(exist = false) private List lines;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/InvoiceApplicationVO.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/InvoiceApplicationVO.java
new file mode 100644
index 0000000..664d02b
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/InvoiceApplicationVO.java
@@ -0,0 +1,56 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.transport.pojo.entity.InvoiceApplication;
+import org.springblade.transport.pojo.entity.InvoiceApplicationDetail;
+import org.springblade.transport.pojo.entity.InvoiceApplicationRecord;
+import org.springblade.transport.pojo.entity.InvoiceApplicationSettlement;
+
+import java.io.Serial;
+import java.util.List;
+
+/**
+ * 开票申请视图实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class InvoiceApplicationVO extends InvoiceApplication {
+ @Serial private static final long serialVersionUID = 1L;
+ @TableField(exist = false) private String settlementNos;
+ @TableField(exist = false) private String approvalStatusName;
+ @TableField(exist = false) private String kingdeeStatusName;
+ @TableField(exist = false) private String createUserName;
+ @TableField(exist = false) private List settlements;
+ @TableField(exist = false) private List sheets;
+ @TableField(exist = false) private List details;
+ @TableField(exist = false) private List records;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/InvoiceReceiptVO.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/InvoiceReceiptVO.java
new file mode 100644
index 0000000..8be4dcf
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/InvoiceReceiptVO.java
@@ -0,0 +1,56 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.transport.pojo.entity.InvoiceReceipt;
+import org.springblade.transport.pojo.entity.InvoiceReceiptRecord;
+import org.springblade.transport.pojo.entity.InvoiceReceiptSettlement;
+
+import java.io.Serial;
+import java.util.List;
+
+/**
+ * 收票登记视图实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Schema(description = "收票登记视图实体类")
+public class InvoiceReceiptVO extends InvoiceReceipt {
+ @Serial private static final long serialVersionUID = 1L;
+ @TableField(exist = false) private String settlementNos;
+ @TableField(exist = false) private String approvalStatusName;
+ @TableField(exist = false) private String kingdeeStatusName;
+ @TableField(exist = false) private String createUserName;
+ @TableField(exist = false) private String updateUserName;
+ @TableField(exist = false) private List settlements;
+ @TableField(exist = false) private List records;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/PaymentApplicationVO.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/PaymentApplicationVO.java
new file mode 100644
index 0000000..cbacc29
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/PaymentApplicationVO.java
@@ -0,0 +1,47 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments from this software for such purposes.
+ * Copyright of this software remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.transport.pojo.entity.PaymentApplication;
+import org.springblade.transport.pojo.entity.PaymentApplicationInvoice;
+import org.springblade.transport.pojo.entity.PaymentApplicationRecord;
+
+import java.io.Serial;
+import java.time.LocalDate;
+import java.util.List;
+
+/** 付款申请视图。 @author Chill */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class PaymentApplicationVO extends PaymentApplication {
+ @Serial private static final long serialVersionUID = 1L;
+ @TableField(exist = false) private LocalDate applyStartDate;
+ @TableField(exist = false) private LocalDate applyEndDate;
+ @TableField(exist = false) private String createUserName;
+ @TableField(exist = false) private String updateUserName;
+ @TableField(exist = false) private String paymentTypeName;
+ @TableField(exist = false) private String approvalStatusName;
+ @TableField(exist = false) private String kingdeeStatusName;
+ @TableField(exist = false) private List invoices;
+ @TableField(exist = false) private List paymentRecords;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/ReceiptClaimRecordVO.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/ReceiptClaimRecordVO.java
new file mode 100644
index 0000000..9802b66
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/ReceiptClaimRecordVO.java
@@ -0,0 +1,93 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.transport.pojo.entity.ReceiptClaim;
+import org.springblade.transport.pojo.entity.ReceiptClaimSettlement;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 认领记录视图实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Schema(description = "认领记录视图实体类")
+public class ReceiptClaimRecordVO extends ReceiptClaim {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ @TableField(exist = false)
+ private String receiptNoticeNo;
+ @TableField(exist = false)
+ private String payerName;
+ @TableField(exist = false)
+ private BigDecimal receiptAmount;
+ @TableField(exist = false)
+ private String counterpartyName;
+ @TableField(exist = false)
+ private String counterpartyAccount;
+ @TableField(exist = false)
+ private String counterpartyBank;
+ @TableField(exist = false)
+ private String summary;
+ @TableField(exist = false)
+ private LocalDateTime transactionTime;
+ @TableField(exist = false)
+ private String detailSerialNo;
+ @TableField(exist = false)
+ private String associatedSettlementNos;
+ @TableField(exist = false)
+ private String claimStatusName;
+ @TableField(exist = false)
+ private String kingdeeBillStatusName;
+ @TableField(exist = false)
+ private List settlements;
+ @TableField(exist = false)
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate transactionStartDate;
+ @TableField(exist = false)
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate transactionEndDate;
+ @TableField(exist = false)
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate claimStartDate;
+ @TableField(exist = false)
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ private LocalDate claimEndDate;
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/ReceiptFlowVO.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/ReceiptFlowVO.java
new file mode 100644
index 0000000..caa11ce
--- /dev/null
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/vo/ReceiptFlowVO.java
@@ -0,0 +1,73 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.transport.pojo.entity.KingdeeReceiptFlow;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * 收款流水视图实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Schema(description = "收款流水视图实体类")
+public class ReceiptFlowVO extends KingdeeReceiptFlow {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ @TableField(exist = false)
+ private String claimStatusName;
+ @TableField(exist = false)
+ private BigDecimal remainingAmount;
+ @TableField(exist = false)
+ private String createUserName;
+ @TableField(exist = false)
+ private String updateUserName;
+ @TableField(exist = false)
+ private String claimerName;
+ @TableField(exist = false)
+ private String claimerDeptName;
+ @TableField(exist = false)
+ private LocalDate claimDate;
+ @TableField(exist = false)
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime transactionStartTime;
+ @TableField(exist = false)
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime transactionEndTime;
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/BillLedgerController.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/BillLedgerController.java
new file mode 100644
index 0000000..c699cdb
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/BillLedgerController.java
@@ -0,0 +1,82 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ */
+package org.springblade.transport.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.annotation.PreAuth;
+import org.springblade.core.tool.api.R;
+import org.springblade.transport.pojo.dto.BillLedgerSaveRequest;
+import org.springblade.transport.pojo.vo.BillLedgerVO;
+import org.springblade.transport.service.IBillLedgerService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+/** 汇票台账控制器。 @author Chill */
+@RestController
+@AllArgsConstructor
+@PreAuth(menu = "bill_ledger")
+@RequestMapping("/bill-ledger")
+@Tag(name = "汇票台账", description = "汇票票据信息及可用余额管理")
+public class BillLedgerController extends BladeController {
+ private final IBillLedgerService billLedgerService;
+
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 1)
+ @Operation(summary = "汇票台账分页")
+ public R> list(BillLedgerVO query, Query pageQuery) {
+ return R.data(billLedgerService.selectPage(Condition.getPage(pageQuery), query));
+ }
+
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 2)
+ @Operation(summary = "汇票台账详情")
+ public R detail(@RequestParam Long id) {
+ return R.data(billLedgerService.detail(id));
+ }
+
+ @GetMapping("/expiry-counts")
+ @ApiOperationSupport(order = 3)
+ @Operation(summary = "汇票到期快捷统计")
+ public R> expiryCounts() {
+ return R.data(billLedgerService.expiryCounts());
+ }
+
+ @GetMapping("/available-options")
+ @ApiOperationSupport(order = 4)
+ @Operation(summary = "付款申请可用汇票")
+ public R> availableOptions(@RequestParam(required = false) String keyword,
+ @RequestParam(required = false) Long deptId, @RequestParam(required = false) Long selectedId) {
+ return R.data(billLedgerService.availableOptions(keyword, deptId, selectedId));
+ }
+
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 5)
+ @Operation(summary = "新增或编辑汇票台账")
+ public R submit(@RequestBody BillLedgerSaveRequest request) {
+ return R.data(billLedgerService.submit(request));
+ }
+
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 6)
+ @Operation(summary = "删除汇票台账")
+ public R remove(@RequestParam Long id) {
+ billLedgerService.removeLedger(id);
+ return R.success("删除成功");
+ }
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/BillPaymentController.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/BillPaymentController.java
new file mode 100644
index 0000000..3c1f3b4
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/BillPaymentController.java
@@ -0,0 +1,118 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.annotation.PreAuth;
+import org.springblade.core.tool.api.R;
+import org.springblade.transport.pojo.dto.BillPaymentSaveRequest;
+import org.springblade.transport.pojo.dto.BillPaymentStatusRequest;
+import org.springblade.transport.pojo.vo.BillPaymentVO;
+import org.springblade.transport.service.IBillPaymentService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/** 汇票付款控制器。 @author Chill */
+@RestController
+@AllArgsConstructor
+@PreAuth(menu = "bill_payment")
+@RequestMapping("/bill-payment")
+@Tag(name = "汇票付款", description = "汇票付款单据管理")
+public class BillPaymentController extends BladeController {
+ private final IBillPaymentService billPaymentService;
+
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 1)
+ @Operation(summary = "汇票付款分页")
+ public R> list(BillPaymentVO query, Query pageQuery) {
+ return R.data(billPaymentService.selectPage(Condition.getPage(pageQuery), query));
+ }
+
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 2)
+ @Operation(summary = "汇票付款详情")
+ public R detail(@RequestParam Long id) {
+ return R.data(billPaymentService.detail(id));
+ }
+
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 3)
+ @Operation(summary = "保存汇票付款")
+ public R save(@RequestBody BillPaymentSaveRequest request) {
+ return R.data(billPaymentService.saveDraft(request));
+ }
+
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 4)
+ @Operation(summary = "删除汇票付款草稿")
+ public R remove(@RequestParam Long id) {
+ billPaymentService.removeDraft(id);
+ return R.success("删除成功");
+ }
+
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 5)
+ @Operation(summary = "提交汇票付款")
+ public R submit(@RequestBody BillPaymentStatusRequest request) {
+ billPaymentService.submit(request);
+ return R.success("提交成功");
+ }
+
+ @PostMapping("/approve")
+ @ApiOperationSupport(order = 6)
+ @Operation(summary = "审批通过汇票付款")
+ public R approve(@RequestBody BillPaymentStatusRequest request) {
+ billPaymentService.approve(request);
+ return R.success("审批通过");
+ }
+
+ @PostMapping("/return")
+ @ApiOperationSupport(order = 7)
+ @Operation(summary = "驳回汇票付款")
+ public R returnBill(@RequestBody BillPaymentStatusRequest request) {
+ billPaymentService.returnBill(request);
+ return R.success("已驳回");
+ }
+
+ @PostMapping("/void")
+ @ApiOperationSupport(order = 8)
+ @Operation(summary = "作废汇票付款")
+ public R voidBill(@RequestBody BillPaymentStatusRequest request) {
+ billPaymentService.voidBill(request);
+ return R.success("作废成功");
+ }
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/InvoiceApplicationController.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/InvoiceApplicationController.java
new file mode 100644
index 0000000..35ddac0
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/InvoiceApplicationController.java
@@ -0,0 +1,154 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.annotation.PreAuth;
+import org.springblade.core.tool.api.R;
+import org.springblade.transport.pojo.dto.InvoiceApplicationSaveRequest;
+import org.springblade.transport.pojo.dto.InvoiceApplicationStatusRequest;
+import org.springblade.transport.pojo.entity.FormalSettlementDetail;
+import org.springblade.transport.pojo.vo.InvoiceApplicationVO;
+import org.springblade.transport.service.IInvoiceApplicationService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 开票申请控制器
+ *
+ * @author Chill
+ */
+@RestController
+@AllArgsConstructor
+@PreAuth(menu = "invoice_application")
+@RequestMapping("/invoice-application")
+@Tag(name = "开票管理", description = "开票申请管理")
+public class InvoiceApplicationController extends BladeController {
+ private final IInvoiceApplicationService invoiceApplicationService;
+
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 1)
+ @Operation(summary = "开票申请分页")
+ public R> list(InvoiceApplicationVO query, Query pageQuery) {
+ return R.data(invoiceApplicationService.selectPage(Condition.getPage(pageQuery), query));
+ }
+
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 2)
+ @Operation(summary = "开票申请详情")
+ public R detail(@RequestParam Long id) {
+ return R.data(invoiceApplicationService.detail(id));
+ }
+
+ @GetMapping("/settlement-candidates")
+ @ApiOperationSupport(order = 3)
+ @Operation(summary = "可开票正式结算单")
+ public R>> settlementCandidates(@RequestParam(required = false) String keyword) {
+ return R.data(invoiceApplicationService.settlementCandidates(keyword));
+ }
+
+ @GetMapping("/settlement-details")
+ @ApiOperationSupport(order = 4)
+ @Operation(summary = "结算单可选明细")
+ public R> settlementDetails(@RequestParam String settlementIds) {
+ return R.data(invoiceApplicationService.settlementDetails(settlementIds));
+ }
+
+ @GetMapping("/receiver-information")
+ @ApiOperationSupport(order = 5)
+ @Operation(summary = "受票方开票信息")
+ public R> receiverInformation(@RequestParam String settlementIds) {
+ return R.data(invoiceApplicationService.receiverInformation(settlementIds));
+ }
+
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 6)
+ @Operation(summary = "保存开票申请")
+ public R save(@RequestBody InvoiceApplicationSaveRequest request) {
+ return R.data(invoiceApplicationService.saveDraft(request));
+ }
+
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 7)
+ @Operation(summary = "删除开票申请草稿")
+ public R remove(@RequestParam Long id) {
+ invoiceApplicationService.removeDraft(id);
+ return R.success("删除成功");
+ }
+
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 8)
+ @Operation(summary = "提交开票申请")
+ public R submit(@RequestBody InvoiceApplicationStatusRequest request) {
+ invoiceApplicationService.submit(request);
+ return R.success("提交成功");
+ }
+
+ @PostMapping("/approve")
+ @ApiOperationSupport(order = 9)
+ @Operation(summary = "审批通过开票申请")
+ public R approve(@RequestBody InvoiceApplicationStatusRequest request) {
+ invoiceApplicationService.approve(request);
+ return R.success("审批通过");
+ }
+
+ @PostMapping("/return")
+ @ApiOperationSupport(order = 10)
+ @Operation(summary = "驳回开票申请")
+ public R returnBill(@RequestBody InvoiceApplicationStatusRequest request) {
+ invoiceApplicationService.returnBill(request);
+ return R.success("已驳回");
+ }
+
+ @PostMapping("/void")
+ @ApiOperationSupport(order = 11)
+ @Operation(summary = "作废开票申请")
+ public R voidBill(@RequestBody InvoiceApplicationStatusRequest request) {
+ invoiceApplicationService.voidBill(request);
+ return R.success("作废成功");
+ }
+
+ @PostMapping("/sync-kingdee")
+ @ApiOperationSupport(order = 12)
+ @Operation(summary = "同步金蝶开票申请")
+ public R syncKingdee(@RequestParam Long id) {
+ return R.data(invoiceApplicationService.syncKingdee(id));
+ }
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/InvoiceReceiptController.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/InvoiceReceiptController.java
new file mode 100644
index 0000000..1a01d3c
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/InvoiceReceiptController.java
@@ -0,0 +1,157 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.annotation.PreAuth;
+import org.springblade.core.tool.api.R;
+import org.springblade.transport.pojo.dto.InvoiceReceiptSaveRequest;
+import org.springblade.transport.pojo.dto.InvoiceReceiptStatusRequest;
+import org.springblade.transport.pojo.entity.KingdeeInvoicePool;
+import org.springblade.transport.pojo.vo.InvoiceReceiptVO;
+import org.springblade.transport.service.IInvoiceReceiptService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 收票登记控制器
+ *
+ * @author Chill
+ */
+@RestController
+@AllArgsConstructor
+@PreAuth(menu = "invoice_receipt")
+@RequestMapping("/invoice-receipt")
+@Tag(name = "收票管理", description = "进项发票登记认领管理")
+public class InvoiceReceiptController extends BladeController {
+
+ private final IInvoiceReceiptService invoiceReceiptService;
+
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 1)
+ @Operation(summary = "收票登记分页")
+ public R> list(InvoiceReceiptVO query, Query pageQuery) {
+ return R.data(invoiceReceiptService.selectPage(Condition.getPage(pageQuery), query));
+ }
+
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 2)
+ @Operation(summary = "收票登记详情")
+ public R detail(@RequestParam Long id) {
+ return R.data(invoiceReceiptService.detail(id));
+ }
+
+ @GetMapping("/invoice-pool")
+ @ApiOperationSupport(order = 3)
+ @Operation(summary = "查询金蝶进项发票票据池")
+ public R> invoicePool(@RequestParam(required = false) String keyword) {
+ return R.data(invoiceReceiptService.invoicePool(keyword));
+ }
+
+ @GetMapping("/settlement-candidates")
+ @ApiOperationSupport(order = 4)
+ @Operation(summary = "可关联的应付正式结算单")
+ public R>> settlementCandidates(
+ @RequestParam(required = false) String keyword,
+ @RequestParam(required = false) Long receiptId) {
+ return R.data(invoiceReceiptService.settlementCandidates(keyword, receiptId));
+ }
+
+ @GetMapping("/reference-information")
+ @ApiOperationSupport(order = 5)
+ @Operation(summary = "收票关联参考信息")
+ public R> referenceInformation(@RequestParam String settlementIds) {
+ return R.data(invoiceReceiptService.referenceInformation(settlementIds));
+ }
+
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 6)
+ @Operation(summary = "保存收票登记")
+ public R save(@RequestBody InvoiceReceiptSaveRequest request) {
+ return R.data(invoiceReceiptService.saveDraft(request));
+ }
+
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 7)
+ @Operation(summary = "删除收票登记草稿")
+ public R remove(@RequestParam Long id) {
+ invoiceReceiptService.removeDraft(id);
+ return R.success("删除成功");
+ }
+
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 8)
+ @Operation(summary = "提交收票登记")
+ public R submit(@RequestBody InvoiceReceiptStatusRequest request) {
+ invoiceReceiptService.submit(request);
+ return R.success("提交成功");
+ }
+
+ @PostMapping("/approve")
+ @ApiOperationSupport(order = 9)
+ @Operation(summary = "审批通过收票登记")
+ public R approve(@RequestBody InvoiceReceiptStatusRequest request) {
+ invoiceReceiptService.approve(request);
+ return R.success("审批通过");
+ }
+
+ @PostMapping("/return")
+ @ApiOperationSupport(order = 10)
+ @Operation(summary = "驳回收票登记")
+ public R returnBill(@RequestBody InvoiceReceiptStatusRequest request) {
+ invoiceReceiptService.returnBill(request);
+ return R.success("已驳回");
+ }
+
+ @PostMapping("/void")
+ @ApiOperationSupport(order = 11)
+ @Operation(summary = "作废收票登记")
+ public R voidBill(@RequestBody InvoiceReceiptStatusRequest request) {
+ invoiceReceiptService.voidBill(request);
+ return R.success("作废成功");
+ }
+
+ @PostMapping("/sync-kingdee")
+ @ApiOperationSupport(order = 12)
+ @Operation(summary = "同步金蝶发票状态")
+ public R syncKingdee(@RequestParam Long id) {
+ return R.data(invoiceReceiptService.syncKingdee(id));
+ }
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/PaymentApplicationController.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/PaymentApplicationController.java
new file mode 100644
index 0000000..575bf17
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/PaymentApplicationController.java
@@ -0,0 +1,87 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments from this software for such purposes.
+ * Copyright of this software remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.annotation.PreAuth;
+import org.springblade.core.tool.api.R;
+import org.springblade.transport.pojo.dto.PaymentApplicationSaveRequest;
+import org.springblade.transport.pojo.dto.PaymentApplicationStatusRequest;
+import org.springblade.transport.pojo.vo.PaymentApplicationVO;
+import org.springblade.transport.service.IPaymentApplicationService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/** 付款申请控制器。 @author Chill */
+@RestController
+@AllArgsConstructor
+@PreAuth(menu = "payment_application")
+@RequestMapping("/payment-application")
+@Tag(name = "付款管理", description = "付款申请管理")
+public class PaymentApplicationController extends BladeController {
+ private final IPaymentApplicationService paymentApplicationService;
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 1)
+ @Operation(summary = "付款申请分页")
+ public R> list(PaymentApplicationVO query, Query pageQuery) { return R.data(paymentApplicationService.selectPage(Condition.getPage(pageQuery), query)); }
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 2)
+ @Operation(summary = "付款申请详情")
+ public R detail(@RequestParam Long id) { return R.data(paymentApplicationService.detail(id)); }
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 3)
+ @Operation(summary = "保存付款申请")
+ public R save(@RequestBody PaymentApplicationSaveRequest request) { return R.data(paymentApplicationService.saveDraft(request)); }
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 4)
+ @Operation(summary = "删除付款申请草稿")
+ public R remove(@RequestParam Long id) { paymentApplicationService.removeDraft(id); return R.success("删除成功"); }
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 5)
+ @Operation(summary = "提交付款申请")
+ public R submit(@RequestBody PaymentApplicationStatusRequest request) { paymentApplicationService.submit(request); return R.success("提交成功"); }
+ @PostMapping("/approve")
+ @ApiOperationSupport(order = 6)
+ @Operation(summary = "审批通过付款申请")
+ public R approve(@RequestBody PaymentApplicationStatusRequest request) { paymentApplicationService.approve(request); return R.success("审批通过"); }
+ @PostMapping("/return")
+ @ApiOperationSupport(order = 7)
+ @Operation(summary = "驳回付款申请")
+ public R returnBill(@RequestBody PaymentApplicationStatusRequest request) { paymentApplicationService.returnBill(request); return R.success("已驳回"); }
+ @PostMapping("/void")
+ @ApiOperationSupport(order = 8)
+ @Operation(summary = "作废付款申请")
+ public R voidBill(@RequestBody PaymentApplicationStatusRequest request) { paymentApplicationService.voidBill(request); return R.success("作废成功"); }
+ @PostMapping("/sync-kingdee")
+ @ApiOperationSupport(order = 9)
+ @Operation(summary = "生成金蝶付款单")
+ public R syncKingdee(@RequestParam Long id) { return R.data(paymentApplicationService.syncKingdee(id)); }
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/ReceiptClaimRecordController.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/ReceiptClaimRecordController.java
new file mode 100644
index 0000000..7cfd3f8
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/ReceiptClaimRecordController.java
@@ -0,0 +1,90 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.annotation.PreAuth;
+import org.springblade.core.tool.api.R;
+import org.springblade.transport.pojo.dto.ReceiptClaimAttachmentsRequest;
+import org.springblade.transport.pojo.vo.ReceiptClaimRecordVO;
+import org.springblade.transport.service.IReceiptClaimRecordService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 认领记录控制器
+ *
+ * @author Chill
+ */
+@RestController
+@AllArgsConstructor
+@PreAuth(menu = "receipt_claim_record")
+@RequestMapping("/receipt-claim-record")
+@Tag(name = "认领记录", description = "当前用户收款认领记录查询与作废")
+public class ReceiptClaimRecordController extends BladeController {
+
+ private final IReceiptClaimRecordService receiptClaimRecordService;
+
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 1)
+ @Operation(summary = "当前用户认领记录分页")
+ public R> list(ReceiptClaimRecordVO query, Query pageQuery) {
+ return R.data(receiptClaimRecordService.selectPage(Condition.getPage(pageQuery), query));
+ }
+
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 2)
+ @Operation(summary = "认领记录详情")
+ public R detail(@RequestParam Long id) {
+ return R.data(receiptClaimRecordService.detail(id));
+ }
+
+ @PostMapping("/attachments")
+ @ApiOperationSupport(order = 3)
+ @Operation(summary = "维护本人认领记录附件")
+ public R updateAttachments(@RequestBody ReceiptClaimAttachmentsRequest request) {
+ receiptClaimRecordService.updateAttachments(request);
+ return R.success();
+ }
+
+ @PostMapping("/void")
+ @ApiOperationSupport(order = 4)
+ @Operation(summary = "作废认领记录并生成金蝶认领冲单")
+ public R voidClaim(@RequestParam Long id) {
+ return R.data(receiptClaimRecordService.voidClaim(id));
+ }
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/ReceiptFlowController.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/ReceiptFlowController.java
new file mode 100644
index 0000000..4aa3f02
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/controller/ReceiptFlowController.java
@@ -0,0 +1,102 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.annotation.PreAuth;
+import org.springblade.core.tool.api.R;
+import org.springblade.transport.pojo.dto.ReceiptClaimRequest;
+import org.springblade.transport.pojo.dto.ReceiptFlowSyncRequest;
+import org.springblade.transport.pojo.vo.ReceiptFlowVO;
+import org.springblade.transport.service.IReceiptFlowService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 收款流水控制器
+ *
+ * @author Chill
+ */
+@RestController
+@AllArgsConstructor
+@PreAuth(menu = "receipt_flow")
+@RequestMapping("/receipt-flow")
+@Tag(name = "收款流水", description = "金蝶收款流水同步与认领管理")
+public class ReceiptFlowController extends BladeController {
+
+ private final IReceiptFlowService receiptFlowService;
+
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 1)
+ @Operation(summary = "收款流水分页")
+ public R> list(ReceiptFlowVO query, Query pageQuery) {
+ return R.data(receiptFlowService.selectPage(Condition.getPage(pageQuery), query));
+ }
+
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 2)
+ @Operation(summary = "收款流水详情")
+ public R detail(@RequestParam Long id) {
+ return R.data(receiptFlowService.detail(id));
+ }
+
+ @GetMapping("/settlement-candidates")
+ @ApiOperationSupport(order = 3)
+ @Operation(summary = "可关联的应收正式结算单")
+ public R>> settlementCandidates(
+ @RequestParam(required = false) String keyword,
+ @RequestParam Long flowId) {
+ return R.data(receiptFlowService.settlementCandidates(keyword, flowId));
+ }
+
+ @PostMapping("/claim")
+ @ApiOperationSupport(order = 4)
+ @Operation(summary = "认领收款流水")
+ public R claim(@RequestBody ReceiptClaimRequest request) {
+ return R.data(receiptFlowService.claim(request));
+ }
+
+ @PostMapping("/sync")
+ @ApiOperationSupport(order = 5)
+ @Operation(summary = "手动同步金蝶收款流水")
+ public R sync(@RequestBody(required = false) ReceiptFlowSyncRequest request) {
+ return R.data(receiptFlowService.sync(request));
+ }
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/BillLedgerMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/BillLedgerMapper.java
new file mode 100644
index 0000000..15a7948
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/BillLedgerMapper.java
@@ -0,0 +1,14 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.BillLedger;
+
+/** 汇票台账 Mapper。 @author Chill */
+@Mapper
+public interface BillLedgerMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/BillLedgerUsageMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/BillLedgerUsageMapper.java
new file mode 100644
index 0000000..49915d1
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/BillLedgerUsageMapper.java
@@ -0,0 +1,14 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.BillLedgerUsage;
+
+/** 汇票使用记录 Mapper。 @author Chill */
+@Mapper
+public interface BillLedgerUsageMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/BillPaymentMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/BillPaymentMapper.java
new file mode 100644
index 0000000..2b2db97
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/BillPaymentMapper.java
@@ -0,0 +1,35 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.BillPayment;
+
+/** 汇票付款 Mapper。 @author Chill */
+@Mapper
+public interface BillPaymentMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationDetailMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationDetailMapper.java
new file mode 100644
index 0000000..bdfc170
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationDetailMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.InvoiceApplicationDetail;
+
+/**
+ * 开票申请结算明细 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface InvoiceApplicationDetailMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationLineMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationLineMapper.java
new file mode 100644
index 0000000..412052f
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationLineMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.InvoiceApplicationLine;
+
+/**
+ * 开票申请商品行 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface InvoiceApplicationLineMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationMapper.java
new file mode 100644
index 0000000..9e9db78
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.InvoiceApplication;
+
+/**
+ * 开票申请 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface InvoiceApplicationMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationRecordMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationRecordMapper.java
new file mode 100644
index 0000000..b3666bc
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationRecordMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.InvoiceApplicationRecord;
+
+/**
+ * 开票申请操作记录 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface InvoiceApplicationRecordMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationSettlementMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationSettlementMapper.java
new file mode 100644
index 0000000..1cc35ba
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationSettlementMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.InvoiceApplicationSettlement;
+
+/**
+ * 开票申请结算单 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface InvoiceApplicationSettlementMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationSheetMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationSheetMapper.java
new file mode 100644
index 0000000..6715132
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceApplicationSheetMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.InvoiceApplicationSheet;
+
+/**
+ * 开票申请发票张次 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface InvoiceApplicationSheetMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceReceiptMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceReceiptMapper.java
new file mode 100644
index 0000000..eb554ae
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceReceiptMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.InvoiceReceipt;
+
+/**
+ * 收票登记 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface InvoiceReceiptMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceReceiptRecordMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceReceiptRecordMapper.java
new file mode 100644
index 0000000..bd7501f
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceReceiptRecordMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.InvoiceReceiptRecord;
+
+/**
+ * 收票登记操作记录 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface InvoiceReceiptRecordMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceReceiptSettlementMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceReceiptSettlementMapper.java
new file mode 100644
index 0000000..3a26ea7
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/InvoiceReceiptSettlementMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.InvoiceReceiptSettlement;
+
+/**
+ * 收票登记结算单分摊 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface InvoiceReceiptSettlementMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/KingdeeInvoicePoolMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/KingdeeInvoicePoolMapper.java
new file mode 100644
index 0000000..d299c63
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/KingdeeInvoicePoolMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.KingdeeInvoicePool;
+
+/**
+ * 金蝶进项发票票据池 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface KingdeeInvoicePoolMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/KingdeeReceiptFlowMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/KingdeeReceiptFlowMapper.java
new file mode 100644
index 0000000..7d69772
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/KingdeeReceiptFlowMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.KingdeeReceiptFlow;
+
+/**
+ * 金蝶收款流水镜像 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface KingdeeReceiptFlowMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/PaymentApplicationInvoiceMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/PaymentApplicationInvoiceMapper.java
new file mode 100644
index 0000000..21c8c0a
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/PaymentApplicationInvoiceMapper.java
@@ -0,0 +1,29 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments from this software for such purposes.
+ * Copyright of this software remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.PaymentApplicationInvoice;
+
+/** 付款申请发票 Mapper。 @author Chill */
+@Mapper
+public interface PaymentApplicationInvoiceMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/PaymentApplicationMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/PaymentApplicationMapper.java
new file mode 100644
index 0000000..770dc20
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/PaymentApplicationMapper.java
@@ -0,0 +1,29 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments from this software for such purposes.
+ * Copyright of this software remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.PaymentApplication;
+
+/** 付款申请 Mapper。 @author Chill */
+@Mapper
+public interface PaymentApplicationMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/PaymentApplicationRecordMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/PaymentApplicationRecordMapper.java
new file mode 100644
index 0000000..dd9dfb8
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/PaymentApplicationRecordMapper.java
@@ -0,0 +1,29 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments from this software for such purposes.
+ * Copyright of this software remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.PaymentApplicationRecord;
+
+/** 付款申请付款记录 Mapper。 @author Chill */
+@Mapper
+public interface PaymentApplicationRecordMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/ReceiptClaimMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/ReceiptClaimMapper.java
new file mode 100644
index 0000000..cf0fd17
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/ReceiptClaimMapper.java
@@ -0,0 +1,50 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.transport.pojo.entity.ReceiptClaim;
+import org.springblade.transport.pojo.vo.ReceiptClaimRecordVO;
+
+import java.util.List;
+
+/**
+ * 收款流水认领 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface ReceiptClaimMapper extends BaseMapper {
+
+ List selectClaimRecordPage(IPage page,
+ @Param("query") ReceiptClaimRecordVO query, @Param("claimerId") Long claimerId);
+
+ ReceiptClaimRecordVO selectClaimRecordDetail(@Param("id") Long id,
+ @Param("claimerId") Long claimerId);
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/ReceiptClaimMapper.xml b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/ReceiptClaimMapper.xml
new file mode 100644
index 0000000..07a2553
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/ReceiptClaimMapper.xml
@@ -0,0 +1,114 @@
+
+
+
+
+
+ c.id,
+ c.tenant_id,
+ c.create_user,
+ c.create_dept,
+ c.create_time,
+ c.update_user,
+ c.update_time,
+ c.status,
+ c.is_deleted,
+ c.receipt_flow_id,
+ c.claim_amount,
+ c.claimer_id,
+ c.claimer_name,
+ c.claimer_dept_id,
+ c.claimer_dept_name,
+ c.claim_date,
+ c.attachments_json,
+ c.remark,
+ c.claim_status,
+ c.kingdee_bill_no,
+ c.kingdee_bill_status,
+ c.voided_by,
+ c.voided_by_name,
+ c.voided_time,
+ f.receipt_notice_no,
+ f.payer_name,
+ f.receipt_amount,
+ f.counterparty_name,
+ f.counterparty_account,
+ f.counterparty_bank,
+ f.summary,
+ f.transaction_time,
+ f.detail_serial_no,
+ (SELECT GROUP_CONCAT(rcs.formal_settlement_no ORDER BY rcs.id SEPARATOR ',')
+ FROM blade_receipt_claim_settlement rcs
+ WHERE rcs.receipt_claim_id = c.id AND rcs.is_deleted = 0) AS associated_settlement_nos
+
+
+
+ c.is_deleted = 0
+ AND f.is_deleted = 0
+ AND c.claimer_id = #{claimerId}
+
+
+ AND f.receipt_notice_no LIKE #{receiptNoticeNoLike}
+
+
+
+ AND f.counterparty_name LIKE #{counterpartyNameLike}
+
+
+
+ AND f.counterparty_bank LIKE #{counterpartyBankLike}
+
+
+
+ AND f.counterparty_account LIKE #{counterpartyAccountLike}
+
+
+
+ AND f.summary LIKE #{summaryLike}
+
+
+ AND c.claim_status = #{query.claimStatus}
+
+
+ AND f.transaction_time >= #{query.transactionStartDate}
+
+
+ AND f.transaction_time < DATE_ADD(#{query.transactionEndDate}, INTERVAL 1 DAY)
+
+
+
+ AND c.claimer_name LIKE #{claimerNameLike}
+
+
+ AND c.claim_date >= #{query.claimStartDate}
+
+
+ AND c.claim_date <= #{query.claimEndDate}
+
+
+
+ AND c.claimer_dept_name LIKE #{claimerDeptNameLike}
+
+
+ AND c.kingdee_bill_status = #{query.kingdeeBillStatus}
+
+
+
+
+ SELECT
+ FROM blade_receipt_claim c
+ INNER JOIN blade_kingdee_receipt_flow f ON f.id = c.receipt_flow_id
+ WHERE
+ ORDER BY c.create_time DESC
+
+
+
+ SELECT
+ FROM blade_receipt_claim c
+ INNER JOIN blade_kingdee_receipt_flow f ON f.id = c.receipt_flow_id
+ WHERE c.id = #{id}
+ AND c.claimer_id = #{claimerId}
+ AND c.is_deleted = 0
+ AND f.is_deleted = 0
+
+
+
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/ReceiptClaimSettlementMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/ReceiptClaimSettlementMapper.java
new file mode 100644
index 0000000..3537992
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/ReceiptClaimSettlementMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.ReceiptClaimSettlement;
+
+/**
+ * 收款认领结算单分摊 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface ReceiptClaimSettlementMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/ReceiptFlowRecordMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/ReceiptFlowRecordMapper.java
new file mode 100644
index 0000000..2f05829
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/ReceiptFlowRecordMapper.java
@@ -0,0 +1,39 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.ReceiptFlowRecord;
+
+/**
+ * 收款流水操作留痕 Mapper 接口
+ *
+ * @author Chill
+ */
+@Mapper
+public interface ReceiptFlowRecordMapper extends BaseMapper {
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IBillLedgerService.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IBillLedgerService.java
new file mode 100644
index 0000000..c31abd0
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IBillLedgerService.java
@@ -0,0 +1,24 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ */
+package org.springblade.transport.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.transport.pojo.dto.BillLedgerSaveRequest;
+import org.springblade.transport.pojo.entity.BillLedger;
+import org.springblade.transport.pojo.vo.BillLedgerVO;
+
+import java.util.List;
+import java.util.Map;
+
+/** 汇票台账服务。 @author Chill */
+public interface IBillLedgerService extends BaseService {
+ IPage selectPage(IPage page, BillLedgerVO query);
+ BillLedgerVO detail(Long id);
+ Map expiryCounts();
+ List availableOptions(String keyword, Long deptId, Long selectedId);
+ Long submit(BillLedgerSaveRequest request);
+ void removeLedger(Long id);
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IBillPaymentService.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IBillPaymentService.java
new file mode 100644
index 0000000..089d064
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IBillPaymentService.java
@@ -0,0 +1,45 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.transport.pojo.dto.BillPaymentSaveRequest;
+import org.springblade.transport.pojo.dto.BillPaymentStatusRequest;
+import org.springblade.transport.pojo.entity.BillPayment;
+import org.springblade.transport.pojo.vo.BillPaymentVO;
+
+/** 汇票付款服务。 @author Chill */
+public interface IBillPaymentService extends BaseService {
+ IPage selectPage(IPage page, BillPaymentVO query);
+ BillPaymentVO detail(Long id);
+ Long saveDraft(BillPaymentSaveRequest request);
+ void removeDraft(Long id);
+ void submit(BillPaymentStatusRequest request);
+ void approve(BillPaymentStatusRequest request);
+ void returnBill(BillPaymentStatusRequest request);
+ void voidBill(BillPaymentStatusRequest request);
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IInvoiceApplicationService.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IInvoiceApplicationService.java
new file mode 100644
index 0000000..fe65e70
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IInvoiceApplicationService.java
@@ -0,0 +1,57 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.transport.pojo.dto.InvoiceApplicationSaveRequest;
+import org.springblade.transport.pojo.dto.InvoiceApplicationStatusRequest;
+import org.springblade.transport.pojo.entity.FormalSettlementDetail;
+import org.springblade.transport.pojo.entity.InvoiceApplication;
+import org.springblade.transport.pojo.vo.InvoiceApplicationVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 开票申请服务
+ *
+ * @author Chill
+ */
+public interface IInvoiceApplicationService extends BaseService {
+ IPage selectPage(IPage page, InvoiceApplicationVO query);
+ InvoiceApplicationVO detail(Long id);
+ List> settlementCandidates(String keyword);
+ List settlementDetails(String settlementIds);
+ Map receiverInformation(String settlementIds);
+ Long saveDraft(InvoiceApplicationSaveRequest request);
+ void removeDraft(Long id);
+ void submit(InvoiceApplicationStatusRequest request);
+ void approve(InvoiceApplicationStatusRequest request);
+ void returnBill(InvoiceApplicationStatusRequest request);
+ void voidBill(InvoiceApplicationStatusRequest request);
+ String syncKingdee(Long id);
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IInvoiceReceiptService.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IInvoiceReceiptService.java
new file mode 100644
index 0000000..c6253ae
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IInvoiceReceiptService.java
@@ -0,0 +1,69 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.transport.pojo.dto.InvoiceReceiptSaveRequest;
+import org.springblade.transport.pojo.dto.InvoiceReceiptStatusRequest;
+import org.springblade.transport.pojo.entity.InvoiceReceipt;
+import org.springblade.transport.pojo.entity.KingdeeInvoicePool;
+import org.springblade.transport.pojo.vo.InvoiceReceiptVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 收票登记服务
+ *
+ * @author Chill
+ */
+public interface IInvoiceReceiptService extends BaseService {
+
+ IPage selectPage(IPage page, InvoiceReceiptVO query);
+
+ InvoiceReceiptVO detail(Long id);
+
+ List invoicePool(String keyword);
+
+ List> settlementCandidates(String keyword, Long receiptId);
+
+ Map referenceInformation(String settlementIds);
+
+ Long saveDraft(InvoiceReceiptSaveRequest request);
+
+ void removeDraft(Long id);
+
+ void submit(InvoiceReceiptStatusRequest request);
+
+ void approve(InvoiceReceiptStatusRequest request);
+
+ void returnBill(InvoiceReceiptStatusRequest request);
+
+ void voidBill(InvoiceReceiptStatusRequest request);
+
+ String syncKingdee(Long id);
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IPaymentApplicationService.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IPaymentApplicationService.java
new file mode 100644
index 0000000..7a9c0f4
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IPaymentApplicationService.java
@@ -0,0 +1,40 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments from this software for such purposes.
+ * Copyright of this software remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.transport.pojo.dto.PaymentApplicationSaveRequest;
+import org.springblade.transport.pojo.dto.PaymentApplicationStatusRequest;
+import org.springblade.transport.pojo.entity.PaymentApplication;
+import org.springblade.transport.pojo.vo.PaymentApplicationVO;
+
+/** 付款申请服务。 @author Chill */
+public interface IPaymentApplicationService extends BaseService {
+ IPage selectPage(IPage page, PaymentApplicationVO query);
+ PaymentApplicationVO detail(Long id);
+ Long saveDraft(PaymentApplicationSaveRequest request);
+ void removeDraft(Long id);
+ void submit(PaymentApplicationStatusRequest request);
+ void approve(PaymentApplicationStatusRequest request);
+ void returnBill(PaymentApplicationStatusRequest request);
+ void voidBill(PaymentApplicationStatusRequest request);
+ String syncKingdee(Long id);
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IReceiptClaimRecordService.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IReceiptClaimRecordService.java
new file mode 100644
index 0000000..66a8886
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IReceiptClaimRecordService.java
@@ -0,0 +1,49 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.transport.pojo.dto.ReceiptClaimAttachmentsRequest;
+import org.springblade.transport.pojo.entity.ReceiptClaim;
+import org.springblade.transport.pojo.vo.ReceiptClaimRecordVO;
+
+/**
+ * 认领记录服务
+ *
+ * @author Chill
+ */
+public interface IReceiptClaimRecordService extends BaseService {
+
+ IPage selectPage(IPage page,
+ ReceiptClaimRecordVO query);
+
+ ReceiptClaimRecordVO detail(Long id);
+
+ void updateAttachments(ReceiptClaimAttachmentsRequest request);
+
+ String voidClaim(Long id);
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IReceiptFlowService.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IReceiptFlowService.java
new file mode 100644
index 0000000..816990d
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/IReceiptFlowService.java
@@ -0,0 +1,54 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.transport.pojo.dto.ReceiptClaimRequest;
+import org.springblade.transport.pojo.dto.ReceiptFlowSyncRequest;
+import org.springblade.transport.pojo.entity.KingdeeReceiptFlow;
+import org.springblade.transport.pojo.vo.ReceiptFlowVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 收款流水服务
+ *
+ * @author Chill
+ */
+public interface IReceiptFlowService extends BaseService {
+
+ IPage selectPage(IPage page, ReceiptFlowVO query);
+
+ ReceiptFlowVO detail(Long id);
+
+ List> settlementCandidates(String keyword, Long flowId);
+
+ Long claim(ReceiptClaimRequest request);
+
+ int sync(ReceiptFlowSyncRequest request);
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/BillLedgerServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/BillLedgerServiceImpl.java
new file mode 100644
index 0000000..e3645c2
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/BillLedgerServiceImpl.java
@@ -0,0 +1,302 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ */
+package org.springblade.transport.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.RequiredArgsConstructor;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.tool.jackson.JsonUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.transport.mapper.BillLedgerMapper;
+import org.springblade.transport.mapper.BillLedgerUsageMapper;
+import org.springblade.transport.mapper.CustomerArchiveMapper;
+import org.springblade.transport.pojo.dto.BillLedgerSaveRequest;
+import org.springblade.transport.pojo.entity.BillLedger;
+import org.springblade.transport.pojo.entity.BillLedgerUsage;
+import org.springblade.transport.pojo.entity.CustomerArchive;
+import org.springblade.transport.pojo.vo.BillLedgerVO;
+import org.springblade.transport.service.IBillLedgerService;
+import org.springblade.transport.wrapper.BillLedgerWrapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/** 汇票台账服务实现。 @author Chill */
+@Service
+@RequiredArgsConstructor
+public class BillLedgerServiceImpl extends BaseServiceImpl
+ implements IBillLedgerService {
+ private static final String APPROVED = "approved";
+ private final BillLedgerUsageMapper usageMapper;
+ private final CustomerArchiveMapper customerArchiveMapper;
+
+ @Override
+ public IPage selectPage(IPage page, BillLedgerVO query) {
+ LocalDate today = LocalDate.now();
+ LambdaQueryWrapper wrapper = Wrappers.lambdaQuery()
+ .like(Func.isNotEmpty(query.getBillNo()), BillLedger::getBillNo, query.getBillNo())
+ .ge(query.getIssueStartDate() != null, BillLedger::getIssueDate, query.getIssueStartDate())
+ .le(query.getIssueEndDate() != null, BillLedger::getIssueDate, query.getIssueEndDate())
+ .like(Func.isNotEmpty(query.getIssuerName()), BillLedger::getIssuerName, query.getIssuerName())
+ .like(Func.isNotEmpty(query.getReceiverName()), BillLedger::getReceiverName, query.getReceiverName())
+ .eq(Func.isNotEmpty(query.getBillType()), BillLedger::getBillType, query.getBillType());
+ applyMaturityStatus(wrapper, query.getMaturityStatus(), today);
+ applyExpiryShortcut(wrapper, query.getExpiryShortcut(), today);
+ wrapper.orderByDesc(BillLedger::getCreateTime);
+ return page(page, wrapper).convert(item -> BillLedgerWrapper.build().entityVO(item));
+ }
+
+ @Override
+ public BillLedgerVO detail(Long id) {
+ BillLedgerVO vo = BillLedgerWrapper.build().entityVO(existing(id));
+ vo.setUsageRecords(usageMapper.selectList(Wrappers.lambdaQuery()
+ .eq(BillLedgerUsage::getBillLedgerId, id)
+ .eq(BillLedgerUsage::getUsageStatus, APPROVED)
+ .orderByDesc(BillLedgerUsage::getCreateTime)));
+ return vo;
+ }
+
+ @Override
+ public Map expiryCounts() {
+ LocalDate today = LocalDate.now();
+ Map counts = new LinkedHashMap<>();
+ counts.put("all", count());
+ counts.put("within30", count(Wrappers.lambdaQuery()
+ .ge(BillLedger::getMaturityDate, today)
+ .le(BillLedger::getMaturityDate, today.plusDays(30))));
+ counts.put("within90", count(Wrappers.lambdaQuery()
+ .gt(BillLedger::getMaturityDate, today.plusDays(30))
+ .le(BillLedger::getMaturityDate, today.plusDays(90))));
+ counts.put("over90", count(Wrappers.lambdaQuery()
+ .gt(BillLedger::getMaturityDate, today.plusDays(90))));
+ return counts;
+ }
+
+ @Override
+ public List availableOptions(String keyword, Long deptId, Long selectedId) {
+ LocalDate today = LocalDate.now();
+ return list(Wrappers.lambdaQuery()
+ .and(Func.isNotEmpty(keyword), wrapper -> wrapper.like(BillLedger::getBillNo, keyword)
+ .or().like(BillLedger::getIssuerName, keyword)
+ .or().like(BillLedger::getReceiverName, keyword))
+ .and(wrapper -> wrapper
+ .gt(BillLedger::getAvailableBalance, BigDecimal.ZERO)
+ .ge(BillLedger::getMaturityDate, today)
+ .or(selectedId != null, child -> child.eq(BillLedger::getId, selectedId)))
+ .orderByAsc(BillLedger::getMaturityDate)
+ .orderByDesc(BillLedger::getCreateTime)
+ .last("limit 200")).stream()
+ .filter(item -> selectedId != null && Objects.equals(item.getId(), selectedId)
+ || departmentAvailable(item, deptId))
+ .map(item -> BillLedgerWrapper.build().entityVO(item))
+ .toList();
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Long submit(BillLedgerSaveRequest request) {
+ validateRequest(request);
+ BillLedger entity = request.getId() == null ? new BillLedger() : locked(request.getId());
+ String billNo = required(request.getBillNo(), "票据号码", 32);
+ if (entity.getId() != null && !billNo.equals(entity.getBillNo())) {
+ throw new ServiceException("票据号码编辑时不可修改");
+ }
+ Long duplicate = count(Wrappers.lambdaQuery()
+ .eq(BillLedger::getBillNo, billNo)
+ .ne(entity.getId() != null, BillLedger::getId, entity.getId()));
+ if (duplicate > 0) {
+ throw new ServiceException("票据号码已存在");
+ }
+ CustomerArchive issuer = customer(request.getIssuerId(), "出票单位");
+ CustomerArchive feeBearer = customer(request.getFeeBearerId(), "费用承担方");
+ BigDecimal faceAmount = positive(request.getFaceAmount(), "票面金额").setScale(2, RoundingMode.HALF_UP);
+ BigDecimal usedAmount = entity.getId() == null ? BigDecimal.ZERO : activeUsedAmount(entity.getId());
+ if (faceAmount.compareTo(usedAmount) < 0) {
+ throw new ServiceException("票面金额不能小于已使用金额");
+ }
+
+ entity.setBillNo(billNo);
+ entity.setIssuerId(issuer.getId());
+ entity.setIssuerName(customerName(issuer));
+ entity.setReceiverName(required(request.getReceiverName(), "收票单位", 100));
+ entity.setBillType(request.getBillType());
+ entity.setFaceAmount(faceAmount);
+ entity.setAvailableBalance(faceAmount.subtract(usedAmount).setScale(2, RoundingMode.HALF_UP));
+ entity.setIssueDate(request.getIssueDate());
+ entity.setMaturityDate(request.getMaturityDate());
+ entity.setAvailableDeptIdsJson(request.getAvailableDeptIdsJson());
+ entity.setAvailableDeptNames(required(request.getAvailableDeptNames(), "可用部门", 500));
+ entity.setFeeBearerId(feeBearer.getId());
+ entity.setFeeBearerName(customerName(feeBearer));
+ entity.setConfirmedDiscountRate(rate(request.getConfirmedDiscountRate(), "双方确认贴现率"));
+ entity.setIssuingBank(required(request.getIssuingBank(), "出票行", 100));
+ entity.setBankDiscountReferenceRate(rate(request.getBankDiscountReferenceRate(), "银行贴现参考率"));
+ entity.setEstimatedDiscountFee(calculateDiscountFee(faceAmount, entity.getConfirmedDiscountRate()));
+ entity.setAttachmentsJson(request.getAttachmentsJson());
+ entity.setRemark(limit(request.getRemark(), 200, "备注"));
+ if (entity.getId() == null) {
+ entity.setStatus(1);
+ }
+ saveOrUpdate(entity);
+ return entity.getId();
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void removeLedger(Long id) {
+ BillLedger entity = locked(id);
+ if (usageMapper.selectCount(Wrappers.lambdaQuery()
+ .eq(BillLedgerUsage::getBillLedgerId, id)
+ .eq(BillLedgerUsage::getUsageStatus, APPROVED)) > 0) {
+ throw new ServiceException("存在已审核使用记录的汇票不允许删除");
+ }
+ removeById(entity);
+ }
+
+ private void validateRequest(BillLedgerSaveRequest request) {
+ if (request == null) {
+ throw new ServiceException("请求参数不能为空");
+ }
+ if (!List.of("issued", "received").contains(request.getBillType())) {
+ throw new ServiceException("汇票类型不合法");
+ }
+ if (request.getIssueDate() == null) {
+ throw new ServiceException("出票日期不能为空");
+ }
+ if (request.getMaturityDate() == null || !request.getMaturityDate().isAfter(request.getIssueDate())) {
+ throw new ServiceException("到期日期必须晚于出票日期");
+ }
+ List> deptIds = parseArray(request.getAvailableDeptIdsJson(), "可用部门");
+ if (deptIds.isEmpty()) {
+ throw new ServiceException("可用部门不能为空");
+ }
+ }
+
+ private void applyMaturityStatus(LambdaQueryWrapper wrapper, String status,
+ LocalDate today) {
+ if (Func.isEmpty(status)) return;
+ switch (status) {
+ case "expired" -> wrapper.lt(BillLedger::getMaturityDate, today);
+ case "due_today" -> wrapper.eq(BillLedger::getMaturityDate, today);
+ case "unexpired" -> wrapper.gt(BillLedger::getMaturityDate, today);
+ default -> throw new ServiceException("到期状态不合法");
+ }
+ }
+
+ private void applyExpiryShortcut(LambdaQueryWrapper wrapper, String shortcut,
+ LocalDate today) {
+ if (Func.isEmpty(shortcut) || "all".equals(shortcut)) return;
+ switch (shortcut) {
+ case "within30" -> wrapper.ge(BillLedger::getMaturityDate, today)
+ .le(BillLedger::getMaturityDate, today.plusDays(30));
+ case "within90" -> wrapper.gt(BillLedger::getMaturityDate, today.plusDays(30))
+ .le(BillLedger::getMaturityDate, today.plusDays(90));
+ case "over90" -> wrapper.gt(BillLedger::getMaturityDate, today.plusDays(90));
+ default -> throw new ServiceException("到期快捷筛选不合法");
+ }
+ }
+
+ private BillLedger existing(Long id) {
+ BillLedger entity = getById(id);
+ if (entity == null || Objects.equals(entity.getIsDeleted(), 1)) {
+ throw new ServiceException("汇票台账不存在");
+ }
+ return entity;
+ }
+
+ private BillLedger locked(Long id) {
+ BillLedger entity = baseMapper.selectOne(Wrappers.lambdaQuery()
+ .eq(BillLedger::getId, id).last("FOR UPDATE"));
+ if (entity == null || Objects.equals(entity.getIsDeleted(), 1)) {
+ throw new ServiceException("汇票台账不存在");
+ }
+ return entity;
+ }
+
+ private CustomerArchive customer(Long id, String name) {
+ if (id == null) throw new ServiceException(name + "不能为空");
+ CustomerArchive customer = customerArchiveMapper.selectById(id);
+ if (customer == null || Objects.equals(customer.getIsDeleted(), 1)) {
+ throw new ServiceException(name + "对应的客商档案不存在");
+ }
+ return customer;
+ }
+
+ private BigDecimal activeUsedAmount(Long ledgerId) {
+ return usageMapper.selectList(Wrappers.lambdaQuery()
+ .eq(BillLedgerUsage::getBillLedgerId, ledgerId)
+ .eq(BillLedgerUsage::getUsageStatus, APPROVED)).stream()
+ .map(BillLedgerUsage::getUsedAmount)
+ .map(this::money)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ }
+
+ private boolean departmentAvailable(BillLedger ledger, Long deptId) {
+ List> values = parseArray(ledger.getAvailableDeptIdsJson(), "可用部门");
+ if (values.stream().anyMatch(value -> "all".equals(String.valueOf(value)))) return true;
+ return deptId == null || values.stream().anyMatch(value -> String.valueOf(deptId).equals(String.valueOf(value)));
+ }
+
+ private List> parseArray(String value, String name) {
+ if (Func.isEmpty(value)) return List.of();
+ try {
+ Object parsed = JsonUtil.parse(value, List.class);
+ return parsed instanceof List> list ? list : List.of();
+ } catch (Exception exception) {
+ throw new ServiceException(name + "格式不正确");
+ }
+ }
+
+ private String customerName(CustomerArchive customer) {
+ return Func.isNotEmpty(customer.getFullName()) ? customer.getFullName() : customer.getShortName();
+ }
+
+ private BigDecimal calculateDiscountFee(BigDecimal faceAmount, BigDecimal rate) {
+ if (rate == null) return BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+ return faceAmount.multiply(rate).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
+ }
+
+ private BigDecimal positive(BigDecimal value, String name) {
+ if (value == null || value.compareTo(BigDecimal.ZERO) <= 0) {
+ throw new ServiceException(name + "必须大于0");
+ }
+ if (value.scale() > 2) throw new ServiceException(name + "最多保留2位小数");
+ return value;
+ }
+
+ private BigDecimal rate(BigDecimal value, String name) {
+ if (value == null) return null;
+ if (value.compareTo(BigDecimal.ZERO) < 0 || value.compareTo(BigDecimal.valueOf(100)) > 0) {
+ throw new ServiceException(name + "必须在0-100之间");
+ }
+ return value.setScale(Math.min(value.scale(), 4), RoundingMode.HALF_UP);
+ }
+
+ private BigDecimal money(BigDecimal value) {
+ return value == null ? BigDecimal.ZERO : value;
+ }
+
+ private String required(String value, String name, int length) {
+ if (Func.isEmpty(value) || value.trim().isEmpty()) throw new ServiceException(name + "不能为空");
+ return limit(value.trim(), length, name);
+ }
+
+ private String limit(String value, int length, String name) {
+ if (value != null && value.length() > length) {
+ throw new ServiceException(name + "不能超过" + length + "个字符");
+ }
+ return value;
+ }
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/BillPaymentServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/BillPaymentServiceImpl.java
new file mode 100644
index 0000000..15125ee
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/BillPaymentServiceImpl.java
@@ -0,0 +1,343 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.RequiredArgsConstructor;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.jackson.JsonUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.system.cache.SysCache;
+import org.springblade.transport.mapper.BillLedgerMapper;
+import org.springblade.transport.mapper.BillLedgerUsageMapper;
+import org.springblade.transport.mapper.BillPaymentMapper;
+import org.springblade.transport.pojo.dto.BillPaymentSaveRequest;
+import org.springblade.transport.pojo.dto.BillPaymentStatusRequest;
+import org.springblade.transport.pojo.entity.BillLedger;
+import org.springblade.transport.pojo.entity.BillLedgerUsage;
+import org.springblade.transport.pojo.entity.BillPayment;
+import org.springblade.transport.pojo.vo.BillPaymentVO;
+import org.springblade.transport.service.IBillPaymentService;
+import org.springblade.transport.wrapper.BillPaymentWrapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+import java.util.Objects;
+
+/** 汇票付款服务实现。 @author Chill */
+@Service
+@RequiredArgsConstructor
+public class BillPaymentServiceImpl extends BaseServiceImpl
+ implements IBillPaymentService {
+ private static final String DRAFT = "draft";
+ private static final String REVIEWING = "reviewing";
+ private static final String APPROVED = "approved";
+ private static final String RETURNED = "returned";
+ private static final String VOIDED = "voided";
+ private static final String RELEASED = "released";
+
+ private final BillLedgerMapper billLedgerMapper;
+ private final BillLedgerUsageMapper usageMapper;
+
+ @Override
+ public IPage selectPage(IPage page, BillPaymentVO query) {
+ LambdaQueryWrapper wrapper = Wrappers.lambdaQuery()
+ .like(Func.isNotEmpty(query.getPaymentNo()), BillPayment::getPaymentNo, query.getPaymentNo())
+ .like(Func.isNotEmpty(query.getDeptName()), BillPayment::getDeptName, query.getDeptName())
+ .ge(query.getPaymentStartDate() != null, BillPayment::getPaymentDate, query.getPaymentStartDate())
+ .le(query.getPaymentEndDate() != null, BillPayment::getPaymentDate, query.getPaymentEndDate())
+ .eq(Func.isNotEmpty(query.getApprovalStatus()), BillPayment::getApprovalStatus,
+ query.getApprovalStatus())
+ .orderByDesc(BillPayment::getCreateTime);
+ return page(page, wrapper).convert(item -> BillPaymentWrapper.build().entityVO(item));
+ }
+
+ @Override
+ public BillPaymentVO detail(Long id) {
+ BillPayment entity = existing(id);
+ BillPaymentVO vo = BillPaymentWrapper.build().entityVO(entity);
+ BillLedger ledger = billLedgerMapper.selectById(entity.getBillLedgerId());
+ if (ledger != null) {
+ vo.setBillNo(ledger.getBillNo());
+ vo.setFaceAmount(ledger.getFaceAmount());
+ vo.setAvailableBalance(ledger.getAvailableBalance());
+ }
+ return vo;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Long saveDraft(BillPaymentSaveRequest request) {
+ validateRequest(request);
+ BillPayment entity = request.getId() == null ? new BillPayment() : locked(request.getId());
+ if (entity.getId() != null && !List.of(DRAFT, RETURNED).contains(entity.getApprovalStatus())) {
+ throw new ServiceException("当前状态不可编辑");
+ }
+ Long deptId = Func.firstLong(AuthUtil.getDeptId());
+ if (deptId == null) {
+ throw new ServiceException("使用部门不能为空");
+ }
+ if (entity.getId() != null && !Objects.equals(entity.getDeptId(), deptId)) {
+ throw new ServiceException("仅允许编辑当前部门的汇票付款");
+ }
+ String deptName = required(SysCache.getDeptName(deptId), "使用部门", 100);
+ BillLedger ledger = lockedBill(request.getBillLedgerId());
+ BigDecimal usedAmount = positive(request.getUsedAmount(), "本次使用");
+ validateLedgerAmount(ledger, usedAmount, deptId);
+ if (entity.getId() == null) {
+ entity.setPaymentNo(nextNo());
+ entity.setApprovalStatus(DRAFT);
+ entity.setCurrentNode("草稿");
+ }
+ entity.setBillLedgerId(ledger.getId());
+ entity.setBillNo(ledger.getBillNo());
+ entity.setFaceAmount(money(ledger.getFaceAmount()).setScale(2, RoundingMode.HALF_UP));
+ entity.setAvailableBalance(money(ledger.getAvailableBalance()).setScale(2, RoundingMode.HALF_UP));
+ entity.setUsedAmount(usedAmount);
+ entity.setDeptId(deptId);
+ entity.setDeptName(deptName);
+ entity.setPaymentDate(request.getPaymentDate() == null ? LocalDate.now() : request.getPaymentDate());
+ entity.setAttachmentsJson(request.getAttachmentsJson());
+ entity.setRemark(limit(request.getRemark(), 200, "备注"));
+ entity.setStatus(1);
+ saveOrUpdate(entity);
+ return entity.getId();
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void removeDraft(Long id) {
+ BillPayment entity = locked(id);
+ if (!DRAFT.equals(entity.getApprovalStatus())) {
+ throw new ServiceException("仅草稿状态的汇票付款允许删除");
+ }
+ removeById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void submit(BillPaymentStatusRequest request) {
+ BillPayment entity = locked(requiredId(request));
+ if (!List.of(DRAFT, RETURNED).contains(entity.getApprovalStatus())) {
+ throw new ServiceException("当前状态不允许提交");
+ }
+ validateStoredAmount(entity);
+ entity.setApprovalStatus(REVIEWING);
+ entity.setCurrentNode("财务审核");
+ entity.setCurrentProcessor(AuthUtil.getUserName());
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void approve(BillPaymentStatusRequest request) {
+ BillPayment entity = locked(requiredId(request));
+ if (!REVIEWING.equals(entity.getApprovalStatus())) {
+ throw new ServiceException("仅审批中的汇票付款允许审核");
+ }
+ BillLedger ledger = lockedBill(entity.getBillLedgerId());
+ validateLedgerAmount(ledger, entity.getUsedAmount(), entity.getDeptId());
+ BillLedgerUsage exists = usageMapper.selectOne(Wrappers.lambdaQuery()
+ .eq(BillLedgerUsage::getBillPaymentId, entity.getId())
+ .eq(BillLedgerUsage::getUsageStatus, APPROVED)
+ .last("FOR UPDATE"));
+ if (exists != null) {
+ throw new ServiceException("该汇票付款已生成使用记录");
+ }
+ BigDecimal usedAmount = money(entity.getUsedAmount()).setScale(2, RoundingMode.HALF_UP);
+ ledger.setAvailableBalance(money(ledger.getAvailableBalance()).subtract(usedAmount)
+ .setScale(2, RoundingMode.HALF_UP));
+ billLedgerMapper.updateById(ledger);
+ BillLedgerUsage usage = new BillLedgerUsage();
+ usage.setBillLedgerId(ledger.getId());
+ usage.setBillPaymentId(entity.getId());
+ usage.setApplicationNo(entity.getPaymentNo());
+ usage.setUsedAmount(usedAmount);
+ usage.setUseDeptId(entity.getDeptId());
+ usage.setUseDeptName(entity.getDeptName());
+ usage.setUsageStatus(APPROVED);
+ usage.setStatus(1);
+ usageMapper.insert(usage);
+ entity.setAvailableBalance(ledger.getAvailableBalance());
+ entity.setApprovalStatus(APPROVED);
+ entity.setCurrentNode("审批通过");
+ entity.setCurrentProcessor(AuthUtil.getUserName());
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void returnBill(BillPaymentStatusRequest request) {
+ BillPayment entity = locked(requiredId(request));
+ if (!REVIEWING.equals(entity.getApprovalStatus())) {
+ throw new ServiceException("仅审批中的汇票付款允许驳回");
+ }
+ entity.setApprovalStatus(RETURNED);
+ entity.setCurrentNode("已驳回");
+ entity.setCurrentProcessor(AuthUtil.getUserName());
+ entity.setRemark(request.getReason() == null ? entity.getRemark() : limit(request.getReason(), 200, "驳回原因"));
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void voidBill(BillPaymentStatusRequest request) {
+ BillPayment entity = locked(requiredId(request));
+ if (!APPROVED.equals(entity.getApprovalStatus())) {
+ throw new ServiceException("仅审批通过的汇票付款允许作废");
+ }
+ BillLedgerUsage usage = usageMapper.selectOne(Wrappers.lambdaQuery()
+ .eq(BillLedgerUsage::getBillPaymentId, entity.getId())
+ .eq(BillLedgerUsage::getUsageStatus, APPROVED)
+ .last("FOR UPDATE"));
+ if (usage == null) {
+ throw new ServiceException("未找到汇票使用记录,无法作废");
+ }
+ BillLedger ledger = lockedBill(usage.getBillLedgerId());
+ ledger.setAvailableBalance(money(ledger.getAvailableBalance()).add(money(usage.getUsedAmount()))
+ .min(money(ledger.getFaceAmount())).setScale(2, RoundingMode.HALF_UP));
+ billLedgerMapper.updateById(ledger);
+ usage.setUsageStatus(RELEASED);
+ usageMapper.updateById(usage);
+ entity.setAvailableBalance(ledger.getAvailableBalance());
+ entity.setApprovalStatus(VOIDED);
+ entity.setCurrentNode("已作废");
+ entity.setCurrentProcessor(AuthUtil.getUserName());
+ entity.setRemark(request.getReason() == null ? entity.getRemark() : limit(request.getReason(), 200, "作废原因"));
+ updateById(entity);
+ }
+
+ private void validateRequest(BillPaymentSaveRequest request) {
+ if (request == null) throw new ServiceException("请求参数不能为空");
+ if (request.getBillLedgerId() == null) throw new ServiceException("票据号码不能为空");
+ if (request.getPaymentDate() == null) throw new ServiceException("付款日期不能为空");
+ positive(request.getUsedAmount(), "本次使用");
+ }
+
+ private void validateStoredAmount(BillPayment entity) {
+ BillLedger ledger = lockedBill(entity.getBillLedgerId());
+ validateLedgerAmount(ledger, entity.getUsedAmount(), entity.getDeptId());
+ entity.setBillNo(ledger.getBillNo());
+ entity.setFaceAmount(ledger.getFaceAmount());
+ entity.setAvailableBalance(ledger.getAvailableBalance());
+ }
+
+ private void validateLedgerAmount(BillLedger ledger, BigDecimal usedAmount, Long deptId) {
+ if (ledger.getMaturityDate() != null && ledger.getMaturityDate().isBefore(LocalDate.now())) {
+ throw new ServiceException("所选汇票已到期");
+ }
+ if (usedAmount == null || usedAmount.compareTo(BigDecimal.ZERO) <= 0) {
+ throw new ServiceException("本次使用必须大于0");
+ }
+ if (usedAmount.scale() > 2) {
+ throw new ServiceException("本次使用最多保留2位小数");
+ }
+ if (usedAmount.compareTo(money(ledger.getAvailableBalance())) > 0) {
+ throw new ServiceException("本次使用不能超过汇票可用余额");
+ }
+ if (!departmentAvailable(ledger, deptId)) {
+ throw new ServiceException("当前使用部门不在汇票可用部门范围内");
+ }
+ }
+
+ private boolean departmentAvailable(BillLedger ledger, Long deptId) {
+ if (Func.isEmpty(ledger.getAvailableDeptIdsJson())) return false;
+ try {
+ Object parsed = JsonUtil.parse(ledger.getAvailableDeptIdsJson(), List.class);
+ if (!(parsed instanceof List> values)) return false;
+ if (values.stream().anyMatch(item -> "all".equals(String.valueOf(item)))) return true;
+ return deptId != null && values.stream().anyMatch(item -> String.valueOf(deptId).equals(String.valueOf(item)));
+ } catch (Exception exception) {
+ throw new ServiceException("汇票可用部门配置不正确");
+ }
+ }
+
+ private BillLedger lockedBill(Long id) {
+ BillLedger ledger = billLedgerMapper.selectOne(Wrappers.lambdaQuery()
+ .eq(BillLedger::getId, id).last("FOR UPDATE"));
+ if (ledger == null || Objects.equals(ledger.getIsDeleted(), 1)) {
+ throw new ServiceException("所选汇票台账不存在");
+ }
+ return ledger;
+ }
+
+ private BillPayment locked(Long id) {
+ BillPayment entity = baseMapper.selectOne(Wrappers.lambdaQuery()
+ .eq(BillPayment::getId, id).last("FOR UPDATE"));
+ if (entity == null || Objects.equals(entity.getIsDeleted(), 1)) {
+ throw new ServiceException("汇票付款不存在");
+ }
+ return entity;
+ }
+
+ private BillPayment existing(Long id) {
+ BillPayment entity = getById(id);
+ if (entity == null || Objects.equals(entity.getIsDeleted(), 1)) {
+ throw new ServiceException("汇票付款不存在");
+ }
+ return entity;
+ }
+
+ private Long requiredId(BillPaymentStatusRequest request) {
+ if (request == null || request.getId() == null) throw new ServiceException("单据不能为空");
+ return request.getId();
+ }
+
+ private synchronized String nextNo() {
+ String prefix = "HP" + LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE);
+ return prefix + String.format("%05d", count(Wrappers.lambdaQuery()
+ .likeRight(BillPayment::getPaymentNo, prefix)) + 1);
+ }
+
+ private BigDecimal positive(BigDecimal value, String name) {
+ if (value == null || value.compareTo(BigDecimal.ZERO) <= 0) throw new ServiceException(name + "必须大于0");
+ if (value.scale() > 2) throw new ServiceException(name + "最多保留2位小数");
+ return value.setScale(2, RoundingMode.HALF_UP);
+ }
+
+ private BigDecimal money(BigDecimal value) {
+ return value == null ? BigDecimal.ZERO : value;
+ }
+
+ private String required(String value, String name, int length) {
+ if (Func.isEmpty(value) || value.trim().isEmpty()) throw new ServiceException(name + "不能为空");
+ return limit(value.trim(), length, name);
+ }
+
+ private String limit(String value, int length, String name) {
+ if (value != null && value.length() > length) throw new ServiceException(name + "不能超过" + length + "个字符");
+ return value;
+ }
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/InvoiceApplicationServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/InvoiceApplicationServiceImpl.java
new file mode 100644
index 0000000..63cb624
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/InvoiceApplicationServiceImpl.java
@@ -0,0 +1,643 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.RequiredArgsConstructor;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.transport.mapper.CustomerArchiveMapper;
+import org.springblade.transport.mapper.CustomerContactMapper;
+import org.springblade.transport.mapper.CustomerInvoiceInfoMapper;
+import org.springblade.transport.mapper.FormalSettlementDetailMapper;
+import org.springblade.transport.mapper.FormalSettlementMapper;
+import org.springblade.transport.mapper.InvoiceApplicationDetailMapper;
+import org.springblade.transport.mapper.InvoiceApplicationLineMapper;
+import org.springblade.transport.mapper.InvoiceApplicationMapper;
+import org.springblade.transport.mapper.InvoiceApplicationRecordMapper;
+import org.springblade.transport.mapper.InvoiceApplicationSettlementMapper;
+import org.springblade.transport.mapper.InvoiceApplicationSheetMapper;
+import org.springblade.transport.pojo.dto.InvoiceApplicationSaveRequest;
+import org.springblade.transport.pojo.dto.InvoiceApplicationStatusRequest;
+import org.springblade.transport.pojo.entity.CustomerArchive;
+import org.springblade.transport.pojo.entity.CustomerContact;
+import org.springblade.transport.pojo.entity.CustomerInvoiceInfo;
+import org.springblade.transport.pojo.entity.FormalSettlement;
+import org.springblade.transport.pojo.entity.FormalSettlementDetail;
+import org.springblade.transport.pojo.entity.InvoiceApplication;
+import org.springblade.transport.pojo.entity.InvoiceApplicationDetail;
+import org.springblade.transport.pojo.entity.InvoiceApplicationLine;
+import org.springblade.transport.pojo.entity.InvoiceApplicationRecord;
+import org.springblade.transport.pojo.entity.InvoiceApplicationSettlement;
+import org.springblade.transport.pojo.entity.InvoiceApplicationSheet;
+import org.springblade.transport.pojo.vo.InvoiceApplicationSheetVO;
+import org.springblade.transport.pojo.vo.InvoiceApplicationVO;
+import org.springblade.transport.service.IInvoiceApplicationService;
+import org.springblade.transport.wrapper.InvoiceApplicationWrapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * 开票申请服务实现类
+ *
+ * @author Chill
+ */
+@Service
+@RequiredArgsConstructor
+public class InvoiceApplicationServiceImpl extends BaseServiceImpl
+ implements IInvoiceApplicationService {
+ private static final String DRAFT = "draft";
+ private static final String REVIEWING = "reviewing";
+ private static final String APPROVED = "approved";
+ private static final String RETURNED = "returned";
+ private static final String VOIDED = "voided";
+ private final InvoiceApplicationSettlementMapper settlementRelationMapper;
+ private final InvoiceApplicationSheetMapper sheetMapper;
+ private final InvoiceApplicationLineMapper lineMapper;
+ private final InvoiceApplicationDetailMapper applicationDetailMapper;
+ private final InvoiceApplicationRecordMapper recordMapper;
+ private final FormalSettlementMapper formalSettlementMapper;
+ private final FormalSettlementDetailMapper formalSettlementDetailMapper;
+ private final CustomerArchiveMapper customerArchiveMapper;
+ private final CustomerInvoiceInfoMapper customerInvoiceInfoMapper;
+ private final CustomerContactMapper customerContactMapper;
+
+ @Override
+ public IPage selectPage(IPage page, InvoiceApplicationVO query) {
+ LambdaQueryWrapper wrapper = Wrappers.lambdaQuery()
+ .like(Func.isNotEmpty(query.getApplicationNo()), InvoiceApplication::getApplicationNo, query.getApplicationNo())
+ .like(Func.isNotEmpty(query.getProjectName()), InvoiceApplication::getProjectName, query.getProjectName())
+ .like(Func.isNotEmpty(query.getDeptName()), InvoiceApplication::getDeptName, query.getDeptName())
+ .eq(Func.isNotEmpty(query.getKingdeeStatus()), InvoiceApplication::getKingdeeStatus, query.getKingdeeStatus())
+ .eq(Func.isNotEmpty(query.getApprovalStatus()), InvoiceApplication::getApprovalStatus, query.getApprovalStatus())
+ .orderByDesc(InvoiceApplication::getCreateTime);
+ return page(page, wrapper).convert(this::toListVO);
+ }
+
+ @Override
+ public InvoiceApplicationVO detail(Long id) {
+ InvoiceApplication entity = existing(id);
+ InvoiceApplicationVO vo = toListVO(entity);
+ vo.setSettlements(settlementRelationMapper.selectList(Wrappers.lambdaQuery()
+ .eq(InvoiceApplicationSettlement::getInvoiceApplicationId, id)
+ .orderByAsc(InvoiceApplicationSettlement::getCreateTime)));
+ List sheets = sheetMapper.selectList(Wrappers.lambdaQuery()
+ .eq(InvoiceApplicationSheet::getInvoiceApplicationId, id).orderByAsc(InvoiceApplicationSheet::getSheetNo));
+ vo.setSheets(sheets.stream().map(sheet -> {
+ InvoiceApplicationSheetVO sheetVO = Objects.requireNonNull(BeanUtil.copyProperties(sheet, InvoiceApplicationSheetVO.class));
+ sheetVO.setLines(lineMapper.selectList(Wrappers.lambdaQuery()
+ .eq(InvoiceApplicationLine::getInvoiceSheetId, sheet.getId()).orderByAsc(InvoiceApplicationLine::getLineNo)));
+ return sheetVO;
+ }).toList());
+ vo.setDetails(applicationDetailMapper.selectList(Wrappers.lambdaQuery()
+ .eq(InvoiceApplicationDetail::getInvoiceApplicationId, id).orderByAsc(InvoiceApplicationDetail::getLineNo)));
+ vo.setRecords(recordMapper.selectList(Wrappers.lambdaQuery()
+ .eq(InvoiceApplicationRecord::getInvoiceApplicationId, id)
+ .orderByAsc(InvoiceApplicationRecord::getCreateTime)));
+ return vo;
+ }
+
+ @Override
+ public List> settlementCandidates(String keyword) {
+ List settlements = formalSettlementMapper.selectList(Wrappers.lambdaQuery()
+ .eq(FormalSettlement::getSettlementType, "receivable")
+ .eq(FormalSettlement::getApprovalStatus, APPROVED)
+ .eq(FormalSettlement::getStatus, 1)
+ .and(Func.isNotEmpty(keyword), wrapper -> wrapper.like(FormalSettlement::getFormalSettlementNo, keyword)
+ .or().like(FormalSettlement::getProjectName, keyword)
+ .or().like(FormalSettlement::getContractName, keyword))
+ .orderByDesc(FormalSettlement::getCreateTime).last("limit 200"));
+ return settlements.stream().map(settlement -> {
+ BigDecimal available = availableAmount(settlement, null);
+ Map row = new LinkedHashMap<>();
+ row.put("id", settlement.getId());
+ row.put("formalSettlementNo", settlement.getFormalSettlementNo());
+ row.put("projectId", settlement.getProjectId());
+ row.put("projectName", settlement.getProjectName());
+ row.put("deptId", settlement.getDeptId());
+ row.put("deptName", settlement.getDeptName());
+ row.put("contractId", settlement.getContractId());
+ row.put("contractNo", settlement.getContractNo());
+ row.put("contractName", settlement.getContractName());
+ row.put("issuerName", settlement.getPayeeName());
+ row.put("receiverName", settlement.getPayerName());
+ row.put("settlementAmount", money(settlement.getSettlementAmount()));
+ row.put("availableInvoiceAmount", available);
+ return row;
+ }).filter(row -> ((BigDecimal) row.get("availableInvoiceAmount")).compareTo(BigDecimal.ZERO) > 0).toList();
+ }
+
+ @Override
+ public List settlementDetails(String settlementIds) {
+ List ids = distinctIds(settlementIds);
+ if (ids.isEmpty()) return List.of();
+ assertCompatible(ids.stream().map(this::availableSettlement).toList());
+ return formalSettlementDetailMapper.selectList(Wrappers.lambdaQuery()
+ .in(FormalSettlementDetail::getFormalSettlementId, ids).orderByAsc(FormalSettlementDetail::getLineNo));
+ }
+
+ @Override
+ public Map receiverInformation(String settlementIds) {
+ List settlements = distinctIds(settlementIds).stream().map(this::availableSettlement).toList();
+ assertCompatible(settlements);
+ FormalSettlement first = settlements.get(0);
+ CustomerArchive customer = findCustomer(first.getPayerName());
+ Map result = new LinkedHashMap<>();
+ result.put("issuerName", first.getPayeeName());
+ result.put("receiverName", first.getPayerName());
+ result.put("customer", customer);
+ result.put("invoiceInfos", customer == null ? List.of() : customerInvoiceInfoMapper.selectList(
+ Wrappers.lambdaQuery().eq(CustomerInvoiceInfo::getCustomerId, customer.getId())
+ .eq(CustomerInvoiceInfo::getStatus, 1).orderByDesc(CustomerInvoiceInfo::getIsDefault)));
+ result.put("contacts", customer == null ? List.of() : customerContactMapper.selectList(
+ Wrappers.lambdaQuery().eq(CustomerContact::getCustomerId, customer.getId())
+ .eq(CustomerContact::getStatus, 1).orderByDesc(CustomerContact::getIsDefault)));
+ return result;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Long saveDraft(InvoiceApplicationSaveRequest request) {
+ validateRequest(request);
+ boolean creating = request.getId() == null;
+ InvoiceApplication entity = creating ? new InvoiceApplication() : editable(request.getId());
+ List oldSettlementIds = entity.getId() == null ? List.of() : relationSettlementIds(entity.getId());
+ List requestedRows = request.getSettlements().stream()
+ .filter(Objects::nonNull)
+ .peek(row -> {
+ if (row.getSettlementId() == null) throw new ServiceException("正式结算单不能为空");
+ })
+ .collect(Collectors.toMap(InvoiceApplicationSaveRequest.SettlementRow::getSettlementId,
+ Function.identity(), (first, duplicate) -> first, LinkedHashMap::new)).values().stream().toList();
+ List settlements = requestedRows.stream().map(row -> availableSettlement(row.getSettlementId())).toList();
+ assertCompatible(settlements);
+ FormalSettlement first = settlements.get(0);
+ Map settlementMap = settlements.stream()
+ .collect(Collectors.toMap(FormalSettlement::getId, Function.identity()));
+ BigDecimal totalAvailable = BigDecimal.ZERO;
+ BigDecimal allocatedTotal = BigDecimal.ZERO;
+ for (InvoiceApplicationSaveRequest.SettlementRow row : requestedRows) {
+ FormalSettlement settlement = settlementMap.get(row.getSettlementId());
+ BigDecimal available = availableAmount(settlement, entity.getId());
+ BigDecimal allocated = nonNegative(row.getAllocatedInvoiceAmount(), "分摊发票金额");
+ if (allocated.compareTo(available) > 0) {
+ throw new ServiceException("结算单" + settlement.getFormalSettlementNo() + "的分摊金额超过剩余可开票金额");
+ }
+ totalAvailable = totalAvailable.add(available);
+ allocatedTotal = allocatedTotal.add(allocated);
+ }
+ BigDecimal lineTotal = validateSheets(request.getSheets());
+ if (lineTotal.compareTo(BigDecimal.ZERO) <= 0) {
+ throw new ServiceException("本次开票金额必须大于0");
+ }
+ if (lineTotal.compareTo(allocatedTotal) != 0) {
+ throw new ServiceException("开票商品行金额合计必须等于结算单分摊金额合计");
+ }
+ CustomerArchive customer = findCustomer(first.getPayerName());
+ CustomerInvoiceInfo invoiceInfo = customerInvoiceInfoMapper.selectById(request.getReceiverInvoiceInfoId());
+ if (customer == null || invoiceInfo == null || !Objects.equals(customer.getId(), invoiceInfo.getCustomerId())
+ || Objects.equals(invoiceInfo.getIsDeleted(), 1) || !Objects.equals(invoiceInfo.getStatus(), 1)) {
+ throw new ServiceException("请选择受票方有效的开票信息");
+ }
+ String invoiceTitle = required(invoiceInfo.getInvoiceTitle(), "受票方单位");
+ String taxpayerNo = limit(invoiceInfo.getTaxNo(), 20, "纳税人识别号");
+ String bankName = limit(invoiceInfo.getBankName(), 100, "开户行");
+ String bankAccount = limit(invoiceInfo.getBankAccount(), 50, "开户账号");
+ String registeredAddress = limit(invoiceInfo.getRegisteredAddress(), 200, "注册地址");
+ if ("electronic_special".equals(request.getInvoiceType())) {
+ required(taxpayerNo, "电子专票的纳税人识别号");
+ required(bankName, "电子专票的开户行");
+ required(bankAccount, "电子专票的开户账号");
+ required(registeredAddress, "电子专票的注册地址");
+ }
+ if (entity.getId() == null) {
+ entity.setApplicationNo(nextNo());
+ entity.setApprovalStatus(DRAFT);
+ entity.setCurrentNode("草稿");
+ entity.setKingdeeStatus("unsynced");
+ entity.setApplicantName(AuthUtil.getUserName());
+ }
+ entity.setProjectId(first.getProjectId());
+ entity.setProjectName(first.getProjectName());
+ entity.setDeptId(first.getDeptId());
+ entity.setDeptName(first.getDeptName());
+ entity.setIssuerName(first.getPayeeName());
+ entity.setReceiverCustomerId(customer.getId());
+ entity.setReceiverName(invoiceTitle);
+ entity.setInvoiceType(request.getInvoiceType());
+ entity.setAvailableInvoiceAmount(totalAvailable);
+ entity.setInvoiceAmount(lineTotal);
+ entity.setUndertakingDeptId(first.getDeptId());
+ entity.setUndertakingDeptName(first.getDeptName());
+ entity.setDepartmentEmails(normalizeEmails(request.getDepartmentEmails()));
+ entity.setReceiverInvoiceInfoId(invoiceInfo.getId());
+ entity.setTaxpayerNo(taxpayerNo);
+ entity.setBankName(bankName);
+ entity.setBankAccount(bankAccount);
+ entity.setRegisteredAddress(registeredAddress);
+ entity.setContactName(limit(request.getContactName(), 50, "联系人"));
+ entity.setContactPhone(validatePhone(request.getContactPhone()));
+ entity.setEmail(validateReceiverEmails(request.getEmail()));
+ entity.setAttachmentsJson(request.getAttachmentsJson());
+ entity.setRemark(limit(request.getRemark(), 200, "备注"));
+ saveOrUpdate(entity);
+ deleteChildren(entity.getId());
+ saveRelations(entity.getId(), requestedRows, settlementMap);
+ saveSheets(entity.getId(), request.getSheets());
+ saveDetails(entity.getId(), request.getDetailIds(), settlementMap.keySet());
+ Set refreshIds = new LinkedHashSet<>(oldSettlementIds);
+ refreshIds.addAll(settlementMap.keySet());
+ refreshIds.forEach(this::refreshSettlementInvoiceStatus);
+ record(entity.getId(), creating ? "create" : "save", creating ? "创建草稿" : "保存草稿",
+ entity.getApprovalStatus(), entity.getApprovalStatus(), null, null);
+ return entity.getId();
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void removeDraft(Long id) {
+ InvoiceApplication entity = editable(id);
+ List settlementIds = relationSettlementIds(id);
+ deleteChildren(id);
+ removeById(entity);
+ settlementIds.forEach(this::refreshSettlementInvoiceStatus);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void submit(InvoiceApplicationStatusRequest request) {
+ InvoiceApplication entity = editable(request.getId());
+ String fromStatus = entity.getApprovalStatus();
+ entity.setApprovalStatus(REVIEWING);
+ entity.setCurrentNode("开票审核");
+ entity.setCurrentProcessor(null);
+ entity.setApplicationDate(LocalDate.now());
+ updateById(entity);
+ record(entity.getId(), "submit", "提交审批", fromStatus, REVIEWING, null, null);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void approve(InvoiceApplicationStatusRequest request) {
+ changeStatus(request.getId(), REVIEWING, APPROVED, "approve", "审批通过", null);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void returnBill(InvoiceApplicationStatusRequest request) {
+ changeStatus(request.getId(), REVIEWING, RETURNED, "return", "已驳回",
+ required(request.getReason(), "驳回原因"));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void voidBill(InvoiceApplicationStatusRequest request) {
+ InvoiceApplication entity = existing(request.getId());
+ if (!APPROVED.equals(entity.getApprovalStatus())) throw new ServiceException("仅审批通过的开票申请允许作废");
+ entity.setApprovalStatus(VOIDED);
+ entity.setCurrentNode("已作废");
+ entity.setCurrentProcessor(AuthUtil.getUserName());
+ entity.setVoidReason(limit(required(request.getReason(), "作废原因"), 200, "作废原因"));
+ updateById(entity);
+ record(entity.getId(), "void", "作废", APPROVED, VOIDED, entity.getVoidReason(), entity.getKingdeeBillNo());
+ relationSettlementIds(entity.getId()).forEach(this::refreshSettlementInvoiceStatus);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public String syncKingdee(Long id) {
+ InvoiceApplication entity = existing(id);
+ if (!APPROVED.equals(entity.getApprovalStatus())) throw new ServiceException("仅审批通过的开票申请允许同步金蝶");
+ if ("synced".equals(entity.getKingdeeStatus())) return entity.getKingdeeBillNo();
+ String kingdeeNo = "K3INV" + DateTimeFormatter.ofPattern("yyyyMMddHHmmss").format(LocalDateTime.now());
+ entity.setKingdeeBillNo(kingdeeNo);
+ entity.setKingdeeStatus("synced");
+ entity.setSyncedTime(LocalDateTime.now());
+ updateById(entity);
+ record(entity.getId(), "sync", "同步金蝶", entity.getApprovalStatus(), entity.getApprovalStatus(), null, kingdeeNo);
+ return kingdeeNo;
+ }
+
+ private InvoiceApplicationVO toListVO(InvoiceApplication entity) {
+ InvoiceApplicationVO vo = InvoiceApplicationWrapper.build().entityVO(entity);
+ vo.setSettlementNos(settlementRelationMapper.selectList(Wrappers.lambdaQuery()
+ .eq(InvoiceApplicationSettlement::getInvoiceApplicationId, entity.getId())
+ .orderByAsc(InvoiceApplicationSettlement::getCreateTime)).stream()
+ .map(InvoiceApplicationSettlement::getFormalSettlementNo).collect(Collectors.joining(",")));
+ return vo;
+ }
+
+ private void validateRequest(InvoiceApplicationSaveRequest request) {
+ if (request.getSettlements() == null || request.getSettlements().isEmpty()) throw new ServiceException("请至少选择一张正式结算单");
+ if (request.getDetailIds() == null || request.getDetailIds().isEmpty()) throw new ServiceException("请至少选择一条开票明细");
+ if (!List.of("electronic_special", "electronic_normal").contains(request.getInvoiceType())) throw new ServiceException("请选择有效的发票类型");
+ if (request.getReceiverInvoiceInfoId() == null) throw new ServiceException("请选择受票方单位");
+ if (Func.isEmpty(request.getDepartmentEmails())) throw new ServiceException("请选择部门邮箱");
+ }
+
+ private BigDecimal validateSheets(List sheets) {
+ if (sheets == null || sheets.isEmpty()) throw new ServiceException("请至少添加一张发票");
+ BigDecimal total = BigDecimal.ZERO;
+ for (InvoiceApplicationSaveRequest.SheetRow sheet : sheets) {
+ if (sheet.getLines() == null || sheet.getLines().isEmpty()) throw new ServiceException("每张发票至少需要一条商品行");
+ boolean containsFreight = sheet.getLines().stream().anyMatch(line -> "运费".equals(line.getGoodsName()));
+ boolean containsOther = sheet.getLines().stream().anyMatch(line -> !"运费".equals(line.getGoodsName()));
+ if (containsFreight && containsOther) throw new ServiceException("运费不能与其他费用合并开在同一张发票中");
+ for (InvoiceApplicationSaveRequest.LineRow line : sheet.getLines()) {
+ required(line.getGoodsCategory(), "商品和服务分类");
+ required(line.getGoodsName(), "货物或服务简称");
+ nonNegative(line.getQuantity(), "数量");
+ nonNegative(line.getUnitPriceNoTax(), "不含税单价");
+ BigDecimal amount = nonNegative(line.getAmountWithTax(), "含税金额");
+ BigDecimal taxRate = nonNegative(line.getTaxRate(), "税率");
+ if (taxRate.compareTo(BigDecimal.valueOf(100)) > 0) throw new ServiceException("税率必须在0-100之间");
+ line.setTaxAmount(calculateTax(amount, taxRate));
+ line.setRemark(limit(line.getRemark(), 200, "商品行备注"));
+ total = total.add(amount);
+ }
+ }
+ return total.setScale(2, RoundingMode.HALF_UP);
+ }
+
+ private void assertCompatible(List settlements) {
+ if (settlements.isEmpty()) throw new ServiceException("请选择正式结算单");
+ FormalSettlement first = settlements.get(0);
+ if (settlements.stream().anyMatch(item -> !Objects.equals(first.getContractId(), item.getContractId())
+ || !Objects.equals(first.getProjectId(), item.getProjectId())
+ || !Objects.equals(first.getDeptId(), item.getDeptId())
+ || !Objects.equals(first.getPayerName(), item.getPayerName())
+ || !Objects.equals(first.getPayeeName(), item.getPayeeName()))) {
+ throw new ServiceException("合并开票的正式结算单必须属于同一合同、项目、组织及收付款方");
+ }
+ }
+
+ private FormalSettlement availableSettlement(Long id) {
+ if (id == null) throw new ServiceException("正式结算单不能为空");
+ FormalSettlement settlement = formalSettlementMapper.selectById(id);
+ if (settlement == null || Objects.equals(settlement.getIsDeleted(), 1)) throw new ServiceException("正式结算单不存在");
+ if (!Objects.equals(settlement.getStatus(), 1) || !APPROVED.equals(settlement.getApprovalStatus())
+ || !"receivable".equals(settlement.getSettlementType())) {
+ throw new ServiceException("只能选择审批通过、未作废的应收正式结算单");
+ }
+ return settlement;
+ }
+
+ private BigDecimal availableAmount(FormalSettlement settlement, Long excludeApplicationId) {
+ BigDecimal allocated = activeRelations(settlement.getId(), excludeApplicationId).stream()
+ .map(InvoiceApplicationSettlement::getAllocatedInvoiceAmount).map(this::money)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ return money(settlement.getSettlementAmount()).subtract(allocated).max(BigDecimal.ZERO);
+ }
+
+ private List activeRelations(Long settlementId, Long excludeApplicationId) {
+ List relations = settlementRelationMapper.selectList(
+ Wrappers.lambdaQuery()
+ .eq(InvoiceApplicationSettlement::getFormalSettlementId, settlementId)
+ .ne(excludeApplicationId != null, InvoiceApplicationSettlement::getInvoiceApplicationId, excludeApplicationId));
+ if (relations.isEmpty()) return List.of();
+ Map applications = listByIds(relations.stream()
+ .map(InvoiceApplicationSettlement::getInvoiceApplicationId).distinct().toList()).stream()
+ .collect(Collectors.toMap(InvoiceApplication::getId, Function.identity()));
+ return relations.stream().filter(relation -> {
+ InvoiceApplication application = applications.get(relation.getInvoiceApplicationId());
+ return application != null && !VOIDED.equals(application.getApprovalStatus())
+ && !Objects.equals(application.getIsDeleted(), 1);
+ }).toList();
+ }
+
+ private void saveRelations(Long applicationId, List rows,
+ Map settlementMap) {
+ for (InvoiceApplicationSaveRequest.SettlementRow row : rows) {
+ FormalSettlement source = settlementMap.get(row.getSettlementId());
+ InvoiceApplicationSettlement relation = new InvoiceApplicationSettlement();
+ relation.setInvoiceApplicationId(applicationId);
+ relation.setFormalSettlementId(source.getId());
+ relation.setFormalSettlementNo(source.getFormalSettlementNo());
+ relation.setSettlementAmount(source.getSettlementAmount());
+ relation.setAvailableInvoiceAmount(availableAmount(source, applicationId));
+ relation.setAllocatedInvoiceAmount(row.getAllocatedInvoiceAmount());
+ settlementRelationMapper.insert(relation);
+ }
+ }
+
+ private void saveSheets(Long applicationId, List sheets) {
+ int sheetNo = 1;
+ for (InvoiceApplicationSaveRequest.SheetRow sheetRow : sheets) {
+ InvoiceApplicationSheet sheet = new InvoiceApplicationSheet();
+ sheet.setInvoiceApplicationId(applicationId);
+ sheet.setSheetNo(sheetNo++);
+ sheet.setInvoiceAmount(sheetRow.getLines().stream().map(InvoiceApplicationSaveRequest.LineRow::getAmountWithTax)
+ .map(this::money).reduce(BigDecimal.ZERO, BigDecimal::add));
+ sheetMapper.insert(sheet);
+ int lineNo = 1;
+ for (InvoiceApplicationSaveRequest.LineRow lineRow : sheetRow.getLines()) {
+ InvoiceApplicationLine line = Objects.requireNonNull(BeanUtil.copyProperties(lineRow, InvoiceApplicationLine.class));
+ line.setId(null);
+ line.setInvoiceApplicationId(applicationId);
+ line.setInvoiceSheetId(sheet.getId());
+ line.setLineNo(lineNo++);
+ lineMapper.insert(line);
+ }
+ }
+ }
+
+ private void saveDetails(Long applicationId, List detailIds, Set settlementIds) {
+ List details = formalSettlementDetailMapper.selectBatchIds(detailIds.stream().distinct().toList());
+ if (details.size() != detailIds.stream().distinct().count()
+ || details.stream().anyMatch(detail -> !settlementIds.contains(detail.getFormalSettlementId()))) {
+ throw new ServiceException("开票明细必须来自已选择的正式结算单");
+ }
+ int lineNo = 1;
+ for (FormalSettlementDetail source : details) {
+ InvoiceApplicationDetail detail = Objects.requireNonNull(BeanUtil.copyProperties(source, InvoiceApplicationDetail.class));
+ detail.setId(null);
+ detail.setInvoiceApplicationId(applicationId);
+ detail.setFormalSettlementDetailId(source.getId());
+ detail.setLineNo(lineNo++);
+ applicationDetailMapper.insert(detail);
+ }
+ }
+
+ private void deleteChildren(Long applicationId) {
+ List sheetIds = sheetMapper.selectList(Wrappers.lambdaQuery()
+ .eq(InvoiceApplicationSheet::getInvoiceApplicationId, applicationId)).stream()
+ .map(InvoiceApplicationSheet::getId).toList();
+ if (!sheetIds.isEmpty()) lineMapper.delete(Wrappers.lambdaQuery()
+ .in(InvoiceApplicationLine::getInvoiceSheetId, sheetIds));
+ sheetMapper.delete(Wrappers.lambdaQuery()
+ .eq(InvoiceApplicationSheet::getInvoiceApplicationId, applicationId));
+ applicationDetailMapper.delete(Wrappers.lambdaQuery()
+ .eq(InvoiceApplicationDetail::getInvoiceApplicationId, applicationId));
+ settlementRelationMapper.delete(Wrappers.lambdaQuery()
+ .eq(InvoiceApplicationSettlement::getInvoiceApplicationId, applicationId));
+ }
+
+ private void refreshSettlementInvoiceStatus(Long settlementId) {
+ FormalSettlement settlement = formalSettlementMapper.selectById(settlementId);
+ if (settlement == null) return;
+ BigDecimal allocated = activeRelations(settlementId, null).stream()
+ .map(InvoiceApplicationSettlement::getAllocatedInvoiceAmount).map(this::money)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ String status = allocated.compareTo(BigDecimal.ZERO) <= 0 ? "unreceived"
+ : allocated.compareTo(money(settlement.getSettlementAmount())) >= 0 ? "completed" : "partial";
+ settlement.setInvoiceStatus(status);
+ formalSettlementMapper.updateById(settlement);
+ }
+
+ private List relationSettlementIds(Long applicationId) {
+ return settlementRelationMapper.selectList(Wrappers.lambdaQuery()
+ .eq(InvoiceApplicationSettlement::getInvoiceApplicationId, applicationId)).stream()
+ .map(InvoiceApplicationSettlement::getFormalSettlementId).distinct().toList();
+ }
+
+ private CustomerArchive findCustomer(String name) {
+ if (Func.isEmpty(name)) return null;
+ return customerArchiveMapper.selectOne(Wrappers.lambdaQuery()
+ .and(wrapper -> wrapper.eq(CustomerArchive::getFullName, name).or().eq(CustomerArchive::getShortName, name))
+ .eq(CustomerArchive::getStatus, 1)
+ .eq(CustomerArchive::getIsDeleted, 0).last("limit 1"));
+ }
+
+ private void changeStatus(Long id, String from, String to, String actionType, String node, String reason) {
+ InvoiceApplication entity = existing(id);
+ if (!from.equals(entity.getApprovalStatus())) throw new ServiceException("当前状态不允许此操作");
+ entity.setApprovalStatus(to);
+ entity.setCurrentNode(node);
+ entity.setCurrentProcessor(AuthUtil.getUserName());
+ updateById(entity);
+ record(id, actionType, node, from, to, reason, entity.getKingdeeBillNo());
+ }
+
+ private void record(Long applicationId, String actionType, String actionName, String fromStatus,
+ String toStatus, String reason, String kingdeeBillNo) {
+ InvoiceApplicationRecord record = new InvoiceApplicationRecord();
+ record.setInvoiceApplicationId(applicationId);
+ record.setActionType(actionType);
+ record.setActionName(actionName);
+ record.setFromStatus(fromStatus);
+ record.setToStatus(toStatus);
+ record.setOperatorName(AuthUtil.getUserName());
+ record.setReason(reason);
+ record.setKingdeeBillNo(kingdeeBillNo);
+ recordMapper.insert(record);
+ }
+
+ private InvoiceApplication existing(Long id) {
+ InvoiceApplication entity = getById(id);
+ if (entity == null || Objects.equals(entity.getIsDeleted(), 1)) throw new ServiceException("开票申请不存在");
+ return entity;
+ }
+
+ private InvoiceApplication editable(Long id) {
+ InvoiceApplication entity = existing(id);
+ if (!List.of(DRAFT, RETURNED).contains(entity.getApprovalStatus())) throw new ServiceException("当前状态不可编辑");
+ return entity;
+ }
+
+ private List distinctIds(String ids) {
+ return ids == null ? List.of() : Func.toLongList(ids).stream().distinct().toList();
+ }
+
+ private String nextNo() {
+ String prefix = "KP-" + LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE);
+ return prefix + String.format("%05d", count(Wrappers.lambdaQuery()
+ .likeRight(InvoiceApplication::getApplicationNo, prefix)) + 1);
+ }
+
+ private String normalizeEmails(String value) {
+ List emails = value == null ? List.of() : List.of(value.split("[;,,;]"));
+ List normalized = emails.stream().map(String::trim).filter(item -> !item.isEmpty()).distinct().toList();
+ if (normalized.isEmpty() || normalized.size() > 3) throw new ServiceException("部门邮箱必填且最多选择3个");
+ normalized.forEach(email -> validateEmail(email, "部门邮箱"));
+ return String.join(";", normalized);
+ }
+
+ private String validateEmail(String value, String name) {
+ String result = limit(value, 100, name);
+ if (Func.isNotEmpty(result) && !result.matches("^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$")) {
+ throw new ServiceException(name + "格式不正确");
+ }
+ return result;
+ }
+
+ private String validateReceiverEmails(String value) {
+ if (Func.isEmpty(value)) return value;
+ List emails = List.of(value.split("[;,,;]")).stream()
+ .map(String::trim).filter(item -> !item.isEmpty()).distinct().toList();
+ if (emails.size() > 3) throw new ServiceException("邮箱最多填写3个");
+ emails.forEach(email -> validateEmail(email, "邮箱"));
+ return limit(String.join(";", emails), 100, "邮箱");
+ }
+
+ private String validatePhone(String value) {
+ if (Func.isNotEmpty(value) && !value.matches("^\\d{11}$")) throw new ServiceException("联系电话必须为11位数字");
+ return value;
+ }
+
+ private BigDecimal calculateTax(BigDecimal amount, BigDecimal rate) {
+ if (rate.compareTo(BigDecimal.ZERO) == 0) return BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
+ return amount.subtract(amount.divide(BigDecimal.ONE.add(rate.divide(BigDecimal.valueOf(100), 8,
+ RoundingMode.HALF_UP)), 8, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP);
+ }
+
+ private BigDecimal nonNegative(BigDecimal value, String name) {
+ if (value == null || value.compareTo(BigDecimal.ZERO) < 0) throw new ServiceException(name + "不能小于0");
+ return value;
+ }
+
+ private BigDecimal money(BigDecimal value) {
+ return value == null ? BigDecimal.ZERO : value;
+ }
+
+ private String required(String value, String name) {
+ if (Func.isEmpty(value)) throw new ServiceException(name + "不能为空");
+ return value;
+ }
+
+ private String limit(String value, int length, String name) {
+ if (value != null && value.length() > length) throw new ServiceException(name + "不能超过" + length + "个字符");
+ return value;
+ }
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/InvoiceReceiptServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/InvoiceReceiptServiceImpl.java
new file mode 100644
index 0000000..2d7e310
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/InvoiceReceiptServiceImpl.java
@@ -0,0 +1,684 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.RequiredArgsConstructor;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.transport.mapper.CustomerArchiveMapper;
+import org.springblade.transport.mapper.CustomerContactMapper;
+import org.springblade.transport.mapper.FormalSettlementMapper;
+import org.springblade.transport.mapper.InvoiceReceiptMapper;
+import org.springblade.transport.mapper.InvoiceReceiptRecordMapper;
+import org.springblade.transport.mapper.InvoiceReceiptSettlementMapper;
+import org.springblade.transport.mapper.KingdeeInvoicePoolMapper;
+import org.springblade.transport.pojo.dto.InvoiceReceiptSaveRequest;
+import org.springblade.transport.pojo.dto.InvoiceReceiptStatusRequest;
+import org.springblade.transport.pojo.entity.CustomerArchive;
+import org.springblade.transport.pojo.entity.CustomerContact;
+import org.springblade.transport.pojo.entity.FormalSettlement;
+import org.springblade.transport.pojo.entity.InvoiceReceipt;
+import org.springblade.transport.pojo.entity.InvoiceReceiptRecord;
+import org.springblade.transport.pojo.entity.InvoiceReceiptSettlement;
+import org.springblade.transport.pojo.entity.KingdeeInvoicePool;
+import org.springblade.transport.pojo.vo.InvoiceReceiptVO;
+import org.springblade.transport.service.IInvoiceReceiptService;
+import org.springblade.transport.wrapper.InvoiceReceiptWrapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * 收票登记服务实现类
+ *
+ * @author Chill
+ */
+@Service
+@RequiredArgsConstructor
+public class InvoiceReceiptServiceImpl extends BaseServiceImpl
+ implements IInvoiceReceiptService {
+
+ private static final String DRAFT = "draft";
+ private static final String REVIEWING = "reviewing";
+ private static final String APPROVED = "approved";
+ private static final String RETURNED = "returned";
+ private static final String VOIDED = "voided";
+
+ private final KingdeeInvoicePoolMapper invoicePoolMapper;
+ private final InvoiceReceiptSettlementMapper settlementRelationMapper;
+ private final InvoiceReceiptRecordMapper recordMapper;
+ private final FormalSettlementMapper formalSettlementMapper;
+ private final CustomerArchiveMapper customerArchiveMapper;
+ private final CustomerContactMapper customerContactMapper;
+
+ @Override
+ public IPage selectPage(IPage page, InvoiceReceiptVO query) {
+ LambdaQueryWrapper wrapper = Wrappers.lambdaQuery()
+ .like(Func.isNotEmpty(query.getInvoiceNo()), InvoiceReceipt::getInvoiceNo, query.getInvoiceNo())
+ .eq(query.getInvoiceDate() != null, InvoiceReceipt::getInvoiceDate, query.getInvoiceDate())
+ .like(Func.isNotEmpty(query.getProjectName()), InvoiceReceipt::getProjectName, query.getProjectName())
+ .like(Func.isNotEmpty(query.getDeptName()), InvoiceReceipt::getDeptName, query.getDeptName())
+ .eq(Func.isNotEmpty(query.getApprovalStatus()), InvoiceReceipt::getApprovalStatus,
+ query.getApprovalStatus())
+ .eq(Func.isNotEmpty(query.getKingdeeStatus()), InvoiceReceipt::getKingdeeStatus,
+ query.getKingdeeStatus())
+ .orderByDesc(InvoiceReceipt::getCreateTime);
+ return page(page, wrapper).convert(this::toListVO);
+ }
+
+ @Override
+ public InvoiceReceiptVO detail(Long id) {
+ InvoiceReceipt entity = existing(id);
+ InvoiceReceiptVO vo = toListVO(entity);
+ List settlements = settlementRelationMapper.selectList(
+ Wrappers.lambdaQuery()
+ .eq(InvoiceReceiptSettlement::getInvoiceReceiptId, id)
+ .orderByAsc(InvoiceReceiptSettlement::getCreateTime));
+ settlements.forEach(item -> {
+ FormalSettlement source = formalSettlementMapper.selectById(item.getFormalSettlementId());
+ if (source != null) {
+ item.setSettlementAmount(money(source.getSettlementAmount()));
+ }
+ item.setReceivedInvoiceAmount(receivedAmount(item.getFormalSettlementId(), id));
+ });
+ vo.setSettlements(settlements);
+ vo.setRecords(recordMapper.selectList(Wrappers.lambdaQuery()
+ .eq(InvoiceReceiptRecord::getInvoiceReceiptId, id)
+ .orderByAsc(InvoiceReceiptRecord::getCreateTime)));
+ return vo;
+ }
+
+ @Override
+ public List invoicePool(String keyword) {
+ return invoicePoolMapper.selectList(Wrappers.lambdaQuery()
+ .eq(KingdeeInvoicePool::getStatus, 1)
+ .and(Func.isNotEmpty(keyword), wrapper -> wrapper.like(KingdeeInvoicePool::getInvoiceNo, keyword)
+ .or().like(KingdeeInvoicePool::getIssuerName, keyword)
+ .or().like(KingdeeInvoicePool::getReceiverName, keyword))
+ .orderByDesc(KingdeeInvoicePool::getSourceUpdatedTime)
+ .orderByDesc(KingdeeInvoicePool::getCreateTime)
+ .last("limit 200"));
+ }
+
+ @Override
+ public List> settlementCandidates(String keyword, Long receiptId) {
+ List settlements = formalSettlementMapper.selectList(
+ Wrappers.lambdaQuery()
+ .eq(FormalSettlement::getSettlementType, "payable")
+ .eq(FormalSettlement::getApprovalStatus, APPROVED)
+ .eq(FormalSettlement::getStatus, 1)
+ .and(Func.isNotEmpty(keyword), wrapper -> wrapper
+ .like(FormalSettlement::getFormalSettlementNo, keyword)
+ .or().like(FormalSettlement::getProjectName, keyword)
+ .or().like(FormalSettlement::getContractName, keyword))
+ .orderByDesc(FormalSettlement::getCreateTime)
+ .last("limit 200"));
+ return settlements.stream().map(settlement -> {
+ BigDecimal received = receivedAmount(settlement.getId(), receiptId);
+ BigDecimal remaining = money(settlement.getSettlementAmount()).subtract(received).max(BigDecimal.ZERO);
+ Map row = new LinkedHashMap<>();
+ row.put("id", settlement.getId());
+ row.put("formalSettlementNo", settlement.getFormalSettlementNo());
+ row.put("projectId", settlement.getProjectId());
+ row.put("projectName", settlement.getProjectName());
+ row.put("deptId", settlement.getDeptId());
+ row.put("deptName", settlement.getDeptName());
+ row.put("contractId", settlement.getContractId());
+ row.put("contractNo", settlement.getContractNo());
+ row.put("contractName", settlement.getContractName());
+ row.put("payerName", settlement.getPayerName());
+ row.put("payeeName", settlement.getPayeeName());
+ row.put("settlementAmount", money(settlement.getSettlementAmount()));
+ row.put("receivedInvoiceAmount", received);
+ row.put("remainingInvoiceAmount", remaining);
+ return row;
+ }).filter(row -> ((BigDecimal) row.get("remainingInvoiceAmount")).compareTo(BigDecimal.ZERO) > 0)
+ .toList();
+ }
+
+ @Override
+ public Map referenceInformation(String settlementIds) {
+ List settlements = distinctIds(settlementIds).stream()
+ .map(this::availableSettlement)
+ .toList();
+ assertCompatible(settlements);
+ FormalSettlement first = settlements.get(0);
+ CustomerArchive customer = findCustomer(first.getPayeeName());
+ List customerEmails = customer == null ? List.of() : customerContactMapper.selectList(
+ Wrappers.lambdaQuery()
+ .eq(CustomerContact::getCustomerId, customer.getId())
+ .eq(CustomerContact::getStatus, 1)
+ .orderByDesc(CustomerContact::getIsDefault)
+ .orderByAsc(CustomerContact::getCreateTime)).stream()
+ .map(CustomerContact::getEmail)
+ .filter(item -> Func.isNotEmpty(item))
+ .map(String::trim)
+ .distinct()
+ .toList();
+ Map result = new LinkedHashMap<>();
+ result.put("projectId", first.getProjectId());
+ result.put("projectName", first.getProjectName());
+ result.put("deptId", first.getDeptId());
+ result.put("deptName", first.getDeptName());
+ result.put("payerName", first.getPayerName());
+ result.put("payeeName", first.getPayeeName());
+ result.put("customerEmails", customerEmails);
+ result.put("departmentEmails", List.of());
+ return result;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Long saveDraft(InvoiceReceiptSaveRequest request) {
+ validateRequest(request);
+ boolean creating = request.getId() == null;
+ InvoiceReceipt entity = creating ? new InvoiceReceipt() : editable(request.getId());
+ KingdeeInvoicePool invoice = lockedInvoice(request.getKingdeeInvoicePoolId());
+ assertInvoiceUnused(invoice, entity.getId());
+
+ Map