diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java index e82ce79f..6e7c0f96 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java @@ -17,12 +17,14 @@ import com.zc.business.service.IDcEventService; import com.zc.business.service.IMiddleDatabaseService; import com.zc.business.utils.diff.Diff; import com.zc.business.utils.diff.model.Result; +import com.zc.common.core.httpclient.exception.HttpException; import com.zc.common.core.websocket.WebSocketService; import com.zc.common.core.websocket.constant.WebSocketEvent; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.io.IOException; import java.text.SimpleDateFormat; import java.util.*; import java.util.regex.Matcher; @@ -87,6 +89,9 @@ public class DcEventServiceImpl extends ServiceImpl impl @Autowired private DcRampMapper dcRampMapper; + @Autowired + private DcWarningServiceImpl dcWarningService; + private final String HAPPEN = UniversalEnum.TAKE_PLACE.getValue(); private final String EVENT = UniversalEnum.INCIDENT.getValue(); //private final String SUBEVENT = "0"; @@ -2017,6 +2022,23 @@ public class DcEventServiceImpl extends ServiceImpl impl dcEventProcessService.insertDcEventProcess(dcEventProcess); return AjaxResult.success(UniversalEnum.OPERATION_FAILURE.getValue()); } + + if (StringUtils.isNotEmpty(dcEvent.getStringEventSource()) && dcEvent.getStringEventSource().equals("扫码报警")){ + //扫码报警 处置记录 + HashMap warningInfo = dcWarningMapper.selectDcWarningById(eventId); + if (warningInfo != null && Objects.nonNull(warningInfo.get("warningSource")) && "5".equals(warningInfo.get("warningSource").toString())){ + com.alibaba.fastjson.JSONObject otherConfig = com.alibaba.fastjson.JSONObject.parseObject(warningInfo.get("otherConfig").toString()); + String alarmId = otherConfig.getString("id"); + if (org.apache.commons.lang3.StringUtils.isNotBlank(alarmId)) { + try { + //扫码报警接警反馈 + dcWarningService.addCodeScanningProcess(alarmId,"事件处置完成"); + } catch (IOException | HttpException e) { + e.printStackTrace(); + } + } + } + } return AjaxResult.error(UniversalEnum.SUCCESSFUL_OPERATION.getValue()); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index f63e27da..84e59f9e 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -25,6 +25,7 @@ import com.zc.business.utils.QYWXUtil; import com.zc.business.utils.StakeMarkUtils; import com.zc.common.core.httpclient.OkHttp; import com.zc.common.core.httpclient.exception.HttpException; +import com.zc.common.core.httpclient.request.RequestParams; import com.zc.common.core.websocket.WebSocketService; import com.zc.common.core.websocket.constant.WebSocketEvent; import okhttp3.Response; @@ -663,12 +664,14 @@ public class DcWarningServiceImpl implements IDcWarningService { String alarmId = otherConfig.getString("id"); if (StringUtils.isNotBlank(alarmId)) { try { - AjaxResult alarmResult = dealWarning(alarmId); - System.out.println(alarmResult); + dealWarning(alarmId); + //扫码报警接警反馈 + addCodeScanningProcess(alarmId,"济菏运管中心接警"); } catch (IOException | HttpException e) { e.printStackTrace(); } } + } return AjaxResult.success(UniversalEnum.SUCCESSFUL_OPERATION.getValue()); @@ -686,6 +689,27 @@ public class DcWarningServiceImpl implements IDcWarningService { return JSON.parseObject(response.body().string(), AjaxResult.class); } + //扫码报警 处置记录 + public AjaxResult addCodeScanningProcess(String alarmId,String content) throws IOException, HttpException { + String url = configService.selectConfigByKey("alarmCode"); + url = url + "/warning/addProcess"; + + RequestParams requestParams = new RequestParams(); + requestParams.put("warningInfoId",alarmId); + requestParams.put("processType","1"); + requestParams.put("processTitle",content); + requestParams.put("processTime",new Date()); + + OkHttp okHttp = new OkHttp(); + Response response // 请求响应 + = okHttp + .headers(new HashMap<>()) + .url(url) // 请求地址 + .data(requestParams) + .post(); // 请求方法 + return JSON.parseObject(response.body().string(), AjaxResult.class); + } + @Override public int deleteDcWarningByStringId(DcWarning dcWarning) { return dcWarningMapper.deleteDcWarningByStringId(dcWarning); @@ -1013,6 +1037,21 @@ public class DcWarningServiceImpl implements IDcWarningService { } qywxUtil.sendMessageByWxUserId(wxUserIds,message); + //扫码报警 处置记录 + HashMap warningInfo = dcWarningMapper.selectDcWarningById(eventId); + if (warningInfo != null && Objects.nonNull(warningInfo.get("warningSource")) && "5".equals(warningInfo.get("warningSource").toString())){ + com.alibaba.fastjson.JSONObject otherConfig = com.alibaba.fastjson.JSONObject.parseObject(warningInfo.get("otherConfig").toString()); + String alarmId = otherConfig.getString("id"); + if (StringUtils.isNotBlank(alarmId)) { + try { + //扫码报警接警反馈 + addCodeScanningProcess(alarmId,"调度路管人员现场处置"); + } catch (IOException | HttpException e) { + e.printStackTrace(); + } + } + } + return AjaxResult.success(); } @@ -1150,6 +1189,21 @@ public class DcWarningServiceImpl implements IDcWarningService { map.put("eventId",dcDispatchEventId.getEventId()); sendQYWXMessage(map); + //扫码报警 处置记录 + HashMap warningInfo = dcWarningMapper.selectDcWarningById(dcDispatchEventId.getEventId()); + if (warningInfo != null && Objects.nonNull(warningInfo.get("warningSource")) && "5".equals(warningInfo.get("warningSource").toString())){ + com.alibaba.fastjson.JSONObject otherConfig = com.alibaba.fastjson.JSONObject.parseObject(warningInfo.get("otherConfig").toString()); + String alarmId = otherConfig.getString("id"); + if (StringUtils.isNotBlank(alarmId)) { + try { + //扫码报警接警反馈 + addCodeScanningProcess(alarmId,"调度路管人员现场处置"); + } catch (IOException | HttpException e) { + e.printStackTrace(); + } + } + } + return UniversalEnum.ONE.getNumber(); }