package com.huazheng.project.greenplum.service.impl;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import org.apache.flink.util.Collector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import com.huazheng.project.greenplum.mapper.GPMapper;
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.Bkpf;
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.VbapAdv;
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.mapper.CrmMapper;
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.SalesInquiryProcess;
import com.huazheng.project.mssql.model.SalesInquiryProcessMX;
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.mapper.HzcrmMapper;
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;

import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import lombok.extern.log4j.Log4j2;

@Log4j2
@Service
public class GPServiceImpl {
	
	@Autowired
	private RedisTemplate<Object, Object> redis1Template;
	
	@Autowired
	private CrmMapper crmMapper;
	
	@Autowired
	private HzcrmMapper hzcrmMapper;
	
	@Autowired
	private GPMapper gpMapper;
	
	public String getErrorInfoFromException(Exception e) {
		try {
			StringWriter sw = new StringWriter();
			PrintWriter pw = new PrintWriter(sw);
			e.printStackTrace(pw);
			return "\r\n" + sw.toString() + "\r\n";
		} catch (Exception e2) {
			return "bad getErrorInfoFromException";
		}
	}
	private Date caDate(String datestr) {
		try {
			if (datestr == null || datestr.equals("00000000") || StrUtil.isBlank(datestr)) {
				return null;
			} else {
				Date date = DateUtil.parse(datestr, "yyyyMMdd");
				return date;
			}
		} catch (Exception e) {
			return null;
		}
	}
	
	public void processVbap(String value, Collector<Vbap> out) {
		try {
			Vbap data = JSONUtil.toBean(value, Vbap.class);
			try {
				if (data.getErdat() != null && data.getErzet() != null) {
					String erdat2 = new StringBuffer(data.getErdat()).insert(4, "-").insert(7, "-").toString();
					String erzet2 = new StringBuffer(data.getErzet()).insert(2, ":").insert(5, ":").toString();
					String dateStr = erdat2 + " " + erzet2;
					Date date = DateUtil.parse(dateStr);
					data.setErdat1(date);
					data.setErdat2(date);
				}
			} catch (Exception e) {
				redis1Template.opsForHash().put("huazheng:Vbap:error", "processVbap1", getErrorInfoFromException(e));
				log.error(e.getMessage());
			}
			Vbap exist = gpMapper.selectVbap(data);
			if (exist != null) {
				exist.setExist(true); // 已经在库
				VbapAdv vbapAdv = gpMapper.selectVbapAdv(data); // 宽表
				if (vbapAdv != null) {
					gpMapper.resetCaVbapAdv(data); // 重置宽表
				}
				exist.setVbapAdv(vbapAdv);
				out.collect(exist);
			} else {
				out.collect(data);
			}
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbap:error", "processVbap", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkVbap(Vbap element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkVbap()");
				gpMapper.insertVbap(element);
				gpMapper.insertVbapAdv(element); // 更新htsl、pssj
			} else {
				if (element.getVbapAdv() == null) {
					gpMapper.insertVbapAdv(element); // 更新htsl、pssj
				}
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Vbap:error", "sinkVbap", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbap:error", "sinkVbap", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processAufk(String value, Collector<Aufk> out) {
		try {
			Aufk data = JSONUtil.toBean(value, Aufk.class);
			Aufk exist = gpMapper.selectAufk(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				try {
					if (data.getErdat() != null && data.getErfzeit() != null) {
						String erdat2 = new StringBuffer(data.getErdat()).insert(4, "-").insert(7, "-").toString();
						String erzet2 = new StringBuffer(data.getErfzeit()).insert(2, ":").insert(5, ":").toString();
						String dateStr = erdat2 + " " + erzet2;
						Date date = DateUtil.parse(dateStr);
						data.setErdat1(date);
						data.setErdat2(date);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Aufk:error", "processAufk1", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Aufk:error", "processAufk", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkAufk(Aufk element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkAufk()");
				gpMapper.insertAufk(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Aufk:error", "sinkAufk", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Aufk:error", "sinkAufk", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processSysSAPreturnNo(String value, Collector<SysSAPreturnNo> out) {
		try {
			SysSAPreturnNo data = JSONUtil.toBean(value, SysSAPreturnNo.class);
			SysSAPreturnNo exist = gpMapper.selectSysSAPreturnNo(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SysSAPreturnNo:error", "processSysSAPreturnNo", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkSysSAPreturnNo(SysSAPreturnNo element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkSysSAPreturnNo()");
				gpMapper.insertSysSAPreturnNo(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:SysSAPreturnNo:error", "sinkSysSAPreturnNo", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SysSAPreturnNo:error", "sinkSysSAPreturnNo", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processSalesContractProcess(String value, Collector<SalesContractProcess> arg2) {
		try {
			SalesContractProcess data = JSONUtil.toBean(value, SalesContractProcess.class);
			SalesContractProcess exist = gpMapper.selectSalesContractProcess(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SalesContractProcess:error", "processSalesContractProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkSalesContractProcess(SalesContractProcess element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkSalesContractProcess()");
				gpMapper.insertSalesContractProcess(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:SalesContractProcess:error", "sinkSalesContractProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SalesContractProcess:error", "sinkSalesContractProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processSalesContractProcessMX(Iterable<SalesContractProcess> arg1, Collector<SalesContractProcessMX> arg2) {
		try {
			arg1.forEach(scp -> {
				List<SalesContractProcessMX> list = crmMapper.selectSalesContractProcessMX(scp); // 查询：销售合同流程MX
				list.forEach(scpmx -> {
					SalesContractProcessMX exist = gpMapper.selectSalesContractProcessMX(scpmx);
					if (exist != null) {
						scpmx.setExist(true); // 已经在库
					}
					scpmx.setVbap(scp.getVbap());
					Object chengben = scpmx.getChengben();
					if (chengben != null && chengben.toString().equals("")) {
						scpmx.setChengben(null);
					}
					arg2.collect(scpmx);
				});
			});
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SalesContractProcessMX:error", "processSalesContractProcessMX", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkSalesContractProcessMX(SalesContractProcessMX element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkSalesContractProcessMX()");
				gpMapper.insertSalesContractProcessMX(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:SalesContractProcessMX:error", "sinkSalesContractProcessMX", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SalesContractProcessMX:error", "sinkSalesContractProcessMX", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processSalesForecastProcess(String value, Collector<SalesForecastProcess> arg2) {
		try {
			SalesForecastProcess data = JSONUtil.toBean(value, SalesForecastProcess.class);
			String kaiShiSJs = data.getKaiShiSJs(); // 时间数据纠错
			if (kaiShiSJs == null || kaiShiSJs.equals("00000000") || StrUtil.isBlank(kaiShiSJs)) {
				data.setKaiShiSJ(null);
			} else {
				if (kaiShiSJs.indexOf("--") == -1) {
					Date date = DateUtil.parse(kaiShiSJs);
					data.setKaiShiSJ(date);
				} 
			}
			String jieShuSJs = data.getJieShuSJs(); // 时间数据纠错
			if (jieShuSJs == null || jieShuSJs.equals("00000000") || StrUtil.isBlank(jieShuSJs)) {
				data.setJieShuSJ(null);
			} else {
				Date date = DateUtil.parse(jieShuSJs);
				data.setJieShuSJ(date);
			}
			SalesForecastProcess exist = gpMapper.selectSalesForecastProcess(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SalesForecastProcess:error", "processSalesForecastProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkSalesForecastProcess(SalesForecastProcess element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkSalesForecastProcess()");
				gpMapper.insertSalesForecastProcess(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:SalesForecastProcess:error", "sinkSalesForecastProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SalesForecastProcess:error", "sinkSalesForecastProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void processSalesInquiryProcess(String value, Collector<SalesInquiryProcess> arg2) {
		try {
			SalesInquiryProcess data = JSONUtil.toBean(value, SalesInquiryProcess.class);
			SalesInquiryProcess exist = gpMapper.selectSalesInquiryProcess(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} 
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SalesInquiryProcess:error", "processSalesInquiryProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkSalesInquiryProcess(SalesInquiryProcess element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkSalesInquiryProcess()");
				gpMapper.insertSalesInquiryProcess(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:SalesInquiryProcess:error", "sinkSalesInquiryProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SalesInquiryProcess:error", "sinkSalesInquiryProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void processSalesInquiryProcessMX(String value, Collector<SalesInquiryProcessMX> arg2) {
		try {
			SalesInquiryProcessMX data = JSONUtil.toBean(value, SalesInquiryProcessMX.class);
			SalesInquiryProcessMX exist = gpMapper.selectSalesInquiryProcessMX(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SalesInquiryProcessMX:error", "processSalesInquiryProcessMX", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkSalesInquiryProcessMX(SalesInquiryProcessMX element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkSalesInquiryProcessMX()");
				gpMapper.insertSalesInquiryProcessMX(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:SalesInquiryProcessMX:error", "sinkSalesInquiryProcessMX", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SalesInquiryProcessMX:error", "sinkSalesInquiryProcessMX", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processSampleApplicationProcess(String value, Collector<SampleApplicationProcess> arg2) {
		try {
			SampleApplicationProcess data = JSONUtil.toBean(value, SampleApplicationProcess.class);
			SampleApplicationProcess exist = gpMapper.selectSampleApplicationProcess(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				String pcbcs = data.getPCBCS();
				String chanPinYY = data.getChanPinYY();
				if (StrUtil.isBlank(pcbcs) || StrUtil.isBlank(chanPinYY)) {
					data.setPCBCS2chanPinYY(null);
				}
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SampleApplicationProcess:error", "processSampleApplicationProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkSampleApplicationProcess(SampleApplicationProcess element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkSampleApplicationProcess()");
				gpMapper.insertSampleApplicationProcess(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:SampleApplicationProcess:error", "sinkSampleApplicationProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SampleApplicationProcess:error", "sinkSampleApplicationProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void processSampleApplicationProcessMingXi(String value, Collector<SampleApplicationProcessMingXi> arg2) {
		try {
			SampleApplicationProcessMingXi data = JSONUtil.toBean(value, SampleApplicationProcessMingXi.class);
			SampleApplicationProcessMingXi exist = gpMapper.selectSampleApplicationProcessMingXi(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SampleApplicationProcessMingXi:error", "processSampleApplicationProcessMingXi", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkSampleApplicationProcessMingXi(SampleApplicationProcessMingXi element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkSampleApplicationProcessMingXi()");
				gpMapper.insertSampleApplicationProcessMingXi(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:SampleApplicationProcessMingXi:error", "sinkSampleApplicationProcessMingXi", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SampleApplicationProcessMingXi:error", "sinkSampleApplicationProcessMingXi", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processSampleClosingProcess(String value, Collector<SampleClosingProcess> arg2) {
		try {
			SampleClosingProcess data = JSONUtil.toBean(value, SampleClosingProcess.class);
			SampleClosingProcess exist = gpMapper.selectSampleClosingProcess(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				try {
					if (NumberUtil.isNumber(data.getYangPinSQSLH())) {
						int yangPinSQSLHi = Integer.parseInt(data.getYangPinSQSLH());
						data.setYangPinSQSLHi(yangPinSQSLHi);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:SampleClosingProcess:error", "processSampleClosingProcess", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SampleClosingProcess:error", "processSampleClosingProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkSampleClosingProcess(SampleClosingProcess element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkSampleClosingProcess()");
				gpMapper.insertSampleClosingProcess(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:SampleClosingProcess:error", "sinkSampleClosingProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SampleClosingProcess:error", "sinkSampleClosingProcess", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processSampleClosingProcessMingXi(String value, Collector<SampleClosingProcessMingXi> arg2) {
		try {
			SampleClosingProcessMingXi data = JSONUtil.toBean(value, SampleClosingProcessMingXi.class);
			SampleClosingProcessMingXi exist = gpMapper.selectSampleClosingProcessMingXi(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SampleClosingProcessMingXi:error", "processSampleClosingProcessMingXi", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkSampleClosingProcessMingXi(SampleClosingProcessMingXi element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkSampleClosingProcessMingXi()");
				gpMapper.insertSampleClosingProcessMingXi(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:SampleClosingProcessMingXi:error", "sinkSampleClosingProcessMingXi", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SampleClosingProcessMingXi:error", "sinkSampleClosingProcessMingXi", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processSalesForecastProcessMX(Iterable<SalesForecastProcess> arg1, Collector<SalesForecastProcessMX> arg2) {
		try {
			arg1.forEach(sfp -> {
				List<SalesForecastProcessMX> list = crmMapper.selectSalesForecastProcessMX(sfp); // 查询：销售预测流程MX
				list.forEach(sfpmx -> {
					SalesForecastProcessMX exist = gpMapper.selectSalesForecastProcessMX(sfpmx);
					if (exist != null) {
						sfpmx.setExist(true); // 已经在库
					}
					if (sfpmx.getJiHuaJDL() != null) {
						try {
							sfpmx.setJiHuaJDL(ReUtil.getFirstNumber(sfpmx.getJiHuaJDL())+"");
						} catch (Exception e) {
							redis1Template.opsForHash().put("huazheng:SalesForecastProcessMX:error", "sinkSalesForecastProcessMX", getErrorInfoFromException(e));
							log.error(e.getMessage());
						}
					}
					arg2.collect(sfpmx);
				});
			});
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SalesForecastProcessMX:error", "processSalesForecastProcessMX", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkSalesForecastProcessMX(SalesForecastProcessMX element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkSalesForecastProcessMX()");
				gpMapper.insertSalesForecastProcessMX(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:SalesForecastProcessMX:error", "sinkSalesForecastProcessMX", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:SalesForecastProcessMX:error", "sinkSalesForecastProcessMX", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processVbep(String value, Collector<Vbep> out) {
		try {
			Vbep data = JSONUtil.toBean(value, Vbep.class);
			Vbep exist = gpMapper.selectVbep(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				try {
					if (data.getEdatu() != null) {
						String erdat2 = new StringBuffer(data.getEdatu()).insert(4, "-").insert(7, "-").toString();
						Date date = DateUtil.parse(erdat2);
						data.setEdatu1(date);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Vbep:error", "processVbep1", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbep:error", "processVbep", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkVbep(Vbep element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkVbep()");
				gpMapper.insertVbep(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Vbep:error", "sinkVbep", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbep:error", "sinkVbep", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processAfpo(String value, Collector<Afpo> out) {
		try {
			Afpo data = JSONUtil.toBean(value, Afpo.class);
			Afpo exist = gpMapper.selectAfpo(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Afpo:error", "processAfpo", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkAfpo(Afpo element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkAfpo()");
				gpMapper.insertAfpo(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Afpo:error", "sinkAfpo", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Afpo:error", "sinkAfpo", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processAfko(String value, Collector<Afko> out) {
		try {
			Afko data = JSONUtil.toBean(value, Afko.class);
			Afko exist = gpMapper.selectAfko(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				try {
					if (data.getGltrp() != null) {
						String erdat2 = new StringBuffer(data.getGltrp()).insert(4, "-").insert(7, "-").toString();
						Date date = DateUtil.parse(erdat2);
						data.setGltrp1(date);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Afko:error", "processAfko1", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
				try {
					if (data.getGstrp() != null) {
						String erdat2 = new StringBuffer(data.getGstrp()).insert(4, "-").insert(7, "-").toString();
						Date date = DateUtil.parse(erdat2);
						data.setGstrp1(date);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Afko:error", "processAfko2", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Afko:error", "processAfko", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkAfko(Afko element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkAfko()");
				gpMapper.insertAfko(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Afko:error", "sinkAfko", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Afko:error", "sinkAfko", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processAufm(String value, Collector<Aufm> out) {
		try {
			Aufm data = JSONUtil.toBean(value, Aufm.class);
			Aufm exist = gpMapper.selectAufm(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				try {
					if (data.getBldat() != null) {
						String erdat2 = new StringBuffer(data.getBldat()).insert(4, "-").insert(7, "-").toString();
						Date date = DateUtil.parse(erdat2);
						data.setBldat1(date);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Aufm:error", "processAufm1", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
				try {
					if (data.getBudat() != null) {
						String erdat2 = new StringBuffer(data.getBudat()).insert(4, "-").insert(7, "-").toString();
						Date date = DateUtil.parse(erdat2);
						data.setBudat1(date);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Aufm:error", "processAufm2", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Aufm:error", "processAufm", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkAufm(Aufm element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkAufm()");
				gpMapper.insertAufm(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Aufm:error", "sinkAufm", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Aufm:error", "sinkAufm", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processMara(String value, Collector<Mara> out) {
		try {
			Mara data = JSONUtil.toBean(value, Mara.class);
			Mara exist = gpMapper.selectMara(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				try {
					if (data.getErsda() != null) {
						String erdat2 = new StringBuffer(data.getErsda()).insert(4, "-").insert(7, "-").toString();
						Date date = DateUtil.parse(erdat2);
						data.setErsda1(date);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Mara:error", "processMara1", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
				try {
					if (data.getLaeda() != null) {
						String erdat2 = new StringBuffer(data.getLaeda()).insert(4, "-").insert(7, "-").toString();
						Date date = DateUtil.parse(erdat2);
						data.setLaeda1(date);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Mara:error", "processMara2", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Mara:error", "processMara", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkMara(Mara element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkMara()");
				gpMapper.insertMara(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Mara:error", "sinkMara", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Mara:error", "sinkMara", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processT023t(String value, Collector<T023t> out) {
		try {
			T023t data = JSONUtil.toBean(value, T023t.class);
			T023t exist = gpMapper.selectT023t(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:T023t:error", "processT023t", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkT023t(T023t element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkT023t()");
				gpMapper.insertT023t(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:T023t:error", "sinkT023t", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:T023t:error", "sinkT023t", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processMakt(String value, Collector<Makt> out) {
		try {
			Makt data = JSONUtil.toBean(value, Makt.class);
			Makt exist = gpMapper.selectMakt(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				try {
					String maktx = data.getMaktx();
					if (maktx != null && !maktx.equals("")) {
						String[] split = maktx.split("-");
						for (int i = split.length - 1; i >= 0; i--) {
							String string = split[i];
							if (string.indexOf("*") != -1) {
								data.setMaktxSize(string.split("\\*")[0]); // 分割出尺寸数据
								break;
							}
						}
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Makt:error", "processMakt1", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Makt:error", "processMakt", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkMakt(Makt element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkMakt()");
				gpMapper.insertMakt(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Makt:error", "sinkMakt", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Makt:error", "sinkMakt", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processZsd06(String value, Collector<Zsd06> out) {
		try {
			Zsd06 data = JSONUtil.toBean(value, Zsd06.class);
			Zsd06 exist = gpMapper.selectZsd06(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				try {
					if (data.getDatum() != null) {
						String erdat2 = new StringBuffer(data.getDatum()).insert(4, "-").insert(7, "-").toString();
						Date date = DateUtil.parse(erdat2);
						data.setDatum1(date);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Zsd06:error", "processZsd061", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
				data.setCrt_datum1(caDate(data.getCrt_datum()));
				data.setCha_datum1(caDate(data.getCha_datum()));
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Zsd06:error", "processZsd06", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkZsd06(Zsd06 element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkZsd06()");
				gpMapper.insertZsd06(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Zsd06:error", "sinkZsd06", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Zsd06:error", "sinkZsd06", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processKna1(String value, Collector<Kna1> out) {
		try {
			Kna1 data = JSONUtil.toBean(value, Kna1.class);
			Kna1 exist = gpMapper.selectKna1(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Kna1:error", "processKna1", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkKna1(Kna1 element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkKna1()");
				gpMapper.insertKna1(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Kna1:error", "sinkKna1", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Kna1:error", "sinkKna1", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processLips(String value, Collector<Lips> out) {
		try {
			Lips data = JSONUtil.toBean(value, Lips.class);
			Lips exist = gpMapper.selectLips(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				try {
					if (data.getErdat() != null && data.getErzet() != null) {
						String erdat2 = new StringBuffer(data.getErdat()).insert(4, "-").insert(7, "-").toString();
						String erzet2 = new StringBuffer(data.getErzet()).insert(2, ":").insert(5, ":").toString();
						String dateStr = erdat2 + " " + erzet2;
						Date date = DateUtil.parse(dateStr);
						data.setErdat1(date);
						data.setErdat2(date);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Lips:error", "processLips1", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Lips:error", "processLips", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkLips(Lips element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkLips()");
				gpMapper.insertLips(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Lips:error", "sinkLips", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Lips:error", "sinkLips", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processVbrp(String value, Collector<Vbrp> out) {
		try {
			Vbrp data = JSONUtil.toBean(value, Vbrp.class);
			Vbrp exist = gpMapper.selectVbrp(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbrp:error", "processVbrp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkVbrp(Vbrp element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkVbrp()");
				gpMapper.insertVbrp(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Vbrp:error", "sinkVbrp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbrp:error", "sinkVbrp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processVbrk(String value, Collector<Vbrk> out) {
		try {
			Vbrk data = JSONUtil.toBean(value, Vbrk.class);
			Vbrk exist = gpMapper.selectVbrk(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				if (data.getFkdat() != null) {
					String erdat2 = new StringBuffer(data.getFkdat()).insert(4, "-").insert(7, "-").toString();
					Date date = DateUtil.parse(erdat2);
					data.setFkdat1(date);
				}
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbrk:error", "processVbrk", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkVbrk(Vbrk element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkVbrk()");
				gpMapper.insertVbrk(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Vbrk:error", "sinkVbrk", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbrk:error", "sinkVbrk", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processLikp(String value, Collector<Likp> out) {
		try {
			Likp data = JSONUtil.toBean(value, Likp.class);
			Likp exist = gpMapper.selectLikp(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				data.setErdat1(caDate(data.getErdat())); // 日期00000000格式转换,已处理异常
				data.setWadat_ist1(caDate(data.getWadat_ist())); // 日期00000000格式转换,已处理异常
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Likp:error", "processLikp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkLikp(Likp element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkLikp()");
				gpMapper.insertLikp(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Likp:error", "sinkLikp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Likp:error", "sinkLikp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processVbuk(String value, Collector<Vbuk> out) {
		try {
			Vbuk data = JSONUtil.toBean(value, Vbuk.class);
			Vbuk exist = gpMapper.selectVbuk(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbuk:error", "processVbuk", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkVbuk(Vbuk element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkVbuk()");
				gpMapper.insertVbuk(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Vbuk:error", "sinkVbuk", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbuk:error", "sinkVbuk", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processHandover(String value, Collector<Handover> out) {
		try {
			Handover data = JSONUtil.toBean(value, Handover.class);
			Handover exist = gpMapper.selectHandover(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Handover:error", "processHandover", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkHandover(Handover element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkHandover()");
				gpMapper.insertHandover(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Handover:error", "sinkHandover", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Handover:error", "sinkHandover", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processHandoverTask(String value, Collector<HandoverTask> arg2) {
		try {
			HandoverTask data = JSONUtil.toBean(value, HandoverTask.class);
			HandoverTask exist = gpMapper.selectHandoverTask(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:HandoverTask:error", "processHandoverTask", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkHandoverTask(HandoverTask element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkHandoverTask()");
				gpMapper.insertHandoverTask(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:HandoverTask:error", "sinkHandoverTask", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:HandoverTask:error", "sinkHandoverTask", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processTransformNewNode(String value, Collector<TransformNewNode> arg2) {
		try {
			TransformNewNode data = JSONUtil.toBean(value, TransformNewNode.class);
			TransformNewNode exist = gpMapper.selectTransformNewNode(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:TransformNewNode:error", "processTransformNewNode", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkTransformNewNode(TransformNewNode element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkTransformNewNode()");
				gpMapper.insertTransformNewNode(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:TransformNewNode:error", "sinkTransformNewNode", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:TransformNewNode:error", "sinkTransformNewNode", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processMska(String value, Collector<Mska> out) {
		try {
			Mska data = JSONUtil.toBean(value, Mska.class);
			Mska exist = gpMapper.selectMska(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Mska:error", "processMska", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkMska(Mska element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkMska()");
				gpMapper.insertMska(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Mska:error", "sinkMska", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Mska:error", "sinkMska", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processKonv(String value, Collector<Konv> out) {
		try {
			Konv data = JSONUtil.toBean(value, Konv.class);
			Konv exist = gpMapper.selectKonv(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Konv:error", "processKonv", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkKonv(Konv element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkKonv()");
				gpMapper.insertKonv(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Konv:error", "sinkKonv", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Konv:error", "sinkKonv", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processZmdpc(String value, Collector<Zmdpc> out) {
		try {
			Zmdpc data = JSONUtil.toBean(value, Zmdpc.class);
			Zmdpc exist = gpMapper.selectZmdpc(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Zmdpc:error", "processZmdpc", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkZmdpc(Zmdpc element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkZmdpc()");
				gpMapper.insertZmdpc(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Zmdpc:error", "sinkZmdpc", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Zmdpc:error", "sinkZmdpc", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processVbpa(String value, Collector<Vbpa> arg2) {
		try {
			Vbpa data = JSONUtil.toBean(value, Vbpa.class);
			Vbpa exist = gpMapper.selectVbpa(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbpa:error", "processVbpa", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkVbpa(Vbpa element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkVbpa()");
				gpMapper.insertVbpa(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Vbpa:error", "sinkVbpa", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbpa:error", "sinkVbpa", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processPa0002(String value, Collector<Pa0002> arg2) {
		try {
			Pa0002 data = JSONUtil.toBean(value, Pa0002.class);
			if (data.getEndda() != null) {
				String erdat2 = new StringBuffer(data.getEndda()).insert(4, "-").insert(7, "-").toString();
				Date date = DateUtil.parse(erdat2);
				data.setEndda1(date);
			}
			data.setYeWuYMC(data.getNachn() + data.getVorna());
			Pa0002 exist = gpMapper.selectPa0002(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Pa0002:error", "processPa0002", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkPa0002(Pa0002 element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkPa0002()");
				gpMapper.insertPa0002(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Pa0002:error", "sinkPa0002", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Pa0002:error", "sinkPa0002", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processT001w(String value, Collector<T001w> out) {
		try {
			T001w data = JSONUtil.toBean(value, T001w.class);
			T001w exist = gpMapper.selectT001w(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:T001w:error", "processT001w", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkT001w(T001w element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkT001w()");
				gpMapper.insertT001w(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:T001w:error", "sinkT001w", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:T001w:error", "sinkT001w", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processTKeHu(String value, Collector<TKeHu> out) {
		try {
			TKeHu data = JSONUtil.toBean(value, TKeHu.class);
			TKeHu exist = gpMapper.selectTKeHu(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:TKeHu:error", "processTKeHu", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkTKeHu(TKeHu element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkTKeHu()");
				gpMapper.insertTKeHu(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:TKeHu:error", "sinkTKeHu", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:TKeHu:error", "sinkTKeHu", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processTKeHuXiaoShouZZ(Iterable<TKeHu> arg1, Collector<TKeHuXiaoShouZZ> arg2) {
		try {
			arg1.forEach(tkeHu -> {
				List<TKeHuXiaoShouZZ> tkeHuXiaoShouZZList = hzcrmMapper.selectTKeHuXiaoShouZZ(tkeHu); // 源数据
				tkeHuXiaoShouZZList.forEach(tkeHuXiaoShouZZ -> {
					TKeHuXiaoShouZZ exist = gpMapper.selectTKeHuXiaoShouZZ(tkeHuXiaoShouZZ);
					if (exist != null) {
						tkeHuXiaoShouZZ.setExist(true); // 已经在库
					}
					arg2.collect(tkeHuXiaoShouZZ);
				});
			});
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:TKeHuXiaoShouZZ:error", "processTKeHuXiaoShouZZ", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkTKeHuXiaoShouZZ(TKeHuXiaoShouZZ element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkTKeHuXiaoShouZZ()");
				gpMapper.insertTKeHuXiaoShouZZ(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:TKeHuXiaoShouZZ:error", "sinkTKeHuXiaoShouZZ", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:TKeHuXiaoShouZZ:error", "sinkTKeHuXiaoShouZZ", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processTKeHuXiaoShouZZYeWuY(String value, Collector<TKeHuXiaoShouZZYeWuY> out) {
		try {
			TKeHuXiaoShouZZYeWuY data = JSONUtil.toBean(value, TKeHuXiaoShouZZYeWuY.class);
			TKeHuXiaoShouZZYeWuY exist = gpMapper.selectTKeHuXiaoShouZZYeWuY(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:TKeHuXiaoShouZZYeWuY:error", "processTKeHuXiaoShouZZYeWuY", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void sinkTKeHuXiaoShouZZYeWuY(TKeHuXiaoShouZZYeWuY element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkTKeHuXiaoShouZZYeWuY()");
				gpMapper.insertTKeHuXiaoShouZZYeWuY(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:TKeHuXiaoShouZZYeWuY:error", "sinkTKeHuXiaoShouZZYeWuY", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:TKeHuXiaoShouZZYeWuY:error", "sinkTKeHuXiaoShouZZYeWuY", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processKnvv(String value, Collector<Knvv> out) {
		try {
			Knvv data = JSONUtil.toBean(value, Knvv.class);
			Knvv exist = gpMapper.selectKnvv(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Knvv:error", "processKnvv", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkKnvv(Knvv element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkKnvv()");
				gpMapper.insertKnvv(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Knvv:error", "sinkKnvv", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Knvv:error", "sinkKnvv", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processKnkk(String value, Collector<Knkk> out) {
		try {
			Knkk data = JSONUtil.toBean(value, Knkk.class);
			Knkk exist = gpMapper.selectKnkk(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Knkk:error", "processKnkk", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkKnkk(Knkk element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkKnkk()");
				gpMapper.insertKnkk(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Knkk:error", "sinkKnkk", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Knkk:error", "sinkKnkk", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processS066(String value, Collector<S066> out) {
		try {
			S066 data = JSONUtil.toBean(value, S066.class);
			S066 exist = gpMapper.selectS066(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				String sptags = data.getSptags(); // 日期转义
				if (sptags == null || sptags.equals("00000000") || StrUtil.isBlank(sptags)) {
					Date date = DateUtil.parse("1970-01-01 00:00:00").toJdkDate();
					data.setSptag(date);
				} else {
					String erdat2 = new StringBuffer(sptags).insert(4, "-").insert(7, "-").toString();
					Date date = DateUtil.parse(erdat2);
					data.setSptag(date);
				}
				if (data.getSptags() == null) {
					data.setSptags("00000000");
				}
				if (data.getSpwocs() == null) {
					data.setSpwocs("000000");
				}
				if (data.getSpbups() == null) {
					data.setSpbups("000000");
				}
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:S066:error", "processS066", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkS066(S066 element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkS066()");
				gpMapper.insertS066(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:S066:error", "sinkS066", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:S066:error", "sinkS066", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}

	public void processS067(String value, Collector<S067> arg2) {
		try {
			S067 data = JSONUtil.toBean(value, S067.class);
			S067 exist = gpMapper.selectS067(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				String sptags = data.getSptags(); // 日期转义
				if (sptags == null || sptags.equals("00000000") || StrUtil.isBlank(sptags)) {
					Date date = DateUtil.parse("1970-01-01 00:00:00").toJdkDate();
					data.setSptag(date);
				} else {
					String erdat2 = new StringBuffer(sptags).insert(4, "-").insert(7, "-").toString();
					Date date = DateUtil.parse(erdat2);
					data.setSptag(date);
				}
				if (data.getSptags() == null) {
					data.setSptags("00000000");
				}
				if (data.getSpwocs() == null) {
					data.setSpwocs("000000");
				}
				if (data.getSpbups() == null) {
					data.setSpbups("000000");
				}
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:S067:error", "processS067", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkS067(S067 element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkS067()");
				gpMapper.insertS067(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:S067:error", "sinkS067", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:S067:error", "sinkS067", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processTWuLiaoDB(Iterable<TKeHu> arg1, Collector<TWuLiaoDB> arg2) {
		try {
			arg1.forEach(tkeHu -> {
				List<TWuLiaoDB> twuLiaoDBList = hzcrmMapper.selectTWuLiaoDB(tkeHu); // 源数据
				twuLiaoDBList.forEach(twuLiaoDB -> {
					TWuLiaoDB exist = gpMapper.selectTWuLiaoDB(twuLiaoDB);
					if (exist != null) {
						twuLiaoDB.setExist(true); // 已经在库
					}
					arg2.collect(twuLiaoDB);
				});
			});
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:TWuLiaoDB:error", "processTWuLiaoDB", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkTWuLiaoDB(TWuLiaoDB element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkTWuLiaoDB()");
				gpMapper.insertTWuLiaoDB(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:TWuLiaoDB:error", "sinkTWuLiaoDB", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:TWuLiaoDB:error", "sinkTWuLiaoDB", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processTransformHistoryNode(String value, Collector<TransformHistoryNode> arg2) {
		try {
			TransformHistoryNode data = JSONUtil.toBean(value, TransformHistoryNode.class);
			TransformHistoryNode exist = gpMapper.selectTransformHistoryNode(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			arg2.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:TransformHistoryNode:error", "processTransformHistoryNode", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkTransformHistoryNode(TransformHistoryNode element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkTransformHistoryNode()");
				gpMapper.insertTransformHistoryNode(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:TransformHistoryNode:error", "sinkTransformHistoryNode", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:TransformHistoryNode:error", "sinkTransformHistoryNode", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processTvkbt(String value, Collector<Tvkbt> out) {
		try {
			Tvkbt data = JSONUtil.toBean(value, Tvkbt.class);
			Tvkbt exist = gpMapper.selectTvkbt(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Tvkbt:error", "processTvkbt", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void sinkTvkbt(Tvkbt element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkTvkbt()");
				gpMapper.insertTvkbt(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Tvkbt:error", "sinkTvkbt", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Tvkbt:error", "sinkTvkbt", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	
	// ----------------- 以下代码泛型化 -----------------
	public void processTasks(Tasks data, Collector<Tasks> out) {
		try {
			Tasks exist = gpMapper.selectTasks(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Tasks:error", "processTasks", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkTasks(Tasks element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkTasks()");
				gpMapper.insertTasks(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Tasks:error", "sinkTasks", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Tasks:error", "sinkTasks", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void processZsdfhzl(Zsdfhzl data, Collector<Zsdfhzl> out) {
		try {
			Zsdfhzl exist = gpMapper.selectZsdfhzl(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				try {
					if (data.getCdate() != null && data.getCtime() != null) {
						String erdat2 = new StringBuffer(data.getCdate()).insert(4, "-").insert(7, "-").toString();
						String erzet2 = new StringBuffer(data.getCtime()).insert(2, ":").insert(5, ":").toString();
						String dateStr = erdat2 + " " + erzet2;
						Date date = DateUtil.parse(dateStr);
						data.setCdate1(date);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Zsdfhzl:error", "processZsdfhzl1", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
				try {
					if (data.getFh_date() != null && data.getFh_date().indexOf("--") == -1) {
						String erdat2 = new StringBuffer(data.getFh_date()).insert(4, "-").insert(7, "-").toString();
						Date date = DateUtil.parse(erdat2);
						data.setFh_date1(date);
					}
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Zsdfhzl:error", "processZsdfhzl2", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Zsdfhzl:error", "processZsdfhzl", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkZsdfhzl(Zsdfhzl element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkZsdfhzl()");
				gpMapper.insertZsdfhzl(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Zsdfhzl:error", "sinkZsdfhzl", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Zsdfhzl:error", "sinkZsdfhzl", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void processVbak(Vbak data, Collector<Vbak> out) {
		try {
			Vbak exist = gpMapper.selectVbak(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				try {
					data.setAudat1(caDate(data.getAudat())); // 日期00000000格式转换,已处理异常
				} catch (Exception e) {
					redis1Template.opsForHash().put("huazheng:Vbak:error", "processVbak1", getErrorInfoFromException(e));
					log.error(e.getMessage());
				}
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbak:error", "processVbak", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkVbak(Vbak element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkVbak()");
				gpMapper.insertVbak(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Vbak:error", "sinkVbak", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Vbak:error", "sinkVbak", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void processBsid(Bsid bsid, Collector<Bsid> out) {
		try {
			if (StrUtil.isBlank(bsid.getUmsks())) {
				bsid.setUmskz(""); // 属于主键组，不能为空
			}
			String augdts = bsid.getAugdts(); // 日期转义
			if (augdts == null || augdts.equals("00000000") || StrUtil.isBlank(augdts)) {
				Date date = DateUtil.parse("1970-01-01 00:00:00");
				bsid.setAugdt(date);
			} else {
				String erdat2 = new StringBuffer(augdts).insert(4, "-").insert(7, "-").toString();
				Date date = DateUtil.parse(erdat2);
				bsid.setAugdt(date);
			}
			String zfbdts = bsid.getZfbdts(); // 转义日期
			if (zfbdts == null || zfbdts.equals("00000000") || StrUtil.isBlank(zfbdts)) {
				Date date = DateUtil.parse("1970-01-01 00:00:00");
				bsid.setZfbdt(date);
			} else {
				String erdat2 = new StringBuffer(zfbdts).insert(4, "-").insert(7, "-").toString();
				Date date = DateUtil.parse(erdat2);
				bsid.setZfbdt(date);
			}
			String budats = bsid.getBudats(); // 转义日期
			if (budats == null || budats.equals("00000000") || StrUtil.isBlank(budats)) {
				Date date = DateUtil.parse("1970-01-01 00:00:00");
				bsid.setBudat(date);
				bsid.setBudatc("1970-01");
				bsid.setDqsjc(null); // 到期时间不用计算
			} else {
				String erdat2 = new StringBuffer(budats).insert(4, "-").insert(7, "-").toString();
				Date date = DateUtil.parse(erdat2);
				bsid.setBudat(date);
				bsid.setBudatc(DateUtil.format(date, "yyyy-MM"));
				if ("Z001".equals(bsid.getZterm())) {
					bsid.setDqsjc(bsid.getZfbdt()); // 现款，到期时间=基准日期
				} else {
					int budatDay = Integer.parseInt(DateUtil.format(bsid.getBudat(), "dd")); // 过账日期
					if (budatDay > 26) { // budat(过账日期) > 26号 ：zfbdt(基准日期)+2个月
						bsid.setDqsjc(DateUtil.offset(bsid.getZfbdt(), DateField.MONTH, 2)); // 到期时间
						// 根据过账日期判断日是否>26，大于的话，就在过账日期的基础上加一个月，小于等于的话就是不变
						bsid.setBudatd(DateUtil.format(DateUtil.offset(bsid.getBudat(), DateField.MONTH, 1), "yyyy-MM"));
					} else if (budatDay <= 26) { // budat(过账日期) <= 26号 ：zfbdt(基准日期)+1个月
						bsid.setDqsjc(DateUtil.offset(bsid.getZfbdt(), DateField.MONTH, 1)); // 到期时间
						// 根据过账日期判断日是否>26，大于的话，就在过账日期的基础上加一个月，小于等于的话就是不变
						bsid.setBudatd(DateUtil.format(bsid.getBudat(), "yyyy-MM"));
					}
				}
			}
			Bsid exist = gpMapper.selectBsid(bsid);
			if (exist != null) {
				bsid.setExist(true); // 已经在库
			}
			out.collect(bsid);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Bsid:error", "processBsid", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkBsid(Bsid element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkBsid()");
				gpMapper.insertBsid(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Bsid:error", "sinkBsid", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Bsid:error", "sinkBsid", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void processBsad(Bsad bsad, Collector<Bsad> out) {
		try {
			if (StrUtil.isBlank(bsad.getUmsks())) {
				bsad.setUmskz(""); // 属于主键组，不能为空
			}
			String augdts = bsad.getAugdts(); // 日期转义
			if (augdts == null || augdts.equals("00000000") || StrUtil.isBlank(augdts)) {
				Date date = DateUtil.parse("1970-01-01 00:00:00");
				bsad.setAugdt(date);
			} else {
				String erdat2 = new StringBuffer(augdts).insert(4, "-").insert(7, "-").toString();
				Date date = DateUtil.parse(erdat2);
				bsad.setAugdt(date);
			}
			String zfbdts = bsad.getZfbdts(); // 转义日期
			if (zfbdts == null || zfbdts.equals("00000000") || StrUtil.isBlank(zfbdts)) {
				Date date = DateUtil.parse("1970-01-01 00:00:00");
				bsad.setZfbdt(date);
			} else {
				String erdat2 = new StringBuffer(zfbdts).insert(4, "-").insert(7, "-").toString();
				Date date = DateUtil.parse(erdat2);
				bsad.setZfbdt(date);
			}
			String budats = bsad.getBudats(); // 转义日期
			if (budats == null || budats.equals("00000000") || StrUtil.isBlank(budats)) {
				Date date = DateUtil.parse("1970-01-01 00:00:00");
				bsad.setBudat(date);
				bsad.setBudatc("1970-01");
				bsad.setDqsjc(null); // 到期时间不用计算
			} else {
				String erdat2 = new StringBuffer(budats).insert(4, "-").insert(7, "-").toString();
				Date date = DateUtil.parse(erdat2);
				bsad.setBudat(date);
				bsad.setBudatc(DateUtil.format(date, "yyyy-MM"));
				if ("Z001".equals(bsad.getZterm())) {
					bsad.setDqsjc(bsad.getZfbdt()); // 现款，到期时间=基准日期
				} else {
					int budatDay = Integer.parseInt(DateUtil.format(bsad.getBudat(), "dd")); // 过账日期
					if (budatDay > 26) { // budat(过账日期) > 26号 ：zfbdt(基准日期)+2个月
						bsad.setDqsjc(DateUtil.offset(bsad.getZfbdt(), DateField.MONTH, 2)); // 到期时间
						// 根据过账日期判断日是否>26，大于的话，就在过账日期的基础上加一个月，小于等于的话就是不变
						bsad.setBudatd(DateUtil.format(DateUtil.offset(bsad.getBudat(), DateField.MONTH, 1), "yyyy-MM"));
					} else if (budatDay <= 26) { // budat(过账日期) <= 26号 ：zfbdt(基准日期)+1个月
						bsad.setDqsjc(DateUtil.offset(bsad.getZfbdt(), DateField.MONTH, 1)); // 到期时间
						// 根据过账日期判断日是否>26，大于的话，就在过账日期的基础上加一个月，小于等于的话就是不变
						bsad.setBudatd(DateUtil.format(bsad.getBudat(), "yyyy-MM"));
					}
				}
			}
			Bsad exist = gpMapper.selectBsad(bsad);
			if (exist != null) {
				bsad.setExist(true); // 已经在库
			}
			out.collect(bsad);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Bsad:error", "processBsad", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkBsad(Bsad element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkBsad()");
				gpMapper.insertBsad(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Bsad:error", "sinkBsad", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Bsad:error", "sinkBsad", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void processPersonComp(PersonComp data, Collector<PersonComp> out) {
		try {
			PersonComp exist = gpMapper.selectPersonComp(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			} else {
				data.setId(UUID.randomUUID().toString());
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:PersonComp:error", "processPersonComp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkPersonComp(PersonComp element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkPersonComp()");
				gpMapper.insertPersonComp(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:PersonComp:error", "sinkPersonComp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:PersonComp:error", "sinkPersonComp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void processAfvc(Afvc data, Collector<Afvc> out) {
		try {
			Afvc exist = gpMapper.selectAfvc(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Afvc:error", "processAfvc", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkAfvc(Afvc element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkAfvc()");
				gpMapper.insertAfvc(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Afvc:error", "sinkAfvc", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Afvc:error", "sinkAfvc", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processMkpf(Mkpf data, Collector<Mkpf> out) {
		try {
			Mkpf exist = gpMapper.selectMkpf(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Mkpf:error", "processMkpf", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkMkpf(Mkpf element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkMkpf()");
				gpMapper.insertMkpf(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Mkpf:error", "sinkMkpf", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Mkpf:error", "sinkMkpf", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processMseg(Mseg data, Collector<Mseg> out) {
		try {
			Mseg exist = gpMapper.selectMseg(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Mseg:error", "processMseg", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkMseg(Mseg element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkMseg()");
				gpMapper.insertMseg(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Mseg:error", "sinkMseg", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Mseg:error", "sinkMseg", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processAfru(Afru data, Collector<Afru> out) {
		try {
			Afru exist = gpMapper.selectAfru(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Afru:error", "processAfru", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkAfru(Afru element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkAfru()");
				gpMapper.insertAfru(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Afru:error", "sinkAfru", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Afru:error", "sinkAfru", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processTspat(Tspat data, Collector<Tspat> out) {
		try {
			Tspat exist = gpMapper.selectTspat(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Tspat:error", "processTspat", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkTspat(Tspat element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkTspat()");
				gpMapper.insertTspat(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Tspat:error", "sinkTspat", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Tspat:error", "sinkTspat", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processZpoedit(Zpoedit data, Collector<Zpoedit> out) {
		try {
			Zpoedit exist = gpMapper.selectZpoedit(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Zpoedit:error", "processZpoedit", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkZpoedit(Zpoedit element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkZpoedit()");
				gpMapper.insertZpoedit(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Zpoedit:error", "sinkZpoedit", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Zpoedit:error", "sinkZpoedit", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processAusp(Ausp data, Collector<Ausp> out) {
		try {
			Ausp exist = gpMapper.selectAusp(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Ausp:error", "processAusp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkAusp(Ausp element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkAusp()");
				gpMapper.insertAusp(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Ausp:error", "sinkAusp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Ausp:error", "sinkAusp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processKnvp(Knvp data, Collector<Knvp> out) {
		try {
			Knvp exist = gpMapper.selectKnvp(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Knvp:error", "processKnvp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkKnvp(Knvp element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkKnvp()");
				gpMapper.insertKnvp(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Knvp:error", "sinkKnvp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Knvp:error", "sinkKnvp", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	
	public void processBkpf(Bkpf data, Collector<Bkpf> out) {
		try {
			Bkpf exist = gpMapper.selectBkpf(data);
			if (exist != null) {
				data.setExist(true); // 已经在库
			}
			out.collect(data);
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Bkpf:error", "processBkpf", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
	public void sinkBkpf(Bkpf element) {
		try {
			if (element.isExist() == false) {
				log.debug("GPServiceImpl.sinkBkpf()");
				gpMapper.insertBkpf(element);
			}
		} catch (RuntimeException e) {
			redis1Template.opsForHash().put("huazheng:Bkpf:error", "sinkBkpf", getErrorInfoFromException(e));
			log.error(e.getMessage());
		} catch (Exception e) {
			redis1Template.opsForHash().put("huazheng:Bkpf:error", "sinkBkpf", getErrorInfoFromException(e));
			log.error(e.getMessage());
		}
	}
}
