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,16 +678,17 @@ public class CommandController extends BaseController { ...@@ -678,16 +678,17 @@ public class CommandController extends BaseController {
//平面图。待完成orgUsrzhDto.getBuildId() //平面图。待完成orgUsrzhDto.getBuildId()
List<Map<String,Object>> list= equipFeignClient.findImgByFileCategory(orgUsrzhDto.getBuildId(),"fourImg").getResult(); if(orgUsrzhDto.getBuildId()!=null) {
List<String> url=new ArrayList<>(); List<Map<String,Object>> list= equipFeignClient.findImgByFileCategory(orgUsrzhDto.getBuildId(),"fourImg").getResult();
if(list!=null&&list.size()>0) { List<String> url=new ArrayList<>();
list.stream().forEach(map->{ if(list!=null&&list.size()>0) {
url.add(map.get("filePath").toString()); list.stream().forEach(map->{
}); url.add(map.get("filePath").toString());
});
}
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
...@@ -144,8 +144,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -144,8 +144,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
String[] data= alertCalled.getAddress().split("@address@"); String[] data= alertCalled.getAddress().split("@address@");
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,20 +140,26 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -136,20 +140,26 @@ 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 {
Long alertSubmittedId = saveAlertSubmitted(alertSubmittedDto, userName); try {
// 组装规则入参 Long alertSubmittedId = saveAlertSubmitted(alertSubmittedDto, userName);
AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId()); // 组装规则入参
AlertCalledObjsDto alertCalledVo = new AlertCalledObjsDto(); AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId());
alertCalledVo.setAlertCalled(alertCalled); AlertCalledObjsDto alertCalledVo = new AlertCalledObjsDto();
List<AlertFormValue> alertFormValue = new ArrayList<>(); alertCalledVo.setAlertCalled(alertCalled);
AlertFormValue formValue = new AlertFormValue(); List<AlertFormValue> alertFormValue = new ArrayList<>();
formValue.setFieldCode("alertSubmittedId"); AlertFormValue formValue = new AlertFormValue();
formValue.setFieldValue(alertSubmittedId.toString()); formValue.setFieldCode("alertSubmittedId");
alertFormValue.add(formValue); formValue.setFieldValue(alertSubmittedId.toString());
alertCalledVo.setAlertFormValue(alertFormValue); alertFormValue.add(formValue);
alertCalledVo.setAlertFormValue(alertFormValue);
// 调用规则
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,33 +93,42 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe ...@@ -82,33 +93,42 @@ 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) {
// 获取调派ID try {
Long alertCalledId = powerTransferDto.getAlertCalledId(); // 获取调派ID
int count = count(new QueryWrapper<PowerTransfer>().eq("alert_called_id", alertCalledId)); Long alertCalledId = powerTransferDto.getAlertCalledId();
String dispatch_num = alertCalledId.toString() + (count + 1); int count = count(new QueryWrapper<PowerTransfer>().eq("alert_called_id", alertCalledId));
String dispatch_num = alertCalledId.toString() + (count + 1);
// 获取警情详情
AlertCalled alertCalled = alertCalledService.getById(alertCalledId); // 获取警情详情
AlertCalled alertCalled = alertCalledService.getById(alertCalledId);
// 创建力量调派
PowerTransfer powerTransfer = new PowerTransfer(); // 创建力量调派
BeanUtils.copyProperties(powerTransferDto, powerTransfer); PowerTransfer powerTransfer = new PowerTransfer();
BeanUtils.copyProperties(alertCalled, powerTransfer); BeanUtils.copyProperties(powerTransferDto, powerTransfer);
powerTransfer.setDispatchNum(dispatch_num); BeanUtils.copyProperties(alertCalled, powerTransfer);
powerTransfer.setSequenceNbr(null); powerTransfer.setDispatchNum(dispatch_num);
powerTransfer.setSequenceNbr(null);
save(powerTransfer);
Long powerTransferSequenceNbr = powerTransfer.getSequenceNbr(); save(powerTransfer);
Long powerTransferSequenceNbr = powerTransfer.getSequenceNbr();
// 获取任务派发模板
Template template = templateService.getOne(new QueryWrapper<Template>().eq("type", // 获取任务派发模板
alertCalled.getAlertType()).eq("format", false)); Template template = templateService.getOne(new QueryWrapper<Template>().eq("type",
String content = template.getContent(); alertCalled.getAlertType()).eq("format", false));
Map<String, String> definitions = new HashMap<>(); String content = template.getContent();
initDefinitions(definitions, alertCalled, powerTransferDto); Map<String, String> definitions = new HashMap<>();
initDefinitions(definitions, alertCalled, powerTransferDto);
// 创建力量调派单位
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