From 2e64c232ab6b51b2cecf1ee96e1e9b709234f326 Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期六, 21 八月 2021 16:35:14 +0800 Subject: [PATCH] 随手拍改版接口开发 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java | 171 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 140 insertions(+), 31 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..60f59a4 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 @@ -649,6 +649,12 @@ populationDO = (ComMngPopulationDO)populationMap.get(populationKey); ComMngPopulationDO updatePopulationDO = updatePopulationDO(vo,populationDO,labelList); updateList.add(updatePopulationDO); + + ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); + BeanUtils.copyProperties(vo,mistake); + setMistake(mistake, vo); + mistake.setMistake("该实有人口已存在,执行更新,社区id::"+ populationDO.getActId()); + mistakes.add(mistake); }else{ //不存在实有人口,则新增 populationDO = savePopulationDO(vo, populationActVO, comMngVillageDO,labelList); @@ -2900,7 +2906,6 @@ 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(); @@ -2917,8 +2922,20 @@ } populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setCardNo(cardNoAES); - comDrugPopulationDO.setCardNo(cardNoAES); - comDrugPopulationDAO.updateById(comDrugPopulationDO); + + 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; } @@ -2926,7 +2943,6 @@ 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(); @@ -2943,8 +2959,19 @@ } populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setCardNo(cardNoAES); - comCorrectPopulationDO.setCardNo(cardNoAES); - comCorrectPopulationDAO.updateById(comCorrectPopulationDO); + 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; } @@ -2952,7 +2979,6 @@ 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(); @@ -2969,8 +2995,19 @@ } populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setCardNo(cardNoAES); - comMajorPopulationDO.setCardNo(cardNoAES); - comMajorPopulationDAO.updateById(comMajorPopulationDO); + 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; } @@ -2978,7 +3015,6 @@ 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(); @@ -2995,8 +3031,19 @@ } populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setCardNo(cardNoAES); - comCultPopulationDO.setCardNo(cardNoAES); - comCultPopulationDAO.updateById(comCultPopulationDO); + 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; } @@ -3004,7 +3051,6 @@ 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(); @@ -3021,8 +3067,20 @@ } populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setCardNo(cardNoAES); - comRehabilitationPopulationDO.setCardNo(cardNoAES); - comRehabilitationPopulationDAO.updateById(comRehabilitationPopulationDO); + 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; } @@ -3030,7 +3088,6 @@ 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(); @@ -3047,8 +3104,19 @@ } populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setCardNo(cardNoAES); - comKeyPopulationDO.setCardNo(cardNoAES); - comKeyPopulationDAO.updateById(comKeyPopulationDO); + 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; } @@ -3056,7 +3124,6 @@ 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(); @@ -3073,8 +3140,19 @@ } populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setCardNo(cardNoAES); - comSentencePopulationDO.setCardNo(cardNoAES); - comSentencePopulationDAO.updateById(comSentencePopulationDO); + 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; } @@ -3082,7 +3160,6 @@ 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(); @@ -3099,15 +3176,25 @@ } populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setCardNo(cardNoAES); - comVeteransPopulationDO.setCardNo(cardNoAES); - comVeteransPopulationDAO.updateById(comVeteransPopulationDO); + 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){ 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(); @@ -3124,8 +3211,19 @@ } populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setCardNo(cardNoAES); - comDisabilityPopulationDO.setCardNo(cardNoAES); - comDisabilityPopulationDAO.updateById(comDisabilityPopulationDO); + 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; } @@ -3133,7 +3231,6 @@ 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(); @@ -3150,8 +3247,19 @@ } populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setCardNo(cardNoAES); - comLowSecurityPopulationDO.setCardNo(cardNoAES); - comLowSecurityPopulationDAO.updateById(comLowSecurityPopulationDO); + 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; } @@ -4463,7 +4571,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