Merge branch 'FSHJOB1.2' into 'master'
非注册用户统计脚本修改 See merge request !22
This commit is contained in:
+16
-4
@@ -1,6 +1,5 @@
|
||||
package com.fangjia.job.youfang.job;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -21,6 +20,7 @@ import com.fangjia.job.common.util.DateUtilCustom;
|
||||
import com.fangjia.job.common.util.DingDingMessageUtil;
|
||||
import com.fangjia.job.youfang.document.PageLog;
|
||||
import com.fangjia.job.youfang.document.UnregisterUser;
|
||||
import com.fangjia.job.youfang.po.EnterpriseProductUser;
|
||||
import com.fangjia.job.youfang.service.EnterpriseProductUserService;
|
||||
import com.fangjia.job.youfang.service.PageLogService;
|
||||
/**
|
||||
@@ -49,8 +49,10 @@ public class UnregisterUserJob implements SimpleJob {
|
||||
try {
|
||||
logger.info("开始统计非注册用户");
|
||||
Map<String, String> dateMap = DateUtilCustom.getYesterday();
|
||||
Date start = DateUtils.str2Date(dateMap.get("start"));
|
||||
Date end = DateUtils.str2Date(dateMap.get("end"));
|
||||
String s = dateMap.get("start");
|
||||
String e = dateMap.get("end");
|
||||
Date start = DateUtils.str2Date(s);
|
||||
Date end = DateUtils.str2Date(e);
|
||||
Long count = pageLogService.queryForCount(start, end);
|
||||
logger.info("总数量:" + count);
|
||||
int pages = PageBean.calcPages(count, 1000);
|
||||
@@ -68,8 +70,18 @@ public class UnregisterUserJob implements SimpleJob {
|
||||
mongoTemplate.save(data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 查出昨日新注册的用户,如果之前在未注册当中就移除
|
||||
List<EnterpriseProductUser> users = enterpriseProductUserService.queryAddUser(s, e);
|
||||
for (EnterpriseProductUser user : users) {
|
||||
Query q = Query.query(Criteria.where("pid").is(user.getPushClientId()));
|
||||
boolean exists = mongoTemplate.exists(q, UnregisterUser.class);
|
||||
if (exists) {
|
||||
mongoTemplate.remove(q, UnregisterUser.class);
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("处理结束");
|
||||
} catch (Exception e) {
|
||||
logger.error("根据PV日志统计出未注册的用户设备信息和推送信息异常", e);
|
||||
|
||||
+2
@@ -42,4 +42,6 @@ public interface EnterpriseProductUserService {
|
||||
* @return
|
||||
*/
|
||||
boolean existsByPushId(String pushID);
|
||||
|
||||
List<EnterpriseProductUser> queryAddUser(String start, String end);
|
||||
}
|
||||
|
||||
+6
@@ -36,4 +36,10 @@ public class EnterpriseProductUserServiceImpl extends EntityService<EnterprisePr
|
||||
return super.exists("push_client_id", pushID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnterpriseProductUser> queryAddUser(String start, String end) {
|
||||
String sql = "select push_client_id from enterprise_product_user where add_time between ? and ?";
|
||||
return super.list(sql, new Object[] { start, end });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user