package com.ruoyi.novel.domain;

// RoyaltyReport.java
@Data
public class RoyaltyReport {
    private Long authorId;
    private String authorName;
    private String month;
    private BigDecimal totalReads;
    private BigDecimal royaltyRate;
    private BigDecimal handlingFeeRate;
    private BigDecimal handlingFee;
    private BigDecimal netAmount;
    private String currency = "CNY";

    // 计算逻辑
    public void calculate(BigDecimal reads, BigDecimal rate, BigDecimal feeRate) {
        this.totalReads = reads;
        this.royaltyRate = rate;
        this.handlingFeeRate = feeRate;

        BigDecimal rawAmount = reads.multiply(rate);
        this.handlingFee = rawAmount.multiply(feeRate);
        this.netAmount = rawAmount.subtract(handlingFee);
    }
}