Commit 88f7136a authored by 郭武斌's avatar 郭武斌

*)警情处警规则

parent 5b6131e3
......@@ -27,14 +27,45 @@ public class AlertCalledRo implements Serializable{
private static final long serialVersionUID = -8105736102662461646L;
/**
* 通用属性
*/
@Label("警情id")
private Long sequenceNbr;
@Label(value = "警情类型")
private String alertType;
@Label(value = "警情类型code")
private String alertTypeCode;
@Label(value = "事发单位")
private String unitInvolved;
@Label(value = "被困人数")
private Integer trappedNum;
@Label(value = "伤亡人数")
private Integer casualtiesNum;
@Label(value = "地址")
private String address;
/**
* 一般火灾
*/
@Label(value = "失火位置")
private String fireLocation;
@Label(value = "燃烧物质")
private String burningMaterial;
@Label(value = "火势情况")
private String fireSituation;
@Label(value = "危险爆炸品")
private String dangerousExplosives;
/**
* 航空器救援
*/
}
......@@ -2,15 +2,22 @@ package com.yeejoin.amos.boot.module.jcs.biz.rule.action;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod;
import com.yeejoin.amos.feign.systemctl.Systemctl;
......@@ -29,14 +36,10 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
public class AlertCalledAction {
public static final Logger log = LoggerFactory.getLogger(AlertCalledAction.class);
@Autowired
private OrgUsrServiceImpl orgUsrService;
@PostConstruct
public void init() throws Exception
{
System.out.println();
}
public void sendSysMessage(String msgType, AlertCalledRo contingency) {
// ContingencyRo ro = (ContingencyRo)contingency;
// ro.setTelemetryMap(null);
......@@ -74,44 +77,30 @@ System.out.println();
* @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();
// }
@SuppressWarnings("unchecked")
@RuleMethod(methodLabel = "短信报送", project = "西咸机场119接处警规则")
public void sendcmd(String smsCode, String sendType, String sendIds, Object object)
{
List<Long> seqs = StringUtil.String2LongList(sendIds);
if (ValidationUtil.isEmpty(seqs))
{
//构建短信参数
HashMap<String, String> smsParams = new HashMap<String, String>();
smsParams.put("smsCode", smsCode);
Map<String, String> objectMap = JSON.parseObject(JSON.toJSONString(object), HashMap.class);
smsParams.putAll(objectMap);
//发送短信
List<OrgUsrDto> orgUsrDtos = orgUsrService.queryBatchSeq(seqs);
for (OrgUsrDto orgUsrDto : orgUsrDtos)
{
// smsParams.put("mobile", orgUsrDto.ge);
Systemctl.smsClient.sendCommonSms(smsParams);
}
}
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledVo;
import com.yeejoin.amos.component.rule.RuleTrigger;
......@@ -35,18 +39,49 @@ public class RuleAlertCalledService {
* @return
* @throws Exception
*/
public Boolean fireAlertCalledRule(AlertCalledVo alertCalledVo) throws Exception
public Boolean fireAlertCalledRule(AlertCalledVo alertCalledVo) throws Exception
{
AlertCalled alertCalled = alertCalledVo.getAlertCalled();
if (ValidationUtil.isEmpty(alertCalled))
{
throw new BadRequest("参数校验失败.");
}
//构建警情报送规则对象
/**
* 构建警情报送规则对象
*/
AlertCalledRo alertCalledRo = new AlertCalledRo();
alertCalledRo.setSequenceNbr(alertCalled.getSequenceNbr());
alertCalledRo.setAlertType(alertCalled.getAlertType());
alertCalledRo.setAlertTypeCode(alertCalled.getAlertTypeCode());
//通用属性
Bean.toModel(alertCalled, alertCalledRo);
List<AlertFormValue> alertFormValues = alertCalledVo.getAlertFormValue();
for (AlertFormValue alertFormValue : alertFormValues)
{
//一般火灾
if (alertFormValue.getFieldCode().equals("fireLocation"))
{
alertCalledRo.setFireLocation(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("burningMaterial"))
{
alertCalledRo.setBurningMaterial(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("fireSituation"))
{
alertCalledRo.setFireSituation(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("dangerousExplosives"))
{
alertCalledRo.setDangerousExplosives(alertFormValue.getFieldValue());
}
//航空器救援
//突发事件救援
//漏油现场安全保障
//专机保障
}
alertCalledRo.setAlertTypeCode("229");
//触发规则
......
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