Commit cec35b98 authored by tangwei's avatar tangwei

警情推送

parent 9e4f4f3c
package com.yeejoin.amos.boot.module.jcs.api.dto; package com.yeejoin.amos.boot.module.jcs.api.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -18,7 +19,6 @@ import java.util.Date; ...@@ -18,7 +19,6 @@ import java.util.Date;
@ApiModel(value="AlertCalledZhDto", description=" 指挥警情接警记录") @ApiModel(value="AlertCalledZhDto", description=" 指挥警情接警记录")
public class AlertCalledZhDto { public class AlertCalledZhDto {
@ApiModelProperty(value = "主键ID") @ApiModelProperty(value = "主键ID")
protected Long sequenceNbr; protected Long sequenceNbr;
......
...@@ -9,6 +9,7 @@ import java.util.Set; ...@@ -9,6 +9,7 @@ import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -384,7 +385,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -384,7 +385,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
// 保存动态表单数据 // 保存动态表单数据
iAlertFormValueService.saveBatch(alertFormValuelist); iAlertFormValueService.saveBatch(alertFormValuelist);
emqKeeper.getMqttClient().publish(topic1, "1".getBytes(), RuleConfig.DEFAULT_QOS, true); emqKeeper.getMqttClient().publish(topic1, "1".getBytes(), RuleConfig.DEFAULT_QOS, false);
} else { } else {
// 警情报送 // 警情报送
// ****************************************************待确认开发 // ****************************************************待确认开发
...@@ -409,15 +410,15 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -409,15 +410,15 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto, AlertBusinessTypeEnum.警情初报.getCode(), ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto, AlertBusinessTypeEnum.警情初报.getCode(),
null, null, null); null, null, null);
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化 // 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true); emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, false);
//tuisongxinjingqing //tuisongxinjingqing
RequestData par=new RequestData(); RequestData par=new RequestData();
par.setAlertId(alertCalled.getSequenceNbr()); par.setAlertId(alertCalled.getSequenceNbr());
List<AlertCalledZhDto> list = this.alertCalledListByAlertStatus(null, null, par); List<AlertCalledZhDto> list = this.alertCalledListByAlertStatus(null, null, par);
String json=list!=null&&list.size()>0?JSONObject.toJSONString(list.get(0)):""; String json=list!=null&&list.size()>0?JSONObject.toJSONString(list.get(0), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue):"";
emqKeeper.getMqttClient().publish(topicData, json.getBytes(), RuleConfig.DEFAULT_QOS, true); emqKeeper.getMqttClient().publish(topicData, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
/** /**
* 同步保存ES * 同步保存ES
...@@ -431,7 +432,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -431,7 +432,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
throw new RuntimeException("报送失败,系统异常!"); throw new RuntimeException("报送失败,系统异常!");
} }
} }
/** /**
* 根据id 修改警情 type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案 * 根据id 修改警情 type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
*/ */
......
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.XWPFTemplate;
...@@ -515,15 +516,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -515,15 +516,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams); alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams);
} }
//警情結案推送
if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
RequestData par=new RequestData();
par.setAlertId(alertCalled.getSequenceNbr());
List<AlertCalledZhDto> list = alertCalledService.alertCalledListByAlertStatus(null, null, par);
String json=list!=null&&list.size()>0?JSONObject.toJSONString(list.get(0)):"";
emqKeeper.getMqttClient().publish(topicJa, json.getBytes(), RuleConfig.DEFAULT_QOS, true);
}
...@@ -538,7 +531,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -538,7 +531,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Map<String,String> saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) { public Map<String,String> saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) {
Long alertSubmittedId = alertSubmittedDto.getSequenceNbr(); try { Long alertSubmittedId = alertSubmittedDto.getSequenceNbr();
String alertWay = ""; String alertWay = "";
Map<String,String> map = new HashMap<>(); Map<String,String> map = new HashMap<>();
Set<String> mobiles = new HashSet<>(); Set<String> mobiles = new HashSet<>();
...@@ -665,6 +658,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -665,6 +658,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
} }
if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode()) if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())
|| AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) { || AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
// 查询本次警情调派的车辆 // 查询本次警情调派的车辆
...@@ -689,6 +688,22 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -689,6 +688,22 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// powerTransferCompanyResourcesService.update(new UpdateWrapper<PowerTransferCompanyResources>().eq("resources_id", transferCarIdList).set("status", FireCarStatusEnum.返队.getCode())); // powerTransferCompanyResourcesService.update(new UpdateWrapper<PowerTransferCompanyResources>().eq("resources_id", transferCarIdList).set("status", FireCarStatusEnum.返队.getCode()));
} }
//警情結案推送
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
//tuisongxinjingqing
RequestData par=new RequestData();
par.setAlertId(alertSubmittedDto.getAlertCalledId());
List<AlertCalledZhDto> list4 = alertCalledService.alertCalledListByAlertStatus(null, null, par);
String json=list4!=null&&list4.size()>0?JSONObject.toJSONString(list4.get(0), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue):"";
emqKeeper.getMqttClient().publish(topicJa, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
// 4.发送任务消息 // 4.发送任务消息
// 4.1组织短信内容 废弃 // 4.1组织短信内容 废弃
...@@ -704,6 +719,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -704,6 +719,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
map.put("alertWay",alertWay); map.put("alertWay",alertWay);
map.put("mobiles", StringUtils.join(mobiles,",")); map.put("mobiles", StringUtils.join(mobiles,","));
return map; return map;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("报送失败,系统异常!");
}
} }
public void generateMob(AlertCalled alertCalled) throws ParseException, FileNotFoundException { public void generateMob(AlertCalled alertCalled) throws ParseException, FileNotFoundException {
......
...@@ -162,7 +162,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe ...@@ -162,7 +162,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
// 发送调派通知 // 发送调派通知
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化 // 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true); emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, false);
} catch (MqttException e) { } catch (MqttException e) {
throw new RuntimeException(); throw new RuntimeException();
} }
......
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