forked from rongchao/epmet-cloud-rizhao
				
			
				 10 changed files with 288 additions and 1 deletions
			
			
		@ -0,0 +1,41 @@ | 
				
			|||
package com.epmet.service.evaluationindex.extract.toscreen; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @author zhaoqifeng | 
				
			|||
 * @dscription | 
				
			|||
 * @date 2020/9/24 14:28 | 
				
			|||
 */ | 
				
			|||
public interface GovernRankDataExtractService { | 
				
			|||
	/** | 
				
			|||
	 * 网格治理能力 | 
				
			|||
	 * | 
				
			|||
	 * @param customerId | 
				
			|||
	 * @param monthId | 
				
			|||
	 * @return void | 
				
			|||
	 * @author zhaoqifeng | 
				
			|||
	 * @date 2020/9/24 15:16 | 
				
			|||
	 */ | 
				
			|||
	void extractGridData(String customerId, String monthId); | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 社区治理能力 | 
				
			|||
	 * | 
				
			|||
	 * @param customerId | 
				
			|||
	 * @param monthId | 
				
			|||
	 * @return void | 
				
			|||
	 * @author zhaoqifeng | 
				
			|||
	 * @date 2020/9/24 15:17 | 
				
			|||
	 */ | 
				
			|||
	void extractCommunityData(String customerId, String monthId); | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 街道治理能力 | 
				
			|||
	 * | 
				
			|||
	 * @param customerId | 
				
			|||
	 * @param monthId | 
				
			|||
	 * @return void | 
				
			|||
	 * @author zhaoqifeng | 
				
			|||
	 * @date 2020/9/24 15:17 | 
				
			|||
	 */ | 
				
			|||
	void extractStreetData(String customerId, String monthId); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,64 @@ | 
				
			|||
package com.epmet.service.evaluationindex.extract.toscreen.impl; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.constant.NumConstant; | 
				
			|||
import com.epmet.constant.OrgTypeConstant; | 
				
			|||
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyDao; | 
				
			|||
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity; | 
				
			|||
import com.epmet.entity.evaluationindex.screen.ScreenGovernRankDataEntity; | 
				
			|||
import com.epmet.service.evaluationindex.extract.toscreen.GovernRankDataExtractService; | 
				
			|||
import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyService; | 
				
			|||
import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; | 
				
			|||
import com.epmet.service.evaluationindex.screen.ScreenGovernRankDataService; | 
				
			|||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			|||
import org.springframework.util.CollectionUtils; | 
				
			|||
 | 
				
			|||
import java.math.BigDecimal; | 
				
			|||
import java.math.RoundingMode; | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @author zhaoqifeng | 
				
			|||
 * @dscription | 
				
			|||
 * @date 2020/9/24 14:31 | 
				
			|||
 */ | 
				
			|||
public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractService { | 
				
			|||
	@Autowired | 
				
			|||
	private ScreenGovernRankDataService screenGovernRankDataService; | 
				
			|||
	@Autowired | 
				
			|||
	private FactIndexGovrnAblityOrgMonthlyService factIndexGovrnAblityOrgMonthlyService; | 
				
			|||
	@Autowired | 
				
			|||
	private FactIndexGovrnAblityGridMonthlyService factIndexGovrnAblityGridMonthlyService; | 
				
			|||
 | 
				
			|||
	@Override | 
				
			|||
	public void extractGridData(String customerId, String monthId) { | 
				
			|||
		List<ScreenGovernRankDataEntity> list = screenGovernRankDataService.initList(customerId, OrgTypeConstant.GRID, null); | 
				
			|||
		if (CollectionUtils.isEmpty(list)) { | 
				
			|||
			return; | 
				
			|||
		} | 
				
			|||
		List<FactIndexGovrnAblityGridMonthlyEntity> gridList = factIndexGovrnAblityGridMonthlyService.getGridByCustomer(customerId, monthId); | 
				
			|||
		list.forEach(entity -> gridList.stream().filter(gridAblity -> entity.getOrgId().equals(gridAblity.getGridId())).forEach(grid -> { | 
				
			|||
			BigDecimal total = new BigDecimal(grid.getProjectTotal()); | 
				
			|||
			entity.setYearId(grid.getYearId()); | 
				
			|||
			entity.setMonthId(grid.getMonthId()); | 
				
			|||
			//TODO 响应率
 | 
				
			|||
			//解决率
 | 
				
			|||
			BigDecimal resolveCount = new BigDecimal(grid.getResolveProjectCount()); | 
				
			|||
			entity.setResolvedRatio(resolveCount.divide(total, NumConstant.SIX, RoundingMode.HALF_UP)); | 
				
			|||
			//自治率
 | 
				
			|||
			BigDecimal selfCount = new BigDecimal(grid.getSelfSolveProjectCount()); | 
				
			|||
			entity.setGovernRatio(selfCount.divide(total, NumConstant.SIX, RoundingMode.HALF_UP)); | 
				
			|||
			//满意率
 | 
				
			|||
			entity.setSatisfactionRatio(grid.getSatisfactionRatio()); | 
				
			|||
		})); | 
				
			|||
	} | 
				
			|||
 | 
				
			|||
	@Override | 
				
			|||
	public void extractCommunityData(String customerId, String monthId) { | 
				
			|||
 | 
				
			|||
	} | 
				
			|||
 | 
				
			|||
	@Override | 
				
			|||
	public void extractStreetData(String customerId, String monthId) { | 
				
			|||
 | 
				
			|||
	} | 
				
			|||
} | 
				
			|||
@ -0,0 +1,24 @@ | 
				
			|||
package com.epmet.service.evaluationindex.indexcoll; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.mybatis.service.BaseService; | 
				
			|||
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity; | 
				
			|||
 | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @author zhaoqifeng | 
				
			|||
 * @dscription | 
				
			|||
 * @date 2020/9/24 14:34 | 
				
			|||
 */ | 
				
			|||
public interface FactIndexGovrnAblityGridMonthlyService extends BaseService<FactIndexGovrnAblityGridMonthlyEntity> { | 
				
			|||
	/** | 
				
			|||
	 * 查询客户下网格治理能力 | 
				
			|||
	 * | 
				
			|||
	 * @param customerId | 
				
			|||
	 * @param monthId | 
				
			|||
	 * @return java.util.List<com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity> | 
				
			|||
	 * @author zhaoqifeng | 
				
			|||
	 * @date 2020/9/24 15:41 | 
				
			|||
	 */ | 
				
			|||
	List<FactIndexGovrnAblityGridMonthlyEntity> getGridByCustomer(String customerId, String monthId); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,20 @@ | 
				
			|||
package com.epmet.service.evaluationindex.indexcoll.impl; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			|||
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; | 
				
			|||
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity; | 
				
			|||
import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyService; | 
				
			|||
 | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @author zhaoqifeng | 
				
			|||
 * @dscription | 
				
			|||
 * @date 2020/9/24 14:36 | 
				
			|||
 */ | 
				
			|||
public class FactIndexGovrnAblityGridMonthlyServiceImpl extends BaseServiceImpl<FactIndexGovrnAblityGridMonthlyDao, FactIndexGovrnAblityGridMonthlyEntity> implements FactIndexGovrnAblityGridMonthlyService { | 
				
			|||
	@Override | 
				
			|||
	public List<FactIndexGovrnAblityGridMonthlyEntity> getGridByCustomer(String customerId, String monthId) { | 
				
			|||
		return baseDao.selectGridByCustomer(customerId, monthId); | 
				
			|||
	} | 
				
			|||
} | 
				
			|||
					Loading…
					
					
				
		Reference in new issue