|
|
@ -25,6 +25,7 @@ import com.epmet.dto.indexcal.AgencyCalResultDTO; |
|
|
|
import com.epmet.dto.indexcal.AgencyScoreDTO; |
|
|
|
import com.epmet.dto.indexcal.CalculateCommonFormDTO; |
|
|
|
import com.epmet.dto.indexcal.SubCommunityAvgResultDTO; |
|
|
|
import com.epmet.dto.screen.ScreenProjectOrgDailyDTO; |
|
|
|
import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO; |
|
|
|
import com.epmet.entity.evaluationindex.indexcal.AgencySelfSubScoreEntity; |
|
|
|
import com.epmet.entity.evaluationindex.indexcal.AgencySubScoreEntity; |
|
|
@ -50,6 +51,7 @@ import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -616,7 +618,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
//下属所有社区的党建能力平均值
|
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { |
|
|
|
List<SubCommunityAvgResultDTO> subCommPartyAvgScore = communityScoreDao.selectSubCommAvgScoreExistSubNotSelf(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),form.getCustomerAreaCode()); |
|
|
|
List<SubCommunityAvgResultDTO> dispose = communityScoreDao.selectSubCommAvgScoreExistSubNotSelf(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),form.getCustomerAreaCode()); |
|
|
|
List<SubCommunityAvgResultDTO> subCommPartyAvgScore = disposeSubAvg(dispose, form); |
|
|
|
if (CollectionUtils.isEmpty(subCommPartyAvgScore)) { |
|
|
|
log.warn(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL); |
|
|
|
} else if (subCommPartyAvgScore.size() > NumConstant.ZERO) { |
|
|
@ -692,7 +695,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
Map<String, String> pid = new HashMap<>(); |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQZLNLHZ.getCode().equals(detail.getIndexCode())) { |
|
|
|
List<SubCommunityAvgResultDTO> subGridGovernAvg = communityScoreDao.selectSubCommAvgScoreExistSubNotSelf(monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); |
|
|
|
List<SubCommunityAvgResultDTO> dispose = communityScoreDao.selectSubCommAvgScoreExistSubNotSelf(monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); |
|
|
|
List<SubCommunityAvgResultDTO> subGridGovernAvg = disposeSubAvg(dispose,form); |
|
|
|
if (CollectionUtils.isEmpty(subGridGovernAvg)){ |
|
|
|
log.warn("查询街道下属所有社区治理能力汇总为空"); |
|
|
|
}else if (subGridGovernAvg.size() > NumConstant.ZERO) { |
|
|
@ -713,7 +717,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 治理能力的六个五级指标
|
|
|
|
List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityExistsSubNotSelf(monthId,form.getCustomerAreaCode()); |
|
|
|
List<Map<String, Object>> communityGovernAbility = disposeFiveLevel(form); |
|
|
|
if (CollectionUtils.isEmpty(communityGovernAbility)){ |
|
|
|
log.warn(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); |
|
|
|
}else{ |
|
|
@ -767,7 +771,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
String indexCode = detail.getIndexCode(); |
|
|
|
if (IndexCodeEnum.JIE_DAO_XIA_SHU_SQFWNLDFPYZ.getCode().equals(indexCode)) { |
|
|
|
List<SubCommunityAvgResultDTO> subCommServiceAvg = communityScoreDao.selectSubCommAvgScoreExistSubNotSelf(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),form.getCustomerAreaCode()); |
|
|
|
List<SubCommunityAvgResultDTO> dispose = communityScoreDao.selectSubCommAvgScoreExistSubNotSelf(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),form.getCustomerAreaCode()); |
|
|
|
List<SubCommunityAvgResultDTO> subCommServiceAvg = disposeSubAvg(dispose,form); |
|
|
|
if (CollectionUtils.isEmpty(subCommServiceAvg)) { |
|
|
|
log.warn("查询街道下属社区服务能力得分平均值为空"); |
|
|
|
} else if (subCommServiceAvg.size() > NumConstant.ZERO) { |
|
|
@ -787,7 +792,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
List<Map<String, Object>> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMapExistsSubNotSelf(monthId,form.getCustomerAreaCode()); |
|
|
|
List<Map<String, Object>> communityActivityCountList = disposeActivityCount(form); |
|
|
|
if (CollectionUtils.isEmpty(communityActivityCountList)) { |
|
|
|
log.warn(IndexCalConstant.STREET_SERVICE_ABILITY_NULL); |
|
|
|
}else{ |
|
|
@ -832,7 +837,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
String customerId = form.getCustomerId(); |
|
|
|
String monthId = form.getMonthId(); |
|
|
|
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); |
|
|
|
List<AgencyScoreDTO> agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSub(form.getCustomerAreaCode(), NumConstant.NINE, monthId, IndexCalConstant.STREET_LEVEL); |
|
|
|
List<AgencyScoreDTO> agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSub(form.getCustomerAreaCode(), monthId, IndexCalConstant.STREET_LEVEL,form.getCustomerId()); |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
agencyScoreList.forEach(community -> { |
|
|
|
if (detail.getIndexCode().equals(community.getIndexCode())) { |
|
|
@ -866,4 +871,76 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
public List<SubCommunityAvgResultDTO> disposeSubAvg(List<SubCommunityAvgResultDTO> avgScore, CalculateCommonFormDTO formDTO){ |
|
|
|
List<ScreenProjectOrgDailyDTO> orgIds = customerAgencyDao.selectAgencyByParentAreaCode(formDTO.getCustomerAreaCode()); |
|
|
|
List<SubCommunityAvgResultDTO> subAvgScores = new ArrayList<>(); |
|
|
|
orgIds.forEach(org -> { |
|
|
|
SubCommunityAvgResultDTO s = new SubCommunityAvgResultDTO(); |
|
|
|
s.setAgencyId(org.getOrgId()); |
|
|
|
subAvgScores.add(s); |
|
|
|
}); |
|
|
|
subAvgScores.forEach(subScore -> { |
|
|
|
if (!CollectionUtils.isEmpty(avgScore)){ |
|
|
|
avgScore.forEach(avg -> { |
|
|
|
if (subScore.getAgencyId().equals(avg.getParentId())){ |
|
|
|
subScore.setScore(avg.getScore()); |
|
|
|
avg.setScoreStatus(true); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
Map<Boolean, List<SubCommunityAvgResultDTO>> groupByStatus = avgScore.stream().collect(Collectors.groupingBy(SubCommunityAvgResultDTO::getScoreStatus)); |
|
|
|
List<SubCommunityAvgResultDTO> subAvgResultDTOS = groupByStatus.get(false); |
|
|
|
if (!CollectionUtils.isEmpty(subAvgResultDTOS)){ |
|
|
|
AtomicReference<BigDecimal> finalScore = new AtomicReference<>(new BigDecimal(NumConstant.ZERO)); |
|
|
|
subAvgResultDTOS.forEach(sub -> { |
|
|
|
finalScore.set(finalScore.get().add(sub.getScore())); |
|
|
|
}); |
|
|
|
BigDecimal divide = finalScore.get().divide(new BigDecimal(subAvgResultDTOS.size())); |
|
|
|
subAvgScores.forEach(s -> { |
|
|
|
if (s.getAgencyId().equals("1234085031077498881")){ |
|
|
|
s.setScore(divide); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
return subAvgScores; |
|
|
|
} |
|
|
|
|
|
|
|
public List<Map<String, Object>> disposeFiveLevel(CalculateCommonFormDTO formDTO){ |
|
|
|
List<Map<String, Object>> result = new ArrayList<>(); |
|
|
|
List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityExistsSubNotSelf(formDTO.getMonthId(),formDTO.getCustomerAreaCode()); |
|
|
|
List<Map<String, Object>> kongCunGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityIsKongCun(formDTO.getMonthId(),formDTO.getCustomerAreaCode()); |
|
|
|
if (!CollectionUtils.isEmpty(kongCunGovernAbility)){ |
|
|
|
kongCunGovernAbility.forEach(k -> { |
|
|
|
k.put("AGENCY_ID",k.get("PARENT_ID")); |
|
|
|
k.put("PARENT_ID",NumConstant.ZERO_STR); |
|
|
|
}); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(communityGovernAbility)){ |
|
|
|
result.addAll(communityGovernAbility); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(kongCunGovernAbility)){ |
|
|
|
result.addAll(kongCunGovernAbility); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public List<Map<String, Object>> disposeActivityCount(CalculateCommonFormDTO formDTO){ |
|
|
|
List<Map<String, Object>> result = new ArrayList<>(); |
|
|
|
List<Map<String, Object>> ActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMapExistsSub(formDTO.getMonthId(),formDTO.getCustomerAreaCode()); |
|
|
|
List<Map<String, Object>> kongCunActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMapIsKongCun(formDTO.getMonthId(),formDTO.getCustomerAreaCode()); |
|
|
|
if (!CollectionUtils.isEmpty(kongCunActivityCountList)){ |
|
|
|
kongCunActivityCountList.forEach(k -> { |
|
|
|
k.put("AGENCY_ID",k.get("PARENT_ID")); |
|
|
|
k.put("PARENT_ID",NumConstant.ZERO_STR); |
|
|
|
}); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(ActivityCountList)){ |
|
|
|
result.addAll(ActivityCountList); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(kongCunActivityCountList)){ |
|
|
|
result.addAll(kongCunActivityCountList); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|