优化系统催办
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.yxt.messagecenter.biz.messageurgeList.MessageUrgeListMapper">
|
<mapper namespace="com.yxt.messagecenter.biz.messageurgeList.MessageUrgeListMapper">
|
||||||
<select id="selecct" resultType="com.yxt.messagecenter.api.messageurgeList.MessageUrgeList">
|
<select id="selecct" resultType="com.yxt.messagecenter.api.messageurgeList.MessageUrgeList">
|
||||||
select *
|
select msgSid,procInstId,urgeType,urgeName,nodeName,taskId,timeInterval,urgeContent,createTime
|
||||||
from message_urgelist
|
from message_urgelist
|
||||||
where taskId = #{taskId}
|
where taskId = #{taskId} order by id desc
|
||||||
</select>
|
</select>
|
||||||
<select id="urgeCount" resultType="com.yxt.messagecenter.api.messageurgeList.MessageUrgeListVo">
|
<select id="urgeCount" resultType="com.yxt.messagecenter.api.messageurgeList.MessageUrgeListVo">
|
||||||
SELECT taskId,
|
SELECT taskId,
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.yxt.messagecenter.biz.messageurgeList;
|
package com.yxt.messagecenter.biz.messageurgeList;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
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.FlowFeign;
|
||||||
import com.yxt.anrui.flowable.api.flow2.FlowableMessageVo;
|
import com.yxt.anrui.flowable.api.flow2.FlowableMessageVo;
|
||||||
import com.yxt.anrui.flowable.api.flowtask.FlowTaskDto;
|
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.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -47,7 +52,7 @@ public class ScheduledMessageService {
|
|||||||
//@Scheduled(cron = "0 0 0 * * ?")
|
//@Scheduled(cron = "0 0 0 * * ?")
|
||||||
// @Scheduled(cron = "0 0/5 16 * * ?")
|
// @Scheduled(cron = "0 0/5 16 * * ?")
|
||||||
// @Scheduled(cron = "0/30 * * * * ?") //每30秒执行一次
|
// @Scheduled(cron = "0/30 * * * * ?") //每30秒执行一次
|
||||||
@Scheduled(cron = "0 0/5 * * * ?") //每300秒(5分钟)执行一次
|
@Scheduled(cron = "0 0/5 * * * ?")
|
||||||
public void remindMessage() {
|
public void remindMessage() {
|
||||||
//查询规则
|
//查询规则
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
@@ -78,6 +83,12 @@ public class ScheduledMessageService {
|
|||||||
messageUrgeListList.removeAll(Collections.singleton(null));
|
messageUrgeListList.removeAll(Collections.singleton(null));
|
||||||
if (messageUrgeListList.size() >= 0) {
|
if (messageUrgeListList.size() >= 0) {
|
||||||
if (num > messageUrgeListList.size()) {
|
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();
|
MessageListDto messageListDto = new MessageListDto();
|
||||||
BeanUtil.copyProperties(flowableMessageVo, messageListDto);
|
BeanUtil.copyProperties(flowableMessageVo, messageListDto);
|
||||||
//===================================================
|
//===================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user