|
@@ -1,476 +0,0 @@
|
|
|
-package com.persagy.apm.report.dependencies.common.service.impl;
|
|
|
-
|
|
|
-import com.persagy.apm.common.model.dto.PoemsPuser;
|
|
|
-import com.persagy.apm.common.response.PoemsFeignResponse;
|
|
|
-import com.persagy.apm.report.config.function.model.Function;
|
|
|
-import com.persagy.apm.report.config.statisticsitems.model.StatisticItems;
|
|
|
-import com.persagy.apm.report.config.statisticsitems.model.dto.QueryStatisticItemsDTO;
|
|
|
-import com.persagy.apm.report.config.statisticsitems.service.IStatisticItemsService;
|
|
|
-import com.persagy.apm.report.config.type.constant.enums.BelongTypeEnum;
|
|
|
-import com.persagy.apm.report.dependencies.centermiddleware.model.vo.ProjectEERDataVo;
|
|
|
-import com.persagy.apm.report.dependencies.centermiddleware.service.ICenterMiddlewareWebService;
|
|
|
-import com.persagy.apm.report.dependencies.common.DataConstants;
|
|
|
-import com.persagy.apm.report.dependencies.common.dto.QueryPlatformParamDTO;
|
|
|
-import com.persagy.apm.report.dependencies.common.service.CommonService;
|
|
|
-import com.persagy.apm.report.dependencies.common.service.PlatformService;
|
|
|
-import com.persagy.apm.report.dependencies.common.utils.DataUtils;
|
|
|
-import com.persagy.apm.report.dependencies.common.utils.DateUtils;
|
|
|
-import com.persagy.apm.report.dependencies.common.utils.SpringContextHolder;
|
|
|
-import com.persagy.apm.report.dependencies.common.vo.PlatformAreaInfoVO;
|
|
|
-import com.persagy.apm.report.dependencies.common.vo.WorkOrderVO;
|
|
|
-import com.persagy.apm.report.dependencies.emsweather.service.EMSWeatherWebService;
|
|
|
-import com.persagy.apm.report.dependencies.environment.model.dto.BatchQueryEnvListByParamDTO;
|
|
|
-import com.persagy.apm.report.dependencies.environment.service.IEnvironmentWebService;
|
|
|
-import com.persagy.apm.report.dependencies.equiprunmanager.service.IEquipRunManagerService;
|
|
|
-import com.persagy.apm.report.dependencies.iotdataanalysis.model.AlarmInfoVo;
|
|
|
-import com.persagy.apm.report.dependencies.iotdataanalysis.model.CountAndDayRateDataVo;
|
|
|
-import com.persagy.apm.report.dependencies.iotdataanalysis.service.IDataAnalysisWebService;
|
|
|
-import com.persagy.apm.report.dependencies.saasweb.model.dto.QueryProjectDTO;
|
|
|
-import com.persagy.apm.report.dependencies.saasweb.model.vo.PoemsProjectVO;
|
|
|
-import com.persagy.apm.report.dependencies.saasweb.model.vo.ReportProjectVO;
|
|
|
-import com.persagy.apm.report.dependencies.saasweb.service.ISaasWebService;
|
|
|
-import com.persagy.apm.report.dependencies.saasweb.service.impl.SaasWebClientWrapper;
|
|
|
-import com.persagy.apm.report.dependencies.workorder.model.WorkOrder;
|
|
|
-import com.persagy.apm.report.dependencies.workorder.service.IWorkOrderWebService;
|
|
|
-import com.persagy.apm.report.detail.business.model.Platform;
|
|
|
-import com.persagy.apm.report.detail.common.model.vo.DateGraphItemVO;
|
|
|
-import com.persagy.apm.report.detail.hotel.project.model.vo.*;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
-import org.springframework.util.StringUtils;
|
|
|
-
|
|
|
-import java.util.*;
|
|
|
-
|
|
|
-@Api(value = "公共service实现类")
|
|
|
-@Service
|
|
|
-@Slf4j
|
|
|
-public class CommonServiceImpl implements CommonService {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- SaasWebClientWrapper saasWebClientWrapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- SpringContextHolder holder;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- IWorkOrderWebService iWorkOrderWebService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- IEnvironmentWebService iEnvironmentWebService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- IDataAnalysisWebService iDataAnalysisWebService;
|
|
|
-
|
|
|
- @Value("${group.code}")
|
|
|
- String groupCode;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- IStatisticItemsService iStatisticItemsService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ISaasWebService saasWebService;
|
|
|
-
|
|
|
-// @Value("${work.order.type}")
|
|
|
- String workOrderType;
|
|
|
-
|
|
|
-// @Value("${energy.save.work.order.type}")
|
|
|
- String energySaveWorkOrderType;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- IEquipRunManagerService iEquipRunManagerService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- EMSWeatherWebService emsWeatherWebService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ICenterMiddlewareWebService iCenterMiddlewareWebService;
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<String> getPjNameByPjId(List<String> pjIdList) {
|
|
|
- if (CollectionUtils.isEmpty(pjIdList)) {
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
- QueryProjectDTO queryProjectDTO = new QueryProjectDTO();
|
|
|
- PoemsPuser poemsPuser = new PoemsPuser();
|
|
|
- poemsPuser.setUserId(DataConstants.USER_ID);
|
|
|
- poemsPuser.setLoginDevice(DataConstants.LOGIN_DEVICE);
|
|
|
- poemsPuser.setPd(DataConstants.PD);
|
|
|
- queryProjectDTO.setPuser(poemsPuser);
|
|
|
- PoemsFeignResponse<PoemsProjectVO> projectsResponse = saasWebClientWrapper.queryProjects(queryProjectDTO);
|
|
|
- List<PoemsProjectVO> projectVOList = projectsResponse.getContent();
|
|
|
- if (!CollectionUtils.isEmpty(projectVOList)) {
|
|
|
- List<String> pjNameList = new ArrayList<>();
|
|
|
- for (PoemsProjectVO poemsProjectVO : projectVOList) {
|
|
|
- if (!pjIdList.contains(poemsProjectVO.getProjectId())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- pjNameList.add(poemsProjectVO.getProjectLocalName());
|
|
|
- }
|
|
|
- return pjNameList;
|
|
|
- }
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Platform getPlatform(StatisticItems statisticItems, QueryPlatformParamDTO queryPlatformParamDTO) {
|
|
|
- String serviceName = statisticItems.getItemCode() + statisticItems.getItemSource() + "WebService";
|
|
|
- PlatformService platformService = holder.getPlatformService(serviceName);
|
|
|
- Platform platform = new Platform();
|
|
|
- platform.setItemCode(statisticItems.getItemCode());
|
|
|
- platform.setModelName(statisticItems.getItemName());
|
|
|
- if (queryPlatformParamDTO.getBelongType().equals(BelongTypeEnum.PROJECT.getType())) {
|
|
|
- platform.setMonthlySummaries(platformService.getPjPlatformRate(queryPlatformParamDTO));
|
|
|
- } else if (queryPlatformParamDTO.getBelongType().equals(BelongTypeEnum.AREA.getType())) {
|
|
|
- // 合格标准
|
|
|
- String standardValueStr = statisticItems.getStandardValue();
|
|
|
- Double standardValue = DataUtils.parseDouble(standardValueStr);
|
|
|
- platform.setStandardValue(standardValue);
|
|
|
- platform.setQualifyFormula(statisticItems.getQualifyFormula());
|
|
|
- platform.setStandardFlag(statisticItems.getStandardFlag());
|
|
|
- PlatformAreaInfoVO platformAreaInfoVO = platformService.getAreaPlatformRate(statisticItems, queryPlatformParamDTO);
|
|
|
- if (null != platformAreaInfoVO) {
|
|
|
- platform.setSatisfiedCount(platformAreaInfoVO.getSatisfiedCount());
|
|
|
- platform.setUnsatisfiedCount(platformAreaInfoVO.getUnsatisfiedCount());
|
|
|
- platform.setUnsatisfiedProjects(platformAreaInfoVO.getUnsatisfiedProjects());
|
|
|
- }
|
|
|
- }
|
|
|
- return platform;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public HotelProjectAlarmDealInfo getHotelProjectAlarmDealInfo(String projectId, Date reportDate) {
|
|
|
- if (StringUtils.isEmpty(projectId) || null == reportDate) {
|
|
|
- log.info("获取HotelProjectAlarmDealInfo信息时传入参为空,故不进行查询");
|
|
|
- return new HotelProjectAlarmDealInfo();
|
|
|
- }
|
|
|
- Integer workCount = 0;
|
|
|
- Integer dealCount = 0;
|
|
|
- List<WorkOrder> askEndTimeList = iWorkOrderWebService.getWorkOrderNumByParam(projectId, reportDate, "ask_end_time", null, "8");
|
|
|
- if (null != askEndTimeList) {
|
|
|
- dealCount = askEndTimeList.size();
|
|
|
- }
|
|
|
- List<WorkOrder> createTimeWorkList = iWorkOrderWebService.getWorkOrderNumByParam(projectId, reportDate, "create_time", null, null);
|
|
|
- if (null != createTimeWorkList) {
|
|
|
- workCount = createTimeWorkList.size();
|
|
|
- }
|
|
|
- Double completeRate = null;
|
|
|
- if (null != workCount && workCount != 0 && null != dealCount) {
|
|
|
- completeRate = DataUtils.parseDouble(dealCount) / workCount * 100;
|
|
|
- }
|
|
|
- HotelProjectAlarmDealInfo hotelProjectAlarmDealInfo = new HotelProjectAlarmDealInfo();
|
|
|
- hotelProjectAlarmDealInfo.setHandledCount(dealCount);
|
|
|
- hotelProjectAlarmDealInfo.setHandledPercent(completeRate);
|
|
|
- hotelProjectAlarmDealInfo.setTotalCount(workCount);
|
|
|
- // 获取项目信息
|
|
|
- ReportProjectVO reportProjectInfo = saasWebService.getReportProjectInfo(projectId);
|
|
|
- hotelProjectAlarmDealInfo.setProjectName(null == reportProjectInfo ? "" : reportProjectInfo.getProjectName());
|
|
|
- return hotelProjectAlarmDealInfo;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public HotelProjectKpiItem getHotelProjectKpiItem(String projectId, Date reportDate, List<String> projectIdList, Function function) {
|
|
|
- if (CollectionUtils.isEmpty(projectIdList) || StringUtils.isEmpty(projectId) || null == reportDate || null == function || StringUtils.isEmpty(function.getItemId())) {
|
|
|
- log.info("获取HotelProjectKpiItem信息时传入参为空,故不进行查询");
|
|
|
- return new HotelProjectKpiItem();
|
|
|
- }
|
|
|
- try {
|
|
|
- String startTime = DateUtils.date2Str(reportDate, DateUtils.SDF_SECOND);
|
|
|
- String endTime = DateUtils.date2Str(DateUtils.getMonthOff(reportDate, 1), DateUtils.SDF_SECOND);
|
|
|
- String itemId = function.getItemId();
|
|
|
- String[] itemIdList = itemId.split("_");
|
|
|
- String envTypdId = itemIdList[0];
|
|
|
- String envParentTypeId = itemIdList[1];
|
|
|
- BatchQueryEnvListByParamDTO batchQueryEnvListByParamDTO = new BatchQueryEnvListByParamDTO();
|
|
|
- batchQueryEnvListByParamDTO.setProjectIdList(projectIdList);
|
|
|
- batchQueryEnvListByParamDTO.setEnvTypeId(envTypdId);
|
|
|
- batchQueryEnvListByParamDTO.setEnvParentTypeId(envParentTypeId);
|
|
|
- batchQueryEnvListByParamDTO.setStartTime(startTime);
|
|
|
- batchQueryEnvListByParamDTO.setEndTime(endTime);
|
|
|
- List<HotelProjectKpiItem> hotelProjectKpiItemList = iEnvironmentWebService.getPjEnvRateInfoMap(batchQueryEnvListByParamDTO);
|
|
|
- Map<String, Integer> sortMap = new HashMap<>();
|
|
|
- sortMap.put("controlRates", -1);
|
|
|
- DataUtils.sort(hotelProjectKpiItemList, sortMap);
|
|
|
- for (int i = 0; i < hotelProjectKpiItemList.size(); i++) {
|
|
|
- HotelProjectKpiItem hotelProjectKpiItem = hotelProjectKpiItemList.get(i);
|
|
|
- if (!hotelProjectKpiItem.getProjectId().equals(projectId)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (hotelProjectKpiItem.getControlRates() != null) {
|
|
|
- hotelProjectKpiItem.setRank(i + 1);
|
|
|
- }
|
|
|
- hotelProjectKpiItem.setName(function.getName());
|
|
|
- return hotelProjectKpiItem;
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("获取HotelProjectKpiItem的" + function.getItemId() + "数据失败:", e);
|
|
|
- }
|
|
|
- return new HotelProjectKpiItem();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public HotelProjectMaintenanceGraph getHotelProjectMaintenanceGraph(String userId, String projectId, Date reportDate, Function function) {
|
|
|
- if (StringUtils.isEmpty(projectId) || null == reportDate || null == function || StringUtils.isEmpty(function.getItemId())) {
|
|
|
- log.info("获取HotelProjectMaintenanceGraph信息时传入参为空,故不进行查询");
|
|
|
- return new HotelProjectMaintenanceGraph();
|
|
|
- }
|
|
|
- HotelProjectMaintenanceGraph hotelProjectMaintenanceGraph = new HotelProjectMaintenanceGraph();
|
|
|
- try {
|
|
|
- String userCode = DataConstants.USER_ID;
|
|
|
- if (!StringUtils.isEmpty(userId)) {
|
|
|
- userCode = userId;
|
|
|
- }
|
|
|
- String[] itemIdList = function.getItemId().split("_");
|
|
|
- String itemId = itemIdList[0];
|
|
|
- String itemStandardCode = itemIdList[1];
|
|
|
- String targetCode = iDataAnalysisWebService.getTargetCode(userCode, groupCode, itemId);
|
|
|
- CountAndDayRateDataVo dataVo = iDataAnalysisWebService.getIotDataAnalysisData(userCode, groupCode, projectId, reportDate, targetCode);
|
|
|
- List<DateGraphItemVO> dateGraphItemVOList = new ArrayList<>();
|
|
|
- TreeMap<Date, Double> dataMap = dataVo.getDataMap();
|
|
|
- /*if (null != dataMap && dataMap.size() != 0) {
|
|
|
- for (Map.Entry<Date, Double> entry : dataMap.entrySet()) {
|
|
|
- DateGraphItemVO dateGraphItemVO = new DateGraphItemVO();
|
|
|
- dateGraphItemVO.setDate(entry.getKey());
|
|
|
- dateGraphItemVO.setValue(entry.getValue());
|
|
|
- dateGraphItemVOList.add(dateGraphItemVO);
|
|
|
- }
|
|
|
- }*/
|
|
|
- List<Date> dateList = DateUtils.getDayList(reportDate, DateUtils.getMonthOff(reportDate, 1));
|
|
|
- for (Date date : dateList) {
|
|
|
- DateGraphItemVO dateGraphItemVO = new DateGraphItemVO();
|
|
|
- dateGraphItemVO.setDate(date);
|
|
|
- dateGraphItemVO.setValue(null == dataMap ? null : dataMap.get(date));
|
|
|
- dateGraphItemVOList.add(dateGraphItemVO);
|
|
|
- }
|
|
|
- hotelProjectMaintenanceGraph.setMonthlyValue(dataVo.getCountRate());
|
|
|
- String standardValue = null;
|
|
|
- QueryStatisticItemsDTO queryStatisticItemsDTO = new QueryStatisticItemsDTO();
|
|
|
- queryStatisticItemsDTO.setItemCode(itemStandardCode);
|
|
|
- List<StatisticItems> statisticItemList = iStatisticItemsService.queryStatisticItemsList(queryStatisticItemsDTO);
|
|
|
- if (!CollectionUtils.isEmpty(statisticItemList)) {
|
|
|
- StatisticItems statisticItems = statisticItemList.get(0);
|
|
|
- standardValue = statisticItems.getStandardValue();
|
|
|
- }
|
|
|
- hotelProjectMaintenanceGraph.setStandardValue(DataUtils.parseDouble(standardValue));
|
|
|
- hotelProjectMaintenanceGraph.setName(function.getName());
|
|
|
- hotelProjectMaintenanceGraph.setValue(dateGraphItemVOList);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("获取HotelProjectMaintenanceGraph的" + function.getItemId() + "数据失败:", e);
|
|
|
- }
|
|
|
- return hotelProjectMaintenanceGraph;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public HotelProjectMaintenanceInfo getHotelProjectMaintenanceInfo(String userId, String projectId, Date reportDate, List<Function> functionList, List<String> projectIdList) {
|
|
|
- if (StringUtils.isEmpty(projectId) || null == reportDate || CollectionUtils.isEmpty(functionList) || CollectionUtils.isEmpty(projectIdList)) {
|
|
|
- log.info("获取HotelProjectMaintenanceInfo信息时传入参为空,故不进行查询");
|
|
|
- return new HotelProjectMaintenanceInfo();
|
|
|
- }
|
|
|
- HotelProjectMaintenanceInfo hotelProjectMaintenanceInfo = new HotelProjectMaintenanceInfo();
|
|
|
- // 设置默认值
|
|
|
- hotelProjectMaintenanceInfo.setBreakCount(0);
|
|
|
- hotelProjectMaintenanceInfo.setBreakLostTime(0.0);
|
|
|
- List<HotelProjectMaintenanceGraph> hotelProjectMaintenanceGraphList = new ArrayList<>();
|
|
|
- if (!CollectionUtils.isEmpty(functionList)) {
|
|
|
- for (Function function : functionList) {
|
|
|
- hotelProjectMaintenanceGraphList.add(getHotelProjectMaintenanceGraph(userId, projectId, reportDate, function));
|
|
|
- }
|
|
|
- }
|
|
|
- List<AlarmInfoVo> alarmInfoVoList = iDataAnalysisWebService.getAlarmInfoVo(groupCode, projectIdList, reportDate);
|
|
|
- Map<String, Integer> sortMap = new HashMap<>();
|
|
|
- sortMap.put("alarmCount", -1);
|
|
|
- sortMap.put("projectId", 1);
|
|
|
- DataUtils.sort(alarmInfoVoList, sortMap);
|
|
|
- for (int i = 0; i < alarmInfoVoList.size(); i++) {
|
|
|
- AlarmInfoVo vo = alarmInfoVoList.get(i);
|
|
|
- if (!vo.getProjectId().equals(projectId)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- hotelProjectMaintenanceInfo.setBreakCount(vo.getAlarmCount());
|
|
|
- hotelProjectMaintenanceInfo.setBreakLostTime(vo.getTotalDuration());
|
|
|
- if (vo.getAlarmCount() != null) {
|
|
|
- hotelProjectMaintenanceInfo.setRank(i + 1);
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- hotelProjectMaintenanceInfo.setProjectTotalCount(projectIdList.size());
|
|
|
- hotelProjectMaintenanceInfo.setGraphs(hotelProjectMaintenanceGraphList);
|
|
|
- return hotelProjectMaintenanceInfo;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public HotelProjectEnergyWorkerOrderInfo getHotelProjectEnergyWorkerOrderInfo(String projectId, Date reportDate) {
|
|
|
- if (StringUtils.isEmpty(projectId) || null == reportDate) {
|
|
|
- log.info("获取HotelProjectEnergyWorkerOrderInfo信息时传入参为空,故不进行查询");
|
|
|
- return new HotelProjectEnergyWorkerOrderInfo();
|
|
|
- }
|
|
|
- HotelProjectEnergyWorkerOrderInfo hotelProjectEnergyWorkerOrderInfo = new HotelProjectEnergyWorkerOrderInfo();
|
|
|
- try {
|
|
|
- List<WorkOrder> createTimeWorkList = iWorkOrderWebService.getWorkOrderNumByParam(projectId, reportDate, "create_time", workOrderType, null);
|
|
|
- Integer totalCount = 0;
|
|
|
- if (null != createTimeWorkList) {
|
|
|
- totalCount = createTimeWorkList.size();
|
|
|
- }
|
|
|
- List<WorkOrder> realFinishTimeWorkList = iWorkOrderWebService.getWorkOrderNumByParam(projectId, reportDate, "real_finish_time", workOrderType, null);
|
|
|
- Integer executeCount = 0;
|
|
|
- if (null != realFinishTimeWorkList) {
|
|
|
- executeCount = realFinishTimeWorkList.size();
|
|
|
- }
|
|
|
- hotelProjectEnergyWorkerOrderInfo.setTotalCount(totalCount);
|
|
|
- hotelProjectEnergyWorkerOrderInfo.setExecuteCount(executeCount);
|
|
|
- Double executePercent = null;
|
|
|
- if (null != totalCount && totalCount != 0 && null != executeCount) {
|
|
|
- executePercent = DataUtils.parseDouble(executeCount) / totalCount * 100;
|
|
|
- }
|
|
|
- hotelProjectEnergyWorkerOrderInfo.setExecutePercent(executePercent);
|
|
|
- List<WorkOrder> energySaveRealFinishTimeWorkList = iWorkOrderWebService.getWorkOrderNumByParam(projectId, reportDate, "real_finish_time", energySaveWorkOrderType, null);
|
|
|
- Integer initiativeCount = 0;
|
|
|
- if (null != energySaveRealFinishTimeWorkList) {
|
|
|
- initiativeCount = energySaveRealFinishTimeWorkList.size();
|
|
|
- }
|
|
|
- hotelProjectEnergyWorkerOrderInfo.setInitiativeCount(initiativeCount);
|
|
|
- List<String> workOrderIdList = new ArrayList<>();
|
|
|
- List<WorkOrderVO> workOrderVOList = new ArrayList<>();
|
|
|
- for (WorkOrder workOrder : energySaveRealFinishTimeWorkList) {
|
|
|
- workOrderIdList.add(workOrder.getOrderId());
|
|
|
- WorkOrderVO vo = new WorkOrderVO();
|
|
|
- vo.setOrderId(workOrder.getOrderId());
|
|
|
- vo.setOrderName(workOrder.getWoName());
|
|
|
- if (!StringUtils.isEmpty(workOrder.getRealFinishTime())) {
|
|
|
- vo.setRealFinishTime(DateUtils.str2Date(workOrder.getRealFinishTime(), DateUtils.SDFSECOND));
|
|
|
- }
|
|
|
- workOrderVOList.add(vo);
|
|
|
- }
|
|
|
- // {工单id:工单节能量}
|
|
|
- Map<String, Double> workId_energyMap = iEquipRunManagerService.getEnergySaveWorderMap(workOrderIdList);
|
|
|
- Map<String, Integer> sortMap = new HashMap<>();
|
|
|
- sortMap.put("realFinishTime", -1);
|
|
|
- DataUtils.sort(workOrderVOList, sortMap);
|
|
|
- List<HotelProjectEnergyWorkOrderItem> hotelProjectEnergyWorkOrderItemList = new ArrayList<>();
|
|
|
- Double totalEnergySave = null;
|
|
|
- for (WorkOrderVO workOrder : workOrderVOList) {
|
|
|
- HotelProjectEnergyWorkOrderItem hotelProjectEnergyWorkOrderItem = new HotelProjectEnergyWorkOrderItem();
|
|
|
- hotelProjectEnergyWorkOrderItem.setWorkName(workOrder.getOrderName());
|
|
|
- String completeTimeStr = "";
|
|
|
- if (!StringUtils.isEmpty(workOrder.getRealFinishTime())) {
|
|
|
- completeTimeStr = DateUtils.date2Str(workOrder.getRealFinishTime(), DateUtils.SDF_DOT_DAY);
|
|
|
- }
|
|
|
- hotelProjectEnergyWorkOrderItem.setCompletedTime(completeTimeStr);
|
|
|
- hotelProjectEnergyWorkOrderItem.setEnergySaved(workId_energyMap.get(workOrder.getOrderId()));
|
|
|
- hotelProjectEnergyWorkOrderItemList.add(hotelProjectEnergyWorkOrderItem);
|
|
|
- Double energySave = workId_energyMap.get(workOrder.getOrderId());
|
|
|
- if (energySave != null) {
|
|
|
- if (null == totalEnergySave) {
|
|
|
- totalEnergySave = 0.0;
|
|
|
- }
|
|
|
- totalEnergySave = totalEnergySave + energySave;
|
|
|
- }
|
|
|
- }
|
|
|
- hotelProjectEnergyWorkerOrderInfo.setDetailInfo(hotelProjectEnergyWorkOrderItemList);
|
|
|
- hotelProjectEnergyWorkerOrderInfo.setTotalEnergySave(totalEnergySave);
|
|
|
- // 获取项目信息
|
|
|
- ReportProjectVO reportProjectInfo = saasWebService.getReportProjectInfo(projectId);
|
|
|
- hotelProjectEnergyWorkerOrderInfo.setProjectName(null == reportProjectInfo ? "" : reportProjectInfo.getProjectName());
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("获取HotelProjectEnergyWorkerOrderInfo的数据失败:", e);
|
|
|
- }
|
|
|
- return hotelProjectEnergyWorkerOrderInfo;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public HotelProjectMaintenanceBaseInfo getHotelProjectMaintenanceBaseInfo(String projectId, Date reportDate, String userId) {
|
|
|
- if (StringUtils.isEmpty(projectId) || null == reportDate) {
|
|
|
- log.info("获取HotelProjectMaintenanceBaseInfo信息时传入参为空,故不进行查询");
|
|
|
- return new HotelProjectMaintenanceBaseInfo();
|
|
|
- }
|
|
|
- String userCode = DataConstants.USER_ID;
|
|
|
- if (!StringUtils.isEmpty(userId)) {
|
|
|
- userCode = userId;
|
|
|
- }
|
|
|
- HotelProjectMaintenanceBaseInfo hotelProjectMaintenanceBaseInfo = iDataAnalysisWebService.getHotelProjectMaintenanceBaseInfo(userCode, groupCode, projectId, reportDate);
|
|
|
- // 获取项目信息
|
|
|
- ReportProjectVO reportProjectInfo = saasWebService.getReportProjectInfo(projectId);
|
|
|
- hotelProjectMaintenanceBaseInfo.setProjectName(null == reportProjectInfo ? "" : reportProjectInfo.getProjectName());
|
|
|
- return hotelProjectMaintenanceBaseInfo;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public HotelProjectChillerPlantEfficiency getHotelProjectChillerPlantEfficiency(String projectId, Date reportDate, List<String> pjIdList) {
|
|
|
- log.info("获取HotelProjectChillerPlantEfficiency开始");
|
|
|
- if (StringUtils.isEmpty(projectId) || null == reportDate) {
|
|
|
- log.info("获取HotelProjectChillerPlantEfficiency信息时传入参为空,故不进行查询");
|
|
|
- return new HotelProjectChillerPlantEfficiency();
|
|
|
- }
|
|
|
- HotelProjectChillerPlantEfficiency hotelProjectChillerPlantEfficiency = new HotelProjectChillerPlantEfficiency();
|
|
|
- Double avgTempCurrentMonth = emsWeatherWebService.getPjMonthAvgTemp(projectId, reportDate);
|
|
|
- Double avgTempLastYearMonth = emsWeatherWebService.getPjMonthAvgTemp(projectId, DateUtils.getYearOff(reportDate, -1));
|
|
|
- emsWeatherWebService.getPjMonthAvgTemp(projectId, DateUtils.getYearOff(reportDate, -1));
|
|
|
- hotelProjectChillerPlantEfficiency.setAverageTemperatureCurrentMonth(avgTempCurrentMonth);
|
|
|
- hotelProjectChillerPlantEfficiency.setAverageTemperatureLastYearSameTime(avgTempLastYearMonth);
|
|
|
- Double avgTempGrowth = null;
|
|
|
- if (avgTempCurrentMonth != null && avgTempLastYearMonth != null) {
|
|
|
- avgTempGrowth = avgTempCurrentMonth - avgTempLastYearMonth;
|
|
|
- }
|
|
|
- hotelProjectChillerPlantEfficiency.setAverageTemperatureGrowth(avgTempGrowth);
|
|
|
- List<ProjectEERDataVo> projectEERDataVoList = iCenterMiddlewareWebService.getProjectEERDataList(pjIdList, groupCode, reportDate);
|
|
|
- Map<String, Integer> sortMap = new HashMap<>();
|
|
|
- sortMap.put("eer", -1);
|
|
|
- DataUtils.sort(projectEERDataVoList, sortMap);
|
|
|
- for (int i = 0; i < projectEERDataVoList.size(); i++) {
|
|
|
- ProjectEERDataVo vo = projectEERDataVoList.get(i);
|
|
|
- if (!vo.getProjectId().equals(projectId)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- hotelProjectChillerPlantEfficiency.setEer(vo.getEer());
|
|
|
- hotelProjectChillerPlantEfficiency.setMaxEerTime(vo.getMaxEerTimeList());
|
|
|
- hotelProjectChillerPlantEfficiency.setMinEerTime(vo.getMinEerTimeList());
|
|
|
- hotelProjectChillerPlantEfficiency.setCoolingCapacityCurrentMonth(vo.getCoolingCapacityCurrentMonth());
|
|
|
- List<DateGraphItemVO> eerDetailInfo = vo.getEerDetailInfo();
|
|
|
- sortMap.put("date", 1);
|
|
|
- DataUtils.sort(vo.getEerDetailInfo(), sortMap);
|
|
|
- hotelProjectChillerPlantEfficiency.setEerDetailInfo(vo.getEerDetailInfo());
|
|
|
- if (vo.getEer() != null) {
|
|
|
- hotelProjectChillerPlantEfficiency.setRank(i + 1);
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- hotelProjectChillerPlantEfficiency.setProjectTotalCount(pjIdList.size());
|
|
|
- List<String> currentProjectIdList = new ArrayList<>();
|
|
|
- currentProjectIdList.add(projectId);
|
|
|
- List<ProjectEERDataVo> currentPjLastYearEERDataVoList = iCenterMiddlewareWebService.getProjectEERDataList(currentProjectIdList, groupCode, DateUtils.getYearOff(reportDate, -1));
|
|
|
- if (!CollectionUtils.isEmpty(currentPjLastYearEERDataVoList)) {
|
|
|
- ProjectEERDataVo currentPjLastYearEERDataVo = currentPjLastYearEERDataVoList.get(0);
|
|
|
- if (currentPjLastYearEERDataVo != null) {
|
|
|
- hotelProjectChillerPlantEfficiency.setCoolingCapacityLastYearSameTime(currentPjLastYearEERDataVo.getCoolingCapacityCurrentMonth());
|
|
|
- Double currentMonth = hotelProjectChillerPlantEfficiency.getCoolingCapacityCurrentMonth();
|
|
|
- Double lastYearSameMonth = currentPjLastYearEERDataVo.getCoolingCapacityCurrentMonth();
|
|
|
- Double coolingCapacityRange = null;
|
|
|
- if (lastYearSameMonth != null && lastYearSameMonth != 0.0 && currentMonth != null) {
|
|
|
- coolingCapacityRange = (currentMonth - lastYearSameMonth) / lastYearSameMonth * 100;
|
|
|
- }
|
|
|
- hotelProjectChillerPlantEfficiency.setCoolingCapacityRange(coolingCapacityRange);
|
|
|
- }
|
|
|
- }
|
|
|
- List<ProjectEERDataVo> currentPjLastMonthEERDataVoList = iCenterMiddlewareWebService.getProjectEERDataList(currentProjectIdList, groupCode, DateUtils.getMonthOff(reportDate, -1));
|
|
|
- if (!CollectionUtils.isEmpty(currentPjLastMonthEERDataVoList)) {
|
|
|
- ProjectEERDataVo currentPjLastMonthEERDataVo = currentPjLastMonthEERDataVoList.get(0);
|
|
|
- if (currentPjLastMonthEERDataVo != null) {
|
|
|
- hotelProjectChillerPlantEfficiency.setEerLastMonth(currentPjLastMonthEERDataVo.getEer());
|
|
|
- Double currentMonth = hotelProjectChillerPlantEfficiency.getEer();
|
|
|
- Double lastMonth = currentPjLastMonthEERDataVo.getEer();
|
|
|
- Double eerMonthRange = null;
|
|
|
- if (lastMonth != null && lastMonth != 0.0 && currentMonth != null) {
|
|
|
- eerMonthRange = (currentMonth - lastMonth) / lastMonth * 100;
|
|
|
- }
|
|
|
- hotelProjectChillerPlantEfficiency.setEerMonthRange(eerMonthRange);
|
|
|
- }
|
|
|
- }
|
|
|
- log.info("获取HotelProjectChillerPlantEfficiency结束");
|
|
|
- return hotelProjectChillerPlantEfficiency;
|
|
|
- }
|
|
|
-
|
|
|
-}
|