package com.fshark.overseas.advert.processor;

import com.fshark.overseas.advert.modle.AppsFlyerEvent;
import org.apache.flink.streaming.api.functions.ProcessFunction;
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"};

    @Override
    public void processElement(AppsFlyerEvent value, ProcessFunction<AppsFlyerEvent, AppsFlyerEvent>.Context ctx, Collector<AppsFlyerEvent> out) throws Exception {
        out.collect(value);

        for (String aPackage : packages) {
            if (aPackage.equals(value.getGame_id())) {
                setMutiValue(value);
                out.collect(value);
            }
        }
    }

    private void setMutiValue(AppsFlyerEvent value) {
        value.setGame_id("com.chaosportal.shark.all");
        value.setPlatform("muti");
    }
}
