From 70d2a5d0f9c6951b2d4cac954041ed73582ff7eb Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期一, 09 六月 2025 11:54:00 +0800
Subject: [PATCH] 6.9新增登录失败冻结逻辑

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialOrgServiceImpl.java |   56 +++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 47 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 ecdd5fd..a55482d 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,8 +8,11 @@
 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.dao.ComActDAO;
+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.model.dos.ComActDO;
 import com.panzhihua.service_community.service.ComActSocialOrgService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
@@ -31,6 +34,8 @@
 private ComActSocialOrgDao comActSocialOrgDao;
 @Resource
 private UserService userService;
+@Resource
+private ComActDAO comActDAO;
     @Override
     public R pageList(CommonPage commonPage) {
         return R.ok(comActSocialOrgDao.pageList(new Page(commonPage.getPage(),commonPage.getSize()),commonPage));
@@ -38,7 +43,7 @@
 
     @Override
     public R selectById(Long id) {
-        return null;
+        return R.ok(comActSocialOrgDao.detail(id));
     }
 
     @Override
@@ -51,9 +56,28 @@
             administratorsUserVO.setType(3);
             administratorsUserVO.setAccount(comActSocialOrgVO.getAccount());
             administratorsUserVO.setPassword(comActSocialOrgVO.getPassword());
-            administratorsUserVO.setRoleId(comActSocialOrgVO.getRoleId());
-            administratorsUserVO.setCommunityId(comActSocialOrg.getCommunityId());
-            administratorsUserVO.setName(comActSocialOrgVO.getContactName());
+            //根据roleId判断是普通社会组织还是定制三社
+            if(comActSocialOrgVO.getRoleId()==null){
+                administratorsUserVO.setSocialType(2);
+                administratorsUserVO.setRoleId(777777777L);
+                comActSocialOrg.setIsSociety(1);
+                Long affiliatedUnit = comActSocialOrg.getAffiliatedUnit();
+                Integer affiliatedUnitType = comActSocialOrg.getAffiliatedUnitType();
+                if (affiliatedUnitType.equals(2)) {
+                    administratorsUserVO.setCommunityId(affiliatedUnit);
+                    ComActDO comActDO = comActDAO.selectById(affiliatedUnit);
+                    comActSocialOrg.setStreetId(comActDO.getStreetId());
+                }
+                administratorsUserVO.setName(comActSocialOrgVO.getCorporationName());
+            } else {
+                administratorsUserVO.setRoleId(comActSocialOrgVO.getRoleId());
+                if(comActSocialOrg.getCommunityId()!=null){
+                    administratorsUserVO.setCommunityId(comActSocialOrg.getCommunityId());
+                    ComActDO comActDO = comActDAO.selectById(comActSocialOrg.getCommunityId());
+                    comActSocialOrg.setStreetId(comActDO.getStreetId());
+                }
+                administratorsUserVO.setName(comActSocialOrgVO.getContactName());
+            }
             administratorsUserVO.setPhone(comActSocialOrgVO.getContactPhone());
             R r=userService.addUserBackstageProperty(administratorsUserVO);
             if(R.isOk(r)){
@@ -62,7 +86,7 @@
                 this.comActSocialOrgDao.insert(comActSocialOrg);
                 return R.ok();
             }
-            return R.fail(r.getMsg());
+            return R.fail("账号或手机号已存在");
         }
         return R.fail();
     }
@@ -70,10 +94,24 @@
     @Override
     public R update(ComActSocialOrgVO comActSocialOrgVO) {
         if(comActSocialOrgVO!=null){
-               ComActSocialOrg comActSocialOrg=new ComActSocialOrg();
-               BeanUtils.copyProperties(comActSocialOrgVO,comActSocialOrg);
-               this.comActSocialOrgDao.updateById(comActSocialOrg);
-               return R.ok();
+            ComActSocialOrg comActSocialOrg=new ComActSocialOrg();
+            BeanUtils.copyProperties(comActSocialOrgVO,comActSocialOrg);
+            AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO();
+            if(comActSocialOrgVO.getRoleId() == null) {
+                administratorsUserVO.setRoleId(777777777L);
+            } else {
+                administratorsUserVO.setRoleId(comActSocialOrgVO.getRoleId());
+            }
+            ComActSocialOrg comPropertyBase=this.comActSocialOrgDao.selectById(comActSocialOrgVO.getId());
+            administratorsUserVO.setUserId(comPropertyBase.getUserId());
+            administratorsUserVO.setLastLoginTime(DateUtil.date());
+            administratorsUserVO.setAccount(comActSocialOrgVO.getAccount());
+            administratorsUserVO.setPassword(comActSocialOrgVO.getPassword());
+            Integer status = comActSocialOrgVO.getStatus();
+            administratorsUserVO.setStatus(status.equals(0) ? 2 : 1);
+            this.userService.putUserBackstage(administratorsUserVO);
+            this.comActSocialOrgDao.updateById(comActSocialOrg);
+            return R.ok();
         }
         return R.fail();
     }

--
Gitblit v1.7.1