# HotelKpiStrWeekBasicDTO.java

    package cloud.wconnect.workperformance.pojo.dto.hotelkpi.strdata.week.basic;

    import cloud.wconnect.workperformance.cons.hotelkpi.strdata.HotelKpiStrWeekDateEnum;
    import cloud.wconnect.workperformance.cons.hotelkpi.strdata.HotelKpiStrWeekEnum;
    import com.google.common.collect.Lists;
    import lombok.AllArgsConstructor;
    import lombok.Builder;
    import lombok.Data;

    import java.util.Arrays;
    import java.util.List;
    import java.util.stream.Stream;

    /**
     * DTO: Str Week Basic
     *
     * @author zc
     * @date 2024/10/18
     */
    @Data
    @Builder
    @AllArgsConstructor
    public class HotelKpiStrWeekBasicDTO {
        /**
         * Date Category: 1 Week、2 MTD
         */
        private Integer category;
        /**
         * List
         */
        private List<HotelKpiStrWeekBasicValueDTO> list;

        public HotelKpiStrWeekBasicDTO() {
            this.list = Lists.newArrayList(HotelKpiStrWeekEnum.OCC_PERCENT, HotelKpiStrWeekEnum.ADR,
                    HotelKpiStrWeekEnum.REV_PAR).stream().map(item -> {
                HotelKpiStrWeekBasicValueDTO otbPaceValueDTO = new HotelKpiStrWeekBasicValueDTO();
                otbPaceValueDTO.setCategory(item.getCategory());
                return otbPaceValueDTO;
            }).toList();
        }

        /**
         * 生成 BasicDTO 初始值
         *
         * @return List<HotelKpiStrDataBasicDTO> 初始值
         * @author zc
         * @date 2025/3/2
         */
        public static List<HotelKpiStrWeekBasicDTO> generateInitBasicDTOList() {
            return Arrays.stream(HotelKpiStrWeekDateEnum.values()).map(item -> {
                HotelKpiStrWeekBasicDTO basicDTO = new HotelKpiStrWeekBasicDTO();
                basicDTO.setCategory(item.getCategory());
                return basicDTO;
            }).toList();
        }

        /**
         * 提取用户 id
         *
         * @return java.util.List<java.lang.Integer>
         * @author zc
         * @date 2025/8/21
         */
        public List<Integer> extractAllUserId() {
            return list.stream().flatMap(valueDto ->
                    extractUserIdFromValueDto(valueDto).stream()).toList();
        }

        /**
         * 提取用户 id
         *
         * @param valueDTO 值对象
         * @return java.util.List<java.lang.Integer>
         * @author zc
         * @date 2025/8/21
         */
        private static List<Integer> extractUserIdFromValueDto(HotelKpiStrWeekBasicValueDTO valueDTO) {
            return Stream.of(valueDTO.getProperty(), valueDTO.getPropertyChg(), valueDTO.getCompSet(),
                            valueDTO.getCompSetChg(), valueDTO.getIndex(), valueDTO.getIndexChg())
                    .map(HotelKpiStrWeekBasicValueDetailDTO::getUpdatedBy).filter(item -> item > 0).toList();
        }
    }