package com.huazheng.project;

import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.common.restartstrategy.RestartStrategies;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.windowing.ProcessAllWindowFunction;
import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.util.Collector;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;

import com.huazheng.project.greenplum.flatmap.GreenPlumFlatMapFunction;
import com.huazheng.project.greenplum.richsink.GreenPlumRichSinkFunction;
import com.huazheng.project.greenplum.service.impl.GPServiceImpl;
import com.huazheng.project.greenplum.source.hana.AfkoSource;
import com.huazheng.project.greenplum.source.hana.AfpoSource;
import com.huazheng.project.greenplum.source.hana.AfruSource;
import com.huazheng.project.greenplum.source.hana.AfvcSource;
import com.huazheng.project.greenplum.source.hana.AufkSource;
import com.huazheng.project.greenplum.source.hana.AufmSource;
import com.huazheng.project.greenplum.source.hana.AuspSource;
import com.huazheng.project.greenplum.source.hana.BsadSource;
import com.huazheng.project.greenplum.source.hana.BsidSource;
import com.huazheng.project.greenplum.source.hana.Kna1Source;
import com.huazheng.project.greenplum.source.hana.KnkkSource;
import com.huazheng.project.greenplum.source.hana.KnvpSource;
import com.huazheng.project.greenplum.source.hana.KnvvSource;
import com.huazheng.project.greenplum.source.hana.KonvSource;
import com.huazheng.project.greenplum.source.hana.LikpSource;
import com.huazheng.project.greenplum.source.hana.LipsSource;
import com.huazheng.project.greenplum.source.hana.MaktSource;
import com.huazheng.project.greenplum.source.hana.MaraSource;
import com.huazheng.project.greenplum.source.hana.MkpfSource;
import com.huazheng.project.greenplum.source.hana.MsegSource;
import com.huazheng.project.greenplum.source.hana.MskaSource;
import com.huazheng.project.greenplum.source.hana.Pa0002Source;
import com.huazheng.project.greenplum.source.hana.S066Source;
import com.huazheng.project.greenplum.source.hana.S067Source;
import com.huazheng.project.greenplum.source.hana.T001wSource;
import com.huazheng.project.greenplum.source.hana.T023tSource;
import com.huazheng.project.greenplum.source.hana.TspatSource;
import com.huazheng.project.greenplum.source.hana.TvkbtSource;
import com.huazheng.project.greenplum.source.hana.VbakSource;
import com.huazheng.project.greenplum.source.hana.VbapSource;
import com.huazheng.project.greenplum.source.hana.VbepSource;
import com.huazheng.project.greenplum.source.hana.VbpaSource;
import com.huazheng.project.greenplum.source.hana.VbrkSource;
import com.huazheng.project.greenplum.source.hana.VbrpSource;
import com.huazheng.project.greenplum.source.hana.VbukSource;
import com.huazheng.project.greenplum.source.hana.ZmdpcSource;
import com.huazheng.project.greenplum.source.hana.ZpoeditSource;
import com.huazheng.project.greenplum.source.hana.Zsd06Source;
import com.huazheng.project.greenplum.source.hana.ZsdfhzlSource;
import com.huazheng.project.greenplum.source.mssql.SalesContractProcessSource;
import com.huazheng.project.greenplum.source.mssql.SalesForecastProcessSource;
import com.huazheng.project.greenplum.source.mssql.SampleApplicationProcessMingXiSource;
import com.huazheng.project.greenplum.source.mssql.SampleApplicationProcessSource;
import com.huazheng.project.greenplum.source.mssql.SampleClosingProcessMingXiSource;
import com.huazheng.project.greenplum.source.mssql.SampleClosingProcessSource;
import com.huazheng.project.greenplum.source.mssql2.SysSAPreturnNoSource;
import com.huazheng.project.greenplum.source.mssql2.TKeHuSource;
import com.huazheng.project.greenplum.source.mssql2.TKeHuXiaoShouZZYeWuYSource;
import com.huazheng.project.greenplum.source.mssql3.PersonCompSource;
import com.huazheng.project.greenplum.source.mssql4.TasksSource;
import com.huazheng.project.greenplum.source.mysql.HandoverSource;
import com.huazheng.project.greenplum.source.mysql.HandoverTaskSource;
import com.huazheng.project.greenplum.source.mysql.TransformHistoryNodeSource;
import com.huazheng.project.greenplum.source.mysql.TransformNewNodeSource;
import com.huazheng.project.hana.model.Afko;
import com.huazheng.project.hana.model.Afpo;
import com.huazheng.project.hana.model.Afru;
import com.huazheng.project.hana.model.Afvc;
import com.huazheng.project.hana.model.Aufk;
import com.huazheng.project.hana.model.Aufm;
import com.huazheng.project.hana.model.Ausp;
import com.huazheng.project.hana.model.Bsad;
import com.huazheng.project.hana.model.Bsid;
import com.huazheng.project.hana.model.Kna1;
import com.huazheng.project.hana.model.Knkk;
import com.huazheng.project.hana.model.Knvp;
import com.huazheng.project.hana.model.Knvv;
import com.huazheng.project.hana.model.Konv;
import com.huazheng.project.hana.model.Likp;
import com.huazheng.project.hana.model.Lips;
import com.huazheng.project.hana.model.Makt;
import com.huazheng.project.hana.model.Mara;
import com.huazheng.project.hana.model.Mkpf;
import com.huazheng.project.hana.model.Mseg;
import com.huazheng.project.hana.model.Mska;
import com.huazheng.project.hana.model.Pa0002;
import com.huazheng.project.hana.model.S066;
import com.huazheng.project.hana.model.S067;
import com.huazheng.project.hana.model.T001w;
import com.huazheng.project.hana.model.T023t;
import com.huazheng.project.hana.model.Tspat;
import com.huazheng.project.hana.model.Tvkbt;
import com.huazheng.project.hana.model.Vbak;
import com.huazheng.project.hana.model.Vbap;
import com.huazheng.project.hana.model.Vbep;
import com.huazheng.project.hana.model.Vbpa;
import com.huazheng.project.hana.model.Vbrk;
import com.huazheng.project.hana.model.Vbrp;
import com.huazheng.project.hana.model.Vbuk;
import com.huazheng.project.hana.model.Zmdpc;
import com.huazheng.project.hana.model.Zpoedit;
import com.huazheng.project.hana.model.Zsd06;
import com.huazheng.project.hana.model.Zsdfhzl;
import com.huazheng.project.mssql.model.SalesContractProcess;
import com.huazheng.project.mssql.model.SalesContractProcessMX;
import com.huazheng.project.mssql.model.SalesForecastProcess;
import com.huazheng.project.mssql.model.SalesForecastProcessMX;
import com.huazheng.project.mssql.model.SampleApplicationProcess;
import com.huazheng.project.mssql.model.SampleApplicationProcessMingXi;
import com.huazheng.project.mssql.model.SampleClosingProcess;
import com.huazheng.project.mssql.model.SampleClosingProcessMingXi;
import com.huazheng.project.mssql2.model.SysSAPreturnNo;
import com.huazheng.project.mssql2.model.TKeHu;
import com.huazheng.project.mssql2.model.TKeHuXiaoShouZZ;
import com.huazheng.project.mssql2.model.TKeHuXiaoShouZZYeWuY;
import com.huazheng.project.mssql2.model.TWuLiaoDB;
import com.huazheng.project.mssql3.model.PersonComp;
import com.huazheng.project.mssql4.model.Tasks;
import com.huazheng.project.mysql.model.Handover;
import com.huazheng.project.mysql.model.HandoverTask;
import com.huazheng.project.mysql.model.TransformHistoryNode;
import com.huazheng.project.mysql.model.TransformNewNode;

@SuppressWarnings({"rawtypes", "unchecked"})
public class HZDataStream {

	// 重置过程
	// redis-cli -n 1 --raw keys "huazheng:Vbap:*"
	// redis-cli -n 1 --raw keys "huazheng:check:Vbap:*"
	// redis-cli -n 1 --raw keys "huazheng:Vbap:*" | xargs redis-cli -n 1 del
	// redis-cli -n 1 --raw keys "huazheng:check:Vbap:*" | xargs redis-cli -n 1 del
	// redis-cli -n 1 --raw keys "huazheng:list:Vbap" | xargs redis-cli -n 1 del
	// redis-cli -n 1 --raw keys "huazheng:checkDelete:Vbap:rowNum" | xargs redis-cli -n 1 del
	
	// 全部清理，可替代上面部分，首字母用*替代可以查询到全部的key
	// redis-cli -n 1 --raw keys "huazheng*ikp*" | xargs redis-cli -n 1 del
	// update likp set hashresult = null;
	// select * from Vbap limit 10;
	
	/*
	 * 
--重置数据更新标记
update SampleApplicationProcessMingXi set hashresult = null;

--类名把首字母去掉
redis-cli -n 1 --raw keys "huazheng*ampleApplicationProcessMingXi:*"
--更新计数器 1280
redis-cli -n 1 --raw get "huazheng:check:SampleApplicationProcessMingXi:rowNum"
--实时查看更新计数器
watch -n 1 redis-cli -n 1 --raw get "huazheng:check:SampleApplicationProcessMingXi:rowNum"

--指定更新计数器
redis-cli -n 1 --raw set "huazheng:check:SampleApplicationProcessMingXi:rowNum" 1460

--写入计数器（发）
huazheng:SampleApplicationProcessMingXi:sendcount
--写入计数器（收）
huazheng:SampleApplicationProcessMingXi:receivecount

--重置更新计数器
redis-cli -n 1 --raw keys "huazheng:check:SampleApplicationProcessMingXi:rowNum" | xargs redis-cli -n 1 del

--重置写入计数器
redis-cli -n 1 --raw keys "huazheng:SampleApplicationProcessMingXi:*" | xargs redis-cli -n 1 del

--重置所有
redis-cli -n 1 --raw keys "huazheng*ikp*" | xargs redis-cli -n 1 del
	 */
	
	
	private static ApplicationContext context;

	private static int seconds = 1;// 窗口时间

	private static GPServiceImpl gpserviceImpl;
	private static GreenPlumRichSinkFunction greenPlumRichSinkFunction;
	private static GreenPlumFlatMapFunction greenPlumFlatMapFunction;
	public static RedisTemplate<String, Object> redis1Template;
	
	private static VbapSource vbapSource;
	private static BsidSource bsidSource;
	private static BsadSource bsadSource;
	private static Pa0002Source pa0002Source;
	private static VbpaSource vbpaSource;
	private static TvkbtSource tvkbtSource;
	private static AufmSource aufmSource;
	private static VbrkSource vbrkSource;
	private static VbrpSource vbrpSource;
	private static S066Source s066Source;
	private static S067Source s067Source;
	private static VbukSource vbukSource;
	private static LikpSource likpSource;
	private static KonvSource konvSource;
	private static LipsSource lipsSource;
	private static AfkoSource afkoSource;
	private static AfpoSource afpoSource;
	private static VbepSource vbepSource;
	private static T023tSource t023tSource;
	private static Kna1Source kna1Source;
	private static KnvvSource knvvSource;
	private static AfvcSource afvcSource;
	private static KnvpSource knvpSource;
	private static AuspSource auspSource;
	private static TspatSource tspatSource;
	private static AfruSource afruSource;
	private static ZpoeditSource zpoeditSource;
	private static MkpfSource mkpfSource;
	private static KnkkSource knkkSource;
	private static MaraSource maraSource;
	private static MaktSource maktSource;
	private static Zsd06Source zsd06Source;
	private static ZmdpcSource zmdpcSource;
	private static VbakSource vbakSource;
	private static AufkSource aufkSource;
	private static T001wSource t001wSource;
	private static MskaSource mskaSource;
	private static ZsdfhzlSource zsdfhzlSource;
	
	private static PersonCompSource personCompSource;
	
	private static SalesContractProcessSource salesContractProcessSource;
	private static SalesForecastProcessSource salesForecastProcessSource;
	private static SampleApplicationProcessSource sampleApplicationProcessSource;
	private static SampleApplicationProcessMingXiSource sampleApplicationProcessMingXiSource;
	private static SampleClosingProcessSource sampleClosingProcessSource;
	private static SampleClosingProcessMingXiSource sampleClosingProcessMingXiSource;
	
	private static TransformHistoryNodeSource transformHistoryNodeSource;
	private static TransformNewNodeSource transformNewNodeSource;
	
	private static HandoverTaskSource handoverTaskSource;
	private static HandoverSource handoverSource;
	
	private static TKeHuXiaoShouZZYeWuYSource tkeHuXiaoShouZZYeWuYSource;
	private static TKeHuSource tkeHuSource;
	private static SysSAPreturnNoSource sysSAPreturnNoSource;
	
	private static TasksSource tasksSource;
	private static MsegSource msegSource;
	
	static {
		context = new ClassPathXmlApplicationContext(new String[] { "spring-init.xml" });
		gpserviceImpl = (GPServiceImpl) context.getBean("GPServiceImpl");
		
		greenPlumRichSinkFunction = (GreenPlumRichSinkFunction) context.getBean("greenPlumRichSinkFunction");
		greenPlumFlatMapFunction = (GreenPlumFlatMapFunction) context.getBean("greenPlumFlatMapFunction");
		redis1Template = (RedisTemplate<String, Object>) context.getBean("redis1Template");
		
		vbapSource = (VbapSource) context.getBean("vbapSource");
		bsidSource = (BsidSource) context.getBean("bsidSource");
		bsadSource = (BsadSource) context.getBean("bsadSource");
		pa0002Source = (Pa0002Source) context.getBean("pa0002Source");
		vbpaSource = (VbpaSource) context.getBean("vbpaSource");
		tvkbtSource = (TvkbtSource) context.getBean("tvkbtSource");
		aufmSource = (AufmSource) context.getBean("aufmSource");
		vbrkSource = (VbrkSource) context.getBean("vbrkSource");
		vbrpSource = (VbrpSource) context.getBean("vbrpSource");
		s066Source = (S066Source) context.getBean("s066Source");
		s067Source = (S067Source) context.getBean("s067Source");
		vbukSource = (VbukSource) context.getBean("vbukSource");
		likpSource = (LikpSource) context.getBean("likpSource");
		konvSource = (KonvSource) context.getBean("konvSource");
		lipsSource = (LipsSource) context.getBean("lipsSource");
		afkoSource = (AfkoSource) context.getBean("afkoSource");
		afpoSource = (AfpoSource) context.getBean("afpoSource");
		vbepSource = (VbepSource) context.getBean("vbepSource");
		t023tSource = (T023tSource) context.getBean("t023tSource");
		kna1Source = (Kna1Source) context.getBean("kna1Source");
		knvvSource = (KnvvSource) context.getBean("knvvSource");
		afvcSource = (AfvcSource) context.getBean("afvcSource");
		knvpSource = (KnvpSource) context.getBean("knvpSource");
		auspSource = (AuspSource) context.getBean("auspSource");
		afruSource = (AfruSource) context.getBean("afruSource");
		tspatSource = (TspatSource) context.getBean("tspatSource");
		zpoeditSource = (ZpoeditSource) context.getBean("zpoeditSource");
		mkpfSource = (MkpfSource) context.getBean("mkpfSource");
 		knkkSource = (KnkkSource) context.getBean("knkkSource");
		maraSource = (MaraSource) context.getBean("maraSource");
		maktSource = (MaktSource) context.getBean("maktSource");
		zsd06Source = (Zsd06Source) context.getBean("zsd06Source");
		zmdpcSource = (ZmdpcSource) context.getBean("zmdpcSource");
		vbakSource = (VbakSource) context.getBean("vbakSource");
		aufkSource = (AufkSource) context.getBean("aufkSource");
		t001wSource = (T001wSource) context.getBean("t001wSource");
		mskaSource = (MskaSource) context.getBean("mskaSource");
		zsdfhzlSource = (ZsdfhzlSource) context.getBean("zsdfhzlSource");
		
		personCompSource = (PersonCompSource) context.getBean("personCompSource");
		
		salesContractProcessSource = (SalesContractProcessSource) context.getBean("salesContractProcessSource");
		salesForecastProcessSource = (SalesForecastProcessSource) context.getBean("salesForecastProcessSource");
		sampleApplicationProcessSource = (SampleApplicationProcessSource) context.getBean("sampleApplicationProcessSource");
		sampleApplicationProcessMingXiSource = (SampleApplicationProcessMingXiSource) context.getBean("sampleApplicationProcessMingXiSource");
		sampleClosingProcessSource = (SampleClosingProcessSource) context.getBean("sampleClosingProcessSource");
		sampleClosingProcessMingXiSource = (SampleClosingProcessMingXiSource) context.getBean("sampleClosingProcessMingXiSource");
		
		transformHistoryNodeSource = (TransformHistoryNodeSource) context.getBean("transformHistoryNodeSource");
		transformNewNodeSource = (TransformNewNodeSource) context.getBean("transformNewNodeSource");
		
		handoverTaskSource = (HandoverTaskSource) context.getBean("handoverTaskSource");
		handoverSource = (HandoverSource) context.getBean("handoverSource");
		
		tkeHuXiaoShouZZYeWuYSource = (TKeHuXiaoShouZZYeWuYSource) context.getBean("TKeHuXiaoShouZZYeWuYSource");
		tkeHuSource = (TKeHuSource) context.getBean("TKeHuSource");
		sysSAPreturnNoSource = (SysSAPreturnNoSource) context.getBean("sysSAPreturnNoSource");
		
		tasksSource = (TasksSource) context.getBean("tasksSource");
		msegSource = (MsegSource) context.getBean("msegSource");
		
	}
	
	public static void main(String[] args) throws Exception {
		
		// 初始化运行环境
		StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
		env.setRestartStrategy(RestartStrategies.fixedDelayRestart(Integer.MAX_VALUE, 10l));
		
		// ================= TvkbtSource 队列 =================
		DataStream<String> tvkbtRedis = env.addSource(tvkbtSource).setParallelism(1).name("输入tvkbtSource队列");
		
		// 机构单位：销售办公室：文本
		tvkbtRedis.flatMap(new FlatMapFunction<String, Tvkbt>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Tvkbt> out) throws Exception {
				gpserviceImpl.processTvkbt(value, out);
			}
		}).setParallelism(1).name("拉取Tvkbt数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Tvkbt数据");
		
//		// ================= BsadSource、BsidSource 队列 =================
//		// 数据合并Bsid2Bsad
//		bsidProcess.connect(bsadProcess).flatMap(new CoFlatMapFunction<Bsid, Bsad, Bsid2Bsad>() {
//			private static final long serialVersionUID = 1L;
//			@Override
//			public void flatMap1(Bsid value, Collector<Bsid2Bsad> out) throws Exception {
//				Bsid2Bsad target = new Bsid2Bsad();
//				BeanUtil.copyProperties(value, target);
//				gpserviceImpl.processBsid2Bsad(target, out);
//			}
//			@Override
//			public void flatMap2(Bsad value, Collector<Bsid2Bsad> out) throws Exception {
//				Bsid2Bsad target = new Bsid2Bsad();
//				BeanUtil.copyProperties(value, target);
//				gpserviceImpl.processBsid2Bsad(target, out);
//			}
//		}).setParallelism(1).name("合并Bsid2Bsad数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Bsid2Bsad数据");
		
		// ================= SalesForecastProcessSource 队列 =================
		DataStream<String> salesForecastProcessRedis = env.addSource(salesForecastProcessSource).setParallelism(1).name("输入SalesForecastProcess队列");
		
		// 数据处理
		SingleOutputStreamOperator<SalesForecastProcess> salesForecastProcessProcess = salesForecastProcessRedis.flatMap(new FlatMapFunction<String, SalesForecastProcess>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<SalesForecastProcess> out) throws Exception {
				gpserviceImpl.processSalesForecastProcess(value, out);
			}
		}).setParallelism(1).name("拉取SalesForecastProcess数据");
		// 数据输出
		salesForecastProcessProcess.addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出SalesForecastProcess数据");
		
		// ================= SampleApplicationProcessSource 队列 =================
		DataStream<String> sampleApplicationProcessRedis = env.addSource(sampleApplicationProcessSource).setParallelism(1).name("输入SampleApplicationProcess队列");
		
		// 数据处理
		sampleApplicationProcessRedis.flatMap(new FlatMapFunction<String, SampleApplicationProcess>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<SampleApplicationProcess> out) throws Exception {
				gpserviceImpl.processSampleApplicationProcess(value, out);
			}
		}).setParallelism(1).name("拉取SampleApplicationProcess数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出SampleApplicationProcess数据");
		
		// ================= SampleApplicationProcessMingXiSource 队列 =================
		DataStream<String> sampleApplicationProcessMingXiRedis = env.addSource(sampleApplicationProcessMingXiSource).setParallelism(1).name("输入SampleApplicationProcessMingXi队列");
		
		// 数据处理
		sampleApplicationProcessMingXiRedis.flatMap(new FlatMapFunction<String, SampleApplicationProcessMingXi>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<SampleApplicationProcessMingXi> out) throws Exception {
				gpserviceImpl.processSampleApplicationProcessMingXi(value, out);
			}
		}).setParallelism(1).name("拉取SampleApplicationProcessMingXi数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出SampleApplicationProcessMingXi数据");
		
		// ================= SampleClosingProcessSource 队列 =================
		DataStream<String> sampleClosingProcessRedis = env.addSource(sampleClosingProcessSource).setParallelism(1).name("输入SampleClosingProcess队列");
		
		// 数据处理
		sampleClosingProcessRedis.flatMap(new FlatMapFunction<String, SampleClosingProcess>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<SampleClosingProcess> out) throws Exception {
				gpserviceImpl.processSampleClosingProcess(value, out);
			}
		}).setParallelism(1).name("拉取SampleClosingProcess数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出SampleClosingProcess数据");
		
		// ================= SampleClosingProcessMingXiSource 队列 =================
		DataStream<String> sampleClosingProcessMingXiRedis = env.addSource(sampleClosingProcessMingXiSource).setParallelism(1).name("输入SampleClosingProcessMingXi队列");
		
		// 数据处理
		sampleClosingProcessMingXiRedis.flatMap(new FlatMapFunction<String, SampleClosingProcessMingXi>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<SampleClosingProcessMingXi> out) throws Exception {
				gpserviceImpl.processSampleClosingProcessMingXi(value, out);
			}
		}).setParallelism(1).name("拉取SampleClosingProcessMingXi数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出SampleClosingProcessMingXi数据");
		
		// 数据处理
		salesForecastProcessProcess.timeWindowAll(Time.seconds(seconds)).process(new ProcessAllWindowFunction<SalesForecastProcess, SalesForecastProcessMX, TimeWindow>() {
			private static final long serialVersionUID = 1L;
	
			@Override
			public void process(ProcessAllWindowFunction<SalesForecastProcess, SalesForecastProcessMX, TimeWindow>.Context arg0, Iterable<SalesForecastProcess> arg1, Collector<SalesForecastProcessMX> arg2) throws Exception {
				gpserviceImpl.processSalesForecastProcessMX(arg1, arg2);
			}
		}).setParallelism(1).name("拉取SalesForecastProcessMX数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出SalesForecastProcessMX数据");
		
		
		// ================= SalesContractProcess 队列 =================
		DataStream<String> salesContractProcessRedis = env.addSource(salesContractProcessSource).setParallelism(1).name("输入SalesContractProcess队列");
		
		// 数据处理
		SingleOutputStreamOperator<SalesContractProcess> salesContractProcessProcess = salesContractProcessRedis.flatMap(new FlatMapFunction<String, SalesContractProcess>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<SalesContractProcess> out) throws Exception {
				gpserviceImpl.processSalesContractProcess(value, out);
			}
		}).setParallelism(1).name("拉取SalesContractProcess数据");
		// 数据输出
		salesContractProcessProcess.addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出SalesContractProcess数据");
		
		// 数据处理
		salesContractProcessProcess.timeWindowAll(Time.seconds(seconds)).process(new ProcessAllWindowFunction<SalesContractProcess, SalesContractProcessMX, TimeWindow>() {
			private static final long serialVersionUID = 1L;
	
			@Override
			public void process(ProcessAllWindowFunction<SalesContractProcess, SalesContractProcessMX, TimeWindow>.Context arg0, Iterable<SalesContractProcess> arg1, Collector<SalesContractProcessMX> arg2) throws Exception {
				gpserviceImpl.processSalesContractProcessMX(arg1, arg2);
			}
		}).setParallelism(1).name("拉取SalesContractProcessMX数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出SalesContractProcessMX数据");
		
		// ================= transformHistoryNodeSource 队列 =================
		DataStream<String> transformHistoryNodeRedis = env.addSource(transformHistoryNodeSource).setParallelism(1).name("输入TransformHistoryNode队列");
		
		// 数据处理
		transformHistoryNodeRedis.flatMap(new FlatMapFunction<String, TransformHistoryNode>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<TransformHistoryNode> out) throws Exception {
				gpserviceImpl.processTransformHistoryNode(value, out);
			}
		}).setParallelism(1).name("拉取TransformHistoryNode数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出TransformHistoryNode数据");
		
		// ================= transformNewNodeSource 队列 =================
		DataStream<String> transformNewNodeRedis = env.addSource(transformNewNodeSource).setParallelism(1).name("输入TransformNewNode队列");
		
		// 数据处理
		transformNewNodeRedis.flatMap(new FlatMapFunction<String, TransformNewNode>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<TransformNewNode> out) throws Exception {
				gpserviceImpl.processTransformNewNode(value, out);
			}
		}).setParallelism(1).name("拉取TransformNewNode数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出TransformNewNode数据");
		
		// ================= VbapSource 队列 =================
		DataStream<String> vbapRedis = env.addSource(vbapSource).setParallelism(1).name("输入vbap队列");
		
		// 数据处理
		SingleOutputStreamOperator<Vbap> vbapProcess = vbapRedis.flatMap(new FlatMapFunction<String, Vbap>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Vbap> out) throws Exception {
				gpserviceImpl.processVbap(value, out);
			}
		}).setParallelism(1).name("拉取Vbap数据");
		// 数据输出
		vbapProcess.addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Vbap数据");
		
		// ================= T001wSource 队列 =================
		DataStream<String> t001wRedis = env.addSource(t001wSource).setParallelism(1).name("输入T001wSource队列");
		
		// 工厂/分支机构
		t001wRedis.flatMap(new FlatMapFunction<String, T001w>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<T001w> out) throws Exception {
				gpserviceImpl.processT001w(value, out);
			}
		}).setParallelism(1).name("拉取T001w数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出T001w数据");
		
		// ================= vbpaRedis 队列 =================
		DataStream<String> vbpaRedis = env.addSource(vbpaSource).setParallelism(1).name("输入vbpa队列");
		// 销售凭证 ： 合作伙伴
		vbpaRedis.flatMap(new FlatMapFunction<String, Vbpa>() {
			private static final long serialVersionUID = 1L;
			@Override
			public void flatMap(String value, Collector<Vbpa> out) throws Exception {
				gpserviceImpl.processVbpa(value, out);
			}
		}).setParallelism(1).name("拉取vbpa数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出vbpa数据");
		
		// ================= pa0002Redis 队列 =================
		DataStream<String> pa0002Redis = env.addSource(pa0002Source).setParallelism(1).name("输入pa0002队列");
		// HR 主记录: 信息类型 0002 (人员数据)
		pa0002Redis.flatMap(new FlatMapFunction<String, Pa0002>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Pa0002> out) throws Exception {
				gpserviceImpl.processPa0002(value, out);
			}
		}).setParallelism(1).name("拉取Pa0002数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Pa0002数据");
		
		// ================= AufkSource 队列 =================
		DataStream<String> aufkRedis = env.addSource(aufkSource).setParallelism(1).name("输入aufkSource队列");
		// 销售凭证：项目数据
		aufkRedis.flatMap(new FlatMapFunction<String, Aufk>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Aufk> out) throws Exception {
				gpserviceImpl.processAufk(value, out);
			}
		}).setParallelism(1).name("拉取Aufk数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Aufk数据");
		
		// ================= ZmdpcSource 队列 =================
		DataStream<String> zmdpcRedis = env.addSource(zmdpcSource).setParallelism(1).name("输入ZmdpcSource队列");
		// 销售订单生产地对照表
		zmdpcRedis.flatMap(new FlatMapFunction<String, Zmdpc>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Zmdpc> out) throws Exception {
				gpserviceImpl.processZmdpc(value, out);
			}
		}).setParallelism(1).name("拉取Zmdpc数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Zmdpc数据");
		
		// =========================================== mssql2 ===========================================
		// ================= SysSAPreturnNoSource 队列 =================
		DataStream<String> sysSAPreturnNoRedis = env.addSource(sysSAPreturnNoSource).setParallelism(1).name("输入SysSAPreturnNoSource队列");
		// 销售凭证:计划行数据
		sysSAPreturnNoRedis.flatMap(new FlatMapFunction<String, SysSAPreturnNo>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<SysSAPreturnNo> out) throws Exception {
				gpserviceImpl.processSysSAPreturnNo(value, out);
			}
		}).setParallelism(1).name("拉取SysSAPreturnNo数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出SysSAPreturnNo数据");
		
		// =========================================== mssql2 ===========================================
		
		// ================= VbepSource 队列 =================
		DataStream<String> vbepRedis = env.addSource(vbepSource).setParallelism(1).name("输入VbepSource队列");
		// 销售凭证:计划行数据
		vbepRedis.flatMap(new FlatMapFunction<String, Vbep>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Vbep> out) throws Exception {
				gpserviceImpl.processVbep(value, out);
			}
		}).setParallelism(1).name("拉取Vbep数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Vbep数据");
		
		// ================= AfpoSource 队列 =================
		DataStream<String> afpoRedis = env.addSource(afpoSource).setParallelism(1).name("输入afpoSource队列");
		// 订单项
		afpoRedis.flatMap(new FlatMapFunction<String, Afpo>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Afpo> out) throws Exception {
				gpserviceImpl.processAfpo(value, out);
			}
		}).setParallelism(1).name("拉取Afpo数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Afpo数据");
		
		// ================= AfkoSource 队列 =================
		DataStream<String> afkoRedis = env.addSource(afkoSource).setParallelism(1).name("输入afkoSource队列");
		// 订单表头数据 PP 订单
		afkoRedis.flatMap(new FlatMapFunction<String, Afko>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Afko> out) throws Exception {
				gpserviceImpl.processAfko(value, out);
			}
		}).setParallelism(1).name("拉取Afko数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Afko数据");
		
		// ================= AufmSource 队列 =================
		DataStream<String> aufmRedis = env.addSource(aufmSource).setParallelism(1).name("输入aufmSource队列");
		
		// 针对订单的货物移动
		aufmRedis.flatMap(new FlatMapFunction<String, Aufm>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Aufm> out) throws Exception {
				gpserviceImpl.processAufm(value, out);
			}
		}).setParallelism(1).name("拉取Aufm数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Aufm数据");
		
		// ================= MaraSource 队列 =================
		DataStream<String> maraRedis = env.addSource(maraSource).setParallelism(1).name("输入MaraSource队列");
		// 常规物料数据
		maraRedis.flatMap(new FlatMapFunction<String, Mara>() {
			private static final long serialVersionUID = 1L;
	
			@Override
			public void flatMap(String value, Collector<Mara> out) throws Exception {
				gpserviceImpl.processMara(value, out);
			}
		}).setParallelism(1).name("拉取Mara数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Mara数据");
		
		// ================= T023tSource 队列 =================
		DataStream<String> t023tRedis = env.addSource(t023tSource).setParallelism(1).name("输入T023tSource队列");
		
		// 物料组描述
		t023tRedis.flatMap(new FlatMapFunction<String, T023t>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<T023t> out) throws Exception {
				gpserviceImpl.processT023t(value, out);
			}
		}).setParallelism(1).name("拉取T023t数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出T023t数据");
		
		// ================= MaktSource 队列 =================
		DataStream<String> maktRedis = env.addSource(maktSource).setParallelism(1).name("输入MaktSource队列");
		// 物料描述
		maktRedis.flatMap(new FlatMapFunction<String, Makt>() {
			private static final long serialVersionUID = 1L;
	
			@Override
			public void flatMap(String value, Collector<Makt> out) throws Exception {
				gpserviceImpl.processMakt(value, out);
			}
		}).setParallelism(1).name("拉取Makt数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Mara数据");
		
		// ================= Zsd06Source 队列 =================
		DataStream<String> zsd06Redis = env.addSource(zsd06Source).setParallelism(1).name("输入Zsd06Source队列");
		// 承诺交期日
		zsd06Redis.flatMap(new FlatMapFunction<String, Zsd06>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Zsd06> out) throws Exception {
				gpserviceImpl.processZsd06(value, out);
			}
		}).setParallelism(1).name("拉取Zsd06数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Zsd06数据");
		
		
		
		// ================= KonvRedis 队列 =================
		// 条件（事务数据）
		DataStream<String> konvRedis = env.addSource(konvSource).setParallelism(1).name("输入Konv队列");
		konvRedis.flatMap(new FlatMapFunction<String, Konv>() {
			private static final long serialVersionUID = 1L;
			@Override
			public void flatMap(String value, Collector<Konv> out) throws Exception {
				gpserviceImpl.processKonv(value, out);
			}
		}).setParallelism(1).name("拉取Konv数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Konv数据");
		
		// ================= Kna1Source 队列 =================
		DataStream<String> kna1Redis = env.addSource(kna1Source).setParallelism(1).name("输入Kna1Source队列");
		// 客户主文件的一般数据
		kna1Redis.flatMap(new FlatMapFunction<String, Kna1>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Kna1> out) throws Exception {
				gpserviceImpl.processKna1(value, out);
			}
		}).setParallelism(1).name("拉取Kna1数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Kna1数据");
		
		// ================= KnvvSource 队列 =================
		DataStream<String> knvvRedis = env.addSource(knvvSource).setParallelism(1).name("输入KnvvSource队列");
		// 客户主记录销售数据
		knvvRedis.flatMap(new FlatMapFunction<String, Knvv>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Knvv> out) throws Exception {
				gpserviceImpl.processKnvv(value, out);
			}
		}).setParallelism(1).name("拉取Knvv数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Knvv数据");
		
		
		// ================= AfvcSource 队列 =================
//		DataStream<String> afvcRedis = env.addSource(afvcSource).setParallelism(1).name("输入AfvcSource队列");
//		// 客户主记录销售数据
//		afvcRedis.flatMap(new FlatMapFunction<String, Afvc>() {
//			private static final long serialVersionUID = 1L;
//
//			@Override
//			public void flatMap(String value, Collector<Afvc> out) throws Exception {
//				gpserviceImpl.processAfvc(value, out);
//			}
//		}).setParallelism(1).name("拉取Afvc数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Afvc数据");
		
		// ================= AfvcSource 队列 =================

		
		
		
		
		
		// ================= KnkkSource 队列 =================
		DataStream<String> knkkRedis = env.addSource(knkkSource).setParallelism(1).name("输入KnkkSource队列");
		// 客户主数据信贷管理控制范围数据
		knkkRedis.flatMap(new FlatMapFunction<String, Knkk>() {
			private static final long serialVersionUID = 1L;
	
			@Override
			public void flatMap(String value, Collector<Knkk> out) throws Exception {
				gpserviceImpl.processKnkk(value, out);
			}
		}).setParallelism(1).name("拉取Knkk数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Knkk数据");
		
		// ================= S066Source 队列 =================
		DataStream<String> s066Redis = env.addSource(s066Source).setParallelism(1).name("输入S066Source队列");
		// 未清订单信贷管理
		s066Redis.flatMap(new FlatMapFunction<String, S066>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<S066> out) throws Exception {
				gpserviceImpl.processS066(value, out);
			}
		}).setParallelism(1).name("拉取S066数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出S066数据");
		
		// ================= S067Source 队列 =================
		DataStream<String> s067Redis = env.addSource(s067Source).setParallelism(1).name("输入S067Source队列");
		// 未清交货/发票凭证(KM)
		s067Redis.flatMap(new FlatMapFunction<String, S067>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<S067> out) throws Exception {
				gpserviceImpl.processS067(value, out);
			}
		}).setParallelism(1).name("拉取S067数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出S067数据");
		
		// ================= TKeHuSource 队列 =================
		DataStream<String> tkeHuRedis = env.addSource(tkeHuSource).setParallelism(1).name("输入TKeHuSource队列");
		// 客户
		SingleOutputStreamOperator<TKeHu> tkeHuProcess = tkeHuRedis.flatMap(new FlatMapFunction<String, TKeHu>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<TKeHu> out) throws Exception {
				gpserviceImpl.processTKeHu(value, out);
			}
		}).setParallelism(1).name("拉取TKeHu数据");
		// 数据输出
		tkeHuProcess.addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出TKeHu数据");
		
		// 客户物料
		tkeHuProcess.timeWindowAll(Time.seconds(seconds)).process(new ProcessAllWindowFunction<TKeHu, TWuLiaoDB, TimeWindow>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void process(ProcessAllWindowFunction<TKeHu, TWuLiaoDB, TimeWindow>.Context arg0, Iterable<TKeHu> arg1, Collector<TWuLiaoDB> arg2) throws Exception {
				gpserviceImpl.processTWuLiaoDB(arg1, arg2);
			}
		}).setParallelism(1).name("拉取TWuLiaoDB数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出TWuLiaoDB数据");
		
		
		// 客户销售
		tkeHuProcess.timeWindowAll(Time.seconds(seconds)).process(new ProcessAllWindowFunction<TKeHu, TKeHuXiaoShouZZ, TimeWindow>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void process(ProcessAllWindowFunction<TKeHu, TKeHuXiaoShouZZ, TimeWindow>.Context arg0, Iterable<TKeHu> arg1, Collector<TKeHuXiaoShouZZ> arg2) throws Exception {
				gpserviceImpl.processTKeHuXiaoShouZZ(arg1, arg2);
			}
		}).setParallelism(1).name("拉取TKeHuXiaoShouZZ数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出TKeHuXiaoShouZZ数据");
		
		
		
		
		
		
		
		
		
		
		
		
		// ================= TKeHuXiaoShouZZYeWuYSource 队列 =================
		DataStream<String> tkeHuXiaoShouZZYeWuYRedis = env.addSource(tkeHuXiaoShouZZYeWuYSource).setParallelism(1).name("输入TKeHuXiaoShouZZYeWuYSource队列");
		// 客户销售业务员
		tkeHuXiaoShouZZYeWuYRedis.flatMap(new FlatMapFunction<String, TKeHuXiaoShouZZYeWuY>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<TKeHuXiaoShouZZYeWuY> out) throws Exception {
				gpserviceImpl.processTKeHuXiaoShouZZYeWuY(value, out);
			}
		}).setParallelism(1).name("拉取TKeHuXiaoShouZZYeWuY数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出TKeHuXiaoShouZZYeWuY数据");
		
		// ================= LipsRedis 队列 =================
		// SD凭证：交货：项目数据
		DataStream<String> lipsRedis = env.addSource(lipsSource).setParallelism(1).name("输入Lips队列");
		lipsRedis.flatMap(new FlatMapFunction<String, Lips>() {
			private static final long serialVersionUID = 1L;
			@Override
			public void flatMap(String value, Collector<Lips> out) throws Exception {
				gpserviceImpl.processLips(value, out);
			}
		}).setParallelism(1).name("拉取Lips数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Lips数据");
		
		// ================= VbrpRedis 队列 =================
		// 发票行项目
		DataStream<String> vbrpRedis = env.addSource(vbrpSource).setParallelism(1).name("输入Vbrp队列");
		// 销售凭证 ： 合作伙伴
		vbrpRedis.flatMap(new FlatMapFunction<String, Vbrp>() {
			private static final long serialVersionUID = 1L;
			@Override
			public void flatMap(String value, Collector<Vbrp> out) throws Exception {
				gpserviceImpl.processVbrp(value, out);
			}
		}).setParallelism(1).name("拉取Vbrp数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Vbrp数据");
		
		// ================= VbrkRedis 队列 =================
		// 发票抬头
		DataStream<String> vbrkRedis = env.addSource(vbrkSource).setParallelism(1).name("输入Vbrk队列");
		// 销售凭证 ： 合作伙伴
		vbrkRedis.flatMap(new FlatMapFunction<String, Vbrk>() {
			private static final long serialVersionUID = 1L;
			@Override
			public void flatMap(String value, Collector<Vbrk> out) throws Exception {
				gpserviceImpl.processVbrk(value, out);
			}
		}).setParallelism(1).name("拉取Vbrk数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Vbrk数据");
		
		// ================= LikpRedis 队列 =================
		// SD凭证：交货抬头数据
		DataStream<String> likpRedis = env.addSource(likpSource).setParallelism(1).name("输入Likp队列");
		likpRedis.flatMap(new FlatMapFunction<String, Likp>() {
			private static final long serialVersionUID = 1L;
			@Override
			public void flatMap(String value, Collector<Likp> out) throws Exception {
				gpserviceImpl.processLikp(value, out);
			}
		}).setParallelism(1).name("拉取Likp数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Likp数据");
		
		// ================= VbukRedis 队列 =================
		// 销售凭证：抬头状态和管理数据
		DataStream<String> vbukRedis = env.addSource(vbukSource).setParallelism(1).name("输入Vbuk队列");
		vbukRedis.flatMap(new FlatMapFunction<String, Vbuk>() {
			private static final long serialVersionUID = 1L;
			@Override
			public void flatMap(String value, Collector<Vbuk> out) throws Exception {
				gpserviceImpl.processVbuk(value, out);
			}
		}).setParallelism(1).name("拉取Vbuk数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Vbuk数据");
		
		// =========================================== mysql ===========================================
		// Handover
		DataStream<String> handoverRedis = env.addSource(handoverSource).setParallelism(1).name("输入Handover队列");
		
		handoverRedis.flatMap(new FlatMapFunction<String, Handover>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<Handover> out) throws Exception {
				gpserviceImpl.processHandover(value, out);
			}
		}).setParallelism(1).name("拉取Handover数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Handover数据");
		
		// 送货单(派车单） mysql
		DataStream<String> handoverTaskRedis = env.addSource(handoverTaskSource).setParallelism(1).name("输入HandoverTask队列");
		
		handoverTaskRedis.flatMap(new FlatMapFunction<String, HandoverTask>() {
			private static final long serialVersionUID = 1L;

			@Override
			public void flatMap(String value, Collector<HandoverTask> out) throws Exception {
				gpserviceImpl.processHandoverTask(value, out);
			}
		}).setParallelism(1).name("拉取HandoverTask数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出HandoverTask数据");
		
		// =========================================== mysql ===========================================
		
		// ================= MskaSource 队列 =================
		DataStream<String> mskaRedis = env.addSource(mskaSource).setParallelism(1).name("输入MskaSource队列");
		// 销售订单库存
		mskaRedis.flatMap(new FlatMapFunction<String, Mska>() {
			private static final long serialVersionUID = 1L;
	
			@Override
			public void flatMap(String value, Collector<Mska> out) throws Exception {
				gpserviceImpl.processMska(value, out);
			}
		}).setParallelism(1).name("拉取Mska数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Mska数据");
		
		// ================= Source 队列 =================
		env.addSource(tasksSource).setParallelism(1).name("输入TasksSource队列").flatMap(greenPlumFlatMapFunction).returns(Tasks.class).setParallelism(1).name("拉取Tasks数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Tasks数据");
		env.addSource(zsdfhzlSource).setParallelism(1).name("输入ZsdfhzlSource队列").flatMap(greenPlumFlatMapFunction).returns(Zsdfhzl.class).setParallelism(1).name("拉取Zsdfhzl数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Zsdfhzl数据");
		env.addSource(vbakSource).setParallelism(1).name("输入vbak队列").flatMap(greenPlumFlatMapFunction).returns(Vbak.class).setParallelism(1).name("拉取vbak数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出vbak数据");
		env.addSource(bsidSource).setParallelism(1).name("输入bsid队列").flatMap(greenPlumFlatMapFunction).returns(Bsid.class).setParallelism(1).name("拉取Bsid数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Bsid数据");
		env.addSource(bsadSource).setParallelism(1).name("输入bsad队列").flatMap(greenPlumFlatMapFunction).returns(Bsad.class).setParallelism(1).name("拉取Bsad数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Bsad数据");
		
		env.addSource(personCompSource).setParallelism(1).name("输入PersonComp队列").flatMap(greenPlumFlatMapFunction).returns(PersonComp.class).setParallelism(1).name("拉取PersonComp数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出PersonComp数据");
		env.addSource(afvcSource).setParallelism(1).name("输入Afvc队列").flatMap(greenPlumFlatMapFunction).returns(Afvc.class).setParallelism(1).name("拉取Afvc数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Afvc数据");
		env.addSource(mkpfSource).setParallelism(1).name("输入Mkpf队列").flatMap(greenPlumFlatMapFunction).returns(Mkpf.class).setParallelism(1).name("拉取Mkpf数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Mkpf数据");
		env.addSource(msegSource).setParallelism(1).name("输入Mseg队列").flatMap(greenPlumFlatMapFunction).returns(Mseg.class).setParallelism(1).name("拉取Mseg数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Mseg数据");
		env.addSource(afruSource).setParallelism(1).name("输入Afru队列").flatMap(greenPlumFlatMapFunction).returns(Afru.class).setParallelism(1).name("拉取Afru数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Afru数据");
		env.addSource(tspatSource).setParallelism(1).name("输入Tspat队列").flatMap(greenPlumFlatMapFunction).returns(Tspat.class).setParallelism(1).name("拉取Tspat数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Tspat数据");
		env.addSource(zpoeditSource).setParallelism(1).name("输入Zpoedit队列").flatMap(greenPlumFlatMapFunction).returns(Zpoedit.class).setParallelism(1).name("拉取zpoedit数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Zpoedit数据");
		env.addSource(auspSource).setParallelism(1).name("输入Ausp队列").flatMap(greenPlumFlatMapFunction).returns(Ausp.class).setParallelism(1).name("拉取Ausp数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Ausp数据");
		env.addSource(knvpSource).setParallelism(1).name("输入Knvp队列").flatMap(greenPlumFlatMapFunction).returns(Knvp.class).setParallelism(1).name("拉取Knvp数据").addSink(greenPlumRichSinkFunction).setParallelism(1).name("输出Knvp数据");
		
		env.execute("华正数据迁移任务");
	}

}
