mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
✨ ERP:采购订单的 paymentPrice 调整,为接入财务的付款单做准备
This commit is contained in:
parent
2d02430768
commit
2d43c1f9be
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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]
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
* 附件地址
|
||||
*/
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
* 附件地址
|
||||
*/
|
||||
|
@ -110,6 +110,7 @@ public class ErpSaleOutDO extends BaseDO {
|
||||
*/
|
||||
private BigDecimal otherPrice;
|
||||
|
||||
// TODO 芋艿:receiptPrice
|
||||
/**
|
||||
* 本次收款,单位:元
|
||||
*
|
||||
|
@ -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<ErpPurchaseInDO> {
|
||||
.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)
|
||||
|
@ -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<ErpPurchaseReturnDO
|
||||
.eqIfPresent(ErpPurchaseReturnDO::getAccountId, reqVO.getAccountId())
|
||||
.likeIfPresent(ErpPurchaseReturnDO::getOrderNo, reqVO.getOrderNo())
|
||||
.orderByDesc(ErpPurchaseReturnDO::getId);
|
||||
// 退款状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报字段不存在的错误
|
||||
if (Objects.equals(reqVO.getRefundStatus(), ErpPurchaseReturnPageReqVO.REFUND_STATUS_NONE)) {
|
||||
query.eq(ErpPurchaseReturnDO::getRefundPrice, 0);
|
||||
} else if (Objects.equals(reqVO.getRefundStatus(), ErpPurchaseReturnPageReqVO.REFUND_STATUS_PART)) {
|
||||
query.gt(ErpPurchaseReturnDO::getRefundPrice, 0).apply("t.refund_price < t.total_price");
|
||||
} else if (Objects.equals(reqVO.getRefundStatus(), ErpPurchaseReturnPageReqVO.REFUND_STATUS_ALL)) {
|
||||
query.apply("t.refund_price = t.total_price");
|
||||
}
|
||||
if (Boolean.TRUE.equals(reqVO.getRefundEnable())) {
|
||||
query.apply("t.refund_price < t.total_price");
|
||||
}
|
||||
if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) {
|
||||
query.leftJoin(ErpPurchaseReturnItemDO.class, ErpPurchaseReturnItemDO::getReturnId, ErpPurchaseReturnDO::getId)
|
||||
.eq(reqVO.getWarehouseId() != null, ErpPurchaseReturnItemDO::getWarehouseId, reqVO.getWarehouseId())
|
||||
|
@ -140,10 +140,7 @@ public class ErpPurchaseInServiceImpl implements ErpPurchaseInService {
|
||||
purchaseIn.setDiscountPercent(BigDecimal.ZERO);
|
||||
}
|
||||
purchaseIn.setDiscountPrice(MoneyUtils.priceMultiplyPercent(purchaseIn.getTotalPrice(), purchaseIn.getDiscountPercent()));
|
||||
purchaseIn.setTotalPrice(purchaseIn.getTotalPrice().subtract(purchaseIn.getDiscountPrice()));
|
||||
// 计算应收金额
|
||||
BigDecimal allPrice = purchaseIn.getTotalPrice().add(purchaseIn.getOtherPrice());
|
||||
purchaseIn.setDebtPrice(allPrice.subtract(purchaseIn.getRefundPrice()));
|
||||
purchaseIn.setTotalPrice(purchaseIn.getTotalPrice().subtract(purchaseIn.getDiscountPrice().add(purchaseIn.getOtherPrice())));
|
||||
}
|
||||
|
||||
private void updatePurchaseOrderInCount(Long orderId) {
|
||||
|
@ -136,10 +136,7 @@ public class ErpPurchaseReturnServiceImpl implements ErpPurchaseReturnService {
|
||||
purchaseReturn.setDiscountPercent(BigDecimal.ZERO);
|
||||
}
|
||||
purchaseReturn.setDiscountPrice(MoneyUtils.priceMultiplyPercent(purchaseReturn.getTotalPrice(), purchaseReturn.getDiscountPercent()));
|
||||
purchaseReturn.setTotalPrice(purchaseReturn.getTotalPrice().subtract(purchaseReturn.getDiscountPrice()));
|
||||
// 计算应退金额
|
||||
BigDecimal allPrice = purchaseReturn.getTotalPrice().add(purchaseReturn.getOtherPrice());
|
||||
purchaseReturn.setDebtPrice(allPrice.subtract(purchaseReturn.getRefundPrice()));
|
||||
purchaseReturn.setTotalPrice(purchaseReturn.getTotalPrice().subtract(purchaseReturn.getDiscountPrice().add(purchaseReturn.getOtherPrice())));
|
||||
}
|
||||
|
||||
private void updatePurchaseOrderReturnCount(Long orderId) {
|
||||
|
Loading…
Reference in New Issue
Block a user