# OperatingStatisticsParseServiceByOther.java

    package cloud.wconnect.workperformance.service.sva.operatingstatistics.operatingstatistics;

    import cloud.wconnect.commonlib.cons.BaseConstant;
    import cloud.wconnect.commonlib.cons.BaseErrorCodeEnum;
    import cloud.wconnect.commonlib.cons.CommonErrorI18nConstant;
    import cloud.wconnect.commonlib.cons.SystemPlatformEnum;
    import cloud.wconnect.commonlib.exception.BadRequestException;
    import cloud.wconnect.commonlib.exception.InternalServerErrorException;
    import cloud.wconnect.commonlib.exception.ParseReportException;
    import cloud.wconnect.commonlib.pojo.dto.PropertyDTO;
    import cloud.wconnect.commonlib.util.*;
    import cloud.wconnect.workperformance.cons.S3BucketFunctionCons;
    import cloud.wconnect.workperformance.cons.operatingstatisticsdaily.OperatingStatisticsDatasourceEnum;
    import cloud.wconnect.workperformance.pojo.bo.sva.operatingstatistics.OperatingStatisticsListBO;
    import cloud.wconnect.workperformance.service.AmazonS3Service;
    import cloud.wconnect.workperformance.service.sva.operatingstatistics.IOperStatisImportLogService;
    import cloud.wconnect.workperformance.service.sva.operatingstatistics.IOperatingStatisticsReportEnhancerService;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.google.common.collect.Lists;
    import jakarta.annotation.Resource;
    import org.apache.commons.collections.CollectionUtils;
    import org.apache.commons.lang3.StringUtils;
    import org.apache.poi.ss.usermodel.Row;
    import org.apache.poi.ss.usermodel.Sheet;
    import org.apache.poi.ss.usermodel.Workbook;
    import org.apache.poi.ss.usermodel.WorkbookFactory;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.stereotype.Component;
    import org.springframework.web.multipart.MultipartFile;

    import java.io.IOException;
    import java.io.InputStream;
    import java.math.BigDecimal;
    import java.math.RoundingMode;
    import java.time.LocalDate;
    import java.time.format.DateTimeFormatter;
    import java.time.format.DateTimeParseException;
    import java.util.*;
    import java.util.function.Function;
    import java.util.stream.Collectors;

    /**
     * 服务实现类：报告处理
     *
     * @author zc
     * @date 2024/6/3
     */
    @Component
    @DS("work_performance")
    public class OperatingStatisticsParseServiceByOther implements IOperatingStatisticsParseService {
        @Resource
        private IOperStatisImportLogService importLogService;
        @Resource
        private I18nMessageUtils i18nMessageUtils;
        @Resource
        private AmazonS3Service amazonS3Service;
        @Resource
        private IOperatingStatisticsReportEnhancerService operatingStatisticsReportEnhancerService;
        @Value("${aws-s3.third-party.key.schedule-vs-actual.operating-statistics}")
        private String s3FilePath;
        @Value("${file-max-size.import-report.sva}")
        private long fileMaxSize;

        /**
         * 判断是否支持
         *
         * @param source 数据源
         * @return boolean
         * @author zc
         * @date 2024/8/19
         */
        @Override
        public boolean supports(String source) {
            return SystemPlatformEnum.OTHER.getDesc().equals(source);
        }

        /**
         * 校验文件内容是否合法
         *
         * @param propertyDTOList 资产集合
         * @param file            文件
         * @author zc
         * @date 2024/8/19
         */
        @Override
        public void checkFile(List<PropertyDTO> propertyDTOList, MultipartFile file) {
            // 限制文件大小
            FileCheckUtils.checkFileSize(file, fileMaxSize);
            // 校验文件格式
            UploadUtils.checkFileFormat(file, Lists.newArrayList("xls", "xlsx"));
            Map<String, PropertyDTO> name2PropertyDTO = propertyDTOList.stream()
                    .collect(Collectors.toMap(item -> item.getName().toLowerCase(), Function.identity()));
            try (InputStream in = file.getInputStream(); Workbook workbook = WorkbookFactory.create(in)) {
                Sheet sheet = workbook.getSheetAt(0);
                // 获取最大行数
                int lastRowNum = sheet.getLastRowNum();
                // 若只包含标题，直接返回
                if (lastRowNum < 1) {
                    return;
                }

                // 提取标题
                List<String> titleList = Lists.newArrayList();
                Row titleRow = sheet.getRow(0);
                for (int i = 0; i <= 11; i++) {
                    titleList.add(CellUtils.convertCellStr(titleRow.getCell(i)));
                }

                for (int i = 1; i <= lastRowNum; i++) {
                    Row row = sheet.getRow(i);

                    // Property Name
                    String propertyNameStr = CellUtils.convertCellStr(row.getCell(0));
                    if (StringUtils.isBlank(propertyNameStr)) {
                        throw new BadRequestException(CommonErrorI18nConstant.CANNOT_EMPTY,
                                i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(0)),
                                BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                "The Property Name cannot be blank");
                    }
                    // 若资产不存在，则跳过校验
                    PropertyDTO propertyDTO = name2PropertyDTO.get(propertyNameStr.toLowerCase());
                    if (Objects.isNull(propertyDTO)) {
                        continue;
                    }

                    // Date
                    String dateStr = CellUtils.convertCellStr(row.getCell(1));
                    if (StringUtils.isBlank(dateStr)) {
                        throw new BadRequestException(CommonErrorI18nConstant.CANNOT_EMPTY,
                                i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(1)),
                                BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                "The Date cannot be blank");
                    } else {
                        try {
                            DateTimeFormatter formatter = DateTimeFormatter.ofPattern(BaseConstant.DATE_FORMAT_YYYY_MM_DD, Locale.ENGLISH);
                            LocalDate.parse(dateStr, formatter);
                        } catch (DateTimeParseException e) {
                            throw new BadRequestException(CommonErrorI18nConstant.FORMAT_INCORRECT,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(1), BaseConstant.DATE_FORMAT_YYYY_MM_DD),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The Date format is incorrect, Date = " + dateStr);
                        }
                    }

                    // Rooms Rented
                    String roomsRentedStr = CellUtils.convertCellStr(row.getCell(2));
                    if (StringUtils.isNotBlank(roomsRentedStr)) {
                        try {
                            int roomsRented = Integer.parseInt(roomsRentedStr);
                            if (roomsRented < 0) {
                                throw new BadRequestException(CommonErrorI18nConstant.CANNOT_LESS_THAN_ZERO,
                                        i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(2)),
                                        BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                        "The Rooms Rented cannot be less than 0, Rooms Rented = " + roomsRentedStr);
                            }
                            if (roomsRented > 1000000) {
                                throw new BadRequestException(CommonErrorI18nConstant.NUMBER_OVERLENGTH,
                                        i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(2), 6, 0),
                                        BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                        "The Rooms Rented cannot be greater than 1000000, Rooms Rented = " + roomsRentedStr);
                            }
                        } catch (NumberFormatException e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_INTEGER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(2)),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The Rooms Rented must integer, Rooms Rented = " + roomsRentedStr);
                        }
                    }

                    // Occ%
                    String occPercentStr = CellUtils.convertCellStr(row.getCell(3));
                    if (StringUtils.isNotBlank(occPercentStr)) {
                        BigDecimal occPercent;
                        try {
                            occPercent = new BigDecimal(occPercentStr);
                            if (occPercent.compareTo(new BigDecimal("0")) < 0) {
                                throw new BadRequestException(CommonErrorI18nConstant.CANNOT_LESS_THAN_ZERO,
                                        i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(3)),
                                        BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                        "The Occ% cannot be less than 0, Occ% = " + occPercentStr);
                            }
                        } catch (NumberFormatException e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(3)),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The Occ% must number, Occ% = " + occPercentStr);
                        }
                        // 校验整数位是否超过限制
                        int intLength = occPercent.abs().toBigInteger().toString().length();
                        if (intLength > 5) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(3), 5),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The integer of Occ% exceeds the limit, Occ% = " + occPercentStr);
                        }
                    }

                    // ADR
                    String adrStr = CellUtils.convertCellStr(row.getCell(4));
                    if (StringUtils.isNotBlank(adrStr)) {
                        BigDecimal adr;
                        try {
                            adr = new BigDecimal(adrStr);
                        } catch (NumberFormatException e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(4)),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The ADR must number, ADR = " + adrStr);
                        }
                        // 校验整数位是否超过限制
                        int intLength = adr.abs().toBigInteger().toString().length();
                        if (intLength > 10) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(4), 10),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The integer of ADR exceeds the limit, ADR = " + adrStr);
                        }
                    }

                    // RevPAR
                    String revParStr = CellUtils.convertCellStr(row.getCell(5));
                    if (StringUtils.isNotBlank(revParStr)) {
                        BigDecimal revPar;
                        try {
                            revPar = new BigDecimal(revParStr);
                        } catch (NumberFormatException e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(5)),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The RevPAR must number, RevPAR = " + revParStr);
                        }
                        // 校验整数位是否超过限制
                        int intLength = revPar.abs().toBigInteger().toString().length();
                        if (intLength > 8) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(5), 8),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The integer of RevPAR exceeds the limit, RevPAR = " + revParStr);
                        }
                    }

                    // Room Rev
                    String roomRevStr = CellUtils.convertCellStr(row.getCell(6));
                    if (StringUtils.isNotBlank(roomRevStr)) {
                        BigDecimal roomRev;
                        try {
                            roomRev = new BigDecimal(roomRevStr);
                        } catch (NumberFormatException e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(6)),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The Room Rev must number, Room Rev = " + roomRevStr);
                        }
                        // 校验整数位是否超过限制
                        int intLength = roomRev.abs().toBigInteger().toString().length();
                        if (intLength > 8) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(6), 8),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The integer of Room Rev exceeds the limit, Room Rev = " + roomRevStr);
                        }
                    }

                    // Food Rev
                    String foodRevStr = CellUtils.convertCellStr(row.getCell(7));
                    if (StringUtils.isNotBlank(foodRevStr)) {
                        BigDecimal foodRev;
                        try {
                            foodRev = new BigDecimal(foodRevStr);
                        } catch (NumberFormatException e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(7)),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The Food Rev must number, Food Rev = " + foodRevStr);
                        }
                        // 校验整数位是否超过限制
                        int intLength = foodRev.abs().toBigInteger().toString().length();
                        if (intLength > 8) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(7), 8),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The integer of Food Rev exceeds the limit, Food Rev = " + foodRevStr);
                        }
                    }

                    // F&B || Rev
                    String fb2RevStr = CellUtils.convertCellStr(row.getCell(8));
                    if (StringUtils.isNotBlank(fb2RevStr)) {
                        BigDecimal fb2Rev;
                        try {
                            fb2Rev = new BigDecimal(fb2RevStr);
                        } catch (NumberFormatException e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(8)),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The F&B || Rev must number, F&B || Rev = " + fb2RevStr);
                        }
                        // 校验整数位是否超过限制
                        int intLength = fb2Rev.abs().toBigInteger().toString().length();
                        if (intLength > 8) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(8), 8),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The integer of F&B || Rev  exceeds the limit, F&B || Rev = " + fb2RevStr);
                        }
                    }

                    // Beverage Rev
                    String beverageRevStr = CellUtils.convertCellStr(row.getCell(9));
                    if (StringUtils.isNotBlank(beverageRevStr)) {
                        BigDecimal beverageRev;
                        try {
                            beverageRev = new BigDecimal(beverageRevStr);
                        } catch (NumberFormatException e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(9)),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The Beverage Rev must number, Beverage Rev = " + beverageRevStr);
                        }
                        // 校验整数位是否超过限制
                        int intLength = beverageRev.abs().toBigInteger().toString().length();
                        if (intLength > 8) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(9), 8),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The integer of Beverage Rev exceeds the limit, Beverage Rev = " + beverageRevStr);
                        }
                    }

                    // Other Rev
                    String otherRevStr = CellUtils.convertCellStr(row.getCell(10));
                    if (StringUtils.isNotBlank(otherRevStr)) {
                        BigDecimal otherRev;
                        try {
                            otherRev = new BigDecimal(otherRevStr);
                        } catch (NumberFormatException e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(10)),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The Other Rev must number, Other Rev = " + otherRevStr);
                        }
                        // 校验整数位是否超过限制
                        int intLength = otherRev.abs().toBigInteger().toString().length();
                        if (intLength > 8) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(10), 8),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The integer of Other Rev exceeds the limit, Other Rev = " + otherRevStr);
                        }
                    }

                    // Total Rev
                    String totalRevStr = CellUtils.convertCellStr(row.getCell(11));
                    if (StringUtils.isNotBlank(totalRevStr)) {
                        BigDecimal totalRev;
                        try {
                            totalRev = new BigDecimal(totalRevStr);
                        } catch (NumberFormatException e) {
                            throw new BadRequestException(CommonErrorI18nConstant.MUST_NUMBER,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(11)),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The Total Rev must number, Total Rev = " + totalRevStr);
                        }
                        // 校验整数位是否超过限制
                        int intLength = totalRev.abs().toBigInteger().toString().length();
                        if (intLength > 10) {
                            throw new BadRequestException(CommonErrorI18nConstant.NUMBER_INTEGER_OVERLENGTH,
                                    i18nMessageUtils.getErrorParamMapNotNeedTranslate(titleList.get(11), 10),
                                    BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                                    "The integer of Total Rev exceeds the limit, Total Rev = " + totalRevStr);
                        }
                    }
                }
            } catch (IOException e) {
                throw new InternalServerErrorException(BaseErrorCodeEnum.SYSTEM_ERROR.getI18nCode(),
                        BaseErrorCodeEnum.SYSTEM_ERROR.getCode(),
                        "Handle check Sva Operating Statistics Other report error.", e);
            }
        }

        /**
         * 处理数据
         *
         * @param propertyDTOList      资产集合
         * @param file                 文件
         * @param propertyId2DateRange 数据日期范围（时间戳）
         * @param logIds               日志 id 集合
         * @param operatorId           操作人 id
         * @author zc
         * @date 2024/8/19
         */
        @Override
        public void handleData(List<PropertyDTO> propertyDTOList, MultipartFile file,
                               Map<Integer, List<Long>> propertyId2DateRange, List<Long> logIds, int operatorId) {
            // 处理是否成功
            boolean handleResult = true;
            String tenantSymbol = propertyDTOList.get(0).getTenantSymbol();
            List<String> propertyAbbrList = propertyDTOList.stream().map(PropertyDTO::getAbbr).toList();
            String s3Key = tenantSymbol + "/" + StringUtils.join(propertyAbbrList, "_") + "/" + s3FilePath
                    + UploadUtils.getRandomFileName(file.getOriginalFilename());

            try (InputStream in = file.getInputStream()) {
                // 上传报告到 S3，用于导入记录下载报告
                amazonS3Service.uploadFile(S3BucketFunctionCons.SVA_OPERATING_IMPORT_RECORD, file, s3Key);

                // 解析报告
                List<OperatingStatisticsListBO> operatingListBoList = parse(propertyDTOList, in, propertyId2DateRange);
                // 处理Operating statistics original数据
                operatingStatisticsReportEnhancerService.handleOperatingStatisticsOriginByNonM3Api(propertyDTOList, operatingListBoList, operatorId,
                        propertyId2DateRange,OperatingStatisticsDatasourceEnum.OTHER.getValue());
                // 按优先级更新Operating statistics数据
                operatingStatisticsReportEnhancerService.updateOperatingStatisticsByPriority(propertyDTOList, propertyId2DateRange);
            } catch (Exception e) {
                handleResult = false;
                throw new ParseReportException(BaseErrorCodeEnum.SYSTEM_ERROR.getI18nCode(),
                        BaseErrorCodeEnum.SYSTEM_ERROR.getCode(),
                        "Handle import Sva Operating statistics Other report error.", e);
            } finally {
                importLogService.updateBatch(logIds, handleResult, operatorId, s3Key);
            }
        }

        /**
         * 解析报告
         *
         * @param propertyDTOList      资产集合
         * @param in                   报告文件
         * @param propertyId2DateRange 报告数据日期范围(yyyyMMdd)
         * @return OperatingStatisticsListBO 集合
         * @author zc
         * @date 2024/6/3
         */
        @Override
        public List<OperatingStatisticsListBO> parse(List<PropertyDTO> propertyDTOList, InputStream in,
                                                     Map<Integer, List<Long>> propertyId2DateRange) throws ParseReportException {
            Map<String, PropertyDTO> name2PropertyDTO = propertyDTOList.stream()
                    .collect(Collectors.toMap(item -> item.getName().toLowerCase(), Function.identity()));

            try (Workbook workbook = WorkbookFactory.create(in)) {
                Sheet sheet = workbook.getSheetAt(0);

                List<OperatingStatisticsListBO> operatingStatistics = Lists.newArrayList();
                // 跳过第 0 行标题
                for (int i = 1; i <= sheet.getLastRowNum(); i++) {
                    Row row = sheet.getRow(i);

                    String propertyName = CellUtils.convertCellStr(row.getCell(0));
                    PropertyDTO propertyDTO = name2PropertyDTO.get(propertyName.toLowerCase());
                    if (Objects.isNull(propertyDTO)) {
                        continue;
                    }

                    String dateStr = CellUtils.convertCellStr(row.getCell(1));
                    if (StringUtils.isEmpty(dateStr)) {
                        continue;
                    }

                    // 数据日期范围配置为空的不处理
                    List<Long> dateRangeList = propertyId2DateRange.getOrDefault(propertyDTO.getId(), Collections.emptyList());
                    if (CollectionUtils.isEmpty(dateRangeList)) {
                        continue;
                    }

                    // 只提取指定日期范围的数据
                    LocalDate localDate = DateTimeUtils.strToLocalDate(dateStr, BaseConstant.DATE_FORMAT_YYYY_MM_DD);
                    int targetDate = Integer.parseInt(DateTimeUtils.localDateToStr(localDate, BaseConstant.DATE_FORMAT_YYYYMMDD));
                    if (targetDate < dateRangeList.get(0) || targetDate > dateRangeList.get(1)) {
                        continue;
                    }

                    operatingStatistics.add(convert2Bo(row, propertyDTO));
                }
                return operatingStatistics;
            } catch (IOException e) {
                throw new InternalServerErrorException(BaseErrorCodeEnum.SYSTEM_ERROR.getI18nCode(),
                        BaseErrorCodeEnum.SYSTEM_ERROR.getCode(),
                        "Handle parse Sva Operating statistics Other report error.", e);
            }
        }

        /**
         * 报告数据转换为 BO
         *
         * @param row         行数据
         * @param propertyDTO 资产
         * @return OperatingStatisticsListBO
         * @author zc
         * @date 2024/7/29
         */
        private OperatingStatisticsListBO convert2Bo(Row row, PropertyDTO propertyDTO) {
            RoundingMode roundingMode = InternationalizationUtils.getRoundingMode(propertyDTO
                    .getInternationalization().getNumber().getCalculationRule());
            int scale = BaseConstant.DATA_PRECISION;

            OperatingStatisticsListBO os = new OperatingStatisticsListBO();
            os.setProperty(propertyDTO.getAbbr());

            String dateStr = CellUtils.convertCellStr(row.getCell(1));
            os.setTheDay(dateStr);

            String roomsRentedStr = CellUtils.convertCellStr(row.getCell(2));
            os.setRoomsRented(StringUtils.isBlank(roomsRentedStr) ? null : Integer.parseInt(roomsRentedStr));

            String occPercentStr = CellUtils.convertCellStr(row.getCell(3));
            os.setOccPercent(StringUtils.isBlank(occPercentStr) ? null : new BigDecimal(occPercentStr)
                    .setScale(scale, roundingMode));

            String adrStr = CellUtils.convertCellStr(row.getCell(4));
            os.setAdr(StringUtils.isBlank(adrStr) ? null : new BigDecimal(adrStr)
                    .setScale(scale, roundingMode));

            String revParStr = CellUtils.convertCellStr(row.getCell(5));
            os.setRevPar(StringUtils.isBlank(revParStr) ? null : new BigDecimal(revParStr)
                    .setScale(scale, roundingMode));

            String roomRevStr = CellUtils.convertCellStr(row.getCell(6));
            os.setRoomRev(StringUtils.isBlank(roomRevStr) ? null : new BigDecimal(roomRevStr)
                    .setScale(scale, roundingMode));

            String foodRevStr = CellUtils.convertCellStr(row.getCell(7));
            os.setFoodRev(StringUtils.isBlank(foodRevStr) ? null : new BigDecimal(foodRevStr)
                    .setScale(scale, roundingMode));

            String fb2RevStr = CellUtils.convertCellStr(row.getCell(8));
            os.setFb2Rev(StringUtils.isBlank(fb2RevStr) ? null : new BigDecimal(fb2RevStr)
                    .setScale(scale, roundingMode));

            String bevRevStr = CellUtils.convertCellStr(row.getCell(9));
            os.setBevRev(StringUtils.isBlank(bevRevStr) ? null : new BigDecimal(bevRevStr)
                    .setScale(scale, roundingMode));

            String otherRev = CellUtils.convertCellStr(row.getCell(10));
            os.setOtherRev(StringUtils.isBlank(otherRev) ? null : new BigDecimal(otherRev)
                    .setScale(scale, roundingMode));

            String totalRevStr = CellUtils.convertCellStr(row.getCell(11));
            os.setTotalRev(StringUtils.isBlank(totalRevStr) ? null : new BigDecimal(totalRevStr)
                    .setScale(scale, roundingMode));

            return os;
        }
    }