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
4c828a8a
Commit
4c828a8a
authored
Feb 16, 2017
by
lee_mingzhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加限制,用户已保存的联系人>=2时,不允许再保存联系人信息
parent
e659fbd2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
20 deletions
+29
-20
WeChatController.java
...group/xyqb/controller/external/user/WeChatController.java
+15
-8
UserDetailServiceImpl.java
...ntgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
+14
-12
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/WeChatController.java
View file @
4c828a8a
...
@@ -4,6 +4,7 @@ import cn.quantgroup.xyqb.Constants;
...
@@ -4,6 +4,7 @@ import cn.quantgroup.xyqb.Constants;
import
cn.quantgroup.xyqb.entity.Merchant
;
import
cn.quantgroup.xyqb.entity.Merchant
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.WechatUserInfo
;
import
cn.quantgroup.xyqb.entity.WechatUserInfo
;
import
cn.quantgroup.xyqb.event.UserinfoChangedEvent
;
import
cn.quantgroup.xyqb.model.AuthBean
;
import
cn.quantgroup.xyqb.model.AuthBean
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.webchat.AccessTokenResponse
;
import
cn.quantgroup.xyqb.model.webchat.AccessTokenResponse
;
...
@@ -173,7 +174,7 @@ public class WeChatController {
...
@@ -173,7 +174,7 @@ public class WeChatController {
* @return
* @return
*/
*/
@RequestMapping
(
"/receiveCode/{key}"
)
@RequestMapping
(
"/receiveCode/{key}"
)
public
void
receiveCode
(
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
HttpServletResponse
response
)
{
public
void
receiveCode
(
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
String
redirect
,
HttpServletResponse
response
)
{
LOGGER
.
info
(
"微信登录:"
+
systemKey
);
LOGGER
.
info
(
"微信登录:"
+
systemKey
);
// 从code获取token
// 从code获取token
Merchant
merchant
=
merchantService
.
findMerchantByName
(
systemKey
);
Merchant
merchant
=
merchantService
.
findMerchantByName
(
systemKey
);
...
@@ -214,18 +215,24 @@ public class WeChatController {
...
@@ -214,18 +215,24 @@ public class WeChatController {
}
}
// 已经关联了用户
// 已经关联了用户
// create session, 登进去,该怎么玩怎么玩。
// create session, 登进去,该怎么玩怎么玩。
String
redirectUrl
=
createUserSession
(
user
,
merchant
);
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
redirect
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
response
.
setStatus
(
301
);
}
}
private
String
createUserSession
(
User
user
,
Merchant
merchant
)
{
private
String
createUserSession
(
User
user
,
Merchant
merchant
,
String
redirect
)
{
LOGGER
.
info
(
"微信登录: createUserSession:{} merchant is null:"
,
merchant
==
null
);
if
(
StringUtils
.
isEmpty
(
redirect
))
{
if
(
"baitiao"
.
equals
(
merchant
.
getName
()))
{
LOGGER
.
info
(
"微信登录: createUserSession:{} merchant is null:"
,
merchant
==
null
);
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget5"
,
Constants
.
Channel
.
BAITIAO
);
if
(
"baitiao"
.
equals
(
merchant
.
getName
()))
{
}
else
{
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget5"
,
Constants
.
Channel
.
BAITIAO
);
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget4"
,
1L
);
}
else
{
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget4"
,
1L
);
}
}
else
if
(
redirect
.
equals
(
"redirect"
)){
AuthBean
authBean
=
sessionService
.
createSession
(
Constants
.
Channel
.
WECHAT
,
Constants
.
Channel
.
WECHAT
,
""
,
user
,
merchant
);
return
userUIAddr
+
"/weixin/callback?phoneNo="
+
user
.
getPhoneNo
()
+
"&token="
+
authBean
.
getToken
();
}
}
return
null
;
}
}
private
String
loginInWechatWithSessionCreated
(
User
user
,
Merchant
merchant
,
String
target
,
Long
channelId
)
{
private
String
loginInWechatWithSessionCreated
(
User
user
,
Merchant
merchant
,
String
target
,
Long
channelId
)
{
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
View file @
4c828a8a
...
@@ -49,18 +49,20 @@ public class UserDetailServiceImpl implements IUserDetailService {
...
@@ -49,18 +49,20 @@ public class UserDetailServiceImpl implements IUserDetailService {
Specification
<
UserDetail
>
specification
=
new
Specification
<
UserDetail
>()
{
Specification
<
UserDetail
>
specification
=
new
Specification
<
UserDetail
>()
{
@Override
@Override
public
Predicate
toPredicate
(
Root
<
UserDetail
>
root
,
CriteriaQuery
<?>
criteriaQuery
,
CriteriaBuilder
criteriaBuilder
)
{
public
Predicate
toPredicate
(
Root
<
UserDetail
>
root
,
CriteriaQuery
<?>
criteriaQuery
,
CriteriaBuilder
criteriaBuilder
)
{
if
(!
StringUtils
.
isEmpty
(
name
))
{
//以下条件不做非空判断,如果判断非空当不填任何条件查询时,会将user_detail表的所有数据都查询出来
Path
<
String
>
namePath
=
root
.
get
(
"name"
);
//不做非空判断,当不填任何条件查询时将返回空列表[]
criteriaQuery
.
where
(
criteriaBuilder
.
equal
(
namePath
,
name
));
//if (!StringUtils.isEmpty(name)) {
}
Path
<
String
>
namePath
=
root
.
get
(
"name"
);
if
(!
StringUtils
.
isEmpty
(
phoneNo
))
{
criteriaQuery
.
where
(
criteriaBuilder
.
equal
(
namePath
,
name
));
Path
<
String
>
phonePath
=
root
.
get
(
"phoneNo"
);
//}
criteriaQuery
.
where
(
criteriaBuilder
.
equal
(
phonePath
,
phoneNo
));
//if (!StringUtils.isEmpty(phoneNo)) {
}
Path
<
String
>
phonePath
=
root
.
get
(
"phoneNo"
);
if
(!
StringUtils
.
isEmpty
(
idNo
))
{
criteriaQuery
.
where
(
criteriaBuilder
.
equal
(
phonePath
,
phoneNo
));
Path
<
String
>
idNoPath
=
root
.
get
(
"idNo"
);
//}
criteriaQuery
.
where
(
criteriaBuilder
.
equal
(
idNoPath
,
idNo
));
//if (!StringUtils.isEmpty(idNo)) {
}
Path
<
String
>
idNoPath
=
root
.
get
(
"idNo"
);
criteriaQuery
.
where
(
criteriaBuilder
.
equal
(
idNoPath
,
idNo
));
//}
return
null
;
return
null
;
}
}
};
};
...
...
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