Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
wangsixiang 1 year ago
parent
commit
735b32b9df
  1. 90
      zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java
  2. 51
      zc-business/src/main/java/com/zc/business/controller/VideoController.java
  3. 82
      zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java
  4. 6
      zc-business/src/main/java/com/zc/business/domain/DcEmergencyPlans.java
  5. 42
      zc-business/src/main/java/com/zc/business/enums/DeviceTypeEnum.java
  6. 24
      zc-business/src/main/java/com/zc/business/enums/WarningSubclassEnum.java
  7. 18
      zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java
  8. 18
      zc-business/src/main/java/com/zc/business/service/IDcWarningService.java
  9. 55
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java
  10. 66
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  11. 169
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java
  12. 10
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml
  13. 4
      zc-business/src/main/resources/mapper/business/StatusMapper.xml

90
zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java

@ -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));
}
}

51
zc-business/src/main/java/com/zc/business/controller/VideoController.java

@ -26,8 +26,10 @@ import javax.annotation.Resource;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.ruoyi.common.constant.Constants.HTTP;
import static java.util.Comparator.comparing;
/**
@ -312,6 +314,55 @@ public class VideoController extends BaseController {
return AjaxResult.success(resultList);
}
/**
* 根据桩号查询上下行相机
*/
@ApiOperation("根据桩号查询上下行相机")
@GetMapping(value = "/nearCamPileNum")
public Object nearCamPileNum(@ApiParam(value = "桩号", name = "pileNum", required = true) String pileNum) throws HttpException, IOException {
// 获取济菏运管中心相机信息
JSONObject camInfo = getCamByDept("1301730");
if (!camInfo.containsKey("data")) {
return camInfo;
}
List<Map<String,Object>> datalist = (List<Map<String, Object>>) camInfo.get("data");
Integer pileNumDistance = pileNumTransformMetre(pileNum);
Map<String,Object> result = new HashMap<>();
//上行列表
List<Map<String,Object>> upCameraList = datalist.stream()
.filter(item -> "0".equals(item.get("camOrientation")))
.map(item->{
item.put("pileNumDistance",pileNumTransformMetre(item.get("pileNum").toString()));
return item;
})
.sorted(comparing(item -> Math.abs(Integer.parseInt(item.get("pileNumDistance").toString()) - pileNumDistance)))
.collect(Collectors.toList());
if (upCameraList.size() > 0){
result.put("upCamera",upCameraList.get(0));
}
//下行列表
List<Map<String,Object>> downCameraList = datalist.stream()
.filter(item -> "1".equals(item.get("camOrientation")))
.map(item->{
item.put("pileNumDistance",pileNumTransformMetre(item.get("pileNum").toString()));
return item;
})
.sorted(comparing(item -> Math.abs(Integer.parseInt(item.get("pileNumDistance").toString()) - pileNumDistance)))
.collect(Collectors.toList());
if (downCameraList.size() > 0){
result.put("downCamera",downCameraList.get(0));
}
return AjaxResult.success(result);
}
/**
* 获取视频流信息
*/

82
zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java

@ -8,7 +8,6 @@ import com.ruoyi.common.core.redis.RedisCache;
import com.zc.business.domain.DcRegion;
import com.zc.business.service.impl.DcRegionServiceImpl;
import com.zc.common.core.httpclient.OkHttp;
import com.zc.common.core.httpclient.exception.HttpException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import okhttp3.Response;
@ -17,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -53,7 +51,7 @@ public class WeatherForecastController extends BaseController {
* */
@ApiOperation("天气实况查询")
@PostMapping(value = "/weatherFacts")
public AjaxResult weatherFacts() throws HttpException, IOException {
public AjaxResult weatherFacts() {
return getAjaxResult(WEATHERFACTSURI, WEATHERFACTSKEY, WEATHERFACTS);
}
@ -62,7 +60,7 @@ public class WeatherForecastController extends BaseController {
* */
@ApiOperation("气象预警查询")
@PostMapping(value = "/meteorologicalEarlyWarning")
public AjaxResult meteorologicalEarlyWarning() throws HttpException, IOException {
public AjaxResult meteorologicalEarlyWarning() {
return getAjaxResult(METEOROLOGICALEARLYWARNINGURI, METEOROLOGICALEARLYWARNINGKEY, METEOROLOGICALEARLYWARNING);
}
@ -71,7 +69,7 @@ public class WeatherForecastController extends BaseController {
* */
@ApiOperation("气象预警数量查询")
@PostMapping(value = "/queryTheNumberOfMeteorologicalWarning")
public AjaxResult queryTheNumberOfMeteorologicalWarning() throws HttpException, IOException {
public AjaxResult queryTheNumberOfMeteorologicalWarning() {
JSONObject jsonObject = new JSONObject();
JSONObject cacheObject = redisCache.getCacheObject(METEOROLOGICALEARLYWARNING);
@ -84,24 +82,28 @@ public class WeatherForecastController extends BaseController {
for (DcRegion dcRegion : list) {
OkHttp okHttp = new OkHttp();
try {
OkHttp okHttp = new OkHttp();
Response response // 请求响应
= okHttp
.headers(new HashMap<>())
.url(METEOROLOGICALEARLYWARNINGURI + dcRegion.getLongitude() + "," + dcRegion.getLatitude() + KEY + METEOROLOGICALEARLYWARNINGKEY) // 请求地址
.get(); // 请求方法
Response response // 请求响应
= okHttp
.headers(new HashMap<>())
.url(METEOROLOGICALEARLYWARNINGURI + dcRegion.getLongitude() + "," + dcRegion.getLatitude() + KEY + METEOROLOGICALEARLYWARNINGKEY) // 请求地址
.get(); // 请求方法
if (response.body() != null) {
if (response.body() != null) {
JSONObject jsonResult = JSONObject.parseObject(response.body().string());
if (jsonResult.getInteger("code") == 200) {
JSONObject jsonResult = JSONObject.parseObject(response.body().string());
if (jsonResult.getInteger("code") == 200) {
jsonObject.put(METEOROLOGICALEARLYWARNING + dcRegion.getId(), extracted(jsonResult, "warning"));
jsonObject.put(METEOROLOGICALEARLYWARNING + dcRegion.getId(), extracted(jsonResult, "warning"));
} else {
return AjaxResult.error(jsonResult.getInteger("code"), "请求失败");
} else {
return AjaxResult.error(jsonResult.getInteger("code"), "请求失败");
}
}
} catch (Exception e) {
return AjaxResult.error(500, "连接异常,请检查网络");
}
}
}
@ -131,11 +133,11 @@ public class WeatherForecastController extends BaseController {
* */
@ApiOperation("逐小时天气查询")
@PostMapping(value = "/hourlyWeather")
public AjaxResult hourlyWeather() throws HttpException, IOException {
public AjaxResult hourlyWeather() {
return getAjaxResult(HOURLYWEATHERURI, HOURLYWEATHERKEY, HOURLYWEATHER);
}
private AjaxResult getAjaxResult(String uri, String accessKey, String redisKey) throws HttpException, IOException {
private AjaxResult getAjaxResult(String uri, String accessKey, String redisKey) {
JSONObject cacheObject = redisCache.getCacheObject(redisKey);
@ -150,34 +152,42 @@ public class WeatherForecastController extends BaseController {
JSONObject jsonObject = new JSONObject();
for (DcRegion dcRegion : list) {
OkHttp okHttp = new OkHttp();
Response response // 请求响应
= okHttp
.headers(new HashMap<>())
.url(uri + dcRegion.getLongitude() + "," + dcRegion.getLatitude() + KEY + accessKey) // 请求地址
.get(); // 请求方法
try {
OkHttp okHttp = new OkHttp();
Response response // 请求响应
= okHttp
.headers(new HashMap<>())
.url(uri + dcRegion.getLongitude() + "," + dcRegion.getLatitude() + KEY + accessKey) // 请求地址
.get(); // 请求方法
if (response.body() != null) {
if (response.body() != null) {
JSONObject jsonResult = JSONObject.parseObject(response.body().string());
if (jsonResult.getInteger("code") == 200) {
JSONObject jsonResult = JSONObject.parseObject(response.body().string());
if (jsonResult.getInteger("code") == 200) {
if (Objects.equals(redisKey, WEATHERFACTS)) {
if (Objects.equals(redisKey, WEATHERFACTS)) {
jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "now"));
jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "now"));
} else if (Objects.equals(redisKey, METEOROLOGICALEARLYWARNING)) {
} else if (Objects.equals(redisKey, METEOROLOGICALEARLYWARNING)) {
jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "warning"));
jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "warning"));
} else if (Objects.equals(redisKey, HOURLYWEATHER)) {
} else if (Objects.equals(redisKey, HOURLYWEATHER)) {
jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "hourly"));
jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "hourly"));
}
} else {
return AjaxResult.error(jsonResult.getInteger("code"), "请求失败");
}
} else {
return AjaxResult.error(jsonResult.getInteger("code"), "请求失败");
}
} catch (Exception e) {
return AjaxResult.error(500, "连接异常,请检查网络");
}
}

6
zc-business/src/main/java/com/zc/business/domain/DcEmergencyPlans.java

@ -69,6 +69,12 @@ public class DcEmergencyPlans {
@ApiModelProperty("可控设备")
private String controllableDevice;
/**
* 可控设备名称
*/
@ApiModelProperty("可控设备名称")
private String controllableDeviceName;
/**
* 控制指令
*/

42
zc-business/src/main/java/com/zc/business/enums/DeviceTypeEnum.java

@ -0,0 +1,42 @@
package com.zc.business.enums;
/**
* 设备类型
* @author wangjiabao
*/
public enum DeviceTypeEnum {
CAMERA(1, "摄像机"),
VARIABLE_INFORMATION_FLAG(2, "可变信息标志"),
METEOROLOGICAL_DETECTOR(3, "气象检测器"),
EXPORT_INDUCTION_LIGHT(4, "出口诱导灯"),
ROAD_SECTION_VOICE_BROADCASTING(5, "路段语音广播"),
COLLISION_OF_GUARDRAILS(6, "护栏碰撞"),
MILLIMETER_WAVE_RADAR(7, "毫米波雷达"),
CONFLUENCE_AREA_WARNING(8, "合流区预警"),
SMART_CONE_BUCKET(9, "智慧锥桶"),
LASER_FATIGUE_AWAKENING(10, "激光疲劳唤醒"),
CLASS_I_COMMUNICATION_STATION(11, "一类交流站"),
DRIVING_GUIDANCE(12, "行车诱导"),
SMART_DEVICE_BOX(13, "智能设备箱"),
ONLINE_MONITORING_OF_LIGHT(14, "光线在线监测");
private final int code;
private final String info;
DeviceTypeEnum(int code, String info)
{
this.code = code;
this.info = info;
}
public int getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

24
zc-business/src/main/java/com/zc/business/enums/WarningSubclassEnum.java

@ -27,9 +27,20 @@ public enum WarningSubclassEnum {
EMERGENCY_LANE_BLOCKED("4-7", "应急车道被占用", "发生"),
VEHICLE_EXIT_EMERGENCY_LANE("4-8", "车离开应急车道", "发生"),
OTHER_CONDITION("4-9", "其他", "发生停车"),
OTHER_UNKNOWN("4-10", "未知车俩", "发生停车"),
REVERSING_OR_GOING_BACKWARDS("5-1", "倒车/逆行", "发生"),
FIREWORKS("6-1", "烟火", "发生"),
DEBRIS_ON_ROAD("7-1", "撒落物", "发生撒落物"),
LINEBALL("5-2", "压线", "发生压线"),
TURNROUND("5-3", "掉头", "发生掉头"),
SPEED("5-4", "超速", "发生超速"),
LOW_SPEED("5-5", "低速", "发生低速"),
ILLEGALLANECHANGE("5-5", "违规变道", "发生违规变道"),
FAILURE_TO_MAINTAIN_A_SAFE_DISTANCE("5-5", "未保持安全距离", "发生未保持安全距离"),
FIREWORKS("6-1", "烟火", "发生烟火"),
FIRE_HAZARD("6-2", "火灾", "发生火灾"),
STUMBLING_BLOCK("6-3", "障碍物", "发生障碍物"),
SPILL("6-4", "抛洒物", "发生抛洒物"),
DEBRIS_ON_ROAD("7-1", "道路施工", "发生道路施工"),
RAIN("8-1", "雨", "发生异常天气"),
HAIL("8-2", "冰雹", "发生异常天气"),
WIND("8-3", "风", "发生异常天气"),
@ -42,7 +53,14 @@ public enum WarningSubclassEnum {
ROAD_FOG("8-10", "道路团雾", "发生异常天气"),
COLLISION_ONLY("9-1", "只碰撞不倾斜", "发生护栏碰撞"),
TILTED_WITHOUT_COLLISION("9-1", "只倾斜无碰撞", "发生护栏碰撞"),
COLLISION_AND_TILTED("9-3", "碰撞后倾斜", "发生护栏碰撞");
COLLISION_AND_TILTED("9-3", "碰撞后倾斜", "发生护栏碰撞"),
UNKNOWN("10-1", "未知", "发生未知交通事故"),
SINGLE_VEHICLE_ACCIDENT("10-2", "单车事故", "发生单车事故"),
MULTIPLE_VEHICLE_ACCIDENT("10-3", "多车事故", "发生多车事故"),
VEHICLE_DROPANCHOR("11-1", "车辆抛锚", "发生车辆抛锚"),
RESTS("99-1", "其他", "发生其他事故");
@Getter
private final String code;
@Getter

18
zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java

@ -7,23 +7,23 @@ import org.apache.ibatis.annotations.Param;
/**
* 预警信息Mapper接口
*
*
* @author ruoyi
* @date 2024-01-26
*/
public interface DcWarningMapper
public interface DcWarningMapper
{
/**
* 查询预警信息
*
*
* @param id 预警信息主键
* @return 预警信息
*/
public HashMap<String,Object> selectDcWarningById(Integer id);
public DcWarning selectDcWarningById(String id);
/**
* 查询预警信息列表
*
*
* @param dcWarning 预警信息
* @return 预警信息集合
*/
@ -32,7 +32,7 @@ public interface DcWarningMapper
List<DcWarning> export(DcWarning dcWarning);
/**
* 新增预警信息
*
*
* @param dcWarning 预警信息
* @return 结果
*/
@ -40,7 +40,7 @@ public interface DcWarningMapper
/**
* 修改预警信息
*
*
* @param dcWarning 预警信息
* @return 结果
*/
@ -48,7 +48,7 @@ public interface DcWarningMapper
/**
* 删除预警信息
*
*
* @param id 预警信息主键
* @return 结果
*/
@ -56,7 +56,7 @@ public interface DcWarningMapper
/**
* 批量删除预警信息
*
*
* @param id 需要删除的数据主键集合
* @return 结果
*/

18
zc-business/src/main/java/com/zc/business/service/IDcWarningService.java

@ -10,23 +10,23 @@ import org.springframework.web.bind.annotation.RequestBody;
/**
* 预警信息Service接口
*
*
* @author ruoyi
* @date 2024-01-26
*/
public interface IDcWarningService
public interface IDcWarningService
{
/**
* 查询预警信息
*
*
* @param id 预警信息主键
* @return 预警信息
*/
public HashMap<String,Object> selectDcWarningById(Integer id);
public DcWarning selectDcWarningById(String id);
/**
* 查询预警信息列表
*
*
* @param dcWarning 预警信息
* @return 预警信息集合
*/
@ -35,7 +35,7 @@ public interface IDcWarningService
List<DcWarning> export(DcWarning dcWarning);
/**
* 新增预警信息
*
*
* @param dcWarning 预警信息
* @return 结果
*/
@ -43,7 +43,7 @@ public interface IDcWarningService
/**
* 修改预警信息
*
*
* @param dcWarning 预警信息
* @return 结果
*/
@ -51,7 +51,7 @@ public interface IDcWarningService
/**
* 批量删除预警信息
*
*
* @param id 需要删除的预警信息主键集合
* @return 结果
*/
@ -59,7 +59,7 @@ public interface IDcWarningService
/**
* 删除预警信息信息
*
*
* @param id 预警信息主键
* @return 结果
*/

55
zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

@ -61,7 +61,20 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
*/
@Override
public List<DcEmergencyPlans> selectDcEmergencyPlansList(DcEmergencyPlans dcEmergencyPlans) {
return dcEmergencyPlansMapper.selectDcEmergencyPlansList(dcEmergencyPlans);
List<DcEmergencyPlans> dcEmergencyPlansList = dcEmergencyPlansMapper.selectDcEmergencyPlansList(dcEmergencyPlans);
dcEmergencyPlansList.stream()
.filter(dcEmergencyPlans1 -> StringUtils.isNotEmpty(dcEmergencyPlans1.getControllableDevice()))
.forEach(dcEmergencyPlans1 -> {
List<String> deviceIds = Arrays.asList(dcEmergencyPlans1.getControllableDevice().split(","));
List<DcDevice> deviceList = dcDeviceService.listByIds(deviceIds);
StringBuilder stringBuilder = new StringBuilder();
deviceList.forEach(dcDevice -> {
stringBuilder.append(",");
stringBuilder.append(dcDevice.getDeviceName());
});
dcEmergencyPlans1.setControllableDeviceName(stringBuilder.toString().replaceFirst(",",""));
});
return dcEmergencyPlansList;
}
/**
@ -607,16 +620,13 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
String controlModel = otherConfig.get("controlModel").toString();
props.put("onWorkStatus", otherConfig.get("state").toString());
props.put("inWorkStatus", otherConfig.get("state").toString());
if (controlModel.equals("1")) {
props.put("mode", "00");
} else if (controlModel.equals("2")) {
props.put("mode", controlModel);
if (controlModel.equals("01")) {
String startTime = otherConfig.get("startTime").toString();
String endTime = otherConfig.get("endTime").toString();
props.put("mode", "01");
props.put("startDisplayTime", startTime);
props.put("endDisplayTime", endTime);
} else {
props.put("mode", "02");
}
AjaxResult ajaxResult = dcDeviceController.invokedFunction(iotDeviceId, functionId, props);
@ -880,7 +890,13 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
// 设备类型 数据处理
String deviceType = dcExecuteActionOperationList.stream()
.map(DcExecuteAction::getDeviceType)
.map(String::valueOf)
.distinct()
.map(type -> Arrays.stream(DeviceTypeEnum.values())
.filter(deviceTypeEnum -> deviceTypeEnum.getCode() == type)
.findFirst()
.map(DeviceTypeEnum::getInfo)
.orElse("类型异常")
)
.collect(Collectors.joining(","));
dcEmergencyPlans.setDeviceType(deviceType);
// 可控设备 数据处理
@ -893,7 +909,30 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
dcEmergencyPlans.setControllableDevice(controllableDevice);
// 控制指令 数据处理
List<String> otherConfigList = dcExecuteActionOperationList.stream()
.map(DcExecuteAction::getOtherConfig)
.map(dcExecuteAction -> {
JSONObject config = new JSONObject();
String otherConfig = dcExecuteAction.getOtherConfig();
JSONObject jsonObject = JSON.parseObject(otherConfig);
if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.DRIVING_GUIDANCE) {
// 行车诱导
config.put("controlModelName",jsonObject.get("controlModelName"));
config.put("name",jsonObject.get("name"));
if (jsonObject.get("controlModel").toString().equals("01")) {
config.put("time",jsonObject.get("startTime").toString() +"-"+jsonObject.get("endTime").toString());
}
}else if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.VARIABLE_INFORMATION_FLAG ||
dcExecuteAction.getDeviceType() == DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING) {
// 情报板/语音广播
config.put("content",jsonObject.get("content"));
}
else if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.LASER_FATIGUE_AWAKENING) {
// 激光疲劳唤醒
config.put("name",jsonObject.get("name"));
config.put("operationDuration",jsonObject.get("operationDuration")+"分钟");
}
return JSON.toJSONString(config);
})
.collect(Collectors.toList());
List<String> otherConfigStringList = otherConfigList.stream()

66
zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

@ -367,6 +367,72 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
for (DcEvent dcEvent : dcEventList) {
MdEvent mdEvent = new MdEvent(dcEvent);
mdEventList.add(mdEvent);
int eventType = Math.toIntExact(dcEvent.getEventType());
switch (eventType) {
//交通事故
case 1:
if (dcEvent.getDcEventAccident() != null) {
dcEventAccidentMapper.insertDcEventAccident(dcEvent.getDcEventAccident());
}
break;
//车辆事故
case 2:
if (dcEvent.getDcEventVehicleAccident() != null) {
dcEventVehicleAccidentMapper.insertDcEventVehicleAccident(dcEvent.getDcEventVehicleAccident());
}
break;
//交通管制
case 3:
if (dcEvent.getDcEventTrafficControl() != null) {
dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
}
break;
//交通拥堵
case 4:
if (dcEvent.getDcEventTrafficCongestion() != null) {
dcEventTrafficCongestionMapper.insertDcEventTrafficCongestion(dcEvent.getDcEventTrafficCongestion());
}
break;
//非法上路
case 5:
break;
//路障清除
case 6:
break;
//施工建设
case 7:
if (dcEvent.getDcEventConstruction() != null) {
dcEventConstructionMapper.insertDcEventConstruction(dcEvent.getDcEventConstruction());
}
break;
//服务区异常
case 8:
if (dcEvent.getDcEventServiceArea() != null) {
dcEventServiceAreaMapper.insertDcEventServiceArea(dcEvent.getDcEventServiceArea());
}
break;
//设施设备隐患
case 9:
break;
//异常天气
case 10:
if (dcEvent.getDcEventAbnormalWeather() != null) {
dcEventAbnormalWeatherMapper.insertDcEventAbnormalWeather(dcEvent.getDcEventAbnormalWeather());
}
break;
//其他事件
case 11:
break;
//
default:
break;
}
}
middleDatabaseService.batchInsertMiddleDatabaseEvent(mdEventList);
}

169
zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

@ -1,12 +1,11 @@
package com.zc.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.zc.business.domain.DcEvent;
import com.zc.business.domain.DcWarning;
import com.zc.business.domain.DcWarningBatchConvert;
import com.zc.business.domain.*;
import com.zc.business.enums.ValueConverter;
import com.zc.business.mapper.DcEventMapper;
import com.zc.business.mapper.DcWarningMapper;
@ -18,6 +17,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
@ -44,7 +44,7 @@ public class DcWarningServiceImpl implements IDcWarningService
* @return 预警信息
*/
@Override
public HashMap<String, Object> selectDcWarningById(Integer id)
public DcWarning selectDcWarningById(String id)
{
return dcWarningMapper.selectDcWarningById(id);
}
@ -76,9 +76,11 @@ public class DcWarningServiceImpl implements IDcWarningService
public int insertDcWarning(DcWarning dcWarning)
{
dcWarning.setCreateTime(DateUtils.getNowDate());
//设置事件Id UUID无下划线格式32
String uuid = IdUtils.fastSimpleUUID();
dcWarning.setId(uuid);
if (dcWarning.getId()==null) {
//设置事件Id UUID无下划线格式32
String uuid = IdUtils.fastSimpleUUID();
dcWarning.setId(uuid);
}
return dcWarningMapper.insertDcWarning(dcWarning);
}
@ -201,7 +203,7 @@ public class DcWarningServiceImpl implements IDcWarningService
if ("0".equals(dcWarningBatchConvert.getType())){
dcWarningMapper.batchDelete(dcWarningList);
} else {
//确认,批量转换为事件
//确认,批量转换为事件
List<DcEvent> dcEventList = new ArrayList<>();
for (DcWarning dcWarning : dcWarningList) {
if (dcWarning == null || dcWarning.getId() == null || StringUtils.isBlank(dcWarning.getStakeMark()) ||
@ -236,6 +238,156 @@ public class DcWarningServiceImpl implements IDcWarningService
dcEvent.setCreateTime(DateUtils.getNowDate());//创建时间
dcEvent.setUserId(SecurityUtils.getUserId());//处置人员
Calendar cal = Calendar.getInstance();
cal.add(Calendar.HOUR,3);
dcEvent.setEstimatedEndTime(cal.getTime()); //预计解除时间
dcEvent.setRoadId(1L); //道路id
dcEvent.setRoadName("济菏高速"); //道路id
dcEvent.setInTunnel(0); //是否处在隧道
Integer warningType = dcWarning.getWarningType();
if (warningType == 1){
//交通拥堵
DcEventTrafficCongestion dcEventTrafficCongestion = new DcEventTrafficCongestion();
dcEventTrafficCongestion.setId(dcWarning.getId());
dcEventTrafficCongestion.setCongestionCause(5L);
dcEventTrafficCongestion.setCongestionMileage(0F);
dcEventTrafficCongestion.setMaxCongestionMileage(0F);
dcEvent.setDcEventTrafficCongestion(dcEventTrafficCongestion);
} else if (warningType == 4) {
//停车
DcEventVehicleAccident dcEventVehicleAccident = new DcEventVehicleAccident();
dcEventVehicleAccident.setId(dcWarning.getId());
if (dcWarning.getWarningSource() == 1) {
dcEventVehicleAccident.setReporterName("视频AI");
} else if (dcWarning.getWarningSource() == 2) {
dcEventVehicleAccident.setReporterName("雷达识别");
} else if (dcWarning.getWarningSource() == 3) {
dcEventVehicleAccident.setReporterName("智慧锥桶");
} else if (dcWarning.getWarningSource() == 4) {
dcEventVehicleAccident.setReporterName("护栏碰撞");
} else if (dcWarning.getWarningSource() == 6) {
dcEventVehicleAccident.setReporterName("非机预警");
}
dcEventVehicleAccident.setReporterPhoneNumber("96659");
dcEventVehicleAccident.setLocationType(1L);
dcEventVehicleAccident.setTrafficJam(0L);
dcEventVehicleAccident.setWeatherCondition(1L);
dcEventVehicleAccident.setCongestionAhead(1);
dcEventVehicleAccident.setAtIntersection(1);
dcEventVehicleAccident.setOnCurve(1);
dcEventVehicleAccident.setSmallCar(0L);
dcEventVehicleAccident.setTrucks(0L);
dcEventVehicleAccident.setBuses(0L);
dcEventVehicleAccident.setTankers(0L);
dcEventVehicleAccident.setMinorInjuries(0L);
dcEventVehicleAccident.setSeriousInjuries(0L);
dcEventVehicleAccident.setFatalities(0L);
dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident);
} else if (warningType == 7){
//道路施工
} else if (warningType == 8) {
//异常天气
DcEventAbnormalWeather dcEventAbnormalWeather = new DcEventAbnormalWeather();
dcEventAbnormalWeather.setId(dcWarning.getId());
dcEventAbnormalWeather.setEmergencyLevel(1L);
dcEvent.setDcEventAbnormalWeather(dcEventAbnormalWeather);
} else if (warningType == 9) {
//护栏碰撞
DcEventAccident dcEventAccident = new DcEventAccident();
dcEventAccident.setId(dcWarning.getId());
if (dcWarning.getWarningSource() == 1) {
dcEventAccident.setReporterName("视频AI");
dcEventAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 2) {
dcEventAccident.setReporterName("雷达识别");
dcEventAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 3) {
dcEventAccident.setReporterName("智慧锥桶");
dcEventAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 4) {
dcEventAccident.setReporterName("护栏碰撞");
dcEventAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 5) {
dcEventAccident.setReporterName("扫码报警");
JSONObject otherConfig = JSONObject.parseObject(dcWarning.getOtherConfig());
if (otherConfig != null && otherConfig.containsKey("phone")) {
dcEventAccident.setReporterPhoneNumber(otherConfig.getString("phone"));
dcEventAccident.setVehicleOwnerPhone(otherConfig.getString("phone"));
}
} else if (dcWarning.getWarningSource() == 6) {
dcEventAccident.setReporterName("非机预警");
dcEventAccident.setReporterPhoneNumber("96659");
}
dcEventAccident.setLocationType(1L);
dcEventAccident.setTrafficJam(0f);
dcEventAccident.setWeatherCondition(1L);
dcEventAccident.setImpactLevel(1L);
dcEventAccident.setIsReverseCargo(0);
dcEventAccident.setIsMaintenance(0);
dcEventAccident.setCongestionAhead(0);
dcEventAccident.setOnCurve(0);
dcEventAccident.setSmallCar(0L);
dcEventAccident.setTrucks(0L);
dcEventAccident.setBuses(0L);
dcEventAccident.setTankers(0L);
dcEventAccident.setMinorInjuries(0L);
dcEventAccident.setSeriousInjuries(0L);
dcEventAccident.setFatalities(0L);
dcEvent.setDcEventAccident(dcEventAccident);
} else if (warningType == 10) {
//交通事故
DcEventAccident dcEventAccident = new DcEventAccident();
} else if (warningType == 11) {
//车辆故障
DcEventVehicleAccident dcEventVehicleAccident = new DcEventVehicleAccident();
dcEventVehicleAccident.setId(dcWarning.getId());
if (dcWarning.getWarningSource() == 1) {
dcEventVehicleAccident.setReporterName("视频AI");
dcEventVehicleAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 2) {
dcEventVehicleAccident.setReporterName("雷达识别");
dcEventVehicleAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 3) {
dcEventVehicleAccident.setReporterName("智慧锥桶");
dcEventVehicleAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 4) {
dcEventVehicleAccident.setReporterName("护栏碰撞");
dcEventVehicleAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 5) {
dcEventVehicleAccident.setReporterName("扫码报警");
JSONObject otherConfig = JSONObject.parseObject(dcWarning.getOtherConfig());
if (otherConfig != null && otherConfig.containsKey("phone")) {
dcEventVehicleAccident.setReporterPhoneNumber(otherConfig.getString("phone"));
}
} else if (dcWarning.getWarningSource() == 6) {
dcEventVehicleAccident.setReporterName("非机预警");
dcEventVehicleAccident.setReporterPhoneNumber("96659");
}
dcEventVehicleAccident.setLocationType(1L);
dcEventVehicleAccident.setTrafficJam(0L);
dcEventVehicleAccident.setWeatherCondition(1L);
dcEventVehicleAccident.setCongestionAhead(1);
dcEventVehicleAccident.setAtIntersection(1);
dcEventVehicleAccident.setOnCurve(1);
dcEventVehicleAccident.setSmallCar(0L);
dcEventVehicleAccident.setTrucks(0L);
dcEventVehicleAccident.setBuses(0L);
dcEventVehicleAccident.setTankers(0L);
dcEventVehicleAccident.setMinorInjuries(0L);
dcEventVehicleAccident.setSeriousInjuries(0L);
dcEventVehicleAccident.setFatalities(0L);
dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident);
}
dcEventList.add(dcEvent);
}
@ -243,6 +395,7 @@ public class DcWarningServiceImpl implements IDcWarningService
dcWarningMapper.batchUpdateState(SecurityUtils.getUserId(),dcWarningList);
//批量插入事件表
dcEventService.batchInsertDcEventWarning(dcEventList);
}

10
zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.DcWarningMapper">
<resultMap type="DcWarning" id="DcWarningResult">
<result property="id" column="id" />
<result property="stakeMark" column="stake_mark" />
@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDcWarningList" parameterType="DcWarning" resultType="hashmap">
<include refid="selectDcWarningVo"/>
<where>
<where>
<if test="stakeMark != null and stakeMark != ''"> and stake_mark = #{stakeMark}</if>
<if test="direction != null and direction != ''"> and direction = #{direction}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
@ -63,8 +63,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="endDate != null and endDate != ''"> and date_format(warning_time,'%Y-%m-%d') &lt;= #{endDate}</if>
</where>
</select>
<select id="selectDcWarningById" parameterType="Integer" resultType="hashmap">
<select id="selectDcWarningById" parameterType="string" resultType="com.zc.business.domain.DcWarning">
<include refid="selectDcWarningVo"/>
where id = #{id}
</select>
@ -198,4 +198,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
</mapper>
</mapper>

4
zc-business/src/main/resources/mapper/business/StatusMapper.xml

@ -13,7 +13,7 @@
<result column="lost_rate" jdbcType="VARCHAR" property="lostRate"/>
<result column="direction" jdbcType="VARCHAR" property="direction"/>
<result column="product_name" jdbcType="VARCHAR" property="production"/>
<result column="manufacturer" jdbcType="VARCHAR" property="production"/>
<result column="model" jdbcType="VARCHAR" property="model"/>
<result column="facilities_type" jdbcType="VARCHAR" property="network"/>
<result column="remark" jdbcType="VARCHAR" property="content"/>
@ -85,7 +85,7 @@
</sql>
<select id="listStatus" parameterType="com.zc.business.domain.Status" resultMap="BaseResultMap">
select s.id, s.device_no, s.device_name, s.device_status,s.time, d.device_ip,s.success_rate,s.lost_rate,d.direction,e.product_name,e.model,d.facilities_type,d.remark,COALESCE(d.child_type, d.device_type) AS type
select s.id, s.device_no, s.device_name, s.device_status,s.time, d.device_ip,s.success_rate,s.lost_rate,d.direction,e.manufacturer,e.model,d.facilities_type,d.remark,COALESCE(d.child_type, d.device_type) AS type
from dc_device d
LEFT JOIN status s on (s.device_id=d.id)
LEFT JOIN dc_product e on e.id=d.product_id

Loading…
Cancel
Save