Commit ebf0f365 authored by kongfm's avatar kongfm

修复相似警情查找 及 警情任务结束mqtt 消息

parent 26bb3fad
...@@ -63,4 +63,7 @@ public class AlertPaperInfoDto { ...@@ -63,4 +63,7 @@ public class AlertPaperInfoDto {
@ApiModelProperty(value = "电梯设备编码") @ApiModelProperty(value = "电梯设备编码")
private String elevatorCode; private String elevatorCode;
@ApiModelProperty(value = "警情结束时间")
private Date finishTime;
} }
...@@ -24,6 +24,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto; ...@@ -24,6 +24,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledDto; import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledRequestDto; import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledRequestDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled; import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator; import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.WechatRelation; import com.yeejoin.amos.boot.module.tzs.api.entity.WechatRelation;
import com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums; import com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums;
...@@ -195,7 +196,10 @@ public class AlertCalledController extends BaseController { ...@@ -195,7 +196,10 @@ public class AlertCalledController extends BaseController {
alertCalledDto.setUseStatus(elevator.getUseStatus()); alertCalledDto.setUseStatus(elevator.getUseStatus());
alertCalledDto.setUseSiteCategory(elevator.getUseSiteCategory()); alertCalledDto.setUseSiteCategory(elevator.getUseSiteCategory());
alertCalledDto.setAlarmType(AlertStageEnums.getEnumById(alertCalledDto.getAlarmTypeCode()).getValue()); alertCalledDto.setAlarmType(AlertStageEnums.getEnumById(alertCalledDto.getAlarmTypeCode()).getValue());
alertCalledDto.setEquipmentClassification("电梯");
alertCalledDto.setEquipmentClassificationCode("3000");
alertCalledDto.setCity(elevator.getCity());
alertCalledDto.setDistrict(elevator.getDistrict());
AlertCalledDto alertCalledDtoReturn = iAlertCalledService.createAlertCalled(alertCalledDto); AlertCalledDto alertCalledDtoReturn = iAlertCalledService.createAlertCalled(alertCalledDto);
return ResponseHelper.buildResponse(alertCalledDtoReturn); return ResponseHelper.buildResponse(alertCalledDtoReturn);
} }
...@@ -232,6 +236,11 @@ public class AlertCalledController extends BaseController { ...@@ -232,6 +236,11 @@ public class AlertCalledController extends BaseController {
alertPaperInfoDto.setAlertStatus(alertCalled.getAlertStage()); alertPaperInfoDto.setAlertStatus(alertCalled.getAlertStage());
alertPaperInfoDto.setElevatorId(elevator.getSequenceNbr() +""); alertPaperInfoDto.setElevatorId(elevator.getSequenceNbr() +"");
alertPaperInfoDto.setElevatorCode(elevator.getRegisterCode()); alertPaperInfoDto.setElevatorCode(elevator.getRegisterCode());
DispatchPaper paper = dispatchPaperServiceImpl.getOne(new LambdaQueryWrapper<DispatchPaper>().eq(DispatchPaper::getIsDelete,false).eq(DispatchPaper::getAlertId,alertId));
if(paper != null) {
alertPaperInfoDto.setFinishTime(paper.getFeedbackFinishTime());
}
return ResponseHelper.buildResponse(alertPaperInfoDto); return ResponseHelper.buildResponse(alertPaperInfoDto);
} }
......
...@@ -387,7 +387,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -387,7 +387,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
// 警情基本信息 // 警情基本信息
AlertCalled alertCalled = BeanDtoVoUtils.convert(alertCalledObjsDto.getAlertCalledDto(),AlertCalled.class); AlertCalled alertCalled = BeanDtoVoUtils.convert(alertCalledObjsDto.getAlertCalledDto(),AlertCalled.class);
alertCalled.setEquipmentClassification("电梯");
alertCalled.setEquipmentClassificationCode("3000");
alertCalled.setCallTime(DateUtils.longStr2Date(alertCalled.getCallTimeStr())); alertCalled.setCallTime(DateUtils.longStr2Date(alertCalled.getCallTimeStr()));
// 判断是否归并警情 // 判断是否归并警情
...@@ -425,6 +426,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -425,6 +426,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
queryWrapper.eq(Elevator::getRescueCode,alertCalled.getDeviceId()); queryWrapper.eq(Elevator::getRescueCode,alertCalled.getDeviceId());
Elevator elevator = iElevatorService.getOne(queryWrapper); Elevator elevator = iElevatorService.getOne(queryWrapper);
alertCalled.setEquipmentId(elevator.getSequenceNbr()); alertCalled.setEquipmentId(elevator.getSequenceNbr());
alertCalled.setCity(elevator.getCity());
alertCalled.setDistrict(elevator.getDistrict());
this.save(alertCalled); this.save(alertCalled);
// 动态表单 // 动态表单
......
...@@ -116,6 +116,7 @@ public class ESAlertCalledService { ...@@ -116,6 +116,7 @@ public class ESAlertCalledService {
esAlertCalled.setAlertStatus(alertCalled.getAlertStatus()); esAlertCalled.setAlertStatus(alertCalled.getAlertStatus());
esAlertCalled.setEmergencyCall(alertCalled.getEmergencyCall()); esAlertCalled.setEmergencyCall(alertCalled.getEmergencyCall());
esAlertCalled.setDeviceId(alertCalled.getDeviceId()); esAlertCalled.setDeviceId(alertCalled.getDeviceId());
esAlertCalled.setUseUnit(alertCalled.getUseUnit());
if (alertCalled.getAlertStatus()) if (alertCalled.getAlertStatus())
{ {
esAlertCalled.setAlertStatusStr(AlertStatusEnum.CLOSED.getCode()); esAlertCalled.setAlertStatusStr(AlertStatusEnum.CLOSED.getCode());
...@@ -141,13 +142,11 @@ public class ESAlertCalledService { ...@@ -141,13 +142,11 @@ public class ESAlertCalledService {
public Page<ESAlertCalledDto> queryByKeys(ESAlertCalledRequestDto alertCalledVo, int current, int size) public Page<ESAlertCalledDto> queryByKeys(ESAlertCalledRequestDto alertCalledVo, int current, int size)
{ {
Page<ESAlertCalledDto> result = new Page<ESAlertCalledDto>(current, size); Page<ESAlertCalledDto> result = new Page<ESAlertCalledDto>(current, size);
String[] alertStatus = alertCalledVo.getAlertStatus(); String[] alertStatus = alertCalledVo.getAlertStatus();
if (ValidationUtil.isEmpty(alertStatus)) if (ValidationUtil.isEmpty(alertStatus))
{ {
return result; return result;
} }
AlertCalled alertCalled = BeanDtoVoUtils.convert(alertCalledVo.getAlertCalledDto(),AlertCalled.class); AlertCalled alertCalled = BeanDtoVoUtils.convert(alertCalledVo.getAlertCalledDto(),AlertCalled.class);
if (ValidationUtil.isEmpty(alertCalled)) if (ValidationUtil.isEmpty(alertCalled))
{ {
...@@ -157,54 +156,92 @@ public class ESAlertCalledService { ...@@ -157,54 +156,92 @@ public class ESAlertCalledService {
* 通用匹配规则,条件构建 * 通用匹配规则,条件构建
*/ */
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
//警情状态 //警情状态
BoolQueryBuilder qb0 = QueryBuilders.boolQuery(); BoolQueryBuilder qbstatus = QueryBuilders.boolQuery();
for (String status : alertStatus) for (String status : alertStatus)
{ {
AlertStatusEnum alertStatusEnum = AlertStatusEnum.getEnum(status); AlertStatusEnum alertStatusEnum = AlertStatusEnum.getEnum(status);
if (!ValidationUtil.isEmpty(alertStatusEnum)) if (!ValidationUtil.isEmpty(alertStatusEnum))
{ {
qb0.should(QueryBuilders.termQuery("alertStatusStr.keyword", alertStatusEnum.getCode())); qbstatus.should(QueryBuilders.termQuery("alertStatusStr.keyword", alertStatusEnum.getCode()));
} }
} }
boolMust.must(qb0); boolMust.must(qbstatus);
//接警时间,距离当前时间不超过两个小时的 // 如果没有搜索条件不搜索
long currentTime = System.currentTimeMillis() ; boolean flag = true;
currentTime = currentTime - 120*60*1000; // ①事发地点一致,或相距不超过200米的;&& ②警情类别一致;&& ③报警时间:距离当前时间不超过两小时的
BoolQueryBuilder qb1 = QueryBuilders.boolQuery() if (!ValidationUtil.isEmpty(alertCalled.getAddress()) && !ValidationUtil.isEmpty(alertCalled.getAlarmTypeCode()) && !ValidationUtil.isEmpty(alertCalled.getAlarmTypeCode()))
.filter(QueryBuilders.rangeQuery("callTimeLong").gte(currentTime));
boolMust.must(qb1);
//报警电话一致
if (!ValidationUtil.isEmpty(alertCalled.getEmergencyCall()) && !ValidationUtil.isEmpty(alertCalled.getContactPhone()))
{ {
BoolQueryBuilder qb2 = QueryBuilders.boolQuery() flag = false;
.should(QueryBuilders.termQuery("emergencyCall.keyword", alertCalled.getEmergencyCall())) BoolQueryBuilder qb0 = QueryBuilders.boolQuery();
.should(QueryBuilders.termQuery("contactPhone.keyword", alertCalled.getContactPhone())); BoolQueryBuilder temp1 = QueryBuilders.boolQuery()
boolMust.must(qb2); .filter(QueryBuilders.matchQuery("address", alertCalled.getAddress()));
qb0.must(temp1);
BoolQueryBuilder temp2 = QueryBuilders.boolQuery()
.filter(QueryBuilders.matchQuery("alarmTypeCode", alertCalled.getAlarmTypeCode()));
qb0.must(temp2);
//接警时间,距离当前时间不超过两个小时的
long currentTime = System.currentTimeMillis() ;
currentTime = currentTime - 120*60*1000;
BoolQueryBuilder temp3 = QueryBuilders.boolQuery()
.filter(QueryBuilders.rangeQuery("callTimeLong").gte(currentTime));
qb0.must(temp3);
boolMust.should(qb0);
} }
//事发地点一致,或相距不超过200米的 // 报警电话一致;
if (!ValidationUtil.isEmpty(alertCalled.getAddress())) if (!ValidationUtil.isEmpty(alertCalled.getEmergencyCall())) {
{ flag = false;
BoolQueryBuilder qb3 = QueryBuilders.boolQuery() BoolQueryBuilder tempQb = QueryBuilders.boolQuery();
.filter(QueryBuilders.matchQuery("address", alertCalled.getAddress())); BoolQueryBuilder tempQb1 = QueryBuilders.boolQuery()
boolMust.should(qb3); .filter(QueryBuilders.termQuery("emergencyCall.keyword", alertCalled.getEmergencyCall()));
tempQb.must(tempQb1);
boolMust.should(tempQb);
} }
//警情类型一致 // 使用单位名称一致;&& ②警情类别一致;&& ③报警时间:距离当前时间不超过两小时的
BoolQueryBuilder qb4 = QueryBuilders.boolQuery() if (!ValidationUtil.isEmpty(alertCalled.getUseUnit()) && !ValidationUtil.isEmpty(alertCalled.getAlarmTypeCode()) ) {
.filter(QueryBuilders.termQuery("alarmTypeCode", alertCalled.getAlarmTypeCode())); flag = false;
boolMust.must(qb4); BoolQueryBuilder qb0 = QueryBuilders.boolQuery();
//使用单位名称一致 BoolQueryBuilder temp1 = QueryBuilders.boolQuery()
if (!ValidationUtil.isEmpty(alertCalled.getUseUnit())) .filter(QueryBuilders.termQuery("useUnit.keyword", alertCalled.getUseUnit()));
{ qb0.must(temp1);
BoolQueryBuilder qb5 = QueryBuilders.boolQuery()
.filter(QueryBuilders.termQuery("useUnit.keyword", alertCalled.getUseUnit())); BoolQueryBuilder temp2 = QueryBuilders.boolQuery()
boolMust.must(qb5); .filter(QueryBuilders.termQuery("alarmTypeCode.keyword", alertCalled.getAlarmTypeCode()));
qb0.must(temp2);
//接警时间,距离当前时间不超过两个小时的
long currentTime = System.currentTimeMillis() ;
currentTime = currentTime - 120*60*1000;
BoolQueryBuilder temp3 = QueryBuilders.boolQuery()
.filter(QueryBuilders.rangeQuery("callTimeLong").gte(currentTime));
qb0.must(temp3);
boolMust.should(qb0);
} }
//电梯识别码一致
if(!ValidationUtil.isEmpty(alertCalled.getDeviceId())) { // 电梯识别码一致;&& ③报警时间:距离当前时间不超过两小时的
BoolQueryBuilder qb6 = QueryBuilders.boolQuery() if (!ValidationUtil.isEmpty(alertCalled.getDeviceId())) {
flag = false;
BoolQueryBuilder qb0 = QueryBuilders.boolQuery();
BoolQueryBuilder temp = QueryBuilders.boolQuery()
.filter(QueryBuilders.termQuery("deviceId.keyword", alertCalled.getDeviceId())); .filter(QueryBuilders.termQuery("deviceId.keyword", alertCalled.getDeviceId()));
boolMust.must(qb6); qb0.must(temp);
//接警时间,距离当前时间不超过两个小时的
long currentTime = System.currentTimeMillis() ;
currentTime = currentTime - 120*60*1000;
BoolQueryBuilder temp2 = QueryBuilders.boolQuery()
.filter(QueryBuilders.rangeQuery("callTimeLong").gte(currentTime));
qb0.must(temp2);
boolMust.should(qb0);
}
boolMust.minimumShouldMatch(1);//至少满足一个
if(flag) { // 不搜素
return result;
} }
/** /**
......
...@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto; ...@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchPaperFormDto; import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchPaperFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.RepairConsultDto; import com.yeejoin.amos.boot.module.tzs.api.dto.RepairConsultDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.RescueProcessDto; import com.yeejoin.amos.boot.module.tzs.api.dto.RescueProcessDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue; import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper; import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchTask; import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchTask;
...@@ -275,6 +276,12 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai ...@@ -275,6 +276,12 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
// 警情伤亡消息 矩阵 消息 // 警情伤亡消息 矩阵 消息
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("alertId",String.valueOf(alertCalledVo.getSequenceNbr())); jsonObject.put("alertId",String.valueOf(alertCalledVo.getSequenceNbr()));
// KRJY 的 repaired complainantBack 和 reportorBack 警情完成
if(CZHJ == DispatchPaperEnums.reportorBack || CZHJ == DispatchPaperEnums.complainantBack) {
jsonObject.put("finished",true);
} else if(CZHJ == DispatchPaperEnums.repaired && alertCalledVo.getAlarmTypeCode().equals(AlertStageEnums.KRJY.getId())) {
jsonObject.put("finished",true);
}
try { try {
emqKeeper.getMqttClient().publish(alertHeartpushTopic, jsonObject.toString().getBytes("UTF-8"), 1, false); emqKeeper.getMqttClient().publish(alertHeartpushTopic, jsonObject.toString().getBytes("UTF-8"), 1, false);
emqKeeper.getMqttClient().publish(alertMatrixpushTopic, jsonObject.toString().getBytes("UTF-8"), 1, false); emqKeeper.getMqttClient().publish(alertMatrixpushTopic, jsonObject.toString().getBytes("UTF-8"), 1, false);
......
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