fire_point/src/main/java/com/xkrs/common/StaticScheduleTask.java
2023-03-08 11:17:16 +08:00

41 lines
1.1 KiB
Java

package com.xkrs.common;
import com.xkrs.straw.utilsnew.FirePointSubscribeManager;
import com.xkrs.utils.DateTimeUtils;
import com.xkrs.utils.WDWxSendMsgUtil;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.time.LocalDateTime;
/**
* 定时任务
*/
@Configuration
@EnableScheduling
public class StaticScheduleTask {
@Resource
private FirePointSubscribeManager firePointSubscribeManager;
//每半小时更新一次订阅
@Scheduled(cron = "0 */30 * * * ?")
private void syncSubscribe() {
firePointSubscribeManager.autoSync();
}
//每小时更新一次订阅
@Scheduled(cron = "0 0 * * * ?")
private void testPushWeiXinMessage() {
try {
WDWxSendMsgUtil.sendMsg("18447024917@chatroom", "微信发消息测试 " + DateTimeUtils.localDateTimeToString(LocalDateTime.now()), 0);
} catch (Exception e) {
e.printStackTrace();
}
}
}