diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 8bf6af5abd..ed3a3961da 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -441,6 +441,7 @@ epmet: # 外部应用认证,使用AccessToken等头进行认证 externalAuthUrls: - /data/report/** + - /data/stats/** - /epmetuser/customerstaff/customerlist swaggerUrls: diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AdvancedBranchRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AdvancedBranchRankFormDTO.java new file mode 100644 index 0000000000..a6e5ecb9b3 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AdvancedBranchRankFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.evaluationindex.screen.dto.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 先进排行-先进支部排行--接口入参 + * @Author sun + */ +@Data +public class AdvancedBranchRankFormDTO implements Serializable { + private static final long serialVersionUID = -8674763412362557239L; + /** + * 机关Id + * */ + @NotBlank(message = "机关Id不能为空" , groups = AdvancedBranchRankFormDTO.AddUserInternalGroup.class) + private String agencyId; + /** + * 显示多少条 + * */ + @Min(value = 1, message = "查询条数必须大于0", groups = {AdvancedBranchRankFormDTO.AddUserInternalGroup.class }) + private Integer topNum; + /** + * 月份Id + * */ + private String monthId; + public interface AddUserInternalGroup {} +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexAdvanceBranchRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexAdvanceBranchRankResultDTO.java new file mode 100644 index 0000000000..cbe72572b6 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexAdvanceBranchRankResultDTO.java @@ -0,0 +1,53 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 先进排行-先进支部排行--接口返参 + * + * @Author sun + */ +@Data +public class IndexAdvanceBranchRankResultDTO implements Serializable { + private static final long serialVersionUID = 330099297596334388L; + + /** + * 名称 XXXX社区党委 + */ + private String name; + /** + * 指标得分 + */ + @JsonIgnore + private String totalScore; + private BigDecimal scroe; + /** + * 党员数 + */ + private Integer partyMemberNum; + + /** + * 议题数 + */ + private Integer issueNum; + + /** + * 项目数 + */ + private Integer projectNum; + + /** + * 满意度 90.64% 返回字符串,前端直接显示 + */ + private String satisfactionRatio; + + /** + * 结案率 94.3% 返回字符串,前端直接显示 + */ + private String closedProjectRatio; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java index 79b839ea10..100c35b293 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java @@ -113,5 +113,16 @@ public class IndexController { return new Result().ok(indexService.indexScore(formDTO)); } + /** + * @param formDTO + * @Description 先进排行-先进支部排行 + * @author sun + */ + @PostMapping("advancedbranchrank") + Result> advancedBranchRank(@RequestBody AdvancedBranchRankFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AdvancedBranchRankFormDTO.AddUserInternalGroup.class); + return new Result>().ok(indexService.advancedBranchRank(formDTO)); + } + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java index c042885cc6..2c030eac41 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java @@ -88,4 +88,11 @@ public interface ScreenIndexDataMonthlyDao{ * @author sun */ IndexScoreResultDTO selectMonthData(IndexScoreFormDTO formDTO); + + /** + * @param formDTO + * @Description 先进排行-先进支部排行 + * @author sun + */ + List selectRankList(AdvancedBranchRankFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java index a577e666a6..3485770cc2 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java @@ -69,4 +69,11 @@ public interface IndexService { * @author sun */ IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO); + + /** + * @param formDTO + * @Description 先进排行-先进支部排行 + * @author sun + */ + List advancedBranchRank(AdvancedBranchRankFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java index 385ec49fcc..01b433dc0d 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java @@ -11,9 +11,11 @@ import com.epmet.evaluationindex.screen.constant.ScreenConstant; import com.epmet.evaluationindex.screen.dto.form.*; import com.epmet.evaluationindex.screen.dto.result.*; import org.apache.commons.lang3.StringUtils; +import org.jsoup.helper.DataUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.util.unit.DataUnit; import java.math.BigDecimal; import java.text.NumberFormat; @@ -283,8 +285,6 @@ public class IndexServiceImpl implements IndexService { NumberFormat nf = NumberFormat.getPercentInstance(); nf.setMaximumFractionDigits(1); - BigDecimal num = new BigDecimal(resultDTO.getTotal()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros(); - resultDTO.setTotalScore(num); BigDecimal num1 = new BigDecimal(resultDTO.getParty()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros(); resultDTO.setPartyDevAbility(num1); resultDTO.setPartyDevAbilityWeight(nf.format(Double.parseDouble(resultDTO.getPartyDevAbilityWeight()))); @@ -294,8 +294,37 @@ public class IndexServiceImpl implements IndexService { BigDecimal num3 = new BigDecimal(resultDTO.getService()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros(); resultDTO.setServiceAbility(num3); resultDTO.setServiceAbilityWeight(nf.format(Double.parseDouble(resultDTO.getServiceAbilityWeight()))); + Double db = num1.doubleValue() + num2.doubleValue() + num3.doubleValue(); + BigDecimal num = new BigDecimal(db.toString()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros(); + resultDTO.setTotalScore(num); return resultDTO; } + /** + * @param formDTO + * @Description 先进排行-先进支部排行 + * @author sun + */ + @Override + public List advancedBranchRank(AdvancedBranchRankFormDTO formDTO) { + //根据当前所选组织,查询screen_index_data_monthly中类型为网格的按照总指数倒序,关联screen_org_rank_data表取其他数据 + //1.级联查询组织下所有网格的先进支部排行数据,按总指数降序 + formDTO.setMonthId(DateUtils.getBeforeNMonth(1)); + List list = screenIndexDataMonthlyDao.selectRankList(formDTO); + //2.遍历数据,小数保留一位小数,百分数添加百分号 + NumberFormat nf = NumberFormat.getPercentInstance(); + nf.setMaximumFractionDigits(1); + list.forEach(l->{ + BigDecimal num = new BigDecimal(l.getTotalScore()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros(); + l.setScroe(num); + BigDecimal num1 = new BigDecimal(l.getSatisfactionRatio()).setScale(1, BigDecimal.ROUND_HALF_UP); + l.setSatisfactionRatio(num1 + "%"); + BigDecimal num2 = new BigDecimal(l.getClosedProjectRatio()).setScale(1, BigDecimal.ROUND_HALF_UP); + l.setClosedProjectRatio(num2 + "%"); + }); + + return list; + } + } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml index f35e7a490c..3b655a6481 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml @@ -193,4 +193,27 @@ AND month_id = #{monthId} + + diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java index 4adf142a12..5c730099e4 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java @@ -41,6 +41,11 @@ public class IndexDataMonthlyFormDTO implements Serializable { */ private String parentId; + /** + * 所有上级ID,用英文逗号分开 + */ + private String allParentIds; + /** * 组织名称 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index c5d269e36f..7ebedfc864 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -11,21 +11,23 @@ import com.epmet.dao.evaluationindex.indexcal.GridScoreDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityGridMonthlyDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyDao; +import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; +import com.epmet.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao; import com.epmet.dao.stats.DimCustomerDao; import com.epmet.dao.stats.DimDateDao; import com.epmet.dao.stats.DimMonthDao; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractScreenFormDTO; -import com.epmet.dto.extract.form.ScreenExtractFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; -import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityGridMonthlyEntity; import com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity; +import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; +import com.epmet.entity.evaluationindex.screen.ScreenIndexDataMonthlyEntity; import com.epmet.entity.stats.DimAgencyEntity; import com.epmet.entity.stats.DimCustomerEntity; import com.epmet.entity.stats.DimDateEntity; @@ -37,8 +39,6 @@ import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollCommunityS import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollStreetService; import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService; -import com.epmet.service.evaluationindex.extract.todata.GroupExtractService; -import com.epmet.service.evaluationindex.extract.todata.ProjectExtractService; import com.epmet.service.evaluationindex.extract.toscreen.*; import com.epmet.service.evaluationindex.indexcal.*; import com.epmet.service.stats.DimAgencyService; @@ -718,5 +718,42 @@ public class DemoController { } + @Autowired + private ScreenIndexDataMonthlyDao screenIndexDataMonthlyDao; + @Autowired + private ScreenCustomerAgencyDao screenCustomerAgencyDao; + + /** + * @return com.epmet.commons.tools.utils.Result + * @param + * @author yinzuomei + * @description screen_index_data_monthly 赋值ALL_PARENT_IDS + * @Date 2020/10/10 17:59 + **/ + @DataSource(DataSourceConstant.EVALUATION_INDEX) + @PostMapping("updateDeptIndexMonthly") + public Result updateDeptIndexMonthly(){ + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("ORG_TYPE", "department"); + List list=screenIndexDataMonthlyDao.selectList(wrapper); + int updateNum=0; + for(ScreenIndexDataMonthlyEntity entity:list){ + if(StringUtils.isNotBlank(entity.getParentId())){ + ScreenCustomerAgencyEntity agencyEntity=screenCustomerAgencyDao.selectByAgencyId(entity.getParentId()); + if(null!=agencyEntity){ + //根组织下的部门 + if("0".equals(agencyEntity.getPid())){ + log.info("根组织下的部门"); + entity.setAllParentIds(agencyEntity.getAgencyId()); + }else{ + entity.setAllParentIds(agencyEntity.getPids().concat(",").concat(agencyEntity.getAgencyId())); + } + updateNum+=screenIndexDataMonthlyDao.updateParentIdsById(entity.getId(),entity.getAllParentIds()); + } + } + } + log.info("影响行数="+updateNum); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index 4ed5d1303c..bdadee2f52 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -113,7 +113,8 @@ public interface FactOriginProjectMainDailyDao extends BaseDao subScore = deptSubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), levelIndexPath); if (CollectionUtils.isEmpty(subScore)) { - log.error("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); + log.warn("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); return; } Map> selfSubParentMap = new HashMap<>(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java index e76b18513a..f0c4d272d3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java @@ -123,7 +123,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { //获取该能力下的分数 List subScore = gridSubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), levelIndexPath); if (CollectionUtils.isEmpty(subScore)) { - log.error("calculateSelfSubScore gridSubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); + log.warn("calculateSelfSubScore gridSubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); return; } Map> selfSubParentMap = new HashMap<>(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java index e1efb04152..88e6b14578 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java @@ -132,7 +132,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni //获取该能力下的分数 List subScore = communitySubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), levelIndexPath); if (CollectionUtils.isEmpty(subScore)) { - log.error("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); + log.warn("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); return; } Map> selfSubParentMap = new HashMap<>(); @@ -204,7 +204,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni if (IndexCodeEnum.XIA_SHU_SUO_YOU_WGDDJNLPJZ.getCode().equals(detail.getIndexCode())) { List subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { - log.error(IndexCalConstant.GRID_PARTY_AVG_NULL); + log.warn(IndexCalConstant.GRID_PARTY_AVG_NULL); } else { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE); @@ -298,7 +298,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni // 治理能力的六个五级指标 List> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL); if (CollectionUtils.isEmpty(communityGovernAbility)){ - log.error(IndexCalConstant.COMMUNITY_GOVERN_ABILITY_NULL); + log.warn(IndexCalConstant.COMMUNITY_GOVERN_ABILITY_NULL); }else{ String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { @@ -370,7 +370,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni } else { List> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL); if (CollectionUtils.isEmpty(communityActivityCountList)) { - log.error(IndexCalConstant.COMMUNITY_SERVICE_ABILITY_NULL); + log.warn(IndexCalConstant.COMMUNITY_SERVICE_ABILITY_NULL); }else{ String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java index 8977849482..9334fa2351 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java @@ -130,7 +130,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict //获取该能力下的分数 List subScore = agencySubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.DISTRICT, levelIndexPath); if (CollectionUtils.isEmpty(subScore)) { - log.error("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); + log.warn("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); return; } Map> selfSubParentMap = new HashMap<>(); @@ -202,7 +202,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict if (IndexCodeEnum.QU_XIA_JI_JIE_DDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { - log.error(IndexCalConstant.DISTRICT_PARTY_AVG_NULL); + log.warn(IndexCalConstant.DISTRICT_PARTY_AVG_NULL); } else if (subGridPartyAvgScore.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE); @@ -283,7 +283,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } } if (CollectionUtils.isEmpty(districtGovernAvgList)) { - log.error("查询所有街道治理能力平均值集合为空"); + log.warn("查询所有街道治理能力平均值集合为空"); } else{ MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(districtGovernAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> governAvg = ListUtils.partition(districtGovernAvgList, IndexCalConstant.PAGE_SIZE); @@ -363,7 +363,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } } if (CollectionUtils.isEmpty(subStreetAvgList)) { - log.error("查询区下属街道服务能力汇总平均值集合为空"); + log.warn("查询区下属街道服务能力汇总平均值集合为空"); } else{ MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subStreetAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> serviceAvgList = ListUtils.partition(subStreetAvgList, IndexCalConstant.PAGE_SIZE); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java index a36ba5f471..4809870eef 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java @@ -133,7 +133,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ //获取该能力下的分数 List subScore = agencySubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.STREET, levelIndexPath); if (CollectionUtils.isEmpty(subScore)) { - log.error("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); + log.warn("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId()); return; } Map> selfSubParentMap = new HashMap<>(); @@ -205,7 +205,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { List subCommPartyAvgScore = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); if (CollectionUtils.isEmpty(subCommPartyAvgScore)) { - log.error(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL); + log.warn(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL); } else if (subCommPartyAvgScore.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); Integer indexEnd = NumConstant.TEN; @@ -299,7 +299,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ // 治理能力的六个五级指标 List> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(communityGovernAbility)){ - log.error(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); + log.warn(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); }else{ String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { @@ -371,7 +371,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ } else { List> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.STREET_LEVEL); if (CollectionUtils.isEmpty(communityActivityCountList)) { - log.error(IndexCalConstant.STREET_SERVICE_ABILITY_NULL); + log.warn(IndexCalConstant.STREET_SERVICE_ABILITY_NULL); }else{ String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); if (StringUtils.isEmpty(fieldNameByIndexCode)) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java index 0732ac80c5..83a66a67d2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.service.evaluationindex.indexcoll.impl; 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.utils.ConvertUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.OrgTypeConstant; @@ -23,16 +24,20 @@ import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity; import com.epmet.eum.IndexCodeEnum; import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; /** @@ -43,6 +48,7 @@ import java.util.stream.Collectors; @Service @DataSource(DataSourceConstant.EVALUATION_INDEX) public class FactIndexCollectServiceImpl implements FactIndexCollectService { + Cache allParentIds = CacheBuilder.newBuilder().expireAfterWrite(2, TimeUnit.HOURS).build(); @Autowired private FactIndexPartyAblityCpcMonthlyDao factIndexPartyAblityCpcMonthlyDao; @@ -219,6 +225,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { // 根据年,汇总今年各项得到,计算平均值后 插入年表 screen_index_data_yearly this.insertIndexDataYear(monthId, customerId); + allParentIds.invalidateAll(); } /** @@ -283,6 +290,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { // 补充表中其他字段 monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.GRID, gridScoreDTOS.get(i).getGridId(), gridScoreDTOS.get(i).getParentAgencyId(), gridScoreDTOS.get(i).getGridName(), monthlyDTO); + monthlyDTO.setAllParentIds(gridScoreDTOS.get(i).getAllParentIds()); monthlyFormDTOList.add(monthlyDTO); } screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); @@ -298,21 +306,26 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { * @Author zhangyong * @Date 14:17 2020-09-03 **/ - private void insertIndexDataMonthlyByGridScore(String monthId, String customerId, List gridScoreDTOS){ + private void insertIndexDataMonthlyByGridScore(String monthId, String customerId, List gridScoreDTOS) { List monthlyFormDTOList = new ArrayList<>(); // 根据网格id进行分组,最后组装一条数据 一个网格 对应 4条数据 Map> collect = gridScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexGridScoreDTO::getGridId)); // 查询网格的 上级组织id 和 组织名称 List parentGridList = screenCustomerGridDao.selectListGridInfo(customerId); - for(Map.Entry> gridScore : collect.entrySet()){ + if (!CollectionUtils.isEmpty(parentGridList)) { + parentGridList.forEach(o -> { + allParentIds.put(o.getGridId(), o.getGridId()); + }); + } + for (Map.Entry> gridScore : collect.entrySet()) { IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO(); // 给4个指数 赋默认值 monthlyFormDTO = this.setIndexDefaultValueFor(monthlyFormDTO); - for ( int i = 0; i < gridScore.getValue().size(); i++){ - if (NumConstant.ONE_STR.equals(gridScore.getValue().get(i).getIsTotal())){ + for (int i = 0; i < gridScore.getValue().size(); i++) { + if (NumConstant.ONE_STR.equals(gridScore.getValue().get(i).getIsTotal())) { // 是总分 - if (IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode().equals(gridScore.getValue().get(i).getIndexCode())){ + if (IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode().equals(gridScore.getValue().get(i).getIndexCode())) { // 总指数 = 网格相关 monthlyFormDTO.setIndexTotal(gridScore.getValue().get(i).getScore()); } @@ -339,6 +352,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { // 补充表中其他字段 monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.GRID, gridScore.getKey(), parentAgencyId, gridName, monthlyFormDTO); + monthlyFormDTO.setAllParentIds(allParentIds.getIfPresent(monthlyFormDTO.getOrgId())); monthlyFormDTOList.add(monthlyFormDTO); } if (monthlyFormDTOList.size() > NumConstant.ZERO){ @@ -409,6 +423,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { // 补充表中其他字段 monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.AGENCY, communityScoreDTOS.get(i).getAgencyId(), communityScoreDTOS.get(i).getPid(), communityScoreDTOS.get(i).getAgencyName(), monthlyDTO); + monthlyDTO.setAllParentIds(communityScoreDTOS.get(i).getPids()); monthlyFormDTOList.add(monthlyDTO); } screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); @@ -424,20 +439,25 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { * @Author zhangyong * @Date 14:17 2020-09-03 **/ - private void insertIndexDataMonthlyByCommunityScore(String monthId, String customerId, List communityScoreDTOS){ + private void insertIndexDataMonthlyByCommunityScore(String monthId, String customerId, List communityScoreDTOS) { List monthlyFormDTOList = new ArrayList<>(); // 根据组织id 进行分组,最后组装一条数据 一个组织id 对应 4条数据 Map> collect = communityScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId)); // 根据客户id,查询区/街道 组织名称、id List parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId); - for(Map.Entry> communityScore : collect.entrySet()){ + if (!CollectionUtils.isEmpty(parentAgencyList)) { + parentAgencyList.forEach(o -> { + allParentIds.put(o.getAgencyId(), o.getPids()); + }); + } + for (Map.Entry> communityScore : collect.entrySet()) { IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO(); // 给4个指数 赋默认值 monthlyFormDTO = this.setIndexDefaultValueFor(monthlyFormDTO); - for ( int i = 0; i < communityScore.getValue().size(); i++){ - if (NumConstant.ONE_STR.equals(communityScore.getValue().get(i).getIsTotal())){ + for (int i = 0; i < communityScore.getValue().size(); i++) { + if (NumConstant.ONE_STR.equals(communityScore.getValue().get(i).getIsTotal())) { // 是总分 - if (IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode().equals(communityScore.getValue().get(i).getIndexCode())){ + if (IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode().equals(communityScore.getValue().get(i).getIndexCode())) { // 总指数 = 社区相关 monthlyFormDTO.setIndexTotal(communityScore.getValue().get(i).getScore()); } @@ -465,6 +485,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { // 补充表中其他字段 monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.AGENCY, communityScore.getKey(), parentAgencyId, agencyName, monthlyFormDTO); + monthlyFormDTO.setAllParentIds(allParentIds.getIfPresent(monthlyFormDTO.getOrgId())); // 补充表中其他字段 monthlyFormDTOList.add(monthlyFormDTO); } @@ -497,7 +518,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, null); } - if (!CollectionUtils.isEmpty(mismatchDeptList)){ + if (!CollectionUtils.isEmpty(mismatchDeptList)) { + mismatchDeptList.forEach(o -> { + String pids = allParentIds.getIfPresent(o.getParentAgencyId()); + if (!StringUtils.isEmpty(pids)) { + allParentIds.put(o.getDeptId(), pids.concat(StrConstant.COLON).concat(o.getParentAgencyId())); + } + }); // 如果进行不匹配查询,查到了其他部门信息,一律赋默认值 this.insertIndexMonthlyByDeptDefaultScore(monthId, customerId, mismatchDeptList); } @@ -534,6 +561,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { // 补充表中其他字段 monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.DEPARTMENT, deptScoreDTOS.get(i).getDeptId(), deptScoreDTOS.get(i).getParentAgencyId(), deptScoreDTOS.get(i).getDeptName(), monthlyDTO); + monthlyDTO.setAllParentIds(allParentIds.getIfPresent(monthlyDTO.getOrgId())); monthlyFormDTOList.add(monthlyDTO); } screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); @@ -579,12 +607,18 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { deptName = deptEntity.getDeptName(); } } - if ("".equals(parentAgencyId)){ - throw new RuntimeException("在screen_customer_dept表中未查询到该客户下的父级信息:customerId =" + customerId + ", deptId = " + deptScore.getKey()); + if ("".equals(parentAgencyId)) { + log.error("在screen_customer_dept表中未查询到该客户下的父级信息:customerId =" + customerId + ", deptId = " + deptScore.getKey()); + continue; } // 补充表中其他字段 monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.DEPARTMENT, deptScore.getKey(), parentAgencyId, deptName, monthlyFormDTO); + //部门表没有 allParentIds 所以直接获取 然后拼接 + String ppIds = allParentIds.getIfPresent(monthlyFormDTO.getParentId()); + if (!StringUtils.isEmpty(ppIds)) { + monthlyFormDTO.setAllParentIds(ppIds.concat(StrConstant.COLON).concat(monthlyFormDTO.getParentId())); + } monthlyFormDTOList.add(monthlyFormDTO); } if (monthlyFormDTOList.size() > NumConstant.ZERO){ @@ -634,13 +668,18 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { * @Author zhangyong * @Date 14:17 2020-09-03 **/ - private void insertIndexDataMonthlyByAgencyScore(String monthId, String customerId, List agencyScoreDTOS){ + private void insertIndexDataMonthlyByAgencyScore(String monthId, String customerId, List agencyScoreDTOS) { List monthlyFormDTOList = new ArrayList<>(); // 根据组织id(eg:社区或者街道id) 进行分组,最后组装一条数据 一个组织id 对应 4条数据 Map> collect = agencyScoreDTOS.stream().collect(Collectors.groupingBy(AgencyScoreDTO::getAgencyId)); List parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId); int j = 0; - for(Map.Entry> agencyScore : collect.entrySet()){ + if (!CollectionUtils.isEmpty(parentAgencyList)) { + parentAgencyList.forEach(o -> { + allParentIds.put(o.getAgencyId(), o.getPids()); + }); + } + for (Map.Entry> agencyScore : collect.entrySet()) { if (NumConstant.ZERO_STR.equals(agencyScore.getKey())) { log.warn("insertIndexDataMonthlyByAgencyScore agencyyId is 0"); continue; @@ -669,12 +708,16 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { agencyName = agencyScoreDTO.getAgencyName(); } } - if ("".equals(agencyName)){ + if ("".equals(agencyName)) { throw new RuntimeException("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + agencyScore.getKey()); } // 补充表中其他字段 monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.AGENCY, agencyScore.getKey(), parentAgencyId, agencyName, monthlyFormDTO); + if ("S2-C1".equals(monthlyFormDTO.getOrgId())) { + System.out.println("======" + allParentIds.getIfPresent(monthlyFormDTO.getOrgId())); + } + monthlyFormDTO.setAllParentIds(allParentIds.getIfPresent(monthlyFormDTO.getOrgId())); monthlyFormDTOList.add(monthlyFormDTO); } if (monthlyFormDTOList.size() > NumConstant.ZERO){ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index f8c2d6db81..afbaa54d93 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -160,7 +160,10 @@ and t1.AGENCY_ID=#{communityId} - and t1.CLOSED_STATUS=#{closedStatus} + and t1.IS_RESOLVED=#{closedStatus} + + + and t1.PROJECT_STATUS=#{projectStatus} @@ -175,7 +178,10 @@ AND T1.CUSTOMER_ID = #{customerId} and t1.PIDS LIKE CONCAT(#{agencyPath},'%') - and t1.CLOSED_STATUS=#{closedStatus} + and t1.IS_RESOLVED=#{closedStatus} + + + and t1.PROJECT_STATUS=#{projectStatus} SELECT AGENCY_ID agencyId, - AGENCY_NAME agencyName + AGENCY_NAME agencyName, + PIDS pids FROM screen_customer_agency WHERE diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml index ae09cefb52..9df4f5941f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml @@ -126,7 +126,8 @@ SELECT GRID_ID gridId, GRID_NAME gridName, - PARENT_AGENCY_ID parentAgencyId + PARENT_AGENCY_ID parentAgencyId, + ALL_PARENT_IDS allParentIds FROM screen_customer_grid WHERE diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml index f192c1373c..91ecd0a870 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml @@ -19,6 +19,7 @@ ORG_TYPE, ORG_ID, PARENT_ID, + ALL_PARENT_IDS, ORG_NAME, INDEX_TOTAL, PARTY_DEV_ABLITY, @@ -43,6 +44,7 @@ #{item.orgType}, #{item.orgId}, #{item.parentId}, + #{item.allParentIds}, #{item.orgName}, #{item.indexTotal}, @@ -99,4 +101,10 @@ where CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId} AND ORG_TYPE = #{orgType} limit 1000; + + + update screen_index_data_monthly m3 + SET m3.ALL_PARENT_IDS =#{allParentIds} + where m3.id=#{id} +