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
46d6ffd9
Commit
46d6ffd9
authored
Mar 07, 2024
by
宋新宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store归因上报redis
parent
9c1d04eb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
3 deletions
+90
-3
UniversalProcess.java
...n/java/com/lwby/marketing/att/novel/UniversalProcess.java
+10
-0
StoreAttributionFlow.java
...lwby/marketing/att/novel/handle/StoreAttributionFlow.java
+5
-1
BiRedisConfig.java
src/main/java/com/lwby/marketing/conf/BiRedisConfig.java
+44
-0
RedisConfig.java
src/main/java/com/lwby/marketing/conf/RedisConfig.java
+21
-2
application-prod.yml
src/main/resources/application-prod.yml
+5
-0
application-test.yml
src/main/resources/application-test.yml
+5
-0
No files found.
src/main/java/com/lwby/marketing/att/novel/UniversalProcess.java
View file @
46d6ffd9
...
@@ -32,6 +32,9 @@ public class UniversalProcess {
...
@@ -32,6 +32,9 @@ public class UniversalProcess {
@Resource
@Resource
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
@Resource
private
RedisTemplate
<
String
,
String
>
biRedisTemplate
;
/******************************************** GENERIC METHOD ***********************************************/
/******************************************** GENERIC METHOD ***********************************************/
...
@@ -82,9 +85,16 @@ public class UniversalProcess {
...
@@ -82,9 +85,16 @@ public class UniversalProcess {
return
String
.
format
(
"fc_%s_%d_%s_%s"
,
action
.
getDeviceId
(),
action
.
getPlatformId
(),
action
.
getMediaName
(),
action
.
getCurrentDateStr
());
return
String
.
format
(
"fc_%s_%d_%s_%s"
,
action
.
getDeviceId
(),
action
.
getPlatformId
(),
action
.
getMediaName
(),
action
.
getCurrentDateStr
());
}
}
public
String
buildKey
(
Integer
platformId
,
String
deviceId
)
{
return
String
.
format
(
"market:activeness:30:%d:%s"
,
platformId
,
deviceId
);
}
/******************************************** REDIS **********************************************************/
/******************************************** REDIS **********************************************************/
public
boolean
existsIsAlive
(
String
key
)
{
return
Boolean
.
TRUE
.
equals
(
biRedisTemplate
.
hasKey
(
key
));
}
public
boolean
exists
(
String
key
)
{
public
boolean
exists
(
String
key
)
{
return
Boolean
.
TRUE
.
equals
(
redisTemplate
.
hasKey
(
key
));
return
Boolean
.
TRUE
.
equals
(
redisTemplate
.
hasKey
(
key
));
}
}
...
...
src/main/java/com/lwby/marketing/att/novel/handle/StoreAttributionFlow.java
View file @
46d6ffd9
...
@@ -19,7 +19,11 @@ public class StoreAttributionFlow extends NodeFlow<NovelAction> {
...
@@ -19,7 +19,11 @@ public class StoreAttributionFlow extends NodeFlow<NovelAction> {
public
void
process
(
NovelAction
action
)
{
public
void
process
(
NovelAction
action
)
{
//商店归因通知
//商店归因通知
if
(
Objects
.
isNull
(
action
.
getDeliveryDeviceInfo
())){
if
(
Objects
.
isNull
(
action
.
getDeliveryDeviceInfo
())){
up
.
notifyResult
(
action
,
AttributionStatus
.
STORE_CALLBACK
);
//商店判断30天活跃,不在活跃天数内,发BI
String
aliveDeviceKey
=
up
.
buildKey
(
action
.
getPlatformId
(),
action
.
getDeviceId
());
if
(!
up
.
existsIsAlive
(
aliveDeviceKey
))
{
up
.
notifyResult
(
action
,
AttributionStatus
.
STORE_CALLBACK
);
}
action
.
stop
(
true
);
//结束后面所有执行流程
action
.
stop
(
true
);
//结束后面所有执行流程
}
}
...
...
src/main/java/com/lwby/marketing/conf/BiRedisConfig.java
0 → 100644
View file @
46d6ffd9
package
com
.
lwby
.
marketing
.
conf
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.connection.RedisStandaloneConfiguration
;
import
org.springframework.data.redis.connection.jedis.JedisConnectionFactory
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
/**
* @author songxinyu
* @version BiRedisConfig.java, v 0.1 2024年03月07日 11:32 songxinyu Exp $
*/
@Configuration
public
class
BiRedisConfig
{
@Value
(
"${bi.redis.host}"
)
private
String
biHostName
;
@Value
(
"${bi.redis.port}"
)
private
int
biHostPort
;
@Bean
(
"biJedisFactory"
)
public
JedisConnectionFactory
jedisConnectionFactory
()
{
RedisStandaloneConfiguration
config
=
new
RedisStandaloneConfiguration
();
config
.
setHostName
(
biHostName
);
config
.
setPort
(
biHostPort
);
return
new
JedisConnectionFactory
(
config
);
}
@Bean
(
"biRedisTemplate"
)
public
RedisTemplate
<
Object
,
Object
>
redisTemplate
(
@Qualifier
(
"biJedisFactory"
)
RedisConnectionFactory
redisConnectionFactory
)
{
RedisTemplate
<
Object
,
Object
>
template
=
new
RedisTemplate
<>();
StringRedisSerializer
stringRedisSerializer
=
new
StringRedisSerializer
();
template
.
setKeySerializer
(
stringRedisSerializer
);
template
.
setValueSerializer
(
stringRedisSerializer
);
template
.
setConnectionFactory
(
redisConnectionFactory
);
return
template
;
}
}
src/main/java/com/lwby/marketing/conf/RedisConfig.java
View file @
46d6ffd9
package
com
.
lwby
.
marketing
.
conf
;
package
com
.
lwby
.
marketing
.
conf
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.connection.RedisStandaloneConfiguration
;
import
org.springframework.data.redis.connection.jedis.JedisConnectionFactory
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
@Configuration
@Configuration
public
class
RedisConfig
{
public
class
RedisConfig
{
@Bean
@Value
(
"${spring.redis.host}"
)
public
RedisTemplate
<
Object
,
Object
>
redisTemplate
(
RedisConnectionFactory
redisConnectionFactory
)
{
private
String
hostName
;
@Value
(
"${spring.redis.port}"
)
private
int
hostPort
;
@Bean
(
"jedisFactory"
)
public
JedisConnectionFactory
jedisConnectionFactory
()
{
RedisStandaloneConfiguration
config
=
new
RedisStandaloneConfiguration
();
config
.
setHostName
(
hostName
);
config
.
setPort
(
hostPort
);
return
new
JedisConnectionFactory
(
config
);
}
@Bean
(
"redisTemplate"
)
public
RedisTemplate
<
Object
,
Object
>
redisTemplate
(
@Qualifier
(
"jedisFactory"
)
RedisConnectionFactory
redisConnectionFactory
)
{
RedisTemplate
<
Object
,
Object
>
template
=
new
RedisTemplate
<>();
RedisTemplate
<
Object
,
Object
>
template
=
new
RedisTemplate
<>();
StringRedisSerializer
stringRedisSerializer
=
new
StringRedisSerializer
();
StringRedisSerializer
stringRedisSerializer
=
new
StringRedisSerializer
();
template
.
setKeySerializer
(
stringRedisSerializer
);
template
.
setKeySerializer
(
stringRedisSerializer
);
...
...
src/main/resources/application-prod.yml
View file @
46d6ffd9
...
@@ -33,6 +33,11 @@ spring:
...
@@ -33,6 +33,11 @@ spring:
listener
:
listener
:
ack-mode
:
RECORD
ack-mode
:
RECORD
bi
:
redis
:
host
:
r-2zethzp7pjl3rjbelp.redis.rds.aliyuncs.com
port
:
6379
story
:
story
:
novel
:
novel
:
active
:
active
:
...
...
src/main/resources/application-test.yml
View file @
46d6ffd9
...
@@ -33,6 +33,11 @@ spring:
...
@@ -33,6 +33,11 @@ spring:
listener
:
listener
:
ack-mode
:
RECORD
ack-mode
:
RECORD
bi
:
redis
:
host
:
172.17.243.150
port
:
6379
story
:
story
:
novel
:
novel
:
active
:
active
:
...
...
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