Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-execute-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 51d33667
authored
Oct 10, 2023
by
chizw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
sop短链 sop事件参数调整
1 parent
0535cee7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
24 deletions
platform-execute/src/main/java/cn/com/glsx/execute/filter/shorturl/SopEventProcessFilter.java
platform-execute/src/main/java/cn/com/glsx/execute/modules/rabbitmq/produce/MsgProducer.java
platform-execute/src/main/java/cn/com/glsx/execute/filter/shorturl/SopEventProcessFilter.java
View file @
51d3366
...
...
@@ -6,6 +6,8 @@ import cn.com.glsx.execute.filter.TransformContext;
import
cn.com.glsx.execute.modules.rabbitmq.produce.MsgProducer
;
import
cn.com.glsx.execute.modules.service.shorturl.ShortUrlService
;
import
cn.com.glsx.execute.utils.UrlUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.config.ConfigurableBeanFactory
;
...
...
@@ -13,8 +15,8 @@ import org.springframework.context.annotation.Scope;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.
util.Date
;
import
java.util.
Map
;
import
java.
text.SimpleDateFormat
;
import
java.util.
*
;
/**
* @author chizw
...
...
@@ -34,9 +36,6 @@ public class SopEventProcessFilter implements AccessFilter {
@Resource
private
MsgProducer
msgProducer
;
private
static
final
String
UA_KEY
=
"User-Agent"
;
private
static
final
String
COOKIE_KEY
=
"Cookie"
;
@Override
public
int
order
()
{
return
6
;
...
...
@@ -49,27 +48,28 @@ public class SopEventProcessFilter implements AccessFilter {
@Override
public
void
doFilter
(
AccessFilterChain
chain
,
TransformContext
context
)
{
//sop事件
List
<
Map
<
String
,
Object
>>
mapList
=
new
ArrayList
<>();
String
urlParam
=
context
.
getParam
(
TransformContext
.
PARAM_URL_PARAM_KEY
);
String
queryString
=
context
.
getParam
(
TransformContext
.
PARAM_QUERY_STRING_KEY
);
Map
<
String
,
String
>
extra
=
UrlUtil
.
convertUrlParamsToMap
(
urlParam
,
queryString
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"org_id"
,
extra
.
get
(
"merchantId"
));
jsonObject
.
put
(
"add_way"
,
"SHORT_LINK"
);
jsonObject
.
put
(
"wechat_union_id"
,
extra
.
get
(
"unionId"
));
jsonObject
.
put
(
"event_time"
,
new
Date
());
jsonObject
.
put
(
"event_type"
,
"READ_URL"
);
jsonObject
.
put
(
"system_source"
,
"Others"
);
jsonObject
.
put
(
"platform"
,
"Others"
);
jsonObject
.
put
(
"user_agent"
,
context
.
getParam
(
TransformContext
.
PARAM_UA_KEY
));
jsonObject
.
put
(
"device_type"
,
null
);
jsonObject
.
put
(
"os"
,
null
);
jsonObject
.
put
(
"ip"
,
context
.
getParam
(
TransformContext
.
PARAM_CLIENT_ID_KEY
));
jsonObject
.
put
(
"gps"
,
null
);
jsonObject
.
put
(
"extra"
,
extra
);
log
.
info
(
"sop event mq message:{}"
,
jsonObject
);
msgProducer
.
customerEventSend
(
jsonObject
.
toJSONString
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"org_id"
,
extra
.
get
(
"merchantId"
));
map
.
put
(
"add_way"
,
"SHORT_LINK"
);
map
.
put
(
"wechat_union_id"
,
extra
.
get
(
"unionId"
));
map
.
put
(
"event_time"
,
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
()));
map
.
put
(
"event_type"
,
"READ_URL"
);
map
.
put
(
"system_source"
,
"Others"
);
map
.
put
(
"platform"
,
"Others"
);
map
.
put
(
"user_agent"
,
JSON
.
toJSONString
(
context
.
getParam
(
TransformContext
.
PARAM_UA_KEY
)));
map
.
put
(
"device_type"
,
null
);
map
.
put
(
"os"
,
null
);
map
.
put
(
"ip"
,
context
.
getParam
(
TransformContext
.
PARAM_CLIENT_ID_KEY
));
map
.
put
(
"gps"
,
null
);
map
.
put
(
"extra"
,
JSON
.
toJSONString
(
extra
));
mapList
.
add
(
map
);
log
.
info
(
"sop event mq message:{}"
,
JSON
.
toJSONString
(
mapList
));
msgProducer
.
customerEventSend
(
mapList
);
chain
.
doFilter
(
context
);
}
}
platform-execute/src/main/java/cn/com/glsx/execute/modules/rabbitmq/produce/MsgProducer.java
View file @
51d3366
...
...
@@ -2,6 +2,7 @@ package cn.com.glsx.execute.modules.rabbitmq.produce;
import
cn.com.glsx.execute.config.RabbitMQConfig
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.rabbit.connection.CorrelationData
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
...
...
@@ -82,8 +83,8 @@ public class MsgProducer implements RabbitTemplate.ConfirmCallback {
* 客户事件推送
* @param content
*/
public
void
customerEventSend
(
String
content
)
{
log
.
info
(
"推送客户事件数据到mq:{}"
,
content
);
public
void
customerEventSend
(
Object
content
)
{
log
.
info
(
"推送客户事件数据到mq:{}"
,
JSON
.
toJSONString
(
content
)
);
rabbitTemplate
.
convertAndSend
(
RabbitMQConfig
.
DATA_REPORT_EXCHANGE_NAME
,
"dataReport.customer.event"
,
JSON
.
toJSONString
(
content
));
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment