From 7fe3feb239ea8206ad023b2ae68a50cb8b353516 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Sun, 13 Feb 2022 10:17:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E8=B5=8B=E8=83=BD=E5=B9=B3=E5=8F=B0=20?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E8=B0=83=E5=8A=A8=E6=A8=A1=E5=9D=97=2018?= =?UTF-8?q?=E7=B1=BB=E5=88=ABsql=E5=86=99=E6=AD=BB=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dao/IcResiUserDao.java | 4 +- .../service/impl/IcResiUserServiceImpl.java | 13 +++-- .../impl/IcUserChangeRecordServiceImpl.java | 16 ++++--- .../impl/IcUserTransferRecordServiceImpl.java | 19 +++++--- .../main/resources/mapper/IcResiUserDao.xml | 47 ++++--------------- 5 files changed, 42 insertions(+), 57 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index dbbe42d2c9..bc3e9f147a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -230,7 +230,7 @@ public interface IcResiUserDao extends BaseDao { List listIcResiInfosByUserIds(@Param("userIds") List userIds); - Map getCategoryListMap(@Param("icUserId") String icUserId); + Map getCategoryListMap(@Param("columns")List columns, @Param("icUserId") String icUserId); Map selectResiInfoMap(@Param("idCard") String idCard); @@ -238,5 +238,5 @@ public interface IcResiUserDao extends BaseDao { List icUserCustomerIds(); - List> getIcUserList(@Param("customerId") String customerId); + List> getIcUserList(@Param("customerId") String customerId, @Param("columns")List columns); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index 9a71e31e82..a8b7737b21 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -382,12 +382,15 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> resultList = operCustomizeOpenFeignClient.categoryWarnConfigList(tokenDto.getCustomerId()); - if (!resultList.success()) { - throw new RuntimeException("居民信息修改,获取客户居民类别预警配置表数据失败"); + IcResiCategoryStatsConfigDTO sfdto = new IcResiCategoryStatsConfigDTO(); + sfdto.setCustomerId(tokenDto.getCustomerId()); + Result> categoryListResult = operCustomizeOpenFeignClient.getCategoryList(sfdto); + if (!categoryListResult.success()){ + throw new RenException("居民信息修改,获取客户居民类别预警配置表数据失败"); } //修改前数据库居民十八类信息值 - Map hash = icResiUserDao.getCategoryListMap(entity.getId()); + List columns = categoryListResult.getData().stream().map(IcResiCategoryStatsConfigDTO::getColumnName).collect(Collectors.toList()); + Map hash = icResiUserDao.getCategoryListMap(columns, entity.getId()); //封装变更记录和变更明细数据 //变更记录 IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); @@ -396,7 +399,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl list = new ArrayList<>(); IcUserChangeDetailedEntity categoryEntity = null; - for (IcResiCategoryWarnConfigDTO dto : resultList.getData()) { + for (IcResiCategoryStatsConfigDTO dto : categoryListResult.getData()) { String oldValue = hash.get(dto.getColumnName()); if (map.containsKey(dto.getColumnName()) && !oldValue.equals(map.get(dto.getColumnName()))) { //类别修改后的值 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java index 58c4f2da00..d9662fdc8b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java @@ -21,12 +21,13 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcResiUserDao; import com.epmet.dao.IcUserChangeRecordDao; -import com.epmet.dto.IcResiCategoryWarnConfigDTO; +import com.epmet.dto.IcResiCategoryStatsConfigDTO; import com.epmet.dto.IcUserChangeRecordDTO; import com.epmet.dto.form.IcResiUserChangeRecordFormDTO; import com.epmet.dto.form.IcUserChangeRecordInitFormDTO; @@ -171,10 +172,13 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl"+customerId); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //1.获取客户居民类别预警配置表数据 - Result> resultList = operCustomizeOpenFeignClient.categoryWarnConfigList(customerId); - if (!resultList.success()) { - throw new RuntimeException("居民信息修改,获取客户居民类别预警配置表数据失败"); + IcResiCategoryStatsConfigDTO sfdto = new IcResiCategoryStatsConfigDTO(); + sfdto.setCustomerId(customerId); + Result> categoryListResult = operCustomizeOpenFeignClient.getCategoryList(sfdto); + if (!categoryListResult.success()){ + throw new RenException("居民信息修改,获取客户居民类别预警配置表数据失败"); } + List columns = categoryListResult.getData().stream().map(IcResiCategoryStatsConfigDTO::getColumnName).collect(Collectors.toList()); List changeList = new ArrayList<>(); IcUserChangeRecordEntity change = null; List detailedList = new ArrayList<>(); @@ -187,7 +191,7 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl subList = new ArrayList<>(); String changeId = UUID.randomUUID().toString().replaceAll("-", ""); - for (IcResiCategoryWarnConfigDTO dto : resultList.getData()){ + for (IcResiCategoryStatsConfigDTO dto : categoryListResult.getData()){ if(map.containsKey(dto.getColumnName())&&"1".equals(map.get(dto.getColumnName()))){ detailed = new IcUserChangeDetailedEntity(); detailed.setCustomerId(customerId); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java index 7f8fa309cb..0cceb4b513 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java @@ -27,6 +27,7 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcResiUserDao; import com.epmet.dao.IcUserTransferRecordDao; +import com.epmet.dto.IcResiCategoryStatsConfigDTO; import com.epmet.dto.IcResiCategoryWarnConfigDTO; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.IcResiUserOrgMsgFormDTO; @@ -51,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 居民调动记录表 @@ -173,12 +175,15 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl> resultList = operCustomizeOpenFeignClient.categoryWarnConfigList(formDTO.getCustomerId()); - if (!resultList.success()) { - throw new RuntimeException("人员调动,获取客户居民类别预警配置表数据失败"); + IcResiCategoryStatsConfigDTO dto = new IcResiCategoryStatsConfigDTO(); + dto.setCustomerId(formDTO.getCustomerId()); + Result> categoryListResult = operCustomizeOpenFeignClient.getCategoryList(dto); + if (!categoryListResult.success()){ + throw new RenException("人员调动,获取客户居民类别预警配置表数据失败"); } - Map map = icResiUserDao.getCategoryListMap(formDTO.getIcUserId()); - List changeDetailedEntityList = saveChangeDetailed(resultList.getData(), map, changeRecordEntity.getId(), formDTO, resiUserDTO); + List columns = categoryListResult.getData().stream().map(IcResiCategoryStatsConfigDTO::getColumnName).collect(Collectors.toList()); + Map map = icResiUserDao.getCategoryListMap(columns, formDTO.getIcUserId()); + List changeDetailedEntityList = saveChangeDetailed(categoryListResult.getData(), map, changeRecordEntity.getId(), formDTO, resiUserDTO); icUserChangeDetailedService.insertBatch(changeDetailedEntityList); } @@ -231,7 +236,7 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl saveChangeDetailed(List configList, Map map, String icUserChangeRecordId, IcResiUserTransferFormDTO formDTO, IcResiUserDTO resiUserDTO) { + private List saveChangeDetailed(List configList, Map map, String icUserChangeRecordId, IcResiUserTransferFormDTO formDTO, IcResiUserDTO resiUserDTO) { List list = new ArrayList<>(); IcUserChangeDetailedEntity outEntity = null; IcUserChangeDetailedEntity inEntity = null; @@ -246,7 +251,7 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl SELECT - IFNULL(is_kc,'0') IS_KC, - IFNULL(is_cj,'0') IS_CJ, - IFNULL(is_ylfn,'0') IS_YLFN, - IFNULL(is_sn,'0') IS_SN, - IFNULL(is_special,'0') IS_SPECIAL, - IFNULL(is_volunteer,'0') IS_VOLUNTEER, - IFNULL(is_unemployed,'0') IS_UNEMPLOYED, - IFNULL(is_mb,'0') IS_MB, - IFNULL(is_sz,'0') IS_SZ, - IFNULL(is_sd,'0') IS_SD, - IFNULL(is_veterans,'0') IS_VETERANS, - IFNULL(is_ensure_house,'0') IS_ENSURE_HOUSE, - IFNULL(is_party,'0') IS_PARTY, - IFNULL(is_old_people,'0') IS_OLD_PEOPLE, - IFNULL(is_xfry,'0')IS_XFRY, - IFNULL(is_united_front,'0') IS_UNITED_FRONT, - IFNULL(is_db,'0') IS_DB, - IFNULL(is_dbh,'0') IS_DBH + + IFNULL(`${c}`,'0') AS `${c}` + FROM ic_resi_user WHERE @@ -590,25 +575,13 @@ iru.home_id HOME_ID, iru.name NAME, iru.created_by CREATED_BY, - date_format(iru.created_time, '%Y-%m-%d %h:%i:%s') CREATED_TIME, - IFNULL(iru.is_kc,'0') IS_KC, - IFNULL(iru.is_cj,'0') IS_CJ, - IFNULL(iru.is_ylfn,'0') IS_YLFN, - IFNULL(iru.is_sn,'0') IS_SN, - IFNULL(iru.is_special,'0') IS_SPECIAL, - IFNULL(iru.is_volunteer,'0') IS_VOLUNTEER, - IFNULL(iru.is_unemployed,'0') IS_UNEMPLOYED, - IFNULL(iru.is_mb,'0') IS_MB, - IFNULL(iru.is_sz,'0') IS_SZ, - IFNULL(iru.is_sd,'0') IS_SD, - IFNULL(iru.is_veterans,'0') IS_VETERANS, - IFNULL(iru.is_ensure_house,'0') IS_ENSURE_HOUSE, - IFNULL(iru.is_party,'0') IS_PARTY, - IFNULL(iru.is_old_people,'0') IS_OLD_PEOPLE, - IFNULL(iru.is_xfry,'0')IS_XFRY, - IFNULL(iru.is_united_front,'0') IS_UNITED_FRONT, - IFNULL(iru.is_db,'0') IS_DB, - IFNULL(iru.is_dbh,'0') IS_DBH + date_format(iru.created_time, '%Y-%m-%d %h:%i:%s') CREATED_TIME + + , + + IFNULL(`${c}`,'0') AS `${c}` + + FROM ic_resi_user iru From c946e162378a380cfc06297f7eb61cc15b26a4a2 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Sun, 13 Feb 2022 13:52:10 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=8C=E6=8C=89dateId=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/datastats/DatsStatsDao.xml | 4 ++-- .../main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml index eab284f5cb..be3c501bf3 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml @@ -1155,8 +1155,8 @@ FROM fact_grid_member_statistics_daily WHERE del_flag = '0' - AND DATE_FORMAT(created_time,'%Y%m%d') = ]]> #{startTime} - AND DATE_FORMAT(created_time,'%Y%m%d') #{endTime} + AND date_id = ]]> #{startTime} + AND date_id #{endTime} AND project_incr > 0 AND pids LIKE CONCAT('%', #{agencyId}, '%') GROUP BY grid_id, date_id diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml index 8eae39d26e..f604fb7eda 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml @@ -150,8 +150,8 @@ stats_staff_patrol_record_daily WHERE del_flag = '0' - AND DATE_FORMAT(created_time,'%Y%m%d') = ]]> #{startTime} - AND DATE_FORMAT(created_time,'%Y%m%d') #{endTime} + AND date_id = ]]> #{startTime} + AND date_id #{endTime} AND routine_work_count > 0 AND grid_pids LIKE CONCAT('%', #{agencyId}, '%') GROUP BY grid_id, date_id From b3432601c340355bc4e4e51d38eb01cfc2965c75 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Sun, 13 Feb 2022 14:10:26 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/govorg/impl/GovOrgServiceImpl.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index c7244b019a..4fc3cb4f81 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -617,16 +617,8 @@ public class GovOrgServiceImpl implements GovOrgService { //3.查询直属下级组织下网格在查询时间段内存在上报事件(直接立项)数的网格,一天一条 List projectList = dataStatsService.getGridDateProjectIncrList(formDTO); //4.汇总数据,一个网格一天只记录一条数据,这条数据可能是例行工作的也可能是上报事件的,也可能某一天两个数都有,但只记录一条 - Map map = new HashMap<>(); - workList.forEach(w -> { - map.put(w.getGridId() + w.getDateId(), w.getDateId()); - }); - //projectList.stream().filter(pro -> !map.containsKey(pro.getGridId() + pro.getDateId())).forEach(p -> workList.add(p)); - projectList.forEach(pro -> { - if (!map.containsKey(pro.getGridId() + pro.getDateId())) { - workList.add(pro); - } - }); + Set map = workList.stream().map(o -> o.getGridId() + o.getDateId()).collect(Collectors.toSet()); + projectList.stream().filter(pro -> !map.contains(pro.getGridId() + pro.getDateId())).forEach(p -> workList.add(p)); //5.按组织封装数据 //计算百分比使用,保留小数点后两位 NumberFormat numberFormat = NumberFormat.getInstance(); From c082ebafe4ca6409a9c7f0405fc4b715ed663d6a Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Sun, 13 Feb 2022 15:45:32 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E8=80=97=E6=97=B6=E4=BF=A1=E6=81=AFSQL?= =?UTF-8?q?=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/FactOriginProjectOrgPeriodDailyDao.java | 2 +- .../extract/todata/impl/ProjectExtractServiceImpl.java | 7 +++++-- .../extract/FactOriginProjectOrgPeriodDailyDao.xml | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java index 5f3bf2ae42..af74dc163e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java @@ -64,7 +64,7 @@ public interface FactOriginProjectOrgPeriodDailyDao extends BaseDao list,@Param("customerId") String customerId); + void deleteByProjectIds(@Param("list") List list, @Param("customerId") String customerId, @Param("dateId") String dateId); /** * @Description 批量插入 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 551ba144a4..7cdb6fb3a8 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 @@ -494,14 +494,17 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { }); if (!CollectionUtils.isEmpty(formattingData)) { List projectList = new ArrayList<>(); - projectList.add(param.getObjectId()); - factOriginProjectOrgPeriodDailyDao.deleteByProjectIds(projectList, param.getCustomerId()); + if (StringUtils.isNotEmpty(param.getObjectId())) { + projectList.add(param.getObjectId()); + } + factOriginProjectOrgPeriodDailyDao.deleteByProjectIds(projectList, param.getCustomerId(), param.getDateId()); Lists.partition(formattingData, NumConstant.ONE_HUNDRED) .forEach(part -> factOriginProjectOrgPeriodDailyDao.insertBatch(part)); } } + /** * @Description 项目节点耗时数据补齐 * @param diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml index 063ec1acc8..9515803a6b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml @@ -40,6 +40,7 @@ WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} + AND (DATE_FORMAT(INFORMED_DATE,"%Y%m%d") >= #{dateId} OR DATE_FORMAT(HANDLED_DATE,"%Y%m%d") >= #{dateId} OR DATE_FORMAT(PERIOD_TILL_REPLY_FIRSTLY,"%Y%m%d") >= #{dateId}) PROJECT_ID = #{item} From 888419fe1eca204f1653db35e8a32e6e4da0bc4c Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 14 Feb 2022 10:39:51 +0800 Subject: [PATCH 5/6] dynamicQuery --- .../service/impl/IcResiUserServiceImpl.java | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index a8b7737b21..5709333e9b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -18,7 +18,6 @@ package com.epmet.service.impl; import cn.hutool.core.bean.BeanUtil; -import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -710,11 +709,27 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO); - List subTables=new ArrayList<>(); + /*List subTablesBak=new ArrayList<>(); if(subTablesRes.success()&&CollectionUtils.isNotEmpty(subTablesRes.getData())){ - subTables =subTablesRes.getData().stream().map(SubTableJoinDTO::getJoinTableSql).collect(Collectors.toList()); - } - return baseDao.dynamicQuery(customerId,resultTableName,conditions,subTables,currentStaffAgencyId,staffOrgPath); + subTablesBak =subTablesRes.getData().stream().map(SubTableJoinDTO::getJoinTableSql).collect(Collectors.toList()); + }*/ + List subTables =subTablesRes.getData(); + // log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true)); + //关联哪些子表:查询条件用到的表名+查询的列对应的表 并集去重 + Set whereConditionTables=conditions.stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet()); + Set tables=new HashSet<>(); + tables.addAll(whereConditionTables); + tables.add(resultTableName); + // log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true)); + //最终关联的子表对应的sql: + List finalSubTables =new ArrayList<>(); + subTables.forEach(subTable->{ + if(tables.contains(subTable.getTableName())){ + finalSubTables.add(subTable.getJoinTableSql()); + } + }); + + return baseDao.dynamicQuery(customerId,resultTableName,conditions,finalSubTables,currentStaffAgencyId,staffOrgPath); } /** From 26936e18b152482a675a25385f8e7d11f5cf900f Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 14 Feb 2022 15:49:15 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=91=98=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8A=E6=8A=A5=E6=8E=A5=E5=8F=A3=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AEpids=E6=98=AF=E4=BB=8E=E4=B8=89?= =?UTF-8?q?=E4=B8=AA=E8=A1=97=E9=81=93=E5=BC=80=E5=A7=8B=E7=9A=84=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=9C=A8=E5=89=8D=E8=BE=B9=E6=8B=BC=E4=B8=8A?= =?UTF-8?q?=E5=B9=B3=E9=98=B4=E5=8E=BF=E7=9A=84=E7=BB=84=E7=BB=87id?= =?UTF-8?q?=E6=89=8D=E5=8F=AF=E4=BB=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/commons/tools/constant/StrConstant.java | 2 ++ .../java/com/epmet/service/impl/StatsUserServiceImpl.java | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index a18f34f72b..67f467f63c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java @@ -95,6 +95,8 @@ public interface StrConstant { String SPECIAL_CUSTOMER = "150282ed25c14ff0785e7e06283b6283"; //平音客户 String PY_CUSTOMER = "6f203e30de1a65aab7e69c058826cd80"; + //平音客户跟组织Id + String PY_ROOT_AGENCY = "53613e1c5de6ed473467f0159a10b135"; /** * 单位积分,积分上限,积分说明,积分事件 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java index a3ccd6c5a1..0f3f9de0ce 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java @@ -3,6 +3,7 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; @@ -252,7 +253,8 @@ public class StatsUserServiceImpl implements StatsUserService { m.setSourceType("external"); m.setParentCustomerId(crm.getParentCustomerId()); m.setPid(pid.toString()); - m.setPids(pids.toString()); + //20220214 上报数据的pids是从街道开始,需要在前边拼接上平阴县的id才能保证后续的查询用like时可以筛选出数据 sun + m.setPids(StrConstant.PY_ROOT_AGENCY + ":" + pids.toString()); } else { log.warn(String.format("网格员数据分析上报,数据错误,根据agencyId未查询到组织信息,客户Id->%s,组织Id->%s", m.getCustomerId(), m.getAgencyId())); iterator.remove();