You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.0 KiB
66 lines
2.0 KiB
package com.mh.quartz.task; |
|
|
|
import com.mh.common.core.domain.entity.AlarmCode; |
|
import com.mh.common.core.domain.entity.AlarmRecords; |
|
import com.mh.common.core.domain.entity.AlarmRules; |
|
import com.mh.common.core.domain.entity.CollectionParamsManage; |
|
import com.mh.common.utils.BigDecimalUtils; |
|
import com.mh.common.utils.DateUtils; |
|
import com.mh.framework.rabbitmq.producer.SendMsgByTopic; |
|
import com.mh.system.service.device.ICollectionParamsManageService; |
|
import com.mh.system.service.operation.IAlarmCodeService; |
|
import com.mh.system.service.operation.IAlarmRecordsService; |
|
import com.mh.system.service.operation.IAlarmRulesService; |
|
import lombok.extern.slf4j.Slf4j; |
|
import org.springframework.beans.factory.annotation.Autowired; |
|
import org.springframework.data.redis.core.StringRedisTemplate; |
|
import org.springframework.stereotype.Component; |
|
|
|
import java.math.BigDecimal; |
|
import java.math.RoundingMode; |
|
import java.util.Date; |
|
import java.util.List; |
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
/** |
|
* @author LJF |
|
* @version 1.0 |
|
* @project EEMCS |
|
* @description 创建报警记录 |
|
* @date 2025-02-21 08:48:48 |
|
*/ |
|
@Slf4j |
|
@Component("createAlarmTask") |
|
public class CreateAlarmTask { |
|
|
|
|
|
private final IAlarmRecordsService alarmRecordService; |
|
|
|
private final SendMsgByTopic sendMsgByTopic; |
|
|
|
@Autowired |
|
public CreateAlarmTask(IAlarmRecordsService alarmRecordService, SendMsgByTopic sendMsgByTopic) { |
|
this.alarmRecordService = alarmRecordService; |
|
this.sendMsgByTopic = sendMsgByTopic; |
|
} |
|
|
|
public void createAlarmTask() { |
|
log.info("创建报警记录"); |
|
// 第一次判断 |
|
String alarmTask = alarmRecordService.createAlarmTask(); |
|
if (null == alarmTask) { |
|
return; |
|
} |
|
// 根据","逗号进行分割 |
|
String[] alarmTaskArray = alarmTask.split(","); |
|
// 遍历 |
|
for (String id : alarmTaskArray) { |
|
if (null == id || id.isEmpty()) { |
|
continue; |
|
} |
|
sendMsgByTopic.sendDelayedAlarm(id, 1); |
|
} |
|
} |
|
|
|
}
|
|
|