Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
youka-manage
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
java-youka-wallet
youka-manage
Commits
0cb948f1
Commit
0cb948f1
authored
Mar 06, 2018
by
Java-聂换换
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加用户
parent
ed351e35
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
223 additions
and
5 deletions
+223
-5
ComCode.java
src/main/java/com/thinkgem/jeesite/common/constant/ComCode.java
+60
-0
MD5.java
src/main/java/com/thinkgem/jeesite/common/utils/MD5.java
+61
-0
YoukaUserService.java
src/main/java/com/thinkgem/jeesite/modules/youka/service/YoukaUserService.java
+7
-1
YoukaUserController.java
src/main/java/com/thinkgem/jeesite/modules/youka/web/YoukaUserController.java
+2
-0
YoukaUserDao.xml
src/main/resources/mappings/modules/youka/YoukaUserDao.xml
+1
-3
userForm.jsp
src/main/webapp/WEB-INF/views/modules/youka/userForm.jsp
+91
-0
userList.jsp
src/main/webapp/WEB-INF/views/modules/youka/userList.jsp
+1
-1
No files found.
src/main/java/com/thinkgem/jeesite/common/constant/ComCode.java
0 → 100644
View file @
0cb948f1
package
com
.
thinkgem
.
jeesite
.
common
.
constant
;
import
java.text.SimpleDateFormat
;
/**
* 常量数据
*/
public
class
ComCode
{
/**
* 加密串
*/
public
static
final
String
signCode
=
"Y0UKA@2018"
;
/**
* 时间相关参数
*/
public
static
final
long
mills
=
1000
;
public
static
final
long
seconds
=
60
;
public
static
final
long
minutes
=
60
;
public
static
final
long
hours
=
24
;
public
static
final
SimpleDateFormat
YYYYMMDD_HHMMSS
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm:ss"
);
/**
* 系统公共
*/
public
static
final
String
STATUS_CODE_2000
=
"2000"
;
public
static
final
String
STATUS_CODE_2000_DESC
=
"成功"
;
public
static
final
String
STATUS_CODE_9999
=
"9999"
;
public
static
final
String
STATUS_CODE_9999_DESC
=
"验证SIGN失败"
;
public
static
final
String
STATUS_CODE_9998
=
"9998"
;
public
static
final
String
STATUS_CODE_9998_DESC
=
"通用异常"
;
/**
* 验证码
*/
public
static
final
String
STATUS_CODE_3001
=
"3001"
;
public
static
final
String
STATUS_CODE_3001_DESC
=
"验证码未输入功能代码或手机号"
;
/**
* 用户相关
*/
public
static
final
String
STATUS_CODE_4001
=
"4001"
;
public
static
final
String
STATUS_CODE_4001_DESC
=
"必传信息为空"
;
public
static
final
String
STATUS_CODE_4002
=
"4002"
;
public
static
final
String
STATUS_CODE_4002_DESC
=
"用户名或密码错误"
;
public
static
final
String
STATUS_CODE_4003
=
"4003"
;
public
static
final
String
STATUS_CODE_4003_DESC
=
"用户名或验证码错误"
;
public
static
final
String
STATUS_CODE_4004
=
"4004"
;
public
static
final
String
STATUS_CODE_4004_DESC
=
"该手机号尚未注册,请注册后登录"
;
public
static
final
String
STATUS_CODE_4005
=
"4005"
;
public
static
final
String
STATUS_CODE_4005_DESC
=
"修改密码失败"
;
public
static
final
String
STATUS_CODE_4006
=
"4006"
;
public
static
final
String
STATUS_CODE_4006_DESC
=
"系统中没有该推荐用户"
;
public
static
final
String
STATUS_CODE_4007
=
"4007"
;
public
static
final
String
STATUS_CODE_4007_DESC
=
"注册手机号已存在"
;
public
static
final
String
STATUS_CODE_4008
=
"4008"
;
public
static
final
String
STATUS_CODE_4008_DESC
=
"注册手机号与推荐手机号重复"
;
public
static
final
String
STATUS_CODE_4009
=
"4009"
;
public
static
final
String
STATUS_CODE_4009_DESC
=
"验证码已过期"
;
public
static
final
String
STATUS_CODE_4010
=
"4010"
;
public
static
final
String
STATUS_CODE_4010_DESC
=
"验证码场景错误"
;
}
src/main/java/com/thinkgem/jeesite/common/utils/MD5.java
0 → 100644
View file @
0cb948f1
package
com
.
thinkgem
.
jeesite
.
common
.
utils
;
import
org.apache.commons.codec.digest.DigestUtils
;
/**
* Created by houkang on 2017/7/17.
*/
public
class
MD5
{
/**
* 签名字符串
* @param text 需要签名的字符串
* @param key 密钥
* @param input_charset 编码格式
* @return 签名结果
*/
public
static
String
sign
(
String
text
,
String
key
,
String
input_charset
)
{
text
=
text
+
key
;
return
DigestUtils
.
md5Hex
(
getContentBytes
(
text
,
input_charset
));
}
/**
* 签名字符串
* @param text 需要签名的字符串
* @param sign 签名结果
* @param key 密钥
* @param input_charset 编码格式
* @return 签名结果
*/
public
static
boolean
verify
(
String
text
,
String
sign
,
String
key
,
String
input_charset
)
{
text
=
text
+
key
;
String
mysign
=
DigestUtils
.
md5Hex
(
getContentBytes
(
text
,
input_charset
));
if
(
mysign
.
equals
(
sign
))
{
return
true
;
}
else
{
return
false
;
}
}
/**
* @param content
* @param charset
* @return
*/
private
static
byte
[]
getContentBytes
(
String
content
,
String
charset
)
{
if
(
charset
==
null
)
{
return
content
.
getBytes
();
}
try
{
return
content
.
getBytes
(
charset
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"MD5签名过程中出现错误,指定的编码集不对,您目前指定的编码集是:"
+
charset
);
}
}
}
src/main/java/com/thinkgem/jeesite/modules/youka/service/YoukaUserService.java
View file @
0cb948f1
package
com
.
thinkgem
.
jeesite
.
modules
.
youka
.
service
;
import
com.thinkgem.jeesite.common.config.Global
;
import
com.thinkgem.jeesite.common.constant.ComCode
;
import
com.thinkgem.jeesite.common.persistence.Page
;
import
com.thinkgem.jeesite.common.service.CrudService
;
import
com.thinkgem.jeesite.common.utils.DateUtils
;
import
com.thinkgem.jeesite.common.utils.IdGen
;
import
com.thinkgem.jeesite.common.utils.MD5
;
import
com.thinkgem.jeesite.common.utils.StringUtils
;
import
com.thinkgem.jeesite.modules.cms.dao.ArticleDao
;
import
com.thinkgem.jeesite.modules.cms.entity.Article
;
...
...
@@ -39,6 +41,7 @@ public class YoukaUserService extends CrudService<YoukaUserDao, YoukaUser> {
private
YoukaCardDao
youkaCardDao
;
@Override
@Transactional
(
readOnly
=
false
)
public
void
save
(
YoukaUser
youkaUser
){
if
(
youkaUser
.
getId
()
!=
null
&&
!
""
.
equals
(
youkaUser
.
getId
())){
// youkaUser.setUpdateBy(UserUtils.getUser());
...
...
@@ -74,9 +77,12 @@ public class YoukaUserService extends CrudService<YoukaUserDao, YoukaUser> {
youkaUser
.
setSubMerchantId
(
subMerchantId
);
// 保存用户信息
String
code
=
IdGen
.
randomBase62
(
64
);
youkaUser
.
setNickname
(
"E_"
+
youkaUser
.
getMobile
());
youkaUser
.
setBelongTo
(
"B"
);
youkaUser
.
setStatus
(
"0"
);
youkaUser
.
setCode
(
code
);
youkaUser
.
setAvatar
(
StringUtils
.
replace
(
youkaUser
.
getAvatar
(),
Global
.
IMAGE_SAVE_URL
,
""
));
youkaUser
.
setPassword
(
MD5
.
sign
(
youkaUser
.
getPassword
(),
ComCode
.
signCode
,
"utf-8"
));
dao
.
insert
(
youkaUser
);
YoukaUserDetail
youkaUserDetail
=
youkaUser
.
getYoukaUserDetail
();
if
(
youkaUserDetail
!=
null
){
...
...
src/main/java/com/thinkgem/jeesite/modules/youka/web/YoukaUserController.java
View file @
0cb948f1
...
...
@@ -126,7 +126,9 @@ public class YoukaUserController extends BaseController {
addMessage
(
redirectAttributes
,
"保存用户'"
+
youkaUser
.
getMobile
()
+
"'成功"
);
return
"redirect:"
+
adminPath
+
"/youka/user/list?repage"
;
}
catch
(
Exception
e
){
addMessage
(
redirectAttributes
,
"保存用户'"
+
youkaUser
.
getMobile
()
+
"失败"
);
e
.
printStackTrace
();
}
return
"redirect:"
+
adminPath
+
"/youka/user/list?repage"
;
}
...
...
src/main/resources/mappings/modules/youka/YoukaUserDao.xml
View file @
0cb948f1
...
...
@@ -105,7 +105,6 @@
<insert
id=
"insert"
>
INSERT INTO youka_users(
id,
`code`,
`nickname`,
`sub_merchant_id`,
...
...
@@ -122,10 +121,9 @@
`update_date`,
`update_by`
) VALUES (
#{id},
#{code},
#{nickname},
#{sub
_m
erchantId},
#{sub
M
erchantId},
#{level} ,
#{mobile} ,
#{password},
...
...
src/main/webapp/WEB-INF/views/modules/youka/userForm.jsp
0 → 100644
View file @
0cb948f1
<
%@
page
contentType=
"text/html;charset=UTF-8"
%
>
<
%@
include
file=
"/WEB-INF/views/include/taglib.jsp"
%
>
<html>
<head>
<title>
用户管理
</title>
<meta
name=
"decorator"
content=
"default"
/>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
"#no"
).
focus
();
$
(
"#inputForm"
).
validate
({
submitHandler
:
function
(
form
){
loading
(
'正在提交,请稍等...'
);
form
.
submit
();
},
errorContainer
:
"#messageBox"
,
errorPlacement
:
function
(
error
,
element
)
{
$
(
"#messageBox"
).
text
(
"输入有误,请先更正。"
);
if
(
element
.
is
(
":checkbox"
)
||
element
.
is
(
":radio"
)
||
element
.
parent
().
is
(
".input-append"
)){
error
.
appendTo
(
element
.
parent
().
parent
());
}
else
{
error
.
insertAfter
(
element
);
}
}
});
});
</script>
</head>
<body>
<ul
class=
"nav nav-tabs"
>
<li><a
href=
"${ctx}/youka/user/list"
>
用户列表
</a></li>
<li
class=
"active"
><a
href=
"${ctx}/youka/user/form?id=${user.id}"
>
用户
<shiro:hasPermission
name=
"sys:user:edit"
>
'添加'
</shiro:hasPermission><shiro:lacksPermission
name=
"sys:user:edit"
>
查看
</shiro:lacksPermission></a></li>
</ul><br/>
<form:form
id=
"inputForm"
modelAttribute=
"youkaUser"
action=
"${ctx}/youka/user/save"
method=
"post"
class=
"form-horizontal"
>
<form:hidden
path=
"id"
/>
<sys:message
content=
"${message}"
/>
<div
class=
"control-group"
>
<label
class=
"control-label"
>
头像:
</label>
<div
class=
"controls"
>
<form:hidden
id=
"nameImage"
path=
"avatar"
htmlEscape=
"false"
maxlength=
"255"
class=
"input-xlarge"
/>
<sys:ckfinder
input=
"nameImage"
type=
"images"
uploadPath=
"/photo"
selectMultiple=
"false"
maxWidth=
"100"
maxHeight=
"100"
/>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
>
用户类型:
</label>
<div
class=
"controls"
>
<form:select
path=
"level"
cssStyle=
"width: 100px"
>
<form:option
value=
"S"
>
管理员
</form:option>
<form:option
value=
"A"
>
王者会员
</form:option>
<form:option
value=
"B"
>
钻石会员
</form:option>
<form:option
value=
"C"
>
黄金会员
</form:option>
<form:option
value=
"D"
>
白银会员
</form:option>
<form:option
value=
"E"
>
青铜会员
</form:option>
</form:select>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
>
手机号:
</label>
<div
class=
"controls"
>
<form:input
path=
"mobile"
htmlEscape=
"false"
maxlength=
"50"
class=
"input-medium required"
/>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
>
密码:
</label>
<div
class=
"controls"
>
<input
id=
"password"
name=
"password"
type=
"password"
value=
""
maxlength=
"50"
minlength=
"3"
class=
"required"
/>
<span
class=
"help-inline"
><font
color=
"red"
>
*
</font>
</span>
</div>
</div>
<div
class=
"form-actions"
>
<shiro:hasPermission
name=
"sys:user:edit"
><input
id=
"btnSubmit"
class=
"btn btn-primary"
type=
"submit"
value=
"保 存"
/>
</shiro:hasPermission>
<input
id=
"btnCancel"
class=
"btn"
type=
"button"
value=
"返 回"
onclick=
"history.go(-1)"
/>
</div>
</form:form>
</body>
</html>
\ No newline at end of file
src/main/webapp/WEB-INF/views/modules/youka/userList.jsp
View file @
0cb948f1
...
...
@@ -2,7 +2,7 @@
<
%@
include
file=
"/WEB-INF/views/include/taglib.jsp"
%
>
<html>
<head>
<title>
用户
列表
</title>
<title>
用户
管理
</title>
<meta
name=
"decorator"
content=
"default"
/>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment