From 757e5dc619ddf01fbd9ec2c8c75b6663d79835cb Mon Sep 17 00:00:00 2001
From: CeDo <cedoogle@gmail.com>
Date: 星期二, 11 五月 2021 14:10:55 +0800
Subject: [PATCH] Merge branch 'test'

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |   44 ++++++++++++++++++++++++++------------------
 1 files changed, 26 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..a1055c6 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
@@ -416,36 +416,44 @@
         if(populationDO==null){
             return R.fail();
         }
+        String cardNo = populationDO.getCardNo();
         BeanUtils.copyProperties(vo,populationDO);
         try {
             //TODO 修改拦截器时候需要维护加密操作
-             populationDO.setCardNo(AESUtil.encrypt128(populationDO.getCardNo(), aesKey));
-             populationDO.setPhone(AESUtil.encrypt128(populationDO.getPhone(), aesKey));
-
-        } catch (NoSuchPaddingException e) {
+            if(!cardNo.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));
+            }else{
+                populationDO.setCardNo(AESUtil.encrypt128(cardNo, 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