| 
						
						
						
					 | 
					@ -1,11 +1,13 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					package com.epmet.service.evaluationindex.extract.toscreen.impl; | 
					 | 
					 | 
					package com.epmet.service.evaluationindex.extract.toscreen.impl; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.alibaba.fastjson.JSON; | 
					 | 
					 | 
					import com.alibaba.fastjson.JSON; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.exception.RenException; | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.ConvertUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.DateUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.DateUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.constant.OrgTypeConstant; | 
					 | 
					 | 
					import com.epmet.constant.OrgTypeConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.extract.form.ExtractScreenFormDTO; | 
					 | 
					 | 
					import com.epmet.dto.extract.form.ExtractScreenFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.dto.extract.result.GridUserCountResultDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; | 
					 | 
					 | 
					import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.entity.stats.DimAgencyEntity; | 
					 | 
					 | 
					import com.epmet.entity.stats.DimAgencyEntity; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.entity.stats.DimGridEntity; | 
					 | 
					 | 
					import com.epmet.entity.stats.DimGridEntity; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -14,6 +16,7 @@ import com.epmet.service.evaluationindex.extract.toscreen.PublicPartExtractServi | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.stats.DimAgencyService; | 
					 | 
					 | 
					import com.epmet.service.stats.DimAgencyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.stats.DimGridService; | 
					 | 
					 | 
					import com.epmet.service.stats.DimGridService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.stats.FactIssueGridMonthlyService; | 
					 | 
					 | 
					import com.epmet.service.stats.FactIssueGridMonthlyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.service.stats.user.FactRegUserGridMonthlyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.util.DimIdGenerator; | 
					 | 
					 | 
					import com.epmet.util.DimIdGenerator; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -25,6 +28,7 @@ import java.math.BigDecimal; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.HashMap; | 
					 | 
					 | 
					import java.util.HashMap; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.List; | 
					 | 
					 | 
					import java.util.List; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.Map; | 
					 | 
					 | 
					import java.util.Map; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.util.stream.Collectors; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					/** | 
					 | 
					 | 
					/** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 * desc:公众参与抽取到大屏的接口实现类 | 
					 | 
					 | 
					 * desc:公众参与抽取到大屏的接口实现类 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -42,13 +46,15 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private DimGridService dimGridService; | 
					 | 
					 | 
					    private DimGridService dimGridService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private FactIssueGridMonthlyService factIssueGridMonthlyService; | 
					 | 
					 | 
					    private FactIssueGridMonthlyService factIssueGridMonthlyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private FactRegUserGridMonthlyService factRegUserGridMonthlyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * desc: 【月】抽取公众参与 人均议题    总次数和平均参与度 | 
					 | 
					 | 
					     * desc: 【月】抽取公众参与 人均议题    总次数和平均参与度 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * target:screen_user_join | 
					 | 
					 | 
					     * target:screen_user_join | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * 总参与:统计周期内议题表决的人数 | 
					 | 
					 | 
					     * 总参与:统计周期内议题表决的人数 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					     * 百人人均议题:统计周期内总的议题数/(用户数/100) | 
					 | 
					 | 
					     * 百人人均议题:统计周期内总的议题数/(注册用户数/100) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					     * 百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数 | 
					 | 
					 | 
					     * 百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * 不考虑市北:人均议题:统计周期内议题总数/发过议题的人数 参与度:各个行为(表决)的总数/发生行为的人数 | 
					 | 
					 | 
					     * 不考虑市北:人均议题:统计周期内议题总数/发过议题的人数 参与度:各个行为(表决)的总数/发生行为的人数 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * | 
					 | 
					 | 
					     * | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -76,6 +82,29 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //构建组织数据
 | 
					 | 
					 | 
					        //构建组织数据
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Map<String, ScreenUserJoinEntity> insertMap = new HashMap<>(); | 
					 | 
					 | 
					        Map<String, ScreenUserJoinEntity> insertMap = new HashMap<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        orgList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); | 
					 | 
					 | 
					        orgList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        //获取议题月份增量
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<FactIssueGridMonthlyEntity> issueTotal = factIssueGridMonthlyService.getIssueCount(formDTO.getCustomerId(), formDTO.getMonthId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (CollectionUtils.isEmpty(issueTotal)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.error("抽取【公众参与-人均议题】,获取议题增量为空"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            return; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<GridUserCountResultDTO> userCountList = factRegUserGridMonthlyService.selectGridUserCount(formDTO.getCustomerId(), formDTO.getMonthId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (CollectionUtils.isEmpty(issueTotal)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.error("抽取【公众参与-人均议题】,获取注册用户数为空"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            return; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Map<String, GridUserCountResultDTO> userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getGridId, o -> o)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        issueTotal.forEach(issue -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            String gridId = issue.getGridId(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            ScreenUserJoinEntity entity = insertMap.get(gridId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            entity.setJoinTotal(issue.getIssueIncr()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            GridUserCountResultDTO user = userCountMap.get(gridId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //百人人均议题:统计周期内总的议题数/(注册用户数/100)
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getUserCount()).divide(new BigDecimal(NumConstant.ONE_HUNDRED))); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 需要修改字段类型
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //entity.setAvgIssue(avgIssueCount);
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |