|
@@ -3,6 +3,7 @@ package com.persagy.apm.energy.report.saasweb.service.impl;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.persagy.apm.common.model.dto.PoemsFeignBaseDTO;
|
|
|
import com.persagy.apm.common.response.PoemsFeignResponse;
|
|
|
+import com.persagy.apm.energy.report.common.utils.DateUtils;
|
|
|
import com.persagy.apm.energy.report.saasweb.model.ConvertSaasWebTool;
|
|
|
import com.persagy.apm.energy.report.saasweb.model.dto.QueryByProjectIdDTO;
|
|
|
import com.persagy.apm.energy.report.saasweb.model.dto.QueryPartitionDTO;
|
|
@@ -10,6 +11,7 @@ import com.persagy.apm.energy.report.saasweb.model.dto.QueryProjectDTO;
|
|
|
import com.persagy.apm.energy.report.saasweb.model.vo.*;
|
|
|
import com.persagy.apm.energy.report.saasweb.service.ISaasWebService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.assertj.core.util.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -26,6 +28,7 @@ import java.util.stream.Collectors;
|
|
|
**/
|
|
|
@Api(value = "运维平台service实现类")
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
@Autowired
|
|
|
SaasWebClientWrapper saasWebClientWrapper;
|
|
@@ -528,4 +531,28 @@ public class SaasWebServiceImpl implements ISaasWebService {
|
|
|
}
|
|
|
return result.doubleValue();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<String> getComparableProjects(List<String> projectIds, Date month) {
|
|
|
+ if (CollectionUtils.isEmpty(projectIds)) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
+ List<String> result = new ArrayList<>();
|
|
|
+ for (String projectId : projectIds) {
|
|
|
+ SimpleProjectVO simpleProjectInfo = getSimpleProjectInfo(projectId);
|
|
|
+ String businessOpeningTime = simpleProjectInfo.getBusinessOpeningTime();
|
|
|
+ try {
|
|
|
+ Date openDate = DateUtils.str2Date(businessOpeningTime, DateUtils.SDFSECOND);
|
|
|
+ Date firstDayOfLastYear = DateUtils.getFirstDayOfLastYear(month);
|
|
|
+ // 如果开业时间早于去年,添加到结果集
|
|
|
+ if (DateUtils.compareDate(openDate, firstDayOfLastYear)) {
|
|
|
+ result.add(projectId);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("时间转换异常", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|