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

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.scripting.support.ResourceScriptSource;
import org.springframework.stereotype.Service;

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.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.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.SalesForecastProcess;
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.TKeHuXiaoShouZZYeWuY;
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.date.DateUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.extern.log4j.Log4j2;

@Log4j2
@Service
public class JobServiceImpl {

	@Autowired
	private RedisTemplate<String, String> redis1Template;

	@Autowired
	private SapMapper sapMapper;
	@Autowired
	private CrmMapper crmMapper;
	@Autowired
	private TmsMapper tmsMapper;
	@Autowired
	private HzcrmMapper hzcrmMapper;
	@Autowired
	private UltimusDBMapper ultimusDBMapper;
	
	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";
		}
	}

	// ===================== sapMapper rowids =====================
	public void checkJob1() {
		selectBsidNew();
		selectBsadNew();
		selectPa0002New();
		selectTvkbtNew();
		selectAufmNew();
		selectS066New();
		selectS067New();
		selectVbukNew();
		selectKonvNew();
		selectAfkoNew();
		selectAfpoNew();
		selectAfvcNew();
		selectAuspNew();
		selectAfruNew();
		selectTspatNew();
		selectZpoeditNew();
		selectMkpfNew();
		selectT023tNew();
		selectKna1New();
		selectKnvvNew();
		selectKnkkNew();
		selectMaraNew();
		selectMaktNew();
		selectZsd06New();
		selectZmdpcNew();
		selectAufkNew();
		selectT001wNew();
		selectMskaNew();
		selectZsdfhzlNew();
		selectKnvpNew();
		selectBkpfNew();
		selectMsegNew();
	}
	private void selectBsidNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:bsid:sendcount", "huazheng:bsid:rowids", "huazheng:list:bsid");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:bsid:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:bsid:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:bsid:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:bsid:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:bsid:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:bsid:rowids"); // 标记rowids
			Bsid bsid = Bsid.builder().rowids(Long.valueOf(rowids)).build();
			List<Bsid> list = sapMapper.selectBsidNew(bsid);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectBsadNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:bsad:sendcount", "huazheng:bsad:rowids", "huazheng:list:bsad");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:bsad:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:bsad:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:bsad:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:bsad:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:bsad:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:bsad:rowids"); // 标记rowids
			Bsad bsad = Bsad.builder().rowids(Long.valueOf(rowids)).build();
			List<Bsad> list = sapMapper.selectBsadNew(bsad);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectPa0002New() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Pa0002:sendcount", "huazheng:Pa0002:rowids", "huazheng:list:Pa0002");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Pa0002:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Pa0002:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Pa0002:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Pa0002:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Pa0002:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Pa0002:rowids"); // 标记id
			Pa0002 pa0002 = Pa0002.builder().rowids(Long.valueOf(rowids)).build();
			List<Pa0002> list = sapMapper.selectPa0002New(pa0002);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectTvkbtNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Tvkbt:sendcount", "huazheng:Tvkbt:rowids", "huazheng:list:Tvkbt");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Tvkbt:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Tvkbt:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Tvkbt:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Tvkbt:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Tvkbt:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Tvkbt:rowids"); // 标记id
			Tvkbt tvkbt = Tvkbt.builder().rowids(Long.valueOf(rowids)).build();
			List<Tvkbt> list = sapMapper.selectTvkbtNew(tvkbt);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectAufmNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Aufm:sendcount", "huazheng:Aufm:rowids", "huazheng:list:Aufm");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Aufm:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Aufm:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Aufm:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Aufm:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Aufm:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Aufm:rowids"); // 标记id
			Aufm aufm = Aufm.builder().rowids(Long.valueOf(rowids)).build();
			List<Aufm> list = sapMapper.selectAufmNew(aufm);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectS066New() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:S066:sendcount", "huazheng:S066:rowids", "huazheng:list:S066");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:S066:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:S066:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:S066:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:S066:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:S066:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:S066:rowids"); // 标记id
			S066 s066 = S066.builder().rowids(Long.valueOf(rowids)).build();
			List<S066> list = sapMapper.selectS066New(s066);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectS067New() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:S067:sendcount", "huazheng:S067:rowids", "huazheng:list:S067");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:S067:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:S067:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:S067:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:S067:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:S067:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:S067:rowids"); // 标记id
			S067 s067 = S067.builder().rowids(Long.valueOf(rowids)).build();
			List<S067> list = sapMapper.selectS067New(s067);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectVbukNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Vbuk:sendcount", "huazheng:Vbuk:rowids", "huazheng:list:Vbuk");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Vbuk:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Vbuk:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Vbuk:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Vbuk:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Vbuk:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Vbuk:rowids"); // 标记id
			Vbuk vbuk = Vbuk.builder().rowids(Long.valueOf(rowids)).build();
			List<Vbuk> list = sapMapper.selectVbukNew(vbuk);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectKonvNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Konv:sendcount", "huazheng:Konv:rowids", "huazheng:list:Konv");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Konv:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Konv:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Konv:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Konv:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Konv:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Konv:rowids"); // 标记id
			Konv konv = Konv.builder().rowids(Long.valueOf(rowids)).build();
			List<Konv> list = sapMapper.selectKonvNew(konv);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectAfkoNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Afko:sendcount", "huazheng:Afko:rowids", "huazheng:list:Afko");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Afko:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Afko:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Afko:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Afko:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Afko:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Afko:rowids"); // 标记id
			Afko afko = Afko.builder().rowids(Long.valueOf(rowids)).build();
			List<Afko> list = sapMapper.selectAfkoNew(afko);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectAfvcNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Afvc:sendcount", "huazheng:Afvc:rowids", "huazheng:list:Afvc");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Afvc:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Afvc:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Afvc:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Afvc:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Afvc:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Afvc:rowids"); // 标记id
			Afvc afvc = Afvc.builder().rowids(Long.valueOf(rowids)).build();
			List<Afvc> list = sapMapper.selectAfvcNew(afvc);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectKnvpNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Knvp:sendcount", "huazheng:Knvp:rowids", "huazheng:list:Knvp");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Knvp:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Knvp:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Knvp:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Knvp:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Knvp:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Knvp:rowids"); // 标记id
			Knvp knvp = Knvp.builder().rowids(Long.valueOf(rowids)).build();
			List<Knvp> list = sapMapper.selectKnvpNew(knvp);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectAfruNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Afru:sendcount", "huazheng:Afru:rowids", "huazheng:list:Afru");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Afru:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Afru:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Afru:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Afru:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Afru:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Afru:rowids"); // 标记id
			Afru afru = Afru.builder().rowids(Long.valueOf(rowids)).build();
			List<Afru> list = sapMapper.selectAfruNew(afru);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectTspatNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Tspat:sendcount", "huazheng:Tspat:rowids", "huazheng:list:Tspat");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Tspat:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Tspat:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Tspat:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Tspat:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Tspat:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Tspat:rowids"); // 标记id
			Tspat tspat = Tspat.builder().rowids(Long.valueOf(rowids)).build();
			List<Tspat> list = sapMapper.selectTspatNew(tspat);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectZpoeditNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Zpoedit:sendcount", "huazheng:Zpoedit:rowids", "huazheng:list:Zpoedit");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Zpoedit:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Zpoedit:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Zpoedit:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Zpoedit:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Zpoedit:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Zpoedit:rowids"); // 标记id
			Zpoedit zpoedit = Zpoedit.builder().rowids(Long.valueOf(rowids)).build();
			List<Zpoedit> list = sapMapper.selectZpoeditNew(zpoedit);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectMkpfNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Mkpf:sendcount", "huazheng:Mkpf:rowids", "huazheng:list:Mkpf");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Mkpf:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Mkpf:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Mkpf:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Mkpf:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Mkpf:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Mkpf:rowids"); // 标记id
			Mkpf mkpf = Mkpf.builder().rowids(Long.valueOf(rowids)).build();
			List<Mkpf> list = sapMapper.selectMkpfNew(mkpf);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectAuspNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Ausp:sendcount", "huazheng:Ausp:rowids", "huazheng:list:Ausp");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Ausp:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Ausp:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Ausp:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Ausp:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Ausp:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Ausp:rowids"); // 标记id
			Ausp ausp = Ausp.builder().rowids(Long.valueOf(rowids)).build();
			List<Ausp> list = sapMapper.selectAuspNew(ausp);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectAfpoNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Afpo:sendcount", "huazheng:Afpo:rowids", "huazheng:list:Afpo");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Afpo:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Afpo:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Afpo:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Afpo:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Afpo:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Afpo:rowids"); // 标记id
			Afpo afpo = Afpo.builder().rowids(Long.valueOf(rowids)).build();
			List<Afpo> list = sapMapper.selectAfpoNew(afpo);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectT023tNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:T023t:sendcount", "huazheng:T023t:rowids", "huazheng:list:T023t");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:T023t:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:T023t:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:T023t:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:T023t:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:T023t:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:T023t:rowids"); // 标记id
			T023t t023t = T023t.builder().rowids(Long.valueOf(rowids)).build();
			List<T023t> list = sapMapper.selectT023tNew(t023t);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectKna1New() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Kna1:sendcount", "huazheng:Kna1:rowids", "huazheng:list:Kna1");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Kna1:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Kna1:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Kna1:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Kna1:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Kna1:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Kna1:rowids"); // 标记id
			Kna1 kna1 = Kna1.builder().rowids(Long.valueOf(rowids)).build();
			List<Kna1> list = sapMapper.selectKna1New(kna1);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					String updat = item.getUpdat();
					if ("00000000".equals(updat)) {
						item.setUpdat(null);
					} else {
						Date date = DateUtil.parse(updat, "yyyyMMdd");
						String format = DateUtil.format(date, "yyyy-MM-dd");
						item.setUpdat(format);
					}
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectKnvvNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Knvv:sendcount", "huazheng:Knvv:rowids", "huazheng:list:Knvv");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Knvv:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Knvv:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Knvv:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Knvv:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Knvv:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Knvv:rowids"); // 标记id
			Knvv knvv = Knvv.builder().rowids(Long.valueOf(rowids)).build();
			List<Knvv> list = sapMapper.selectKnvvNew(knvv);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectKnkkNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Knkk:sendcount", "huazheng:Knkk:rowids", "huazheng:list:Knkk");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Knkk:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Knkk:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Knkk:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Knkk:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Knkk:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Knkk:rowids"); // 标记id
			Knkk knkk = Knkk.builder().rowids(Long.valueOf(rowids)).build();
			List<Knkk> list = sapMapper.selectKnkkNew(knkk);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectMaraNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Mara:sendcount", "huazheng:Mara:rowids", "huazheng:list:Mara");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Mara:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Mara:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Mara:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Mara:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Mara:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Mara:rowids"); // 标记id
			Mara mara = Mara.builder().rowids(Long.valueOf(rowids)).build();
			List<Mara> list = sapMapper.selectMaraNew(mara);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectMaktNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Makt:sendcount", "huazheng:Makt:rowids", "huazheng:list:Makt");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Makt:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Makt:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Makt:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Makt:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Makt:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Makt:rowids"); // 标记id
			Makt makt = Makt.builder().rowids(Long.valueOf(rowids)).build();
			List<Makt> list = sapMapper.selectMaktNew(makt);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectZsd06New() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Zsd06:sendcount", "huazheng:Zsd06:rowids", "huazheng:list:Zsd06");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Zsd06:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Zsd06:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Zsd06:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Zsd06:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Zsd06:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Zsd06:rowids"); // 标记id
			Zsd06 zsd06 = Zsd06.builder().rowids(Long.valueOf(rowids)).build();
			List<Zsd06> list = sapMapper.selectZsd06New(zsd06);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectZmdpcNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Zmdpc:sendcount", "huazheng:Zmdpc:rowids", "huazheng:list:Zmdpc");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Zmdpc:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Zmdpc:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Zmdpc:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Zmdpc:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Zmdpc:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Zmdpc:rowids"); // 标记id
			Zmdpc zmdpc = Zmdpc.builder().rowids(Long.valueOf(rowids)).build();
			List<Zmdpc> list = sapMapper.selectZmdpcNew(zmdpc);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectAufkNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Aufk:sendcount", "huazheng:Aufk:rowids", "huazheng:list:Aufk");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Aufk:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Aufk:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Aufk:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Aufk:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Aufk:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Aufk:rowids"); // 标记id
			Aufk aufk = Aufk.builder().rowids(Long.valueOf(rowids)).build();
			List<Aufk> list = sapMapper.selectAufkNew(aufk);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					String aedat = item.getAedat();
					if ("00000000".equals(aedat)) {
						item.setAedat(null);
					} else {
						Date date = DateUtil.parse(aedat, "yyyyMMdd");
						String format = DateUtil.format(date, "yyyy-MM-dd");
						item.setAedat(format);
					}
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectT001wNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:T001w:sendcount", "huazheng:T001w:rowids", "huazheng:list:T001w");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:T001w:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:T001w:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:T001w:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:T001w:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:T001w:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:T001w:rowids"); // 标记id
			T001w t001w = T001w.builder().rowids(Long.valueOf(rowids)).build();
			List<T001w> list = sapMapper.selectT001wNew(t001w);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectMskaNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Mska:sendcount", "huazheng:Mska:rowids", "huazheng:list:Mska");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Mska:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Mska:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Mska:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Mska:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Mska:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Mska:rowids"); // 标记id
			Mska mska = Mska.builder().rowids(Long.valueOf(rowids)).build();
			List<Mska> list = sapMapper.selectMskaNew(mska);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectZsdfhzlNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Zsdfhzl:sendcount", "huazheng:Zsdfhzl:rowids", "huazheng:list:Zsdfhzl");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Zsdfhzl:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Zsdfhzl:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Zsdfhzl:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Zsdfhzl:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Zsdfhzl:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Zsdfhzl:rowids"); // 标记id
			Zsdfhzl zsdfhzl = Zsdfhzl.builder().rowids(Long.valueOf(rowids)).build();
			List<Zsdfhzl> list = sapMapper.selectZsdfhzlNew(zsdfhzl);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectBkpfNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Bkpf:sendcount", "huazheng:Bkpf:rowids", "huazheng:list:Bkpf");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Bkpf:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Bkpf:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Bkpf:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Bkpf:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Bkpf:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Bkpf:rowids"); // 标记id
			Bkpf bkpf = Bkpf.builder().rowids(Long.valueOf(rowids)).build();
			List<Bkpf> list = sapMapper.selectBkpfNew(bkpf);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					String aedat = item.getAedat();
					if ("00000000".equals(aedat)) {
						item.setAedat(null);
					} else {
						Date date = DateUtil.parse(aedat, "yyyyMMdd");
						String format = DateUtil.format(date, "yyyy-MM-dd");
						item.setAedat(format);
					}
					String cpudt = item.getCpudt();
					String cputm = item.getCputm();
					if ("00000000".equals(cpudt)) {
						item.setCpudt_cputm(null);
					} else {
						Date date = DateUtil.parse(cpudt+cputm, "yyyyMMddHHmmss");
						item.setCpudt_cputm(date);
					}
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectMsegNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Mseg:sendcount", "huazheng:Mseg:rowids", "huazheng:list:Mseg");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Mseg:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Mseg:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Mseg:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Mseg:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Mseg:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Mseg:rowids"); // 标记id
			Mseg mseg = Mseg.builder().rowids(Long.valueOf(rowids)).build();
			List<Mseg> list = sapMapper.selectMsegNew(mseg);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	
	// 独立的
	public void selectVbepNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Vbep:sendcount", "huazheng:Vbep:rowids", "huazheng:list:Vbep");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Vbep:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Vbep:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Vbep:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Vbep:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Vbep:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Vbep:rowids"); // 标记id
			Vbep vbep = Vbep.builder().rowids(Long.valueOf(rowids)).build();
			List<Vbep> list = sapMapper.selectVbepNew(vbep);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	public void selectVbapNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:vbap:sendcount", "huazheng:vbap:rowids", "huazheng:list:vbap");
		
		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:vbap:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:vbap:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:vbap:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:vbap:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:vbap:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:vbap:rowids"); // 标记rowids
			Vbap vbap = Vbap.builder().rowids(Long.valueOf(rowids)).build();
			List<Vbap> list = sapMapper.selectVbapNew(vbap);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	public void selectVbpaNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Vbpa:sendcount", "huazheng:Vbpa:rowids", "huazheng:list:Vbpa");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Vbpa:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Vbpa:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Vbpa:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Vbpa:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Vbpa:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Vbpa:rowids"); // 标记id
			Vbpa vbpa = Vbpa.builder().rowids(Long.valueOf(rowids)).build();
			List<Vbpa> list = sapMapper.selectVbpaNew(vbpa);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	public void selectVbrkNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Vbrk:sendcount", "huazheng:Vbrk:rowids", "huazheng:list:Vbrk");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Vbrk:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Vbrk:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Vbrk:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Vbrk:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Vbrk:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Vbrk:rowids"); // 标记id
			Vbrk vbrk = Vbrk.builder().rowids(Long.valueOf(rowids)).build();
			List<Vbrk> list = sapMapper.selectVbrkNew(vbrk);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	public void selectVbrpNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Vbrp:sendcount", "huazheng:Vbrp:rowids", "huazheng:list:Vbrp");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Vbrp:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Vbrp:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Vbrp:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Vbrp:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Vbrp:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Vbrp:rowids"); // 标记id
			Vbrp vbrp = Vbrp.builder().rowids(Long.valueOf(rowids)).build();
			List<Vbrp> list = sapMapper.selectVbrpNew(vbrp);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	public void selectVbakNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Vbak:sendcount", "huazheng:Vbak:rowids", "huazheng:list:Vbak");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Vbak:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Vbak:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Vbak:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Vbak:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Vbak:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Vbak:rowids"); // 标记id
			Vbak vbak = Vbak.builder().rowids(Long.valueOf(rowids)).build();
			List<Vbak> list = sapMapper.selectVbakNew(vbak);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					String erdat = item.getErdat();
					String erzet = item.getErzet();
					if ("00000000".equals(erdat)) {
						item.setErdat2erzet(null);
					} else {
						Date date = DateUtil.parse(erdat+erzet, "yyyyMMddHHmmss");
						item.setErdat2erzet(date);
					}
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	public void selectLikpNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Likp:sendcount", "huazheng:Likp:rowids", "huazheng:list:Likp");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Likp:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Likp:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Likp:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Likp:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Likp:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Likp:rowids"); // 标记id
			Likp likp = Likp.builder().rowids(Long.valueOf(rowids)).build();
			List<Likp> list = sapMapper.selectLikpNew(likp);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					String wadat_ist = item.getWadat_ist();
					String lfuhr = item.getLfuhr();
					if ("00000000".equals(wadat_ist)) {
						item.setWadat_ist2lfuhr(null);
					} else {
						Date date = DateUtil.parse(wadat_ist+lfuhr, "yyyyMMddHHmmss");
						item.setWadat_ist2lfuhr(date);
					}
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	public void selectLipsNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Lips:sendcount", "huazheng:Lips:rowids", "huazheng:list:Lips");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Lips:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Lips:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Lips:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Lips:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Lips:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Lips:rowids"); // 标记id
			Lips lips = Lips.builder().rowids(Long.valueOf(rowids)).build();
			List<Lips> list = sapMapper.selectLipsNew(lips);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	
	// ===================== crmMapper rowids =====================
	// 独立的
	public void selectSalesForecastProcessNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:SalesForecastProcess:sendcount", "huazheng:SalesForecastProcess:id", "huazheng:list:SalesForecastProcess");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:SalesForecastProcess:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SalesForecastProcess:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SalesForecastProcess:id", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:SalesForecastProcess:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:SalesForecastProcess:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String id = opsForValue.get("huazheng:SalesForecastProcess:id"); // 标记id
			SalesForecastProcess sfp = SalesForecastProcess.builder().id(id).build();
			List<SalesForecastProcess> list = crmMapper.selectSalesForecastProcessNew(sfp);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getId(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	public void selectSalesContractProcessNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:SalesContractProcess:sendcount", "huazheng:SalesContractProcess:id", "huazheng:list:SalesContractProcess");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:SalesContractProcess:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SalesContractProcess:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SalesContractProcess:id", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:SalesContractProcess:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:SalesContractProcess:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String id = opsForValue.get("huazheng:SalesContractProcess:id"); // 标记id
			SalesContractProcess scp = SalesContractProcess.builder().id(id).build();
			List<SalesContractProcess> list = crmMapper.selectSalesContractProcessNew(scp);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getId(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	public void selectSampleApplicationProcessNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:SampleApplicationProcess:sendcount", "huazheng:SampleApplicationProcess:id", "huazheng:list:SampleApplicationProcess");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:SampleApplicationProcess:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SampleApplicationProcess:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SampleApplicationProcess:id", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:SampleApplicationProcess:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:SampleApplicationProcess:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String id = opsForValue.get("huazheng:SampleApplicationProcess:id"); // 标记id
			SampleApplicationProcess scp = SampleApplicationProcess.builder().id(id).build();
			List<SampleApplicationProcess> list = crmMapper.selectSampleApplicationProcessNew(scp);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getId(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	public void selectSampleApplicationProcessMingXiNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:SampleApplicationProcessMingXi:sendcount", "huazheng:SampleApplicationProcessMingXi:id", "huazheng:list:SampleApplicationProcessMingXi");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:SampleApplicationProcessMingXi:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SampleApplicationProcessMingXi:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SampleApplicationProcessMingXi:id", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:SampleApplicationProcessMingXi:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:SampleApplicationProcessMingXi:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String id = opsForValue.get("huazheng:SampleApplicationProcessMingXi:id"); // 标记id
			SampleApplicationProcessMingXi scp = SampleApplicationProcessMingXi.builder().id(id).build();
			List<SampleApplicationProcessMingXi> list = crmMapper.selectSampleApplicationProcessMingXiNew(scp);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getId(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	public void selectSampleClosingProcessNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:SampleClosingProcess:sendcount", "huazheng:SampleClosingProcess:id", "huazheng:list:SampleClosingProcess");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:SampleClosingProcess:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SampleClosingProcess:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SampleClosingProcess:id", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:SampleClosingProcess:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:SampleClosingProcess:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String id = opsForValue.get("huazheng:SampleClosingProcess:id"); // 标记id
			SampleClosingProcess scp = SampleClosingProcess.builder().id(id).build();
			List<SampleClosingProcess> list = crmMapper.selectSampleClosingProcessNew(scp);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getId(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	public void selectSampleClosingProcessMingXiNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:SampleClosingProcessMingXi:sendcount", "huazheng:SampleClosingProcessMingXi:id", "huazheng:list:SampleClosingProcessMingXi");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:SampleClosingProcessMingXi:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SampleClosingProcessMingXi:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SampleClosingProcessMingXi:id", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:SampleClosingProcessMingXi:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:SampleClosingProcessMingXi:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String id = opsForValue.get("huazheng:SampleClosingProcessMingXi:id"); // 标记id
			SampleClosingProcessMingXi scp = SampleClosingProcessMingXi.builder().id(id).build();
			List<SampleClosingProcessMingXi> list = crmMapper.selectSampleClosingProcessMingXiNew(scp);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getId(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	
	// ===================== tmsMapper rowids =====================
	public void checkJob3() {
		selectTransformHistoryNodeNew();
		selectHandoverTaskNew();
		selectTransformNewNodeNew();
		selectHandoverNew();
	}
	private void selectTransformHistoryNodeNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:TransformHistoryNode:sendcount", "huazheng:TransformHistoryNode:id", "huazheng:list:TransformHistoryNode");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:TransformHistoryNode:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:TransformHistoryNode:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:TransformHistoryNode:id", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:TransformHistoryNode:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:TransformHistoryNode:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String id = opsForValue.get("huazheng:TransformHistoryNode:id"); // 标记id
			TransformHistoryNode thn = TransformHistoryNode.builder().id(Integer.parseInt(id)).build();
			List<TransformHistoryNode> list = tmsMapper.selectTransformHistoryNodeNew(thn);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getId().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectHandoverTaskNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:HandoverTask:sendcount", "huazheng:HandoverTask:task_id", "huazheng:list:HandoverTask");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:HandoverTask:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:HandoverTask:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:HandoverTask:task_id", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:HandoverTask:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:HandoverTask:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String task_id = opsForValue.get("huazheng:HandoverTask:task_id"); // 标记id
			HandoverTask handoverTask = HandoverTask.builder().task_id(task_id).build();
			List<HandoverTask> list = tmsMapper.selectHandoverTaskNew(handoverTask);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getTask_id(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectTransformNewNodeNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:TransformNewNode:sendcount", "huazheng:TransformNewNode:id", "huazheng:list:TransformNewNode");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:TransformNewNode:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:TransformNewNode:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:TransformNewNode:id", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:TransformNewNode:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:TransformNewNode:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String id = opsForValue.get("huazheng:TransformNewNode:id"); // 标记id
			TransformNewNode transformNewNode = TransformNewNode.builder().id(Integer.parseInt(id)).build();
			List<TransformNewNode> list = tmsMapper.selectTransformNewNodeNew(transformNewNode);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getId().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectHandoverNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Handover:sendcount", "huazheng:Handover:handover_id", "huazheng:list:Handover");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Handover:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Handover:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Handover:handover_id", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Handover:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Handover:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String handover_id = opsForValue.get("huazheng:Handover:handover_id"); // 标记id
			Handover handover = Handover.builder().handover_id(handover_id).build();
			List<Handover> list = tmsMapper.selectHandoverNew(handover);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getHandover_id(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	
	// ===================== hzcrmMapper rowids =====================
	public void checkJob4() {
		selectTKeHuXiaoShouZZYeWuYNew();
		selectTKeHuNew();
	}
	private void selectTKeHuXiaoShouZZYeWuYNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:TKeHuXiaoShouZZYeWuY:sendcount", "huazheng:TKeHuXiaoShouZZYeWuY:rowids", "huazheng:list:TKeHuXiaoShouZZYeWuY");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:TKeHuXiaoShouZZYeWuY:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:TKeHuXiaoShouZZYeWuY:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:TKeHuXiaoShouZZYeWuY:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:TKeHuXiaoShouZZYeWuY:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:TKeHuXiaoShouZZYeWuY:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:TKeHuXiaoShouZZYeWuY:rowids"); // 标记id
			TKeHuXiaoShouZZYeWuY tkeHuXiaoShouZZYeWuY = TKeHuXiaoShouZZYeWuY.builder().rowids(Long.valueOf(rowids)).build();
			List<TKeHuXiaoShouZZYeWuY> list = hzcrmMapper.selectTKeHuXiaoShouZZYeWuYNew(tkeHuXiaoShouZZYeWuY);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	private void selectTKeHuNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:TKeHu:sendcount", "huazheng:TKeHu:rowids", "huazheng:list:TKeHu");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:TKeHu:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:TKeHu:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:TKeHu:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:TKeHu:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:TKeHu:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:TKeHu:rowids"); // 标记id
			TKeHu tkeHu = TKeHu.builder().rowids(Long.valueOf(rowids)).build();
			List<TKeHu> list = hzcrmMapper.selectTKeHuNew(tkeHu);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	
	// 独立的
	public void selectSysSAPreturnNoNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:SysSAPreturnNo:sendcount", "huazheng:SysSAPreturnNo:rowids", "huazheng:list:SysSAPreturnNo");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:SysSAPreturnNo:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SysSAPreturnNo:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:SysSAPreturnNo:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:SysSAPreturnNo:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:SysSAPreturnNo:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:SysSAPreturnNo:rowids"); // 标记id
			SysSAPreturnNo sysSAPreturnNo = SysSAPreturnNo.builder().rowids(Long.valueOf(rowids)).build();
			List<SysSAPreturnNo> list = hzcrmMapper.selectSysSAPreturnNoNew(sysSAPreturnNo);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	
	// ===================== ultimusDBMapper rowids =====================
	// 独立的
	public void selectTasksNew() {
		DefaultRedisScript<String> script = new DefaultRedisScript<String>();
		script.setResultType(String.class);
		script.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/vbap4send.lua")));
		List<String> keys = Arrays.asList("huazheng:Tasks:sendcount", "huazheng:Tasks:rowids", "huazheng:list:Tasks");

		ValueOperations<String, String> opsForValue = redis1Template.opsForValue();
		opsForValue.setIfAbsent("huazheng:Tasks:sendcount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Tasks:receivecount", "0"); // 不存在则创建，存在则么有操作
		opsForValue.setIfAbsent("huazheng:Tasks:rowids", "0"); // 不存在则创建，存在则么有操作
		Long sendcount = Long.valueOf(opsForValue.get("huazheng:Tasks:sendcount"));
		Long receivecount = Long.valueOf(opsForValue.get("huazheng:Tasks:receivecount"));
		if (sendcount - receivecount <= 20) { // 如果发送数和消费数的差小于5则往队列中写数据
			String rowids = opsForValue.get("huazheng:Tasks:rowids"); // 标记id
			Tasks tasks = Tasks.builder().rowids(Long.valueOf(rowids)).build();
			List<Tasks> list = ultimusDBMapper.selectTasksNew(tasks);
			if (!list.isEmpty()) {
				list.forEach(item -> {
					JSONObject json = JSONUtil.parseObj(item, false);
					String execute = redis1Template.execute(script, keys, item.getRowids().toString(), json.toString());
					log.info("标记时间回写 --> " + execute);
				});
			}
		}
	}
	
}
