From 0e12120f342378ac6be7254ad11d98e243407e34 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期一, 10 五月 2021 13:41:54 +0800
Subject: [PATCH] 修改bug

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |   41 +++++++++++++++++++++++------------------
 1 files changed, 23 insertions(+), 18 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 27f2053..b224e35 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
@@ -419,33 +419,38 @@
         BeanUtils.copyProperties(vo,populationDO);
         try {
             //TODO 修改拦截器时候需要维护加密操作
-             populationDO.setCardNo(AESUtil.encrypt128(populationDO.getCardNo(), aesKey));
-             populationDO.setPhone(AESUtil.encrypt128(populationDO.getPhone(), aesKey));
-
-        } catch (NoSuchPaddingException e) {
+            if(!populationDO.getCardNo().equals(vo.getCardNo())){//判断是否修改身份证号码
+                //判断要修改的身份证号码是否已存在
+                ComMngPopulationDO cardNoDO = populationDAO.selectOne(new QueryWrapper<ComMngPopulationDO>()
+                        .lambda().eq(ComMngPopulationDO::getCardNo,vo.getCardNo()));
+                if(cardNoDO != null){
+                    return R.fail("您输入的身份证已存在,请重新输入");
+                }
+                populationDO.setCardNo(AESUtil.encrypt128(vo.getCardNo(), aesKey));
+                populationDO.setPhone(AESUtil.encrypt128(vo.getPhone(), aesKey));
+            }
+        } catch (Exception e) {
             e.printStackTrace();
-        } catch (NoSuchAlgorithmException e) {
-            e.printStackTrace();
-        } catch (InvalidKeyException e) {
-            e.printStackTrace();
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        } catch (BadPaddingException e) {
-            e.printStackTrace();
-        } catch (IllegalBlockSizeException e) {
-            e.printStackTrace();
+            return R.fail();
         }
 
         ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>().eq("alley",vo.getRoad()).eq("house_num",vo.getDoorNo()).eq("community_id",communityId));
         if (comMngVillageDO == null) {
-            throw new ServiceException("街道巷:" + vo.getRoad() + "不存在!");
+            return R.fail("街道巷:" + vo.getRoad() + vo.getDoorNo() + "不存在!");
+//            throw new ServiceException("街道巷:" + vo.getRoad() + "不存在!");
         }
         populationDO.setVillageId(comMngVillageDO.getVillageId());
         populationDO.setActId(comActDO.getCommunityId());
         populationDO.setStreetId(comActDO.getStreetId());
-        populationDO.setVillageName(comMngVillageDO.getGroupAt());
-        this.updateById(populationDO);
-        return R.ok();
+        if(!StringUtils.isEmpty(comMngVillageDO.getGroupAt())){
+            populationDO.setVillageName(comMngVillageDO.getGroupAt());
+        }
+//        this.updateById(populationDO);
+        if(populationDAO.updateById(populationDO) > 0){
+            return R.ok();
+        }else{
+            return R.fail("修改失败");
+        }
     }
 
     @Override

--
Gitblit v1.7.1