| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -2,18 +2,22 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.dynamic.datasource.annotation.DataSource; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.DataSourceConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.datareport.dao.evaluationindex.screen.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.datareport.service.evaluationindex.screen.PartyMemberLeadService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.datareport.utils.DateUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.datareport.utils.ModuleConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.ScreenCustomerAgencyDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.evaluationindex.screen.constant.ScreenConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.evaluationindex.screen.dto.form.AgencyAndNumFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.evaluationindex.screen.dto.form.ContactMassLineChartFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.evaluationindex.screen.dto.form.FineExampleFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.evaluationindex.screen.dto.form.VolunteerServiceFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.evaluationindex.screen.dto.result.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.OperCrmOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.github.pagehelper.PageHelper; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -48,7 +52,10 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private DateUtils dateUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ScreenPartyUserRankDataDao screenPartyUserRankDataDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ScreenCustomerAgencyDao customerAgencyDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private OperCrmOpenFeignClient operCrmOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description  1、先锋模范 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param fineExampleFormDTO | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -58,17 +65,35 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public FineExampleResultDTO fineExample(FineExampleFormDTO fineExampleFormDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        FineExampleResultDTO fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (null == fineExampleResultDTO){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return new FineExampleResultDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String customerId = fineExampleFormDTO.getCustomerId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String areaCode = null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(StringUtils.isBlank(customerId)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ScreenCustomerAgencyDTO agencyInfo = customerAgencyDao.selectByAgencyId(fineExampleFormDTO.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if(null == agencyInfo) throw new RenException("未找到对应的机关"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            customerId = agencyInfo.getCustomerId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            areaCode = agencyInfo.getAreaCode(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        fineExampleResultDTO.setPlatJoinPartyRatio(this.getRatio(Double.valueOf(fineExampleResultDTO.getPlatJoinPartyRatio()))); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return fineExampleResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<List<String>> crmResponse = operCrmOpenFeignClient.getAllSubCustomerIds(customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(null == crmResponse || !crmResponse.success()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException("获取子客户列表失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> subCustomers = crmResponse.getData(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							FineExampleResultDTO fineExampleResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(CollectionUtils.isEmpty(subCustomers)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								 fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							else | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								fineExampleResultDTO = screenPioneerDataDao.selectFineExampleByAreaCode(areaCode,customerId,subCustomers); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (null == fineExampleResultDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                return new FineExampleResultDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            fineExampleResultDTO.setPlatJoinPartyRatio(this.getRatio(Double.valueOf(fineExampleResultDTO.getPlatJoinPartyRatio()))); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return fineExampleResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |