# SvaProductivityRatioSettings.java

    package cloud.wconnect.workperformance.entity.sva;

    import com.baomidou.mybatisplus.annotation.IdType;
    import com.baomidou.mybatisplus.annotation.TableId;
    import com.baomidou.mybatisplus.annotation.TableName;
    import java.io.Serializable;
    import java.math.BigDecimal;
    import lombok.Getter;
    import lombok.Setter;
    import lombok.ToString;
    import lombok.experimental.Accessors;

    /**
     * <p>
     *
     * </p>
     *
     * @author lichen
     * @since 2026-03-05
     */
    @Getter
    @Setter
    @ToString
    @Accessors(chain = true)
    @TableName("sva_productivity_ratio_settings")
    public class SvaProductivityRatioSettings implements Serializable {

        private static final long serialVersionUID = 1L;

        @TableId(value = "id", type = IdType.AUTO)
        private Integer id;

        /**
         * 租户id
         */
        private Integer tenantId;

        /**
         * 资产id
         */
        private Integer propertyId;

        /**
         * 生效的年份
         */
        private Integer year;

        private String departmentCode;

        /**
         * 部门描述
         */
        private String departmentDesc;

        /**
         * 计算类型：FIXED固定工时、OCC_DRIVEN产量驱动
         */
        private String calculationType;

        /**
         * 驱动类型
         */
        private String driverType;

        /**
         * 数据日期范围，CURRENT表示当天数据，PREVIOUS_DAY表示前一天数据
         */
        private String volumeReference;

        /**
         * 级别A
         */
        private Integer levelAOcc;

        /**
         * 级别B
         */
        private Integer levelBOcc;

        /**
         * 级别C
         */
        private Integer levelCOcc;

        /**
         * 级别D
         */
        private Integer levelDOcc;

        private BigDecimal levelARatio;

        private BigDecimal levelBRatio;

        private BigDecimal levelCRatio;

        private BigDecimal levelDRatio;

        private Integer levelAFixedHours;

        private Integer levelBFixedHours;

        private Integer levelCFixedHours;

        private Integer levelDFixedHours;

        /**
         * 备注
         */
        private String note;

        /**
         * 级别
         */
        public static final String LEVEL_A = "A";
        public static final String LEVEL_B = "B";
        public static final String LEVEL_C = "C";
        public static final String LEVEL_D = "D";

        /**
         * 获取 Fixed Hours
         *
         * @param setting Productivity Ratio Settings
         * @param level   等级
         * @return java.lang.Integer Fixed Hours
         * @author lichen
         * @date 2026/3/6
         */
        public static Integer getFixedHours(SvaProductivityRatioSettings setting, String level) {
            return switch (level) {
                case SvaProductivityRatioSettings.LEVEL_A -> setting.getLevelAFixedHours();
                case SvaProductivityRatioSettings.LEVEL_B -> setting.getLevelBFixedHours();
                case SvaProductivityRatioSettings.LEVEL_C -> setting.getLevelCFixedHours();
                case SvaProductivityRatioSettings.LEVEL_D -> setting.getLevelDFixedHours();
                default -> null;
            };
        }

        /**
         * 获取 Ratio
         *
         * @param setting Productivity Ratio Settings
         * @param level   等级
         * @return java.math.BigDecimal Ratio
         * @author lichen
         * @date 2026/3/6
         */
        public static BigDecimal getRatio(SvaProductivityRatioSettings setting, String level) {
            return switch (level) {
                case SvaProductivityRatioSettings.LEVEL_A -> setting.getLevelARatio();
                case SvaProductivityRatioSettings.LEVEL_B -> setting.getLevelBRatio();
                case SvaProductivityRatioSettings.LEVEL_C -> setting.getLevelCRatio();
                case SvaProductivityRatioSettings.LEVEL_D -> setting.getLevelDRatio();
                default -> null;
            };
        }
    }