Przeglądaj źródła

修改飞书登录接口跳转

syh 5 lat temu
rodzic
commit
bdd67c77c6

+ 3 - 3
feishu-sdk/src/main/java/cn/feishu/sdk/Test.java

@@ -4,10 +4,10 @@ import cn.feishu.sdk.provider.AuthProvider;
 
 public class Test {
     public static void main(String[] args){
-        AuthProvider authProvider = new AuthProvider();
         try {
-            authProvider.getAppAccessToken();
-            authProvider.getTenantAccessToken();
+            AuthProvider.getAppAccessToken();
+            AuthProvider.getTenantAccessToken();
+            String string = AuthProvider.getAuthUrl("");
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 8 - 7
feishu-sdk/src/main/java/cn/feishu/sdk/provider/AuthProvider.java

@@ -17,18 +17,19 @@ public class AuthProvider {
      * @throws UnsupportedEncodingException
      * @throws MalformedURLException
      */
-    public String getAuthUrl(String state) throws UnsupportedEncodingException, MalformedURLException {
+    public static String getAuthUrl(String state) throws UnsupportedEncodingException, MalformedURLException {
         String redirectUri = PropertiesUtils.getConfig("callback_url");
+        System.out.println(ApiConstant.FEISHU_API_URL+ApiConstant.AUTH_INDEX+"?redirect_uri="+ URLEncoder.encode(redirectUri,"UTF-8")+"&app_id="+ApiConstant.FEISHU_APP_ID+"&state="+state);
         return HttpUtil.feishuGetRequestString(ApiConstant.FEISHU_API_URL+ApiConstant.AUTH_INDEX+"?redirect_uri="+ URLEncoder.encode(redirectUri,"UTF-8")+"&app_id="+ApiConstant.FEISHU_APP_ID+"&state="+state);
     }
 
     /**
-     * 根据code
+     * 根据code获取用户登录信息
      * @param code
      * @return
      * @throws Exception
      */
-    public JSONObject getAccessToken(String code) throws Exception {
+    public static JSONObject getFeishuUserInfo(String code) throws Exception {
         JSONObject params = new JSONObject();
         params.put("app_access_token",getAppAccessToken());
         params.put("grant_type","authorization_code");
@@ -36,7 +37,7 @@ public class AuthProvider {
         return HttpUtil.feishuPostRequest(ApiConstant.FEISHU_API_URL+ApiConstant.AUTH_ACCESS_TOKEN,params);
     }
 
-    public JSONObject refreshAccessToken(String refreshToken) throws Exception{
+    public static JSONObject refreshAccessToken(String refreshToken) throws Exception{
         JSONObject params = new JSONObject();
         params.put("app_access_token",getAppAccessToken());
         params.put("grant_type","refresh_token");
@@ -44,7 +45,7 @@ public class AuthProvider {
         return HttpUtil.feishuPostRequest(ApiConstant.FEISHU_API_URL+ApiConstant.REFRESH_AUTH_ACCESS_TOKEN,params);
     }
 
-    public JSONObject getUserInfo(String accessToken){
+    public static JSONObject getUserInfo(String accessToken){
         JSONObject params = new JSONObject();
         params.put("user_access_token",accessToken);
         return HttpUtil.feishuGetRequest("Bearer user_access_token",ApiConstant.FEISHU_API_URL+ApiConstant.USER_INFO,params);
@@ -56,7 +57,7 @@ public class AuthProvider {
      * @return
      * @throws Exception
      */
-    public String getAppAccessToken() throws Exception {
+    public static String getAppAccessToken() throws Exception {
         JSONObject params = new JSONObject();
         params.put("app_id",ApiConstant.FEISHU_APP_ID);
         params.put("app_secret",ApiConstant.FEISHU_APP_SECRET);
@@ -74,7 +75,7 @@ public class AuthProvider {
      * @return
      * @throws Exception
      */
-    public String getTenantAccessToken() throws Exception {
+    public static String getTenantAccessToken() throws Exception {
         JSONObject params = new JSONObject();
         params.put("app_id",ApiConstant.FEISHU_APP_ID);
         params.put("app_secret",ApiConstant.FEISHU_APP_SECRET);

+ 5 - 0
jeecg-boot-module-system/pom.xml

@@ -79,6 +79,11 @@
             <scope>compile</scope>
         </dependency>
         <dependency>
+            <groupId>cn.feishu.sdk</groupId>
+            <artifactId>feishu-sdk</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+        <dependency>
             <groupId>com.aliyun.oss</groupId>
             <artifactId>aliyun-sdk-oss</artifactId>
             <version>3.5.0</version>

+ 0 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -62,13 +62,6 @@ public class CallbackController {
     @Autowired
     private IReportService reportService;
 
-    @GetMapping("/feishu/auth")
-    public void feishuAuth(HttpServletRequest request,
-                        HttpServletResponse response,
-                        @RequestParam("code") String code,
-                        @RequestParam("state") String state) throws IOException {
-        System.out.println(request.getQueryString());
-    }
     @GetMapping("/qywexin")
     public void qywexin(HttpServletRequest request,
                         HttpServletResponse response,

+ 241 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CorpFeishuUserController.java

@@ -0,0 +1,241 @@
+package org.jeecg.modules.ctop.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.CorpFeishuUser;
+import org.jeecg.modules.ctop.service.ICorpFeishuUserService;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+ /**
+ * 飞书用户信息
+ * @author jeecg-boot
+ * @date   2020-06-23
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="飞书用户信息")
+@RestController
+@RequestMapping("/ctop/corpFeishuUser")
+public class CorpFeishuUserController {
+	@Autowired
+	private ICorpFeishuUserService corpFeishuUserService;
+
+	/**
+	  * 分页列表查询
+	 * @param corpFeishuUser
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "飞书用户信息-分页列表查询")
+	@ApiOperation(value="飞书用户信息-分页列表查询", notes="飞书用户信息-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<CorpFeishuUser>> queryPageList(CorpFeishuUser corpFeishuUser,
+													   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+													   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+													   HttpServletRequest req) {
+		Result<IPage<CorpFeishuUser>> result = new Result<>();
+		QueryWrapper<CorpFeishuUser> queryWrapper = QueryGenerator.initQueryWrapper(corpFeishuUser, req.getParameterMap());
+		Page<CorpFeishuUser> page = new Page<CorpFeishuUser>(pageNo, pageSize);
+		IPage<CorpFeishuUser> pageList = corpFeishuUserService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param corpFeishuUser
+	 * @return
+	 */
+	@AutoLog(value = "飞书用户信息-添加")
+	@ApiOperation(value="飞书用户信息-添加", notes="飞书用户信息-添加")
+	@PostMapping(value = "/add")
+	public Result<CorpFeishuUser> add(@RequestBody CorpFeishuUser corpFeishuUser) {
+		Result<CorpFeishuUser> result = new Result<>();
+		try {
+			corpFeishuUserService.save(corpFeishuUser);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param corpFeishuUser
+	 * @return
+	 */
+	@AutoLog(value = "飞书用户信息-编辑")
+	@ApiOperation(value="飞书用户信息-编辑", notes="飞书用户信息-编辑")
+	@PutMapping(value = "/edit")
+	public Result<CorpFeishuUser> edit(@RequestBody CorpFeishuUser corpFeishuUser) {
+		Result<CorpFeishuUser> result = new Result<>();
+		CorpFeishuUser corpFeishuUserEntity = corpFeishuUserService.getById(corpFeishuUser.getId());
+		if(corpFeishuUserEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = corpFeishuUserService.updateById(corpFeishuUser);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "飞书用户信息-通过id删除")
+	@ApiOperation(value="飞书用户信息-通过id删除", notes="飞书用户信息-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			corpFeishuUserService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "飞书用户信息-批量删除")
+	@ApiOperation(value="飞书用户信息-批量删除", notes="飞书用户信息-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<CorpFeishuUser> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<CorpFeishuUser> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.corpFeishuUserService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "飞书用户信息-通过id查询")
+	@ApiOperation(value="飞书用户信息-通过id查询", notes="飞书用户信息-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<CorpFeishuUser> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<CorpFeishuUser> result = new Result<>();
+		CorpFeishuUser corpFeishuUser = corpFeishuUserService.getById(id);
+		if(corpFeishuUser==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(corpFeishuUser);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<CorpFeishuUser> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              CorpFeishuUser corpFeishuUser = JSON.parseObject(deString, CorpFeishuUser.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(corpFeishuUser, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<CorpFeishuUser> pageList = corpFeishuUserService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "飞书用户信息列表");
+      mv.addObject(NormalExcelConstants.CLASS, CorpFeishuUser.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("飞书用户信息列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<CorpFeishuUser> listCorpFeishuUsers = ExcelImportUtil.importExcel(file.getInputStream(), CorpFeishuUser.class, params);
+              corpFeishuUserService.saveBatch(listCorpFeishuUsers);
+              return Result.ok("文件导入成功!数据行数:" + listCorpFeishuUsers.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

+ 70 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/CorpFeishuUser.java

@@ -0,0 +1,70 @@
+package org.jeecg.modules.ctop.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 飞书用户信息
+ * @author jeecg-boot
+ * @date   2020-06-23
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_corp_feishu_user")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_corp_feishu_user对象", description="飞书用户信息")
+public class CorpFeishuUser {
+
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private Integer id;
+	/**email*/
+	@Excel(name = "email", width = 15)
+    @ApiModelProperty(value = "email")
+	private String email;
+	/**name*/
+	@Excel(name = "name", width = 15)
+    @ApiModelProperty(value = "name")
+	private String name;
+	/**avatarUrl*/
+	@Excel(name = "avatarUrl", width = 15)
+    @ApiModelProperty(value = "avatarUrl")
+	private String avatarUrl;
+	/**avatarThumb*/
+	@Excel(name = "avatarThumb", width = 15)
+    @ApiModelProperty(value = "avatarThumb")
+	private String avatarThumb;
+	/**avatarMiddle*/
+	@Excel(name = "avatarMiddle", width = 15)
+    @ApiModelProperty(value = "avatarMiddle")
+	private String avatarMiddle;
+	/**avatarBig*/
+	@Excel(name = "avatarBig", width = 15)
+    @ApiModelProperty(value = "avatarBig")
+	private String avatarBig;
+	/**userId*/
+	@Excel(name = "userId", width = 15)
+    @ApiModelProperty(value = "userId")
+	private String userId;
+	/**mobile*/
+	@Excel(name = "mobile", width = 15)
+    @ApiModelProperty(value = "mobile")
+	private String mobile;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/CorpFeishuUserMapper.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.CorpFeishuUser;
+
+/**
+ * 飞书用户信息
+ * @author: jeecg-boot
+ * @date:   2020-06-23
+ * @cersion: V1.0
+ */
+public interface CorpFeishuUserMapper extends BaseMapper<CorpFeishuUser> {
+
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/CorpFeishuUserMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.ctop.mapper.CorpFeishuUserMapper">
+
+</mapper>

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICorpFeishuUserService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.CorpFeishuUser;
+
+/**
+ * 飞书用户信息
+ * @author jeecg-boot
+ * @date   2020-06-23
+ * @version V1.0
+ */
+public interface ICorpFeishuUserService extends IService<CorpFeishuUser> {
+
+}

+ 18 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CorpFeishuUserServiceImpl.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.ctop.entity.CorpFeishuUser;
+import org.jeecg.modules.ctop.mapper.CorpFeishuUserMapper;
+import org.jeecg.modules.ctop.service.ICorpFeishuUserService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 飞书用户信息
+ * @author jeecg-boot
+ * @date   2020-06-23
+ * @version V1.0
+ */
+@Service
+public class CorpFeishuUserServiceImpl extends ServiceImpl<CorpFeishuUserMapper, CorpFeishuUser> implements ICorpFeishuUserService {
+
+}

+ 65 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.CtopCorpWexinUser;
 import cn.com.ctop.common.module.service.ICtopCorpWexinUserService;
 import cn.com.ctop.common.module.utils.AesEncryptUtil;
 import cn.com.ctop.common.module.utils.EncryptedString;
+import cn.feishu.sdk.provider.AuthProvider;
 import cn.hutool.core.util.RandomUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.aliyuncs.exceptions.ClientException;
@@ -30,6 +31,8 @@ import org.jeecg.common.util.DySmsHelper;
 import org.jeecg.common.util.PasswordUtil;
 import org.jeecg.common.util.RedisUtil;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.CorpFeishuUser;
+import org.jeecg.modules.ctop.service.ICorpFeishuUserService;
 import org.jeecg.modules.shiro.vo.DefContants;
 import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
@@ -42,6 +45,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.util.*;
 
 /**
@@ -65,16 +69,72 @@ public class LoginController {
     private ISysDepartService sysDepartService;
     @Autowired
     private ICtopCorpWexinUserService ctopCorpWexinUserService;
-    @GetMapping("feishu/auth")
-    public String feishuAuth(String code){
-
-        return "";
+    @Autowired
+    private ICorpFeishuUserService corpFeishuUserService;
+    @GetMapping("/feishu/auth")
+    public void feishuAuth(HttpServletRequest request,
+                           HttpServletResponse response,
+                           @RequestParam("code") String code,
+                           @RequestParam("state") String state) throws IOException {
+        Result<JSONObject> result = new Result<>();
+        //1:根据code值获取用户飞书信息
+        try {
+            JSONObject data = AuthProvider.getFeishuUserInfo(code);
+            String accessToken = data.getJSONObject("data").getString("access_token");
+            //根据accessToken
+            JSONObject userData = AuthProvider.getUserInfo(accessToken);
+            JSONObject dataObject = userData.getJSONObject("data");
+            String email = dataObject.getString("email");
+            if(null == email||email.trim().equals("")){
+                response.sendRedirect("http://localhost:3000/errorPage?desc=飞书尚未绑定邮箱");
+                return ;
+            }
+            SysUser sysUser = sysUserService.getUserByEmail(email);
+            if (sysUser == null) {
+                response.sendRedirect("http://localhost:3000/errorPage?desc=该用户未注册系统账户,请联系管理员");
+                return ;
+            }
+            if(sysUser.getStatus() != 1){
+                response.sendRedirect("http://localhost:3000/errorPage?desc=该用户已冻结,请联系管理员");
+                return ;
+            }
+            String departId = sysDepartService.selectIdByOrdCode(sysUser.getOrgCode());
+            sysUser.setDepartId(departId);
+            result = sysUserService.checkUserIsEffective(sysUser);
+            if (!result.isSuccess()) {
+                response.sendRedirect("http://localhost:3000/errorPage?desc="+result.getMessage());
+                return ;
+            }
+            //用户登录信息
+            userInfo(sysUser, result);
+            sysBaseApi.addLog("用户名: " + email + ",登录成功!", CommonConstant.LOG_TYPE_1, null);
+            CorpFeishuUser feishuUser = corpFeishuUserService.getById(sysUser.getId());
+            if (feishuUser == null) {
+                feishuUser = new CorpFeishuUser();
+                feishuUser.setUserId(sysUser.getId());
+                feishuUser.setEmail(sysUser.getEmail());
+                feishuUser.setAvatarBig(dataObject.getString("avatar_big"));
+                feishuUser.setAvatarMiddle(dataObject.getString("avatar_middle"));
+                feishuUser.setAvatarThumb(dataObject.getString("avatar_thumb"));
+                feishuUser.setAvatarUrl(dataObject.getString("avatar_url"));
+                feishuUser.setName(dataObject.getString("name"));
+                feishuUser.setMobile(dataObject.getString("mobile"));
+                feishuUser.setCreateTime(new Date());
+                feishuUser.setUpdateTime(new Date());
+                corpFeishuUserService.save(feishuUser);
+            }
+            response.sendRedirect("http://localhost:3000/dashboard/analysis");
+            return ;
+        } catch (Exception e) {
+            response.sendRedirect("http://localhost:3000/errorPage?desc=系统异常,请联系管理员");
+            return;
+        }
     }
 
     @RequestMapping(value = "/wxlogin", method = RequestMethod.POST)
     @ApiOperation("企业微信登录接口")
     public Result<JSONObject> wxlogin(@RequestParam(name = "code") String code) throws Exception {
-        Result<JSONObject> result = new Result<JSONObject>();
+        Result<JSONObject> result = new Result<>();
         val configStorage = new WxCpDefaultConfigImpl();
         configStorage.setCorpId("ww24b8a47826f5875f");
         configStorage.setAgentId(1000002);