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
c9e6cc6b
Commit
c9e6cc6b
authored
Apr 17, 2024
by
宋新宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
md5
parent
8fb2d748
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
52 deletions
+25
-52
ClickbackService.java
.../java/com/lwby/marketing/controller/ClickbackService.java
+25
-26
ServiceHelper.java
...ain/java/com/lwby/marketing/controller/ServiceHelper.java
+0
-26
No files found.
src/main/java/com/lwby/marketing/controller/ClickbackService.java
View file @
c9e6cc6b
...
...
@@ -50,6 +50,10 @@ public class ClickbackService extends ServiceHelper{
@Resource
(
name
=
"storyKafka"
)
public
KafkaTemplate
<
String
,
String
>
storyKafkaTemplate
;
private
static
final
String
UAPRE
=
"Mozilla/5.0 (iPhone; CPU iPhone OS "
;
private
static
final
String
UASUF
=
" like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
;
@RequestMapping
(
"/jrtt"
)
@ResponseBody
...
...
@@ -62,19 +66,19 @@ public class ClickbackService extends ServiceHelper{
DeliveryDeviceInfo
ddi
=
action
.
getDeliveryDeviceInfo
();
if
(
StringUtils
.
isNotEmpty
(
ddi
.
getDj_channel
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getChannelByDeviceIdKeyAndPlatformId
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
Integer
.
parseInt
(
ddi
.
getDj_channel
())),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getChannelByDeviceIdKeyAndPlatformId
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
Integer
.
parseInt
(
ddi
.
getDj_channel
())),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
if
(
StringUtils
.
isNumeric
(
ddi
.
getBook_id
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryBookIdCacheKey
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getBook_id
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryBookIdCacheKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getBook_id
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
if
(
StringUtils
.
isNumeric
(
ddi
.
getPartId
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryPartIdCacheKey
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getPartId
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryPartIdCacheKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getPartId
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
}
}
if
(
type
==
DeviceType
.
IP
)
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKey
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
else
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKeyByIdfaAndPlatformId
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKeyByIdfaAndPlatformId
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
}
}
...
...
@@ -95,19 +99,19 @@ public class ClickbackService extends ServiceHelper{
DeliveryDeviceInfo
ddi
=
action
.
getDeliveryDeviceInfo
();
if
(
StringUtils
.
isNotEmpty
(
ddi
.
getDj_channel
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getChannelByDeviceIdKeyAndPlatformId
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
Integer
.
parseInt
(
ddi
.
getDj_channel
())),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getChannelByDeviceIdKeyAndPlatformId
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
Integer
.
parseInt
(
ddi
.
getDj_channel
())),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
if
(
StringUtils
.
isNumeric
(
ddi
.
getBook_id
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryBookIdCacheKey
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getBook_id
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryBookIdCacheKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getBook_id
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
if
(
StringUtils
.
isNumeric
(
ddi
.
getPartId
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryPartIdCacheKey
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getPartId
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryPartIdCacheKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getPartId
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
}
}
if
(
type
==
DeviceType
.
IP
)
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKey
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
else
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKeyByIdfaAndPlatformId
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKeyByIdfaAndPlatformId
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
}
}
...
...
@@ -127,19 +131,19 @@ public class ClickbackService extends ServiceHelper{
DeliveryDeviceInfo
ddi
=
action
.
getDeliveryDeviceInfo
();
if
(
StringUtils
.
isNotEmpty
(
ddi
.
getDj_channel
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getChannelByDeviceIdKeyAndPlatformId
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
Integer
.
parseInt
(
ddi
.
getDj_channel
())),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getChannelByDeviceIdKeyAndPlatformId
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
Integer
.
parseInt
(
ddi
.
getDj_channel
())),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
if
(
StringUtils
.
isNumeric
(
ddi
.
getVideoResourceId
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryVRIdCacheKey
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getVideoResourceId
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryVRIdCacheKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getVideoResourceId
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
if
(
StringUtils
.
isNumeric
(
ddi
.
getVideoId
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryVIIdCacheKey
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getVideoId
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryVIIdCacheKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getVideoId
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
}
}
if
(
type
==
DeviceVideoType
.
IDFA
)
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKey
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
else
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKeyByIdfaAndPlatformId
(
assembleKey
(
deviceIdKey
,
type
)
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKeyByIdfaAndPlatformId
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
}
}
...
...
@@ -152,8 +156,6 @@ public class ClickbackService extends ServiceHelper{
public
NovelAction
fullJrtt
(
Map
<
String
,
String
>
params
)
{
ClientInfo
clientInfo
=
new
ClientInfo
();
//imeiMd5
clientInfo
.
setImei
(
params
.
get
(
"imei"
));
clientInfo
.
setOaid
(
params
.
get
(
"oaid_md5"
));
clientInfo
.
setIdfa
(
params
.
get
(
"idfaMd5"
));
clientInfo
.
setClientIp
(
params
.
get
(
"ip"
));
...
...
@@ -184,8 +186,6 @@ public class ClickbackService extends ServiceHelper{
public
NovelAction
fullJrttFreeVideo
(
Map
<
String
,
String
>
params
)
{
ClientInfo
clientInfo
=
new
ClientInfo
();
//imeiMd5
clientInfo
.
setImei
(
params
.
get
(
"imei"
));
clientInfo
.
setOaid
(
params
.
get
(
"oaid_md5"
));
String
idfa
=
params
.
get
(
"idfa"
);
if
(!
filter
.
contains
(
idfa
)
&&
StringUtils
.
isNotEmpty
(
idfa
))
{
...
...
@@ -249,12 +249,11 @@ public class ClickbackService extends ServiceHelper{
}
enum
DeviceType
{
IMEI
(
"imei"
,(
c
)
->
isNotEmptyAndSNull
(
c
.
getImei
())?
c
.
getImei
():
null
),
OAID
(
"oaid"
,
(
c
)
->
isNotEmptyAndSNull
(
c
.
getOaid
())?
c
.
getOaid
():
null
),
IDFA
(
"idfa"
,(
c
)
->
isNotEmptyAndSNull
(
c
.
getIdfa
())?
c
.
getIdfa
():
null
),
IP_UA
(
"ipua"
,(
c
)
->
isNotEmptyAndSNull
(
c
.
getClientIp
())
&&
isNotEmptyAndSNull
(
c
.
getUa
())?
c
.
getClientIp
().
concat
(
StringUtils
.
substringBefore
(
c
.
getUa
(),
" Chrome/"
)):
null
),
IP_MODEL
(
"ipmodel"
,(
c
)
->
isNotEmptyAndSNull
(
c
.
getClientIp
())
&&
isNotEmptyAndSNull
(
c
.
getPhoneModel
())?
c
.
getClientIp
().
concat
(
c
.
getPhoneModel
(
)):
null
),
IP
(
"ip"
,(
c
)
->
isNotEmptyAndSNull
(
c
.
getClientIp
())?
c
.
getClientIp
(
):
null
);
IP_UA
(
"ipua"
,(
c
)
->
isNotEmptyAndSNull
(
c
.
getClientIp
())
&&
isNotEmptyAndSNull
(
c
.
getUa
())?
SecureUtil
.
md5
(
c
.
getClientIp
().
concat
(
StringUtils
.
substringBefore
(
c
.
getUa
(),
" Chrome/"
)
)):
null
),
IP_MODEL
(
"ipmodel"
,(
c
)
->
isNotEmptyAndSNull
(
c
.
getClientIp
())
&&
isNotEmptyAndSNull
(
c
.
getPhoneModel
())?
SecureUtil
.
md5
(
c
.
getClientIp
().
concat
(
c
.
getPhoneModel
()
)):
null
),
IP
(
"ip"
,(
c
)
->
isNotEmptyAndSNull
(
c
.
getClientIp
())?
SecureUtil
.
md5
(
c
.
getClientIp
()
):
null
);
private
String
value
;
...
...
@@ -283,9 +282,9 @@ public class ClickbackService extends ServiceHelper{
IDFA
(
"idfa"
,(
c
)
->
isNotEmptyAndSNull
(
c
.
getIdfa
())?
c
.
getIdfa
():
null
),
IP_UA
(
"ipua"
,(
c
)
->
(
isNotEmptyAndSNull
(
c
.
getClientIp
())
&&
isNotEmptyAndSNull
(
c
.
getUa
()))
?
((
"0"
.
equals
(
c
.
getOs
())
?
c
.
getClientIp
().
concat
(
StringUtils
.
substringBefore
(
c
.
getUa
(),
" Chrome/"
))
:
(
c
.
getUa
().
startsWith
(
"bi kan duan ju"
)
?
Arrays
.
stream
(
c
.
getSystemVersion
().
split
(
"\\."
)).
collect
(
Collectors
.
joining
(
"_"
)):
c
.
getClientIp
().
concat
(
c
.
getUa
(
))))):
null
),
((
"0"
.
equals
(
c
.
getOs
())
?
SecureUtil
.
md5
(
c
.
getClientIp
().
concat
(
StringUtils
.
substringBefore
(
c
.
getUa
(),
" Chrome/"
)
))
:
(
c
.
getUa
().
startsWith
(
"bi kan duan ju"
)
?
SecureUtil
.
md5
(
c
.
getClientIp
().
concat
(
UAPRE
+
Arrays
.
stream
(
c
.
getSystemVersion
().
split
(
"\\."
)).
collect
(
Collectors
.
joining
(
"_"
))
+
UASUF
)):
SecureUtil
.
md5
(
c
.
getClientIp
().
concat
(
c
.
getUa
()
))))):
null
),
IP_MODEL
(
"ipmodel"
,(
c
)
->
isNotEmptyAndSNull
(
c
.
getClientIp
())
&&
isNotEmptyAndSNull
(
c
.
getPhoneModel
())?
c
.
getClientIp
().
concat
(
c
.
getPhoneModel
()):
null
);
private
String
value
;
...
...
src/main/java/com/lwby/marketing/controller/ServiceHelper.java
View file @
c9e6cc6b
...
...
@@ -27,32 +27,6 @@ public class ServiceHelper {
}
}
public
String
assembleKey
(
String
deviceId
,
ClickbackService
.
DeviceType
type
)
{
switch
(
type
)
{
case
IMEI:
case
OAID:
case
IDFA:
return
deviceId
;
case
IP_UA:
case
IP_MODEL:
case
IP:
return
SecureUtil
.
md5
(
deviceId
);
}
return
null
;
}
public
String
assembleKey
(
String
deviceId
,
ClickbackService
.
DeviceVideoType
type
)
{
switch
(
type
)
{
case
OAID:
case
IDFA:
return
deviceId
;
case
IP_UA:
case
IP_MODEL:
return
SecureUtil
.
md5
(
deviceId
);
}
return
null
;
}
public
String
getModelByUa
(
String
ua
)
{
String
uasplit
=
ua
.
split
(
"Build"
)[
0
];
String
model
=
null
;
...
...
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