diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index bcef31dc14..75c8c1cac9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -38,6 +38,7 @@ public interface NumConstant { int FIFTY_ONE = 51; int SIXTY = 60; int ONE_HUNDRED = 100; + BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100); int ONE_THOUSAND = 1000; int MAX = 99999999; int EIGHTY_EIGHT = 88; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/FinishOrgDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/FinishOrgDTO.java index ab5c9ef2ce..9f1b3b3d36 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/FinishOrgDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/FinishOrgDTO.java @@ -13,6 +13,9 @@ import java.io.Serializable; public class FinishOrgDTO implements Serializable { private static final long serialVersionUID = -5684606755705833962L; + + private String departmentId; + private String gridId; private String projectId; private String orgIdPath; private String pIdPath; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java index c4ba146e48..6c7fad11c7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java @@ -380,7 +380,7 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { NumberFormat numberFormat = NumberFormat.getInstance(); numberFormat.setMaximumFractionDigits(NumConstant.SIX); String topicToIssueRatioStr = numberFormat.format((float) projectTotal / issueTotal); - BigDecimal topicToIssueRatio = new BigDecimal(topicToIssueRatioStr); + BigDecimal topicToIssueRatio = new BigDecimal(topicToIssueRatioStr).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); map.put(partyMember.getUserId(), topicToIssueRatio); } return map; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java index 858b3d6ddd..1d189bacef 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java @@ -282,7 +282,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { notReturnProjectList.forEach(not -> { gridIssueShiftProjectRatio.forEach(total -> { if (not.getGridId().equals(total.getGridId())){ - not.setTransferRightRatio(getRound(new BigDecimal(not.getNotReturnProject()/total.getProjectTotal()))); + not.setTransferRightRatio(getRound(new BigDecimal(not.getNotReturnProject()/total.getProjectTotal()).multiply(NumConstant.ONE_HUNDRED_DECIMAL))); } }); }); @@ -319,7 +319,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { scoreMap.forEach((k,v) -> { allScore.set(++v); }); - resultSatisfactionScore.put(gridId,getRound(new BigDecimal(allScore.get()/scoreMap.size()))); + resultSatisfactionScore.put(gridId,getRound(new BigDecimal(allScore.get()/scoreMap.size()).multiply(NumConstant.ONE_HUNDRED_DECIMAL))); }); } String quarterId = DateUtils.getQuarterId(monthId); @@ -432,7 +432,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { int regUserTotal=regUserIds.size(); String volunteerRatioStr = numberFormat.format((float) volunteerTotal / regUserTotal); BigDecimal volunteerRatio = new BigDecimal(volunteerRatioStr); - entity.setVolunteerRatio(volunteerRatio); + entity.setVolunteerRatio(volunteerRatio.multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); } } //网格党员志愿者率 : 所有志愿者中,同时是党员的占比 @@ -449,7 +449,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { int partyUserCount=paryUserIds.size(); String partyVolunteerRatioStr = numberFormat.format((float) partyUserCount / volunteerCount); BigDecimal partyVolunteerRatio = new BigDecimal(partyVolunteerRatioStr); - entity.setPartyVolunteerRatio(partyVolunteerRatio); + entity.setPartyVolunteerRatio(partyVolunteerRatio.multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); } } @@ -491,7 +491,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { gridProjectTotalList.forEach(project -> { gridIssueTotalList.forEach(issue -> { if (project.getGridId().equals(issue.getGridId())) { - project.setIssueToProjectRatio(getRound(new BigDecimal(project.getProjectTotal() / issue.getIssueTotal()))); + project.setIssueToProjectRatio(getRound(new BigDecimal(project.getProjectTotal() / issue.getIssueTotal()).multiply(NumConstant.ONE_HUNDRED_DECIMAL))); } }); }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java index a54d995f8f..ec8269c8a6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java @@ -121,9 +121,13 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { if(StringUtils.isNotBlank(param.getDateId())){ try { issueExtractService.issueExtractMain(param); + } catch (Exception e) { + log.error("抽取【议题数据主表】发生异常,参数:" + JSON.toJSONString(param), e); + } + try { issueExtractService.issueExtractLog(param); } catch (Exception e) { - log.error("抽取【议题数据】发生异常,参数:" + JSON.toJSONString(param), e); + log.error("抽取【议题数据附表】发生异常,参数:" + JSON.toJSONString(param), e); } }else if(StringUtils.isNotBlank(param.getStartDate()) && StringUtils.isNotBlank(param.getEndDate())){ try { @@ -132,10 +136,19 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { String dateDimId = daysBetween.get(i); param.setDateId(dateDimId); issueExtractService.issueExtractMain(param); + } + } catch (Exception e) { + log.error("抽取【议题数据主表】发生异常,参数:" + JSON.toJSONString(param), e); + } + try { + List daysBetween = DateUtils.getDaysBetween(param.getStartDate(), param.getEndDate()); + for (int i = 0; i < daysBetween.size(); i++) { + String dateDimId = daysBetween.get(i); + param.setDateId(dateDimId); issueExtractService.issueExtractLog(param); } } catch (Exception e) { - log.error("抽取【议题数据】发生异常,参数:" + JSON.toJSONString(param), e); + log.error("抽取【议题数据附表】发生异常,参数:" + JSON.toJSONString(param), e); } } }); @@ -143,6 +156,10 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { if(StringUtils.isNotBlank(param.getDateId())){ try { projectExtractService.saveOriginProjectDaily(param); + } catch (Exception e) { + log.error("抽取【项目数据】发生异常,参数:" + JSON.toJSONString(param), e); + } + try { projectExtractService.extractProjectPeriodData(param); } catch (Exception e) { log.error("抽取【项目数据】发生异常,参数:" + JSON.toJSONString(param), e); @@ -154,6 +171,15 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { String dateDimId = daysBetween.get(i); param.setDateId(dateDimId); projectExtractService.saveOriginProjectDaily(param); + } + } catch (Exception e) { + log.error("抽取【项目数据】发生异常,参数:" + JSON.toJSONString(param), e); + } + try { + List daysBetween = DateUtils.getDaysBetween(param.getStartDate(), param.getEndDate()); + for (int i = 0; i < daysBetween.size(); i++) { + String dateDimId = daysBetween.get(i); + param.setDateId(dateDimId); projectExtractService.extractProjectPeriodData(param); } } catch (Exception e) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java index 2d02bc6a7f..61bfed1eda 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java @@ -164,20 +164,18 @@ public class IssueExtractServiceImpl implements IssueExtractService { List result = new ArrayList<>(); // 1. 查询议题process List listResult = issueService.selectIssueProcessInfo(customerId, dateId); - if (CollectionUtils.isEmpty(listResult)) { - log.warn("issueExtractMain issueExtractLog return empty,customerId:{},dateId:{}", customerId, dateId); - return true; + if (!CollectionUtils.isEmpty(listResult)) { + Map> groupByIssue = listResult.stream().collect(Collectors.groupingBy(IssueProcessInfoResultDTO::getIssueId)); + groupByIssue.forEach((issueId, process) -> { + List descByCreateTime = process.stream().sorted(Comparator.comparing(IssueProcessInfoResultDTO::getCreateTime).reversed()).collect(Collectors.toList()); + issueMainDailyDao.updateIssueStatus(issueId,descByCreateTime.get(NumConstant.ZERO).getActionCode()); + }); + listResult.forEach(issueProcess -> { + IssueLogDailyFormDTO issueLogDailyFormDTO = ConvertUtils.sourceToTarget(issueProcess, IssueLogDailyFormDTO.class); + issueLogDailyFormDTO.setOperationUserId(issueProcess.getUserId()); + result.add(issueLogDailyFormDTO); + }); } - Map> groupByIssue = listResult.stream().collect(Collectors.groupingBy(IssueProcessInfoResultDTO::getIssueId)); - groupByIssue.forEach((issueId, process) -> { - List descByCreateTime = process.stream().sorted(Comparator.comparing(IssueProcessInfoResultDTO::getCreateTime).reversed()).collect(Collectors.toList()); - issueMainDailyDao.updateIssueStatus(issueId,descByCreateTime.get(NumConstant.ZERO).getActionCode()); - }); - listResult.forEach(issueProcess -> { - IssueLogDailyFormDTO issueLogDailyFormDTO = ConvertUtils.sourceToTarget(issueProcess, IssueLogDailyFormDTO.class); - issueLogDailyFormDTO.setOperationUserId(issueProcess.getUserId()); - result.add(issueLogDailyFormDTO); - }); // 2. 查询议题满意度 List satisfactionInfoList = issueService.selectIssueSatisfactionInfo(customerId, dateId); @@ -215,7 +213,7 @@ public class IssueExtractServiceImpl implements IssueExtractService { } // 5. 上级ID - List agencyIds = listResult.stream().map(process -> process.getAgencyId()).distinct().collect(Collectors.toList()); + List agencyIds = result.stream().map(process -> process.getAgencyId()).distinct().collect(Collectors.toList()); List agencyInfoList = dimAgencyDao.selectAgencyInfo(agencyIds); if (CollectionUtils.isEmpty(agencyInfoList)){ throw new RenException(ExtractConstant.PARENT_AGENCY_ID_LIST); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java index bf892c6a84..2b4abe37a1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java @@ -88,7 +88,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { pendingList.stream().flatMap(pending -> closedList.stream().filter(closed -> pending.getId().equals(closed.getProjectId())).map(process -> { FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity(); entity.setId(process.getProjectId()); - entity.setProjectStatus("close"); + entity.setProjectStatus("closed"); entity.setCreatedTime(DateUtils.stringToDate(pending.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD)); entity.setUpdatedTime(process.getUpdatedTime()); entity.setIsResolved(process.getIsResolved()); @@ -98,11 +98,18 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { if (!CollectionUtils.isEmpty(finishOrgList)) { closeProjects.forEach(close -> finishOrgList.stream().filter(finish -> close.getId().equals(finish.getProjectId())).forEach(dto -> { String[] orgIds = dto.getPIdPath().split(StrConstant.COLON); + String org = ""; if (orgIds.length > NumConstant.ONE) { - close.setFinishOrgIds(orgIds[orgIds.length - 1]); + org = orgIds[orgIds.length - 1]; } else { - close.setFinishOrgIds(orgIds[0]); + org = orgIds[0]; } + if (StringUtils.isNotEmpty(dto.getGridId())) { + org = org + StrConstant.COLON + dto.getGridId(); + } else if (StringUtils.isNotEmpty(dto.getDepartmentId())) { + org = org + StrConstant.COLON + dto.getDepartmentId(); + } + close.setFinishOrgIds(org); })); } //更新状态 @@ -180,7 +187,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { } } final List mainList = list; - //节点发起人 + //节点发起人 部门流转退回结案 List processList = projectProcessService.getProcessListByCustomer(customerId, dateString); if (!CollectionUtils.isEmpty(processList)) { List logList = processList.stream().map(process -> { @@ -230,6 +237,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { return entity; }).collect(Collectors.toList()); + //节点发起人 响应 List responseList = projectProcessService.getResponseProcessList(customerId, dateString); if (!CollectionUtils.isEmpty(responseList)) { logList.addAll(responseList.stream().map(process -> { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java index 2cb4feff51..f41366eb13 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java @@ -71,7 +71,8 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService }else{ //2、党员参与议事占比 int issueTotal=calPartyPartiIssueTotal(customerId,gridId,null,null,null); - entity.setIssueRatio(new BigDecimal(entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); + BigDecimal issueRatio=new BigDecimal(entity.getIssueTotal()/issueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + entity.setIssueRatio(issueRatio.setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } //3、党员发布话题: @@ -82,7 +83,12 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService } else { //当前网格内所有话题总数 int gridTopicTotal = getGridOrCommunityTopicTotal(customerId, gridId, null); - entity.setTopicRatio(gridTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / gridTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + if(gridTopicTotal == NumConstant.ZERO){ + entity.setTopicRatio(BigDecimal.ZERO); + }else{ + BigDecimal topicRatio=new BigDecimal(entity.getTopicTotal() / gridTopicTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + entity.setTopicRatio(topicRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + } } //当前网格内所有议题总数 @@ -93,13 +99,21 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //6、党员发布议题占比 : 占网格内所有议题的比率 if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); + }else{ + BigDecimal publishIssueRatio=new BigDecimal(entity.getPublishIssueTotal() / gridIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + entity.setPublishIssueRatio(publishIssueRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } - entity.setPublishIssueRatio(gridIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getPublishIssueTotal() / gridIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); //7、议题转项目数 entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, gridId, null)); //8、议题转项目占比 : 占网格内议题总数的比率 - entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / gridIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + if(entity.getShiftProjectTotal() == NumConstant.ZERO){ + entity.setShiftProjectRatio(BigDecimal.ZERO); + }else{ + BigDecimal shiftProjectRatio=new BigDecimal(entity.getShiftProjectTotal() / gridIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + entity.setShiftProjectRatio(shiftProjectRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + } + }else{ // log.info("当前网格内所有议题总数="+gridIssueTotal); entity.setPublishIssueTotal(NumConstant.ZERO); @@ -116,7 +130,12 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService } else { // 10、占总结项目 int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, gridId, null, null); - entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + if(closedProjectTotal == NumConstant.ZERO){ + entity.setResolvedProjectRatio(BigDecimal.ZERO); + }else { + BigDecimal resolvedProjectRatio=new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + entity.setResolvedProjectRatio(resolvedProjectRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + } } }); screenPioneerDataService.delAndSavePioneerData(customerId, OrgTypeConstant.GRID, IndexCalConstant.DELETE_SIZE, gridList); 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 3fbac8284e..053830f4b6 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 @@ -204,6 +204,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { if (NumConstant.SIX != monthId.length()){ throw new RuntimeException("入参monthId格式不正确:monthId =" + monthId); } + allParentIds.cleanUp(); // 根据网格类型,删除 指数-指数数据(每月数值)表中 匹配的数据 this.batchDelIndexDataMonthly(customerId, monthId, OrgTypeConstant.GRID); // 开始处理 网格相关分值表 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java index f0a47885ea..45ed305ff5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java @@ -86,7 +86,7 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl