package com.changan.contract.common.timer;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.time.ZonedDateTime;
import java.util.*;
import com.alibaba.druid.sql.visitor.functions.Now;
import com.changan.contract.utils.JsonResult;
import com.changan.contract.xqht.dao.ProcessDao;
import com.changan.contract.xqht.dao.XxctLaborRenewMapper;
import com.changan.contract.xqht.entity.*;
import com.changan.contract.xqht.utils.fadada.FaDaDaUtils;
import com.google.common.base.Strings;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import com.changan.contract.config.Configuration;
import com.changan.contract.labor.dao.LaborerDao;
import com.changan.contract.labor.po.LaborContractPO;
import com.changan.contract.labor.po.Laborer;
import com.changan.contract.labor.service.LaborContractService;
import com.changan.contract.newsign.entity.LaborRecNew;
import com.changan.contract.newsign.service.LaborRecNewService;
import com.changan.contract.newsign.utils.Base64Coded;
import com.changan.contract.newsign.utils.RSAEncrypt;
import com.changan.contract.utils.DateUtil;
import com.changan.contract.utils.SendMailUtil;
import com.changan.contract.utils.SendSMSUtil;
import com.changan.contract.xqht.service.XqhtService;
import com.changan.contract.xqht.utils.ca.CaUtils;
import com.changan.contract.xqht.utils.http.ApiUtils;
import com.changan.contract.xqht.utils.http.LXHttpClientUtils;
import lombok.extern.slf4j.Slf4j;
/**
* 服务器启动,初始化执行计划
*
* @author sunbowen
* @author Granpee 于2018年6月1日重构
*/
@Slf4j
@Component
public class CommonTimer implements CommandLineRunner {
@Autowired
RedisTemplate redisTemplate;
/**
* 把已经流程完成的续签信息传给XXCT_LABOR_RENEW表
*/
private void run12SyncReNew() {
log.info("************************ 运行12小时定时任务 ************************");
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
List<LaborReNew> list = processDao.searchEmployeeByStatus();
Integer updateCount = 0;
Integer insertCount = 0;
for (LaborReNew laborReNew : list) {
String employeeNumber = laborReNew.getEmployeeNumber();
Date attributeDat1 = laborReNew.getAttributeDat1();
Date createDate = laborReNew.getCreateDate();
List<LaborReNew> lists=xxctLaborRenewMapper.searchByUniq( employeeNumber,attributeDat1,createDate);
if (lists.size() == 0) {
Integer insert = xxctLaborRenewMapper.insertReNew(laborReNew);
insertCount += insert;
//Integer update = xxctLaborRenewMapper.updateByPrimaryKey3(employeeNumber, attributeDat1, createDate,laborReNew);
//updateCount += update;
//log.info("修改ReNew表员工编号:{} 是否成功:{}", employeeNumber, update);
} else {
// log.info("新增ReNew表员工编号:{} 是否成功:{}", employeeNumber, insert);
}
}
//log.info("成功修改ReNew表员工个数:{} ",updateCount);
log.info("成功新增ReNew表员工个数:{} ",insertCount);
}
}, 0, (long) 1000 * 60 );
}
@Autowired
ProcessDao processDao;
@Autowired
XxctLaborRenewMapper xxctLaborRenewMapper;
}
服务器启动,初始化执行计划,定时任务
最新推荐文章于 2022-07-13 13:37:52 发布