/** system.schedule('AssetUseInfoSchedule0331','0 0 20 31 MAR ? 2018-2035', new AssetUseInfoSchedule()); system.schedule('AssetUseInfoSchedule0630','0 0 20 30 JUN ? 2018-2035', new AssetUseInfoSchedule()); system.schedule('AssetUseInfoSchedule0930','0 0 20 30 SEP ? 2018-2035', new AssetUseInfoSchedule()); system.schedule('AssetUseInfoSchedule1231','0 0 20 31 DEC ? 2018-2035', new AssetUseInfoSchedule()); 改为每月末执行,但是只有在3、6、9、12月时,才会进入执行batch的逻辑 */ global class AssetUseInfoSchedule implements Schedulable { global void execute(SchedulableContext sc) { // 保有设备前一年使用情况记录(每年12月31日执行) if(Test.isRunningTest() || checkDate(date.today().addDays(-1))){ Id execBTId = Database.executeBatch(new AssetUseInfoBatch(), 200); } } //判断当月是否3,6,9,12 月 public boolean checkDate(Date today){ if(today.month() == 3 || today.month() == 6 || today.month() == 9 || today.month() == 12){ return true; } return false; } }