|
@@ -1,6 +1,7 @@
|
|
|
package com.persagy.apm.energy.report.environment.service.impl;
|
|
|
|
|
|
import com.persagy.apm.common.response.PoemsFeignResponse;
|
|
|
+import com.persagy.apm.energy.report.common.DataConstants;
|
|
|
import com.persagy.apm.energy.report.common.dto.QueryAreaPlatformParamDTO;
|
|
|
import com.persagy.apm.energy.report.common.dto.QueryPjPlatformParamDTO;
|
|
|
import com.persagy.apm.energy.report.common.service.CommonService;
|
|
@@ -10,7 +11,9 @@ import com.persagy.apm.energy.report.environment.model.dto.QueryEnvListByParamDT
|
|
|
import com.persagy.apm.energy.report.environment.model.vo.EnvAvgRateVO;
|
|
|
import com.persagy.apm.energy.report.environment.service.IEnvironmentWebService;
|
|
|
import com.persagy.apm.energy.report.monthly.detail.business.model.Platform;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
@@ -22,7 +25,7 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class IEnvironmentWebServiceImpl implements IEnvironmentWebService {
|
|
|
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private EnvironmentWebClientWrapper environmentWebClientWrapper;
|
|
|
@Resource
|
|
|
private CommonService commonService;
|
|
@@ -33,7 +36,7 @@ public class IEnvironmentWebServiceImpl implements IEnvironmentWebService {
|
|
|
Date reportDate = queryPjPlatformParamDTO.getReportDate();
|
|
|
Date startDate = DateUtils.getFirstDayOfYear(reportDate);
|
|
|
while (startDate.before(DateUtils.getMonthOff(reportDate, 1))) {
|
|
|
- date_rateMap.put(startDate, getEnvAvgRate(queryPjPlatformParamDTO.getProjectId(), reportDate));
|
|
|
+ date_rateMap.put(startDate, getEnvAvgRate(queryPjPlatformParamDTO.getProjectId(), startDate));
|
|
|
startDate = DateUtils.getMonthOff(startDate, 1);
|
|
|
}
|
|
|
List<Double> monthlySummaries = date_rateMap.values().stream().collect(Collectors.toList());
|
|
@@ -45,14 +48,17 @@ public class IEnvironmentWebServiceImpl implements IEnvironmentWebService {
|
|
|
try {
|
|
|
QueryEnvListByParamDTO paramDTO = new QueryEnvListByParamDTO();
|
|
|
paramDTO.setProjectId(pjId);
|
|
|
- paramDTO.setEnvTypeId("Temp");
|
|
|
- paramDTO.setEnvParentTypeId("Humiture");
|
|
|
+ paramDTO.setEnvTypeId(DataConstants.ENV_TYPE_ID);
|
|
|
+ paramDTO.setEnvParentTypeId(DataConstants.ENV_PARENT_TYPE_ID);
|
|
|
paramDTO.setStartTime(DateUtils.date2Str(reportDate, DateUtils.SDF_SECOND));
|
|
|
paramDTO.setEndTime(DateUtils.date2Str(DateUtils.getMonthOff(reportDate, 1), DateUtils.SDF_SECOND));
|
|
|
PoemsFeignResponse<EnvAvgRateVO> response = environmentWebClientWrapper.listWorkOrderByParam(paramDTO);
|
|
|
- EnvAvgRateVO envAvgRateVO = (EnvAvgRateVO) response.getContent();
|
|
|
- if (null != envAvgRateVO) {
|
|
|
- return envAvgRateVO.getAvgNum();
|
|
|
+ List<EnvAvgRateVO> envAvgRateVOList = response.getContent();
|
|
|
+ if (!CollectionUtils.isEmpty(envAvgRateVOList)) {
|
|
|
+ EnvAvgRateVO envAvgRateVO = envAvgRateVOList.get(0);
|
|
|
+ if (null != envAvgRateVO) {
|
|
|
+ return envAvgRateVO.getAvgNum();
|
|
|
+ }
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|