Showing
8 changed files
with
65 additions
and
8 deletions
@@ -48,6 +48,7 @@ | @@ -48,6 +48,7 @@ | ||
48 | <value>/ClickUnionRest/addUnion4Jump/goandroid</value> | 48 | <value>/ClickUnionRest/addUnion4Jump/goandroid</value> |
49 | <value>/PayChannelRest/getChannelType</value> | 49 | <value>/PayChannelRest/getChannelType</value> |
50 | <value>/UnionRest/addBigData</value> | 50 | <value>/UnionRest/addBigData</value> |
51 | + <value>/UnionRest/cleanUnionLogs</value> | ||
51 | <value>/tencentMkt/TencentMktController/sendSms</value> | 52 | <value>/tencentMkt/TencentMktController/sendSms</value> |
52 | <value>/tencentMkt/TencentMktController/getActivityInfo</value> | 53 | <value>/tencentMkt/TencentMktController/getActivityInfo</value> |
53 | <value>/tencentMkt/TencentMktController/validRegCodeAndSendCode</value> | 54 | <value>/tencentMkt/TencentMktController/validRegCodeAndSendCode</value> |
@@ -7,4 +7,6 @@ import org.apache.ibatis.annotations.Param; | @@ -7,4 +7,6 @@ import org.apache.ibatis.annotations.Param; | ||
7 | public interface BaseUserActiveDayMapper { | 7 | public interface BaseUserActiveDayMapper { |
8 | 8 | ||
9 | BaseUserActiveDay selectByUdidAndAppKey(@Param("udid")String udid,@Param("appKey")String appKey); | 9 | BaseUserActiveDay selectByUdidAndAppKey(@Param("udid")String udid,@Param("appKey")String appKey); |
10 | + | ||
11 | + BaseUserActiveDay selectByUdidAndAppKeyDate(@Param("udid")String udid,@Param("appKey")String appKey,@Param("end_date")int end_date); | ||
10 | } | 12 | } |
@@ -44,4 +44,7 @@ public interface IUnionLogsDAO { | @@ -44,4 +44,7 @@ public interface IUnionLogsDAO { | ||
44 | List<UnionLogs> selectListByHour(ActivateDeviceIdReqBO activateDeviceIdReqBO); | 44 | List<UnionLogs> selectListByHour(ActivateDeviceIdReqBO activateDeviceIdReqBO); |
45 | 45 | ||
46 | List<YHActivateDeviceIdRspBO> selectYHListByParam(@Param("yhActivateDeviceIdReqBO") YHActivateDeviceIdReqBO yhActivateDeviceIdReqBO, @Param("list") List<String> unionTypes); | 46 | List<YHActivateDeviceIdRspBO> selectYHListByParam(@Param("yhActivateDeviceIdReqBO") YHActivateDeviceIdReqBO yhActivateDeviceIdReqBO, @Param("list") List<String> unionTypes); |
47 | + | ||
48 | + List<UnionLogs> selectByBeginAndEnd(@Param("beginTime") int beginTime,@Param("endTime") int endTime); | ||
49 | + | ||
47 | } | 50 | } |
@@ -12,4 +12,7 @@ | @@ -12,4 +12,7 @@ | ||
12 | select * from base_user_active_day where udid=#{udid} and app_key = #{appKey} limit 1 | 12 | select * from base_user_active_day where udid=#{udid} and app_key = #{appKey} limit 1 |
13 | </select> | 13 | </select> |
14 | 14 | ||
15 | + <select id="selectByUdidAndAppKeyDate" resultMap="BaseResultMap"> | ||
16 | + select * from base_user_active_day where udid=#{udid} and app_key = #{appKey} and date_id <#{end_date} limit 1 | ||
17 | + </select> | ||
15 | </mapper> | 18 | </mapper> |
@@ -226,4 +226,9 @@ | @@ -226,4 +226,9 @@ | ||
226 | </if> | 226 | </if> |
227 | group by union_type | 227 | group by union_type |
228 | </select> | 228 | </select> |
229 | + | ||
230 | + <select id="selectByBeginAndEnd" resultMap="BaseResultMap"> | ||
231 | + select <include refid="Base_Column_List"/> | ||
232 | + from union_logs where create_time <=#{endTime} and create_time >= #{beginTime} | ||
233 | + </select> | ||
229 | </mapper> | 234 | </mapper> |
@@ -84,6 +84,14 @@ public class UnionRest { | @@ -84,6 +84,14 @@ public class UnionRest { | ||
84 | return response; | 84 | return response; |
85 | } | 85 | } |
86 | 86 | ||
87 | + @RequestMapping(value = "/cleanUnionLogs") | ||
88 | + @ResponseBody | ||
89 | + public UnionResponseBO cleanUnionLogs(int beginTime,int endTime){ | ||
90 | + log.info("enter cleanUnionLogs,beginTimeis {},endTime is {}",beginTime,endTime); | ||
91 | + UnionResponseBO response = dingdangService.cleanBigData(beginTime,endTime); | ||
92 | + return response; | ||
93 | + } | ||
94 | + | ||
87 | /** | 95 | /** |
88 | * 资讯下载,上报yas | 96 | * 资讯下载,上报yas |
89 | * @param request | 97 | * @param request |
@@ -34,5 +34,7 @@ public interface DingdangService { | @@ -34,5 +34,7 @@ public interface DingdangService { | ||
34 | 34 | ||
35 | UnionResponseBO addBigData(int beginTime,int endTime); | 35 | UnionResponseBO addBigData(int beginTime,int endTime); |
36 | 36 | ||
37 | + UnionResponseBO cleanBigData(int beginTime,int endTime); | ||
38 | + | ||
37 | UnionResponse addYas(ClickUnionRequestBO request); | 39 | UnionResponse addYas(ClickUnionRequestBO request); |
38 | } | 40 | } |
@@ -16,14 +16,8 @@ import com.yoho.unions.common.redis.RedisValueCache; | @@ -16,14 +16,8 @@ import com.yoho.unions.common.redis.RedisValueCache; | ||
16 | import com.yoho.unions.common.utils.DateUtil; | 16 | import com.yoho.unions.common.utils.DateUtil; |
17 | import com.yoho.unions.common.utils.HttpUtils; | 17 | import com.yoho.unions.common.utils.HttpUtils; |
18 | import com.yoho.unions.common.utils.RandomUtil; | 18 | import com.yoho.unions.common.utils.RandomUtil; |
19 | -import com.yoho.unions.dal.IMktMarketingUrlDAO; | ||
20 | -import com.yoho.unions.dal.IUnionActivityLogsDAO; | ||
21 | -import com.yoho.unions.dal.IUnionClickLogsDAO; | ||
22 | -import com.yoho.unions.dal.IUnionsActiveRecordDAO; | ||
23 | -import com.yoho.unions.dal.model.MktMarketingUrl; | ||
24 | -import com.yoho.unions.dal.model.UnionActivityLogs; | ||
25 | -import com.yoho.unions.dal.model.UnionClickLogs; | ||
26 | -import com.yoho.unions.dal.model.UnionsActiveRecord; | 19 | +import com.yoho.unions.dal.*; |
20 | +import com.yoho.unions.dal.model.*; | ||
27 | import com.yoho.unions.server.service.DingdangService; | 21 | import com.yoho.unions.server.service.DingdangService; |
28 | import org.apache.commons.lang.StringUtils; | 22 | import org.apache.commons.lang.StringUtils; |
29 | import org.apache.commons.lang3.tuple.Pair; | 23 | import org.apache.commons.lang3.tuple.Pair; |
@@ -64,6 +58,12 @@ public class DingdangServiceImpl implements DingdangService { | @@ -64,6 +58,12 @@ public class DingdangServiceImpl implements DingdangService { | ||
64 | 58 | ||
65 | @Resource | 59 | @Resource |
66 | IMktMarketingUrlDAO mktMarketingUrlDAO; | 60 | IMktMarketingUrlDAO mktMarketingUrlDAO; |
61 | + | ||
62 | + @Resource | ||
63 | + IUnionLogsDAO unionLogsDAO; | ||
64 | + | ||
65 | + @Resource | ||
66 | + BaseUserActiveDayMapper baseUserActiveDayMapper; | ||
67 | 67 | ||
68 | private static final String unions_KEY = "yh:unions:dingdang_"; | 68 | private static final String unions_KEY = "yh:unions:dingdang_"; |
69 | 69 | ||
@@ -352,6 +352,39 @@ public class DingdangServiceImpl implements DingdangService { | @@ -352,6 +352,39 @@ public class DingdangServiceImpl implements DingdangService { | ||
352 | } | 352 | } |
353 | 353 | ||
354 | @Override | 354 | @Override |
355 | + public UnionResponseBO cleanBigData(int beginTime,int endTime){ | ||
356 | + try{ | ||
357 | + //查出那段时间内的激活 | ||
358 | + List<UnionLogs> unionLogsList = unionLogsDAO.selectByBeginAndEnd(beginTime, endTime); | ||
359 | + for(UnionLogs unionLogs:unionLogsList){ | ||
360 | + //取出udid | ||
361 | + String udid = unionLogs.getUdid(); | ||
362 | + String client_type = unionLogs.getClientType(); | ||
363 | + String app_key = "yohobuy_ios"; | ||
364 | + int id = unionLogs.getId(); | ||
365 | + String endDate = DateUtil.long2DateStr(Long.valueOf(beginTime)*Long.valueOf(1000),"yyyyMMdd"); | ||
366 | + | ||
367 | + if(client_type.equals("ios")){ | ||
368 | + app_key = "yohobuy_ios"; | ||
369 | + }else{ | ||
370 | + app_key = "yohobuy_android"; | ||
371 | + } | ||
372 | + BaseUserActiveDay baseUserActiveDay = baseUserActiveDayMapper.selectByUdidAndAppKeyDate(udid, app_key,Integer.valueOf(endDate)); | ||
373 | + if(null!=baseUserActiveDay){ | ||
374 | + log.info("deleteUnionLogs udid is {}",udid); | ||
375 | + unionLogsDAO.deleteByPrimaryKey(id); | ||
376 | + } | ||
377 | + } | ||
378 | + | ||
379 | + }catch (Exception e){ | ||
380 | + log.warn("cleanBigData exception is {}",e); | ||
381 | + } | ||
382 | + UnionResponseBO response = new UnionResponseBO(); | ||
383 | + response.setIsSuccess(true); | ||
384 | + return response; | ||
385 | + } | ||
386 | + | ||
387 | + @Override | ||
355 | public UnionResponse addYas(ClickUnionRequestBO request){ | 388 | public UnionResponse addYas(ClickUnionRequestBO request){ |
356 | 389 | ||
357 | String unionType = request.getUnion_type(); | 390 | String unionType = request.getUnion_type(); |
-
Please register or login to post a comment