From ea6649b5798eb33abf741a94c08a735b5e3fc86a Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Thu, 22 Aug 2024 11:12:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=AB=E7=A0=81=E6=8A=A5=E8=AD=A6=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CodeScanningAlarmController.java | 28 +++++++++---------- .../service/impl/DcWarningServiceImpl.java | 23 +++++++++++++++ 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java b/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java index 1a82888b..c1074bce 100644 --- a/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java +++ b/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java @@ -143,22 +143,20 @@ public class CodeScanningAlarmController extends BaseController { dcWarning.setOtherConfig(String.valueOf(JSONObject.parseObject(JSONObject.toJSONString(otherConfig)))); dcWarningService.updateDcWarning(dcWarning); - String warningState = oldData.get("warningState").toString(); - if (warningState.equals("2")){ - DcEventProcess dcEventProcess = new DcEventProcess(); - dcEventProcess.setEventId(oldData.get("id").toString()); - dcEventProcess.setSource(2); - if (type.equals("video")){ - dcEventProcess.setType("mp4"); - } else { - dcEventProcess.setType("png"); - } - dcEventProcess.setContext(url); - dcEventProcess.setOperatorName("上报人"); - dcEventProcess.setOperationTime(new Date()); - dcEventProcessMapper.insertDcEventProcess(dcEventProcess); - + DcEventProcess dcEventProcess = new DcEventProcess(); + dcEventProcess.setEventId(oldData.get("id").toString()); + dcEventProcess.setSource(2); + if (type.equals("video")){ + dcEventProcess.setType("mp4"); + } else { + dcEventProcess.setType("png"); } + dcEventProcess.setContext(url); + dcEventProcess.setOperatorName("上报人"); + dcEventProcess.setOperationTime(new Date()); + dcEventProcessMapper.insertDcEventProcess(dcEventProcess); + + return AjaxResult.success("添加成功"); } 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 3d8b547e..327f7170 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 @@ -18,6 +18,7 @@ import com.zc.business.enums.UniversalEnum; import com.zc.business.enums.ValueConverter; import com.zc.business.enums.WarningSubclassEnum; import com.zc.business.mapper.DcEventMapper; +import com.zc.business.mapper.DcEventProcessMapper; import com.zc.business.mapper.DcProcessConfigMapper; import com.zc.business.mapper.DcWarningMapper; import com.zc.business.service.IDcEventService; @@ -67,6 +68,8 @@ public class DcWarningServiceImpl implements IDcWarningService { @Autowired private DcEventProcessServiceImpl dcEventProcessService; @Autowired + private DcEventProcessMapper dcEventProcessMapper; + @Autowired private IDcTrafficPoliceService dcTrafficPoliceService; @Autowired private DcProcessConfigMapper dcProcessConfigMapper; @@ -272,6 +275,26 @@ public class DcWarningServiceImpl implements IDcWarningService { } //事件推送至 Websocket int i = dcWarningMapper.insertDcWarning(dcWarning);//如果没有配置策略直接加入数据库; + + //扫码报警提前插入处置记录 + if (dcWarning.getWarningSource() == 5){ + DcEventProcess dcEventProcess = new DcEventProcess(); + dcEventProcess.setEventId(uuid); + dcEventProcess.setSource(2); + JSONObject otherConfig = new JSONObject(dcWarning.getOtherConfig()); + String phone = otherConfig.getString("phone"); + + String direction = "1".equals(dcWarning.getDirection()) ? "菏泽方向" : "济南方向"; + String typeName = ValueConverter.eventTypeName(dcWarning.getWarningType().toString()); + + String context = dcWarning.getStakeMark() + direction + "," + phone + "上报了一起" + typeName + "事件"; + dcEventProcess.setContext(context); + dcEventProcess.setOperatorName("上报人"); + dcEventProcess.setOperationTime(new Date()); + dcEventProcessMapper.insertDcEventProcess(dcEventProcess); + + } + extracted(dcWarning); return i; }