From 203cfd864a5c213b5311646d105b412e77a43d76 Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 17 Nov 2020 10:36:47 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=8A=BD=E5=8F=96=E5=88=B0=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F-=E9=9A=BE=E7=82=B9=E8=B5=8C=E7=82=B9=E3=80=81?= =?UTF-8?q?=E7=83=AD=E5=BF=83=E5=B8=82=E6=B0=91=EF=BC=8C=E5=B0=8F=E7=BB=84?= =?UTF-8?q?=E5=8E=9F=E5=A7=8B=E6=95=B0=E6=8D=AE=EF=BC=8C=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E5=9B=A0=E4=B8=BA=E5=88=A0=E9=99=A4=E7=BD=91=E6=A0=BC=E8=80=8C?= =?UTF-8?q?=E9=80=A0=E6=88=90=E5=9E=83=E5=9C=BE=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/FactOriginGroupMainDailyDao.java | 9 ++++ .../screen/ScreenDifficultyDataDao.java | 9 ++++ .../todata/impl/GroupExtractServiceImpl.java | 21 ++++++--- ...srootsGovernDataAbsorptionServiceImpl.java | 47 ++++++++----------- .../screen/ScreenDifficultyDataService.java | 8 ++++ .../ScreenPartyUserRankDataService.java | 1 - .../impl/ScreenDifficultyDataServiceImpl.java | 12 +++++ .../extract/FactOriginGroupMainDailyDao.xml | 12 +++++ .../screen/ScreenDifficultyDataDao.xml | 10 ++++ 9 files changed, 95 insertions(+), 34 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java index 5bd0c89103..12e6151f3f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java @@ -61,6 +61,15 @@ public interface FactOriginGroupMainDailyDao extends BaseDao + * @author wangc + * @date 2020.11.17 09:56 + */ + List selectAllGroupByCustomerId(@Param("customerId") String customerId); + /** * @param customerId * @return 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 2b66e785bb..3d90291cba 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 @@ -91,4 +91,13 @@ public interface ScreenDifficultyDataDao extends BaseDao list); int insertBatchImg(@Param("list") List 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/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java index cd04bc123e..dedb5bc3a3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java @@ -66,7 +66,7 @@ public class GroupExtractServiceImpl implements GroupExtractService { /** * @param param * @return - * @Description 业务抽取 - 小组祥光 + * @Description 业务抽取 - 小组 * @author wangc * @date 2020.09.18 21:07 **/ @@ -88,22 +88,31 @@ public class GroupExtractServiceImpl implements GroupExtractService { List memberList = new LinkedList<>(); if (!CollectionUtils.isEmpty(originGroupData)) { List gridList = dimGridService.getGridAttributes(param.getCustomerId(),originGroupData.stream().map(FactOriginGroupMainDailyDTO::getGridId).distinct().collect(Collectors.toList())); - List missingGroups = new LinkedList<>(); + if (!CollectionUtils.isEmpty(gridList)) { Map gridMap = gridList.stream().collect(Collectors.toMap(GridAttributesResultDTO::getGridId, Function.identity(), (key1, key2) -> key2)); - + //剔除本次要更新数据中的垃圾数据 for(Iterator iter = originGroupData.iterator(); + iter.hasNext();){ + FactOriginGroupMainDailyDTO pointer = iter.next(); + if(null == gridMap.get(pointer.getGridId()))iter.remove(); + + } + //记录全量中的垃圾数 + List missingGroups = new LinkedList<>(); + List population = factOriginGroupMainDailyDao.selectAllGroupByCustomerId(param.getCustomerId()); + if(!CollectionUtils.isEmpty(population)){ + for(Iterator iter = population.iterator(); iter.hasNext();){ FactOriginGroupMainDailyDTO pointer = iter.next(); if(null == gridMap.get(pointer.getGridId())){ missingGroups.add(pointer.getId()); - iter.remove(); } } - - originGroupData.forEach(group -> { + } + originGroupData.forEach(group -> { GridAttributesResultDTO attr = gridMap.get(group.getGridId()); if (null != attr) { group.setAgencyId(attr.getAgencyId()); 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 8a60c6076b..f81c2e7259 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 @@ -126,22 +126,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr }); } - - //6.存入数据库 - //不按照时间删除,每次插入之前将该客户下的所有历史数据清空 - //过滤 统计维度中没有的数据 - Set gridIdSet = new HashSet<>(); - List newInsertList = registeredUsers.stream() - .filter(o -> { - if (StringUtils.isBlank(o.getGridName())) { - gridIdSet.add(o.getGridId()); - return false; - } else { - return true; - } - }).collect(Collectors.toList()); - log.warn("userScoreDataHub grids:{} not in DimGrid", JSON.toJSONString(gridIdSet)); - screenPartyUserRankDataService.dataClean(newInsertList, param.getCustomerId()); + screenPartyUserRankDataService.dataClean(registeredUsers, param.getCustomerId()); } /** @@ -160,43 +145,51 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr //查询数据 List difficulties = factOriginProjectMainDailyService.getDifficultyBaseInfo(param.getCustomerId(),projectService.getOvertimeProjectByParameter(param.getCustomerId(),existed)); 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)); - List missing = new LinkedList<>(); + + //剔除垃圾数据(本次需要更新的数据集) for(Iterator iter = difficulties.iterator(); iter.hasNext();){ ScreenDifficultyDataEntity pointer = iter.next(); if(null == gridMap.get(pointer.getOrgId())){ - missing.add(pointer.getEventId()); iter.remove(); } } + //记录垃圾数(全量) + List missing = new LinkedList<>(); + List population = screenDifficultyDataService.getAllDifficultyByCustomerId(param.getCustomerId()); + if(!CollectionUtils.isEmpty(population)){ + for(Iterator iter = population.iterator(); iter.hasNext();){ + ScreenDifficultyDataEntity pointer = iter.next(); + if(null == gridMap.get(pointer.getOrgId())){ + missing.add(pointer.getEventId()); + } + } + } List projectIds = difficulties.stream().map(ScreenDifficultyDataEntity :: getEventId).distinct().collect(Collectors.toList()); //最近一次操作 Map latestOperationMap = projectProcessService.getLatestOperation(projectIds,param.getCustomerId()); - - boolean isOperationNull = CollectionUtils.isEmpty(latestOperationMap) ? true : false; - //图片 List projectSourceMap = factOriginProjectMainDailyService.getNewProject(param.getCustomerId(),projectIds); Map> imgMap = topicService.getTopicImgs(projectSourceMap); - boolean isImgNull = CollectionUtils.isEmpty(imgMap) ? true : false; + Map contentMap = topicService.getTopicContent(projectSourceMap); - boolean isContentNull = CollectionUtils.isEmpty(contentMap) ? true : false; + difficulties.forEach( diff -> { - if(!isImgNull) { + if(!CollectionUtils.isEmpty(imgMap)) { List figureList = imgMap.get(diff.getEventId()); diff.setEventImgUrl(CollectionUtils.isEmpty(figureList) ? "" : figureList.get(NumConstant.ZERO).getEventImgUrl()); } - if(!isContentNull) { + if(!CollectionUtils.isEmpty(contentMap)) { diff.setEventContent(contentMap.get(diff.getEventId())); } - if(!isOperationNull){ + if(! CollectionUtils.isEmpty(latestOperationMap)){ ProjectLatestOperationResultDTO oper = latestOperationMap.get(diff.getEventId()); if(null != oper){ diff.setLatestOperateDesc(oper.getOperationName()); 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 c133c88c84..5fc1af8dcd 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 @@ -51,4 +51,12 @@ public interface ScreenDifficultyDataService extends BaseService difficulties, List imgs,List missing); + /** + * @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/ScreenPartyUserRankDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyUserRankDataService.java index 99ce30dc0c..ea844971a9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyUserRankDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyUserRankDataService.java @@ -40,5 +40,4 @@ public interface ScreenPartyUserRankDataService extends BaseService dataList,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 a371230024..89673d1e26 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 @@ -68,4 +68,16 @@ public class ScreenDifficultyDataServiceImpl extends BaseServiceImpl + * @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/FactOriginGroupMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml index c2c75be60f..2717a8cb5e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml @@ -38,6 +38,18 @@ CUSTOMER_ID = #{customerId} + + + DELETE FROM fact_origin_group_main_daily 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 c56a4e85ab..100a2c29dd 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 @@ -219,4 +219,14 @@ + From 97f4d4637293562732d578f7ce7334ca65521090 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 17 Nov 2020 14:31:08 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=B0=83=E7=94=A8feign=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=20=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E5=88=9B=E5=BB=BA=E8=AE=AE=E9=A2=98=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResiTopicServiceImpl.java | 68 +++++++++---------- .../epmet/modules/utils/ModuleConstant.java | 4 +- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index 1a5d8964a3..6e34af14da 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -18,7 +18,6 @@ package com.epmet.modules.topic.service.impl; - import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -75,9 +74,9 @@ import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO; import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.TopicInfoDTO; -import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.form.CheckTopicPublisherFormDTO; import com.epmet.resi.group.dto.topic.form.GovTopicIssueInfoFormDTO; +import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.result.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -1156,48 +1155,49 @@ public class ResiTopicServiceImpl extends BaseServiceImpl issueResult = govIssueFeignClient.issueShiftedToTopic(issueInfo); + if (issueResult == null || !issueResult.success() || StringUtils.isBlank(issueResult.getData())) { + throw new RenException(ModuleConstant.CREATE_ISSUE_ERROR); + } //5.修改话题shiftIssue字段 - if(issueResult.success() && StringUtils.isNotBlank(issueResult.getData())){ - ResiTopicEntity topic2Upd = new ResiTopicEntity(); - topic2Upd.setId(topicTurnIssueFromDTO.getTopicId()); - topic2Upd.setUpdatedBy(topicTurnIssueFromDTO.getUserId()); - topic2Upd.setShiftIssue(Boolean.TRUE); - topic2Upd.setIssueId(issueResult.getData()); - topic2Upd.setUpdatedTime(now); - int topicResult = baseDao.updateOne(topic2Upd); - //6.新增话题操作记录 - if(topicResult == NumConstant.ONE) { - ResiTopicOperationEntity operation = new ResiTopicOperationEntity(); - operation.setCreatedTime(now); - operation.setCreatedBy(topicTurnIssueFromDTO.getUserId()); - operation.setTopicId(topicTurnIssueFromDTO.getTopicId()); - operation.setOperationType(ModuleConstant.TOPIC_OPERATION_TYPE_SHIFT_ISSUE); - int operationResult = resiTopicOperationDao.insertOneByParams(operation); - if(operationResult != NumConstant.ONE){ - logger.warn(ModuleConstant.FAILURE_TO_ADD_TOPIC_OPERATION); - } - } - //7.更新组统计信息 议题数量+1 - resiGroupStatisticalDao.incryTotalIssues(group.getGroupId()); - if(null != groupCache && null != groupCache.getGroupStatisticalInfo()){ - groupCache.getGroupStatisticalInfo().setTotalIssues( - null == groupCache.getGroupStatisticalInfo().getTotalIssues() ? NumConstant.ONE - : groupCache.getGroupStatisticalInfo().getTotalIssues() + NumConstant.ONE - ); - resiGroupRedis.set(groupCache); - } - logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC); + ResiTopicEntity topic2Upd = new ResiTopicEntity(); + topic2Upd.setId(topicTurnIssueFromDTO.getTopicId()); + topic2Upd.setUpdatedBy(topicTurnIssueFromDTO.getUserId()); + topic2Upd.setShiftIssue(Boolean.TRUE); + topic2Upd.setIssueId(issueResult.getData()); + topic2Upd.setUpdatedTime(now); + int topicResult = baseDao.updateOne(topic2Upd); + //6.新增话题操作记录 + if (topicResult == NumConstant.ONE) { + ResiTopicOperationEntity operation = new ResiTopicOperationEntity(); + operation.setCreatedTime(now); + operation.setCreatedBy(topicTurnIssueFromDTO.getUserId()); + operation.setTopicId(topicTurnIssueFromDTO.getTopicId()); + operation.setOperationType(ModuleConstant.TOPIC_OPERATION_TYPE_SHIFT_ISSUE); + int operationResult = resiTopicOperationDao.insertOneByParams(operation); + if (operationResult != NumConstant.ONE) { + logger.warn(ModuleConstant.FAILURE_TO_ADD_TOPIC_OPERATION); + } + } + //7.更新组统计信息 议题数量+1 + resiGroupStatisticalDao.incryTotalIssues(group.getGroupId()); + if (null != groupCache && null != groupCache.getGroupStatisticalInfo()) { + groupCache.getGroupStatisticalInfo().setTotalIssues( + null == groupCache.getGroupStatisticalInfo().getTotalIssues() ? NumConstant.ONE + : groupCache.getGroupStatisticalInfo().getTotalIssues() + NumConstant.ONE + ); + resiGroupRedis.set(groupCache); } + logger.warn(ModuleConstant.FAILURE_TO_UPDATE_TOPIC); } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java index 094c58bda7..9fa1359bdf 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java @@ -327,5 +327,7 @@ public interface ModuleConstant extends Constant { String FIELD_OPERATION_TYPE = "OPERATION_TYPE"; - String CLOSED_TOPIC_REASON_PREFIX="话题已关闭:"; + String CLOSED_TOPIC_REASON_PREFIX = "话题已关闭:"; + + String CREATE_ISSUE_ERROR = "创建议题失败"; } From f709bedaf5d3d21d2c06772759c158c09325f6a0 Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 17 Nov 2020 16:14:33 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E9=9A=BE=E7=82=B9=E8=B5=8C=E7=82=B9=20?= =?UTF-8?q?=E5=85=A8=E5=88=A0=E5=85=A8=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FactOriginProjectMainDailyDao.java | 4 +- .../com/epmet/dao/project/ProjectDao.java | 11 +---- .../FactOriginProjectMainDailyService.java | 4 +- ...FactOriginProjectMainDailyServiceImpl.java | 8 ++-- ...srootsGovernDataAbsorptionServiceImpl.java | 40 +++++------------- .../screen/ScreenDifficultyDataService.java | 2 +- .../impl/ScreenDifficultyDataServiceImpl.java | 12 +++--- .../epmet/service/project/ProjectService.java | 3 +- .../project/impl/ProjectServiceImpl.java | 5 +-- .../extract/FactOriginProjectMainDailyDao.xml | 19 ++++++--- .../resources/mapper/project/ProjectDao.xml | 41 ------------------- 11 files changed, 43 insertions(+), 106 deletions(-) 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 062c651aaf..ebbbe5e84b 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 @@ -180,12 +180,12 @@ public interface FactOriginProjectMainDailyDao extends BaseDao * @author wangc * @date 2020.09.28 10:19 */ - List selectDifficultyBaseInfo(@Param("customerId")String customerId,@Param("list")List list); + List selectDifficultyBaseInfo(@Param("customerId")String customerId,@Param("thresholdValue") Integer thresholdValue); /** * @Description 查询评价周期内新立的项目,是为了增量新增难点赌点的图片库 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java index 2e15e2aea1..3d4526a0fe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java @@ -103,14 +103,5 @@ public interface ProjectDao extends BaseDao { */ String selectParameterValueByKey(@Param("customerId") String customerId); - /** - * @Description 得到超过阈值滞留的项目Id集合 - * 规定只要项目的任何一个负责人(被流转到的,自始至终不管有没有处理)超过了自定义或默认的滞留时间就算难点赌点 - * @param customerId - * @param exclude - * @return java.util.List - * @author wangc - * @date 2020.11.06 14:14 - */ - List selectOvertimeProjectIds(@Param("customerId") String customerId,@Param("exclude") List exclude,@Param("value") Integer value); + } \ No newline at end of file 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 8f1c0631f7..8b7e1ae06c 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 @@ -248,12 +248,12 @@ public interface FactOriginProjectMainDailyService extends BaseService * @author wangc * @date 2020.09.28 10:23 */ - List getDifficultyBaseInfo(String customerId , List list); + List getDifficultyBaseInfo(String customerId ,Integer thresholdValue); /** * @Description 得到评价周期内新立项的id 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 21caf5f319..bdc82b519d 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 @@ -237,15 +237,15 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl * @author wangc * @date 2020.09.28 10:23 */ @Override - public List getDifficultyBaseInfo(String customerId, List list) { - if(CollectionUtils.isEmpty(list)) return null; - return baseDao.selectDifficultyBaseInfo(customerId,list); + public List getDifficultyBaseInfo(String customerId, Integer thresholdValue) { + + return baseDao.selectDifficultyBaseInfo(customerId,thresholdValue); } /** 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 f81c2e7259..2f6f0b6a44 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 @@ -100,10 +100,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr Map scoreMap = cpcIndexCalculateService.getCpcScore(param.getCustomerId(),dateId); //剔除垃圾数据 - for(Iterator iter = registeredUsers.iterator(); - iter.hasNext();){ - if(null == gridMap.get(iter.next().getGridId())) iter.remove(); - } + registeredUsers.removeIf(user -> null == gridMap.get(user.getGridId())); //5.整合数据 if(!CollectionUtils.isEmpty(registeredUsers)){ @@ -124,7 +121,6 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr user.setDataEndTime(finalDateId); }); - } screenPartyUserRankDataService.dataClean(registeredUsers, param.getCustomerId()); } @@ -138,12 +134,8 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr **/ @Override public void difficultyDataHub(ScreenCentralZoneDataFormDTO param) { - - //查询难点赌点中有无已结案的项目,若有则保留 - List existed = screenDifficultyDataService.selectExistedInfo(param.getCustomerId()); - //查询数据 - List difficulties = factOriginProjectMainDailyService.getDifficultyBaseInfo(param.getCustomerId(),projectService.getOvertimeProjectByParameter(param.getCustomerId(),existed)); + List difficulties = factOriginProjectMainDailyService.getDifficultyBaseInfo(param.getCustomerId(),projectService.getOvertimeProjectByParameter(param.getCustomerId())); if(CollectionUtils.isEmpty(difficulties)) return; //2.查询出客户下网格的相关信息 @@ -151,24 +143,13 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr 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(); - } - } - //记录垃圾数(全量) - List missing = new LinkedList<>(); - List population = screenDifficultyDataService.getAllDifficultyByCustomerId(param.getCustomerId()); - if(!CollectionUtils.isEmpty(population)){ - for(Iterator iter = population.iterator(); iter.hasNext();){ - ScreenDifficultyDataEntity pointer = iter.next(); - if(null == gridMap.get(pointer.getOrgId())){ - missing.add(pointer.getEventId()); - } - } - } - + //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()); //最近一次操作 @@ -196,7 +177,6 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr diff.setEventTitle(oper.getTitle()); diff.setEventCostTime(oper.getCostTime()); } - } diff.setDataEndTime(DateUtils.getBeforeNDay(NumConstant.ONE)); @@ -204,6 +184,6 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr List imgList = new LinkedList<>(); imgMap.values().forEach(list -> {imgList.addAll(list);}); - screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList,missing); + screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList); } } 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 5fc1af8dcd..235dfe856a 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 @@ -49,7 +49,7 @@ public interface ScreenDifficultyDataService extends BaseService difficulties, List imgs,List missing); + void dataClean(String customerId,List difficulties, List imgs); /** * @Description 根据客户Id查出全部的难点赌点的项目Id和网格Id,因为需要比对全部的信息然后删除因为删除网格而导致的垃圾数据 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 89673d1e26..66873e1b6d 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 @@ -53,17 +53,17 @@ public class ScreenDifficultyDataServiceImpl extends BaseServiceImpl difficulties, List imgs,List missing) { - if(!CollectionUtils.isEmpty(missing)){ - baseDao.deleteBatchDifficulty(customerId, missing); - baseDao.deleteBatchDifficultyImg(missing); + public void dataClean(String customerId, List 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); + if (!CollectionUtils.isEmpty(difficulties)) { - baseDao.deleteBatchDifficulty(customerId, difficulties.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList())); baseDao.insertBatch(difficulties); } if (!CollectionUtils.isEmpty(imgs)) { - baseDao.deleteBatchDifficultyImg(imgs.stream().map(ScreenDifficultyImgDataEntity::getEventId).distinct().collect(Collectors.toList())); baseDao.insertBatchImg(imgs); } baseDao.updateTime(customerId, DateUtils.getBeforeNDay(NumConstant.ONE)); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java index e707c0a64c..2dc0e88aa6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java @@ -104,10 +104,9 @@ public interface ProjectService extends BaseService { * @Description 得到超过阈值滞留的项目Id集合 * 规定只要项目的任何一个负责人(被流转到的,自始至终不管有没有处理)超过了自定义或默认的滞留时间就算难点赌点 * @param customerId - * @param exclude * @return java.util.List * @author wangc * @date 2020.11.06 14:14 */ - List getOvertimeProjectByParameter(String customerId,List exclude); + Integer getOvertimeProjectByParameter(String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java index 23461db970..5ba8ea04d6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java @@ -86,16 +86,15 @@ public class ProjectServiceImpl extends BaseServiceImpl * @author wangc * @date 2020.11.06 14:14 */ @Override - public List getOvertimeProjectByParameter(String customerId, List exclude) { + public Integer getOvertimeProjectByParameter(String customerId) { String parameter = baseDao.selectParameterValueByKey(customerId); if(StringUtils.isBlank(parameter)) parameter = baseDao.selectParameterValueByKey("default"); - return baseDao.selectOvertimeProjectIds(customerId, exclude, StringUtils.isBlank(parameter) ? NumConstant.FIVE : Integer.parseInt(parameter)); + return StringUtils.isBlank(parameter) ? NumConstant.FIVE : Integer.parseInt(parameter); } } \ 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 f5c56529be..9a21641767 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 @@ -385,11 +385,20 @@ WHERE project.DEL_FLAG = '0' AND project.CUSTOMER_ID = #{customerId} - - - project.ID = #{projectId} - - + AND project.ID IN ( + + + SELECT DISTINCT + project_id + FROM + fact_origin_project_org_period_daily + WHERE + del_flag = '0' + AND customer_id = #{customerId} + AND TIMESTAMPDIFF( MINUTE, informed_date, IFNULL( handled_date, NOW( ) ) ) > #{thresholdValue} + + ) + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml index de792f46db..08c8d78d5b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml @@ -106,45 +106,4 @@ and PARAMETER_KEY ='detention_days' - - \ No newline at end of file From af4c0091eda6dc7124f415bda3b3f980438562e7 Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 17 Nov 2020 17:32:50 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E9=9A=BE=E7=82=B9=E8=B5=8C=E7=82=B9=20?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/FactOriginProjectMainDailyDao.xml | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) 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 9a21641767..1ea4b350fd 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 @@ -389,15 +389,28 @@ SELECT DISTINCT - project_id + period.project_id FROM - fact_origin_project_org_period_daily - WHERE - del_flag = '0' - AND customer_id = #{customerId} - AND TIMESTAMPDIFF( MINUTE, informed_date, IFNULL( handled_date, NOW( ) ) ) > #{thresholdValue} + fact_origin_project_org_period_daily period + LEFT JOIN + ( + + SELECT + + project.ID AS projectId, + IF(project.project_status = 'closed',period.handled_date,NOW()) AS finishDate - ) + FROM fact_origin_project_main_daily project LEFT JOIN fact_origin_project_org_period_daily period + ON project.ID = period.project_id AND period.del_flag = '0' AND period.customer_id = #{customerId} + AND period.operation = 'close' + WHERE project.customer_id = #{customerId} AND project.del_flag = '0' + ) projectFinishDate ON projectFinishDate.projectId = period.project_id + + WHERE + period.del_flag = '0' + AND period.customer_id = #{customerId} + AND TIMESTAMPDIFF( DAY, period.informed_date, projectFinishDate.finishDate) > #{thresholdValue} + ) From 6dab1ffef0f1a307aa5bbad22bd62b9e66b075af Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 17 Nov 2020 17:53:02 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9user=E6=9C=8D=E5=8A=A1/us?= =?UTF-8?q?erresiinfo/getuserresiinfo=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dao/UserWechatDao.java | 2 + .../service/impl/UserBaseInfoServiceImpl.java | 12 +++--- .../main/resources/mapper/UserResiInfoDao.xml | 38 ++++++++----------- .../main/resources/mapper/UserWechatDao.xml | 20 ++++++++++ 4 files changed, 44 insertions(+), 28 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java index ef513d0ac7..d0f6b2def7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java @@ -75,4 +75,6 @@ public interface UserWechatDao extends BaseDao{ **/ List selectResiAndStrangerInfo(@Param("userIds") List userIds, @Param("realName")String realName); + //临时用下in + List selectNotInUserBaseInfoTemp(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java index 7143b7d171..326e74912d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java @@ -166,7 +166,7 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl userWechatDTOList=userWechatDao.selectAll(); + List userWechatDTOList=userWechatDao.selectNotInUserBaseInfoTemp(); List userIdList=new ArrayList<>(); for(UserWechatDTO userWechatDTO:userWechatDTOList){ userIdList.add(userWechatDTO.getUserId()); @@ -202,12 +202,12 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl SELECT - uri.id, - uc.USER_ID, + ubi.USER_ID, uri.REG_MOBILE, - uri.SURNAME, - uri.`NAME`, - uri.STREET, - uri.DISTRICT, + ubi.SURNAME, + ubi.`NAME`, + ubi.STREET, + ubi.DISTRICT, uri.RESI_VISIT_ID, - uri.BUILDING_ADDRESS, - CONCAT( - uri.STREET, - '-', - uri.SURNAME, - ( CASE WHEN uw.SEX = '1' THEN '先生' WHEN uw.SEX = '2' THEN '女士' ELSE '先生/女士' END ) + ubi.BUILDING_ADDRESS, + CONCAT( + ubi.STREET, + '-', + ubi.SURNAME, + ( CASE WHEN ubi.GENDER = '1' THEN '先生' WHEN ubi.GENDER = '2' THEN '女士' ELSE '先生/女士' END ) ) AS show_name, uw.HEAD_IMG_URL AS head_photo - FROM - user_customer uc - LEFT JOIN user_resi_info uri ON ( uc.USER_ID = uri.USER_ID ) - LEFT JOIN user_wechat uw ON (uc.USER_ID = uw.USER_ID) + user_base_info ubi + LEFT JOIN user_resi_info uri ON ( ubi.USER_ID = uri.USER_ID AND uri.DEL_FLAG = '0' ) + LEFT JOIN user_wechat uw ON ( uri.USER_ID = uw.USER_ID AND uw.DEL_FLAG = '0' ) WHERE - uc.DEL_FLAG = '0' - AND uri.DEL_FLAG = '0' - AND uc.CUSTOMER_ID = #{customerId} - AND uc.USER_ID = #{userId} - AND uw.DEL_FLAG = '0' - AND uw.USER_ID = #{userId} + ubi.USER_ID =#{userId} + AND ubi.DEL_FLAG = '0' diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml index 98a5c58075..5797e95eef 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml @@ -115,4 +115,24 @@ ORDER BY base.REAL_NAME , wechat.NICKNAME + + +