|
|
@ -19,22 +19,23 @@ package com.epmet.service.evaluationindex.extract.todata.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.constant.*; |
|
|
|
import com.epmet.dao.evaluationindex.extract.FactAgencyGovernDailyDao; |
|
|
|
import com.epmet.dto.extract.result.OrgStatisticsResultDTO; |
|
|
|
import com.epmet.dto.stats.DimAgencyDTO; |
|
|
|
import com.epmet.entity.evaluationindex.extract.FactAgencyGovernDailyEntity; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactAgencyGovernDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueMainDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.*; |
|
|
|
import com.epmet.service.stats.DimAgencyService; |
|
|
|
import com.epmet.util.DimIdGenerator; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -54,6 +55,8 @@ public class FactAgencyGovernDailyServiceImpl extends BaseServiceImpl<FactAgency |
|
|
|
private FactOriginIssueMainDailyService factOriginIssueMainDailyService; |
|
|
|
@Resource |
|
|
|
private FactOriginProjectMainDailyService factOriginProjectMainDailyService; |
|
|
|
@Resource |
|
|
|
private FactOriginProjectLogDailyService factOriginProjectLogDailyService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 治理指数-组织相关 |
|
|
@ -67,27 +70,227 @@ public class FactAgencyGovernDailyServiceImpl extends BaseServiceImpl<FactAgency |
|
|
|
@Override |
|
|
|
public void extractFactAgencyGovernDaily(String customerId, String dateId) { |
|
|
|
List<DimAgencyDTO> agencyList = dimAgencyService.getAgencyInfoByCustomerId(customerId); |
|
|
|
List<FactAgencyGovernDailyEntity> agencyGovernDailyList = agencyList.stream().map(agency -> { |
|
|
|
FactAgencyGovernDailyEntity entity = initEntity(agency, dateId); |
|
|
|
return entity; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
// 问题解决总数:当前组织下,话题关闭(已解决+无需解决)总数、议题关闭(已解决+无需解决)总数和项目结案(议题转为项目的结案数+项目立项结案数)总数之和
|
|
|
|
List<FactAgencyGovernDailyEntity> agencyGovernDailyList = agencyList.stream().map(agency -> initEntity(agency, dateId)).collect(Collectors.toList()); |
|
|
|
// 1.问题解决总数:当前组织下,话题关闭(已解决+无需解决)总数、议题关闭(已解决+无需解决)总数和项目结案(议题转为项目的结案数+项目立项结案数)总数之和
|
|
|
|
// 话题总数
|
|
|
|
Map<String, OrgStatisticsResultDTO> topicTotal = factOriginTopicMainDailyService.getAgencyClosedTopicCount(customerId, dateId, null, |
|
|
|
null); |
|
|
|
// 党群自治占比:当前组织下,所有小组内关闭(已解决+无需解决)的话题数与问题解决总数之比(未出小组:未转议题的)
|
|
|
|
// 网格自治占比:当前组织下,所有网格内结案项目数与问题解决总数之比(未出网格)
|
|
|
|
// 参考:fact_index_govrn_ablity_grid_monthly的SELF_SOLVE_PROJECT_COUNT计算
|
|
|
|
// 社区解决占比:当前组织下,由社区结案的项目数与问题解决总数之比
|
|
|
|
// 区直部门解决占比:当前组织下,由区级部门结案的项目数与问题解决总数之比
|
|
|
|
// 街道解决占比:当前组织下,由街道结案的项目数与问题解决总数之比
|
|
|
|
// 自下而上的项目解决:结案时操作人所代表的的处理部门(可以是网格、街道、组织)
|
|
|
|
// 自上而下的项目解决:向下吹哨,谁立项谁解决(后期在讨论哪样更合理)
|
|
|
|
//
|
|
|
|
// 究竟是谁解决!!:
|
|
|
|
// A社区→A街道→B社区(结案)——A街道解决(自下而上吹(饱含立项往上吹/从话题来的项目),看往上吹的最高层级)
|
|
|
|
// A社区→B社区→C社区(结案)——C社区解决(平级协助解决,看最后结案)
|
|
|
|
// A街道→A社区→B社区(结案)——A街道解决(自上而下吹,谁立项谁解决)
|
|
|
|
// 注:A社区→A街道→(退回)A社区→B社区(结案),A街道不算处理项目,仍是平级协助解决,看最后谁结案
|
|
|
|
if (!topicTotal.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = topicTotal.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setProblemResolvedCount(dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
//当前组织内,话题关闭已解决数
|
|
|
|
Map<String, OrgStatisticsResultDTO> topicResolvedCount = factOriginTopicMainDailyService.getAgencyClosedTopicCount(customerId, dateId, |
|
|
|
ProjectConstant.RESOLVED, |
|
|
|
null); |
|
|
|
if (!topicResolvedCount.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = topicResolvedCount.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setTopicResolvedCount(dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//当前组织内,话题关闭未解决数
|
|
|
|
Map<String, OrgStatisticsResultDTO> topicUnResolvedCount = factOriginTopicMainDailyService.getAgencyClosedTopicCount(customerId, dateId, |
|
|
|
ProjectConstant.UNRESOLVED, |
|
|
|
null); |
|
|
|
if (!topicUnResolvedCount.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = topicUnResolvedCount.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setTopicUnResolvedCount(dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//当前组织内,话题关闭已解决数
|
|
|
|
Map<String, OrgStatisticsResultDTO> topicSelfResolvedCount = factOriginTopicMainDailyService.getAgencyClosedTopicCount(customerId, dateId, |
|
|
|
ProjectConstant.RESOLVED, |
|
|
|
NumConstant.ZERO); |
|
|
|
if (!topicSelfResolvedCount.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = topicSelfResolvedCount.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setInGroupTopicResolvedCount(dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//当前组织内,话题关闭未解决数
|
|
|
|
Map<String, OrgStatisticsResultDTO> topicSelfUnResolvedCount = factOriginTopicMainDailyService.getAgencyClosedTopicCount(customerId, |
|
|
|
dateId, |
|
|
|
ProjectConstant.UNRESOLVED, |
|
|
|
NumConstant.ZERO); |
|
|
|
if (!topicSelfUnResolvedCount.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = topicSelfUnResolvedCount.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setInGroupTopicUnResolvedCount(dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
//议题总数
|
|
|
|
Map<String, OrgStatisticsResultDTO> issueTotal = factOriginIssueMainDailyService.getAgencyClosedIssueCount(customerId, dateId, null); |
|
|
|
if (!issueTotal.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = issueTotal.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setProblemResolvedCount(item.getProblemResolvedCount() + dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 当前组织内,议题关闭已解决数
|
|
|
|
Map<String, OrgStatisticsResultDTO> issueResolvedTotal = factOriginIssueMainDailyService.getAgencyClosedIssueCount(customerId, dateId, |
|
|
|
IssueConstant.CLOSED_RESOLVED); |
|
|
|
if (!issueResolvedTotal.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = issueResolvedTotal.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setIssueResolvedCount(dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 当前组织内,议题关闭未解决数
|
|
|
|
Map<String, OrgStatisticsResultDTO> issueUnResolvedTotal = factOriginIssueMainDailyService.getAgencyClosedIssueCount(customerId, dateId, |
|
|
|
IssueConstant.CLOSED_UNRESOLVED); |
|
|
|
if (!issueUnResolvedTotal.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = issueUnResolvedTotal.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setIssueUnResolvedCount(dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
//项目总数
|
|
|
|
Map<String, OrgStatisticsResultDTO> projectTotal = factOriginProjectMainDailyService.getAgencyClosedProjectCount(customerId, dateId, null, |
|
|
|
null); |
|
|
|
if (!projectTotal.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = projectTotal.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setProblemResolvedCount(item.getProblemResolvedCount() + dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 当前组织内:来源于议题的项目:结案已解决数
|
|
|
|
Map<String, OrgStatisticsResultDTO> issueProjectResolvedTotal = factOriginProjectMainDailyService.getAgencyClosedProjectCount(customerId, |
|
|
|
dateId, ProjectConstant.RESOLVED, |
|
|
|
"issue"); |
|
|
|
if (!issueProjectResolvedTotal.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = issueProjectResolvedTotal.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setIssueProjectResolvedCount(dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 当前组织内:来源于议题的项目:结案无需解决数
|
|
|
|
Map<String, OrgStatisticsResultDTO> issueProjectUnResolvedTotal = factOriginProjectMainDailyService.getAgencyClosedProjectCount(customerId, |
|
|
|
dateId, ProjectConstant.UNRESOLVED, |
|
|
|
"issue"); |
|
|
|
if (!issueProjectUnResolvedTotal.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = issueProjectUnResolvedTotal.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setIssueProjectUnResolvedCount(dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 当前组织内:来源于议题的项目:结案已解决数
|
|
|
|
Map<String, OrgStatisticsResultDTO> projectResolvedTotal = factOriginProjectMainDailyService.getAgencyClosedProjectCount(customerId, |
|
|
|
dateId, ProjectConstant.RESOLVED, |
|
|
|
OrgTypeConstant.AGENCY); |
|
|
|
if (!projectResolvedTotal.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = projectResolvedTotal.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setApprovalProjectResolvedCount(dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 当前组织内:来源于议题的项目:结案无需解决数
|
|
|
|
Map<String, OrgStatisticsResultDTO> projectUnResolvedTotal = factOriginProjectMainDailyService.getAgencyClosedProjectCount(customerId, |
|
|
|
dateId, ProjectConstant.UNRESOLVED, |
|
|
|
OrgTypeConstant.AGENCY); |
|
|
|
if (!projectUnResolvedTotal.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = projectUnResolvedTotal.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
item.setApprovalProjectUnResolvedCount(dto.getSum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
// 2.党群自治占比:当前组织下,所有小组内关闭(已解决+无需解决)的话题数与问题解决总数之比(未出小组:未转议题的)
|
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
int count = item.getInGroupTopicResolvedCount() + item.getInGroupTopicUnResolvedCount(); |
|
|
|
int sum = item.getProblemResolvedCount(); |
|
|
|
if (sum != NumConstant.ZERO) { |
|
|
|
BigDecimal resolveCount = new BigDecimal(sum); |
|
|
|
BigDecimal selfCount = new BigDecimal(count); |
|
|
|
item.setGroupSelfGovernRatio(selfCount.divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP)); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 3.网格自治占比:当前组织下,所有网格内结案项目数与问题解决总数之比(未出网格)
|
|
|
|
Map<String, OrgStatisticsResultDTO> gridSelfCount = factOriginProjectLogDailyService.getAgencyGridSelfDaily(customerId, dateId); |
|
|
|
if (!gridSelfCount.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
OrgStatisticsResultDTO dto = gridSelfCount.get(item.getAgencyId()); |
|
|
|
if (null != dto) { |
|
|
|
int count = dto.getCount(); |
|
|
|
int sum = item.getProblemResolvedCount(); |
|
|
|
if (sum != NumConstant.ZERO) { |
|
|
|
BigDecimal resolveCount = new BigDecimal(sum); |
|
|
|
BigDecimal selfCount = new BigDecimal(count); |
|
|
|
item.setGridSelfGovernRatio(selfCount.divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP)); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 4.社区解决占比:当前组织下,由社区结案的项目数与问题解决总数之比
|
|
|
|
// 5.区直部门解决占比:当前组织下,由区级部门结案的项目数与问题解决总数之比
|
|
|
|
// 6.街道解决占比:当前组织下,由街道结案的项目数与问题解决总数之比
|
|
|
|
Map<String, List<OrgStatisticsResultDTO>> projectCount = factOriginProjectMainDailyService.getAgencyClosedProjectStatic(customerId, dateId); |
|
|
|
if (!gridSelfCount.isEmpty()) { |
|
|
|
agencyGovernDailyList.forEach(item -> { |
|
|
|
List<OrgStatisticsResultDTO> list = projectCount.get(item.getAgencyId()); |
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
Map<String, OrgStatisticsResultDTO> map = list.stream().collect(Collectors.toMap(OrgStatisticsResultDTO::getLevel, |
|
|
|
Function.identity())); |
|
|
|
int sum = item.getProblemResolvedCount(); |
|
|
|
BigDecimal resolveCount = new BigDecimal(sum); |
|
|
|
if (sum != NumConstant.ZERO) { |
|
|
|
// 社区解决占比
|
|
|
|
OrgStatisticsResultDTO community = map.get(ScreenConstant.COMMUNITY); |
|
|
|
if (null != community) { |
|
|
|
int count = community.getCount(); |
|
|
|
BigDecimal selfCount = new BigDecimal(count); |
|
|
|
item.setCommunityClosedRatio(selfCount.divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP)); |
|
|
|
item.setCommunityClosedCount(count); |
|
|
|
} |
|
|
|
// 街道解决占比
|
|
|
|
OrgStatisticsResultDTO street = map.get(ScreenConstant.STREET); |
|
|
|
if (null != street) { |
|
|
|
int count = street.getCount(); |
|
|
|
BigDecimal selfCount = new BigDecimal(count); |
|
|
|
item.setStreetClosedRatio(selfCount.divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP)); |
|
|
|
item.setStreetClosedCount(count); |
|
|
|
} |
|
|
|
// 区直部门解决占比
|
|
|
|
OrgStatisticsResultDTO districtDept = map.get(ScreenConstant.DISTRICT); |
|
|
|
if (null != districtDept) { |
|
|
|
int count = districtDept.getCount(); |
|
|
|
BigDecimal selfCount = new BigDecimal(count); |
|
|
|
item.setDistrictDeptClosedRatio(selfCount.divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP)); |
|
|
|
item.setDistrictDeptClosedCount(count); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private FactAgencyGovernDailyEntity initEntity(DimAgencyDTO agency, String dateId) { |
|
|
|