/**
|
* Created by T on 2020/5/21.
|
*/
|
|
global class MonthEndAutoJudgeSchedule implements Schedulable {
|
|
// // 需在每个月最后一天运行
|
// global void execute(SchedulableContext SC) {
|
// // 获取当前月份的第一天
|
// Date firstDayOfMonth = Date.today().toStartOfMonth();
|
// // 将月份推到下一个月
|
// Date nextMonth = Date.newInstance(firstDayOfMonth.year(), firstDayOfMonth.month() + 1, 1);
|
// // 获取当前月份最后一天
|
// Date lastDayOfMonth = nextMonth.addDays(-1);
|
|
// if (String.valueOf(Date.today()).equals(String.valueOf(lastDayOfMonth))) {
|
// Database.executeBatch(new MonthEndAutoJudgeBatch(),20);
|
// }
|
// }
|
|
//每个月最后一个工作日凌晨运行完毕 CHAN-BUZC7V update by rentx 2020-11-05 start
|
global void execute(SchedulableContext SC) {
|
// 获取当前月份的第一天
|
Date firstDayOfMonth = Date.today().toStartOfMonth();
|
// 将月份推到下一个月
|
Date nextMonth = Date.newInstance(firstDayOfMonth.year(), firstDayOfMonth.month() + 1, 1);
|
// 获取当前月份最后一天
|
Date lastDayOfMonth = nextMonth.addDays(-1);
|
//获取当前月份的最后一个工作日
|
List<OlympusCalendar__c> ssDay
|
= [Select Date__c From OlympusCalendar__c Where Date__c >= :firstDayOfMonth And Date__c <= :lastDayOfMonth And IsWorkDay__c = 1 order by Date__c desc limit 1];
|
|
if (ssDay != null && ssDay.size() > 0) {
|
if (String.valueOf(Date.today()).equals(String.valueOf(ssDay.get(0).Date__c))) {
|
Database.executeBatch(new MonthEndAutoJudgeBatch(),20);
|
}
|
}
|
|
}
|
//CHAN-BUZC7V update by rentx 2020-11-05 end
|
}
|