From a07fbafbc973ac8d11df09afe1386681d00091a9 Mon Sep 17 00:00:00 2001
From: CeDo <cedoogle@gmail.com>
Date: 星期一, 31 五月 2021 18:16:02 +0800
Subject: [PATCH] update

---
 springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java |   37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
index 88209fa..ed7c464 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -585,7 +585,7 @@
     public R putUserCommunityArea(LoginUserInfoVO loginUserInfoVO) {
         SysUserDO sysUserDO = new SysUserDO();
         sysUserDO.setCommunityId(loginUserInfoVO.getCommunityId());
-        sysUserDO.setAreaId(loginUserInfoVO.getAreaId());
+//        sysUserDO.setAreaId(loginUserInfoVO.getAreaId());
         sysUserDO.setUserId(loginUserInfoVO.getUserId());
         int update = userDao.updateById(sysUserDO);
         if (update > 0) {
@@ -609,9 +609,13 @@
         String idCard = loginUserInfoVO.getIdCard();
         String name = loginUserInfoVO.getName();
         log.info("用户实名认证发送请求,姓名:" + name + "身份证号码:" + idCard);
-        boolean b = RealNameUtil.authentication(idCard, name);
-        if (!b) {
-            return R.fail("身份认证失败:请填写真实信息");
+        try {
+            boolean b = RealNameUtil.authentication(idCard, name);
+            if (!b) {
+                return R.fail("身份认证失败:请填写真实信息");
+            }
+        }catch (ServiceException serviceException){
+            return R.fail(serviceException.getMessage());
         }
         SysUserDO sysUserDO = new SysUserDO();
         sysUserDO.setName(name);
@@ -751,7 +755,7 @@
     @Override
     public R listFamily(Long userId,Long pageNum, Long pageSize) {
         List<ComMngFamilyInfoVO> comMngFamilyInfoVOS = new ArrayList<>();
-        LambdaQueryWrapper<ComMngFamilyInfoDO> query = new QueryWrapper<ComMngFamilyInfoDO>().lambda().eq(ComMngFamilyInfoDO::getUserId, userId);
+        LambdaQueryWrapper<ComMngFamilyInfoDO> query = new QueryWrapper<ComMngFamilyInfoDO>().lambda().eq(ComMngFamilyInfoDO::getUserId, userId).orderByDesc(ComMngFamilyInfoDO::getCreateAt);
         IPage<ComMngFamilyInfoDO> pageData = comMngFamilyInfoDAO.selectPage(new Page<>(pageNum,pageSize), query);
         if (!ObjectUtils.isEmpty(pageData.getRecords())) {
             pageData.getRecords().forEach(comMngFamilyInfoDO -> {
@@ -861,6 +865,29 @@
             }
 
         }
+
+        if(insert>0 && sysUserDO.getType()==3){//添加的用户是社区账号时
+            //添加网格综合治理管理后台用户
+            SysUserDO sysUserDOWangGe = new SysUserDO();
+            BeanUtils.copyProperties(sysUserDO, sysUserDOWangGe);
+            sysUserDOWangGe.setUserId(null);
+            sysUserDOWangGe.setType(7);//网格综治后台
+            try {
+                int addWange = userDao.insert(sysUserDOWangGe);
+                if(addWange!=1){
+                    throw new ServiceException("新增网格综合治理管理后台用户失败");
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("网格综合治理管理后台用户报错【{}】", e.getMessage());
+                if (e.getMessage().contains("union_phone_type")) {
+                    throw new ServiceException("手机号已经存在");
+                } else if (e.getMessage().contains("union_account_type")) {
+                    throw new ServiceException("账户已经存在");
+                }
+
+            }
+        }
         if (insert > 0) {
             SysUserDO sysUserDO1 = userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getType, administratorsUserVO.getType()).eq(SysUserDO::getAccount, administratorsUserVO.getAccount()));
             Long userId = sysUserDO1.getUserId();

--
Gitblit v1.7.1