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
729db3d3
Commit
729db3d3
authored
Apr 23, 2019
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加接口
parent
ad9edf08
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
0 deletions
+73
-0
MdpController.java
src/main/java/com/qiankun/controller/mdp/MdpController.java
+73
-0
No files found.
src/main/java/com/qiankun/controller/mdp/MdpController.java
View file @
729db3d3
...
@@ -10,6 +10,7 @@ import com.qiankun.annotation.Auth;
...
@@ -10,6 +10,7 @@ import com.qiankun.annotation.Auth;
import
com.qiankun.config.WxMaConfiguration
;
import
com.qiankun.config.WxMaConfiguration
;
import
com.qiankun.config.WxMaProperties
;
import
com.qiankun.config.WxMaProperties
;
import
com.qiankun.dao.UserDao
;
import
com.qiankun.dao.UserDao
;
import
com.qiankun.entity.Contacts
;
import
com.qiankun.entity.User
;
import
com.qiankun.entity.User
;
import
com.qiankun.service.UserService
;
import
com.qiankun.service.UserService
;
import
com.qiankun.utils.JwtTokenUtil
;
import
com.qiankun.utils.JwtTokenUtil
;
...
@@ -33,8 +34,10 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -33,8 +34,10 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.ResourceBundle
;
import
java.util.ResourceBundle
;
import
java.util.Set
;
@RestController
@RestController
@RequestMapping
(
"/wx/mdp"
)
@RequestMapping
(
"/wx/mdp"
)
...
@@ -177,6 +180,76 @@ public class MdpController {
...
@@ -177,6 +180,76 @@ public class MdpController {
return
result
;
return
result
;
}
}
/**
* 获取用户积分、参与的活动等相关信息
* @param sKey
* @return
*/
@Auth
(
verifyURL
=
false
,
verifyLogin
=
false
)
@RequestMapping
(
value
=
"/userActivityInfo"
,
method
=
RequestMethod
.
GET
)
public
Map
<
String
,
Object
>
getUserActivityInfo
(
@RequestHeader
String
sKey
){
Map
<
String
,
Object
>
result
=
Maps
.
newConcurrentMap
();
if
(
Strings
.
isNullOrEmpty
(
sKey
)){
result
.
put
(
"status"
,
"error"
);
result
.
put
(
"errorMsg"
,
"请求参数错误"
);
return
result
;
}
String
openid
=
tokenUtil
.
getUsernameFromToken
(
sKey
);
User
user
=
userService
.
findByOpenid
(
openid
);
if
(
user
==
null
){
result
.
put
(
"status"
,
"error"
);
result
.
put
(
"errorMsg"
,
"用户不存在"
);
return
result
;
}
if
(
Strings
.
isNullOrEmpty
(
user
.
getName
())
||
Strings
.
isNullOrEmpty
(
user
.
getBirthday
())
||
Strings
.
isNullOrEmpty
(
user
.
getPaperType
())
||
Strings
.
isNullOrEmpty
(
user
.
getPaperId
())
||
Strings
.
isNullOrEmpty
(
user
.
getNation
())
||
Strings
.
isNullOrEmpty
(
user
.
getNationality
())
||
Strings
.
isNullOrEmpty
(
user
.
getNativePlace
())
||
Strings
.
isNullOrEmpty
(
user
.
getAddr
())
||
Strings
.
isNullOrEmpty
(
user
.
getMobile
())
||
Strings
.
isNullOrEmpty
(
user
.
getQq
())
||
!
validateContacts
(
user
)){
result
.
put
(
"userInfoStatus"
,
"unComplete"
);
}
else
{
result
.
put
(
"userInfoStatus"
,
"complete"
);
}
result
.
put
(
"points"
,
getUserPoints
(
user
));
result
.
put
(
"status"
,
"ok"
);
return
result
;
}
/**
* 获取用户积分
* @param user
* @return
*/
private
int
getUserPoints
(
User
user
){
return
0
;
}
private
boolean
validateContacts
(
User
user
){
boolean
flag
=
true
;
Set
<
Contacts
>
sets
=
user
.
getContacts
();
if
(
sets
==
null
){
flag
=
false
;
}
else
{
Iterator
<
Contacts
>
it
=
sets
.
iterator
();
while
(
it
.
hasNext
()){
Contacts
c
=
it
.
next
();
if
(
Strings
.
isNullOrEmpty
(
c
.
getName
())
||
Strings
.
isNullOrEmpty
(
c
.
getRelation
())
||
Strings
.
isNullOrEmpty
(
c
.
getMobile
())){
flag
=
false
;
break
;
}
}
}
return
flag
;
}
@Auth
(
verifyLogin
=
false
,
verifyURL
=
false
)
@Auth
(
verifyLogin
=
false
,
verifyURL
=
false
)
@RequestMapping
(
value
=
"/loadResource"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/loadResource"
,
method
=
RequestMethod
.
GET
)
public
ResponseEntity
<
byte
[]>
loadResource
(
@RequestParam
String
imageName
)
throws
IOException
{
public
ResponseEntity
<
byte
[]>
loadResource
(
@RequestParam
String
imageName
)
throws
IOException
{
...
...
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