Authored by zhengwen.ge

数据修复

... ... @@ -48,6 +48,7 @@
<value>/ClickUnionRest/addUnion4Jump/goandroid</value>
<value>/PayChannelRest/getChannelType</value>
<value>/UnionRest/addBigData</value>
<value>/UnionRest/cleanUnionLogs</value>
<value>/tencentMkt/TencentMktController/sendSms</value>
<value>/tencentMkt/TencentMktController/getActivityInfo</value>
<value>/tencentMkt/TencentMktController/validRegCodeAndSendCode</value>
... ...
... ... @@ -7,4 +7,6 @@ import org.apache.ibatis.annotations.Param;
public interface BaseUserActiveDayMapper {
BaseUserActiveDay selectByUdidAndAppKey(@Param("udid")String udid,@Param("appKey")String appKey);
BaseUserActiveDay selectByUdidAndAppKeyDate(@Param("udid")String udid,@Param("appKey")String appKey,@Param("end_date")int end_date);
}
\ No newline at end of file
... ...
... ... @@ -44,4 +44,7 @@ public interface IUnionLogsDAO {
List<UnionLogs> selectListByHour(ActivateDeviceIdReqBO activateDeviceIdReqBO);
List<YHActivateDeviceIdRspBO> selectYHListByParam(@Param("yhActivateDeviceIdReqBO") YHActivateDeviceIdReqBO yhActivateDeviceIdReqBO, @Param("list") List<String> unionTypes);
List<UnionLogs> selectByBeginAndEnd(@Param("beginTime") int beginTime,@Param("endTime") int endTime);
}
... ...
... ... @@ -12,4 +12,7 @@
select * from base_user_active_day where udid=#{udid} and app_key = #{appKey} limit 1
</select>
<select id="selectByUdidAndAppKeyDate" resultMap="BaseResultMap">
select * from base_user_active_day where udid=#{udid} and app_key = #{appKey} and date_id &lt;#{end_date} limit 1
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -226,4 +226,9 @@
</if>
group by union_type
</select>
<select id="selectByBeginAndEnd" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from union_logs where create_time &lt;=#{endTime} and create_time &gt;= #{beginTime}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -84,6 +84,14 @@ public class UnionRest {
return response;
}
@RequestMapping(value = "/cleanUnionLogs")
@ResponseBody
public UnionResponseBO cleanUnionLogs(int beginTime,int endTime){
log.info("enter cleanUnionLogs,beginTimeis {},endTime is {}",beginTime,endTime);
UnionResponseBO response = dingdangService.cleanBigData(beginTime,endTime);
return response;
}
/**
* 资讯下载,上报yas
* @param request
... ...
... ... @@ -34,5 +34,7 @@ public interface DingdangService {
UnionResponseBO addBigData(int beginTime,int endTime);
UnionResponseBO cleanBigData(int beginTime,int endTime);
UnionResponse addYas(ClickUnionRequestBO request);
}
... ...
... ... @@ -16,14 +16,8 @@ import com.yoho.unions.common.redis.RedisValueCache;
import com.yoho.unions.common.utils.DateUtil;
import com.yoho.unions.common.utils.HttpUtils;
import com.yoho.unions.common.utils.RandomUtil;
import com.yoho.unions.dal.IMktMarketingUrlDAO;
import com.yoho.unions.dal.IUnionActivityLogsDAO;
import com.yoho.unions.dal.IUnionClickLogsDAO;
import com.yoho.unions.dal.IUnionsActiveRecordDAO;
import com.yoho.unions.dal.model.MktMarketingUrl;
import com.yoho.unions.dal.model.UnionActivityLogs;
import com.yoho.unions.dal.model.UnionClickLogs;
import com.yoho.unions.dal.model.UnionsActiveRecord;
import com.yoho.unions.dal.*;
import com.yoho.unions.dal.model.*;
import com.yoho.unions.server.service.DingdangService;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
... ... @@ -65,6 +59,12 @@ public class DingdangServiceImpl implements DingdangService {
@Resource
IMktMarketingUrlDAO mktMarketingUrlDAO;
@Resource
IUnionLogsDAO unionLogsDAO;
@Resource
BaseUserActiveDayMapper baseUserActiveDayMapper;
private static final String unions_KEY = "yh:unions:dingdang_";
static final String yasUrl = "http://analytics.m.yohobuy.com/yas.gif/web/";
... ... @@ -352,6 +352,39 @@ public class DingdangServiceImpl implements DingdangService {
}
@Override
public UnionResponseBO cleanBigData(int beginTime,int endTime){
try{
//查出那段时间内的激活
List<UnionLogs> unionLogsList = unionLogsDAO.selectByBeginAndEnd(beginTime, endTime);
for(UnionLogs unionLogs:unionLogsList){
//取出udid
String udid = unionLogs.getUdid();
String client_type = unionLogs.getClientType();
String app_key = "yohobuy_ios";
int id = unionLogs.getId();
String endDate = DateUtil.long2DateStr(Long.valueOf(beginTime)*Long.valueOf(1000),"yyyyMMdd");
if(client_type.equals("ios")){
app_key = "yohobuy_ios";
}else{
app_key = "yohobuy_android";
}
BaseUserActiveDay baseUserActiveDay = baseUserActiveDayMapper.selectByUdidAndAppKeyDate(udid, app_key,Integer.valueOf(endDate));
if(null!=baseUserActiveDay){
log.info("deleteUnionLogs udid is {}",udid);
unionLogsDAO.deleteByPrimaryKey(id);
}
}
}catch (Exception e){
log.warn("cleanBigData exception is {}",e);
}
UnionResponseBO response = new UnionResponseBO();
response.setIsSuccess(true);
return response;
}
@Override
public UnionResponse addYas(ClickUnionRequestBO request){
String unionType = request.getUnion_type();
... ...