@ -1,60 +1,61 @@
package com.epmet.dataaggre.service.datastats.impl ;
import com.alibaba.fastjson.JSON ;
import com.epmet.commons.dynamic.datasource.annotation.DataSource ;
import com.epmet.commons.tools.constant.NumConstant ;
import com.epmet.commons.tools.enums.OrgLevelEnum ;
import com.epmet.commons.tools.exception.RenException ;
import com.epmet.commons.tools.feign.ResultDataResolver ;
import com.epmet.commons.tools.utils.ConvertUtils ;
import com.epmet.commons.tools.utils.DateUtils ;
import com.epmet.commons.tools.utils.ExcelUtils ;
import com.epmet.dataaggre.constant.DataSourceConstant ;
import com.epmet.dataaggre.constant.OrgConstant ;
import com.epmet.dataaggre.dao.datastats.DataStatsDao ;
import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao ;
import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO ;
import com.epmet.dataaggre.dto.datastats.form.* ;
import com.epmet.dataaggre.dto.datastats.result.* ;
import com.epmet.commons.dynamic.datasource.annotation.DataSource ;
import com.epmet.commons.tools.constant.NumConstant ;
import com.epmet.commons.tools.enums.OrgLevelEnum ;
import com.epmet.commons.tools.enums.OrgTypeEnum ;
import com.epmet.commons.tools.exception.RenException ;
import com.epmet.commons.tools.feign.ResultDataResolver ;
import com.epmet.commons.tools.utils.ConvertUtils ;
import com.epmet.commons.tools.utils.DateUtils ;
import com.epmet.commons.tools.utils.ExcelUtils ;
import com.epmet.dataaggre.constant.DataSourceConstant ;
import com.epmet.dataaggre.constant.OrgConstant ;
import com.epmet.dataaggre.dao.datastats.DataStatsDao ;
import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao ;
import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO ;
import com.epmet.dataaggre.dto.datastats.form.* ;
import com.epmet.dataaggre.dto.datastats.result.* ;
import com.epmet.dataaggre.dto.epmetuser.FactIcuserCategoryAnalysisDailyDTO ;
import com.epmet.dataaggre.dto.epmetuser.form.GridMemberPatrolListFormDTO ;
import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO ;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult ;
import com.epmet.dataaggre.dto.evaluationindex.ScreenAgencyOrGridListDTO ;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO ;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO ;
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO ;
import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO ;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDailySumResult ;
import com.epmet.dataaggre.dto.evaluationindex.ScreenAgencyOrGridListDTO ;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO ;
import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO ;
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO ;
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO ;
import com.epmet.dataaggre.dto.govorg.result.GridDateIdResultDTO ;
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO ;
import com.epmet.dataaggre.dto.govproject.form.ProjectTotalFormDTO ;
import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO ;
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO ;
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity ;
import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity ;
import com.epmet.dataaggre.excel.CustomerDataManageExcel ;
import com.epmet.dataaggre.service.datastats.DataStatsService ;
import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService ;
import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService ;
import com.epmet.dataaggre.service.govorg.GovOrgService ;
import com.epmet.dataaggre.service.opercrm.CustomerRelation ;
import com.github.pagehelper.PageHelper ;
import lombok.extern.slf4j.Slf4j ;
import org.apache.commons.collections4.CollectionUtils ;
import org.apache.commons.lang3.StringUtils ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
import javax.servlet.http.HttpServletResponse ;
import java.math.BigDecimal ;
import java.math.RoundingMode ;
import java.text.NumberFormat ;
import java.text.ParseException ;
import java.text.SimpleDateFormat ;
import java.util.* ;
import java.util.concurrent.atomic.AtomicInteger ;
import java.util.concurrent.atomic.AtomicReference ;
import java.util.stream.Collectors ;
import com.epmet.dataaggre.dto.govproject.form.ProjectTotalFormDTO ;
import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO ;
import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO ;
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity ;
import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity ;
import com.epmet.dataaggre.excel.CustomerDataManageExcel ;
import com.epmet.dataaggre.service.datastats.DataStatsService ;
import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService ;
import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService ;
import com.epmet.dataaggre.service.govorg.GovOrgService ;
import com.epmet.dataaggre.service.opercrm.CustomerRelation ;
import com.github.pagehelper.PageHelper ;
import lombok.extern.slf4j.Slf4j ;
import org.apache.commons.collections4.CollectionUtils ;
import org.apache.commons.lang3.StringUtils ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
import javax.servlet.http.HttpServletResponse ;
import java.math.BigDecimal ;
import java.math.RoundingMode ;
import java.text.NumberFormat ;
import java.text.ParseException ;
import java.text.SimpleDateFormat ;
import java.util.* ;
import java.util.concurrent.atomic.AtomicInteger ;
import java.util.concurrent.atomic.AtomicReference ;
import java.util.stream.Collectors ;
/ * *
* @Author sun
@ -98,15 +99,15 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
formDTO . setDateId ( format . format ( yesterday ) ) ;
}
//0 .根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表
//NumConstant.ZERO .根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表
agencyList = indexService . getAgencyIdsByAgencyId ( formDTO . getAgencyId ( ) ) ;
agencyList . add ( formDTO . getAgencyId ( ) ) ;
//1.查询组织下注册用户最新日统计数据【只查询注册用户的统计数据,不涉及参与用户的】
List < AgencyBasicDataResultDTO > userList = dataStatsDao . getAgnecyRegUser ( agencyList , formDTO . getDateId ( ) ) ;
int userTotal = 0 ;
int resiTotal = 0 ;
int partyMemberTotal = 0 ;
int userTotal = NumConstant . ZERO ;
int resiTotal = NumConstant . ZERO ;
int partyMemberTotal = NumConstant . ZERO ;
for ( AgencyBasicDataResultDTO u : userList ) {
userTotal + = u . getUserTotal ( ) ;
resiTotal + = u . getResiTotal ( ) ;
@ -114,15 +115,15 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
}
resultDTO . setUserTotal ( userTotal ) ;
resultDTO . setResiTotal ( resiTotal ) ;
resultDTO . setResiRatio ( resultDTO . getResiTotal ( ) = = 0 | | resultDTO . getUserTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getResiTotal ( ) / ( float ) resultDTO . getUserTotal ( ) ) ) ) ;
resultDTO . setResiRatio ( resultDTO . getResiTotal ( ) = = NumConstant . ZERO | | resultDTO . getUserTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getResiTotal ( ) / ( float ) resultDTO . getUserTotal ( ) ) ) ) ;
resultDTO . setPartyMemberTotal ( partyMemberTotal ) ;
resultDTO . setPartyMemberRatio ( resultDTO . getPartyMemberTotal ( ) = = 0 | | resultDTO . getUserTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getPartyMemberTotal ( ) / ( float ) resultDTO . getUserTotal ( ) ) ) ) ;
resultDTO . setPartyMemberRatio ( resultDTO . getPartyMemberTotal ( ) = = NumConstant . ZERO | | resultDTO . getUserTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getPartyMemberTotal ( ) / ( float ) resultDTO . getUserTotal ( ) ) ) ) ;
//2.查询组织下最新群组日统计数据
List < AgencyBasicDataResultDTO > groupList = dataStatsDao . getAgnecyGroup ( agencyList , formDTO . getDateId ( ) ) ;
int groupTotal = 0 ;
int ordinaryTotal = 0 ;
int branchTotal = 0 ;
int groupTotal = NumConstant . ZERO ;
int ordinaryTotal = NumConstant . ZERO ;
int branchTotal = NumConstant . ZERO ;
for ( AgencyBasicDataResultDTO g : groupList ) {
groupTotal + = g . getGroupTotal ( ) ;
ordinaryTotal + = g . getOrdinaryTotal ( ) ;
@ -130,9 +131,9 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
}
resultDTO . setGroupTotal ( groupTotal ) ;
resultDTO . setOrdinaryTotal ( ordinaryTotal ) ;
resultDTO . setOrdinaryRatio ( resultDTO . getOrdinaryTotal ( ) = = 0 | | resultDTO . getGroupTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getOrdinaryTotal ( ) / ( float ) resultDTO . getGroupTotal ( ) ) ) ) ;
resultDTO . setOrdinaryRatio ( resultDTO . getOrdinaryTotal ( ) = = NumConstant . ZERO | | resultDTO . getGroupTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getOrdinaryTotal ( ) / ( float ) resultDTO . getGroupTotal ( ) ) ) ) ;
resultDTO . setBranchTotal ( branchTotal ) ;
resultDTO . setBranchRatio ( resultDTO . getBranchTotal ( ) = = 0 | | resultDTO . getGroupTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getBranchTotal ( ) / ( float ) resultDTO . getGroupTotal ( ) ) ) ) ;
resultDTO . setBranchRatio ( resultDTO . getBranchTotal ( ) = = NumConstant . ZERO | | resultDTO . getGroupTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getBranchTotal ( ) / ( float ) resultDTO . getGroupTotal ( ) ) ) ) ;
//3.查询组织下最新话题日统计数据
//状态话题-机关日统计数据表最新日期三种状态数据
@ -148,21 +149,21 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
//转议题
int shiftIssueTotal = topicSHiftIssue . stream ( ) . mapToInt ( AgencyBasicDataResultDTO . Topic : : getShiftedIssueTotal ) . sum ( ) ;
resultDTO . setShiftIssueTotal ( shiftIssueTotal ) ;
resultDTO . setShiftIssueRatio ( resultDTO . getShiftIssueTotal ( ) = = 0 | | resultDTO . getTopicTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getShiftIssueTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setShiftIssueRatio ( resultDTO . getShiftIssueTotal ( ) = = NumConstant . ZERO | | resultDTO . getTopicTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getShiftIssueTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
//热议中
int discussingTotal = hotdiscuss . stream ( ) . mapToInt ( AgencyBasicDataResultDTO . Topic : : getTopicCount ) . sum ( ) ;
resultDTO . setDiscussingTotal ( discussingTotal ) ;
resultDTO . setDiscussingRatio ( resultDTO . getDiscussingTotal ( ) = = 0 | | resultDTO . getTopicTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getDiscussingTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setDiscussingRatio ( resultDTO . getDiscussingTotal ( ) = = NumConstant . ZERO | | resultDTO . getTopicTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getDiscussingTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
//已处理
resultDTO . setClosedTopicTotal ( closedTotal ) ;
resultDTO . setClosedTopicRatio ( resultDTO . getClosedTopicTotal ( ) = = 0 | | resultDTO . getTopicTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedTopicTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setClosedTopicRatio ( resultDTO . getClosedTopicTotal ( ) = = NumConstant . ZERO | | resultDTO . getTopicTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedTopicTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
//4 .查询组织下最新议题日统计数据
//NumConstant.FOUR .查询组织下最新议题日统计数据
List < AgencyBasicDataResultDTO > issueList = dataStatsDao . getAgencyIssue ( agencyList , formDTO . getDateId ( ) ) ;
int issueTotal = 0 ;
int votingTotal = 0 ;
int closedIssueTotal = 0 ;
int shiftProjectTotal = 0 ;
int issueTotal = NumConstant . ZERO ;
int votingTotal = NumConstant . ZERO ;
int closedIssueTotal = NumConstant . ZERO ;
int shiftProjectTotal = NumConstant . ZERO ;
for ( AgencyBasicDataResultDTO i : issueList ) {
issueTotal + = i . getIssueTotal ( ) ;
votingTotal + = i . getVotingTotal ( ) ;
@ -171,17 +172,17 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
}
resultDTO . setIssueTotal ( issueTotal ) ;
resultDTO . setVotingTotal ( votingTotal ) ;
resultDTO . setVotingRatio ( resultDTO . getVotingTotal ( ) = = 0 | | resultDTO . getIssueTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getVotingTotal ( ) / ( float ) resultDTO . getIssueTotal ( ) ) ) ) ;
resultDTO . setVotingRatio ( resultDTO . getVotingTotal ( ) = = NumConstant . ZERO | | resultDTO . getIssueTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getVotingTotal ( ) / ( float ) resultDTO . getIssueTotal ( ) ) ) ) ;
resultDTO . setClosedIssueTotal ( closedIssueTotal ) ;
resultDTO . setClosedIssueRatio ( resultDTO . getClosedIssueTotal ( ) = = 0 | | resultDTO . getIssueTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedIssueTotal ( ) / ( float ) resultDTO . getIssueTotal ( ) ) ) ) ;
resultDTO . setClosedIssueRatio ( resultDTO . getClosedIssueTotal ( ) = = NumConstant . ZERO | | resultDTO . getIssueTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedIssueTotal ( ) / ( float ) resultDTO . getIssueTotal ( ) ) ) ) ;
resultDTO . setShiftProjectTotal ( shiftProjectTotal ) ;
resultDTO . setShiftProjectRatio ( resultDTO . getShiftProjectTotal ( ) = = 0 | | resultDTO . getIssueTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getShiftProjectTotal ( ) / ( float ) resultDTO . getIssueTotal ( ) ) ) ) ;
resultDTO . setShiftProjectRatio ( resultDTO . getShiftProjectTotal ( ) = = NumConstant . ZERO | | resultDTO . getIssueTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getShiftProjectTotal ( ) / ( float ) resultDTO . getIssueTotal ( ) ) ) ) ;
//5.查询组织下最新项目日统计数据
List < AgencyBasicDataResultDTO > projectList = dataStatsDao . getAgencyProject ( agencyList , formDTO . getDateId ( ) ) ;
int projectTotal = 0 ;
int pendingTotal = 0 ;
int closedProjectTotal = 0 ;
int projectTotal = NumConstant . ZERO ;
int pendingTotal = NumConstant . ZERO ;
int closedProjectTotal = NumConstant . ZERO ;
for ( AgencyBasicDataResultDTO p : projectList ) {
projectTotal + = p . getProjectTotal ( ) ;
pendingTotal + = p . getPendingTotal ( ) ;
@ -189,9 +190,9 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
}
resultDTO . setProjectTotal ( projectTotal ) ;
resultDTO . setPendingTotal ( pendingTotal ) ;
resultDTO . setPendingRatio ( resultDTO . getPendingTotal ( ) = = 0 | | resultDTO . getProjectTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getPendingTotal ( ) / ( float ) resultDTO . getProjectTotal ( ) ) ) ) ;
resultDTO . setPendingRatio ( resultDTO . getPendingTotal ( ) = = NumConstant . ZERO | | resultDTO . getProjectTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getPendingTotal ( ) / ( float ) resultDTO . getProjectTotal ( ) ) ) ) ;
resultDTO . setClosedProjectTotal ( closedProjectTotal ) ;
resultDTO . setClosedProjectRatio ( resultDTO . getClosedProjectTotal ( ) = = 0 | | resultDTO . getProjectTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedProjectTotal ( ) / ( float ) resultDTO . getProjectTotal ( ) ) ) ) ;
resultDTO . setClosedProjectRatio ( resultDTO . getClosedProjectTotal ( ) = = NumConstant . ZERO | | resultDTO . getProjectTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedProjectTotal ( ) / ( float ) resultDTO . getProjectTotal ( ) ) ) ) ;
return resultDTO ;
}
@ -220,21 +221,21 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
gridIds . add ( formDTO . getGridId ( ) ) ;
List < SubGridUserResultDTO > userList = dataStatsDao . getSubGridUser ( gridIds , formDTO . getDateId ( ) ) ;
if ( userList . size ( ) > NumConstant . ZERO ) {
resultDTO . setUserTotal ( userList . get ( 0 ) . getUserTotal ( ) ) ;
resultDTO . setResiTotal ( userList . get ( 0 ) . getResiTotal ( ) ) ;
resultDTO . setResiRatio ( resultDTO . getResiTotal ( ) = = 0 | | resultDTO . getUserTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getResiTotal ( ) / ( float ) resultDTO . getUserTotal ( ) ) ) ) ;
resultDTO . setPartyMemberTotal ( userList . get ( 0 ) . getPartyMemberTotal ( ) ) ;
resultDTO . setPartyMemberRatio ( resultDTO . getPartyMemberTotal ( ) = = 0 | | resultDTO . getUserTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getPartyMemberTotal ( ) / ( float ) resultDTO . getUserTotal ( ) ) ) ) ;
resultDTO . setUserTotal ( userList . get ( NumConstant . ZERO ) . getUserTotal ( ) ) ;
resultDTO . setResiTotal ( userList . get ( NumConstant . ZERO ) . getResiTotal ( ) ) ;
resultDTO . setResiRatio ( resultDTO . getResiTotal ( ) = = NumConstant . ZERO | | resultDTO . getUserTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getResiTotal ( ) / ( float ) resultDTO . getUserTotal ( ) ) ) ) ;
resultDTO . setPartyMemberTotal ( userList . get ( NumConstant . ZERO ) . getPartyMemberTotal ( ) ) ;
resultDTO . setPartyMemberRatio ( resultDTO . getPartyMemberTotal ( ) = = NumConstant . ZERO | | resultDTO . getUserTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getPartyMemberTotal ( ) / ( float ) resultDTO . getUserTotal ( ) ) ) ) ;
}
//2.查询网格下最新群组日统计数据
List < SubGridGroupResultDTO > groupList = dataStatsDao . getSubGridGroup ( gridIds , formDTO . getDateId ( ) ) ;
if ( groupList . size ( ) > NumConstant . ZERO ) {
resultDTO . setGroupTotal ( groupList . get ( 0 ) . getGroupTotal ( ) ) ;
resultDTO . setOrdinaryTotal ( groupList . get ( 0 ) . getOrdinaryTotal ( ) ) ;
resultDTO . setOrdinaryRatio ( resultDTO . getOrdinaryTotal ( ) = = 0 | | resultDTO . getGroupTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getOrdinaryTotal ( ) / ( float ) resultDTO . getGroupTotal ( ) ) ) ) ;
resultDTO . setBranchTotal ( groupList . get ( 0 ) . getBranchTotal ( ) ) ;
resultDTO . setBranchRatio ( resultDTO . getBranchTotal ( ) = = 0 | | resultDTO . getGroupTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getBranchTotal ( ) / ( float ) resultDTO . getGroupTotal ( ) ) ) ) ;
resultDTO . setGroupTotal ( groupList . get ( NumConstant . ZERO ) . getGroupTotal ( ) ) ;
resultDTO . setOrdinaryTotal ( groupList . get ( NumConstant . ZERO ) . getOrdinaryTotal ( ) ) ;
resultDTO . setOrdinaryRatio ( resultDTO . getOrdinaryTotal ( ) = = NumConstant . ZERO | | resultDTO . getGroupTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getOrdinaryTotal ( ) / ( float ) resultDTO . getGroupTotal ( ) ) ) ) ;
resultDTO . setBranchTotal ( groupList . get ( NumConstant . ZERO ) . getBranchTotal ( ) ) ;
resultDTO . setBranchRatio ( resultDTO . getBranchTotal ( ) = = NumConstant . ZERO | | resultDTO . getGroupTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getBranchTotal ( ) / ( float ) resultDTO . getGroupTotal ( ) ) ) ) ;
}
//3.查询网格下最新话题日统计数据
@ -245,7 +246,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
List < SubGridFormDTO . Topic > topicShiftIssueList = dataStatsDao . getSubGridTopicShiftIssue ( gridIds , formDTO . getDateId ( ) ) ;
//热议中话题-网格日统计数据
List < SubGridFormDTO . Topic > hotdiscussList = dataStatsDao . getSubGridTopicHotDiscuss ( gridIds , formDTO . getDateId ( ) ) ;
AtomicReference < Integer > closedTotal = new AtomicReference < > ( 0 ) ;
AtomicReference < Integer > closedTotal = new AtomicReference < > ( NumConstant . ZERO ) ;
if ( topicList . size ( ) > NumConstant . ZERO ) {
resultDTO . setTopicTotal ( topicList . stream ( ) . collect ( Collectors . summingInt ( SubGridFormDTO . Topic : : getTopicCount ) ) ) ;
topicList . forEach ( t - > {
@ -256,38 +257,38 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
}
//转议题
if ( topicShiftIssueList . size ( ) > NumConstant . ZERO ) {
resultDTO . setShiftIssueTotal ( topicShiftIssueList . get ( 0 ) . getShiftedIssueTotal ( ) ) ;
resultDTO . setShiftIssueRatio ( resultDTO . getShiftIssueTotal ( ) = = 0 | | resultDTO . getTopicTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getShiftIssueTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setShiftIssueTotal ( topicShiftIssueList . get ( NumConstant . ZERO ) . getShiftedIssueTotal ( ) ) ;
resultDTO . setShiftIssueRatio ( resultDTO . getShiftIssueTotal ( ) = = NumConstant . ZERO | | resultDTO . getTopicTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getShiftIssueTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
}
//热议中
if ( hotdiscussList . size ( ) > NumConstant . ZERO ) {
resultDTO . setDiscussingTotal ( hotdiscussList . get ( 0 ) . getTopicCount ( ) ) ;
resultDTO . setDiscussingRatio ( resultDTO . getDiscussingTotal ( ) = = 0 | | resultDTO . getTopicTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getDiscussingTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setDiscussingTotal ( hotdiscussList . get ( NumConstant . ZERO ) . getTopicCount ( ) ) ;
resultDTO . setDiscussingRatio ( resultDTO . getDiscussingTotal ( ) = = NumConstant . ZERO | | resultDTO . getTopicTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getDiscussingTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
}
//已处理
resultDTO . setClosedTopicTotal ( closedTotal . get ( ) ) ;
resultDTO . setClosedTopicRatio ( resultDTO . getClosedTopicTotal ( ) = = 0 | | resultDTO . getTopicTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedTopicTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setClosedTopicRatio ( resultDTO . getClosedTopicTotal ( ) = = NumConstant . ZERO | | resultDTO . getTopicTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedTopicTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
//4 .查询网格下最新议题日统计数据
//NumConstant.FOUR .查询网格下最新议题日统计数据
List < SubGridIssueResultDTO > issueList = dataStatsDao . getSubGridIssue ( gridIds , formDTO . getDateId ( ) ) ;
if ( issueList . size ( ) > NumConstant . ZERO ) {
resultDTO . setIssueTotal ( issueList . get ( 0 ) . getIssueTotal ( ) ) ;
resultDTO . setVotingTotal ( issueList . get ( 0 ) . getVotingTotal ( ) ) ;
resultDTO . setVotingRatio ( resultDTO . getVotingTotal ( ) = = 0 | | resultDTO . getIssueTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getVotingTotal ( ) / ( float ) resultDTO . getIssueTotal ( ) ) ) ) ;
resultDTO . setClosedIssueTotal ( issueList . get ( 0 ) . getClosedIssueTotal ( ) ) ;
resultDTO . setClosedIssueRatio ( resultDTO . getClosedIssueTotal ( ) = = 0 | | resultDTO . getIssueTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedIssueTotal ( ) / ( float ) resultDTO . getIssueTotal ( ) ) ) ) ;
resultDTO . setShiftProjectTotal ( issueList . get ( 0 ) . getShiftProjectTotal ( ) ) ;
resultDTO . setShiftProjectRatio ( resultDTO . getShiftProjectTotal ( ) = = 0 | | resultDTO . getIssueTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getShiftProjectTotal ( ) / ( float ) resultDTO . getIssueTotal ( ) ) ) ) ;
resultDTO . setIssueTotal ( issueList . get ( NumConstant . ZERO ) . getIssueTotal ( ) ) ;
resultDTO . setVotingTotal ( issueList . get ( NumConstant . ZERO ) . getVotingTotal ( ) ) ;
resultDTO . setVotingRatio ( resultDTO . getVotingTotal ( ) = = NumConstant . ZERO | | resultDTO . getIssueTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getVotingTotal ( ) / ( float ) resultDTO . getIssueTotal ( ) ) ) ) ;
resultDTO . setClosedIssueTotal ( issueList . get ( NumConstant . ZERO ) . getClosedIssueTotal ( ) ) ;
resultDTO . setClosedIssueRatio ( resultDTO . getClosedIssueTotal ( ) = = NumConstant . ZERO | | resultDTO . getIssueTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedIssueTotal ( ) / ( float ) resultDTO . getIssueTotal ( ) ) ) ) ;
resultDTO . setShiftProjectTotal ( issueList . get ( NumConstant . ZERO ) . getShiftProjectTotal ( ) ) ;
resultDTO . setShiftProjectRatio ( resultDTO . getShiftProjectTotal ( ) = = NumConstant . ZERO | | resultDTO . getIssueTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getShiftProjectTotal ( ) / ( float ) resultDTO . getIssueTotal ( ) ) ) ) ;
}
//5.查询网格下最新项目日统计数据
List < SubGridProjectResultDTO > projectList = dataStatsDao . getSubGridProject ( gridIds , formDTO . getDateId ( ) ) ;
if ( projectList . size ( ) > NumConstant . ZERO ) {
resultDTO . setProjectTotal ( projectList . get ( 0 ) . getProjectTotal ( ) ) ;
resultDTO . setPendingTotal ( projectList . get ( 0 ) . getPendingTotal ( ) ) ;
resultDTO . setPendingRatio ( resultDTO . getPendingTotal ( ) = = 0 | | resultDTO . getProjectTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getPendingTotal ( ) / ( float ) resultDTO . getProjectTotal ( ) ) ) ) ;
resultDTO . setClosedProjectTotal ( projectList . get ( 0 ) . getClosedProjectTotal ( ) ) ;
resultDTO . setClosedProjectRatio ( resultDTO . getClosedProjectTotal ( ) = = 0 | | resultDTO . getProjectTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedProjectTotal ( ) / ( float ) resultDTO . getProjectTotal ( ) ) ) ) ;
resultDTO . setProjectTotal ( projectList . get ( NumConstant . ZERO ) . getProjectTotal ( ) ) ;
resultDTO . setPendingTotal ( projectList . get ( NumConstant . ZERO ) . getPendingTotal ( ) ) ;
resultDTO . setPendingRatio ( resultDTO . getPendingTotal ( ) = = NumConstant . ZERO | | resultDTO . getProjectTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getPendingTotal ( ) / ( float ) resultDTO . getProjectTotal ( ) ) ) ) ;
resultDTO . setClosedProjectTotal ( projectList . get ( NumConstant . ZERO ) . getClosedProjectTotal ( ) ) ;
resultDTO . setClosedProjectRatio ( resultDTO . getClosedProjectTotal ( ) = = NumConstant . ZERO | | resultDTO . getProjectTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedProjectTotal ( ) / ( float ) resultDTO . getProjectTotal ( ) ) ) ) ;
}
return resultDTO ;
@ -339,12 +340,12 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
dto . setResiTotal ( u . getResiTotal ( ) ) ;
}
}
dto . setPartyMemberRatio ( dto . getPartyMemberTotal ( ) = = 0 | | dto . getUserTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getPartyMemberTotal ( ) / ( float ) dto . getUserTotal ( ) ) ) ) ;
dto . setResiRatio ( dto . getResiTotal ( ) = = 0 | | dto . getUserTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getResiTotal ( ) / ( float ) dto . getUserTotal ( ) ) ) ) ;
dto . setPartyMemberRatio ( dto . getPartyMemberTotal ( ) = = NumConstant . ZERO | | dto . getUserTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getPartyMemberTotal ( ) / ( float ) dto . getUserTotal ( ) ) ) ) ;
dto . setResiRatio ( dto . getResiTotal ( ) = = NumConstant . ZERO | | dto . getUserTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getResiTotal ( ) / ( float ) dto . getUserTotal ( ) ) ) ) ;
resultList . add ( dto ) ;
}
//4 .按要求排序并返回
//NumConstant.FOUR .按要求排序并返回
Collections . sort ( resultList , new Comparator < SubAgencyUserResultDTO > ( ) {
@Override
public int compare ( SubAgencyUserResultDTO o1 , SubAgencyUserResultDTO o2 ) {
@ -408,12 +409,12 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
dto . setResiTotal ( re . getResiTotal ( ) ) ;
}
}
dto . setPartyMemberRatio ( dto . getPartyMemberTotal ( ) = = 0 | | dto . getUserTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getPartyMemberTotal ( ) / ( float ) dto . getUserTotal ( ) ) ) ) ;
dto . setResiRatio ( dto . getResiTotal ( ) = = 0 | | dto . getUserTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getResiTotal ( ) / ( float ) dto . getUserTotal ( ) ) ) ) ;
dto . setPartyMemberRatio ( dto . getPartyMemberTotal ( ) = = NumConstant . ZERO | | dto . getUserTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getPartyMemberTotal ( ) / ( float ) dto . getUserTotal ( ) ) ) ) ;
dto . setResiRatio ( dto . getResiTotal ( ) = = NumConstant . ZERO | | dto . getUserTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getResiTotal ( ) / ( float ) dto . getUserTotal ( ) ) ) ) ;
resultList . add ( dto ) ;
}
//4 .按要求排序并返回
//NumConstant.FOUR .按要求排序并返回
Collections . sort ( resultList , new Comparator < SubGridUserResultDTO > ( ) {
@Override
public int compare ( SubGridUserResultDTO o1 , SubGridUserResultDTO o2 ) {
@ -477,12 +478,12 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
dto . setBranchTotal ( u . getBranchTotal ( ) ) ;
}
}
dto . setOrdinaryRatio ( dto . getOrdinaryTotal ( ) = = 0 | | dto . getGroupTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getOrdinaryTotal ( ) / ( float ) dto . getGroupTotal ( ) ) ) ) ;
dto . setBranchRatio ( dto . getBranchTotal ( ) = = 0 | | dto . getGroupTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getBranchTotal ( ) / ( float ) dto . getGroupTotal ( ) ) ) ) ;
dto . setOrdinaryRatio ( dto . getOrdinaryTotal ( ) = = NumConstant . ZERO | | dto . getGroupTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getOrdinaryTotal ( ) / ( float ) dto . getGroupTotal ( ) ) ) ) ;
dto . setBranchRatio ( dto . getBranchTotal ( ) = = NumConstant . ZERO | | dto . getGroupTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getBranchTotal ( ) / ( float ) dto . getGroupTotal ( ) ) ) ) ;
resultList . add ( dto ) ;
}
//4 .按要求排序并返回
//NumConstant.FOUR .按要求排序并返回
Collections . sort ( resultList , new Comparator < SubAgencyGroupResultDTO > ( ) {
@Override
public int compare ( SubAgencyGroupResultDTO o1 , SubAgencyGroupResultDTO o2 ) {
@ -543,12 +544,12 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
dto . setBranchTotal ( re . getBranchTotal ( ) ) ;
}
}
dto . setOrdinaryRatio ( dto . getOrdinaryTotal ( ) = = 0 | | dto . getGroupTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getOrdinaryTotal ( ) / ( float ) dto . getGroupTotal ( ) ) ) ) ;
dto . setBranchRatio ( dto . getBranchTotal ( ) = = 0 | | dto . getGroupTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getBranchTotal ( ) / ( float ) dto . getGroupTotal ( ) ) ) ) ;
dto . setOrdinaryRatio ( dto . getOrdinaryTotal ( ) = = NumConstant . ZERO | | dto . getGroupTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getOrdinaryTotal ( ) / ( float ) dto . getGroupTotal ( ) ) ) ) ;
dto . setBranchRatio ( dto . getBranchTotal ( ) = = NumConstant . ZERO | | dto . getGroupTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getBranchTotal ( ) / ( float ) dto . getGroupTotal ( ) ) ) ) ;
resultList . add ( dto ) ;
}
//4 .按要求排序并返回
//NumConstant.FOUR .按要求排序并返回
Collections . sort ( resultList , new Comparator < SubGridGroupResultDTO > ( ) {
@Override
public int compare ( SubGridGroupResultDTO o1 , SubGridGroupResultDTO o2 ) {
@ -604,10 +605,10 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
List < SubAgencyFormDTO . Topic > hotdiscuss = dataStatsDao . getSubAgencyTopicHotDiscuss ( agencyIds , formDTO . getDateId ( ) ) ;
subAgencyList . forEach ( sub - > {
SubAgencyTopicResultDTO resultDTO = new SubAgencyTopicResultDTO ( ) ;
AtomicInteger topicTotal = new AtomicInteger ( 0 ) ;
AtomicInteger closedTotal = new AtomicInteger ( 0 ) ;
AtomicInteger shiftIssueTotal = new AtomicInteger ( 0 ) ;
AtomicInteger hotdiscussTotal = new AtomicInteger ( 0 ) ;
AtomicInteger topicTotal = new AtomicInteger ( NumConstant . ZERO ) ;
AtomicInteger closedTotal = new AtomicInteger ( NumConstant . ZERO ) ;
AtomicInteger shiftIssueTotal = new AtomicInteger ( NumConstant . ZERO ) ;
AtomicInteger hotdiscussTotal = new AtomicInteger ( NumConstant . ZERO ) ;
topic . forEach ( t - > {
if ( t . getAgencyId ( ) . equals ( sub . getAgencyId ( ) ) ) {
topicTotal . addAndGet ( t . getTopicCount ( ) ) ;
@ -633,28 +634,25 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
resultDTO . setAreaCode ( null = = sub . getAreaCode ( ) ? "" : sub . getAreaCode ( ) ) ;
resultDTO . setTopicTotal ( topicTotal . get ( ) ) ;
resultDTO . setDiscussingTotal ( hotdiscussTotal . get ( ) ) ;
resultDTO . setDiscussingRatio ( resultDTO . getDiscussingTotal ( ) = = 0 | | resultDTO . getTopicTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getDiscussingTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setDiscussingRatio ( resultDTO . getDiscussingTotal ( ) = = NumConstant . ZERO | | resultDTO . getTopicTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getDiscussingTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setClosedTopicTotal ( closedTotal . get ( ) ) ;
resultDTO . setClosedTopicRatio ( resultDTO . getClosedTopicTotal ( ) = = 0 | | resultDTO . getTopicTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedTopicTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setClosedTopicRatio ( resultDTO . getClosedTopicTotal ( ) = = NumConstant . ZERO | | resultDTO . getTopicTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedTopicTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setShiftIssueTotal ( shiftIssueTotal . get ( ) ) ;
resultDTO . setShiftIssueRatio ( resultDTO . getShiftIssueTotal ( ) = = 0 | | resultDTO . getTopicTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getShiftIssueTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setShiftIssueRatio ( resultDTO . getShiftIssueTotal ( ) = = NumConstant . ZERO | | resultDTO . getTopicTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getShiftIssueTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultList . add ( resultDTO ) ;
} ) ;
//3.按要求排序并返回
Collections . sort ( resultList , new Comparator < SubAgencyTopicResultDTO > ( ) {
@Override
public int compare ( SubAgencyTopicResultDTO o1 , SubAgencyTopicResultDTO o2 ) {
if ( "discussing" . equals ( formDTO . getType ( ) ) ) {
return o2 . getDiscussingTotal ( ) . compareTo ( o1 . getDiscussingTotal ( ) ) ;
} else if ( "closed" . equals ( formDTO . getType ( ) ) ) {
return o2 . getClosedTopicTotal ( ) . compareTo ( o1 . getClosedTopicTotal ( ) ) ;
} else if ( "shiftIssue" . equals ( formDTO . getType ( ) ) ) {
return o2 . getShiftIssueTotal ( ) . compareTo ( o1 . getShiftIssueTotal ( ) ) ;
} else {
return o2 . getTopicTotal ( ) . compareTo ( o1 . getTopicTotal ( ) ) ;
}
resultList . sort ( ( o1 , o2 ) - > {
if ( "discussing" . equals ( formDTO . getType ( ) ) ) {
return o2 . getDiscussingTotal ( ) . compareTo ( o1 . getDiscussingTotal ( ) ) ;
} else if ( "closed" . equals ( formDTO . getType ( ) ) ) {
return o2 . getClosedTopicTotal ( ) . compareTo ( o1 . getClosedTopicTotal ( ) ) ;
} else if ( "shiftIssue" . equals ( formDTO . getType ( ) ) ) {
return o2 . getShiftIssueTotal ( ) . compareTo ( o1 . getShiftIssueTotal ( ) ) ;
} else {
return o2 . getTopicTotal ( ) . compareTo ( o1 . getTopicTotal ( ) ) ;
}
} ) ;
@ -700,10 +698,10 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
List < SubGridFormDTO . Topic > hotdiscuss = dataStatsDao . getSubGridTopicHotDiscuss ( gridIds , formDTO . getDateId ( ) ) ;
gridList . forEach ( gr - > {
SubGridTopicResultDTO resultDTO = new SubGridTopicResultDTO ( ) ;
AtomicInteger topicTotal = new AtomicInteger ( 0 ) ;
AtomicInteger closedTotal = new AtomicInteger ( 0 ) ;
AtomicInteger shiftIssueTotal = new AtomicInteger ( 0 ) ;
AtomicInteger hotdiscussTotal = new AtomicInteger ( 0 ) ;
AtomicInteger topicTotal = new AtomicInteger ( NumConstant . ZERO ) ;
AtomicInteger closedTotal = new AtomicInteger ( NumConstant . ZERO ) ;
AtomicInteger shiftIssueTotal = new AtomicInteger ( NumConstant . ZERO ) ;
AtomicInteger hotdiscussTotal = new AtomicInteger ( NumConstant . ZERO ) ;
topic . forEach ( t - > {
if ( t . getGridId ( ) . equals ( gr . getGridId ( ) ) ) {
topicTotal . addAndGet ( t . getTopicCount ( ) ) ;
@ -727,11 +725,11 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
resultDTO . setGridName ( gr . getGridName ( ) ) ;
resultDTO . setTopicTotal ( topicTotal . get ( ) ) ;
resultDTO . setDiscussingTotal ( hotdiscussTotal . get ( ) ) ;
resultDTO . setDiscussingRatio ( resultDTO . getDiscussingTotal ( ) = = 0 | | resultDTO . getTopicTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getDiscussingTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setDiscussingRatio ( resultDTO . getDiscussingTotal ( ) = = NumConstant . ZERO | | resultDTO . getTopicTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getDiscussingTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setClosedTopicTotal ( closedTotal . get ( ) ) ;
resultDTO . setClosedTopicRatio ( resultDTO . getClosedTopicTotal ( ) = = 0 | | resultDTO . getTopicTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedTopicTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setClosedTopicRatio ( resultDTO . getClosedTopicTotal ( ) = = NumConstant . ZERO | | resultDTO . getTopicTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getClosedTopicTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setShiftIssueTotal ( shiftIssueTotal . get ( ) ) ;
resultDTO . setShiftIssueRatio ( resultDTO . getShiftIssueTotal ( ) = = 0 | | resultDTO . getTopicTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getShiftIssueTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultDTO . setShiftIssueRatio ( resultDTO . getShiftIssueTotal ( ) = = NumConstant . ZERO | | resultDTO . getTopicTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) resultDTO . getShiftIssueTotal ( ) / ( float ) resultDTO . getTopicTotal ( ) ) ) ) ;
resultList . add ( resultDTO ) ;
} ) ;
@ -802,13 +800,13 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
dto . setShiftProjectTotal ( u . getShiftProjectTotal ( ) ) ;
}
}
dto . setVotingRatio ( dto . getVotingTotal ( ) = = 0 | | dto . getIssueTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getVotingTotal ( ) / ( float ) dto . getIssueTotal ( ) ) ) ) ;
dto . setClosedIssueRatio ( dto . getClosedIssueTotal ( ) = = 0 | | dto . getIssueTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getClosedIssueTotal ( ) / ( float ) dto . getIssueTotal ( ) ) ) ) ;
dto . setShiftProjectRatio ( dto . getShiftProjectTotal ( ) = = 0 | | dto . getIssueTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getShiftProjectTotal ( ) / ( float ) dto . getIssueTotal ( ) ) ) ) ;
dto . setVotingRatio ( dto . getVotingTotal ( ) = = NumConstant . ZERO | | dto . getIssueTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getVotingTotal ( ) / ( float ) dto . getIssueTotal ( ) ) ) ) ;
dto . setClosedIssueRatio ( dto . getClosedIssueTotal ( ) = = NumConstant . ZERO | | dto . getIssueTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getClosedIssueTotal ( ) / ( float ) dto . getIssueTotal ( ) ) ) ) ;
dto . setShiftProjectRatio ( dto . getShiftProjectTotal ( ) = = NumConstant . ZERO | | dto . getIssueTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getShiftProjectTotal ( ) / ( float ) dto . getIssueTotal ( ) ) ) ) ;
resultList . add ( dto ) ;
}
//4 .按要求排序并返回
//NumConstant.FOUR .按要求排序并返回
Collections . sort ( resultList , new Comparator < SubAgencyIssueResultDTO > ( ) {
@Override
public int compare ( SubAgencyIssueResultDTO o1 , SubAgencyIssueResultDTO o2 ) {
@ -872,13 +870,13 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
dto . setShiftProjectTotal ( re . getShiftProjectTotal ( ) ) ;
}
}
dto . setVotingRatio ( dto . getVotingTotal ( ) = = 0 | | dto . getIssueTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getVotingTotal ( ) / ( float ) dto . getIssueTotal ( ) ) ) ) ;
dto . setClosedIssueRatio ( dto . getClosedIssueTotal ( ) = = 0 | | dto . getIssueTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getClosedIssueTotal ( ) / ( float ) dto . getIssueTotal ( ) ) ) ) ;
dto . setShiftProjectRatio ( dto . getShiftProjectTotal ( ) = = 0 | | dto . getIssueTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getShiftProjectTotal ( ) / ( float ) dto . getIssueTotal ( ) ) ) ) ;
dto . setVotingRatio ( dto . getVotingTotal ( ) = = NumConstant . ZERO | | dto . getIssueTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getVotingTotal ( ) / ( float ) dto . getIssueTotal ( ) ) ) ) ;
dto . setClosedIssueRatio ( dto . getClosedIssueTotal ( ) = = NumConstant . ZERO | | dto . getIssueTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getClosedIssueTotal ( ) / ( float ) dto . getIssueTotal ( ) ) ) ) ;
dto . setShiftProjectRatio ( dto . getShiftProjectTotal ( ) = = NumConstant . ZERO | | dto . getIssueTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getShiftProjectTotal ( ) / ( float ) dto . getIssueTotal ( ) ) ) ) ;
resultList . add ( dto ) ;
}
//4 .按要求排序并返回
//NumConstant.FOUR .按要求排序并返回
Collections . sort ( resultList , new Comparator < SubGridIssueResultDTO > ( ) {
@Override
public int compare ( SubGridIssueResultDTO o1 , SubGridIssueResultDTO o2 ) {
@ -943,12 +941,12 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
dto . setClosedProjectTotal ( u . getClosedProjectTotal ( ) ) ;
}
}
dto . setPendingRatio ( dto . getPendingTotal ( ) = = 0 | | dto . getProjectTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getPendingTotal ( ) / ( float ) dto . getProjectTotal ( ) ) ) ) ;
dto . setClosedProjectRatio ( dto . getClosedProjectTotal ( ) = = 0 | | dto . getProjectTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getClosedProjectTotal ( ) / ( float ) dto . getProjectTotal ( ) ) ) ) ;
dto . setPendingRatio ( dto . getPendingTotal ( ) = = NumConstant . ZERO | | dto . getProjectTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getPendingTotal ( ) / ( float ) dto . getProjectTotal ( ) ) ) ) ;
dto . setClosedProjectRatio ( dto . getClosedProjectTotal ( ) = = NumConstant . ZERO | | dto . getProjectTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getClosedProjectTotal ( ) / ( float ) dto . getProjectTotal ( ) ) ) ) ;
resultList . add ( dto ) ;
}
//4 .按要求排序并返回
//NumConstant.FOUR .按要求排序并返回
Collections . sort ( resultList , new Comparator < SubAgencyProjectResultDTO > ( ) {
@Override
public int compare ( SubAgencyProjectResultDTO o1 , SubAgencyProjectResultDTO o2 ) {
@ -1009,12 +1007,12 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
dto . setClosedProjectTotal ( re . getClosedProjectTotal ( ) ) ;
}
}
dto . setPendingRatio ( dto . getPendingTotal ( ) = = 0 | | dto . getProjectTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getPendingTotal ( ) / ( float ) dto . getProjectTotal ( ) ) ) ) ;
dto . setClosedProjectRatio ( dto . getClosedProjectTotal ( ) = = 0 | | dto . getProjectTotal ( ) = = 0 ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getClosedProjectTotal ( ) / ( float ) dto . getProjectTotal ( ) ) ) ) ;
dto . setPendingRatio ( dto . getPendingTotal ( ) = = NumConstant . ZERO | | dto . getProjectTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getPendingTotal ( ) / ( float ) dto . getProjectTotal ( ) ) ) ) ;
dto . setClosedProjectRatio ( dto . getClosedProjectTotal ( ) = = NumConstant . ZERO | | dto . getProjectTotal ( ) = = NumConstant . ZERO ? BigDecimal . ZERO : new BigDecimal ( numberFormat . format ( ( float ) dto . getClosedProjectTotal ( ) / ( float ) dto . getProjectTotal ( ) ) ) ) ;
resultList . add ( dto ) ;
}
//4 .按要求排序并返回
//NumConstant.FOUR .按要求排序并返回
Collections . sort ( resultList , new Comparator < SubGridProjectResultDTO > ( ) {
@Override
public int compare ( SubGridProjectResultDTO o1 , SubGridProjectResultDTO o2 ) {
@ -1278,7 +1276,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
resultList . add ( dto ) ;
}
//4 .按要求排序并返回
//NumConstant.FOUR .按要求排序并返回
Collections . sort ( resultList , new Comparator < AgencyGovrnResultDTO > ( ) {
@Override
public int compare ( AgencyGovrnResultDTO o1 , AgencyGovrnResultDTO o2 ) {
@ -1380,7 +1378,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
resultList . add ( dto ) ;
}
//4 .按要求排序并返回
//NumConstant.FOUR .按要求排序并返回
Collections . sort ( resultList , new Comparator < GridGovrnResultDTO > ( ) {
@Override
public int compare ( GridGovrnResultDTO o1 , GridGovrnResultDTO o2 ) {
@ -1388,7 +1386,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
return o2 . getGroupSelfGovernRatio ( ) . compareTo ( o1 . getGroupSelfGovernRatio ( ) ) ;
} else if ( "grid" . equals ( formDTO . getType ( ) ) ) {
return o2 . getGridSelfGovernRatio ( ) . compareTo ( o1 . getGridSelfGovernRatio ( ) ) ;
} else if ( "community" . equals ( formDTO . getType ( ) ) ) {
} else if ( OrgLevelEnum . COMMUNITY . getCode ( ) . equals ( formDTO . getType ( ) ) ) {
return o2 . getCommunityResolvedRatio ( ) . compareTo ( o1 . getCommunityResolvedRatio ( ) ) ;
} else if ( "department" . equals ( formDTO . getType ( ) ) ) {
return o2 . getDistrictDeptResolvedRatio ( ) . compareTo ( o1 . getDistrictDeptResolvedRatio ( ) ) ;
@ -1471,18 +1469,18 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
formDTO . setDateId ( format . format ( yesterday ) ) ;
}
BaseStatsDataResultDTO result = new BaseStatsDataResultDTO ( ) ;
result . setTopicTotal ( 0 ) ;
result . setTopicIncr ( 0 ) ;
result . setTopicTotal ( NumConstant . ZERO ) ;
result . setTopicIncr ( NumConstant . ZERO ) ;
result . setIssueTotal ( 0 ) ;
result . setIssueIncr ( 0 ) ;
result . setProjectTotal ( 0 ) ;
result . setProjectIncr ( 0 ) ;
result . setClosedProjectTotal ( 0 ) ;
result . setClosedProjectIncr ( 0 ) ;
result . setIssueTotal ( NumConstant . ZERO ) ;
result . setIssueIncr ( NumConstant . ZERO ) ;
result . setProjectTotal ( NumConstant . ZERO ) ;
result . setProjectIncr ( NumConstant . ZERO ) ;
result . setClosedProjectTotal ( NumConstant . ZERO ) ;
result . setClosedProjectIncr ( NumConstant . ZERO ) ;
//0 .根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表
//NumConstant.ZERO .根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表
List < String > agencyList = indexService . getAgencyIdsByAgencyId ( formDTO . getAgencyId ( ) ) ;
agencyList . add ( formDTO . getAgencyId ( ) ) ;
TotalAndIncrResultDTO sum = dataStatsDao . getAgencySumTopic ( agencyList , formDTO . getDateId ( ) ) ;
@ -1546,7 +1544,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
List < WorkFactResultDTO > result = new ArrayList < > ( ) ;
//如果是社区 则下级是网格 查询网格的数据
if ( OrgLevelEnum . COMMUNITY . getCode ( ) . equals ( formDTO . getAgencyLevel ( ) ) ) {
//0 .根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表
//NumConstant.ZERO .根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表
List < ScreenCustomerGridDTO > subAgencyList = indexService . getSubGridList ( formDTO . getAgencyId ( ) ) ;
if ( subAgencyList . size ( ) < NumConstant . ONE ) {
return null ;
@ -1585,7 +1583,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
result . add ( resultDTO ) ;
} ) ;
} else {
//0 .根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表
//NumConstant.ZERO .根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表
List < ScreenCustomerAgencyDTO > subAgencyList = indexService . getSubAgencyListByAgency ( formDTO . getAgencyId ( ) ) ;
if ( subAgencyList . size ( ) < NumConstant . ONE ) {
return null ;
@ -1636,9 +1634,9 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
resultDTO . setRoutineWorkCount ( patrolRecordDTO . getRoutineWorkCount ( ) ) ;
resultDTO . setPatrolTotal ( patrolRecordDTO . getPatrolTotal ( ) ) ;
Integer totalTime = patrolRecordDTO . getTotalTime ( ) ;
if ( totalTime ! = null | | totalTime > 0 ) {
if ( totalTime ! = null | | totalTime > NumConstant . ZERO ) {
int minutes = totalTime / 60 ;
if ( minutes > 0 ) {
if ( minutes > NumConstant . ZERO ) {
String totalTimeDesc = minutes / 60 + "小时" + minutes % 60 + "分" ;
resultDTO . setPatrolTotalTime ( totalTimeDesc ) ;
}
@ -1649,12 +1647,12 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
private Integer getTotal ( Map < String , Integer > startMap , Map < String , Integer > endMap , String agencyId ) {
Integer total1 = startMap . getOrDefault ( agencyId , NumConstant . ZERO ) ;
Integer total2 = endMap . getOrDefault ( agencyId , NumConstant . ZERO ) ;
return Math . max ( total2 - total1 , 0 ) ;
return Math . max ( total2 - total1 , NumConstant . ZERO ) ;
}
private String getPercentage ( Integer countInt , Integer totalInt ) {
if ( NumConstant . ZERO = = totalInt ) {
return "0 %" ;
return "NumConstant.ZERO %" ;
}
BigDecimal count = new BigDecimal ( countInt ) ;
BigDecimal total = new BigDecimal ( totalInt ) ;
@ -1681,7 +1679,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
//根据组织级别判断查询直属下级组织或网格数据
//2.直属网格
if ( "community" . equals ( formDTO . getAgencyLevel ( ) ) ) {
if ( OrgLevelEnum . COMMUNITY . getCode ( ) . equals ( formDTO . getAgencyLevel ( ) ) ) {
//2-1.查询组织直属网格列表【网格维度】
List < ScreenCustomerGridDTO > gridList = indexService . getSubGridList ( formDTO . getAgencyId ( ) ) ;
if ( gridList . size ( ) < NumConstant . ONE ) {
@ -1729,8 +1727,8 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
} ) ;
}
//4 .按用户数降序排序并返回
Collections . sort ( resultList , ( o1 , o2 ) - > {
//NumConstant.FOUR .按用户数降序排序并返回
resultList . sort ( ( o1 , o2 ) - > {
//降序
return o2 . getUserTotal ( ) . compareTo ( o1 . getUserTotal ( ) ) ;
} ) ;
@ -1757,7 +1755,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
//根据组织级别判断查询直属下级组织或网格数据
//2.直属网格
if ( "community" . equals ( formDTO . getAgencyLevel ( ) ) ) {
if ( OrgLevelEnum . COMMUNITY . getCode ( ) . equals ( formDTO . getAgencyLevel ( ) ) ) {
//2-1.查询组织直属网格列表【网格维度】
List < ScreenCustomerGridDTO > gridList = indexService . getSubGridList ( formDTO . getAgencyId ( ) ) ;
if ( gridList . size ( ) < NumConstant . ONE ) {
@ -1798,7 +1796,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
List < SubAgencyFormDTO . Topic > hotdiscuss = dataStatsDao . getSubAgencyTopicHotDiscuss ( agencyIds , formDTO . getDateId ( ) ) ;
//3-3.查询直属下级组织小组日统计数据
List < SubAgencyGroupResultDTO > list = dataStatsDao . getSubAgencyGroup ( agencyIds , formDTO . getDateId ( ) ) ;
//3-4 .封装数据
//3-NumConstant.FOUR .封装数据
subAgencyList . forEach ( sub - > {
SubTopicAndGroupResultDTO resultDTO = new SubTopicAndGroupResultDTO ( ) ;
resultDTO . setOrgId ( sub . getAgencyId ( ) ) ;
@ -1817,12 +1815,12 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
} ) ;
}
//4 .按用户数降序排序并返回
Collections . sort ( resultList , ( o1 , o2 ) - > {
//NumConstant.FOUR .按用户数降序排序并返回
resultList . sort ( ( o1 , o2 ) - > {
//降序
return o2 . getTopicTotal ( ) . compareTo ( o1 . getTopicTotal ( ) ) ;
} ) ;
AtomicInteger i = new AtomicInteger ( 1 ) ;
AtomicInteger i = new AtomicInteger ( NumConstant . ONE ) ;
resultList . forEach ( e - > e . setSort ( i . getAndIncrement ( ) ) ) ;
return resultList ;
}
@ -1876,24 +1874,27 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
* /
@Override
public void CustomerDataManage ( CustomerDataManageFormDTO formDTO , HttpServletResponse response ) throws Exception {
String openTime = formDTO . getStartTime ( ) ;
List < CustomerDataManageResultDTO . CustomerDataManage > result = operateExport ( formDTO ) . getList ( ) ;
if ( ! CollectionUtils . isEmpty ( result ) ) {
CustomerDataManageResultDTO . CustomerDataManage c = new CustomerDataManageResultDTO . CustomerDataManage ( ) ;
c . setOrgName ( "合计" ) ;
c . setUserCount ( result . stream ( ) . collect ( Collectors . summingInt ( CustomerDataManageResultDTO . CustomerDataManage : : getUserCount ) ) ) ;
c . setResidentCount ( result . stream ( ) . collect ( Collectors . summingInt ( CustomerDataManageResultDTO . CustomerDataManage : : getResidentCount ) ) ) ;
c . setPartyMemberCount ( result . stream ( ) . collect ( Collectors . summingInt ( CustomerDataManageResultDTO . CustomerDataManage : : getPartyMemberCount ) ) ) ;
c . setGroupCount ( result . stream ( ) . collect ( Collectors . summingInt ( CustomerDataManageResultDTO . CustomerDataManage : : getGroupCount ) ) ) ;
c . setTopicCount ( result . stream ( ) . collect ( Collectors . summingInt ( CustomerDataManageResultDTO . CustomerDataManage : : getTopicCount ) ) ) ;
c . setIssueCount ( result . stream ( ) . collect ( Collectors . summingInt ( CustomerDataManageResultDTO . CustomerDataManage : : getIssueCount ) ) ) ;
c . setProjectCount ( result . stream ( ) . collect ( Collectors . summingInt ( CustomerDataManageResultDTO . CustomerDataManage : : getProjectCount ) ) ) ;
c . setClosedProjectCount ( result . stream ( ) . collect ( Collectors . summingInt ( CustomerDataManageResultDTO . CustomerDataManage : : getClosedProjectCount ) ) ) ;
c . setPatrolPeopleCount ( result . stream ( ) . collect ( Collectors . summingInt ( CustomerDataManageResultDTO . CustomerDataManage : : getPatrolPeopleCount ) ) ) ;
c . setPatrolCount ( result . stream ( ) . collect ( Collectors . summingInt ( CustomerDataManageResultDTO . CustomerDataManage : : getPatrolCount ) ) ) ;
c . setPatrolDurationInteger ( result . stream ( ) . collect ( Collectors . summingInt ( CustomerDataManageResultDTO . CustomerDataManage : : getPatrolDurationInteger ) ) ) ;
c . setUserCount ( result . stream ( ) . mapToInt ( CustomerDataManageResultDTO . CustomerDataManage : : getUserCount ) . sum ( ) ) ;
c . setResidentCount ( result . stream ( ) . mapToInt ( CustomerDataManageResultDTO . CustomerDataManage : : getResidentCount ) . sum ( ) ) ;
c . setPartyMemberCount ( result . stream ( ) . mapToInt ( CustomerDataManageResultDTO . CustomerDataManage : : getPartyMemberCount ) . sum ( ) ) ;
c . setGroupCount ( result . stream ( ) . mapToInt ( CustomerDataManageResultDTO . CustomerDataManage : : getGroupCount ) . sum ( ) ) ;
c . setTopicCount ( result . stream ( ) . mapToInt ( CustomerDataManageResultDTO . CustomerDataManage : : getTopicCount ) . sum ( ) ) ;
c . setIssueCount ( result . stream ( ) . mapToInt ( CustomerDataManageResultDTO . CustomerDataManage : : getIssueCount ) . sum ( ) ) ;
c . setProjectCount ( result . stream ( ) . mapToInt ( CustomerDataManageResultDTO . CustomerDataManage : : getProjectCount ) . sum ( ) ) ;
c . setClosedProjectCount ( result . stream ( ) . mapToInt ( CustomerDataManageResultDTO . CustomerDataManage : : getClosedProjectCount ) . sum ( ) ) ;
c . setPatrolPeopleCount ( result . stream ( ) . mapToInt ( CustomerDataManageResultDTO . CustomerDataManage : : getPatrolPeopleCount ) . sum ( ) ) ;
c . setPatrolRoutineWorkTimes ( result . stream ( ) . mapToInt ( CustomerDataManageResultDTO . CustomerDataManage : : getPatrolRoutineWorkTimes ) . sum ( ) ) ;
c . setPatrolCount ( result . stream ( ) . mapToInt ( CustomerDataManageResultDTO . CustomerDataManage : : getPatrolCount ) . sum ( ) ) ;
c . setPatrolDurationInteger ( result . stream ( ) . mapToInt ( CustomerDataManageResultDTO . CustomerDataManage : : getPatrolDurationInteger ) . sum ( ) ) ;
c . setPatrolDuration ( getHm ( c . getPatrolDurationInteger ( ) ) ) ;
result . add ( c ) ;
}
formDTO . setStartTime ( openTime ) ;
String fileName = excelName ( formDTO ) ;
ExcelUtils . exportExcelToTargetDisposeAll ( response , fileName , result , CustomerDataManageExcel . class ) ;
}
@ -1908,7 +1909,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
String result = "0分钟" ;
if ( seconds > = NumConstant . SIXTY ) {
Integer hours = seconds / 3600 ;
Integer minutes = seconds % 3600 / 60 ;
Integer minutes = seconds % 3600 / NumConstant . SIXTY ;
result = ( hours < NumConstant . ONE ? "" : hours + "小时" ) + ( minutes < NumConstant . ONE ? "" : minutes + "分钟" ) ;
} else if ( seconds < NumConstant . SIXTY & & seconds > NumConstant . ZERO ) {
result = "1分钟" ;
@ -1928,20 +1929,20 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
s . append ( agencyName ) ;
if ( StringUtils . isNotBlank ( formDTO . getStartTime ( ) ) ) {
String startTime = formDTO . getStartTime ( ) ;
String sYear = startTime . substring ( 0 , 4 ) ;
String sMonth = startTime . substring ( 4 , 6 ) ;
String sDay = startTime . substring ( 6 , 8 ) ;
String sYear = startTime . substring ( NumConstant . ZERO , NumConstant . FOUR ) ;
String sMonth = startTime . substring ( NumConstant . FOUR , NumConstant . SIX ) ;
String sDay = startTime . substring ( NumConstant . SIX , NumConstant . EIGHT ) ;
String endTime = formDTO . getEndTime ( ) ;
String eYear = endTime . substring ( 0 , 4 ) ;
String eMonth = endTime . substring ( 4 , 6 ) ;
String eDay = endTime . substring ( 6 , 8 ) ;
String eYear = endTime . substring ( NumConstant . ZERO , NumConstant . FOUR ) ;
String eMonth = endTime . substring ( NumConstant . FOUR , NumConstant . SIX ) ;
String eDay = endTime . substring ( NumConstant . SIX , NumConstant . EIGHT ) ;
s . append ( sYear ) . append ( "年" ) . append ( sMonth ) . append ( "月" ) . append ( sDay ) . append ( "日-" )
. append ( eYear ) . append ( "年" ) . append ( eMonth ) . append ( "月" ) . append ( eDay ) . append ( "日区间新增值" ) ;
} else {
String endTime = formDTO . getEndTime ( ) ;
String eYear = endTime . substring ( 0 , 4 ) ;
String eMonth = endTime . substring ( 4 , 6 ) ;
String eDay = endTime . substring ( 6 , 8 ) ;
String eYear = endTime . substring ( NumConstant . ZERO , NumConstant . FOUR ) ;
String eMonth = endTime . substring ( NumConstant . FOUR , NumConstant . SIX ) ;
String eDay = endTime . substring ( NumConstant . SIX , NumConstant . EIGHT ) ;
s . append ( eYear ) . append ( "年" ) . append ( eMonth ) . append ( "月" ) . append ( eDay ) . append ( "日截止累计值" ) ;
}
return s . toString ( ) ;
@ -1976,7 +1977,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
}
//组织或网格Id集合
List < String > idList = agencyGrid . getAgencyGridList ( ) . stream ( ) . map ( ScreenAgencyOrGridListDTO . AgencyGrid : : getOrgId ) . collect ( Collectors . toList ( ) ) ;
formDTO . setDataType ( ! "community" . equals ( agencyGrid . getLevel ( ) ) ? "agency" : "grid" ) ;
formDTO . setDataType ( ! OrgLevelEnum . COMMUNITY . getCode ( ) . equals ( agencyGrid . getLevel ( ) ) ? OrgTypeEnum . AGENCY . getCode ( ) : OrgTypeEnum . GRID . getCode ( ) ) ;
formDTO . setIdList ( idList ) ;
resultDTO . setTotal ( idList . size ( ) ) ;
@ -1984,25 +1985,27 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
formDTO . setSourceType ( "end" ) ;
List < CustomerDataManageResultDTO . CustomerDataManage > userEnd = dataStatsDao . regUserList ( formDTO ) ;
HashMap < String , CustomerDataManageResultDTO . CustomerDataManage > uEndMap = new HashMap < > ( ) ;
userEnd . stream ( ) . forEach ( u - > uEndMap . put ( u . getOrgId ( ) , u ) ) ;
userEnd . forEach ( u - > uEndMap . put ( u . getOrgId ( ) , u ) ) ;
List < CustomerDataManageResultDTO . CustomerDataManage > groupEnd = dataStatsDao . groupList ( formDTO ) ;
HashMap < String , CustomerDataManageResultDTO . CustomerDataManage > gEndMap = new HashMap < > ( ) ;
groupEnd . stream ( ) . forEach ( u - > gEndMap . put ( u . getOrgId ( ) , u ) ) ;
groupEnd . forEach ( u - > gEndMap . put ( u . getOrgId ( ) , u ) ) ;
List < CustomerDataManageResultDTO . CustomerDataManage > topicEnd = dataStatsDao . topicList ( formDTO ) ;
HashMap < String , CustomerDataManageResultDTO . CustomerDataManage > tEndMap = new HashMap < > ( ) ;
topicEnd . stream ( ) . forEach ( u - > tEndMap . put ( u . getOrgId ( ) , u ) ) ;
topicEnd . forEach ( u - > tEndMap . put ( u . getOrgId ( ) , u ) ) ;
List < CustomerDataManageResultDTO . CustomerDataManage > issueEnd = dataStatsDao . issueList ( formDTO ) ;
HashMap < String , CustomerDataManageResultDTO . CustomerDataManage > iEndMap = new HashMap < > ( ) ;
issueEnd . stream ( ) . forEach ( u - > iEndMap . put ( u . getOrgId ( ) , u ) ) ;
issueEnd . forEach ( u - > iEndMap . put ( u . getOrgId ( ) , u ) ) ;
List < CustomerDataManageResultDTO . CustomerDataManage > projectEnd = dataStatsDao . projectList ( formDTO ) ;
HashMap < String , CustomerDataManageResultDTO . CustomerDataManage > pEndMap = new HashMap < > ( ) ;
projectEnd . stream ( ) . forEach ( u - > pEndMap . put ( u . getOrgId ( ) , u ) ) ;
projectEnd . forEach ( u - > pEndMap . put ( u . getOrgId ( ) , u ) ) ;
//巡查数据不区分区间差值,只计算累计值,人员做去重处理且是有巡查记录的人员 ==
CustomerDataManageFormDTO patrolForm = ConvertUtils . sourceToTarget ( formDTO , CustomerDataManageFormDTO . class ) ;
patrolForm . setStartTime ( startTimeForm ) ;
List < CustomerDataManageResultDTO . CustomerDataManage > patrolEnd = statsStaffPatrolRecordDailyService . patrolList ( patrolForm ) ;
//4.判断是否需要查询起始日期用户、群组、话题、议题、项目、巡查数据
//获取例行工作次数
List < CustomerDataManageResultDTO . CustomerDataManage > workCountList = statsStaffPatrolRecordDailyService . getPatrolRecordCount ( patrolForm ) ;
//NumConstant.FOUR.判断是否需要查询起始日期用户、群组、话题、议题、项目、巡查数据
HashMap < String , CustomerDataManageResultDTO . CustomerDataManage > uStartMap = new HashMap < > ( ) ;
HashMap < String , CustomerDataManageResultDTO . CustomerDataManage > gStartMap = new HashMap < > ( ) ;
HashMap < String , CustomerDataManageResultDTO . CustomerDataManage > tStartMap = new HashMap < > ( ) ;
@ -2011,87 +2014,101 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
if ( "Interval" . equals ( formDTO . getType ( ) ) ) {
formDTO . setSourceType ( "start" ) ;
List < CustomerDataManageResultDTO . CustomerDataManage > userStart = dataStatsDao . regUserList ( formDTO ) ;
userStart . stream ( ) . forEach ( u - > uStartMap . put ( u . getOrgId ( ) , u ) ) ;
userStart . forEach ( u - > uStartMap . put ( u . getOrgId ( ) , u ) ) ;
List < CustomerDataManageResultDTO . CustomerDataManage > groupStart = dataStatsDao . groupList ( formDTO ) ;
groupStart . stream ( ) . forEach ( u - > gStartMap . put ( u . getOrgId ( ) , u ) ) ;
groupStart . forEach ( u - > gStartMap . put ( u . getOrgId ( ) , u ) ) ;
List < CustomerDataManageResultDTO . CustomerDataManage > topicStart = dataStatsDao . topicList ( formDTO ) ;
topicStart . stream ( ) . forEach ( u - > tStartMap . put ( u . getOrgId ( ) , u ) ) ;
topicStart . forEach ( u - > tStartMap . put ( u . getOrgId ( ) , u ) ) ;
List < CustomerDataManageResultDTO . CustomerDataManage > issueStart = dataStatsDao . issueList ( formDTO ) ;
issueStart . stream ( ) . forEach ( u - > iStartMap . put ( u . getOrgId ( ) , u ) ) ;
issueStart . forEach ( u - > iStartMap . put ( u . getOrgId ( ) , u ) ) ;
List < CustomerDataManageResultDTO . CustomerDataManage > projectStart = dataStatsDao . projectList ( formDTO ) ;
projectStart . stream ( ) . forEach ( u - > pStartMap . put ( u . getOrgId ( ) , u ) ) ;
projectStart . forEach ( u - > pStartMap . put ( u . getOrgId ( ) , u ) ) ;
}
//5.封装数据
agencyGrid . getAgencyGridList ( ) . forEach ( org - > {
for ( ScreenAgencyOrGridListDTO . AgencyGrid org : agencyGrid . getAgencyGridList ( ) ) {
CustomerDataManageResultDTO . CustomerDataManage dto = new CustomerDataManageResultDTO . CustomerDataManage ( ) ;
dto . setOrgId ( org . getOrgId ( ) ) ;
dto . setOrgName ( org . getOrgName ( ) ) ;
int user = 0 ;
int resi = 0 ;
int part = 0 ;
if ( uEndMap . containsKey ( org . getOrgId ( ) ) ) {
int user = NumConstant . ZERO ;
int resi = NumConstant . ZERO ;
int part = NumConstant . ZERO ;
if ( uEndMap . containsKey ( org . getOrgId ( ) ) ) {
user = uEndMap . get ( org . getOrgId ( ) ) . getUserCount ( ) ;
resi = uEndMap . get ( org . getOrgId ( ) ) . getResidentCount ( ) ;
part = uEndMap . get ( org . getOrgId ( ) ) . getPartyMemberCount ( ) ;
if ( "Interval" . equals ( formDTO . getType ( ) ) & & uStartMap . containsKey ( org . getOrgId ( ) ) ) {
if ( "Interval" . equals ( formDTO . getType ( ) ) & & uStartMap . containsKey ( org . getOrgId ( ) ) ) {
user = user - uStartMap . get ( org . getOrgId ( ) ) . getUserCount ( ) ;
resi = resi - uStartMap . get ( org . getOrgId ( ) ) . getResidentCount ( ) ;
part = part - uStartMap . get ( org . getOrgId ( ) ) . getPartyMemberCount ( ) ;
}
}
int group = 0 ;
if ( gEndMap . containsKey ( org . getOrgId ( ) ) ) {
int group = NumConstant . ZERO ;
if ( gEndMap . containsKey ( org . getOrgId ( ) ) ) {
group = gEndMap . get ( org . getOrgId ( ) ) . getGroupCount ( ) ;
if ( "Interval" . equals ( formDTO . getType ( ) ) & & gStartMap . containsKey ( org . getOrgId ( ) ) ) {
if ( "Interval" . equals ( formDTO . getType ( ) ) & & gStartMap . containsKey ( org . getOrgId ( ) ) ) {
group = group - gStartMap . get ( org . getOrgId ( ) ) . getGroupCount ( ) ;
}
}
int topic = 0 ;
if ( tEndMap . containsKey ( org . getOrgId ( ) ) ) {
int topic = NumConstant . ZERO ;
if ( tEndMap . containsKey ( org . getOrgId ( ) ) ) {
topic = tEndMap . get ( org . getOrgId ( ) ) . getTopicCount ( ) ;
if ( "Interval" . equals ( formDTO . getType ( ) ) & & tStartMap . containsKey ( org . getOrgId ( ) ) ) {
if ( "Interval" . equals ( formDTO . getType ( ) ) & & tStartMap . containsKey ( org . getOrgId ( ) ) ) {
topic = topic - tStartMap . get ( org . getOrgId ( ) ) . getTopicCount ( ) ;
}
}
int issue = 0 ;
if ( iEndMap . containsKey ( org . getOrgId ( ) ) ) {
int issue = NumConstant . ZERO ;
if ( iEndMap . containsKey ( org . getOrgId ( ) ) ) {
issue = iEndMap . get ( org . getOrgId ( ) ) . getIssueCount ( ) ;
if ( "Interval" . equals ( formDTO . getType ( ) ) & & iStartMap . containsKey ( org . getOrgId ( ) ) ) {
if ( "Interval" . equals ( formDTO . getType ( ) ) & & iStartMap . containsKey ( org . getOrgId ( ) ) ) {
issue = issue - iStartMap . get ( org . getOrgId ( ) ) . getIssueCount ( ) ;
}
}
int project = 0 ;
int closed = 0 ;
if ( pEndMap . containsKey ( org . getOrgId ( ) ) ) {
int project = NumConstant . ZERO ;
int closed = NumConstant . ZERO ;
if ( pEndMap . containsKey ( org . getOrgId ( ) ) ) {
project = pEndMap . get ( org . getOrgId ( ) ) . getProjectCount ( ) ;
closed = pEndMap . get ( org . getOrgId ( ) ) . getClosedProjectCount ( ) ;
if ( "Interval" . equals ( formDTO . getType ( ) ) & & pStartMap . containsKey ( org . getOrgId ( ) ) ) {
if ( "Interval" . equals ( formDTO . getType ( ) ) & & pStartMap . containsKey ( org . getOrgId ( ) ) ) {
project = project - pStartMap . get ( org . getOrgId ( ) ) . getProjectCount ( ) ;
closed = closed - pStartMap . get ( org . getOrgId ( ) ) . getClosedProjectCount ( ) ;
}
}
int patro = 0 ;
int patroCount = 0 ;
int patro = NumConstant . ZERO ;
int patroCount = NumConstant . ZERO ;
String patrolDuration = "" ;
int patrolDurationInteger = 0 ;
int patrolDurationInteger = NumConstant . ZERO ;
HashSet set = new HashSet ( ) ;
for ( CustomerDataManageResultDTO . CustomerDataManage u : patrolEnd ) {
if ( "community" . equals ( agencyGrid . getLevel ( ) ) & & org . getOrgId ( ) . equals ( u . getOrgId ( ) ) ) {
if ( OrgLevelEnum . COMMUNITY . getCode ( ) . equals ( agencyGrid . getLevel ( ) ) & & org . getOrgId ( ) . equals ( u . getOrgId ( ) ) ) {
patroCount + = u . getPatrolCount ( ) ;
patrolDurationInteger + = u . getPatrolDurationInteger ( ) ;
set . add ( u . getStaffId ( ) ) ;
}
if ( ! "community" . equals ( agencyGrid . getLevel ( ) ) & & u . getOrgId ( ) . contains ( org . getOrgId ( ) ) ) {
if ( ! OrgLevelEnum . COMMUNITY . getCode ( ) . equals ( agencyGrid . getLevel ( ) ) & & u . getOrgId ( ) . contains ( org . getOrgId ( ) ) ) {
patroCount + = u . getPatrolCount ( ) ;
patrolDurationInteger + = u . getPatrolDurationInteger ( ) ;
set . add ( u . getStaffId ( ) ) ;
}
}
//例行工作次数累加
int patrolRoutineWorkTimes = NumConstant . ZERO ;
if ( CollectionUtils . isNotEmpty ( workCountList ) & & workCountList . get ( NumConstant . ZERO ) ! = null ) {
for ( CustomerDataManageResultDTO . CustomerDataManage work : workCountList ) {
if ( OrgLevelEnum . COMMUNITY . getCode ( ) . equals ( agencyGrid . getLevel ( ) ) & & org . getOrgId ( ) . equals ( work . getOrgId ( ) ) ) {
patrolRoutineWorkTimes + = work . getPatrolRoutineWorkTimes ( ) ;
set . add ( work . getStaffId ( ) ) ;
} else if ( ! OrgLevelEnum . COMMUNITY . getCode ( ) . equals ( agencyGrid . getLevel ( ) ) & & work . getOrgId ( ) . contains ( org . getOrgId ( ) ) ) {
patrolRoutineWorkTimes + = work . getPatrolRoutineWorkTimes ( ) ;
set . add ( work . getStaffId ( ) ) ;
}
}
}
patro = set . size ( ) ;
Integer minutes = patrolDurationInteger / 60 ;
patrolDuration = ( minutes / 60 > 0 ? minutes / 60 + "小时" : "" ) + ( minutes % 60 > 0 ? minutes % 60 + "分钟" : "0分钟" ) ;
patrolDuration = ( minutes / 60 > NumConstant . ZERO ? minutes / 60 + "小时" : "" ) + ( minutes % 60 > NumConstant . ZERO ? minutes % 60 + "分钟" : "0分钟" ) ;
dto . setUserCount ( user ) ;
dto . setResidentCount ( resi ) ;
@ -2106,10 +2123,12 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve
dto . setPatrolDuration ( patrolDuration ) ;
dto . setPatrolDurationInteger ( patrolDurationInteger ) ;
dto . setPatrolRoutineWorkTimes ( patrolRoutineWorkTimes ) ;
dataManageList . add ( dto ) ;
} ) ;
}
//6 .默认按用户总数降序
//NumConstant.SIX .默认按用户总数降序
Collections . sort ( dataManageList , new Comparator < CustomerDataManageResultDTO . CustomerDataManage > ( ) {
@Override
public int compare ( CustomerDataManageResultDTO . CustomerDataManage o1 , CustomerDataManageResultDTO . CustomerDataManage o2 ) {