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 2ba667217c..97453a2f06 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 @@ -997,11 +997,6 @@ public class DemoController { @Autowired private ScreenGrassrootsGovernDataAbsorptionService ndddYhjfService; - @PostMapping("diffOld") - public Result diff(@RequestBody ScreenCentralZoneDataFormDTO param){ - ndddYhjfService.difficultyDataHub(param); - return new Result(); - } @PostMapping("testDiffNew") public Result testDiff(@RequestBody ScreenCentralZoneDataFormDTO param){ return new Result().ok(ndddYhjfService.difficultyDataExtract(param)); 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 dad541fcfb..8826ac6f9a 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 @@ -26,10 +26,7 @@ import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; import com.epmet.dto.pingyin.result.*; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; -import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; -import com.epmet.entity.evaluationindex.extract.GovernProjectInfoDTO; +import com.epmet.entity.evaluationindex.extract.*; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -405,11 +402,11 @@ public interface FactOriginProjectMainDailyDao extends BaseDao + * @return java.util.List * @author LiuJanJun * @date 2021/4/12 1:35 下午 */ - List getProjectForDiff(@Param("customerId") String customerId, @Param("dateId") String dateId); + List getProjectForDiff(@Param("customerId") String customerId, @Param("offset") int offset, @Param("pageSize") int pageSize); /** * desc: 获取难点堵点项目数据耗时 @@ -420,7 +417,7 @@ public interface FactOriginProjectMainDailyDao extends BaseDao getProjectPeriodForDiff(@Param("customerId") String customerId, @Param("dateId") String dateId); + List getProjectPeriodForDiff(@Param("customerId") String customerId, @Param("projectId") String projectId); List selectResponseCount(@Param("customerId") String customerId); @@ -551,4 +548,5 @@ public interface FactOriginProjectMainDailyDao extends BaseDao getMemberProjectCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java index 3d90291cba..fb35330b9c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java @@ -19,7 +19,6 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.screencoll.form.DifficultyDataDetailFormDTO; -import com.epmet.dto.screencoll.form.DifficultyDataFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyImgDataEntity; import org.apache.ibatis.annotations.Mapper; @@ -56,7 +55,7 @@ public interface ScreenDifficultyDataDao extends BaseDao list, @Param("customerId")String customerId); - + /** * @Description 根据customerId查询是否有难点赌点的数据 * @param customerId @@ -92,12 +91,4 @@ public interface ScreenDifficultyDataDao extends BaseDao list); - /** - * @Description 根据客户Id查出全部的难点赌点的项目Id和网格Id,因为需要比对全部的信息然后删除因为删除网格而导致的垃圾数据 - * @param customerId - * @return java.util.List - * @author wangc - * @date 2020.11.17 09:33 - */ - List selectAllDifficultyByCustomerId(@Param("customerId")String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainAndPeriodDTO.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainAndPeriodDTO.java new file mode 100644 index 0000000000..191d6a93b7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainAndPeriodDTO.java @@ -0,0 +1,156 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.extract; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; + +import java.util.List; + +/** + * 项目主表_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-16 + */ +@Data +public class FactOriginProjectMainAndPeriodDTO extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 项目的发布日期yyyyMMdd + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 转议题用户ID + */ + private String issueCreatorId; + + /** + * 转为项目的议题ID + */ + private String issueId; + + /** + * 转为议题的话题ID + */ + private String topicId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 上级ID + */ + private String pid; + + /** + * 所有上级Id集合 (项目来源) + * */ + private String pids; + + /** + * 组织ID(网格所属组织ID) + */ + private String agencyId; + + /** + * 来源:议题issue + */ + private String origin; + + /** + * 来源ID + */ + private String originId; + + /** + * 状态 + */ + private String projectStatus; + + /** + * resolved unresolved + * */ + private String isResolved; + + /** + * 创建话题用户的ID + */ + private String topicCreatorId; + + /** + * 是否是党员 1:是 + */ + private String isParty; + + /** + * 是否超期 1:是 + */ + private String isOverdue; + + /** + * 是否满意 1:是 + */ + private Integer isSatisfied; + + /** + * 办结组织Ids(:隔开,有可能是社区id可能是网格id,无需区分级别,在统计时模糊查询) + */ + private String finishOrgIds; + + /** + * 项目创建人(议题转项目或立项人) + */ + private String projectCreator; + + /** + * 项目处理时间节点 + */ + private List periodList; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java index 515befcf9d..6e1268f727 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java @@ -27,10 +27,7 @@ import com.epmet.dto.pingyin.result.*; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; -import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; -import com.epmet.entity.evaluationindex.extract.GovernProjectInfoDTO; +import com.epmet.entity.evaluationindex.extract.*; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import java.util.List; @@ -377,11 +374,13 @@ public interface FactOriginProjectMainDailyService extends BaseService * @author LiuJanJun * @date 2021/4/12 11:07 上午 */ - List getProjectForDiff(ScreenCentralZoneDataFormDTO param); + List getProjectAndPeriodForDiff(ScreenCentralZoneDataFormDTO param, int offset, int pageSize); /** * desc: 根据项目数据 获取相关连的项目耗时 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java index 1f1fcfe88a..8ad4183718 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java @@ -36,10 +36,7 @@ import com.epmet.dto.result.CostDayResultDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; -import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; -import com.epmet.entity.evaluationindex.extract.GovernProjectInfoDTO; +import com.epmet.entity.evaluationindex.extract.*; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; @@ -527,8 +524,8 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl getProjectForDiff(ScreenCentralZoneDataFormDTO param) { - return baseDao.getProjectForDiff(param.getCustomerId(),param.getDateId()); + public List getProjectAndPeriodForDiff(ScreenCentralZoneDataFormDTO param, int offset, int pageSize) { + return baseDao.getProjectForDiff(param.getCustomerId(),offset,pageSize); } @Override diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java index 817d714096..570756ad25 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java @@ -18,15 +18,6 @@ public interface ScreenGrassrootsGovernDataAbsorptionService { **/ void userScoreDataHub(ScreenCentralZoneDataFormDTO param); - /** - * @Description 难点赌点数据中转站 - * @param param - * @return - * @author wangc - * @date 2020.09.25 10:00 - **/ - void difficultyDataHub(ScreenCentralZoneDataFormDTO param); - /** * desc: 新的难点堵点抽取 * diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java index ada550886f..d8d971fda1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java @@ -8,12 +8,10 @@ import com.epmet.constant.ProjectConstant; import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.ProjectDTO; import com.epmet.dto.org.GridInfoDTO; -import com.epmet.dto.project.result.ProjectLatestOperationResultDTO; -import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.dto.topic.TopicAttachmentDTO; import com.epmet.dto.topic.result.ResiTopicAndImgResultDTO; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; +import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainAndPeriodDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyImgDataEntity; @@ -155,101 +153,8 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr screenPartyUserRankDataService.dataClean(registeredUsers, param.getCustomerId()); } - /** - * @param param - * @return - * @Description 难点赌点数据中转站 - * @author wangc - * @date 2020.09.25 10:00 - **/ - @Override - public void difficultyDataHub(ScreenCentralZoneDataFormDTO param) { - //查询数据 - List difficulties = factOriginProjectMainDailyService.getDifficultyBaseInfo(param.getCustomerId(), projectService.getOvertimeProjectByParameter(param.getCustomerId())); - if (CollectionUtils.isEmpty(difficulties)) { - return; - } - - //2.查询出客户下网格的相关信息 - List gridList = customerGridService.queryGridInfoList(param.getCustomerId()); - Map gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, a -> a, (o, n) -> o)); - - //剔除垃圾数据(本次需要更新的数据集) - //for(Iterator iter = difficulties.iterator(); iter.hasNext();){ - // ScreenDifficultyDataEntity pointer = iter.next(); - // if(null == gridMap.get(pointer.getOrgId())){ - // iter.remove(); - // } - //} - difficulties.removeIf(diff -> null == gridMap.get(diff.getOrgId())); - - List projectIds = difficulties.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList()); - //最近一次操作 - Map latestOperationMap = projectProcessService.getLatestOperation(projectIds, param.getCustomerId()); - //图片 - List projectSourceMap = difficulties.stream().map(diff -> { - ProjectSourceMapFormDTO map = new ProjectSourceMapFormDTO(); - map.setProjectId(diff.getEventId()); - map.setSourceId(diff.getEventImgUrl()); - return map; - }).collect(Collectors.toList()); - //factOriginProjectMainDailyService.getNewProject(param.getCustomerId(),projectIds); - - Map> imgMap = topicService.getTopicImgs(projectSourceMap); - - Map contentMap = topicService.getTopicContent(projectSourceMap); - - difficulties.forEach(diff -> { - - List figureList = CollectionUtils.isEmpty(imgMap) ? null : imgMap.get(diff.getEventId()); - diff.setEventImgUrl(CollectionUtils.isEmpty(figureList) ? "" : figureList.get(NumConstant.ZERO).getEventImgUrl()); - - - if (!CollectionUtils.isEmpty(contentMap)) { - diff.setEventContent(contentMap.get(diff.getEventId())); - } - if (!CollectionUtils.isEmpty(latestOperationMap)) { - ProjectLatestOperationResultDTO oper = latestOperationMap.get(diff.getEventId()); - if (null != oper) { - diff.setLatestOperateDesc(oper.getOperationName()); - diff.setEventTitle(oper.getTitle()); - diff.setEventCostTime(oper.getCostTime()); - } - } - - diff.setDataEndTime(DateUtils.getBeforeNDay(NumConstant.ONE)); - }); - List imgList = new LinkedList<>(); - imgMap.values().forEach(imgList::addAll); - - //立案后会有 一个process 如果没有则说明是垃圾数据 如果有其他方式立项的项目则需要考虑下兼容 - difficulties.removeIf(diff -> StringUtils.isBlank(diff.getLatestOperateDesc())); - - screenDifficultyDataService.dataClean(param.getCustomerId(), difficulties, imgList); - log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(difficulties)); - difficulties.removeIf( diff -> StringUtils.isBlank(diff.getLatestOperateDesc())); - imgList.forEach(item -> { - item.setCustomerId(param.getCustomerId()); - }); - screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList); - log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}",param.getCustomerId(),JSON.toJSONString(difficulties)); - } - @Override public boolean difficultyDataExtract(ScreenCentralZoneDataFormDTO param) { - //1.根据客户Id 获取所有项目数据 - List difficultyBaseList = factOriginProjectMainDailyService.getProjectForDiff(param); - if (CollectionUtils.isEmpty(difficultyBaseList)) { - log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); - return false; - } - //获取业务库项目标题 - List bizProjectInfoList = projectService.getProjectInfo(param.getCustomerId(), null, null); - if (CollectionUtils.isEmpty(bizProjectInfoList)) { - log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); - return false; - } - Map bizProjectInfoMap = bizProjectInfoList.stream().collect(Collectors.toMap(ProjectDTO::getId, o -> o, (o1, o2) -> o1)); //获取agency维度 List agencyList = dimAgencyService.getAgencyListByCustomerId(param.getCustomerId()); Map agencyMap = agencyList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o, (o1, o2) -> o1)); @@ -266,74 +171,97 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr Map> projectCategoryMap = projectCategoryData.stream() .collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toSet()))); - //2.获取项目的所有节点耗时数据 - List projectPeriodList = factOriginProjectMainDailyService.getProjectPeriod(param); - //处理部门数去重(只要流转到就算) - Map> orgCountMap = new HashMap<>(); - //被处理次数 - Map handleCountMap = new HashMap<>(); - Set valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap); - - List diffList = new ArrayList<>(); - List imgDataEntities = new ArrayList<>(); - for (FactOriginProjectMainDailyEntity project : difficultyBaseList) { - if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) { - log.warn("未获取到相关的项目信息或者项目的所属组织信息,agencyId:{},projectId:{}",project.getAgencyId(),project.getId()); - continue; - } - //判断是否符合难点堵点条件 - if (!valideProjectIdSet.contains(project.getId())) { - continue; - } - ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap); - Set regCount = orgCountMap.get(project.getId()); - if (regCount != null) { - diffEntity.setEventReOrg(regCount.size()); - } else { - diffEntity.setEventReOrg(0); - } - Integer handleOrgCount = handleCountMap.get(project.getId()); - if (handleOrgCount != null) { - diffEntity.setEventHandledCount(handleOrgCount); - } else { - diffEntity.setEventHandledCount(0); + //获取业务库项目标题 + List bizProjectInfoList = projectService.getProjectInfo(param.getCustomerId(), null, null); + if (CollectionUtils.isEmpty(bizProjectInfoList)) { + log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); + return false; + } + Map bizProjectInfoMap = bizProjectInfoList.stream().collect(Collectors.toMap(ProjectDTO::getId, o -> o, (o1, o2) -> o1)); + + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.FIVE_HUNDRED; + List difficultyBaseList; + do { + //1.根据客户Id 获取所有项目数据 + int offset = (pageNo++ - NumConstant.ONE) * pageSize; + difficultyBaseList = factOriginProjectMainDailyService.getProjectAndPeriodForDiff(param, offset,pageSize); + if (CollectionUtils.isEmpty(difficultyBaseList)) { + log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); + return false; } - diffEntity.setDataEndTime(StringUtils.isBlank(param.getDateId())?DateUtils.getBeforeNDay(NumConstant.ONE):param.getDateId()); - setCategoryInfo(diffEntity, project.getId(), categoryList, projectCategoryMap); - - - if (StringUtils.isNotBlank(project.getTopicId())) { - //获取图片及话题内容 - ResiTopicAndImgResultDTO topicInfo = topicService.getTopicAndImgs(project.getTopicId(), "image"); - if (topicInfo != null) { - List topicImgList = topicInfo.getTopicImgList(); - if (!CollectionUtils.isEmpty(topicImgList)){ - diffEntity.setEventImgUrl(topicImgList.get(NumConstant.ZERO).getAttachmentUrl()); - topicImgList.forEach(img -> { - ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity(); - imgData.setEventId(project.getId()); - imgData.setEventImgUrl(img.getAttachmentUrl()); - imgData.setSort(img.getSort()); - imgDataEntities.add(imgData); - imgData.setCustomerId(param.getCustomerId()); - }); + //2.获取项目的所有节点耗时数据 + List projectPeriodList = difficultyBaseList.stream() + .filter(o->o.getPeriodList() != null) + .flatMap(o->o.getPeriodList().stream()) + .collect(Collectors.toList()); + //处理部门数去重(只要流转到就算) + Map> orgCountMap = new HashMap<>(); + //被处理次数 + Map handleCountMap = new HashMap<>(); + Set valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap); + + List diffList = new ArrayList<>(); + List imgDataEntities = new ArrayList<>(); + for (FactOriginProjectMainAndPeriodDTO project : difficultyBaseList) { + if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) { + log.warn("未获取到相关的项目信息或者项目的所属组织信息,agencyId:{},projectId:{}",project.getAgencyId(),project.getId()); + continue; + } + //判断是否符合难点堵点条件 + if (!valideProjectIdSet.contains(project.getId())) { + continue; + } + ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap); + Set regCount = orgCountMap.get(project.getId()); + if (regCount != null) { + diffEntity.setEventReOrg(regCount.size()); + } else { + diffEntity.setEventReOrg(0); + } + Integer handleOrgCount = handleCountMap.get(project.getId()); + if (handleOrgCount != null) { + diffEntity.setEventHandledCount(handleOrgCount); + } else { + diffEntity.setEventHandledCount(0); + } + + diffEntity.setDataEndTime(StringUtils.isBlank(param.getDateId())?DateUtils.getBeforeNDay(NumConstant.ONE):param.getDateId()); + setCategoryInfo(diffEntity, project.getId(), categoryList, projectCategoryMap); + + + if (StringUtils.isNotBlank(project.getTopicId())) { + //获取图片及话题内容 + ResiTopicAndImgResultDTO topicInfo = topicService.getTopicAndImgs(project.getTopicId(), "image"); + if (topicInfo != null) { + List topicImgList = topicInfo.getTopicImgList(); + if (!CollectionUtils.isEmpty(topicImgList)){ + diffEntity.setEventImgUrl(topicImgList.get(NumConstant.ZERO).getAttachmentUrl()); + topicImgList.forEach(img -> { + ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity(); + imgData.setEventId(project.getId()); + imgData.setEventImgUrl(img.getAttachmentUrl()); + imgData.setSort(img.getSort()); + imgDataEntities.add(imgData); + imgData.setCustomerId(param.getCustomerId()); + }); + } + diffEntity.setEventContent(topicInfo.getTopicContent()); + + log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count()); } - diffEntity.setEventContent(topicInfo.getTopicContent()); - log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count()); } - + diffList.add(diffEntity); } - diffList.add(diffEntity); - } - List collect = diffList.stream().filter(o -> o.getEventCostTime() < 5 * 24 * 60).collect(Collectors.toList()); - log.info("========:" + JSON.toJSONString(collect)); - log.info("========:" + JSON.toJSONString(diffList)); - log.info("========:" + JSON.toJSONString(imgDataEntities)); + log.info("========:" + JSON.toJSONString(diffList)); + log.info("========:" + JSON.toJSONString(imgDataEntities)); + + screenDifficultyDataService.dataClean(param.getCustomerId(),diffList,imgDataEntities); + } while (!CollectionUtils.isEmpty(difficultyBaseList)&&difficultyBaseList.size()==pageSize); - screenDifficultyDataService.dataClean(param.getCustomerId(),diffList,imgDataEntities); - log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(diffList)); + //log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(diffList)); //3.获取项目的最后操作记录 return true; } @@ -422,7 +350,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr * @param bizProjectInfoMap * @return */ - private ScreenDifficultyDataEntity buildBaseDiffEntity(FactOriginProjectMainDailyEntity project, Map agencyMap, + private ScreenDifficultyDataEntity buildBaseDiffEntity(FactOriginProjectMainAndPeriodDTO project, Map agencyMap, Map gridMap, Map bizProjectInfoMap) { ProjectDTO projectDTO = bizProjectInfoMap.get(project.getId()); ScreenDifficultyDataEntity diff = new ScreenDifficultyDataEntity(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenDifficultyDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenDifficultyDataService.java index 235dfe856a..99a01fd41c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenDifficultyDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenDifficultyDataService.java @@ -34,7 +34,7 @@ public interface ScreenDifficultyDataService extends BaseService difficulties, List imgs); - - /** - * @Description 根据客户Id查出全部的难点赌点的项目Id和网格Id,因为需要比对全部的信息然后删除因为删除网格而导致的垃圾数据 - * @param customerId - * @return java.util.List - * @author wangc - * @date 2020.11.17 09:31 - */ - List getAllDifficultyByCustomerId(String customerId); -} \ No newline at end of file +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java index f263b332fc..5fb3751181 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java @@ -21,7 +21,6 @@ package com.epmet.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.ScreenDifficultyDataDao; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; @@ -54,30 +53,15 @@ public class ScreenDifficultyDataServiceImpl extends BaseServiceImpl difficulties, List imgs) { - List orient = baseDao.selectAllDifficultyByCustomerId(customerId); - if(!CollectionUtils.isEmpty(orient)){ - baseDao.deleteBatchDifficultyImg(orient.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList())); - } - baseDao.deleteBatchDifficulty(customerId,null); - + List projectId = difficulties.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList()); + baseDao.deleteBatchDifficultyImg(projectId); + baseDao.deleteBatchDifficulty(customerId,projectId); if (!CollectionUtils.isEmpty(difficulties)) { baseDao.insertBatch(difficulties); } if (!CollectionUtils.isEmpty(imgs)) { baseDao.insertBatchImg(imgs); } - //baseDao.updateTime(customerId, DateUtils.getBeforeNDay(NumConstant.ONE)); } - /** - * @Description 根据客户Id查出全部的难点赌点的项目Id和网格Id,因为需要比对全部的信息然后删除因为删除网格而导致的垃圾数据 - * @param customerId - * @return java.util.List - * @author wangc - * @date 2020.11.17 09:31 - */ - @Override - public List getAllDifficultyByCustomerId(String customerId) { - return baseDao.selectAllDifficultyByCustomerId(customerId); - } -} \ No newline at end of file +} 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 d35a30cb00..1d34dfb47b 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 @@ -3,32 +3,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - SELECT - id, date_id, customer_id, issue_id, topic_id, grid_id, pid, pids, agency_id, project_status, is_resolved, - topic_creator_id, is_party, is_overdue, finish_org_ids - FROM fact_origin_project_main_daily + m.id, m.date_id dateId, m.customer_id, m.issue_id, m.topic_id, m.grid_id, + m.pid, m.pids, m.agency_id, m.project_status, m.is_resolved, + m.topic_creator_id, m.is_party, m.is_overdue, m.finish_org_ids + FROM fact_origin_project_main_daily m WHERE - CUSTOMER_ID = #{customerId} - - AND DATE_ID = #{dateId,jdbcType=VARCHAR} - + m.CUSTOMER_ID = #{customerId} + AND m.DEL_FLAG = '0' + LIMIT #{offset} ,#{pageSize} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml index 9860bee6f3..8cae5260d0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml @@ -221,14 +221,4 @@ -