|
|
@ -1,8 +1,8 @@ |
|
|
|
package com.zc.business.controller; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.ruoyi.common.core.controller.BaseController; |
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
|
import com.ruoyi.common.utils.uuid.IdUtils; |
|
|
|
import com.zc.business.domain.DcWarning; |
|
|
|
import com.zc.business.service.IDcWarningService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
@ -36,49 +36,53 @@ public class CodeScanningAlarmController extends BaseController { |
|
|
|
*/ |
|
|
|
@PostMapping(value = "/event") |
|
|
|
public AjaxResult codeScanningAlarmControllerEvent(@RequestBody Map<String, Object> returnParameters) { |
|
|
|
String id = String.valueOf(returnParameters.get("id")); |
|
|
|
DcWarning dcWarning = new DcWarning(); |
|
|
|
//设置事件Id UUID无下划线格式32
|
|
|
|
String uuid = IdUtils.fastSimpleUUID(); |
|
|
|
dcWarning.setId(uuid); |
|
|
|
dcWarning.setStakeMark(String.valueOf(returnParameters.get("stakeNum"))); |
|
|
|
String roadCode = String.valueOf(returnParameters.get("roadCode")); |
|
|
|
dcWarning.setDirection(Objects.equals(roadCode, "1") ? "3" : "1"); |
|
|
|
String createTime = String.valueOf(returnParameters.get("createTime")); |
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmXXX"); |
|
|
|
try { |
|
|
|
dcWarning.setWarningTime(format.parse(createTime)); |
|
|
|
} catch (ParseException e) { |
|
|
|
dcWarning.setWarningTime(new Date()); |
|
|
|
dcWarning.setId(id); |
|
|
|
dcWarning.setOtherConfig(String.valueOf(JSONObject.parseObject(JSONObject.toJSONString(returnParameters)))); |
|
|
|
if (dcWarningService.selectDcWarningById(id) == null) { |
|
|
|
dcWarning.setStakeMark(String.valueOf(returnParameters.get("stakeNum"))); |
|
|
|
String roadCode = String.valueOf(returnParameters.get("roadCode")); |
|
|
|
dcWarning.setDirection(Objects.equals(roadCode, "1") ? "3" : "1"); |
|
|
|
String createTime = String.valueOf(returnParameters.get("createTime")); |
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmXXX"); |
|
|
|
try { |
|
|
|
dcWarning.setWarningTime(format.parse(createTime)); |
|
|
|
} catch (ParseException e) { |
|
|
|
dcWarning.setWarningTime(new Date()); |
|
|
|
} |
|
|
|
dcWarning.setCreateTime(new Date()); |
|
|
|
String accidentType = String.valueOf(returnParameters.get("accidentType")); |
|
|
|
switch (accidentType) { |
|
|
|
case "1"://车辆炸胎(无备胎)
|
|
|
|
dcWarning.setWarningType(11); |
|
|
|
dcWarning.setWarningSubclass("11-3"); |
|
|
|
break; |
|
|
|
case "2"://车辆炸胎(有备胎)
|
|
|
|
dcWarning.setWarningType(11); |
|
|
|
dcWarning.setWarningSubclass("11-2"); |
|
|
|
break; |
|
|
|
case "3"://车辆抛锚
|
|
|
|
dcWarning.setWarningType(11); |
|
|
|
dcWarning.setWarningSubclass("11-1"); |
|
|
|
break; |
|
|
|
case "4"://单车事故
|
|
|
|
dcWarning.setWarningType(10); |
|
|
|
dcWarning.setWarningSubclass("10-2"); |
|
|
|
break; |
|
|
|
case "5"://多车事故
|
|
|
|
dcWarning.setWarningType(10); |
|
|
|
dcWarning.setWarningSubclass("10-3"); |
|
|
|
break; |
|
|
|
} |
|
|
|
String warningTitle = "济荷高速:" + (Objects.equals(roadCode, "1") ? "济南方向" : "菏泽方向") + "发生" + (Integer.parseInt(accidentType) >= 4 ? "交通事故事件" : "车辆故障事件"); |
|
|
|
dcWarning.setWarningTitle(warningTitle); |
|
|
|
dcWarning.setWarningSource(5); |
|
|
|
dcWarning.setWarningState(1); |
|
|
|
return AjaxResult.success(dcWarningService.insertDcWarning(dcWarning)); |
|
|
|
} else { |
|
|
|
return AjaxResult.success(dcWarningService.updateDcWarning(dcWarning)); |
|
|
|
} |
|
|
|
dcWarning.setCreateTime(new Date()); |
|
|
|
String accidentType = String.valueOf(returnParameters.get("accidentType")); |
|
|
|
switch (accidentType) { |
|
|
|
case "1"://车辆炸胎(无备胎)
|
|
|
|
dcWarning.setWarningType(11); |
|
|
|
dcWarning.setWarningSubclass("11-3"); |
|
|
|
break; |
|
|
|
case "2"://车辆炸胎(有备胎)
|
|
|
|
dcWarning.setWarningType(11); |
|
|
|
dcWarning.setWarningSubclass("11-2"); |
|
|
|
break; |
|
|
|
case "3"://车辆抛锚
|
|
|
|
dcWarning.setWarningType(11); |
|
|
|
dcWarning.setWarningSubclass("11-1"); |
|
|
|
break; |
|
|
|
case "4"://单车事故
|
|
|
|
dcWarning.setWarningType(10); |
|
|
|
dcWarning.setWarningSubclass("10-2"); |
|
|
|
break; |
|
|
|
case "5"://多车事故
|
|
|
|
dcWarning.setWarningType(10); |
|
|
|
dcWarning.setWarningSubclass("10-3"); |
|
|
|
break; |
|
|
|
} |
|
|
|
String warningTitle = "济荷高速:" + (Objects.equals(roadCode, "1") ? "济南方向" : "菏泽方向") + "发生" + (Integer.parseInt(accidentType) >= 4 ? "交通事故事件" : "车辆故障事件"); |
|
|
|
dcWarning.setWarningTitle(warningTitle); |
|
|
|
dcWarning.setOtherConfig(returnParameters.toString()); |
|
|
|
dcWarning.setWarningSource(5); |
|
|
|
dcWarning.setWarningState(1); |
|
|
|
return AjaxResult.success(dcWarningService.insertDcWarning(dcWarning)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|