Commit 60b54653 authored by 李腾威's avatar 李腾威

地图消息接口

parent cf9b0baa
package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
......@@ -36,7 +37,11 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
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.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -44,6 +49,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -52,6 +58,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.util.Date;
import java.util.LinkedHashMap;
......@@ -69,6 +76,8 @@ import java.util.Map;
@RequestMapping(value = "/alert-called")
public class AlertCalledController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(AlertCalledController.class);
@Autowired
RedisUtils redisUtils;
......@@ -96,6 +105,15 @@ public class AlertCalledController extends BaseController {
@Autowired
ElevatorServiceImpl elevatorService;
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.alertReport.push}")
private String alertReportpushTopic;
@Value("${mqtt.topic.alertInfo.push}")
private String alertInfopushTopic;
/**
* 新增警情接警填报记录
*
......@@ -111,6 +129,27 @@ public class AlertCalledController extends BaseController {
}
ReginParams reginParams = getSelectedOrgInfo();
alertCalledObjsDto = iAlertCalledService.createAlertCalled(alertCalledObjsDto, reginParams.getUserModel());
// 坐席接警后,辅屏由常态化切换为处置态
AgencyUserModel user =getUserInfo();
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId",user.getUserId());
jsonObject.put("alertId",alertCalledObjsDto.getAlertCalledDto().getSequenceNbr());
JSONObject jsonObject1 = new JSONObject();
jsonObject.put("alertId",alertCalledObjsDto.getAlertCalledDto().getSequenceNbr());
try {
emqKeeper.getMqttClient().publish(alertReportpushTopic, jsonObject.toString().getBytes("UTF-8"), 1, false);
// 跑马灯消息提醒
if(null != alertCalledObjsDto.getAlertCalledDto().getFatherAlert()) {
emqKeeper.getMqttClient().publish(alertInfopushTopic, jsonObject1.toString().getBytes("UTF-8"), 1, false);
}
} catch (MqttException e) {
logger.error("mqtt发送失败" +jsonObject );
} catch (UnsupportedEncodingException e) {
logger.error("mqtt发送失败" +jsonObject );
}
return ResponseHelper.buildResponse(alertCalledObjsDto.getAlertCalledDto());
}
......
......@@ -331,7 +331,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
LambdaQueryWrapper<AlertCalled> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(AlertCalled::getAlertStageCode,"860");
queryWrapper.ge(AlertCalled::getCallTime,DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN));
queryWrapper.le(AlertCalled::getAlertStageCode,DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN));
queryWrapper.le(AlertCalled::getCallTime,DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN));
Object list = this.list(queryWrapper);
return list;
}
......
......@@ -63,4 +63,12 @@ mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator
\ No newline at end of file
mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
\ No newline at end of file
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