| 
					
				 | 
			
			
				@ -1,7 +1,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.wlyy.figure.label.service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.figure_label.entity.FLJobConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.figure.label.dao.FLJobConfigDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.figure_label.entity.FlJobConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.figure.label.dao.FlJobConfigDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.figure.label.util.ConstantUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.figure.label.util.IdCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.figure.label.util.QuartzHelpers; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.time.DateFormatUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -16,7 +17,9 @@ import org.springframework.util.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.text.ParseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 *@author lith on 2018.03.23 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@Service 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${JobService.sleepTime}") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -26,7 +29,7 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private IdCardUtil idCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private FLJobConfigDao flJobConfigDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private FlJobConfigDao flJobConfigDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private JdbcTemplate jdbcTemplate; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -34,10 +37,9 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private QuartzHelpers quartzHelpers; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void stopById(String id) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FLJobConfig flJobConfig = flJobConfigDao.findByIdAndStatus(Long.valueOf(id), "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FlJobConfig flJobConfig = flJobConfigDao.findByIdAndStatus(Long.valueOf(id), "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (flJobConfig != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int j = 1; j <= 2; j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                quartzHelpers.removeJob(flJobConfig.getId() + "-" + j); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -48,26 +50,26 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void startById(String id) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FLJobConfig FLJobConfig = flJobConfigDao.findByIdAndStatus(Long.valueOf(id), "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (FLJobConfig != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            startOneJob(FLJobConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FlJobConfig flJobConfig = flJobConfigDao.findByIdAndStatus(Long.valueOf(id), "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (flJobConfig != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            startOneJob(flJobConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("任务已经启动"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void stopAll() throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<FLJobConfig> FLJobConfigs = flJobConfigDao.findByAll("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (FLJobConfigs != null && FLJobConfigs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (FLJobConfig FLJobConfig : FLJobConfigs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<FlJobConfig> FlJobConfigs = flJobConfigDao.findByAll("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (FlJobConfigs != null && FlJobConfigs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (FlJobConfig FlJobConfig : FlJobConfigs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (int j = 1; j <= 2; j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    quartzHelpers.removeJob(FLJobConfig.getId() + "-" + j); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    quartzHelpers.removeJob(FlJobConfig.getId() + "-" + j); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    flJobConfigDao.updateStatus(FLJobConfig.getId(),"0") ;; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    flJobConfigDao.updateStatus(FlJobConfig.getId(),"0") ;; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -75,12 +77,12 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void startAll() throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<FLJobConfig> FLJobConfigs = flJobConfigDao.findByAll("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (FLJobConfigs != null && FLJobConfigs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (FLJobConfig FLJobConfig : FLJobConfigs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                startOneJob(FLJobConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<FlJobConfig> FlJobConfigs = flJobConfigDao.findByAll("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (FlJobConfigs != null && FlJobConfigs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (FlJobConfig FlJobConfig : FlJobConfigs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                startOneJob(FlJobConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("任务已经全部启动"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -90,17 +92,19 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 启动单个任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param FLJobConfig 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param FlJobConfig 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void startOneJob(FLJobConfig FLJobConfig) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void startOneJob(FlJobConfig FlJobConfig) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FLJobConfig flJobConfigVO = new FLJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BeanUtils.copyProperties(FLJobConfig, flJobConfigVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FlJobConfig flJobConfigVO = new FlJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BeanUtils.copyProperties(FlJobConfig, flJobConfigVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> params = new HashMap<String, Object>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("jobConfig", flJobConfigVO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("sourceType", flJobConfigVO.getSourceType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("source", flJobConfigVO.getSource()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //表里设置的增量查询类型和增量查询初始值,如果值没有配置,以当前时间为准 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(!StringUtils.isEmpty(flJobConfigVO.getSqlFieldValue())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("sqlFiledValue",flJobConfigVO.getSqlFieldValue()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -108,18 +112,18 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("sqlFiledValue", DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("sqlFiledCondition", ">"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(FLJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(FlJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //往quartz框架添加任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            quartzHelpers.addJob(getRightClass(FLJobConfig), FLJobConfig.getQuartzCron(), FLJobConfig.getId().toString(), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            flJobConfigDao.updateStatus(FLJobConfig.getId(), "1");//设置任务状态是启动 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            quartzHelpers.addJob(getRightClass(FlJobConfig), FlJobConfig.getQuartzCron(), FlJobConfig.getId().toString(), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            flJobConfigDao.updateStatus(FlJobConfig.getId(), "1");//设置任务状态是启动 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void startNowById(String id) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FLJobConfig FLJobConfig = flJobConfigDao.findOne(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FlJobConfig FlJobConfig = flJobConfigDao.findOne(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FLJobConfig flJobConfigVO = new FLJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BeanUtils.copyProperties(FLJobConfig, flJobConfigVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FlJobConfig flJobConfigVO = new FlJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BeanUtils.copyProperties(FlJobConfig, flJobConfigVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("jobConfig", flJobConfigVO.getId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -130,8 +134,8 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("sqlFiledCondition", ">"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //往quartz框架添加任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(FLJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            quartzHelpers.startNow(getRightClass(FLJobConfig), FLJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(FlJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            quartzHelpers.startNow(getRightClass(FlJobConfig), FlJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Thread.sleep(sleepTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -158,19 +162,19 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        calendar.add(Calendar.DATE, -1);//把日期往后增加一天.整数往后推,负数往前移动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date nowDate = calendar.getTime();   //这个时间就是日期往后推一天的结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String daybefore = new SimpleDateFormat("yyyy-MM-dd").format(nowDate.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<FLJobConfig> FLJobConfigs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(FLJobConfig.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (FLJobConfig FLJobConfig : FLJobConfigs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<FlJobConfig> FlJobConfigs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(FlJobConfig.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (FlJobConfig FlJobConfig : FlJobConfigs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            FLJobConfig flJobConfig = new FLJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BeanUtils.copyProperties(FLJobConfig, flJobConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            FlJobConfig flJobConfig = new FlJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BeanUtils.copyProperties(FlJobConfig, flJobConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("jobConfig", flJobConfig.getId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //往quartz框架添加任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("sqlFiledValue", daybefore+","+yesterday); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("sqlFiledCondition", ">,<"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!StringUtils.isEmpty(FLJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                quartzHelpers.startNow(getRightClass(FLJobConfig), FLJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!StringUtils.isEmpty(FlJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                quartzHelpers.startNow(getRightClass(FlJobConfig), FlJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Thread.sleep(sleepTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -178,12 +182,12 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param FLJobConfig 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param FlJobConfig 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws ClassNotFoundException 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private Class getRightClass(FLJobConfig FLJobConfig) throws ClassNotFoundException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return Class.forName(FLJobConfig.getJobClass()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private Class getRightClass(FlJobConfig FlJobConfig) throws ClassNotFoundException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return Class.forName(FlJobConfig.getJobClass()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void productDataByOneDayWithId(String yesterday, String id) throws Exception { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -198,12 +202,12 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date nowDate = calendar.getTime();   //这个时间就是日期往后推一天的结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String daybefore = new SimpleDateFormat("yyyy-MM-dd").format(nowDate.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FLJobConfig FLJobConfig = flJobConfigDao.findById(Long.valueOf(id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (FLJobConfig == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FlJobConfig FlJobConfig = flJobConfigDao.findById(Long.valueOf(id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (FlJobConfig == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("id不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FLJobConfig flJobConfigVO = new FLJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BeanUtils.copyProperties(FLJobConfig, flJobConfigVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FlJobConfig flJobConfigVO = new FlJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BeanUtils.copyProperties(FlJobConfig, flJobConfigVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("jobConfig", Long.valueOf(flJobConfigVO.getId())); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -211,20 +215,20 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //往quartz框架添加任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("sqlFiledValue", daybefore + "," + yesterday); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("sqlFiledCondition", ">,<"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(FLJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            quartzHelpers.startNow(getRightClass(FLJobConfig), FLJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(FlJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            quartzHelpers.startNow(getRightClass(FlJobConfig), FlJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Thread.sleep(sleepTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void productDataByDayAndId(Integer day, String id) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FLJobConfig FLJobConfig = flJobConfigDao.findById(Long.valueOf(id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (FLJobConfig == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FlJobConfig FlJobConfig = flJobConfigDao.findById(Long.valueOf(id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (FlJobConfig == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("id不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FLJobConfig flJobConfigVO = new FLJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BeanUtils.copyProperties(FLJobConfig, flJobConfigVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FlJobConfig flJobConfigVO = new FlJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BeanUtils.copyProperties(FlJobConfig, flJobConfigVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("jobConfig", flJobConfigVO.getId().toString()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -232,8 +236,8 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //往quartz框架添加任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("sqlFiledValue",  getYesterday(0 - i - 1)+","+getYesterday(0 - i)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("sqlFiledCondition", ">,<"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!StringUtils.isEmpty(FLJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                quartzHelpers.startNow(getRightClass(FLJobConfig), FLJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!StringUtils.isEmpty(FlJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                quartzHelpers.startNow(getRightClass(FlJobConfig), FlJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Thread.sleep(sleepTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -319,12 +323,12 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date nowDate = calendar.getTime();   //这个时间就是日期往后推一天的结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String daybefore = new SimpleDateFormat("yyyy-MM-dd").format(nowDate.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FLJobConfig FLJobConfig = flJobConfigDao.findById(Long.valueOf(id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (FLJobConfig == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FlJobConfig FlJobConfig = flJobConfigDao.findById(Long.valueOf(id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (FlJobConfig == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("id不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FLJobConfig flJobConfigVO = new FLJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BeanUtils.copyProperties(FLJobConfig, flJobConfigVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        FlJobConfig flJobConfigVO = new FlJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BeanUtils.copyProperties(FlJobConfig, flJobConfigVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("jobConfig", flJobConfigVO.getId().toString()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -332,8 +336,8 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //往quartz框架添加任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("sqlFiledValue", daybefore + "," + yesterday); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("sqlFiledCondition", ">,<"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(FLJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            quartzHelpers.startNow(getRightClass(FLJobConfig), FLJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isEmpty(FlJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            quartzHelpers.startNow(getRightClass(FlJobConfig), FlJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Thread.sleep(sleepTime * 1000L); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -352,10 +356,10 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        calendar.add(Calendar.DATE, -1);//把日期往后增加一天.整数往后推,负数往前移动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date nowDate = calendar.getTime();   //这个时间就是日期往后推一天的结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String daybefore = new SimpleDateFormat("yyyy-MM-dd").format(nowDate.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<FLJobConfig> FLJobConfigs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(FLJobConfig.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (FLJobConfig FLJobConfig : FLJobConfigs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            FLJobConfig flJobConfigVO = new FLJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BeanUtils.copyProperties(FLJobConfig, flJobConfigVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<FlJobConfig> FlJobConfigs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(FlJobConfig.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (FlJobConfig FlJobConfig : FlJobConfigs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            FlJobConfig flJobConfigVO = new FlJobConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BeanUtils.copyProperties(FlJobConfig, flJobConfigVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("jobConfig", flJobConfigVO.getId().toString()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -363,8 +367,8 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("sqlFiledValue", daybefore + "," + yesterday); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("sqlFiledCondition", ">,<"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!StringUtils.isEmpty(FLJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                quartzHelpers.startNow(getRightClass(FLJobConfig), FLJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!StringUtils.isEmpty(FlJobConfig.getJobClass())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                quartzHelpers.startNow(getRightClass(FlJobConfig), FlJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Thread.sleep(sleepTime * 1000L); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -372,6 +376,18 @@ public class JobService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 增量查询数据成功后,将增量时间改为当前时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param bool 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void updateFieldValuetoCurrentTime(Long id,boolean bool) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (bool) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            this.flJobConfigDao.updateSqlFildeValue(id, DateFormatUtils.format(new Date(), ConstantUtil.date_format)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /* public void startCleanCacheJob() throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!quartzHelper.isExistJob(CacheCleanJob.jobKey)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            quartzHelper.addJob(CacheCleanJob.class, CacheCleanJob.cron, CacheCleanJob.jobKey, new HashMap<>()); 
			 |