Authored by zhengwen.ge

90天池子

package com.yoho.unions.dal;
import com.yoho.unions.dal.model.BaseUserActiveDay;
import org.apache.ibatis.annotations.Param;
public interface BaseUserActiveDayMapper {
BaseUserActiveDay selectByUdidAndAppKey(@Param("udid")String udid,@Param("appKey")String appKey);
}
\ No newline at end of file
... ...
package com.yoho.unions.dal.model;
public class BaseUserActiveDay {
private String dateId;
private String udid;
private String idfa;
private String appKey;
public String getDateId() {
return dateId;
}
public void setDateId(String dateId) {
this.dateId = dateId == null ? null : dateId.trim();
}
public String getUdid() {
return udid;
}
public void setUdid(String udid) {
this.udid = udid == null ? null : udid.trim();
}
public String getIdfa() {
return idfa;
}
public void setIdfa(String idfa) {
this.idfa = idfa == null ? null : idfa.trim();
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey == null ? null : appKey.trim();
}
}
\ No newline at end of file
... ...
<?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.BaseUserActiveDayMapper" >
<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.BaseUserActiveDay" >
<result column="date_id" property="dateId" jdbcType="VARCHAR" />
<result column="udid" property="udid" jdbcType="VARCHAR" />
<result column="idfa" property="idfa" jdbcType="VARCHAR" />
<result column="app_key" property="appKey" jdbcType="VARCHAR" />
</resultMap>
<select id="selectByUdidAndAppKey" resultMap="BaseResultMap">
select * from base_user_active_day where udid=#{udid} and app_key = #{appKey} limit 1
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -124,6 +124,9 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
@Resource
AppChannelActiveMapper appChannelActiveMapper;
@Resource
BaseUserActiveDayMapper baseUserActiveDayMapper;
@Resource(name="unionServiceImpl")
IUnionService unionService;
... ... @@ -405,14 +408,15 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
} else if ("mars".equals(appkey)) {
app_key = "yohomars_ios";
}
List<AppActivateIdfaList> _90DayIdfaList = appActivateIdfaListDAO.selectByUdidAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getUdid(), app_key));
activeUnion.info("check ios active info in 90 days. udid is {} and app_key is {},yesterday is {} and result is {}", request.getUdid(), app_key, yesterday, (null == _90DayIdfaList || _90DayIdfaList.size() == 0)? "null": _90DayIdfaList.get(0));
// List<AppActivateIdfaList> _90DayIdfaList = appActivateIdfaListDAO.selectByUdidAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getUdid(), app_key));
// activeUnion.info("check ios active info in 90 days. udid is {} and app_key is {},yesterday is {} and result is {}", request.getUdid(), app_key, yesterday, (null == _90DayIdfaList || _90DayIdfaList.size() == 0)? "null": _90DayIdfaList.get(0));
BaseUserActiveDay baseUserActiveDay = baseUserActiveDayMapper.selectByUdidAndAppKey(request.getUdid(),app_key);
List<AppActivateIdfaList> _15DayIdfaList = appActivateIdfaListDAO.select15DaysByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getIdfa(), app_key, null));
activeUnion.info("check ios active info in 15 days. udid is {} and app_key is {},yesterday is {} and result is {}", request.getUdid(), app_key, yesterday, (null == _15DayIdfaList || _15DayIdfaList.size() == 0)? "null": _15DayIdfaList.get(0));
//判断90天内是否在大数据有记录
if (CollectionUtils.isNotEmpty(_90DayIdfaList)) {
if (baseUserActiveDay!=null) {
// log.warn("ios activateUnion error because 90 days has activate in bigdata database info with param is {}", request);
String time = DateUtil.getcurrentTime();
udidPool.info("Has action in 90 days at bigdata. udid is {},idfa is {},current time is {}", request.getUdid(), request.getIdfa(),time);
... ... @@ -448,10 +452,11 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
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));
activeUnion.info("check android active info in 90 days. udid is {} and app_key is {},yesterday is {} and result is {}", request.getUdid(), appKey, yesterday, activateUdidLists);
// List<AppActivateUdidList> activateUdidLists = appActivateUdidListDAO.selectByImeiUdidDate(new AppActivateUdidList(Long.valueOf(yesterday), request.getUdid(), appKey));
BaseUserActiveDay baseUserActiveDay = baseUserActiveDayMapper.selectByUdidAndAppKey(request.getUdid(), appKey);
activeUnion.info("check android active info in 90 days. udid is {} and app_key is {},yesterday is {} and result is {}", request.getUdid(), appKey, yesterday, baseUserActiveDay);
if (CollectionUtils.isNotEmpty(activateUdidLists)){
if (baseUserActiveDay!=null){
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);
}
... ...
... ... @@ -27,6 +27,7 @@ datasources:
daos:
- com.yoho.unions.dal.IAppActivateIdfaListDAO
- com.yoho.unions.dal.IAppActivateUdidListDAO
- com.yoho.unions.dal.BaseUserActiveDayMapper
yh_unions:
servers:
... ...
... ... @@ -28,6 +28,7 @@ datasources:
daos:
- com.yoho.unions.dal.IAppActivateIdfaListDAO
- com.yoho.unions.dal.IAppActivateUdidListDAO
- com.yoho.unions.dal.BaseUserActiveDayMapper
yh_unions:
servers:
... ...