|  |  | @ -1,61 +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.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.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 | 
			
		
	
	
		
			
				
					|  |  | @ -1386,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()); | 
			
		
	
	
		
			
				
					|  |  | @ -1679,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) { | 
			
		
	
	
		
			
				
					|  |  | @ -1755,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) { | 
			
		
	
	
		
			
				
					|  |  | @ -1888,6 +1888,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve | 
			
		
	
		
			
				
					|  |  |  |             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())); | 
			
		
	
	
		
			
				
					|  |  | @ -2002,6 +2003,12 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve | 
			
		
	
		
			
				
					|  |  |  |         patrolForm.setStartTime(startTimeForm); | 
			
		
	
		
			
				
					|  |  |  |         List<CustomerDataManageResultDTO.CustomerDataManage> patrolEnd = statsStaffPatrolRecordDailyService.patrolList(patrolForm); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //获取例行工作次数
 | 
			
		
	
		
			
				
					|  |  |  |         List<CustomerDataManageResultDTO.CustomerDataManage>  workCountList = statsStaffPatrolRecordDailyService.getPatrolRecordCount(patrolForm); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, List<CustomerDataManageResultDTO.CustomerDataManage>> workCountMap = null; | 
			
		
	
		
			
				
					|  |  |  |         if(workCountList != null && workCountList.size() > NumConstant.ZERO && workCountList.get(NumConstant.ZERO) != null){ | 
			
		
	
		
			
				
					|  |  |  |             workCountMap = workCountList.stream().collect(Collectors.groupingBy(CustomerDataManageResultDTO.CustomerDataManage::getOrgId)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         //NumConstant.FOUR.判断是否需要查询起始日期用户、群组、话题、议题、项目、巡查数据
 | 
			
		
	
		
			
				
					|  |  |  |         HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> uStartMap = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> gStartMap = new HashMap<>(); | 
			
		
	
	
		
			
				
					|  |  | @ -2023,50 +2030,50 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //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 = NumConstant.ZERO; | 
			
		
	
		
			
				
					|  |  |  |             int resi = NumConstant.ZERO; | 
			
		
	
		
			
				
					|  |  |  |             int part = NumConstant.ZERO; | 
			
		
	
		
			
				
					|  |  |  |             if(uEndMap.containsKey(org.getOrgId())){ | 
			
		
	
		
			
				
					|  |  |  |             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 = NumConstant.ZERO; | 
			
		
	
		
			
				
					|  |  |  |             if(gEndMap.containsKey(org.getOrgId())){ | 
			
		
	
		
			
				
					|  |  |  |             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 = NumConstant.ZERO; | 
			
		
	
		
			
				
					|  |  |  |             if(tEndMap.containsKey(org.getOrgId())){ | 
			
		
	
		
			
				
					|  |  |  |             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 = NumConstant.ZERO; | 
			
		
	
		
			
				
					|  |  |  |             if(iEndMap.containsKey(org.getOrgId())){ | 
			
		
	
		
			
				
					|  |  |  |             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 = NumConstant.ZERO; | 
			
		
	
		
			
				
					|  |  |  |             int closed = NumConstant.ZERO; | 
			
		
	
		
			
				
					|  |  |  |             if(pEndMap.containsKey(org.getOrgId())){ | 
			
		
	
		
			
				
					|  |  |  |             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(); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
	
		
			
				
					|  |  | @ -2076,19 +2083,39 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve | 
			
		
	
		
			
				
					|  |  |  |             String patrolDuration = ""; | 
			
		
	
		
			
				
					|  |  |  |             int patrolDurationInteger = NumConstant.ZERO; | 
			
		
	
		
			
				
					|  |  |  |             HashSet set = new HashSet(); | 
			
		
	
		
			
				
					|  |  |  |             List<CustomerDataManageResultDTO.CustomerDataManage> workCountListTemp; | 
			
		
	
		
			
				
					|  |  |  |             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; | 
			
		
	
		
			
				
					|  |  |  |             workCountListTemp = workCountMap.get(org.getOrgId()); | 
			
		
	
		
			
				
					|  |  |  |             if (CollectionUtils.isNotEmpty(workCountListTemp)) { | 
			
		
	
		
			
				
					|  |  |  |                 if (OrgLevelEnum.COMMUNITY.getCode().equals(agencyGrid.getLevel())) { | 
			
		
	
		
			
				
					|  |  |  |                     for (CustomerDataManageResultDTO.CustomerDataManage work : workCountListTemp) { | 
			
		
	
		
			
				
					|  |  |  |                         patrolRoutineWorkTimes += work.getPatrolRoutineWorkTimes(); | 
			
		
	
		
			
				
					|  |  |  |                         set.add(work.getStaffId()); | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |                 } else { | 
			
		
	
		
			
				
					|  |  |  |                     if (!OrgLevelEnum.COMMUNITY.getCode().equals(agencyGrid.getLevel())) { | 
			
		
	
		
			
				
					|  |  |  |                         for (CustomerDataManageResultDTO.CustomerDataManage work : workCountListTemp) { | 
			
		
	
		
			
				
					|  |  |  |                             patrolRoutineWorkTimes += work.getPatrolRoutineWorkTimes(); | 
			
		
	
		
			
				
					|  |  |  |                             set.add(work.getStaffId()); | 
			
		
	
		
			
				
					|  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             patro = set.size(); | 
			
		
	
		
			
				
					|  |  |  |             Integer minutes = patrolDurationInteger / 60; | 
			
		
	
		
			
				
					|  |  |  |             patrolDuration = (minutes / 60 > NumConstant.ZERO ? minutes / 60 + "小时" : "") + (minutes % 60 > NumConstant.ZERO ? minutes % 60 + "分钟" : "0分钟"); | 
			
		
	
	
		
			
				
					|  |  | @ -2106,8 +2133,10 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve | 
			
		
	
		
			
				
					|  |  |  |             dto.setPatrolDuration(patrolDuration); | 
			
		
	
		
			
				
					|  |  |  |             dto.setPatrolDurationInteger(patrolDurationInteger); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             dto.setPatrolRoutineWorkTimes(patrolRoutineWorkTimes); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             dataManageList.add(dto); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //NumConstant.SIX.默认按用户总数降序
 | 
			
		
	
		
			
				
					|  |  |  |         Collections.sort(dataManageList, new Comparator<CustomerDataManageResultDTO.CustomerDataManage>() { | 
			
		
	
	
		
			
				
					|  |  | 
 |