|
@@ -37,10 +37,10 @@ public class SystemMsgJob {
|
|
|
/**
|
|
|
* 定时推送公告-取消公告-修改公告状态,不想污染日志,使用jdbc
|
|
|
*/
|
|
|
- @Scheduled(cron = "0/10 * * * * ?")
|
|
|
+ @Scheduled(cron = "0/10 * * * * ?")
|
|
|
public void autoUpdateMsgStatus(){
|
|
|
/** 普通公告推送*/
|
|
|
- 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()";
|
|
|
+ String sql1 = "select * from m_system_msg where is_deleted = 0 and msg_type = 2 and push_status = 1 and now()<=push_end_date_time and now()>=push_date_time ";
|
|
|
List<SystemMsg> list1 = jdbcTemplate.query(sql1,new BeanPropertyRowMapper<>(SystemMsg.class));
|
|
|
if (list1.size() > 0){
|
|
|
for (SystemMsg msg : list1) {
|
|
@@ -52,7 +52,7 @@ public class SystemMsgJob {
|
|
|
}
|
|
|
/** 维护公告推送*/
|
|
|
//String sql2 = "select * from m_system_msg where is_deleted = 0 and msg_type = 1 and status = 1 and push_status = 1 and push_date_time >= now() and push_warn_date_time <= TIMESTAMPADD(SECOND, 1, NOW())";
|
|
|
- String sql2 = "select * from m_system_msg where is_deleted = 0 and msg_type = 1 and status = 1 and push_status = 1 and push_warn_date_time>=NOW() ";
|
|
|
+ String sql2 = "select * from m_system_msg where is_deleted = 0 and msg_type = 1 and status = 1 and push_status = 1 and TIMESTAMPDIFF(SECOND,push_warn_date_time,sysdate())>0 ";
|
|
|
List<SystemMsg> list2 = jdbcTemplate.query(sql2,new BeanPropertyRowMapper<>(SystemMsg.class));
|
|
|
if (list2.size() > 0){
|
|
|
for (SystemMsg msg : list2) {
|
|
@@ -63,13 +63,14 @@ public class SystemMsgJob {
|
|
|
.in(SystemMsg::getId,list2.stream().map(SystemMsg::getId).collect(Collectors.toList())));
|
|
|
}
|
|
|
/** 维护倒计时*/
|
|
|
- // String sql3 = "select * from m_system_msg where is_deleted = 0 and msg_type = 1 and status != 3 and TIMESTAMPADD(SECOND, 1, NOW()) >= push_count_down_date_time and now() < push_date_time ";
|
|
|
- String sql3 = "select * from m_system_msg where is_deleted = 0 and msg_type = 1 and status != 3 and push_count_down_date_time >=NOW() ";
|
|
|
+ // String sql3 = "select * from m_system_msg where is_deleted = 0 and msg_type = 1 and status != 3 and TIMESTAMPADD(SECOND, 1, NOW()) >= push_count_down_date_time and now() < push_date_time ";
|
|
|
+ String sql3 = "select * from m_system_msg where is_deleted = 0 and msg_type = 1 and status != 3 and TIMESTAMPDIFF(SECOND,push_count_down_date_time,sysdate())>0 ";
|
|
|
List<SystemMsg> list3 = jdbcTemplate.query(sql3,new BeanPropertyRowMapper<>(SystemMsg.class));
|
|
|
if (list3.size() > 0){
|
|
|
SystemMsg msg = list3.get(0);
|
|
|
msg.setMsgType(3);
|
|
|
- msg.setMsgContent(Duration.between(LocalDateTime.now(), msg.getPushDateTime()).getSeconds()+"");
|
|
|
+ // msg.setMsgContent(Duration.between(LocalDateTime.now(), msg.getPushDateTime()).getSeconds()+"");
|
|
|
+ msg.setMsgContent((msg.getMsgCountDownTime()*60)+"");
|
|
|
systemMsgService.pushSystemMsgToAllUser(msg);
|
|
|
systemMsgService.update(new LambdaUpdateWrapper<SystemMsg>()
|
|
|
.set(SystemMsg::getStatus,3)
|