Browse Source

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

develop
Mr.Wang 1 year ago
parent
commit
c3ff29bb12
  1. 22
      zc-business/src/main/java/com/zc/business/controller/DcWarningController.java
  2. 124
      zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java
  3. 21
      zc-business/src/main/java/com/zc/business/domain/DcWarning.java
  4. 38
      zc-business/src/main/java/com/zc/business/domain/DcWarningBatchConvert.java
  5. 4
      zc-business/src/main/java/com/zc/business/domain/MdEvent.java
  6. 3
      zc-business/src/main/java/com/zc/business/enums/IotProductEnum.java
  7. 10
      zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java
  8. 3
      zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java
  9. 10
      zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java
  10. 105
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java
  11. 11
      zc-business/src/main/java/com/zc/business/service/IDcEventService.java
  12. 12
      zc-business/src/main/java/com/zc/business/service/IDcWarningService.java
  13. 3
      zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java
  14. 30
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  15. 77
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java
  16. 6
      zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java
  17. 65
      zc-business/src/main/resources/mapper/business/DcEventMapper.xml
  18. 22
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml
  19. 86
      zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml

22
zc-business/src/main/java/com/zc/business/controller/DcWarningController.java

@ -1,6 +1,7 @@
package com.zc.business.controller;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.zc.business.domain.DcWarningBatchConvert;
import com.zc.business.service.IDcWarningService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
@ -9,17 +10,13 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.zc.business.domain.DcWarning;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
@ -31,6 +28,7 @@ import java.util.List;
* @author ruoyi
* @date 2024-01-26
*/
@Api(tags = "感知事件")
@RestController
@RequestMapping("/business/warning")
public class DcWarningController extends BaseController
@ -41,6 +39,7 @@ public class DcWarningController extends BaseController
/**
* 查询预警信息列表
*/
@ApiOperation("查询感知事件列表")
@PreAuthorize("@ss.hasPermi('business:warning:list')")
@GetMapping("/list")
public TableDataInfo list(DcWarning dcWarning)
@ -130,4 +129,11 @@ public class DcWarningController extends BaseController
List<HashMap<String,Object>> list = dcWarningService.selectDcWarningoTherConfig(dcWarning);
return getDataTable(list);
}
@ApiOperation("感知事件批量转换")
@PostMapping("/batchConvert")
public AjaxResult batchConvert(@RequestBody DcWarningBatchConvert dcWarningBatchConvert){
return dcWarningService.batchConvert(dcWarningBatchConvert);
}
}

124
zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java

@ -34,14 +34,22 @@ public class DcMeteorologicalDetectorData extends BaseEntity
@Excel(name = "能见度")
private String visibility;
/** 路面状况 */
@Excel(name = "路面状况")
private String roadSurfaceStatus;
/** 路面温度 */
@Excel(name = "路面温度")
private String remoteRoadSurfaceTemperature;
/** 气压 */
@Excel(name = "气压")
private String atmosphericPressure;
/** 降水类型 */
@Excel(name = "降水类型")
private String precipitationType;
/** 湿滑系数 */
@Excel(name = "湿滑系数")
private String wetSlipperyCoefficient;
/** 气温 */
@Excel(name = "气温")
private String temperature;
@ -58,49 +66,18 @@ public class DcMeteorologicalDetectorData extends BaseEntity
@Excel(name = "风速")
private String windSpeed;
/** 冰点温度 */
@Excel(name = "冰点温度")
private String freezingPointTemperature;
/** 盐度值 */
@Excel(name = "盐度值")
private String salinityValue;
/** 路面温度 */
@Excel(name = "路面温度")
private String roadSurfaceTemperature;
/** 水膜厚度(GS1) */
@Excel(name = "水膜厚度(GS1)")
private String waterFilmThickness;
/** 降水类型 */
@Excel(name = "降水类型")
private String precipitationType;
/** 路面状态 */
@Excel(name = "路面状态")
private String remoteRoadSurfaceStatus;
/** 湿滑系数 */
@Excel(name = "湿滑系数")
private String wetSlipperyCoefficient;
/** 水膜厚度 */
@Excel(name = "水膜厚度")
private String waterFilmIceSnowValue;
/** 传感器温度 */
@Excel(name = "传感器温度")
private String sensorTemperature;
/** 远程路面温度 */
@Excel(name = "远程路面温度")
private String remoteRoadSurfaceTemperature;
/** 远程路面状态 */
@Excel(name = "远程路面状态")
private String remoteRoadSurfaceStatus;
/** 路基温度 */
@Excel(name = "路基温度")
private String subSurfaceTemperature;
/** 水膜厚度(GS2) */
@Excel(name = "水膜厚度(GS2)")
private String waterFilmIceSnowValue;
public void setId(Long id)
{
@ -147,15 +124,6 @@ public class DcMeteorologicalDetectorData extends BaseEntity
{
return visibility;
}
public void setRoadSurfaceStatus(String roadSurfaceStatus)
{
this.roadSurfaceStatus = roadSurfaceStatus;
}
public String getRoadSurfaceStatus()
{
return roadSurfaceStatus;
}
public void setAtmosphericPressure(String atmosphericPressure)
{
this.atmosphericPressure = atmosphericPressure;
@ -201,42 +169,7 @@ public class DcMeteorologicalDetectorData extends BaseEntity
{
return windSpeed;
}
public void setFreezingPointTemperature(String freezingPointTemperature)
{
this.freezingPointTemperature = freezingPointTemperature;
}
public String getFreezingPointTemperature()
{
return freezingPointTemperature;
}
public void setSalinityValue(String salinityValue)
{
this.salinityValue = salinityValue;
}
public String getSalinityValue()
{
return salinityValue;
}
public void setRoadSurfaceTemperature(String roadSurfaceTemperature)
{
this.roadSurfaceTemperature = roadSurfaceTemperature;
}
public String getRoadSurfaceTemperature()
{
return roadSurfaceTemperature;
}
public void setWaterFilmThickness(String waterFilmThickness)
{
this.waterFilmThickness = waterFilmThickness;
}
public String getWaterFilmThickness()
{
return waterFilmThickness;
}
public void setPrecipitationType(String precipitationType)
{
this.precipitationType = precipitationType;
@ -255,15 +188,7 @@ public class DcMeteorologicalDetectorData extends BaseEntity
{
return wetSlipperyCoefficient;
}
public void setSensorTemperature(String sensorTemperature)
{
this.sensorTemperature = sensorTemperature;
}
public String getSensorTemperature()
{
return sensorTemperature;
}
public void setRemoteRoadSurfaceTemperature(String remoteRoadSurfaceTemperature)
{
this.remoteRoadSurfaceTemperature = remoteRoadSurfaceTemperature;
@ -282,15 +207,7 @@ public class DcMeteorologicalDetectorData extends BaseEntity
{
return remoteRoadSurfaceStatus;
}
public void setSubSurfaceTemperature(String subSurfaceTemperature)
{
this.subSurfaceTemperature = subSurfaceTemperature;
}
public String getSubSurfaceTemperature()
{
return subSurfaceTemperature;
}
public void setWaterFilmIceSnowValue(String waterFilmIceSnowValue)
{
this.waterFilmIceSnowValue = waterFilmIceSnowValue;
@ -309,22 +226,15 @@ public class DcMeteorologicalDetectorData extends BaseEntity
.append("rainfall", getRainfall())
.append("visibilityType", getVisibilityType())
.append("visibility", getVisibility())
.append("roadSurfaceStatus", getRoadSurfaceStatus())
.append("atmosphericPressure", getAtmosphericPressure())
.append("temperature", getTemperature())
.append("humidity", getHumidity())
.append("windDirection", getWindDirection())
.append("windSpeed", getWindSpeed())
.append("freezingPointTemperature", getFreezingPointTemperature())
.append("salinityValue", getSalinityValue())
.append("roadSurfaceTemperature", getRoadSurfaceTemperature())
.append("waterFilmThickness", getWaterFilmThickness())
.append("precipitationType", getPrecipitationType())
.append("wetSlipperyCoefficient", getWetSlipperyCoefficient())
.append("sensorTemperature", getSensorTemperature())
.append("remoteRoadSurfaceTemperature", getRemoteRoadSurfaceTemperature())
.append("remoteRoadSurfaceStatus", getRemoteRoadSurfaceStatus())
.append("subSurfaceTemperature", getSubSurfaceTemperature())
.append("waterFilmIceSnowValue", getWaterFilmIceSnowValue())
.toString();
}

21
zc-business/src/main/java/com/zc/business/domain/DcWarning.java

@ -116,6 +116,11 @@ public class DcWarning extends BaseEntity
private String startStakeMark;
private String endStakeMark;
//开始日期
private String startDate;
//结束日期
private String endDate;
public String getStartStakeMark() {
return startStakeMark;
}
@ -372,6 +377,22 @@ public class DcWarning extends BaseEntity
return otherConfig;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

38
zc-business/src/main/java/com/zc/business/domain/DcWarningBatchConvert.java

@ -0,0 +1,38 @@
package com.zc.business.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* @Description 感知事件批量处理
*
* @author liuwenge
* @date 2024/3/16 16:27
*/
@ApiModel("感知事件批量处理")
public class DcWarningBatchConvert {
@ApiModelProperty("操作类型:0误报,1确认")
private String type;
@ApiModelProperty("感知事件列表")
private List<DcWarning> warningList;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<DcWarning> getWarningList() {
return warningList;
}
public void setWarningList(List<DcWarning> warningList) {
this.warningList = warningList;
}
}

4
zc-business/src/main/java/com/zc/business/domain/MdEvent.java

@ -666,8 +666,8 @@ public class MdEvent
//交通事件详情
this.eventDesc = dcEvent.getDescription();
//发生时间
this.occurTime = dcEvent.getStartTime();
//发生时间
this.occurTime = dcEvent.getOccurrenceTime();
//结束时间
this.endTime = dcEvent.getEndTime();
//发生路段位置桩号
this.stakeNumber = dcEvent.getStakeMark();

3
zc-business/src/main/java/com/zc/business/enums/IotProductEnum.java

@ -13,6 +13,9 @@ public enum IotProductEnum {
// 行车诱导
TRAFFIC_GUIDANCE("8866"),
// 护栏碰撞
GUARDRAIL_COLLISION("hlpz"),
// 气象检测器
WEATHER_DETECTOR("zc-meteorological"),

10
zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java

@ -73,6 +73,16 @@ public interface DcEventMapper extends BaseMapper<DcEvent>
List<Map<String,String>>selectCount();
/**
* @Description 批量添加事件
*
* @author liuwenge
* @date 2024/3/18 15:02
* @param eventList
* @return boolean
*/
boolean batchInsertDcEvent(List<DcEvent> eventList);
}

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

@ -70,4 +70,7 @@ public interface DcWarningMapper
//AI视频
List<HashMap<String,Object>> selectDcWarningoTherConfig(DcWarning dcWarning);
boolean batchUpdateState(@Param("userId") Long userId,@Param("dcWarningList") List<DcWarning> dcWarningList);
boolean batchDelete(@Param("dcWarningList") List<DcWarning> dcWarningList);
}

10
zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java

@ -81,4 +81,14 @@ public interface MiddleDatabaseMapper
* @return 结果
*/
boolean updateMiddleDatabaseEvent(MdEvent mdEvent);
/**
* @Description 中间库批量添加事件
*
* @author liuwenge
* @date 2024/3/18 15:09
* @param mdEventList
* @return boolean
*/
boolean batchInsertMiddleDatabaseEvent(List<MdEvent> mdEventList);
}

105
zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.redis.RedisCache;
import com.zc.business.constant.RedisKeyConstants;
import com.zc.business.domain.DcDevice;
@ -21,10 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -116,6 +116,11 @@ public class DeviceMessageHandler {
if (IotProductEnum.WEATHER_DETECTOR.value().equals(productId)) {
weatherDetectorMessageHandle(data);
}
// 护栏碰撞
if (IotProductEnum.GUARDRAIL_COLLISION.value().equals(productId)) {
guardrailCollisionDeviceMessageHandle(data);
}
}
@ -229,26 +234,27 @@ public class DeviceMessageHandler {
extracted1(data, dcWarning);
}
//抛洒物(有ID有框)
if (illegalTrafficEventSubType.equals("abandonedObjectEnd")){
if (illegalTrafficEventSubType.equals("abandonedObjectEnd")) {
extracted3(data, dcWarning);
}
//事故(有ID有框)
if(illegalTrafficEventSubType.equals("trafficAccidentEnd")){
if (illegalTrafficEventSubType.equals("trafficAccidentEnd")) {
extracted3(data, dcWarning);
}
//车辆抛锚有ID有框)
if(illegalTrafficEventSubType.equals("singleVehicleBreakdownEnd")){
if (illegalTrafficEventSubType.equals("singleVehicleBreakdownEnd")) {
extracted3(data, dcWarning);
}
//违停(有ID有框)
if(illegalTrafficEventSubType.equals("illegalParkingEnd")){
if (illegalTrafficEventSubType.equals("illegalParkingEnd")) {
extracted3(data, dcWarning);
}
}
//(有ID有框)
//(有ID有框)
private void extracted3(JSONObject data, DcWarning dcWarning) {
//事件上报ID
String targetId = data.getString("targetId");
@ -267,7 +273,7 @@ public class DeviceMessageHandler {
String targetIdEvent = (String) hashMap.get("targetId");
//事件位置
String coordinateEvent = (String) hashMap.get("coordinate");
if (coordinate.equals(coordinateEvent)&&targetId.equals(targetIdEvent)) {
if (coordinate.equals(coordinateEvent) && targetId.equals(targetIdEvent)) {
DcWarning dcWarning2 = new DcWarning();
dcWarning2.setId(id);
//自动确定状态
@ -326,6 +332,7 @@ public class DeviceMessageHandler {
/**
* 一站式情况调查站设备消息处理入口
*
* @param msg 设备消息
*/
private void oneStopDeviceMessageHandle(JSONObject msg) {
@ -333,8 +340,76 @@ public class DeviceMessageHandler {
}
/**
* 护栏碰撞设备消息处理入口
*
* @param msg 设备消息
*/
private void guardrailCollisionDeviceMessageHandle(JSONObject msg) {
JSONObject dataJsonObject = msg.getJSONObject("data");
String serviceIP = dataJsonObject.getString("serviceIP");//告警ip
String timeOfFireAlarming = dataJsonObject.getString("timeOfFireAlarming");//告警时间
JSONArray jsonArray = dataJsonObject.getJSONArray("data");
for (Object o : jsonArray) {
JSONObject jsonObject = JSONObject.parseObject(o.toString());
String nodeAddress = jsonObject.getString("nodeAddress");//节点地址
String alarmType = jsonObject.getString("alarmType");//告警类型
String location = jsonObject.getString("location");//告警位置
String areaCode = jsonObject.getString("areaCode");//区域号
DcWarning dcWarning = new DcWarning();
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DcDevice::getIotDeviceId, nodeAddress);
List<DcDevice> dcDevices = dcDeviceService.list(lambdaQueryWrapper);
String direction = "";
if (Objects.equals(location, "0")) {
dcWarning.setDirection("1");
direction = "上行右侧";
} else if (Objects.equals(location, "1")) {
dcWarning.setDirection("1");
direction = "上行左侧";
} else if (Objects.equals(location, "10")) {
dcWarning.setDirection("0");
direction = "下行右侧";
} else if (Objects.equals(location, "11")) {
dcWarning.setDirection("0");
direction = "下行左侧";
}
String eventType = "";
if (Objects.equals(alarmType, "1")) {
eventType = "碰撞";
} else if (Objects.equals(alarmType, "2")) {
eventType = "只倾斜无碰撞";
} else if (Objects.equals(alarmType, "3")) {
eventType = "碰撞后倾斜";
} else if (Objects.equals(alarmType, "4")) {
eventType = "应急车道被占";
} else if (Objects.equals(alarmType, "5")) {
eventType = "车离开应急车道";
}
SimpleDateFormat sdf = new SimpleDateFormat("yy年MM月dd日HH时mm分");
try {
Date date = sdf.parse(timeOfFireAlarming);
dcWarning.setWarningTime(date);
} catch (ParseException e) {
e.printStackTrace();
}
dcWarning.setStakeMark(dcDevices.get(0).getStakeMark());
dcWarning.setWarningType(9);
dcWarning.setCreateTime(new Date());
dcWarning.setWarningTitle("护栏碰撞上报事件:区域号为" + areaCode + "在" + timeOfFireAlarming + direction + "发生" + eventType + "事件");
dcWarning.setOtherConfig(dataJsonObject.toJSONString());
dcWarningService.insertDcWarning(dcWarning);
}
}
/**
* 气象检测器消息处理入口
*
* @param msg 设备消息
*/
private void weatherDetectorMessageHandle(JSONObject msg) {
@ -352,19 +427,19 @@ public class DeviceMessageHandler {
Map<String,Object> expands = new HashMap<>();
expands.put("rainFall",meteorologicalDetectorData.getRainfall()); //雨量
expands.put("windSpeed",meteorologicalDetectorData.getWindSpeed()); //风速
expands.put("windDirection",meteorologicalDetectorData.getWindDirection()); //风向
expands.put("windSpeed",meteorologicalDetectorData.getWindSpeed()); //风速
expands.put("temperature",meteorologicalDetectorData.getTemperature()); //大气温度
expands.put("humidity",meteorologicalDetectorData.getHumidity()); //大气湿度
expands.put("airPressure",meteorologicalDetectorData.getAtmosphericPressure()); //数字气压
expands.put("airPressure",meteorologicalDetectorData.getAtmosphericPressure()); //气压
expands.put("waterThick",meteorologicalDetectorData.getWaterFilmIceSnowValue()); //水膜厚度
expands.put("wet",meteorologicalDetectorData.getWetSlipperyCoefficient()); //湿滑
expands.put("rainXingTai",meteorologicalDetectorData.getPrecipitationType()); //雨量降水形态
expands.put("visibility",meteorologicalDetectorData.getVisibility()); //能见度
expands.put("pathContactLu",meteorologicalDetectorData.getRoadSurfaceTemperature()); //路面温度
expands.put("pathContactBing",meteorologicalDetectorData.getFreezingPointTemperature()); //冰点温度
expands.put("pathContactYan",meteorologicalDetectorData.getSalinityValue()); //路面盐度
expands.put("remoteRoadSurfaceTemperature",meteorologicalDetectorData.getRemoteRoadSurfaceTemperature()); //路面温度
expands.put("pathContactZhuang",meteorologicalDetectorData.getRemoteRoadSurfaceStatus()); //路面状况
mdDeviceData.setExpands(JSONObject.toJSONString(expands));
middleDatabaseService.insertMiddleDatabaseDeviceData(mdDeviceData);

11
zc-business/src/main/java/com/zc/business/service/IDcEventService.java

@ -38,6 +38,17 @@ public interface IDcEventService
*/
public int insertDcEvent(DcEvent dcEvent);
public int insertDcEventWarning(DcEvent dcEvent);
/**
* @Description 批量添加事件
*
* @author liuwenge
* @date 2024/3/18 8:43
* @param dcEventList
* @return int
*/
public boolean batchInsertDcEventWarning(List<DcEvent> dcEventList);
/**
* 修改事件信息
*

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

@ -5,6 +5,8 @@ import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult;
import com.zc.business.domain.DcWarning;
import com.zc.business.domain.DcWarningBatchConvert;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 预警信息Service接口
@ -69,4 +71,14 @@ public interface IDcWarningService
int deleteDcWarningByStringId(DcWarning dcWarning);
List<HashMap<String,Object>> selectDcWarningoTherConfig(DcWarning dcWarning);
/**
* @Description 感知事件批量转换
*
* @author liuwenge
* @date 2024/3/16 16:35
* @param dcWarningBatchConvert
* @return com.ruoyi.common.core.domain.AjaxResult
*/
AjaxResult batchConvert(DcWarningBatchConvert dcWarningBatchConvert);
}

3
zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java

@ -89,4 +89,7 @@ public interface IMiddleDatabaseService
*/
boolean updateMiddleDatabaseEvent(MdEvent mdEvent);
boolean batchInsertMiddleDatabaseEvent(List<MdEvent> mdEventList);
}

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

@ -101,14 +101,14 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
}
List<DcEvent> dcEventList = dcEventMapper.selectDcEventList(dcEvent);
for (DcEvent dcEvents : dcEventList) {
/*for (DcEvent dcEvents : dcEventList) {
// 根据 deptId 获取部门名称
Long deptId = dcEvents.getDeptId();
String deptName = deptService.selectDeptById(deptId).getDeptName();
// 将部门名称赋值给 deptName 字段
dcEvents.setDeptName(deptName);
}
}*/
return dcEventList;
}
@ -348,6 +348,32 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
}
}
/**
* @Description 批量添加事件
*
* @author liuwenge
* @date 2024/3/18 8:42
* @param dcEventList
* @return int
*/
@Override
public boolean batchInsertDcEventWarning(List<DcEvent> dcEventList) {
boolean flag = dcEventMapper.batchInsertDcEvent(dcEventList);
if (flag) {
//中间库
List<MdEvent> mdEventList = new ArrayList<>();
for (DcEvent dcEvent : dcEventList) {
MdEvent mdEvent = new MdEvent(dcEvent);
mdEventList.add(mdEvent);
}
middleDatabaseService.batchInsertMiddleDatabaseEvent(mdEventList);
}
return flag;
}
/**
* 修改事件信息
*

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

@ -6,6 +6,7 @@ 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.enums.ValueConverter;
import com.zc.business.mapper.DcEventMapper;
import com.zc.business.mapper.DcWarningMapper;
@ -16,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -170,4 +172,79 @@ public class DcWarningServiceImpl implements IDcWarningService
{
return dcWarningMapper.selectDcWarningoTherConfig(dcWarning);
}
/**
* @Description 感知事件批量转换
*
* @author liuwenge
* @date 2024/3/16 16:36
* @param dcWarningBatchConvert
* @return com.ruoyi.common.core.domain.AjaxResult
*/
@Override
@Transactional
public AjaxResult batchConvert(DcWarningBatchConvert dcWarningBatchConvert){
if (StringUtils.isBlank(dcWarningBatchConvert.getType())){
return AjaxResult.error("请选择操作类型");
}
List<DcWarning> dcWarningList = dcWarningBatchConvert.getWarningList();
if (dcWarningList != null && dcWarningList.size() > 0){
//误报,批量删除
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()) ||
StringUtils.isBlank(dcWarning.getDirection())) {
return AjaxResult.error("参数错误");
}
dcWarning.setUserId(SecurityUtils.getUserId());
DcEvent dcEvent = new DcEvent();
dcEvent.setId(dcWarning.getId());//id
dcEvent.setStakeMark(dcWarning.getStakeMark());//桩号
dcEvent.setDirection(dcWarning.getDirection());//方向
dcEvent.setDeptId(dcWarning.getDeptId());//部门
dcEvent.setOccurrenceTime(dcWarning.getWarningTime());//预警时间
if (dcWarning.getWarningLevel() != null) {
dcEvent.setEventLevel(dcWarning.getWarningLevel().longValue());//事件等级
}
if (dcWarning.getWarningSource() != null) {
dcEvent.setEventSource((long) ValueConverter.convertValueSource(dcWarning.getWarningSource()));//事件来源
}
if (dcWarning.getWarningType() != null) {
dcEvent.setEventType((long) ValueConverter.convertValueHost(dcWarning.getWarningType()));//事件主类
}
if (StringUtils.isBlank(dcWarning.getWarningSubclass())) {
dcEvent.setEventSubclass(ValueConverter.convertValueSon(dcWarning.getWarningSubclass()));//事件子类
}
dcEvent.setEventTitle(dcWarning.getWarningTitle());//标题
dcEvent.setLang(dcWarning.getLane());//车道
dcEvent.setRemark(dcEvent.getRemark());//备注
dcEvent.setIsPerceived(1);//是否感知事件
dcEvent.setEventState(Long.valueOf(1));//状态为处理中
dcEvent.setCreateTime(DateUtils.getNowDate());//创建时间
dcEvent.setUserId(SecurityUtils.getUserId());//处置人员
dcEventList.add(dcEvent);
}
//批量更改感知事件状态
dcWarningMapper.batchUpdateState(SecurityUtils.getUserId(),dcWarningList);
//批量插入事件表
dcEventService.batchInsertDcEventWarning(dcEventList);
}
} else {
return AjaxResult.error("请选择感知事件");
}
return AjaxResult.success("批量操作成功");
}
}

6
zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java

@ -153,4 +153,10 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService {
}
return middleDatabaseMapper.updateMiddleDatabaseEvent(mdEvent);
}
@Override
public boolean batchInsertMiddleDatabaseEvent(List<MdEvent> mdEventList){
return middleDatabaseMapper.batchInsertMiddleDatabaseEvent(mdEventList);
}
}

65
zc-business/src/main/resources/mapper/business/DcEventMapper.xml

@ -144,6 +144,7 @@
SELECT
id,
dc_event.dept_id as dept_id,
sys_dept.dept_name,
stake_mark,
CASE direction
WHEN '1' THEN '菏泽方向'
@ -257,6 +258,7 @@
FROM
dc_event
LEFT JOIN sys_user on dc_event.user_id = sys_user.user_id
LEFT JOIN sys_dept on dc_event.dept_id = sys_dept.dept_id
</sql>
<sql id="selectDcEventVoListAll"> select dc_event.id AS id,
@ -542,8 +544,69 @@
<if test="isPerceived != null">#{isPerceived},</if>
</trim>
</insert>
<insert id="batchInsertDcEvent" useGeneratedKeys="true" keyProperty="id">
<foreach collection ="list" item="dcEvent" index= "index" separator =";">
insert into dc_event
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dcEvent.id != null">id,</if>
<if test="dcEvent.deptId != null">dept_id,</if>
<if test="dcEvent.stakeMark != null and dcEvent.stakeMark != ''">stake_mark,</if>
<if test="dcEvent.direction != null and dcEvent.direction != ''">direction,</if>
<if test="dcEvent.userId != null">user_id,</if>
<if test="dcEvent.startTime != null">start_time,</if>
<if test="dcEvent.endTime != null">end_time,</if>
<if test="dcEvent.estimatedEndTime != null">estimated_end_time,</if>
<if test="dcEvent.eventLevel != null">event_level,</if>
<if test="dcEvent.eventType != null">event_type,</if>
<if test="dcEvent.eventSubclass != null">event_subclass,</if>
<if test="dcEvent.eventCause != null">event_cause,</if>
<if test="dcEvent.description != null">description,</if>
<if test="dcEvent.eventState != null">event_state,</if>
<if test="dcEvent.eventSource != null">event_source,</if>
<if test="dcEvent.eventNature != null">event_nature,</if>
<if test="dcEvent.remark != null">remark,</if>
<if test="dcEvent.createTime != null">create_time,</if>
<if test="dcEvent.updateTime != null">update_time,</if>
<if test="dcEvent.eventSourceTips != null">event_source_tips,</if>
<if test="dcEvent.inTunnel != null">in_tunnel,</if>
<if test="dcEvent.roadId != null">road_id,</if>
<if test="dcEvent.lang != null">lang,</if>
<if test="dcEvent.eventTitle != null">event_title,</if>
<if test="dcEvent.occurrenceTime != null">occurrence_time,</if>
<if test="dcEvent.isPerceived != null">is_perceived,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dcEvent.id != null">#{dcEvent.id},</if>
<if test="dcEvent.deptId != null">#{dcEvent.deptId},</if>
<if test="dcEvent.stakeMark != null and dcEvent.stakeMark != ''">#{dcEvent.stakeMark},</if>
<if test="dcEvent.direction != null and dcEvent.direction != ''">#{dcEvent.direction},</if>
<if test="dcEvent.userId != null">#{dcEvent.userId},</if>
<if test="dcEvent.startTime != null">#{dcEvent.startTime},</if>
<if test="dcEvent.endTime != null">#{dcEvent.endTime},</if>
<if test="dcEvent.estimatedEndTime != null">#{dcEvent.estimatedEndTime},</if>
<if test="dcEvent.eventLevel != null">#{dcEvent.eventLevel},</if>
<if test="dcEvent.eventType != null">#{dcEvent.eventType},</if>
<if test="dcEvent.eventSubclass != null">#{dcEvent.eventSubclass},</if>
<if test="dcEvent.eventCause != null">#{dcEvent.eventCause},</if>
<if test="dcEvent.description != null">#{dcEvent.description},</if>
<if test="dcEvent.eventState != null">#{dcEvent.eventState},</if>
<if test="dcEvent.eventSource != null">#{dcEvent.eventSource},</if>
<if test="dcEvent.eventNature != null">#{dcEvent.eventNature},</if>
<if test="dcEvent.remark != null">#{dcEvent.remark},</if>
<if test="dcEvent.createTime != null">#{dcEvent.createTime},</if>
<if test="dcEvent.updateTime != null">#{dcEvent.updateTime},</if>
<if test="dcEvent.eventSourceTips != null">#{dcEvent.eventSourceTips},</if>
<if test="dcEvent.inTunnel != null">#{dcEvent.inTunnel},</if>
<if test="dcEvent.roadId != null">#{dcEvent.roadId},</if>
<if test="dcEvent.lang != null">#{dcEvent.lang},</if>
<if test="dcEvent.eventTitle != null">#{dcEvent.eventTitle},</if>
<if test="dcEvent.occurrenceTime != null">#{dcEvent.occurrenceTime},</if>
<if test="dcEvent.isPerceived != null">#{dcEvent.isPerceived},</if>
</trim>
</foreach>
</insert>
<update id="updateDcEvent" parameterType="DcEvent">
<update id="updateDcEvent" parameterType="DcEvent">
update dc_event
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>

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

@ -59,6 +59,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warningTitle != null and warningTitle != ''"> and warning_title = #{warningTitle}</if>
<if test="otherConfig != null and otherConfig != ''"> and other_config = #{otherConfig}</if>
<if test="lane != null and lane != ''"> and lane = #{lane}</if>
<if test="startDate != null and startDate != ''"> and date_format(warning_time,'%Y-%m-%d') >= #{startDate}</if>
<if test="endDate != null and endDate != ''"> and date_format(warning_time,'%Y-%m-%d') &lt;= #{endDate}</if>
</where>
</select>
@ -148,6 +150,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update dc_warning set warning_state=2,user_id=#{userId} where id=#{id}
</update>
<update id="batchUpdateState">
update dc_warning set warning_state = 2,user_id = #{userId}
where id in
<foreach collection="dcWarningList" item="item" index="index"
separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
<delete id="deleteDcWarningById" parameterType="Integer">
delete from dc_warning where id = #{id}
</delete>
@ -158,6 +170,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteDcWarningByStringId">
delete from dc_warning where id= #{id}
</delete>
<delete id="batchDelete">
delete from dc_warning
where id in
<foreach collection="dcWarningList" item="item" index="index"
separator="," open="(" close=")">
#{item.id}
</foreach>
</delete>
<select id="selectCount" resultType="int">
SELECT COUNT(*)AS count FROM dc_warning
</select>

86
zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml

@ -231,6 +231,92 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</insert>
<insert id="batchInsertMiddleDatabaseEvent">
<foreach collection ="list" item="mdEvent" index= "index" separator =";">
insert into event
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mdEvent.fusionId != null">fusionId,</if>
<if test="mdEvent.eventName != null">event_name,</if>
<if test="mdEvent.eventTypeCode != null">event_type_code,</if>
<if test="mdEvent.eventDesc != null">event_desc,</if>
<if test="mdEvent.occurTime != null">occur_time,</if>
<if test="mdEvent.endTime != null">end_time,</if>
<if test="mdEvent.stakeNumber != null and mdEvent.stakeNumber != ''">stake_number,</if>
<if test="mdEvent.longitude != null">longitude,</if>
<if test="mdEvent.latitude != null">latitude,</if>
<if test="mdEvent.lane != null">lane,</if>
<if test="mdEvent.direction != null and mdEvent.direction != ''">direction,</if>
<if test="mdEvent.location != null">location,</if>
<if test="mdEvent.eventSourceCode != null">event_source_code,</if>
<if test="mdEvent.eventSource != null">event_source,</if>
<if test="mdEvent.eventStatus != null">event_status,</if>
<if test="mdEvent.eventLevel != null">event_level,</if>
<if test="mdEvent.sectionId != null">section_id,</if>
<if test="mdEvent.eventTypeCode2 != null">event_type_code2,</if>
<if test="mdEvent.eventCause != null">event_cause,</if>
<if test="mdEvent.accidentWeather != null">accident_weather,</if>
<if test="mdEvent.accidentQueue != null">accident_queue,</if>
<if test="mdEvent.congestionPile != null">congestion_pile,</if>
<if test="mdEvent.congestionReason != null">congestion_reason,</if>
<if test="mdEvent.controlCategory != null">control_category,</if>
<if test="mdEvent.controlReason != null">control_reason,</if>
<if test="mdEvent.controlReasonType != null">control_reason_type,</if>
<if test="mdEvent.controlStation != null">control_station,</if>
<if test="mdEvent.controlPile != null">control_pile,</if>
<if test="mdEvent.controlStrategy != null">control_strategy,</if>
<if test="mdEvent.controlType != null">control_type,</if>
<if test="mdEvent.controlVehicleType != null">control_vehicle_type,</if>
<if test="mdEvent.creatorUserId != null">CreatorUserId,</if>
<if test="mdEvent.lastModificationTime != null">LastModificationTime,</if>
<if test="mdEvent.lastModifierUserId != null">LastModifierUserId,</if>
<if test="mdEvent.isDeleted != null">IsDeleted,</if>
<if test="mdEvent.deleterUserId != null">DeleterUserId,</if>
<if test="mdEvent.deletionTime != null">DeletionTime,</if>
CreationTime,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mdEvent.fusionId != null">#{mdEvent.fusionId},</if>
<if test="mdEvent.eventName != null">#{mdEvent.eventName},</if>
<if test="mdEvent.eventTypeCode != null">#{mdEvent.eventTypeCode},</if>
<if test="mdEvent.eventDesc != null">#{mdEvent.eventDesc},</if>
<if test="mdEvent.occurTime != null">#{mdEvent.occurTime},</if>
<if test="mdEvent.endTime != null">#{mdEvent.endTime},</if>
<if test="mdEvent.stakeNumber != null and mdEvent.stakeNumber != ''">#{mdEvent.stakeNumber},</if>
<if test="mdEvent.longitude != null">#{mdEvent.longitude},</if>
<if test="mdEvent.latitude != null">#{mdEvent.latitude},</if>
<if test="mdEvent.lane != null">#{mdEvent.lane},</if>
<if test="mdEvent.direction != null and mdEvent.direction != ''">#{mdEvent.direction},</if>
<if test="mdEvent.location != null">#{mdEvent.location},</if>
<if test="mdEvent.eventSourceCode != null">#{mdEvent.eventSourceCode},</if>
<if test="mdEvent.eventSource != null">#{mdEvent.eventSource},</if>
<if test="mdEvent.eventStatus != null">#{mdEvent.eventStatus},</if>
<if test="mdEvent.eventLevel != null">#{mdEvent.eventLevel},</if>
<if test="mdEvent.sectionId != null">#{mdEvent.sectionId},</if>
<if test="mdEvent.eventTypeCode2 != null">#{mdEvent.eventTypeCode2},</if>
<if test="mdEvent.eventCause != null">#{mdEvent.eventCause},</if>
<if test="mdEvent.accidentWeather != null">#{mdEvent.accidentWeather},</if>
<if test="mdEvent.accidentQueue != null">#{mdEvent.accidentQueue},</if>
<if test="mdEvent.congestionPile != null">#{mdEvent.congestionPile},</if>
<if test="mdEvent.congestionReason != null">#{mdEvent.congestionReason},</if>
<if test="mdEvent.controlCategory != null">#{mdEvent.controlCategory},</if>
<if test="mdEvent.controlReason != null">#{mdEvent.controlReason},</if>
<if test="mdEvent.controlReasonType != null">#{mdEvent.controlReasonType},</if>
<if test="mdEvent.controlStation != null">#{mdEvent.controlStation},</if>
<if test="mdEvent.controlPile != null">#{mdEvent.controlPile},</if>
<if test="mdEvent.controlStrategy != null">#{mdEvent.controlStrategy},</if>
<if test="mdEvent.controlType != null">#{mdEvent.controlType},</if>
<if test="mdEvent.controlVehicleType != null">#{mdEvent.controlVehicleType},</if>
<if test="mdEvent.creatorUserId != null">#{mdEvent.creatorUserId},</if>
<if test="mdEvent.lastModificationTime != null">#{mdEvent.lastModificationTime},</if>
<if test="mdEvent.lastModifierUserId != null">#{mdEvent.lastModifierUserId},</if>
<if test="mdEvent.isDeleted != null">#{mdEvent.isDeleted},</if>
<if test="mdEvent.deleterUserId != null">#{mdEvent.deleterUserId},</if>
<if test="mdEvent.deletionTime != null">#{mdEvent.deletionTime},</if>
now()
</trim>
</foreach>
</insert>
<update id="updateMiddleDatabaseDeviceInfo" parameterType="MdDevice">
update device
<set>

Loading…
Cancel
Save