|
@ -2,7 +2,6 @@ package com.epmet.datareport.service.fact.impl; |
|
|
|
|
|
|
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.exception.ErrorCode; |
|
|
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.constant.DataSourceConstant; |
|
|
import com.epmet.constant.DataSourceConstant; |
|
|
import com.epmet.datareport.constant.FactConstant; |
|
|
import com.epmet.datareport.constant.FactConstant; |
|
@ -10,6 +9,7 @@ import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao; |
|
|
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao; |
|
|
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao; |
|
|
import com.epmet.datareport.dao.fact.FactIndexAgencyScoreDao; |
|
|
import com.epmet.datareport.dao.fact.FactIndexAgencyScoreDao; |
|
|
import com.epmet.datareport.dao.fact.FactIndexAgencySubScoreDao; |
|
|
import com.epmet.datareport.dao.fact.FactIndexAgencySubScoreDao; |
|
|
|
|
|
import com.epmet.datareport.dao.fact.FactIndexCommunityScoreDao; |
|
|
import com.epmet.datareport.dao.fact.FactIndexCommunitySubScoreDao; |
|
|
import com.epmet.datareport.dao.fact.FactIndexCommunitySubScoreDao; |
|
|
import com.epmet.datareport.service.fact.FactIndexService; |
|
|
import com.epmet.datareport.service.fact.FactIndexService; |
|
|
import com.epmet.evaluationindex.screen.dto.form.*; |
|
|
import com.epmet.evaluationindex.screen.dto.form.*; |
|
@ -19,7 +19,10 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import java.text.ParseException; |
|
|
import java.text.ParseException; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.*; |
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Calendar; |
|
|
|
|
|
import java.util.LinkedList; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 数据改版api |
|
|
* 数据改版api |
|
@ -39,6 +42,8 @@ public class FactIndexServiceImpl implements FactIndexService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private FactIndexAgencySubScoreDao factIndexAgencySubScoreDao; |
|
|
private FactIndexAgencySubScoreDao factIndexAgencySubScoreDao; |
|
|
@Autowired |
|
|
@Autowired |
|
|
|
|
|
private FactIndexCommunityScoreDao factIndexCommunityScoreDao; |
|
|
|
|
|
@Autowired |
|
|
private FactIndexCommunitySubScoreDao factIndexCommunitySubScoreDao; |
|
|
private FactIndexCommunitySubScoreDao factIndexCommunitySubScoreDao; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -49,15 +54,47 @@ public class FactIndexServiceImpl implements FactIndexService { |
|
|
@Override |
|
|
@Override |
|
|
public List<AblityIndexResultDTO> ablityIndex(AblityIndexFormDTO formDTO) { |
|
|
public List<AblityIndexResultDTO> ablityIndex(AblityIndexFormDTO formDTO) { |
|
|
LinkedList<AblityIndexResultDTO> resultDTO = new LinkedList<>(); |
|
|
LinkedList<AblityIndexResultDTO> resultDTO = new LinkedList<>(); |
|
|
//分别查询过去12个月党建能力、治理能力、服务能力各自总分乘权重后的分值,每个月份三个分值的加和就是当月的能力指数的分值 fact_index_agency_score 按月份升序
|
|
|
|
|
|
//1.查询组织过去12个月党建能力指标
|
|
|
|
|
|
//LinkedList<AblityIndexResultDTO.MonthScoreResultDTO.ScoreListResultDTO> djList = factIndexAgencyScoreDao.;
|
|
|
|
|
|
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> djList = null; |
|
|
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> djList = null; |
|
|
//2.查询组织过去12个月治理能力指标
|
|
|
|
|
|
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> zlList = null; |
|
|
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> zlList = null; |
|
|
//3.查询组织过去12个月服务能力指标
|
|
|
|
|
|
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> fwList = null; |
|
|
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> fwList = null; |
|
|
//4.遍历计算每个月能力指数
|
|
|
//分别查询过去12个月党建能力、治理能力、服务能力各自总分乘权重后的分值,每个月份三个分值的加和就是当月的能力指数的分值 fact_index_agency_score 按月份升序
|
|
|
|
|
|
//1.计算所查月份前12个月的monthId
|
|
|
|
|
|
formDTO.setStartMonthId(getDate(formDTO.getMonthId())); |
|
|
|
|
|
//2.根据组织Id查询组织信息
|
|
|
|
|
|
CompartmentResultDTO agency = screenCustomerAgencyDao.getAgencyAreaInfo(formDTO.getAgencyId()); |
|
|
|
|
|
if (null == agency) { |
|
|
|
|
|
throw new RenException(String.format("根据组织Id未查询到组织信息,组织Id:%s", formDTO.getAgencyId())); |
|
|
|
|
|
} |
|
|
|
|
|
//1.根据组织级别判断查询哪类数据表
|
|
|
|
|
|
//区县级、乡镇街道级
|
|
|
|
|
|
if ("district".equals(agency.getLevel()) || "street".equals(agency.getLevel())) { |
|
|
|
|
|
//2-1.查询过去12个月党建能力每月总分、本级得分、下级得分数据(不想写union)
|
|
|
|
|
|
formDTO.setIndexCode(FactConstant.DJNL); |
|
|
|
|
|
djList = factIndexAgencyScoreDao.selectAblityIndex(formDTO); |
|
|
|
|
|
//2-2.查询过去12个月治理能力每月总分、本级得分、下级得分数据
|
|
|
|
|
|
formDTO.setIndexCode(FactConstant.ZLNL); |
|
|
|
|
|
zlList = factIndexAgencyScoreDao.selectAblityIndex(formDTO); |
|
|
|
|
|
//2-3.查询过去12个月服务能力每月总分、本级得分、下级得分数据
|
|
|
|
|
|
formDTO.setIndexCode(FactConstant.FWNL); |
|
|
|
|
|
fwList = factIndexAgencyScoreDao.selectAblityIndex(formDTO); |
|
|
|
|
|
|
|
|
|
|
|
//社区级
|
|
|
|
|
|
} else if ("community".equals(agency.getLevel())) { |
|
|
|
|
|
//2-1.查询过去12个月党建能力每月总分、本级得分、下级得分数据
|
|
|
|
|
|
formDTO.setIndexCode(FactConstant.DJNL); |
|
|
|
|
|
djList = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO); |
|
|
|
|
|
//2-2.查询过去12个月治理能力每月总分、本级得分、下级得分数据
|
|
|
|
|
|
formDTO.setIndexCode(FactConstant.ZLNL); |
|
|
|
|
|
zlList = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO); |
|
|
|
|
|
//2-3.查询过去12个月服务能力每月总分、本级得分、下级得分数据
|
|
|
|
|
|
formDTO.setIndexCode(FactConstant.FWNL); |
|
|
|
|
|
fwList = factIndexCommunityScoreDao.selectCommunityAblityIndex(formDTO); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
throw new RenException(String.format("根据组织Id查询到的组织级别信息错误,组织Id:%s", formDTO.getAgencyId())); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//3.遍历计算每个月能力指数
|
|
|
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> nlList = new LinkedList<>(); |
|
|
LinkedList<AblityIndexResultDTO.ScoreListResultDTO> nlList = new LinkedList<>(); |
|
|
for (int i = 0; i < djList.size(); i++) { |
|
|
for (int i = 0; i < djList.size(); i++) { |
|
|
AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO(); |
|
|
AblityIndexResultDTO.ScoreListResultDTO nldto = new AblityIndexResultDTO.ScoreListResultDTO(); |
|
@ -180,6 +217,11 @@ public class FactIndexServiceImpl implements FactIndexService { |
|
|
return resultList; |
|
|
return resultList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param newDate |
|
|
|
|
|
* @Description 计算monthId对应一年前的monthId |
|
|
|
|
|
* @author sun |
|
|
|
|
|
*/ |
|
|
public String getDate(String newDate) { |
|
|
public String getDate(String newDate) { |
|
|
String date = ""; |
|
|
String date = ""; |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyymm"); |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyymm"); |
|
|