|  |  | @ -1,11 +1,8 @@ | 
			
		
	
		
			
				
					|  |  |  | package com.epmet.service.evaluationindex.indexcoll.impl; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.dynamic.datasource.annotation.DataSource; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.NumConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.DateUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.constant.DataSourceConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.constant.OrgTypeConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.extract.result.OrgStatisticsResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.stats.DimAgencyDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.stats.FactArticlePublishedAgencyDailyDTO; | 
			
		
	
	
		
			
				
					|  |  | @ -13,13 +10,13 @@ import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthly | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.evaluationindex.extract.FactOriginProjectLogDailyService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.evaluationindex.extract.FactOriginProjectMainDailyService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.evaluationindex.extract.FactOriginProjectOrgPeriodDailyService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.evaluationindex.indexcoll.IndexCollStreetService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.stats.DimAgencyService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.stats.FactArticlePublishedAgencyDailyService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.util.DimIdGenerator; | 
			
		
	
		
			
				
					|  |  |  | import io.swagger.models.auth.In; | 
			
		
	
		
			
				
					|  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
	
		
			
				
					|  |  | @ -38,7 +35,6 @@ import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  | @Service | 
			
		
	
		
			
				
					|  |  |  | @Slf4j | 
			
		
	
		
			
				
					|  |  |  | @DataSource(DataSourceConstant.EVALUATION_INDEX) | 
			
		
	
		
			
				
					|  |  |  | public class IndexCollStreetServiceImpl implements IndexCollStreetService { | 
			
		
	
		
			
				
					|  |  |  | 	@Autowired | 
			
		
	
		
			
				
					|  |  |  | 	private DimAgencyService dimAgencyService; | 
			
		
	
	
		
			
				
					|  |  | @ -47,7 +43,7 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { | 
			
		
	
		
			
				
					|  |  |  | 	@Autowired | 
			
		
	
		
			
				
					|  |  |  | 	private FactOriginProjectLogDailyService factOriginProjectLogDailyService; | 
			
		
	
		
			
				
					|  |  |  | 	@Autowired | 
			
		
	
		
			
				
					|  |  |  | 	private FactOriginProjectOrgPeriodDailyDao factOriginProjectOrgPeriodDailyDao; | 
			
		
	
		
			
				
					|  |  |  | 	private FactOriginProjectOrgPeriodDailyService factOriginProjectOrgPeriodDailyService; | 
			
		
	
		
			
				
					|  |  |  | 	@Autowired | 
			
		
	
		
			
				
					|  |  |  | 	private FactOriginProjectMainDailyService factOriginProjectMainDailyService; | 
			
		
	
		
			
				
					|  |  |  | 	@Autowired | 
			
		
	
	
		
			
				
					|  |  | @ -58,7 +54,7 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { | 
			
		
	
		
			
				
					|  |  |  | 	@Override | 
			
		
	
		
			
				
					|  |  |  | 	public void saveStreetAbility(String customerId, String dateId) { | 
			
		
	
		
			
				
					|  |  |  | 		//当前日期前一天
 | 
			
		
	
		
			
				
					|  |  |  | 		Date date = DateUtils.getBeforeDay(DateUtils.stringToDate(dateId, DateUtils.DATE_PATTERN_YYYYMMDD)); | 
			
		
	
		
			
				
					|  |  |  | 		Date date = DateUtils.stringToDate(dateId, DateUtils.DATE_PATTERN_YYYYMM); | 
			
		
	
		
			
				
					|  |  |  | 		//获取日期相关维度
 | 
			
		
	
		
			
				
					|  |  |  | 		DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); | 
			
		
	
		
			
				
					|  |  |  | 		//获取社区列表
 | 
			
		
	
	
		
			
				
					|  |  | @ -96,7 +92,7 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		//社区项目响应度
 | 
			
		
	
		
			
				
					|  |  |  | 		List<OrgStatisticsResultDTO> responsiveness = factOriginProjectOrgPeriodDailyDao.selectResponsiveness(customerId, dimId.getMonthId(), | 
			
		
	
		
			
				
					|  |  |  | 		List<OrgStatisticsResultDTO> responsiveness = factOriginProjectOrgPeriodDailyService.getResponsiveness(customerId, dimId.getMonthId(), | 
			
		
	
		
			
				
					|  |  |  | 				OrgTypeConstant.STREET, OrgTypeConstant.AGENCY); | 
			
		
	
		
			
				
					|  |  |  | 		if (null != responsiveness && !responsiveness.isEmpty()) { | 
			
		
	
		
			
				
					|  |  |  | 			list.forEach(entity -> responsiveness.stream().filter(dto -> dto.getAgencyId().equals(entity.getAgencyId())).forEach(response -> { | 
			
		
	
	
		
			
				
					|  |  | @ -115,7 +111,7 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { | 
			
		
	
		
			
				
					|  |  |  | 				if (sa.getCount() != NumConstant.ZERO) { | 
			
		
	
		
			
				
					|  |  |  | 					BigDecimal count = new BigDecimal(sa.getCount()); | 
			
		
	
		
			
				
					|  |  |  | 					BigDecimal sum = new BigDecimal(sa.getSum()); | 
			
		
	
		
			
				
					|  |  |  | 					entity.setOverdueProjectRatio(sum.divide(count, NumConstant.SIX, RoundingMode.HALF_UP)); | 
			
		
	
		
			
				
					|  |  |  | 					entity.setSatisfactionRatio(sum.divide(count, NumConstant.SIX, RoundingMode.HALF_UP)); | 
			
		
	
		
			
				
					|  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  | 			})); | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
	
		
			
				
					|  |  | @ -123,18 +119,19 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { | 
			
		
	
		
			
				
					|  |  |  | 		Map<String, Integer> agencyHandleCount = factOriginProjectLogDailyService.getProjectHandledAgency(customerId,dimId.getMonthId(),"month"); | 
			
		
	
		
			
				
					|  |  |  | 		Map<String,BigDecimal> responseMap = factOriginProjectLogDailyService.getAgencyResponseRatio(customerId,dimId.getMonthId(),"month"); | 
			
		
	
		
			
				
					|  |  |  | 		list.forEach(entity ->{ | 
			
		
	
		
			
				
					|  |  |  | 			entity.setClosedProjectCount(agencyHandleCount.get(entity.getAgencyId())); | 
			
		
	
		
			
				
					|  |  |  | 			entity.setClosedProjectCount(agencyHandleCount.get(entity.getAgencyId()) == null? NumConstant.ZERO : agencyHandleCount.get(entity.getAgencyId())); | 
			
		
	
		
			
				
					|  |  |  | 			BigDecimal element = entity.getClosedProjectRatio(); | 
			
		
	
		
			
				
					|  |  |  | 			//办结率
 | 
			
		
	
		
			
				
					|  |  |  | 			entity.setClosedProjectRatio( | 
			
		
	
		
			
				
					|  |  |  | 					element.divide(new BigDecimal(entity.getTransferedCount()), NumConstant.SIX, RoundingMode.HALF_UP) | 
			
		
	
		
			
				
					|  |  |  | 			); | 
			
		
	
		
			
				
					|  |  |  | 			if (entity.getTransferedCount() != NumConstant.ZERO) { | 
			
		
	
		
			
				
					|  |  |  | 				//办结率
 | 
			
		
	
		
			
				
					|  |  |  | 				entity.setClosedProjectRatio( | 
			
		
	
		
			
				
					|  |  |  | 						element.divide(new BigDecimal(entity.getTransferedCount()), NumConstant.SIX, RoundingMode.HALF_UP) | 
			
		
	
		
			
				
					|  |  |  | 				); | 
			
		
	
		
			
				
					|  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  | 			//响应度
 | 
			
		
	
		
			
				
					|  |  |  | 			entity.setRespProjectRatio(responseMap.get(entity.getAgencyId())); | 
			
		
	
		
			
				
					|  |  |  | 		}); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.STREET); | 
			
		
	
		
			
				
					|  |  |  | 		factIndexGovrnAblityOrgMonthlyService.insertBatch(list); | 
			
		
	
		
			
				
					|  |  |  | 		factIndexGovrnAblityOrgMonthlyService.saveList(list); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		//2.党建能力
 | 
			
		
	
	
		
			
				
					|  |  | @ -159,6 +156,6 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { | 
			
		
	
		
			
				
					|  |  |  | 			})); | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		factIndexPartyAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.STREET); | 
			
		
	
		
			
				
					|  |  |  | 		factIndexPartyAblityOrgMonthlyService.insertBatch(partyList); | 
			
		
	
		
			
				
					|  |  |  | 		factIndexPartyAblityOrgMonthlyService.saveList(partyList); | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |