Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
a7d0155a
Commit
a7d0155a
authored
Jan 03, 2017
by
zhouqian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first login
parent
f9413568
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
135 additions
and
8 deletions
+135
-8
UserDetailController.java
...p/xyqb/controller/internal/user/UserDetailController.java
+69
-0
Address.java
src/main/java/cn/quantgroup/xyqb/entity/Address.java
+1
-1
Contact.java
src/main/java/cn/quantgroup/xyqb/entity/Contact.java
+4
-3
UserExtInfo.java
src/main/java/cn/quantgroup/xyqb/entity/UserExtInfo.java
+1
-1
Relation.java
...in/java/cn/quantgroup/xyqb/entity/enumerate/Relation.java
+39
-0
RequestFilter.java
src/main/java/cn/quantgroup/xyqb/filter/RequestFilter.java
+5
-1
SessionServiceImpl.java
...ntgroup/xyqb/service/session/impl/SessionServiceImpl.java
+1
-0
XyqbSessionContextHolder.java
.../cn/quantgroup/xyqb/session/XyqbSessionContextHolder.java
+3
-0
ValidationUtil.java
src/main/java/cn/quantgroup/xyqb/util/ValidationUtil.java
+12
-2
No files found.
src/main/java/cn/quantgroup/xyqb/controller/internal/user/UserDetailController.java
0 → 100644
View file @
a7d0155a
package
cn
.
quantgroup
.
xyqb
.
controller
.
internal
.
user
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.UserDetail
;
import
cn.quantgroup.xyqb.model.IdCardInfo
;
import
cn.quantgroup.xyqb.model.IdType
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.sql.Timestamp
;
import
java.text.ParseException
;
/**
* Created by Miraculous on 2017/1/3.
*/
@RestController
@RequestMapping
(
"/user_detail"
)
public
class
UserDetailController
implements
IBaseController
{
@Autowired
private
IUserDetailService
userDetailService
;
@Autowired
private
IIdCardService
idCardService
;
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
UserDetailController
.
class
);
@RequestMapping
(
"/save"
)
public
JsonResult
saveUserdetail
(
String
idNo
,
String
name
)
{
try
{
if
(!
ValidationUtil
.
validateChinese
(
name
))
{
return
JsonResult
.
buildErrorStateResult
(
"姓名错误"
,
null
);
}
IdCardInfo
info
=
idCardService
.
getIdCardInfo
(
idNo
);
if
(!
info
.
isValid
())
{
return
JsonResult
.
buildErrorStateResult
(
"身份证号码错误"
,
null
);
}
User
user
=
getCurrentUser
();
if
(
user
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"系统错误"
,
null
);
}
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
UserDetail
userDetail
=
new
UserDetail
();
userDetail
.
setIdNo
(
idNo
);
userDetail
.
setPhoneNo
(
user
.
getPhoneNo
());
userDetail
.
setUserId
(
user
.
getId
());
userDetail
.
setCreatedAt
(
now
);
userDetail
.
setUpdatedAt
(
now
);
userDetail
.
setName
(
name
);
userDetail
.
setGender
(
info
.
getGender
());
userDetail
.
setEmail
(
""
);
userDetail
.
setIdType
(
IdType
.
ID_CARD
);
userDetail
.
setIsAuthenticated
(
false
);
userDetail
.
setQq
(
""
);
userDetailService
.
saveUserDetail
(
userDetail
);
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
}
catch
(
ParseException
ex
)
{
LOGGER
.
error
(
"身份证号错误, idNo: {}"
,
idNo
);
return
JsonResult
.
buildErrorStateResult
(
"身份证号码错误"
,
null
);
}
}
}
src/main/java/cn/quantgroup/xyqb/entity/Address.java
View file @
a7d0155a
...
...
@@ -39,6 +39,6 @@ public class Address implements Serializable{
private
String
address
;
@Column
(
name
=
"created_at"
)
private
Timestamp
createdAt
;
@Column
(
name
=
"update_at"
)
@Column
(
name
=
"update
d
_at"
)
private
Timestamp
updateAt
;
}
src/main/java/cn/quantgroup/xyqb/entity/Contact.java
View file @
a7d0155a
package
cn
.
quantgroup
.
xyqb
.
entity
;
import
cn.quantgroup.xyqb.entity.enumerate.Relation
;
import
lombok.Data
;
import
javax.persistence.*
;
...
...
@@ -26,9 +27,9 @@ public class Contact implements Serializable {
@Column
(
name
=
"phone_no"
)
private
String
phoneNo
;
@Column
(
name
=
"relation"
)
private
String
relation
;
@Column
(
name
=
"create_at"
)
private
Relation
relation
;
@Column
(
name
=
"create
d
_at"
)
private
Timestamp
createdAt
;
@Column
(
name
=
"update_at"
)
@Column
(
name
=
"update
d
_at"
)
private
Timestamp
updateAt
;
}
src/main/java/cn/quantgroup/xyqb/entity/UserExtInfo.java
View file @
a7d0155a
...
...
@@ -47,7 +47,7 @@ public class UserExtInfo implements Serializable {
private
boolean
marryStatus
;
@Column
(
name
=
"created_at"
)
private
Timestamp
createdAt
;
@Column
(
name
=
"update_at"
)
@Column
(
name
=
"update
d
_at"
)
private
Timestamp
updateAt
;
}
src/main/java/cn/quantgroup/xyqb/entity/enumerate/Relation.java
0 → 100644
View file @
a7d0155a
package
cn
.
quantgroup
.
xyqb
.
entity
.
enumerate
;
/**
* Created by Miraculous on 2017/1/3.
*/
public
enum
Relation
{
PARENT
(
"父母"
),
CHILDREN
(
"子女"
),
BROTHER
(
"兄弟姐妹"
),
COLLEAGUE
(
"同事"
),
CLASSMATE
(
"同学"
),
FRIEND
(
"朋友"
),
SPOUSE
(
"夫妻"
),
SELF
(
"本人"
),
OTHER
(
"其他"
);
String
description
;
Relation
(
String
desc
)
{
description
=
desc
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
@Override
public
String
toString
()
{
final
StringBuffer
sb
=
new
StringBuffer
(
"Relation{"
);
sb
.
append
(
"description='"
).
append
(
description
).
append
(
'\''
);
sb
.
append
(
'}'
);
return
sb
.
toString
();
}
}
src/main/java/cn/quantgroup/xyqb/filter/RequestFilter.java
View file @
a7d0155a
...
...
@@ -63,7 +63,11 @@ public class RequestFilter implements Filter {
if
(
sessionStruct
==
null
)
{
return
;
}
try
{
sessionService
.
persistSession
(
sessionStruct
.
getSid
(),
sessionStruct
.
getValues
());
}
finally
{
XyqbSessionContextHolder
.
releaseSession
();
}
}
private
boolean
isMatch
(
String
path
)
{
...
...
src/main/java/cn/quantgroup/xyqb/service/session/impl/SessionServiceImpl.java
View file @
a7d0155a
...
...
@@ -6,6 +6,7 @@ import cn.quantgroup.xyqb.function.OneArgFunction;
import
cn.quantgroup.xyqb.model.session.SessionStruct
;
import
cn.quantgroup.xyqb.model.session.SessionValue
;
import
cn.quantgroup.xyqb.service.session.ISessionService
;
import
cn.quantgroup.xyqb.session.XyqbSessionContextHolder
;
import
com.alibaba.fastjson.JSON
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
src/main/java/cn/quantgroup/xyqb/session/XyqbSessionContextHolder.java
View file @
a7d0155a
...
...
@@ -52,4 +52,7 @@ public class XyqbSessionContextHolder {
}
}
public
static
void
releaseSession
()
{
threadSession
.
remove
();
}
}
src/main/java/cn/quantgroup/xyqb/util/ValidationUtil.java
View file @
a7d0155a
...
...
@@ -12,8 +12,10 @@ import java.util.regex.Pattern;
public
class
ValidationUtil
{
private
static
String
regExp
=
"^((13[0-9])|(14[0-9])|(15[0-9])|(17[37680])|(18[0-9]))\\d{8}$"
;
private
static
String
chineseExp
=
"^[\u4e00-\u9fa5]+(\\.|·)?[\u4e00-\u9fa5]+$"
;
private
static
Pattern
pattern
=
Pattern
.
compile
(
regExp
);
private
static
Pattern
phonePattern
=
Pattern
.
compile
(
regExp
);
private
static
Pattern
chinesePattern
=
Pattern
.
compile
(
chineseExp
);
public
static
boolean
validatePhoneNo
(
String
phoneNo
)
{
...
...
@@ -23,11 +25,19 @@ public class ValidationUtil {
return
false
;
}
Matcher
matcher
=
pattern
.
matcher
(
phoneNo
);
Matcher
matcher
=
p
honeP
attern
.
matcher
(
phoneNo
);
return
matcher
.
find
();
}
public
static
boolean
validateChinese
(
String
chinese
)
{
if
(
StringUtils
.
isEmpty
(
chinese
))
{
return
false
;
}
Matcher
matcher
=
chinesePattern
.
matcher
(
chinese
);
return
matcher
.
find
();
}
public
static
boolean
validateChannelId
(
Long
channelId
)
{
return
channelId
==
0L
?
false
:
true
;
}
...
...
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