Browse Source

Merge branch 'dev_data_stats' into dev

dev_shibei_match
sunyuchao 5 years ago
parent
commit
dba8910e97
  1. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/constant/ProjectConstant.java
  2. 22
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
  3. 15
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java
  4. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/constant/ProjectConstant.java

@ -8,6 +8,8 @@ public interface ProjectConstant {
String DAY = "day";
String MONTH = "month";
String PENDING = "处理中";
String CLOSED = "已结案";
/**
* 根据Token获取组织信息失败

22
epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java

@ -3,6 +3,7 @@ package com.epmet.service.project.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dao.project.ProjectDao;
import com.epmet.dto.form.LoginUserDetailsFormDTO;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
@ -20,6 +21,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -54,6 +56,15 @@ public class ProjectServiceImpl implements ProjectService {
//将小数转成百分比
resultDTO.setPendingRatio(percent.format(pendingRatio.doubleValue()));
resultDTO.setClosedRatio(percent.format(resultDTO.getClosedRatioInt().setScale(4, RoundingMode.HALF_UP).doubleValue()));
} else {
resultDTO.setAgencyId(agencyId);
Date date = DateUtils.getBeforeDay(new Date());
resultDTO.setDateName(DateUtils.format(date, "yyyy.MM.dd"));
resultDTO.setProjectTotal(NumConstant.ZERO);
resultDTO.setPendingTotal(NumConstant.ZERO);
resultDTO.setPendingRatio("0%");
resultDTO.setClosedTotal(NumConstant.ZERO);
resultDTO.setClosedRatio("0%");
}
return resultDTO;
}
@ -78,6 +89,17 @@ public class ProjectServiceImpl implements ProjectService {
//先四舍五入保留四位小数再把小数转成百分比
sum.setRatio(percent.format(sum.getRatioInt().setScale(4, RoundingMode.HALF_UP).doubleValue()));
});
} else {
ProjectSummaryInfoResultDTO pending = new ProjectSummaryInfoResultDTO();
pending.setName(ProjectConstant.PENDING);
pending.setValue(NumConstant.ZERO);
pending.setRatio("0%");
resultList.add(pending);
ProjectSummaryInfoResultDTO closed = new ProjectSummaryInfoResultDTO();
closed.setName(ProjectConstant.CLOSED);
closed.setValue(NumConstant.ZERO);
closed.setRatio("0%");
resultList.add(closed);
}
return resultList;
}

15
epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java

@ -56,7 +56,20 @@ public class PublicityServiceImpl implements PublicityService {
@Override
public FactPublishedAgencyDailyDTO summaryInfo(TokenDto tokenDto) {
String agencyId = this.getLoginUserDetails(tokenDto);
return publicityDao.summaryInfo(agencyId);
FactPublishedAgencyDailyDTO factPublishedAgencyDailyDTO = publicityDao.summaryInfo(agencyId);
if (null == factPublishedAgencyDailyDTO) {
factPublishedAgencyDailyDTO = new FactPublishedAgencyDailyDTO();
Date dateFact = DateUtils.addDateDays(new Date(), -1);
String strDate = DateUtils.format(dateFact, DateUtils.DATE_PATTERN_YYYYMMDD);
String yearId = strDate.substring(0, 4);
String monthId = strDate.substring(5, 6);
String dayId = strDate.substring(7, 8);
factPublishedAgencyDailyDTO.setPublishedTotal(0);
factPublishedAgencyDailyDTO.setPublishingTotal(0);
factPublishedAgencyDailyDTO.setDateName(yearId + "." + monthId + "." + dayId);
}
return factPublishedAgencyDailyDTO;
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java

@ -347,7 +347,7 @@ public class TopicServiceImpl implements TopicService {
gridDistinct.put(k,false);
});
List<ResiGroupTopicResultDTO> topicsBetweenTimeRange = topicDao.selectGroupOrderByGridBetweenTimeRange(calendar.getTime(),targetDate,dataPacket.getCustomerId());
List<ResiGroupTopicResultDTO> topicsBetweenTimeRange = topicDao.selectGroupOrderByGridBetweenTimeRange(calendar.getTime(),targetDateCheck,dataPacket.getCustomerId());
Map<String,List<ResiGroupTopicResultDTO>> GridGroupMapBetweenTimeRange =
topicsBetweenTimeRange.stream().collect(Collectors.groupingBy(ResiGroupTopicResultDTO::getGridId));
List<ResiGroupTopicResultDTO> groupListBetweenTimeRange = new LinkedList<>();
@ -357,7 +357,7 @@ public class TopicServiceImpl implements TopicService {
groupListBetweenTimeRange.addAll(entryBetweenTimeRange.getValue());
}
List<ResiTopicOperationResultDTO> operationsBetweenTimeRange =
topicDao.selectTopicOperationRecordBetweenTimeRange(calendar.getTime(),targetDate);
topicDao.selectTopicOperationRecordBetweenTimeRange(calendar.getTime(),targetDateCheck);
Map<String,List<ResiTopicOperationResultDTO>> topicOperationMapBetweenTimeRange =
operationsBetweenTimeRange.stream().collect(Collectors.groupingBy(ResiTopicOperationResultDTO::getTopicId));
@ -1127,7 +1127,7 @@ public class TopicServiceImpl implements TopicService {
gridDistinct.put(k,false);
});
List<ResiGroupTopicResultDTO> topicsBetweenTimeRange = topicDao.selectGroupOrderByGridBetweenTimeRange(calendar.getTime(),targetDate,dataPacket.getCustomerId());
List<ResiGroupTopicResultDTO> topicsBetweenTimeRange = topicDao.selectGroupOrderByGridBetweenTimeRange(calendar.getTime(),targetDateCheck,dataPacket.getCustomerId());
//key : gridId
Map<String,List<ResiGroupTopicResultDTO>> GridGroupMapBetweenTimeRange =
topicsBetweenTimeRange.stream().collect(Collectors.groupingBy(ResiGroupTopicResultDTO::getGridId));

Loading…
Cancel
Save