# HotelKpiV2OriginDetailDTO.java

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

    import cloud.wconnect.workperformance.cons.hotelkpi.HotelKpiDateTypeCons;
    import cloud.wconnect.workperformance.pojo.dto.hotelkpi.factorconfigv2.HotelKpiV2FactorConfigDTO;
    import cloud.wconnect.workperformance.pojo.dto.hotelkpi.originkpi.HotelKpiOriginValueDTO;
    import lombok.AllArgsConstructor;
    import lombok.Data;
    import lombok.experimental.Accessors;

    import java.util.List;

    /**
     * DTO: Hotel KPI V2 Origin Detail
     *
     * @author zc
     * @date 2025/08/18
     */
    @Data
    @Accessors(chain = true)
    @AllArgsConstructor
    public class HotelKpiV2OriginDetailDTO {

        /**
         * Category
         * weekly - 1: TOTAL 2: TRANSIENT 3: GROUP 4: Contract
         * monthly/quarterly/yearly - 没有分类
         */
        private Integer category;

        /**
         * Actual/OTB
         */
        private HotelKpiOriginValueDTO actual;

        /**
         * Budget
         */
        private HotelKpiOriginValueDTO budget;

        /**
         * Last Year
         */
        private HotelKpiOriginValueDTO ly;

        public HotelKpiV2OriginDetailDTO() {
            this.actual = new HotelKpiOriginValueDTO();
            this.budget = new HotelKpiOriginValueDTO();
            this.ly = new HotelKpiOriginValueDTO();
        }

        /**
         * V2 Category
         * Weekly: Total, Transient, Group
         * Monthly: Total
         */
        public static List<HotelKpiV2OriginDetailDTO> initV2OriginDetailDTOList(int dateType, HotelKpiV2FactorConfigDTO factorConfigDTO) {
            if (HotelKpiDateTypeCons.WEEKLY == dateType) {
                return factorConfigDTO.getWeekly().stream().map(item ->
                        new HotelKpiV2OriginDetailDTO().setCategory(item.getCategory())).toList();
            } else {
                return factorConfigDTO.getMonthly().stream().map(item ->
                        new HotelKpiV2OriginDetailDTO().setCategory(item.getCategory())).toList();
            }
        }
    }