# HotelKpiMetricsDTO.java

    package cloud.wconnect.workperformance.pojo.dto.hotelkpi.kpi;

    import cloud.wconnect.workperformance.pojo.dto.hotelkpi.kpi.explain.HotelKpiExplainMainDTO;
    import com.google.common.collect.Lists;
    import lombok.AllArgsConstructor;
    import lombok.Builder;
    import lombok.Data;

    import java.util.List;

    /**
     * DTO: Hotel KPI Metrics
     *
     * @author zc
     * @date 2024/06/24
     */
    @Data
    @Builder
    @AllArgsConstructor
    public class HotelKpiMetricsDTO {

        /**
         * 日期
         */
        private Long date;

        /**
         * 指标类型
         */
        private Integer metricsType;

        /**
         * 指标名称
         */
        private String title;

        /**
         * 指标描述
         */
        private String description;

        /**
         * 指标数据范围
         */
        private HotelKpiDataRangeDTO dataRange;

        /**
         * 指标是否停用（true:已停用 false:未停用）
         */
        private Boolean disabled;

        /**
         * 指标单位
         */
        private String unit;

        /**
         * 指标对比条件
         */
        private HotelKpiComparisonDTO comparison;

        /**
         * 指标警示备注数量
         */
        private Long warningCount;

        /**
         * 指标解释说明内容
         */
        private HotelKpiExplainMainDTO explain;

        /**
         * 指标实际值
         */
        private HotelKpiValueDTO actual;

        /**
         * 指标目标值
         */
        private HotelKpiValueDTO target;

        /**
         * 指标修正值(达标值)
         */
        private HotelKpiValueDTO cure;

        public HotelKpiMetricsDTO() {
            this.comparison = new HotelKpiComparisonDTO();
            this.explain = new HotelKpiExplainMainDTO();
            this.actual = new HotelKpiValueDTO();
            this.target = new HotelKpiValueDTO();
            this.cure = new HotelKpiValueDTO();
        }

        /**
         * 汇总用户 id
         *
         * @return 用户 id 集合
         * @author zc
         * @date 2024/6/25
         */
        public List<Integer> summaryUserIds() {
            List<Integer> userIds = Lists.newArrayListWithExpectedSize(3);
            userIds.addAll(actual.getCalculationFactor().stream().map(HotelKpiCalculationFactorDTO::getUpdatedBy)
                    .filter(item -> item > 0).toList());
            userIds.addAll(target.getCalculationFactor().stream().map(HotelKpiCalculationFactorDTO::getUpdatedBy)
                    .filter(item -> item > 0).toList());
            userIds.addAll(cure.getCalculationFactor().stream().map(HotelKpiCalculationFactorDTO::getUpdatedBy)
                    .filter(item -> item > 0).toList());
            return userIds;
        }
    }