diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInPageReqVO.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInPageReqVO.java index 2be52e5ff..e84607ce4 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInPageReqVO.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInPageReqVO.java @@ -17,6 +17,10 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ToString(callSuper = true) public class ErpPurchaseInPageReqVO extends PageParam { + public static final Integer PAYMENT_STATUS_NONE = 0; + public static final Integer PAYMENT_STATUS_PART = 1; + public static final Integer PAYMENT_STATUS_ALL = 2; + @Schema(description = "采购单编号", example = "XS001") private String no; @@ -45,8 +49,11 @@ public class ErpPurchaseInPageReqVO extends PageParam { @Schema(description = "结算账号编号", example = "1") private Long accountId; - @Schema(description = "是否欠款", example = "true") - private Boolean debtStatus; + @Schema(description = "付款状态", example = "1") + private Integer paymentStatus; + + @Schema(description = "是否可付款", example = "true") + private Boolean paymentEnable; // 对应 paymentStatus = [0, 1] @Schema(description = "采购单号", example = "1") private String orderNo; diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInRespVO.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInRespVO.java index fe6a31010..beeeab869 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInRespVO.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInRespVO.java @@ -52,6 +52,8 @@ public class ErpPurchaseInRespVO { @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906") @ExcelProperty("最终合计价格") private BigDecimal totalPrice; + @Schema(description = "已付款金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") + private BigDecimal paymentPrice; @Schema(description = "合计产品价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") private BigDecimal totalProductPrice; @@ -68,11 +70,6 @@ public class ErpPurchaseInRespVO { @Schema(description = "定金金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") private BigDecimal otherPrice; - @Schema(description = "本次付款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") - private BigDecimal refundPrice; - @Schema(description = "本次欠款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "666") - private BigDecimal debtPrice; - @Schema(description = "附件地址", example = "https://www.iocoder.cn") @ExcelProperty("附件地址") private String fileUrl; diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInSaveReqVO.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInSaveReqVO.java index 64dbac499..80edeec6d 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInSaveReqVO.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/in/ErpPurchaseInSaveReqVO.java @@ -32,10 +32,6 @@ public class ErpPurchaseInSaveReqVO { @Schema(description = "其它金额,单位:元", example = "7127") private BigDecimal otherPrice; - @Schema(description = "本次付款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") - @NotNull(message = "本次付款不能为空") - private BigDecimal refundPrice; - @Schema(description = "附件地址", example = "https://www.iocoder.cn") private String fileUrl; diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnPageReqVO.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnPageReqVO.java index b9d9d4b0b..a534d2e3e 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnPageReqVO.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnPageReqVO.java @@ -17,6 +17,10 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ToString(callSuper = true) public class ErpPurchaseReturnPageReqVO extends PageParam { + public static final Integer REFUND_STATUS_NONE = 0; + public static final Integer REFUND_STATUS_PART = 1; + public static final Integer REFUND_STATUS_ALL = 2; + @Schema(description = "采购单编号", example = "XS001") private String no; @@ -48,4 +52,10 @@ public class ErpPurchaseReturnPageReqVO extends PageParam { @Schema(description = "采购单号", example = "1") private String orderNo; + @Schema(description = "退款状态", example = "1") + private Integer refundStatus; + + @Schema(description = "是否可退款", example = "true") + private Boolean refundEnable; // 对应 refundStatus = [0, 1] + } \ No newline at end of file diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnRespVO.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnRespVO.java index 887b5f040..223b9327e 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnRespVO.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnRespVO.java @@ -52,6 +52,8 @@ public class ErpPurchaseReturnRespVO { @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906") @ExcelProperty("最终合计价格") private BigDecimal totalPrice; + @Schema(description = "已退款金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") + private BigDecimal refundPrice; @Schema(description = "合计产品价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") private BigDecimal totalProductPrice; @@ -68,11 +70,6 @@ public class ErpPurchaseReturnRespVO { @Schema(description = "定金金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") private BigDecimal otherPrice; - @Schema(description = "本次退款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") - private BigDecimal refundPrice; - @Schema(description = "本次欠款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "666") - private BigDecimal debtPrice; - @Schema(description = "附件地址", example = "https://www.iocoder.cn") @ExcelProperty("附件地址") private String fileUrl; diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnSaveReqVO.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnSaveReqVO.java index ae258c06a..9254bd583 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnSaveReqVO.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/purchase/vo/returns/ErpPurchaseReturnSaveReqVO.java @@ -32,10 +32,6 @@ public class ErpPurchaseReturnSaveReqVO { @Schema(description = "其它金额,单位:元", example = "7127") private BigDecimal otherPrice; - @Schema(description = "本次退款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") - @NotNull(message = "本次退款不能为空") - private BigDecimal refundPrice; - @Schema(description = "附件地址", example = "https://www.iocoder.cn") private String fileUrl; diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseInDO.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseInDO.java index 5e7ff5947..a16844d3e 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseInDO.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseInDO.java @@ -77,9 +77,15 @@ public class ErpPurchaseInDO extends BaseDO { /** * 最终合计价格,单位:元 * - * totalPrice = totalProductPrice + totalTaxPrice - discountPrice + * totalPrice = totalProductPrice + totalTaxPrice - discountPrice + otherPrice */ private BigDecimal totalPrice; + /** + * 已支付金额,单位:元 + * + * 目的:和 TODO erp_finance_payment 结合,记录已支付金额 + */ + private BigDecimal paymentPrice; /** * 合计产品价格,单位:元 @@ -104,17 +110,6 @@ public class ErpPurchaseInDO extends BaseDO { */ private BigDecimal otherPrice; - /** - * 本次退款,单位:元 - * - * refundPrice = totalPrice + otherPrice - debtPrice - */ - private BigDecimal refundPrice; - /** - * 本次欠款,单位:元 - */ - private BigDecimal debtPrice; - /** * 附件地址 */ diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseReturnDO.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseReturnDO.java index 0ec4ac6fd..a1c8cc4d5 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseReturnDO.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseReturnDO.java @@ -77,9 +77,15 @@ public class ErpPurchaseReturnDO extends BaseDO { /** * 最终合计价格,单位:元 * - * totalPrice = totalProductPrice + totalTaxPrice - discountPrice + * totalPrice = totalProductPrice + totalTaxPrice - discountPrice + otherPrice */ private BigDecimal totalPrice; + /** + * 已退款金额,单位:元 + * + * 目的:和 TODO erp_finance_payment 结合,记录已退款金额 + */ + private BigDecimal refundPrice; /** * 合计产品价格,单位:元 @@ -104,17 +110,6 @@ public class ErpPurchaseReturnDO extends BaseDO { */ private BigDecimal otherPrice; - /** - * 本次退款,单位:元 - * - * refundPrice = totalPrice + otherPrice - debtPrice - */ - private BigDecimal refundPrice; - /** - * 本次欠款,单位:元 - */ - private BigDecimal debtPrice; - /** * 附件地址 */ diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSaleOutDO.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSaleOutDO.java index 57ab55650..4bf567159 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSaleOutDO.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSaleOutDO.java @@ -110,6 +110,7 @@ public class ErpSaleOutDO extends BaseDO { */ private BigDecimal otherPrice; + // TODO 芋艿:receiptPrice /** * 本次收款,单位:元 * diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseInMapper.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseInMapper.java index ff43be137..cd227c351 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseInMapper.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseInMapper.java @@ -10,8 +10,8 @@ import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseInItemDO; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; -import java.math.BigDecimal; import java.util.List; +import java.util.Objects; /** * ERP 采购入库 Mapper @@ -32,10 +32,16 @@ public interface ErpPurchaseInMapper extends BaseMapperX { .eqIfPresent(ErpPurchaseInDO::getAccountId, reqVO.getAccountId()) .likeIfPresent(ErpPurchaseInDO::getOrderNo, reqVO.getOrderNo()) .orderByDesc(ErpPurchaseInDO::getId); - if (Boolean.TRUE.equals(reqVO.getDebtStatus())) { - query.gt(ErpPurchaseInDO::getDebtPrice, BigDecimal.ZERO); - } else if (Boolean.FALSE.equals(reqVO.getDebtStatus())) { - query.eq(ErpPurchaseInDO::getDebtPrice, BigDecimal.ZERO); + // 付款状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报字段不存在的错误 + if (Objects.equals(reqVO.getPaymentStatus(), ErpPurchaseInPageReqVO.PAYMENT_STATUS_NONE)) { + query.eq(ErpPurchaseInDO::getPaymentPrice, 0); + } else if (Objects.equals(reqVO.getPaymentStatus(), ErpPurchaseInPageReqVO.PAYMENT_STATUS_PART)) { + query.gt(ErpPurchaseInDO::getPaymentPrice, 0).apply("t.payment_price < t.total_price"); + } else if (Objects.equals(reqVO.getPaymentStatus(), ErpPurchaseInPageReqVO.PAYMENT_STATUS_ALL)) { + query.apply("t.payment_price = t.total_price"); + } + if (Boolean.TRUE.equals(reqVO.getPaymentEnable())) { + query.apply("t.payment_price < t.total_price"); } if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) { query.leftJoin(ErpPurchaseInItemDO.class, ErpPurchaseInItemDO::getInId, ErpPurchaseInDO::getId) diff --git a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseReturnMapper.java b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseReturnMapper.java index 716b27574..aa3c9ad5f 100644 --- a/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseReturnMapper.java +++ b/yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/purchase/ErpPurchaseReturnMapper.java @@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Objects; /** * ERP 采购退货 Mapper @@ -30,6 +31,17 @@ public interface ErpPurchaseReturnMapper extends BaseMapperX