# HFYesterdayNext90DaysParseByOther.java

    package cloud.wconnect.rateshop.service.revenue.report.historyandforecast.yesterdaytonext90days;

    import cloud.wconnect.commonlib.cons.*;
    import cloud.wconnect.commonlib.exception.BadRequestException;
    import cloud.wconnect.commonlib.exception.ParseReportException;
    import cloud.wconnect.commonlib.pojo.dto.PropertyDTO;
    import cloud.wconnect.commonlib.pojo.dto.RoomsConfigDTO;
    import cloud.wconnect.commonlib.pojo.dto.internationalization.InternationalizationNumberDTO;
    import cloud.wconnect.commonlib.service.RoomsConfigInternalService;
    import cloud.wconnect.commonlib.util.*;
    import cloud.wconnect.rateshop.cons.revenue.RevenueCons;
    import cloud.wconnect.rateshop.cons.revenue.RevenueImportCons;
    import cloud.wconnect.rateshop.entity.revenue.RevenueAdrConfig;
    import cloud.wconnect.rateshop.entity.revenue.RevenueDailySummary;
    import cloud.wconnect.rateshop.entity.revenue.RevenueImportLog;
    import cloud.wconnect.rateshop.pojo.bo.revenue.DailySummaryBO;
    import cloud.wconnect.rateshop.pojo.dto.revenue.ResolveExceptionDTO;
    import cloud.wconnect.rateshop.service.revenue.*;
    import cloud.wconnect.rateshop.service.revenue.report.IImportRevenueReport;
    import cloud.wconnect.rateshop.service.revenue.report.IRevenueReportCommonService;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.google.common.collect.Lists;
    import org.apache.commons.collections.CollectionUtils;
    import org.apache.commons.lang3.StringUtils;
    import org.apache.poi.ss.usermodel.*;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.stereotype.Service;
    import org.springframework.transaction.annotation.Transactional;
    import org.springframework.web.multipart.MultipartFile;

    import jakarta.annotation.Resource;

    import java.io.InputStream;
    import java.math.BigDecimal;
    import java.math.RoundingMode;
    import java.time.LocalDate;
    import java.time.ZoneId;
    import java.time.ZonedDateTime;
    import java.time.format.DateTimeFormatter;
    import java.util.List;
    import java.util.Objects;

    /**
     * @author: yyt
     * 2024-08-14
     */
    @Service
    @DS("rate_shop")
    public class HFYesterdayNext90DaysParseByOther implements IImportRevenueReport {

        @Resource
        private IRevenueReportCommonService revenueImportCommonService;
        @Resource
        private RoomsConfigInternalService roomsConfigInternalService;
        @Resource
        private IRevenueAdrConfigService revenueAdrConfigService;
        @Resource
        private IRevenueDailySummaryService revenueDailySummaryService;
        @Autowired
        private I18nMessageUtils i18nMessageUtils;

        @Value("${file-max-size.import-report.revenue}")
        private Long importReportFileMaxSize;

        @Value("${aws-s3.third-party.key.revenue.history-and-forecast-yesterday-and-ninety-day}")
        private String s3Key;

        private static final String SOURCE = SystemPlatformEnum.OTHER.getDesc();

        private static final int FILE_TYPE = RevenueImportCons.HISTORY_AND_FORECAST_YESTERDAY_AND_NEXT_NINETY_DAYS;

        /**
         * 判断支持的平台
         *
         * @param source   平台
         * @param fileType 文件类型
         * @return boolean
         * @author yyt
         * @date 2024/8/14
         */
        @Override
        public boolean supports(String source, int fileType) {
            return SOURCE.equals(source) && FILE_TYPE == fileType;
        }

        /**
         * 检查文件
         *
         * @param propertyDTO 资产
         * @param file        文件
         * @author yyt
         * @date 2024/8/14
         **/
        @Override
        public void checkFile(PropertyDTO propertyDTO, MultipartFile file) {
            // 限制文件大小
            FileCheckUtils.checkFileSize(file, importReportFileMaxSize);

            // 校验文件格式
            UploadUtils.checkFileFormat(file, Lists.newArrayList("xls", "xlsx"));

            try (InputStream in = file.getInputStream();
                 Workbook workbook = WorkbookFactory.create(in)) {
                Sheet sheet = workbook.getSheetAt(0);
                Row titleRow = sheet.getRow(0);
                if (Objects.isNull(titleRow)) {
                    throw new BadRequestException(CommonErrorI18nConstant.IMPORT_REPORT_NOT_REQUIRED,
                            BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                            "The imported report is not the one required for the current functionality");
                }

                String dateTitle = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(titleRow, "A"));
                String roomsTitle = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(titleRow, "B"));
                String occTitle = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(titleRow, "C"));
                String oooRoomsTitle = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(titleRow, "D"));
                String transientDeductRoomsTitle = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(titleRow, "E"));
                String transientNonDeductRoomsTitle = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(titleRow, "F"));
                String groupDeductRoomsTitle = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(titleRow, "G"));
                String groupNonDeductRoomsTitle = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(titleRow, "H"));
                DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(BaseConstant.DATE_FORMAT_YYYY_MM_DD);

                for (int i = 1; i <= sheet.getLastRowNum(); i++) {
                    Row row = sheet.getRow(i);
                    if (Objects.isNull(row)) {
                        continue;
                    }

                    Cell dateCell = CellUtils.getCellByColumnLetter(row, "A");
                    if (Objects.isNull(dateCell) || StringUtils.isBlank(dateCell.toString())) {
                        throw new BadRequestException(CommonErrorI18nConstant.CANNOT_EMPTY,
                                i18nMessageUtils.getErrorParamMapNotNeedTranslate(dateTitle),
                                BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                "The date cannot be empty");
                    } else {
                        // 格式必须 yyyy-MM-dd
                        try {
                            LocalDate.parse(CellUtils.convertCellStr(dateCell, BaseConstant.DATE_FORMAT_YYYY_MM_DD), dateTimeFormatter);
                        } catch (Exception e) {
                            throw new BadRequestException(CommonErrorI18nConstant.FORMAT_INCORRECT,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(dateTitle, BaseConstant.DATE_FORMAT_YYYY_MM_DD),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The date format error");
                        }
                    }

                    Cell roomsCell = CellUtils.getCellByColumnLetter(row, "B");
                    if (Objects.nonNull(roomsCell) && StringUtils.isNotBlank(roomsCell.toString())) {
                        BigDecimal rooms;
                        try {
                            rooms = new BigDecimal(CellUtils.convertCellStr(roomsCell));
                        } catch (Exception e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(roomsTitle),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The rooms must be a number");
                        }
                        if (rooms.toBigInteger().toString().length() > 6) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(roomsTitle, 6),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The rooms exceed the limit");
                        }
                    }

                    Cell occCell = CellUtils.getCellByColumnLetter(row, "C");
                    if (Objects.nonNull(occCell) && StringUtils.isNotBlank(occCell.toString())) {
                        BigDecimal occ;
                        try {
                            occ = new BigDecimal(CellUtils.convertCellStr(occCell));
                        } catch (Exception e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(occTitle),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The occ must be a number");
                        }
                        if (occ.toBigInteger().toString().length() > 6) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(occTitle, 6),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The occ exceed the limit");
                        }
                    }

                    Cell oooRoomsCell = CellUtils.getCellByColumnLetter(row, "D");
                    if (Objects.nonNull(oooRoomsCell) && StringUtils.isNotBlank(oooRoomsCell.toString())) {
                        BigDecimal oooRooms;
                        try {
                            oooRooms = new BigDecimal(CellUtils.convertCellStr(oooRoomsCell));
                        } catch (Exception e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(oooRoomsTitle),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The ooo rooms must be a number");
                        }
                        if (oooRooms.toBigInteger().toString().length() > 6) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(oooRoomsTitle, 6),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The ooo rooms exceed the limit");
                        }
                    }

                    Cell transientDeductRoomsCell = CellUtils.getCellByColumnLetter(row, "E");
                    if (Objects.nonNull(transientDeductRoomsCell) && StringUtils.isNotBlank(transientDeductRoomsCell.toString())) {
                        BigDecimal transientDeductRooms;
                        try {
                            transientDeductRooms = new BigDecimal(CellUtils.convertCellStr(transientDeductRoomsCell));
                        } catch (Exception e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(transientDeductRoomsTitle),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The transient deduct rooms must be a number");
                        }
                        if (transientDeductRooms.toBigInteger().toString().length() > 6) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(transientDeductRoomsTitle, 6),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The transient deduct rooms exceed the limit");
                        }
                    }

                    Cell transientNonDeductRoomsCell = CellUtils.getCellByColumnLetter(row, "F");
                    if (Objects.nonNull(transientNonDeductRoomsCell) && StringUtils.isNotBlank(transientNonDeductRoomsCell.toString())) {
                        BigDecimal transientNonDeductRooms;
                        try {
                            transientNonDeductRooms = new BigDecimal(CellUtils.convertCellStr(transientNonDeductRoomsCell));
                        } catch (Exception e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(transientNonDeductRoomsTitle),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The transient non deduct rooms must be a number");
                        }
                        if (transientNonDeductRooms.toBigInteger().toString().length() > 6) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(transientNonDeductRoomsTitle, 6),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The transient non deduct rooms exceed the limit");
                        }
                    }

                    Cell groupDeductRoomsCell = CellUtils.getCellByColumnLetter(row, "G");
                    if (Objects.nonNull(groupDeductRoomsCell) && StringUtils.isNotBlank(groupDeductRoomsCell.toString())) {
                        BigDecimal groupDeductRooms;
                        try {
                            groupDeductRooms = new BigDecimal(CellUtils.convertCellStr(groupDeductRoomsCell));
                        } catch (Exception e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(groupDeductRoomsTitle),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The group deduct rooms must be a number");
                        }
                        if (groupDeductRooms.toBigInteger().toString().length() > 6) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(groupDeductRoomsTitle, 6),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The group deduct rooms exceed the limit");
                        }
                    }

                    Cell groupNonDeductRoomsCell = CellUtils.getCellByColumnLetter(row, "H");
                    if (Objects.nonNull(groupNonDeductRoomsCell) && StringUtils.isNotBlank(groupNonDeductRoomsCell.toString())) {
                        BigDecimal groupNonDeductRooms;
                        try {
                            groupNonDeductRooms = new BigDecimal(CellUtils.convertCellStr(groupNonDeductRoomsCell));
                        } catch (Exception e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(groupNonDeductRoomsTitle),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The group non deduct rooms must be a number");
                        }
                        if (groupNonDeductRooms.toBigInteger().toString().length() > 6) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(groupNonDeductRoomsTitle, 6),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The group non deduct rooms exceed the limit");
                        }
                    }
                }

            } catch (BadRequestException e) {
                throw e;
            } catch (Exception e) {
                throw new ParseReportException(BaseErrorCodeEnum.SYSTEM_ERROR.getI18nCode(),
                        BaseErrorCodeEnum.SYSTEM_ERROR.getCode(), "parsing file failed.", e);
            }
        }

        /**
         * 处理导入记录
         *
         * @param propertyDTO         资产
         * @param importLog           导入记录
         * @param resolveExceptionDTO 选择条件
         * @param file                文件
         * @param userId              操作人
         * @return 导入记录
         * @author yyt
         * @date 2024/8/14
         **/
        @Override
        public RevenueImportLog handleImportLog(PropertyDTO propertyDTO, RevenueImportLog importLog,
                                                ResolveExceptionDTO resolveExceptionDTO, MultipartFile file, int userId) {
            return revenueImportCommonService.handleImportLog(propertyDTO, importLog, resolveExceptionDTO, s3Key, file, userId);
        }

        /**
         * 处理文件
         *
         * @param propertyDTO 资产信息
         * @param file        文件
         * @param importLog   导入记录
         * @param userId      操作人
         * @author yyt
         * @date 2024/8/14
         **/
        @Override
        @Transactional(rollbackFor = Exception.class)
        public void handleFile(PropertyDTO propertyDTO, MultipartFile file, RevenueImportLog importLog, Integer userId) {
            boolean importSuccess = true;
            try (InputStream inputStream = file.getInputStream()) {
                Workbook workbook = WorkbookFactory.create(inputStream);

                saveDailySummary(propertyDTO, workbook, importLog);

                workbook.close();
            } catch (Exception e) {
                importSuccess = false;
                throw new ParseReportException(BaseErrorCodeEnum.SYSTEM_ERROR.getI18nCode(),
                        BaseErrorCodeEnum.SYSTEM_ERROR.getCode(), "parse report error", e);
            } finally {
                revenueImportCommonService.updateImportStatus(importLog, importSuccess, userId);
            }
        }

        /**
         * 保存 Daily Summary 数据
         *
         * @param propertyDTO 资产
         * @param workbook    文件
         * @param importLog   导入记录
         * @author yyt
         * @date 2024/8/16
         **/
        private void saveDailySummary(PropertyDTO propertyDTO, Workbook workbook, RevenueImportLog importLog) {
            /*
             * 数据导入限制说明：
             * 报告数据范围：昨天至未来90天
             * 导入限制：仅支持导入营业日期前一天的数据
             * 限制原因：无法确认报告在营业日的具体生成时刻，为确保数据准确性，系统限定只能导入前一天的确定数据。
             *
             *  由于解决异常时记录的报告日期是-1,90天，所以此处使用营业日前一天作为开始日期和结束日期
             */
            Long theDate = importLog.getTheDate();
            //营业日前一天
            LocalDate beforeDateOfBusinessDate = DateTimeUtils.longToLocalDate(theDate, propertyDTO.getTimezone()).minusDays(1);
            long beforeDateLongOfBusinessDate = DateTimeUtils.localDateToLong(beforeDateOfBusinessDate, propertyDTO.getTimezone());

            //解析数据
            List<DailySummaryBO> dailySummaryBOS = parseHistoryAndForecastForDailySummary(propertyDTO, workbook,
                    beforeDateLongOfBusinessDate, beforeDateLongOfBusinessDate);
            if (CollectionUtils.isEmpty(dailySummaryBOS)) return;

            revenueDailySummaryService.saveOrUpdate(propertyDTO, dailySummaryBOS);
        }

        /**
         * 解析报告
         *
         * @param propertyDTO 资产
         * @param workbook    文件
         * @param startDate   开始日期
         * @param endDate     结束日期
         * @return HistoryAndForecastDailySummaryDTO
         * @author yyt
         * @date 2024/8/15
         **/
        private List<DailySummaryBO> parseHistoryAndForecastForDailySummary(PropertyDTO propertyDTO, Workbook workbook,
                                                                            Long startDate, Long endDate) {
            InternationalizationNumberDTO number = propertyDTO.getInternationalization().getNumber();
            int dataPrecision = BaseConstant.DATA_PRECISION;
            RoundingMode roundingMode = InternationalizationUtils.getRoundingMode(number.getCalculationRule());

            Integer propertyId = propertyDTO.getId();
            RoomsConfigDTO roomsConfig = roomsConfigInternalService.getRoomsConfig(propertyId);
            Integer rooms = roomsConfig.getRooms();

            RevenueAdrConfig revenueAdrConfig = revenueAdrConfigService.get(propertyId);
            boolean checkTransientDeduct = Objects.nonNull(revenueAdrConfig) && revenueAdrConfig.getCheckTransientDeduct();
            boolean checkTransientNonDeduct = Objects.nonNull(revenueAdrConfig) && revenueAdrConfig.getCheckTransientNonDeduct();
            boolean checkGroupDeduct = Objects.nonNull(revenueAdrConfig) && revenueAdrConfig.getCheckGroupDeduct();
            boolean checkGroupNonDeduct = Objects.nonNull(revenueAdrConfig) && revenueAdrConfig.getCheckGroupNonDeduct();

            ZoneId zoneId = ZoneId.of(propertyDTO.getTimezone());
            DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(BaseConstant.DATE_FORMAT_YYYY_MM_DD);
            BigDecimal oneHundred = BigDecimal.valueOf(100L);
            long syncTime = DateTimeUtils.nowTimestamp();
            List<DailySummaryBO> dailySummaryBOS = Lists.newArrayListWithExpectedSize(92);

            Sheet sheet = workbook.getSheetAt(0);
            for (int i = 1; i <= sheet.getLastRowNum(); i++) {
                Row row = sheet.getRow(i);
                if (Objects.isNull(row)) {
                    continue;
                }

                Cell dateCell = CellUtils.getCellByColumnLetter(row, "A");
                String dateStr = CellUtils.convertCellStr(dateCell, BaseConstant.DATE_FORMAT_YYYY_MM_DD);
                ZonedDateTime targetDateZoneDateTime = LocalDate.parse(dateStr, dateTimeFormatter).atStartOfDay(zoneId);
                long targetDate = targetDateZoneDateTime.toEpochSecond();
                if (targetDate < startDate || targetDate > endDate) {
                    continue;
                }

                DailySummaryBO dailySummaryBO = new DailySummaryBO();
                dailySummaryBO.setTheDate(targetDate);

                //小时数设置为Final
                dailySummaryBO.setTheHour(RevenueDailySummary.FINAL_HOUR);

                //同步时间
                dailySummaryBO.setSyncTime(syncTime);

                //入住房间数
                String totalOccStr = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(row, "B"));
                dailySummaryBO.setTotalOcc(StringUtils.isEmpty(totalOccStr) ? BaseConstant.ZERO : Integer.parseInt(totalOccStr));
                //故障房
                String oooRoomStr = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(row, "D"));
                dailySummaryBO.setOooRooms(StringUtils.isEmpty(oooRoomStr) ? BaseConstant.ZERO : Integer.parseInt(oooRoomStr));
                //设置可用房间数 = 配置的房间数 - 入住房间数 - 故障房间数
                dailySummaryBO.setRoomsAvailable(rooms - dailySummaryBO.getTotalOcc() - dailySummaryBO.getOooRooms());

                // 如果勾选了 Transient deduct，则累加交订金的 Transient 房间数
                int transientRooms = BaseConstant.ZERO;
                String transientRoomsStr = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(row, "E"));
                if (checkTransientDeduct && StringUtils.isNotEmpty(transientRoomsStr)) {
                    transientRooms = Integer.parseInt(transientRoomsStr);
                }
                // 如果勾选了 Transient non deduct，则累加未交订金的 Transient 房间数
                int nonDeductRooms = BaseConstant.ZERO;
                String nonDeductRoomsStr = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(row, "F"));
                if (checkTransientNonDeduct && StringUtils.isNotEmpty(nonDeductRoomsStr)) {
                    nonDeductRooms = Integer.parseInt(nonDeductRoomsStr);
                }
                dailySummaryBO.setTransientRooms(transientRooms + nonDeductRooms);

                // 如果勾选了 Group deduct，则累加交订金的 Group 房间数
                int groupRooms = BaseConstant.ZERO;
                String groupRoomsStr = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(row, "G"));
                if (checkGroupDeduct && StringUtils.isNotEmpty(groupRoomsStr)) {
                    groupRooms = Integer.parseInt(groupRoomsStr);
                }
                // 如果勾选了 Group non deduct，则累加未交订金的 Group 房间数
                int grpNonDeductRooms = BaseConstant.ZERO;
                String grpNonDeductRoomsStr = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(row, "H"));
                if (checkGroupNonDeduct && StringUtils.isNotEmpty(grpNonDeductRoomsStr)) {
                    grpNonDeductRooms = Integer.parseInt(grpNonDeductRoomsStr);
                }
                dailySummaryBO.setGroupRooms(groupRooms + grpNonDeductRooms);

                dailySummaryBO.setTotalRoomsSold(transientRooms + nonDeductRooms + groupRooms + grpNonDeductRooms);

                // 设置 occ，根据 occ 的配置规则判断：1.使用配置的房间数计算 occ，2.直接使用文件中的 occ
                if (roomsConfig.getOccRule() == RevenueCons.USE_ROOMS_TO_CALCULATE) {
                    String totalOccRoomsStr = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(row, "B"));
                    if (StringUtils.isNotEmpty(totalOccRoomsStr)) {
                        //  Occ. % = total occ rooms / 总房间数
                        BigDecimal occPercent = new BigDecimal(totalOccRoomsStr).divide(BigDecimal.valueOf(rooms), dataPrecision, roundingMode).multiply(oneHundred);
                        dailySummaryBO.setOcc(occPercent);
                    }
                } else {
                    String occPercentStr = CellUtils.convertCellStr(CellUtils.getCellByColumnLetter(row, "C"));
                    if (StringUtils.isNotEmpty(occPercentStr)) {
                        dailySummaryBO.setOcc(new BigDecimal(occPercentStr).setScale(BaseConstant.DATA_PRECISION, roundingMode));
                    }
                }

                dailySummaryBOS.add(dailySummaryBO);
            }

            return dailySummaryBOS;
        }

        /**
         * 校验日期
         *
         * @param propertyDTO         资产DTO
         * @param resolveExceptionDTO 导入报告DTO
         * @author lichen
         * @date 2025/11/19
         */
        public void checkDate(PropertyDTO propertyDTO, ResolveExceptionDTO resolveExceptionDTO) {
            revenueImportCommonService.checkHistoryAndForecastYesterdayAndNinetyDaysReportDate(propertyDTO, resolveExceptionDTO);
        }

    }