|
@@ -10,6 +10,7 @@ import org.springblade.manager.entity.SystemMsg;
|
|
|
import org.springblade.manager.service.ISystemMsgService;
|
|
|
import org.springblade.websocket.vo.MsgVO;
|
|
|
import org.springblade.websocket.vo.SystMsgVO;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
@@ -34,11 +35,18 @@ public class SystemMsgJob {
|
|
|
|
|
|
private final JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
+ // 读取配置并设置默认值
|
|
|
+ @Value("${scheduler.enabled:true}")
|
|
|
+ private boolean schedulerEnabled;
|
|
|
+
|
|
|
/**
|
|
|
* 定时推送公告-取消公告-修改公告状态,不想污染日志,使用jdbc
|
|
|
*/
|
|
|
@Scheduled(cron = "0/10 * * * * ?")
|
|
|
public void autoUpdateMsgStatus(){
|
|
|
+ // 本地环境跳过执行(可添加日志输出)
|
|
|
+ if (!schedulerEnabled) return;
|
|
|
+
|
|
|
/** 普通公告推送*/
|
|
|
String sql1 = "select * from m_system_msg where is_deleted = 0 and msg_type = 2 and push_status = 1 and push_end_date_time >= now()";
|
|
|
List<SystemMsg> list1 = jdbcTemplate.query(sql1,new BeanPropertyRowMapper<>(SystemMsg.class));
|