| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -29,12 +29,16 @@ import com.epmet.constant.DataSourceConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.PingYinConstants; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.evaluationindex.screen.ScreenProjectOrgDailyDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.pingyin.result.EvaluateTotalResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.pingyin.result.ProjectOrgDailyResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.pingyin.result.ProjectTotalResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.pingyin.result.ResolvedNumResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.screen.ScreenProjectOrgDailyDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.screencoll.ScreenCollFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.evaluationindex.screen.ScreenProjectOrgDailyEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.org.CustomerAgencyEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.crm.CustomerRelationService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.evaluationindex.screen.ScreenProjectOrgDailyService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.org.CustomerAgencyService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.google.common.collect.Lists; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -51,6 +55,7 @@ import java.util.ArrayList; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.Arrays; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.List; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.Map; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.stream.Collectors; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 * 项目(事件)分析按组织_按天统计 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -69,6 +74,8 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private CustomerRelationService customerRelationService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private CustomerAgencyService customerAgencyService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private FactOriginProjectMainDailyService projectMainDailyService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public PageData<ScreenProjectOrgDailyDTO> page(Map<String, Object> params) { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -172,12 +179,52 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.info(String.format(PingYinConstants.SELECT_GRID_INFO_BY_ORG_IS_NULL,customerId)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> orgIds = agencyInfos.stream().map(m -> m.getOrgId()).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 查询 项目总数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ProjectTotalResultDTO> projectTotal = projectMainDailyService.selectProjectTotalByOrg(orgIds, dateId, null); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 查询 项目解决数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ResolvedNumResultDTO> resolvedNum = projectMainDailyService.selectResolvedNumByOrg(orgIds, dateId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //查询 参与满意度评价的总次数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String[] activeCodesAll = {PingYinConstants.EVALUATE_BAD,PingYinConstants.EVALUATE_GOOD,PingYinConstants.EVALUATE_PERFECT}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<EvaluateTotalResultDTO> evaluateTotal = projectMainDailyService.selectEvaluateCountByOrg(orgIds, dateId, getActiveCode(activeCodesAll)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //查询 满意+非常满意的总次数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String[] activeCodesGood = {PingYinConstants.EVALUATE_GOOD,PingYinConstants.EVALUATE_PERFECT}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<EvaluateTotalResultDTO> evaluateGood = projectMainDailyService.selectEvaluateCountByOrg(orgIds, dateId, getActiveCode(activeCodesGood)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        projectOrgDaily.forEach(p -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            p.setBadTotal(null == p.getBadTotal() ? NumConstant.ZERO : p.getBadTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            p.setEvaluateTotal(null == p.getEvaluateTotal() ? NumConstant.ZERO : p.getEvaluateTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            p.setGoodTotal(null == p.getGoodTotal() ? NumConstant.ZERO : p.getGoodTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            p.setProjectTotal(null == p.getProjectTotal() ? NumConstant.ZERO : p.getProjectTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            p.setResolvedNum(null == p.getResolvedNum() ? NumConstant.ZERO : p.getResolvedNum()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 参与满意度评价的总次数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!CollectionUtils.isEmpty(evaluateTotal)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                evaluateTotal.forEach(e -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (p.getOrgId().equals(e.getOrgId())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        p.setEvaluateTotal(p.getEvaluateTotal() + e.getEvaluateCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 满意+非常满意的总次数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!CollectionUtils.isEmpty(evaluateGood)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                evaluateGood.forEach(e -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (p.getOrgId().equals(e.getOrgId())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        p.setGoodTotal(p.getGoodTotal() + e.getEvaluateCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 项目总数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!CollectionUtils.isEmpty(projectTotal)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                projectTotal.forEach(t -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (p.getOrgId().equals(t.getOrgId())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        p.setProjectTotal(p.getProjectTotal() + t.getProjectTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 已解决的项目总数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!CollectionUtils.isEmpty(resolvedNum)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                resolvedNum.forEach(r -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (p.getOrgId().equals(r.getOrgId())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        p.setResolvedNum(p.getResolvedNum() + r.getResolvedNum()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 不满意总次数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            p.setBadTotal(p.getEvaluateTotal() - p.getGoodTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        log.info(projectOrgDaily.toString()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        agencyInfos.forEach(a -> { | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -200,6 +247,17 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        insert(agencyInfos,customerId,dateId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description  activeCode处理 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Param actCode | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author zxc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2021/4/13 上午10:06 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public List<String> getActiveCode(String[] actCode){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> activeCodes = Arrays.asList(actCode); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return activeCodes; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Param a | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |