# BudgetDatabaseCalculateServiceImpl.java

    package cloud.wconnect.rateshop.service.budgetdatabase.impl;

    import cloud.wconnect.commonlib.cons.BaseConstant;
    import cloud.wconnect.commonlib.pojo.dto.RoomsConfigDTO;
    import cloud.wconnect.commonlib.pojo.dto.internationalization.InternationalizationDTO;
    import cloud.wconnect.commonlib.pojo.dto.internationalization.InternationalizationNumberDTO;
    import cloud.wconnect.commonlib.redis.PropertyI18nRedisService;
    import cloud.wconnect.commonlib.service.RoomsConfigInternalService;
    import cloud.wconnect.commonlib.util.InternationalizationUtils;
    import cloud.wconnect.rateshop.pojo.bo.budgetdatabase.OneYearRevenueBO;
    import cloud.wconnect.rateshop.pojo.bo.budgetdatabase.OneYearRoomsBO;
    import cloud.wconnect.rateshop.pojo.dto.budgetdatabase.BudgetYearDTO;
    import cloud.wconnect.rateshop.pojo.dto.budgetdatabase.BudgetYearRoomsDTO;
    import cloud.wconnect.rateshop.service.budgetdatabase.IBudgetDatabaseCalculateService;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import jakarta.annotation.Nullable;
    import org.apache.commons.collections.CollectionUtils;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;

    import java.math.BigDecimal;
    import java.math.RoundingMode;
    import java.time.Year;
    import java.time.YearMonth;
    import java.util.List;
    import java.util.Objects;
    import java.util.stream.Collectors;

    /**
     * @author: yyt
     * 2025-08-15
     */
    @Service
    @DS("rate_shop")
    public class BudgetDatabaseCalculateServiceImpl implements IBudgetDatabaseCalculateService {

        @Autowired
        private PropertyI18nRedisService propertyI18nRedisService;
        @Autowired
        private RoomsConfigInternalService roomsConfigInternalService;

        /**
         * 计算 yoy chg
         *
         * @param propertyId  资产 id
         * @param budgetTotal 预测 total
         * @param actualTotal 实际 total
         * @return % yoy chg
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BigDecimal calculateYoyChg(int propertyId, BigDecimal budgetTotal, BigDecimal actualTotal) {
            // 预测 / 实际 - 1
            if (Objects.nonNull(budgetTotal) && Objects.nonNull(actualTotal) && actualTotal.compareTo(BigDecimal.ZERO) != 0) {
                InternationalizationDTO internationalization = propertyI18nRedisService.get(propertyId).getInternationalization();
                InternationalizationNumberDTO number = internationalization.getNumber();
                RoundingMode roundingMode = InternationalizationUtils.getRoundingMode(number.getCalculationRule());
                return budgetTotal.divide(actualTotal, BaseConstant.DATA_PRECISION, roundingMode).subtract(BigDecimal.ONE)
                        .multiply(BigDecimal.valueOf(100));
            }
            return null;
        }

        /**
         * 计算 yoy chg
         *
         * @param propertyId  资产 id
         * @param budgetTotal 预测 total
         * @param actualTotal 实际 total
         * @return yoy chg
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BigDecimal calculateYoyChg(int propertyId, Long budgetTotal, Integer actualTotal) {
            // 预测 / 实际 - 1
            if (Objects.nonNull(budgetTotal) && Objects.nonNull(actualTotal)) {
                return calculateYoyChg(propertyId, new BigDecimal(budgetTotal), new BigDecimal(actualTotal));
            }
            return null;
        }

        /**
         * 计算 yoy chg
         *
         * @param propertyId  资产 id
         * @param budgetTotal 预测 total
         * @param actualTotal 实际 total
         * @return yoy chg
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BigDecimal calculateYoyChg(int propertyId, Long budgetTotal, Long actualTotal) {
            // 预测 / 实际 - 1
            if (Objects.nonNull(budgetTotal) && Objects.nonNull(actualTotal)) {
                return calculateYoyChg(propertyId, new BigDecimal(budgetTotal), new BigDecimal(actualTotal));
            }
            return null;
        }

        /**
         * 计算 adr
         *
         * @param propertyId 资产 id
         * @param revenue    revenue
         * @param rooms      rooms
         * @return adr
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BigDecimal calculateAdr(int propertyId, BigDecimal revenue, Long rooms) {
            // revenue / rooms
            if (Objects.nonNull(revenue) && Objects.nonNull(rooms) && rooms > 0) {
                InternationalizationDTO internationalization = propertyI18nRedisService.get(propertyId).getInternationalization();
                InternationalizationNumberDTO number = internationalization.getNumber();
                return revenue.divide(new BigDecimal(rooms), BaseConstant.DATA_PRECISION, InternationalizationUtils.getRoundingMode(number.getCalculationRule()));
            }
            return null;
        }

        /**
         * 计算 adr
         *
         * @param propertyId 资产 id
         * @param revenue    revenue
         * @param rooms      rooms
         * @return adr
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BigDecimal calculateAdr(int propertyId, BigDecimal revenue, Integer rooms) {
            // revenue / rooms
            if (Objects.nonNull(revenue) && Objects.nonNull(rooms) && rooms > 0) {
                InternationalizationDTO internationalization = propertyI18nRedisService.get(propertyId).getInternationalization();
                InternationalizationNumberDTO number = internationalization.getNumber();
                return revenue.divide(new BigDecimal(rooms), BaseConstant.DATA_PRECISION, InternationalizationUtils.getRoundingMode(number.getCalculationRule()));
            }
            return null;
        }

        /**
         * 计算 occ
         *
         * @param propertyId 资产 id
         * @param year       年
         * @param month      月
         * @param rooms      rooms
         * @return occ
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BigDecimal calculateOcc(int propertyId, int year, @Nullable Integer month, Integer rooms) {
            // 房间数 / (当前年或当前月天数 * 资产设置房间数)
            RoomsConfigDTO roomsConfig = roomsConfigInternalService.getRoomsConfig(propertyId);
            Integer propertyRooms = roomsConfig.getRooms();
            if (Objects.nonNull(rooms) && Objects.nonNull(propertyRooms)  && propertyRooms > 0) {
                InternationalizationDTO internationalization = propertyI18nRedisService.get(propertyId).getInternationalization();
                InternationalizationNumberDTO number = internationalization.getNumber();
                RoundingMode roundingMode = InternationalizationUtils.getRoundingMode(number.getCalculationRule());
                int totalRooms = Year.of(year).length() * propertyRooms;
                if (Objects.nonNull(month)) {
                    totalRooms = YearMonth.of(year, month).lengthOfMonth() * propertyRooms;
                }
                return new BigDecimal(rooms).divide(new BigDecimal(totalRooms), BaseConstant.DATA_PRECISION, roundingMode)
                        .multiply(BigDecimal.valueOf(100));
            }

            return null;
        }

        /**
         * 计算 occ
         *
         * @param propertyId 资产 id
         * @param year       年
         * @param month      月
         * @param rooms      rooms
         * @return occ
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BigDecimal calculateOcc(int propertyId, int year, @Nullable Integer month, Long rooms) {
            // 房间数 / (当前年或当前月天数 * 资产设置房间数)
            RoomsConfigDTO roomsConfig = roomsConfigInternalService.getRoomsConfig(propertyId);
            Integer propertyRooms = roomsConfig.getRooms();
            if (Objects.nonNull(rooms) && Objects.nonNull(propertyRooms)  && propertyRooms > 0) {
                InternationalizationDTO internationalization = propertyI18nRedisService.get(propertyId).getInternationalization();
                InternationalizationNumberDTO number = internationalization.getNumber();
                RoundingMode roundingMode = InternationalizationUtils.getRoundingMode(number.getCalculationRule());
                int totalRooms = Year.of(year).length() * propertyRooms;
                if (Objects.nonNull(month)) {
                    totalRooms = YearMonth.of(year, month).lengthOfMonth() * propertyRooms;
                }
                return new BigDecimal(rooms).divide(new BigDecimal(totalRooms), BaseConstant.DATA_PRECISION, roundingMode)
                        .multiply(BigDecimal.valueOf(100));
            }

            return null;
        }

        /**
         * 计算 occ change
         *
         * @param budgetOcc 预测 occ
         * @param actualOcc 实际 occ
         * @return occ change
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BigDecimal calculateOccChange(BigDecimal budgetOcc, BigDecimal actualOcc) {
            // 预测 - 实际
            if (Objects.nonNull(budgetOcc) && Objects.nonNull(actualOcc)) {
                return budgetOcc.subtract(actualOcc);
            }
            return null;
        }

        /**
         * 计算 revpar
         *
         * @param propertyId 资产 id
         * @param adr        adr
         * @param occ        occ
         * @return revpar
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BigDecimal calculateRevpar(Integer propertyId, BigDecimal adr, BigDecimal occ) {
            // adr * occ
            if (Objects.nonNull(adr) && Objects.nonNull(occ)) {
                InternationalizationDTO internationalization = propertyI18nRedisService.get(propertyId).getInternationalization();
                InternationalizationNumberDTO number = internationalization.getNumber();
                RoundingMode roundingMode = InternationalizationUtils.getRoundingMode(number.getCalculationRule());
                return adr.multiply(occ).divide(BigDecimal.valueOf(100), BaseConstant.DATA_PRECISION, roundingMode);
            }
            return null;
        }

        /**
         * 计算 平均值
         *
         * @param propertyId  资产 id
         * @param molecule    分子
         * @param denominator 分母
         * @return 平均值
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BigDecimal calculateAvg(int propertyId, BigDecimal molecule, Integer denominator) {
            if (Objects.nonNull(molecule) && Objects.nonNull(denominator) && denominator != 0) {
                InternationalizationDTO internationalization = propertyI18nRedisService.get(propertyId).getInternationalization();
                InternationalizationNumberDTO number = internationalization.getNumber();
                return molecule.divide(new BigDecimal(denominator), BaseConstant.DATA_PRECISION, InternationalizationUtils.getRoundingMode(number.getCalculationRule()));
            }
            return null;
        }

        /**
         * 计算 平均值
         *
         * @param propertyId  资产 id
         * @param molecule    分子
         * @param denominator 分母
         * @return 平均值
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BigDecimal calculateAvg(int propertyId, Integer molecule, Integer denominator) {
            if (Objects.nonNull(molecule) && Objects.nonNull(denominator)) {
                return calculateAvg(propertyId, new BigDecimal(molecule), denominator);
            }
            return null;
        }

        /**
         * 汇总 total
         *
         * @param propertyId 资产 id
         * @param revenues   revenue
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BudgetYearDTO calculateRevenueTotal(Integer propertyId, List<OneYearRevenueBO> revenues) {
            BudgetYearDTO budgetYearDTO = new BudgetYearDTO();
            budgetYearDTO.setJanuary(summaryRevenue(revenues.stream().map(OneYearRevenueBO::getJanuary).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setFebruary(summaryRevenue(revenues.stream().map(OneYearRevenueBO::getFebruary).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setMarch(summaryRevenue(revenues.stream().map(OneYearRevenueBO::getMarch).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setApril(summaryRevenue(revenues.stream().map(OneYearRevenueBO::getApril).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setMay(summaryRevenue(revenues.stream().map(OneYearRevenueBO::getMay).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setJune(summaryRevenue(revenues.stream().map(OneYearRevenueBO::getJune).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setJuly(summaryRevenue(revenues.stream().map(OneYearRevenueBO::getJuly).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setAugust(summaryRevenue(revenues.stream().map(OneYearRevenueBO::getAugust).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setSeptember(summaryRevenue(revenues.stream().map(OneYearRevenueBO::getSeptember).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setOctober(summaryRevenue(revenues.stream().map(OneYearRevenueBO::getOctober).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setNovember(summaryRevenue(revenues.stream().map(OneYearRevenueBO::getNovember).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setDecember(summaryRevenue(revenues.stream().map(OneYearRevenueBO::getDecember).filter(Objects::nonNull).collect(Collectors.toList())));

            budgetYearDTO.setBudgetTotal(summaryOneYearRevenue(budgetYearDTO.getJanuary(), budgetYearDTO.getFebruary(),
                    budgetYearDTO.getMarch(), budgetYearDTO.getApril(), budgetYearDTO.getMay(), budgetYearDTO.getJune(),
                    budgetYearDTO.getJuly(), budgetYearDTO.getAugust(), budgetYearDTO.getSeptember(), budgetYearDTO.getOctober(),
                    budgetYearDTO.getNovember(), budgetYearDTO.getDecember()));

            List<BigDecimal> actualTotal = revenues.stream().map(OneYearRevenueBO::getActualTotal).filter(Objects::nonNull).toList();
            budgetYearDTO.setActualTotal(CollectionUtils.isEmpty(actualTotal) ? null : actualTotal.stream().reduce(BigDecimal.ZERO, BigDecimal::add));

            budgetYearDTO.setYoyChg(calculateYoyChg(propertyId, budgetYearDTO.getBudgetTotal(), budgetYearDTO.getActualTotal()));

            return budgetYearDTO;
        }

        /**
         * 汇总 total
         *
         * @param propertyId 资产 id
         * @param rooms      room
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BudgetYearRoomsDTO calculateRoomsTotal(Integer propertyId, List<OneYearRoomsBO> rooms) {
            BudgetYearRoomsDTO budgetYearDTO = new BudgetYearRoomsDTO();
            budgetYearDTO.setJanuary(summaryRooms(rooms.stream().map(OneYearRoomsBO::getJanuary).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setFebruary(summaryRooms(rooms.stream().map(OneYearRoomsBO::getFebruary).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setMarch(summaryRooms(rooms.stream().map(OneYearRoomsBO::getMarch).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setApril(summaryRooms(rooms.stream().map(OneYearRoomsBO::getApril).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setMay(summaryRooms(rooms.stream().map(OneYearRoomsBO::getMay).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setJune(summaryRooms(rooms.stream().map(OneYearRoomsBO::getJune).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setJuly(summaryRooms(rooms.stream().map(OneYearRoomsBO::getJuly).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setAugust(summaryRooms(rooms.stream().map(OneYearRoomsBO::getAugust).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setSeptember(summaryRooms(rooms.stream().map(OneYearRoomsBO::getSeptember).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setOctober(summaryRooms(rooms.stream().map(OneYearRoomsBO::getOctober).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setNovember(summaryRooms(rooms.stream().map(OneYearRoomsBO::getNovember).filter(Objects::nonNull).collect(Collectors.toList())));
            budgetYearDTO.setDecember(summaryRooms(rooms.stream().map(OneYearRoomsBO::getDecember).filter(Objects::nonNull).collect(Collectors.toList())));

            budgetYearDTO.setBudgetTotal(summaryOneYearRooms(budgetYearDTO.getJanuary(), budgetYearDTO.getFebruary(),
                    budgetYearDTO.getMarch(), budgetYearDTO.getApril(), budgetYearDTO.getMay(), budgetYearDTO.getJune(),
                    budgetYearDTO.getJuly(), budgetYearDTO.getAugust(), budgetYearDTO.getSeptember(), budgetYearDTO.getOctober(),
                    budgetYearDTO.getNovember(), budgetYearDTO.getDecember()));

            List<Long> actualTotal = rooms.stream().map(OneYearRoomsBO::getActualTotal).filter(Objects::nonNull).toList();
            budgetYearDTO.setActualTotal(CollectionUtils.isEmpty(actualTotal) ? null : actualTotal.stream().reduce(0L, Long::sum));

            budgetYearDTO.setYoyChg(calculateYoyChg(propertyId, budgetYearDTO.getBudgetTotal(), budgetYearDTO.getActualTotal()));

            return budgetYearDTO;
        }

        /**
         * 汇总 revenue
         *
         * @param revenues revenue
         * @return revenue
         * @author yyt
         * @date 2025/8/14
         **/
        private BigDecimal summaryRevenue(List<BigDecimal> revenues) {
            return CollectionUtils.isEmpty(revenues) ? null : revenues.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
        }

        /**
         * 汇总 rooms
         *
         * @param rooms rooms
         * @return rooms
         * @author yyt
         * @date 2025/8/14
         **/
        private Long summaryRooms(List<Long> rooms) {
            return CollectionUtils.isEmpty(rooms) ? null : rooms.stream().reduce(0L, Long::sum);
        }

        /**
         * 汇总 revenue
         *
         * @param january   1 月
         * @param february  2 月
         * @param march     3 月
         * @param april     4 月
         * @param may       5 月
         * @param june      6 月
         * @param july      7 月
         * @param august    8 月
         * @param september 9 月
         * @param october   10 月
         * @param november  11 月
         * @param december  12 月
         * @return revenue
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public BigDecimal summaryOneYearRevenue(BigDecimal january, BigDecimal february, BigDecimal march, BigDecimal april,
                                                BigDecimal may, BigDecimal june, BigDecimal july, BigDecimal august, BigDecimal september,
                                                BigDecimal october, BigDecimal november, BigDecimal december) {
            BigDecimal total = null;
            if (Objects.nonNull(january)) {
                total = january;
            }
            if (Objects.nonNull(february)) {
                total = total == null ? february : total.add(february);
            }
            if (Objects.nonNull(march)) {
                total = total == null ? march : total.add(march);
            }
            if (Objects.nonNull(april)) {
                total = total == null ? april : total.add(april);
            }
            if (Objects.nonNull(may)) {
                total = total == null ? may : total.add(may);
            }
            if (Objects.nonNull(june)) {
                total = total == null ? june : total.add(june);
            }
            if (Objects.nonNull(july)) {
                total = total == null ? july : total.add(july);
            }
            if (Objects.nonNull(august)) {
                total = total == null ? august : total.add(august);
            }
            if (Objects.nonNull(september)) {
                total = total == null ? september : total.add(september);
            }
            if (Objects.nonNull(october)) {
                total = total == null ? october : total.add(october);
            }
            if (Objects.nonNull(november)) {
                total = total == null ? november : total.add(november);
            }
            if (Objects.nonNull(december)) {
                total = total == null ? december : total.add(december);
            }
            return total;
        }

        /**
         * 汇总 rooms
         *
         * @param january   1 月
         * @param february  2 月
         * @param march     3 月
         * @param april     4 月
         * @param may       5 月
         * @param june      6 月
         * @param july      7 月
         * @param august    8 月
         * @param september 9 月
         * @param october   10 月
         * @param november  11 月
         * @param december  12 月
         * @return revenue
         * @author yyt
         * @date 2025/8/14
         **/
        @Override
        public Long summaryOneYearRooms(Long january, Long february, Long march, Long april,
                                           Long may, Long june, Long july, Long august, Long september,
                                           Long october, Long november, Long december) {
            Long total = null;
            if (Objects.nonNull(january)) {
                total = january;
            }
            if (Objects.nonNull(february)) {
                total = total == null ? february : total + february;
            }
            if (Objects.nonNull(march)) {
                total = total == null ? march : total + march;
            }
            if (Objects.nonNull(april)) {
                total = total == null ? april : total + april;
            }
            if (Objects.nonNull(may)) {
                total = total == null ? may : total + may;
            }
            if (Objects.nonNull(june)) {
                total = total == null ? june : total + june;
            }
            if (Objects.nonNull(july)) {
                total = total == null ? july : total + july;
            }
            if (Objects.nonNull(august)) {
                total = total == null ? august : total + august;
            }
            if (Objects.nonNull(september)) {
                total = total == null ? september : total + september;
            }
            if (Objects.nonNull(october)) {
                total = total == null ? october : total + october;
            }
            if (Objects.nonNull(november)) {
                total = total == null ? november : total + november;
            }
            if (Objects.nonNull(december)) {
                total = total == null ? december : total + december;
            }
            return total;
        }

        /**
         * 计算 revenue
         *
         * @param propertyId 资产 id
         * @param rooms      房间数
         * @param adr        单价
         * @return revenue
         * @author yyt
         * @date 2025/8/15
         **/
        @Override
        public BigDecimal calculateRevenue(Integer propertyId, Integer rooms, BigDecimal adr) {
            if (Objects.nonNull(rooms) && Objects.nonNull(adr)) {
                InternationalizationDTO internationalization = propertyI18nRedisService.get(propertyId).getInternationalization();
                InternationalizationNumberDTO number = internationalization.getNumber();
                return adr.multiply(new BigDecimal(rooms)).setScale(BaseConstant.DATA_PRECISION, InternationalizationUtils.getRoundingMode(number.getCalculationRule()));
            }
            return null;
        }

        /**
         * 计算 revenue
         *
         * @param propertyId 资产 id
         * @param rooms      房间数
         * @param adr        单价
         * @return revenue
         * @author yyt
         * @date 2025/8/15
         **/
        @Override
        public BigDecimal calculateRevenue(Integer propertyId, Long rooms, BigDecimal adr) {
            if (Objects.nonNull(rooms) && Objects.nonNull(adr)) {
                InternationalizationDTO internationalization = propertyI18nRedisService.get(propertyId).getInternationalization();
                InternationalizationNumberDTO number = internationalization.getNumber();
                return adr.multiply(new BigDecimal(rooms)).setScale(BaseConstant.DATA_PRECISION, InternationalizationUtils.getRoundingMode(number.getCalculationRule()));
            }
            return null;
        }

        /**
         * 计算 revenue total
         *
         * @param propertyId         资产 id
         * @param budgetRevenue      budget revenue
         * @param budgetTotalRevenue budget total revenue
         * @return revenue total (%)
         * @author yyt
         * @date 2025/8/21
         **/
        @Override
        public BigDecimal calculateRevenueTotal(int propertyId, BigDecimal budgetRevenue, BigDecimal budgetTotalRevenue) {
            // (budgetRevenue / budgetTotalRevenue) * 100
            if (Objects.nonNull(budgetRevenue) && Objects.nonNull(budgetTotalRevenue) && budgetTotalRevenue.compareTo(BigDecimal.ZERO) != 0) {
                InternationalizationDTO internationalization = propertyI18nRedisService.get(propertyId).getInternationalization();
                InternationalizationNumberDTO number = internationalization.getNumber();
                RoundingMode roundingMode = InternationalizationUtils.getRoundingMode(number.getCalculationRule());
                return budgetRevenue.divide(budgetTotalRevenue, BaseConstant.DATA_PRECISION, roundingMode).multiply(BigDecimal.valueOf(100));
            }
            return null;
        }

    }