|
|
|
@ -55,7 +55,6 @@ public class UserController { |
|
|
|
private AccessAddressService accessAddressService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 登录接口 |
|
|
|
* |
|
|
|
@ -77,7 +76,7 @@ public class UserController { |
|
|
|
JSONObject paramObject = JSONObject.parseObject(jsonString); |
|
|
|
String post = null; |
|
|
|
try { |
|
|
|
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, null,null); |
|
|
|
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, null, null); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
@ -102,7 +101,7 @@ public class UserController { |
|
|
|
param.put("id", userinfo.getId().toString()); |
|
|
|
param.put("workwechatid", userWxId); |
|
|
|
// 将openid写回
|
|
|
|
PublicConfig.editUserWechatOpenid(param,userkey,userToken); |
|
|
|
PublicConfig.editUserWechatOpenid(param, userkey, userToken); |
|
|
|
} |
|
|
|
// 设置放入时间
|
|
|
|
userinfo.setInstant(Instant.now()); |
|
|
|
@ -114,9 +113,6 @@ public class UserController { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/loginOut") |
|
|
|
public RestResponse loginOut(HttpServletRequest request) { |
|
|
|
HttpSession session = request.getSession(); |
|
|
|
@ -124,12 +120,12 @@ public class UserController { |
|
|
|
String key = request.getHeader("user-key"); |
|
|
|
if (token != null) { |
|
|
|
AuthenticationTokenPool.removeUserToken(token); |
|
|
|
redisPool.getRedisTemplateByDb(5).delete(PublicConfig.LoginRedisPrefix+key); |
|
|
|
redisPool.getRedisTemplateByDb(5).delete(PublicConfig.LoginRedisPrefix + key); |
|
|
|
} else { |
|
|
|
String userKey = (String) session.getAttribute("userKey"); |
|
|
|
String userToken = (String) session.getAttribute("userToken"); |
|
|
|
AuthenticationTokenPool.removeUserToken(userToken); |
|
|
|
redisPool.getRedisTemplateByDb(5).delete(PublicConfig.LoginRedisPrefix+userKey); |
|
|
|
redisPool.getRedisTemplateByDb(5).delete(PublicConfig.LoginRedisPrefix + userKey); |
|
|
|
} |
|
|
|
session.invalidate(); |
|
|
|
return new RestResponse("", 200, new StatusInfo("退出成功", "退出成功")); |
|
|
|
@ -170,7 +166,7 @@ public class UserController { |
|
|
|
JSONObject paramObject = JSONObject.parseObject(jsonString); |
|
|
|
String post = null; |
|
|
|
try { |
|
|
|
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userkey,token); |
|
|
|
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userkey, token); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
@ -204,12 +200,11 @@ public class UserController { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 通过名称获取人员
|
|
|
|
@PostMapping("/sys/findUserByName") |
|
|
|
public RestResponse findUserByName(@RequestBody Map<String,String> map,HttpServletRequest request){ |
|
|
|
public RestResponse findUserByName(@RequestBody Map<String, String> map, HttpServletRequest request) { |
|
|
|
Map<String, Object> paramForUser = new HashMap<>(); |
|
|
|
paramForUser.put("name",map.get("name")); |
|
|
|
paramForUser.put("name", map.get("name")); |
|
|
|
String token = request.getHeader("user-token"); |
|
|
|
String userkey = request.getHeader("user-key"); |
|
|
|
if (token == null) { |
|
|
|
@ -218,17 +213,22 @@ public class UserController { |
|
|
|
} |
|
|
|
// 获取当前获取用户时查询范围
|
|
|
|
String scope = map.get("scope"); |
|
|
|
if("department".equals(scope)){ |
|
|
|
if ("department".equals(scope)) { |
|
|
|
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); |
|
|
|
// 如果是部门级别
|
|
|
|
paramForUser.put("adminorg",userToken.getMaindeparment()); |
|
|
|
paramForUser.put("adminorg", userToken.getMaindeparment()); |
|
|
|
} |
|
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForUser, userkey, token); |
|
|
|
List<UserByPortP> userByPortP = new ArrayList<>(); |
|
|
|
for (UserByPort userByPort : userByPortList) { |
|
|
|
// 获取当前用户的用工关系
|
|
|
|
int emptype = userByPort.getEmptype(); |
|
|
|
if (emptype <= 10) { |
|
|
|
// 如果是在职人员
|
|
|
|
userByPortP.add(new UserByPortP(userByPort)); |
|
|
|
} |
|
|
|
return new RestResponse(userByPortP,userByPortP.size(),200); |
|
|
|
} |
|
|
|
return new RestResponse(userByPortP, userByPortP.size(), 200); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -269,8 +269,6 @@ public class UserController { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 添加用户管理仓库的权限 |
|
|
|
* |
|
|
|
@ -379,9 +377,6 @@ public class UserController { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 修改用户密码 |
|
|
|
* |
|
|
|
@ -440,7 +435,7 @@ public class UserController { |
|
|
|
String classes = (String) map.get("classes"); |
|
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(map); |
|
|
|
for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndDepository.getUserId(), userKey,token); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndDepository.getUserId(), userKey, token); |
|
|
|
UserByPortP up = new UserByPortP(userByPort); |
|
|
|
up.setId(roleAndDepository.getId()); |
|
|
|
up.setDepositoryName(roleAndDepository.getDepositoryName()); |
|
|
|
@ -463,7 +458,7 @@ public class UserController { |
|
|
|
List<RoleAndMaterialType> roleAndMaterialTypeByCondition = roleService.findRoleAndMaterialTypeByCondition(map); |
|
|
|
for (RoleAndMaterialType roleAndMaterialType : roleAndMaterialTypeByCondition |
|
|
|
) { |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndMaterialType.getUid(), userKey,token); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndMaterialType.getUid(), userKey, token); |
|
|
|
UserByPortP up = new UserByPortP(userByPort); |
|
|
|
up.setId(roleAndMaterialType.getId()); |
|
|
|
up.setMaterialTypeName(roleAndMaterialType.getTname()); |
|
|
|
@ -489,7 +484,7 @@ public class UserController { |
|
|
|
userKey = (String) request.getSession().getAttribute("userKey"); |
|
|
|
} |
|
|
|
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); |
|
|
|
List<String> stringList = LinkInterfaceUtil.getUserAccessToAddresses(userKey,token); |
|
|
|
List<String> stringList = LinkInterfaceUtil.getUserAccessToAddresses(userKey, token); |
|
|
|
List<AccesstoAddress> accessToAddressByList = accessAddressService.findAccessToAddressByList(stringList); |
|
|
|
// 获取顶级菜单
|
|
|
|
List<AccesstoAddress> menusByNoParent = new ArrayList<>(); |
|
|
|
@ -595,7 +590,7 @@ public class UserController { |
|
|
|
} |
|
|
|
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); |
|
|
|
// 获取当前用户可见的菜单id
|
|
|
|
List<String> stringList = LinkInterfaceUtil.getUserAccessToAddresses(userKey,token); |
|
|
|
List<String> stringList = LinkInterfaceUtil.getUserAccessToAddresses(userKey, token); |
|
|
|
// 根据菜单id获取菜单信息
|
|
|
|
List<AccesstoAddress> accessToAddressByList = accessAddressService.findAccessToAddressByList(stringList); |
|
|
|
List<AccesstoAddress> result = new ArrayList<>(); |
|
|
|
|