Commit 5b454ed1 authored by 郭武斌's avatar 郭武斌

*)添加警情报送规则

parent 98f89d4a
...@@ -25,6 +25,12 @@ spring.data.elasticsearch.cluster-name=elasticsearch ...@@ -25,6 +25,12 @@ spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=172.16.3.3:9300 spring.data.elasticsearch.cluster-nodes=172.16.3.3:9300
spring.elasticsearch.rest.uris=http://172.16.3.3:9200 spring.elasticsearch.rest.uris=http://172.16.3.3:9200
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=super
emqx.password=a123456
security.systemctl.name=AMOS-API-SYSTEMCTL security.systemctl.name=AMOS-API-SYSTEMCTL
......
package com.yeejoin.amos.boot.module.jcs.api.dto;
import java.io.Serializable;
import com.yeejoin.amos.component.rule.Label;
import com.yeejoin.amos.component.rule.RuleFact;
import lombok.Data;
/**
*
* <pre>
* 警情报送规则触发对象
* </pre>
*
* @author gwb
* @version $Id: AlertCalledRo.java, v 0.1 2021年6月24日 下午3:31:14 gwb Exp $
*/
@Data
@RuleFact(value = "警情信息",project = "西咸机场119接处警规则")
public class AlertCalledRo implements Serializable{
/**
* <pre>
*
* </pre>
*/
private static final long serialVersionUID = -8105736102662461646L;
@Label("警情id")
private Long sequenceNbr;
@Label(value = "警情类型")
private String alertType;
@Label(value = "警情类型code")
private String alertTypeCode;
}
...@@ -4,8 +4,18 @@ import com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledVo; ...@@ -4,8 +4,18 @@ import com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledVo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
* <pre>
* 警情信息ES请求参数对象
* </pre>
*
* @author gwb
* @version $Id: ESAlertCalledRequestDto.java, v 0.1 2021年6月24日 下午3:30:40 gwb Exp $
*/
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class ESAlertCalledRequestDto extends AlertCalledVo public class ESAlertCalledRequestDto extends AlertCalledVo
{ {
@ApiModelProperty(value = "警情状态") @ApiModelProperty(value = "警情状态")
......
package com.yeejoin.amos.boot.module.jcs.biz.rule.action;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod;
import com.yeejoin.amos.feign.systemctl.Systemctl;
/**
*
* <pre>
* 警情报送规则动作
* </pre>
*
* @author gwb
* @version $Id: AlertCalledAction.java, v 0.1 2021年6月24日 下午4:41:22 gwb Exp $
*/
@Component
@RuleActionBean(beanLabel = "警情报送" )
public class AlertCalledAction {
public static final Logger log = LoggerFactory.getLogger(AlertCalledAction.class);
@PostConstruct
public void init() throws Exception
{
System.out.println();
}
public void sendSysMessage(String msgType, AlertCalledRo contingency) {
// ContingencyRo ro = (ContingencyRo)contingency;
// ro.setTelemetryMap(null);
// ro.setTelesignallingMap(null);
// Constructor<?> constructor;
// try {
// constructor = Class.forName(
// PACKAGEURL + result.getClass().getSimpleName() + "Message")
// .getConstructor(ActionResult.class);
// AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result);
// ToipResponse toipResponse = action.buildResponse(msgType, contingency, result.toJson());
// String topic = String.format("/%s/%s/%s", serviceName, stationName,"numberPlan");
// log.info(String.format("mqtt[%s]:【 %s 】", topic, toipResponse.toJsonStr()));
// webMqttComponent.publish(topic, toipResponse.toJsonStr());
// ContingencyEvent event = new ContingencyEvent(this);
// event.setMsgBody(toipResponse.toJsonStr());
// event.setTopic(topic);
// event.setMsgType(msgType);
// event.setContingency(contingency);
// contingencyLogPublisher.publish(event);
//
// } catch (Exception e) {
// e.printStackTrace();
// }
}
/**
*
* <pre>
* 短信报送
* </pre>
*
* @param smsTemp
* @param sendType
* @param sendIds
* @param alertCalledRo
*/
@RuleMethod(methodLabel = "短信报送", project = "西咸机场119接处警规则")
public void sendcmd(String smsTemp, String sendType, String sendIds, Object object) {
AlertCalledRo alertCalledRo = (AlertCalledRo)object;
HashMap<String, String> smsParams = new HashMap<String, String>();
smsParams.put("smsType", "MOBILE_REGISTER");
smsParams.put("mobile", "15191462503");
Systemctl.smsClient.sendVerifyCode(smsParams);
// ContingencyRo ro = (ContingencyRo)contingency;
// ro.setTelemetryMap(null);
// ro.setTelesignallingMap(null);
// Constructor<?> constructor;
// try {
// constructor = Class.forName(
// PACKAGEURL + result.getClass().getSimpleName() + "Message")
// .getConstructor(ActionResult.class);
// AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result);
// if ("mqtt".equals(pushType.toLowerCase())) {
// ToipResponse toipResponse = action.buildResponse(msgType, contingency, result.toJson());
// String topic = String.format("/%s/%s/%s", serviceName, stationName,"plan");
// log.info(String.format("mqtt[%s]:【 %s 】", topic, toipResponse.toJsonStr()));
// webMqttComponent.publish(topic, toipResponse.toJsonStr());
//
// ContingencyEvent event = new ContingencyEvent(this);
// event.setMsgBody(toipResponse.toJsonStr());
// event.setTopic(topic);
// event.setMsgType(msgType);
// event.setContingency(contingency);
// contingencyLogPublisher.publish(event);
// } else if ("websocket".equals(pushType.toLowerCase())){
// action.execute(msgType, contingency);
// }
//
// } catch (Exception e) {
// e.printStackTrace();
// }
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.component.rule.RuleTrigger;
/**
*
* <pre>
* 规则触发服务
* </pre>
*
* @author gwb
* @version $Id: RuleAlertCalledService.java, v 0.1 2021年6月24日 下午6:30:44 gwb Exp $
*/
@Service
public class RuleAlertCalledService {
@Autowired
private RuleTrigger ruleTrigger;
/**
*
* <pre>
* 触发警情报送规则
* </pre>
*
* @param alertCalled
* @return
* @throws Exception
*/
public Boolean fireAlertCalledRule(AlertCalled alertCalled) throws Exception
{
//构建警情报送规则对象
AlertCalledRo alertCalledRo = new AlertCalledRo();
alertCalledRo.setSequenceNbr(alertCalled.getSequenceNbr());
alertCalledRo.setAlertType(alertCalled.getAlertType());
alertCalledRo.setAlertTypeCode(alertCalled.getAlertTypeCode());
alertCalledRo.setAlertTypeCode("229");
//触发规则
ruleTrigger.publish(alertCalledRo, "西咸机场119接处警规则/alertCalledRule", new String[0]);
return true;
}
}
...@@ -12,11 +12,17 @@ ...@@ -12,11 +12,17 @@
<dependencies> <dependencies>
<!-- ES-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId> <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency> </dependency>
<!-- amos rule-->
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<version>1.4.7</version>
</dependency>
</dependencies> </dependencies>
......
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