|
|
@ -1,6 +1,8 @@ |
|
|
|
package com.yxt.messagecenter.biz.messageurgeList; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateUnit; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import com.yxt.anrui.flowable.api.flow2.FlowFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow2.FlowableMessageVo; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.FlowTaskDto; |
|
|
@ -21,7 +23,10 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.text.DateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.time.Duration; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -47,7 +52,7 @@ public class ScheduledMessageService { |
|
|
|
//@Scheduled(cron = "0 0 0 * * ?")
|
|
|
|
// @Scheduled(cron = "0 0/5 16 * * ?")
|
|
|
|
// @Scheduled(cron = "0/30 * * * * ?") //每30秒执行一次
|
|
|
|
@Scheduled(cron = "0 0/5 * * * ?") //每300秒(5分钟)执行一次
|
|
|
|
@Scheduled(cron = "0 0/5 * * * ?") |
|
|
|
public void remindMessage() { |
|
|
|
//查询规则
|
|
|
|
Date now = new Date(); |
|
|
@ -78,6 +83,12 @@ public class ScheduledMessageService { |
|
|
|
messageUrgeListList.removeAll(Collections.singleton(null)); |
|
|
|
if (messageUrgeListList.size() >= 0) { |
|
|
|
if (num > messageUrgeListList.size()) { |
|
|
|
//判断最后一次催办的发送时间,若小于设置的间隔时间则不推送
|
|
|
|
MessageUrgeList messageUrgeList = messageUrgeListList.get(0); |
|
|
|
long minutess = DateUtil.between(now, messageUrgeList.getCreateTime(), DateUnit.MINUTE); |
|
|
|
if(minutess<minutes){ |
|
|
|
continue; |
|
|
|
} |
|
|
|
MessageListDto messageListDto = new MessageListDto(); |
|
|
|
BeanUtil.copyProperties(flowableMessageVo, messageListDto); |
|
|
|
//===================================================
|
|
|
|