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

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;

import com.huazheng.project.greenplum.mapper.GPMapper;
import com.huazheng.project.greenplum.utils.SomeUtils;
import com.huazheng.project.hana.mapper.SapMapper;
import com.huazheng.project.hana.model.Afko;
import com.huazheng.project.hana.model.Afpo;
import com.huazheng.project.hana.model.Aufk;
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.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.Pa0002;
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.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.mssql4.mapper.UltimusDBMapper;
import com.huazheng.project.mssql4.model.Tasks;
import com.huazheng.project.mysql.mapper.TmsMapper;
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.thread.ThreadUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONUtil;
import lombok.extern.log4j.Log4j2;

@Log4j2
@Service
public class CheckDeleteServiceImpl {

	@Autowired
	private RedisTemplate<String, String> redis1Template;
	@Autowired
	private GPMapper gpMapper;
	@Autowired
	private SapMapper sapMapper;
	@Autowired
	private CrmMapper crmMapper;
	@Autowired
	private TmsMapper tmsMapper;
	@Autowired
	private HzcrmMapper hzcrmMapper;
	@Autowired
	private UltimusDBMapper ultimusDBMapper;
	
	public void checkJob7() {
		selectAufkCheckByDelete();
		selectAfkoCheckByDelete();
		selectAfpoCheckByDelete();
		selectBkpfCheckByDelete();
		selectKna1CheckByDelete();
		selectPa0002CheckByDelete();
		selectZsd06CheckByDelete();
		selectZsdfhzlCheckByDelete();
		selectMaraCheckByDelete();
		selectAuspCheckByDelete();
		selectKnvvCheckByDelete();
		selectKonvCheckByDelete();
		selectMaktCheckByDelete();
		selectVbukCheckByDelete();
		selectZpoeditCheckByDelete();
		selectBsadCheckByDelete();
		selectBsidCheckByDelete();
		selectZmdpcCheckByDelete();
		selectSalesForecastProcessCheckByDelete();
		selectHandoverCheckByDelete();
		selectHandoverTaskCheckByDelete();
		selectTransformHistoryNodeCheckByDelete();
		selectTransformNewNodeCheckByDelete();
		selectSalesForecastProcessMXCheckByDelete();
	}
	
	public void selectAufkCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Aufk:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Aufk:rowNum");
			Aufk build = Aufk.builder().rowNum(rowNum).build();
			
			List<Aufk> list = gpMapper.selectAufkCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Aufk:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Aufk source = sapMapper.selectAufkById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteAufk(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Aufk:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectAufkcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Aufk:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectAfkoCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Afko:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Afko:rowNum");
			Afko build = Afko.builder().rowNum(rowNum).build();
			
			List<Afko> list = gpMapper.selectAfkoCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Afko:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Afko source = sapMapper.selectAfkoById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteAfko(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Afko:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectAfkocheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Afko:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectAfpoCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Afpo:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Afpo:rowNum");
			Afpo build = Afpo.builder().rowNum(rowNum).build();
			
			List<Afpo> list = gpMapper.selectAfpoCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Afpo:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Afpo source = sapMapper.selectAfpoById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteAfpo(target); // 删除数仓中的数据
					operator = "delete";
				}

				redis1Template.opsForValue().set("huazheng:checkDelete:Afpo:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectAfpocheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Afpo:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectBkpfCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Bkpf:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Bkpf:rowNum");
			Bkpf build = Bkpf.builder().rowNum(rowNum).build();
			
			List<Bkpf> list = gpMapper.selectBkpfCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Bkpf:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Bkpf source = sapMapper.selectBkpfById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteBkpf(target); // 删除数仓中的数据
					operator = "delete";
				}

				redis1Template.opsForValue().set("huazheng:checkDelete:Bkpf:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectBkpfcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Bkpf:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectKna1CheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Kna1:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Kna1:rowNum");
			Kna1 build = Kna1.builder().rowNum(rowNum).build();
			
			List<Kna1> list = gpMapper.selectKna1Check(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Kna1:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Kna1 source = sapMapper.selectKna1ById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteKna1(target); // 删除数仓中的数据
					operator = "delete";
				}

				redis1Template.opsForValue().set("huazheng:checkDelete:Kna1:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectKna1checkDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Kna1:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	
	public void selectPa0002CheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Pa0002:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Pa0002:rowNum");
			Pa0002 build = Pa0002.builder().rowNum(rowNum).build();

			List<Pa0002> list = gpMapper.selectPa0002Check(build); // 从数仓中查询一组数据
			if (list.size() == 0) { // rowid已完成，则转为由更新时间字段开始同步
				redis1Template.opsForValue().set("huazheng:checkDelete:Pa0002:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}

			list.forEach(target -> { // 遍历要检查的数据
				Pa0002 source = sapMapper.selectPa0002ById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deletePa0002(target); // 删除数仓中的数据
					operator = "delete";
				}

				redis1Template.opsForValue().set("huazheng:checkDelete:Pa0002:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectPa0002checkDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Pa0002:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	
	
	public void selectZsd06CheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Zsd06:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Zsd06:rowNum");
			Zsd06 build = Zsd06.builder().rowNum(rowNum).build();

			List<Zsd06> list = gpMapper.selectZsd06Check(build); // 从数仓中查询一组数据
			if (list.size() == 0) { // rowid已完成，则转为由更新时间字段开始同步
				redis1Template.opsForValue().set("huazheng:checkDelete:Zsd06:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}

			list.forEach(target -> { // 遍历要检查的数据
				Zsd06 source = sapMapper.selectZsd06ById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteZsd06(target); // 删除数仓中的数据
					operator = "delete";
				}
				
				redis1Template.opsForValue().set("huazheng:checkDelete:Zsd06:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectZsd06checkDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Zsd06:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectZsdfhzlCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Zsdfhzl:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Zsdfhzl:rowNum");
			Zsdfhzl build = Zsdfhzl.builder().rowNum(rowNum).build();

			List<Zsdfhzl> list = gpMapper.selectZsdfhzlCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) { // rowid已完成，则转为由更新时间字段开始同步
				redis1Template.opsForValue().set("huazheng:checkDelete:Zsdfhzl:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}

			list.forEach(target -> { // 遍历要检查的数据
				Zsdfhzl source = sapMapper.selectZsdfhzlById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteZsdfhzl(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Zsdfhzl:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectZsdfhzlcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Zsdfhzl:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectMaraCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Mara:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Mara:rowNum");
			Mara build = Mara.builder().rowNum(rowNum).build();
			
			List<Mara> list = gpMapper.selectMaraCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Mara:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Mara source = sapMapper.selectMaraById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteMara(target); // 删除数仓中的数据
					operator = "delete";
				}
				
				redis1Template.opsForValue().set("huazheng:checkDelete:Mara:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectMaracheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Mara:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectAuspCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Ausp:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Ausp:rowNum");
			Ausp build = Ausp.builder().rowNum(rowNum).build();
			
			List<Ausp> list = gpMapper.selectAuspCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Ausp:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Ausp source = sapMapper.selectAuspById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteAusp(target); // 删除数仓中的数据
					operator = "delete";
				}
				
				redis1Template.opsForValue().set("huazheng:checkDelete:Ausp:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectAuspcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Ausp:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectKnvvCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Knvv:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Knvv:rowNum");
			Knvv build = Knvv.builder().rowNum(rowNum).build();
			
			List<Knvv> list = gpMapper.selectKnvvCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Knvv:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Knvv source = sapMapper.selectKnvvById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteKnvv(target); // 删除数仓中的数据
					operator = "delete";
				} else { // 源库中有数据
					String shash = SecureUtil.md5(JSONUtil.toJsonStr(source)); // 源库中数据的hash结果
					String thash = target.getHashResult(); // 数仓中数据的hash结果
					if (!shash.equals(thash)) { // 如果hash结果不一致
						source.setHashResult(shash);
						while (true) {
							try {
								gpMapper.updateKnvv(source); // 更新数据到数仓中
								break;
							} catch (RuntimeException e) {
								log.error(e.getMessage());ThreadUtil.safeSleep(500);
							}
						}
						ThreadUtil.safeSleep(500);
					}
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Knvv:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectKnvvcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Knvv:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	
	public void selectKonvCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Konv:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Konv:rowNum");
			Konv build = Konv.builder().rowNum(rowNum).build();
			
			List<Konv> list = gpMapper.selectKonvCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Konv:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Konv source = sapMapper.selectKonvById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteKonv(target); // 删除数仓中的数据
					operator = "delete";
				}
				
				redis1Template.opsForValue().set("huazheng:checkDelete:Konv:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectKonvcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Konv:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectMaktCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Makt:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Makt:rowNum");
			Makt build = Makt.builder().rowNum(rowNum).build();
			
			List<Makt> list = gpMapper.selectMaktCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Makt:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Makt source = sapMapper.selectMaktById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteMakt(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Makt:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectMaktcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Makt:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectVbukCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Vbuk:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Vbuk:rowNum");
			Vbuk build = Vbuk.builder().rowNum(rowNum).build();
			
			List<Vbuk> list = gpMapper.selectVbukCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Vbuk:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Vbuk source = sapMapper.selectVbukById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteVbuk(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Vbuk:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectVbukcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Vbuk:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectZpoeditCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Zpoedit:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Zpoedit:rowNum");
			Zpoedit build = Zpoedit.builder().rowNum(rowNum).build();
			
			List<Zpoedit> list = gpMapper.selectZpoeditCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Zpoedit:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Zpoedit source = sapMapper.selectZpoeditById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteZpoedit(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Zpoedit:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectZpoeditcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Zpoedit:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectBsadCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Bsad:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Bsad:rowNum");
			Bsad build = Bsad.builder().rowNum(rowNum).build();
			
			List<Bsad> list = gpMapper.selectBsadCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Bsad:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Bsad source = sapMapper.selectBsadById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteBsad(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Bsad:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectBsadcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Bsad:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectBsidCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Bsid:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Bsid:rowNum");
			Bsid build = Bsid.builder().rowNum(rowNum).build();
			
			List<Bsid> list = gpMapper.selectBsidCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Bsid:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Bsid source = sapMapper.selectBsidById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteBsid(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Bsid:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectBsidcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Bsid:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	
	public void selectZmdpcCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Zmdpc:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Zmdpc:rowNum");
			Zmdpc build = Zmdpc.builder().rowNum(rowNum).build();
			
			List<Zmdpc> list = gpMapper.selectZmdpcCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Zmdpc:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Zmdpc source = sapMapper.selectZmdpcById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteZmdpc(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Zmdpc:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectZmdpccheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Zmdpc:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	
	public void selectSalesForecastProcessCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:SalesForecastProcess:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:SalesForecastProcess:rowNum");
			SalesForecastProcess build = SalesForecastProcess.builder().rowNum(rowNum).build();
			
			List<SalesForecastProcess> list = gpMapper.selectSalesForecastProcessCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:SalesForecastProcess:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				SalesForecastProcess source = crmMapper.selectSalesForecastProcessById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteSalesForecastProcess(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:SalesForecastProcess:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectSalesForecastProcesscheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:SalesForecastProcess:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	
	public void selectHandoverCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Handover:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Handover:rowNum");
			Handover build = Handover.builder().rowNum(rowNum).build();
			
			List<Handover> list = gpMapper.selectHandoverCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Handover:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Handover source = tmsMapper.selectHandoverById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteHandover(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Handover:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectHandovercheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Handover:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectHandoverTaskCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:HandoverTask:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:HandoverTask:rowNum");
			HandoverTask build = HandoverTask.builder().rowNum(rowNum).build();
			
			List<HandoverTask> list = gpMapper.selectHandoverTaskCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:HandoverTask:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				HandoverTask source = tmsMapper.selectHandoverTaskById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteHandoverTask(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:HandoverTask:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectHandoverTaskcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:HandoverTask:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectTransformHistoryNodeCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:TransformHistoryNode:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:TransformHistoryNode:rowNum");
			TransformHistoryNode build = TransformHistoryNode.builder().rowNum(rowNum).build();
			
			List<TransformHistoryNode> list = gpMapper.selectTransformHistoryNodeCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:TransformHistoryNode:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				TransformHistoryNode source = tmsMapper.selectTransformHistoryNodeById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteTransformHistoryNode(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:TransformHistoryNode:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectTransformHistoryNodecheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:TransformHistoryNode:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectTransformNewNodeCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:TransformNewNode:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:TransformNewNode:rowNum");
			TransformNewNode build = TransformNewNode.builder().rowNum(rowNum).build();
			
			List<TransformNewNode> list = gpMapper.selectTransformNewNodeCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:TransformNewNode:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				TransformNewNode source = tmsMapper.selectTransformNewNodeById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteTransformNewNode(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:TransformNewNode:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectTransformNewNodecheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:TransformNewNode:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	
	public void selectSalesForecastProcessMXCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:SalesForecastProcessMX:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:SalesForecastProcessMX:rowNum");
			SalesForecastProcessMX build = SalesForecastProcessMX.builder().rowNum(rowNum).build();
			
			List<SalesForecastProcessMX> list = gpMapper.selectSalesForecastProcessMXCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:SalesForecastProcessMX:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				SalesForecastProcessMX source = crmMapper.selectSalesForecastProcessMXById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteSalesForecastProcessMX(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:SalesForecastProcessMX:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectSalesForecastProcessMXcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:SalesForecastProcessMX:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	

	// 独立的
	public void selectSalesContractProcessCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:SalesContractProcess:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:SalesContractProcess:rowNum");
			SalesContractProcess build = SalesContractProcess.builder().rowNum(rowNum).build();
			
			List<SalesContractProcess> list = gpMapper.selectSalesContractProcessCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:SalesContractProcess:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				SalesContractProcess source = crmMapper.selectSalesContractProcessById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteSalesContractProcess(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:SalesContractProcess:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectSalesContractProcesscheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:SalesContractProcess:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectSampleApplicationProcessCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:SampleApplicationProcess:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:SampleApplicationProcess:rowNum");
			SampleApplicationProcess build = SampleApplicationProcess.builder().rowNum(rowNum).build();
			
			List<SampleApplicationProcess> list = gpMapper.selectSampleApplicationProcessCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:SampleApplicationProcess:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				SampleApplicationProcess source = crmMapper.selectSampleApplicationProcessById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteSampleApplicationProcess(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:SampleApplicationProcess:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectSampleApplicationProcesscheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:SampleApplicationProcess:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	
	public void selectSalesInquiryProcessCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:SalesInquiryProcess:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:SalesInquiryProcess:rowNum");
			SalesInquiryProcess build = SalesInquiryProcess.builder().rowNum(rowNum).build();
			
			List<SalesInquiryProcess> list = gpMapper.selectSalesInquiryProcessCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:SalesInquiryProcess:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				SalesInquiryProcess source = crmMapper.selectSalesInquiryProcessById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteSalesInquiryProcess(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:SalesInquiryProcess:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectSalesInquiryProcesscheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:SalesInquiryProcess:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectSampleClosingProcessCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:SampleClosingProcess:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:SampleClosingProcess:rowNum");
			SampleClosingProcess build = SampleClosingProcess.builder().rowNum(rowNum).build();
			
			List<SampleClosingProcess> list = gpMapper.selectSampleClosingProcessCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:SampleClosingProcess:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				SampleClosingProcess source = crmMapper.selectSampleClosingProcessById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteSampleClosingProcess(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:SampleClosingProcess:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectSampleClosingProcesscheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:SampleClosingProcess:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectSalesContractProcessMXCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:SalesContractProcessMX:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:SalesContractProcessMX:rowNum");
			SalesContractProcessMX build = SalesContractProcessMX.builder().rowNum(rowNum).build();
			
			List<SalesContractProcessMX> list = gpMapper.selectSalesContractProcessMXCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:SalesContractProcessMX:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				SalesContractProcessMX source = crmMapper.selectSalesContractProcessMXById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteSalesContractProcessMX(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:SalesContractProcessMX:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectSalesContractProcessMXcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:SalesContractProcessMX:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectSampleApplicationProcessMingXiCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:SampleApplicationProcessMingXi:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:SampleApplicationProcessMingXi:rowNum");
			SampleApplicationProcessMingXi build = SampleApplicationProcessMingXi.builder().rowNum(rowNum).build();
			
			List<SampleApplicationProcessMingXi> list = gpMapper.selectSampleApplicationProcessMingXiCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:SampleApplicationProcessMingXi:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				SampleApplicationProcessMingXi source = crmMapper.selectSampleApplicationProcessMingXiById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteSampleApplicationProcessMingXi(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:SampleApplicationProcessMingXi:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectSampleApplicationProcessMingXicheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:SampleApplicationProcessMingXi:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	
	public void selectSalesInquiryProcessMXCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:SalesInquiryProcessMX:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:SalesInquiryProcessMX:rowNum");
			SalesInquiryProcessMX build = SalesInquiryProcessMX.builder().rowNum(rowNum).build();
			
			List<SalesInquiryProcessMX> list = gpMapper.selectSalesInquiryProcessMXCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:SalesInquiryProcessMX:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				SalesInquiryProcessMX source = crmMapper.selectSalesInquiryProcessMXById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteSalesInquiryProcessMX(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:SalesInquiryProcessMX:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectSalesInquiryProcessMXcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:SalesInquiryProcessMX:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectSampleClosingProcessMingXiCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:SampleClosingProcessMingXi:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:SampleClosingProcessMingXi:rowNum");
			SampleClosingProcessMingXi build = SampleClosingProcessMingXi.builder().rowNum(rowNum).build();
			
			List<SampleClosingProcessMingXi> list = gpMapper.selectSampleClosingProcessMingXiCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:SampleClosingProcessMingXi:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				SampleClosingProcessMingXi source = crmMapper.selectSampleClosingProcessMingXiById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteSampleClosingProcessMingXi(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:SampleClosingProcessMingXi:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectSampleClosingProcessMingXicheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:SampleClosingProcessMingXi:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	
	// 独立的
	public void selectLikpCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Likp:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Likp:rowNum");
			Likp build = Likp.builder().rowNum(rowNum).build();
			
			List<Likp> list = gpMapper.selectLikpCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) { // rowid已完成，则转为由更新时间字段开始同步
				redis1Template.opsForValue().set("huazheng:checkDelete:Likp:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Likp source = sapMapper.selectLikpById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteLikp(target); // 删除数仓中的数据
					operator = "delete";
				}

				redis1Template.opsForValue().set("huazheng:checkDelete:Likp:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectLikpcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Likp:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectLipsCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Lips:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Lips:rowNum");
			Lips build = Lips.builder().rowNum(rowNum).build();

			List<Lips> list = gpMapper.selectLipsCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) { // rowid已完成，则转为由更新时间字段开始同步
				redis1Template.opsForValue().set("huazheng:checkDelete:Lips:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}

			list.forEach(target -> { // 遍历要检查的数据
				Lips source = sapMapper.selectLipsById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteLips(target); // 删除数仓中的数据
					operator = "delete";
				}

				redis1Template.opsForValue().set("huazheng:checkDelete:Lips:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectLipscheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Lips:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectVbakCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Vbak:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Vbak:rowNum");
			Vbak build = Vbak.builder().rowNum(rowNum).build();

			List<Vbak> list = gpMapper.selectVbakCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Vbak:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}

			list.forEach(target -> { // 遍历要检查的数据
				Vbak source = sapMapper.selectVbakById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteVbak(target); // 删除数仓中的数据
					operator = "delete";
				}

				redis1Template.opsForValue().set("huazheng:checkDelete:Vbak:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectVbakcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Vbak:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectVbapCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Vbap:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Vbap:rowNum");
			Vbap build = Vbap.builder().rowNum(rowNum).build();

			List<Vbap> list = gpMapper.selectVbapCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) { // rowid已完成，则转为由更新时间字段开始同步
				redis1Template.opsForValue().set("huazheng:checkDelete:Vbap:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}

			list.forEach(target -> { // 遍历要检查的数据
				Vbap source = sapMapper.selectVbapById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteVbap(target); // 删除数仓中的数据
					gpMapper.deleteVbapAdv(target);
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Vbap:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectVbapcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Vbap:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectVbepCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Vbep:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Vbep:rowNum");
			Vbep build = Vbep.builder().rowNum(rowNum).build();
			
			List<Vbep> list = gpMapper.selectVbepCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Vbep:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Vbep source = sapMapper.selectVbepById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteVbep(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Vbep:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectVbepcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Vbep:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectVbpaCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Vbpa:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Vbpa:rowNum");
			Vbpa build = Vbpa.builder().rowNum(rowNum).build();
			
			List<Vbpa> list = gpMapper.selectVbpaCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Vbpa:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Vbpa source = sapMapper.selectVbpaById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteVbpa(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Vbpa:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectVbpacheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Vbpa:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectVbrkCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Vbrk:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Vbrk:rowNum");
			Vbrk build = Vbrk.builder().rowNum(rowNum).build();

			List<Vbrk> list = gpMapper.selectVbrkCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) { // rowid已完成，则转为由更新时间字段开始同步
				redis1Template.opsForValue().set("huazheng:checkDelete:Vbrk:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}

			list.forEach(target -> { // 遍历要检查的数据
				Vbrk source = sapMapper.selectVbrkById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteVbrk(target); // 删除数仓中的数据
					operator = "delete";
				}

				redis1Template.opsForValue().set("huazheng:checkDelete:Vbrk:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectVbrkcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Vbrk:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectVbrpCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Vbrp:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Vbrp:rowNum");
			Vbrp build = Vbrp.builder().rowNum(rowNum).build();
			
			List<Vbrp> list = gpMapper.selectVbrpCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Vbrp:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Vbrp source = sapMapper.selectVbrpById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteVbrp(target); // 删除数仓中的数据
					operator = "delete";
				}
				
				redis1Template.opsForValue().set("huazheng:checkDelete:Vbrp:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectVbrpcheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Vbrp:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	public void selectSysSAPreturnNoCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:SysSAPreturnNo:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:SysSAPreturnNo:rowNum");
			SysSAPreturnNo build = SysSAPreturnNo.builder().rowNum(rowNum).build();
			
			List<SysSAPreturnNo> list = gpMapper.selectSysSAPreturnNoCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:SysSAPreturnNo:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				SysSAPreturnNo source = hzcrmMapper.selectSysSAPreturnNoById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteSysSAPreturnNo(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:SysSAPreturnNo:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectSysSAPreturnNocheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:SysSAPreturnNo:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	
	
	
	public void selectTasksCheckByDelete() {
		try {
			ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
			opsForValue.setIfAbsent("huazheng:checkDelete:Tasks:rowNum", "0");
			String rowNum = opsForValue.get("huazheng:checkDelete:Tasks:rowNum");
			Tasks build = Tasks.builder().rowNum(rowNum).build();
			
			List<Tasks> list = gpMapper.selectTasksCheck(build); // 从数仓中查询一组数据
			if (list.size() == 0) {
				redis1Template.opsForValue().set("huazheng:checkDelete:Tasks:rowNum", "0"); // 计数器复位
				ThreadUtil.sleep(1000); // 没有数据了，休眠一下
			}
			
			list.forEach(target -> { // 遍历要检查的数据
				Tasks source = ultimusDBMapper.selectTasksById(target); // 根据主键查询源库中的数据
				String operator = "none";
				if (source == null) { // 如果源库中没有数据
					gpMapper.deleteTasks(target); // 删除数仓中的数据
					operator = "delete";
				}
				redis1Template.opsForValue().set("huazheng:checkDelete:Tasks:rowNum", target.getRowNum());
				if (!operator.equals("none")) {
					log.info(String.format("selectTaskscheckDelete --> rowNum:%s, operator:%s", target.getRowNum(), operator));
				}
			});
		} catch (Exception e) {
			redis1Template.opsForValue().set("huazheng:checkDeleteError:Tasks:rowNum", SomeUtils.getErrorInfoFromException(e));
		}
	}
	
}
