|
|
@@ -14,13 +14,19 @@ 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.dto.login.LoginStatusResponseData;
|
|
|
+import com.fs.wxcid.dto.user.UserInfo;
|
|
|
+import com.fs.wxcid.dto.user.UserInfoExt;
|
|
|
+import com.fs.wxcid.dto.user.UserProfileData;
|
|
|
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 com.fs.wxcid.service.impl.UserServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -46,6 +52,8 @@ public class CompanyWxServiceImpl extends ServiceImpl<CompanyWxAccountMapper, Co
|
|
|
private ICidIpadServerUserService cidIpadServerUserService;
|
|
|
@Autowired
|
|
|
private AdminLicenseService adminLicenseService;
|
|
|
+ @Autowired
|
|
|
+ private UserServiceImpl userService;
|
|
|
|
|
|
/**
|
|
|
* 查询企微账号
|
|
|
@@ -156,12 +164,17 @@ public class CompanyWxServiceImpl extends ServiceImpl<CompanyWxAccountMapper, Co
|
|
|
@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{
|
|
|
+ try {
|
|
|
+ LoginStatusResponseData login = loginService.checkLoginStatus(accountId);
|
|
|
+ if(login.getRet() == 0){
|
|
|
+ account.setLoginStatus(1);
|
|
|
+ account.setLoginTime(LocalDateTime.now());
|
|
|
+ updateById(account);
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -208,4 +221,32 @@ public class CompanyWxServiceImpl extends ServiceImpl<CompanyWxAccountMapper, Co
|
|
|
cidIpadServerUserService.save(qwIpadServerUser);
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void wakeUpLogin(Long accountId) {
|
|
|
+ loginService.wakeUpLogin(accountId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateWxInfo(Long accountId) {
|
|
|
+ CompanyWxAccount account = getById(accountId);
|
|
|
+ UserProfileData profile = userService.getProfile(accountId);
|
|
|
+ UserInfo userInfo = profile.getUserInfo();
|
|
|
+ UserInfoExt userInfoExt = profile.getUserInfoExt();
|
|
|
+ account.setWxNickName(userInfo.getNickName().getStr());
|
|
|
+ account.setWxNo(userInfo.getUserName().getStr());
|
|
|
+ account.setHeadImgUrl(userInfoExt.getBigHeadImgUrl());
|
|
|
+ account.setPhone(userInfo.getBindMobile().getStr());
|
|
|
+ updateById(account);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void wxLoginOut(Long accountId) {
|
|
|
+ CompanyWxAccount account = getById(accountId);
|
|
|
+ account.setLoginStatus(0);
|
|
|
+ account.setOutTime(LocalDateTime.now());
|
|
|
+ account.setOutRemark("手动退出");
|
|
|
+ updateById(account);
|
|
|
+ loginService.logOut(accountId);
|
|
|
+ }
|
|
|
}
|