|
|
@@ -51,10 +51,6 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
put(17, 3);//快小
|
|
|
}};
|
|
|
|
|
|
- private static final Map<String, String> clientDomain2AppId = new HashMap<String, String>() {{
|
|
|
- put("10003129" + "14", "dzdyIAP");//抖小
|
|
|
- }};
|
|
|
-
|
|
|
private static final Map<String, String> media2Id = new HashMap<String, String>() {{
|
|
|
put("adq", "3");//腾讯广点通
|
|
|
put("dy", "1");//字节巨量
|
|
|
@@ -148,19 +144,12 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
String line;
|
|
|
while ((line = reader.readLine()) != null) {
|
|
|
if ("user".equals(type)) {
|
|
|
- JSONObject dzUser = getDZUser(line, clientId);
|
|
|
- dorisLoadManager.add("hr_playlet", "user_event", dzUser);
|
|
|
- JSONObject dzLogin = getDZLogin(line, clientId);
|
|
|
- dorisLoadManager.add("hr_playlet", "server_event", dzLogin);
|
|
|
- JSONObject dzActivation = getDZActivation(line, clientId);
|
|
|
- dorisLoadManager.add("hr_playlet", "server_event", dzActivation);
|
|
|
- JSONObject dzRegister = getDZRegister(line, clientId);
|
|
|
- if (statDate.replace("-", "").equals(dzRegister.getString("stat_date"))) {
|
|
|
- dorisLoadManager.add("hr_playlet", "server_event", dzRegister);
|
|
|
- }
|
|
|
+ getDZUser(line);
|
|
|
+ getDZLogin(line);
|
|
|
+ getDZActivation(line);
|
|
|
+ getDZRegister(line, statDate);
|
|
|
} else if ("order".equals(type)) {
|
|
|
- JSONObject dzOrder = getDZOrder(line, clientId);
|
|
|
- dorisLoadManager.add("hr_playlet", "server_event", dzOrder);
|
|
|
+ getDZOrder(line);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -175,11 +164,15 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
return SecureUtil.md5(clientId + token + timeStamp).toLowerCase();
|
|
|
}
|
|
|
|
|
|
- private JSONObject getDZUser(String line, String clientId) {
|
|
|
+ private void getDZUser(String line) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(line);
|
|
|
+ String channelId = jsonObject.getString("channelId");
|
|
|
+ String appIdByChannelId = cacheService.getDZAppIdByChannelId(channelId);
|
|
|
+ if (StringUtils.isBlank(appIdByChannelId)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
JSONObject userJson = new JSONObject();
|
|
|
int domain = jsonObject.getIntValue("domain");
|
|
|
- String appId = clientId + domain;
|
|
|
Long ctime = jsonObject.getLong("ctime");
|
|
|
String statDate = DateUtils.formatDate(ctime * 1000, "yyyyMMdd");
|
|
|
String registerTime = DateUtils.formatDate(ctime * 1000, "yyyy-MM-dd HH:mm:ss");
|
|
|
@@ -189,7 +182,7 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
Long dyeTime = jsonObject.getLong("dyeTime");
|
|
|
String activationTime = DateUtils.formatDate(dyeTime * 1000, "yyyy-MM-dd HH:mm:ss");
|
|
|
String fromMedia = jsonObject.getString("from");
|
|
|
- userJson.put("app_id", clientDomain2AppId.getOrDefault(appId, appId));
|
|
|
+ userJson.put("app_id", appIdByChannelId);
|
|
|
userJson.put("uid", jsonObject.getString("userId"));
|
|
|
userJson.put("stat_date", statDate);
|
|
|
userJson.put("register_time", registerTime);
|
|
|
@@ -197,7 +190,7 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
userJson.put("open_id", jsonObject.getString("openId"));
|
|
|
userJson.put("platform", domain2Platform.getOrDefault(domain, domain));
|
|
|
userJson.put("official_account_open_id", jsonObject.getString("thirdWxId"));
|
|
|
- userJson.put("channel_id", jsonObject.getString("channelId"));
|
|
|
+ userJson.put("channel_id", channelId);
|
|
|
userJson.put("link_id", jsonObject.getString("referralId"));
|
|
|
userJson.put("expiration_time", jsonObject.getString("vipEndDate"));
|
|
|
userJson.put("pay_amount", jsonObject.getString("payAmount"));
|
|
|
@@ -219,15 +212,18 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
userJson.put("advertiser_id", advertiserId);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- return userJson;
|
|
|
+ dorisLoadManager.add("hr_playlet", "user_event", userJson);
|
|
|
}
|
|
|
|
|
|
- private JSONObject getDZLogin(String line, String clientId) {
|
|
|
+ private void getDZLogin(String line) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(line);
|
|
|
+ String channelId = jsonObject.getString("channelId");
|
|
|
+ String appIdByChannelId = cacheService.getDZAppIdByChannelId(channelId);
|
|
|
+ if (StringUtils.isBlank(appIdByChannelId)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
JSONObject loginJson = new JSONObject();
|
|
|
int domain = jsonObject.getIntValue("domain");
|
|
|
- String appId = clientId + domain;
|
|
|
Long loginTime = jsonObject.getLong("loginTime");
|
|
|
String statDate = DateUtils.formatDate(loginTime * 1000, "yyyyMMdd");
|
|
|
String adId = jsonObject.getString("adid");
|
|
|
@@ -236,21 +232,25 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
Long dyeTime = jsonObject.getLong("dyeTime");
|
|
|
String activationTime = DateUtils.formatDate(dyeTime * 1000, "yyyy-MM-dd HH:mm:ss");
|
|
|
String activationDate = DateUtils.formatDate(dyeTime * 1000, "yyyyMMdd");
|
|
|
+ Long ctime = jsonObject.getLong("ctime");
|
|
|
+ String registerTime = DateUtils.formatDate(ctime * 1000, "yyyy-MM-dd HH:mm:ss");
|
|
|
+ String registerDate = DateUtils.formatDate(ctime * 1000, "yyyyMMdd");
|
|
|
String fromMedia = jsonObject.getString("from");
|
|
|
String userId = jsonObject.getString("userId");
|
|
|
+ loginJson.put("app_id", appIdByChannelId);
|
|
|
loginJson.put("stat_date", statDate);
|
|
|
loginJson.put("event", "LOGIN");
|
|
|
loginJson.put("event_pk", SecureUtil.md5(String.format("dianzhong_login_%s_%s", userId, loginTime)));
|
|
|
loginJson.put("event_tag", "dianzhong_login");
|
|
|
- loginJson.put("app_id", clientDomain2AppId.getOrDefault(appId, appId));
|
|
|
loginJson.put("activation_date", activationDate);
|
|
|
loginJson.put("uid", userId);
|
|
|
loginJson.put("open_id", jsonObject.getString("openId"));
|
|
|
loginJson.put("platform", domain2Platform.getOrDefault(domain, domain));
|
|
|
loginJson.put("official_account_open_id", jsonObject.getString("thirdWxId"));
|
|
|
- loginJson.put("channel_id", jsonObject.getString("channelId"));
|
|
|
+ loginJson.put("channel_id", channelId);
|
|
|
loginJson.put("link_id", jsonObject.getString("referralId"));
|
|
|
- loginJson.put("register_date", jsonObject.getString("ctime"));
|
|
|
+ loginJson.put("register_date", registerDate);
|
|
|
+ loginJson.put("register_time", registerTime);
|
|
|
loginJson.put("expiration_time", jsonObject.getString("vipEndDate"));
|
|
|
loginJson.put("last_login_time", jsonObject.getString("loginTime"));
|
|
|
loginJson.put("created_at", loginTime);
|
|
|
@@ -270,14 +270,18 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
loginJson.put("advertiser_id", advertiserId);
|
|
|
}
|
|
|
}
|
|
|
- return loginJson;
|
|
|
+ dorisLoadManager.add("hr_playlet", "server_event", loginJson);
|
|
|
}
|
|
|
|
|
|
- private JSONObject getDZActivation(String line, String clientId) {
|
|
|
+ private void getDZActivation(String line) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(line);
|
|
|
+ String channelId = jsonObject.getString("channelId");
|
|
|
+ String appIdByChannelId = cacheService.getDZAppIdByChannelId(channelId);
|
|
|
+ if (StringUtils.isBlank(appIdByChannelId)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
JSONObject loginJson = new JSONObject();
|
|
|
int domain = jsonObject.getIntValue("domain");
|
|
|
- String appId = clientId + domain;
|
|
|
Long loginTime = jsonObject.getLong("loginTime");
|
|
|
String adId = jsonObject.getString("adid");
|
|
|
String promotionId = jsonObject.getString("promotionId");
|
|
|
@@ -285,21 +289,25 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
Long dyeTime = jsonObject.getLong("dyeTime");
|
|
|
String statDate = DateUtils.formatDate(dyeTime * 1000, "yyyyMMdd");
|
|
|
String activationTime = DateUtils.formatDate(dyeTime * 1000, "yyyy-MM-dd HH:mm:ss");
|
|
|
+ Long ctime = jsonObject.getLong("ctime");
|
|
|
+ String registerTime = DateUtils.formatDate(ctime * 1000, "yyyy-MM-dd HH:mm:ss");
|
|
|
+ String registerDate = DateUtils.formatDate(ctime * 1000, "yyyyMMdd");
|
|
|
String fromMedia = jsonObject.getString("from");
|
|
|
String userId = jsonObject.getString("userId");
|
|
|
+ loginJson.put("app_id", appIdByChannelId);
|
|
|
loginJson.put("stat_date", statDate);
|
|
|
loginJson.put("event", "ACTIVATION");
|
|
|
loginJson.put("event_pk", SecureUtil.md5(String.format("dianzhong_activation_%s_%s", userId, dyeTime)));
|
|
|
loginJson.put("event_tag", "dianzhong_activation");
|
|
|
- loginJson.put("app_id", clientDomain2AppId.getOrDefault(appId, appId));
|
|
|
loginJson.put("activation_date", statDate);
|
|
|
loginJson.put("uid", userId);
|
|
|
loginJson.put("open_id", jsonObject.getString("openId"));
|
|
|
loginJson.put("platform", domain2Platform.getOrDefault(domain, domain));
|
|
|
loginJson.put("official_account_open_id", jsonObject.getString("thirdWxId"));
|
|
|
- loginJson.put("channel_id", jsonObject.getString("channelId"));
|
|
|
+ loginJson.put("channel_id", channelId);
|
|
|
loginJson.put("link_id", jsonObject.getString("referralId"));
|
|
|
- loginJson.put("register_date", jsonObject.getString("ctime"));
|
|
|
+ loginJson.put("register_date", registerDate);
|
|
|
+ loginJson.put("register_time", registerTime);
|
|
|
loginJson.put("expiration_time", jsonObject.getString("vipEndDate"));
|
|
|
loginJson.put("last_login_time", jsonObject.getString("loginTime"));
|
|
|
loginJson.put("created_at", loginTime);
|
|
|
@@ -319,14 +327,18 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
loginJson.put("advertiser_id", advertiserId);
|
|
|
}
|
|
|
}
|
|
|
- return loginJson;
|
|
|
+ dorisLoadManager.add("hr_playlet", "server_event", loginJson);
|
|
|
}
|
|
|
|
|
|
- private JSONObject getDZRegister(String line, String clientId) {
|
|
|
+ private void getDZRegister(String line, String date) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(line);
|
|
|
+ String channelId = jsonObject.getString("channelId");
|
|
|
+ String appIdByChannelId = cacheService.getDZAppIdByChannelId(channelId);
|
|
|
+ if (StringUtils.isBlank(appIdByChannelId)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
JSONObject loginJson = new JSONObject();
|
|
|
int domain = jsonObject.getIntValue("domain");
|
|
|
- String appId = clientId + domain;
|
|
|
Long ctime = jsonObject.getLong("ctime");
|
|
|
String statDate = DateUtils.formatDate(ctime * 1000, "yyyyMMdd");
|
|
|
Long loginTime = jsonObject.getLong("loginTime");
|
|
|
@@ -336,21 +348,24 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
Long dyeTime = jsonObject.getLong("dyeTime");
|
|
|
String activationTime = DateUtils.formatDate(dyeTime * 1000, "yyyy-MM-dd HH:mm:ss");
|
|
|
String activationDate = DateUtils.formatDate(dyeTime * 1000, "yyyyMMdd");
|
|
|
+ String registerTime = DateUtils.formatDate(ctime * 1000, "yyyy-MM-dd HH:mm:ss");
|
|
|
+ String registerDate = DateUtils.formatDate(ctime * 1000, "yyyyMMdd");
|
|
|
String fromMedia = jsonObject.getString("from");
|
|
|
String userId = jsonObject.getString("userId");
|
|
|
+ loginJson.put("app_id", appIdByChannelId);
|
|
|
loginJson.put("stat_date", statDate);
|
|
|
loginJson.put("event", "REGISTER");
|
|
|
loginJson.put("event_pk", SecureUtil.md5(String.format("dianzhong_register_%s_%s", userId, ctime)));
|
|
|
loginJson.put("event_tag", "dianzhong_register");
|
|
|
- loginJson.put("app_id", clientDomain2AppId.getOrDefault(appId, appId));
|
|
|
loginJson.put("activation_date", activationDate);
|
|
|
loginJson.put("uid", userId);
|
|
|
loginJson.put("open_id", jsonObject.getString("openId"));
|
|
|
loginJson.put("platform", domain2Platform.getOrDefault(domain, domain));
|
|
|
loginJson.put("official_account_open_id", jsonObject.getString("thirdWxId"));
|
|
|
- loginJson.put("channel_id", jsonObject.getString("channelId"));
|
|
|
+ loginJson.put("channel_id", channelId);
|
|
|
loginJson.put("link_id", jsonObject.getString("referralId"));
|
|
|
- loginJson.put("register_date", jsonObject.getString("ctime"));
|
|
|
+ loginJson.put("register_date", registerDate);
|
|
|
+ loginJson.put("register_time", registerTime);
|
|
|
loginJson.put("expiration_time", jsonObject.getString("vipEndDate"));
|
|
|
loginJson.put("last_login_time", jsonObject.getString("loginTime"));
|
|
|
loginJson.put("created_at", loginTime);
|
|
|
@@ -370,15 +385,22 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
loginJson.put("advertiser_id", advertiserId);
|
|
|
}
|
|
|
}
|
|
|
- return loginJson;
|
|
|
+ if (date.replace("-", "").equals(statDate)) {
|
|
|
+ dorisLoadManager.add("hr_playlet", "server_event", loginJson);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- private JSONObject getDZOrder(String line, String clientId) {
|
|
|
+ private void getDZOrder(String line) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(line);
|
|
|
JSONObject orderJson = new JSONObject();
|
|
|
+ String channelId = jsonObject.getString("channelId");
|
|
|
+ String appIdByChannelId = cacheService.getDZAppIdByChannelId(channelId);
|
|
|
+ if (StringUtils.isBlank(appIdByChannelId)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
String orderId = jsonObject.getString("id");
|
|
|
int domain = jsonObject.getIntValue("domain");
|
|
|
- String appId = clientId + domain;
|
|
|
Long ctime = jsonObject.getLong("ctime");
|
|
|
String statDate = DateUtils.formatDate(ctime * 1000, "yyyyMMdd");
|
|
|
String adId = jsonObject.getString("adid");
|
|
|
@@ -387,12 +409,15 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
Long dyeTime = jsonObject.getLong("dyeTime");
|
|
|
String activationTime = DateUtils.formatDate(dyeTime * 1000, "yyyy-MM-dd HH:mm:ss");
|
|
|
String activationDate = DateUtils.formatDate(dyeTime * 1000, "yyyyMMdd");
|
|
|
+ Long registerT = jsonObject.getLong("registerDate");
|
|
|
+ String registerTime = DateUtils.formatDate(registerT * 1000, "yyyy-MM-dd HH:mm:ss");
|
|
|
+ String registerDate = DateUtils.formatDate(registerT * 1000, "yyyyMMdd");
|
|
|
String fromMedia = jsonObject.getString("from");
|
|
|
+ orderJson.put("app_id", appIdByChannelId);
|
|
|
orderJson.put("stat_date", statDate);
|
|
|
orderJson.put("event", "PAY");
|
|
|
orderJson.put("event_pk", SecureUtil.md5("dianzhong_order_id:" + orderId));
|
|
|
orderJson.put("event_tag", "dianzhong_order");
|
|
|
- orderJson.put("app_id", clientDomain2AppId.getOrDefault(appId, appId));
|
|
|
orderJson.put("order_no", orderId);
|
|
|
orderJson.put("platform_order_no", jsonObject.getString("outTradeNo"));
|
|
|
orderJson.put("total_fee", jsonObject.getString("discount"));
|
|
|
@@ -401,12 +426,13 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
orderJson.put("created_at", ctime);
|
|
|
orderJson.put("pay_time", jsonObject.getLong("finishTime"));
|
|
|
orderJson.put("uid", jsonObject.getString("userId"));
|
|
|
- orderJson.put("channel_id", jsonObject.getString("channelId"));
|
|
|
+ orderJson.put("channel_id", channelId);
|
|
|
orderJson.put("platform", domain2Platform.getOrDefault(domain, domain));
|
|
|
orderJson.put("video_id", jsonObject.getString("sourceInfo"));
|
|
|
orderJson.put("video_detail_id", jsonObject.getString("chapterId"));
|
|
|
orderJson.put("video_name", jsonObject.getString("sourceDesc"));
|
|
|
- orderJson.put("register_date", jsonObject.getString("registerDate"));
|
|
|
+ orderJson.put("register_date", registerDate);
|
|
|
+ orderJson.put("register_time", registerTime);
|
|
|
orderJson.put("open_id", jsonObject.getString("openId"));
|
|
|
orderJson.put("mobile_system", jsonObject.getIntValue("os") == 0 ? "Android" : "ios");
|
|
|
orderJson.put("link_id", jsonObject.getString("referralId"));
|
|
|
@@ -430,6 +456,6 @@ public class DianZhongServiceImpl implements IDianZhongService {
|
|
|
orderJson.put("advertiser_id", advertiserId);
|
|
|
}
|
|
|
}
|
|
|
- return orderJson;
|
|
|
+ dorisLoadManager.add("hr_playlet", "server_event", orderJson);
|
|
|
}
|
|
|
}
|