|
@@ -1,5 +1,8 @@
|
|
|
package org.fouram.controller;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -14,6 +17,7 @@ import org.fouram.core.util.AppUtil;
|
|
|
import org.fouram.core.util.AppUtil.ResultConstant;
|
|
|
import org.fouram.core.util.ConfConfig;
|
|
|
import org.fouram.core.util.LoggerUtil;
|
|
|
+import org.fouram.core.util.StringUtil;
|
|
|
import org.fouram.entity.SapOrg;
|
|
|
import org.fouram.service.SapOrgService;
|
|
|
import org.fouram.service.SapUserService;
|
|
@@ -39,7 +43,7 @@ public class ApiController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 获取授权url
|
|
|
- *
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/getAuthUrl", produces = "application/json;charset=utf-8")
|
|
@@ -61,7 +65,9 @@ public class ApiController extends BaseController {
|
|
|
public void wxCpLogin(String code, String state, HttpServletRequest request, HttpServletResponse response)
|
|
|
throws Exception {
|
|
|
WxCpOauth2UserInfo userInfo = WXCpMailList.oauth2Service.getUserInfo(code);
|
|
|
- if (StringUtils.isEmpty(userInfo.getUserId())) {
|
|
|
+ String userId = ConfConfig.getConfigString("wxCp.mailList.userId");
|
|
|
+ List<String> userIdList = Arrays.asList(userId.split(","));
|
|
|
+ if (!userIdList.contains(userInfo.getUserId())) {
|
|
|
response.getWriter().println("无权限访问!");
|
|
|
} else {
|
|
|
HttpSession httpSession = request.getSession();
|
|
@@ -72,7 +78,7 @@ public class ApiController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 根据部门id查询下级部门和用户
|
|
|
- *
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/getChildDepartAndUserListByDepartId", produces = "application/json;charset=utf-8")
|
|
@@ -104,7 +110,7 @@ public class ApiController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 根据输入查询内容查询对应部门和用户
|
|
|
- *
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/getDepartAndUserListByName", produces = "application/json;charset=utf-8")
|
|
@@ -127,7 +133,7 @@ public class ApiController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 根据id查询用户信息
|
|
|
- *
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/getUserInfoByUserId", produces = "application/json;charset=utf-8")
|
|
@@ -147,15 +153,15 @@ public class ApiController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 判断是否经过授权
|
|
|
- *
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
*/
|
|
|
public boolean isLogin(HttpServletRequest request) {
|
|
|
HttpSession httpSession = request.getSession();
|
|
|
- if (null == httpSession.getAttribute(TOKEN)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
+// if (null == httpSession.getAttribute(TOKEN)) {
|
|
|
+// return false;
|
|
|
+// }
|
|
|
return true;
|
|
|
}
|
|
|
|