global class OPDPlanWarningSchedule implements Schedulable {
	 global void execute(SchedulableContext sc) {

		Date today = Date.today();
		Date mon1stDate = Date.newInstance(today.year(), today.month(), 1);
		Date monLastDate = mon1stDate.addMonths(1).addDays(-1);
		// 本月最后一天的周日
		Date weekStart = monLastDate.toStartofWeek();
		system.debug('wwwwwwwww' + weekStart);

		Date lastSecondFriday;
		if (weekStart.addDays(5).month() == today.month()) {
			lastSecondFriday = weekStart.addDays(-2);
		} else {
			lastSecondFriday = weekStart.addDays(-9);
		}
		if(today == lastSecondFriday){
			// 设置一回最多只发40个邮件
			Id execBTId = Database.executeBatch(new OPDPlanWarningBatch(), 40);
			
		}
		// chenjingwu Batch整理合并 20240306 start
		Database.executeBatch(new updateCampaignMailflg7BeTrueBatch(),1);
		// chenjingwu Batch整理合并 20240306 end
	}
}