feat(erp): 付款单付款账户、关联来票、付款明细改为非必填
- 去掉 accountName/invoiceId/items 的 @NotEmpty/@NotNull,requiredMode 改 NOT_REQUIRED
- 关联来票为空时跳过来票校验与剩余可付金额校验
Co-Authored-By: Claude Code <noreply@anthropic.com>
| | |
| | | @Schema(description = "供应商名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "小番茄公司") |
| | | private String supplierName; |
| | | |
| | | @Schema(description = "关联的来票编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25787") |
| | | @Schema(description = "关联的来票编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "25787") |
| | | private Long invoiceId; |
| | | @Schema(description = "关联的来票信息") |
| | | private ErpPurchaseInvoiceRespVO invoice; |
| | | |
| | | @Schema(description = "付款账户", requiredMode = Schema.RequiredMode.REQUIRED, example = "农行对公账户") |
| | | @Schema(description = "付款账户", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "农行对公账户") |
| | | private String accountName; |
| | | |
| | | @Schema(description = "合计价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "13832") |
| | |
| | | @ExcelProperty("创建时间") |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "付款项列表", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @Schema(description = "付款项列表", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private List<Item> items; |
| | | |
| | | @Data |
| | |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.Valid; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | |
| | | @NotNull(message = "供应商编号不能为空") |
| | | private Long supplierId; |
| | | |
| | | @Schema(description = "关联的来票编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25787") |
| | | @NotNull(message = "关联来票编号不能为空") |
| | | @Schema(description = "关联的来票编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "25787") |
| | | private Long invoiceId; |
| | | |
| | | @Schema(description = "付款账户", requiredMode = Schema.RequiredMode.REQUIRED, example = "农行对公账户") |
| | | @NotEmpty(message = "付款账户不能为空") |
| | | @Schema(description = "付款账户", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "农行对公账户") |
| | | private String accountName; |
| | | |
| | | @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "11600") |
| | |
| | | @Schema(description = "附件 blobId 列表", example = "[1, 2, 3]") |
| | | private List<Long> blobIds; |
| | | |
| | | @Schema(description = "付款项列表", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "付款项列表不能为空") |
| | | @Schema(description = "付款项列表", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Valid |
| | | private List<Item> items; |
| | | |
| | |
| | | * @param supplierId 供应商编号 |
| | | */ |
| | | private void validateInvoiceForPayment(Long invoiceId, Long supplierId) { |
| | | // 未关联来票时跳过校验(付款单允许不关联来票) |
| | | if (invoiceId == null) { |
| | | return; |
| | | } |
| | | // 1. 校验来票存在 |
| | | ErpPurchaseInvoiceDO invoice = invoiceService.getPurchaseInvoice(invoiceId); |
| | | if (invoice == null) { |
| | |
| | | * @param oldPaymentPrice 更新场景下,该付款单自身当前的付款金额(用于排除自身),创建场景传 null |
| | | */ |
| | | private void validatePaymentPriceExceedsInvoiceRemaining(Long invoiceId, BigDecimal paymentPrice, BigDecimal oldPaymentPrice) { |
| | | // 未关联来票时无剩余可付金额可校验 |
| | | if (invoiceId == null) { |
| | | return; |
| | | } |
| | | ErpPurchaseInvoiceDO invoice = invoiceService.getPurchaseInvoice(invoiceId); |
| | | BigDecimal paidPrice = financePaymentMapper.selectPaymentPriceMapByInvoiceId(List.of(invoiceId)) |
| | | .getOrDefault(invoiceId, BigDecimal.ZERO); |