|
|
@@ -1,32 +1,39 @@
|
|
|
package com.fs.qw.controller;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.fs.common.annotation.Log;
|
|
|
import com.fs.common.annotation.RepeatSubmit;
|
|
|
+import com.fs.common.constant.Constants;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.domain.model.LoginUser;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
|
-import com.fs.common.utils.ServletUtils;
|
|
|
-import com.fs.company.domain.Company;
|
|
|
+import com.fs.common.exception.ServiceException;
|
|
|
+import com.fs.common.exception.user.UserPasswordNotMatchException;
|
|
|
+import com.fs.common.utils.MessageUtils;
|
|
|
+import com.fs.common.utils.poi.ExcelUtil;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
|
import com.fs.company.service.ICompanyUserService;
|
|
|
+import com.fs.company.service.impl.CompanyDeptServiceImpl;
|
|
|
+import com.fs.fastGpt.domain.FastGptRole;
|
|
|
+import com.fs.fastGpt.mapper.FastGptRoleMapper;
|
|
|
+import com.fs.framework.manager.AsyncManager;
|
|
|
+import com.fs.framework.manager.factory.AsyncFactory;
|
|
|
import com.fs.qw.domain.QwExternalContact;
|
|
|
-import com.fs.qw.domain.QwExternalContactTransferCompanyAudit;
|
|
|
import com.fs.qw.domain.QwUser;
|
|
|
import com.fs.qw.mapper.QwCompanyMapper;
|
|
|
import com.fs.qw.mapper.QwExternalContactMapper;
|
|
|
-import com.fs.qw.param.QwFsUserParam;
|
|
|
-import com.fs.qw.param.QwUserBingParam;
|
|
|
-import com.fs.qw.param.QwUserListParam;
|
|
|
+import com.fs.qw.param.*;
|
|
|
import com.fs.qw.service.IQwDeptService;
|
|
|
import com.fs.qw.service.IQwExternalContactTransferCompanyAuditService;
|
|
|
import com.fs.qw.service.IQwUserService;
|
|
|
import com.fs.qw.vo.QwOptionsVO;
|
|
|
import com.fs.qw.vo.QwUserVO;
|
|
|
+import com.fs.qw.vo.UpdateSendTypeVo;
|
|
|
import com.fs.qwApi.domain.QwExternalContactAllListResult;
|
|
|
import com.fs.qwApi.domain.inner.ExternalContact;
|
|
|
import com.fs.qwApi.domain.inner.ExternalContactInfo;
|
|
|
@@ -34,14 +41,18 @@ import com.fs.qwApi.domain.inner.FollowInfo;
|
|
|
import com.fs.qwApi.param.QwExternalListParam;
|
|
|
import com.fs.qwApi.service.QwApiService;
|
|
|
import com.fs.voice.utils.StringUtil;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.security.authentication.AuthenticationManager;
|
|
|
+import org.springframework.security.authentication.BadCredentialsException;
|
|
|
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
|
|
+import org.springframework.security.core.Authentication;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -77,25 +88,612 @@ public class QwUserController extends BaseController {
|
|
|
@Autowired
|
|
|
private QwExternalContactMapper qwExternalContactMapper;
|
|
|
|
|
|
- @GetMapping("/getQwUserAll")
|
|
|
- public AjaxResult getQwUserAll(){
|
|
|
- return AjaxResult.success(qwUserService.getQwUserAll());
|
|
|
+ @Autowired
|
|
|
+ private CompanyDeptServiceImpl companyDeptService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private AuthenticationManager authenticationManager;
|
|
|
+ @Autowired
|
|
|
+ private FastGptRoleMapper fastGptRoleMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询企微员工列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:staffList')")
|
|
|
+ @GetMapping("/staffList")
|
|
|
+ public TableDataInfo staffList(QwUserListParam qwUser) {
|
|
|
+
|
|
|
+ // 添加企微部门查询条件
|
|
|
+ Long deptId = qwUser.getDeptId();
|
|
|
+ if(deptId!=null && qwUser.getCorpId()!=null){
|
|
|
+ List<Long> qwDeptIdList = new ArrayList<>();
|
|
|
+ if (deptId!=null){
|
|
|
+ qwDeptIdList.add(deptId);
|
|
|
+ }
|
|
|
+ // 本部门的下级部门
|
|
|
+ List<Long> deptList = qwUserService.selectDeptByParentId(deptId,qwUser.getCorpId());
|
|
|
+ if (!deptList.isEmpty()){
|
|
|
+ qwDeptIdList.addAll(deptList);
|
|
|
+ }
|
|
|
+ qwUser.setQwDeptIdList(qwDeptIdList);
|
|
|
+ }
|
|
|
+ startPage();
|
|
|
+ List<QwUserVO> list = qwUserService.selectQwUserListStaffVO(qwUser);
|
|
|
+ return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取企微信息
|
|
|
- * **/
|
|
|
- @GetMapping("/getQwUserInfo")
|
|
|
- public R getQwUserInfo(QwFsUserParam param){
|
|
|
- return R.ok().put("data",qwUserService.getQwUserInfo(param));
|
|
|
+ * 查询企微员工列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:staffListPost')")
|
|
|
+ @PostMapping("/staffListPost")
|
|
|
+ public TableDataInfo staffListPost(@RequestBody QwUserListParam qwUser) {
|
|
|
+ // 添加企微部门查询条件
|
|
|
+ Long deptId = qwUser.getDeptId();
|
|
|
+ if(deptId!=null && qwUser.getCorpId()!=null){
|
|
|
+ List<Long> qwDeptIdList = new ArrayList<>();
|
|
|
+ qwDeptIdList.add(deptId);
|
|
|
+ // 本部门的下级部门
|
|
|
+ List<Long> deptList = qwUserService.selectDeptByParentId(deptId,qwUser.getCorpId());
|
|
|
+ if (!deptList.isEmpty()){
|
|
|
+ qwDeptIdList.addAll(deptList);
|
|
|
+ }
|
|
|
+ qwUser.setQwDeptIdList(qwDeptIdList);
|
|
|
+ }
|
|
|
+ startPage();
|
|
|
+ List<QwUserVO> list = qwUserService.selectQwUserListStaffVO(qwUser);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询我的企微员工列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:myStaffList')")
|
|
|
+ @GetMapping("/myStaffList")
|
|
|
+ public TableDataInfo myStaffList(QwUserListParam qwUser) {
|
|
|
+ startPage();
|
|
|
+ qwUser.setCompanyId(qwUser.getCompanyId());
|
|
|
+ List<QwUserVO> list = qwUserService.selectQwUserListStaffVO(qwUser);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出企微员工列表
|
|
|
+ * @param qwUser
|
|
|
+ * @return AjaxResult
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:export')")
|
|
|
+ @Log(title = "企微员工", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/exportStaff")
|
|
|
+ public AjaxResult export(QwUserListParam qwUser) {
|
|
|
+ qwUser.setCompanyId(qwUser.getCompanyId());
|
|
|
+ List<QwUserVO> list = qwUserService.selectQwUserListStaffVO(qwUser);
|
|
|
+ ExcelUtil<QwUserVO> util = new ExcelUtil<QwUserVO>(QwUserVO.class);
|
|
|
+ return util.exportExcel(list, "企微员工数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出企微用户列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:export')")
|
|
|
+ @Log(title = "企微用户", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public AjaxResult export(QwUser qwUser) {
|
|
|
+ qwUser.setCompanyId(qwUser.getCompanyId());
|
|
|
+ List<QwUser> list = qwUserService.selectQwUserList(qwUser);
|
|
|
+ ExcelUtil<QwUser> util = new ExcelUtil<QwUser>(QwUser.class);
|
|
|
+ return util.exportExcel(list, "企微用户数据");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询我的部门 企业微信员工列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:myDepartList')")
|
|
|
+ @GetMapping("/myDepartList")
|
|
|
+ public TableDataInfo myDepartList(QwUserListParam qwUser)
|
|
|
+ {
|
|
|
+
|
|
|
+ qwUser.setCompanyId(qwUser.getCompanyId());
|
|
|
+// qwUser.setUserType(loginUser.getUser().getUserType());
|
|
|
+ List<Long> combinedList = new ArrayList<>();
|
|
|
+ //本部门
|
|
|
+ Long deptId = getLoginUser().getUser().getDeptId();
|
|
|
+ if (deptId!=null){
|
|
|
+ combinedList.add(deptId);
|
|
|
+ }
|
|
|
+ //本部门的下级部门
|
|
|
+ List<Long> deptList = companyDeptService.selectCompanyDeptByParentId(deptId);
|
|
|
+ if (!deptList.isEmpty()){
|
|
|
+ combinedList.addAll(deptList);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 添加企微部门查询条件
|
|
|
+ Long qwDeptId = qwUser.getDeptId();
|
|
|
+ if(qwDeptId!=null && qwUser.getCorpId()!=null){
|
|
|
+ List<Long> qwDeptIdList = new ArrayList<>();
|
|
|
+ if (qwDeptId!=null){
|
|
|
+ qwDeptIdList.add(qwDeptId);
|
|
|
+ }
|
|
|
+ // 本部门的下级部门
|
|
|
+ List<Long> qwDeptList = qwUserService.selectDeptByParentId(qwDeptId,qwUser.getCorpId());
|
|
|
+ if (!qwDeptList.isEmpty()){
|
|
|
+ qwDeptIdList.addAll(qwDeptList);
|
|
|
+ }
|
|
|
+ qwUser.setQwDeptIdList(qwDeptIdList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ qwUser.setCuDeptIdList(combinedList);
|
|
|
+// qwUser.setUserType(loginUser.getUser().getUserType());
|
|
|
+
|
|
|
+ startPage();
|
|
|
+ List<QwUserVO> list = qwUserService.selectQwUserListStaffVO(qwUser);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:login')")
|
|
|
+ @PostMapping("/loginQwIpad")
|
|
|
+ public R loginQwIpad(@RequestBody QwLoginHookParam loginParam){
|
|
|
+ return qwUserService.loginQwIpad(loginParam);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询部门下的 企业微信账号
|
|
|
+ */
|
|
|
+ @PostMapping("/getQwUserByDept")
|
|
|
+ public R getQwUserByDept(@RequestBody QwUserByDeptParam deptParam){
|
|
|
+ deptParam.setCompanyId(deptParam.getCompanyId());
|
|
|
+ return R.ok().put("data",qwUserService.getQwUserByDept(deptParam)) ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:login')")
|
|
|
+ @PostMapping("/getQwIpad")
|
|
|
+ @RepeatSubmit
|
|
|
+ public R getQwIpad(@RequestBody QwLoginHookParam loginParam){
|
|
|
+ return qwUserService.getQwIpad(loginParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:login')")
|
|
|
+ @PostMapping("/delQwIpad")
|
|
|
+ @RepeatSubmit
|
|
|
+ public R delQwIpad(@RequestBody QwLoginHookParam loginParam){
|
|
|
+ return qwUserService.delQwIpad(loginParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:login')")
|
|
|
+ @PostMapping("/qrCodeStatus")
|
|
|
+ public R qrCodeStatus(@RequestBody QwLoginHookParam loginParam){
|
|
|
+ return qwUserService.qrCodeStatus(loginParam);
|
|
|
+ }
|
|
|
+ //输入验证码
|
|
|
+ @PostMapping("/qrCodeVerify")
|
|
|
+ public R qrCodeVerify(@RequestBody QwLoginHookParam loginParam){
|
|
|
+ return qwUserService.qrCodeVerify(loginParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/outLoginQwIpad")
|
|
|
+ public R outLoginQwIpad(@RequestBody QwLoginHookParam loginParam){
|
|
|
+ return qwUserService.outLoginQwIpad(loginParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/twoCode")
|
|
|
+ public R twoCode(@RequestBody QwLoginHookParam loginParam){
|
|
|
+ return qwUserService.getTwoCode(loginParam);
|
|
|
+ }
|
|
|
+ @PostMapping("/twoCodeStatus")
|
|
|
+ public R TwoCodeStatus(@RequestBody QwLoginHookParam loginParam){
|
|
|
+ return qwUserService.getTwoCodeStatus(loginParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/getQwIpadStatus")
|
|
|
+ public R getQwIpadStatus(@RequestBody QwLoginHookParam loginParam){
|
|
|
+ return qwUserService.getLoginQwIpadStatus(loginParam);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 直接授权key
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:authAppKey')")
|
|
|
+ @PostMapping("/authAppKey")
|
|
|
+ public R authAppKey(@RequestBody QwUser param){
|
|
|
+ return qwUserService.authAppKey(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 输入授权key
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:authAppKey')")
|
|
|
+ @PostMapping("/handleInputAuthAppKey")
|
|
|
+ public R handleInputAuthAppKey(@RequestBody QwUser param){
|
|
|
+ return qwUserService.handleInputAuthAppKey(param);
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/getMyQwCompanyList")
|
|
|
- public R getMyQwCompanyList()
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 登录企业微信(发起登录)
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:login')")
|
|
|
+ @PostMapping("/loginQwCode")
|
|
|
+ public R loginQwCode(@RequestBody QwLoginParam loginParam){
|
|
|
+ return qwUserService.loginQwCode(loginParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 登录请求-刷新获取二维码
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:login')")
|
|
|
+ @PostMapping("/loginQwCodeUrl")
|
|
|
+ public R loginQwCodeUrl(@RequestBody QwLoginParam loginParam){
|
|
|
+ return qwUserService.loginQwCodeUrl(loginParam);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 取redis里的登录二维码
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:login')")
|
|
|
+ @PostMapping("/getQwCodeUrl")
|
|
|
+ public R getQwCodeUrl(@RequestBody QwLoginParam loginParam) throws InterruptedException {
|
|
|
+ return qwUserService.getQwCodeUrl(loginParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 登录企业微信(传输验证信息)
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:login')")
|
|
|
+ @PostMapping("/loginQwCodeMsg")
|
|
|
+ public R loginQwCodeMsg(@RequestBody QwLoginParam loginParam){
|
|
|
+ return qwUserService.loginQwCodeMsg(loginParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 退出企业微信(退出插件)
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:login')")
|
|
|
+ @PostMapping("/logoutQwLogout")
|
|
|
+ public R logoutQwLogout(@RequestBody QwLoginParam loginParam){
|
|
|
+ return qwUserService.logoutQwLogout(loginParam);
|
|
|
+ }
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 企业微信(修改登录状态)
|
|
|
+// */
|
|
|
+// @PreAuthorize("@ss.hasPermi('qw:user:login')")
|
|
|
+// @PostMapping("/modifyLoginQwStatus")
|
|
|
+// public R modifyLoginQwStatus(@RequestBody QwLoginParam loginParam){
|
|
|
+// return qwUserService.modifyLoginQwStatus(loginParam);
|
|
|
+// }
|
|
|
+//
|
|
|
+ /**
|
|
|
+ * 查询企业微信登录状态
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:login')")
|
|
|
+ @PostMapping("/getLoginQwStatus")
|
|
|
+ public R getLoginQwStatus(@RequestBody QwLoginParam loginParam){
|
|
|
+ return qwUserService.getLoginQwStatus(loginParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult updateUser(@RequestBody QwUser qwUser){
|
|
|
+ return toAjax(qwUserService.updateQwUser(qwUser));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自动发课启用禁用
|
|
|
+ * @param qwUser
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/updateIsAuto")
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:isauto')")
|
|
|
+ public AjaxResult updateIsAuto(@RequestBody QwUser qwUser){
|
|
|
+ return toAjax(qwUserService.updateQwUser(qwUser));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业微信员工账号 绑定 云主机
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:loginIp')")
|
|
|
+ @Log(title = "绑定 云主机", businessType = BusinessType.INSERT)
|
|
|
+ @GetMapping("/qwBindCloudHost/{appKey}")
|
|
|
+ public R qwBindCloudHost(@PathVariable("appKey") String appKey){
|
|
|
+ return qwUserService.qwBindCloudHost(appKey);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取云主机的账密
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:cloudAP')")
|
|
|
+ @PostMapping("/selectCloudAP")
|
|
|
+ public R selectCloudAP(@RequestBody QwCloudAPParam param) throws Exception {
|
|
|
+ return qwUserService.selectCloudAP(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据销售账号密码 获取 他的所有企业微信账号以及云主机和账号密码
|
|
|
+ */
|
|
|
+ @PostMapping("/selectCloudByCompany")
|
|
|
+ public R selectCloudByCompany(@RequestBody QwCloudIPByCompanyParam param) throws Exception {
|
|
|
+
|
|
|
+ // 用户验证
|
|
|
+ Authentication authentication = null;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
|
|
+ authentication = authenticationManager
|
|
|
+ .authenticate(new UsernamePasswordAuthenticationToken(param.getCompanyAdmin(), param.getCompanyPassWord()));
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ if (e instanceof BadCredentialsException)
|
|
|
+ {
|
|
|
+ AsyncManager.me().execute(AsyncFactory.recordLogininfor(param.getCompanyAdmin(), Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
|
|
+ throw new UserPasswordNotMatchException();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ AsyncManager.me().execute(AsyncFactory.recordLogininfor(param.getCompanyAdmin(), Constants.LOGIN_FAIL, e.getMessage()));
|
|
|
+ throw new ServiceException(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ LoginUser loginUser=(LoginUser) authentication.getPrincipal();
|
|
|
+
|
|
|
+ return qwUserService.selectCloudByCompany(loginUser.getUser().getCompanyId(),loginUser.getUser().getUserId());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业微信员工账号 绑定 云主机
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:bindIp')")
|
|
|
+ @GetMapping("/qwBindCloudHostByIp/{appKey}/{IP}")
|
|
|
+ public R qwBindCloudHostByIp(@PathVariable("appKey") String appKey,@PathVariable("IP") String IP){
|
|
|
+ return qwUserService.qwBindCloudHostByIp(appKey,IP);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业微信员工账号 解除绑定 云主机
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:loginIpOut')")
|
|
|
+ @Log(title = "解除绑定 云主机", businessType = BusinessType.UPDATE)
|
|
|
+ @GetMapping("/qwUnbindCloudHost/{appKey}")
|
|
|
+ public R qwUnbindCloudHost(@PathVariable("appKey") String appKey){
|
|
|
+ return qwUserService.qwUnbindCloudHost(appKey);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据销售名称模糊查询
|
|
|
+ * @param qwUserName 名称
|
|
|
+ * @return list
|
|
|
+ */
|
|
|
+ @GetMapping("/getQwUserListLikeName")
|
|
|
+ public R getQwUserListLikeName(@RequestParam(required = false) String qwUserName,
|
|
|
+ @RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
|
|
+ @RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
|
|
+ Map<String,Object> params = new HashMap<>();
|
|
|
+ params.put("qwUserName", qwUserName);
|
|
|
+
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ List<QwOptionsVO> qwUserList = companyUserService.selectQwUserListLikeName(params);
|
|
|
+ return R.ok().put("data", new PageInfo<>(qwUserList));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询企微用户列表
|
|
|
+ */
|
|
|
+// @PreAuthorize("@ss.hasPermi('qw:user:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(QwUserListParam qwUser)
|
|
|
{
|
|
|
- List<QwOptionsVO> list = qwUserService.selectQwCompanyListOptionsVOAll();
|
|
|
+ startPage();
|
|
|
+ qwUser.setCompanyId(qwUser.getCompanyId());
|
|
|
+ if (ObjectUtil.isNotEmpty(qwUser.getIsRemark())&&qwUser.getIsRemark().equals("1")){
|
|
|
+ qwUser.setCompanyUserId(getLoginUser().getUser().getUserId());
|
|
|
+ }else if (ObjectUtil.isNotEmpty(qwUser.getIsRemark())&&qwUser.getIsRemark().equals("2")){
|
|
|
+ qwUser.setDeptId(getLoginUser().getDeptId());
|
|
|
+ qwUser.setCorpId(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<QwUserVO> list = qwUserService.selectQwUserListVO(qwUser);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询企微用户列表
|
|
|
+ */
|
|
|
+
|
|
|
+ @GetMapping("/userList")
|
|
|
+ public TableDataInfo userList(QwUserListParam qwUser)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+// LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+// qwUser.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+
|
|
|
+ List<QwUserVO> list = qwUserService.selectAllQwUserListVO(qwUser);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+ // /**
|
|
|
+// * 查询我的企微用户列表
|
|
|
+// */
|
|
|
+// @PreAuthorize("@ss.hasPermi('qw:user:myList')")
|
|
|
+// @GetMapping("/myList")
|
|
|
+// public TableDataInfo myList(QwUserParam qwUser)
|
|
|
+// {
|
|
|
+// startPage();
|
|
|
+// LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+// qwUser.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+// qwUser.setCompanyUserId(loginUser.getCompany().getUserId());
|
|
|
+// List<QwUserVO> list = qwUserService.selectQwUserListVO(qwUser);
|
|
|
+// return getDataTable(list);
|
|
|
+// }
|
|
|
+ @GetMapping("/getQwAllUserList")
|
|
|
+ public R getQwAllUserList(@RequestParam String corpId, @RequestParam Long companyId)
|
|
|
+ {
|
|
|
+ List<QwUserVO> list = companyUserService.selectCompanyQwUserList(corpId, companyId);
|
|
|
return R.ok().put("data",list);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 查询企微用户列表-下拉框
|
|
|
+ */
|
|
|
+ @GetMapping("/qwList")
|
|
|
+ public TableDataInfo getQwList(QwUser qwUser)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+
|
|
|
+ if(ObjectUtil.notEqual(qwUser.getDisableCompanyId(),1)){
|
|
|
+ qwUser.setCompanyId(qwUser.getCompanyId());
|
|
|
+ }
|
|
|
+ List<QwUser> list = qwUserService.selectQwUserList(qwUser);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 查询企微员工列表-用于员工管理绑定
|
|
|
+ */
|
|
|
+ @GetMapping("/getQwUserList")
|
|
|
+ public R getQwUserList()
|
|
|
+ {
|
|
|
+ QwUserParam qwUser = new QwUserParam();
|
|
|
+ List<String> strings = qwCompanyMapper.selectQwCompanyCorpIdListByCompanyId(getLoginUser().getUser().getCompanyId());
|
|
|
+ qwUser.setCorpId(strings);
|
|
|
+ if (strings==null||strings.size()==0){
|
|
|
+ return R.ok().put("data",null);
|
|
|
+ }
|
|
|
+ qwUser.setIsDel(0);
|
|
|
+ List<QwUserVO> list = qwUserService.selectQwUserListBindVO(qwUser);
|
|
|
+ return R.ok().put("data",list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getMyQwUserList")
|
|
|
+ public R getMyQwUserList()
|
|
|
+ {
|
|
|
+ List<QwOptionsVO> list = qwUserService.selectQwUserListOptionsVOByCompanyUserId(getLoginUser().getUser().getUserId());
|
|
|
+ return R.ok().put("data",list);
|
|
|
+ }
|
|
|
+ @GetMapping("/getMyQwCompanyList/{companyId}")
|
|
|
+ public R getMyQwCompanyList(@PathVariable Long companyId)
|
|
|
+ {
|
|
|
+ List<QwOptionsVO> list = qwUserService.selectQwCompanyListOptionsVOByCompanyId(companyId);
|
|
|
+ return R.ok().put("data",list);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取企微用户详细信息
|
|
|
+ */
|
|
|
+
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
+ {
|
|
|
+ return AjaxResult.success(qwUserService.selectQwUserVOById(id));
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 批量查询 企微用户详细信息
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/getInfo/{ids}")
|
|
|
+ public AjaxResult getInfoByIds(@PathVariable("ids") Long[] ids)
|
|
|
+ {
|
|
|
+ return AjaxResult.success(qwUserService.selectQwUserVOByIds(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 新增企微用户
|
|
|
+// */
|
|
|
+// @PreAuthorize("@ss.hasPermi('qw:user:add')")
|
|
|
+// @Log(title = "企微用户", businessType = BusinessType.INSERT)
|
|
|
+// @PostMapping
|
|
|
+// public R add()
|
|
|
+// {
|
|
|
+// LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+//
|
|
|
+// return R.ok(qwUserService.syncQwUser(loginUser.getCompany().getCompanyId()));
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 同步企微用户
|
|
|
+ */
|
|
|
+ @RepeatSubmit
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:sync')")
|
|
|
+ @Log(title = "企微用户", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("sync/{corpId}")
|
|
|
+ public R sync(@PathVariable String corpId)
|
|
|
+ {
|
|
|
+ List<String> strings = qwCompanyMapper.selectQwCompanyCorpIdListByCompanyId(getLoginUser().getUser().getCompanyId());
|
|
|
+ for (String string : strings) {
|
|
|
+
|
|
|
+ if (string.equals(corpId)){
|
|
|
+ qwUserService.syncQwUser(string);
|
|
|
+ qwDeptService.insertOrUpdateQwDept(string);
|
|
|
+ logger.info("同步完成");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ @RepeatSubmit
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:sync')")
|
|
|
+ @Log(title = "同步企微用户名称", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("syncName/{corpId}")
|
|
|
+ public R syncName(@PathVariable String corpId)
|
|
|
+ {
|
|
|
+ List<String> strings = qwCompanyMapper.selectQwCompanyCorpIdListByCompanyId(getLoginUser().getUser().getCompanyId());
|
|
|
+ for (String string : strings) {
|
|
|
+ if (string.equals(corpId)){
|
|
|
+ qwUserService.syncQwUserName(string);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 绑定AI客服
|
|
|
+ */
|
|
|
+// @PreAuthorize("@ss.hasPermi('qw:user:bindAi')")
|
|
|
+ @Log(title = "企微用户", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/bindAi")
|
|
|
+ @RepeatSubmit
|
|
|
+ public R edit(@RequestBody QwUserBindAi param)
|
|
|
+ {
|
|
|
+ QwUser qwUser=new QwUser();
|
|
|
+ qwUser.setId(param.getId());
|
|
|
+ qwUser.setFastGptRoleId(param.getFastGptRoleId());
|
|
|
+ FastGptRole role = fastGptRoleMapper.selectFastGptRoleByRoleId(param.getFastGptRoleId());
|
|
|
+
|
|
|
+ if (role.getBindCorpId()!=null){
|
|
|
+ if (role.getBindCorpId().equals(param.getCorpId())){
|
|
|
+ qwUserService.updateQwUser(qwUser);
|
|
|
+ }else {
|
|
|
+ return R.error("该角色已绑定其他企业");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ int i = qwUserService.updateQwUser(qwUser);
|
|
|
+
|
|
|
+ FastGptRole fastGptRole=new FastGptRole();
|
|
|
+ fastGptRole.setRoleId(param.getFastGptRoleId());
|
|
|
+ fastGptRole.setBindCorpId(param.getCorpId());
|
|
|
+ fastGptRoleMapper.updateFastGptRole(fastGptRole);
|
|
|
+
|
|
|
+ if (i>0){
|
|
|
+ return R.ok();
|
|
|
+ }else {
|
|
|
+ return R.error("绑定失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 解除应用绑定
|
|
|
+ */
|
|
|
+// @PreAuthorize("@ss.hasPermi('fastGpt:fastGptRole:relieve')")
|
|
|
+ @Log(title = "解除应用", businessType = BusinessType.UPDATE)
|
|
|
+ @GetMapping("/relieveFastGptRoleById/{id}")
|
|
|
+ public R relieveFastGptRoleById(@PathVariable("id") Long id)
|
|
|
+ {
|
|
|
+ return qwUserService.relieveFastGptRoleById(id);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 绑定企微用户
|
|
|
@@ -188,6 +786,7 @@ public class QwUserController extends BaseController {
|
|
|
}
|
|
|
return R.error("绑定失败");
|
|
|
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -201,6 +800,52 @@ public class QwUserController extends BaseController {
|
|
|
syncMyQwExternalContact(qu,null);
|
|
|
}
|
|
|
|
|
|
+ /** 修改企微用户的欢迎语 */
|
|
|
+ @PostMapping("/weclomeQwUser")
|
|
|
+ public R weclomeQwUser(@RequestBody QwUser qwUser) throws Exception {
|
|
|
+
|
|
|
+
|
|
|
+ return qwUserService.weclomeQwUser(qwUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除企微用户
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('qw:user:remove')")
|
|
|
+ @Log(title = "企微用户", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
+ {
|
|
|
+ return toAjax(qwUserService.deleteQwUserByIds(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取企业微信用户列表
|
|
|
+ */
|
|
|
+ @GetMapping("/qwUserList/{corpId}")
|
|
|
+ public TableDataInfo qwUserList(@PathVariable String corpId)
|
|
|
+ {
|
|
|
+
|
|
|
+// LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+// Long companyId = loginUser.getCompany().getCompanyId();
|
|
|
+
|
|
|
+ List<QwOptionsVO> list = qwUserService.selectQwUserListOptionsVO(corpId);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+ @GetMapping("/getQwUserAll")
|
|
|
+ public AjaxResult getQwUserAll(){
|
|
|
+ return AjaxResult.success(qwUserService.getQwUserAll());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取企微信息
|
|
|
+ * **/
|
|
|
+ @GetMapping("/getQwUserInfo")
|
|
|
+ public R getQwUserInfo(QwFsUserParam param){
|
|
|
+ return R.ok().put("data",qwUserService.getQwUserInfo(param));
|
|
|
+ }
|
|
|
+
|
|
|
public R syncMyQwExternalContact(QwUser qwUser,String getNextCursor ) {
|
|
|
|
|
|
String qwUserId = qwUser.getQwUserId();
|
|
|
@@ -286,79 +931,38 @@ public class QwUserController extends BaseController {
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 同步企微用户
|
|
|
- */
|
|
|
- @RepeatSubmit
|
|
|
- @PreAuthorize("@ss.hasPermi('qw:user:sync')")
|
|
|
- @Log(title = "企微用户", businessType = BusinessType.INSERT)
|
|
|
- @PostMapping("sync/{corpId}")
|
|
|
- public R sync(@PathVariable("corpId") String corpId)
|
|
|
- {
|
|
|
-
|
|
|
- List<String> strings = qwCompanyMapper.selectQwCompanyCorpIdListByAll();
|
|
|
- for (String string : strings) {
|
|
|
-
|
|
|
- if (string.equals(corpId)){
|
|
|
- qwUserService.syncQwUser(string);
|
|
|
- qwDeptService.insertOrUpdateQwDept(string);
|
|
|
- logger.info("同步完成");
|
|
|
- }
|
|
|
- }
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取企微用户详细信息
|
|
|
- */
|
|
|
-
|
|
|
- @GetMapping(value = "/{id}")
|
|
|
- public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
- {
|
|
|
- return AjaxResult.success(qwUserService.selectQwUserVOById(id));
|
|
|
- }
|
|
|
- /**
|
|
|
- * 批量查询 企微用户详细信息
|
|
|
- */
|
|
|
- @GetMapping(value = "/getInfo/{ids}")
|
|
|
- public AjaxResult getInfoByIds(@PathVariable("ids") Long[] ids)
|
|
|
- {
|
|
|
- return AjaxResult.success(qwUserService.selectQwUserVOByIds(ids));
|
|
|
+ // /**
|
|
|
+// * 重启云主机
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @PutMapping("/restartHost")
|
|
|
+// public R restartCloudHost(@RequestParam String serverIp) {
|
|
|
+// return qwUserService.restartCloudHost(serverIp);
|
|
|
+// }
|
|
|
+ @PostMapping("/updateSendType")
|
|
|
+ public R updateSendType(@RequestBody UpdateSendTypeVo vo) {
|
|
|
+ return qwUserService.updateSendType(vo);
|
|
|
}
|
|
|
|
|
|
- @RepeatSubmit
|
|
|
- @PreAuthorize("@ss.hasPermi('qw:user:sync')")
|
|
|
- @Log(title = "同步企微用户名称", businessType = BusinessType.INSERT)
|
|
|
- @PostMapping("syncName/{corpId}")
|
|
|
- public R syncName(@PathVariable("corpId") String corpId)
|
|
|
- {
|
|
|
- List<String> strings = qwCompanyMapper.selectQwCompanyCorpIdListByAll();
|
|
|
- for (String string : strings) {
|
|
|
- if (string.equals(corpId)){
|
|
|
- qwUserService.syncQwUserName(string);
|
|
|
- }
|
|
|
- }
|
|
|
+ @GetMapping("/changeVideoStatus")
|
|
|
+ public R changeVideoStatus(Long id) {
|
|
|
+ qwUserService.changeVideoStatus(id);
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询企微用户列表
|
|
|
- */
|
|
|
-
|
|
|
- @GetMapping("/userList")
|
|
|
- public TableDataInfo userList(QwUserListParam qwUser)
|
|
|
+ @GetMapping("/companyQwUserlist")
|
|
|
+ public TableDataInfo companyQwUserlist(@RequestParam Long companyId,
|
|
|
+ @RequestParam String corpId,
|
|
|
+ @RequestParam(required = false) String nickName)
|
|
|
{
|
|
|
startPage();
|
|
|
- List<QwUserVO> list = qwUserService.selectAllQwUserListVO(qwUser);
|
|
|
+ List<QwUserVO> list = qwUserService.selectQwUserListByCompanyIdAndCorpIdAndNickName(companyId, corpId, nickName);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/getQwAllUserList")
|
|
|
- public R getQwAllUserList(@RequestParam String corpId, @RequestParam Long companyId)
|
|
|
+ @GetMapping("/updateFastGptRoleStatusById/{id}")
|
|
|
+ public R updateFastGptRoleStatusById(@PathVariable Long id)
|
|
|
{
|
|
|
- List<QwUserVO> list = companyUserService.selectCompanyQwUserList(corpId, companyId);
|
|
|
- return R.ok().put("data",list);
|
|
|
+ return qwUserService.updateQwUserFastGptRoleStatusById(id);
|
|
|
}
|
|
|
}
|