| 
						
						
						
					 | 
					@ -1,6 +1,7 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					package com.epmet.service.impl; | 
					 | 
					 | 
					package com.epmet.service.impl; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.convert.DateConverter; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.DateUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.DateUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.constant.GroupConstant; | 
					 | 
					 | 
					import com.epmet.constant.GroupConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.AgencySubTreeDto; | 
					 | 
					 | 
					import com.epmet.dto.AgencySubTreeDto; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -9,24 +10,29 @@ import com.epmet.dto.group.form.GroupStatsFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.group.form.GroupTotalFormDTO; | 
					 | 
					 | 
					import com.epmet.dto.group.form.GroupTotalFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.group.result.*; | 
					 | 
					 | 
					import com.epmet.dto.group.result.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.stats.DimAgencyDTO; | 
					 | 
					 | 
					import com.epmet.dto.stats.DimAgencyDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.entity.group.ResiGroupEntity; | 
					 | 
					 | 
					import com.epmet.entity.group.ResiGroupEntity; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.entity.stats.DimAgencyEntity; | 
					 | 
					 | 
					import com.epmet.entity.stats.DimAgencyEntity; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.entity.stats.DimGridEntity; | 
					 | 
					 | 
					import com.epmet.entity.stats.DimGridEntity; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.entity.stats.FactGroupTotalAgencyDailyEntity; | 
					 | 
					 | 
					import com.epmet.entity.stats.FactGroupTotalAgencyDailyEntity; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.entity.stats.FactGroupTotalGridDailyEntity; | 
					 | 
					 | 
					import com.epmet.entity.stats.FactGroupTotalGridDailyEntity; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.StatsGroupService; | 
					 | 
					 | 
					import com.epmet.service.StatsGroupService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.group.GroupDataService; | 
					 | 
					 | 
					import com.epmet.service.group.GroupDataService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.org.CustomerGridService; | 
					 | 
					 | 
					import com.epmet.service.org.CustomerGridService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.stats.*; | 
					 | 
					 | 
					import com.epmet.service.stats.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.util.DimIdGenerator; | 
					 | 
					 | 
					import com.epmet.util.DimIdGenerator; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.util.ModuleConstant; | 
					 | 
					 | 
					import com.epmet.util.ModuleConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import org.apache.commons.configuration.ConfigurationException; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.beans.BeanUtils; | 
					 | 
					 | 
					import org.springframework.beans.BeanUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.util.CollectionUtils; | 
					 | 
					 | 
					import org.springframework.util.CollectionUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.text.ParseException; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.text.SimpleDateFormat; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.time.LocalDate; | 
					 | 
					 | 
					import java.time.LocalDate; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.time.ZoneId; | 
					 | 
					 | 
					import java.time.ZoneId; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.time.ZonedDateTime; | 
					 | 
					 | 
					import java.time.ZonedDateTime; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -63,6 +69,8 @@ public class StatsGroupServiceImpl implements StatsGroupService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private FactGroupTotalGridDailyService factGroupTotalGridDailyService; | 
					 | 
					 | 
					    private FactGroupTotalGridDailyService factGroupTotalGridDailyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private FactGroupTotalAgencyDailyService factGroupTotalAgencyDailyService; | 
					 | 
					 | 
					    private FactGroupTotalAgencyDailyService factGroupTotalAgencyDailyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private FactOriginGroupMainDailyService factOriginGroupMainDailyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param | 
					 | 
					 | 
					     * @param | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -352,15 +360,16 @@ public class StatsGroupServiceImpl implements StatsGroupService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     **/ | 
					 | 
					 | 
					     **/ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public void gridGroupTotal(GroupTotalFormDTO formDTO) { | 
					 | 
					 | 
					    public void gridGroupTotal(GroupTotalFormDTO formDTO) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Date date = DateUtils.yesterDay(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
 | 
					 | 
					 | 
					        //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (null != formDTO && StringUtils.isNotBlank(formDTO.getDate())) { | 
					 | 
					 | 
					        if (StringUtils.isBlank(formDTO.getDateId())) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            date = DateUtils.parse(formDTO.getDate(), DateUtils.DATE_PATTERN); | 
					 | 
					 | 
					            Date yesterday = DateUtils.addDateDays(new Date(), -1); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            formDTO.setDateId(format.format(yesterday)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //入参有客户Id的则按客户Id执行,没有的则全部客户都执行
 | 
					 | 
					 | 
					        //入参有客户Id的则按客户Id执行,没有的则全部客户都执行
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) { | 
					 | 
					 | 
					        if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            log.info("单独统计客户网格-小组总数日统计数据,当前统计的客户Id:" + formDTO.getCustomerId()); | 
					 | 
					 | 
					            log.info("单独统计客户网格-小组总数日统计数据,当前统计的客户Id:" + formDTO.getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            gridGroupStats(formDTO.getCustomerId(), date); | 
					 | 
					 | 
					            gridGroupStats(formDTO.getCustomerId(), formDTO.getDateId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            int pageNo = 1; | 
					 | 
					 | 
					            int pageNo = 1; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            int pageSize = 100; | 
					 | 
					 | 
					            int pageSize = 100; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -373,7 +382,7 @@ public class StatsGroupServiceImpl implements StatsGroupService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        try { | 
					 | 
					 | 
					                        try { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            log.info("for循环统计网格-小组总数日统计数据,当前统计的客户Id:" + customerId); | 
					 | 
					 | 
					                            log.info("for循环统计网格-小组总数日统计数据,当前统计的客户Id:" + customerId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            //遍历统计每一个客户数据
 | 
					 | 
					 | 
					                            //遍历统计每一个客户数据
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            gridGroupStats(customerId, date); | 
					 | 
					 | 
					                            gridGroupStats(customerId, formDTO.getDateId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                        } catch (Exception e) { | 
					 | 
					 | 
					                        } catch (Exception e) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            log.error("小组总数-网格日统计-程序错误,对应客户Id:" + customerId, e); | 
					 | 
					 | 
					                            log.error("小组总数-网格日统计-程序错误,对应客户Id:" + customerId, e); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            log.error("Error creating model JSON", e); | 
					 | 
					 | 
					                            log.error("Error creating model JSON", e); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -389,8 +398,9 @@ public class StatsGroupServiceImpl implements StatsGroupService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Author sun | 
					 | 
					 | 
					     * @Author sun | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description 小组总数-网格日统计数据 | 
					 | 
					 | 
					     * @Description 小组总数-网格日统计数据 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     **/ | 
					 | 
					 | 
					     **/ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    private void gridGroupStats(String customerId, Date date) { | 
					 | 
					 | 
					    private void gridGroupStats(String customerId, String dateId) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        //1:查询各维度表Id,方便使用
 | 
					 | 
					 | 
					        //1:查询各维度表Id,方便使用
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Date date = DateUtils.parseDate(dateId,DateUtils.DATE_PATTERN_YYYYMMDD); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); | 
					 | 
					 | 
					        DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //2:根据客户Id查询网格维度表数据
 | 
					 | 
					 | 
					        //2:根据客户Id查询网格维度表数据
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -399,18 +409,18 @@ public class StatsGroupServiceImpl implements StatsGroupService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //3.根据客户Id查询客户下有效的群组列表数据
 | 
					 | 
					 | 
					        //3.根据客户Id查询客户下有效的群组列表数据
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        log.info("StatsGroupServiceImpl.customerGridStats-根据客户Id查询客户下有效的群组列表数据,对应客户Id:" + customerId); | 
					 | 
					 | 
					        log.info("StatsGroupServiceImpl.customerGridStats-根据客户Id查询客户下有效的群组列表数据,对应客户Id:" + customerId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        List<ResiGroupEntity> groupList = groupDataService.getGroupListByCustomerId(customerId); | 
					 | 
					 | 
					        List<FactOriginGroupMainDailyEntity> groupList = factOriginGroupMainDailyService.getGroupListByCustomerId(customerId, dateId); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //4.分别计算每个网格下审核通过的小组数据
 | 
					 | 
					 | 
					        //4.分别计算每个网格下审核通过的小组数据
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<FactGroupTotalGridDailyEntity> list = new ArrayList<>(); | 
					 | 
					 | 
					        List<FactGroupTotalGridDailyEntity> list = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        DimIdGenerator.DimIdBean finalDimId = dimId; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        dimGridList.forEach(grid -> { | 
					 | 
					 | 
					        dimGridList.forEach(grid -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            FactGroupTotalGridDailyEntity entity = new FactGroupTotalGridDailyEntity(); | 
					 | 
					 | 
					            FactGroupTotalGridDailyEntity entity = new FactGroupTotalGridDailyEntity(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            AtomicInteger total = new AtomicInteger(0); | 
					 | 
					 | 
					            AtomicInteger total = new AtomicInteger(0); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            AtomicInteger ordinary = new AtomicInteger(0); | 
					 | 
					 | 
					            AtomicInteger ordinary = new AtomicInteger(0); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            AtomicInteger branch = new AtomicInteger(0); | 
					 | 
					 | 
					            AtomicInteger branch = new AtomicInteger(0); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            groupList.forEach(group -> { | 
					 | 
					 | 
					            groupList.forEach(group -> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                if (grid.getId().equals(group.getGridId()) && "approved".equals(group.getState())) { | 
					 | 
					 | 
					                if (grid.getId().equals(group.getGridId()) && "approved".equals(group.getGroupState())) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    total.addAndGet(1); | 
					 | 
					 | 
					                    total.addAndGet(1); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    if ("ordinary".equals(group.getGroupType())) { | 
					 | 
					 | 
					                    if ("ordinary".equals(group.getGroupType())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        ordinary.addAndGet(1); | 
					 | 
					 | 
					                        ordinary.addAndGet(1); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -424,11 +434,11 @@ public class StatsGroupServiceImpl implements StatsGroupService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity.setCustomerId(grid.getCustomerId()); | 
					 | 
					 | 
					            entity.setCustomerId(grid.getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity.setAgencyId(grid.getAgencyId()); | 
					 | 
					 | 
					            entity.setAgencyId(grid.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity.setGridId(grid.getId()); | 
					 | 
					 | 
					            entity.setGridId(grid.getId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            entity.setDateId(dimId.getDateId()); | 
					 | 
					 | 
					            entity.setDateId(finalDimId.getDateId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            entity.setWeekId(dimId.getWeekId()); | 
					 | 
					 | 
					            entity.setWeekId(finalDimId.getWeekId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            entity.setMonthId(dimId.getMonthId()); | 
					 | 
					 | 
					            entity.setMonthId(finalDimId.getMonthId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            entity.setQuarterId(dimId.getQuarterId()); | 
					 | 
					 | 
					            entity.setQuarterId(finalDimId.getQuarterId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            entity.setYearId(dimId.getYearId()); | 
					 | 
					 | 
					            entity.setYearId(finalDimId.getYearId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            entity.setGroupTotal(total.get()); | 
					 | 
					 | 
					            entity.setGroupTotal(total.get()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity.setOrdinaryTotal(ordinary.get()); | 
					 | 
					 | 
					            entity.setOrdinaryTotal(ordinary.get()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity.setBranchTotal(branch.get()); | 
					 | 
					 | 
					            entity.setBranchTotal(branch.get()); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -457,15 +467,16 @@ public class StatsGroupServiceImpl implements StatsGroupService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     **/ | 
					 | 
					 | 
					     **/ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public void agencyGroupTotal(GroupTotalFormDTO formDTO) { | 
					 | 
					 | 
					    public void agencyGroupTotal(GroupTotalFormDTO formDTO) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        Date date = DateUtils.yesterDay(); | 
					 | 
					 | 
					        //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        //入参有时间的则按具体时间执行,没有的则按当前时间前一天执行
 | 
					 | 
					 | 
					        if (StringUtils.isBlank(formDTO.getDateId())) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (null != formDTO && StringUtils.isNotBlank(formDTO.getDate())) { | 
					 | 
					 | 
					            Date yesterday = DateUtils.addDateDays(new Date(), -1); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            date = DateUtils.parse(formDTO.getDate(), DateUtils.DATE_PATTERN); | 
					 | 
					 | 
					            SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            formDTO.setDateId(format.format(yesterday)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //入参有客户Id的则按客户Id执行,没有的则全部客户都执行
 | 
					 | 
					 | 
					        //入参有客户Id的则按客户Id执行,没有的则全部客户都执行
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) { | 
					 | 
					 | 
					        if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            log.info("单独统计客户组织下-小组总数日统计数据,当前统计的客户Id:" + formDTO.getCustomerId()); | 
					 | 
					 | 
					            log.info("单独统计客户组织下-小组总数日统计数据,当前统计的客户Id:" + formDTO.getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            agencyGroupStats(formDTO.getCustomerId(), date); | 
					 | 
					 | 
					            agencyGroupStats(formDTO.getCustomerId(), formDTO.getDateId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            int pageNo = 1; | 
					 | 
					 | 
					            int pageNo = 1; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            int pageSize = 100; | 
					 | 
					 | 
					            int pageSize = 100; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -477,7 +488,7 @@ public class StatsGroupServiceImpl implements StatsGroupService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        try { | 
					 | 
					 | 
					                        try { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            log.info("for循环统计机关-小组总数日统计数据,当前统计的客户Id:" + customerId); | 
					 | 
					 | 
					                            log.info("for循环统计机关-小组总数日统计数据,当前统计的客户Id:" + customerId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            //遍历统计每一个客户数据
 | 
					 | 
					 | 
					                            //遍历统计每一个客户数据
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            agencyGroupStats(customerId, date); | 
					 | 
					 | 
					                            agencyGroupStats(customerId, formDTO.getDateId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                        } catch (Exception e) { | 
					 | 
					 | 
					                        } catch (Exception e) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            log.error("小组总数-机关日统计程序错误,对应客户Id:" + customerId, e); | 
					 | 
					 | 
					                            log.error("小组总数-机关日统计程序错误,对应客户Id:" + customerId, e); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            log.error("Error creating model JSON", e); | 
					 | 
					 | 
					                            log.error("Error creating model JSON", e); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -493,8 +504,9 @@ public class StatsGroupServiceImpl implements StatsGroupService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Author sun | 
					 | 
					 | 
					     * @Author sun | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description 小组总数-机关日统计数据 | 
					 | 
					 | 
					     * @Description 小组总数-机关日统计数据 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     **/ | 
					 | 
					 | 
					     **/ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    private void agencyGroupStats(String customerId, Date date) { | 
					 | 
					 | 
					    private void agencyGroupStats(String customerId, String dateId) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        //1:查询各维度表Id,方便使用
 | 
					 | 
					 | 
					        //1:查询各维度表Id,方便使用
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Date date = DateUtils.parseDate(dateId,DateUtils.DATE_PATTERN_YYYYMMDD); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); | 
					 | 
					 | 
					        DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //2:根据客户Id查询机关维度表数据
 | 
					 | 
					 | 
					        //2:根据客户Id查询机关维度表数据
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -508,10 +520,11 @@ public class StatsGroupServiceImpl implements StatsGroupService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //4.根据客户Id查询客户下有效的群组列表数据
 | 
					 | 
					 | 
					        //4.根据客户Id查询客户下有效的群组列表数据
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        log.info("StatsGroupServiceImpl.agencyGroupStats-根据客户Id查询客户下有效的群组列表数据,对应客户Id:" + customerId); | 
					 | 
					 | 
					        log.info("StatsGroupServiceImpl.agencyGroupStats-根据客户Id查询客户下有效的群组列表数据,对应客户Id:" + customerId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        List<ResiGroupEntity> groupList = groupDataService.getGroupListByCustomerId(customerId); | 
					 | 
					 | 
					        List<FactOriginGroupMainDailyEntity> groupList = factOriginGroupMainDailyService.getGroupListByCustomerId(customerId, dateId); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<FactGroupTotalAgencyDailyEntity> list = new ArrayList<>(); | 
					 | 
					 | 
					        List<FactGroupTotalAgencyDailyEntity> list = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //5.遍历组织维度数据分别计算每个组织下群组数据
 | 
					 | 
					 | 
					        //5.遍历组织维度数据分别计算每个组织下群组数据
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        DimIdGenerator.DimIdBean finalDimId = dimId; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        agencyList.forEach(agency->{ | 
					 | 
					 | 
					        agencyList.forEach(agency->{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            FactGroupTotalAgencyDailyEntity entity = new FactGroupTotalAgencyDailyEntity(); | 
					 | 
					 | 
					            FactGroupTotalAgencyDailyEntity entity = new FactGroupTotalAgencyDailyEntity(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					           //5-1.汇总组织及所有下级组织列表
 | 
					 | 
					 | 
					           //5-1.汇总组织及所有下级组织列表
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -538,7 +551,7 @@ public class StatsGroupServiceImpl implements StatsGroupService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					           //5-3.根据汇总的网格列表统计对应的群组数据
 | 
					 | 
					 | 
					           //5-3.根据汇总的网格列表统计对应的群组数据
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            agencyGridList.forEach(gridId -> { | 
					 | 
					 | 
					            agencyGridList.forEach(gridId -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                groupList.forEach(group -> { | 
					 | 
					 | 
					                groupList.forEach(group -> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    if (gridId.equals(group.getGridId()) && "approved".equals(group.getState())) { | 
					 | 
					 | 
					                    if (gridId.equals(group.getGridId()) && "approved".equals(group.getGroupState())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                        total.addAndGet(1); | 
					 | 
					 | 
					                        total.addAndGet(1); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        if ("ordinary".equals(group.getGroupType())) { | 
					 | 
					 | 
					                        if ("ordinary".equals(group.getGroupType())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            ordinary.addAndGet(1); | 
					 | 
					 | 
					                            ordinary.addAndGet(1); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -553,11 +566,11 @@ public class StatsGroupServiceImpl implements StatsGroupService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity.setCustomerId(agency.getCustomerId()); | 
					 | 
					 | 
					            entity.setCustomerId(agency.getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity.setAgencyId(agency.getId()); | 
					 | 
					 | 
					            entity.setAgencyId(agency.getId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity.setPid(agency.getPid()); | 
					 | 
					 | 
					            entity.setPid(agency.getPid()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            entity.setDateId(dimId.getDateId()); | 
					 | 
					 | 
					            entity.setDateId(finalDimId.getDateId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            entity.setWeekId(dimId.getWeekId()); | 
					 | 
					 | 
					            entity.setWeekId(finalDimId.getWeekId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            entity.setMonthId(dimId.getMonthId()); | 
					 | 
					 | 
					            entity.setMonthId(finalDimId.getMonthId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            entity.setQuarterId(dimId.getQuarterId()); | 
					 | 
					 | 
					            entity.setQuarterId(finalDimId.getQuarterId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            entity.setYearId(dimId.getYearId()); | 
					 | 
					 | 
					            entity.setYearId(finalDimId.getYearId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            entity.setGroupTotal(total.get()); | 
					 | 
					 | 
					            entity.setGroupTotal(total.get()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity.setOrdinaryTotal(ordinary.get()); | 
					 | 
					 | 
					            entity.setOrdinaryTotal(ordinary.get()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity.setBranchTotal(branch.get()); | 
					 | 
					 | 
					            entity.setBranchTotal(branch.get()); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |