Commit 14af413e authored by tangwei's avatar tangwei

增加力量调派通知

parent df89c009
......@@ -118,7 +118,7 @@ public interface EquipFeignClient {
*
* **/
@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 {
//平面图。待完成orgUsrzhDto.getBuildId()
List<Map<String,Object>> list= equipFeignClient.findImgByFileCategory(orgUsrzhDto.getBuildId(),"fourImg").getResult();
List<String> url=new ArrayList<>();
if(list!=null&&list.size()>0) {
list.stream().forEach(map->{
url.add(map.get("filePath").toString());
});
if(orgUsrzhDto.getBuildId()!=null) {
List<Map<String,Object>> list= equipFeignClient.findImgByFileCategory(orgUsrzhDto.getBuildId(),"fourImg").getResult();
List<String> url=new ArrayList<>();
if(list!=null&&list.size()>0) {
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 {
@TycloudOperation( needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "fireCar/list")
@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);
}
......
......@@ -110,7 +110,7 @@ public class FrontlineLiaisonController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "前线联络员列表全部数据查询", notes = "前线联络员列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<FrontlineLiaisonDto>> selectForList() {
return ResponseHelper.buildResponse(frontlineLiaisonServiceImpl.queryForFrontlineLiaisonList());
public ResponseModel<List<FrontlineLiaisonDto>> selectForList(@RequestParam(value = "alertCalledId")Long alertCalledId) {
return ResponseHelper.buildResponse(frontlineLiaisonServiceImpl.queryForFrontlineLiaisonList(alertCalledId));
}
}
......@@ -32,7 +32,7 @@ public class FrontlineLiaisonServiceImpl extends BaseService<FrontlineLiaisonDto
/**
* 列表查询 示例
*/
public List<FrontlineLiaisonDto> queryForFrontlineLiaisonList() {
return this.queryForList("" , false);
public List<FrontlineLiaisonDto> queryForFrontlineLiaisonList(@Condition(Operator.eq) Long alertCalledId) {
return this.queryForList("" , false,alertCalledId);
}
}
\ No newline at end of file
......@@ -144,8 +144,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
String[] data= alertCalled.getAddress().split("@address@");
alertCalled.setAddress(data[0]);
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"))) {
alertCalled.setCoordinateX(Double.valueOf(jSONObject.getString("longitude")));
}
......
......@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.*;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyMapper;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.ObjectUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -83,6 +84,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Value("${mqtt.topic.alert.reporting}")
private String topic;
@Value("${mqtt.topic.command.power.deployment}")
private String powertopic;
@Autowired
EquipFeignClient equipFeignClient;
......@@ -136,20 +140,26 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Override
public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception {
Long alertSubmittedId = saveAlertSubmitted(alertSubmittedDto, userName);
// 组装规则入参
AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId());
AlertCalledObjsDto alertCalledVo = new AlertCalledObjsDto();
alertCalledVo.setAlertCalled(alertCalled);
List<AlertFormValue> alertFormValue = new ArrayList<>();
AlertFormValue formValue = new AlertFormValue();
formValue.setFieldCode("alertSubmittedId");
formValue.setFieldValue(alertSubmittedId.toString());
alertFormValue.add(formValue);
alertCalledVo.setAlertFormValue(alertFormValue);
// 调用规则
ruleAlertCalledService.fireAlertCalledRule(alertCalledVo);
try {
Long alertSubmittedId = saveAlertSubmitted(alertSubmittedDto, userName);
// 组装规则入参
AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId());
AlertCalledObjsDto alertCalledVo = new AlertCalledObjsDto();
alertCalledVo.setAlertCalled(alertCalled);
List<AlertFormValue> alertFormValue = new ArrayList<>();
AlertFormValue formValue = new AlertFormValue();
formValue.setFieldCode("alertSubmittedId");
formValue.setFieldValue(alertSubmittedId.toString());
alertFormValue.add(formValue);
alertCalledVo.setAlertFormValue(alertFormValue);
// 调用规则
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;
}
......
......@@ -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.enums.DutyInfoEnum;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
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.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -68,6 +72,13 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
@Autowired
PowerTransferMapper powerTransferMapper;
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.command.power.deployment}")
private String topic;
@Override
public PowerTransferSimpleDto getPowerTransferList(Long alertCalledId) {
List<PowerTransferCompanyResourcesDto> powerTransferList =
......@@ -82,33 +93,42 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
@Override
@Transactional(rollbackFor = Exception.class)
public boolean createPowerTransfer(PowerTransferDto powerTransferDto) {
// 获取调派ID
Long alertCalledId = powerTransferDto.getAlertCalledId();
int count = count(new QueryWrapper<PowerTransfer>().eq("alert_called_id", alertCalledId));
String dispatch_num = alertCalledId.toString() + (count + 1);
// 获取警情详情
AlertCalled alertCalled = alertCalledService.getById(alertCalledId);
// 创建力量调派
PowerTransfer powerTransfer = new PowerTransfer();
BeanUtils.copyProperties(powerTransferDto, powerTransfer);
BeanUtils.copyProperties(alertCalled, powerTransfer);
powerTransfer.setDispatchNum(dispatch_num);
powerTransfer.setSequenceNbr(null);
save(powerTransfer);
Long powerTransferSequenceNbr = powerTransfer.getSequenceNbr();
// 获取任务派发模板
Template template = templateService.getOne(new QueryWrapper<Template>().eq("type",
alertCalled.getAlertType()).eq("format", false));
String content = template.getContent();
Map<String, String> definitions = new HashMap<>();
initDefinitions(definitions, alertCalled, powerTransferDto);
// 创建力量调派单位
createPowerTransferCompany(powerTransferDto, powerTransferSequenceNbr, definitions, content);
try {
// 获取调派ID
Long alertCalledId = powerTransferDto.getAlertCalledId();
int count = count(new QueryWrapper<PowerTransfer>().eq("alert_called_id", alertCalledId));
String dispatch_num = alertCalledId.toString() + (count + 1);
// 获取警情详情
AlertCalled alertCalled = alertCalledService.getById(alertCalledId);
// 创建力量调派
PowerTransfer powerTransfer = new PowerTransfer();
BeanUtils.copyProperties(powerTransferDto, powerTransfer);
BeanUtils.copyProperties(alertCalled, powerTransfer);
powerTransfer.setDispatchNum(dispatch_num);
powerTransfer.setSequenceNbr(null);
save(powerTransfer);
Long powerTransferSequenceNbr = powerTransfer.getSequenceNbr();
// 获取任务派发模板
Template template = templateService.getOne(new QueryWrapper<Template>().eq("type",
alertCalled.getAlertType()).eq("format", false));
String content = template.getContent();
Map<String, String> definitions = new HashMap<>();
initDefinitions(definitions, alertCalled, powerTransferDto);
// 创建力量调派单位
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;
}
......
......@@ -50,12 +50,14 @@ spring.redis.expire.time=300
## mqtt-警情初报消息主题
mqtt.topic.alert.reporting=alertReporting
## 实战指挥新警情报主题
## 实战指挥新警情?报主题
mqtt.topic.command.alert.notice=alertNotice
## 跑马灯地震,天气预警信息
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