Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
tjmdp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Redmine
Redmine
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
other-project
tjmdp
Commits
2b72dc2f
Commit
2b72dc2f
authored
Apr 16, 2019
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
c0656b16
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
8 deletions
+58
-8
MdpController.java
src/main/java/com/qiankun/controller/mdp/MdpController.java
+6
-4
RainbowPlanController.java
...qiankun/controller/rainbowplan/RainbowPlanController.java
+4
-4
UserUtils.java
src/main/java/com/qiankun/utils/UserUtils.java
+48
-0
No files found.
src/main/java/com/qiankun/controller/mdp/MdpController.java
View file @
2b72dc2f
...
...
@@ -10,7 +10,9 @@ import com.qiankun.config.WxMaProperties;
import
com.qiankun.entity.User
;
import
com.qiankun.service.UserService
;
import
com.qiankun.utils.JwtTokenUtil
;
import
com.qiankun.utils.UserUtils
;
import
com.qiankun.vo.PaperIdLoginVo
;
import
com.qiankun.vo.UserVo
;
import
me.chanjar.weixin.common.error.WxErrorException
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -55,7 +57,7 @@ public class MdpController {
if
(
userInfo
!=
null
){
String
sKey
=
tokenUtil
.
generateToken
(
userInfo
.
getOpenid
());
result
.
put
(
"sKey"
,
sKey
);
result
.
put
(
"userInfo"
,
userInfo
);
result
.
put
(
"userInfo"
,
UserUtils
.
converToVo
(
userInfo
)
);
}
else
{
result
.
put
(
"sKey"
,
""
);
result
.
put
(
"userInfo"
,
""
);
...
...
@@ -82,7 +84,7 @@ public class MdpController {
user
.
setOpenid
(
vo
.
getOpenid
());
userService
.
save
(
user
);
result
.
put
(
"sKey"
,
tokenUtil
.
generateToken
(
user
.
getOpenid
()));
result
.
put
(
"userInfo"
,
user
);
result
.
put
(
"userInfo"
,
UserUtils
.
converToVo
(
user
)
);
}
result
.
put
(
"isExist"
,
true
);
}
...
...
@@ -91,13 +93,13 @@ public class MdpController {
@Auth
(
verifyLogin
=
false
,
verifyURL
=
false
)
@RequestMapping
(
value
=
"/userInfo"
,
method
=
RequestMethod
.
GET
)
public
User
getUserInfo
(
@RequestHeader
String
sKey
){
public
User
Vo
getUserInfo
(
@RequestHeader
String
sKey
){
if
(
Strings
.
isNullOrEmpty
(
sKey
)){
throw
new
IllegalArgumentException
(
"请求参数错误"
);
}
String
openid
=
tokenUtil
.
getUsernameFromToken
(
sKey
);
User
user
=
userService
.
findByOpenid
(
openid
);
return
user
;
return
UserUtils
.
converToVo
(
user
)
;
}
}
src/main/java/com/qiankun/controller/rainbowplan/RainbowPlanController.java
View file @
2b72dc2f
...
...
@@ -139,7 +139,7 @@ public class RainbowPlanController {
}
@Auth
(
verifyLogin
=
false
,
verifyURL
=
false
)
@RequestMapping
(
value
=
"/userInfo"
,
method
=
RequestMethod
.
POST
)
public
String
updateUserInfo
(
@RequestBody
UserInfo
info
,
@RequestHeader
String
sKey
)
throws
Exception
{
public
@ResponseBody
RainbowPlanUser
updateUserInfo
(
@RequestBody
UserInfo
info
,
@RequestHeader
String
sKey
)
throws
Exception
{
if
(
Strings
.
isNullOrEmpty
(
sKey
)){
throw
new
IllegalArgumentException
(
"请求参数错误"
);
}
...
...
@@ -160,12 +160,12 @@ public class RainbowPlanController {
throw
new
Exception
(
"保存失败,请求用户不存在"
);
}
return
"OK"
;
return
user
;
}
@Auth
(
verifyLogin
=
false
,
verifyURL
=
false
)
@RequestMapping
(
value
=
"/userInfoWithAvatar"
,
method
=
RequestMethod
.
POST
)
public
String
updateUserInfoWithAvatar
(
UserInfo
info
,
@RequestHeader
String
sKey
)
throws
Exception
{
public
@ResponseBody
RainbowPlanUser
updateUserInfoWithAvatar
(
UserInfo
info
,
@RequestHeader
String
sKey
)
throws
Exception
{
if
(
Strings
.
isNullOrEmpty
(
sKey
)){
throw
new
IllegalArgumentException
(
"请求参数错误"
);
}
...
...
@@ -194,7 +194,7 @@ public class RainbowPlanController {
}
else
{
throw
new
Exception
(
"保存失败,请求用户不存在"
);
}
return
"OK"
;
return
user
;
}
@Auth
(
verifyLogin
=
false
,
verifyURL
=
false
)
@RequestMapping
(
value
=
"/publishWish"
,
method
=
RequestMethod
.
POST
)
...
...
src/main/java/com/qiankun/utils/UserUtils.java
0 → 100644
View file @
2b72dc2f
package
com
.
qiankun
.
utils
;
import
com.qiankun.entity.Contacts
;
import
com.qiankun.entity.User
;
import
com.qiankun.vo.UserVo
;
import
org.springframework.beans.BeanUtils
;
import
java.util.Iterator
;
import
java.util.Set
;
public
class
UserUtils
{
public
static
UserVo
converToVo
(
User
user
){
UserVo
vo
=
null
;
if
(
user
!=
null
){
vo
=
new
UserVo
();
BeanUtils
.
copyProperties
(
user
,
vo
);
Set
<
Contacts
>
contacts
=
user
.
getContacts
();
if
(
contacts
!=
null
){
Iterator
<
Contacts
>
its
=
contacts
.
iterator
();
Integer
count
=
0
;
while
(
its
.
hasNext
())
{
Contacts
c
=
its
.
next
();
if
(
count
==
0
)
{
vo
.
setContactsAddr1
(
c
.
getAddr
());
vo
.
setContactsName1
(
c
.
getName
());
vo
.
setContactsMobile1
(
c
.
getMobile
());
vo
.
setContactsRelation1
(
c
.
getRelation
());
vo
.
setContactsWeixin1
(
c
.
getWeixin
());
vo
.
setContactsQQ1
(
c
.
getQq
());
count
++;
}
else
{
vo
.
setContactsAddr2
(
c
.
getAddr
());
vo
.
setContactsName2
(
c
.
getName
());
vo
.
setContactsMobile2
(
c
.
getMobile
());
vo
.
setContactsRelation2
(
c
.
getRelation
());
vo
.
setContactsWeixin2
(
c
.
getWeixin
());
vo
.
setContactsQQ2
(
c
.
getQq
());
}
}
}
}
return
vo
;
}
}
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