|
@@ -1,18 +1,18 @@
|
|
|
package com.persagy.apm.energy.report.monthly.detail.hotel.project.service.impl;
|
|
|
|
|
|
+import com.persagy.apm.energy.report.common.utils.DataUtils;
|
|
|
+import com.persagy.apm.energy.report.common.utils.DateUtils;
|
|
|
+import com.persagy.apm.energy.report.manualfilling.service.IManualFillingService;
|
|
|
import com.persagy.apm.energy.report.monthly.config.function.constant.enums.FunctionTypeEnum;
|
|
|
import com.persagy.apm.energy.report.monthly.config.function.model.Function;
|
|
|
import com.persagy.apm.energy.report.monthly.config.function.model.dto.QueryFunctionDTO;
|
|
|
import com.persagy.apm.energy.report.monthly.config.function.service.IFunctionService;
|
|
|
-import com.persagy.apm.energy.report.monthly.config.functiongroup.service.IFunctionGroupService;
|
|
|
import com.persagy.apm.energy.report.monthly.detail.common.model.vo.CostItemVO;
|
|
|
import com.persagy.apm.energy.report.monthly.detail.common.service.impl.ReportCostInfoServiceImpl;
|
|
|
import com.persagy.apm.energy.report.monthly.detail.hotel.project.model.vo.HotelProjectCostInfo;
|
|
|
import com.persagy.apm.energy.report.monthly.detail.hotel.project.service.IHotelProjectReportCostService;
|
|
|
-import com.persagy.apm.energy.report.monthly.functionvalue.service.IFunctionValueService;
|
|
|
import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
|
|
|
import com.persagy.apm.energy.report.monthly.outline.service.IReportOutlineService;
|
|
|
-import com.persagy.apm.energy.report.saasweb.model.vo.ReportProjectVO;
|
|
|
import com.persagy.apm.energy.report.saasweb.model.vo.SimpleProjectVO;
|
|
|
import com.persagy.apm.energy.report.saasweb.service.ISaasWebService;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
@@ -21,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -41,6 +40,8 @@ public class HotelProjectReportCostServiceImpl extends ReportCostInfoServiceImpl
|
|
|
private ISaasWebService saasWebService;
|
|
|
@Autowired
|
|
|
private IReportOutlineService reportOutlineService;
|
|
|
+ @Autowired
|
|
|
+ private IManualFillingService manualFillingService;
|
|
|
|
|
|
@Override
|
|
|
public HotelProjectCostInfo getCost(ReportOutline reportOutline, List<String> functionIdList) {
|
|
@@ -63,6 +64,40 @@ public class HotelProjectReportCostServiceImpl extends ReportCostInfoServiceImpl
|
|
|
}
|
|
|
hotelProjectCostInfo.setProjectName(simpleProjectInfo.getProjectName());
|
|
|
|
|
|
+ // 获取入住率
|
|
|
+ String occupancyRateCurrentMonth = manualFillingService.getIndicatorFillingData(
|
|
|
+ simpleProjectInfo.getProjectLocalID(), "occupancyRate",
|
|
|
+ 2, reportMonth, DateUtils.getMonthOff(reportMonth, 1));
|
|
|
+ // 去年同期入住率
|
|
|
+ Date lastYearSameTime = DateUtils.getSameMonthFirstDayOfLastYear(reportMonth);
|
|
|
+ String occupancyRateLastYearSameTime = manualFillingService.getIndicatorFillingData(
|
|
|
+ simpleProjectInfo.getProjectLocalID(), "occupancyRate",
|
|
|
+ 2, lastYearSameTime, DateUtils.getMonthOff(lastYearSameTime, 1));
|
|
|
+ // 上个月入住率
|
|
|
+ String occupancyRateLastMonth = manualFillingService.getIndicatorFillingData(
|
|
|
+ simpleProjectInfo.getProjectLocalID(), "occupancyRate",
|
|
|
+ 2, DateUtils.getFirstDayOfLastMonth(reportMonth), reportMonth);
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(occupancyRateCurrentMonth)) {
|
|
|
+ double occupancy = Double.parseDouble(occupancyRateCurrentMonth);
|
|
|
+ hotelProjectCostInfo.setOccupancy(occupancy);
|
|
|
+ // 入住率同比增长
|
|
|
+ if (StringUtils.isNotBlank(occupancyRateLastYearSameTime)) {
|
|
|
+ double occupancyLastYearSameTime = Double.parseDouble(occupancyRateLastYearSameTime);
|
|
|
+ Double growth = DataUtils.doubleSubtract(occupancy, occupancyLastYearSameTime);
|
|
|
+ hotelProjectCostInfo.setOccupancyYearRange(DataUtils.doubleDivide(growth, occupancyLastYearSameTime));
|
|
|
+ }
|
|
|
+ // 入住率环比增长
|
|
|
+ if (StringUtils.isNotBlank(occupancyRateLastMonth)) {
|
|
|
+ double occupancyLastMonth = Double.parseDouble(occupancyRateLastMonth);
|
|
|
+ Double growth = DataUtils.doubleSubtract(occupancy, occupancyLastMonth);
|
|
|
+ hotelProjectCostInfo.setOccupancyMonthRange(DataUtils.doubleDivide(growth, occupancyLastMonth));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 具体的费用条目
|
|
|
List<CostItemVO> costItemInfos = getCostItemInfos(functionIdList, reportMonth, Lists.newArrayList(projectId));
|
|
|
hotelProjectCostInfo.setItemsCostInfo(costItemInfos);
|
|
|
|