From 508dd8dde98b7da379e56a819d1cb8d78b98a110 Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期一, 23 八月 2021 15:55:42 +0800 Subject: [PATCH] 随手拍新增图片宽高 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java | 1490 +++++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 1,186 insertions(+), 304 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java index 394e152..ee7dd0f 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java @@ -81,6 +81,10 @@ @Resource private ComMngPopulationHouseUserDAO comMngPopulationHouseUserDAO; @Resource + private ComMngPopulationCommunityTagsDAO comMngPopulationCommunityTagsDAO; + @Resource + private ComMngPopulationCommunityTagsService comMngPopulationCommunityTagsService; + @Resource private ComMngPopulationDAO comMngPopulationDAO; @Resource private ComMngPopulationHouseUserService comMngPopulationHouseUserService; @@ -213,6 +217,12 @@ //设置年龄 if (StringUtils.isNotEmpty(comMngPopulationVO.getBirthday())) { comMngPopulationVO.setAge(AgeUtils.getAgeFromBirthTimes(comMngPopulationVO.getBirthday())); + } + //设置特殊群体标签 + ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = comMngPopulationCommunityTagsDAO.selectOne(new QueryWrapper<ComMngPopulationCommunityTagsDO>(). + lambda().eq(ComMngPopulationCommunityTagsDO::getPopulationId, populationId)); + if (null != comMngPopulationCommunityTagsDO) { + comMngPopulationVO.setLabel(comMngPopulationCommunityTagsDO.getLabel()); } //查询当前用户电子档信息 @@ -496,7 +506,7 @@ @Override @Transactional(rollbackFor = Exception.class) - public R listSavePopulation(List<ComMngPopulationServeExcelVO> list, Long communityId){ + public R listSavePopulation(List<ComMngPopulationServeExcelVO> list, Long communityId, Long userId){ //需要新增的房屋集合 List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); //需要新增的人口集合 @@ -505,6 +515,10 @@ List<ComMngPopulationDO> updateList = new ArrayList<>(); //需要新增的人口与房屋关系集合 List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> savePopulationCommunityList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> updatePopulationCommunityList = new ArrayList<>(); log.info("开始处理导入数据"); List<ComMngPopulationMistakeExcelVO> mistakes = new ArrayList<>(); @@ -516,7 +530,7 @@ log.error("未查询到社区信息"); return R.fail("未查询到社区信息"); } - log.info("开始查询社区信息数据完成"); + log.info("查询社区信息数据完成"); //查询当前社区标签列表 List<String> labelList = new ArrayList<>(); @@ -559,6 +573,12 @@ houseUserMap.put(key,houseUser); }); + List<ComMngPopulationCommunityTagsDO> populationCommunityLists = comMngPopulationCommunityTagsDAO.selectList(null); + HashMap<String,Object> populationCommunityMap = new HashMap<>(); + populationCommunityLists.forEach(populationCommunity -> { + String key = populationCommunity.getPopulationId() + populationCommunity.getCommunityId() + ""; + populationCommunityMap.put(key,populationCommunity); + }); for (ComMngPopulationServeExcelVO vo : list) { if (vo.getDoorNo().contains("号")) { @@ -607,7 +627,7 @@ address.append(vo.getHouseNo()).append("号"); } vo.setAddress(address.toString()); - log.info("开始查询小区街路巷是否存在完成"); + log.info("查询小区街路巷是否存在完成"); log.info("开始查询房屋是否存在"); //先判断房屋是否存在 @@ -633,7 +653,7 @@ populationHouseDO = (ComMngPopulationHouseDO)houseMap.get(houseKey); } vo.setHouseId(populationHouseDO.getId()); - log.info("开始查询房屋是否存在完成"); + log.info("查询房屋是否存在完成"); if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) { //空户处理完房屋信息,直接返回 @@ -647,14 +667,14 @@ if(!isOnly(populationKey,populationMap)){ //存在实有人口信息,则更新 populationDO = (ComMngPopulationDO)populationMap.get(populationKey); - ComMngPopulationDO updatePopulationDO = updatePopulationDO(vo,populationDO,labelList); + ComMngPopulationDO updatePopulationDO = updatePopulationDO(vo,populationDO,communityId,userId); updateList.add(updatePopulationDO); }else{ //不存在实有人口,则新增 - populationDO = savePopulationDO(vo, populationActVO, comMngVillageDO,labelList); + populationDO = savePopulationDO(vo, populationActVO, comMngVillageDO, userId); saveList.add(populationDO); } - log.info("开始查询实有人口是否已存在完成"); + log.info("查询实有人口是否已存在完成"); log.info("开始查询实有人口房屋居住信息"); //处理实有人口房屋居住信息 @@ -672,7 +692,53 @@ houseUserList.add(populationHouseUserDO); } } - log.info("开始查询实有人口房屋居住信息完成"); + log.info("查询实有人口房屋居住信息完成"); + + log.info("开始查询实有人口存在社区信息"); + //处理实有人口与社区关系以及对应特殊群体标签 + String populationCommunityKey = populationDO.getId() + populationActVO.getCommunityId() + ""; + if (populationDO != null) { + ComMngPopulationCommunityTagsDO cpopulationCommunityTagsDO = null; + if(isOnly(populationCommunityKey,populationCommunityMap)){ + //实有人口不存在于当前社区 + cpopulationCommunityTagsDO = new ComMngPopulationCommunityTagsDO(); + cpopulationCommunityTagsDO.setId(Snowflake.getId()); + cpopulationCommunityTagsDO.setPopulationId(populationDO.getId()); + cpopulationCommunityTagsDO.setCommunityId(communityId); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setCreateBy(userId); + savePopulationCommunityList.add(cpopulationCommunityTagsDO); + } + }else { + //实有人口存在于当前社区,则更新 + ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = (ComMngPopulationCommunityTagsDO)populationCommunityMap.get(populationCommunityKey); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + comMngPopulationCommunityTagsDO.setLabel(Joiner.on(",").join(userTag)); + comMngPopulationCommunityTagsDO.setUpdateBy(userId); + updatePopulationCommunityList.add(comMngPopulationCommunityTagsDO); + + ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); + BeanUtils.copyProperties(vo,mistake); + setMistake(mistake, vo); + mistake.setMistake("该实有人口已存在于该社区,执行更新"); + mistakes.add(mistake); + } + log.info("查询实有人口存在社区信息完成"); } }catch (Exception e){ log.info("出现错误,错误原因:" + e.getMessage()); @@ -683,23 +749,33 @@ if(!houseList.isEmpty()){ log.info("执行数据库导入房屋"); comMngPopulationHouseDAO.insertAll(houseList); - log.info("执行数据库导入房屋完成"); + log.info("数据库导入房屋完成"); } if(!saveList.isEmpty()){ log.info("执行数据库导入人口"); this.baseMapper.insertAll(saveList); - log.info("执行数据库导入人口完成"); + log.info("数据库导入人口完成"); } if(!updateList.isEmpty()){ log.info("执行数据库更新人口"); this.baseMapper.updateAll(updateList); // this.updateBatchById(updateList); - log.info("执行数据库更新人口完成"); + log.info("数据库更新人口完成"); } if(!houseUserList.isEmpty()){ log.info("执行数据库导入人口房屋关系"); comMngPopulationHouseUserService.saveBatch(houseUserList); - log.info("执行数据库导入人口房屋关系完成"); + log.info("数据库导入人口房屋关系完成"); + } + if(!savePopulationCommunityList.isEmpty()){ + log.info("执行数据库导入人口社区关系"); + comMngPopulationCommunityTagsService.saveBatch(savePopulationCommunityList); + log.info("数据库导入人口社区关系完成"); + } + if(!updatePopulationCommunityList.isEmpty()){ + log.info("执行数据库更新人口社区关系"); + comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); + log.info("数据库更新人口社区关系完成"); } log.info("执行数据库导入完成"); @@ -712,7 +788,7 @@ @Override @Transactional(rollbackFor = Exception.class) - public R listSaveDrugPopulation(List<ComMngPopulationDrugExcelVO> list, Long communityId) { + public R listSaveDrugPopulation(List<ComMngPopulationDrugExcelVO> list, Long communityId, Long userId) { //需要新增的房屋集合 List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); //需要新增的人口集合 @@ -721,6 +797,10 @@ List<ComMngPopulationDO> updateList = new ArrayList<>(); //需要新增的人口与房屋关系集合 List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> savePopulationCommunityList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> updatePopulationCommunityList = new ArrayList<>(); log.info("开始处理导入数据"); List<ComMngPopulationDrugMistakeExcelVO> mistakes = new ArrayList<>(); @@ -773,6 +853,13 @@ houseUserLists.forEach(houseUser -> { String key = houseUser.getPopulId() + houseUser.getHouseId() + ""; houseUserMap.put(key,houseUser); + }); + + List<ComMngPopulationCommunityTagsDO> populationCommunityLists = comMngPopulationCommunityTagsDAO.selectList(null); + HashMap<String,Object> populationCommunityMap = new HashMap<>(); + populationCommunityLists.forEach(populationCommunity -> { + String key = populationCommunity.getPopulationId() + populationCommunity.getCommunityId() + ""; + populationCommunityMap.put(key,populationCommunity); }); @@ -863,11 +950,11 @@ if(!isOnly(populationKey,populationMap)){ //存在实有人口信息,则更新 populationDO = (ComMngPopulationDO)populationMap.get(populationKey); - ComMngPopulationDO updatePopulationDO = updateDrugPopulationDO(vo,populationDO,labelList); + ComMngPopulationDO updatePopulationDO = updateDrugPopulationDO(vo,populationDO,communityId,userId); updateList.add(updatePopulationDO); }else{ //不存在实有人口,则新增 - populationDO = saveDrugPopulationDO(vo, populationActVO, comMngVillageDO,labelList); + populationDO = saveDrugPopulationDO(vo, populationActVO, comMngVillageDO,userId); saveList.add(populationDO); } log.info("开始查询实有人口是否已存在完成"); @@ -889,6 +976,52 @@ } } log.info("开始查询实有人口房屋居住信息完成"); + + log.info("开始查询实有人口存在社区信息"); + //处理实有人口与社区关系以及对应特殊群体标签 + String populationCommunityKey = populationDO.getId() + populationActVO.getCommunityId() + ""; + if (populationDO != null) { + ComMngPopulationCommunityTagsDO cpopulationCommunityTagsDO = null; + if(isOnly(populationCommunityKey,populationCommunityMap)){ + //实有人口不存在于当前社区 + cpopulationCommunityTagsDO = new ComMngPopulationCommunityTagsDO(); + cpopulationCommunityTagsDO.setId(Snowflake.getId()); + cpopulationCommunityTagsDO.setPopulationId(populationDO.getId()); + cpopulationCommunityTagsDO.setCommunityId(communityId); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setCreateBy(userId); + savePopulationCommunityList.add(cpopulationCommunityTagsDO); + } + }else { + //实有人口存在于当前社区,则更新 + ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = (ComMngPopulationCommunityTagsDO)populationCommunityMap.get(populationCommunityKey); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + comMngPopulationCommunityTagsDO.setLabel(Joiner.on(",").join(userTag)); + comMngPopulationCommunityTagsDO.setUpdateBy(userId); + updatePopulationCommunityList.add(comMngPopulationCommunityTagsDO); + + ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO(); + BeanUtils.copyProperties(vo,mistake); + setDrugMistake(mistake, vo); + mistake.setMistake("该实有人口已存在于该社区,执行更新"); + mistakes.add(mistake); + } + log.info("查询实有人口存在社区信息完成"); } }catch (Exception e){ log.info("出现错误,错误原因:" + e.getMessage()); @@ -917,6 +1050,16 @@ comMngPopulationHouseUserService.saveBatch(houseUserList); log.info("执行数据库导入人口房屋关系完成"); } + if(!savePopulationCommunityList.isEmpty()){ + log.info("执行数据库导入人口社区关系"); + comMngPopulationCommunityTagsService.saveBatch(savePopulationCommunityList); + log.info("数据库导入人口社区关系完成"); + } + if(!updatePopulationCommunityList.isEmpty()){ + log.info("执行数据库更新人口社区关系"); + comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); + log.info("数据库更新人口社区关系完成"); + } log.info("执行数据库导入完成"); if (!mistakes.isEmpty()) { @@ -928,7 +1071,7 @@ @Override @Transactional(rollbackFor = Exception.class) - public R listSaveCorrectPopulation(List<ComMngPopulationCorrectExcelVO> list, Long communityId) { + public R listSaveCorrectPopulation(List<ComMngPopulationCorrectExcelVO> list, Long communityId, Long userId) { //需要新增的房屋集合 List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); //需要新增的人口集合 @@ -937,6 +1080,10 @@ List<ComMngPopulationDO> updateList = new ArrayList<>(); //需要新增的人口与房屋关系集合 List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> savePopulationCommunityList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> updatePopulationCommunityList = new ArrayList<>(); log.info("开始处理导入数据"); List<ComMngPopulationCorrectMistakeExcelVO> mistakes = new ArrayList<>(); @@ -989,6 +1136,13 @@ houseUserLists.forEach(houseUser -> { String key = houseUser.getPopulId() + houseUser.getHouseId() + ""; houseUserMap.put(key,houseUser); + }); + + List<ComMngPopulationCommunityTagsDO> populationCommunityLists = comMngPopulationCommunityTagsDAO.selectList(null); + HashMap<String,Object> populationCommunityMap = new HashMap<>(); + populationCommunityLists.forEach(populationCommunity -> { + String key = populationCommunity.getPopulationId() + populationCommunity.getCommunityId() + ""; + populationCommunityMap.put(key,populationCommunity); }); @@ -1079,11 +1233,11 @@ if(!isOnly(populationKey,populationMap)){ //存在实有人口信息,则更新 populationDO = (ComMngPopulationDO)populationMap.get(populationKey); - ComMngPopulationDO updatePopulationDO = updateCorrectPopulationDO(vo,populationDO,labelList); + ComMngPopulationDO updatePopulationDO = updateCorrectPopulationDO(vo,populationDO,communityId,userId); updateList.add(updatePopulationDO); }else{ //不存在实有人口,则新增 - populationDO = saveCorrectPopulationDO(vo, populationActVO, comMngVillageDO,labelList); + populationDO = saveCorrectPopulationDO(vo, populationActVO, comMngVillageDO,userId); saveList.add(populationDO); } log.info("开始查询实有人口是否已存在完成"); @@ -1105,6 +1259,52 @@ } } log.info("开始查询实有人口房屋居住信息完成"); + + log.info("开始查询实有人口存在社区信息"); + //处理实有人口与社区关系以及对应特殊群体标签 + String populationCommunityKey = populationDO.getId() + populationActVO.getCommunityId() + ""; + if (populationDO != null) { + ComMngPopulationCommunityTagsDO cpopulationCommunityTagsDO = null; + if(isOnly(populationCommunityKey,populationCommunityMap)){ + //实有人口不存在于当前社区 + cpopulationCommunityTagsDO = new ComMngPopulationCommunityTagsDO(); + cpopulationCommunityTagsDO.setId(Snowflake.getId()); + cpopulationCommunityTagsDO.setPopulationId(populationDO.getId()); + cpopulationCommunityTagsDO.setCommunityId(communityId); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setCreateBy(userId); + savePopulationCommunityList.add(cpopulationCommunityTagsDO); + } + }else { + //实有人口存在于当前社区,则更新 + ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = (ComMngPopulationCommunityTagsDO)populationCommunityMap.get(populationCommunityKey); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + comMngPopulationCommunityTagsDO.setLabel(Joiner.on(",").join(userTag)); + comMngPopulationCommunityTagsDO.setUpdateBy(userId); + updatePopulationCommunityList.add(comMngPopulationCommunityTagsDO); + + ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO(); + BeanUtils.copyProperties(vo,mistake); + setCorrectMistake(mistake, vo); + mistake.setMistake("该实有人口已存在于该社区,执行更新"); + mistakes.add(mistake); + } + log.info("查询实有人口存在社区信息完成"); } }catch (Exception e){ log.info("出现错误,错误原因:" + e.getMessage()); @@ -1133,6 +1333,16 @@ comMngPopulationHouseUserService.saveBatch(houseUserList); log.info("执行数据库导入人口房屋关系完成"); } + if(!savePopulationCommunityList.isEmpty()){ + log.info("执行数据库导入人口社区关系"); + comMngPopulationCommunityTagsService.saveBatch(savePopulationCommunityList); + log.info("数据库导入人口社区关系完成"); + } + if(!updatePopulationCommunityList.isEmpty()){ + log.info("执行数据库更新人口社区关系"); + comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); + log.info("数据库更新人口社区关系完成"); + } log.info("执行数据库导入完成"); if (!mistakes.isEmpty()) { @@ -1144,7 +1354,7 @@ @Override @Transactional(rollbackFor = Exception.class) - public R listSaveMajorPopulation(List<ComMngPopulationMajorExcelVO> list, Long communityId) { + public R listSaveMajorPopulation(List<ComMngPopulationMajorExcelVO> list, Long communityId, Long userId) { //需要新增的房屋集合 List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); //需要新增的人口集合 @@ -1153,6 +1363,10 @@ List<ComMngPopulationDO> updateList = new ArrayList<>(); //需要新增的人口与房屋关系集合 List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> savePopulationCommunityList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> updatePopulationCommunityList = new ArrayList<>(); log.info("开始处理导入数据"); List<ComMngPopulationMajorMistakeExcelVO> mistakes = new ArrayList<>(); @@ -1205,6 +1419,13 @@ houseUserLists.forEach(houseUser -> { String key = houseUser.getPopulId() + houseUser.getHouseId() + ""; houseUserMap.put(key,houseUser); + }); + + List<ComMngPopulationCommunityTagsDO> populationCommunityLists = comMngPopulationCommunityTagsDAO.selectList(null); + HashMap<String,Object> populationCommunityMap = new HashMap<>(); + populationCommunityLists.forEach(populationCommunity -> { + String key = populationCommunity.getPopulationId() + populationCommunity.getCommunityId() + ""; + populationCommunityMap.put(key,populationCommunity); }); @@ -1295,11 +1516,11 @@ if(!isOnly(populationKey,populationMap)){ //存在实有人口信息,则更新 populationDO = (ComMngPopulationDO)populationMap.get(populationKey); - ComMngPopulationDO updatePopulationDO = updateMajorPopulationDO(vo,populationDO,labelList); + ComMngPopulationDO updatePopulationDO = updateMajorPopulationDO(vo,populationDO,communityId,userId); updateList.add(updatePopulationDO); }else{ //不存在实有人口,则新增 - populationDO = saveMajorPopulationDO(vo, populationActVO, comMngVillageDO,labelList); + populationDO = saveMajorPopulationDO(vo, populationActVO, comMngVillageDO,userId); saveList.add(populationDO); } log.info("开始查询实有人口是否已存在完成"); @@ -1321,6 +1542,52 @@ } } log.info("开始查询实有人口房屋居住信息完成"); + + log.info("开始查询实有人口存在社区信息"); + //处理实有人口与社区关系以及对应特殊群体标签 + String populationCommunityKey = populationDO.getId() + populationActVO.getCommunityId() + ""; + if (populationDO != null) { + ComMngPopulationCommunityTagsDO cpopulationCommunityTagsDO = null; + if(isOnly(populationCommunityKey,populationCommunityMap)){ + //实有人口不存在于当前社区 + cpopulationCommunityTagsDO = new ComMngPopulationCommunityTagsDO(); + cpopulationCommunityTagsDO.setId(Snowflake.getId()); + cpopulationCommunityTagsDO.setPopulationId(populationDO.getId()); + cpopulationCommunityTagsDO.setCommunityId(communityId); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setCreateBy(userId); + savePopulationCommunityList.add(cpopulationCommunityTagsDO); + } + }else { + //实有人口存在于当前社区,则更新 + ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = (ComMngPopulationCommunityTagsDO)populationCommunityMap.get(populationCommunityKey); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + comMngPopulationCommunityTagsDO.setLabel(Joiner.on(",").join(userTag)); + comMngPopulationCommunityTagsDO.setUpdateBy(userId); + updatePopulationCommunityList.add(comMngPopulationCommunityTagsDO); + + ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); + BeanUtils.copyProperties(vo,mistake); + setMajorMistake(mistake, vo); + mistake.setMistake("该实有人口已存在于该社区,执行更新"); + mistakes.add(mistake); + } + log.info("查询实有人口存在社区信息完成"); } }catch (Exception e){ log.info("出现错误,错误原因:" + e.getMessage()); @@ -1349,6 +1616,16 @@ comMngPopulationHouseUserService.saveBatch(houseUserList); log.info("执行数据库导入人口房屋关系完成"); } + if(!savePopulationCommunityList.isEmpty()){ + log.info("执行数据库导入人口社区关系"); + comMngPopulationCommunityTagsService.saveBatch(savePopulationCommunityList); + log.info("数据库导入人口社区关系完成"); + } + if(!updatePopulationCommunityList.isEmpty()){ + log.info("执行数据库更新人口社区关系"); + comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); + log.info("数据库更新人口社区关系完成"); + } log.info("执行数据库导入完成"); if (!mistakes.isEmpty()) { @@ -1360,7 +1637,7 @@ @Override @Transactional(rollbackFor = Exception.class) - public R listSaveCultPopulation(List<ComMngPopulationCultExcelVO> list, Long communityId) { + public R listSaveCultPopulation(List<ComMngPopulationCultExcelVO> list, Long communityId, Long userId) { //需要新增的房屋集合 List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); //需要新增的人口集合 @@ -1369,6 +1646,10 @@ List<ComMngPopulationDO> updateList = new ArrayList<>(); //需要新增的人口与房屋关系集合 List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> savePopulationCommunityList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> updatePopulationCommunityList = new ArrayList<>(); log.info("开始处理导入数据"); List<ComMngPopulationCultMistakeExcelVO> mistakes = new ArrayList<>(); @@ -1421,6 +1702,13 @@ houseUserLists.forEach(houseUser -> { String key = houseUser.getPopulId() + houseUser.getHouseId() + ""; houseUserMap.put(key,houseUser); + }); + + List<ComMngPopulationCommunityTagsDO> populationCommunityLists = comMngPopulationCommunityTagsDAO.selectList(null); + HashMap<String,Object> populationCommunityMap = new HashMap<>(); + populationCommunityLists.forEach(populationCommunity -> { + String key = populationCommunity.getPopulationId() + populationCommunity.getCommunityId() + ""; + populationCommunityMap.put(key,populationCommunity); }); @@ -1511,11 +1799,11 @@ if(!isOnly(populationKey,populationMap)){ //存在实有人口信息,则更新 populationDO = (ComMngPopulationDO)populationMap.get(populationKey); - ComMngPopulationDO updatePopulationDO = updateCultPopulationDO(vo,populationDO,labelList); + ComMngPopulationDO updatePopulationDO = updateCultPopulationDO(vo,populationDO,communityId,userId); updateList.add(updatePopulationDO); }else{ //不存在实有人口,则新增 - populationDO = saveCultPopulationDO(vo, populationActVO, comMngVillageDO,labelList); + populationDO = saveCultPopulationDO(vo, populationActVO, comMngVillageDO,userId); saveList.add(populationDO); } log.info("开始查询实有人口是否已存在完成"); @@ -1537,6 +1825,52 @@ } } log.info("开始查询实有人口房屋居住信息完成"); + + log.info("开始查询实有人口存在社区信息"); + //处理实有人口与社区关系以及对应特殊群体标签 + String populationCommunityKey = populationDO.getId() + populationActVO.getCommunityId() + ""; + if (populationDO != null) { + ComMngPopulationCommunityTagsDO cpopulationCommunityTagsDO = null; + if(isOnly(populationCommunityKey,populationCommunityMap)){ + //实有人口不存在于当前社区 + cpopulationCommunityTagsDO = new ComMngPopulationCommunityTagsDO(); + cpopulationCommunityTagsDO.setId(Snowflake.getId()); + cpopulationCommunityTagsDO.setPopulationId(populationDO.getId()); + cpopulationCommunityTagsDO.setCommunityId(communityId); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setCreateBy(userId); + savePopulationCommunityList.add(cpopulationCommunityTagsDO); + } + }else { + //实有人口存在于当前社区,则更新 + ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = (ComMngPopulationCommunityTagsDO)populationCommunityMap.get(populationCommunityKey); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + comMngPopulationCommunityTagsDO.setLabel(Joiner.on(",").join(userTag)); + comMngPopulationCommunityTagsDO.setUpdateBy(userId); + updatePopulationCommunityList.add(comMngPopulationCommunityTagsDO); + + ComMngPopulationCultMistakeExcelVO mistake = new ComMngPopulationCultMistakeExcelVO(); + BeanUtils.copyProperties(vo,mistake); + setCultMistake(mistake, vo); + mistake.setMistake("该实有人口已存在于该社区,执行更新"); + mistakes.add(mistake); + } + log.info("查询实有人口存在社区信息完成"); } }catch (Exception e){ log.info("出现错误,错误原因:" + e.getMessage()); @@ -1565,6 +1899,16 @@ comMngPopulationHouseUserService.saveBatch(houseUserList); log.info("执行数据库导入人口房屋关系完成"); } + if(!savePopulationCommunityList.isEmpty()){ + log.info("执行数据库导入人口社区关系"); + comMngPopulationCommunityTagsService.saveBatch(savePopulationCommunityList); + log.info("数据库导入人口社区关系完成"); + } + if(!updatePopulationCommunityList.isEmpty()){ + log.info("执行数据库更新人口社区关系"); + comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); + log.info("数据库更新人口社区关系完成"); + } log.info("执行数据库导入完成"); if (!mistakes.isEmpty()) { @@ -1576,7 +1920,7 @@ @Override @Transactional(rollbackFor = Exception.class) - public R listSaveRehabilitationPopulation(List<ComMngPopulationRehabilitationExcelVO> list, Long communityId) { + public R listSaveRehabilitationPopulation(List<ComMngPopulationRehabilitationExcelVO> list, Long communityId, Long userId) { //需要新增的房屋集合 List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); //需要新增的人口集合 @@ -1585,6 +1929,10 @@ List<ComMngPopulationDO> updateList = new ArrayList<>(); //需要新增的人口与房屋关系集合 List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> savePopulationCommunityList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> updatePopulationCommunityList = new ArrayList<>(); log.info("开始处理导入数据"); List<ComMngPopulationRehabilitationMistakeExcelVO> mistakes = new ArrayList<>(); @@ -1637,6 +1985,13 @@ houseUserLists.forEach(houseUser -> { String key = houseUser.getPopulId() + houseUser.getHouseId() + ""; houseUserMap.put(key,houseUser); + }); + + List<ComMngPopulationCommunityTagsDO> populationCommunityLists = comMngPopulationCommunityTagsDAO.selectList(null); + HashMap<String,Object> populationCommunityMap = new HashMap<>(); + populationCommunityLists.forEach(populationCommunity -> { + String key = populationCommunity.getPopulationId() + populationCommunity.getCommunityId() + ""; + populationCommunityMap.put(key,populationCommunity); }); @@ -1727,11 +2082,11 @@ if(!isOnly(populationKey,populationMap)){ //存在实有人口信息,则更新 populationDO = (ComMngPopulationDO)populationMap.get(populationKey); - ComMngPopulationDO updatePopulationDO = updateRehabilitationPopulationDO(vo,populationDO,labelList); + ComMngPopulationDO updatePopulationDO = updateRehabilitationPopulationDO(vo,populationDO,communityId,userId); updateList.add(updatePopulationDO); }else{ //不存在实有人口,则新增 - populationDO = saveRehabilitationPopulationDO(vo, populationActVO, comMngVillageDO,labelList); + populationDO = saveRehabilitationPopulationDO(vo, populationActVO, comMngVillageDO,userId); saveList.add(populationDO); } log.info("开始查询实有人口是否已存在完成"); @@ -1753,6 +2108,52 @@ } } log.info("开始查询实有人口房屋居住信息完成"); + + log.info("开始查询实有人口存在社区信息"); + //处理实有人口与社区关系以及对应特殊群体标签 + String populationCommunityKey = populationDO.getId() + populationActVO.getCommunityId() + ""; + if (populationDO != null) { + ComMngPopulationCommunityTagsDO cpopulationCommunityTagsDO = null; + if(isOnly(populationCommunityKey,populationCommunityMap)){ + //实有人口不存在于当前社区 + cpopulationCommunityTagsDO = new ComMngPopulationCommunityTagsDO(); + cpopulationCommunityTagsDO.setId(Snowflake.getId()); + cpopulationCommunityTagsDO.setPopulationId(populationDO.getId()); + cpopulationCommunityTagsDO.setCommunityId(communityId); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setCreateBy(userId); + savePopulationCommunityList.add(cpopulationCommunityTagsDO); + } + }else { + //实有人口存在于当前社区,则更新 + ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = (ComMngPopulationCommunityTagsDO)populationCommunityMap.get(populationCommunityKey); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + comMngPopulationCommunityTagsDO.setLabel(Joiner.on(",").join(userTag)); + comMngPopulationCommunityTagsDO.setUpdateBy(userId); + updatePopulationCommunityList.add(comMngPopulationCommunityTagsDO); + + ComMngPopulationRehabilitationMistakeExcelVO mistake = new ComMngPopulationRehabilitationMistakeExcelVO(); + BeanUtils.copyProperties(vo,mistake); + setRehabilitationMistake(mistake, vo); + mistake.setMistake("该实有人口已存在于该社区,执行更新"); + mistakes.add(mistake); + } + log.info("查询实有人口存在社区信息完成"); } }catch (Exception e){ log.info("出现错误,错误原因:" + e.getMessage()); @@ -1781,6 +2182,16 @@ comMngPopulationHouseUserService.saveBatch(houseUserList); log.info("执行数据库导入人口房屋关系完成"); } + if(!savePopulationCommunityList.isEmpty()){ + log.info("执行数据库导入人口社区关系"); + comMngPopulationCommunityTagsService.saveBatch(savePopulationCommunityList); + log.info("数据库导入人口社区关系完成"); + } + if(!updatePopulationCommunityList.isEmpty()){ + log.info("执行数据库更新人口社区关系"); + comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); + log.info("数据库更新人口社区关系完成"); + } log.info("执行数据库导入完成"); if (!mistakes.isEmpty()) { @@ -1792,7 +2203,7 @@ @Override @Transactional(rollbackFor = Exception.class) - public R listSaveKeyPopulation(List<ComMngPopulationKeyExcelVO> list, Long communityId) { + public R listSaveKeyPopulation(List<ComMngPopulationKeyExcelVO> list, Long communityId, Long userId) { //需要新增的房屋集合 List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); //需要新增的人口集合 @@ -1801,6 +2212,10 @@ List<ComMngPopulationDO> updateList = new ArrayList<>(); //需要新增的人口与房屋关系集合 List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> savePopulationCommunityList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> updatePopulationCommunityList = new ArrayList<>(); log.info("开始处理导入数据"); List<ComMngPopulationKeyMistakeExcelVO> mistakes = new ArrayList<>(); @@ -1853,6 +2268,13 @@ houseUserLists.forEach(houseUser -> { String key = houseUser.getPopulId() + houseUser.getHouseId() + ""; houseUserMap.put(key,houseUser); + }); + + List<ComMngPopulationCommunityTagsDO> populationCommunityLists = comMngPopulationCommunityTagsDAO.selectList(null); + HashMap<String,Object> populationCommunityMap = new HashMap<>(); + populationCommunityLists.forEach(populationCommunity -> { + String key = populationCommunity.getPopulationId() + populationCommunity.getCommunityId() + ""; + populationCommunityMap.put(key,populationCommunity); }); @@ -1943,11 +2365,11 @@ if(!isOnly(populationKey,populationMap)){ //存在实有人口信息,则更新 populationDO = (ComMngPopulationDO)populationMap.get(populationKey); - ComMngPopulationDO updatePopulationDO = updateKeyPopulationDO(vo,populationDO,labelList); + ComMngPopulationDO updatePopulationDO = updateKeyPopulationDO(vo,populationDO,communityId,userId); updateList.add(updatePopulationDO); }else{ //不存在实有人口,则新增 - populationDO = saveKeyPopulationDO(vo, populationActVO, comMngVillageDO,labelList); + populationDO = saveKeyPopulationDO(vo, populationActVO, comMngVillageDO,userId); saveList.add(populationDO); } log.info("开始查询实有人口是否已存在完成"); @@ -1969,6 +2391,52 @@ } } log.info("开始查询实有人口房屋居住信息完成"); + + log.info("开始查询实有人口存在社区信息"); + //处理实有人口与社区关系以及对应特殊群体标签 + String populationCommunityKey = populationDO.getId() + populationActVO.getCommunityId() + ""; + if (populationDO != null) { + ComMngPopulationCommunityTagsDO cpopulationCommunityTagsDO = null; + if(isOnly(populationCommunityKey,populationCommunityMap)){ + //实有人口不存在于当前社区 + cpopulationCommunityTagsDO = new ComMngPopulationCommunityTagsDO(); + cpopulationCommunityTagsDO.setId(Snowflake.getId()); + cpopulationCommunityTagsDO.setPopulationId(populationDO.getId()); + cpopulationCommunityTagsDO.setCommunityId(communityId); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setCreateBy(userId); + savePopulationCommunityList.add(cpopulationCommunityTagsDO); + } + }else { + //实有人口存在于当前社区,则更新 + ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = (ComMngPopulationCommunityTagsDO)populationCommunityMap.get(populationCommunityKey); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + comMngPopulationCommunityTagsDO.setLabel(Joiner.on(",").join(userTag)); + comMngPopulationCommunityTagsDO.setUpdateBy(userId); + updatePopulationCommunityList.add(comMngPopulationCommunityTagsDO); + + ComMngPopulationKeyMistakeExcelVO mistake = new ComMngPopulationKeyMistakeExcelVO(); + BeanUtils.copyProperties(vo,mistake); + setKeyMistake(mistake, vo); + mistake.setMistake("该实有人口已存在于该社区,执行更新"); + mistakes.add(mistake); + } + log.info("查询实有人口存在社区信息完成"); } }catch (Exception e){ log.info("出现错误,错误原因:" + e.getMessage()); @@ -1997,6 +2465,16 @@ comMngPopulationHouseUserService.saveBatch(houseUserList); log.info("执行数据库导入人口房屋关系完成"); } + if(!savePopulationCommunityList.isEmpty()){ + log.info("执行数据库导入人口社区关系"); + comMngPopulationCommunityTagsService.saveBatch(savePopulationCommunityList); + log.info("数据库导入人口社区关系完成"); + } + if(!updatePopulationCommunityList.isEmpty()){ + log.info("执行数据库更新人口社区关系"); + comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); + log.info("数据库更新人口社区关系完成"); + } log.info("执行数据库导入完成"); if (!mistakes.isEmpty()) { @@ -2008,7 +2486,7 @@ @Override @Transactional(rollbackFor = Exception.class) - public R listSaveSentencePopulation(List<ComMngPopulationSentenceExcelVO> list, Long communityId) { + public R listSaveSentencePopulation(List<ComMngPopulationSentenceExcelVO> list, Long communityId, Long userId) { //需要新增的房屋集合 List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); //需要新增的人口集合 @@ -2017,6 +2495,10 @@ List<ComMngPopulationDO> updateList = new ArrayList<>(); //需要新增的人口与房屋关系集合 List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> savePopulationCommunityList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> updatePopulationCommunityList = new ArrayList<>(); log.info("开始处理导入数据"); List<ComMngPopulationSentenceMistakeExcelVO> mistakes = new ArrayList<>(); @@ -2069,6 +2551,13 @@ houseUserLists.forEach(houseUser -> { String key = houseUser.getPopulId() + houseUser.getHouseId() + ""; houseUserMap.put(key,houseUser); + }); + + List<ComMngPopulationCommunityTagsDO> populationCommunityLists = comMngPopulationCommunityTagsDAO.selectList(null); + HashMap<String,Object> populationCommunityMap = new HashMap<>(); + populationCommunityLists.forEach(populationCommunity -> { + String key = populationCommunity.getPopulationId() + populationCommunity.getCommunityId() + ""; + populationCommunityMap.put(key,populationCommunity); }); @@ -2159,11 +2648,11 @@ if(!isOnly(populationKey,populationMap)){ //存在实有人口信息,则更新 populationDO = (ComMngPopulationDO)populationMap.get(populationKey); - ComMngPopulationDO updatePopulationDO = updateSentencePopulationDO(vo,populationDO,labelList); + ComMngPopulationDO updatePopulationDO = updateSentencePopulationDO(vo,populationDO,communityId,userId); updateList.add(updatePopulationDO); }else{ //不存在实有人口,则新增 - populationDO = saveSentencePopulationDO(vo, populationActVO, comMngVillageDO,labelList); + populationDO = saveSentencePopulationDO(vo, populationActVO, comMngVillageDO,userId); saveList.add(populationDO); } log.info("开始查询实有人口是否已存在完成"); @@ -2185,6 +2674,52 @@ } } log.info("开始查询实有人口房屋居住信息完成"); + + log.info("开始查询实有人口存在社区信息"); + //处理实有人口与社区关系以及对应特殊群体标签 + String populationCommunityKey = populationDO.getId() + populationActVO.getCommunityId() + ""; + if (populationDO != null) { + ComMngPopulationCommunityTagsDO cpopulationCommunityTagsDO = null; + if(isOnly(populationCommunityKey,populationCommunityMap)){ + //实有人口不存在于当前社区 + cpopulationCommunityTagsDO = new ComMngPopulationCommunityTagsDO(); + cpopulationCommunityTagsDO.setId(Snowflake.getId()); + cpopulationCommunityTagsDO.setPopulationId(populationDO.getId()); + cpopulationCommunityTagsDO.setCommunityId(communityId); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setCreateBy(userId); + savePopulationCommunityList.add(cpopulationCommunityTagsDO); + } + }else { + //实有人口存在于当前社区,则更新 + ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = (ComMngPopulationCommunityTagsDO)populationCommunityMap.get(populationCommunityKey); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + comMngPopulationCommunityTagsDO.setLabel(Joiner.on(",").join(userTag)); + comMngPopulationCommunityTagsDO.setUpdateBy(userId); + updatePopulationCommunityList.add(comMngPopulationCommunityTagsDO); + + ComMngPopulationSentenceMistakeExcelVO mistake = new ComMngPopulationSentenceMistakeExcelVO(); + BeanUtils.copyProperties(vo,mistake); + setSentenceMistake(mistake, vo); + mistake.setMistake("该实有人口已存在于该社区,执行更新"); + mistakes.add(mistake); + } + log.info("查询实有人口存在社区信息完成"); } }catch (Exception e){ log.info("出现错误,错误原因:" + e.getMessage()); @@ -2213,6 +2748,16 @@ comMngPopulationHouseUserService.saveBatch(houseUserList); log.info("执行数据库导入人口房屋关系完成"); } + if(!savePopulationCommunityList.isEmpty()){ + log.info("执行数据库导入人口社区关系"); + comMngPopulationCommunityTagsService.saveBatch(savePopulationCommunityList); + log.info("数据库导入人口社区关系完成"); + } + if(!updatePopulationCommunityList.isEmpty()){ + log.info("执行数据库更新人口社区关系"); + comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); + log.info("数据库更新人口社区关系完成"); + } log.info("执行数据库导入完成"); if (!mistakes.isEmpty()) { @@ -2224,7 +2769,7 @@ @Override @Transactional(rollbackFor = Exception.class) - public R listSaveVeteransPopulation(List<ComMngPopulationVeteransExcelVO> list, Long communityId) { + public R listSaveVeteransPopulation(List<ComMngPopulationVeteransExcelVO> list, Long communityId, Long userId) { //需要新增的房屋集合 List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); //需要新增的人口集合 @@ -2233,6 +2778,10 @@ List<ComMngPopulationDO> updateList = new ArrayList<>(); //需要新增的人口与房屋关系集合 List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> savePopulationCommunityList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> updatePopulationCommunityList = new ArrayList<>(); log.info("开始处理导入数据"); List<ComMngPopulationVeteransMistakeExcelVO> mistakes = new ArrayList<>(); @@ -2285,6 +2834,13 @@ houseUserLists.forEach(houseUser -> { String key = houseUser.getPopulId() + houseUser.getHouseId() + ""; houseUserMap.put(key,houseUser); + }); + + List<ComMngPopulationCommunityTagsDO> populationCommunityLists = comMngPopulationCommunityTagsDAO.selectList(null); + HashMap<String,Object> populationCommunityMap = new HashMap<>(); + populationCommunityLists.forEach(populationCommunity -> { + String key = populationCommunity.getPopulationId() + populationCommunity.getCommunityId() + ""; + populationCommunityMap.put(key,populationCommunity); }); @@ -2375,11 +2931,11 @@ if(!isOnly(populationKey,populationMap)){ //存在实有人口信息,则更新 populationDO = (ComMngPopulationDO)populationMap.get(populationKey); - ComMngPopulationDO updatePopulationDO = updateVeteransPopulationDO(vo,populationDO,labelList); + ComMngPopulationDO updatePopulationDO = updateVeteransPopulationDO(vo,populationDO,communityId,userId); updateList.add(updatePopulationDO); }else{ //不存在实有人口,则新增 - populationDO = saveVeteransPopulationDO(vo, populationActVO, comMngVillageDO,labelList); + populationDO = saveVeteransPopulationDO(vo, populationActVO, comMngVillageDO,userId); saveList.add(populationDO); } log.info("开始查询实有人口是否已存在完成"); @@ -2401,6 +2957,52 @@ } } log.info("开始查询实有人口房屋居住信息完成"); + + log.info("开始查询实有人口存在社区信息"); + //处理实有人口与社区关系以及对应特殊群体标签 + String populationCommunityKey = populationDO.getId() + populationActVO.getCommunityId() + ""; + if (populationDO != null) { + ComMngPopulationCommunityTagsDO cpopulationCommunityTagsDO = null; + if(isOnly(populationCommunityKey,populationCommunityMap)){ + //实有人口不存在于当前社区 + cpopulationCommunityTagsDO = new ComMngPopulationCommunityTagsDO(); + cpopulationCommunityTagsDO.setId(Snowflake.getId()); + cpopulationCommunityTagsDO.setPopulationId(populationDO.getId()); + cpopulationCommunityTagsDO.setCommunityId(communityId); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setCreateBy(userId); + savePopulationCommunityList.add(cpopulationCommunityTagsDO); + } + }else { + //实有人口存在于当前社区,则更新 + ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = (ComMngPopulationCommunityTagsDO)populationCommunityMap.get(populationCommunityKey); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + comMngPopulationCommunityTagsDO.setLabel(Joiner.on(",").join(userTag)); + comMngPopulationCommunityTagsDO.setUpdateBy(userId); + updatePopulationCommunityList.add(comMngPopulationCommunityTagsDO); + + ComMngPopulationVeteransMistakeExcelVO mistake = new ComMngPopulationVeteransMistakeExcelVO(); + BeanUtils.copyProperties(vo,mistake); + setVeteransMistake(mistake, vo); + mistake.setMistake("该实有人口已存在于该社区,执行更新"); + mistakes.add(mistake); + } + log.info("查询实有人口存在社区信息完成"); } }catch (Exception e){ log.info("出现错误,错误原因:" + e.getMessage()); @@ -2429,6 +3031,16 @@ comMngPopulationHouseUserService.saveBatch(houseUserList); log.info("执行数据库导入人口房屋关系完成"); } + if(!savePopulationCommunityList.isEmpty()){ + log.info("执行数据库导入人口社区关系"); + comMngPopulationCommunityTagsService.saveBatch(savePopulationCommunityList); + log.info("数据库导入人口社区关系完成"); + } + if(!updatePopulationCommunityList.isEmpty()){ + log.info("执行数据库更新人口社区关系"); + comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); + log.info("数据库更新人口社区关系完成"); + } log.info("执行数据库导入完成"); if (!mistakes.isEmpty()) { @@ -2440,7 +3052,7 @@ @Override @Transactional(rollbackFor = Exception.class) - public R listSaveDisabilityPopulation(List<ComMngPopulationDisabilityExcelVO> list, Long communityId) { + public R listSaveDisabilityPopulation(List<ComMngPopulationDisabilityExcelVO> list, Long communityId, Long userId) { //需要新增的房屋集合 List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); //需要新增的人口集合 @@ -2449,6 +3061,10 @@ List<ComMngPopulationDO> updateList = new ArrayList<>(); //需要新增的人口与房屋关系集合 List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> savePopulationCommunityList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> updatePopulationCommunityList = new ArrayList<>(); log.info("开始处理导入数据"); List<ComMngPopulationDisabilityMistakeExcelVO> mistakes = new ArrayList<>(); @@ -2501,6 +3117,13 @@ houseUserLists.forEach(houseUser -> { String key = houseUser.getPopulId() + houseUser.getHouseId() + ""; houseUserMap.put(key,houseUser); + }); + + List<ComMngPopulationCommunityTagsDO> populationCommunityLists = comMngPopulationCommunityTagsDAO.selectList(null); + HashMap<String,Object> populationCommunityMap = new HashMap<>(); + populationCommunityLists.forEach(populationCommunity -> { + String key = populationCommunity.getPopulationId() + populationCommunity.getCommunityId() + ""; + populationCommunityMap.put(key,populationCommunity); }); @@ -2591,11 +3214,11 @@ if(!isOnly(populationKey,populationMap)){ //存在实有人口信息,则更新 populationDO = (ComMngPopulationDO)populationMap.get(populationKey); - ComMngPopulationDO updatePopulationDO = updateDisabilityPopulationDO(vo,populationDO,labelList); + ComMngPopulationDO updatePopulationDO = updateDisabilityPopulationDO(vo,populationDO,communityId,userId); updateList.add(updatePopulationDO); }else{ //不存在实有人口,则新增 - populationDO = saveDisabilityPopulationDO(vo, populationActVO, comMngVillageDO,labelList); + populationDO = saveDisabilityPopulationDO(vo, populationActVO, comMngVillageDO,userId); saveList.add(populationDO); } log.info("开始查询实有人口是否已存在完成"); @@ -2617,6 +3240,52 @@ } } log.info("开始查询实有人口房屋居住信息完成"); + + log.info("开始查询实有人口存在社区信息"); + //处理实有人口与社区关系以及对应特殊群体标签 + String populationCommunityKey = populationDO.getId() + populationActVO.getCommunityId() + ""; + if (populationDO != null) { + ComMngPopulationCommunityTagsDO cpopulationCommunityTagsDO = null; + if(isOnly(populationCommunityKey,populationCommunityMap)){ + //实有人口不存在于当前社区 + cpopulationCommunityTagsDO = new ComMngPopulationCommunityTagsDO(); + cpopulationCommunityTagsDO.setId(Snowflake.getId()); + cpopulationCommunityTagsDO.setPopulationId(populationDO.getId()); + cpopulationCommunityTagsDO.setCommunityId(communityId); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setCreateBy(userId); + savePopulationCommunityList.add(cpopulationCommunityTagsDO); + } + }else { + //实有人口存在于当前社区,则更新 + ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = (ComMngPopulationCommunityTagsDO)populationCommunityMap.get(populationCommunityKey); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + comMngPopulationCommunityTagsDO.setLabel(Joiner.on(",").join(userTag)); + comMngPopulationCommunityTagsDO.setUpdateBy(userId); + updatePopulationCommunityList.add(comMngPopulationCommunityTagsDO); + + ComMngPopulationDisabilityMistakeExcelVO mistake = new ComMngPopulationDisabilityMistakeExcelVO(); + BeanUtils.copyProperties(vo,mistake); + setDisabilityMistake(mistake, vo); + mistake.setMistake("该实有人口已存在于该社区,执行更新"); + mistakes.add(mistake); + } + log.info("查询实有人口存在社区信息完成"); } }catch (Exception e){ log.info("出现错误,错误原因:" + e.getMessage()); @@ -2645,6 +3314,16 @@ comMngPopulationHouseUserService.saveBatch(houseUserList); log.info("执行数据库导入人口房屋关系完成"); } + if(!savePopulationCommunityList.isEmpty()){ + log.info("执行数据库导入人口社区关系"); + comMngPopulationCommunityTagsService.saveBatch(savePopulationCommunityList); + log.info("数据库导入人口社区关系完成"); + } + if(!updatePopulationCommunityList.isEmpty()){ + log.info("执行数据库更新人口社区关系"); + comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); + log.info("数据库更新人口社区关系完成"); + } log.info("执行数据库导入完成"); if (!mistakes.isEmpty()) { @@ -2656,7 +3335,7 @@ @Override @Transactional(rollbackFor = Exception.class) - public R listSaveLowSecurityPopulation(List<ComMngPopulationLowSecurityExcelVO> list, Long communityId) { + public R listSaveLowSecurityPopulation(List<ComMngPopulationLowSecurityExcelVO> list, Long communityId, Long userId) { //需要新增的房屋集合 List<ComMngPopulationHouseDO> houseList = new ArrayList<>(); //需要新增的人口集合 @@ -2669,6 +3348,10 @@ List<ComDrugPopulationDO> updateDrugList = new ArrayList<>(); //需要新增的人口与房屋关系集合 List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> savePopulationCommunityList = new ArrayList<>(); + //需要新增的人口与社区关系集合 + List<ComMngPopulationCommunityTagsDO> updatePopulationCommunityList = new ArrayList<>(); log.info("开始处理导入数据"); List<ComMngPopulationLowSecurityMistakeExcelVO> mistakes = new ArrayList<>(); @@ -2721,6 +3404,13 @@ houseUserLists.forEach(houseUser -> { String key = houseUser.getPopulId() + houseUser.getHouseId() + ""; houseUserMap.put(key,houseUser); + }); + + List<ComMngPopulationCommunityTagsDO> populationCommunityLists = comMngPopulationCommunityTagsDAO.selectList(null); + HashMap<String,Object> populationCommunityMap = new HashMap<>(); + populationCommunityLists.forEach(populationCommunity -> { + String key = populationCommunity.getPopulationId() + populationCommunity.getCommunityId() + ""; + populationCommunityMap.put(key,populationCommunity); }); @@ -2811,11 +3501,11 @@ if(!isOnly(populationKey,populationMap)){ //存在实有人口信息,则更新 populationDO = (ComMngPopulationDO)populationMap.get(populationKey); - ComMngPopulationDO updatePopulationDO = updateLowSecurityPopulationDO(vo,populationDO,labelList); + ComMngPopulationDO updatePopulationDO = updateLowSecurityPopulationDO(vo,populationDO,communityId,userId); updateList.add(updatePopulationDO); }else{ //不存在实有人口,则新增 - populationDO = saveLowSecurityPopulationDO(vo, populationActVO, comMngVillageDO,labelList); + populationDO = saveLowSecurityPopulationDO(vo, populationActVO, comMngVillageDO,userId); saveList.add(populationDO); } log.info("开始查询实有人口是否已存在完成"); @@ -2837,6 +3527,52 @@ } } log.info("开始查询实有人口房屋居住信息完成"); + + log.info("开始查询实有人口存在社区信息"); + //处理实有人口与社区关系以及对应特殊群体标签 + String populationCommunityKey = populationDO.getId() + populationActVO.getCommunityId() + ""; + if (populationDO != null) { + ComMngPopulationCommunityTagsDO cpopulationCommunityTagsDO = null; + if(isOnly(populationCommunityKey,populationCommunityMap)){ + //实有人口不存在于当前社区 + cpopulationCommunityTagsDO = new ComMngPopulationCommunityTagsDO(); + cpopulationCommunityTagsDO.setId(Snowflake.getId()); + cpopulationCommunityTagsDO.setPopulationId(populationDO.getId()); + cpopulationCommunityTagsDO.setCommunityId(communityId); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setCreateBy(userId); + savePopulationCommunityList.add(cpopulationCommunityTagsDO); + } + }else { + //实有人口存在于当前社区,则更新 + ComMngPopulationCommunityTagsDO comMngPopulationCommunityTagsDO = (ComMngPopulationCommunityTagsDO)populationCommunityMap.get(populationCommunityKey); + List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); + //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 + Iterator<String> iterator = userTag.iterator(); + while (iterator.hasNext()) { + String s = iterator.next(); + if (!labelList.contains(s)) + iterator.remove(); + } + comMngPopulationCommunityTagsDO.setLabel(Joiner.on(",").join(userTag)); + comMngPopulationCommunityTagsDO.setUpdateBy(userId); + updatePopulationCommunityList.add(comMngPopulationCommunityTagsDO); + + ComMngPopulationLowSecurityMistakeExcelVO mistake = new ComMngPopulationLowSecurityMistakeExcelVO(); + BeanUtils.copyProperties(vo,mistake); + setLowSecurityMistake(mistake, vo); + mistake.setMistake("该实有人口已存在于该社区,执行更新"); + mistakes.add(mistake); + } + log.info("查询实有人口存在社区信息完成"); } }catch (Exception e){ log.info("出现错误,错误原因:" + e.getMessage()); @@ -2865,6 +3601,16 @@ comMngPopulationHouseUserService.saveBatch(houseUserList); log.info("执行数据库导入人口房屋关系完成"); } + if(!savePopulationCommunityList.isEmpty()){ + log.info("执行数据库导入人口社区关系"); + comMngPopulationCommunityTagsService.saveBatch(savePopulationCommunityList); + log.info("数据库导入人口社区关系完成"); + } + if(!updatePopulationCommunityList.isEmpty()){ + log.info("执行数据库更新人口社区关系"); + comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); + log.info("数据库更新人口社区关系完成"); + } log.info("执行数据库导入完成"); if (!mistakes.isEmpty()) { @@ -2875,303 +3621,427 @@ } - private ComMngPopulationDO updatePopulationDO(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){ + private ComMngPopulationDO updatePopulationDO(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO, Long communityId, Long userId){ BeanUtils.copyProperties(vo, populationDO); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } String cardNoAES = populationDO.getCardNo(); try { cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); }catch (Exception e){ log.error("身份证加密失败"); } - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setActId(communityId); populationDO.setCardNo(cardNoAES); + populationDO.setUpdateBy(userId); return populationDO; } - private ComMngPopulationDO updateDrugPopulationDO(ComMngPopulationDrugExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){ + private ComMngPopulationDO updateDrugPopulationDO(ComMngPopulationDrugExcelVO vo, ComMngPopulationDO populationDO, Long communityId, Long userId){ BeanUtils.copyProperties(vo, populationDO); ComDrugPopulationDO comDrugPopulationDO = comDrugPopulationDAO.selectOne(new QueryWrapper<ComDrugPopulationDO>().lambda() .eq(ComDrugPopulationDO::getPopulationId, populationDO.getId())); - BeanUtils.copyProperties(vo, comDrugPopulationDO); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } String cardNoAES = populationDO.getCardNo(); try { cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); }catch (Exception e){ log.error("身份证加密失败"); } - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setActId(communityId); populationDO.setCardNo(cardNoAES); - comDrugPopulationDO.setCardNo(cardNoAES); - comDrugPopulationDAO.updateById(comDrugPopulationDO); + populationDO.setUpdateBy(userId); + + if (comDrugPopulationDO != null) { + BeanUtils.copyProperties(vo, comDrugPopulationDO); + comDrugPopulationDO.setCardNo(cardNoAES); + comDrugPopulationDAO.updateById(comDrugPopulationDO); + }else { + comDrugPopulationDO = new ComDrugPopulationDO(); + BeanUtils.copyProperties(vo, comDrugPopulationDO); + comDrugPopulationDO.setId(Snowflake.getId()); + comDrugPopulationDO.setPopulationId(populationDO.getId()); + comDrugPopulationDO.setCommunityId(populationDO.getActId()); + comDrugPopulationDO.setStreetId(populationDO.getStreetId()); + comDrugPopulationDAO.insert(comDrugPopulationDO); + } return populationDO; } - private ComMngPopulationDO updateCorrectPopulationDO(ComMngPopulationCorrectExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){ + private ComMngPopulationDO updateCorrectPopulationDO(ComMngPopulationCorrectExcelVO vo, ComMngPopulationDO populationDO,Long communityId, Long userId){ BeanUtils.copyProperties(vo, populationDO); ComCorrectPopulationDO comCorrectPopulationDO = comCorrectPopulationDAO.selectOne(new QueryWrapper<ComCorrectPopulationDO>().lambda() .eq(ComCorrectPopulationDO::getPopulationId, populationDO.getId())); - BeanUtils.copyProperties(vo, comCorrectPopulationDO); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } String cardNoAES = populationDO.getCardNo(); try { cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); }catch (Exception e){ log.error("身份证加密失败"); } - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setActId(communityId); populationDO.setCardNo(cardNoAES); - comCorrectPopulationDO.setCardNo(cardNoAES); - comCorrectPopulationDAO.updateById(comCorrectPopulationDO); + populationDO.setUpdateBy(userId); + if (comCorrectPopulationDO != null) { + BeanUtils.copyProperties(vo, comCorrectPopulationDO); + comCorrectPopulationDO.setCardNo(cardNoAES); + comCorrectPopulationDAO.updateById(comCorrectPopulationDO); + }else { + comCorrectPopulationDO = new ComCorrectPopulationDO(); + BeanUtils.copyProperties(vo, comCorrectPopulationDO); + comCorrectPopulationDO.setId(Snowflake.getId()); + comCorrectPopulationDO.setPopulationId(populationDO.getId()); + comCorrectPopulationDO.setCommunityId(populationDO.getActId()); + comCorrectPopulationDO.setStreetId(populationDO.getStreetId()); + comCorrectPopulationDAO.insert(comCorrectPopulationDO); + } return populationDO; } - private ComMngPopulationDO updateMajorPopulationDO(ComMngPopulationMajorExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){ + private ComMngPopulationDO updateMajorPopulationDO(ComMngPopulationMajorExcelVO vo, ComMngPopulationDO populationDO,Long communityId, Long userId){ BeanUtils.copyProperties(vo, populationDO); ComMajorPopulationDO comMajorPopulationDO = comMajorPopulationDAO.selectOne(new QueryWrapper<ComMajorPopulationDO>().lambda() .eq(ComMajorPopulationDO::getPopulationId, populationDO.getId())); - BeanUtils.copyProperties(vo, comMajorPopulationDO); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } String cardNoAES = populationDO.getCardNo(); try { cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); }catch (Exception e){ log.error("身份证加密失败"); } - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setActId(communityId); populationDO.setCardNo(cardNoAES); - comMajorPopulationDO.setCardNo(cardNoAES); - comMajorPopulationDAO.updateById(comMajorPopulationDO); + populationDO.setUpdateBy(userId); + if (comMajorPopulationDO != null) { + BeanUtils.copyProperties(vo, comMajorPopulationDO); + comMajorPopulationDO.setCardNo(cardNoAES); + comMajorPopulationDAO.updateById(comMajorPopulationDO); + }else { + comMajorPopulationDO = new ComMajorPopulationDO(); + BeanUtils.copyProperties(vo, comMajorPopulationDO); + comMajorPopulationDO.setId(Snowflake.getId()); + comMajorPopulationDO.setPopulationId(populationDO.getId()); + comMajorPopulationDO.setCommunityId(populationDO.getActId()); + comMajorPopulationDO.setStreetId(populationDO.getStreetId()); + comMajorPopulationDAO.insert(comMajorPopulationDO); + } return populationDO; } - private ComMngPopulationDO updateCultPopulationDO(ComMngPopulationCultExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){ + private ComMngPopulationDO updateCultPopulationDO(ComMngPopulationCultExcelVO vo, ComMngPopulationDO populationDO,Long communityId, Long userId){ BeanUtils.copyProperties(vo, populationDO); ComCultPopulationDO comCultPopulationDO = comCultPopulationDAO.selectOne(new QueryWrapper<ComCultPopulationDO>().lambda(). eq(ComCultPopulationDO::getPopulationId, populationDO.getId())); - BeanUtils.copyProperties(vo, comCultPopulationDO); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } String cardNoAES = populationDO.getCardNo(); try { cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); }catch (Exception e){ log.error("身份证加密失败"); } - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setActId(communityId); populationDO.setCardNo(cardNoAES); - comCultPopulationDO.setCardNo(cardNoAES); - comCultPopulationDAO.updateById(comCultPopulationDO); + populationDO.setUpdateBy(userId); + if (comCultPopulationDO != null) { + BeanUtils.copyProperties(vo, comCultPopulationDO); + comCultPopulationDO.setCardNo(cardNoAES); + comCultPopulationDAO.updateById(comCultPopulationDO); + }else { + comCultPopulationDO = new ComCultPopulationDO(); + BeanUtils.copyProperties(vo, comCultPopulationDO); + comCultPopulationDO.setId(Snowflake.getId()); + comCultPopulationDO.setPopulationId(populationDO.getId()); + comCultPopulationDO.setCommunityId(populationDO.getActId()); + comCultPopulationDO.setStreetId(populationDO.getStreetId()); + comCultPopulationDAO.insert(comCultPopulationDO); + } return populationDO; } - private ComMngPopulationDO updateRehabilitationPopulationDO(ComMngPopulationRehabilitationExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){ + private ComMngPopulationDO updateRehabilitationPopulationDO(ComMngPopulationRehabilitationExcelVO vo, ComMngPopulationDO populationDO,Long communityId, Long userId){ BeanUtils.copyProperties(vo, populationDO); ComRehabilitationPopulationDO comRehabilitationPopulationDO = comRehabilitationPopulationDAO.selectOne(new QueryWrapper<ComRehabilitationPopulationDO>().lambda(). eq(ComRehabilitationPopulationDO::getPopulationId, populationDO.getId())); - BeanUtils.copyProperties(vo, comRehabilitationPopulationDO); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } String cardNoAES = populationDO.getCardNo(); try { cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); }catch (Exception e){ log.error("身份证加密失败"); } - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setActId(communityId); populationDO.setCardNo(cardNoAES); - comRehabilitationPopulationDO.setCardNo(cardNoAES); - comRehabilitationPopulationDAO.updateById(comRehabilitationPopulationDO); + populationDO.setUpdateBy(userId); + if (comRehabilitationPopulationDO != null) { + BeanUtils.copyProperties(vo, comRehabilitationPopulationDO); + comRehabilitationPopulationDO.setCardNo(cardNoAES); + comRehabilitationPopulationDAO.updateById(comRehabilitationPopulationDO); + }else { + comRehabilitationPopulationDO = new ComRehabilitationPopulationDO(); + BeanUtils.copyProperties(vo, comRehabilitationPopulationDO); + comRehabilitationPopulationDO.setId(Snowflake.getId()); + comRehabilitationPopulationDO.setPopulationId(populationDO.getId()); + comRehabilitationPopulationDO.setCommunityId(populationDO.getActId()); + comRehabilitationPopulationDO.setStreetId(populationDO.getStreetId()); + comRehabilitationPopulationDAO.insert(comRehabilitationPopulationDO); + } + return populationDO; } - private ComMngPopulationDO updateKeyPopulationDO(ComMngPopulationKeyExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){ + private ComMngPopulationDO updateKeyPopulationDO(ComMngPopulationKeyExcelVO vo, ComMngPopulationDO populationDO,Long communityId, Long userId){ BeanUtils.copyProperties(vo, populationDO); ComKeyPopulationDO comKeyPopulationDO = comKeyPopulationDAO.selectOne(new QueryWrapper<ComKeyPopulationDO>().lambda(). eq(ComKeyPopulationDO::getPopulationId, populationDO.getId())); - BeanUtils.copyProperties(vo, comKeyPopulationDO); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } String cardNoAES = populationDO.getCardNo(); try { cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); }catch (Exception e){ log.error("身份证加密失败"); } - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setActId(communityId); populationDO.setCardNo(cardNoAES); - comKeyPopulationDO.setCardNo(cardNoAES); - comKeyPopulationDAO.updateById(comKeyPopulationDO); + populationDO.setUpdateBy(userId); + if (comKeyPopulationDO != null) { + BeanUtils.copyProperties(vo, comKeyPopulationDO); + comKeyPopulationDO.setCardNo(cardNoAES); + comKeyPopulationDAO.updateById(comKeyPopulationDO); + }else { + comKeyPopulationDO = new ComKeyPopulationDO(); + BeanUtils.copyProperties(vo, comKeyPopulationDO); + comKeyPopulationDO.setId(Snowflake.getId()); + comKeyPopulationDO.setPopulationId(populationDO.getId()); + comKeyPopulationDO.setCommunityId(populationDO.getActId()); + comKeyPopulationDO.setStreetId(populationDO.getStreetId()); + comKeyPopulationDAO.insert(comKeyPopulationDO); + } return populationDO; } - private ComMngPopulationDO updateSentencePopulationDO(ComMngPopulationSentenceExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){ + private ComMngPopulationDO updateSentencePopulationDO(ComMngPopulationSentenceExcelVO vo, ComMngPopulationDO populationDO,Long communityId, Long userId){ BeanUtils.copyProperties(vo, populationDO); ComSentencePopulationDO comSentencePopulationDO = comSentencePopulationDAO.selectOne(new QueryWrapper<ComSentencePopulationDO>().lambda(). eq(ComSentencePopulationDO::getPopulationId, populationDO.getId())); - BeanUtils.copyProperties(vo, comSentencePopulationDO); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } String cardNoAES = populationDO.getCardNo(); try { cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); }catch (Exception e){ log.error("身份证加密失败"); } - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setActId(communityId); populationDO.setCardNo(cardNoAES); - comSentencePopulationDO.setCardNo(cardNoAES); - comSentencePopulationDAO.updateById(comSentencePopulationDO); + populationDO.setUpdateBy(userId); + if (comSentencePopulationDO != null) { + BeanUtils.copyProperties(vo, comSentencePopulationDO); + comSentencePopulationDO.setCardNo(cardNoAES); + comSentencePopulationDAO.updateById(comSentencePopulationDO); + }else { + comSentencePopulationDO = new ComSentencePopulationDO(); + BeanUtils.copyProperties(vo, comSentencePopulationDO); + comSentencePopulationDO.setId(Snowflake.getId()); + comSentencePopulationDO.setPopulationId(populationDO.getId()); + comSentencePopulationDO.setCommunityId(populationDO.getActId()); + comSentencePopulationDO.setStreetId(populationDO.getStreetId()); + comSentencePopulationDAO.insert(comSentencePopulationDO); + } return populationDO; } - private ComMngPopulationDO updateVeteransPopulationDO(ComMngPopulationVeteransExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){ + private ComMngPopulationDO updateVeteransPopulationDO(ComMngPopulationVeteransExcelVO vo, ComMngPopulationDO populationDO,Long communityId, Long userId){ BeanUtils.copyProperties(vo, populationDO); ComVeteransPopulationDO comVeteransPopulationDO = comVeteransPopulationDAO.selectOne(new QueryWrapper<ComVeteransPopulationDO>().lambda(). eq(ComVeteransPopulationDO::getPopulationId, populationDO.getId())); - BeanUtils.copyProperties(vo, comVeteransPopulationDO); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } String cardNoAES = populationDO.getCardNo(); try { cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); }catch (Exception e){ log.error("身份证加密失败"); } - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setActId(communityId); populationDO.setCardNo(cardNoAES); - comVeteransPopulationDO.setCardNo(cardNoAES); - comVeteransPopulationDAO.updateById(comVeteransPopulationDO); + populationDO.setUpdateBy(userId); + if (comVeteransPopulationDO != null) { + BeanUtils.copyProperties(vo, comVeteransPopulationDO); + comVeteransPopulationDO.setCardNo(cardNoAES); + comVeteransPopulationDAO.updateById(comVeteransPopulationDO); + }else { + comVeteransPopulationDO = new ComVeteransPopulationDO(); + BeanUtils.copyProperties(vo, comVeteransPopulationDO); + comVeteransPopulationDO.setId(Snowflake.getId()); + comVeteransPopulationDO.setPopulationId(populationDO.getId()); + comVeteransPopulationDO.setCommunityId(populationDO.getActId()); + comVeteransPopulationDO.setStreetId(populationDO.getStreetId()); + comVeteransPopulationDAO.insert(comVeteransPopulationDO); + } return populationDO; } - private ComMngPopulationDO updateDisabilityPopulationDO(ComMngPopulationDisabilityExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){ + private ComMngPopulationDO updateDisabilityPopulationDO(ComMngPopulationDisabilityExcelVO vo, ComMngPopulationDO populationDO,Long communityId, Long userId){ BeanUtils.copyProperties(vo, populationDO); ComDisabilityPopulationDO comDisabilityPopulationDO = comDisabilityPopulationDAO.selectOne(new QueryWrapper<ComDisabilityPopulationDO>().lambda(). eq(ComDisabilityPopulationDO::getPopulationId, populationDO.getId())); - BeanUtils.copyProperties(vo, comDisabilityPopulationDO); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } String cardNoAES = populationDO.getCardNo(); try { cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); }catch (Exception e){ log.error("身份证加密失败"); } - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setActId(communityId); populationDO.setCardNo(cardNoAES); - comDisabilityPopulationDO.setCardNo(cardNoAES); - comDisabilityPopulationDAO.updateById(comDisabilityPopulationDO); + populationDO.setUpdateBy(userId); + if (comDisabilityPopulationDO != null) { + BeanUtils.copyProperties(vo, comDisabilityPopulationDO); + comDisabilityPopulationDO.setCardNo(cardNoAES); + comDisabilityPopulationDAO.updateById(comDisabilityPopulationDO); + }else { + comDisabilityPopulationDO = new ComDisabilityPopulationDO(); + BeanUtils.copyProperties(vo, comDisabilityPopulationDO); + comDisabilityPopulationDO.setId(Snowflake.getId()); + comDisabilityPopulationDO.setPopulationId(populationDO.getId()); + comDisabilityPopulationDO.setCommunityId(populationDO.getActId()); + comDisabilityPopulationDO.setStreetId(populationDO.getStreetId()); + comDisabilityPopulationDAO.insert(comDisabilityPopulationDO); + } return populationDO; } - private ComMngPopulationDO updateLowSecurityPopulationDO(ComMngPopulationLowSecurityExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){ + private ComMngPopulationDO updateLowSecurityPopulationDO(ComMngPopulationLowSecurityExcelVO vo, ComMngPopulationDO populationDO,Long communityId, Long userId){ BeanUtils.copyProperties(vo, populationDO); ComLowSecurityPopulationDO comLowSecurityPopulationDO = comLowSecurityPopulationDAO.selectOne(new QueryWrapper<ComLowSecurityPopulationDO>().lambda(). eq(ComLowSecurityPopulationDO::getPopulationId, populationDO.getId())); - BeanUtils.copyProperties(vo, comLowSecurityPopulationDO); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } String cardNoAES = populationDO.getCardNo(); try { cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); }catch (Exception e){ log.error("身份证加密失败"); } - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); + populationDO.setActId(communityId); populationDO.setCardNo(cardNoAES); - comLowSecurityPopulationDO.setCardNo(cardNoAES); - comLowSecurityPopulationDAO.updateById(comLowSecurityPopulationDO); + populationDO.setUpdateBy(userId); + if (comLowSecurityPopulationDO != null) { + BeanUtils.copyProperties(vo, comLowSecurityPopulationDO); + comLowSecurityPopulationDO.setCardNo(cardNoAES); + comLowSecurityPopulationDAO.updateById(comLowSecurityPopulationDO); + }else { + comLowSecurityPopulationDO = new ComLowSecurityPopulationDO(); + BeanUtils.copyProperties(vo, comLowSecurityPopulationDO); + comLowSecurityPopulationDO.setId(Snowflake.getId()); + comLowSecurityPopulationDO.setPopulationId(populationDO.getId()); + comLowSecurityPopulationDO.setCommunityId(populationDO.getActId()); + comLowSecurityPopulationDO.setStreetId(populationDO.getStreetId()); + comLowSecurityPopulationDAO.insert(comLowSecurityPopulationDO); + } return populationDO; } - private ComMngPopulationDO savePopulationDO(ComMngPopulationServeExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) { + private ComMngPopulationDO savePopulationDO(ComMngPopulationServeExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO, Long userId) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); BeanUtils.copyProperties(vo, populationDO); populationDO.setId(Snowflake.getId()); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } populationDO.setVillageId(comMngVillageDO.getVillageId()); populationDO.setActId(comActDO.getCommunityId()); populationDO.setStreetId(comActDO.getStreetId()); - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setVillageName(comMngVillageDO.getGroupAt()); populationDO.setCardNoStr(vo.getCardNo()); populationDO.setUpdateAt(new Date()); @@ -3183,6 +4053,7 @@ log.error("身份证加密失败"); } populationDO.setCardNo(cardNoAES); + populationDO.setCreateBy(userId); //新增的时候默认绑定房屋id // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { @@ -3195,7 +4066,7 @@ return populationDO; } - private ComMngPopulationDO saveDrugPopulationDO(ComMngPopulationDrugExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) { + private ComMngPopulationDO saveDrugPopulationDO(ComMngPopulationDrugExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,Long userId) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); BeanUtils.copyProperties(vo, populationDO); ComDrugPopulationDO comDrugPopulationDO = new ComDrugPopulationDO(); @@ -3203,19 +4074,19 @@ Long populationId = Snowflake.getId(); populationDO.setId(populationId); comDrugPopulationDO.setPopulationId(populationId); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } populationDO.setVillageId(comMngVillageDO.getVillageId()); populationDO.setActId(comActDO.getCommunityId()); populationDO.setStreetId(comActDO.getStreetId()); - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setVillageName(comMngVillageDO.getGroupAt()); populationDO.setCardNoStr(vo.getCardNo()); populationDO.setUpdateAt(new Date()); @@ -3227,6 +4098,7 @@ log.error("身份证加密失败"); } populationDO.setCardNo(cardNoAES); + populationDO.setCreateBy(userId); //新增的时候默认绑定房屋id // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { @@ -3243,7 +4115,7 @@ return populationDO; } - private ComMngPopulationDO saveCorrectPopulationDO(ComMngPopulationCorrectExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) { + private ComMngPopulationDO saveCorrectPopulationDO(ComMngPopulationCorrectExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,Long userId) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); BeanUtils.copyProperties(vo, populationDO); ComCorrectPopulationDO comCorrectPopulationDO = new ComCorrectPopulationDO(); @@ -3251,19 +4123,19 @@ Long populationId = Snowflake.getId(); populationDO.setId(populationId); comCorrectPopulationDO.setPopulationId(populationId); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } populationDO.setVillageId(comMngVillageDO.getVillageId()); populationDO.setActId(comActDO.getCommunityId()); populationDO.setStreetId(comActDO.getStreetId()); - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setVillageName(comMngVillageDO.getGroupAt()); populationDO.setCardNoStr(vo.getCardNo()); populationDO.setUpdateAt(new Date()); @@ -3275,6 +4147,7 @@ log.error("身份证加密失败"); } populationDO.setCardNo(cardNoAES); + populationDO.setCreateBy(userId); //新增的时候默认绑定房屋id // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { @@ -3291,7 +4164,7 @@ return populationDO; } - private ComMngPopulationDO saveMajorPopulationDO(ComMngPopulationMajorExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) { + private ComMngPopulationDO saveMajorPopulationDO(ComMngPopulationMajorExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,Long userId) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); BeanUtils.copyProperties(vo, populationDO); ComMajorPopulationDO comMajorPopulationDO = new ComMajorPopulationDO(); @@ -3299,19 +4172,19 @@ Long populationId = Snowflake.getId(); populationDO.setId(populationId); comMajorPopulationDO.setPopulationId(populationId); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } populationDO.setVillageId(comMngVillageDO.getVillageId()); populationDO.setActId(comActDO.getCommunityId()); populationDO.setStreetId(comActDO.getStreetId()); - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setVillageName(comMngVillageDO.getGroupAt()); populationDO.setCardNoStr(vo.getCardNo()); populationDO.setUpdateAt(new Date()); @@ -3323,6 +4196,7 @@ log.error("身份证加密失败"); } populationDO.setCardNo(cardNoAES); + populationDO.setCreateBy(userId); //新增的时候默认绑定房屋id // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { @@ -3339,7 +4213,7 @@ return populationDO; } - private ComMngPopulationDO saveCultPopulationDO(ComMngPopulationCultExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) { + private ComMngPopulationDO saveCultPopulationDO(ComMngPopulationCultExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,Long userId) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); BeanUtils.copyProperties(vo, populationDO); ComCultPopulationDO comCultPopulationDO = new ComCultPopulationDO(); @@ -3347,19 +4221,19 @@ Long populationId = Snowflake.getId(); populationDO.setId(populationId); comCultPopulationDO.setPopulationId(populationId); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } populationDO.setVillageId(comMngVillageDO.getVillageId()); populationDO.setActId(comActDO.getCommunityId()); populationDO.setStreetId(comActDO.getStreetId()); - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setVillageName(comMngVillageDO.getGroupAt()); populationDO.setCardNoStr(vo.getCardNo()); populationDO.setUpdateAt(new Date()); @@ -3371,6 +4245,7 @@ log.error("身份证加密失败"); } populationDO.setCardNo(cardNoAES); + populationDO.setCreateBy(userId); //新增的时候默认绑定房屋id // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { @@ -3387,7 +4262,7 @@ return populationDO; } - private ComMngPopulationDO saveRehabilitationPopulationDO(ComMngPopulationRehabilitationExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) { + private ComMngPopulationDO saveRehabilitationPopulationDO(ComMngPopulationRehabilitationExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,Long userId) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); BeanUtils.copyProperties(vo, populationDO); ComRehabilitationPopulationDO comRehabilitationPopulationDO = new ComRehabilitationPopulationDO(); @@ -3395,19 +4270,19 @@ Long populationId = Snowflake.getId(); populationDO.setId(populationId); comRehabilitationPopulationDO.setPopulationId(populationId); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } populationDO.setVillageId(comMngVillageDO.getVillageId()); populationDO.setActId(comActDO.getCommunityId()); populationDO.setStreetId(comActDO.getStreetId()); - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setVillageName(comMngVillageDO.getGroupAt()); populationDO.setCardNoStr(vo.getCardNo()); populationDO.setUpdateAt(new Date()); @@ -3419,6 +4294,7 @@ log.error("身份证加密失败"); } populationDO.setCardNo(cardNoAES); + populationDO.setCreateBy(userId); //新增的时候默认绑定房屋id // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { @@ -3435,7 +4311,7 @@ return populationDO; } - private ComMngPopulationDO saveKeyPopulationDO(ComMngPopulationKeyExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) { + private ComMngPopulationDO saveKeyPopulationDO(ComMngPopulationKeyExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,Long userId) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); BeanUtils.copyProperties(vo, populationDO); ComKeyPopulationDO comKeyPopulationDO = new ComKeyPopulationDO(); @@ -3443,19 +4319,19 @@ Long populationId = Snowflake.getId(); populationDO.setId(populationId); comKeyPopulationDO.setPopulationId(populationId); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } populationDO.setVillageId(comMngVillageDO.getVillageId()); populationDO.setActId(comActDO.getCommunityId()); populationDO.setStreetId(comActDO.getStreetId()); - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setVillageName(comMngVillageDO.getGroupAt()); populationDO.setCardNoStr(vo.getCardNo()); populationDO.setUpdateAt(new Date()); @@ -3467,6 +4343,7 @@ log.error("身份证加密失败"); } populationDO.setCardNo(cardNoAES); + populationDO.setCreateBy(userId); //新增的时候默认绑定房屋id // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { @@ -3483,7 +4360,7 @@ return populationDO; } - private ComMngPopulationDO saveSentencePopulationDO(ComMngPopulationSentenceExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) { + private ComMngPopulationDO saveSentencePopulationDO(ComMngPopulationSentenceExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,Long userId) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); BeanUtils.copyProperties(vo, populationDO); ComSentencePopulationDO comSentencePopulationDO = new ComSentencePopulationDO(); @@ -3491,19 +4368,19 @@ Long populationId = Snowflake.getId(); populationDO.setId(populationId); comSentencePopulationDO.setPopulationId(populationId); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } populationDO.setVillageId(comMngVillageDO.getVillageId()); populationDO.setActId(comActDO.getCommunityId()); populationDO.setStreetId(comActDO.getStreetId()); - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setVillageName(comMngVillageDO.getGroupAt()); populationDO.setCardNoStr(vo.getCardNo()); populationDO.setUpdateAt(new Date()); @@ -3515,6 +4392,7 @@ log.error("身份证加密失败"); } populationDO.setCardNo(cardNoAES); + populationDO.setCreateBy(userId); //新增的时候默认绑定房屋id // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { @@ -3531,7 +4409,7 @@ return populationDO; } - private ComMngPopulationDO saveVeteransPopulationDO(ComMngPopulationVeteransExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) { + private ComMngPopulationDO saveVeteransPopulationDO(ComMngPopulationVeteransExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,Long userId) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); BeanUtils.copyProperties(vo, populationDO); ComVeteransPopulationDO comVeteransPopulationDO = new ComVeteransPopulationDO(); @@ -3539,19 +4417,19 @@ Long populationId = Snowflake.getId(); populationDO.setId(populationId); comVeteransPopulationDO.setPopulationId(populationId); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } populationDO.setVillageId(comMngVillageDO.getVillageId()); populationDO.setActId(comActDO.getCommunityId()); populationDO.setStreetId(comActDO.getStreetId()); - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setVillageName(comMngVillageDO.getGroupAt()); populationDO.setCardNoStr(vo.getCardNo()); populationDO.setUpdateAt(new Date()); @@ -3563,6 +4441,7 @@ log.error("身份证加密失败"); } populationDO.setCardNo(cardNoAES); + populationDO.setCreateBy(userId); //新增的时候默认绑定房屋id // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { @@ -3579,7 +4458,7 @@ return populationDO; } - private ComMngPopulationDO saveDisabilityPopulationDO(ComMngPopulationDisabilityExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) { + private ComMngPopulationDO saveDisabilityPopulationDO(ComMngPopulationDisabilityExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,Long userId) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); BeanUtils.copyProperties(vo, populationDO); ComDisabilityPopulationDO comDisabilityPopulationDO = new ComDisabilityPopulationDO(); @@ -3587,19 +4466,19 @@ Long populationId = Snowflake.getId(); populationDO.setId(populationId); comDisabilityPopulationDO.setPopulationId(populationId); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } populationDO.setVillageId(comMngVillageDO.getVillageId()); populationDO.setActId(comActDO.getCommunityId()); populationDO.setStreetId(comActDO.getStreetId()); - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setVillageName(comMngVillageDO.getGroupAt()); populationDO.setCardNoStr(vo.getCardNo()); populationDO.setUpdateAt(new Date()); @@ -3611,6 +4490,7 @@ log.error("身份证加密失败"); } populationDO.setCardNo(cardNoAES); + populationDO.setCreateBy(userId); //新增的时候默认绑定房屋id // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { @@ -3627,7 +4507,7 @@ return populationDO; } - private ComMngPopulationDO saveLowSecurityPopulationDO(ComMngPopulationLowSecurityExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) { + private ComMngPopulationDO saveLowSecurityPopulationDO(ComMngPopulationLowSecurityExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,Long userId) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); ComLowSecurityPopulationDO comLowSecurityPopulationDO = new ComLowSecurityPopulationDO(); BeanUtils.copyProperties(vo, populationDO); @@ -3635,19 +4515,19 @@ Long populationId = Snowflake.getId(); populationDO.setId(populationId); comLowSecurityPopulationDO.setPopulationId(populationId); - List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); - - //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 - Iterator<String> iterator = userTag.iterator(); - while (iterator.hasNext()) { - String s = iterator.next(); - if (!labelList.contains(s)) - iterator.remove(); - } +// List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); +// +// //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除 +// Iterator<String> iterator = userTag.iterator(); +// while (iterator.hasNext()) { +// String s = iterator.next(); +// if (!labelList.contains(s)) +// iterator.remove(); +// } populationDO.setVillageId(comMngVillageDO.getVillageId()); populationDO.setActId(comActDO.getCommunityId()); populationDO.setStreetId(comActDO.getStreetId()); - populationDO.setLabel(Joiner.on(",").join(userTag)); +// populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setVillageName(comMngVillageDO.getGroupAt()); populationDO.setCardNoStr(vo.getCardNo()); populationDO.setUpdateAt(new Date()); @@ -3659,6 +4539,7 @@ log.error("身份证加密失败"); } populationDO.setCardNo(cardNoAES); + populationDO.setCreateBy(userId); //新增的时候默认绑定房屋id // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { @@ -4463,7 +5344,8 @@ } } else { //新增 - Integer count = comMngUserTagDAO.selectCount(new QueryWrapper<ComMngUserTagDO>().lambda().eq(ComMngUserTagDO::getTagName, comMngTagVO.getTagName())); + Integer count = comMngUserTagDAO.selectCount(new QueryWrapper<ComMngUserTagDO>().lambda().eq(ComMngUserTagDO::getTagName, comMngTagVO.getTagName()) + .eq(ComMngUserTagDO::getCommunityId, comMngTagVO.getCommunityId())); if (count > 0) { return R.fail("该标签已存在,标签名称重复"); } -- Gitblit v1.7.1