Commit 14af413e authored by tangwei's avatar tangwei

增加力量调派通知

parent df89c009
...@@ -118,7 +118,7 @@ public interface EquipFeignClient { ...@@ -118,7 +118,7 @@ public interface EquipFeignClient {
* *
* **/ * **/
@RequestMapping(value = "/car/getTeamCarList", method = RequestMethod.GET) @RequestMapping(value = "/car/getTeamCarList", method = RequestMethod.GET)
ResponseModel<List<Map<String,Object>>> getTeamCarList(); ResponseModel<List<Map<String,Object>>> getTeamCarList(@RequestParam Double longitude,@RequestParam Double latitude);
} }
...@@ -678,6 +678,7 @@ public class CommandController extends BaseController { ...@@ -678,6 +678,7 @@ public class CommandController extends BaseController {
//平面图。待完成orgUsrzhDto.getBuildId() //平面图。待完成orgUsrzhDto.getBuildId()
if(orgUsrzhDto.getBuildId()!=null) {
List<Map<String,Object>> list= equipFeignClient.findImgByFileCategory(orgUsrzhDto.getBuildId(),"fourImg").getResult(); List<Map<String,Object>> list= equipFeignClient.findImgByFileCategory(orgUsrzhDto.getBuildId(),"fourImg").getResult();
List<String> url=new ArrayList<>(); List<String> url=new ArrayList<>();
if(list!=null&&list.size()>0) { if(list!=null&&list.size()>0) {
...@@ -686,7 +687,7 @@ public class CommandController extends BaseController { ...@@ -686,7 +687,7 @@ public class CommandController extends BaseController {
}); });
} }
orgusrDataxDto.setPlanePicture(url); orgusrDataxDto.setPlanePicture(url);
}
return ResponseHelper.buildResponse(orgusrDataxDto); return ResponseHelper.buildResponse(orgusrDataxDto);
} }
...@@ -764,9 +765,9 @@ public class CommandController extends BaseController { ...@@ -764,9 +765,9 @@ public class CommandController extends BaseController {
@TycloudOperation( needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation( needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "fireCar/list") @GetMapping(value = "fireCar/list")
@ApiOperation(httpMethod = "GET", value = "车辆资源", notes = "车辆资源") @ApiOperation(httpMethod = "GET", value = "车辆资源", notes = "车辆资源")
public ResponseModel<List<Map<String,Object>>> getTeamCarList() { public ResponseModel<List<Map<String,Object>>> getTeamCarList(RequestData par) {
List<Map<String,Object>> list= equipFeignClient.getTeamCarList().getResult(); List<Map<String,Object>> list= equipFeignClient.getTeamCarList(par.getLongitude(),par.getLatitude()).getResult();
return ResponseHelper.buildResponse(list); return ResponseHelper.buildResponse(list);
} }
......
...@@ -110,7 +110,7 @@ public class FrontlineLiaisonController extends BaseController { ...@@ -110,7 +110,7 @@ public class FrontlineLiaisonController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "前线联络员列表全部数据查询", notes = "前线联络员列表全部数据查询") @ApiOperation(httpMethod = "GET",value = "前线联络员列表全部数据查询", notes = "前线联络员列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public ResponseModel<List<FrontlineLiaisonDto>> selectForList() { public ResponseModel<List<FrontlineLiaisonDto>> selectForList(@RequestParam(value = "alertCalledId")Long alertCalledId) {
return ResponseHelper.buildResponse(frontlineLiaisonServiceImpl.queryForFrontlineLiaisonList()); return ResponseHelper.buildResponse(frontlineLiaisonServiceImpl.queryForFrontlineLiaisonList(alertCalledId));
} }
} }
...@@ -32,7 +32,7 @@ public class FrontlineLiaisonServiceImpl extends BaseService<FrontlineLiaisonDto ...@@ -32,7 +32,7 @@ public class FrontlineLiaisonServiceImpl extends BaseService<FrontlineLiaisonDto
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<FrontlineLiaisonDto> queryForFrontlineLiaisonList() { public List<FrontlineLiaisonDto> queryForFrontlineLiaisonList(@Condition(Operator.eq) Long alertCalledId) {
return this.queryForList("" , false); return this.queryForList("" , false,alertCalledId);
} }
} }
\ No newline at end of file
...@@ -145,7 +145,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -145,7 +145,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
alertCalled.setAddress(data[0]); alertCalled.setAddress(data[0]);
if(data[1]!=null&&!"".equals(data[1])){ if(data[1]!=null&&!"".equals(data[1])){
JSONObject jSONObject = JSON.parseObject(data[1]); JSONObject jSONObject = JSON.parseObject(data[1]);
if(jSONObject.getString("longitude")!=null&&!"".equals(jSONObject.getString("longitude"))) { if(jSONObject.getString("longitude")!=null&&!"".equals(jSONObject.getString("longitude"))) {
alertCalled.setCoordinateX(Double.valueOf(jSONObject.getString("longitude"))); alertCalled.setCoordinateX(Double.valueOf(jSONObject.getString("longitude")));
} }
......
...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.*; ...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.*;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyMapper; import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyMapper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -83,6 +84,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -83,6 +84,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Value("${mqtt.topic.alert.reporting}") @Value("${mqtt.topic.alert.reporting}")
private String topic; private String topic;
@Value("${mqtt.topic.command.power.deployment}")
private String powertopic;
@Autowired @Autowired
EquipFeignClient equipFeignClient; EquipFeignClient equipFeignClient;
...@@ -136,6 +140,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -136,6 +140,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Override @Override
public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception { public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception {
try {
Long alertSubmittedId = saveAlertSubmitted(alertSubmittedDto, userName); Long alertSubmittedId = saveAlertSubmitted(alertSubmittedDto, userName);
// 组装规则入参 // 组装规则入参
AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId()); AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId());
...@@ -150,6 +155,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -150,6 +155,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 调用规则 // 调用规则
ruleAlertCalledService.fireAlertCalledRule(alertCalledVo); ruleAlertCalledService.fireAlertCalledRule(alertCalledVo);
//通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(powertopic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
} catch (MqttException e) {
throw new RuntimeException();
}
return true; return true;
} }
......
...@@ -8,13 +8,17 @@ import java.util.stream.Collectors; ...@@ -8,13 +8,17 @@ import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.jcs.api.dto.*; import com.yeejoin.amos.boot.module.jcs.api.dto.*;
import com.yeejoin.amos.boot.module.jcs.api.enums.DutyInfoEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.DutyInfoEnum;
import com.yeejoin.amos.component.rule.config.RuleConfig;
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.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
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.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
...@@ -68,6 +72,13 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe ...@@ -68,6 +72,13 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
@Autowired @Autowired
PowerTransferMapper powerTransferMapper; PowerTransferMapper powerTransferMapper;
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.command.power.deployment}")
private String topic;
@Override @Override
public PowerTransferSimpleDto getPowerTransferList(Long alertCalledId) { public PowerTransferSimpleDto getPowerTransferList(Long alertCalledId) {
List<PowerTransferCompanyResourcesDto> powerTransferList = List<PowerTransferCompanyResourcesDto> powerTransferList =
...@@ -82,6 +93,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe ...@@ -82,6 +93,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean createPowerTransfer(PowerTransferDto powerTransferDto) { public boolean createPowerTransfer(PowerTransferDto powerTransferDto) {
try {
// 获取调派ID // 获取调派ID
Long alertCalledId = powerTransferDto.getAlertCalledId(); Long alertCalledId = powerTransferDto.getAlertCalledId();
int count = count(new QueryWrapper<PowerTransfer>().eq("alert_called_id", alertCalledId)); int count = count(new QueryWrapper<PowerTransfer>().eq("alert_called_id", alertCalledId));
...@@ -109,6 +121,14 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe ...@@ -109,6 +121,14 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
// 创建力量调派单位 // 创建力量调派单位
createPowerTransferCompany(powerTransferDto, powerTransferSequenceNbr, definitions, content); createPowerTransferCompany(powerTransferDto, powerTransferSequenceNbr, definitions, content);
//发送调派通知
//通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
} catch (MqttException e) {
throw new RuntimeException();
}
return true; return true;
} }
......
...@@ -50,12 +50,14 @@ spring.redis.expire.time=300 ...@@ -50,12 +50,14 @@ 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
## 跑马灯地震,天气预警信息 ## 跑马灯地震,天气预警信息
mqtt.topic.command.seismometeorology.notice=seismometeorology mqtt.topic.command.seismometeorology.notice=seismometeorology
security.systemctl.name=AMOS-API-SYSTEMCTL mqtt.topic.command.power.deployment=power
security.systemctl.name=AMOS-API-SYSTEMCTL
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