Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fangyeqing
/
xkl-interface
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
zhaoyue
7 years ago
Commit
5caa346993f1472ac5dc73145b8d82465d0b292d
1 parent
a419c684
Add rtn more information when verify the usr account
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
src/main/java/com/xkl/controller/uspih/UserAccountController.java
src/main/java/com/xkl/model/UsrInfoModelForUSPIH.java
src/main/java/com/xkl/controller/uspih/UserAccountController.java
View file @
5caa346
...
...
@@ -11,10 +11,12 @@ import com.xkl.domain.User;
import
com.xkl.domain.XklAdminEntity
;
import
com.xkl.domain.XklMemberEntity
;
import
com.xkl.model.ResultModel
;
import
com.xkl.model.UsrInfoModelForUSPIH
;
import
com.xkl.repository.UserRepository
;
import
com.xkl.repository.XklMemberRespository
;
import
com.xkl.security.AntiXSS
;
import
com.xkl.security.SecurityTool
;
import
com.xkl.tools.DatetimeTools
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -25,6 +27,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* @author zhaoyue
...
...
@@ -34,7 +38,9 @@ import javax.servlet.http.HttpServletRequest;
public
class
UserAccountController
{
@Autowired
private
UserRepository
userRepository
;
@Autowired
private
XklMemberRespository
memberRespository
;
private
static
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
//小写的mm表示的是分钟
@RequestMapping
(
method
=
RequestMethod
.
GET
)
@AntiXSS
...
...
@@ -47,7 +53,17 @@ public class UserAccountController {
if
(
user
==
null
)
{
//用户未找到
return
new
ResponseEntity
<>(
ResultModel
.
error
(
ResultStatus
.
USER_NOT_FOUND
),
HttpStatus
.
OK
);
}
return
new
ResponseEntity
<>(
ResultModel
.
ok
(),
HttpStatus
.
OK
);
XklMemberEntity
xklMemberEntity
=
memberRespository
.
findOne
((
long
)
user
.
getMemberId
());
Date
birthDate
=
new
Date
();
try
{
birthDate
=
sdf
.
parse
(
xklMemberEntity
.
getBirthDate
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
int
age
=
DatetimeTools
.
getAge
(
birthDate
,
new
Date
());
UsrInfoModelForUSPIH
usrInfo
=
new
UsrInfoModelForUSPIH
(
xklMemberEntity
.
getName
(),
xklMemberEntity
.
isSex
()
?
1
:
0
,
age
);
return
new
ResponseEntity
<>(
ResultModel
.
ok
(
usrInfo
),
HttpStatus
.
OK
);
}
...
...
src/main/java/com/xkl/model/UsrInfoModelForUSPIH.java
0 → 100644
View file @
5caa346
package
com
.
xkl
.
model
;
import
lombok.Data
;
/**
* QrCode信息
*/
@Data
public
class
UsrInfoModelForUSPIH
{
private
String
name
;
private
int
sex
;
private
int
age
;
public
UsrInfoModelForUSPIH
(
String
name
,
int
sex
,
int
age
)
{
this
.
name
=
name
;
this
.
sex
=
sex
;
this
.
age
=
age
;
}
}
...
...
Please
register
or
login
to post a comment