Browse Source

Merge branches 'dev' and 'release' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev

dev_shibei_match
wxz 5 years ago
parent
commit
0f654c9be6
  1. 24
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java
  2. 2
      epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml
  3. 2
      epmet-module/data-report/data-report-server/pom.xml
  4. 36
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java
  5. 4
      epmet-module/data-report/data-report-server/src/main/resources/mapper/user/UserAnalysisDao.xml
  6. 2
      epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml
  7. 4
      epmet-module/data-statistical/data-statistical-server/pom.xml
  8. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  9. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java
  10. 329
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java
  11. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
  12. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueAgencyMonthlyDao.xml
  13. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml
  14. 2
      epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-test.yml

24
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java

@ -2,8 +2,6 @@ package com.epmet.commons.tools.utils;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.dto.form.DingTalkTextMsg;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.Lists;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
@ -17,8 +15,6 @@ import javax.crypto.spec.SecretKeySpec;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* desc: 发送消息工具类
@ -43,15 +39,8 @@ public class DingdingMsgSender {
*/
private ArrayBlockingQueue<DingTalkTextMsg> msgQueue = new ArrayBlockingQueue<>(maxQueueSize);
private volatile boolean running = false;
private Cache<String, AtomicInteger> limitCache = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).maximumSize(1000).build();
public DingdingMsgSender() {
}
private void handleMsg() {
DingTalkTextMsg msg = null;
@ -59,18 +48,7 @@ public class DingdingMsgSender {
//阻塞取元素
msg = msgQueue.take();
if (msg != null) {
AtomicInteger limitCount = limitCache.getIfPresent(msg.getWebHook());
if (limitCount == null) {
limitCount = new AtomicInteger(1);
limitCache.put(msg.getWebHook(), limitCount);
}
if (limitCount.intValue() > maxQueueSize) {
msgQueue.offer(msg);
Thread.sleep(1000);
} else {
sendPostByJSON(msg);
limitCount.addAndGet(1);
}
sendPostByJSON(msg);
} else {
Thread.sleep(1000);
}

2
epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
data-report-server:
container_name: data-report-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.15
image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.17
ports:
- "8109:8109"
network_mode: host # 使用现有网络

2
epmet-module/data-report/data-report-server/pom.xml

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<version>0.3.15</version>
<version>0.3.17</version>
<artifactId>data-report-server</artifactId>
<parent>

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

@ -46,6 +46,8 @@ public class PublicityServiceImpl implements PublicityService {
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
/**
* @param tokenDto
* @Description 宣传能力工作端当前机关累计发文和当前发文
@ -66,16 +68,16 @@ public class PublicityServiceImpl implements PublicityService {
@Override
public List<FactTagViewedAgencyDTO> tagviewed(TokenDto tokenDto, Integer pageSize, String type) {
String agencyId = this.getLoginUserDetails(tokenDto);
Date date = new Date();
String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN);
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(0, 6);
if (StringUtils.equals("month", type)) {//当月
String monthId = strDate.substring(0, 4) + strDate.substring(5, 7);
return publicityDao.getViewedMonthlyCountByTag(agencyId, monthId, pageSize);
} else if (StringUtils.equals("quarter", type)) {//当季
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date);
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact);
return publicityDao.getViewedQuarterlyCountByTag(agencyId, quarterId, pageSize);
} else if (StringUtils.equals("year", type)) {//当年
@ -94,16 +96,16 @@ public class PublicityServiceImpl implements PublicityService {
@Override
public List<FactTagUsedAgencyDTO> tagused(TokenDto tokenDto, Integer pageSize, String type) {
String agencyId = this.getLoginUserDetails(tokenDto);
Date date = new Date();
String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN);
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(0, 6);
if (StringUtils.equals("month", type)) {//当月
String monthId = strDate.substring(0, 4) + strDate.substring(5, 7);
return publicityDao.getUsedMonthlyCountByTag(agencyId, monthId, pageSize);
} else if (StringUtils.equals("quarter", type)) {//当季
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date);
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact);
return publicityDao.getUsedQuarterlyCountByTag(agencyId, quarterId, pageSize);
} else if (StringUtils.equals("year", type)) {//当年
@ -122,8 +124,8 @@ public class PublicityServiceImpl implements PublicityService {
@Override
public List<FactPublishedAgencyDTO> subagencyPublishedarticle(TokenDto tokenDto, String type) {
String agencyId = this.getLoginUserDetails(tokenDto);
Date date = new Date();
String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD);
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(0, 6);
@ -131,7 +133,7 @@ public class PublicityServiceImpl implements PublicityService {
return publicityDao.getSubAgencyPublishedMonth(agencyId, monthId);
} else if (StringUtils.equals("quarter", type)) {//当季
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date);
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact);
return publicityDao.getSubAgencyPublishedQuarter(agencyId, quarterId);
} else if (StringUtils.equals("year", type)) {//当年
@ -150,8 +152,8 @@ public class PublicityServiceImpl implements PublicityService {
@Override
public List<FactPublishedDepartmentDTO> departmentPublishedarticle(TokenDto tokenDto, String type) {
String agencyId = this.getLoginUserDetails(tokenDto);
Date date = new Date();
String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD);
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(0, 6);
@ -159,7 +161,7 @@ public class PublicityServiceImpl implements PublicityService {
return publicityDao.getSubDepartPublishedMonth(agencyId, monthId);
} else if (StringUtils.equals("quarter", type)) {//当季
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date);
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact);
return publicityDao.getSubDepartPublishedQuarter(agencyId, quarterId);
} else if (StringUtils.equals("year", type)) {//当年
@ -178,8 +180,8 @@ public class PublicityServiceImpl implements PublicityService {
@Override
public List<FactPublishedGridDTO> subgridPublishedarticle(TokenDto tokenDto, String type) {
String agencyId = this.getLoginUserDetails(tokenDto);
Date date = new Date();
String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD);
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(0, 6);
@ -187,7 +189,7 @@ public class PublicityServiceImpl implements PublicityService {
return publicityDao.getSubGridPublishedMonth(agencyId, monthId);
} else if (StringUtils.equals("quarter", type)) {//当季
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date);
String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact);
return publicityDao.getSubGridPublishedQuarter(agencyId, quarterId);
} else if (StringUtils.equals("year", type)) {//当年

4
epmet-module/data-report/data-report-server/src/main/resources/mapper/user/UserAnalysisDao.xml

@ -57,8 +57,8 @@
m.id,
m.DATE_ID AS currentDate,
m.DATE_ID AS dateId,
m.REG_TOTAL AS regTotal,
0 AS partiTotal,
m.REG_TOTAL AS partiTotal,
0 AS regTotal,
m.PARTYMEMBER_TOTAL AS partymemberTotal,
m.PARTYMEMBER_PROPORTION*100 AS partymemberProportionValue,
m.WARM_HEARTED_TOTAL AS warmHeartedTotal,

2
epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
data-statistical-server:
container_name: data-statistical-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.21
image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.22
ports:
- "8108:8108"
network_mode: host # 使用现有网络

4
epmet-module/data-statistical/data-statistical-server/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<version>0.3.21</version>
<version>0.3.22</version>
<parent>
<artifactId>data-statistical</artifactId>
<groupId>com.epmet</groupId>
@ -159,7 +159,7 @@
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr>
<nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java

@ -154,7 +154,7 @@ public class StatsGroupServiceImpl implements StatsGroupService {
//机关下的所有网格(包括直属网格)
List<String> allGrid = this.getAllGrid(agencyId,customerId);
if (allGrid.size() != NumConstant.ZERO) {
// 1. 机关下有多少网格
// 1. 机关下有多少网格 (this.getAllGrid拿的是当前机关下所有网格,以下方法是根据“dateId”来拿的,两者过滤)
List<GridIdListByCustomerResultDTO> customerGridIdList = customerGridService.getCustomerGridIdList(customerId, dateId);
AtomicReference<Integer> gridSize = new AtomicReference<>(NumConstant.ZERO);
if (customerGridIdList.size() != NumConstant.ZERO) {

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java

@ -227,6 +227,7 @@ public class StatsIssueServiceImpl implements StatsIssueService {
FactIssueAgencyMonthlyDTO dto = issueAgencyMonthlyIncList.get(i);
if (agency.getId().equals(dto.getAgencyId())) {
monthly.setIssueIncr(dto.getIssueIncr());
monthly.setVotingIncr(dto.getVotingIncr());
monthly.setShiftProjectIncr(dto.getShiftProjectIncr());
monthly.setClosedIncr(dto.getClosedIncr());
monthly.setClosedResolvedIncr(dto.getClosedResolvedIncr());
@ -430,6 +431,7 @@ public class StatsIssueServiceImpl implements StatsIssueService {
FactIssueGridMonthlyDTO dto = gridMonthlyIncListList.get(i);
if (grid.getId().equals(dto.getGridId())) {
monthly.setIssueIncr(dto.getIssueIncr());
monthly.setVotingIncr(dto.getVotingIncr());
monthly.setShiftProjectIncr(dto.getShiftProjectIncr());
monthly.setClosedIncr(dto.getClosedIncr());
monthly.setClosedResolvedIncr(dto.getClosedResolvedIncr());

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

@ -921,4 +921,333 @@ public class TopicServiceImpl implements TopicService {
}
/**
* @Description 根据话题状态的维度自动匹配分析数据
* @param
* @return
* @author wangc
* @date 2020.06.30 17:04
**/
void analyzeTopicGroupByIssueStatus(Map<String, Set<String>> subGridOfAgency, List<AgencySubTreeDto> agencies, Map<String,List<ResiGroupTopicResultDTO>> gridGroupMap, Map<String,List<ResiTopicOperationResultDTO>> topicOperationMap, Date targetDate, TopicStatisticalData dataPacket, List<DimTopicStatusDTO> statusDimension, DimIdGenerator.DimIdBean timeDimension){
//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)){
//求出这个月的第一天
calendar.setTime(new Date());
calendar.set(Calendar.DAY_OF_MONTH, NumConstant.ONE);
calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO);
calendar.set(Calendar.MINUTE, NumConstant.ZERO);
calendar.set(Calendar.SECOND, NumConstant.ZERO);
// isMonthEnd = true;
//}
//计算百分比使用,保留小数点后两位
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.SIX);
Map<String,DimTopicStatusDTO> statusMap = new HashMap<>();
statusDimension.forEach(status -> statusMap.put(status.getId(),status));
Map<String,AgencySubTreeDto> agencyMap = new HashMap<>();
agencies.forEach(agency -> {agencyMap.put(agency.getAgencyId(),agency);});
List<ResiGroupTopicResultDTO> groupList = new LinkedList<>();
for(Map.Entry<String,List<ResiGroupTopicResultDTO>> entry : gridGroupMap.entrySet()){
if(null != entry.getValue() && entry.getValue().size() > NumConstant.ZERO)
groupList.addAll(entry.getValue());
}
//key -> groupId
Map<String,GroupTopicData> groupTopicData = traverseGroupTopic(groupList,topicOperationMap);
Map<String,Boolean> gridDistinct = new HashMap<>();
agencies.forEach(agency -> {
if(null != agency.getGridIds() && agency.getGridIds().size() > NumConstant.ZERO){
agency.getGridIds().forEach(grid -> {
gridDistinct.put(grid,false);
});
}
});
for(Map.Entry<String,Set<String>> entry : subGridOfAgency.entrySet()){
FactTopicIssueAgencyDailyDTO issueAgencyD = new FactTopicIssueAgencyDailyDTO();
FactTopicTotalAgencyDailyDTO totalAgencyD = new FactTopicTotalAgencyDailyDTO();
//initAgencyDailyDTO(entry.getKey(),agencyMap.get(entry.getKey()).getPid(),agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,statusMap,issueAgencyD,totalAgencyD);
statusMap.forEach((k,v) -> {
//无状态标识
boolean noStatusFlag = false;
if(StringUtils.equals(k,"discussing")){
noStatusFlag = true;
}
final boolean noStatusFlagFinal = noStatusFlag;
//k:状态的key
//对应状态key的一条话题-状态记录
FactTopicStatusAgencyDailyDTO topicAgencyD = new FactTopicStatusAgencyDailyDTO();
topicAgencyD.setTopicStatusId(k);
//initAgencyDailyDTO
if(null != entry.getValue() && entry.getValue().size() > NumConstant.ZERO){
entry.getValue().forEach(gridId -> {
FactTopicStatusGridDailyDTO topicGridD = new FactTopicStatusGridDailyDTO();
topicGridD.setTopicStatusId(k);
FactTopicIssueGridDailyDTO issueGridD = new FactTopicIssueGridDailyDTO();
FactTopicTotalGridDailyDTO totalGirdD = new FactTopicTotalGridDailyDTO();
//init
//if(noStatusFlagFinal){
//initGridDailyDTO(entry.getKey(),gridId,agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,statusMap,issueGridD,totalGirdD,topicGridD_discussing);
//}else{
//initGridDailyDTO(entry.getKey(),gridId,agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,statusMap,topicGridD_discussing);
//}
List<ResiGroupTopicResultDTO> groups = gridGroupMap.get(gridId);
if(null != groups && groups.size() > NumConstant.ZERO) {
groups.forEach(group -> {
if (null != group && StringUtils.isNotBlank(group.getGroupId())) {
if(noStatusFlagFinal) {
issueAgencyD.setIssueIncr(issueAgencyD.getIssueIncr() + groupTopicData.get(group.getGroupId()).getIssueIncr());
issueAgencyD.setIssueTotal(issueAgencyD.getIssueTotal() + groupTopicData.get(group.getGroupId()).getIssueTotal());
totalAgencyD.setIssueTotalCount(issueAgencyD.getIssueTotal());
totalAgencyD.setHiddenTotalCount(totalAgencyD.getHiddenTotalCount() + groupTopicData.get(group.getGroupId()).getHiddenTotal());
totalAgencyD.setTopicIncr(totalAgencyD.getTopicIncr() + groupTopicData.get(group.getGroupId()).getTopicIncr());
totalAgencyD.setTopicTotal(totalAgencyD.getTopicTotal() + groupTopicData.get(group.getGroupId()).getTotal());
issueGridD.setIssueIncr(issueGridD.getIssueIncr() + groupTopicData.get(group.getGroupId()).getIssueIncr());
issueGridD.setIssueTotal(issueGridD.getIssueTotal() + groupTopicData.get(group.getGroupId()).getIssueTotal());
totalGirdD.setIssueTotalCount(issueGridD.getIssueTotal());
totalGirdD.setHiddenTotalCount(totalGirdD.getHiddenTotalCount() + groupTopicData.get(group.getGroupId()).getHiddenTotal());
totalGirdD.setTopicIncr(totalGirdD.getTopicIncr() + groupTopicData.get(group.getGroupId()).getTopicIncr());
totalGirdD.setTopicTotal(totalGirdD.getTopicTotal() + groupTopicData.get(group.getGroupId()).getTotal());
}
GroupTopicData data = groupTopicData.get(group.getGroupId());
if (null != data) {
//根据当前的话题状态key,去data中取相应的数据
switch(k){
case "discussing":
topicAgencyD.setTopicCount(topicAgencyD.getTopicCount() + data.getDiscussingTotal());
topicAgencyD.setTopicIncrement(topicAgencyD.getTopicIncrement() + data.getDiscussingIncr());
topicGridD.setTopicCount(topicGridD.getTopicCount() + data.getDiscussingTotal());
topicGridD.setTopicIncrement(topicGridD.getTopicIncrement() + data.getDiscussingIncr());
break;
case "hidden":
topicAgencyD.setTopicCount(topicAgencyD.getTopicCount() + data.getHiddenTotal());
topicAgencyD.setTopicIncrement(topicAgencyD.getTopicIncrement() + data.getHiddenIncr());
topicGridD.setTopicCount(topicGridD.getTopicCount() + data.getHiddenTotal());
topicGridD.setTopicIncrement(topicGridD.getTopicIncrement() + data.getHiddenIncr());
break;
case "closed":
topicAgencyD.setTopicCount(topicAgencyD.getTopicCount() + data.getClosedTotal());
topicAgencyD.setTopicIncrement(topicAgencyD.getTopicIncrement() + data.getClosedIncr());
topicGridD.setTopicCount(topicGridD.getTopicCount() + data.getClosedTotal());
topicGridD.setTopicIncrement(topicGridD.getTopicIncrement() + data.getClosedIncr());
break;
}
}
}
});
}
//网格-百分比
//setGridTopicProportion(numberFormat, topicGridD, totalGirdD);
if(!gridDistinct.get(gridId)) {
//setGridDailyDataPacket(dataPacket, issueGridD, totalGirdD, topicGridD_discussing, topicGridD_hidden, topicGridD_closed);
/*
if(noStatusFlagFinal){
set :: issueGridD | totalGridD | topicGridD
}else{
set :: topicGridD
}
*/
gridDistinct.put(gridId,true);
}
});
}
//机关-百分比
//setAgencyTopicProportion(numberFormat,topicAgencyD,totalAgencyD);
//setAgencyDailyDataPacket(dataPacket,issueAgencyD,totalAgencyD,topicAgencyD_discussing,topicAgencyD_hidden,topicAgencyD_closed);
/*
if(noStatusFlagFinal){
set :: issueAgencyD | totalAgencyD | topicAgencyD
}else{
set :: topicAgencyD
}
*/
});
}
gridDistinct.forEach((k,v) -> {
gridDistinct.put(k,false);
});
List<ResiGroupTopicResultDTO> topicsBetweenTimeRange = topicDao.selectGroupOrderByGridBetweenTimeRange(calendar.getTime(),targetDate,dataPacket.getCustomerId());
//key : gridId
Map<String,List<ResiGroupTopicResultDTO>> GridGroupMapBetweenTimeRange =
topicsBetweenTimeRange.stream().collect(Collectors.groupingBy(ResiGroupTopicResultDTO::getGridId));
List<ResiGroupTopicResultDTO> groupListBetweenTimeRange = new LinkedList<>();
for(Map.Entry<String,List<ResiGroupTopicResultDTO>> entryBetweenTimeRange : GridGroupMapBetweenTimeRange.entrySet()){
if(null != entryBetweenTimeRange.getValue() && entryBetweenTimeRange.getValue().size() > NumConstant.ZERO)
groupListBetweenTimeRange.addAll(entryBetweenTimeRange.getValue());
}
List<ResiTopicOperationResultDTO> operationsBetweenTimeRange =
topicDao.selectTopicOperationRecordBetweenTimeRange(calendar.getTime(),targetDate);
//key: topicId
Map<String,List<ResiTopicOperationResultDTO>> topicOperationMapBetweenTimeRange =
operationsBetweenTimeRange.stream().collect(Collectors.groupingBy(ResiTopicOperationResultDTO::getTopicId));
//key: groupId
Map<String,GroupTopicData> groupTopicDataBetweenTimeRange = traverseGroupTopic(groupListBetweenTimeRange,topicOperationMapBetweenTimeRange);
for(Map.Entry<String,Set<String>> entry : subGridOfAgency.entrySet()){
FactTopicIssueAgencyMonthlyDTO issueAgencyM = new FactTopicIssueAgencyMonthlyDTO();
//initAgencyMonthlyDTO(entry.getKey(),agencyMap.get(entry.getKey()).getPid(),agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,statusMap,issueAgencyM);
statusMap.forEach((k,v) -> {
boolean noStatusFlag = false;
if(StringUtils.equals(k,"discussing")){
noStatusFlag = true;
}
final boolean noStatusFlagFinal = noStatusFlag;
FactTopicStatusAgencyMonthlyDTO topicAgencyM = new FactTopicStatusAgencyMonthlyDTO();
topicAgencyM.setTopicStatusId(k);
if(null != entry.getValue() && entry.getValue().size() > NumConstant.ZERO){
entry.getValue().forEach(gridId -> {
FactTopicIssueGridMonthlyDTO issueGridM = new FactTopicIssueGridMonthlyDTO();
initGridMonthlyDTO(entry.getKey(),gridId,agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,issueGridM);
List<ResiGroupTopicResultDTO> groups = gridGroupMap.get(gridId);
if(null != groups) {
groups.forEach(group -> {
if (null != group && StringUtils.isNotBlank(group.getGroupId())) {
if(noStatusFlagFinal) {
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());
}
GroupTopicData data = groupTopicDataBetweenTimeRange.get(group.getGroupId());
if (null != data) {
switch(k){
case "discussing":
topicAgencyM.setTopicCount(topicAgencyM.getTopicCount() + data.getDiscussingTotal());
topicAgencyM.setTopicIncr(topicAgencyM.getTopicIncr() + data.getDiscussingIncr());
break;
case "hidden":
topicAgencyM.setTopicCount(topicAgencyM.getTopicCount() + data.getHiddenTotal());
topicAgencyM.setTopicIncr(topicAgencyM.getTopicIncr() + data.getHiddenIncr());
break;
case "closed":
topicAgencyM.setTopicCount(topicAgencyM.getTopicCount() + data.getClosedTotal());
topicAgencyM.setTopicIncr(topicAgencyM.getTopicIncr() + data.getClosedIncr());
break;
}
}
}
});
}
if(!gridDistinct.get(gridId)) {
setGridMonthlyDataPacket(dataPacket, issueGridM);
}
gridDistinct.put(gridId,true);
});
}
//机关-百分比
//Integer topicTotal = dataPacket.getTotalAgencyDailyList().stream().filter( obj -> StringUtils.equals(obj.getAgencyId(),entry.getKey())).findFirst().get().getTopicTotal();
//setAgencyTopicMonthlyProportion(numberFormat,topicAgencyM,topicTotal);
/*
if(noStatusFlagFinal){
set :: issueAgencyM | topicAgencyM
}else{
set topicAgencyM
}
*/
});
}
}
}

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

@ -186,15 +186,17 @@ public class UserServiceImpl implements UserService {
Boolean isMonthBeginning = true;
Calendar calendar =Calendar.getInstance();
//求出T-1
calendar.setTime(new Date());
calendar.add(Calendar.DATE, NumConstant.ONE_NEG);
Date targetDateCheck = null == targetDate ? calendar.getTime() : targetDate;
//指定日期 OR T-1
calendar.setTime(targetDateCheck);
//如果目标日期不是是当月的第一天
if(calendar.get(Calendar.DATE) != calendar.getActualMinimum(Calendar.DAY_OF_MONTH)){
//求出这个月的第一天
calendar.setTime(new Date());
calendar.set(Calendar.DAY_OF_MONTH, NumConstant.ONE);
calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO);
calendar.set(Calendar.MINUTE, NumConstant.ZERO);
@ -255,7 +257,7 @@ public class UserServiceImpl implements UserService {
regAgencyD.setPartymemberTotal(partyRegData.getTotal());
regAgencyD.setRegIncr(regData.getIncr());
regAgencyD.setWarmIncr(warmRegData.getIncr());
regAgencyD.setPartymemberIncr(partiData.getIncr());
regAgencyD.setPartymemberIncr(partyPartiData.getIncr());
regAgencyD.setResiProportion(new BigDecimal(NumConstant.ONE));
regAgencyD.setPartymemberProportion(null == regData.getTotal() || regData.getTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float)partyRegData.getTotal()/(float)regData.getTotal() )));
regAgencyD.setWarmHeartedProportion(null == regData.getTotal() || regData.getTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float)warmRegData.getTotal()/(float)regData.getTotal() )));
@ -312,7 +314,7 @@ public class UserServiceImpl implements UserService {
regAgencyM.setPartymemberTotal(partyRegData.getTotal());
regAgencyM.setRegIncr(regData.getIncr());
regAgencyM.setWarmIncr(warmRegData.getIncr());
regAgencyM.setPartymemberIncr(partiData.getIncr());
regAgencyM.setPartymemberIncr(partyPartiData.getIncr());
regAgencyM.setResiProportion(new BigDecimal(NumConstant.ONE));
regAgencyM.setPartymemberProportion(regAgencyD.getPartymemberProportion());
regAgencyM.setWarmHeartedProportion(regAgencyD.getWarmHeartedProportion());

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

@ -51,6 +51,7 @@
SELECT
da.ID AS "agencyId",
SUM(IFNULL(ISSUE_INCR, 0)) AS "issueIncr",
SUM(IFNULL(VOTING_INCR, 0)) AS "votingIncr",
SUM(IFNULL(SHIFT_PROJECT_INCR, 0)) AS "shiftProjectIncr",
SUM(IFNULL(CLOSED_INCR, 0)) AS "closedIncr",
SUM(IFNULL(CLOSED_RESOLVED_INCR, 0)) AS "closedResolvedIncr",
@ -64,6 +65,7 @@
AND MONTH_ID = #{monthId}
WHERE
da.DEL_FLAG = '0'
AND da.AGENCY_DIM_TYPE= 'all'
AND da.CUSTOMER_ID = #{customerId}
GROUP BY
da.ID

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactIssueGridMonthlyDao.xml

@ -57,6 +57,7 @@
dg.AGENCY_ID AS "agencyId",
dg.ID AS "gridId",
SUM(IFNULL(ISSUE_INCR, 0)) AS "issueIncr",
SUM(IFNULL(VOTING_INCR, 0)) AS "votingIncr",
SUM(IFNULL(SHIFT_PROJECT_INCR, 0)) AS "shiftProjectIncr",
SUM(IFNULL(CLOSED_INCR, 0)) AS "closedIncr",
SUM(IFNULL(CLOSED_RESOLVED_INCR, 0)) AS "closedResolvedIncr",

2
epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-test.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-job-server:
container_name: epmet-job-server-test
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-job-server:0.3.7
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-job-server:0.3.13
ports:
- "8084:8084"
network_mode: host # 使用现有网络

Loading…
Cancel
Save