Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
registration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
13
Issues
13
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
丁伟
registration
Commits
9407336e
Commit
9407336e
authored
Dec 24, 2023
by
丁伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、取消qq邮箱无法注册的问题。
2、增加“是否购买CDCS/CSDG考前培训”
parent
a37736f7
Show whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
538 additions
and
435 deletions
+538
-435
src/main/java/org/ccpit/base/dao/BaseDao.java
+21
-21
src/main/java/org/ccpit/base/dao/IDao.java
+15
-0
src/main/java/org/ccpit/base/modol/BaseEntity.java
+1
-5
src/main/java/org/ccpit/base/role/IRole.java
+2
-0
src/main/java/org/ccpit/base/role/Role.java
+7
-9
src/main/java/org/ccpit/base/role/RoleController.java
+48
-48
src/main/java/org/ccpit/base/role/RoleDao.java
+2
-2
src/main/java/org/ccpit/base/role/RoleService.java
+30
-28
src/main/java/org/ccpit/base/role/RoleUrl.java
+1
-2
src/main/java/org/ccpit/base/security/CmsTagSupport.java
+11
-11
src/main/java/org/ccpit/base/security/LoginFilter.java
+6
-10
src/main/java/org/ccpit/base/security/SecurityAllRoleTag.java
+5
-8
src/main/java/org/ccpit/base/security/SecurityAnyRoleTag.java
+4
-4
src/main/java/org/ccpit/base/security/SecurityUriTag.java
+10
-9
src/main/java/org/ccpit/base/user/IUser.java
+2
-0
src/main/java/org/ccpit/base/user/User.java
+39
-15
src/main/java/org/ccpit/base/user/UserController.java
+39
-48
src/main/java/org/ccpit/base/user/UserDao.java
+11
-9
src/main/java/org/ccpit/base/user/UserService.java
+40
-40
src/main/java/org/ccpit/base/utils/CryptUtil.java
+3
-4
src/main/java/org/ccpit/base/utils/HtmlEscapeUtil.java
+3
-3
src/main/java/org/ccpit/base/utils/ImgFontByte.java
+0
-0
src/main/java/org/ccpit/base/utils/MailSender.java
+9
-9
src/main/java/org/ccpit/base/utils/PasswordHash.java
+2
-4
src/main/java/org/ccpit/base/utils/PopupAuthenticator.java
+1
-0
src/main/java/org/ccpit/base/utils/ReadConfigUtil.java
+5
-5
src/main/java/org/ccpit/base/utils/SqlEscapeUtil.java
+4
-3
src/main/java/org/ccpit/base/utils/UserRolesUtil.java
+1
-2
src/main/java/org/ccpit/base/utils/ValidateCode.java
+25
-26
src/main/java/org/ccpit/base/utils/mailUtil/Mail.java
+23
-4
src/main/java/org/ccpit/base/utils/mailUtil/MailUtil.java
+22
-33
src/main/java/org/ccpit/business/registerManage/ExcelHelper.java
+5
-0
src/main/java/org/ccpit/business/registerManage/RegisterController.java
+0
-2
src/main/java/org/ccpit/business/registerManage/RegisterInfo.java
+13
-1
src/main/resources/framework.properties
+6
-6
src/main/sql/update.sql
+6
-3
src/main/sql/update_20210616.sql
+45
-15
src/main/sql/update_20210702.sql
+11
-4
src/main/sql/update_20211222.sql
+4
-2
src/main/webapp/WEB-INF/jsp/front/info.jsp
+42
-33
src/main/webapp/WEB-INF/jsp/front/reg.jsp
+9
-2
src/main/webapp/WEB-INF/jsp/front/reg2.jsp
+1
-1
src/main/webapp/resource/front/js/reg.js
+4
-4
No files found.
src/main/java/org/ccpit/base/dao/BaseDao.java
View file @
9407336e
...
...
@@ -44,10 +44,10 @@ public class BaseDao<T> implements IDao<T> {
boolean
success
;
try
{
hibernateTemplate
.
saveOrUpdate
(
t
);
success
=
true
;
}
catch
(
Exception
e
)
{
success
=
false
;
throw
new
RuntimeException
(
"save failed"
,
e
);
success
=
true
;
}
catch
(
Exception
e
)
{
success
=
false
;
throw
new
RuntimeException
(
"save failed"
,
e
);
}
return
success
;
}
...
...
@@ -103,10 +103,10 @@ public class BaseDao<T> implements IDao<T> {
boolean
success
;
try
{
hibernateTemplate
.
delete
(
t
);
success
=
true
;
}
catch
(
Exception
e
)
{
success
=
false
;
throw
new
RuntimeException
(
"save failed"
,
e
);
success
=
true
;
}
catch
(
Exception
e
)
{
success
=
false
;
throw
new
RuntimeException
(
"save failed"
,
e
);
}
return
success
;
}
...
...
@@ -121,13 +121,13 @@ public class BaseDao<T> implements IDao<T> {
boolean
success
=
false
;
try
{
T
t
=
queryById
(
id
);
if
(
t
!=
null
)
{
if
(
t
!=
null
)
{
hibernateTemplate
.
delete
(
t
);
success
=
true
;
success
=
true
;
}
}
catch
(
Exception
e
)
{
success
=
false
;
throw
new
RuntimeException
(
"save failed"
,
e
);
}
catch
(
Exception
e
)
{
success
=
false
;
throw
new
RuntimeException
(
"save failed"
,
e
);
}
return
success
;
}
...
...
@@ -146,10 +146,10 @@ public class BaseDao<T> implements IDao<T> {
for
(
int
i
=
0
;
i
<
ts
.
size
();
i
++)
{
hibernateTemplate
.
saveOrUpdate
(
ts
.
get
(
i
));
}
success
=
true
;
}
catch
(
Exception
e
)
{
success
=
false
;
throw
new
RuntimeException
(
"save failed"
,
e
);
success
=
true
;
}
catch
(
Exception
e
)
{
success
=
false
;
throw
new
RuntimeException
(
"save failed"
,
e
);
}
return
success
;
}
...
...
@@ -168,10 +168,10 @@ public class BaseDao<T> implements IDao<T> {
for
(
int
i
=
0
;
i
<
ts
.
size
();
i
++)
{
hibernateTemplate
.
delete
(
ts
.
get
(
i
));
}
success
=
true
;
}
catch
(
Exception
e
)
{
success
=
false
;
throw
new
RuntimeException
(
"save failed"
,
e
);
success
=
true
;
}
catch
(
Exception
e
)
{
success
=
false
;
throw
new
RuntimeException
(
"save failed"
,
e
);
}
return
success
;
...
...
src/main/java/org/ccpit/base/dao/IDao.java
View file @
9407336e
...
...
@@ -11,51 +11,66 @@ import java.util.List;
public
interface
IDao
<
T
>
{
/**
* 实例化一个实体
*
* @param t
*/
public
boolean
save
(
T
t
);
/**
* 实例化所有实体
*
* @param t
*/
public
boolean
saveAll
(
List
<
T
>
list
);
/**
* 删除一个实体
*
* @param t
*/
public
boolean
delete
(
T
t
);
/**
* 删除一个实体
*
* @param id
*/
public
boolean
deleteById
(
long
id
);
/**
* 删除所有实体
*
* @param t
*/
public
boolean
deleteAll
(
List
<
T
>
list
);
/**
* 查询实体
*
* @param t
*/
public
List
<
T
>
query
(
final
String
hql
,
final
Object
...
params
);
/**
* 查询所有
*
* @param t
*/
public
List
<
T
>
queryAll
();
/**
* 分页查询
*
* @param pageRequest
* @param hql
* @param values
* @return
*/
public
Page
findPage
(
PageRequest
pageRequest
,
String
hql
,
Object
[]
values
);
/**
* 获取实体的Class
*
* @param t
*/
public
Class
getEntityClass
();
...
...
src/main/java/org/ccpit/base/modol/BaseEntity.java
View file @
9407336e
package
org
.
ccpit
.
base
.
modol
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
java.io.Serializable
;
import
java.lang.annotation.Inherited
;
/**
* Created by Administrator on 2015/8/13.
*/
public
class
BaseEntity
implements
IEntity
,
Serializable
{
public
class
BaseEntity
implements
IEntity
,
Serializable
{
/**
* Serializable ID
*/
...
...
src/main/java/org/ccpit/base/role/IRole.java
View file @
9407336e
...
...
@@ -7,7 +7,9 @@ import java.util.List;
*/
public
interface
IRole
{
public
String
getRoleName
();
public
List
<
RoleUrl
>
getUrlPerfixs
();
public
long
getId
();
}
src/main/java/org/ccpit/base/role/Role.java
View file @
9407336e
package
org
.
ccpit
.
base
.
role
;
import
org.ccpit.base.modol.BaseEntity
;
import
org.hibernate.annotations.
*
;
import
org.hibernate.annotations.
CacheConcurrencyStrategy
;
import
javax.persistence.*
;
import
javax.persistence.CascadeType
;
import
javax.persistence.Entity
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -36,7 +34,7 @@ public class Role extends BaseEntity implements IRole {
}
@Override
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
fetch
=
FetchType
.
EAGER
)
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
fetch
=
FetchType
.
EAGER
)
public
List
<
RoleUrl
>
getUrlPerfixs
()
{
return
urlPerfixs
;
}
...
...
@@ -55,19 +53,19 @@ public class Role extends BaseEntity implements IRole {
@Override
public
int
hashCode
()
{
return
(
"role"
+
getId
()).
hashCode
();
return
(
"role"
+
getId
()).
hashCode
();
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
o
==
null
)
{
if
(
o
==
null
)
{
return
false
;
}
if
(
o
==
this
)
{
if
(
o
==
this
)
{
return
true
;
}
if
(
o
.
getClass
()
==
Role
.
class
)
{
return
o
.
hashCode
()
==
this
.
hashCode
();
if
(
o
.
getClass
()
==
Role
.
class
)
{
return
o
.
hashCode
()
==
this
.
hashCode
();
}
return
false
;
}
...
...
src/main/java/org/ccpit/base/role/RoleController.java
View file @
9407336e
package
org
.
ccpit
.
base
.
role
;
import
java.io.IOException
;
import
java.util.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
net.sf.json.JSONArray
;
import
org.ccpit.base.controller.BaseController
;
import
org.ccpit.base.controller.Page
;
import
org.ccpit.base.controller.PageRequest
;
import
org.ccpit.base.user.User
;
import
org.ccpit.base.user.UserService
;
...
...
@@ -20,30 +12,38 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by Administrator on 2015/9/6.
*/
@Controller
@RequestMapping
(
"/admin/role"
)
public
class
RoleController
extends
BaseController
{
public
class
RoleController
extends
BaseController
{
@Autowired
private
RoleService
roleService
;
@Autowired
private
UserService
userService
;
@RequestMapping
(
"/goinRoleListPage"
)
public
Object
manage
(){
public
Object
manage
()
{
return
new
ModelAndView
(
"admin/role/roleListPage"
);
}
@RequestMapping
(
"/addRole"
)
public
void
addRole
(
String
roleName
,
String
urlPerfixs
,
String
description
,
HttpServletResponse
response
)
{
public
void
addRole
(
String
roleName
,
String
urlPerfixs
,
String
description
,
HttpServletResponse
response
)
{
String
result
=
""
;
boolean
flag
=
roleService
.
addRole
(
roleName
,
urlPerfixs
,
description
);
if
(
flag
)
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存成功!\" }"
;
}
else
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存失败!\" }"
;
boolean
flag
=
roleService
.
addRole
(
roleName
,
urlPerfixs
,
description
);
if
(
flag
)
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存成功!\" }"
;
}
else
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存失败!\" }"
;
}
try
{
response
.
setContentType
(
"text/html"
);
...
...
@@ -52,28 +52,28 @@ public class RoleController extends BaseController{
e
.
printStackTrace
();
}
}
/**
*
* addRolePri:(添加角色操作权限). <br/>
* TODO(这里描述这个方法适用条件 – 可选).<br/>
* TODO(这里描述这个方法的执行流程 – 可选).<br/>
* TODO(这里描述这个方法的使用方法 – 可选).<br/>
* TODO(这里描述这个方法的注意事项 – 可选).<br/>
*
* @author dingwei
* @return
* @author dingwei
* @since JDK 1.6
*/
@RequestMapping
(
"/addRolePri"
)
public
void
addRolePri
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
void
addRolePri
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
String
result
=
""
;
String
roleId
=
request
.
getParameter
(
"roleId"
);
String
urlPrefixs
=
request
.
getParameter
(
"priIds"
);
boolean
flag
=
roleService
.
editRole
(
Long
.
valueOf
(
roleId
),
""
,
urlPrefixs
,
""
);
if
(
flag
)
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存成功!\" }"
;
}
else
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存失败!\" }"
;
if
(
flag
)
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存成功!\" }"
;
}
else
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存失败!\" }"
;
}
try
{
response
.
setContentType
(
"text/html"
);
...
...
@@ -84,13 +84,13 @@ public class RoleController extends BaseController{
}
@RequestMapping
(
"/editRole/{id}"
)
public
void
editRole
(
@PathVariable
long
id
,
String
roleName
,
String
urlPerfixs
,
String
description
,
HttpServletResponse
response
)
{
public
void
editRole
(
@PathVariable
long
id
,
String
roleName
,
String
urlPerfixs
,
String
description
,
HttpServletResponse
response
)
{
String
result
=
""
;
boolean
flag
=
roleService
.
editRole
(
id
,
roleName
,
urlPerfixs
,
description
);
if
(
flag
)
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存成功!\" }"
;
}
else
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存失败!\" }"
;
boolean
flag
=
roleService
.
editRole
(
id
,
roleName
,
urlPerfixs
,
description
);
if
(
flag
)
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存成功!\" }"
;
}
else
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存失败!\" }"
;
}
try
{
response
.
setContentType
(
"text/html"
);
...
...
@@ -102,9 +102,9 @@ public class RoleController extends BaseController{
@RequestMapping
(
"/userRoles/{id}"
)
@ResponseBody
public
Object
userRoles
(
@PathVariable
long
id
){
public
Object
userRoles
(
@PathVariable
long
id
)
{
User
user
=
userService
.
getUser
(
id
);
if
(
user
!=
null
)
{
if
(
user
!=
null
)
{
return
userService
.
getUserRoles
(
user
);
}
return
"false"
;
...
...
@@ -112,12 +112,12 @@ public class RoleController extends BaseController{
@RequestMapping
(
"/delRoles"
)
@ResponseBody
public
Object
delRoles
(
HttpServletRequest
request
){
public
Object
delRoles
(
HttpServletRequest
request
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
String
jsonIds
=
request
.
getParameter
(
"ids"
);
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
jsonIds
);
Object
[]
ids
=
jsonArray
.
toArray
();
for
(
Object
str
:
ids
)
{
for
(
Object
str
:
ids
)
{
boolean
flag
=
roleService
.
deleteRole
((
Integer
)
str
);
}
map
.
put
(
"flag"
,
true
);
...
...
@@ -127,7 +127,7 @@ public class RoleController extends BaseController{
@RequestMapping
(
"/saveUserRoles/{id}"
)
@ResponseBody
public
Object
saveUserRoles
(
@PathVariable
long
id
,
HttpServletRequest
request
,
String
[]
ids
)
{
public
Object
saveUserRoles
(
@PathVariable
long
id
,
HttpServletRequest
request
,
String
[]
ids
)
{
System
.
out
.
println
(
ids
);
User
user
=
userService
.
getUser
(
id
);
//todo save
...
...
@@ -135,14 +135,14 @@ public class RoleController extends BaseController{
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
ids
);
Object
[]
arr
=
jsonArray
.
toArray
();
Long
[]
longs
=
new
Long
[
arr
.
length
];
for
(
int
i
=
0
;
i
<
arr
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
arr
.
length
;
i
++)
{
longs
[
i
]
=
Long
.
parseLong
(
arr
[
i
].
toString
());
}
boolean
flag
=
userService
.
saveUserRoles
(
user
,
longs
);
if
(
flag
){
boolean
flag
=
userService
.
saveUserRoles
(
user
,
longs
);
if
(
flag
)
{
map
.
put
(
"flag"
,
true
);
map
.
put
(
"info"
,
"数据删除成功!"
);
}
else
{
}
else
{
map
.
put
(
"flag"
,
false
);
map
.
put
(
"info"
,
"保存失败!"
);
}
...
...
@@ -152,15 +152,15 @@ public class RoleController extends BaseController{
@RequestMapping
(
"/getAllRoles"
)
@ResponseBody
public
Object
getAllRoles
(
HttpServletRequest
request
){
public
Object
getAllRoles
(
HttpServletRequest
request
)
{
PageRequest
pageRequest
=
getPage
(
request
);
String
roleName
=
request
.
getParameter
(
"roleName"
);
StringBuffer
hql
=
new
StringBuffer
(
"from Role where 1=1"
);
if
(
null
==
roleName
)
{
if
(
null
==
roleName
)
{
}
else
{
if
(
null
!=
roleName
)
{
hql
.
append
(
" and roleName like '%"
+
roleName
+
"%'"
);
}
else
{
if
(
null
!=
roleName
)
{
hql
.
append
(
" and roleName like '%"
+
roleName
+
"%'"
);
}
}
List
<
Role
>
pageRole
=
roleService
.
getAll
(
hql
.
toString
());
...
...
@@ -169,10 +169,10 @@ public class RoleController extends BaseController{
@RequestMapping
(
"/getRoleByID"
)
@ResponseBody
public
Role
getRoleByID
(
HttpServletRequest
request
)
{
public
Role
getRoleByID
(
HttpServletRequest
request
)
{
String
roleId
=
request
.
getParameter
(
"roleId"
);
Role
role
=
null
;
if
(
null
!=
roleId
)
{
if
(
null
!=
roleId
)
{
role
=
roleService
.
get
(
Long
.
valueOf
(
roleId
));
}
return
role
;
...
...
@@ -180,11 +180,11 @@ public class RoleController extends BaseController{
@RequestMapping
(
"/getRolesList"
)
@ResponseBody
public
Object
getRolesList
(
HttpServletRequest
request
)
{
public
Object
getRolesList
(
HttpServletRequest
request
)
{
List
<
Role
>
listBo
=
roleService
.
getAllRoles
();
List
list
=
new
ArrayList
();
if
(
null
!=
listBo
)
{
for
(
int
i
=
0
;
i
<
listBo
.
size
();
i
++)
{
if
(
null
!=
listBo
)
{
for
(
int
i
=
0
;
i
<
listBo
.
size
();
i
++)
{
Map
result
=
new
HashMap
();
result
.
put
(
"id"
,
listBo
.
get
(
i
).
getId
());
result
.
put
(
"text"
,
listBo
.
get
(
i
).
getRoleName
());
...
...
src/main/java/org/ccpit/base/role/RoleDao.java
View file @
9407336e
...
...
@@ -9,8 +9,8 @@ import org.springframework.stereotype.Repository;
*/
@Repository
public
class
RoleDao
extends
BaseDao
<
Role
>
{
public
Role
getRoleByUrl
(
String
url
){
Role
role
=
findUnique
(
"select r from "
+
Role
.
class
.
getName
()+
" as r left join r.urlPerfixs as p where p.url = ?"
,
new
String
[]{
url
});
public
Role
getRoleByUrl
(
String
url
)
{
Role
role
=
findUnique
(
"select r from "
+
Role
.
class
.
getName
()
+
" as r left join r.urlPerfixs as p where p.url = ?"
,
new
String
[]{
url
});
return
role
;
}
}
src/main/java/org/ccpit/base/role/RoleService.java
View file @
9407336e
...
...
@@ -5,14 +5,15 @@ import org.ccpit.base.controller.Convert;
import
org.ccpit.base.controller.Page
;
import
org.ccpit.base.controller.PageBo
;
import
org.ccpit.base.controller.PageRequest
;
import
org.ccpit.base.user.UserDao
;
import
org.ccpit.base.utils.UrlRolesMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
javax.transaction.Transactional
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by Administrator on 2015/9/6.
...
...
@@ -25,7 +26,7 @@ public class RoleService {
@Autowired
private
UrlRolesMapper
mapper
;
public
boolean
addRole
(
String
roleName
,
String
url
,
String
description
)
{
public
boolean
addRole
(
String
roleName
,
String
url
,
String
description
)
{
Role
role
=
new
Role
();
role
.
setRoleName
(
roleName
);
role
.
setDescription
(
description
);
...
...
@@ -46,14 +47,14 @@ public class RoleService {
return
result
;
}
public
boolean
editRole
(
long
id
,
String
roleName
,
String
urlPrefixs
,
String
description
)
{
public
boolean
editRole
(
long
id
,
String
roleName
,
String
urlPrefixs
,
String
description
)
{
Role
role
=
roleDao
.
queryById
(
id
);
urlPrefixs
=
getPriId
(
urlPrefixs
);
if
(
role
!=
null
)
{
if
(
null
!=
roleName
&&
!
""
.
equals
(
roleName
))
{
if
(
role
!=
null
)
{
if
(
null
!=
roleName
&&
!
""
.
equals
(
roleName
))
{
role
.
setRoleName
(
roleName
);
}
if
(
null
!=
roleName
&&
!
""
.
equals
(
description
))
{
if
(
null
!=
roleName
&&
!
""
.
equals
(
description
))
{
role
.
setDescription
(
description
);
}
List
<
RoleUrl
>
urlList
=
new
ArrayList
<
RoleUrl
>();
...
...
@@ -86,7 +87,7 @@ public class RoleService {
return
roleDao
.
findPage
(
pr
,
"from "
+
Role
.
class
.
getName
(),
null
);
}
public
Page
<
Role
>
getAll
(
PageRequest
pr
,
String
hql
)
{
public
Page
<
Role
>
getAll
(
PageRequest
pr
,
String
hql
)
{
return
roleDao
.
findPage
(
pr
,
hql
,
null
);
}
...
...
@@ -95,27 +96,27 @@ public class RoleService {
}
public
List
<
Role
>
getAllRoles
(){
public
List
<
Role
>
getAllRoles
()
{
return
roleDao
.
queryAll
();
}
public
Map
<
String
,
Object
>
convertToMap
(
Role
role
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
if
(
role
==
null
)
public
Map
<
String
,
Object
>
convertToMap
(
Role
role
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
if
(
role
==
null
)
return
map
;
List
<
String
>
urls
=
new
ArrayList
<
String
>();
for
(
RoleUrl
roleUrl
:
role
.
getUrlPerfixs
())
{
for
(
RoleUrl
roleUrl
:
role
.
getUrlPerfixs
())
{
urls
.
add
(
roleUrl
.
getUrl
());
}
map
.
put
(
"urlPrefixs"
,
StringUtils
.
join
(
urls
,
","
));
map
.
put
(
"roleName"
,
role
.
getRoleName
());
map
.
put
(
"id"
,
role
.
getId
());
map
.
put
(
"urlPerfixs"
,
urls
);
map
.
put
(
"description"
,
role
.
getDescription
());
map
.
put
(
"urlPrefixs"
,
StringUtils
.
join
(
urls
,
","
));
map
.
put
(
"roleName"
,
role
.
getRoleName
());
map
.
put
(
"id"
,
role
.
getId
());
map
.
put
(
"urlPerfixs"
,
urls
);
map
.
put
(
"description"
,
role
.
getDescription
());
return
map
;
}
public
PageBo
<
Role
>
convert
(
Page
<
Role
>
page
){
public
PageBo
<
Role
>
convert
(
Page
<
Role
>
page
)
{
return
new
PageBo
<
Role
>(
page
,
new
Convert
<
Role
>()
{
@Override
public
Map
<
String
,
Object
>
convert
(
Role
obj
)
{
...
...
@@ -126,31 +127,32 @@ public class RoleService {
/**
* 根据url查找role
*
* @param url
* @return
*/
public
Role
findRoleByUrl
(
String
url
){
public
Role
findRoleByUrl
(
String
url
)
{
return
roleDao
.
getRoleByUrl
(
url
);
}
//去掉重复priId
private
String
getPriId
(
String
priIds
)
{
private
String
getPriId
(
String
priIds
)
{
List
list
=
new
ArrayList
();
String
[]
str
=
priIds
.
split
(
","
);
if
(
null
!=
str
&&
!
""
.
equals
(
str
))
{
for
(
int
i
=
0
;
i
<
str
.
length
;
i
++)
{
if
(!
list
.
contains
(
str
[
i
]))
{
if
(
null
!=
str
&&
!
""
.
equals
(
str
))
{
for
(
int
i
=
0
;
i
<
str
.
length
;
i
++)
{
if
(!
list
.
contains
(
str
[
i
]))
{
list
.
add
(
str
[
i
]);
}
}
}
String
priId
=
""
;
if
(
null
!=
list
&&
list
.
size
()>
0
)
{
for
(
int
j
=
0
;
j
<
list
.
size
();
j
++)
{
if
(
null
!=
list
&&
list
.
size
()
>
0
)
{
for
(
int
j
=
0
;
j
<
list
.
size
();
j
++)
{
String
id
=
(
String
)
list
.
get
(
j
);
priId
+=
id
+
","
;
}
}
return
priId
.
substring
(
0
,
priId
.
length
()-
1
);
return
priId
.
substring
(
0
,
priId
.
length
()
-
1
);
}
}
src/main/java/org/ccpit/base/role/RoleUrl.java
View file @
9407336e
package
org
.
ccpit
.
base
.
role
;
import
org.ccpit.base.modol.BaseEntity
;
import
org.hibernate.annotations.
*
;
import
org.hibernate.annotations.
CacheConcurrencyStrategy
;
import
javax.persistence.*
;
import
javax.persistence.Entity
;
/**
* 角色 地址 映射表
...
...
src/main/java/org/ccpit/base/security/CmsTagSupport.java
View file @
9407336e
...
...
@@ -2,12 +2,9 @@ package org.ccpit.base.security;
import
org.ccpit.base.controller.BaseController
;
import
org.ccpit.base.user.User
;
import
org.ccpit.base.user.UserService
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.web.context.WebApplicationContext
;
import
org.springframework.web.context.support.WebApplicationContextUtils
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.jsp.JspException
;
...
...
@@ -16,14 +13,14 @@ import javax.servlet.jsp.tagext.TagSupport;
/**
* Created by Administrator on 2015/9/8.
*/
public
class
CmsTagSupport
extends
TagSupport
implements
ApplicationContextAware
{
public
class
CmsTagSupport
extends
TagSupport
implements
ApplicationContextAware
{
static
String
SPLIT
=
","
;
static
ApplicationContext
ac
;
public
User
getUser
(){
public
User
getUser
()
{
HttpServletRequest
req
=
(
HttpServletRequest
)
pageContext
.
getRequest
();
Object
obj
=
req
.
getSession
().
getAttribute
(
BaseController
.
USER_IN_SESSION
);
if
(
obj
==
null
)
if
(
obj
==
null
)
return
null
;
return
(
User
)
obj
;
// UserService userService = ac.getBean(UserService.class);
...
...
@@ -33,21 +30,24 @@ public class CmsTagSupport extends TagSupport implements ApplicationContextAware
@Override
public
int
doStartTag
()
throws
JspException
{
if
(
getUser
()
==
null
)
if
(
getUser
()
==
null
)
return
SKIP_BODY
;
return
validate
()
?
EVAL_PAGE:
SKIP_BODY
;
return
validate
()
?
EVAL_PAGE
:
SKIP_BODY
;
}
/**
* validate the security return the result
*
* @return
*/
public
boolean
validate
(){
public
boolean
validate
()
{
return
false
;
};
}
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
ac
=
applicationContext
;
ac
=
applicationContext
;
}
}
src/main/java/org/ccpit/base/security/LoginFilter.java
View file @
9407336e
...
...
@@ -3,15 +3,10 @@ package org.ccpit.base.security;
import
org.apache.commons.lang.StringUtils
;
import
org.ccpit.base.controller.BaseController
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
javax.servlet.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.jsp.jstl.sql.Result
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
...
...
@@ -19,7 +14,7 @@ import java.util.List;
/**
* 用户登录Filter 拦截后台所有请求
*
*
<p>
* Created by sqp on 2015/9/30.
*/
public
class
LoginFilter
implements
Filter
{
...
...
@@ -27,6 +22,7 @@ public class LoginFilter implements Filter {
private
List
<
String
>
exceptPaths
=
new
ArrayList
<
String
>();
//拦截之后重定向的url
private
String
redirectPath
=
""
;
@Override
public
void
init
(
FilterConfig
filterConfig
)
throws
ServletException
{
...
...
@@ -43,16 +39,16 @@ public class LoginFilter implements Filter {
HttpServletRequest
request
=
(
HttpServletRequest
)
servletRequest
;
HttpServletResponse
response
=
(
HttpServletResponse
)
servletResponse
;
if
(
exceptPaths
.
contains
(
request
.
getRequestURI
())){
filterChain
.
doFilter
(
request
,
servletResponse
);
if
(
exceptPaths
.
contains
(
request
.
getRequestURI
()))
{
filterChain
.
doFilter
(
request
,
servletResponse
);
return
;
}
if
(
request
.
getSession
().
getAttribute
(
BaseController
.
USER_IN_SESSION
)
==
null
&&
request
.
getSession
().
getAttribute
(
"registerInfo"
)==
null
)
{
if
(
request
.
getSession
().
getAttribute
(
BaseController
.
USER_IN_SESSION
)
==
null
&&
request
.
getSession
().
getAttribute
(
"registerInfo"
)
==
null
)
{
response
.
sendRedirect
(
redirectPath
);
return
;
}
filterChain
.
doFilter
(
request
,
servletResponse
);
filterChain
.
doFilter
(
request
,
servletResponse
);
}
@Override
...
...
src/main/java/org/ccpit/base/security/SecurityAllRoleTag.java
View file @
9407336e
package
org
.
ccpit
.
base
.
security
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.ccpit.base.role.Role
;
import
org.ccpit.base.user.UserService
;
import
javax.servlet.jsp.JspException
;
import
javax.servlet.jsp.tagext.TagSupport
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -19,21 +16,21 @@ public class SecurityAllRoleTag extends CmsTagSupport {
@Override
public
boolean
validate
()
{
if
(
roles
==
null
||
roles
.
isEmpty
())
if
(
roles
==
null
||
roles
.
isEmpty
())
return
true
;
String
[]
roles
=
getRoles
().
split
(
SPLIT
);
List
<
Role
>
tagRoles
=
new
ArrayList
<
Role
>();
for
(
String
roleId
:
roles
)
{
Role
r
=
new
Role
();
for
(
String
roleId
:
roles
)
{
Role
r
=
new
Role
();
if
(
StringUtils
.
isNumeric
(
roleId
))
r
.
setId
(
Long
.
parseLong
(
roleId
));
tagRoles
.
add
(
r
);
}
Set
<
Role
>
userRoles
=
ac
.
getBean
(
UserService
.
class
).
getUserRolesIncludeGroup
(
getUser
());
boolean
can
=
true
;
for
(
Role
r
:
tagRoles
)
{
if
(!
userRoles
.
contains
(
r
)){
for
(
Role
r
:
tagRoles
)
{
if
(!
userRoles
.
contains
(
r
))
{
can
=
false
;
break
;
}
...
...
src/main/java/org/ccpit/base/security/SecurityAnyRoleTag.java
View file @
9407336e
...
...
@@ -20,19 +20,19 @@ public class SecurityAnyRoleTag extends CmsTagSupport {
@Override
public
boolean
validate
()
{
if
(
roles
==
null
||
roles
.
isEmpty
())
if
(
roles
==
null
||
roles
.
isEmpty
())
return
true
;
String
[]
roles
=
getRoles
().
split
(
SPLIT
);
List
<
Role
>
tagRoles
=
new
ArrayList
<
Role
>();
for
(
String
roleId
:
roles
)
{
Role
r
=
new
Role
();
for
(
String
roleId
:
roles
)
{
Role
r
=
new
Role
();
if
(
StringUtils
.
isNumeric
(
roleId
))
r
.
setId
(
Long
.
parseLong
(
roleId
));
tagRoles
.
add
(
r
);
}
Set
<
Role
>
userRoles
=
ac
.
getBean
(
UserService
.
class
).
getUserRolesIncludeGroup
(
getUser
());
return
CollectionUtils
.
containsAny
(
tagRoles
,
userRoles
);
return
CollectionUtils
.
containsAny
(
tagRoles
,
userRoles
);
}
public
String
getRoles
()
{
...
...
src/main/java/org/ccpit/base/security/SecurityUriTag.java
View file @
9407336e
package
org
.
ccpit
.
base
.
security
;
import
java.util.Set
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.ccpit.base.role.Role
;
import
org.ccpit.base.utils.UrlRolesMapper
;
import
org.ccpit.base.utils.UserRolesUtil
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Set
;
/**
* 自定义标签 判断用户权限
* Created by Administrator on 2015/9/7.
*/
@Component
public
class
SecurityUriTag
extends
CmsTagSupport
{
/** Uri to check */
public
class
SecurityUriTag
extends
CmsTagSupport
{
/**
* Uri to check
*/
private
String
uri
;
@Override
public
boolean
validate
()
{
Set
<
Role
>
roles
=
ac
.
getBean
(
UrlRolesMapper
.
class
).
getRoles
(
getUri
());
if
(
roles
==
null
||
roles
.
isEmpty
())
{
if
(
roles
==
null
||
roles
.
isEmpty
())
{
return
false
;
}
UserRolesUtil
userRolesUtil
=
ac
.
getBean
(
UserRolesUtil
.
class
);
Set
<
Role
>
roleSet
=
userRolesUtil
.
getAllRoles
((
HttpServletRequest
)
pageContext
.
getRequest
());
if
(
roleSet
.
isEmpty
()){
if
(
roleSet
.
isEmpty
())
{
return
false
;
}
return
CollectionUtils
.
containsAny
(
roles
,
roleSet
);
return
CollectionUtils
.
containsAny
(
roles
,
roleSet
);
}
public
String
getUri
()
{
...
...
src/main/java/org/ccpit/base/user/IUser.java
View file @
9407336e
...
...
@@ -5,6 +5,8 @@ package org.ccpit.base.user;
*/
public
interface
IUser
{
public
String
getUsername
();
public
String
getLoginName
();
public
long
getId
();
}
src/main/java/org/ccpit/base/user/User.java
View file @
9407336e
package
org
.
ccpit
.
base
.
user
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.Set
;
import
javax.persistence.*
;
import
org.ccpit.base.modol.BaseEntity
;
import
org.ccpit.base.role.Role
;
import
org.hibernate.annotations.Cache
;
import
org.hibernate.annotations.CacheConcurrencyStrategy
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.Set
;
/**
* Created by Administrator on 2015/9/2.
*/
@Entity
@Cache
(
usage
=
CacheConcurrencyStrategy
.
READ_WRITE
)
public
class
User
extends
BaseEntity
implements
IUser
,
Serializable
{
public
class
User
extends
BaseEntity
implements
IUser
,
Serializable
{
/**
* serialVersionUID:TODO(用一句话描述这个变量表示什么).
*
* @since JDK 1.6
*/
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -89,6 +89,7 @@ public class User extends BaseEntity implements IUser,Serializable{
public
long
getId
()
{
return
super
.
getId
();
}
@Override
public
String
getUsername
()
{
return
username
;
...
...
@@ -117,26 +118,27 @@ public class User extends BaseEntity implements IUser,Serializable{
@Override
public
int
hashCode
()
{
return
(
"user"
+
getId
()).
hashCode
();
return
(
"user"
+
getId
()).
hashCode
();
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
o
==
null
)
{
if
(
o
==
null
)
{
return
false
;
}
if
(
o
==
this
)
{
if
(
o
==
this
)
{
return
true
;
}
if
(
o
.
getClass
()
==
User
.
class
)
{
return
o
.
hashCode
()
==
this
.
hashCode
();
if
(
o
.
getClass
()
==
User
.
class
)
{
return
o
.
hashCode
()
==
this
.
hashCode
();
}
return
false
;
}
@ManyToMany
(
fetch
=
FetchType
.
EAGER
,
cascade
=
CascadeType
.
ALL
)
@ManyToMany
(
fetch
=
FetchType
.
EAGER
,
cascade
=
CascadeType
.
ALL
)
@JoinTable
(
name
=
"user_Roles"
,
joinColumns
=
{
@JoinColumn
(
name
=
"user_id"
,
referencedColumnName
=
"id"
)},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
"id"
)})
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
"id"
)})
public
Set
<
Role
>
getRoles
()
{
return
roles
;
}
...
...
@@ -144,69 +146,91 @@ public class User extends BaseEntity implements IUser,Serializable{
public
void
setRoles
(
Set
<
Role
>
roles
)
{
this
.
roles
=
roles
;
}
public
String
getUserType
()
{
return
userType
;
}
public
void
setUserType
(
String
userType
)
{
this
.
userType
=
userType
;
}
public
Integer
getAge
()
{
return
age
;
}
public
void
setAge
(
Integer
age
)
{
this
.
age
=
age
;
}
public
String
getSex
()
{
return
sex
;
}
public
void
setSex
(
String
sex
)
{
this
.
sex
=
sex
;
}
public
String
getCompany
()
{
return
company
;
}
public
void
setCompany
(
String
company
)
{
this
.
company
=
company
;
}
public
String
getEmail
()
{
return
email
;
}
public
void
setEmail
(
String
email
)
{
this
.
email
=
email
;
}
public
Integer
getCountStatus
()
{
return
countStatus
;
}
public
void
setCountStatus
(
Integer
countStatus
)
{
this
.
countStatus
=
countStatus
;
}
public
String
getTelphone
()
{
return
telphone
;
}
public
void
setTelphone
(
String
telphone
)
{
this
.
telphone
=
telphone
;
}
public
String
getCreator
()
{
return
creator
;
}
public
void
setCreator
(
String
creator
)
{
this
.
creator
=
creator
;
}
public
long
getCreatorId
()
{
return
creatorId
;
}
public
void
setCreatorId
(
long
creatorId
)
{
this
.
creatorId
=
creatorId
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Integer
getLoginCount
()
{
return
loginCount
;
}
public
void
setLoginCount
(
Integer
loginCount
)
{
this
.
loginCount
=
loginCount
;
}
...
...
src/main/java/org/ccpit/base/user/UserController.java
View file @
9407336e
package
org
.
ccpit
.
base
.
user
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
net.sf.json.JSONArray
;
import
org.ccpit.base.controller.BaseController
;
import
org.ccpit.base.controller.Page
;
import
org.ccpit.base.controller.PageRequest
;
...
...
@@ -22,7 +9,6 @@ import org.ccpit.base.role.RoleDao;
import
org.ccpit.base.usergroup.UserGroup
;
import
org.ccpit.base.usergroup.UserGroupDao
;
import
org.ccpit.base.usergroup.UserGroupService
;
import
org.ccpit.base.utils.CryptUtil
;
import
org.ccpit.base.utils.PasswordHash
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -33,6 +19,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.servlet.ModelAndView
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.*
;
/**
* Created by sqp on 2015/9/5.
*/
...
...
@@ -67,7 +58,7 @@ public class UserController extends BaseController {
}
@RequestMapping
(
"/addUser"
)
public
void
addUser
(
HttpServletRequest
request
,
HttpServletResponse
response
,
User
user
)
{
public
void
addUser
(
HttpServletRequest
request
,
HttpServletResponse
response
,
User
user
)
{
String
result
=
""
;
User
user_in_session
=
(
User
)
request
.
getSession
().
getAttribute
(
"user_in_session"
);
try
{
...
...
@@ -79,17 +70,17 @@ public class UserController extends BaseController {
user
.
setCreatorId
(
user_in_session
.
getId
());
user
.
setCreator
(
user_in_session
.
getUsername
());
user
.
setCreateTime
(
new
Date
());
if
(
null
==
user
.
getUserType
())
{
if
(
null
==
user
.
getUserType
())
{
user
.
setUserType
(
"back"
);
}
if
(
null
==
user
.
getCountStatus
())
{
if
(
null
==
user
.
getCountStatus
())
{
user
.
setCountStatus
(
1
);
}
boolean
flag
=
userService
.
addUser
(
user
);
if
(
flag
)
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存成功!\" }"
;
}
else
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存失败!\" }"
;
if
(
flag
)
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存成功!\" }"
;
}
else
{
result
=
"{ \"flag\": "
+
flag
+
", \"info\": \"数据保存失败!\" }"
;
}
try
{
response
.
setContentType
(
"text/html"
);
...
...
@@ -105,31 +96,31 @@ public class UserController extends BaseController {
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
User
user1
=
userService
.
getUser
(
id
);
boolean
flag
=
false
;
if
(
null
!=
user
.
getAge
())
{
if
(
null
!=
user
.
getAge
())
{
user1
.
setAge
(
user
.
getAge
());
}
if
(
null
!=
user
.
getCountStatus
())
{
if
(
null
!=
user
.
getCountStatus
())
{
user1
.
setCountStatus
(
user
.
getCountStatus
());
}
if
(
null
!=
user
.
getCompany
())
{
if
(
null
!=
user
.
getCompany
())
{
user1
.
setCompany
(
user
.
getCompany
());
}
if
(
null
!=
user
.
getEmail
())
{
if
(
null
!=
user
.
getEmail
())
{
user1
.
setEmail
(
user
.
getEmail
());
}
if
(
null
!=
user
.
getLoginName
())
{
if
(
null
!=
user
.
getLoginName
())
{
user1
.
setLoginName
(
user
.
getLoginName
());
}
if
(
null
!=
user
.
getSex
())
{
if
(
null
!=
user
.
getSex
())
{
user1
.
setSex
(
user
.
getSex
());
}
if
(
null
!=
user
.
getTelphone
())
{
if
(
null
!=
user
.
getTelphone
())
{
user1
.
setTelphone
(
user
.
getTelphone
());
}
if
(
null
!=
user
.
getUsername
())
{
if
(
null
!=
user
.
getUsername
())
{
user1
.
setUsername
(
user
.
getUsername
());
}
if
(
null
!=
user
.
getUserType
())
{
if
(
null
!=
user
.
getUserType
())
{
user1
.
setUserType
(
user
.
getUserType
());
}
flag
=
userService
.
updateUser
(
user1
);
...
...
@@ -157,13 +148,13 @@ public class UserController extends BaseController {
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
jsonIds
);
Object
[]
ids
=
jsonArray
.
toArray
();
boolean
flag
=
false
;
for
(
Object
str
:
ids
)
{
for
(
Object
str
:
ids
)
{
flag
=
userService
.
deleteUser
((
Integer
)
str
);
}
if
(
flag
)
{
if
(
flag
)
{
map
.
put
(
"flag"
,
flag
);
map
.
put
(
"info"
,
"数据删除成功!"
);
}
else
{
}
else
{
map
.
put
(
"info"
,
"数据删除失败!"
);
}
return
map
;
...
...
@@ -183,18 +174,18 @@ public class UserController extends BaseController {
String
userName
=
request
.
getParameter
(
"userName"
);
String
userType
=
request
.
getParameter
(
"userType"
);
StringBuffer
hql
=
new
StringBuffer
(
"from User where 1=1"
);
if
(
null
==
userName
&&
null
==
userType
)
{
if
(
null
==
userName
&&
null
==
userType
)
{
hql
.
append
(
" order by createTime desc"
);
}
else
{
if
(
null
!=
userName
&&
!
""
.
equals
(
userName
))
{
}
else
{
if
(
null
!=
userName
&&
!
""
.
equals
(
userName
))
{
hql
.
append
(
" and userName like '%"
+
userName
+
"%'"
);
}
if
(
null
!=
userType
&&
!
""
.
equals
(
userType
))
{
hql
.
append
(
" and userType ='"
+
userType
+
"'"
);
if
(
null
!=
userType
&&
!
""
.
equals
(
userType
))
{
hql
.
append
(
" and userType ='"
+
userType
+
"'"
);
}
hql
.
append
(
" order by createTime desc"
);
}
Page
<
User
>
users
=
userService
.
queryPage
(
pageRequest
,
hql
.
toString
());
Page
<
User
>
users
=
userService
.
queryPage
(
pageRequest
,
hql
.
toString
());
return
userService
.
convert
(
users
);
}
...
...
@@ -226,7 +217,7 @@ public class UserController extends BaseController {
*/
@RequestMapping
(
"/resetPass"
)
@ResponseBody
public
Object
resetPass
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
Object
resetPass
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
result
=
new
HashMap
();
String
id
=
request
.
getParameter
(
"userId"
);
User
user
=
userService
.
getUser
(
Long
.
valueOf
(
id
));
...
...
@@ -236,9 +227,9 @@ public class UserController extends BaseController {
throw
new
RuntimeException
(
"重置用户密码加密失败...."
,
e
);
}
boolean
b
=
userService
.
updateUser
(
user
);
if
(
b
)
{
if
(
b
)
{
result
.
put
(
"flag"
,
true
);
}
else
{
}
else
{
result
.
put
(
"flag"
,
false
);
}
return
result
;
...
...
@@ -249,7 +240,7 @@ public class UserController extends BaseController {
*/
@RequestMapping
(
"/changePass/{rePass}"
)
@ResponseBody
public
Object
changePass
(
HttpServletRequest
request
,
@PathVariable
String
rePass
)
{
public
Object
changePass
(
HttpServletRequest
request
,
@PathVariable
String
rePass
)
{
Map
result
=
new
HashMap
();
User
user
=
(
User
)
request
.
getSession
().
getAttribute
(
"user_in_session"
);
try
{
...
...
@@ -258,10 +249,10 @@ public class UserController extends BaseController {
throw
new
RuntimeException
(
"修改用户密码加密失败...."
,
e
);
}
boolean
b
=
userService
.
updateUser
(
user
);
if
(
b
)
{
if
(
b
)
{
result
.
put
(
"flag"
,
true
);
result
.
put
(
"info"
,
"密码修改成功!"
);
}
else
{
}
else
{
result
.
put
(
"flag"
,
false
);
}
return
result
;
...
...
@@ -269,11 +260,11 @@ public class UserController extends BaseController {
@RequestMapping
(
"/getUsersList"
)
@ResponseBody
public
Object
getUsersList
(
HttpServletRequest
request
)
{
public
Object
getUsersList
(
HttpServletRequest
request
)
{
List
<
User
>
listBo
=
userService
.
getAllUsers
();
List
list
=
new
ArrayList
();
if
(
null
!=
listBo
)
{
for
(
int
i
=
0
;
i
<
listBo
.
size
();
i
++)
{
if
(
null
!=
listBo
)
{
for
(
int
i
=
0
;
i
<
listBo
.
size
();
i
++)
{
Map
result
=
new
HashMap
();
result
.
put
(
"id"
,
listBo
.
get
(
i
).
getId
());
result
.
put
(
"text"
,
listBo
.
get
(
i
).
getUsername
());
...
...
src/main/java/org/ccpit/base/user/UserDao.java
View file @
9407336e
package
org
.
ccpit
.
base
.
user
;
import
java.util.Set
;
import
org.ccpit.base.dao.BaseDao
;
import
org.ccpit.base.role.Role
;
import
org.ccpit.base.usergroup.UserGroupDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
java.util.Set
;
/**
* 用户实体操作类
* Created by sqp on 2015/9/5.
*/
@Repository
public
class
UserDao
extends
BaseDao
<
User
>{
public
class
UserDao
extends
BaseDao
<
User
>
{
@Autowired
private
UserGroupDao
userGroupDao
;
public
User
getUserByLoginName
(
String
loginName
){
public
User
getUserByLoginName
(
String
loginName
)
{
String
hql
=
"from User where loginName = ?"
;
User
user
=
super
.
findUnique
(
hql
,
new
String
[]{
loginName
});
return
user
;
...
...
@@ -30,20 +30,21 @@ public class UserDao extends BaseDao<User>{
* @param role
* @return
*/
public
boolean
canUserOrInGroup
(
User
user
,
Role
role
)
{
public
boolean
canUserOrInGroup
(
User
user
,
Role
role
)
{
boolean
can
=
canUser
(
user
,
role
);
if
(!
can
){
can
=
userGroupDao
.
canUserInGroup
(
user
,
role
);
if
(!
can
)
{
can
=
userGroupDao
.
canUserInGroup
(
user
,
role
);
}
return
can
;
}
/**
* 获取一个用户所拥有的所有角色,包括用户所在的组拥有的角色
*
* @param user
* @return
*/
public
Set
<
Role
>
getUserRolesIncludeGroup
(
User
user
){
public
Set
<
Role
>
getUserRolesIncludeGroup
(
User
user
)
{
Set
<
Role
>
roles
=
user
.
getRoles
();
Set
<
Role
>
rolesInGroup
=
userGroupDao
.
getRolesForUser
(
user
);
roles
.
addAll
(
rolesInGroup
);
...
...
@@ -52,11 +53,12 @@ public class UserDao extends BaseDao<User>{
/**
* 判断用户是否具有某个角色
*
* @param user
* @param role
* @return
*/
public
boolean
canUser
(
User
user
,
Role
role
)
{
public
boolean
canUser
(
User
user
,
Role
role
)
{
return
user
.
getRoles
().
contains
(
role
);
}
...
...
src/main/java/org/ccpit/base/user/UserService.java
View file @
9407336e
package
org
.
ccpit
.
base
.
user
;
import
java.text.SimpleDateFormat
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
javax.transaction.Transactional
;
import
org.ccpit.base.controller.Convert
;
import
org.ccpit.base.controller.Page
;
import
org.ccpit.base.controller.PageBo
;
...
...
@@ -18,6 +9,10 @@ import org.ccpit.base.role.RoleDao;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
javax.transaction.Transactional
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* Created by sqp on 2015/9/5.
*/
...
...
@@ -31,36 +26,37 @@ public class UserService {
@Autowired
private
RoleDao
roleDao
;
public
List
<
User
>
getAllUsers
(){
public
List
<
User
>
getAllUsers
()
{
return
userDao
.
queryAll
();
}
public
User
getUserByLoginName
(
String
loginName
){
public
User
getUserByLoginName
(
String
loginName
)
{
return
userDao
.
getUserByLoginName
(
loginName
);
}
public
boolean
addUser
(
User
user
){
public
boolean
addUser
(
User
user
)
{
return
userDao
.
save
(
user
);
}
public
boolean
updateUser
(
User
user
){
public
boolean
updateUser
(
User
user
)
{
return
userDao
.
update
(
user
);
}
public
boolean
deleteUser
(
long
id
){
public
boolean
deleteUser
(
long
id
)
{
return
userDao
.
deleteById
(
id
);
}
public
Page
<
User
>
queryPage
(
PageRequest
pr
){
public
Page
<
User
>
queryPage
(
PageRequest
pr
)
{
Page
<
User
>
page
=
userDao
.
findPage
(
pr
,
"from "
+
User
.
class
.
getName
(),
new
String
[]{});
return
page
;
}
public
Page
<
User
>
queryPage
(
PageRequest
pr
,
String
hql
)
{
public
Page
<
User
>
queryPage
(
PageRequest
pr
,
String
hql
)
{
Page
<
User
>
page
=
userDao
.
findPage
(
pr
,
hql
,
new
String
[]{});
return
page
;
}
public
User
getUser
(
long
id
){
public
User
getUser
(
long
id
)
{
return
userDao
.
queryById
(
id
);
}
...
...
@@ -71,80 +67,84 @@ public class UserService {
* @param role
* @return
*/
public
boolean
canUserOrInGroup
(
User
user
,
Role
role
)
{
public
boolean
canUserOrInGroup
(
User
user
,
Role
role
)
{
return
userDao
.
canUserOrInGroup
(
user
,
role
);
}
/**
* 获取一个用户的所有角色
*
* @param user
* @return
*/
public
Set
<
Role
>
getUserRoles
(
User
user
){
public
Set
<
Role
>
getUserRoles
(
User
user
)
{
User
user1
=
userDao
.
queryById
(
user
.
getId
());
return
user1
.
getRoles
();
}
/**
* 获取一个用户所拥有的所有角色,包括用户所在的组拥有的角色
*
* @param user
* @return
*/
public
Set
<
Role
>
getUserRolesIncludeGroup
(
User
user
){
public
Set
<
Role
>
getUserRolesIncludeGroup
(
User
user
)
{
return
userDao
.
getUserRolesIncludeGroup
(
user
);
}
public
boolean
saveUserRoles
(
User
user
,
Long
[]
ids
)
{
public
boolean
saveUserRoles
(
User
user
,
Long
[]
ids
)
{
Set
<
Role
>
roles
=
new
HashSet
<
Role
>();
for
(
long
id
:
ids
)
{
for
(
long
id
:
ids
)
{
roles
.
add
(
roleDao
.
queryById
(
id
));
}
return
saveUserRoles
(
user
,
roles
);
}
public
boolean
saveUserRoles
(
User
user
,
Set
<
Role
>
roleSet
){
public
boolean
saveUserRoles
(
User
user
,
Set
<
Role
>
roleSet
)
{
boolean
success
=
false
;
try
{
user
.
getRoles
().
clear
();
boolean
b
=
userDao
.
update
(
user
);
if
(
b
)
{
if
(
b
)
{
User
user1
=
userDao
.
queryById
(
user
.
getId
());
user1
.
setRoles
(
roleSet
);
success
=
userDao
.
save
(
user1
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
success
=
false
;
}
return
success
;
}
public
Map
<
String
,
Object
>
convertToMap
(
User
User
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
if
(
User
==
null
)
{
public
Map
<
String
,
Object
>
convertToMap
(
User
User
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
if
(
User
==
null
)
{
return
map
;
}
Set
<
Role
>
roleSet
=
User
.
getRoles
();
String
roles
=
""
;
if
(
null
!=
roleSet
)
{
if
(
roleSet
.
size
()>
0
)
{
for
(
Role
role
:
roleSet
)
{
roles
+=
role
.
getRoleName
()+
","
;
if
(
null
!=
roleSet
)
{
if
(
roleSet
.
size
()
>
0
)
{
for
(
Role
role
:
roleSet
)
{
roles
+=
role
.
getRoleName
()
+
","
;
}
roles
=
roles
.
substring
(
0
,
roles
.
length
()-
1
);
roles
=
roles
.
substring
(
0
,
roles
.
length
()
-
1
);
}
}
map
.
put
(
"id"
,
User
.
getId
());
map
.
put
(
"createTime"
,
null
==
User
.
getCreateTime
()?
""
:
sdf
.
format
(
User
.
getCreateTime
()));
map
.
put
(
"id"
,
User
.
getId
());
map
.
put
(
"createTime"
,
null
==
User
.
getCreateTime
()
?
""
:
sdf
.
format
(
User
.
getCreateTime
()));
map
.
put
(
"creator"
,
User
.
getCreator
());
map
.
put
(
"username"
,
User
.
getUsername
());
map
.
put
(
"loginName"
,
User
.
getLoginName
());
map
.
put
(
"countStatus"
,
1
==
User
.
getCountStatus
()
?
"有效"
:
"无效"
);
map
.
put
(
"username"
,
User
.
getUsername
());
map
.
put
(
"loginName"
,
User
.
getLoginName
());
map
.
put
(
"countStatus"
,
1
==
User
.
getCountStatus
()
?
"有效"
:
"无效"
);
map
.
put
(
"loginCount"
,
User
.
getLoginCount
());
map
.
put
(
"company"
,
User
.
getCompany
());
map
.
put
(
"userType"
,
"back"
.
equals
(
User
.
getUserType
())?
"后台用户"
:
"非后台用户"
);
map
.
put
(
"userType"
,
"back"
.
equals
(
User
.
getUserType
())
?
"后台用户"
:
"非后台用户"
);
map
.
put
(
"roles"
,
roles
);
return
map
;
}
public
PageBo
<
User
>
convert
(
Page
<
User
>
page
){
public
PageBo
<
User
>
convert
(
Page
<
User
>
page
)
{
return
new
PageBo
<
User
>(
page
,
new
Convert
<
User
>()
{
@Override
public
Map
<
String
,
Object
>
convert
(
User
obj
)
{
...
...
src/main/java/org/ccpit/base/utils/CryptUtil.java
View file @
9407336e
package
org
.
ccpit
.
base
.
utils
;
import
java.security.MessageDigest
;
import
javax.crypto.Cipher
;
import
javax.crypto.KeyGenerator
;
import
javax.crypto.SecretKey
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.security.MessageDigest
;
/**
* @Description �����㷨
* @Version V0.1
...
...
@@ -13,8 +13,7 @@ import javax.crypto.spec.SecretKeySpec;
* @Date 2015��4��3�� ����3:07:18 JDK�汾��sun jdk 1.6
* ���¼�¼****************************** �汾�� <�汾��> �����ڣ� <����> ���ˣ� <��������>
* �����ݣ� <����������>
**********************************************************************
*
* *********************************************************************
*/
public
class
CryptUtil
{
...
...
src/main/java/org/ccpit/base/utils/HtmlEscapeUtil.java
View file @
9407336e
...
...
@@ -6,7 +6,6 @@ package org.ccpit.base.utils;
import
org.apache.commons.lang.StringUtils
;
import
org.ccpit.base.modol.EscapeHTML
;
import
org.ccpit.base.modol.EscapeSql
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
...
...
@@ -65,12 +64,13 @@ public class HtmlEscapeUtil<T> {
/**
* Escape the Sql with the annotation
*
* @param t
* @return
*/
public
T
escape
(
T
t
){
public
T
escape
(
T
t
)
{
EscapeHTML
annotation
=
t
.
getClass
().
getAnnotation
(
EscapeHTML
.
class
);
if
(
annotation
!=
null
)
{
if
(
annotation
!=
null
)
{
encode
(
t
);
except
(
annotation
.
except
());
execute
();
...
...
src/main/java/org/ccpit/base/utils/ImgFontByte.java
View file @
9407336e
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/main/java/org/ccpit/base/utils/MailSender.java
View file @
9407336e
package
org
.
ccpit
.
base
.
utils
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.log4j.Logger
;
import
org.ccpit.base.user.User
;
import
javax.mail.*
;
import
javax.mail.internet.InternetAddress
;
...
...
@@ -26,8 +24,8 @@ public class MailSender {
public
static
String
HOST
;
private
static
final
Logger
logger
=
Logger
.
getLogger
(
MailSender
.
class
);
static
{
Map
<
String
,
String
>
configMap
=
ReadConfigUtil
.
getPlatformConfig
();
static
{
Map
<
String
,
String
>
configMap
=
ReadConfigUtil
.
getPlatformConfig
();
USERNAME
=
configMap
.
get
(
"email.name"
);
PASSWORD
=
configMap
.
get
(
"email.password"
);
HOST
=
configMap
.
get
(
"email.host"
);
...
...
@@ -35,18 +33,20 @@ public class MailSender {
/**
* 发送邮件
*
* @param targetAddress 收件人
* @param subject 主题
* @param body 内容
* @return 发送成功
*/
public
static
boolean
send
(
String
targetAddress
,
String
subject
,
String
body
)
{
public
static
boolean
send
(
String
targetAddress
,
String
subject
,
String
body
)
{
EmailBody
emailBody
=
new
EmailBody
();
emailBody
.
setContent
(
body
);
emailBody
.
setSubject
(
subject
);
emailBody
.
setSentDate
(
new
Date
());
return
send
(
targetAddress
,
emailBody
);
return
send
(
targetAddress
,
emailBody
);
}
/**
* 发送邮件
*
...
...
@@ -56,7 +56,7 @@ public class MailSender {
* @param: @param mimeDTO 邮件部分参数
* @return: boolean
*/
public
static
boolean
send
(
String
targetAddress
,
EmailBody
body
){
public
static
boolean
send
(
String
targetAddress
,
EmailBody
body
)
{
Properties
props
=
new
Properties
();
props
.
put
(
"mail.pop.host"
,
HOST
);
props
.
setProperty
(
"mail.pop.auth"
,
"true"
);
...
...
@@ -64,7 +64,7 @@ public class MailSender {
props
.
put
(
"mail.pop.password"
,
PASSWORD
);
props
.
put
(
"mail.pop.starttls.enable"
,
"true"
);
props
.
put
(
"mail.transport.protocol"
,
"POP3"
);
props
.
put
(
"mail.pop.port"
,
465
);
props
.
put
(
"mail.pop.port"
,
465
);
Session
session
=
Session
.
getInstance
(
props
,
new
PopupAuthenticator
(
USERNAME
,
PASSWORD
));
boolean
success
=
false
;
...
...
@@ -87,7 +87,7 @@ public class MailSender {
logger
.
info
(
"成功发送了邮件到"
+
targetAddress
+
" 主题:["
+
body
.
getSubject
()
+
"] 内容["
+
body
.
getContent
()
+
"]"
);
}
catch
(
Exception
e
)
{
success
=
false
;
logger
.
warn
(
"到"
+
targetAddress
+
"的邮件发送失败,"
+
e
);
logger
.
warn
(
"到"
+
targetAddress
+
"的邮件发送失败,"
+
e
);
// throw new RuntimeException("email send error",e);
}
return
success
;
...
...
src/main/java/org/ccpit/base/utils/PasswordHash.java
View file @
9407336e
...
...
@@ -5,19 +5,17 @@
* Package Name:org.ccpit.base.utils
* Date:2015年10月23日下午2:10:48
* Copyright (c) 2015, dingwei@ccpit.org All Rights Reserved.
*
*/
package
org
.
ccpit
.
base
.
utils
;
import
javax.crypto.SecretKeyFactory
;
import
javax.crypto.spec.PBEKeySpec
;
import
java.math.BigInteger
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.SecureRandom
;
import
java.security.spec.InvalidKeySpecException
;
import
javax.crypto.SecretKeyFactory
;
import
javax.crypto.spec.PBEKeySpec
;
/**
* ClassName:PasswordHash <br/>
* Function: TODO ADD FUNCTION. <br/>
...
...
src/main/java/org/ccpit/base/utils/PopupAuthenticator.java
View file @
9407336e
...
...
@@ -17,6 +17,7 @@ public class PopupAuthenticator extends Authenticator {
this
.
username
=
user
;
this
.
password
=
pass
;
}
protected
PasswordAuthentication
getPasswordAuthentication
()
{
return
new
PasswordAuthentication
(
username
,
password
);
}
...
...
src/main/java/org/ccpit/base/utils/ReadConfigUtil.java
View file @
9407336e
package
org
.
ccpit
.
base
.
utils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.InputStream
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Properties
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @Description TODO【用一句话描述该文件做什么】
* @Author dingwei
...
...
@@ -42,7 +42,7 @@ public class ReadConfigUtil {
}
if
(
properties
!=
null
)
for
(
Enumeration
en
=
properties
.
propertyNames
();
en
.
hasMoreElements
();)
{
.
hasMoreElements
();
)
{
String
key
=
(
String
)
en
.
nextElement
();
String
value
=
properties
.
getProperty
(
key
);
...
...
src/main/java/org/ccpit/base/utils/SqlEscapeUtil.java
View file @
9407336e
...
...
@@ -8,7 +8,6 @@ import org.apache.commons.lang.StringEscapeUtils;
import
org.apache.commons.lang.StringUtils
;
import
org.ccpit.base.modol.EscapeSql
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
...
...
@@ -103,18 +102,20 @@ public class SqlEscapeUtil<T> {
/**
* Escape the Sql with the annotation
*
* @param t
* @return
*/
public
T
escape
(
T
t
){
public
T
escape
(
T
t
)
{
EscapeSql
annotation
=
t
.
getClass
().
getAnnotation
(
EscapeSql
.
class
);
if
(
annotation
!=
null
)
{
if
(
annotation
!=
null
)
{
encode
(
t
);
except
(
annotation
.
except
());
execute
();
}
return
t
;
}
/**
* 过滤方法
*
...
...
src/main/java/org/ccpit/base/utils/UserRolesUtil.java
View file @
9407336e
...
...
@@ -11,7 +11,6 @@ import org.springframework.context.ApplicationContextAware;
import
org.springframework.stereotype.Repository
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Collection
;
import
java.util.HashSet
;
import
java.util.Set
;
...
...
@@ -68,7 +67,7 @@ public class UserRolesUtil implements ApplicationContextAware {
public
Set
<
Role
>
getRoles
(
HttpServletRequest
request
,
String
scope
)
{
Set
<
Role
>
roles
=
new
HashSet
<
Role
>();
Object
object
=
request
.
getSession
().
getAttribute
(
scope
);
if
(
object
==
null
)
{
if
(
object
==
null
)
{
initOrReload
(
request
);
object
=
request
.
getSession
().
getAttribute
(
scope
);
}
...
...
src/main/java/org/ccpit/base/utils/ValidateCode.java
View file @
9407336e
package
org
.
ccpit
.
base
.
utils
;
import
java.awt.Color
;
import
java
.awt.Font
;
import
java.awt.
Graphics2D
;
import
java
x.imageio.ImageIO
;
import
java.awt.
*
;
import
java.awt.image.BufferedImage
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.Random
;
import
javax.imageio.ImageIO
;
/**
* 验证码生成器
* @author dsna
*
* @author dsna
*/
public
class
ValidateCode
{
// 图片的宽度。
...
...
@@ -26,51 +25,50 @@ public class ValidateCode {
// 验证码
private
String
code
=
null
;
// 验证码图片Buffer
private
BufferedImage
buffImg
=
null
;
private
BufferedImage
buffImg
=
null
;
private
char
[]
codeSequence
=
{
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
private
char
[]
codeSequence
=
{
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'M'
,
'N'
,
'P'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
};
'X'
,
'Y'
,
'Z'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
};
public
ValidateCode
()
{
this
.
createCode
();
}
/**
*
* @param width 图片宽
* @param height 图片高
*/
public
ValidateCode
(
int
width
,
int
height
)
{
this
.
width
=
width
;
this
.
height
=
height
;
public
ValidateCode
(
int
width
,
int
height
)
{
this
.
width
=
width
;
this
.
height
=
height
;
this
.
createCode
();
}
/**
*
* @param width 图片宽
* @param height 图片高
* @param codeCount 字符个数
* @param lineCount 干扰线条数
*/
public
ValidateCode
(
int
width
,
int
height
,
int
codeCount
,
int
lineCount
)
{
this
.
width
=
width
;
this
.
height
=
height
;
this
.
codeCount
=
codeCount
;
this
.
lineCount
=
lineCount
;
public
ValidateCode
(
int
width
,
int
height
,
int
codeCount
,
int
lineCount
)
{
this
.
width
=
width
;
this
.
height
=
height
;
this
.
codeCount
=
codeCount
;
this
.
lineCount
=
lineCount
;
this
.
createCode
();
}
public
void
createCode
()
{
int
x
=
0
,
fontHeight
=
0
,
codeY
=
0
;
int
x
=
0
,
fontHeight
=
0
,
codeY
=
0
;
int
red
=
0
,
green
=
0
,
blue
=
0
;
x
=
width
/
(
codeCount
+
2
);
//每个字符的宽度
x
=
width
/
(
codeCount
+
2
);
//每个字符的宽度
fontHeight
=
height
-
2
;
//字体的高度
codeY
=
height
-
4
;
// 图像buffer
buffImg
=
new
BufferedImage
(
width
,
height
,
BufferedImage
.
TYPE_INT_RGB
);
buffImg
=
new
BufferedImage
(
width
,
height
,
BufferedImage
.
TYPE_INT_RGB
);
Graphics2D
g
=
buffImg
.
createGraphics
();
// 生成随机数
Random
random
=
new
Random
();
...
...
@@ -78,15 +76,15 @@ public class ValidateCode {
g
.
setColor
(
Color
.
WHITE
);
g
.
fillRect
(
0
,
0
,
width
,
height
);
// 创建字体
ImgFontByte
imgFont
=
new
ImgFontByte
();
Font
font
=
imgFont
.
getFont
(
fontHeight
);
ImgFontByte
imgFont
=
new
ImgFontByte
();
Font
font
=
imgFont
.
getFont
(
fontHeight
);
g
.
setFont
(
font
);
for
(
int
i
=
0
;
i
<
lineCount
;
i
++)
{
int
xs
=
random
.
nextInt
(
width
);
int
ys
=
random
.
nextInt
(
height
);
int
xe
=
xs
+
random
.
nextInt
(
width
/
8
);
int
ye
=
ys
+
random
.
nextInt
(
height
/
8
);
int
xe
=
xs
+
random
.
nextInt
(
width
/
8
);
int
ye
=
ys
+
random
.
nextInt
(
height
/
8
);
red
=
random
.
nextInt
(
255
);
green
=
random
.
nextInt
(
255
);
blue
=
random
.
nextInt
(
255
);
...
...
@@ -109,7 +107,7 @@ public class ValidateCode {
randomCode
.
append
(
strRand
);
}
// 将四位数字的验证码保存到Session中。
code
=
randomCode
.
toString
();
code
=
randomCode
.
toString
();
}
public
void
write
(
String
path
)
throws
IOException
{
...
...
@@ -121,6 +119,7 @@ public class ValidateCode {
ImageIO
.
write
(
buffImg
,
"png"
,
sos
);
sos
.
close
();
}
public
BufferedImage
getBuffImg
()
{
return
buffImg
;
}
...
...
src/main/java/org/ccpit/base/utils/mailUtil/Mail.java
View file @
9407336e
...
...
@@ -5,8 +5,7 @@
* Package Name:org.ccpit.base.utils.mailUtil
* Date:2015年11月19日上午10:50:34
* Copyright (c) 2015, dingwei@ccpit.org All Rights Reserved.
*
*/
*/
package
org
.
ccpit
.
base
.
utils
.
mailUtil
;
...
...
@@ -22,7 +21,7 @@ import java.io.Serializable;
* @since JDK 1.6
* @see
*/
public
class
Mail
implements
Serializable
{
public
class
Mail
implements
Serializable
{
/**
* serialVersionUID:TODO(用一句话描述这个变量表示什么).
...
...
@@ -77,71 +76,91 @@ public class Mail implements Serializable{
public
String
getHost
()
{
return
host
;
}
public
void
setHost
(
String
host
)
{
this
.
host
=
host
;
}
public
String
getSender
()
{
return
sender
;
}
public
void
setSender
(
String
sender
)
{
this
.
sender
=
sender
;
}
public
String
getReceiver
()
{
return
receiver
;
}
public
void
setReceiver
(
String
receiver
)
{
this
.
receiver
=
receiver
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getEmailCount
()
{
return
emailCount
;
}
public
void
setEmailCount
(
String
emailCount
)
{
this
.
emailCount
=
emailCount
;
}
public
String
getEmailPassword
()
{
return
emailPassword
;
}
public
void
setEmailPassword
(
String
emailPassword
)
{
this
.
emailPassword
=
emailPassword
;
}
public
String
getMailTitle
()
{
return
mailTitle
;
}
public
void
setMailTitle
(
String
mailTitle
)
{
this
.
mailTitle
=
mailTitle
;
}
public
String
getMailMessage
()
{
return
mailMessage
;
}
public
void
setMailMessage
(
String
mailMessage
)
{
this
.
mailMessage
=
mailMessage
;
}
public
String
getProtocol
()
{
return
protocol
;
}
public
void
setProtocol
(
String
protocol
)
{
this
.
protocol
=
protocol
;
}
public
String
getCopyTo
()
{
return
copyTo
;
}
public
void
setCopyTo
(
String
copyTo
)
{
this
.
copyTo
=
copyTo
;
}
public
String
getAffix
()
{
return
affix
;
}
public
void
setAffix
(
String
affix
)
{
this
.
affix
=
affix
;
}
}
src/main/java/org/ccpit/base/utils/mailUtil/MailUtil.java
View file @
9407336e
...
...
@@ -5,31 +5,20 @@
* Package Name:org.ccpit.base.utils.mailUtil
* Date:2015年11月19日上午11:15:36
* Copyright (c) 2015, dingwei@ccpit.org All Rights Reserved.
*
*/
*/
package
org
.
ccpit
.
base
.
utils
.
mailUtil
;
import
javax.activation.DataHandler
;
import
javax.activation.FileDataSource
;
import
javax.mail.*
;
import
javax.mail.internet.*
;
import
java.io.File
;
import
java.io.UnsupportedEncodingException
;
import
java.util.HashSet
;
import
java.util.Properties
;
import
java.util.Set
;
import
javax.activation.DataHandler
;
import
javax.activation.FileDataSource
;
import
javax.mail.Message
;
import
javax.mail.MessagingException
;
import
javax.mail.NoSuchProviderException
;
import
javax.mail.Session
;
import
javax.mail.Transport
;
import
javax.mail.internet.InternetAddress
;
import
javax.mail.internet.MimeBodyPart
;
import
javax.mail.internet.MimeMessage
;
import
javax.mail.internet.MimeMultipart
;
import
javax.mail.internet.MimeUtility
;
/**
* ClassName:MailUtil <br/>
...
...
@@ -44,13 +33,13 @@ import javax.mail.internet.MimeUtility;
public
class
MailUtil
{
public
static
boolean
sendMail
(
Mail
mail
)
{
public
static
boolean
sendMail
(
Mail
mail
)
{
Properties
properties
=
new
Properties
();
properties
.
setProperty
(
"mail.host"
,
mail
.
getHost
());
properties
.
setProperty
(
"mail.transport.protocol"
,
mail
.
getProtocol
());
properties
.
setProperty
(
"mail.smtp.auth"
,
"true"
);
properties
.
put
(
"mail.smtp.ssl.enable"
,
true
);
properties
.
put
(
"mail.smtp.ssl.enable"
,
true
);
//使用JavaMail发送邮件的5个步骤
//1、创建session
Session
session
=
Session
.
getInstance
(
properties
);
...
...
@@ -63,12 +52,12 @@ public class MailUtil {
//3、连上邮件服务器
transport
.
connect
(
mail
.
getHost
(),
mail
.
getEmailCount
(),
mail
.
getEmailPassword
());
//4、创建邮件
final
Message
message
=
createMail
(
session
,
mail
);
final
Message
message
=
createMail
(
session
,
mail
);
//5、发送邮件
new
Thread
()
{
new
Thread
()
{
@Override
public
void
run
()
{
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
public
void
run
()
{
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
try
{
transport
.
sendMessage
(
message
,
message
.
getAllRecipients
());
transport
.
close
();
...
...
@@ -90,43 +79,43 @@ public class MailUtil {
return
flag
;
}
public
static
MimeMessage
createMail
(
Session
session
,
Mail
mail
)
{
public
static
MimeMessage
createMail
(
Session
session
,
Mail
mail
)
{
MimeMessage
mimeMessage
=
new
MimeMessage
(
session
);
//构建邮件体
try
{
if
(
null
!=
mail
.
getSender
())
{
if
(
null
!=
mail
.
getSender
())
{
//设置发件人
mimeMessage
.
setFrom
(
new
InternetAddress
(
mail
.
getSender
()));
}
if
(
null
!=
mail
.
getReceiver
())
{
if
(
null
!=
mail
.
getReceiver
())
{
String
[]
address
=
mail
.
getReceiver
().
split
(
";"
);
InternetAddress
[]
addresses
=
new
InternetAddress
[
address
.
length
];
for
(
int
i
=
0
;
i
<
address
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
address
.
length
;
i
++)
{
addresses
[
i
]
=
new
InternetAddress
(
address
[
i
]);
}
//设置收件人 群发
mimeMessage
.
setRecipients
(
Message
.
RecipientType
.
TO
,
addresses
);
}
if
(
null
!=
mail
.
getCopyTo
())
{
if
(
null
!=
mail
.
getCopyTo
())
{
String
[]
address
=
mail
.
getReceiver
().
split
(
";"
);
InternetAddress
[]
addresses
=
new
InternetAddress
[
address
.
length
];
for
(
int
i
=
0
;
i
<
address
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
address
.
length
;
i
++)
{
addresses
[
i
]
=
new
InternetAddress
(
address
[
i
]);
}
//抄送人 群发
mimeMessage
.
setRecipients
(
Message
.
RecipientType
.
CC
,
addresses
);
}
//邮件主题
mimeMessage
.
setSubject
(
mail
.
getMailTitle
()==
null
?
""
:
mail
.
getMailTitle
());
mimeMessage
.
setSubject
(
mail
.
getMailTitle
()
==
null
?
""
:
mail
.
getMailTitle
());
//创建邮件正文 为了避免邮件正文中文乱码问题,需要使用charset=UTF-8指明字符编码
MimeBodyPart
mimeBodyPart
=
new
MimeBodyPart
();
mimeBodyPart
.
setContent
(
mail
.
getMailMessage
(),
"text/html;charset=UTF-8"
);
Set
<
MimeBodyPart
>
mimeBodyPartSet
=
new
HashSet
<
MimeBodyPart
>();
//创建邮件附件
if
(
null
!=
mail
.
getAffix
()&&!
""
.
equals
(
mail
.
getAffix
()))
{
if
(
null
!=
mail
.
getAffix
()
&&
!
""
.
equals
(
mail
.
getAffix
()))
{
//多附件,附件地址之间以";"分隔
String
[]
affixs
=
mail
.
getAffix
().
split
(
";"
);
for
(
int
i
=
0
;
i
<
affixs
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
affixs
.
length
;
i
++)
{
File
file
=
new
File
(
affixs
[
i
]);
MimeBodyPart
mbp
=
new
MimeBodyPart
();
DataHandler
dh
=
new
DataHandler
(
new
FileDataSource
(
file
));
...
...
@@ -138,8 +127,8 @@ public class MailUtil {
//创建容器描述数据关系
MimeMultipart
mimeMultipart
=
new
MimeMultipart
();
mimeMultipart
.
addBodyPart
(
mimeBodyPart
);
if
(
null
!=
mimeBodyPartSet
&&
mimeBodyPartSet
.
size
()>
0
)
{
for
(
MimeBodyPart
mbp
:
mimeBodyPartSet
)
{
if
(
null
!=
mimeBodyPartSet
&&
mimeBodyPartSet
.
size
()
>
0
)
{
for
(
MimeBodyPart
mbp
:
mimeBodyPartSet
)
{
mimeMultipart
.
addBodyPart
(
mbp
);
}
}
...
...
src/main/java/org/ccpit/business/registerManage/ExcelHelper.java
View file @
9407336e
...
...
@@ -102,6 +102,7 @@ public class ExcelHelper {
cell22
.
setCellType
(
XSSFCell
.
CELL_TYPE_STRING
);
cell23
.
setCellType
(
XSSFCell
.
CELL_TYPE_STRING
);
cell24
.
setCellType
(
XSSFCell
.
CELL_TYPE_STRING
);
cell25
.
setCellType
(
XSSFCell
.
CELL_TYPE_STRING
);
//在单元格中输入数据
cell0
.
setCellValue
(
"提交时间"
);
...
...
@@ -129,6 +130,7 @@ public class ExcelHelper {
cell22
.
setCellValue
(
"考试科目"
);
cell23
.
setCellValue
(
"报名类型"
);
cell24
.
setCellValue
(
"报名状态"
);
cell25
.
setCellValue
(
"是否购买CDCS/CSDG考前培训"
);
cell0
.
setCellStyle
(
style
);
//循环导出数据到excel中
for
(
int
i
=
0
;
i
<
newsInfoList
.
size
();
i
++)
{
...
...
@@ -159,6 +161,9 @@ public class ExcelHelper {
rowi
.
createCell
(
21
).
setCellValue
(
registerInfo
.
getCity_en
());
//CITY SELECT
rowi
.
createCell
(
22
).
setCellValue
(
registerInfo
.
getSubject
());
//考试科目
rowi
.
createCell
(
24
).
setCellValue
(
registerInfo
.
getRegisterStatus
());
//报名状态
if
(
null
!=
registerInfo
.
getIfBuyFee
()){
rowi
.
createCell
(
25
).
setCellValue
(
1
==
registerInfo
.
getIfBuyFee
()
?
"是"
:
"否"
);
//是否购买CDCS/CSDG靠前培训
}
}
try
{
book
.
write
(
os
);
...
...
src/main/java/org/ccpit/business/registerManage/RegisterController.java
View file @
9407336e
...
...
@@ -25,9 +25,7 @@ import org.ccpit.base.user.User;
import
org.ccpit.business.phase.Phase
;
import
org.ccpit.business.phase.PhaseService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.servlet.ModelAndView
;
...
...
src/main/java/org/ccpit/business/registerManage/RegisterInfo.java
View file @
9407336e
...
...
@@ -26,7 +26,7 @@ import org.springframework.format.annotation.DateTimeFormat;
* Reason: TODO ADD REASON. <br/>
* Date: 2015年11月9日 下午5:33:37 <br/>
*
* @author
sunqipeng
* @author
dingwei
* @see
* @since JDK 1.6
*/
...
...
@@ -95,6 +95,10 @@ public class RegisterInfo implements Serializable {
*/
private
Integer
invoiceType
;
/**
* 是否购买CDCS/CSDG考前培训 1 表示 是 | 2 表示否
*/
private
Integer
ifBuyFee
;
/**
* 省
*/
private
String
province
;
...
...
@@ -721,5 +725,13 @@ public class RegisterInfo implements Serializable {
public
void
setDistrict
(
String
district
)
{
this
.
district
=
district
;
}
public
Integer
getIfBuyFee
()
{
return
ifBuyFee
;
}
public
void
setIfBuyFee
(
Integer
ifBuyFee
)
{
this
.
ifBuyFee
=
ifBuyFee
;
}
}
src/main/resources/framework.properties
View file @
9407336e
# jdbc.X
jdbc.driverClassName
=
com.mysql.jdbc.Driver
# 生产环境 docker 环境下一定要注意 将localhost 换成mysql
jdbc.url
=
jdbc:mysql://mysql:3306/registration?createDatabaseIfNotExist=true&characterEncoding=utf-8
jdbc.user
=
root
jdbc.pass
=
root
#
jdbc.url=jdbc:mysql://mysql:3306/registration?createDatabaseIfNotExist=true&characterEncoding=utf-8
#
jdbc.user=root
#
jdbc.pass=root
# 开发环境
#
jdbc.url=jdbc:mysql://localhost:3306/registration_0611?createDatabaseIfNotExist=true&characterEncoding=utf-8
#
jdbc.user=ccpit
#
jdbc.pass=ccpit1516
jdbc.url
=
jdbc:mysql://localhost:3306/registration_0611?createDatabaseIfNotExist=true&characterEncoding=utf-8
jdbc.user
=
ccpit
jdbc.pass
=
ccpit1516
# hibernate.X
hibernate.dialect
=
org.hibernate.dialect.MySQL5Dialect
...
...
src/main/sql/update.sql
View file @
9407336e
/* create by dingwei 20211212 start */
alter
table
reg_subjectinfo
add
province
varchar
(
100
)
Null
;
alter
table
reg_subjectinfo
add
chengshi
varchar
(
100
)
Null
;
alter
table
reg_subjectinfo
add
district
varchar
(
100
)
Null
;
alter
table
reg_subjectinfo
add
province
varchar
(
100
)
Null
;
alter
table
reg_subjectinfo
add
chengshi
varchar
(
100
)
Null
;
alter
table
reg_subjectinfo
add
district
varchar
(
100
)
Null
;
/* create by dingwei 20211212 end */
src/main/sql/update_20210616.sql
View file @
9407336e
/* create by dingwei 20210611 start */
delete
from
reg_subjectinfo
where
registerInfo_id
=
12978
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12977
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12976
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12975
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12969
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12974
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12971
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12970
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12968
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12967
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12964
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12956
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12955
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12954
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12953
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12978
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12977
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12976
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12975
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12969
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12974
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12971
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12970
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12968
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12967
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12964
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12956
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12955
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12954
;
delete
from
reg_subjectinfo
where
registerInfo_id
=
12953
;
/* create by dingwei 20210611 end */
src/main/sql/update_20210702.sql
View file @
9407336e
/* create by dingwei 20210617 start */
set
character
set
utf8
;
update
reg_subjectinfo
set
registerName
=
'邓默'
where
registerInfo_id
=
12983
;
update
reg_subjectinfo
set
registerName
=
'丁伟'
where
registerInfo_id
=
12979
;
update
reg_subjectinfo
set
registerName
=
'丁伟'
where
registerInfo_id
=
12979
;
set
character
set
utf8
;
update
reg_subjectinfo
set
registerName
=
'邓默'
where
registerInfo_id
=
12983
;
update
reg_subjectinfo
set
registerName
=
'丁伟'
where
registerInfo_id
=
12979
;
update
reg_subjectinfo
set
registerName
=
'丁伟'
where
registerInfo_id
=
12979
;
/* create by dingwei 20210617 end */
src/main/sql/update_20211222.sql
View file @
9407336e
...
...
@@ -3,4 +3,6 @@ alter table reg_registerinfo modify taxIssue Integer;
alter
table
reg_subjectinfo
modify
taxIssue
Integer
;
/* create by dingwei 20210702 end */
select
id
,
name
,
whetherDelete
from
reg_registerinfo
where
taxpayerNum
=
'9142'
;
\ No newline at end of file
select
id
,
name
,
whetherDelete
from
reg_registerinfo
where
taxpayerNum
=
'9142'
;
\ No newline at end of file
src/main/webapp/WEB-INF/jsp/front/info.jsp
View file @
9407336e
...
...
@@ -270,6 +270,15 @@
</c:if>
</c:if>
<tr>
<td
class=
"name"
>
是否购买CDCS/CSDG
</br>
考前培训:
</td>
<c:if
test=
"${registerInfo.ifBuyFee == 1}"
>
<td>
是
</td>
</c:if>
<c:if
test=
"${registerInfo.ifBuyFee == 2}"
>
<td>
否
</td>
</c:if>
</tr>
<tr>
<td
class=
"name"
>
Family Name:
</td>
<td>
${registerInfo.name_en}
</td>
...
...
@@ -312,11 +321,11 @@
<td
class=
"name"
>
COUNTRY:
</td>
<td>
中国
</td>
</tr>
<tr
>
<td
class=
"title"
background=
"/resource/front/img/dh.gif"
height=
"24"
colspan=
"3"
>
上传考生名片
</td
>
</tr
>
<
%
--
<
tr
>
--%
>
<
%
--
<
td
class=
"title"
background=
"/resource/front/img/dh.gif"
height=
"24"
colspan=
"3"
>
--%
>
<
%
--
上传考生名片
--
%
>
<
%
--
</
td
>
--%
>
<
%
--
</
tr
>
--%
>
<
%
--
<
tr
>
--%>
<
%
--
<
td
class=
"name"
>
选择科目
</td>
--%>
<
%
--
<
td
align=
"left"
width=
"30%"
>
--%>
...
...
@@ -331,34 +340,34 @@
<
%
--
</
select
>
--%>
<
%
--
</
td
>
--%>
<
%
--
</
tr
>
--%>
<tr
>
<td
class=
"name"
>
考生名片:
</td
>
<td
align=
"left"
width=
"30%"
>
<input
id=
"imageUrlId1"
class=
"PhotoUpload"
type=
"file"
name=
'file'
/
>
</td
>
<td
align=
"left"
>
<input
data-target=
"imageUrlId1"
class=
"PhotoUploadButton"
type=
"button"
value=
"上传"
name=
"upload"
style=
"width:80px;height:20px"
>
</td
>
</tr
>
<tr
>
<td></td
>
<td
>
<div><img
data-target=
"imageUrlId1"
id=
"img1"
src=
"${registerInfo.img1}"
style=
"width:150px;height:100px"
></div
>
</td
>
<td
align=
"left"
valign=
"top"
>
<p
style=
"color: #000000"
>
图片支持式为:bmp、gif、jpeg、jpg、png,图片大小不要超过1M
</p
>
<p
style=
"color: red;font-size:16px"
>
如开具增值税专用发票,请考生上传个人名片,
</p
>
<p
style=
"color: red;font-size:16px"
>
或其他可证明考生供职于发票抬头所在单位的证明文件,如工牌、入职证明书(拍照即可)等
</p
>
</td
>
</tr
>
<tr
>
<td></td
>
<td
>
<Button
id=
"saveCertificateId"
style=
"width:80px;height:20px"
>
保存照片
</Button
>
</td
>
</tr
>
<
%
--
<
tr
>
--%
>
<
%
--
<
td
class=
"name"
>
考生名片:
</td>
--%
>
<
%
--
<
td
align=
"left"
width=
"30%"
>
--%
>
<
%
--
<
input
id=
"imageUrlId1"
class=
"PhotoUpload"
type=
"file"
name=
'file'
/>
--%
>
<
%
--
</
td
>
--%
>
<
%
--
<
td
align=
"left"
>
--%
>
<
%
--
<
input
data-target=
"imageUrlId1"
class=
"PhotoUploadButton"
type=
"button"
value=
"上传"
--
%
>
<
%
--
name=
"upload"
style=
"width:80px;height:20px"
>
--%
>
<
%
--
</
td
>
--%
>
<
%
--
</
tr
>
--%
>
<
%
--
<
tr
>
--%
>
<
%
--
<
td
></td>
--%
>
<
%
--
<
td
>
--%
>
<
%
--
<
div
><img
data-target=
"imageUrlId1"
id=
"img1"
src=
"${registerInfo.img1}"
--
%
>
<
%
--
style=
"width:150px;height:100px"
></div>
--%
>
<
%
--
</
td
>
--%
>
<
%
--
<
td
align=
"left"
valign=
"top"
>
--%
>
<
%
--
<
p
style=
"color: #000000"
>
图片支持式为:bmp、gif、jpeg、jpg、png,图片大小不要超过1M
</p>
--%
>
<
%
--
<
p
style=
"color: red;font-size:16px"
>
如开具增值税专用发票,请考生上传个人名片,
</p>
--%
>
<
%
--
<
p
style=
"color: red;font-size:16px"
>
或其他可证明考生供职于发票抬头所在单位的证明文件,如工牌、入职证明书(拍照即可)等
</p>
--%
>
<
%
--
</
td
>
--%
>
<
%
--
</
tr
>
--%
>
<
%
--
<
tr
>
--%
>
<
%
--
<
td
></td>
--%
>
<
%
--
<
td
>
--%
>
<
%
--
<
Button
id=
"saveCertificateId"
style=
"width:80px;height:20px"
>
保存照片
</Button>
--%
>
<
%
--
</
td
>
--%
>
<
%
--
</
tr
>
--%
>
<tr>
<td
class=
"title"
background=
"/resource/front/img/dh.gif"
height=
"24"
colspan=
"3"
>
My LIBF 登录
...
...
src/main/webapp/WEB-INF/jsp/front/reg.jsp
View file @
9407336e
...
...
@@ -46,7 +46,7 @@
<tr
id=
"trEmial"
name=
"email33"
>
<td
class=
"name"
width=
"15%"
><span
style=
"color: red;"
>
*
</span><yh:yh
id=
"1_Info_Email"
english=
"E-mail:"
isnotnull=
"1"
>
邮箱:
</yh:yh></td>
<td
width=
"25%"
><input
name=
"email"
value=
""
style=
"width:220px"
onblur=
"this.value=this.value.toLowerCase().replace(/(^\s*)|(\s*$)/g,""); "
type=
"text"
><input
name=
"A_MAINID"
type=
"hidden"
><input
name=
"A_LINK_ID"
type=
"hidden"
><input
name=
"A_ROLEID"
type=
"hidden"
><input
name=
"A_LANGID"
type=
"hidden"
><input
name=
"A_CON_CNF_ID"
type=
"hidden"
><input
name=
"A_STAT_ID"
type=
"hidden"
><input
name=
"A_AUDITSTATE"
type=
"hidden"
><input
name=
"D_LINK_ID"
type=
"hidden"
><input
name=
"D_MAINID"
type=
"hidden"
></td>
<td
width=
"50%"
><span
class=
"reg_body"
>
必填:
请勿使用QQ邮箱,
邮箱会作为登录名,请如实填写
</span></td>
<td
width=
"50%"
><span
class=
"reg_body"
>
必填:邮箱会作为登录名,请如实填写
</span></td>
</tr>
<tr
id=
"trPassWord"
name=
"password33"
>
<td
class=
"name"
><span
style=
"color: red;"
>
*
</span><yh:yh
id=
"1_Info_Password"
english=
"Password:"
isnotnull=
"1"
>
密码:
</yh:yh></td>
...
...
@@ -122,7 +122,14 @@
type=
"text"
></textarea></td>
<td><span
class=
"reg_body"
>
必填:可以安全收到邮寄材料的地址
</span></td>
</tr>
<tr
id=
"trIfBuyFee"
name=
"trIfBuyFee"
>
<td
class=
"name"
><span
style=
"color: red;"
>
*
</span>
是否购买CDCS/CSDG
</br>
考前培训:
</td>
<td
>
<input
class=
"required"
checked=
"checked"
type=
"radio"
name=
"ifBuyFee"
value=
"1"
width=
"40%"
>
是
</input>
  
<input
class=
"required"
type=
"radio"
name=
"ifBuyFee"
value=
"2"
width=
"40%"
>
否
</input>
</td>
<td><span
class=
"reg_body"
>
必选
</span></td>
</tr>
<tr>
<td
class=
"name"
><span
style=
"color: red;"
>
*
</span><yh:yh
id=
"1_customitem6"
english=
"Custom Item6:"
isnotnull=
"0"
>
增值税发票:
</yh:yh></td>
<td><select
class=
"required"
id=
"appreciationTaxTypeId"
name=
"appreciationTaxType"
style=
"width:225px"
>
...
...
src/main/webapp/WEB-INF/jsp/front/reg2.jsp
View file @
9407336e
...
...
@@ -67,7 +67,7 @@
<tr
id=
"trEmial"
name=
"email33"
>
<td
class=
"name"
width=
"15%"
><span
style=
"color: red;"
>
*
</span><yh:yh
id=
"1_Info_Email"
english=
"E-mail:"
isnotnull=
"1"
>
邮箱:
</yh:yh></td>
<td
width=
"25%"
><input
name=
"email"
value=
""
style=
"width:220px"
onblur=
"this.value=this.value.toLowerCase().replace(/(^\s*)|(\s*$)/g,""); "
type=
"text"
><input
name=
"A_MAINID"
type=
"hidden"
><input
name=
"A_LINK_ID"
type=
"hidden"
><input
name=
"A_ROLEID"
type=
"hidden"
><input
name=
"A_LANGID"
type=
"hidden"
><input
name=
"A_CON_CNF_ID"
type=
"hidden"
><input
name=
"A_STAT_ID"
type=
"hidden"
><input
name=
"A_AUDITSTATE"
type=
"hidden"
><input
name=
"D_LINK_ID"
type=
"hidden"
><input
name=
"D_MAINID"
type=
"hidden"
></td>
<td
width=
"50%"
><span
class=
"reg_body"
>
请勿使用QQ邮箱,
邮箱会作为登录名,请如实填写
</span></td>
<td
width=
"50%"
><span
class=
"reg_body"
>
邮箱会作为登录名,请如实填写
</span></td>
</tr>
<tr
id=
"trPassWord"
name=
"password33"
>
<td
class=
"name"
><span
style=
"color: red;"
>
*
</span><yh:yh
id=
"1_Info_Password"
english=
"Password:"
isnotnull=
"1"
>
密码:
</yh:yh></td>
...
...
src/main/webapp/resource/front/js/reg.js
View file @
9407336e
...
...
@@ -85,10 +85,10 @@ var REG = function () {
});
$
(
"[name=email]"
).
on
(
"blur"
,
function
()
{
var
e
=
$
(
"[name=email]"
).
val
();
if
(
new
RegExp
(
"^
\\
w+@qq
\
.com$"
).
test
(
e
))
{
showWarning
(
$
(
"[name=email]"
),
"请勿使用QQ邮箱注册!"
);
return
;
}
//
if (new RegExp("^\\w+@qq\.com$").test(e)) {
//
showWarning($("[name=email]"), "请勿使用QQ邮箱注册!");
//
return;
//
}
var
filter
=
/^
([
a-zA-Z0-9_
\.\-])
+
\@(([
a-zA-Z0-9
\-])
+
\.)
+
([
a-zA-Z0-9
]{2,4})
+$/
;
if
(
!
filter
.
test
(
e
))
{
showWarning
(
$
(
"[name=email]"
),
"邮箱格式不正确!"
);
...
...
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