Commit d6581462 authored by 郭武斌's avatar 郭武斌

*)实现设备联动紧急响应api

parent 16713cca
package com.yeejoin.amos.boot.module.common.api.feign;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
*
* <pre>
* 设备联动服务(车库门、广播、警铃)
* </pre>
*
* @author gwb
* @version $Id: JcsControlServerClient.java, v 0.1 2021年8月19日 上午9:41:10 gwb Exp $
*/
@FeignClient(name = "${control.fegin.name}", configuration = {MultipartSupportConfig.class})
public interface JcsControlServerClient {
/**
*
* <pre>
* 打开/关闭消防警铃
* </pre>
*
* @param areasStr
* @param type(1 为开启 0为关闭)
* @return
*/
@GetMapping(value = "/v1/wksendbell/{codestr}/{type}")
FeignClientResult<String> sendBellAction(@PathVariable("codestr") String areasStr, @PathVariable("type") String type);
/**
*
* <pre>
* 播放广播
* </pre>
*
* @param areasStr
* @param fileUrlsStr
* @return
*/
@GetMapping(value = "/v1/wksend/{codestr}/{urlstr}")
FeignClientResult<String> sendFileAction(@PathVariable("codestr") String areasStr,@PathVariable("urlstr") String fileUrlsStr);
/**
*
* <pre>
* 获取单个设备状态(车库门)
* </pre>
*
* @param ip
* @param port
* @param whichone
* @return
*/
@GetMapping(value = "/v1/controlequip/kndread/{ip}/{port}/{num}")
FeignClientResult<String> readStateAction(@PathVariable("ip") String ip, @PathVariable("port") int port,
@PathVariable("num") int whichone);
/**
*
* <pre>
* 获取连续设备状态(车库门)
* </pre>
*
* @param ip
* @param port
* @param whichone
* @param count
* @return
*/
@GetMapping(value = "/v1/controlequip/kndread/{ip}/{port}/{num}/{count}")
FeignClientResult<String> readMoreStateAction(@PathVariable("ip") String ip,@PathVariable("port") int port,
@PathVariable("num") int whichone, @PathVariable("count") int count);
/**
*
* <pre>
* 设置设备状态(车库门)
* </pre>
*
* @param ip
* @param port
* @param whichone
* @param stateStr
* @return
*/
@GetMapping(value = "/v1/controlequip/kndwrite/{ip}/{port}/{num}/{result}")
FeignClientResult<String> writeStateAction(@PathVariable("ip") String ip,@PathVariable("port") int port,
@PathVariable("num") int whichone, @PathVariable("result") String stateStr);
}
package com.yeejoin.amos.boot.module.jcs.biz.controller; package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -22,14 +21,12 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -22,14 +21,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.CommonUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -39,13 +36,10 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController; ...@@ -39,13 +36,10 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledDto; import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledRequestDto; import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledRequestDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled; 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.biz.service.impl.AlertCalledServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService;
...@@ -287,4 +281,23 @@ public class AlertCalledController extends BaseController { ...@@ -287,4 +281,23 @@ public class AlertCalledController extends BaseController {
@RequestParam("endDate") String endDate) { @RequestParam("endDate") String endDate) {
return ResponseHelper.buildResponse(iAlertCalledService.getAlertInfoList(beginDate, endDate)); return ResponseHelper.buildResponse(iAlertCalledService.getAlertInfoList(beginDate, endDate));
} }
/**
*
* <pre>
* 设备联动紧急响应
* 启动所有消防队伍的警铃、广播,并自动开启所有车库门
* </pre>
*
* @return
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/billsend")
@ApiOperation(httpMethod = "POST", value = "设备联动紧急响应", notes = "启动所有消防队伍的警铃、广播,并自动开启所有车库门")
@Transactional
public ResponseModel<Boolean> controlEquip() throws Exception{
return ResponseHelper.buildResponse(iAlertCalledService.controlEquip());
}
} }
\ No newline at end of file
...@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey; ...@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue; import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData; import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.feign.JcsControlServerClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto;
...@@ -73,6 +74,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -73,6 +74,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
@Autowired @Autowired
AlertSubmittedMapper alertSubmittedMapper; AlertSubmittedMapper alertSubmittedMapper;
@Autowired @Autowired
private JcsControlServerClient jcsControlServerClient;
@Autowired
private AlertFormValueServiceImpl iAlertFormValueService; private AlertFormValueServiceImpl iAlertFormValueService;
@Autowired @Autowired
private ESAlertCalledService eSAlertCalledService; private ESAlertCalledService eSAlertCalledService;
...@@ -428,5 +431,21 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -428,5 +431,21 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
return alertCalledMapper.getTodayAlertCalled(); return alertCalledMapper.getTodayAlertCalled();
} }
@Transactional(rollbackFor = RuntimeException.class)
public Boolean controlEquip() throws Exception
{
//打开消防警铃
jcsControlServerClient.sendBellAction("204,205,206", "1");
//播放广播
jcsControlServerClient.sendFileAction("201,202,203", "1490075199246.mp3");
//打开北站车库门
jcsControlServerClient.writeStateAction("172.19.111.153", 502, 100, "1,1,1,1");
//打开北站车库门弱电警铃
jcsControlServerClient.writeStateAction("172.19.111.153", 502, 107, "1");
//打开南站车库门
jcsControlServerClient.writeStateAction("172.19.111.163", 502, 100, "1");
//打开南站车库门弱电警铃
jcsControlServerClient.writeStateAction("172.19.111.163", 502, 107, "1");
return null;
}
} }
...@@ -50,7 +50,7 @@ spring.redis.expire.time=300 ...@@ -50,7 +50,7 @@ spring.redis.expire.time=300
## mqtt-警情初报消息主题 ## mqtt-警情初报消息主题
mqtt.topic.alert.reporting=alertReporting mqtt.topic.alert.reporting=alertReporting
## 实战指挥新警情?报主题 ## 实战指挥新警情�?�报主题
mqtt.topic.command.alert.notice=alertNotice mqtt.topic.command.alert.notice=alertNotice
## 跑马灯地震,天气预警信息 ## 跑马灯地震,天气预警信息
...@@ -62,4 +62,7 @@ security.systemctl.name=AMOS-API-SYSTEMCTL ...@@ -62,4 +62,7 @@ security.systemctl.name=AMOS-API-SYSTEMCTL
iot.fegin.name=AMOS-API-IOT iot.fegin.name=AMOS-API-IOT
equip.fegin.name=AMOS-EQUIPMANAGE equip.fegin.name=AMOS-EQUIPMANAGE
\ No newline at end of file
## 设备联动服务(车库门、广播、警铃)
control.fegin.name=JCS-API-CONTROL
\ 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