Commit 62c2076f authored by 李腾威's avatar 李腾威

地图消息接口

parent 60b54653
package com.yeejoin.amos.boot.module.tzs.biz.service.impl; package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
...@@ -19,12 +20,18 @@ import com.yeejoin.amos.boot.module.tzs.api.enums.TzsCommonParam; ...@@ -19,12 +20,18 @@ import com.yeejoin.amos.boot.module.tzs.api.enums.TzsCommonParam;
import com.yeejoin.amos.boot.module.tzs.api.mapper.RepairConsultMapper; import com.yeejoin.amos.boot.module.tzs.api.mapper.RepairConsultMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IRepairConsultService; import com.yeejoin.amos.boot.module.tzs.api.service.IRepairConsultService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.io.UnsupportedEncodingException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -38,6 +45,7 @@ import java.util.Map; ...@@ -38,6 +45,7 @@ import java.util.Map;
@Service @Service
public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,RepairConsult,RepairConsultMapper> implements IRepairConsultService { public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,RepairConsult,RepairConsultMapper> implements IRepairConsultService {
private final Logger logger = LoggerFactory.getLogger(RepairConsultServiceImpl.class);
@Autowired @Autowired
TemplateServiceImpl templateServiceImpl; TemplateServiceImpl templateServiceImpl;
...@@ -56,6 +64,15 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai ...@@ -56,6 +64,15 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
@Autowired @Autowired
RescueProcessServiceImpl rescueProcessServiceImpl; RescueProcessServiceImpl rescueProcessServiceImpl;
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.alertHeart.push}")
private String alertHeartpushTopic;
@Value("${mqtt.topic.alertMatrix.push}")
private String alertMatrixpushTopic;
/** /**
* 记录处置日志同时修改案件的状态 * 记录处置日志同时修改案件的状态
* @param alertId * @param alertId
...@@ -250,6 +267,19 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai ...@@ -250,6 +267,19 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
if(flag) { if(flag) {
// 记录处置记录后修改 案件状态 // 记录处置记录后修改 案件状态
alertCalledServiceImpl.updateAlertStage(alertCalledVo,CZHJ); alertCalledServiceImpl.updateAlertStage(alertCalledVo,CZHJ);
// 警情伤亡消息 矩阵 消息
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId",user.getUserId());
jsonObject.put("alertId",alertCalledVo.getSequenceNbr());
try {
emqKeeper.getMqttClient().publish(alertHeartpushTopic, jsonObject.toString().getBytes("UTF-8"), 1, false);
emqKeeper.getMqttClient().publish(alertMatrixpushTopic, jsonObject.toString().getBytes("UTF-8"), 1, false);
} catch (MqttException e) {
logger.error("mqtt发送失败" +jsonObject );
} catch (UnsupportedEncodingException e) {
logger.error("mqtt发送失败" +jsonObject );
}
} }
return flag; return flag;
} }
......
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