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))));
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("添加成功");
}

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.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;
}

Loading…
Cancel
Save