Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
zhdtypt
提交
eba14cce
Z
zhdtypt
项目概览
爱吃血肠
/
zhdtypt
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zhdtypt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
eba14cce
编写于
8月 31, 2017
作者:
爱吃血肠
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
整合用户分配角色
上级
2ba74db9
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
1654 addition
and
1 deletion
+1654
-1
WebRoot/WEB-INF/views/checkAccount/checkAccount.jsp
WebRoot/WEB-INF/views/checkAccount/checkAccount.jsp
+353
-0
WebRoot/WEB-INF/views/checkAccount/checkAccountComplete.jsp
WebRoot/WEB-INF/views/checkAccount/checkAccountComplete.jsp
+20
-0
WebRoot/WEB-INF/views/checkAccount/checkAccountFailed.jsp
WebRoot/WEB-INF/views/checkAccount/checkAccountFailed.jsp
+20
-0
WebRoot/WEB-INF/views/index/index.jsp
WebRoot/WEB-INF/views/index/index.jsp
+1
-1
WebRoot/static/js/jquery.optiscroll.js
WebRoot/static/js/jquery.optiscroll.js
+910
-0
src/main/java/com/newage/iep/action/checkAccount/CheckAccountAction.java
...om/newage/iep/action/checkAccount/CheckAccountAction.java
+143
-0
src/main/java/com/newage/iep/pojos/Role.hbm.xml
src/main/java/com/newage/iep/pojos/Role.hbm.xml
+3
-0
src/main/java/com/newage/iep/pojos/Role.java
src/main/java/com/newage/iep/pojos/Role.java
+9
-0
src/main/java/com/newage/iep/serivce/checkAccount/CheckAccountService.java
.../newage/iep/serivce/checkAccount/CheckAccountService.java
+41
-0
src/main/java/com/newage/iep/serivce/impl/account/checkAccount/CheckAccountServiceImpl.java
...ce/impl/account/checkAccount/CheckAccountServiceImpl.java
+145
-0
src/main/resources/struts-config/struts_website.xml
src/main/resources/struts-config/struts_website.xml
+9
-0
未找到文件。
WebRoot/WEB-INF/views/checkAccount/checkAccount.jsp
0 → 100644
浏览文件 @
eba14cce
<%@page
language=
"java"
import=
"java.util.*"
pageEncoding=
"UTF-8"
%>
<%@ taglib
uri=
"/struts-tags"
prefix=
"s"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<%
String
path
=
request
.
getContextPath
();
String
basePath
=
request
.
getScheme
()+
"://"
+
request
.
getServerName
()+
":"
+
request
.
getServerPort
()+
path
+
"/"
;
%>
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
管理审核注册
</title>
<script
type=
"text/javascript"
src=
"
<c:url
value=
"/static/js/jquery-2.1.1.min.js"
/>
"
></script>
<link
rel=
"stylesheet"
href=
"/static/css/bootstrap/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"/static/css/optiscroll.css"
>
<style>
body
{
padding
:
15px
;
background
:
rgb
(
229
,
243
,
233
);
}
.show
{
display
:
block
;
}
.hide
{
display
:
none
;
}
body
{
padding
:
80px
;
}
#startbtn
{
margin
:
20px
;
}
#waitAudit
{
background
:
darkred
;
border-radius
:
20px
;
border
:
solid
4px
darkred
;
/*opacity: 0.8;*/
box-shadow
:
0px
0px
10px
6px
darkred
;
margin-bottom
:
10px
;
padding
:
20px
;
color
:
#ffffff
;
}
#waitAudit
table
>
tbody
>
tr
{
/*cursor: pointer;*/
}
#waitAudit
table
>
tbody
>
tr
:hover
{
cursor
:
pointer
;
background
:
#286385
;
}
#presentAudit
{
margin-top
:
20px
;
border
:
solid
4px
#539a4a
;
box-shadow
:
0px
0px
10px
6px
#539a4a
;
border-radius
:
20px
;
padding
:
20px
;
display
:
none
;
background
:
#539a4a
;
color
:
#ffffff
;
}
#presentAudit
.operate
{
padding-bottom
:
20px
;
}
#presentAudit
.operate
.btns
{
margin
:
80px
auto
;
/*display: none;*/
}
#manage
{
border
:
solid
4px
#ec971f
;
box-shadow
:
0px
0px
10px
6px
#ec971f
;
border-radius
:
20px
;
padding
:
10px
;
margin-top
:
20px
;
display
:
none
;
background
:
#ec971f
;
}
#manage
select
{
margin
:
0
auto
;
border-radius
:
5px
;
border
:
solid
1px
#539a4a
;
box-shadow
:
0px
0px
3px
1px
#4e9a49
;
margin-bottom
:
3px
;
background
:
#f7ecb5
;
font-size
:
18px
;
}
#manage
.chooserole
{
/*display: none;*/
}
#manage
.sendmsg
{
/*display: none;*/
}
button
:hover
{
border
:
solid
1px
#2a9a71
;
box-shadow
:
0px
0px
3px
1px
#2a9a71
;
}
</style>
</head>
<body>
<div
class=
"container"
>
<div
class=
"row clearfix"
id=
"waitAudit"
>
<div
class=
"table-responsive"
>
<table
class=
"table table-hover"
class=
"waitAuditTable"
style=
"font-size: 18px;"
>
<caption
class=
"text-center"
><h2
style=
"color: #ffffff"
>
等待审核的账号
</h2></caption>
<thead>
<tr>
<th>
姓名
</th>
<th>
邮箱
</th>
<th>
状态
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody>
<s:iterator
value=
"%{#request.checkAccountList}"
id=
"TAccountEntity"
>
<tr>
<td><s:property
value=
"#TAccountEntity.name"
/></td>
<td><s:property
value=
"#TAccountEntity.email"
/></td>
<td>
未审核
</td>
<td><input
type=
"button"
value=
"详细信息"
style=
"background-color:#FFB90F"
name=
"${TAccountEntity.email}"
class=
"btn1"
/></td>
</tr>
</s:iterator>
</tbody>
</table>
</div>
</div>
<div
class=
"row clearfix"
id=
"startbtn"
>
<div
class=
"col-md-12 column"
>
<button
type=
"button"
class=
"btn btn-warning btn-lg active center-block"
>
开始审核注册账号
</button>
</div>
</div>
<div
class=
"row clearfix"
id=
"presentAudit"
>
<h2
class=
"text-center"
style=
"color: #ffffff"
>
详细信息
</h2>
<div
class=
"col-md-6 column"
>
<form
class=
"form-horizontal"
role=
"form"
style=
"font-size: 18px;"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
邮箱
</label>
<div
class=
"col-sm-10"
>
<p
class=
"form-control-static"
name=
"email"
id=
"email"
>
_ _ _ _
</p>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
密码
</label>
<div
class=
"col-sm-10"
>
<p
class=
"form-control-static"
name=
"password"
id=
"password"
>
_ _ _ _
</p>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
姓名
</label>
<div
class=
"col-sm-10"
>
<p
class=
"form-control-static"
name=
"name"
id=
"name"
>
_ _ _ _
</p>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
性别
</label>
<div
class=
"col-sm-10"
>
<p
class=
"form-control-static"
name=
"sex"
id=
"sex"
>
_ _ _ _
</p>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
身份证号
</label>
<div
class=
"col-sm-10"
>
<p
class=
"form-control-static"
name=
"idCard"
id=
"idCard"
>
_ _ _ _
</p>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
出生日期
</label>
<div
class=
"col-sm-10"
>
<p
class=
"form-control-static"
name=
"birthdate"
id=
"birthdate"
>
_ _ _ _
</p>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
组织代码
</label>
<div
class=
"col-sm-10"
>
<p
class=
"form-control-static"
name=
"organize"
id=
"organize"
>
_ _ _ _
</p>
</div>
</div>
</form>
</div>
<div
class=
"col-md-6 column operate"
>
<div
class=
"btns"
style=
"width: 80%;"
>
<button
type=
"button"
id=
"passbtn"
class=
"btn btn-danger btn-default btn-block active"
disabled=
"disabled"
>
通过并分配角色
</button>
<button
type=
"button"
id=
"falsebtn"
class=
"btn btn-default btn-block btn-primary active"
disabled=
"disabled"
>
不能通过
</button>
<button
type=
"button"
id=
"backbtn"
class=
"btn btn-warning btn-block btn-primary active"
>
返回
</button>
</div>
</div>
</div>
<div
class=
"row clearfix"
id=
"manage"
>
<div
class=
"row chooserole"
>
<h2
class=
"text-center"
style=
"color: #ffffff"
>
分配角色:
</h2>
<div
class=
"roles col-sm-6"
>
<select
name=
"roles"
multiple=
"multiple"
class=
"optiscroll center-block"
id=
"roles"
style=
" width: 60%;height: 250px"
>
<s:iterator
value=
"%{#request.roleList}"
id=
"TRoleEntity"
>
<option
value=
<s:property
value=
"#TRoleEntity.Role_id"
/>
>
<s:property
value=
"#TRoleEntity.Role_name"
/>
</option
>
</s:iterator>
</select>
<button
type=
"button"
id=
"add"
style=
"width: 60%"
class=
"btn btn-block btn-success center-block"
>
选中点击添加角色
</button>
</div>
<div
class=
"alreadychoose col-sm-6"
style=
"margin-bottom: 10px;"
>
<select
name=
"roles"
multiple=
"multiple"
class=
"optiscroll center-block"
id=
"choosedroles"
style=
"width: 60%;height: 250px"
>
</select>
<button
type=
"button"
id=
"remove"
style=
"width: 60%"
class=
"btn btn-block btn-success center-block"
>
选中点击删除角色
</button>
</div>
<div
class=
"center-block"
style=
""
>
<!--<button type="button" class="btn btn-warning " style="width: 150px;">返回</button>-->
<button
type=
"button"
class=
"btn center-block"
id=
"successbtn"
dstyle=
"width: 150px;background: #286385;color: #fff"
>
确定通过
</button>
</div>
</div>
<div
class=
"sendmsg"
>
<button
type=
"button"
class=
"btn center-block"
id=
"failbtn"
style=
"width: 150px;background: #286385;color: #fff"
>
确定不通过
</button>
</div>
</div>
</div>
<script
src=
"/static/js/jquery-2.1.1.min.js"
></script>
<script
src=
"/static/js/bootstrap/bootstrap.min.js"
></script>
<script
src=
"/static/js/jquery.optiscroll.js"
></script>
<!--滚动条样式-->
<script>
$
(
function
()
{
$
(
'
#startbtn
'
).
on
(
'
click
'
,
function
()
{
$
(
this
).
removeClass
(
'
show
'
).
addClass
(
'
hide
'
);
$
(
'
#presentAudit
'
).
addClass
(
'
show
'
)
})
$
(
'
#backbtn
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#presentAudit
'
).
removeClass
(
'
show
'
).
addClass
(
'
hide
'
);
$
(
'
#startbtn
'
).
removeClass
(
'
hide
'
).
addClass
(
'
show
'
);
$
(
'
#manage
'
).
removeClass
(
'
show
'
).
addClass
(
'
hide
'
);
})
$
(
'
#passbtn
'
).
on
(
'
click
'
,
function
()
{
// $('#btns').toggleClass('hide');
$
(
'
#manage
'
).
removeClass
(
'
hide
'
).
addClass
(
'
show
'
);
$
(
'
#manage .chooserole
'
).
removeClass
(
'
hide
'
).
addClass
(
'
show
'
);
$
(
'
#manage .sendmsg
'
).
removeClass
(
'
show
'
).
addClass
(
'
hide
'
);
})
$
(
'
#falsebtn
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#manage
'
).
removeClass
(
'
hide
'
).
addClass
(
'
show
'
);
$
(
'
#manage .sendmsg
'
).
removeClass
(
'
hide
'
).
addClass
(
'
show
'
);
$
(
'
#manage .chooserole
'
).
removeClass
(
'
show
'
).
addClass
(
'
hide
'
);
})
$
(
'
#add
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#roles option:selected
'
).
appendTo
(
'
#choosedroles
'
);
})
$
(
'
#remove
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#choosedroles option:selected
'
).
appendTo
(
'
#roles
'
);
})
})
</script>
<script
type=
"text/javascript"
>
</script>
</body>
<script
type=
"text/javascript"
>
var
returnArray
=
[];
var
value
;
/* 点击按钮触发 点击详细信息把待审核的信息加载出来 */
$
(
'
.btn1
'
).
on
(
'
click
'
,
function
(
email
)
{
value
=
$
(
this
).
attr
(
"
name
"
);
// $(this)表示获取当前被点击元素的name值 即邮箱的值
$
.
ajax
({
//提交方式
type
:
"
GET
"
,
//访问servleturl
url
:
"
CheckAccount_queryPersons.do?param=
"
+
value
,
dataType
:
"
json
"
,
success
:
function
(
data
)
{
var
jsonStr
=
data
;
var
jsonObj
=
JSON
.
parse
(
jsonStr
);
//Juery 写法 var jsonObj = $.parseJSON(jsonStr)
// console.log(jsonStr);
console
.
log
(
jsonObj
);
if
(
returnArray
[
0
]
!=
null
)
{
returnArray
[
0
]
=
jsonObj
[
0
].
account_0_id
;
}
else
{
returnArray
.
push
(
jsonObj
[
0
].
account_0_id
);
}
// returnString="account0Id="+jsonObj[0].account0Id+",roleId=123123123123123";
//把按钮 变成可点击
$
(
"
#passbtn
"
).
attr
(
'
disabled
'
,
false
);
$
(
"
#falsebtn
"
).
attr
(
'
disabled
'
,
false
);
//设置属性
$
(
'
#name
'
).
html
(
jsonObj
[
0
].
name
);
$
(
'
#email
'
).
html
(
jsonObj
[
0
].
email
);
$
(
'
#password
'
).
html
(
jsonObj
[
0
].
password
);
$
(
'
#idCard
'
).
html
(
jsonObj
[
0
].
id_number
);
$
(
'
#sex
'
).
html
(
jsonObj
[
0
].
sex
);
var
myear
=
jsonObj
[
0
].
bath
.
year
;
var
mmonth
=
jsonObj
[
0
].
bath
.
month
+
1
;
var
mdate
=
jsonObj
[
0
].
bath
.
date
;
$
(
'
#birthdate
'
).
html
(
myear
+
"
年
"
+
mmonth
+
"
月
"
+
mdate
+
"
日
"
);
$
(
'
#organize
'
).
html
(
jsonObj
[
0
].
cmp_id
);
}
});
})
/*为用户分配角色*/
$
(
'
#successbtn
'
).
on
(
'
click
'
,
function
()
{
var
list
=
$
(
'
#choosedroles option
'
);
list
.
each
(
function
(
index
)
{
returnArray
[
index
+
1
]
=
(
list
[
index
].
value
);
})
console
.
log
(
returnArray
);
var
jsonstr
=
JSON
.
stringify
(
returnArray
);
console
.
log
(
jsonstr
);
// var json=JSON.stringify($("#email").serializeObject());
var
url
=
"
CheckAccount_writeToDataBaseFor1.do?data=
"
+
jsonstr
;
window
.
location
.
href
=
url
;
})
/*审核不通过 value即为邮箱的值*/
$
(
'
#failbtn
'
).
on
(
'
click
'
,
function
()
{
var
url
=
"
CheckAccount_writeToDataBaseFor2.do?data=
"
+
value
;
window
.
location
.
href
=
url
;
})
</script>
<script>
$
(
function
()
{
$
(
'
#startbtn
'
).
on
(
'
click
'
,
function
()
{
$
(
this
).
addClass
(
'
hide
'
);
$
(
'
#presentAudit
'
).
addClass
(
'
show
'
)
})
$
(
'
#backbtn
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#presentAudit
'
).
removeClass
(
'
show
'
);
$
(
'
#startbtn
'
).
removeClass
(
'
hide
'
);
})
$
(
'
#add
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#roles option:selected
'
).
appendTo
(
'
#choosedroles
'
);
})
$
(
'
#remove
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#choosedroles option:selected
'
).
appendTo
(
'
#roles
'
);
})
$
(
'
#passbtn
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#btns
'
).
toggleClass
(
'
hide
'
);
$
(
'
#chooserole
'
).
toggleClass
(
'
show
'
);
})
$
(
'
#falsebtn
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#btns
'
).
toggleClass
(
'
hide
'
);
$
(
'
#sendmsg
'
).
toggleClass
(
'
show
'
);
})
})
</script>
</html>
WebRoot/WEB-INF/views/checkAccount/checkAccountComplete.jsp
0 → 100644
浏览文件 @
eba14cce
<%@page
language=
"java"
import=
"java.util.*"
pageEncoding=
"UTF-8"
%>
<%@ taglib
uri=
"/struts-tags"
prefix=
"s"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<%
String
path
=
request
.
getContextPath
();
String
basePath
=
request
.
getScheme
()+
"://"
+
request
.
getServerName
()+
":"
+
request
.
getServerPort
()+
path
+
"/"
;
%>
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
管理审核注册完成
</title>
</head>
<body
style=
"background-color: white"
>
操作成功
<a
href=
"http://127.0.0.1:8080/CheckAccount_queryByStatus.do"
>
返回
</a>
</body>
</html>
WebRoot/WEB-INF/views/checkAccount/checkAccountFailed.jsp
0 → 100644
浏览文件 @
eba14cce
<%@page
language=
"java"
import=
"java.util.*"
pageEncoding=
"UTF-8"
%>
<%@ taglib
uri=
"/struts-tags"
prefix=
"s"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<%
String
path
=
request
.
getContextPath
();
String
basePath
=
request
.
getScheme
()+
"://"
+
request
.
getServerName
()+
":"
+
request
.
getServerPort
()+
path
+
"/"
;
%>
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
管理审核注册失败
</title>
</head>
<body>
操作失败
<a
href=
"http://127.0.0.1:8080/CheckAccount_queryByStatus.do"
>
返回
</a>
</body>
</html>
WebRoot/WEB-INF/views/index/index.jsp
浏览文件 @
eba14cce
...
...
@@ -255,7 +255,7 @@
<!--</ul>-->
</nav>
</div>
<a
href=
"
manageAudit.html
"
target=
"show"
>
点击进入注册管理
</a>
<br>
<a
href=
"
CheckAccount_queryByStatus.do
"
target=
"show"
>
点击进入注册管理
</a>
<br>
<a
href=
"dataPermission.html"
target=
"show"
>
点击进入数据权限管理
</a>
<br>
<a
href=
"orgdepartment.html"
target=
"show"
>
点击进入组织管理
</a>
<br>
</aside>
...
...
WebRoot/static/js/jquery.optiscroll.js
0 → 100644
浏览文件 @
eba14cce
此差异已折叠。
点击以展开。
src/main/java/com/newage/iep/action/checkAccount/CheckAccountAction.java
0 → 100644
浏览文件 @
eba14cce
package
com.newage.iep.action.checkAccount
;
/**
* Created by qq101 on 2017/8/14.
*/
import
com.newage.iep.pojos.Account
;
import
com.newage.iep.pojos.Role
;
import
com.newage.iep.serivce.checkAccount.CheckAccountService
;
import
com.opensymphony.xwork2.ActionSupport
;
import
com.opensymphony.xwork2.ModelDriven
;
import
net.sf.json.JSONArray
;
import
org.apache.struts2.interceptor.ServletRequestAware
;
import
org.apache.struts2.interceptor.ServletResponseAware
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by a1996_000 on 2017/8/12.
*/
//人员信息
public
class
CheckAccountAction
extends
ActionSupport
implements
ModelDriven
<
Account
>,
ServletRequestAware
,
ServletResponseAware
{
HttpServletRequest
request
;
HttpServletResponse
response
;
String
result
=
null
;
String
result2
=
null
;
private
Account
tAccountEntity
=
new
Account
();
//注入人员信息
@Autowired
@Qualifier
(
"checkAccountService"
)
CheckAccountService
checkAccountService
;
/**
* 查询所有status=0的账户 到达审核账户页面
* @param
*/
public
String
queryByStatus
(){
List
<
Account
>
list
=
checkAccountService
.
queryAccountByStatus
();
//-------添加角色查询
List
<
Role
>
list2
=
checkAccountService
.
queryRoleByLevel
(
"10"
);
request
.
setAttribute
(
"checkAccountList"
,
list
);
request
.
setAttribute
(
"roleList"
,
list2
);
return
"checkAccountList"
;
}
/**
* 查询对应邮箱的账户 即待审核的用户的详细信息进行显示
* @param
*/
@ResponseBody
public
String
queryPersons
()
throws
IOException
{
String
mail
=(
String
)
request
.
getParameter
(
"param"
);
//----test
List
<
Account
>
list
=
new
ArrayList
<
Account
>();
//对用户的信息通过邮箱进行查询
list
=
checkAccountService
.
queryPersonByMail
(
mail
);
result
=
JSONArray
.
fromObject
(
list
).
toString
();
return
"queryString"
;
}
/**
* 为用户分配角色
* @return
* @throws IOException
*/
public
String
writeToDataBaseFor1
()
throws
IOException
{
String
data
=(
String
)
request
.
getParameter
(
"data"
);
String
[]
strArray
=
checkAccountService
.
parseForArray
(
data
);
try
{
for
(
int
i
=
1
;
i
<
strArray
.
length
;
i
++)
{
checkAccountService
.
allotRoleForAccount
(
strArray
[
0
],
strArray
[
i
]);
}
return
"1success"
;
//分配成功
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
"1failed"
;
//分配失败
}
}
/**
* 审核未通过
* @return
* @throws IOException
*/
public
String
writeToDataBaseFor2
()
throws
IOException
{
String
data
=(
String
)
request
.
getParameter
(
"data"
);
System
.
out
.
println
(
"writeToDataBaseFor2-----"
+
data
);
try
{
checkAccountService
.
updateAccountStatusTo2
(
data
);
return
"2success"
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
"2failed"
;
}
}
@Override
public
void
setServletRequest
(
HttpServletRequest
request
)
{
this
.
request
=
request
;
}
@Override
public
void
setServletResponse
(
HttpServletResponse
response
)
{
this
.
response
=
response
;
}
public
String
getResult
()
{
return
result
;
}
public
void
setResult
(
String
result
)
{
this
.
result
=
result
;
}
/**
* 模型驱动
* @return
*/
@Override
public
Account
getModel
()
{
return
tAccountEntity
;
}
}
src/main/java/com/newage/iep/pojos/Role.hbm.xml
浏览文件 @
eba14cce
...
...
@@ -32,5 +32,8 @@
<property
name=
"Modify_date"
>
<column
name=
"Modify_date"
/>
</property>
<property
name=
"Role_level"
>
<column
name=
"Role_level"
/>
</property>
</class>
</hibernate-mapping>
src/main/java/com/newage/iep/pojos/Role.java
浏览文件 @
eba14cce
...
...
@@ -19,6 +19,7 @@ public class Role {
private
Date
Create_date
;
//创建日期
private
String
Modify_by
;
//修改人
private
Date
Modify_date
;
//修改日期
private
String
Role_level
;
//角色等级
public
String
getRole_id
()
{
return
Role_id
;
...
...
@@ -91,4 +92,12 @@ public class Role {
public
void
setModify_date
(
Date
modify_date
)
{
Modify_date
=
modify_date
;
}
public
String
getRole_level
()
{
return
Role_level
;
}
public
void
setRole_level
(
String
role_level
)
{
Role_level
=
role_level
;
}
}
src/main/java/com/newage/iep/serivce/checkAccount/CheckAccountService.java
0 → 100644
浏览文件 @
eba14cce
package
com.newage.iep.serivce.checkAccount
;
import
com.newage.iep.pojos.Account
;
import
com.newage.iep.pojos.Role
;
import
java.util.List
;
/**
* Created by qq101 on 2017/8/14.
*/
public
interface
CheckAccountService
{
/**
* 查询t_account表中Status相应数值的账号----------待审核账号列表
*/
List
<
Account
>
queryAccountByStatus
();
/**
* 查询t_account表中对应Email的账户信息---------用户详细信息查询
*/
List
<
Account
>
queryPersonByMail
(
String
mail
);
/**
* 查询t_role表中所有角色码=10的角色---------用户角色分配
*/
List
<
Role
>
queryRoleByLevel
(
String
number
);
/*
解析数组形式的数据 变成多个参数
*/
String
[]
parseForArray
(
String
data
);
/*
给用户分配角色
*/
void
allotRoleForAccount
(
String
accountId
,
String
RoleId
);
/*
更改用户状态为2 审核没通过
*/
void
updateAccountStatusTo2
(
String
emailName
);
}
src/main/java/com/newage/iep/serivce/impl/account/checkAccount/CheckAccountServiceImpl.java
0 → 100644
浏览文件 @
eba14cce
package
com.newage.iep.serivce.impl.account.checkAccount
;
import
com.newage.iep.business.dao.GenericHibernateDAO
;
import
com.newage.iep.pojos.Account
;
import
com.newage.iep.pojos.AccountRole
;
import
com.newage.iep.pojos.Role
;
import
com.newage.iep.serivce.checkAccount.CheckAccountService
;
import
org.hibernate.Query
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
/**
* Created by qq101 on 2017/8/14.
*/
/**
* 审核用户业务层
*/
@Service
(
"checkAccountService"
)
public
class
CheckAccountServiceImpl
extends
GenericHibernateDAO
implements
CheckAccountService
{
@Override
public
List
<
Account
>
queryAccountByStatus
(){
Query
query
=
this
.
createQuery
(
"from Account ta where ta.status=0"
);
List
<
Account
>
list
=
query
.
list
();
if
(
list
!=
null
){
System
.
out
.
println
(
"querying list by status=0----"
+
list
.
size
());
}
return
list
;
}
/**
* 通过邮箱查询人员中对应的用户
* 查询当前待审核用户的信息
* @param email
* @return
*/
@Override
public
List
<
Account
>
queryPersonByMail
(
String
email
)
{
Query
query
=
this
.
createQuery
(
" from Account ta where ta.email=:email "
);
query
.
setString
(
"email"
,
email
);
List
<
Account
>
list
=
query
.
list
();
if
(
list
!=
null
&&
list
.
size
()==
1
){
Account
account
=
list
.
get
(
0
);
System
.
out
.
println
(
"querying list by email----"
+
list
.
size
());
}
return
list
;
}
/**
* 通过level查询对应的角色 查询出所有的角色为用户分配角色
* @param number ---level
* @return
*/
@Override
public
List
<
Role
>
queryRoleByLevel
(
String
number
){
Query
query
=
this
.
createQuery
(
"from Role tr where tr.Role_level=:number"
);
query
.
setString
(
"number"
,
number
);
List
<
Role
>
list
=
query
.
list
();
if
(
list
!=
null
){
System
.
out
.
println
(
"querying role by Role_level="
+
number
+
"----"
+
list
.
size
());
}
return
list
;
}
/**
* 解析审核用户 分配角色后 前台传来的 String类型的参数 变成String数组
* @param data
* @return String[]
*/
@Override
public
String
[]
parseForArray
(
String
data
){
data
=
data
.
substring
(
1
,
data
.
length
()-
1
);
//去掉两边的[]
String
[]
strArray
=
data
.
split
(
","
);
//用“,”分离
for
(
int
i
=
0
;
i
<
strArray
.
length
;
i
++)
{
strArray
[
i
]=
strArray
[
i
].
substring
(
1
,
strArray
[
i
].
length
()-
1
);
System
.
out
.
println
(
strArray
[
i
]);
}
return
strArray
;
}
/**
* 保存账户 角色关系
* 为用户添加角色信息
* @param accountId
* @param roleId
*/
@Transactional
@Override
public
void
allotRoleForAccount
(
String
accountId
,
String
roleId
){
AccountRole
tAccountRoleEntity
=
new
AccountRole
();
// tAccountRoleEntity.setAccountId(accountId);
// tAccountRoleEntity.setRoleId(roleId);
tAccountRoleEntity
.
setAccount_id
(
accountId
);
tAccountRoleEntity
.
setRole_id
(
roleId
);
try
{
String
hql1
=
"delete from AccountRole tar where tar.account_id=:accountId and tar.role_id=:roleId"
;
Query
query1
=
this
.
createQuery
(
hql1
);
query1
.
setString
(
"accountId"
,
accountId
);
query1
.
setString
(
"roleId"
,
roleId
);
query1
.
executeUpdate
();
save
(
tAccountRoleEntity
);
//设置用户状态为已审核
String
hql2
=
"update Account ta set ta.status=1 where ta.account_0_id=:accountId"
;
Query
query2
=
this
.
createQuery
(
hql2
);
query2
.
setString
(
"accountId"
,
accountId
);
query2
.
executeUpdate
();
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
/**
* 审核未通过
* @param emailName
*/
@Override
@Transactional
public
void
updateAccountStatusTo2
(
String
emailName
){
try
{
String
hql1
=
"update Account ta set ta.status=2 where ta.email=:emailName"
;
Query
query1
=
this
.
createQuery
(
hql1
);
query1
.
setString
(
"emailName"
,
emailName
);
query1
.
executeUpdate
();
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
src/main/resources/struts-config/struts_website.xml
浏览文件 @
eba14cce
...
...
@@ -169,5 +169,14 @@
<param
name=
"actionName"
>
SetAction_toSet
</param>
</result>
</action>
<!--审核用户注册信息-->
<action
name=
"CheckAccount_*"
class=
"com.newage.iep.action.checkAccount.CheckAccountAction"
method=
"{1}"
>
<result
name=
"checkAccountList"
>
/WEB-INF/views/checkAccount/checkAccount.jsp
</result>
<result
name=
"queryString"
type=
"json"
><param
name=
"root"
>
result
<!-- result是action中设置的变量名,也是页面需要返回的数据,该变量必须有setter和getter方法 -->
</param></result>
<result
name=
"1success"
>
/WEB-INF/views/checkAccount/checkAccountComplete.jsp
</result>
<result
name=
"2success"
>
/WEB-INF/views/checkAccount/checkAccountComplete.jsp
</result>
<result
name=
"1failed"
>
/WEB-INF/views/checkAccount/checkAccountFailed.jsp
</result>
<result
name=
"2failed"
>
/WEB-INF/views/checkAccount/checkAccountFailed.jsp
</result>
</action>
</package>
</struts>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录