From 5a8a90c095280fbd2106869ecd2bad10e01a57a6 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期四, 23 十二月 2021 18:10:22 +0800
Subject: [PATCH] 12/23  大屏修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialOrgServiceImpl.java |   40 +++++++++++++++++-----------------------
 1 files changed, 17 insertions(+), 23 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 cd66bcf..a5d580a 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;
@@ -52,6 +53,9 @@
             administratorsUserVO.setAccount(comActSocialOrgVO.getAccount());
             administratorsUserVO.setPassword(comActSocialOrgVO.getPassword());
             administratorsUserVO.setRoleId(comActSocialOrgVO.getRoleId());
+            administratorsUserVO.setCommunityId(comActSocialOrg.getCommunityId());
+            administratorsUserVO.setName(comActSocialOrgVO.getContactName());
+            administratorsUserVO.setPhone(comActSocialOrgVO.getContactPhone());
             R r=userService.addUserBackstageProperty(administratorsUserVO);
             if(R.isOk(r)){
                 comActSocialOrg.setUserId(Long.parseLong(r.getData().toString()));
@@ -59,34 +63,26 @@
                 this.comActSocialOrgDao.insert(comActSocialOrg);
                 return R.ok();
             }
+            return R.fail("账号或手机号已存在");
         }
         return R.fail();
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public R update(ComActSocialOrgVO comActSocialOrgVO) {
         if(comActSocialOrgVO!=null){
-           if(!comActSocialOrgVO.getAccount().isEmpty()||!comActSocialOrgVO.getPassword().isEmpty()){
-               AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO();
-               administratorsUserVO.setUserId(comActSocialOrgVO.getUserId());
-               administratorsUserVO.setAccount(comActSocialOrgVO.getAccount());
-               administratorsUserVO.setPassword(comActSocialOrgVO.getPassword());
-               R r=userService.putUserBackstage(administratorsUserVO);
-               if(R.isOk(r)){
-                   ComActSocialOrg comActSocialOrg=new ComActSocialOrg();
-                   BeanUtils.copyProperties(comActSocialOrgVO,comActSocialOrg);
-                   this.comActSocialOrgDao.updateById(comActSocialOrg);
-                   return R.ok();
-               }
-               return R.fail("账号密码修改失败");
-           }
-           else {
                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();
-           }
         }
         return R.fail();
     }
@@ -99,12 +95,10 @@
             if(comActSocialOrg.getUserId()!=null){
                 AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO();
                 administratorsUserVO.setUserId(comActSocialOrg.getUserId());
-                R r=userService.deleteUserBackstage(administratorsUserVO);
-                if(R.isOk(r)){
-                    this.comActSocialOrgDao.deleteById(id);
-                    return R.ok();
-                }
-                return R.fail("账号删除失败");
+                administratorsUserVO.setCommunityId(comActSocialOrg.getCommunityId());
+                userService.deleteUserBackstage(administratorsUserVO);
+                this.comActSocialOrgDao.deleteById(id);
+                return R.ok();
             }
         }
         return R.fail("用户账号错误");

--
Gitblit v1.7.1