Commit 7a551c95 authored by chenhao's avatar chenhao

提交预案匹配的异步方式

parent 227f6697
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import static org.hamcrest.CoreMatchers.nullValue;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
......@@ -18,6 +16,7 @@ import org.apache.logging.log4j.Logger;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
......@@ -122,6 +121,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.command.alert.notice}")
private String topic;
@Value("${redis.cache.failure.time}")
......@@ -399,13 +399,26 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
}
toSendCompletePoliceSituationMatch(alertCalled.getSequenceNbr());
return alertCalledObjsDto;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("报送失败,系统异常!");
}
}
@Async
public void toSendCompletePoliceSituationMatch(Long id) throws Exception{
Object result = toCompletePoliceSituationMatch(id);
try {
List<Object> list= (List<Object>) result;
if(list.size()>0) {
emqKeeper.getMqttClient().publish(topicMatch, result.toString().getBytes(), RuleConfig.DEFAULT_QOS, false);
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("报送失败,系统异常!");
}
}
/**
* 根据id 修改警情 type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
*/
......@@ -1006,7 +1019,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
String condition1 = alertCalled.getAlertType();
result= getIdsList1(alertCalled.getAlertTypeCode(),AlertStageEnums.救援预案警情类型.getValue() + "," + condition1, null, null);
}
emqKeeper.getMqttClient().publish(topicMatch, result.toString().getBytes(), RuleConfig.DEFAULT_QOS, true);
return result;
}
......
......@@ -66,7 +66,7 @@ mqtt.topic.command.power.deployment=power
mqtt.topic.alert.iot=iot-system-alarm
mqtt.topic.alert.iot.web=iot-system-alarm-web
#警情预案匹配的消息topic名称
mqtt.topic.command.knowledgebase.alert.match=knowledgebaseAlertMatch
mqtt.topic.command.knowledgebase.alert.match=knowledgeAlertMatch
security.systemctl.name=AMOS-API-SYSTEMCTL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment