package com.hzs.common.domain.report;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hzs.common.core.web.domain.BaseEntity;
import lombok.*;
import lombok.experimental.Accessors;

/**
 * <p>
 * 销售业绩统计表
 * </p>
 *
 * @author sangelxiu1
 * @since 2025-09-22
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("CU_MEMBER_PERFORMANCE_SUMMARY")
@KeySequence("C_M_PERFORMANCE_SUMMARY_SEQ")
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CuMemberPerformanceSummary extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @TableId("PK_ID")
    private Long pkId;

    /**
     * 统计日期
     */
    @TableField("SUMMARY_DATE")
    private Date summaryDate;

    /**
     * 精品专区销售金额
     */
    @TableField("RETAIL_REGISTER_AMOUNT")
    private BigDecimal retailRegisterAmount;

    /**
     * 精品专区销售业绩
     */
    @TableField("RETAIL_REGISTER_PV")
    private BigDecimal retailRegisterPv;

    /**
     * 精品专区销售分红(原值)
     */
    @TableField("RETAIL_REGISTER_DV_SOURCE")
    private BigDecimal retailRegisterDvSource;

    /**
     * 精品专区销售分红(上限)
     */
    @TableField("RETAIL_REGISTER_DV_UL")
    private BigDecimal retailRegisterDvUL;

    /**
     * 甄选专区销售金额
     */
    @TableField("RETAIL_UPGRADE_AMOUNT")
    private BigDecimal retailUpgradeAmount;

    /**
     * 甄选专区销售业绩
     */
    @TableField("RETAIL_UPGRADE_PV")
    private BigDecimal retailUpgradePv;

    /**
     * 甄选专区销售分红(原值)
     */
    @TableField("RETAIL_UPGRADE_DV_SOURCE")
    private BigDecimal retailUpgradeDvSource;

    /**
     * 甄选专区销售分红(上限)
     */
    @TableField("RETAIL_UPGRADE_DV_UL")
    private BigDecimal retailUpgradeDvUL;

    /**
     * 商城专区销售金额
     */
    @TableField("RETAIL_REPURCHASE_AMOUNT")
    private BigDecimal retailRepurchaseAmount;

    /**
     * 商城专区销售业绩
     */
    @TableField("RETAIL_REPURCHASE_PV")
    private BigDecimal retailRepurchasePv;

    /**
     * 商城专区销售分红(原值)
     */
    @TableField("RETAIL_REPURCHASE_DV_SOURCE")
    private BigDecimal retailRepurchaseDvSource;

    /**
     * 商城专区销售分红(上限)
     */
    @TableField("RETAIL_REPURCHASE_DV_UL")
    private BigDecimal retailRepurchaseDvUL;

    /**
     * 五折专区销售金额
     */
    @TableField("RETAIL_DISCOUNT_AMOUNT")
    private BigDecimal retailDiscountAmount;

    /**
     * 五折专区销售业绩
     */
    @TableField("RETAIL_DISCOUNT_PV")
    private BigDecimal retailDiscountPv;

    /**
     * 五折专区销售分红(原值)
     */
    @TableField("RETAIL_DISCOUNT_DV_SOURCE")
    private BigDecimal retailDiscountDvSource;

    /**
     * 五折专区销售分红(上限)
     */
    @TableField("RETAIL_DISCOUNT_DV_UL")
    private BigDecimal retailDiscountDvUL;

    /**
     * 当期销售金额合计
     */
    @TableField("TOTAL_AMOUNT")
    private BigDecimal totalAmount;

    /**
     * 当期销售业绩合计
     */
    @TableField("TOTAL_PV")
    private BigDecimal totalPv;

    /**
     * 当日分红合计(分红：所有专区PV值的1.5%每天进行记录)(原值)
     */
    @TableField("TOTAL_DV_SOURCE")
    private BigDecimal totalDvSource;

    /**
     * 当日分红合计(分红：所有专区PV值的1.5%每天进行记录)(上限)
     */
    @TableField("TOTAL_DV_UL")
    private BigDecimal totalDvUL;


    public static CuMemberPerformanceSummary getInitCuMemberPerformanceSummary(Date summaryDate){
        return CuMemberPerformanceSummary.builder()
                .summaryDate(summaryDate)
                .retailRegisterAmount(BigDecimal.ZERO)
                .retailRegisterPv(BigDecimal.ZERO)
                .retailRegisterDvSource(BigDecimal.ZERO)
                .retailRegisterDvUL(BigDecimal.ZERO)
                .retailUpgradeAmount(BigDecimal.ZERO)
                .retailUpgradePv(BigDecimal.ZERO)
                .retailUpgradeDvSource(BigDecimal.ZERO)
                .retailUpgradeDvUL(BigDecimal.ZERO)
                .retailRepurchaseAmount(BigDecimal.ZERO)
                .retailRepurchasePv(BigDecimal.ZERO)
                .retailRepurchaseDvSource(BigDecimal.ZERO)
                .retailRepurchaseDvUL(BigDecimal.ZERO)
                .retailDiscountAmount(BigDecimal.ZERO)
                .retailDiscountPv(BigDecimal.ZERO)
                .retailDiscountDvSource(BigDecimal.ZERO)
                .retailDiscountDvUL(BigDecimal.ZERO)
                .totalAmount(BigDecimal.ZERO)
                .totalPv(BigDecimal.ZERO)
                .totalDvSource(BigDecimal.ZERO)
                .totalDvUL(BigDecimal.ZERO)
                .build();
    }
}
