Commit c3a0207b authored by she's avatar she

ios 订单数据

parent 1aaa4078
......@@ -90,7 +90,7 @@ public class AppsflyerAdmapping {
.name("tiktok");
//测流提取出来激活,登录,创角角色登录,订单事件
adEventDataStream.process(new MutiplatDataProcess()).filter(EventTypeEnum::loginEvent).process(new GameAdMappingProcessor(appConfig)).name("admapping").uid("admapping");
adEventDataStream.process(new MutiplatDataProcess()).filter(EventTypeEnum::installEvent).process(new GameAdMappingProcessor(appConfig)).name("admapping").uid("admapping");
//
sse.execute("appsflyer-admapping");
......
......@@ -37,7 +37,7 @@ public interface GameMappingDao {
@RegisterRowMapper(MediaMapper.class)
Optional<Media> findMediaByPrimary(@BindBean AppsFlyerEvent value);
@SqlUpdate("insert into media (`af_media_id`) values (:media_source)")
@SqlUpdate("insert into media (`af_media_id`,`name`) values (:media_source,:media_source)")
@RegisterRowMapper(MediaMapper.class)
void saveMediaSource(@BindBean AppsFlyerEvent value);
......
......@@ -72,7 +72,12 @@ public class GameAdMappingProcessor extends ProcessFunction<AppsFlyerEvent, Acti
Optional<Media> mediaByPrimary = gameMappingDao.findMediaByPrimary(value);
if (!mediaByPrimary.isPresent()) {
gameMappingDao.saveMediaSource(value);
} else {
mediaByPrimary = gameMappingDao.findMediaByPrimary(value);
}
if (!mediaByPrimary.isPresent()) {
return;
}
//MediaCampaign更新
Media media = mediaByPrimary.get();
Optional<MediaCampaign> mediaCampaign = gameMappingDao.findMediaCampaign(value);
......@@ -87,6 +92,6 @@ public class GameAdMappingProcessor extends ProcessFunction<AppsFlyerEvent, Acti
!adMapping.get().getAf_ad_name().equals(value.getAd())) {
gameMappingDao.saveAdMapping(value, media);
}
}
}
}
......@@ -8,7 +8,7 @@ import org.apache.flink.util.Collector;
public class MutiplatDataProcess extends ProcessFunction<AppsFlyerEvent, AppsFlyerEvent> {
//需要混合的包名
private String[] packages = {"com.chaosportal.samsung", "com.chaosportal.onestore", "com.chaosportal.shark","com.chaosportal.fshark"};
private String[] packages = {"com.chaosportal.samsung", "com.chaosportal.onestore", "com.chaosportal.shark","com.chaosportal.fshark","id6443873221"};
@Override
public void processElement(AppsFlyerEvent value, ProcessFunction<AppsFlyerEvent, AppsFlyerEvent>.Context ctx, Collector<AppsFlyerEvent> out) throws Exception {
......
......@@ -6,8 +6,10 @@ import com.fshark.overseas.advert.modle.OrderData;
import com.fshark.overseas.advert.modle.PlatformEnum;
import com.fshark.overseas.advert.modle.SinkMetricEvent;
import com.fshark.overseas.advert.modle.mapping.Game;
import com.fshark.overseas.advert.util.*;
import org.apache.commons.lang3.StringUtils;
import com.fshark.overseas.advert.util.AppConfig;
import com.fshark.overseas.advert.util.Constants;
import com.fshark.overseas.advert.util.DatabaseUtils;
import com.fshark.overseas.advert.util.JdbiContext;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.functions.sink.RichSinkFunction;
......@@ -47,23 +49,27 @@ public class PurchaseSink extends RichSinkFunction<SinkMetricEvent> {
int platform_id = 1;
if (PlatformEnum.IOS.getName().equals(eventData.getPlatform())) {
platform_id = 2;
} else if (PlatformEnum.PC.getName().equals(eventData.getPlatform())){
} else if (PlatformEnum.PC.getName().equals(eventData.getPlatform())) {
platform_id = 3;
} else if (PlatformEnum.MUTI.getName().equals(eventData.getPlatform())) {
platform_id = 4;
}
if (!appConfig.getSinkType().equals(Constants.TYPE_SINK)) {
Optional<Game> gameByPrimary = gameMappingDao.findGameByPrimary(eventData.getGame_id(), platform_id);
gameByPrimary.ifPresent(game -> eventData.setRate(game.getRate()));
}
orderDao.insertOrder(eventData);
} else if (Constants.TYPE_SINK_OUID_ORDER.equals(value.getEventType())){
} else if (Constants.TYPE_SINK_OUID_ORDER.equals(value.getEventType())) {
OrderData eventData = value.getOrderData();
//获取汇率
//获取汇率
int platform_id = 1;
if (PlatformEnum.IOS.getName().equals(eventData.getPlatform())) {
platform_id = 2;
} else if (PlatformEnum.PC.getName().equals(eventData.getPlatform())){
} else if (PlatformEnum.PC.getName().equals(eventData.getPlatform())) {
platform_id = 3;
} else if (PlatformEnum.MUTI.getName().equals(eventData.getPlatform())) {
platform_id = 4;
}
if (!appConfig.getSinkType().equals(Constants.TYPE_SINK)) {
Optional<Game> gameByPrimary = gameMappingDao.findGameByPrimary(eventData.getGame_id(), platform_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment