记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
董敬伟
liquidnet-bus-v1
Commits
5a08087c
Commit
5a08087c
authored
Aug 18, 2021
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加单个openid同步
parent
1ccd5acc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
2 deletions
+54
-2
SweetWechatSyncDataController.java
...rvice/sweet/controller/SweetWechatSyncDataController.java
+18
-1
SweetWechatMpService.java
...dnet/service/sweet/service/impl/SweetWechatMpService.java
+36
-0
SweetWechatTemplateServiceImpl.java
...ce/sweet/service/impl/SweetWechatTemplateServiceImpl.java
+0
-1
No files found.
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/controller/SweetWechatSyncDataController.java
View file @
5a08087c
...
@@ -3,12 +3,15 @@ package com.liquidnet.service.sweet.controller;
...
@@ -3,12 +3,15 @@ package com.liquidnet.service.sweet.controller;
import
com.liquidnet.commons.lang.util.HttpUtil
;
import
com.liquidnet.commons.lang.util.HttpUtil
;
import
com.liquidnet.service.sweet.service.impl.SweetWechatMpService
;
import
com.liquidnet.service.sweet.service.impl.SweetWechatMpService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.io.*
;
import
java.io.*
;
...
@@ -39,7 +42,8 @@ public class SweetWechatSyncDataController {
...
@@ -39,7 +42,8 @@ public class SweetWechatSyncDataController {
params
.
add
(
"mobile"
,
mobile
);
params
.
add
(
"mobile"
,
mobile
);
// String url = "http://127.0.0.1:9001/adam/rsc/reg/mobile";
// String url = "http://127.0.0.1:9001/adam/rsc/reg/mobile";
String
url
=
"http://testadam.zhengzai.tv/adam/rsc/reg/mobile"
;
// String url = "http://testadam.zhengzai.tv/adam/rsc/reg/mobile";
String
url
=
""
;
HttpUtil
.
post
(
url
,
params
);
HttpUtil
.
post
(
url
,
params
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -62,4 +66,17 @@ public class SweetWechatSyncDataController {
...
@@ -62,4 +66,17 @@ public class SweetWechatSyncDataController {
}
}
}
}
@GetMapping
(
"user"
)
@ApiOperation
(
"openid同步单个关注用户"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"openId"
,
value
=
"openId"
,
required
=
true
)
})
public
void
getUser
(
@RequestParam
()
String
openId
)
{
try
{
sweetWechatMpService
.
getUser
(
openId
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetWechatMpService.java
View file @
5a08087c
...
@@ -85,4 +85,40 @@ public class SweetWechatMpService {
...
@@ -85,4 +85,40 @@ public class SweetWechatMpService {
}
while
(!
nextOpenid
.
isEmpty
());
}
while
(!
nextOpenid
.
isEmpty
());
}
}
public
void
getUser
(
String
openId
)
throws
WxErrorException
{
WxMpService
wxMpService
=
wechatMpConfigure
.
getWxMpService
();
WxMpUser
wxMpUser
=
wxMpService
.
getUserService
().
userInfo
(
openId
);
log
.
info
(
"openId:[{}],wxMpUsers:[{}]"
,
openId
,
wxMpUser
);
SweetWechatUser
userInfo
=
redisDataUtils
.
getSweetWechatUser
(
wxMpUser
.
getUnionId
());
if
(
null
==
userInfo
)
{
SweetWechatUser
sweetWechatUser
=
SweetWechatUser
.
getNew
();
sweetWechatUser
.
setOpenId
(
wxMpUser
.
getOpenId
());
sweetWechatUser
.
setUnionId
(
wxMpUser
.
getUnionId
());
sweetWechatUser
.
setNickname
(
wxMpUser
.
getNickname
());
sweetWechatUser
.
setSexDesc
(
wxMpUser
.
getSexDesc
());
sweetWechatUser
.
setSex
(
wxMpUser
.
getSex
());
sweetWechatUser
.
setHeadImgUrl
(
wxMpUser
.
getHeadImgUrl
());
sweetWechatUser
.
setLanguage
(
wxMpUser
.
getLanguage
());
sweetWechatUser
.
setCountry
(
wxMpUser
.
getCountry
());
sweetWechatUser
.
setProvince
(
wxMpUser
.
getProvince
());
sweetWechatUser
.
setCity
(
wxMpUser
.
getCity
());
sweetWechatUser
.
setSubscribeTime
(
DateUtil
.
ofEpochMilli
(
wxMpUser
.
getSubscribeTime
()));
sweetWechatUser
.
setSubscribeScene
(
wxMpUser
.
getSubscribeScene
());
sweetWechatUser
.
setUserId
(
IDGenerator
.
nextSnowId
());
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
LinkedList
<
Object
[]>
sqlsDataA
=
CollectionUtil
.
linkedListObjectArr
();
sqls
.
add
(
SqlMapping
.
get
(
"sweet_user.insert"
));
sqlsDataA
.
add
(
new
Object
[]{
sweetWechatUser
.
getUserId
(),
sweetWechatUser
.
getOpenId
(),
sweetWechatUser
.
getUnionId
(),
sweetWechatUser
.
getNickname
(),
sweetWechatUser
.
getSexDesc
(),
sweetWechatUser
.
getSex
(),
sweetWechatUser
.
getHeadImgUrl
(),
sweetWechatUser
.
getLanguage
(),
sweetWechatUser
.
getCountry
(),
sweetWechatUser
.
getProvince
(),
sweetWechatUser
.
getCity
(),
sweetWechatUser
.
getSubscribeTime
(),
sweetWechatUser
.
getSubscribeScene
()
});
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
SWEET_USER_INSERT_DRAW
.
getKey
(),
SqlMapping
.
gets
(
sqls
,
sqlsDataA
));
// 入缓存
redisDataUtils
.
setSweetWechatUser
(
sweetWechatUser
);
}
}
}
}
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetWechatTemplateServiceImpl.java
View file @
5a08087c
...
@@ -60,7 +60,6 @@ public class SweetWechatTemplateServiceImpl {
...
@@ -60,7 +60,6 @@ public class SweetWechatTemplateServiceImpl {
public
ResponseDto
sendRemindMsg
()
{
public
ResponseDto
sendRemindMsg
()
{
// test
// test
/*WxMpTemplateMessage templateMessage = getTemplateMessage("CNLDBZYQoDgTWudicx8WU81Jr9b6RyG9hmK4O0tpK-k", "oUpkkuNe4yuVs77aaKFvuvpgNOSw", h5Url.concat("/#/ticket/detail?id=").concat("111"));
/*WxMpTemplateMessage templateMessage = getTemplateMessage("CNLDBZYQoDgTWudicx8WU81Jr9b6RyG9hmK4O0tpK-k", "oUpkkuNe4yuVs77aaKFvuvpgNOSw", h5Url.concat("/#/ticket/detail?id=").concat("111"));
// 添加模板数据
templateMessage.addData(new WxMpTemplateData("first", "感谢支持"))
templateMessage.addData(new WxMpTemplateData("first", "感谢支持"))
.addData(new WxMpTemplateData("keyword1", "摩登天空"))
.addData(new WxMpTemplateData("keyword1", "摩登天空"))
.addData(new WxMpTemplateData("keyword2", "正在现场"))
.addData(new WxMpTemplateData("keyword2", "正在现场"))
...
...
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