Commit fde46022 authored by kongfm's avatar kongfm

警情状态更新后 更新redis 及 es 相关信息

parent 145a5829
...@@ -158,11 +158,30 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -158,11 +158,30 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
LambdaUpdateWrapper<AlertCalled> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<AlertCalled> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(AlertCalled::getSequenceNbr,alertCalledVo.getSequenceNbr()); updateWrapper.eq(AlertCalled::getSequenceNbr,alertCalledVo.getSequenceNbr());
updateWrapper.set(AlertCalled::getAlertStageCode,stage.getId()); updateWrapper.set(AlertCalled::getAlertStageCode,stage.getId());
alertCalledVo.setAlertStage(stage.getValue());
alertCalledVo.setAlertStageCode(stage.getId());
updateWrapper.set(AlertCalled::getAlertStage,stage.getValue()); updateWrapper.set(AlertCalled::getAlertStage,stage.getValue());
if(stage == DispatchPaperEnums.reportorBack || stage == DispatchPaperEnums.complainantBack) { if(stage == DispatchPaperEnums.reportorBack || stage == DispatchPaperEnums.complainantBack) {
updateWrapper.set(AlertCalled::getAlertStatus,true); updateWrapper.set(AlertCalled::getAlertStatus,true);
alertCalledVo.setAlertStatus(true);
} else if(stage == DispatchPaperEnums.repaired && alertCalledVo.getAlarmTypeCode().equals(AlertStageEnums.KRJY.getId())) { } else if(stage == DispatchPaperEnums.repaired && alertCalledVo.getAlarmTypeCode().equals(AlertStageEnums.KRJY.getId())) {
updateWrapper.set(AlertCalled::getAlertStatus,true); updateWrapper.set(AlertCalled::getAlertStatus,true);
alertCalledVo.setAlertStatus(true);
}
Boolean flag = this.update(updateWrapper);
if(flag) { //更新redis 和 es 信息
try {
redisUtils.del(RedisKey.TZS_ALERTCALLED_ID+alertCalledVo.getSequenceNbr());
} catch (Exception e) {
e.printStackTrace();
logger.error("删除redis失败:" + e.getMessage());
}
try {
eSAlertCalledService.updateEsAlertCalled(alertCalledVo);
} catch (Exception e) {
e.printStackTrace();
logger.error("更新es失败:" + e.getMessage());
}
} }
return this.update(updateWrapper); return this.update(updateWrapper);
} }
......
...@@ -278,7 +278,7 @@ public class DispatchTaskServiceImpl extends BaseService<DispatchTaskDto,Dispatc ...@@ -278,7 +278,7 @@ public class DispatchTaskServiceImpl extends BaseService<DispatchTaskDto,Dispatc
if(rescueProcessDto.getDispatchStatus() == null && rescueProcessDto.getDispatchTime() == null) { if(rescueProcessDto.getDispatchStatus() == null && rescueProcessDto.getDispatchTime() == null) {
rescueProcessDto.setDispatchStatus(true); rescueProcessDto.setDispatchStatus(true);
rescueProcessDto.setDispatchTime(dispatchTask.getDispatchTime()); rescueProcessDto.setDispatchTime(dispatchTask.getDispatchTime());
rescueProcessDto.setDispatchUserName(dispatchTask.getRecUserName()); rescueProcessDto.setDispatchUserName(sendUser.getRealName());
rescueProcessDto.setDispatchUserId(dispatchTask.getRecUserId()); rescueProcessDto.setDispatchUserId(dispatchTask.getRecUserId());
rescueProcessServiceImpl.updateByAlertId(rescueProcessDto); rescueProcessServiceImpl.updateByAlertId(rescueProcessDto);
} }
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.biz.service.impl; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
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.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
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;
...@@ -243,4 +244,32 @@ public class ESAlertCalledService { ...@@ -243,4 +244,32 @@ public class ESAlertCalledService {
return result; return result;
} }
/**
* 更新索引
*/
public ESAlertCalled updateEsAlertCalled(AlertCalledDto alertCalled) throws Exception {
esAlertCalledRepository.deleteById(alertCalled.getSequenceNbr());
ESAlertCalled esAlertCalled = new ESAlertCalled();
esAlertCalled.setSequenceNbr(alertCalled.getSequenceNbr());
esAlertCalled.setAlarmType(alertCalled.getAlarmType());
esAlertCalled.setAlarmTypeCode(alertCalled.getAlarmTypeCode());
esAlertCalled.setCallTime(alertCalled.getCallTime());
esAlertCalled.setCallTimeLong(alertCalled.getCallTime()!=null?alertCalled.getCallTime().getTime():null);
esAlertCalled.setContactPhone(alertCalled.getContactPhone());
esAlertCalled.setAddress(alertCalled.getAddress());
esAlertCalled.setAlertStage(alertCalled.getAlertStage());
esAlertCalled.setAlertStatus(alertCalled.getAlertStatus());
esAlertCalled.setEmergencyCall(alertCalled.getEmergencyCall());
esAlertCalled.setDeviceId(alertCalled.getDeviceId());
if (alertCalled.getAlertStatus())
{
esAlertCalled.setAlertStatusStr(AlertStatusEnum.CLOSED.getCode());
}else
{
esAlertCalled.setAlertStatusStr(AlertStatusEnum.UNCLOSED.getCode());
}
esAlertCalledRepository.save(esAlertCalled);
return esAlertCalled;
}
} }
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