Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
60a40708
MaxKey
项目概览
yujianwangzivayy
/
MaxKey
与 Fork 源项目一致
Fork自
MaxKey单点登录官方(MaxKeyTop) / MaxKey
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
60a40708
编写于
11月 10, 2020
作者:
M
MaxKey
提交者:
GitHub
11月 10, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #35 from FranisiL/master_dev_lyp
Master dev lyp
上级
d96247e7
c2a64d07
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
681 addition
and
457 deletion
+681
-457
build.gradle
build.gradle
+4
-0
maxkey-core/src/main/java/org/maxkey/constants/ConstantsOperateMessage.java
...in/java/org/maxkey/constants/ConstantsOperateMessage.java
+3
-0
maxkey-core/src/main/java/org/maxkey/domain/UserInfo.java
maxkey-core/src/main/java/org/maxkey/domain/UserInfo.java
+7
-8
maxkey-core/src/main/java/org/maxkey/util/ExcelUtils.java
maxkey-core/src/main/java/org/maxkey/util/ExcelUtils.java
+20
-0
maxkey-persistence/src/main/java/org/maxkey/persistence/service/UserInfoService.java
.../java/org/maxkey/persistence/service/UserInfoService.java
+544
-242
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/UserInfoController.java
...in/java/org/maxkey/web/contorller/UserInfoController.java
+103
-207
未找到文件。
build.gradle
浏览文件 @
60a40708
...
...
@@ -312,6 +312,10 @@ subprojects {
compile
group:
'org.apache.tomcat.embed'
,
name:
'tomcat-embed-core'
,
version:
'9.0.38'
//JULI logging implementation for embedded Tomcat
compile
group:
'org.apache.tomcat.embed'
,
name:
'tomcat-embed-logging-juli'
,
version:
'8.5.2'
//easyExcel
compile
group:
'com.alibaba'
,
name:
'easyexcel'
,
version:
'2.1.6'
}
jar
{
...
...
maxkey-core/src/main/java/org/maxkey/constants/ConstantsOperateMessage.java
浏览文件 @
60a40708
...
...
@@ -28,4 +28,7 @@ public final class ConstantsOperateMessage {
public
static
final
String
DELETE_SUCCESS
=
"message.action.delete.success"
;
public
static
final
String
DELETE_ERROR
=
"message.action.delete.error"
;
public
static
final
String
import_success
=
"message.action.import.success"
;
public
static
final
String
IMPORT_ERROR
=
"message.action.import.error"
;
}
maxkey-core/src/main/java/org/maxkey/domain/UserInfo.java
浏览文件 @
60a40708
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.maxkey.domain
;
...
...
@@ -32,7 +32,7 @@ import org.springframework.web.multipart.MultipartFile;
/**
* .
* @author Crystal.Sea
*
*
*/
@Table
(
name
=
"MXK_USERINFO"
)
public
class
UserInfo
extends
JpaBaseDomain
{
...
...
@@ -329,7 +329,7 @@ public class UserInfo extends JpaBaseDomain {
}
/**
*
*
*/
public
UserInfo
()
{
super
();
...
...
@@ -469,7 +469,7 @@ public class UserInfo extends JpaBaseDomain {
this
.
nickName
=
nickName
;
}
public
String
getNameZhSpell
()
{
return
nameZhSpell
;
...
...
@@ -1147,7 +1147,6 @@ public class UserInfo extends JpaBaseDomain {
this
.
description
=
description
;
}
/**
* @return the createdBy
*/
...
...
maxkey-core/src/main/java/org/maxkey/util/ExcelUtils.java
0 → 100644
浏览文件 @
60a40708
package
org.maxkey.util
;
import
org.maxkey.domain.UserInfo
;
import
java.io.InputStream
;
import
java.util.List
;
/**
* @author yapeng.li
* @since 2020/9/21 21:06
*/
public
class
ExcelUtils
{
public
static
List
<
UserInfo
>
readExcel
(
InputStream
in
)
throws
Exception
{
return
null
;
}
}
maxkey-persistence/src/main/java/org/maxkey/persistence/service/UserInfoService.java
浏览文件 @
60a40708
此差异已折叠。
点击以展开。
maxkey-web-manage/src/main/java/org/maxkey/web/contorller/UserInfoController.java
浏览文件 @
60a40708
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.maxkey.web.contorller
;
import
java.beans.PropertyEditorSupport
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
...
...
@@ -51,6 +52,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.servlet.ModelAndView
;
...
...
@@ -62,81 +64,103 @@ import org.springframework.web.servlet.ModelAndView;
@RequestMapping
(
value
=
{
"/userinfo"
})
public
class
UserInfoController
{
final
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
UserInfoController
.
class
);
@Autowired
@Qualifier
(
"userInfoService"
)
private
UserInfoService
userInfoService
;
/**
* 查询用户列表
* @param user
* @return
*/
@RequestMapping
(
value
={
"/grid"
})
@ResponseBody
public
JpaPageResults
<
UserInfo
>
forwardUsersList
(
@ModelAttribute
(
"userInfo"
)
UserInfo
userInfo
){
return
userInfoService
.
queryPageResults
(
userInfo
);
}
@RequestMapping
(
value
={
"/forwardAdd"
})
public
ModelAndView
forwardSelectUserType
(){
ModelAndView
modelAndView
=
new
ModelAndView
(
"/userinfo/userAdd"
);
//List<UserType> userTypeList=userTypeService.query(null);
//modelAndView.addObject("userTypeList", userTypeList);
return
modelAndView
;
}
@RequestMapping
(
value
={
"/list"
})
public
ModelAndView
usersList
(){
return
new
ModelAndView
(
"/userinfo/usersList"
);
}
@RequestMapping
(
value
={
"/select"
})
public
ModelAndView
usersSelect
(){
ModelAndView
modelAndView
=
new
ModelAndView
(
"/userinfo/userinfoSelect"
);
return
modelAndView
;
}
/**
* 新增
* @param userInfo
* @param result
* @return
*/
@RequestMapping
(
value
=
"/add"
)
public
ModelAndView
addUsers
(
@Valid
@ModelAttribute
(
"userInfo"
)
UserInfo
userInfo
,
BindingResult
result
)
{
_logger
.
debug
(
userInfo
.
toString
());
if
(
result
.
hasErrors
()){
// new Message(WebContext.getValidErrorText(),result);
}
userInfo
.
setId
(
userInfo
.
generateId
());
//userInfo.setNameZHShortSpell(StringUtils.hanYu2Pinyin(userInfo.getDisplayName(), true));
//userInfo.setNameZHSpell(StringUtils.hanYu2Pinyin(userInfo.getDisplayName(), false));
if
(
userInfoService
.
insert
(
userInfo
))
{
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
userInfo
,
MessageType
.
success
,
OperateType
.
add
,
MessageScope
.
DB
);
}
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_ERROR
),
MessageType
.
error
);
return
WebContext
.
forward
(
"forwardUpdate/"
+
userInfo
.
getId
());
}
@RequestMapping
(
value
={
"/forwardUpdate/{id}"
})
public
ModelAndView
forwardUpdateUsers
(
@PathVariable
(
"id"
)
String
id
){
ModelAndView
modelAndView
=
new
ModelAndView
(
"/userinfo/userUpdate"
);
UserInfo
userInfo
=
userInfoService
.
get
(
id
);
if
(
userInfo
.
getPicture
()!=
null
){
WebContext
.
getSession
().
setAttribute
(
userInfo
.
getId
(),
userInfo
.
getPicture
());
}
modelAndView
.
addObject
(
"model"
,
userInfo
);
return
modelAndView
;
}
/**
* 查询用户列表
*
* @param user
* @return
*/
@RequestMapping
(
value
=
{
"/grid"
})
@ResponseBody
public
JpaPageResults
<
UserInfo
>
forwardUsersList
(
@ModelAttribute
(
"userInfo"
)
UserInfo
userInfo
)
{
return
userInfoService
.
queryPageResults
(
userInfo
);
}
@RequestMapping
(
value
=
{
"/forwardAdd"
})
public
ModelAndView
forwardSelectUserType
()
{
ModelAndView
modelAndView
=
new
ModelAndView
(
"/userinfo/userAdd"
);
//List<UserType> userTypeList=userTypeService.query(null);
//modelAndView.addObject("userTypeList", userTypeList);
return
modelAndView
;
}
@RequestMapping
(
value
=
{
"/list"
})
public
ModelAndView
usersList
()
{
return
new
ModelAndView
(
"/userinfo/usersList"
);
}
@RequestMapping
(
value
=
{
"/select"
})
public
ModelAndView
usersSelect
()
{
ModelAndView
modelAndView
=
new
ModelAndView
(
"/userinfo/userinfoSelect"
);
return
modelAndView
;
}
/**
* 新增
*
* @param userInfo
* @param result
* @return
*/
@RequestMapping
(
value
=
"/add"
)
public
ModelAndView
addUsers
(
@Valid
@ModelAttribute
(
"userInfo"
)
UserInfo
userInfo
,
BindingResult
result
)
{
_logger
.
debug
(
userInfo
.
toString
());
if
(
result
.
hasErrors
())
{
// new Message(WebContext.getValidErrorText(),result);
}
userInfo
.
setId
(
userInfo
.
generateId
());
//userInfo.setNameZHShortSpell(StringUtils.hanYu2Pinyin(userInfo.getDisplayName(), true));
//userInfo.setNameZHSpell(StringUtils.hanYu2Pinyin(userInfo.getDisplayName(), false));
if
(
userInfoService
.
insert
(
userInfo
))
{
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
userInfo
,
MessageType
.
success
,
OperateType
.
add
,
MessageScope
.
DB
);
}
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_ERROR
),
MessageType
.
error
);
return
WebContext
.
forward
(
"forwardUpdate/"
+
userInfo
.
getId
());
}
/**
* 用户excel导入
*
* @param userInfo
* @param result
* @return
*/
/**
*
* @param file excel文件
* @return
*/
@RequestMapping
(
value
=
"/importing"
)
public
Object
importing
(
MultipartFile
file
)
throws
IOException
{
if
(
userInfoService
.
importing
(
file
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_SUCCESS
),
null
,
MessageType
.
success
,
OperateType
.
add
,
MessageScope
.
DB
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
INSERT_ERROR
),
MessageType
.
error
);
}
}
@RequestMapping
(
value
=
{
"/forwardUpdate/{id}"
})
public
ModelAndView
forwardUpdateUsers
(
@PathVariable
(
"id"
)
String
id
)
{
ModelAndView
modelAndView
=
new
ModelAndView
(
"/userinfo/userUpdate"
);
UserInfo
userInfo
=
userInfoService
.
get
(
id
);
if
(
userInfo
.
getPicture
()
!=
null
)
{
WebContext
.
getSession
().
setAttribute
(
userInfo
.
getId
(),
userInfo
.
getPicture
());
}
modelAndView
.
addObject
(
"model"
,
userInfo
);
return
modelAndView
;
}
/**
* 查询用户,根据id
...
...
@@ -144,7 +168,7 @@ public class UserInfoController {
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/getUsers/{id}"
)
@RequestMapping
(
value
=
"/getUsers/{id}"
)
public
UserInfo
getUserInfo
(
@PathVariable
(
"id"
)
String
id
)
{
_logger
.
debug
(
id
);
UserInfo
userInfo
=
userInfoService
.
get
(
id
);
...
...
@@ -157,14 +181,14 @@ public class UserInfoController {
}
return
userInfo
;
}
@ResponseBody
@RequestMapping
(
value
=
"/randomPassword"
)
public
String
randomPassword
()
{
return
userInfoService
.
randomPassword
();
}
/**
* 修改用户
* @param userInfo
...
...
@@ -172,133 +196,5 @@ public class UserInfoController {
* @return
*/
@RequestMapping
(
value
=
"/update"
)
public
ModelAndView
updateUsers
(
@Valid
@ModelAttribute
(
"userInfo"
)
UserInfo
userInfo
,
BindingResult
result
)
{
_logger
.
debug
(
userInfo
.
toString
());
if
(
result
.
hasErrors
()){
// new Message(WebContext.getValidErrorText(),result);
}
_logger
.
info
(
userInfo
.
getExtraAttributeName
());
_logger
.
info
(
userInfo
.
getExtraAttributeValue
());
//userInfo.setNameZHShortSpell(StringUtils.hanYu2Pinyin(userInfo.getDisplayName(), true));
//userInfo.setNameZHSpell(StringUtils.hanYu2Pinyin(userInfo.getDisplayName(), false));
convertExtraAttribute
(
userInfo
)
;
_logger
.
info
(
userInfo
.
getExtraAttribute
());
if
(
userInfoService
.
update
(
userInfo
))
{
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
userInfo
,
MessageType
.
success
,
OperateType
.
add
,
MessageScope
.
DB
);
}
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
return
WebContext
.
forward
(
"forwardUpdate/"
+
userInfo
.
getId
());
}
/**
* 批量删除用户
* @param id
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/batchDelete"
)
public
Message
batchDeleteUsers
(
@RequestParam
(
"id"
)
String
id
)
{
_logger
.
debug
(
id
);
if
(
userInfoService
.
batchDelete
(
StringUtils
.
string2List
(
id
,
","
)))
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_ERROR
),
MessageType
.
error
);
}
}
/**
* 根据用户id删除用户
*
* @param id
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/delete"
)
public
Message
deleteUsersById
(
@RequestParam
(
"id"
)
String
id
)
{
_logger
.
debug
(
id
);
if
(
userInfoService
.
batchDelete
(
StringUtils
.
string2List
(
id
,
","
)))
{
//provisioningPrepare.prepare(userInfo, OPERATEACTION.DELETE_ACTION);
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
DELETE_ERROR
),
MessageType
.
error
);
}
}
protected
void
convertExtraAttribute
(
UserInfo
userInfo
)
{
if
(
userInfo
.
getExtraAttributeValue
()!=
null
){
String
[]
extraAttributeLabel
=
userInfo
.
getExtraAttributeName
().
split
(
","
);
String
[]
extraAttributeValue
=
userInfo
.
getExtraAttributeValue
().
split
(
","
);
Map
<
String
,
String
>
extraAttributeMap
=
new
HashMap
<
String
,
String
>
();
for
(
int
i
=
0
;
i
<
extraAttributeLabel
.
length
;
i
++){
extraAttributeMap
.
put
(
extraAttributeLabel
[
i
],
extraAttributeValue
[
i
]);
}
String
extraAttribute
=
JsonUtils
.
object2Json
(
extraAttributeMap
);
userInfo
.
setExtraAttribute
(
extraAttribute
);
}
}
@RequestMapping
(
value
={
"/forwardChangePassword/{id}"
})
public
ModelAndView
forwardChangePassword
(
@PathVariable
(
"id"
)
String
id
){
ModelAndView
modelAndView
=
new
ModelAndView
(
"/userinfo/changePassword"
);
UserInfo
userInfo
=
userInfoService
.
get
(
id
);
modelAndView
.
addObject
(
"model"
,
userInfo
);
return
modelAndView
;
}
@RequestMapping
(
value
={
"/forwardChangeUserinfoStatus/{id}"
})
public
ModelAndView
forwardChangeUserinfoStatus
(
@PathVariable
(
"id"
)
String
id
){
ModelAndView
modelAndView
=
new
ModelAndView
(
"/userinfo/changeUserinfoStatus"
);
UserInfo
userInfo
=
userInfoService
.
get
(
id
);
modelAndView
.
addObject
(
"model"
,
userInfo
);
return
modelAndView
;
}
@ResponseBody
@RequestMapping
(
value
=
"/changePassword"
)
public
Message
changePassword
(
@ModelAttribute
(
"userInfo"
)
UserInfo
userInfo
)
{
_logger
.
debug
(
userInfo
.
getId
());
if
(
userInfoService
.
changePassword
(
userInfo
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
}
@ResponseBody
@RequestMapping
(
value
=
"/changeUserinfoStatus"
)
public
Message
changeUserinfoStatus
(
@ModelAttribute
(
"userInfo"
)
UserInfo
userInfo
)
{
_logger
.
debug
(
userInfo
.
getId
());
if
(
userInfoService
.
update
(
userInfo
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_ERROR
),
MessageType
.
error
);
}
}
@InitBinder
public
void
binder
(
WebDataBinder
binder
)
{
binder
.
registerCustomEditor
(
String
.
class
,
new
PropertyEditorSupport
()
{
@Override
public
void
setAsText
(
String
value
)
{
if
(
StringUtils
.
isNullOrBlank
(
value
)){
setValue
(
null
);
}
else
{
setValue
(
value
);
}
}
});
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
dateFormat
.
setLenient
(
false
);
binder
.
registerCustomEditor
(
Date
.
class
,
new
CustomDateEditor
(
dateFormat
,
true
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录