Parcourir la source

个微账号登录

吴树波 il y a 2 jours
Parent
commit
bc7c620989

+ 30 - 1
fs-company/src/main/java/com/fs/company/controller/company/CompanyWxAccountController.java

@@ -6,10 +6,13 @@ import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.domain.CompanyWxAccount;
 import com.fs.company.service.ICompanyWxAccountService;
+import com.fs.framework.security.LoginUser;
+import com.fs.framework.service.TokenService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -28,6 +31,8 @@ public class CompanyWxAccountController extends BaseController
 {
     @Autowired
     private ICompanyWxAccountService companyWxAccountService;
+    @Autowired
+    private TokenService tokenService;
 
     /**
      * 查询企微账号列表
@@ -111,6 +116,30 @@ public class CompanyWxAccountController extends BaseController
     @PreAuthorize("@ss.hasPermi('company:companyWx:list')")
 	@GetMapping("/companyListAll")
     public R companyListAll(){
-        return R.ok().put("data", companyWxAccountService.companyListAllCompany(new CompanyUser()));
+        CompanyUser companyUser = new CompanyUser();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        companyUser.setCompanyId(loginUser.getCompany().getCompanyId());
+        return R.ok().put("data", companyWxAccountService.companyListAllCompany(companyUser));
+    }
+    /**
+     * 删除企微账号
+     */
+	@GetMapping("/bindService")
+    public R bindService(Long accountId){
+        return companyWxAccountService.bindService(accountId);
+    }
+    /**
+     * 删除企微账号
+     */
+	@GetMapping("/getWxQrCode")
+    public R getWxQrCode(Long accountId, String ipadOrMac){
+        return R.ok().put("data", companyWxAccountService.getWxQrCode(accountId, ipadOrMac));
+    }
+    /**
+     * 删除企微账号
+     */
+	@GetMapping("/getLoginStatus")
+    public R getLoginStatus(Long accountId){
+        return R.ok().put("data", companyWxAccountService.getLoginStatus(accountId));
     }
 }

+ 21 - 0
fs-service/src/main/java/com/fs/company/domain/CompanyWxAccount.java

@@ -1,9 +1,12 @@
 package com.fs.company.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fs.common.annotation.Excel;
 import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
 
+import java.time.LocalDateTime;
+
 /**
  * 企微账号对象 company_wx_account
  * 
@@ -38,5 +41,23 @@ public class CompanyWxAccount extends BaseEntity
     @Excel(name = "创建人")
     private Long createUser;
 
+    // iPad地区ID
+    private Long addressId;
+    // 服务器ID
+    private Long serverId;
+    // 服务器绑定状态 0-未绑定 1-已绑定
+    private Integer serverStatus;
+    // 公司ID
+    private Long companyId;
+    // 授权码
+    private String authKey;
+    // 过期时间
+    private LocalDateTime authTime;
+    // 登录状态,0未登录1已登录
+    private Integer loginStatus;
+
+
+
+    @TableField(exist = false)
     private String companyUserName;
 }

+ 2 - 2
fs-service/src/main/java/com/fs/company/mapper/CompanyWxAccountMapper.java

@@ -1,5 +1,6 @@
 package com.fs.company.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.domain.CompanyWxAccount;
 import org.apache.ibatis.annotations.Param;
@@ -12,8 +13,7 @@ import java.util.List;
  * @author fs
  * @date 2024-12-09
  */
-public interface CompanyWxAccountMapper 
-{
+public interface CompanyWxAccountMapper extends BaseMapper<CompanyWxAccount> {
     /**
      * 查询企微账号
      * 

+ 9 - 2
fs-service/src/main/java/com/fs/company/service/ICompanyWxAccountService.java

@@ -1,9 +1,10 @@
 package com.fs.company.service;
 
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.common.core.domain.R;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.domain.CompanyWxAccount;
 
-import javax.validation.constraints.NotBlank;
 import java.util.List;
 
 /**
@@ -12,7 +13,7 @@ import java.util.List;
  * @author fs
  * @date 2024-12-09
  */
-public interface ICompanyWxAccountService 
+public interface ICompanyWxAccountService extends IService<CompanyWxAccount>
 {
     /**
      * 查询企微账号
@@ -67,4 +68,10 @@ public interface ICompanyWxAccountService
     List<CompanyUser> companyListAllCompany(CompanyUser companyUser);
 
     CompanyWxAccount selectByCompanyUserAndWxNo(Long userId, String wxNo);
+
+    String getWxQrCode(Long accountId, String ipadOrMac);
+
+    boolean getLoginStatus(Long accountId);
+
+    R bindService(Long accountId);
 }

+ 93 - 2
fs-service/src/main/java/com/fs/company/service/impl/CompanyWxServiceImpl.java

@@ -1,14 +1,27 @@
 package com.fs.company.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.common.annotation.DataScope;
+import com.fs.common.core.domain.R;
 import com.fs.common.utils.DateUtils;
+import com.fs.company.domain.Company;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.domain.CompanyWxAccount;
 import com.fs.company.mapper.CompanyWxAccountMapper;
+import com.fs.company.service.ICompanyService;
+import com.fs.company.service.ICompanyUserService;
 import com.fs.company.service.ICompanyWxAccountService;
+import com.fs.wxcid.domain.CidIpadServerUser;
+import com.fs.wxcid.dto.login.LoginStatusData;
+import com.fs.wxcid.service.AdminLicenseService;
+import com.fs.wxcid.service.ICidIpadServerService;
+import com.fs.wxcid.service.ICidIpadServerUserService;
+import com.fs.wxcid.service.impl.LoginServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -18,10 +31,21 @@ import java.util.List;
  * @date 2024-12-09
  */
 @Service
-public class CompanyWxServiceImpl implements ICompanyWxAccountService
-{
+public class CompanyWxServiceImpl extends ServiceImpl<CompanyWxAccountMapper, CompanyWxAccount> implements ICompanyWxAccountService {
     @Autowired
     private CompanyWxAccountMapper companyWxAccountMapper;
+    @Autowired
+    private LoginServiceImpl loginService;
+    @Autowired
+    private ICompanyService companyService;
+    @Autowired
+    private ICompanyUserService companyUserService;
+    @Autowired
+    private ICidIpadServerService cidIpadServerService;
+    @Autowired
+    private ICidIpadServerUserService cidIpadServerUserService;
+    @Autowired
+    private AdminLicenseService adminLicenseService;
 
     /**
      * 查询企微账号
@@ -117,4 +141,71 @@ public class CompanyWxServiceImpl implements ICompanyWxAccountService
     public CompanyWxAccount selectByCompanyUserAndWxNo(Long userId, String wxNo) {
         return companyWxAccountMapper.selectByCompanyUserAndWxNo(userId, wxNo);
     }
+
+    @Override
+    public String getWxQrCode(Long accountId, String ipadOrMac) {
+        CompanyWxAccount account = getById(accountId);
+        if(account.getAuthKey() == null){
+            String token = adminLicenseService.getToken(accountId);
+            account.setAuthKey(token);
+            updateById(account);
+        }
+        return loginService.getLoginQrCodeNewDirect(accountId, ipadOrMac);
+    }
+
+    @Override
+    public boolean getLoginStatus(Long accountId) {
+        CompanyWxAccount account = getById(accountId);
+        LoginStatusData login = loginService.getLoginStatus(accountId);
+        if(login.getLoginState() == 1){
+            account.setLoginStatus(1);
+            updateById(account);
+            return true;
+        }else{
+            return false;
+        }
+    }
+
+    @Override
+    public R bindService(Long accountId) {
+        CompanyWxAccount account = getById(accountId);
+        Company company = companyService.selectCompanyById(account.getCompanyId());
+        if(company !=null && company.getMaxPadNum() != null && company.getMaxPadNum() != -1){
+            int padCount = baseMapper.selectCount(new QueryWrapper<CompanyWxAccount>()
+                    .eq("company_id", company.getCompanyId())
+                    .isNotNull("server_id"));
+            if (padCount>=company.getMaxPadNum()){
+                return R.error(501,"该销售公司绑定pad数量超过限制");
+            }
+        }
+        Integer serverStatus = account.getServerStatus();
+        if (serverStatus!=null && serverStatus==1){
+            return R.error("已经绑定过");
+        }
+        CompanyUser companyUser = companyUserService.selectCompanyUserById(account.getCompanyUserId());
+        if (companyUser==null){
+            return R.error("未绑定销售");
+        }
+        String addressId = companyUser.getAddressId();
+        if (addressId==null || addressId.isEmpty()){
+            return R.error("请先绑定地址");
+        }
+        Long serverId = cidIpadServerService.selectQwIpadServerByAddressId(addressId);
+        if (serverId==null){
+            return  R.error(501,"该地区服务器剩余数量不足");
+        }
+        account.setServerId(serverId);
+        account.setServerStatus(1);
+        updateById(account);
+
+        cidIpadServerService.subtractServer(serverId);
+        CidIpadServerUser qwIpadServerUser = new CidIpadServerUser();
+        qwIpadServerUser.setCompanyUserId(companyUser.getUserId());
+        qwIpadServerUser.setCompanyId(companyUser.getCompanyId());
+        qwIpadServerUser.setCreateTime(new Date());
+        qwIpadServerUser.setServerId(serverId);
+        qwIpadServerUser.setQwUserId(account.getId());
+        cidIpadServerUserService.save(qwIpadServerUser);
+        return null;
+    }
 }

+ 79 - 0
fs-service/src/main/java/com/fs/wxcid/ServiceUtils.java

@@ -0,0 +1,79 @@
+package com.fs.wxcid;
+
+import com.alibaba.fastjson.TypeReference;
+import com.fs.common.core.redis.RedisCacheT;
+import com.fs.common.exception.CustomException;
+import com.fs.common.exception.base.BaseException;
+import com.fs.company.domain.CompanyWxAccount;
+import com.fs.company.mapper.CompanyWxAccountMapper;
+import com.fs.wxcid.domain.CidIpadServer;
+import com.fs.wxcid.domain.CidIpadServerUser;
+import com.fs.wxcid.dto.common.ApiResponseCommon;
+import com.fs.wxcid.dto.login.RequestBaseVo;
+import com.fs.wxcid.service.AdminLicenseService;
+import com.fs.wxcid.service.ICidIpadServerService;
+import com.fs.wxwork.utils.WxWorkHttpUtil;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import org.springframework.stereotype.Component;
+
+@Component
+@AllArgsConstructor
+public class ServiceUtils {
+
+    private final CompanyWxAccountMapper companyWxAccountMapper;
+    private final ICidIpadServerService cidIpadServerService;
+    private final RedisCacheT<CidIpadServer> redisCache;
+    private final AdminLicenseService adminLicenseService;
+    private final static String KEY = "cid:ipad:servic:";
+
+    private CidIpadServer getService(Long accountId){
+        String key = KEY + accountId;
+        CidIpadServer service = redisCache.getCacheObject(key);
+        if(service == null){
+            CompanyWxAccount account = companyWxAccountMapper.selectById(accountId);
+            if(account.getServerId() == null){
+                throw new BaseException("未绑定服务器");
+            }
+            service = cidIpadServerService.getById(account.getServerId());
+            redisCache.setCacheObject(key, service);
+        }
+        return service;
+    }
+
+    public String getUrl(Long accountId){
+        CidIpadServer service = getService(accountId);
+        return service.getUrl();
+    }
+    public String getProxy(Long accountId){
+        CidIpadServer service = getService(accountId);
+        return service.getProxy();
+    }
+
+
+
+
+    public <S, R,T extends ApiResponseCommon<S>> T sendPost(String url, RequestBaseVo<R> r, TypeReference<T> type){
+        Long accountId = r.getAccountId();
+        String baseUrl = getUrl(accountId) + url + "?key=" + adminLicenseService.getToken(accountId);
+        T response = WxWorkHttpUtil.postWithType(baseUrl, r.getData(), type);
+
+        //先判断是否成功
+        if (response.getCode() != 200 || response.getData() == null) {
+            throw new CustomException("接口请求失败: " + response.getText());
+        }
+        return response;
+    }
+
+    public <S, R,T extends ApiResponseCommon<S>> T sendGet(String url, RequestBaseVo<R> r, TypeReference<T> type){
+        Long accountId = r.getAccountId();
+        String baseUrl = getUrl(accountId) + url + "?key=" + adminLicenseService.getToken(accountId);
+        T response = WxWorkHttpUtil.getWithType(baseUrl, type);
+
+        //先判断是否成功
+        if (response.getCode() != 200 || response.getData() == null) {
+            throw new CustomException("接口请求失败: " + response.getText());
+        }
+        return response;
+    }
+}

+ 2 - 0
fs-service/src/main/java/com/fs/wxcid/domain/CidIpadServer.java

@@ -50,5 +50,7 @@ public class CidIpadServer extends BaseEntity{
     @Excel(name = "剩余数量")
     private Long groupNo;
 
+    private String proxy;
+
 
 }

+ 6 - 0
fs-service/src/main/java/com/fs/wxcid/dto/admin/GenAuthKey3Request.java

@@ -1,9 +1,15 @@
 package com.fs.wxcid.dto.admin;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 @Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
 public class GenAuthKey3Request {
     //要生成 AuthKey 的个数; Count小于1默认设置为1
     @JsonProperty("Count")

+ 18 - 0
fs-service/src/main/java/com/fs/wxcid/dto/login/RequestBaseVo.java

@@ -0,0 +1,18 @@
+package com.fs.wxcid.dto.login;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 微信协议通用基础响应结构(简化版)
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class RequestBaseVo<T> {
+    private T data;
+    private Long accountId;
+}

+ 4 - 0
fs-service/src/main/java/com/fs/wxcid/mapper/CidIpadServerMapper.java

@@ -2,6 +2,7 @@ package com.fs.wxcid.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.wxcid.domain.CidIpadServer;
+import org.apache.ibatis.annotations.Update;
 
 import java.util.List;
 
@@ -59,4 +60,7 @@ public interface CidIpadServerMapper extends BaseMapper<CidIpadServer>{
      * @return 结果
      */
     int deleteCidIpadServerByIds(Long[] ids);
+
+    @Update("UPDATE cid_ipad_server  SET count = count - 1 WHERE id = #{serverId}")
+    void subtractServer(Long serverId);
 }

+ 2 - 2
fs-service/src/main/java/com/fs/wxcid/service/AdminLicenseService.java

@@ -2,13 +2,13 @@ package com.fs.wxcid.service;
 
 
 import com.fs.wxcid.dto.admin.GenAuthKey3Request;
-import com.fs.wxcid.dto.common.ApiResponseCommon;
 
 import java.util.List;
 
 public interface AdminLicenseService {
 
     // 生成授权码(按类型:日/周/月...)
-    ApiResponseCommon<List<String>> genAuthKey3(String key, GenAuthKey3Request request);
+    List<String> genAuthKey3(String key, GenAuthKey3Request request);
 
+    String getToken(Long accountId);
 }

+ 4 - 0
fs-service/src/main/java/com/fs/wxcid/service/ICidIpadServerService.java

@@ -59,4 +59,8 @@ public interface ICidIpadServerService extends IService<CidIpadServer>{
      * @return 结果
      */
     int deleteCidIpadServerById(Long id);
+
+    Long selectQwIpadServerByAddressId(String addressId);
+
+    void subtractServer(Long serverId);
 }

+ 27 - 5
fs-service/src/main/java/com/fs/wxcid/service/impl/AdminLicenseServiceImpl.java

@@ -1,7 +1,9 @@
 package com.fs.wxcid.service.impl;
 
 import com.alibaba.fastjson.TypeReference;
-import com.fs.common.core.redis.RedisCache;
+import com.fs.common.core.redis.RedisCacheT;
+import com.fs.common.exception.base.BaseException;
+import com.fs.common.utils.StringUtils;
 import com.fs.wxcid.dto.admin.GenAuthKey3Request;
 import com.fs.wxcid.dto.common.ApiResponseCommon;
 import com.fs.wxcid.service.AdminLicenseService;
@@ -11,18 +13,21 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.concurrent.TimeUnit;
+
 @Slf4j
 @Service
 public class AdminLicenseServiceImpl implements AdminLicenseService {
 
     // 接口地址 这个后续优化为从数据库中获取
     private static final String BASE_URL = "http://114.117.215.244:7006";
-
+    private static final String KEY = "df704bd7012548049e68db25aff0507f";
+    private static final String TOKEN_KEY = "wx:pad:authKey:";
     @Autowired
-    RedisCache redisCache;
+    private RedisCacheT<String> redisCache;
 
     @Override
-    public ApiResponseCommon<List<String>> genAuthKey3(String key, GenAuthKey3Request request) {
+    public List<String> genAuthKey3(String key, GenAuthKey3Request request) {
         String url = BASE_URL + "/admin/GenAuthKey3" + "?key=" + key;
         ApiResponseCommon<List<String>> listApiResponseCommon = WxWorkHttpUtil.postWithType(
                 url,
@@ -31,6 +36,23 @@ public class AdminLicenseServiceImpl implements AdminLicenseService {
                 }
         );
         log.info("获取授权码结果列表: {}", listApiResponseCommon.getData());
-        return listApiResponseCommon;
+        if(listApiResponseCommon.getCode() == 200){
+            return listApiResponseCommon.getData();
+        }else{
+            throw new BaseException("授权码生成失败:" +  listApiResponseCommon.getText());
+        }
+    }
+
+    @Override
+    public String getToken(Long accountId) {
+        String key = TOKEN_KEY + accountId;
+        String token = redisCache.getCacheObject(key);
+        if(StringUtils.isNotEmpty(token)){
+            return token;
+        }
+        List<String> list = genAuthKey3(KEY, GenAuthKey3Request.builder().Count(1).Type(30000).build());
+        token = list.get(0);
+        redisCache.setCacheObject(key, token);
+        return token;
     }
 }

+ 17 - 0
fs-service/src/main/java/com/fs/wxcid/service/impl/CidIpadServerServiceImpl.java

@@ -1,10 +1,13 @@
 package com.fs.wxcid.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.common.exception.CustomException;
 import com.fs.common.utils.DateUtils;
 import com.fs.wxcid.domain.CidIpadServer;
 import com.fs.wxcid.mapper.CidIpadServerMapper;
 import com.fs.wxcid.service.ICidIpadServerService;
+import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -91,4 +94,18 @@ public class CidIpadServerServiceImpl extends ServiceImpl<CidIpadServerMapper, C
     {
         return baseMapper.deleteCidIpadServerById(id);
     }
+
+    @Override
+    public Long selectQwIpadServerByAddressId(String addressId) {
+        CidIpadServer ipadServer = getOne(new QueryWrapper<CidIpadServer>().eq("address_id", addressId).last("limit 1"));
+        if(ipadServer == null){
+            throw new CustomException("地区PAD不足");
+        }
+        return ipadServer.getId();
+    }
+
+    @Override
+    public void subtractServer(Long serverId) {
+        baseMapper.subtractServer(serverId);
+    }
 }

+ 24 - 22
fs-service/src/main/java/com/fs/wxcid/service/impl/LoginServiceImpl.java

@@ -2,11 +2,10 @@ package com.fs.wxcid.service.impl;
 
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.exception.CustomException;
+import com.fs.wxcid.ServiceUtils;
 import com.fs.wxcid.dto.common.ApiResponseCommon;
-import com.fs.wxcid.dto.login.LoginQrCodeResponseData;
-import com.fs.wxcid.dto.login.LoginStatusData;
-import com.fs.wxcid.dto.login.LoginStatusResponseData;
-import com.fs.wxcid.dto.login.QrCodeRequest;
+import com.fs.wxcid.dto.login.*;
+import com.fs.wxcid.service.AdminLicenseService;
 import com.fs.wxcid.service.LoginService;
 import com.fs.wxwork.utils.WxWorkHttpUtil;
 import com.alibaba.fastjson.TypeReference;
@@ -22,27 +21,22 @@ public class LoginServiceImpl implements LoginService {
     private static final String BASE_URL = "http://114.117.215.244:7006";
 
     @Autowired
-    RedisCache redisCache;
-
-    public ApiResponseCommon<LoginQrCodeResponseData> getLoginQrCodeNewDirect(String authKey, QrCodeRequest request) {
-        String url = BASE_URL + "/login/GetLoginQrCodeNewDirect?key=" + authKey;
-        ApiResponseCommon<LoginQrCodeResponseData> response = WxWorkHttpUtil.postWithType(
-                url,
-                request,
-                new TypeReference<ApiResponseCommon<LoginQrCodeResponseData>>() {}
-        );
-
-        //先判断是否成功
-        if (response.getCode() != 200 || response.getData() == null) {
-            String errorMsg = response.getText() != null ? response.getText() : "获取二维码失败";
-            throw new CustomException("获取登录二维码失败: " + errorMsg);
-        }
-
+    private RedisCache redisCache;
+    @Autowired
+    private AdminLicenseService adminLicenseService;
+    @Autowired
+    private ServiceUtils serviceUtils;
+
+    public String getLoginQrCodeNewDirect(Long accountId, String ipadOrMac) {
+        QrCodeRequest request = new QrCodeRequest();
+        request.setCheck(false);
+        request.setIpadOrmac(ipadOrMac);
+        request.setProxy(serviceUtils.getProxy(accountId));
+        ApiResponseCommon<LoginQrCodeResponseData> response = serviceUtils.sendPost("/login/GetLoginQrCodeNewDirect", RequestBaseVo.builder().accountId(accountId).data(request).build(), new TypeReference<ApiResponseCommon<LoginQrCodeResponseData>>() {});
         //安全访问 data
         log.info("二维码照片url: {}", response.getData().getQrCodeUrl());
-        return response;
+        return response.getData().getQrCodeUrl();
     }
-
     @Override
     public ApiResponseCommon<LoginStatusResponseData> checkLoginStatus(String authKey) {
         String url = BASE_URL + "/login/CheckLoginStatus?key=" + authKey;
@@ -63,6 +57,14 @@ public class LoginServiceImpl implements LoginService {
         }
     }
 
+    public LoginStatusData getLoginStatus(Long accountId) {
+        try {
+            ApiResponseCommon<LoginStatusData> response = serviceUtils.sendGet("/login/GetLoginStatus", RequestBaseVo.builder().accountId(accountId).data(null).build(), new TypeReference<ApiResponseCommon<LoginStatusData>>() {});
+            return response.getData();
+        }catch (Exception e){
+            return new LoginStatusData();
+        }
+    }
     public ApiResponseCommon<LoginStatusData> getLoginStatus(String authKey) {
         String url = BASE_URL + "/login/GetLoginStatus?key=" + authKey;
         ApiResponseCommon<LoginStatusData> response = WxWorkHttpUtil.getWithType(

+ 1 - 2
fs-service/src/main/resources/mapper/company/CompanyWxAccountMapper.xml

@@ -98,8 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="companyListAllCompany" resultType="com.fs.company.domain.CompanyUser">
         select u.* from company_user u
           inner join company_dept d on u.dept_id = d.dept_id
-        where u.del_flag = 0 and u.status = 0
-        ${params.dataScope}
+        where u.del_flag = 0 and u.status = 0 and u.company_id = #{companyId}
     </select>
     <select id="selectByCompanyUserAndWxNo" resultType="com.fs.company.domain.CompanyWxAccount">
         select * from company_wx_account where company_user_id = #{userId} and wx_no = #{wxNo}