diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java index fd4733c790..1e6de73f54 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java @@ -134,10 +134,11 @@ public class ResiCategoryStatsConfigController { } @PostMapping("resicategorystatslistshowd") - public Result> resiCategoryStatsListShowd(){ + public Result> resiCategoryStatsListShowd(@LoginUser TokenDto tokenDTO){ //获取预警配置列表 List statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper() .lambda() + .eq(IcResiCategoryStatsConfigEntity::getCustomerId,tokenDTO.getCustomerId()) .eq(IcResiCategoryStatsConfigEntity::getStatus,"show") .orderByAsc(IcResiCategoryStatsConfigEntity::getSort)); @@ -145,10 +146,11 @@ public class ResiCategoryStatsConfigController { } @PostMapping("resicategorywarnlist") - public Result> resiCategoryWarnList(){ + public Result> resiCategoryWarnList(@LoginUser TokenDto tokenDTO){ //获取预警配置列表 List warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper() .lambda() + .eq(IcResiCategoryWarnConfigEntity::getCustomerId,tokenDTO.getCustomerId()) .orderByAsc(IcResiCategoryWarnConfigEntity::getSort)); return new Result>().ok(ConvertUtils.sourceToTarget(warnConfigEntityList, IcResiCategoryWarnConfigDTO.class)); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java index bdfba55c6a..bfeeaa0b9d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java @@ -49,14 +49,14 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf @Transactional(rollbackFor = Exception.class) public List list(String customerId) { //1.获取IC_FORM_ITEM 中 用于数据分析字段的 id 和label - List icFormItemEntityList = icFormItemDao.selectList(new QueryWrapper().lambda().eq(IcFormItemEntity::getDataAnalyse, 1)); + List icFormItemEntityList = icFormItemDao.selectList(new QueryWrapper().lambda().eq(IcFormItemEntity::getCustomerId,customerId).eq(IcFormItemEntity::getDataAnalyse, 1)); if(CollectionUtils.isEmpty(icFormItemEntityList)){ return new ArrayList<>(); } Set groupIds = icFormItemEntityList.stream().filter(item-> !"0".equals(item.getItemGroupId())).map(item->item.getItemGroupId()).collect(Collectors.toSet()); List icFormItemGroupEntityList = new ArrayList<>(); if(!CollectionUtils.isEmpty(groupIds)){ - icFormItemGroupEntityList.addAll(icFormItemGroupDao.selectList(new QueryWrapper().lambda().in(IcFormItemGroupEntity::getId, groupIds))); + icFormItemGroupEntityList.addAll(icFormItemGroupDao.selectList(new QueryWrapper().lambda().eq(IcFormItemGroupEntity::getCustomerId,customerId).in(IcFormItemGroupEntity::getId, groupIds))); } //获取tableName和COLUMN_NAME Map tableColumnMap = new HashMap<>(); @@ -75,8 +75,8 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf }); //2.获取ic_resi_category_stats_config 和 ic_resi_category_warn_config 表中的数据 - List statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(null); - List warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(null); + List statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper().lambda().eq(IcResiCategoryStatsConfigEntity::getCustomerId,customerId)); + List warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper().lambda().eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)); //3.新增不存在的,删除不在tableColumnMap的 Map statsTableColumnMap = new HashMap<>(); @@ -129,8 +129,11 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf } //4.返回数据 - List statsConfigList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper().lambda().orderByAsc(IcResiCategoryStatsConfigEntity::getSort)); - List warnConfigList = icResiCategoryWarnConfigDao.selectList(null); + List statsConfigList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper().lambda() + .eq(IcResiCategoryStatsConfigEntity::getCustomerId,customerId) + .orderByAsc(IcResiCategoryStatsConfigEntity::getSort)); + List warnConfigList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper().lambda() + .eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)); Map warnMap =new HashMap<>(); warnConfigList.forEach(item->{ warnMap.put(item.getTableName()+"-"+item.getColumnName(),item); @@ -169,6 +172,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf return result; } IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper().lambda() + .eq(IcResiCategoryWarnConfigEntity::getCustomerId, icResiCategoryStatsConfigDTO.getCustomerId()) .eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName()) .eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName())); @@ -207,6 +211,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf if(IcResiCategoryStatsConfigConstant.WARN_YES.equals(formDTO.getWarn())){ //更新 IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper().lambda() + .eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId) .eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName()) .eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName())); if(null == icResiCategoryWarnConfigEntity){ @@ -234,6 +239,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf }else if(IcResiCategoryStatsConfigConstant.WARN_NO.equals(formDTO.getWarn())){ //删除 icResiCategoryWarnConfigDao.delete(new QueryWrapper().lambda() + .eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId) .eq(IcResiCategoryWarnConfigEntity::getTableName,icResiCategoryStatsConfigDTO.getTableName()) .eq(IcResiCategoryWarnConfigEntity::getColumnName,icResiCategoryStatsConfigDTO.getColumnName())); } @@ -267,8 +273,8 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf } icResiCategoryStatsConfigService.updateBatchById(entityList); //排序更新预警的 - List statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(null); - List warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(null); + List statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper().lambda().eq(IcResiCategoryStatsConfigEntity::getCustomerId,customerId)); + List warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper().lambda().eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)); if(CollectionUtils.isEmpty(warnConfigEntityList)){ return ; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index fced7a9aeb..ff956aa49f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -181,6 +181,7 @@ public class IcResiUserController { */ @RequestMapping(value = "/exportExcel2") public void exportExcel(@RequestHeader String customerId,@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception { + //tokenDto.setUserId("9e37adcce6472152e6508a19d3683e02"); CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId()); String staffOrgPath = null; if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { @@ -194,7 +195,7 @@ public class IcResiUserController { Map> otherSheetItems = buildItemMap(resiFormItems); - Map> resiMainList = icResiUserService.getDataForExport(otherSheetItems.get(BASE_TABLE_NAME),new HashMap<>(), pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), BASE_TABLE_NAME, pageFormDTO.getConditions(),staffInfoCacheResult.getAgencyId(),staffOrgPath); + Map> resiMainList = icResiUserService.getDataForExport(otherSheetItems.get(BASE_TABLE_NAME),new HashMap<>(),BASE_TABLE_NAME, pageFormDTO,staffInfoCacheResult.getAgencyId(),staffOrgPath); //resiMainList = (List>)JSON.parse("[{\"IS_BDHJ\":\"1\",\"IS_SPECIAL\":\"1\",\"IS_XFRY\":\"0\",\"REMARKS\":\"beizhu\",\"IS_PARTY\":\"1\",\"icResiUserId\":\"yzmtest2\",\"HOME_ID\":\"中海国际社区一里城1号楼1单元101\",\"HOUSE_TYPE\":\"平房\",\"UNIT_NAME\":\"1单元\",\"GRID_ID\":\"市北区-市北区第三网格3\",\"IS_DB\":\"0\",\"GENDER\":\"男\",\"BIRTHDAY\":\"2021-10-04\",\"IS_VETERANS\":\"0\",\"IS_MB\":\"0\",\"IS_UNEMPLOYED\":\"0\",\"DEMAND_NAME\":null,\"IS_KC\":\"0\",\"IS_ENSURE_HOUSE\":\"0\",\"IS_SD\":\"0\",\"NAME\":\"尹作梅\",\"RDSJ\":null,\"IS_VOLUNTEER\":\"1\",\"GRID_ID_VALUE\":\"e74829ffc43d5470eba6b5e060c11e63\",\"IS_SZ\":\"0\",\"IS_CJ\":\"0\",\"HOME_ID_VALUE\":\"200\",\"DEMAND_CATEGORY_IDS\":null,\"VILLAGE_NAME\":\"中海国际社区一里城\",\"IS_DBH\":\"0\",\"IS_SN\":\"0\",\"BUILD_NAME\":\"1号楼\",\"IS_YLFN\":\"0\",\"IS_UNITED_FRONT\":\"0\",\"ID_CARD\":\"371325199310260529\",\"MOBILE\":\"15764229697\",\"IS_OLD_PEOPLE\":\"0\",\"DOOR_NAME\":\"101\"},{\"IS_SPECIAL\":\"1\",\"IS_XFRY\":\"0\",\"REMARKS\":\"beizhu\",\"IS_PARTY\":\"1\",\"icResiUserId\":\"yzmtest\",\"HOME_ID\":\"中海国际社区一里城1号楼1单元101\",\"HOUSE_TYPE\":\"平房\",\"UNIT_NAME\":\"1单元\",\"GRID_ID\":\"市北区-市北区第三网格3\",\"IS_DB\":\"0\",\"GENDER\":\"男\",\"BIRTHDAY\":\"2021-10-04\",\"IS_VETERANS\":\"0\",\"IS_MB\":\"0\",\"IS_UNEMPLOYED\":\"0\",\"DEMAND_NAME\":\"心理咨询\",\"IS_KC\":\"0\",\"IS_ENSURE_HOUSE\":\"0\",\"IS_SD\":\"0\",\"NAME\":\"尹作梅\",\"RDSJ\":\"2021-10-28 00:00:00\",\"IS_VOLUNTEER\":\"1\",\"GRID_ID_VALUE\":\"e74829ffc43d5470eba6b5e060c11e63\",\"IS_SZ\":\"0\",\"IS_CJ\":\"0\",\"HOME_ID_VALUE\":\"200\",\"DEMAND_CATEGORY_IDS\":\"10180002\",\"VILLAGE_NAME\":\"中海国际社区一里城\",\"IS_DBH\":\"0\",\"IS_SN\":\"0\",\"BUILD_NAME\":\"1号楼\",\"IS_YLFN\":\"0\",\"IS_UNITED_FRONT\":\"0\",\"ID_CARD\":\"371325199310260529\",\"MOBILE\":\"15764229697\",\"IS_OLD_PEOPLE\":\"0\",\"DOOR_NAME\":\"101\"}]"); log.info("resiMainList:{}", JSON.toJSONString(resiMainList)); String templatePath = "excel/ic_resi_info_cid.xls"; @@ -211,7 +212,7 @@ public class IcResiUserController { if (item.getChildGroup() != null) { if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) { Map itemMap1 = otherSheetItems.get(item.getChildGroup().getTableName()); - Map> resiChildMap = icResiUserService.getDataForExport(itemMap1,resiMainList, pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), item.getChildGroup().getTableName(), pageFormDTO.getConditions(),staffInfoCacheResult.getAgencyId(),staffOrgPath); + Map> resiChildMap = icResiUserService.getDataForExport(itemMap1,resiMainList, item.getChildGroup().getTableName(),pageFormDTO,staffInfoCacheResult.getAgencyId(),staffOrgPath); //resiChildMap.forEach((key, value) -> value.putAll(resiMainList.get(key))); Map mapData2 = new HashMap<>(); @@ -246,7 +247,7 @@ public class IcResiUserController { resiFormAllItems.stream().collect(Collectors.groupingBy(e ->e.get));*/ - Map> resiMainList = icResiUserService.getDataForExport(otherSheetItems.get(BASE_TABLE_NAME),new HashMap<>(), pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), BASE_TABLE_NAME, pageFormDTO.getConditions(),staffInfoCacheResult.getAgencyId(),staffOrgPath); + Map> resiMainList = icResiUserService.getDataForExport(otherSheetItems.get(BASE_TABLE_NAME),new HashMap<>(), BASE_TABLE_NAME, pageFormDTO,staffInfoCacheResult.getAgencyId(),staffOrgPath); //========================================= String templatePath = "excel/ic_resi_info_cid_for_easy_excel.xlsx"; @@ -266,7 +267,7 @@ public class IcResiUserController { if (item.getChildGroup() != null) { if (!item.getChildGroup().getTableName().equals(BASE_TABLE_NAME)) { Map itemMap1 = otherSheetItems.get(item.getChildGroup().getTableName()); - Map> resiChildMap = icResiUserService.getDataForExport(itemMap1,resiMainList, pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), item.getChildGroup().getTableName(), pageFormDTO.getConditions(),staffInfoCacheResult.getAgencyId(),staffOrgPath); + Map> resiChildMap = icResiUserService.getDataForExport(itemMap1,resiMainList,item.getChildGroup().getTableName() , pageFormDTO, staffInfoCacheResult.getAgencyId(),staffOrgPath); //resiChildMap.forEach((key, value) -> value.putAll(resiMainList.get(key))); int sheetNo = n.incrementAndGet(); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java index 510c434264..0947eaaf82 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java @@ -57,29 +57,32 @@ public class StatsResiWarnController { private StatsResiWarnService statsResiWarnService; @PostMapping("list") - public Result list(@RequestBody StatsResiListFormDTO formDTO){ + public Result list(@LoginUser TokenDto tokenDto,@RequestBody StatsResiListFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO); - List icStatsResiResultDTOList = statsResiWarnService.list(formDTO.getId(),formDTO.getLevel()); + String customerId = tokenDto.getCustomerId(); + List icStatsResiResultDTOList = statsResiWarnService.list(customerId,formDTO.getId(),formDTO.getLevel()); return new Result().ok(icStatsResiResultDTOList); } @PostMapping("buildingwarnlist") - public Result buildingWarnList(@RequestBody StatsResiWarnFormDTO formDTO){ + public Result buildingWarnList(@LoginUser TokenDto tokenDto,@RequestBody StatsResiWarnFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedBuilding.class); + String customerId = tokenDto.getCustomerId(); String agencyID = formDTO.getAgencyId(); - List icStatsResiWarnBuildingResultDTOS = statsResiWarnService.buildingwWarnList(agencyID); + List icStatsResiWarnBuildingResultDTOS = statsResiWarnService.buildingwWarnList(customerId,agencyID); return new Result().ok(icStatsResiWarnBuildingResultDTOS); } @PostMapping("userwarnlist") - public Result userWarnList(@RequestBody StatsResiWarnFormDTO formDTO){ + public Result userWarnList(@LoginUser TokenDto tokenDto,@RequestBody StatsResiWarnFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedUser.class); + String customerId = tokenDto.getCustomerId(); List buildingIdList = formDTO.getBuildingIdList(); if(CollectionUtils.isEmpty(buildingIdList)){ return new Result(); } - List icStatsResiWarnUserResultDTOS = statsResiWarnService.userWarnList(formDTO.getConfigId(), formDTO.getBuildingIdList()); + List icStatsResiWarnUserResultDTOS = statsResiWarnService.userWarnList(customerId,formDTO.getConfigId(), formDTO.getBuildingIdList()); return new Result().ok(icStatsResiWarnUserResultDTOS); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java index 5eea1c2c44..ef9fac802c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java @@ -35,17 +35,27 @@ import java.util.Map; @Mapper public interface IcStatsResiWarnDao extends BaseDao { - List selectResiWarnByAgencyId(@Param("agencyId") String agencyId); + List selectResiWarnByAgencyId(@Param("customerId") String customerId,@Param("agencyId") String agencyId); - List> userWarnList(@Param("buildingIdList") List buildingIdList, @Param("tableName") String tableName, @Param("columnName") String columnName); + List> userWarnList(@Param("customerId") String customerId, + @Param("buildingIdList") List buildingIdList, + @Param("tableName") String tableName, + @Param("columnName") String columnName); Integer countListByLevelAndCol( + @Param("customerId") String customerId, @Param("tableName") String tableName, @Param("columnName") String columnName, @Param("id")String id, @Param("level")String level); - List resiWarn(@Param("tableName") String tableName,@Param("columnName") String columnName); - IcStatsResiWarnEntity resiWarnById(@Param("tableName") String tableName,@Param("columnName") String columnName,@Param("icStatsResiWarn") IcStatsResiWarnEntity icStatsResiWarn); + List resiWarn(@Param("customerId") String customerId, + @Param("tableName") String tableName, + @Param("columnName") String columnName); + + IcStatsResiWarnEntity resiWarnById(@Param("customerId") String customerId, + @Param("tableName") String tableName, + @Param("columnName") String columnName, + @Param("icStatsResiWarn") IcStatsResiWarnEntity icStatsResiWarn); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index e328c556d4..8b650d342d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -107,13 +107,10 @@ public interface IcResiUserService extends BaseService { * * @param itemList * @param resiMainList - * @param customerId - * @param formCode * @param baseTableName - * @param conditions * @return */ - Map> getDataForExport(Map itemList, Map> resiMainList, String customerId, String formCode, String baseTableName, List conditions,String currentStaffAgencyId, + Map> getDataForExport(Map itemList, Map> resiMainList, String baseTableName, IcResiUserPageFormDTO pageFormDTO, String currentStaffAgencyId, String staffOrgPath); /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java index 4ef4b6722a..64ccaa2fb1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java @@ -31,11 +31,11 @@ import java.util.List; */ public interface StatsResiWarnService{ - List buildingwWarnList(String agencyID); + List buildingwWarnList(String customerId,String agencyID); - List userWarnList(String configId, List buildingIdList); + List userWarnList(String customerId,String configId, List buildingIdList); - List list(String id, String level); + List list(String customerId,String id, String level); void resiWarn(String customerId); 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 daa3526570..5499d7086a 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 @@ -614,19 +614,17 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> getDataForExport(Map formItemMap, Map> resiMainList, String customerId, String formCode, String baseTableName, List conditions, + public Map> getDataForExport(Map formItemMap, Map> resiMainList, String baseTableName,IcResiUserPageFormDTO pageFormDTO, String currentStaffAgencyId, String staffOrgPath) { - List> mapList = this.dynamicQuery(customerId, formCode, baseTableName, conditions,currentStaffAgencyId,staffOrgPath); + List> mapList = this.dynamicQuery(pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), baseTableName, pageFormDTO.getConditions(),currentStaffAgencyId,staffOrgPath); Map> result = new LinkedHashMap<>(); mapList.stream().filter(Objects::nonNull).forEach(map -> { + //遍历所有字段 格式化时间字段 map.forEach((k,o) -> { if (o instanceof java.sql.Date){ o = DateUtils.format(((Date) o),DateUtils.DATE_PATTERN); @@ -635,18 +633,27 @@ public class IcResiUserServiceImpl extends BaseServiceImpl e : formItemMap.entrySet()) { String k = e.getKey(); FormItemResult v = e.getValue(); @@ -658,13 +665,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl columnWrappers = new HashMap<>(); if (v.getItemId().equals("1078")) { Map userMap = resiMainList.get(map.get(UserConstant.IC_RESI_USER)); - Object gridId = userMap.get(UserConstant.GRID_ID); IcResiUserImportServiceImpl.ColumnWrapper value = new IcResiUserImportServiceImpl.ColumnWrapper(); value.setColValue(gridId.toString()); columnWrappers.put("1001", value); } //todo 获取 options - Map stringMap = icResiUserImportService.listRemoteOptions(columnWrappers, v.getOptionSourceValue(), null); + Map stringMap = icResiUserImportService.listRemoteOptions(columnWrappers, v.getOptionSourceValue(), currentStaffAgencyId); if ("checkbox".equals(v.getItemType())) { stringMap.forEach((label, value) -> map.put(value, vauleStr.contains(value) ? "是" : "否")); } else if ("select".equals(v.getItemType())) { @@ -704,15 +710,15 @@ public class IcResiUserServiceImpl extends BaseServiceImpl gridInfoRes = govOrgOpenFeignClient.getGridBaseInfoByGridId(formDTO); if (gridInfoRes != null && gridInfoRes.success() && gridInfoRes.getData() != null) { map.put(UserConstant.GRID_NAME, gridInfoRes.getData().getGridName()); } - } + }*/ Object homeId = map.get(UserConstant.HOME_ID); if (homeId != null) { HashSet houseIds = new HashSet<>(); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java index 8a8af94e2b..4b2028501c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java @@ -52,7 +52,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { private IcResiUserDao icResiUserDao; @Override - public List buildingwWarnList(String agencyID) { + public List buildingwWarnList(String customerId,String agencyID) { List result = new ArrayList<>(); //feign获取当前需要预警的配置信息以及阈值 Result> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList(); @@ -81,7 +81,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { return resiWarnBuildingResultDTO; }).collect(Collectors.toList()); //统计数量 - List icStatsResiWarnEntityList = icStatsResiWarnDao.selectResiWarnByAgencyId(agencyID); + List icStatsResiWarnEntityList = icStatsResiWarnDao.selectResiWarnByAgencyId(customerId,agencyID); if(CollectionUtils.isEmpty(icStatsResiWarnEntityList )){ return result; } @@ -115,7 +115,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { } @Override - public List userWarnList(String configId, List buildingIdList) { + public List userWarnList(String customerId,String configId, List buildingIdList) { //feign根据buildingIdList 获取网格,小区,楼宇 信息 Result> buildingList = govOrgOpenFeignClient.buildingListByIds(buildingIdList); if (!buildingList.success() || null == buildingList.getData()) { @@ -137,7 +137,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult.getData(); //根据buildingID,tableName he columnName获取名字 - List> maps = icStatsResiWarnDao.userWarnList(buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); + List> maps = icStatsResiWarnDao.userWarnList(customerId,buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); result.forEach(item->{ item.setConfigId(configId); List> buildingIds = maps.stream().filter(map -> item.getBuildingId().equals(map.get("buildingId"))).collect(Collectors.toList()); @@ -147,7 +147,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { } @Override - public List list(String id, String level) { + public List list(String customerId,String id, String level) { //获取所有配置类项 getshow Result> statsResult = operCustomizeOpenFeignClient.resiCategoryStatsListShowd(); if (!statsResult.success() || null == statsResult.getData()) { @@ -164,7 +164,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { resultDTO.setHouseShowIcon(item.getHouseShowIcon()); resultDTO.setManagementIcon(item.getManagementIcon()); //根据id ,level 获取count - Integer count = icStatsResiWarnDao.countListByLevelAndCol(item.getTableName(),item.getColumnName(),id,level); + Integer count = icStatsResiWarnDao.countListByLevelAndCol(customerId,item.getTableName(),item.getColumnName(),id,level); resultDTO.setCount(count); result.add(resultDTO); }); @@ -187,10 +187,10 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { //保存数据 List icStatsResiWarnEntities = new ArrayList<>(); for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) { - icStatsResiWarnDao.delete(new QueryWrapper().lambda().eq(IcStatsResiWarnEntity::getConfigId,item.getId())); - List maps = icStatsResiWarnDao.resiWarn(item.getTableName(), item.getColumnName()); + icStatsResiWarnDao.delete(new QueryWrapper().lambda().eq(IcStatsResiWarnEntity::getConfigId,item.getId()).eq(IcStatsResiWarnEntity::getCustomerId,customerId)); + List maps = icStatsResiWarnDao.resiWarn(customerId,item.getTableName(), item.getColumnName()); if(CollectionUtils.isEmpty(maps)){ continue; } @@ -226,6 +226,11 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { if(null == icResiUserEntity){ return ; } + IcStatsResiWarnEntity query = new IcStatsResiWarnEntity(); + query.setAgencyId(icResiUserEntity.getAgencyId()); + query.setGridId(icResiUserEntity.getGridId()); + query.setNeighborHoodId(icResiUserEntity.getVillageId()); + query.setBuildingId(icResiUserEntity.getBuildId()); //保存数据 for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) { @@ -233,11 +238,13 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { IcStatsResiWarnEntity icStatsResiWarn = icStatsResiWarnDao.selectOne(new QueryWrapper().lambda() .eq(IcStatsResiWarnEntity::getConfigId,item.getId()) + .eq(IcStatsResiWarnEntity::getCustomerId,customerId) .eq(IcStatsResiWarnEntity::getAgencyId, icResiUserEntity.getAgencyId()) .eq(IcStatsResiWarnEntity::getGridId, icResiUserEntity.getGridId()) .eq(IcStatsResiWarnEntity::getNeighborHoodId, icResiUserEntity.getVillageId()) .eq(IcStatsResiWarnEntity::getBuildingId, icResiUserEntity.getBuildId())); - + //统计数量 + IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(customerId,item.getTableName(), item.getColumnName(),query); if(null == icStatsResiWarn){ //如果不存在,新增统计数量 icStatsResiWarn = new IcStatsResiWarnEntity(); @@ -248,18 +255,23 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { icStatsResiWarn.setBuildingId(icResiUserEntity.getBuildId()); icStatsResiWarn.setConfigId(item.getId()); icStatsResiWarn.setCustomerId(customerId); - IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(item.getTableName(), item.getColumnName(),icStatsResiWarn); + if(null == resiWarnEntity){ - continue; + icStatsResiWarn.setCount(0); + }else{ + icStatsResiWarn.setCount(resiWarnEntity.getCount()); } - icStatsResiWarn.setCount(resiWarnEntity.getCount()); icStatsResiWarnDao.insert(icStatsResiWarn); }else{ //如果存在,更新统计数量 - IcStatsResiWarnEntity resiWarnEntity = icStatsResiWarnDao.resiWarnById(item.getTableName(), item.getColumnName(),icStatsResiWarn); - icStatsResiWarn.setCount(resiWarnEntity.getCount()); + if(null == resiWarnEntity){ + icStatsResiWarn.setCount(0); + }else{ + icStatsResiWarn.setCount(resiWarnEntity.getCount()); + } icStatsResiWarn.setCustomerId(customerId); icStatsResiWarnDao.updateById(icStatsResiWarn); + } diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls index a3fea99bbc..321666f7a4 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid.xls differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xls b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xls index fcf12bc805..c9a0d77e2e 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xls and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xls differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xlsx index e6ea9548c4..52df58c6c5 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xlsx and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml index 79a5f7499b..4a4a2a6cc3 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml @@ -29,6 +29,7 @@ AND (AGENCY_ID = #{agencyId} or CONCAT(':',AGENCY_PIDS, ':') like CONCAT('%:',#{agencyId},':%')) + and CUSTOMER_ID = #{customerId} @@ -63,7 +66,7 @@ and ID in ( - select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0' + select IC_RESI_USER from ${tableName} where ${columnName} = '1' and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0' ) @@ -78,6 +81,7 @@ AND BUILD_ID = #{id} + and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0' @@ -97,10 +101,11 @@ and ID in ( - select IC_RESI_USER from ${tableName} where ${columnName} = '1' and DEL_FLAG = '0' + select IC_RESI_USER from ${tableName} where ${columnName} = '1' and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0' ) - and DEL_FLAG = '0' + and CUSTOMER_ID = #{customerId} + and DEL_FLAG = '0' group by AGENCY_ID,GRID_ID,VILLAGE_ID,BUILD_ID