76 changed files with 1912 additions and 305 deletions
@ -0,0 +1,41 @@ |
|||
package com.epmet.service.evaluationindex.extract.toscreen; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/9/27 9:37 |
|||
*/ |
|||
public interface OrgRankExtractService { |
|||
/** |
|||
* 网格先进排行 |
|||
* |
|||
* @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,260 @@ |
|||
package com.epmet.service.evaluationindex.extract.toscreen.impl; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.constant.OrgTypeConstant; |
|||
import com.epmet.dto.extract.result.OrgStatisticsResultDTO; |
|||
import com.epmet.dto.stats.user.FactRegUserAgencyMonthlyDTO; |
|||
import com.epmet.dto.stats.user.FactRegUserGridMonthlyDTO; |
|||
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity; |
|||
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyEntity; |
|||
import com.epmet.entity.evaluationindex.screen.ScreenOrgRankDataEntity; |
|||
import com.epmet.service.evaluationindex.extract.todata.*; |
|||
import com.epmet.service.evaluationindex.extract.toscreen.OrgRankExtractService; |
|||
import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyService; |
|||
import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; |
|||
import com.epmet.service.evaluationindex.screen.ScreenOrgRankDataService; |
|||
import com.epmet.service.stats.user.FactRegUserAgencyMonthlyService; |
|||
import com.epmet.service.stats.user.FactRegUserGridMonthlyService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.math.RoundingMode; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/9/27 9:37 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class OrgRankExtractServiceImpl implements OrgRankExtractService { |
|||
@Autowired |
|||
private ScreenOrgRankDataService screenOrgRankDataService; |
|||
@Autowired |
|||
private FactRegUserGridMonthlyService factRegUserGridMonthlyService; |
|||
@Autowired |
|||
private FactOriginGroupMainDailyService factOriginGroupMainDailyService; |
|||
@Autowired |
|||
private FactOriginTopicMainDailyService factOriginTopicMainDailyService; |
|||
@Autowired |
|||
private FactOriginIssueMainDailyService factOriginIssueMainDailyService; |
|||
@Autowired |
|||
private FactOriginProjectMainDailyService factOriginProjectMainDailyService; |
|||
@Autowired |
|||
private FactIndexGovrnAblityGridMonthlyService factIndexGovrnAblityGridMonthlyService; |
|||
@Autowired |
|||
private FactOriginProjectLogDailyService factOriginProjectLogDailyService; |
|||
@Autowired |
|||
private FactRegUserAgencyMonthlyService factRegUserAgencyMonthlyService; |
|||
@Autowired |
|||
private FactIndexGovrnAblityOrgMonthlyService factIndexGovrnAblityOrgMonthlyService; |
|||
|
|||
@Override |
|||
public void extractGridData(String customerId, String monthId) { |
|||
List<ScreenOrgRankDataEntity> list = screenOrgRankDataService.initList(customerId, OrgTypeConstant.GRID, null); |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
return; |
|||
} |
|||
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); |
|||
list.forEach(entity -> { |
|||
entity.setYearId(monthId.substring(NumConstant.ZERO, NumConstant.FOUR)); |
|||
entity.setMonthId(monthId); |
|||
}); |
|||
//党员数
|
|||
List<FactRegUserGridMonthlyDTO> partyMemberList = factRegUserGridMonthlyService.getGridUserCountByCustomer(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(partyMemberList)) { |
|||
list.forEach(entity -> partyMemberList.stream().filter(item -> item.getGridId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setPartyTotal(dto.getPartymemberTotal()); |
|||
})); |
|||
} |
|||
//小组数
|
|||
List<OrgStatisticsResultDTO> groupList = factOriginGroupMainDailyService.getGridGroupCount(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(groupList)) { |
|||
list.forEach(entity -> groupList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setGroupTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//话题数
|
|||
List<OrgStatisticsResultDTO> topicList = factOriginTopicMainDailyService.getGridTopicCount(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(topicList)) { |
|||
list.forEach(entity -> topicList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setTopicTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//议题数
|
|||
List<OrgStatisticsResultDTO> issueList = factOriginIssueMainDailyService.getGridIssueCount(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(issueList)) { |
|||
list.forEach(entity -> issueList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setIssueTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//项目数
|
|||
List<OrgStatisticsResultDTO> projectList = factOriginProjectMainDailyService.getGridProjectCount(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(projectList)) { |
|||
list.forEach(entity -> projectList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setProjectTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//结案率 结案数/项目数
|
|||
List<FactIndexGovrnAblityGridMonthlyEntity> abilityList = factIndexGovrnAblityGridMonthlyService.getGridByCustomer(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(abilityList)) { |
|||
list.forEach(entity -> abilityList.stream().filter(item -> item.getGridId().equals(entity.getOrgId())).forEach(dto -> { |
|||
if (dto.getProjectTotal() != NumConstant.ZERO) { |
|||
BigDecimal total = new BigDecimal(dto.getProjectTotal()); |
|||
BigDecimal closed = new BigDecimal(dto.getResolveProjectCount()); |
|||
entity.setCloseProjectRatio(closed.multiply(hundred).divide(total, NumConstant.SIX, RoundingMode.HALF_UP)); |
|||
} |
|||
|
|||
})); |
|||
} |
|||
//满意率 满意和非常满意占比
|
|||
List<OrgStatisticsResultDTO> satisfactionList = factOriginProjectLogDailyService.getGridSatisfaction(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(satisfactionList)) { |
|||
list.forEach(entity -> satisfactionList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
if (dto.getSum() != NumConstant.ZERO) { |
|||
BigDecimal sum = new BigDecimal(dto.getSum()); |
|||
BigDecimal count = new BigDecimal(dto.getCount()); |
|||
entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); |
|||
} |
|||
})); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void extractCommunityData(String customerId, String monthId) { |
|||
List<ScreenOrgRankDataEntity> list = screenOrgRankDataService.initList(customerId, OrgTypeConstant.AGENCY, OrgTypeConstant.COMMUNITY); |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
return; |
|||
} |
|||
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); |
|||
list.forEach(entity -> { |
|||
entity.setYearId(monthId.substring(NumConstant.ZERO, NumConstant.FOUR)); |
|||
entity.setMonthId(monthId); |
|||
}); |
|||
//党员数
|
|||
List<FactRegUserAgencyMonthlyDTO> partyMemberList = factRegUserAgencyMonthlyService.getOrgUserCountByCustomer(customerId, monthId, |
|||
OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(partyMemberList)) { |
|||
list.forEach(entity -> partyMemberList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setPartyTotal(dto.getPartymemberTotal()); |
|||
})); |
|||
} |
|||
//小组数
|
|||
List<OrgStatisticsResultDTO> groupList = factOriginGroupMainDailyService.getOrgGroupCount(customerId, monthId, OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(groupList)) { |
|||
list.forEach(entity -> groupList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setGroupTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//话题数
|
|||
List<OrgStatisticsResultDTO> topicList = factOriginTopicMainDailyService.getOrgTopicCount(customerId, monthId, OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(topicList)) { |
|||
list.forEach(entity -> topicList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setTopicTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//议题数
|
|||
List<OrgStatisticsResultDTO> issueList = factOriginIssueMainDailyService.getOrgIssueCount(customerId, monthId, OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(issueList)) { |
|||
list.forEach(entity -> issueList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setIssueTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//项目数
|
|||
List<OrgStatisticsResultDTO> projectList = factOriginProjectMainDailyService.getOrgProjectCount(customerId, monthId, OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(projectList)) { |
|||
list.forEach(entity -> projectList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setProjectTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//结案率 结案数/项目数
|
|||
List<FactIndexGovrnAblityOrgMonthlyEntity> abilityList = factIndexGovrnAblityOrgMonthlyService.getOrgByCustomer(customerId, monthId, OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(abilityList)) { |
|||
list.forEach(entity -> abilityList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setCloseProjectRatio(dto.getClosedProjectRatio()); |
|||
})); |
|||
} |
|||
//满意率 满意和非常满意占比
|
|||
List<OrgStatisticsResultDTO> satisfactionList = factOriginProjectLogDailyService.getOrgSatisfaction(customerId, monthId, OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(satisfactionList)) { |
|||
list.forEach(entity -> satisfactionList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
if (dto.getSum() != NumConstant.ZERO) { |
|||
BigDecimal sum = new BigDecimal(dto.getSum()); |
|||
BigDecimal count = new BigDecimal(dto.getCount()); |
|||
entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); |
|||
} |
|||
})); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void extractStreetData(String customerId, String monthId) { |
|||
List<ScreenOrgRankDataEntity> list = screenOrgRankDataService.initList(customerId, OrgTypeConstant.AGENCY, OrgTypeConstant.STREET); |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
return; |
|||
} |
|||
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); |
|||
list.forEach(entity -> { |
|||
entity.setYearId(monthId.substring(NumConstant.ZERO, NumConstant.FOUR)); |
|||
entity.setMonthId(monthId); |
|||
}); |
|||
//党员数
|
|||
List<FactRegUserAgencyMonthlyDTO> partyMemberList = factRegUserAgencyMonthlyService.getOrgUserCountByCustomer(customerId, monthId, |
|||
OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(partyMemberList)) { |
|||
list.forEach(entity -> partyMemberList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setPartyTotal(dto.getPartymemberTotal()); |
|||
})); |
|||
} |
|||
//小组数
|
|||
List<OrgStatisticsResultDTO> groupList = factOriginGroupMainDailyService.getOrgGroupCount(customerId, monthId, OrgTypeConstant.STREET); |
|||
if (!CollectionUtils.isEmpty(groupList)) { |
|||
list.forEach(entity -> groupList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setGroupTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//话题数
|
|||
List<OrgStatisticsResultDTO> topicList = factOriginTopicMainDailyService.getOrgTopicCount(customerId, monthId, OrgTypeConstant.STREET); |
|||
if (!CollectionUtils.isEmpty(topicList)) { |
|||
list.forEach(entity -> topicList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setTopicTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//议题数
|
|||
List<OrgStatisticsResultDTO> issueList = factOriginIssueMainDailyService.getOrgIssueCount(customerId, monthId, OrgTypeConstant.STREET); |
|||
if (!CollectionUtils.isEmpty(issueList)) { |
|||
list.forEach(entity -> issueList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setIssueTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//项目数
|
|||
List<OrgStatisticsResultDTO> projectList = factOriginProjectMainDailyService.getOrgProjectCount(customerId, monthId, OrgTypeConstant.STREET); |
|||
if (!CollectionUtils.isEmpty(projectList)) { |
|||
list.forEach(entity -> projectList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setProjectTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//结案率 结案数/项目数
|
|||
List<FactIndexGovrnAblityOrgMonthlyEntity> abilityList = factIndexGovrnAblityOrgMonthlyService.getOrgByCustomer(customerId, monthId, OrgTypeConstant.STREET); |
|||
if (!CollectionUtils.isEmpty(abilityList)) { |
|||
list.forEach(entity -> abilityList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setCloseProjectRatio(dto.getClosedProjectRatio()); |
|||
})); |
|||
} |
|||
//满意率 满意和非常满意占比
|
|||
List<OrgStatisticsResultDTO> satisfactionList = factOriginProjectLogDailyService.getOrgSatisfaction(customerId, monthId, OrgTypeConstant.STREET); |
|||
if (!CollectionUtils.isEmpty(satisfactionList)) { |
|||
list.forEach(entity -> satisfactionList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
if (dto.getSum() != NumConstant.ZERO) { |
|||
BigDecimal sum = new BigDecimal(dto.getSum()); |
|||
BigDecimal count = new BigDecimal(dto.getCount()); |
|||
entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); |
|||
} |
|||
})); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue