Browse Source

数据维度

dev_shibei_match
wangchao 5 years ago
parent
commit
1faecb4f6c
  1. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java
  2. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java
  3. 39
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java
  4. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ModuleConstant.java
  6. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicStatusAgencyMonthlyDao.xml
  7. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java

@ -2,6 +2,7 @@ package com.epmet.service.impl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.ProjectConstant;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.stats.DimTopicStatusDTO;
import com.epmet.dto.stats.topic.result.TopicStatisticalData;
@ -12,6 +13,8 @@ import com.epmet.service.stats.DimTopicStatusService;
import com.epmet.service.stats.topic.TopicStatisticalService;
import com.epmet.service.topic.TopicService;
import com.epmet.util.DimIdGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -27,6 +30,8 @@ import java.util.*;
@Service
public class StatsTopicServiceImpl implements StatsTopicService {
protected static final Logger log = LoggerFactory.getLogger(StatsTopicServiceImpl.class);
@Autowired
private DimCustomerService dimCustomerService;
@ -80,10 +85,14 @@ public class StatsTopicServiceImpl implements StatsTopicService {
List<AgencySubTreeDto> agencies = dimAgencyService.getAllAgency(customerId);
//5.计算统计数据
TopicStatisticalData data =
topicService.compute(agencies,date,timeDimension,customerId,topicStatusDimension);
try {
TopicStatisticalData data =
topicService.compute(agencies, date, timeDimension, customerId, topicStatusDimension);
//6.生成唯一性统计数据
topicStatisticalService.insertUniquely(data);
}catch(Exception e){
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "topicStats", customerId, new Date().toString(), e.getMessage()));
}
//6.生成唯一性统计数据
topicStatisticalService.insertUniquely(data);
}
}

21
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java

@ -2,6 +2,7 @@ package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.ProjectConstant;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.stats.user.result.UserStatisticalData;
import com.epmet.service.StatsUserService;
@ -10,6 +11,8 @@ import com.epmet.service.stats.DimCustomerService;
import com.epmet.service.stats.user.UserStatisticalService;
import com.epmet.service.user.UserService;
import com.epmet.util.DimIdGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -28,6 +31,8 @@ import java.util.List;
@Service
public class StatsUserServiceImpl implements StatsUserService {
protected static final Logger log = LoggerFactory.getLogger(StatsUserServiceImpl.class);
@Autowired
private DimCustomerService dimCustomerService;
@ -75,11 +80,19 @@ public class StatsUserServiceImpl implements StatsUserService {
//List<AgencySubTreeDto> topAgencies = dimAgencyService.getTopAgency(customerId);
//4.计算机关统计数据、生成唯一性统计数据
UserStatisticalData agencyData = userService.traverseAgencyUser(agencies,date,timeDimension);
userStatisticalService.insertUniquely(agencyData);
try {
UserStatisticalData agencyData = userService.traverseAgencyUser(agencies, date, timeDimension);
userStatisticalService.insertUniquely(agencyData);
}catch(Exception e){
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyUserStats", customerId, new Date().toString(), e.getMessage()));
}
//5.计算网格统计数据、生成唯一性统计数据
UserStatisticalData gridData = userService.traverseGridUser(agencies,date,timeDimension);
userStatisticalService.insertUniquely(gridData);
try {
UserStatisticalData gridData = userService.traverseGridUser(agencies, date, timeDimension);
userStatisticalService.insertUniquely(gridData);
}catch(Exception e){
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "gridUserStats", customerId, new Date().toString(), e.getMessage()));
}
}
}

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

@ -360,37 +360,38 @@ public class TopicServiceImpl implements TopicService {
List<ResiGroupTopicResultDTO> groups = gridGroupMap.get(gridId);
groups.forEach(group -> {
if(null != group && StringUtils.isNotBlank(group.getGroupId())){
if(null != groups) {
groups.forEach(group -> {
if (null != group && StringUtils.isNotBlank(group.getGroupId())) {
issueAgencyM.setIssueIncr(issueAgencyM.getIssueIncr() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueIncr());
issueAgencyM.setIssueTotal(issueAgencyM.getIssueTotal() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueTotal());
issueAgencyM.setIssueIncr(issueAgencyM.getIssueIncr() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueIncr());
issueAgencyM.setIssueTotal(issueAgencyM.getIssueTotal() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueTotal());
issueGridM.setIssueIncr(issueGridM.getIssueIncr() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueIncr());
issueGridM.setIssueTotal(issueGridM.getIssueTotal() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueTotal());
issueGridM.setIssueIncr(issueGridM.getIssueIncr() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueIncr());
issueGridM.setIssueTotal(issueGridM.getIssueTotal() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueTotal());
GroupTopicData data = groupTopicData.get(group.getGroupId());
if(null != data){
GroupTopicData data = groupTopicData.get(group.getGroupId());
if (null != data) {
topicAgencyM_discussing.setTopicCount(topicAgencyM_discussing.getTopicCount() + data.getDiscussingTotal());
topicAgencyM_discussing.setTopicIncr(topicAgencyM_discussing.getTopicIncr() + data.getDiscussingIncr());
topicAgencyM_discussing.setTopicCount(topicAgencyM_discussing.getTopicCount() + data.getDiscussingTotal());
topicAgencyM_discussing.setTopicIncr(topicAgencyM_discussing.getTopicIncr() + data.getDiscussingIncr());
topicAgencyM_hidden.setTopicCount(topicAgencyM_hidden.getTopicCount() + data.getHiddenTotal());
topicAgencyM_hidden.setTopicIncr(topicAgencyM_hidden.getTopicIncr() + data.getHiddenIncr());
topicAgencyM_hidden.setTopicCount(topicAgencyM_hidden.getTopicCount() + data.getHiddenTotal());
topicAgencyM_hidden.setTopicIncr(topicAgencyM_hidden.getTopicIncr() + data.getHiddenIncr());
topicAgencyM_closed.setTopicCount(topicAgencyM_closed.getTopicCount() + data.getClosedTotal());
topicAgencyM_closed.setTopicIncr(topicAgencyM_closed.getTopicIncr() + data.getClosedIncr());
topicAgencyM_closed.setTopicCount(topicAgencyM_closed.getTopicCount() + data.getClosedTotal());
topicAgencyM_closed.setTopicIncr(topicAgencyM_closed.getTopicIncr() + data.getClosedIncr());
}
}
}
}
});
});
}
if(!gridDistinct.get(gridId)) {
setGridMonthlyDataPacket(dataPacket, issueGridM);
}
@ -446,7 +447,7 @@ public class TopicServiceImpl implements TopicService {
}else{
for (ResiTopicResultDTO topic : group.getTopics()) {
if(StringUtils.isBlank(topic.getTopicId())) continue;
if (StringUtils.equals(NumConstant.ONE_STR, topic.getIncrFlag())) {
groupTopicData.setTopicIncr(groupTopicData.getTopicIncr() + NumConstant.ONE);
}

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java

@ -338,6 +338,14 @@ public class UserServiceImpl implements UserService {
regAgencyM.setPartymemberProportion(regAgencyD.getPartymemberProportion());
regAgencyM.setWarmHeartedProportion(regAgencyD.getWarmHeartedProportion());
regAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT);
if(null == dataPacket.getRegAgencyMonthlyList()){
List<FactRegUserAgencyMonthlyDTO> list = new LinkedList<>();
list.add(regAgencyM);
dataPacket.setRegAgencyMonthlyList(list);
}else{
dataPacket.getRegAgencyMonthlyList().add(regAgencyM);
}
FactParticipationUserAgencyMonthlyDTO partiAgencyM = new FactParticipationUserAgencyMonthlyDTO();
partiAgencyM.setCustomerId(customerId);
@ -356,7 +364,13 @@ public class UserServiceImpl implements UserService {
partiAgencyM.setPartymemberProportion(partiAgencyD.getPartymemberProportion());
partiAgencyM.setWarmHeartedProportion(partiAgencyD.getWarmHeartedProportion());
partiAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT);
if(null == dataPacket.getPartiAgencyMonthlyList()){
List<FactParticipationUserAgencyMonthlyDTO> list = new LinkedList<>();
list.add(partiAgencyM);
dataPacket.setPartiAgencyMonthlyList(list);
}else{
dataPacket.getPartiAgencyMonthlyList().add(partiAgencyM);
}
}
@ -521,6 +535,7 @@ public class UserServiceImpl implements UserService {
FactParticipationUserGridMonthlyDTO partiGridM = new FactParticipationUserGridMonthlyDTO();
partiGridM.setCustomerId(customerId);
partiGridM.setAgencyId(agencyId);
partiGridM.setGridId(gridId);
partiGridM.setMonthId(timeDimension.getMonthId());
partiGridM.setQuarterId(timeDimension.getQuarterId());
partiGridM.setYearId(timeDimension.getYearId());

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ModuleConstant.java

@ -30,5 +30,5 @@ public interface ModuleConstant {
/**
* 统计机器人
* */
String CREATED_BY_STATISTICAL_ROBOT = "statisticalRobot";
String CREATED_BY_STATISTICAL_ROBOT = "STATISTICAL_ROBOT";
}

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicStatusAgencyMonthlyDao.xml

@ -60,7 +60,7 @@
#{item.topicProportion},
#{item.topicIncrement},
#{item.topicIncr},
#{item.createdBy},

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml

@ -109,6 +109,7 @@
date_format(CREATED_TIME,'%Y-%m-%d') AS createdTime
FROM RESI_TOPIC_OPERATION operation
WHERE operation.DEL_FLAG = '0'
AND
CREATED_TIME <![CDATA[>=]]> #{startDate} AND CREATED_TIME <![CDATA[<]]> DATE_SUB( #{endDate}, INTERVAL - 1 DAY)
order by TOPIC_ID

Loading…
Cancel
Save