Toggle navigation
Toggle navigation
This project
Loading...
Sign in
YOHOBUY
/
yohobuy-union
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
linlong
8 years ago
Commit
b379733fc698d076c6b90e01404a35a300fea05c
2 parents
ccc4e839
e49e1b71
Merge branch 'master' into hotfix_0307
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
728 additions
and
141 deletions
common/src/main/java/com/yoho/unions/common/redis/RedisHashCache.java
common/src/main/java/com/yoho/unions/common/redis/RedisListCache.java
common/src/main/java/com/yoho/unions/vo/ChannelTypeReqVO.java
common/src/main/java/com/yoho/unions/vo/ChannelTypeVO.java
common/src/main/java/com/yoho/unions/vo/UnionReqVO.java
common/src/main/resources/META-INF/spring/spring-interceptor-config.xml
dal/src/main/java/com/yoho/unions/dal/IAppActivateIdfaListDAO.java
dal/src/main/java/com/yoho/unions/dal/IAppActivateUdidListDAO.java
dal/src/main/java/com/yoho/unions/dal/IMobilePanChannelDAO.java
dal/src/main/java/com/yoho/unions/dal/model/AppActivateIdfaList.java
dal/src/main/java/com/yoho/unions/dal/model/AppActivateUdidList.java
dal/src/main/java/com/yoho/unions/dal/model/MobilePanChannel.java
dal/src/main/resources/META-INF/mybatis/AppActivateIdfaListMapper.xml
dal/src/main/resources/META-INF/mybatis/AppActivateUdidListMapper.xml
dal/src/main/resources/META-INF/mybatis/MobilePanChannelMapper.xml
server/src/main/java/com/yoho/unions/server/restapi/ClickUnionRest.java
server/src/main/java/com/yoho/unions/server/restapi/PayChannelRest.java
server/src/main/java/com/yoho/unions/server/service/IPayChannelService.java
server/src/main/java/com/yoho/unions/server/service/IPinYouService.java
server/src/main/java/com/yoho/unions/server/service/impl/DDServiceImpl.java
server/src/main/java/com/yoho/unions/server/service/impl/DingdangServiceImpl.java
server/src/main/java/com/yoho/unions/server/service/impl/GDTServiceImpl.java
server/src/main/java/com/yoho/unions/server/service/impl/PayChannelServiceImpl.java
server/src/main/java/com/yoho/unions/server/service/impl/PinYouServiceImpl.java
server/src/main/java/com/yoho/unions/server/service/impl/UnionServiceImpl.java
server/src/main/java/com/yoho/unions/server/task/PinYouTask.java
web/src/main/resources/config.properties
web/src/main/resources/databases.yml
web/src/main/webapp/META-INF/autoconf/auto-config.xml
web/src/main/webapp/META-INF/autoconf/config.properties
web/src/main/webapp/META-INF/autoconf/databases.yml
web/src/main/webapp/tencentMkt/index.html
common/src/main/java/com/yoho/unions/common/redis/RedisHashCache.java
View file @
b379733
package
com
.
yoho
.
unions
.
common
.
redis
;
import
com.alibaba.fastjson.JSONArray
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.yoho.core.redis.YHHashOperations
;
import
com.yoho.core.redis.YHRedisTemplate
;
import
com.yoho.unions.common.utils.SerializeUtils
;
import
com.yoho.unions.helper.CacheKeyHelper
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -11,15 +17,21 @@ import org.springframework.stereotype.Component;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
@Component
public
class
RedisHashCache
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
RedisHashCache
.
class
);
@Resource
(
name
=
"yhHashOperations"
)
YHHashOperations
<
String
,
String
,
String
>
yhHashOperations
;
@Resource
(
name
=
"yhHashOperations"
)
private
YHHashOperations
<
String
,
String
,
String
>
hashOperations
;
@Resource
(
name
=
"yhRedisTemplate"
)
private
YHRedisTemplate
<
String
,
String
>
yHRedisTemplate
;
/**
* 获取所有的values
...
...
@@ -35,7 +47,7 @@ public class RedisHashCache {
return
null
;
}
List
<
String
>
valueList
=
yhH
ashOperations
.
values
(
key
);
List
<
String
>
valueList
=
h
ashOperations
.
values
(
key
);
logger
.
debug
(
"values hashOperation value list size is {}"
,
valueList
==
null
?
0
:
valueList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
valueList
))
{
return
null
;
...
...
@@ -51,4 +63,170 @@ public class RedisHashCache {
return
null
;
}
/**
* Hash存储数据
*
* @param cacheKey
* @param entries
* @param timeout
* @param unit
* @param <V>
*/
public
<
V
>
void
add
(
String
cacheKey
,
Map
<
String
,
List
<
V
>>
entries
,
long
timeout
,
TimeUnit
unit
)
{
if
(
entries
==
null
||
entries
.
size
()
==
0
)
{
logger
.
warn
(
"add params is null ."
);
return
;
}
try
{
// 将入口参数中的 Map<String, List<V>> 装换成 Map<String, String>
Map
<
String
,
String
>
valueStrMap
=
Maps
.
newHashMap
();
for
(
String
key
:
entries
.
keySet
())
{
List
<
V
>
valueObjList
=
entries
.
get
(
key
);
valueStrMap
.
put
(
key
,
JSONArray
.
toJSONString
(
valueObjList
));
}
this
.
hashOperations
.
putAll
(
cacheKey
,
valueStrMap
);
this
.
yHRedisTemplate
.
longExpire
(
cacheKey
,
timeout
,
unit
);
}
catch
(
Exception
e
)
{
logger
.
warn
(
"add failed!!! key is: {}"
,
cacheKey
);
}
}
/**
* 根据key和hashkey获取数据
*
* @param cacheKey
* @param hashKey
* @param clazz
* @param <T>
* @return
*/
public
<
T
>
T
get
(
String
cacheKey
,
String
hashKey
,
Class
<
T
>
clazz
)
{
try
{
if
(
StringUtils
.
isEmpty
(
cacheKey
)
||
StringUtils
.
isEmpty
(
hashKey
))
{
return
null
;
}
String
value
=
this
.
hashOperations
.
get
(
cacheKey
,
hashKey
);
if
(
StringUtils
.
isEmpty
(
value
))
{
return
null
;
}
return
CacheKeyHelper
.
string2Value
(
value
,
clazz
);
}
catch
(
Exception
e
)
{
logger
.
warn
(
"RedisHashCache get failed!!! cacheKey is: {},hashkey {}"
,
cacheKey
,
hashKey
);
}
return
null
;
}
/**
* 根据key和hashkey获取数据
*
* @param cacheKey
* @param clazz
* @param <T>
* @return
*/
public
<
T
>
List
<
T
>
multiGet
(
String
cacheKey
,
Collection
<?
extends
Object
>
hashKeyList
,
Class
<
T
>
clazz
)
{
try
{
if
(
StringUtils
.
isEmpty
(
cacheKey
)
||
CollectionUtils
.
isEmpty
(
hashKeyList
))
{
return
null
;
}
List
<
String
>
hkeyList
=
new
ArrayList
<>();
for
(
Object
hobj
:
hashKeyList
)
{
hkeyList
.
add
(
hobj
.
toString
());
}
List
<
String
>
valueList
=
this
.
hashOperations
.
multiGet
(
cacheKey
,
hkeyList
);
if
(
CollectionUtils
.
isEmpty
(
valueList
))
{
return
null
;
}
List
<
T
>
resultList
=
Lists
.
newArrayList
();
for
(
String
result
:
valueList
)
{
if
(
StringUtils
.
isEmpty
(
result
))
{
continue
;
}
resultList
.
add
(
CacheKeyHelper
.
string2Value
(
result
,
clazz
));
}
return
resultList
;
}
catch
(
Exception
e
)
{
logger
.
warn
(
"RedisHashCache get failed!!! cacheKey is: {},hashkey {}"
,
cacheKey
,
hashKeyList
);
}
return
null
;
}
/**
* 存储hash结构数据
*
* @param cacheKey
* @param hashKey
* @param value
* @param timeout
* @param unit
* @param <T>
*/
public
<
T
>
void
put
(
String
cacheKey
,
String
hashKey
,
T
value
,
long
timeout
,
TimeUnit
unit
)
{
try
{
if
(
StringUtils
.
isEmpty
(
cacheKey
)
||
StringUtils
.
isEmpty
(
hashKey
))
{
logger
.
warn
(
"RedisHashCache put failed!!! cacheKey is: {},hashkey {}"
,
cacheKey
,
hashKey
);
return
;
}
String
v
=
CacheKeyHelper
.
value2String
(
value
);
if
(
StringUtils
.
isEmpty
(
v
))
{
logger
.
warn
(
"RedisHashCache put failed!!! value {}"
,
v
);
return
;
}
this
.
hashOperations
.
put
(
cacheKey
,
hashKey
,
v
);
this
.
yHRedisTemplate
.
longExpire
(
cacheKey
,
timeout
,
unit
);
}
catch
(
Exception
e
)
{
logger
.
warn
(
"RedisHashCache get failed!!! cacheKey is: {},hashkey {}"
,
cacheKey
,
hashKey
);
}
}
/**
* 批量put
*
* @param obj key的后缀
* @param m 需要设置的值(该map的key是去除hashKey后缀的值)
* @param unit 超时时间单位
*/
public
<
T
>
void
putAll
(
String
cacheKey
,
Map
<?
extends
String
,
?
extends
T
>
map
,
long
timeout
,
TimeUnit
unit
)
{
logger
.
debug
(
"Enter putAll hashOperation redis value. obj is {}, m is {}"
,
map
);
if
(
MapUtils
.
isEmpty
(
map
))
{
return
;
}
try
{
if
(
StringUtils
.
isBlank
(
cacheKey
))
{
return
;
}
Map
<
String
,
String
>
newMap
=
Maps
.
newHashMap
();
for
(
Map
.
Entry
<?
extends
String
,
?
extends
T
>
o
:
map
.
entrySet
()){
newMap
.
put
(
o
.
getKey
(),
CacheKeyHelper
.
value2String
(
o
.
getValue
()));
}
// 批量set
hashOperations
.
putAll
(
cacheKey
,
newMap
);
// 设置超时
yHRedisTemplate
.
longExpire
(
cacheKey
,
timeout
,
unit
);
}
catch
(
Exception
e
)
{
logger
.
warn
(
"Redis exception. hash redis putAll . obj is {}, map is {}, exception msg is {}"
,
map
,
e
.
getMessage
());
}
}
/**
* 判断值是否存在
* @param cacheKey
* @return
*/
public
Boolean
hasKey
(
String
cacheKey
)
{
logger
.
debug
(
"Enter hasKey hashOperation redis. cacheKey is {}"
,
cacheKey
);
try
{
return
yHRedisTemplate
.
hasKey
(
cacheKey
);
}
catch
(
Exception
e
)
{
logger
.
warn
(
"get haskey method fail!! e {}"
,
e
);
}
return
false
;
}
}
...
...
common/src/main/java/com/yoho/unions/common/redis/RedisListCache.java
View file @
b379733
...
...
@@ -74,32 +74,23 @@ public class RedisListCache {
}
public
<
T
>
void
rightPushAll
(
String
key
,
Collection
<
T
>
values
,
long
timeout
,
TimeUnit
unit
)
{
logger
.
debug
(
"Enter rightPushAll redis list. key is {}, value is {}, timeout is {}, unit is {}"
,
key
,
values
,
timeout
,
unit
);
public
<
T
>
void
rightPushAll
(
String
key
,
String
value
,
long
timeout
,
TimeUnit
unit
)
{
logger
.
debug
(
"Enter rightPushAll redis list. key is {}, value is {}, timeout is {}, unit is {}"
,
key
,
value
,
timeout
,
unit
);
// 如果是空列表,直接返回
if
(
CollectionUtils
.
isEmpty
(
values
))
{
if
(
StringUtils
.
isEmpty
(
value
))
{
return
;
}
String
cacheKey
=
key
;
// 如果获取的key为空,则说明缓存开关是关闭的
if
(
StringUtils
.
isEmpty
(
cacheK
ey
))
{
if
(
StringUtils
.
isEmpty
(
k
ey
))
{
return
;
}
try
{
Collection
<
String
>
strValues
=
new
ArrayList
<
String
>();
for
(
T
t
:
values
)
{
String
strValue
=
CacheKeyHelper
.
value2String
(
t
);
if
(
StringUtils
.
isEmpty
(
strValue
))
{
continue
;
}
strValues
.
add
(
strValue
);
}
yhListOperations
.
rightPushAll
(
cacheKey
,
strValues
);
yHRedisTemplate
.
longExpire
(
cacheKey
,
timeout
,
unit
);
yhListOperations
.
rightPushAll
(
key
,
value
);
yHRedisTemplate
.
longExpire
(
key
,
timeout
,
unit
);
}
catch
(
Exception
e
)
{
logger
.
warn
(
"rightPushAll redis list operation failed. key is {}"
,
cacheK
ey
,
e
);
logger
.
warn
(
"rightPushAll redis list operation failed. key is {}"
,
k
ey
,
e
);
}
}
...
...
common/src/main/java/com/yoho/unions/vo/ChannelTypeReqVO.java
0 → 100644
View file @
b379733
package
com
.
yoho
.
unions
.
vo
;
import
lombok.Data
;
import
lombok.ToString
;
/**
* Created by yoho on 2017/3/2.
*/
@Data
@ToString
public
class
ChannelTypeReqVO
{
private
String
udid
;
private
String
mobile
;
}
...
...
common/src/main/java/com/yoho/unions/vo/ChannelTypeVO.java
0 → 100644
View file @
b379733
package
com
.
yoho
.
unions
.
vo
;
import
lombok.Data
;
import
lombok.ToString
;
/**
* Created by yoho on 2017/3/2.
*/
@Data
@ToString
public
class
ChannelTypeVO
{
private
String
channelTypeName
;
}
...
...
common/src/main/java/com/yoho/unions/vo/UnionReqVO.java
View file @
b379733
package
com
.
yoho
.
unions
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
lombok.Data
;
import
lombok.ToString
;
import
java.io.Serializable
;
@Data
@ToString
public
class
UnionReqVO
{
private
String
channel_id
;
...
...
@@ -23,68 +25,5 @@ public class UnionReqVO{
private
String
utm_campaign
;
public
String
getChannel_id
()
{
return
channel_id
;
}
public
void
setChannel_id
(
String
channel_id
)
{
this
.
channel_id
=
channel_id
;
}
public
String
getTarget_url
()
{
return
target_url
;
}
public
void
setTarget_url
(
String
target_url
)
{
this
.
target_url
=
target_url
;
}
public
String
getTracking_code
()
{
return
tracking_code
;
}
public
void
setTracking_code
(
String
tracking_code
)
{
this
.
tracking_code
=
tracking_code
;
}
public
String
getU_id
()
{
return
u_id
;
}
public
void
setU_id
(
String
u_id
)
{
this
.
u_id
=
u_id
;
}
public
String
getUnion_type
()
{
return
union_type
==
null
?
""
:
union_type
;
}
public
void
setUnion_type
(
String
union_type
)
{
this
.
union_type
=
union_type
;
}
public
String
getUtm_source
()
{
return
utm_source
==
null
?
""
:
utm_source
;
}
public
void
setUtm_source
(
String
utm_source
)
{
this
.
utm_source
=
utm_source
;
}
public
String
getUtm_medium
()
{
return
utm_medium
==
null
?
""
:
utm_medium
;
}
public
void
setUtm_medium
(
String
utm_medium
)
{
this
.
utm_medium
=
utm_medium
;
}
public
String
getUtm_campaign
()
{
return
utm_campaign
==
null
?
""
:
utm_campaign
;
}
public
void
setUtm_campaign
(
String
utm_campaign
)
{
this
.
utm_campaign
=
utm_campaign
;
}
}
...
...
common/src/main/resources/META-INF/spring/spring-interceptor-config.xml
View file @
b379733
...
...
@@ -33,6 +33,7 @@
<value>
/go
</value>
<value>
/pushUnionOrders
</value>
<value>
/ClickUnionRest/addUnion4Jump
</value>
<value>
/PayChannelRest/getChannelType
</value>
<value>
/UnionRest/addBigData
</value>
<value>
/tencentMkt/TencentMktController/sendSms
</value>
<value>
/tencentMkt/TencentMktController/getActivityInfo
</value>
...
...
dal/src/main/java/com/yoho/unions/dal/IAppActivateIdfaListDAO.java
View file @
b379733
...
...
@@ -6,7 +6,8 @@ import com.yoho.unions.dal.model.AppActivateIdfaList;
public
interface
IAppActivateIdfaListDAO
{
List
<
AppActivateIdfaList
>
selectBy
Idfa
AndDate
(
AppActivateIdfaList
record
);
List
<
AppActivateIdfaList
>
selectBy
Udid
AndDate
(
AppActivateIdfaList
record
);
List
<
AppActivateIdfaList
>
select15DaysByIdfaAndDate
(
AppActivateIdfaList
record
);
}
\ No newline at end of file
...
...
dal/src/main/java/com/yoho/unions/dal/IAppActivateUdidListDAO.java
0 → 100644
View file @
b379733
package
com
.
yoho
.
unions
.
dal
;
import
com.yoho.unions.dal.model.AppActivateIdfaList
;
import
com.yoho.unions.dal.model.AppActivateUdidList
;
import
java.util.List
;
public
interface
IAppActivateUdidListDAO
{
int
insert
(
AppActivateUdidList
record
);
List
<
AppActivateUdidList
>
selectByImeiUdidDate
(
AppActivateUdidList
record
);
int
insertSelective
(
AppActivateUdidList
record
);
}
\ No newline at end of file
...
...
dal/src/main/java/com/yoho/unions/dal/IMobilePanChannelDAO.java
0 → 100644
View file @
b379733
package
com
.
yoho
.
unions
.
dal
;
import
com.yoho.unions.dal.model.MobilePanChannel
;
import
org.apache.ibatis.annotations.Param
;
public
interface
IMobilePanChannelDAO
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
MobilePanChannel
record
);
int
insertSelective
(
MobilePanChannel
record
);
MobilePanChannel
selectByPrimaryKey
(
Integer
id
);
MobilePanChannel
selectByMobile
(
@Param
(
"mobile"
)
String
mobile
);
int
updateByPrimaryKeySelective
(
MobilePanChannel
record
);
int
updateByPrimaryKey
(
MobilePanChannel
record
);
}
\ No newline at end of file
...
...
dal/src/main/java/com/yoho/unions/dal/model/AppActivateIdfaList.java
View file @
b379733
...
...
@@ -13,6 +13,8 @@ public class AppActivateIdfaList extends BaseBO {
private
String
idfa
;
private
String
appKey
;
private
String
udid
;
public
AppActivateIdfaList
(){}
...
...
@@ -27,6 +29,22 @@ public class AppActivateIdfaList extends BaseBO {
this
.
appKey
=
appKey
;
}
public
AppActivateIdfaList
(
Long
dateId
,
String
idfa
,
String
appKey
,
String
udid
)
{
this
.
dateId
=
dateId
;
this
.
idfa
=
idfa
;
this
.
appKey
=
appKey
;
this
.
udid
=
udid
;
}
public
String
getUdid
()
{
return
udid
;
}
public
void
setUdid
(
String
udid
)
{
this
.
udid
=
udid
;
}
public
Long
getDateId
()
{
return
dateId
;
}
...
...
dal/src/main/java/com/yoho/unions/dal/model/AppActivateUdidList.java
0 → 100644
View file @
b379733
package
com
.
yoho
.
unions
.
dal
.
model
;
public
class
AppActivateUdidList
{
private
Long
dateId
;
private
String
udid
;
private
String
appKey
;
public
Long
getDateId
()
{
return
dateId
;
}
public
void
setDateId
(
Long
dateId
)
{
this
.
dateId
=
dateId
;
}
public
String
getUdid
()
{
return
udid
;
}
public
void
setUdid
(
String
udid
)
{
this
.
udid
=
udid
==
null
?
null
:
udid
.
trim
();
}
public
String
getAppKey
()
{
return
appKey
;
}
public
void
setAppKey
(
String
appKey
)
{
this
.
appKey
=
appKey
==
null
?
null
:
appKey
.
trim
();
}
public
AppActivateUdidList
()
{
}
public
AppActivateUdidList
(
Long
dateId
,
String
udid
,
String
appKey
)
{
this
.
dateId
=
dateId
;
this
.
udid
=
udid
;
this
.
appKey
=
appKey
;
}
}
\ No newline at end of file
...
...
dal/src/main/java/com/yoho/unions/dal/model/MobilePanChannel.java
0 → 100644
View file @
b379733
package
com
.
yoho
.
unions
.
dal
.
model
;
import
lombok.Data
;
import
lombok.ToString
;
@Data
@ToString
public
class
MobilePanChannel
{
private
Integer
id
;
private
String
mobile
;
private
Byte
channel
;
private
Integer
createTime
;
}
\ No newline at end of file
...
...
dal/src/main/resources/META-INF/mybatis/AppActivateIdfaListMapper.xml
View file @
b379733
...
...
@@ -3,14 +3,14 @@
<mapper
namespace=
"com.yoho.unions.dal.IAppActivateIdfaListDAO"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yoho.unions.dal.model.AppActivateIdfaList"
>
<result
column=
"date_id"
property=
"dateId"
jdbcType=
"BIGINT"
/>
<result
column=
"
idfa"
property=
"idfa
"
jdbcType=
"VARCHAR"
/>
<result
column=
"
udid"
property=
"udid
"
jdbcType=
"VARCHAR"
/>
<result
column=
"app_key"
property=
"appKey"
jdbcType=
"VARCHAR"
/>
</resultMap>
<select
id=
"selectByIdfaAndDate"
resultMap=
"BaseResultMap"
>
select * from app_activate_idfa_list where date_id=#{dateId} and idfa=#{idfa} and app_key = #{appKey}
<select
id=
"selectByUdidAndDate"
resultMap=
"BaseResultMap"
>
select * from app_activate_idfa_list where date_id=#{dateId} and udid=#{udid} and app_key = #{appKey}
</select>
<select
id=
"select15DaysByIdfaAndDate"
resultMap=
"BaseResultMap"
>
select * from app_activate_idfa_list_15days where date_id=#{dateId} and
idfa=#{idfa
} and app_key = #{appKey}
select * from app_activate_idfa_list_15days where date_id=#{dateId} and
udid=#{udid
} and app_key = #{appKey}
</select>
</mapper>
\ No newline at end of file
...
...
dal/src/main/resources/META-INF/mybatis/AppActivateUdidListMapper.xml
0 → 100644
View file @
b379733
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.yoho.unions.dal.IAppActivateUdidListDAO"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yoho.unions.dal.model.AppActivateUdidList"
>
<result
column=
"date_id"
property=
"dateId"
jdbcType=
"BIGINT"
/>
<result
column=
"udid"
property=
"udid"
jdbcType=
"VARCHAR"
/>
<result
column=
"app_key"
property=
"appKey"
jdbcType=
"VARCHAR"
/>
</resultMap>
<select
id=
"selectByImeiUdidDate"
resultMap=
"BaseResultMap"
>
select * from app_activate_udid_list where date_id=#{dateId} and app_key = #{appKey} and udid=#{udid}
</select>
</mapper>
\ No newline at end of file
...
...
dal/src/main/resources/META-INF/mybatis/MobilePanChannelMapper.xml
0 → 100644
View file @
b379733
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.yoho.unions.dal.IMobilePanChannelDAO"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yoho.unions.dal.model.MobilePanChannel"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"mobile"
property=
"mobile"
jdbcType=
"VARCHAR"
/>
<result
column=
"channel"
property=
"channel"
jdbcType=
"TINYINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, mobile, channel, create_time
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from mobile_pan_channel
where id = #{id,jdbcType=INTEGER}
</select>
<select
id=
"selectByMobile"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from mobile_pan_channel
where mobile = #{mobile,jdbcType=VARCHAR}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from mobile_pan_channel
where id = #{id,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.yoho.unions.dal.model.MobilePanChannel"
>
insert into mobile_pan_channel (id, mobile, channel,
create_time)
values (#{id,jdbcType=INTEGER}, #{mobile,jdbcType=VARCHAR}, #{channel,jdbcType=TINYINT},
#{createTime,jdbcType=INTEGER})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.yoho.unions.dal.model.MobilePanChannel"
>
insert into mobile_pan_channel
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"mobile != null"
>
mobile,
</if>
<if
test=
"channel != null"
>
channel,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
<if
test=
"mobile != null"
>
#{mobile,jdbcType=VARCHAR},
</if>
<if
test=
"channel != null"
>
#{channel,jdbcType=TINYINT},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.yoho.unions.dal.model.MobilePanChannel"
>
update mobile_pan_channel
<set
>
<if
test=
"mobile != null"
>
mobile = #{mobile,jdbcType=VARCHAR},
</if>
<if
test=
"channel != null"
>
channel = #{channel,jdbcType=TINYINT},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.yoho.unions.dal.model.MobilePanChannel"
>
update mobile_pan_channel
set mobile = #{mobile,jdbcType=VARCHAR},
channel = #{channel,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
...
...
server/src/main/java/com/yoho/unions/server/restapi/ClickUnionRest.java
View file @
b379733
...
...
@@ -172,11 +172,13 @@ public class ClickUnionRest {
@RequestMapping
(
"/addUnion4Jump"
)
public
void
addUnion4Stream
(
ClickUnionRequestBO
bo
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
clickUnion
.
info
(
"addUnion4Stream ClickUnionRequestBO{}"
,
bo
);
if
(
StringUtils
.
isEmpty
(
bo
.
getUnion_type
()))
{
if
(
null
==
bo
||
StringUtils
.
isEmpty
(
bo
.
getUnion_type
()))
{
return
;
}
String
clientIp
=
null
;
String
IP
=
RemoteIPInterceptor
.
getRemoteIP
();
String
downloadDirect
=
bo
.
getDownloadDirect
();
if
(
StringUtils
.
isNotEmpty
(
IP
)){
String
[]
IPS
=
IP
.
split
(
","
);
clientIp
=
IPS
[
0
];
...
...
@@ -359,6 +361,10 @@ public class ClickUnionRest {
// log.info("addUnion4Stream with request is {}", bo);
response
.
setStatus
(
301
);
//response.setHeader("Location",url);
//如果不需要直接下载, 配置参数downloadDirect=N, 跳转应用宝下载
if
(
null
!=
downloadDirect
&&
"N"
.
equals
(
downloadDirect
.
trim
())){
url
=
"http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445"
;
}
response
.
sendRedirect
(
url
);
}
catch
(
Exception
e
)
{
log
.
error
(
"addUnion4Stream error with request={}"
,
bo
,
e
);
...
...
server/src/main/java/com/yoho/unions/server/restapi/PayChannelRest.java
0 → 100644
View file @
b379733
package
com
.
yoho
.
unions
.
server
.
restapi
;
import
com.yoho.unions.server.service.IPayChannelService
;
import
com.yoho.unions.vo.ApiResponse
;
import
com.yoho.unions.vo.ChannelTypeReqVO
;
import
com.yoho.unions.vo.ChannelTypeVO
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
/**
* Created by yoho on 2017/3/2.
*/
@Controller
@RequestMapping
(
"/PayChannelRest"
)
public
class
PayChannelRest
{
Logger
logger
=
LoggerFactory
.
getLogger
(
PayChannelRest
.
class
);
@Autowired
IPayChannelService
payChannelService
;
@RequestMapping
(
"/getChannelType"
)
@ResponseBody
public
ApiResponse
getChannelType
(
ChannelTypeReqVO
unionReqVO
)
{
logger
.
info
(
"Enter PayChannelRest.getChannelType unionReqVO {} "
,
unionReqVO
);
ChannelTypeVO
channelTypeBO
=
payChannelService
.
getChannelType
(
unionReqVO
);
if
(
StringUtils
.
isNotBlank
(
channelTypeBO
.
getChannelTypeName
())){
return
new
ApiResponse
.
ApiResponseBuilder
().
data
(
channelTypeBO
).
build
();
}
else
{
return
new
ApiResponse
.
ApiResponseBuilder
().
code
(
401
).
build
();
}
}
}
...
...
server/src/main/java/com/yoho/unions/server/service/IPayChannelService.java
0 → 100644
View file @
b379733
package
com
.
yoho
.
unions
.
server
.
service
;
import
com.yoho.unions.vo.ChannelTypeReqVO
;
import
com.yoho.unions.vo.ChannelTypeVO
;
import
com.yoho.unions.vo.UnionReqVO
;
/**
* Created by yoho on 2017/3/2.
*/
public
interface
IPayChannelService
{
/**
* 判断是否是否付费渠道
* @param unionReqVO
* @return
*/
public
ChannelTypeVO
getChannelType
(
ChannelTypeReqVO
unionReqVO
);
}
...
...
server/src/main/java/com/yoho/unions/server/service/IPinYouService.java
View file @
b379733
...
...
@@ -22,4 +22,6 @@ public interface IPinYouService {
UnionResponse
sendTrans
(
TransPinYouRequestBO
requestBO
);
UnionResponse
sendPinYou
();
UnionResponse
sendUrl
(
String
url
);
}
...
...
server/src/main/java/com/yoho/unions/server/service/impl/DDServiceImpl.java
View file @
b379733
...
...
@@ -188,7 +188,7 @@ public class DDServiceImpl implements MainUnionService {
// UnionTypeModel type = UnionConstant.unionTypeMap.get(1);
String
yesterday
=
DateUtil
.
dateAdd
(
DateUtil
.
getToday
(
"yyyyMMdd"
),
"d"
,
-
1
,
"yyyyMMdd"
);
if
(
ClientTypeEnum
.
IOS
.
getName
().
equals
(
request
.
getClient_type
()))
{
List
<
AppActivateIdfaList
>
_90DayIdfaList
=
appActivateIdfaListDAO
.
selectBy
Idfa
AndDate
(
new
AppActivateIdfaList
(
Long
.
valueOf
(
yesterday
),
request
.
getIdfa
()));
List
<
AppActivateIdfaList
>
_90DayIdfaList
=
appActivateIdfaListDAO
.
selectBy
Udid
AndDate
(
new
AppActivateIdfaList
(
Long
.
valueOf
(
yesterday
),
request
.
getIdfa
()));
List
<
AppActivateIdfaList
>
_15DayIdfaList
=
appActivateIdfaListDAO
.
select15DaysByIdfaAndDate
(
new
AppActivateIdfaList
(
Long
.
valueOf
(
yesterday
),
request
.
getIdfa
()));
//判断90天内是否在大数据有记录
if
(
CollectionUtils
.
isNotEmpty
(
_90DayIdfaList
))
{
...
...
server/src/main/java/com/yoho/unions/server/service/impl/DingdangServiceImpl.java
View file @
b379733
...
...
@@ -66,7 +66,7 @@ public class DingdangServiceImpl implements DingdangService {
private
static
final
String
unions_KEY
=
"yh:unions:dingdang_"
;
static
final
String
yasUrl
=
"http
s
://analytics.m.yohobuy.com/yas.gif/web/"
;
static
final
String
yasUrl
=
"http://analytics.m.yohobuy.com/yas.gif/web/"
;
@Override
public
UnionResponseBO
addUnion
(
AddUnionRequestBO
request
)
throws
Exception
{
...
...
@@ -346,6 +346,10 @@ public class DingdangServiceImpl implements DingdangService {
public
UnionResponse
addYas
(
ClickUnionRequestBO
request
){
String
unionType
=
request
.
getUnion_type
();
if
(
StringUtils
.
isEmpty
(
unionType
))
{
return
new
UnionResponse
(
201
,
"union_type is empty"
);
}
String
ak
=
"yohoboys_m"
;
String
random
=
RandomUtil
.
getRandom
(
5
);
int
ts
=
DateUtil
.
getCurrentTimeSecond
();
...
...
server/src/main/java/com/yoho/unions/server/service/impl/GDTServiceImpl.java
View file @
b379733
...
...
@@ -143,7 +143,7 @@ public class GDTServiceImpl implements MainUnionService {
u
.
setValue
(
String
.
valueOf
(
mktMarketingUrl
.
getUnionType
()));
String
yesterday
=
DateUtil
.
dateAdd
(
DateUtil
.
getToday
(
"yyyyMMdd"
),
"d"
,
-
1
,
"yyyyMMdd"
);
if
(
ClientTypeEnum
.
IOS
.
getName
().
equals
(
request
.
getClient_type
()))
{
List
<
AppActivateIdfaList
>
_90DayIdfaList
=
appActivateIdfaListDAO
.
selectBy
Idfa
AndDate
(
new
AppActivateIdfaList
(
Long
.
valueOf
(
yesterday
),
request
.
getIdfa
()));
List
<
AppActivateIdfaList
>
_90DayIdfaList
=
appActivateIdfaListDAO
.
selectBy
Udid
AndDate
(
new
AppActivateIdfaList
(
Long
.
valueOf
(
yesterday
),
request
.
getIdfa
()));
List
<
AppActivateIdfaList
>
_15DayIdfaList
=
appActivateIdfaListDAO
.
select15DaysByIdfaAndDate
(
new
AppActivateIdfaList
(
Long
.
valueOf
(
yesterday
),
request
.
getIdfa
()));
//判断90天内是否在大数据有记录
if
(
CollectionUtils
.
isNotEmpty
(
_90DayIdfaList
))
{
...
...
server/src/main/java/com/yoho/unions/server/service/impl/PayChannelServiceImpl.java
0 → 100644
View file @
b379733
package
com
.
yoho
.
unions
.
server
.
service
.
impl
;
import
com.yoho.unions.common.redis.RedisHashCache
;
import
com.yoho.unions.common.redis.RedisValueCache
;
import
com.yoho.unions.dal.IMobilePanChannelDAO
;
import
com.yoho.unions.dal.model.MobilePanChannel
;
import
com.yoho.unions.server.service.IPayChannelService
;
import
com.yoho.unions.vo.ChannelTypeReqVO
;
import
com.yoho.unions.vo.ChannelTypeVO
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.concurrent.TimeUnit
;
/**
* Created by yoho on 2017/3/2.
*/
@Service
public
class
PayChannelServiceImpl
implements
IPayChannelService
{
static
Logger
logger
=
LoggerFactory
.
getLogger
(
PayChannelServiceImpl
.
class
);
@Autowired
IMobilePanChannelDAO
mobilePanChannelDAO
;
@Autowired
RedisHashCache
redisHashCache
;
@Autowired
RedisValueCache
redisValueCache
;
// 记录付费渠道的redis
private
static
final
String
UNION_PAY_CHANNEL_KEY_PRE
=
"union:pay_channel:"
;
/**
* 判断是否是否付费渠道
* @param unionReqVO
* @return
*/
public
ChannelTypeVO
getChannelType
(
ChannelTypeReqVO
unionReqVO
){
ChannelTypeVO
channelTypeBO
=
new
ChannelTypeVO
();
// (1)判断是否是 付费渠道
if
(
StringUtils
.
isNotBlank
(
unionReqVO
.
getUdid
())){
logger
.
info
(
"pay_channel check"
);
String
redisKey
=
UNION_PAY_CHANNEL_KEY_PRE
+
unionReqVO
.
getUdid
();
String
payChannel
=
redisValueCache
.
get
(
redisKey
,
String
.
class
);
if
(
StringUtils
.
isNotBlank
(
payChannel
)){
channelTypeBO
.
setChannelTypeName
(
"paychannel"
);
}
}
// (2)判断是否是 泛渠道
if
(
StringUtils
.
isEmpty
(
channelTypeBO
.
getChannelTypeName
())
&&
StringUtils
.
isNotBlank
(
unionReqVO
.
getMobile
())){
logger
.
info
(
"pan_channel check"
);
MobilePanChannel
mobilePanChannel
=
mobilePanChannelDAO
.
selectByMobile
(
unionReqVO
.
getMobile
());
if
(
mobilePanChannel
!=
null
){
channelTypeBO
.
setChannelTypeName
(
"panchannel"
);
}
}
return
channelTypeBO
;
}
}
...
...
server/src/main/java/com/yoho/unions/server/service/impl/PinYouServiceImpl.java
View file @
b379733
...
...
@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
import
java.net.URLDecoder
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
/**
* Created by yoho on 2016/11/15.
...
...
@@ -38,6 +39,9 @@ public class PinYouServiceImpl implements IPinYouService {
private
static
final
String
UNION_TRANS_KEY
=
"union:pinyou:trans"
;
//增加一种key,把推送失败的记录到redis里面,然后后面把失败的再重新推
private
static
final
String
UNION_SENDFAIL_KEY
=
"union:pinyou:sendfail"
;
@Autowired
private
RedisListCache
redisListCache
;
...
...
@@ -208,7 +212,7 @@ public class PinYouServiceImpl implements IPinYouService {
return
response
;
}
p
rivate
UnionResponse
sendUrl
(
String
url
)
{
p
ublic
UnionResponse
sendUrl
(
String
url
)
{
log
.
info
(
"pinyou sendUrl url is {}"
,
url
);
try
{
url
=
URLDecoder
.
decode
(
url
,
"UTF-8"
);
...
...
@@ -216,6 +220,7 @@ public class PinYouServiceImpl implements IPinYouService {
log
.
info
(
"pinyou sendUrl union success url={}, and result={}"
,
url
,
pair
);
if
(
pair
.
getLeft
()
!=
200
)
{
log
.
warn
(
"pinyou callback error with request={}"
,
url
);
redisListCache
.
rightPushAll
(
UNION_SENDFAIL_KEY
,
url
,
24
,
TimeUnit
.
HOURS
);
return
new
UnionResponse
(
204
,
"callback error"
);
}
}
catch
(
Exception
e
)
{
...
...
server/src/main/java/com/yoho/unions/server/service/impl/UnionServiceImpl.java
View file @
b379733
...
...
@@ -35,6 +35,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.context.ApplicationEventPublisherAware
;
...
...
@@ -78,13 +79,13 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
@Resource
(
name
=
"yhValueOperations"
)
YHValueOperations
<
String
,
String
>
yhValueOperations
;
@Value
(
"${exclude.union.type}"
)
private
String
EXCLUDE_UNION_TYPE
;
@Resource
IUnionLogsDAO
unionLogsDAO
;
@Resource
private
ServiceCaller
service
;
@Resource
IAppActivateIdfaListDAO
appActivateIdfaListDAO
;
@Resource
...
...
@@ -108,9 +109,15 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
@Resource
IUnionTypeMatchDAO
unionTypeMatchDAO
;
@Resource
IAppActivateUdidListDAO
appActivateUdidListDAO
;
@Resource
(
name
=
"unionServiceImpl"
)
IUnionService
unionService
;
// 记录付费渠道的redis
private
static
final
String
UNION_PAY_CHANNEL_KEY_PRE
=
"union:pay_channel:"
;
public
final
static
List
<
String
>
IOS_INTERFACE_LIST
=
new
ArrayList
<
String
>(){{
add
(
"addUnion_ios"
);
add
(
"addUnion4Jump_ios"
);
add
(
"addMonitor_ios"
);
}};
...
...
@@ -359,14 +366,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
// 查询该td在90天内是否已经激活过
UnionLogs
union
=
unionLogsDAO
.
selectByClientType
(
request
.
getClient_type
(),
request
.
getIdfa
(),
request
.
getImei
(),
request
.
getAppkey
());
log
.
info
(
"activateUnion in selectByClientType result is {}"
,
union
);
// 没有点击记录,则退出
// if (union == null) {
// log.warn("activateUnion error because not click record with request is {}",
// request);
// return new UnionResponse(205, "not click record");
// }
//删除redis中的点击记录
yHRedisTemplate
.
delete
(
key
);
...
...
@@ -389,7 +389,11 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"landing_page_url"
,
StringUtils
.
isEmpty
(
mktMarketingUrl
.
getLandingPageUrl
())
?
""
:
mktMarketingUrl
.
getLandingPageUrl
());
// UnionTypeModel u = UnionConstant.unionTypeMap.get(Integer.parseInt(click.getUnion_type()));
if
(
union
!=
null
&&
union
.
getIsActivate
()
!=
null
&&
union
.
getIsActivate
().
byteValue
()
==
1
)
{
// 如果90天之内有过激活日志,则不允许重复激活
log
.
warn
(
"activateUnion error because 90 days has activate info with param is {}"
,
request
);
return
new
UnionResponse
(
200
,
"have activite in 90 days"
,
result
);
}
UnionTypeModel
u
=
new
UnionTypeModel
();
u
.
setName
(
mktMarketingUrl
.
getName
());
...
...
@@ -400,49 +404,71 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
String
appkey
=
request
.
getAppkey
();
String
app_key
=
"yohobuy_ios"
;
if
(
"yohobuy"
.
equals
(
appkey
))
{
appkey
=
"yohobuy"
;
app_key
=
"yohobuy_ios"
;
}
else
if
(
"yoho"
.
equals
(
appkey
))
{
appkey
=
"yoho!"
;
app_key
=
"yoho!_ios"
;
}
else
if
(
"mars"
.
equals
(
appkey
))
{
appkey
=
"yohomars"
;
app_key
=
"yohomars_ios"
;
}
List
<
AppActivateIdfaList
>
_90DayIdfaList
=
appActivateIdfaListDAO
.
selectByIdfaAndDate
(
new
AppActivateIdfaList
(
Long
.
valueOf
(
yesterday
),
request
.
getIdfa
(),
app_key
));
List
<
AppActivateIdfaList
>
_15DayIdfaList
=
appActivateIdfaListDAO
.
select15DaysByIdfaAndDate
(
new
AppActivateIdfaList
(
Long
.
valueOf
(
yesterday
),
request
.
getIdfa
(),
app_key
));
List
<
AppActivateIdfaList
>
_90DayIdfaList
=
appActivateIdfaListDAO
.
selectByUdidAndDate
(
new
AppActivateIdfaList
(
Long
.
valueOf
(
yesterday
),
request
.
getUdid
(),
app_key
));
// List<AppActivateIdfaList> _15DayIdfaList = appActivateIdfaListDAO.select15DaysByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getUdid(), app_key));
//判断90天内是否在大数据有记录
if
(
CollectionUtils
.
isNotEmpty
(
_90DayIdfaList
))
{
log
.
warn
(
"activateUnion error because 90 days has activate in bigdata database info with param is {}"
,
request
);
log
.
warn
(
"
ios
activateUnion error because 90 days has activate in bigdata database info with param is {}"
,
request
);
//判断15天内是否在大数据有记录
if
(
CollectionUtils
.
isNotEmpty
(
_15DayIdfaList
))
{
//15天内有记录,退出
log
.
warn
(
"activateUnion error because 15 days has activate in bigdata database info with param is {}"
,
request
);
}
else
{
//根据mkt_markering
//15天内没有记录,则记录大数据日志,退出
JSONObject
j
=
new
JSONObject
();
j
.
put
(
"apptype"
,
request
.
getClient_type
());
j
.
put
(
"appid"
,
click
.
getAppid
());
j
.
put
(
"idfa"
,
request
.
getIdfa
());
j
.
put
(
"imei"
,
request
.
getImei
());
j
.
put
(
"udid"
,
request
.
getUdid
());
j
.
put
(
"dateid"
,
DateUtil
.
getcurrentDateTime
());
j
.
put
(
"source"
,
u
==
null
?
""
:
u
.
getName
());
j
.
put
(
"source_id"
,
click
.
getUnion_type
());
j
.
put
(
"ip"
,
request
.
getClientIp
());
j
.
put
(
"collect_ip"
,
""
);
j
.
put
(
"app_key"
,
request
.
getAppkey
());
j
.
put
(
"active_type"
,
"15"
);
j
.
put
(
"tdid"
,
request
.
getTdid
());
activeDingdang
.
info
(
j
.
toString
());
}
// //判断15天内是否在大数据有记录
// if (CollectionUtils.isNotEmpty(_15DayIdfaList)) {
// //15天内有记录,退出
// log.warn("activateUnion error because 15 days has activate in bigdata database info with param is {}", request);
// } else {
// //根据mkt_markering
// //15天内没有记录,则记录大数据日志,退出
// JSONObject j = new JSONObject();
// j.put("apptype", request.getClient_type());
// j.put("appid", click.getAppid());
// j.put("idfa", request.getIdfa());
// j.put("imei", request.getImei());
// j.put("udid", request.getUdid());
// j.put("dateid", DateUtil.getcurrentDateTime());
// j.put("source", u == null ? "" : u.getName());
// j.put("source_id",click.getUnion_type());
// j.put("ip", request.getClientIp());
// j.put("collect_ip", "");
// j.put("app_key", request.getAppkey());
// j.put("active_type", "15");
// j.put("tdid", request.getTdid());
// activeDingdang.info(j.toString());
// }
return
new
UnionResponse
(
200
,
"have activite in 90 days"
,
result
);
}
}
// 如果是安卓的用户,从大数据判断是否是90天的活跃用户,
if
(
StringUtils
.
equals
(
ClientTypeEnum
.
ANDROID
.
getName
(),
request
.
getClient_type
())){
String
appKey
=
request
.
getAppkey
()+
"_android"
;
// 如果90天内有记录,则直接返回
List
<
AppActivateUdidList
>
activateUdidLists
=
appActivateUdidListDAO
.
selectByImeiUdidDate
(
new
AppActivateUdidList
(
Long
.
valueOf
(
yesterday
),
request
.
getUdid
(),
appKey
));
if
(
CollectionUtils
.
isNotEmpty
(
activateUdidLists
)){
log
.
warn
(
"android activateUnion error because 90 days has activate in bigdata database info with param is {}"
,
request
);
return
new
UnionResponse
(
200
,
"have activite in 90 days"
,
result
);
}
}
// 调用成功,更新数据库
// 渠道号是100000000000349的不作为付费渠道,不记redis
if
(!
EXCLUDE_UNION_TYPE
.
equals
(
click
.
getUnion_type
())){
try
{
DynamicIntProperty
activeTime
=
DynamicPropertyFactory
.
getInstance
().
getIntProperty
(
"activeTime_pay_channel"
,
90
);
String
payChannelKey
=
UNION_PAY_CHANNEL_KEY_PRE
+
request
.
getUdid
();
yhValueOperations
.
set
(
payChannelKey
,
request
.
getClient_type
());
yHRedisTemplate
.
longExpire
(
key
,
activeTime
.
get
(),
TimeUnit
.
DAYS
);
}
catch
(
Exception
e
){
log
.
warn
(
"set redis cache error, udid is {}, client_type is {}"
,
request
.
getUdid
(),
request
.
getClient_type
());
}
}
log
.
info
(
"activateUnion add db success with request is {}"
,
request
);
UnionLogs
logs
=
new
UnionLogs
();
logs
.
setAppId
(
request
.
getAppid
());
logs
.
setUdid
(
request
.
getUdid
());
...
...
@@ -712,6 +738,24 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
});
}
private
void
saveUnionLogs
(
ActivateUnionRequestBO
request
,
ClickUnionRequestBO
click
,
String
value
){
UnionLogs
logs
=
new
UnionLogs
();
logs
.
setAppId
(
request
.
getAppid
());
logs
.
setUdid
(
request
.
getUdid
());
logs
.
setIdfa
(
request
.
getIdfa
());
logs
.
setImei
(
request
.
getImei
());
logs
.
setClientType
(
request
.
getClient_type
());
logs
.
setActivateParams
(
JSON
.
toJSONString
(
request
));
logs
.
setIsActivate
((
byte
)
1
);
logs
.
setCreateTime
(
DateUtil
.
getCurrentTimeSecond
());
logs
.
setUpdateTime
(
logs
.
getCreateTime
());
logs
.
setUnionType
(
click
.
getUnion_type
());
logs
.
setAddParams
(
value
);
logs
.
setTd
(
request
.
getTd
());
logs
.
setAppKey
(
request
.
getAppkey
());
logs
.
setInterfaceType
(
click
.
getInterfaceType
());
unionLogsDAO
.
insert
(
logs
);
}
@Override
public
void
setApplicationEventPublisher
(
ApplicationEventPublisher
applicationEventPublisher
)
{
this
.
publisher
=
applicationEventPublisher
;
...
...
server/src/main/java/com/yoho/unions/server/task/PinYouTask.java
View file @
b379733
...
...
@@ -31,6 +31,8 @@ public class PinYouTask {
private
static
final
String
UNION_TRANS_KEY
=
"union:pinyou:trans"
;
private
static
final
String
UNION_SENDFAIL_KEY
=
"union:pinyou:sendfail"
;
@Resource
IPinYouService
pinYouService
;
...
...
@@ -57,6 +59,7 @@ public class PinYouTask {
//从redis里面获取大数据的数据
Long
viewSize
=
redisListCache
.
size
(
UNION_VIEW_KEY
);
Long
transSize
=
redisListCache
.
size
(
UNION_TRANS_KEY
);
Long
failSize
=
redisListCache
.
size
(
UNION_SENDFAIL_KEY
);
List
<
ViewPinYouRequestBO
>
viewPinYouRequestBOList
=
new
ArrayList
<>();
int
viewSizeInt
=
viewSize
==
null
?
0
:
viewSize
.
intValue
();
int
transSizeInt
=
transSize
==
null
?
0
:
transSize
.
intValue
();
...
...
@@ -77,6 +80,13 @@ public class PinYouTask {
}
}
if
(
failSize
>
0
){
for
(
int
i
=
0
;
i
<
failSize
;
i
++){
String
failUrl
=
redisListCache
.
rightPop
(
UNION_SENDFAIL_KEY
,
String
.
class
);
pinYouService
.
sendUrl
(
failUrl
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
transPinYouRequestBOList
)){
log
.
info
(
"transPinYouRequestBOList size is {}"
,
transPinYouRequestBOList
.
size
());
for
(
TransPinYouRequestBO
transPinYouRequestBO:
transPinYouRequestBOList
){
...
...
web/src/main/resources/config.properties
View file @
b379733
...
...
@@ -21,6 +21,8 @@ activeTime_3=24
#今日头条 24
activeTime_4
=
24
#微博
#付费渠道
activeTime_pay_channel
=
90
# ******************** redis servers ********************
redis.readonly.proxy.address
=
192.168.102.12
...
...
@@ -104,4 +106,7 @@ erp.domain=http://192.168.102.47:9098/erp-gateway-web
admin.login.url
=
http://192.168.102.211:30012
business.mobile
=
13621380911,15210647200
\ No newline at end of file
exclude.union.type
=
100000000000349
business.mobile
=
13621380911,15210647200
...
...
web/src/main/resources/databases.yml
View file @
b379733
...
...
@@ -25,6 +25,7 @@ datasources:
password
:
9nm0icOwt6bMHjMusIfMLw==
daos
:
-
com.yoho.unions.dal.IAppActivateIdfaListDAO
-
com.yoho.unions.dal.IAppActivateUdidListDAO
yh_unions
:
servers
:
...
...
@@ -51,6 +52,8 @@ datasources:
-
com.yoho.unions.dal.IChannelGroupConditionDAO
-
com.yoho.unions.dal.IChannelGroupBatchDAO
-
com.yoho.unions.dal.IChannelSmsBlackDAO
-
com.yoho.unions.dal.IMobilePanChannelDAO
-
com.yoho.unions.dal.IChannelUserDAO
readOnlyInSlave
:
true
\ No newline at end of file
...
...
web/src/main/webapp/META-INF/autoconf/auto-config.xml
View file @
b379733
...
...
@@ -11,6 +11,8 @@
<!-- memcached -->
<property
name=
"cache.servers.union.address"
defaultValue=
"memcache.union.yohoops.org:11211"
description=
""
/>
<property
name=
"exclude.union.type"
defaultValue=
"100000000000349"
description=
"m站的渠道号"
/>
<property
name=
"gateway.url"
defaultValue=
"http://api.yoho.cn"
description=
"gateway 的地址"
/>
<property
name=
"sendSMS.password"
defaultValue=
"7jVEde87bLffoTnt6tGxmw=="
description=
"调用运维发送短信接口时的,需要传入的密码(AES加密)"
/>
<property
name=
"tencentmkt.shareUrl"
defaultValue=
"http://union.yoho.cn/union/tencentMkt/index.html"
description=
"市场活动推广的链接地址"
/>
...
...
web/src/main/webapp/META-INF/autoconf/config.properties
View file @
b379733
...
...
@@ -50,6 +50,8 @@ draw.writeFile.delay=${draw.writeFile.delay}
activeTime_3
=
24
#今日头条 24
activeTime_4
=
24
#付费渠道
activeTime_pay_channel
=
90
#广点通 ios加密密钥
ios_encrypt_key
=
a9dc833b8a75c21f
...
...
@@ -103,6 +105,10 @@ platform.login.salt=${platform.login.salt}
erp.domain
=
${erp.domain}
admin.login.url
=
${admin.login.url}
exclude.union.type
=
${exclude.union.type}
business.mobile
=
13621380911,15210647200
union.host
=
${union.host}
\ No newline at end of file
union.host
=
${union.host}
...
...
web/src/main/webapp/META-INF/autoconf/databases.yml
View file @
b379733
...
...
@@ -26,6 +26,7 @@ datasources:
password
:
${bigdate.db.password}
daos
:
-
com.yoho.unions.dal.IAppActivateIdfaListDAO
-
com.yoho.unions.dal.IAppActivateUdidListDAO
yh_unions
:
servers
:
...
...
@@ -52,6 +53,7 @@ datasources:
-
com.yoho.unions.dal.IChannelGroupBatchDAO
-
com.yoho.unions.dal.IChannelSmsBlackDAO
bigdata_yh_unions
:
servers
:
-
${jdbc.mysql.bigdataunion.slave}
...
...
@@ -61,4 +63,13 @@ datasources:
daos
:
-
com.yoho.unions.dal.IChannelUserDAO
bigdata_yoho_passport
:
servers
:
-
${jdbc.mysql.bigdataunion.slave}
-
${jdbc.mysql.bigdataunion.slave}
username
:
${jdbc.mysql.bigdataunion.username}
password
:
${jdbc.mysql.bigdataunion.password}
daos
:
-
com.yoho.unions.dal.IMobilePanChannelDAO
readOnlyInSlave
:
true
\ No newline at end of file
...
...
web/src/main/webapp/tencentMkt/index.html
View file @
b379733
...
...
@@ -43,11 +43,11 @@
a
.
async
=
1
;
a
.
src
=
j
;
m
.
parentNode
.
insertBefore
(
a
,
m
);
}(
window
,
document
,
'script'
,
(
document
.
location
.
protocol
===
'https:'
?
'https:'
:
'http:'
)
+
'//cdn.yoho.cn/yas-jssdk/
1.0.17
/yas.js'
,
'_yas'
));
}(
window
,
document
,
'script'
,
(
document
.
location
.
protocol
===
'https:'
?
'https:'
:
'http:'
)
+
'//cdn.yoho.cn/yas-jssdk/
2.3.4
/yas.js'
,
'_yas'
));
(
function
()
{
if
(
window
.
_yas
)
{
window
.
_yas
(
1
*
new
Date
(),
'
1.0.17
'
,
'yohobuy_m'
,
''
,
''
,
''
);
window
.
_yas
(
1
*
new
Date
(),
'
2.3.4
'
,
'yohobuy_m'
,
''
,
''
,
''
);
}
}());
...
...
Please
register
or
login
to post a comment