From 00a59b93c16b24e7be77c6f1ce4866c75a2e0431 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期二, 19 四月 2022 16:32:21 +0800
Subject: [PATCH] 花城E+防疫修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialOrgServiceImpl.java |   40 +++++++++++++++++++++++++++++++---------
 1 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialOrgServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialOrgServiceImpl.java
index 52a0420..ebee445 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialOrgServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialOrgServiceImpl.java
@@ -8,6 +8,7 @@
 import com.panzhihua.common.model.vos.community.ComActSocialOrgVO;
 import com.panzhihua.common.model.vos.user.AdministratorsUserVO;
 import com.panzhihua.common.service.user.UserService;
+import com.panzhihua.service_community.entity.ComActCommittee;
 import com.panzhihua.service_community.entity.ComActSocialOrg;
 import com.panzhihua.service_community.dao.ComActSocialOrgDao;
 import com.panzhihua.service_community.service.ComActSocialOrgService;
@@ -38,7 +39,7 @@
 
     @Override
     public R selectById(Long id) {
-        return null;
+        return R.ok(comActSocialOrgDao.detail(id));
     }
 
     @Override
@@ -51,8 +52,23 @@
             administratorsUserVO.setType(3);
             administratorsUserVO.setAccount(comActSocialOrgVO.getAccount());
             administratorsUserVO.setPassword(comActSocialOrgVO.getPassword());
-            administratorsUserVO.setRoleId(comActSocialOrgVO.getRoleId());
-            administratorsUserVO.setCommunityId(comActSocialOrg.getCommunityId());
+            //根据roleId判断是普通社会组织还是定制三社
+            if(comActSocialOrgVO.getRoleId()==null){
+                administratorsUserVO.setSocialType(2);
+                administratorsUserVO.setRoleId(777777777L);
+                comActSocialOrg.setIsSociety(1);
+            }
+            else {
+                administratorsUserVO.setRoleId(comActSocialOrgVO.getRoleId());
+            }
+            if(comActSocialOrg.getCommunityId()!=null){
+                administratorsUserVO.setCommunityId(comActSocialOrg.getCommunityId());
+            }
+            if(comActSocialOrg.getStreetId()!=null){
+                administratorsUserVO.setStreetId(comActSocialOrg.getStreetId());
+            }
+            administratorsUserVO.setName(comActSocialOrgVO.getContactName());
+            administratorsUserVO.setPhone(comActSocialOrgVO.getContactPhone());
             R r=userService.addUserBackstageProperty(administratorsUserVO);
             if(R.isOk(r)){
                 comActSocialOrg.setUserId(Long.parseLong(r.getData().toString()));
@@ -60,6 +76,7 @@
                 this.comActSocialOrgDao.insert(comActSocialOrg);
                 return R.ok();
             }
+            return R.fail("账号或手机号已存在");
         }
         return R.fail();
     }
@@ -69,6 +86,14 @@
         if(comActSocialOrgVO!=null){
                ComActSocialOrg comActSocialOrg=new ComActSocialOrg();
                BeanUtils.copyProperties(comActSocialOrgVO,comActSocialOrg);
+                if(comActSocialOrgVO.getRoleId()!=null){
+                    ComActSocialOrg comPropertyBase=this.comActSocialOrgDao.selectById(comActSocialOrgVO.getId());
+                    AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO();
+                    administratorsUserVO.setUserId(comPropertyBase.getUserId());
+                    administratorsUserVO.setRoleId(comActSocialOrgVO.getRoleId());
+                    administratorsUserVO.setLastLoginTime(DateUtil.date());
+                    this.userService.putUserBackstage(administratorsUserVO);
+                }
                this.comActSocialOrgDao.updateById(comActSocialOrg);
                return R.ok();
         }
@@ -84,12 +109,9 @@
                 AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO();
                 administratorsUserVO.setUserId(comActSocialOrg.getUserId());
                 administratorsUserVO.setCommunityId(comActSocialOrg.getCommunityId());
-                R r=userService.deleteUserBackstage(administratorsUserVO);
-                if(R.isOk(r)){
-                    this.comActSocialOrgDao.deleteById(id);
-                    return R.ok();
-                }
-                return R.fail("账号删除失败");
+                userService.deleteUserBackstage(administratorsUserVO);
+                this.comActSocialOrgDao.deleteById(id);
+                return R.ok();
             }
         }
         return R.fail("用户账号错误");

--
Gitblit v1.7.1