|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.enums.KongCunCustomerEnvEnum; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
@ -167,7 +168,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
Map<String, BigDecimal> weightMap = new HashMap<>(); |
|
|
|
selfSubIndexList.forEach(o -> { |
|
|
|
//找出自身 和下级的指标
|
|
|
|
if (o.getAllIndexCodePath().indexOf(ProjectConstant.XIA_JI) > -1) { |
|
|
|
if (o.getAllIndexCodePath().contains(ProjectConstant.XIA_JI)) { |
|
|
|
selfSubParentMap.get(ProjectConstant.XIA_JI).add(o.getIndexCode()); |
|
|
|
weightMap.put(ProjectConstant.XIA_JI, weightMap.getOrDefault(ProjectConstant.XIA_JI, new BigDecimal(0)).add(o.getWeight())); |
|
|
|
} else { |
|
|
@ -225,6 +226,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL); |
|
|
|
return true; |
|
|
|
} |
|
|
|
String quarterId = DateUtils.getQuarterId(monthId); |
|
|
|
String yearId = DateUtils.getYearId(monthId); |
|
|
|
List<IndexInputVO> indexInputVOS = new ArrayList<>(); |
|
|
|
Map<String, String> pid = new HashMap<>(); |
|
|
|
|
|
|
@ -233,7 +236,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
//下属所有社区的党建能力平均值
|
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { |
|
|
|
List<SubCommunityAvgResultDTO> subCommPartyAvgScore = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); |
|
|
|
List<SubCommunityAvgResultDTO> subCommPartyAvgScore = communityScoreDao.selectSubCommAvgScoreNew(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),quarterId,yearId); |
|
|
|
subCommPartyAvgScore.forEach(s -> { |
|
|
|
gridPartyScoreSampleCountMap.put(s.getAgencyId().concat(":").concat(IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQDJNLHZPJZ.getCode()), s.getSampleCount()); |
|
|
|
}); |
|
|
@ -257,7 +260,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 街道名义发文数量
|
|
|
|
List<Map<String, Object>> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId, IndexCalConstant.STREET_LEVEL); |
|
|
|
List<Map<String, Object>> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapNew(customerId, monthId, IndexCalConstant.STREET_LEVEL,quarterId,yearId); |
|
|
|
if (CollectionUtils.isEmpty(mapList)) { |
|
|
|
log.warn(IndexCalConstant.STREET_PUBLISH_ARTICLE_LIST_NULL); |
|
|
|
} else { |
|
|
@ -313,6 +316,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL); |
|
|
|
return true; |
|
|
|
} |
|
|
|
String quarterId = DateUtils.getQuarterId(monthId); |
|
|
|
String yearId = DateUtils.getYearId(monthId); |
|
|
|
List<IndexInputVO> indexInputVOS = new ArrayList<>(); |
|
|
|
Map<String, String> pid = new HashMap<>(); |
|
|
|
|
|
|
@ -320,7 +325,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
Map<String, Integer> gridPartyScoreSampleCountMap = new HashMap<>(); |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQZLNLHZ.getCode().equals(detail.getIndexCode())) { |
|
|
|
List<SubCommunityAvgResultDTO> subGridGovernAvg = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); |
|
|
|
List<SubCommunityAvgResultDTO> subGridGovernAvg = communityScoreDao.selectSubCommAvgScoreNew(customerId, monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),quarterId,yearId); |
|
|
|
subGridGovernAvg.forEach(s -> { |
|
|
|
gridPartyScoreSampleCountMap.put(s.getAgencyId().concat(":").concat(IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQZLNLHZ.getCode()), s.getSampleCount()); |
|
|
|
}); |
|
|
@ -343,7 +348,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 治理能力的六个五级指标
|
|
|
|
List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.STREET_LEVEL); |
|
|
|
List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityNew(customerId, monthId,IndexCalConstant.STREET_LEVEL,quarterId,yearId); |
|
|
|
if (CollectionUtils.isEmpty(communityGovernAbility)){ |
|
|
|
log.warn(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); |
|
|
|
}else{ |
|
|
@ -396,6 +401,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL); |
|
|
|
return true; |
|
|
|
} |
|
|
|
String quarterId = DateUtils.getQuarterId(monthId); |
|
|
|
String yearId = DateUtils.getYearId(monthId); |
|
|
|
List<IndexInputVO> indexInputVOS = new ArrayList<>(); |
|
|
|
Map<String, String> pid = new HashMap<>(); |
|
|
|
|
|
|
@ -405,12 +412,10 @@ 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.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode()); |
|
|
|
|
|
|
|
List<SubCommunityAvgResultDTO> subCommServiceAvg = communityScoreDao.selectSubCommAvgScoreNew(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),quarterId,yearId); |
|
|
|
subCommServiceAvg.forEach(s -> { |
|
|
|
gridPartyScoreSampleCountMap.put(s.getAgencyId().concat(":").concat(IndexCodeEnum.JIE_DAO_XIA_SHU_SQFWNLDFPYZ.getCode()), s.getSampleCount()); |
|
|
|
}); |
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(subCommServiceAvg)) { |
|
|
|
log.warn("查询街道下属社区服务能力得分平均值为空"); |
|
|
|
} else if (subCommServiceAvg.size() > NumConstant.ZERO) { |
|
|
@ -429,7 +434,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
List<Map<String, Object>> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.STREET_LEVEL); |
|
|
|
// 活动组织次数
|
|
|
|
List<Map<String, Object>> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMapNew(customerId, monthId,IndexCalConstant.STREET_LEVEL,quarterId,yearId); |
|
|
|
if (CollectionUtils.isEmpty(communityActivityCountList)) { |
|
|
|
log.warn(IndexCalConstant.STREET_SERVICE_ABILITY_NULL); |
|
|
|
}else{ |
|
|
@ -648,12 +654,16 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL); |
|
|
|
return true; |
|
|
|
} |
|
|
|
String quarterId = DateUtils.getQuarterId(monthId); |
|
|
|
String yearId = DateUtils.getYearId(monthId); |
|
|
|
List<IndexInputVO> indexInputVOS = new ArrayList<>(); |
|
|
|
Map<String, String> pid = new HashMap<>(); |
|
|
|
//下属所有社区的党建能力平均值
|
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { |
|
|
|
List<SubCommunityAvgResultDTO> dispose = communityScoreDao.selectSubCommAvgScoreExistSubNotSelf(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),form.getCustomerAreaCode()); |
|
|
|
// 下属所有社区的党建能力平均值
|
|
|
|
List<SubCommunityAvgResultDTO> dispose = communityScoreDao.selectSubCommAvgScoreExistSubNotSelfNew(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),form.getCustomerAreaCode(),quarterId,yearId); |
|
|
|
// 数据处理
|
|
|
|
List<SubCommunityAvgResultDTO> subCommPartyAvgScore = disposeSubAvg(dispose, form); |
|
|
|
if (CollectionUtils.isEmpty(subCommPartyAvgScore)) { |
|
|
|
log.warn(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL); |
|
|
@ -676,7 +686,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 街道名义发文数量
|
|
|
|
List<Map<String, Object>> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSubStreet(monthId,form.getCustomerAreaCode()); |
|
|
|
List<Map<String, Object>> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSubStreetNew(monthId,form.getCustomerAreaCode(),quarterId,yearId); |
|
|
|
if (CollectionUtils.isEmpty(mapList)) { |
|
|
|
log.warn(IndexCalConstant.STREET_PUBLISH_ARTICLE_LIST_NULL); |
|
|
|
} else { |
|
|
@ -726,11 +736,15 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL); |
|
|
|
return true; |
|
|
|
} |
|
|
|
String quarterId = DateUtils.getQuarterId(monthId); |
|
|
|
String yearId = DateUtils.getYearId(monthId); |
|
|
|
List<IndexInputVO> indexInputVOS = new ArrayList<>(); |
|
|
|
Map<String, String> pid = new HashMap<>(); |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQZLNLHZ.getCode().equals(detail.getIndexCode())) { |
|
|
|
List<SubCommunityAvgResultDTO> dispose = communityScoreDao.selectSubCommAvgScoreExistSubNotSelf(monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); |
|
|
|
// 查询areaCode扫出所有社区级别的数据
|
|
|
|
List<SubCommunityAvgResultDTO> dispose = communityScoreDao.selectSubCommAvgScoreExistSubNotSelfNew(monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode(),quarterId,yearId); |
|
|
|
// 孔村数据处理
|
|
|
|
List<SubCommunityAvgResultDTO> subGridGovernAvg = disposeSubAvg(dispose,form); |
|
|
|
if (CollectionUtils.isEmpty(subGridGovernAvg)){ |
|
|
|
log.warn("查询街道下属所有社区治理能力汇总为空"); |
|
|
@ -801,12 +815,16 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL); |
|
|
|
return true; |
|
|
|
} |
|
|
|
String quarterId = DateUtils.getQuarterId(monthId); |
|
|
|
String yearId = DateUtils.getYearId(monthId); |
|
|
|
List<IndexInputVO> indexInputVOS = new ArrayList<>(); |
|
|
|
Map<String, String> pid = new HashMap<>(); |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
String indexCode = detail.getIndexCode(); |
|
|
|
if (IndexCodeEnum.JIE_DAO_XIA_SHU_SQFWNLDFPYZ.getCode().equals(indexCode)) { |
|
|
|
List<SubCommunityAvgResultDTO> dispose = communityScoreDao.selectSubCommAvgScoreExistSubNotSelf(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),form.getCustomerAreaCode()); |
|
|
|
// 街道服务能力平均值
|
|
|
|
List<SubCommunityAvgResultDTO> dispose = communityScoreDao.selectSubCommAvgScoreExistSubNotSelfNew(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),form.getCustomerAreaCode(),quarterId,yearId); |
|
|
|
// 孔村数据处理
|
|
|
|
List<SubCommunityAvgResultDTO> subCommServiceAvg = disposeSubAvg(dispose,form); |
|
|
|
if (CollectionUtils.isEmpty(subCommServiceAvg)) { |
|
|
|
log.warn("查询街道下属社区服务能力得分平均值为空"); |
|
|
@ -827,6 +845,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 活动组织次数
|
|
|
|
List<Map<String, Object>> communityActivityCountList = disposeActivityCount(form); |
|
|
|
if (CollectionUtils.isEmpty(communityActivityCountList)) { |
|
|
|
log.warn(IndexCalConstant.STREET_SERVICE_ABILITY_NULL); |
|
|
@ -907,6 +926,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
} |
|
|
|
|
|
|
|
public List<SubCommunityAvgResultDTO> disposeSubAvg(List<SubCommunityAvgResultDTO> avgScore, CalculateCommonFormDTO formDTO){ |
|
|
|
// 查询处parentAreaCode = xx的组织
|
|
|
|
List<ScreenProjectOrgDailyDTO> orgIds = customerAgencyDao.selectAgencyByParentAreaCode(formDTO.getCustomerAreaCode()); |
|
|
|
List<SubCommunityAvgResultDTO> subAvgScores = new ArrayList<>(); |
|
|
|
orgIds.forEach(org -> { |
|
|
@ -914,6 +934,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
s.setAgencyId(org.getOrgId()); |
|
|
|
subAvgScores.add(s); |
|
|
|
}); |
|
|
|
// 把除去孔村镇的数据赋值,孔村在下边单独处理
|
|
|
|
subAvgScores.forEach(subScore -> { |
|
|
|
if (!CollectionUtils.isEmpty(avgScore)){ |
|
|
|
avgScore.forEach(avg -> { |
|
|
@ -925,16 +946,19 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
} |
|
|
|
}); |
|
|
|
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()),NumConstant.SIX,BigDecimal.ROUND_HALF_UP); |
|
|
|
subAvgScores.forEach(s -> { |
|
|
|
// 孔村单独处理
|
|
|
|
if (s.getAgencyId().equals("1234085031077498881")){ |
|
|
|
if (s.getAgencyId().equals(PingYinConstant.KONG_CUN_AGENCY_ID)){ |
|
|
|
s.setScore(divide); |
|
|
|
} |
|
|
|
}); |
|
|
@ -942,13 +966,23 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
return subAvgScores; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 治理能力的六个五级指标 |
|
|
|
* @Param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2021/5/29 9:18 上午 |
|
|
|
*/ |
|
|
|
public List<Map<String, Object>> disposeFiveLevel(CalculateCommonFormDTO formDTO){ |
|
|
|
String quarterId = DateUtils.getQuarterId(formDTO.getMonthId()); |
|
|
|
String yearId = DateUtils.getYearId(formDTO.getMonthId()); |
|
|
|
List<Map<String, Object>> result = new ArrayList<>(); |
|
|
|
List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityExistsSubNotSelf(formDTO.getMonthId(),formDTO.getCustomerAreaCode(), ScreenConstant.STREET); |
|
|
|
List<Map<String, Object>> kongCunGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityIsKongCun(formDTO.getMonthId(),formDTO.getCustomerAreaCode()); |
|
|
|
// 治理能力的六个五级指标【街道】
|
|
|
|
List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectStreetGovernAbilityExistsSubNotSelfNew(formDTO.getMonthId(),formDTO.getCustomerAreaCode(), ScreenConstant.STREET,quarterId,yearId,PingYinConstant.KONG_CUN_CUSTOMER_ID); |
|
|
|
// 孔村数据单独查
|
|
|
|
List<Map<String, Object>> kongCunGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityIsKongCunNew(formDTO.getMonthId(),formDTO.getCustomerAreaCode(), quarterId,yearId,PingYinConstant.KONG_CUN_CUSTOMER_ID); |
|
|
|
if (!CollectionUtils.isEmpty(kongCunGovernAbility)){ |
|
|
|
kongCunGovernAbility.forEach(k -> { |
|
|
|
k.put("AGENCY_ID",k.get("PARENT_ID")); |
|
|
|
k.put("AGENCY_ID",k.get("AGENCY_ID")); |
|
|
|
k.put("PARENT_ID",NumConstant.ZERO_STR); |
|
|
|
}); |
|
|
|
} |
|
|
@ -961,13 +995,23 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 活动组织次数【街道】 |
|
|
|
* @Param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2021/5/29 9:31 上午 |
|
|
|
*/ |
|
|
|
public List<Map<String, Object>> disposeActivityCount(CalculateCommonFormDTO formDTO){ |
|
|
|
String quarterId = DateUtils.getQuarterId(formDTO.getMonthId()); |
|
|
|
String yearId = DateUtils.getYearId(formDTO.getMonthId()); |
|
|
|
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()); |
|
|
|
// 街道级 活动组织次数查询
|
|
|
|
List<Map<String, Object>> ActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMapExistsSubNew(formDTO.getMonthId(),formDTO.getCustomerAreaCode(),quarterId,yearId,PingYinConstant.KONG_CUN_CUSTOMER_ID); |
|
|
|
// 孔村活动组织次数
|
|
|
|
List<Map<String, Object>> kongCunActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMapIsKongCunNew(formDTO.getMonthId(),formDTO.getCustomerAreaCode(),quarterId,yearId,PingYinConstant.KONG_CUN_CUSTOMER_ID); |
|
|
|
if (!CollectionUtils.isEmpty(kongCunActivityCountList)){ |
|
|
|
kongCunActivityCountList.forEach(k -> { |
|
|
|
k.put("AGENCY_ID",k.get("PARENT_ID")); |
|
|
|
k.put("AGENCY_ID",k.get("AGENCY_ID")); |
|
|
|
k.put("PARENT_ID",NumConstant.ZERO_STR); |
|
|
|
}); |
|
|
|
} |
|
|
|