From 8f918cb6db02c39e67ce7b0d77cc1be5ed26edaf Mon Sep 17 00:00:00 2001
From: jiaosong <jiaosong6760@dingtalk.com>
Date: 星期五, 25 八月 2023 11:03:28 +0800
Subject: [PATCH] # 企业端用户

---
 server/src/main/java/doumeemes/service/system/impl/WxLoginServiceImpl.java |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/server/src/main/java/doumeemes/service/system/impl/WxLoginServiceImpl.java b/server/src/main/java/doumeemes/service/system/impl/WxLoginServiceImpl.java
index 83c9733..d406e58 100644
--- a/server/src/main/java/doumeemes/service/system/impl/WxLoginServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/system/impl/WxLoginServiceImpl.java
@@ -11,6 +11,7 @@
 import doumeemes.core.utils.Constants;
 import doumeemes.core.utils.HttpsUtil;
 import doumeemes.core.utils.Utils;
+import doumeemes.dao.business.model.Company;
 import doumeemes.dao.business.model.CompanyUser;
 import doumeemes.dao.business.model.Department;
 import doumeemes.dao.ext.CompanyExtMapper;
@@ -18,6 +19,7 @@
 import doumeemes.dao.ext.DepartmentExtMapper;
 import doumeemes.dao.ext.dto.QueryCompanyUserExtDTO;
 import doumeemes.dao.ext.dto.WxLoginDTO;
+import doumeemes.dao.ext.dto.WxLoginOutDTO;
 import doumeemes.dao.ext.vo.CompanyUserExtListVO;
 import doumeemes.dao.ext.vo.WxLoginVO;
 import doumeemes.dao.system.SystemUserMapper;
@@ -69,6 +71,8 @@
 
     @Autowired
     private SystemLoginLogService systemLoginLogService;
+    @Autowired
+    private CompanyExtMapper companyExtMapper;
 
 
     /**
@@ -107,6 +111,11 @@
         if(Objects.isNull(department)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌缁戝畾閮ㄩ棬淇℃伅");
         }
+        Company company = companyExtMapper.selectById(department.getCompanyId());
+        if(Objects.isNull(company)||company.getStatus().equals(Constants.ZERO)){
+            wxLoginVO.setLoginStatus(Constants.ONE);
+            return wxLoginVO;
+        }
         SystemUser systemUser = systemUserMapper.selectById(companyUser.getUserId());
         //鏌ヨ鐢ㄦ埛鏁版嵁
         LoginDTO dto = new LoginDTO();
@@ -136,6 +145,9 @@
             String session = (String)subject.getSession().getId();
             wxLoginVO.setLoginStatus(Constants.ZERO);
             wxLoginVO.setSession(session);
+            return wxLoginVO;
+        }catch (BusinessException e) {
+            wxLoginVO.setLoginStatus(Constants.ONE);
             return wxLoginVO;
         }catch (AuthenticationException e) {
             BusinessException ee = null;
@@ -212,4 +224,14 @@
         }
     }
 
+    @Override
+    public void wxLoginOut(WxLoginOutDTO wxLoginOutDTO) {
+        if(!Objects.isNull(wxLoginOutDTO)&&!Objects.isNull(wxLoginOutDTO.getCompanyUserId())){
+            companyUserExtMapper.update(null,new UpdateWrapper<CompanyUser>()
+                    .set("UNIONID","").set("OPENID","")
+                    .eq("id",wxLoginOutDTO.getCompanyUserId())
+            );
+        }
+    }
+
 }

--
Gitblit v1.9.3