|  |  | @ -6,6 +6,7 @@ | 
			
		
	
		
			
				
					|  |  |  |  import com.epmet.commons.tools.constant.StrConstant; | 
			
		
	
		
			
				
					|  |  |  |  import com.epmet.commons.tools.enums.OrgLevelEnum; | 
			
		
	
		
			
				
					|  |  |  |  import com.epmet.commons.tools.exception.RenException; | 
			
		
	
		
			
				
					|  |  |  |  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; | 
			
		
	
	
		
			
				
					|  |  | @ -1538,12 +1539,12 @@ public class DataStatsServiceImpl implements DataStatsService { | 
			
		
	
		
			
				
					|  |  |  |                 return null; | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             List<String> gridIdList = subAgencyList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |             //查询组织的话题转议题数据
 | 
			
		
	
		
			
				
					|  |  |  |             //查询组织议题数据
 | 
			
		
	
		
			
				
					|  |  |  |             List<SubGridFormDTO.Topic> toIssueStart = dataStatsDao.getSubGridTopicShiftIssue(gridIdList, breforeStartDate); | 
			
		
	
		
			
				
					|  |  |  |             List<SubGridFormDTO.Topic> toIssueEnd = dataStatsDao.getSubGridTopicShiftIssue(gridIdList, formDTO.getEndDateId()); | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> toIssueStartMap = toIssueStart.stream().collect(Collectors.toMap(SubGridFormDTO.Topic::getGridId, SubGridFormDTO.Topic::getShiftedIssueTotal, (o1, o2) -> o1)); | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> toIssueEndMap = toIssueEnd.stream().collect(Collectors.toMap(SubGridFormDTO.Topic::getGridId, SubGridFormDTO.Topic::getShiftedIssueTotal, (o1, o2) -> o1)); | 
			
		
	
		
			
				
					|  |  |  |             //查询组织的议题转项目数据
 | 
			
		
	
		
			
				
					|  |  |  |             //查询组织项目数据
 | 
			
		
	
		
			
				
					|  |  |  |             List<SubGridIssueResultDTO> toProjectStart = dataStatsDao.getSubGridIssue(gridIdList, breforeStartDate); | 
			
		
	
		
			
				
					|  |  |  |             List<SubGridIssueResultDTO> toProjectEnd = dataStatsDao.getSubGridIssue(gridIdList, formDTO.getEndDateId()); | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> toProjectStartMap = toProjectStart.stream().collect(Collectors.toMap(SubGridIssueResultDTO::getGridId, SubGridIssueResultDTO::getShiftProjectTotal, (o1, o2) -> o1)); | 
			
		
	
	
		
			
				
					|  |  | @ -1578,12 +1579,12 @@ public class DataStatsServiceImpl implements DataStatsService { | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             List<String> agencyList = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |             //查询组织的话题转议题数据
 | 
			
		
	
		
			
				
					|  |  |  |             //查询组织的议题数据
 | 
			
		
	
		
			
				
					|  |  |  |             List<SubAgencyFormDTO.Topic> toIssueStart = dataStatsDao.getSubAgencyTopicShiftIssue(agencyList, breforeStartDate); | 
			
		
	
		
			
				
					|  |  |  |             List<SubAgencyFormDTO.Topic> toIssueEnd = dataStatsDao.getSubAgencyTopicShiftIssue(agencyList, formDTO.getEndDateId()); | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> toIssueStartMap = toIssueStart.stream().collect(Collectors.toMap(SubAgencyFormDTO.Topic::getAgencyId, SubAgencyFormDTO.Topic::getShiftedIssueTotal, (o1, o2) -> o1)); | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> toIssueEndMap = toIssueEnd.stream().collect(Collectors.toMap(SubAgencyFormDTO.Topic::getAgencyId, SubAgencyFormDTO.Topic::getShiftedIssueTotal, (o1, o2) -> o1)); | 
			
		
	
		
			
				
					|  |  |  |             //查询组织的议题转项目数据
 | 
			
		
	
		
			
				
					|  |  |  |             //查询组织的项目数据
 | 
			
		
	
		
			
				
					|  |  |  |             List<SubAgencyIssueResultDTO> toProjectStart = dataStatsDao.getSubAgencyIssue(agencyList, breforeStartDate); | 
			
		
	
		
			
				
					|  |  |  |             List<SubAgencyIssueResultDTO> toProjectEnd = dataStatsDao.getSubAgencyIssue(agencyList, formDTO.getEndDateId()); | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> toProjectStartMap = toProjectStart.stream().collect(Collectors.toMap(SubAgencyIssueResultDTO::getAgencyId, SubAgencyIssueResultDTO::getShiftProjectTotal, (o1, o2) -> o1)); | 
			
		
	
	
		
			
				
					|  |  | @ -1595,7 +1596,7 @@ public class DataStatsServiceImpl implements DataStatsService { | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> closeProjectEndMap = closeProjectEnd.stream().collect(Collectors.toMap(SubAgencyProjectResultDTO::getAgencyId, SubAgencyProjectResultDTO::getClosedProjectTotal, (o1, o2) -> o1)); | 
			
		
	
		
			
				
					|  |  |  |             //巡查次数和时间
 | 
			
		
	
		
			
				
					|  |  |  |             List<String> agencyFullIds = subAgencyList.stream().map(o -> o.getPids().concat(StrConstant.COLON).concat(o.getAgencyId())).collect(Collectors.toList()); | 
			
		
	
		
			
				
					|  |  |  |             List<PatrolDailySumResult> patrolList = statsStaffPatrolRecordDailyService.getPatrolSumList(agencyFullIds,breforeStartDate,formDTO.getEndDateId()); | 
			
		
	
		
			
				
					|  |  |  |             List<PatrolDailySumResult> patrolList = statsStaffPatrolRecordDailyService.getPatrolSumList(agencyFullIds,formDTO.getStartDateId(),formDTO.getEndDateId()); | 
			
		
	
		
			
				
					|  |  |  |             Map<String, PatrolDailySumResult> patrolListMap = patrolList.stream().collect(Collectors.toMap(PatrolDailySumResult::getFullAgencyId, o -> o, (o1, o2) -> o1)); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             subAgencyList.forEach(agency->{ | 
			
		
	
	
		
			
				
					|  |  | @ -1944,13 +1945,14 @@ public class DataStatsServiceImpl implements DataStatsService { | 
			
		
	
		
			
				
					|  |  |  |         CustomerDataManageResultDTO resultDTO = new CustomerDataManageResultDTO(); | 
			
		
	
		
			
				
					|  |  |  |         List<CustomerDataManageResultDTO.CustomerDataManage> dataManageList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         //1.必要参数校验及处理
 | 
			
		
	
		
			
				
					|  |  |  |         if ("Interval".equals(formDTO.getType()) && StringUtils.isEmpty(formDTO.getStartTime())) { | 
			
		
	
		
			
				
					|  |  |  |         String startTimeForm = formDTO.getStartTime(); | 
			
		
	
		
			
				
					|  |  |  |         if ("Interval".equals(formDTO.getType()) && StringUtils.isEmpty(startTimeForm)) { | 
			
		
	
		
			
				
					|  |  |  |             throw new RenException("请选择开始时间或查询累计值"); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         //入参有开始时间的则需要减去一天
 | 
			
		
	
		
			
				
					|  |  |  |         if (StringUtils.isNotBlank(formDTO.getStartTime())) { | 
			
		
	
		
			
				
					|  |  |  |         if (StringUtils.isNotBlank(startTimeForm)) { | 
			
		
	
		
			
				
					|  |  |  |             SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); | 
			
		
	
		
			
				
					|  |  |  |             Date date = format.parse(formDTO.getStartTime()); | 
			
		
	
		
			
				
					|  |  |  |             Date date = format.parse(startTimeForm); | 
			
		
	
		
			
				
					|  |  |  |             Date yesterday = DateUtils.addDateDays(date, -1); | 
			
		
	
		
			
				
					|  |  |  |             formDTO.setStartTime(format.format(yesterday)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
	
		
			
				
					|  |  | @ -1983,8 +1985,10 @@ public class DataStatsServiceImpl implements DataStatsService { | 
			
		
	
		
			
				
					|  |  |  |         List<CustomerDataManageResultDTO.CustomerDataManage> projectEnd = dataStatsDao.projectList(formDTO); | 
			
		
	
		
			
				
					|  |  |  |         HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> pEndMap = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         projectEnd.stream().forEach(u->pEndMap.put(u.getOrgId(),u)); | 
			
		
	
		
			
				
					|  |  |  |         //巡查数据不区分区间差值,只计算累计值,人员做去重处理且是有巡查记录的人员
 | 
			
		
	
		
			
				
					|  |  |  |         List<CustomerDataManageResultDTO.CustomerDataManage> patrolEnd = statsStaffPatrolRecordDailyService.patrolList(formDTO); | 
			
		
	
		
			
				
					|  |  |  |         //巡查数据不区分区间差值,只计算累计值,人员做去重处理且是有巡查记录的人员 ==
 | 
			
		
	
		
			
				
					|  |  |  |         CustomerDataManageFormDTO patrolForm = ConvertUtils.sourceToTarget(formDTO,CustomerDataManageFormDTO.class); | 
			
		
	
		
			
				
					|  |  |  |         patrolForm.setStartTime(startTimeForm); | 
			
		
	
		
			
				
					|  |  |  |         List<CustomerDataManageResultDTO.CustomerDataManage> patrolEnd = statsStaffPatrolRecordDailyService.patrolList(patrolForm); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //4.判断是否需要查询起始日期用户、群组、话题、议题、项目、巡查数据
 | 
			
		
	
		
			
				
					|  |  |  |         HashMap<String, CustomerDataManageResultDTO.CustomerDataManage> uStartMap = new HashMap<>(); | 
			
		
	
	
		
			
				
					|  |  | 
 |