Browse Source

扫码报警事件对接

develop
lau572 3 months ago
parent
commit
ea6649b579
  1. 28
      zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java
  2. 23
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

28
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)))); dcWarning.setOtherConfig(String.valueOf(JSONObject.parseObject(JSONObject.toJSONString(otherConfig))));
dcWarningService.updateDcWarning(dcWarning); dcWarningService.updateDcWarning(dcWarning);
String warningState = oldData.get("warningState").toString(); DcEventProcess dcEventProcess = new DcEventProcess();
if (warningState.equals("2")){ dcEventProcess.setEventId(oldData.get("id").toString());
DcEventProcess dcEventProcess = new DcEventProcess(); dcEventProcess.setSource(2);
dcEventProcess.setEventId(oldData.get("id").toString()); if (type.equals("video")){
dcEventProcess.setSource(2); dcEventProcess.setType("mp4");
if (type.equals("video")){ } else {
dcEventProcess.setType("mp4"); dcEventProcess.setType("png");
} else {
dcEventProcess.setType("png");
}
dcEventProcess.setContext(url);
dcEventProcess.setOperatorName("上报人");
dcEventProcess.setOperationTime(new Date());
dcEventProcessMapper.insertDcEventProcess(dcEventProcess);
} }
dcEventProcess.setContext(url);
dcEventProcess.setOperatorName("上报人");
dcEventProcess.setOperationTime(new Date());
dcEventProcessMapper.insertDcEventProcess(dcEventProcess);
return AjaxResult.success("添加成功"); return AjaxResult.success("添加成功");
} }

23
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.ValueConverter;
import com.zc.business.enums.WarningSubclassEnum; import com.zc.business.enums.WarningSubclassEnum;
import com.zc.business.mapper.DcEventMapper; import com.zc.business.mapper.DcEventMapper;
import com.zc.business.mapper.DcEventProcessMapper;
import com.zc.business.mapper.DcProcessConfigMapper; import com.zc.business.mapper.DcProcessConfigMapper;
import com.zc.business.mapper.DcWarningMapper; import com.zc.business.mapper.DcWarningMapper;
import com.zc.business.service.IDcEventService; import com.zc.business.service.IDcEventService;
@ -67,6 +68,8 @@ public class DcWarningServiceImpl implements IDcWarningService {
@Autowired @Autowired
private DcEventProcessServiceImpl dcEventProcessService; private DcEventProcessServiceImpl dcEventProcessService;
@Autowired @Autowired
private DcEventProcessMapper dcEventProcessMapper;
@Autowired
private IDcTrafficPoliceService dcTrafficPoliceService; private IDcTrafficPoliceService dcTrafficPoliceService;
@Autowired @Autowired
private DcProcessConfigMapper dcProcessConfigMapper; private DcProcessConfigMapper dcProcessConfigMapper;
@ -272,6 +275,26 @@ public class DcWarningServiceImpl implements IDcWarningService {
} }
//事件推送至 Websocket //事件推送至 Websocket
int i = dcWarningMapper.insertDcWarning(dcWarning);//如果没有配置策略直接加入数据库; 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); extracted(dcWarning);
return i; return i;
} }

Loading…
Cancel
Save