新增系统基础配置
This commit is contained in:
parent
53edb180e9
commit
09eebe843b
@ -68,4 +68,9 @@ public interface IApiConsts {
|
||||
* 获取用户职位列表
|
||||
*/
|
||||
String LIST_USER_POSITION = "%s/resource/position/listuserposition/%s";
|
||||
|
||||
/**
|
||||
* 用户详情
|
||||
*/
|
||||
String GET_USER_DETAIL = "%s/resource/user/getuserdetail/%s";
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.cm.common.plugin.oauth.controller.apis.user;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.AccessTokenException;
|
||||
@ -127,4 +128,16 @@ public class UserController extends AbstractController {
|
||||
return userService.listUserDepartmentUserByPosition(params);
|
||||
}
|
||||
|
||||
}
|
||||
@ApiOperation(value = "用户详情", notes = "用户详情接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("getuserdetail/{userId}")
|
||||
public JSONObject getUserDetail(@PathVariable("userId") String userId) throws SearchException, AccessTokenException {
|
||||
Map<String, Object> params = getParams();
|
||||
params.put("userId", userId);
|
||||
return userService.getUserDetail(params);
|
||||
}
|
||||
|
||||
}
|
@ -2,6 +2,7 @@ package com.cm.common.plugin.oauth.controller.routes;
|
||||
|
||||
import com.cm.common.component.SecurityComponent;
|
||||
import com.cm.common.config.properties.OauthProperties;
|
||||
import com.cm.common.config.properties.SystemProperties;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.pojo.bos.UserInfoBO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -23,6 +24,8 @@ public class RouteController {
|
||||
private SecurityComponent securityComponent;
|
||||
@Autowired
|
||||
private OauthProperties oauthProperties;
|
||||
@Autowired
|
||||
private SystemProperties systemProperties;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
@ -35,6 +38,7 @@ public class RouteController {
|
||||
UserInfoBO userInfoBO = securityComponent.getCurrentUser();
|
||||
mv.addObject("userUsername", userInfoBO.getUserUsername());
|
||||
mv.addObject("oauthServer", oauthProperties.getOauthServer());
|
||||
mv.addObject("title", systemProperties.getTitle());
|
||||
return mv;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,10 @@ package com.cm.common.plugin.oauth.controller.routes.user;
|
||||
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -17,19 +21,23 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
* @Date: 2019-07-29 21:22
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "用户管理")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/user")
|
||||
public class UserRouteController extends AbstractController {
|
||||
|
||||
/**
|
||||
* 部门用户页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "部门用户页面", notes = "部门用户页面接口")
|
||||
@GetMapping("departmentuser")
|
||||
public ModelAndView departmentUser() {
|
||||
ModelAndView mv = new ModelAndView("user/select-department-user");
|
||||
return mv;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户详情页面", notes = "用户详情页面接口")
|
||||
@GetMapping("userdetail")
|
||||
public ModelAndView userDetail() {
|
||||
ModelAndView mv = new ModelAndView("user/user-detail.html");
|
||||
return mv;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.cm.common.plugin.oauth.service.user;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cm.common.exception.AccessTokenException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
|
||||
@ -97,4 +98,13 @@ public interface IUserService {
|
||||
*/
|
||||
JSONArray listUserDepartmentUserByPosition(Map<String, Object> params) throws AccessTokenException, SearchException;
|
||||
|
||||
/**
|
||||
* 用户详情接口
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws AccessTokenException
|
||||
* @throws SearchException
|
||||
*/
|
||||
JSONObject getUserDetail(Map<String, Object> params) throws AccessTokenException, SearchException;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.cm.common.plugin.oauth.service.user.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cm.common.base.AbstractService;
|
||||
import com.cm.common.config.properties.ApiPathProperties;
|
||||
import com.cm.common.exception.AccessTokenException;
|
||||
@ -128,4 +129,16 @@ public class UserServiceImpl extends AbstractService implements IUserService {
|
||||
}
|
||||
return JSONArray.parseArray(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getUserDetail(Map<String, Object> params) throws AccessTokenException, SearchException {
|
||||
String result = restTemplateUtil.doPostForm(String.format(IApiConsts.GET_USER_DETAIL, apiPathProperties.getUserCenter(), params.get("userId").toString()), params);
|
||||
if (result == null) {
|
||||
throw new AccessTokenException("认证失败");
|
||||
}
|
||||
if (result.isEmpty()) {
|
||||
throw new SearchException("获取人员列表失败");
|
||||
}
|
||||
return JSONObject.parseObject(result);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,109 @@
|
||||
<!doctype html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#httpServletRequest.getScheme() + '://' + #httpServletRequest.getServerName() + ':' + #request.getServerPort() + #request.getContextPath() + '/'} ">
|
||||
<meta charset="UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11,chrome=1"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/layui/css/layui.css"/>
|
||||
<style>
|
||||
html, body {background-color: #FFF;}
|
||||
.edit-content {padding: 0 10px;}
|
||||
.table-left-title {width: 20%; background-color: #e6e6e6; text-align: center;}
|
||||
.layui-table td, .layui-table th {border-color: #000;}
|
||||
[v-cloak] {display: none;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" class="easyui-layout easyui-layout-dialog edit-content">
|
||||
<table class="layui-table" lay-size="sm" v-cloak>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="table-left-title">用户名</td>
|
||||
<td colspan="3"><span>{{userDetail.userUsername}}</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-left-title">姓 名</td>
|
||||
<td colspan="3"><span>{{userDetail.userName}}</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-left-title">电 话</td>
|
||||
<td colspan="3"><span>{{userDetail.userPhone == '' ? '无' : userDetail.userPhone}}</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-left-title">邮 箱</td>
|
||||
<td colspan="3"><span>{{userDetail.userEmail == '' ? '无' : userDetail.userEmail}}</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-left-title">角 色</td>
|
||||
<td colspan="3">
|
||||
<span v-for="(role, index) in userDetail.roles" v-if="userDetail.roles.length > 0">
|
||||
<span v-if="index > 0">,</span>{{role.roleName}}
|
||||
</span>
|
||||
<span v-else>无</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-left-title">部 门</td>
|
||||
<td colspan="3">
|
||||
<span v-for="(department, index) in userDetail.departments" v-if="userDetail.departments.length > 0">
|
||||
<span v-if="index > 0">,</span>{{department.departmentName}}
|
||||
</span>
|
||||
<span v-else>无</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-left-title">职 位</td>
|
||||
<td colspan="3">
|
||||
<span v-for="(position, index) in userDetail.positions" v-if="userDetail.positions.length > 0">
|
||||
<span v-if="index > 0">,</span>{{position.positionName}}
|
||||
</span>
|
||||
<span v-else>无</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-left-title">所属组</td>
|
||||
<td colspan="3">
|
||||
<span v-for="(group, index) in userDetail.groups" v-if="userDetail.groups.length > 0">
|
||||
<span v-if="index > 0">,</span>{{group.groupName}}
|
||||
</span>
|
||||
<span v-else>无</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<script type="text/javascript" src="assets/js/jquery-2.1.1.min.js"></script>
|
||||
<script type="text/javascript" src="assets/js/vendor/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script type="text/javascript" src="assets/js/vue.min.js"></script>
|
||||
<script type="text/javascript" src="assets/js/common.js"></script>
|
||||
<script type="text/javascript">
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
userId: top.restAjax.params(window.location.href).userId,
|
||||
userDetail: {}
|
||||
},
|
||||
methods: {
|
||||
initUserDetail: function() {
|
||||
var self = this;
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/user/getuserdetail/{userId}', [self.userId]), {}, null, function(code, data) {
|
||||
self.userDetail = data;
|
||||
}, function(code, data) {
|
||||
top.DialogBox.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.DialogBox.msg(TextMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.DialogBox.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
this.initUserDetail();
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -95,6 +95,9 @@
|
||||
function initSelectNodes() {
|
||||
showSelectNodes();
|
||||
var nodes = zTree.getNodes();
|
||||
if(nodes.length == 0) {
|
||||
top.DialogBox.msg('暂无数据');
|
||||
}
|
||||
for(var i = 0, item = nodes[i]; item = nodes[i++];) {
|
||||
for(var j = 0, node = selectedNodes[j]; node = selectedNodes[j++];) {
|
||||
if(item[selectTree.primaryKey] == node[selectTree.primaryKey]) {
|
||||
|
@ -0,0 +1,56 @@
|
||||
package com.cm.common.config.properties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: SystemProperties
|
||||
* @Description: 系统配置
|
||||
* @Author: WangGeng
|
||||
* @Date: 2019/9/3 10:14 上午
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "server")
|
||||
public class SystemProperties {
|
||||
|
||||
private Integer port;
|
||||
private String url;
|
||||
private String title;
|
||||
private String loginPageName;
|
||||
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url == null ? "" : url.trim();
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title == null ? "" : title.trim();
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getLoginPageName() {
|
||||
return loginPageName == null ? "" : loginPageName.trim();
|
||||
}
|
||||
|
||||
public void setLoginPageName(String loginPageName) {
|
||||
this.loginPageName = loginPageName;
|
||||
}
|
||||
}
|
@ -20,6 +20,10 @@ public interface ISystemConstant {
|
||||
* APP接口前缀
|
||||
*/
|
||||
String API_TAGS_APP_PREFIX = "APP接口-";
|
||||
/**
|
||||
* 路由接口前缀
|
||||
*/
|
||||
String ROUTE_TAGS_PREFIX = "路由接口-";
|
||||
/**
|
||||
* api前缀
|
||||
*/
|
||||
|
@ -61,11 +61,17 @@ public class AppTokenManager {
|
||||
* @param token
|
||||
* @param appTokenUser
|
||||
*/
|
||||
public void addToken(String token, AppTokenUser appTokenUser) {
|
||||
public synchronized void addToken(String token, AppTokenUser appTokenUser) {
|
||||
AppToken appToken = new AppToken();
|
||||
appToken.setToken(token);
|
||||
appToken.setLastTime(System.currentTimeMillis());
|
||||
appToken.setAppTokenUser(appTokenUser);
|
||||
for (Map.Entry<String, AppToken> kvs : tokens.entrySet()) {
|
||||
if (StringUtils.equals(appTokenUser.getId(), kvs.getValue().getUserId())) {
|
||||
tokens.remove(kvs.getValue().getToken());
|
||||
break;
|
||||
}
|
||||
}
|
||||
tokens.put(token, appToken);
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ public class AppToken {
|
||||
|
||||
private String token;
|
||||
private long lastTime;
|
||||
private String userId;
|
||||
private AppTokenUser appTokenUser;
|
||||
|
||||
public String getToken() {
|
||||
@ -32,6 +33,14 @@ public class AppToken {
|
||||
this.lastTime = lastTime;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public AppTokenUser getAppTokenUser() {
|
||||
return appTokenUser;
|
||||
}
|
||||
@ -47,7 +56,9 @@ public class AppToken {
|
||||
.append("\"").append(token).append("\"");
|
||||
sb.append(",\"lastTime\":")
|
||||
.append(lastTime);
|
||||
sb.append(",\"tokenUser\":")
|
||||
sb.append(",\"userId\":")
|
||||
.append("\"").append(userId).append("\"");
|
||||
sb.append(",\"appTokenUser\":")
|
||||
.append(appTokenUser);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
|
Loading…
Reference in New Issue
Block a user