记得上下班打卡 | 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
bc85ccca
Commit
bc85ccca
authored
Dec 09, 2021
by
sunyuntian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加时间
parent
312a77c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
24 deletions
+37
-24
MaoDengImageHandler.java
.../liquidnet/service/sweet/handler/MaoDengImageHandler.java
+4
-1
SweetWechatMaoDengServiceImpl.java
...ice/sweet/service/impl/SweetWechatMaoDengServiceImpl.java
+33
-23
No files found.
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/handler/MaoDengImageHandler.java
View file @
bc85ccca
...
@@ -45,7 +45,10 @@ public class MaoDengImageHandler implements WxMpMessageHandler {
...
@@ -45,7 +45,10 @@ public class MaoDengImageHandler implements WxMpMessageHandler {
@Override
@Override
public
WxMpXmlOutMessage
handle
(
WxMpXmlMessage
wxMessage
,
Map
<
String
,
Object
>
map
,
WxMpService
wxMpService
,
WxSessionManager
wxSessionManager
)
throws
WxErrorException
{
public
WxMpXmlOutMessage
handle
(
WxMpXmlMessage
wxMessage
,
Map
<
String
,
Object
>
map
,
WxMpService
wxMpService
,
WxSessionManager
wxSessionManager
)
throws
WxErrorException
{
String
fromUser
=
wxMessage
.
getFromUser
();
//用户id
String
fromUser
=
wxMessage
.
getFromUser
();
//用户id
String
picUrl
=
wxMessage
.
getPicUrl
();
//图片url
String
picUrl
=
wxMessage
.
getPicUrl
().
replace
(
"http"
,
"https"
);
//图片urlmao
log
.
debug
(
"[openId] = "
+
wxMessage
.
getOpenId
());
log
.
debug
(
"[unionId] = "
+
wxMessage
.
getUnionId
());
//猫登天空活动开启
//猫登天空活动开启
if
(
StringUtil
.
isNotEmpty
(
redisUtils
.
getSweetMaoDengOpen
(
fromUser
)))
{
if
(
StringUtil
.
isNotEmpty
(
redisUtils
.
getSweetMaoDengOpen
(
fromUser
)))
{
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetWechatMaoDengServiceImpl.java
View file @
bc85ccca
...
@@ -12,6 +12,7 @@ import com.liquidnet.service.sweet.utils.QueueUtils;
...
@@ -12,6 +12,7 @@ import com.liquidnet.service.sweet.utils.QueueUtils;
import
com.liquidnet.service.sweet.utils.WechatUsersRedisUtils
;
import
com.liquidnet.service.sweet.utils.WechatUsersRedisUtils
;
import
com.liquidnet.service.sweet.vo.SweetMaoDengVo
;
import
com.liquidnet.service.sweet.vo.SweetMaoDengVo
;
import
com.liquidnet.service.sweet.vo.SweetWechatUsersVo
;
import
com.liquidnet.service.sweet.vo.SweetWechatUsersVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -19,6 +20,7 @@ import java.time.LocalDateTime;
...
@@ -19,6 +20,7 @@ import java.time.LocalDateTime;
import
java.util.LinkedList
;
import
java.util.LinkedList
;
@Service
@Service
@Slf4j
public
class
SweetWechatMaoDengServiceImpl
{
public
class
SweetWechatMaoDengServiceImpl
{
@Autowired
@Autowired
...
@@ -28,31 +30,39 @@ public class SweetWechatMaoDengServiceImpl {
...
@@ -28,31 +30,39 @@ public class SweetWechatMaoDengServiceImpl {
@Autowired
@Autowired
WechatMaConfigure
maConfigure
;
WechatMaConfigure
maConfigure
;
public
ResponseDto
addBuilderImg
(
String
userId
,
String
imgUrl
)
{
public
ResponseDto
addBuilderImg
(
String
userId
,
String
imgUrl
)
{
LocalDateTime
localDateTime
=
DateUtil
.
asLocalDateTime
(
DateUtil
.
now
());
//生成创建时间
LocalDateTime
localDateTime
=
DateUtil
.
asLocalDateTime
(
DateUtil
.
now
());
//生成创建时间
String
maoId
=
IDGenerator
.
nextSnowId
();
try
{
SweetWechatUsersVo
wechatUsers
=
redisUtils
.
getSweetWechatUsersOfUnionId
(
userId
,
1
);
log
.
error
(
"[userId] = {}"
,
userId
);
if
(
null
==
wechatUsers
)
{
log
.
error
(
"[imgUrl] = {}"
,
imgUrl
);
String
maoId
=
IDGenerator
.
nextSnowId
();
SweetWechatUsersVo
wechatUsers
=
redisUtils
.
getSweetWechatUsersOfUnionId
(
userId
,
1
);
if
(
null
==
wechatUsers
)
{
return
ResponseDto
.
failure
(
"请求失败"
);
}
SweetMaoDengVo
sweetMaoDeng
=
redisUtils
.
getSweetMaoDeng
(
wechatUsers
.
getOpenId
());
if
(
sweetMaoDeng
!=
null
)
{
sweetMaoDeng
.
setImgUrl
(
imgUrl
);
}
String
textMsg
=
sweetMaoDeng
.
getTextMsg
();
String
picUrl
=
sweetMaoDeng
.
getPicUrl
();
sweetMaoDeng
.
setCreatedAt
(
localDateTime
);
redisUtils
.
setSweetMaoDeng
(
sweetMaoDeng
);
if
(
StringUtil
.
isNotEmpty
(
textMsg
)
&&
StringUtil
.
isNotEmpty
(
picUrl
))
{
//redis队列入库
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
LinkedList
<
Object
[]>
sqlsDataA
=
CollectionUtil
.
linkedListObjectArr
();
sqls
.
add
(
SqlMapping
.
get
(
"sweet_wechat_maodeng.insert"
));
sqlsDataA
.
add
(
new
Object
[]{
maoId
,
userId
,
textMsg
,
picUrl
,
imgUrl
,
localDateTime
});
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
SWEET_WECHAT_MAODENG_TEXT_INSERT
.
getKey
(),
SqlMapping
.
gets
(
sqls
,
sqlsDataA
));
return
ResponseDto
.
failure
(
"请求成功"
);
}
return
ResponseDto
.
failure
(
"请求失败"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"[ERROR] = {}"
,
e
);
return
ResponseDto
.
failure
(
"请求失败"
);
return
ResponseDto
.
failure
(
"请求失败"
);
}
}
SweetMaoDengVo
sweetMaoDeng
=
redisUtils
.
getSweetMaoDeng
(
wechatUsers
.
getOpenId
());
if
(
sweetMaoDeng
!=
null
){
sweetMaoDeng
.
setImgUrl
(
imgUrl
);
}
String
textMsg
=
sweetMaoDeng
.
getTextMsg
();
String
picUrl
=
sweetMaoDeng
.
getPicUrl
();
sweetMaoDeng
.
setCreatedAt
(
localDateTime
);
redisUtils
.
setSweetMaoDeng
(
sweetMaoDeng
);
if
(
StringUtil
.
isNotEmpty
(
textMsg
)
&&
StringUtil
.
isNotEmpty
(
picUrl
)){
//redis队列入库
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
LinkedList
<
Object
[]>
sqlsDataA
=
CollectionUtil
.
linkedListObjectArr
();
sqls
.
add
(
SqlMapping
.
get
(
"sweet_wechat_maodeng.insert"
));
sqlsDataA
.
add
(
new
Object
[]{
maoId
,
userId
,
textMsg
,
picUrl
,
imgUrl
,
localDateTime
});
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
SWEET_WECHAT_MAODENG_TEXT_INSERT
.
getKey
(),
SqlMapping
.
gets
(
sqls
,
sqlsDataA
));
return
ResponseDto
.
failure
(
"请求成功"
);
}
return
ResponseDto
.
failure
(
"请求失败"
);
}
}
}
}
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