diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml
index 354c47f3ea..2d4f57c3b7 100644
--- a/epmet-gateway/pom.xml
+++ b/epmet-gateway/pom.xml
@@ -120,6 +120,7 @@
lb://epmet-activiti-server
lb://epmet-job-server
+
lb://epmet-user-server
@@ -180,7 +181,7 @@
lb://data-statistical-server
-
+
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
index 045fca9844..dffd25d035 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
@@ -5,6 +5,9 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.Date;
/**
* desc: 数据统计 对外feign client
@@ -13,6 +16,7 @@ import org.springframework.web.bind.annotation.PostMapping;
* @date: 2020/6/22 17:39
* @author: jianjun liu
*/
+//url="http://localhost:8108"
@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = DataStatisticalOpenFeignClientFallBack.class)
public interface DataStatisticalOpenFeignClient {
@@ -136,4 +140,24 @@ public interface DataStatisticalOpenFeignClient {
@PostMapping("/data/stats/dim/all/init")
Result initAllDims();
+ /**
+ * @Description 执行用户统计
+ * @param
+ * @return
+ * @author wangc
+ * @date 2020.06.29 09:26
+ **/
+ @PostMapping("/data/stats/statsuser/execute")
+ Result execUserStatistical(@RequestParam(value = "date",required = false) String date);
+
+ /**
+ * @Description 执行话题统计
+ * @param
+ * @return
+ * @author wangc
+ * @date 2020.06.29 09:27
+ **/
+ @PostMapping("/data/stats/statstopic/execute")
+ Result execTopicStatistical(@RequestParam(value = "date",required = false) String date);
+
}
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
index 3a6c7e34c3..a15b468fdc 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
@@ -6,6 +6,9 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
/**
* desc:
*
@@ -137,4 +140,28 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result initAllDims() {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "initAllDims");
}
+
+ /**
+ * @Description 执行用户统计
+ * @param
+ * @return
+ * @author wangc
+ * @date 2020.06.29 09:26
+ **/
+ @Override
+ public Result execUserStatistical(String date) {
+ return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "execUserStatistical",date);
+ }
+
+ /**
+ * @Description 执行话题统计
+ * @param
+ * @return
+ * @author wangc
+ * @date 2020.06.29 09:27
+ **/
+ @Override
+ public Result execTopicStatistical(String date) {
+ return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "execTopicStatistical",date);
+ }
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsTopicService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsTopicService.java
index 847a7d9923..9e653812d3 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsTopicService.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsTopicService.java
@@ -2,7 +2,20 @@ package com.epmet.service;
import java.util.Date;
+/**
+ * @Description 话题统计Service接口
+ * @ClassName StatsTopicService
+ * @Auth wangc
+ * @Date 2020-06-23 15:22
+ */
public interface StatsTopicService {
+ /**
+ * @Description 分区统计,按照客户Id划分
+ * @param date 如果目标日期为空,则自动计算为T-1天
+ * @return
+ * @author wangc
+ * @date 2020.06.28 14:38
+ **/
void partition(Date date);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java
index 7e98b2178f..6bf55f86ec 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java
@@ -2,7 +2,19 @@ package com.epmet.service;
import java.util.Date;
+/**
+ * @author wangc
+ * @dscription
+ * @date 2020/6/17 16:51
+ */
public interface StatsUserService {
+ /**
+ * @Description 分区统计,按照客户Id划分
+ * @param date 如果目标日期为空,则自动计算为T-1天
+ * @return
+ * @author wangc
+ * @date 2020.06.28 14:38
+ **/
void partition(Date date);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
index 7eba9840e7..8fc87943da 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
@@ -129,6 +129,13 @@ public class StatsGroupServiceImpl implements StatsGroupService {
factGroupAgencyMonthlyService.insertAgencyGroupMonthly(lastDayAgency);
}
+ /**
+ * @Description 网格小组 【机关-日】 数据统计处理
+ * @param customerAgencyInfos
+ * @param timeDim
+ * @param customerId
+ * @author zxc
+ */
public List getAgencyGroupDaily(List customerAgencyInfos, DimIdGenerator.DimIdBean timeDim,String customerId){
if (customerAgencyInfos.size() == NumConstant.ZERO){
return new ArrayList<>();
@@ -143,10 +150,10 @@ public class StatsGroupServiceImpl implements StatsGroupService {
agencyResult.setCustomerId(customerId);
BeanUtils.copyProperties(timeDim,agencyResult);
//机关下的所有网格(包括直属网格)
- List allGrid = this.getAllGrid(agencyId);
+ List allGrid = this.getAllGrid(agencyId,customerId);
String pidByAgencyId = dimAgencyService.getPidByAgencyId(agencyId);
agencyResult.setPid(StringUtils.isBlank(pidByAgencyId)?"0":pidByAgencyId);
- // TODO 1. 机关下有多少网格
+ // 1. 机关下有多少网格
List customerGridIdList = customerGridService.getCustomerGridIdList(customerId, dateId);
AtomicReference gridSize = new AtomicReference<>(0);
if (customerGridIdList.size() != NumConstant.ZERO){
@@ -161,22 +168,19 @@ public class StatsGroupServiceImpl implements StatsGroupService {
}else {
agencyResult.setGridTotal(NumConstant.ZERO);
}
-
- // TODO 2. 机关下有多少小组,只算 state = ‘approved’
+ // 2. 机关下有多少小组,只算 state = ‘approved’
List agencyGroupTotalCount = groupDataService.getAgencyGroupTotalCount(allGrid,dateId);
Integer groupCount = agencyGroupTotalCount.stream().collect(Collectors.summingInt(AgencyGroupTotalCountResultDTO::getGridGroupCount));
agencyResult.setGroupTotalCount(groupCount);
- // TODO 3. 机关下所有组内人数和(不需要去重) 人员状态 != "removed"
+ // 3. 机关下所有组内人数和(不需要去重) 人员状态 != "removed"
List agencyGridGroupPeopleTotal = groupDataService.selectAgencyGridGroupPeopleTotal(allGrid,dateId);
Integer groupPeopleCount = agencyGridGroupPeopleTotal.stream().collect(Collectors.summingInt(AgencyGridGroupPeopleTotalResultDTO::getGridGroupPeopleTotal));
agencyResult.setGroupMemberTotalCount(groupPeopleCount);
-
- // TODO 4. 机关下小组平均人数
+ // 4. 机关下小组平均人数
agencyResult.setGroupMemberAvgCount(
agencyResult.getGroupTotalCount() == NumConstant.ZERO ? NumConstant.ZERO :
agencyResult.getGroupMemberTotalCount()/agencyResult.getGroupTotalCount());
-
- // TODO 5. 机关下小组人数中位数 小组最大(小)成员数、最多(少)成员小组ID
+ // 5. 机关下小组人数中位数 小组最大(小)成员数、最多(少)成员小组ID
List agencyGridGroupPeople = groupDataService.selectAgencyEveryGroupPeopleCount(allGrid,dateId);
List sorted = agencyGridGroupPeople.stream().sorted(Comparator.comparing(AgencyGridGroupPeopleResultDTO::getGroupCount).reversed()).collect(Collectors.toList());
Integer groupPeopleMedian;
@@ -190,13 +194,12 @@ public class StatsGroupServiceImpl implements StatsGroupService {
(sorted.get(sorted.size() / NumConstant.TWO - NumConstant.ONE).getGroupCount() + sorted.get(sorted.size() / 2).getGroupCount()) / 2 :
sorted.get(sorted.size() / NumConstant.TWO).getGroupCount();
agencyResult.setGroupMedian(groupPeopleMedian);
-
agencyResult.setGroupMemberMaxCount(sorted.get(NumConstant.ZERO).getGroupCount());
agencyResult.setMaxMemberGroupId(sorted.get(NumConstant.ZERO).getGroupId());
agencyResult.setGroupMemberMinCount(sorted.get(sorted.size() - NumConstant.ONE).getGroupCount());
agencyResult.setMinMemberGroupId(sorted.get(sorted.size() - NumConstant.ONE).getGroupId());
}
- // TODO 6. 机关下小组增量
+ // 6. 机关下小组增量
List agencyGroupIncr = groupDataService.selectAgencyGroupIncr(allGrid, dateId);
Integer groupIncr = agencyGroupIncr.stream().collect(Collectors.summingInt(AgencyGroupIncrResultDTO::getGroupIncr));
agencyResult.setGroupIncr(groupIncr);
@@ -210,9 +213,9 @@ public class StatsGroupServiceImpl implements StatsGroupService {
* @param agencyId
* @author zxc
*/
- public List getAllGrid(String agencyId){
+ public List getAllGrid(String agencyId,String customerId){
List result = new ArrayList<>();
- List allAgency = dimAgencyService.getAllAgency(null);
+ List allAgency = dimAgencyService.getAllAgency(customerId);
Map> subGridOfAgency = new HashMap<>();
allAgency.forEach(agency -> {
@@ -237,7 +240,6 @@ public class StatsGroupServiceImpl implements StatsGroupService {
* @author zxc
*/
void initAgencyGridMap(String pid, AgencySubTreeDto agency, Map> subGridOfAgency){
-
//向map中放入数据
if(subGridOfAgency.containsKey(pid)){
//包含key
@@ -254,13 +256,10 @@ public class StatsGroupServiceImpl implements StatsGroupService {
Set grids = new HashSet<>(agency.getGridIds());
subGridOfAgency.put(pid,grids);
}
-
//定义递归出口
if(StringUtils.equals(ModuleConstant.AGENCY_LEVEL_COMMUNITY,agency.getLevel()) || null == agency.getSubAgencies() || agency.getSubAgencies().size() == NumConstant.ZERO){
return ;
}
-
-
//定义递归入口
agency.getSubAgencies().forEach(obj -> {
initAgencyGridMap(pid,obj,subGridOfAgency);
@@ -285,8 +284,4 @@ public class StatsGroupServiceImpl implements StatsGroupService {
return DimIdGenerator.getDimIdBean(result);
}
- public List getAgencyAllGrid(String customerId,String agencyId){
-
- return null;
- }
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java
index be7340eec0..911281919b 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java
@@ -13,6 +13,7 @@ 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 com.epmet.util.ModuleConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -22,7 +23,7 @@ import org.springframework.util.CollectionUtils;
import java.util.*;
/**
- * @Description
+ * @Description 话题统计Service
* @ClassName StatsTopicServiceImpl
* @Auth wangc
* @Date 2020-06-23 15:22
@@ -47,6 +48,13 @@ public class StatsTopicServiceImpl implements StatsTopicService {
@Autowired
private TopicStatisticalService topicStatisticalService;
+ /**
+ * @Description 分区统计,按照客户Id划分
+ * @param date 如果目标日期为空,则自动计算为T-1天
+ * @return
+ * @author wangc
+ * @date 2020.06.28 14:38
+ **/
@Override
public void partition(Date date) {
@@ -65,14 +73,22 @@ public class StatsTopicServiceImpl implements StatsTopicService {
}
+ /**
+ * @Description 生成话题统计数据
+ * @param customerId - 客户Id
+ * @parma date - 目标日期
+ * @return
+ * @author wangc
+ * @date 2020.06.28 14:50
+ **/
void generate(String customerId,Date date){
//1.初始化时间参数
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DATE, NumConstant.ONE_NEG);
- calendar.set(Calendar.HOUR_OF_DAY, 0);
- calendar.set(Calendar.MINUTE, 0);
- calendar.set(Calendar.SECOND, 0);
+ calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO);
+ calendar.set(Calendar.MINUTE, NumConstant.ZERO);
+ calendar.set(Calendar.SECOND, NumConstant.ZERO);
//2.初始化时间维度
DimIdGenerator.DimIdBean timeDimension = DimIdGenerator.getDimIdBean(null == date ? calendar.getTime() : date);
@@ -91,7 +107,7 @@ public class StatsTopicServiceImpl implements StatsTopicService {
//6.生成唯一性统计数据
topicStatisticalService.insertUniquely(data);
}catch(Exception e){
- log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "topicStats", customerId, date), e);
+ log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, ModuleConstant.EXCEPTION_DING_INTERCEPTOR_PREFIX_TOPIC_STATISTICAL, customerId, new Date().toString(), e.getMessage()));
}
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java
index e9c2a764ec..17fd8ccfc6 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java
@@ -11,6 +11,7 @@ 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 com.epmet.util.ModuleConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,6 +46,13 @@ public class StatsUserServiceImpl implements StatsUserService {
@Autowired
private UserStatisticalService userStatisticalService;
+ /**
+ * @Description 分区统计,按照客户Id划分
+ * @param date 如果目标日期为空,则自动计算为T-1天
+ * @return
+ * @author wangc
+ * @date 2020.06.28 14:38
+ **/
@Override
public void partition(Date date) {
int pageNo = NumConstant.ONE;
@@ -62,15 +70,23 @@ public class StatsUserServiceImpl implements StatsUserService {
}
+ /**
+ * @Description 生成用户统计数据
+ * @param customerId 客户Id
+ * @param date 目标日期
+ * @return
+ * @author wangc
+ * @date 2020.06.28 14:40
+ **/
void generate(String customerId,Date date){
//1.初始化时间参数
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
//获取当日的零点
calendar.add(Calendar.DATE, NumConstant.ONE_NEG);
- calendar.set(Calendar.HOUR_OF_DAY, 0);
- calendar.set(Calendar.MINUTE, 0);
- calendar.set(Calendar.SECOND, 0);
+ calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO);
+ calendar.set(Calendar.MINUTE, NumConstant.ZERO);
+ calendar.set(Calendar.SECOND, NumConstant.ZERO);
//2.初始化时间维度
DimIdGenerator.DimIdBean timeDimension = DimIdGenerator.getDimIdBean(null == date ? calendar.getTime() : date);
@@ -84,7 +100,7 @@ public class StatsUserServiceImpl implements StatsUserService {
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);
+ log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, ModuleConstant.EXCEPTION_DING_INTERCEPTOR_PREFIX_AGENCY_USER_STATISTICAL, customerId, new Date().toString(), e.getMessage()));
}
//5.计算网格统计数据、生成唯一性统计数据
@@ -92,7 +108,7 @@ public class StatsUserServiceImpl implements StatsUserService {
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);
+ log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, ModuleConstant.EXCEPTION_DING_INTERCEPTOR_PREFIX_GRID_USER_STATISTICAL, customerId, new Date().toString(), e.getMessage()));
}
}
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java
index 296d66ee22..999a90709e 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java
@@ -55,7 +55,7 @@ public class TopicServiceImpl implements TopicService {
@Override
public TopicStatisticalData compute(List agencies, Date targetDate, DimIdGenerator.DimIdBean timeDimension, String customerId, List statusDimension) {
if(null == agencies || agencies.size() == NumConstant.ZERO){
- logger.warn("没有相应的机关集合");
+ logger.warn(ModuleConstant.LOG_WARN_NO_AGENCY_MESSAGE);
return null;
}
@@ -74,6 +74,18 @@ public class TopicServiceImpl implements TopicService {
Map> gridGroupMap =
topics.stream().collect(Collectors.groupingBy(ResiGroupTopicResultDTO::getGridId));
+ agencies.forEach(agency -> {
+ if(null != agency.getGridIds() && agency.getGridIds().size() > NumConstant.ZERO){
+ agency.getGridIds().forEach(gridId -> {
+ if(!gridGroupMap.containsKey(gridId)){
+ gridGroupMap.put(gridId,null);
+ }
+ });
+
+ }
+
+ });
+
return calculateAndSummarizeTopicStatisticalData(subGridOfAgency,agencies,gridGroupMap,targetDate,statusDimension,timeDimension,customerId);
}
@@ -166,19 +178,19 @@ public class TopicServiceImpl implements TopicService {
* @date 2020.06.22 13:45
**/
void analyzeTopic(Map> subGridOfAgency, List agencies, Map> gridGroupMap, Map> topicOperationMap, Date targetDate, TopicStatisticalData dataPacket, List statusDimension, DimIdGenerator.DimIdBean timeDimension){
- Boolean isMonthEnd = false;
+ //Boolean isMonthEnd = false;
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
- //前一天
+ //前一天零点
calendar.add(Calendar.DATE, NumConstant.ONE_NEG);
+ calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO);
+ calendar.set(Calendar.MINUTE, NumConstant.ZERO);
+ calendar.set(Calendar.SECOND, NumConstant.ZERO);
Date targetDateCheck = null == targetDate ? calendar.getTime() : targetDate;
calendar.setTime(targetDateCheck);
//如果目标日期是当月的最后一天
-
-
-
- if(calendar.get(Calendar.DATE) == calendar.getActualMaximum(Calendar.DAY_OF_MONTH)){
+ //if(calendar.get(Calendar.DATE) == calendar.getActualMaximum(Calendar.DAY_OF_MONTH)){
//求出这个月的第一天
calendar.setTime(new Date());
calendar.set(Calendar.DAY_OF_MONTH, NumConstant.ONE);
@@ -186,8 +198,8 @@ public class TopicServiceImpl implements TopicService {
calendar.set(Calendar.MINUTE, NumConstant.ZERO);
calendar.set(Calendar.SECOND, NumConstant.ZERO);
- isMonthEnd = true;
- }
+ // isMonthEnd = true;
+ //}
//计算百分比使用,保留小数点后两位
NumberFormat numberFormat = NumberFormat.getInstance();
@@ -231,6 +243,9 @@ public class TopicServiceImpl implements TopicService {
if(null != entry.getValue() && entry.getValue().size() > NumConstant.ZERO){
entry.getValue().forEach(gridId -> {
+
+
+
FactTopicIssueGridDailyDTO issueGridD = new FactTopicIssueGridDailyDTO();
FactTopicStatusGridDailyDTO topicGridD_discussing = new FactTopicStatusGridDailyDTO();
FactTopicStatusGridDailyDTO topicGridD_hidden = new FactTopicStatusGridDailyDTO();
@@ -305,6 +320,8 @@ public class TopicServiceImpl implements TopicService {
if(!gridDistinct.get(gridId)) {
setGridDailyDataPacket(dataPacket, issueGridD, totalGirdD, topicGridD_discussing, topicGridD_hidden, topicGridD_closed);
}
+
+
gridDistinct.put(gridId,true);
});
//机关-百分比
@@ -318,13 +335,13 @@ public class TopicServiceImpl implements TopicService {
- if(isMonthEnd){
+ // if(isMonthEnd){
gridDistinct.forEach((k,v) -> {
gridDistinct.put(k,false);
});
- List topicsBetweenTimeRange = topicDao.selectGroupOrderByGridBetweenTimeRange(calendar.getTime(),targetDate,null);
+ List topicsBetweenTimeRange = topicDao.selectGroupOrderByGridBetweenTimeRange(calendar.getTime(),targetDate,dataPacket.getCustomerId());
Map> GridGroupMapBetweenTimeRange =
topicsBetweenTimeRange.stream().collect(Collectors.groupingBy(ResiGroupTopicResultDTO::getGridId));
List groupListBetweenTimeRange = new LinkedList<>();
@@ -355,8 +372,9 @@ public class TopicServiceImpl implements TopicService {
if(null != entry.getValue() && entry.getValue().size() > NumConstant.ZERO){
entry.getValue().forEach(gridId -> {
+
FactTopicIssueGridMonthlyDTO issueGridM = new FactTopicIssueGridMonthlyDTO();
- initGridMonthlyDTO(entry.getKey(),agencyMap.get(entry.getKey()).getCustomerId(),gridId,timeDimension,issueGridM);
+ initGridMonthlyDTO(entry.getKey(),gridId,agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,issueGridM);
List groups = gridGroupMap.get(gridId);
@@ -372,7 +390,7 @@ public class TopicServiceImpl implements TopicService {
issueGridM.setIssueTotal(issueGridM.getIssueTotal() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueTotal());
- GroupTopicData data = groupTopicData.get(group.getGroupId());
+ GroupTopicData data = groupTopicDataBetweenTimeRange.get(group.getGroupId());
if (null != data) {
@@ -392,9 +410,11 @@ public class TopicServiceImpl implements TopicService {
});
}
+
if(!gridDistinct.get(gridId)) {
setGridMonthlyDataPacket(dataPacket, issueGridM);
}
+
gridDistinct.put(gridId,true);
});
//机关-百分比
@@ -408,7 +428,7 @@ public class TopicServiceImpl implements TopicService {
- }
+ // }
}
@@ -431,10 +451,13 @@ public class TopicServiceImpl implements TopicService {
GroupTopicData groupTopicData = new GroupTopicData();
groupTopicData.setGroupId(group.getGroupId());
-
- groupTopicData.setTotal(group.getTopics().size());
-
if (null == group.getTopics() || group.getTopics().size() == NumConstant.ZERO) {
+ groupTopicData.setTotal(NumConstant.ZERO);
+ }else {
+ groupTopicData.setTotal(group.getTopics().size());
+ }
+
+ //if (null == group.getTopics() || group.getTopics().size() == NumConstant.ZERO) {
groupTopicData.setTopicIncr(NumConstant.ZERO);
groupTopicData.setHiddenTotal(NumConstant.ZERO);
groupTopicData.setHiddenIncr(NumConstant.ZERO);
@@ -444,7 +467,7 @@ public class TopicServiceImpl implements TopicService {
groupTopicData.setDiscussingTotal(NumConstant.ZERO);
groupTopicData.setDiscussingIncr(NumConstant.ZERO);
groupTopicData.setIssueTotal(NumConstant.ZERO);
- }else{
+ //}else{
for (ResiTopicResultDTO topic : group.getTopics()) {
if(StringUtils.isBlank(topic.getTopicId())) continue;
@@ -458,79 +481,53 @@ public class TopicServiceImpl implements TopicService {
}
Map> hiddenGroupByDate = operFlag ? operations.stream().filter(oper -> StringUtils.equals("hidden",oper.getStatus())).collect(Collectors.groupingBy(ResiTopicOperationResultDTO::getCreatedTime)) : null;
- Map> hiddenCancelledGroupByDate = operFlag ? operations.stream().filter(oper -> StringUtils.equals("hidden_cancelled",oper.getStatus())).collect(Collectors.groupingBy(ResiTopicOperationResultDTO::getCreatedTime)) : null;
+ //Map> hiddenCancelledGroupByDate = operFlag ? operations.stream().filter(oper -> StringUtils.equals("hidden_cancelled",oper.getStatus())).collect(Collectors.groupingBy(ResiTopicOperationResultDTO::getCreatedTime)) : null;
+ if(operFlag) {
+ //如果在同一天内被多次屏蔽,只计算一次
+ hiddenGroupByDate.forEach((k, v) -> {
+ if (null != v && v.size() > NumConstant.ZERO) {
+ groupTopicData.setHiddenIncr(groupTopicData.getHiddenIncr() + NumConstant.ONE);
+ }
+ });
+ //转议题,operations会根据daily与monthly维度不同而取值不同,当daily时,operations只有当天的操作日志,当monthly时,operations包含时间区间内的操作日志
+ if (operations.stream().filter(operation -> StringUtils.equals(operation.getStatus(), "shift_issue")).findAny().isPresent()) {
+ groupTopicData.setIssueIncr(groupTopicData.getIssueIncr() + NumConstant.ONE);
+ }
+ }
+
+ if (topic.isShiftIssue()) {
+ groupTopicData.setIssueTotal(groupTopicData.getIssueTotal() + NumConstant.ONE);
+ }
//对于话题,每个话题的操作记录中,【关闭】与【转议题】只会出现一次,而【屏蔽】与【取消屏蔽】会出现多次
switch (topic.getStatus()) {
case "hidden":
groupTopicData.setHiddenTotal(groupTopicData.getHiddenTotal() + NumConstant.ONE);
- if (operFlag) {
- //如果在同一天内被多次屏蔽,只计算一次
- hiddenGroupByDate.forEach((k, v) -> {
- if (null != v && v.size() > NumConstant.ZERO) {
- groupTopicData.setHiddenIncr(groupTopicData.getHiddenIncr() + NumConstant.ONE);
- }
- });
-
- for (ResiTopicOperationResultDTO operation : operations) {
- if (StringUtils.equals(operation.getStatus(), "shift_issue"))
- groupTopicData.setIssueIncr(groupTopicData.getIssueIncr() + NumConstant.ONE);
- }
- }
break;
case "closed":
-
groupTopicData.setClosedTotal(groupTopicData.getClosedTotal() + NumConstant.ONE);
if (operFlag) {
- for (ResiTopicOperationResultDTO operation : operations) {
- if (StringUtils.equals(operation.getStatus(), "closed"))
- groupTopicData.setClosedIncr(groupTopicData.getClosedIncr() + NumConstant.ONE);
- if (StringUtils.equals(operation.getStatus(), "shift_issue"))
- groupTopicData.setIssueIncr(groupTopicData.getIssueIncr() + NumConstant.ONE);
+ if (operations.stream().filter(operation -> StringUtils.equals(operation.getStatus(), "closed")).findAny().isPresent()) {
+ groupTopicData.setClosedIncr(groupTopicData.getClosedIncr() + NumConstant.ONE);
}
}
break;
case "discussing":
-
groupTopicData.setDiscussingTotal(groupTopicData.getDiscussingTotal() + NumConstant.ONE);
-
- Set dateRelease = new HashSet<>();
if(operFlag) {
- if (null != hiddenGroupByDate && hiddenGroupByDate.size() > NumConstant.ZERO){
- hiddenGroupByDate.forEach((k, v) -> {
- if (null != v && v.size() > NumConstant.ZERO) {
- if (null != hiddenCancelledGroupByDate.get(k) && hiddenCancelledGroupByDate.get(k).size() > NumConstant.ZERO) {
- if (hiddenCancelledGroupByDate.get(k).size() == v.size()) {
- groupTopicData.setDiscussingIncr(groupTopicData.getDiscussingIncr() + NumConstant.ONE);
- dateRelease.add(k);
- return; //相当于continue,循环下一个日期
- } else {
- //话题操作日志与话题状态不符
-
- }
- }
- }
- });
- }
-
-
- if (operations.stream().filter(operation -> StringUtils.equals(operation.getStatus(), "discussing") && !dateRelease.contains(operation.getCreatedTime())).findAny().isPresent()) {
+ //创建话题,operations会根据daily与monthly维度不同而取值不同,当daily时,operations只有当天的操作日志,当monthly时,operations包含时间区间内的操作日志
+ if (operations.stream().filter(operation -> StringUtils.equals(operation.getStatus(), "discussing")).findAny().isPresent()) {
groupTopicData.setDiscussingIncr(groupTopicData.getDiscussingIncr() + NumConstant.ONE);
}
- if (operations.stream().filter(operation -> StringUtils.equals(operation.getStatus(), "shift_issue")).findAny().isPresent()) {
- groupTopicData.setIssueIncr(groupTopicData.getIssueIncr() + NumConstant.ONE);
- }
}
break;
}
- if (topic.isShiftIssue()) {
- groupTopicData.setIssueTotal(groupTopicData.getIssueTotal() + NumConstant.ONE);
- }
+
}
- }
+ // }
groupTopicStatistical.put(group.getGroupId(), groupTopicData);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
index 2fca7b32fb..f7655f12a7 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
@@ -48,7 +48,7 @@ public class UserServiceImpl implements UserService {
@Override
public UserStatisticalData traverseAgencyUser(List agencies, Date targetDate, DimIdGenerator.DimIdBean timeDimension) {
if(null == agencies || agencies.size() == NumConstant.ZERO){
- logger.warn("没有相应的机关集合");
+ logger.warn(ModuleConstant.LOG_WARN_NO_AGENCY_MESSAGE);
return null;
}
@@ -90,7 +90,7 @@ public class UserServiceImpl implements UserService {
@Override
public UserStatisticalData traverseGridUser(List agencies, Date targetDate, DimIdGenerator.DimIdBean timeDimension) {
if(null == agencies || agencies.size() == NumConstant.ZERO){
- logger.warn("没有相应的机关集合");
+ logger.warn(ModuleConstant.LOG_WARN_NO_AGENCY_MESSAGE);
return null;
}
@@ -184,15 +184,15 @@ public class UserServiceImpl implements UserService {
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.SIX);
- Boolean isMonthEnd = false;
+ Boolean isMonthBeginning = true;
Calendar calendar =Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DATE, NumConstant.ONE_NEG);
Date targetDateCheck = null == targetDate ? calendar.getTime() : targetDate;
calendar.setTime(targetDateCheck);
- //如果目标日期是当月的最后一天
- if(calendar.get(Calendar.DATE) == calendar.getActualMaximum(Calendar.DAY_OF_MONTH)){
+ //如果目标日期不是是当月的第一天
+ if(calendar.get(Calendar.DATE) != calendar.getActualMinimum(Calendar.DAY_OF_MONTH)){
//求出这个月的第一天
calendar.setTime(new Date());
calendar.set(Calendar.DAY_OF_MONTH, NumConstant.ONE);
@@ -200,7 +200,7 @@ public class UserServiceImpl implements UserService {
calendar.set(Calendar.MINUTE, NumConstant.ZERO);
calendar.set(Calendar.SECOND, NumConstant.ZERO);
- isMonthEnd = true;
+ isMonthBeginning = false;
}
if(StringUtils.equals(ModuleConstant.DIM_SUB_AGENCY,relation)){
@@ -297,10 +297,68 @@ public class UserServiceImpl implements UserService {
}
- //月末处理
- if(isMonthEnd){
+
+ FactRegUserAgencyMonthlyDTO regAgencyM = new FactRegUserAgencyMonthlyDTO();
+ regAgencyM.setCustomerId(customerId);
+ regAgencyM.setAgencyId(agencyId);
+ regAgencyM.setMonthId(timeDimension.getMonthId());
+ regAgencyM.setQuarterId(timeDimension.getQuarterId());
+ regAgencyM.setYearId(timeDimension.getYearId());
+ regAgencyM.setRegTotal(regData.getTotal());
+ regAgencyM.setResiTotal(regData.getTotal());
+ regAgencyM.setWarmHeartedTotal(warmRegData.getTotal());
+ regAgencyM.setPartymemberTotal(partyRegData.getTotal());
+ regAgencyM.setRegIncr(regData.getIncr());
+ regAgencyM.setWarmIncr(warmRegData.getIncr());
+ regAgencyM.setPartymemberIncr(partiData.getIncr());
+ regAgencyM.setResiProportion(new BigDecimal(NumConstant.ONE));
+ regAgencyM.setPartymemberProportion(regAgencyD.getPartymemberProportion());
+ regAgencyM.setWarmHeartedProportion(regAgencyD.getWarmHeartedProportion());
+ regAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT);
+
+
+
+ FactParticipationUserAgencyMonthlyDTO partiAgencyM = new FactParticipationUserAgencyMonthlyDTO();
+ partiAgencyM.setCustomerId(customerId);
+ partiAgencyM.setAgencyId(agencyId);
+ partiAgencyM.setMonthId(timeDimension.getMonthId());
+ partiAgencyM.setQuarterId(timeDimension.getQuarterId());
+ partiAgencyM.setYearId(timeDimension.getYearId());
+ partiAgencyM.setRegTotal(partiData.getTotal());
+ partiAgencyM.setResiTotal(partiData.getTotal());
+ partiAgencyM.setWarmHeartedTotal(warmPartiData.getTotal());
+ partiAgencyM.setPartymemberTotal(partyPartiData.getTotal());
+ partiAgencyM.setRegIncr(partiData.getIncr());
+ partiAgencyM.setWarmIncr(warmPartiData.getIncr());
+ partiAgencyM.setPartymemberIncr(partyPartiData.getIncr());
+ partiAgencyM.setResiProportion(new BigDecimal(NumConstant.ONE));
+ partiAgencyM.setPartymemberProportion(partiAgencyD.getPartymemberProportion());
+ partiAgencyM.setWarmHeartedProportion(partiAgencyD.getWarmHeartedProportion());
+ partiAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT);
+
+
+
+ //如果是月初第一天,不再做日期区间查询
+ if(isMonthBeginning) {
+ if (null == dataPacket.getRegAgencyMonthlyList()) {
+ List list = new LinkedList<>();
+ list.add(regAgencyM);
+ dataPacket.setRegAgencyMonthlyList(list);
+ } else {
+ dataPacket.getRegAgencyMonthlyList().add(regAgencyM);
+ }
+ if (null == dataPacket.getPartiAgencyMonthlyList()) {
+ List list = new LinkedList<>();
+ list.add(partiAgencyM);
+ dataPacket.setPartiAgencyMonthlyList(list);
+ } else {
+ dataPacket.getPartiAgencyMonthlyList().add(partiAgencyM);
+ }
+ }else{
+ //如果不是月初第一天
+
//本月注册用户增长数
Integer regIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,calendar.getTime(),targetDateCheck);
//本月新增注册用户Id集合
@@ -321,23 +379,10 @@ public class UserServiceImpl implements UserService {
Integer incrWarmOfPartiMonthly = userDao.selectWarmIncrWithinTimeRange(incrPartiIdsMonthly,gridIds,calendar.getTime(),targetDateCheck);
- FactRegUserAgencyMonthlyDTO regAgencyM = new FactRegUserAgencyMonthlyDTO();
- regAgencyM.setCustomerId(customerId);
- regAgencyM.setAgencyId(agencyId);
- regAgencyM.setMonthId(timeDimension.getMonthId());
- regAgencyM.setQuarterId(timeDimension.getQuarterId());
- regAgencyM.setYearId(timeDimension.getYearId());
- regAgencyM.setRegTotal(regData.getTotal());
- regAgencyM.setResiTotal(regData.getTotal());
- regAgencyM.setWarmHeartedTotal(warmRegData.getTotal());
- regAgencyM.setPartymemberTotal(partyRegData.getTotal());
+
regAgencyM.setRegIncr(regIncrMonthly);
regAgencyM.setWarmIncr(incrWarmOfRegMonthly);
regAgencyM.setPartymemberIncr(incrPartyOfRegMonthly);
- regAgencyM.setResiProportion(new BigDecimal(NumConstant.ONE));
- regAgencyM.setPartymemberProportion(regAgencyD.getPartymemberProportion());
- regAgencyM.setWarmHeartedProportion(regAgencyD.getWarmHeartedProportion());
- regAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT);
if(null == dataPacket.getRegAgencyMonthlyList()){
List list = new LinkedList<>();
list.add(regAgencyM);
@@ -347,23 +392,10 @@ public class UserServiceImpl implements UserService {
}
- FactParticipationUserAgencyMonthlyDTO partiAgencyM = new FactParticipationUserAgencyMonthlyDTO();
- partiAgencyM.setCustomerId(customerId);
- partiAgencyM.setAgencyId(agencyId);
- partiAgencyM.setMonthId(timeDimension.getMonthId());
- partiAgencyM.setQuarterId(timeDimension.getQuarterId());
- partiAgencyM.setYearId(timeDimension.getYearId());
- partiAgencyM.setRegTotal(partiData.getTotal());
- partiAgencyM.setResiTotal(partiData.getTotal());
- partiAgencyM.setWarmHeartedTotal(warmPartiData.getTotal());
- partiAgencyM.setPartymemberTotal(partyPartiData.getTotal());
+
partiAgencyM.setRegIncr(partiIncrMonthly);
partiAgencyM.setWarmIncr(incrWarmOfPartiMonthly);
partiAgencyM.setPartymemberIncr(incrPartyOfPartiMonthly);
- partiAgencyM.setResiProportion(new BigDecimal(NumConstant.ONE));
- partiAgencyM.setPartymemberProportion(partiAgencyD.getPartymemberProportion());
- partiAgencyM.setWarmHeartedProportion(partiAgencyD.getWarmHeartedProportion());
- partiAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT);
if(null == dataPacket.getPartiAgencyMonthlyList()){
List list = new LinkedList<>();
list.add(partiAgencyM);
@@ -381,7 +413,7 @@ public class UserServiceImpl implements UserService {
Set singleGridIdSet = new HashSet<>();
- final boolean monthEndFlag = isMonthEnd;
+ final boolean monthBeginningFlag = isMonthBeginning;
//grid
gridIds.forEach(gridId -> {
@@ -486,7 +518,68 @@ public class UserServiceImpl implements UserService {
- if(monthEndFlag){
+ FactRegUserGridMonthlyDTO regGridM = new FactRegUserGridMonthlyDTO();
+ regGridM.setCustomerId(customerId);
+ regGridM.setAgencyId(agencyId);
+ regGridM.setGridId(gridId);
+ regGridM.setMonthId(timeDimension.getMonthId());
+ regGridM.setQuarterId(timeDimension.getQuarterId());
+ regGridM.setYearId(timeDimension.getYearId());
+ regGridM.setRegTotal(regData.getTotal());
+ regGridM.setResiTotal(regData.getTotal());
+ regGridM.setWarmHeartedTotal(warmRegData.getTotal());
+ regGridM.setPartymemberTotal(partyRegData.getTotal());
+ regGridM.setRegIncr(regData.getIncr());
+ regGridM.setWarmIncr(warmRegData.getIncr());
+ regGridM.setPartymemberIncr(partyRegData.getIncr());
+ regGridM.setResiProportion(new BigDecimal(NumConstant.ONE));
+ regGridM.setPartymemberProportion(regGridD.getPartymemberProportion());
+ regGridM.setWarmHeartedProportion(regGridD.getWarmHeartedProportion());
+ regGridM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT);
+
+
+ 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());
+ partiGridM.setRegTotal(partiData.getTotal());
+ partiGridM.setResiTotal(partiData.getTotal());
+ partiGridM.setWarmHeartedTotal(warmPartiData.getTotal());
+ partiGridM.setPartymemberTotal(partyPartiData.getTotal());
+ partiGridM.setRegIncr(partiData.getIncr());
+ partiGridM.setWarmIncr(warmPartiData.getIncr());
+ partiGridM.setPartymemberIncr(partyPartiData.getIncr());
+ partiGridM.setResiProportion(new BigDecimal(NumConstant.ONE));
+ partiGridM.setPartymemberProportion(partiGridD.getPartymemberProportion());
+ partiGridM.setWarmHeartedProportion(partiGridD.getWarmHeartedProportion());
+ partiGridM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT);
+
+
+
+
+ //如果是月初第一天,不再做日期区间查询
+ if(monthBeginningFlag){
+ if(null != dataPacket.getRegGridMonthlyList()){
+ dataPacket.getRegGridMonthlyList().add(regGridM);
+ }else{
+ List list = new ArrayList<>();
+ list.add(regGridM);
+ dataPacket.setRegGridMonthlyList(list);
+ }
+
+
+ if(null != dataPacket.getPartiGridMonthlyList()){
+ dataPacket.getPartiGridMonthlyList().add(partiGridM);
+ }else{
+ List list = new ArrayList<>();
+ list.add(partiGridM);
+ dataPacket.setPartiGridMonthlyList(list);
+ }
+
+ }else{
//本月注册用户增长数
Integer regIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,singleGridIdSet,calendar.getTime(),targetDateCheck);
//本月新增注册用户Id集合
@@ -506,24 +599,11 @@ public class UserServiceImpl implements UserService {
//本月新增热心居民数(参与用户)
Integer incrWarmOfPartiMonthly = userDao.selectWarmIncrWithinTimeRange(incrPartiIdsMonthly,singleGridIdSet,calendar.getTime(),targetDateCheck);
- FactRegUserGridMonthlyDTO regGridM = new FactRegUserGridMonthlyDTO();
- regGridM.setCustomerId(customerId);
- regGridM.setAgencyId(agencyId);
- regGridM.setGridId(gridId);
- regGridM.setMonthId(timeDimension.getMonthId());
- regGridM.setQuarterId(timeDimension.getQuarterId());
- regGridM.setYearId(timeDimension.getYearId());
- regGridM.setRegTotal(regData.getTotal());
- regGridM.setResiTotal(regData.getTotal());
- regGridM.setWarmHeartedTotal(warmRegData.getTotal());
- regGridM.setPartymemberTotal(partyRegData.getTotal());
+
regGridM.setRegIncr(regIncrMonthly);
regGridM.setWarmIncr(incrWarmOfRegMonthly);
regGridM.setPartymemberIncr(incrPartyOfRegMonthly);
- regGridM.setResiProportion(new BigDecimal(NumConstant.ONE));
- regGridM.setPartymemberProportion(regGridD.getPartymemberProportion());
- regGridM.setWarmHeartedProportion(regGridD.getWarmHeartedProportion());
- regGridM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT);
+
if(null != dataPacket.getRegGridMonthlyList()){
dataPacket.getRegGridMonthlyList().add(regGridM);
}else{
@@ -532,24 +612,11 @@ public class UserServiceImpl implements UserService {
dataPacket.setRegGridMonthlyList(list);
}
- 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());
- partiGridM.setRegTotal(partiData.getTotal());
- partiGridM.setResiTotal(partiData.getTotal());
- partiGridM.setWarmHeartedTotal(warmPartiData.getTotal());
- partiGridM.setPartymemberTotal(partyPartiData.getTotal());
+
partiGridM.setRegIncr(partiIncrMonthly);
partiGridM.setWarmIncr(incrWarmOfPartiMonthly);
partiGridM.setPartymemberIncr(incrPartyOfPartiMonthly);
- partiGridM.setResiProportion(new BigDecimal(NumConstant.ONE));
- partiGridM.setPartymemberProportion(partiGridD.getPartymemberProportion());
- partiGridM.setWarmHeartedProportion(partiGridD.getWarmHeartedProportion());
- partiGridM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT);
+
if(null != dataPacket.getPartiGridMonthlyList()){
dataPacket.getPartiGridMonthlyList().add(partiGridM);
}else{
@@ -568,7 +635,6 @@ public class UserServiceImpl implements UserService {
}
-
}
@@ -592,12 +658,4 @@ public class UserServiceImpl implements UserService {
System.out.println(format.format(calendar.getTime()));
System.out.println(format2.format(calendar.getTime()));
}
-
- /**
- * @Description 先查出所有的用户单位时间内新增的注册居民、党员、热心居民(跟随网格),然后查出单位时间内,每一个网格下的参与用户Id集合和注册用户Id集合
- * @param
- * @return
- * @author wangc
- * @date 2020.06.23 00:32
- **/
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ModuleConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ModuleConstant.java
index 48a1b9a08c..7473434df9 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ModuleConstant.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ModuleConstant.java
@@ -31,4 +31,12 @@ public interface ModuleConstant {
* 统计机器人
* */
String CREATED_BY_STATISTICAL_ROBOT = "STATISTICAL_ROBOT";
+
+ String EXCEPTION_DING_INTERCEPTOR_PREFIX_AGENCY_USER_STATISTICAL = "agencyUserStats";
+
+ String EXCEPTION_DING_INTERCEPTOR_PREFIX_GRID_USER_STATISTICAL = "gridUserStats";
+
+ String EXCEPTION_DING_INTERCEPTOR_PREFIX_TOPIC_STATISTICAL = "topicStats";
+
+ String LOG_WARN_NO_AGENCY_MESSAGE = "没有相应的机关集合";
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql
index 25b7b1e955..60d6b107fe 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql
@@ -697,7 +697,7 @@ CREATE TABLE `fact_topic_status_agency_daily` (
`YEAR_ID` varchar(32) NOT NULL COMMENT '年ID',
`TOPIC_STATUS_ID` varchar(32) NOT NULL COMMENT '话题状态ID 关联dim_topic_status表\n讨论中 discussing\n已屏蔽 hidden\n已关闭 closed\n已转项目 shift_project',
`TOPIC_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '话题数量 指定状态的话题数量',
- `TOPIC_PROPORTION` decimal(4,2) NOT NULL COMMENT '话题状态百分比 指定状态话题数/话题总数\n总数在topic_total_agency_daily中',
+ `TOPIC_PROPORTION` decimal(11,6) NOT NULL COMMENT '话题状态百分比 指定状态话题数/话题总数\n总数在topic_total_agency_daily中',
`TOPIC_INCREMENT` int(11) NOT NULL DEFAULT '0' COMMENT '话题增量 单位时间内的状态话题的增加数',
`DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识',
`REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
@@ -727,7 +727,7 @@ CREATE TABLE `fact_topic_status_agency_monthly` (
`YEAR_ID` varchar(32) NOT NULL COMMENT '年ID 关联年度dm表',
`TOPIC_STATUS_ID` varchar(32) NOT NULL COMMENT '话题状态 讨论中 discussing\n已屏蔽 hidden\n已关闭 closed\n已转项目 shift_project',
`TOPIC_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '话题数量',
- `TOPIC_PROPORTION` decimal(4,2) NOT NULL COMMENT '话题状态占比 月末一天 \n指定状态话题数/话题总数\n总数在topic_total_agency_daily中',
+ `TOPIC_PROPORTION` decimal(11,6) NOT NULL COMMENT '话题状态占比 月末一天 \n指定状态话题数/话题总数\n总数在topic_total_agency_daily中',
`TOPIC_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '话题增量 单位时间内的话题状态增加数',
`DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识',
`REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
@@ -758,7 +758,7 @@ CREATE TABLE `fact_topic_status_grid_daily` (
`YEAR_ID` varchar(32) NOT NULL COMMENT '年ID',
`TOPIC_STATUS_ID` varchar(32) DEFAULT NULL COMMENT '话题状态ID 讨论中 discussing\n已屏蔽 hidden\n已关闭 closed\n已转项目 shift_project',
`TOPIC_COUNT` int(11) DEFAULT '0' COMMENT '话题数量',
- `TOPIC_PROPORTION` decimal(4,2) DEFAULT NULL COMMENT '话题状态占比 指定状态话题数/话题总数\n总数在topic_total_grid_daily中',
+ `TOPIC_PROPORTION` decimal(11,6) DEFAULT NULL COMMENT '话题状态占比 指定状态话题数/话题总数\n总数在topic_total_grid_daily中',
`TOPIC_INCREMENT` int(11) DEFAULT '0' COMMENT '话题增量',
`DEL_FLAG` varchar(32) NOT NULL DEFAULT '0' COMMENT '删除标识',
`REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
index 7c20a18f4c..ed572b8f52 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
@@ -27,7 +27,7 @@
AND ORIGIN = 'issue'
AND STATUS = 'closed'
AND CUSTOMER_ID = #{customerId}
- AND UPDATED_TIME #{date}
+ AND DATE_FORMAT(UPDATED_TIME, '%Y-%m-%d') #{date}
GROUP BY
AGENCY_ID, CLOSED_STATUS
@@ -44,7 +44,7 @@
AND ORIGIN = 'issue'
AND STATUS = 'closed'
AND CUSTOMER_ID = #{customerId}
- AND UPDATED_TIME = #{date}
+ AND DATE_FORMAT(UPDATED_TIME, '%Y-%m-%d') = #{date}
GROUP BY
AGENCY_ID, CLOSED_STATUS
@@ -60,7 +60,7 @@
AND ORIGIN = 'issue'
AND STATUS = 'closed'
AND CUSTOMER_ID = #{customerId}
- AND UPDATED_TIME #{date}
+ AND DATE_FORMAT(UPDATED_TIME, '%Y-%m-%d') #{date}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml
index d2ef1b2a30..ced5e75721 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml
@@ -91,11 +91,7 @@
fact_group_agency_daily
WHERE
del_flag = '0'
- AND DATE_FORMAT(date_id,'%Y%m') = #{monthId}
- GROUP BY
- AGENCY_ID
- ORDER BY
- DATE_ID DESC
+ AND date_id = (SELECT MAX(date_id) FROM fact_group_agency_daily WHERE del_flag = '0')
@@ -107,7 +103,7 @@
fact_group_agency_daily
WHERE
del_flag = '0'
- AND SUBSTRING( date_id, 1, 6 ) = #{monthId}
+ AND month_id = #{monthId}
GROUP BY
agency_id
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml
index 1b6f925c97..6b796d944e 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml
@@ -6,17 +6,17 @@