Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
marketing
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
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
dingjy
marketing
Commits
842e2815
Commit
842e2815
authored
Mar 14, 2024
by
宋新宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
219e6409
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
2 deletions
+47
-2
CrossPlatformAttributionFlow.java
...keting/att/novel/handle/CrossPlatformAttributionFlow.java
+6
-2
AttrController.java
...in/java/com/lwby/marketing/controller/AttrController.java
+35
-0
CrossPlatformAccount.java
...main/java/com/lwby/marketing/vo/CrossPlatformAccount.java
+6
-0
No files found.
src/main/java/com/lwby/marketing/att/novel/handle/CrossPlatformAttributionFlow.java
View file @
842e2815
...
...
@@ -11,7 +11,9 @@ import com.lwby.marketing.po.CrossCallback;
import
com.lwby.marketing.util.DateTimUtils
;
import
com.lwby.marketing.vo.NovelAction
;
import
com.lwby.marketing.vo.CrossPlatformAccount
;
import
org.springframework.jdbc.core.BeanPropertyRowMapper
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.RowMapper
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
...
...
@@ -33,7 +35,8 @@ public class CrossPlatformAttributionFlow extends NodeSwitchFlow<NovelAction> {
//获取跨平台帐号配置
CrossPlatformAccount
cpa
=
getCrossPlatformMedia
().
get
(
action
.
getMediaName
());
//判断是否配置跨平台归因,如果没有则继续执行下一个计划归因处理器
if
(
Objects
.
isNull
(
cpa
)
||
!
cpa
.
getAccount
().
contains
(
action
.
getAdvertiserId
())){
if
(
Objects
.
isNull
(
cpa
)
||
(!
cpa
.
getAccount
().
contains
(
"0"
)
&&
!
cpa
.
getAccount
().
contains
(
action
.
getAdvertiserId
()))
||
(
cpa
.
getOldAccount
().
contains
(
"0"
)
||
cpa
.
getOldAccount
().
contains
(
action
.
getAdvertiserId
()))){
return
false
;
}
action
.
setCpa
(
cpa
);
...
...
@@ -143,7 +146,8 @@ public class CrossPlatformAttributionFlow extends NodeSwitchFlow<NovelAction> {
@Cached
(
name
=
"cross_platform_account"
,
cacheType
=
CacheType
.
LOCAL
)
@CacheRefresh
(
refresh
=
300
)
public
Map
<
String
,
CrossPlatformAccount
>
getCrossPlatformMedia
(){
List
<
CrossCallback
>
ls
=
lwbyJdbcTemplate
.
queryForList
(
"select id,span_check_max_day,new_account,old_account,media_name from cross_callback"
,
CrossCallback
.
class
);
RowMapper
<
CrossCallback
>
rowMapper
=
BeanPropertyRowMapper
.
newInstance
(
CrossCallback
.
class
);
List
<
CrossCallback
>
ls
=
lwbyJdbcTemplate
.
query
(
"select span_check_max_day,new_account,old_account,media_name from cross_callback"
,
rowMapper
);
return
ls
.
stream
()
.
collect
(
Collectors
.
toMap
(
CrossCallback:
:
getMediaName
,
CrossPlatformAccount:
:
new
));
...
...
src/main/java/com/lwby/marketing/controller/AttrController.java
View file @
842e2815
...
...
@@ -2,18 +2,29 @@ package com.lwby.marketing.controller;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.alicp.jetcache.anno.CacheRefresh
;
import
com.alicp.jetcache.anno.CacheType
;
import
com.alicp.jetcache.anno.Cached
;
import
com.lwby.marketing.att.bystory.DyStoryFlowExecutor
;
import
com.lwby.marketing.att.bystory.DyStoryUniversalProcess
;
import
com.lwby.marketing.po.CrossCallback
;
import
com.lwby.marketing.vo.CrossPlatformAccount
;
import
com.lwby.marketing.vo.StoryNovelAction
;
import
com.lwby.marketing.vo.StoreUserUploadEventBO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.jdbc.core.BeanPropertyRowMapper
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.RowMapper
;
import
org.springframework.kafka.core.KafkaTemplate
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
/**
* @author songxinyu
...
...
@@ -153,4 +164,28 @@ public class AttrController {
log
.
error
(
"dystory短篇付费发送消息失败:fail={}"
,
JSON
.
toJSONString
(
failure
));
});
}
@Resource
JdbcTemplate
lwbyJdbcTemplate
;
@RequestMapping
(
"testcross"
)
public
void
testCross
()
{
CrossPlatformAccount
cpa
=
getCrossPlatformMedia
().
get
(
"gdt"
);
//判断是否配置跨平台归因,如果没有则继续执行下一个计划归因处理器
if
(
Objects
.
isNull
(
cpa
)
||
(!
cpa
.
getAccount
().
contains
(
"0"
)
&&
!
cpa
.
getAccount
().
contains
(
"32422617"
))
||
(
cpa
.
getOldAccount
().
contains
(
"0"
)
||
cpa
.
getOldAccount
().
contains
(
"32422617"
))){
System
.
out
.
println
(
111
);
}
}
@Cached
(
name
=
"cross_platform_account"
,
cacheType
=
CacheType
.
LOCAL
)
@CacheRefresh
(
refresh
=
300
)
public
Map
<
String
,
CrossPlatformAccount
>
getCrossPlatformMedia
(){
RowMapper
<
CrossCallback
>
rowMapper
=
BeanPropertyRowMapper
.
newInstance
(
CrossCallback
.
class
);
List
<
CrossCallback
>
ls
=
lwbyJdbcTemplate
.
query
(
"select span_check_max_day,new_account,old_account,media_name from cross_callback"
,
rowMapper
);
return
ls
.
stream
()
.
collect
(
Collectors
.
toMap
(
CrossCallback:
:
getMediaName
,
CrossPlatformAccount:
:
new
));
}
}
src/main/java/com/lwby/marketing/vo/CrossPlatformAccount.java
View file @
842e2815
...
...
@@ -23,6 +23,8 @@ public class CrossPlatformAccount {
*/
private
Set
<
String
>
account
;
private
Set
<
String
>
oldAccount
;
public
CrossPlatformAccount
(
CrossCallback
ccb
){
setMediaName
(
ccb
.
getMediaName
());
setSpanCheckMaxDay
(
ccb
.
getSpanCheckMaxDay
());
...
...
@@ -30,5 +32,9 @@ public class CrossPlatformAccount {
.
map
(
String:
:
trim
)
.
filter
(
_s
->
_s
.
matches
(
"\\d+"
))
.
collect
(
Collectors
.
toSet
()));
setOldAccount
(
Arrays
.
stream
(
ccb
.
getOldAccount
().
split
(
","
))
.
map
(
String:
:
trim
)
.
filter
(
_s
->
_s
.
matches
(
"\\d+"
))
.
collect
(
Collectors
.
toSet
()));
}
}
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