Browse Source

Merge branch 'develop' of http://39.106.31.193:9211/mengff/jihe-dc into develop

# Conflicts:
#	zc-business/src/main/java/com/zc/business/controller/VideoController.java
develop
xiepufeng 11 months ago
parent
commit
ad9f344bc6
  1. 41
      zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java
  2. 5
      zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java
  3. 4
      zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java
  4. 9
      zc-business/src/main/java/com/zc/business/controller/DcMYSQLUtil.java
  5. 22
      zc-business/src/main/java/com/zc/business/controller/DcWarningController.java
  6. 5
      zc-business/src/main/java/com/zc/business/controller/DeviceStatus.java
  7. 43
      zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java
  8. 38
      zc-business/src/main/java/com/zc/business/controller/StatusController.java
  9. 55
      zc-business/src/main/java/com/zc/business/controller/VideoController.java
  10. 24
      zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java
  11. 4
      zc-business/src/main/java/com/zc/business/domain/DcDevice.java
  12. 6
      zc-business/src/main/java/com/zc/business/domain/DcEmergencyPlans.java
  13. 4
      zc-business/src/main/java/com/zc/business/domain/DcEvent.java
  14. 124
      zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java
  15. 21
      zc-business/src/main/java/com/zc/business/domain/DcWarning.java
  16. 38
      zc-business/src/main/java/com/zc/business/domain/DcWarningBatchConvert.java
  17. 4
      zc-business/src/main/java/com/zc/business/domain/MdEvent.java
  18. 9
      zc-business/src/main/java/com/zc/business/domain/Status.java
  19. 42
      zc-business/src/main/java/com/zc/business/enums/DeviceTypeEnum.java
  20. 3
      zc-business/src/main/java/com/zc/business/enums/IotProductEnum.java
  21. 22
      zc-business/src/main/java/com/zc/business/enums/ValueConverter.java
  22. 24
      zc-business/src/main/java/com/zc/business/enums/WarningSubclassEnum.java
  23. 3
      zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java
  24. 10
      zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java
  25. 5
      zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java
  26. 10
      zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java
  27. 117
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java
  28. 5
      zc-business/src/main/java/com/zc/business/service/DcEmergencyPlansService.java
  29. 2
      zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java
  30. 11
      zc-business/src/main/java/com/zc/business/service/IDcEventService.java
  31. 14
      zc-business/src/main/java/com/zc/business/service/IDcWarningService.java
  32. 3
      zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java
  33. 12
      zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java
  34. 86
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java
  35. 96
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  36. 245
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java
  37. 2
      zc-business/src/main/java/com/zc/business/service/impl/DcWeatherMonitoringServiceImpl.java
  38. 6
      zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java
  39. 6
      zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml
  40. 66
      zc-business/src/main/resources/mapper/business/DcEventMapper.xml
  41. 24
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml
  42. 86
      zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml
  43. 10
      zc-business/src/main/resources/mapper/business/StatusMapper.xml

41
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,10 +36,11 @@ 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.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");
@ -51,13 +52,37 @@ public class CodeScanningAlarmController extends BaseController {
dcWarning.setWarningTime(new Date());
}
dcWarning.setCreateTime(new Date());
int warningType = Integer.parseInt(String.valueOf(returnParameters.get("accidentType"))) >= 4 ? 10 : 11;
dcWarning.setWarningType(warningType);
String warningTitle = "济荷高速:" + (Objects.equals(roadCode, "1") ? "济南方向" : "菏泽方向") + "发生" + (warningType == 10 ? "交通事故事件" : "车辆故障事件");
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));
} else {
return AjaxResult.success(dcWarningService.updateDcWarning(dcWarning));
}
}
}

5
zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java

@ -373,6 +373,8 @@ public class DcDeviceController extends BaseController {
return AjaxResult.error("设备未接入");
}
try {
OkHttp okHttp = new OkHttp();
RequestParams requestParams = new RequestParams(props);
@ -384,6 +386,9 @@ public class DcDeviceController extends BaseController {
.data(requestParams)
.post(); // 请求方法
return JSON.parseObject(response.body().string(), AjaxResult.class);
}catch (Exception e){
return AjaxResult.error("请求失败");
}
}

4
zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java

@ -123,7 +123,7 @@ public class DcEmergencyPlansController extends BaseController {
@PreAuthorize("@ss.hasPermi('business:plans:edit')")
@PostMapping("/event/confirm")
public AjaxResult eventConfirm(@RequestBody DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) {
return toAjax(dcEmergencyPlansService.executionEventConfirmation(dcEventAnDcEmergencyPlans));
return AjaxResult.success(dcEmergencyPlansService.executionEventConfirmation(dcEventAnDcEmergencyPlans));
}
/**
@ -133,7 +133,7 @@ public class DcEmergencyPlansController extends BaseController {
@PreAuthorize("@ss.hasPermi('business:plans:edit')")
@PostMapping("/warning/confirm")
public AjaxResult warningConfirm(@RequestBody DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) {
return toAjax(dcEmergencyPlansService.executionWarningConfirmation(dcEventAnDcEmergencyPlans));
return AjaxResult.success(dcEmergencyPlansService.executionWarningConfirmation(dcEventAnDcEmergencyPlans));
}
/**

9
zc-business/src/main/java/com/zc/business/controller/DcMYSQLUtil.java

@ -18,16 +18,19 @@ public class DcMYSQLUtil {
String cmd = "";
String os = System.getProperties().getProperty("os.name");
try {
Process process;
if (os.contains("Windows")) {
// Windows 需要加上 cmd /c
cmd = "cmd /c mysqldump --single-transaction " + " -h" + host + " -P" + port + " -u" + userName + " -p" + password + " --databases --skip-extended-insert " + dbName + " > " + file.getPath();
process = Runtime.getRuntime().exec(cmd);
} else {
// Linux 需要加上 /usr/local/mysql/bin/
cmd = "bash -c /usr/local/mysql/bin/mysqldump --single-transaction " + " -h" + host + " -P" + port + " -u" + userName + " -p'" + password + "' --databases --skip-extended-insert " + dbName + " > " + file.getPath();
cmd = "/usr/local/mysql/bin/mysqldump --single-transaction " + " -h" + host + " -P" + port + " -u" + userName + " -p'" + password + "' --databases --skip-extended-insert " + dbName + " > " + file.getPath();
process = Runtime.getRuntime().exec(new String[]{"bash","-c",cmd});
}
System.out.printf("cmd命令为:%s%n", cmd);
try {
Process process = Runtime.getRuntime().exec(cmd);
if (process.waitFor() == 0) {
System.out.printf(" 数据库:%s 备份成功!%n", dbName);

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

5
zc-business/src/main/java/com/zc/business/controller/DeviceStatus.java

@ -1,5 +1,6 @@
package com.zc.business.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.util.StringUtil;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.zc.business.domain.DcDevice;
@ -47,7 +48,9 @@ public class DeviceStatus {
IDcDeviceService deviceService= SpringUtils.getBean(IDcDeviceService.class);
StatusService statusService= SpringUtils.getBean(StatusService.class);
ExecutorService executor = Executors.newFixedThreadPool(100);
List<DcDevice> deviceList = deviceService.list();
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DcDevice::getUseState,1);
List<DcDevice> deviceList = deviceService.list(lambdaQueryWrapper);
List<Future<Void>> futures = new ArrayList<>();

43
zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java

@ -146,44 +146,55 @@ public class NonAutomaticWarningController extends BaseController {
case "congestion"://拥堵
warningType = "拥堵";
dcWarning.setWarningType(1);
dcWarning.setWarningSubclass("1-1");
break;
case "laneChange"://变道
dcWarning.setWarningType(5);
dcWarning.setWarningSubclass("5-6");
break;
//case "laneChange"://变道
// dcWarning.setWarningType();
// break;
//case "vehicleexist"://机占非
// dcWarning.setWarningType();
// break;
//case "roadBlock"://路障
// dcWarning.setWarningType();
// break;
//case "construction"://施工
// dcWarning.setWarningType();
// break;
case "roadBlock"://路障
dcWarning.setWarningType(6);
dcWarning.setWarningSubclass("6-3");
break;
case "construction"://施工
dcWarning.setWarningType(7);
dcWarning.setWarningSubclass("7-1");
break;
case "llegalParking"://停车
warningType = "停车";
dcWarning.setWarningType(4);
dcWarning.setWarningSubclass("4-10");
break;
case "crossLane"://压线
dcWarning.setWarningType(5);
dcWarning.setWarningSubclass("5-2");
break;
case "turnRound"://掉头
dcWarning.setWarningType(5);
dcWarning.setWarningSubclass("5-3");
break;
//case "crossLane"://压线
// dcWarning.setWarningType();
// break;
//case "turnRound"://掉头
// dcWarning.setWarningType();
// break;
case "wrongDirection"://逆行
warningType = "逆行";
dcWarning.setWarningType(5);
dcWarning.setWarningSubclass("5-1");
break;
case "pedestrian"://行人
warningType = "行人";
dcWarning.setWarningType(2);
dcWarning.setWarningSubclass("2-1");
break;
case "abandonedObject"://抛洒物
warningType = "抛洒物";
dcWarning.setWarningType(7);
dcWarning.setWarningType(6);
dcWarning.setWarningSubclass("6-4");
break;
default://其他
warningType = "其他";
dcWarning.setWarningType(99);
dcWarning.setWarningSubclass("99-1");
}
String direction = "";
if (Objects.equals(directionName, "上行")) {

38
zc-business/src/main/java/com/zc/business/controller/StatusController.java

@ -6,7 +6,9 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.Status;
import com.zc.business.service.impl.DcDeviceServiceImpl;
import com.zc.business.service.impl.StatusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -22,7 +24,6 @@ import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
import static com.ruoyi.common.utils.PageUtils.startPage;
@Api(tags="设备状态")
@RestController
@ -31,6 +32,8 @@ public class StatusController extends BaseController {
@Autowired
private StatusService statusService;
@Autowired
private DcDeviceServiceImpl dcDeviceService;
//设备列表
@ApiOperation("设备状态列表按时间和类型")
@ -94,11 +97,39 @@ public class StatusController extends BaseController {
return AjaxResult.success(mapSort);
}
@ApiOperation("根据设备Id查询折线图数据")
@GetMapping("/deviceStatusList")
public AjaxResult getDeviceStatusList(Long deviceId) {
LocalDateTime thirtyDaysAgo = LocalDateTime.now().minusDays(30);
LocalDateTime currentTime = LocalDateTime.now();
Status status = new Status();
status.setStartTime(thirtyDaysAgo);
status.setTime(currentTime);
status.setDeviceId(deviceId);
List<Status> listStatus = statusService.list(status);
// Group by day and calculate average successRate
Map<Integer, Double> averageSuccessRateByDay = listStatus.stream()
.collect(Collectors.groupingBy(s -> s.getTime().getDayOfMonth(),
Collectors.averagingDouble(s -> Double.parseDouble(s.getSuccessRate().replace("%","")))));
if (averageSuccessRateByDay.isEmpty()) {
return AjaxResult.success("暂无数据");
}
return AjaxResult.success(averageSuccessRateByDay);
}
//按类型划分设备
@ApiOperation("设备状态列表按类型")
@GetMapping ("/type")
public AjaxResult getTypeList()
{
List<DcDevice> dcDeviceList = dcDeviceService.numberOfDevicesByType();
HashMap<String, String> itemTypeMap = new HashMap<>();
itemTypeMap.put("1-1", "高清网络枪型固定摄像机");
itemTypeMap.put("1-2", "高清网络球形摄像机");
@ -122,6 +153,7 @@ public class StatusController extends BaseController {
Status status = new Status();
status.setStartTime(todayStart);
status.setTime(currentTime);
status.setUseState(1);
List<Status> listStatus = statusService.list(status);
//根据时间分组
Map<Integer, List<Status>> map = listStatus.stream()
@ -151,8 +183,10 @@ public class StatusController extends BaseController {
maps.put("sucessRate",String.format("%.2f", sucessRate)+"%");
//离线率
maps.put("failRate",failRate);
//已使用数量
maps.put("sumUseState",String.valueOf(groupItems.size()));
//总数
maps.put("sum",String.valueOf(groupItems.size()));
maps.put("sum", String.valueOf(dcDeviceList.stream().filter(item -> Objects.equals(item.getDeviceType(), entrys.getKey())).map(DcDevice::getSumAll).collect(Collectors.toList()).get(0)));
if(itemTypeMap.get(entrys.getKey())!=null) {
subMap.put(itemTypeMap.get(entrys.getKey()), maps);
}

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

@ -30,10 +30,10 @@ import javax.annotation.Resource;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.ruoyi.common.constant.Constants.HTTP;
import static java.util.Comparator.comparing;
/**
@ -392,6 +392,59 @@ 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("distance",Math.abs(pileNumTransformMetre(item.get("pileNum").toString()) - pileNumDistance));
return item;
})
.sorted(comparing(item -> Integer.parseInt(item.get("distance").toString())))
.collect(Collectors.toList());
if (upCameraList.size() > 0 && Integer.parseInt(upCameraList.get(0).get("distance").toString()) < 2000){
result.put("upCamera",upCameraList.get(0));
} else {
result.put("upCamera",new HashMap<>());
}
//下行列表
List<Map<String,Object>> downCameraList = datalist.stream()
.filter(item -> "1".equals(item.get("camOrientation")))
.map(item->{
item.put("distance",Math.abs(pileNumTransformMetre(item.get("pileNum").toString()) - pileNumDistance));
return item;
})
.sorted(comparing(item -> Integer.parseInt(item.get("distance").toString())))
.collect(Collectors.toList());
if (downCameraList.size() > 0 && Integer.parseInt(downCameraList.get(0).get("distance").toString()) < 2000){
result.put("downCamera",downCameraList.get(0));
} else {
result.put("downCamera",new HashMap<>());
}
return AjaxResult.success(result);
}
/**
* 获取视频流信息
*/

24
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,6 +82,7 @@ public class WeatherForecastController extends BaseController {
for (DcRegion dcRegion : list) {
try {
OkHttp okHttp = new OkHttp();
Response response // 请求响应
@ -103,6 +102,9 @@ public class WeatherForecastController extends BaseController {
return AjaxResult.error(jsonResult.getInteger("code"), "请求失败");
}
}
} catch (Exception e) {
//return AjaxResult.error(500, "连接异常,请检查网络");
}
}
}
redisCache.setCacheObject(METEOROLOGICALEARLYWARNING, jsonObject, 13, TimeUnit.MINUTES);
@ -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,6 +152,9 @@ public class WeatherForecastController extends BaseController {
JSONObject jsonObject = new JSONObject();
for (DcRegion dcRegion : list) {
try {
OkHttp okHttp = new OkHttp();
Response response // 请求响应
@ -179,6 +184,11 @@ public class WeatherForecastController extends BaseController {
return AjaxResult.error(jsonResult.getInteger("code"), "请求失败");
}
}
} catch (Exception e) {
//return AjaxResult.error(500, "连接异常,请检查网络");
}
}

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

@ -39,7 +39,7 @@ public class DcDevice {
@ApiModelProperty("设备编号")
private String deviceCode;
@ApiModelProperty("设备类型")
private Integer deviceType;
private String deviceType;
@ApiModelProperty("设备图片")
private String deviceImg;
@ApiModelProperty("安装日期")
@ -73,6 +73,8 @@ public class DcDevice {
@TableField(exist = false)
private String longitude;
@TableField(exist = false)
private String sumAll;
@TableField(exist = false)
private String latitude;
//设备厂商
@TableField(exist = false)

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;
/**
* 控制指令
*/

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

@ -293,4 +293,8 @@ public class DcEvent {
/** 备注 */
private String remark;
private String subclass;
}

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();

9
zc-business/src/main/java/com/zc/business/domain/Status.java

@ -117,6 +117,8 @@ public class Status {
@Excel(name = "状态")
private int deviceStatus;
@Excel(name = "使用状态")
private int useState;
@ -228,4 +230,11 @@ public class Status {
private String type;
public int getUseState() {
return useState;
}
public void setUseState(int useState) {
this.useState = useState;
}
}

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

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"),

22
zc-business/src/main/java/com/zc/business/enums/ValueConverter.java

@ -18,7 +18,7 @@ public class ValueConverter {
// 静态映射,用于存储转换关系 事件主类转换
private static final Map<Integer, Integer> valueMappingHost = new HashMap<>();
// 静态映射,用于存储转换关系 事件子类转换
// 静态映射,用于存储转换关系 事件子类转换(注:子类7和10子类不能转需要前端自传)
private static final Map<String, String> valueMappingSon = new HashMap<>();
// 静态映射,用于存储转换关系 事件源转换
private static final Map<Integer, Integer> valueMappingSource = new HashMap<>();
@ -36,9 +36,12 @@ public class ValueConverter {
valueMappingHost.put(4, 2);
valueMappingHost.put(5, 11);
valueMappingHost.put(6, 6);
valueMappingHost.put(7, 6);
valueMappingHost.put(7, 7);
valueMappingHost.put(8, 10);
valueMappingHost.put(9, 1);
valueMappingHost.put(10, 1);
valueMappingHost.put(11, 2);
valueMappingHost.put(99, 11);
valueMappingSon.put("1-1", "4-1");
valueMappingSon.put("1-2", "4-1");
valueMappingSon.put("2-1", "5-1");
@ -55,9 +58,18 @@ public class ValueConverter {
valueMappingSon.put("4-7", "2-1");
valueMappingSon.put("4-8", "2-1");
valueMappingSon.put("4-9", "2-1");
valueMappingSon.put("4-10", "2-1");
valueMappingSon.put("5-1", "11-1");
valueMappingSon.put("5-2", "11-1");
valueMappingSon.put("5-3", "11-1");
valueMappingSon.put("5-4", "11-1");
valueMappingSon.put("5-5", "11-1");
valueMappingSon.put("5-6", "11-1");
valueMappingSon.put("5-7", "11-1");
valueMappingSon.put("6-1", "6-1");
valueMappingSon.put("7-1", "6-3");
valueMappingSon.put("6-2", "6-5");
valueMappingSon.put("6-3", "6-5");
valueMappingSon.put("6-4", "6-3");
valueMappingSon.put("8-1", "10-1");
valueMappingSon.put("8-2", "10-9");
valueMappingSon.put("8-3", "10-4");
@ -71,6 +83,10 @@ public class ValueConverter {
valueMappingSon.put("9-1", "1-3");
valueMappingSon.put("9-2", "1-3");
valueMappingSon.put("9-3", "1-3");
valueMappingSon.put("11-1", "2-1");
valueMappingSon.put("11-2", "2-1");
valueMappingSon.put("11-3", "2-1");
valueMappingSon.put("99-1", "11-1");
}
}

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

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

@ -15,4 +15,7 @@ import java.util.List;
public interface DcDeviceMapper extends BaseMapper<DcDevice> {
List<DcDevice> selectDcDeviceList(DcDevice dcDevice);
List<DcDevice> numberOfDevicesByType();
}

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

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

@ -19,7 +19,7 @@ public interface DcWarningMapper
* @param id 预警信息主键
* @return 预警信息
*/
public HashMap<String,Object> selectDcWarningById(Integer id);
public DcWarning selectDcWarningById(String id);
/**
* 查询预警信息列表
@ -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);
}

117
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;
/**
@ -113,6 +113,12 @@ public class DeviceMessageHandler {
// 气象检测器
if (IotProductEnum.WEATHER_DETECTOR.value().equals(productId)) {
weatherDetectorMessageHandle(data);
return;
}
// 护栏碰撞
if (IotProductEnum.GUARDRAIL_COLLISION.value().equals(productId)) {
guardrailCollisionDeviceMessageHandle(data);
}
}
@ -227,26 +233,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");
@ -265,7 +272,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);
//自动确定状态
@ -324,6 +331,7 @@ public class DeviceMessageHandler {
/**
* 一站式情况调查站设备消息处理入口
*
* @param msg 设备消息
*/
private void oneStopDeviceMessageHandle(JSONObject msg) {
@ -331,8 +339,87 @@ 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 = "碰撞";
dcWarning.setWarningType(9);
dcWarning.setWarningSubclass("9-1");
} else if (Objects.equals(alarmType, "2")) {
eventType = "只倾斜无碰撞";
dcWarning.setWarningType(9);
dcWarning.setWarningSubclass("9-2");
} else if (Objects.equals(alarmType, "3")) {
eventType = "碰撞后倾斜";
dcWarning.setWarningType(9);
dcWarning.setWarningSubclass("9-3");
} else if (Objects.equals(alarmType, "4")) {
eventType = "应急车道被占";
dcWarning.setWarningType(4);
dcWarning.setWarningSubclass("4-7");
} else if (Objects.equals(alarmType, "5")) {
eventType = "车离开应急车道";
dcWarning.setWarningType(4);
dcWarning.setWarningSubclass("4-8");
}
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) {
@ -350,19 +437,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);

5
zc-business/src/main/java/com/zc/business/service/DcEmergencyPlansService.java

@ -1,5 +1,6 @@
package com.zc.business.service;
import com.alibaba.fastjson.JSONArray;
import com.zc.business.domain.*;
import java.util.List;
@ -62,7 +63,7 @@ public interface DcEmergencyPlansService {
* @param dcEventAnDcEmergencyPlans 事件数据 事件预案数据
* @return 结果
*/
int executionEventConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans);
JSONArray executionEventConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans);
/**
* 感知事件确定
@ -70,7 +71,7 @@ public interface DcEmergencyPlansService {
* @param dcEventAnDcEmergencyPlans 事件数据 事件预案数据
* @return 结果
*/
int executionWarningConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans);
JSONArray executionWarningConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans);
/**
* 感知事件-情报板自动生成

2
zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java

@ -77,4 +77,6 @@ public interface IDcDeviceService extends IService<DcDevice> {
Long statisticalAnomalyDevice();
List<DcDevice> devicePileNumberQueryDevice(Map<String,Object> parameter);
List<DcDevice> numberOfDevicesByType();
}

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);
/**
* 修改事件信息
*

14
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接口
@ -20,7 +22,7 @@ public interface IDcWarningService
* @param id 预警信息主键
* @return 预警信息
*/
public HashMap<String,Object> selectDcWarningById(Integer id);
public DcWarning selectDcWarningById(String id);
/**
* 查询预警信息列表
@ -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);
}

12
zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java

@ -384,6 +384,7 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
public Long statisticalAnomalyDevice() {
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DcDevice::getDeviceState, 0).or().isNull(DcDevice::getDeviceState);
lambdaQueryWrapper.eq(DcDevice::getUseState,1);
return (long) list(lambdaQueryWrapper).size();
}
@ -395,16 +396,20 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
String deviceType = String.valueOf(parameter.get("deviceType"));
String childType = String.valueOf(parameter.get("childType"));
String deviceState = String.valueOf(parameter.get("deviceState"));
String direction = String.valueOf(parameter.get("direction"));
DcDevice device = new DcDevice();
if (!Objects.equals(childType, "null")) {
device.setChildType(childType);
}
if (!Objects.equals(deviceType, "null")) {
device.setDeviceType(Integer.valueOf(deviceType));
device.setDeviceType(deviceType);
}
if (!Objects.equals(deviceState, "null")) {
device.setDeviceState(deviceState);
}
if (!Objects.equals(direction, "null")) {
device.setDirection(direction);
}
List<DcDevice> list = listDevice(device);
if (startStakeMarks != null && endStakeMarks != null) {
Integer startStakeMark = Integer.parseInt(startStakeMarks.get(0) + startStakeMarks.get(1));
@ -442,6 +447,11 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
return dcDevices;
}
@Override
public List<DcDevice> numberOfDevicesByType() {
return dcDeviceMapper.numberOfDevicesByType();
}
public static <T> List<T> castList(Object obj, Class<T> clazz) {
List<T> result = new ArrayList<T>();
if (obj instanceof List<?>) {

86
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;
}
/**
@ -96,9 +109,9 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
return dcEmergencyPlansList.stream()
.filter(dcEmergencyPlans -> {
String triggerMechanism = dcEmergencyPlans.getTriggerMechanism();
JSONObject triggerJson = JSONObject.parseObject(triggerMechanism);
String eventSubclass = triggerJson.get("eventSubclass").toString();
return eventSubclass.equals(event.getEventSubclass());
// JSONObject triggerJson = JSONObject.parseObject(triggerMechanism);
// String eventSubclass = triggerJson.get("eventSubclass").toString();
return triggerMechanism.equals(event.getSubclass());
})
.collect(Collectors.toList());
} else if (eventType == EventTypeEnum.VEHICLE_MALFUNCTION.getCode()) {
@ -106,11 +119,11 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
return dcEmergencyPlansList.stream()
.filter(dcEmergencyPlans -> {
String triggerMechanism = dcEmergencyPlans.getTriggerMechanism();
JSONObject triggerJson = JSONObject.parseObject(triggerMechanism);
String locationType = triggerJson.get("locationType").toString();
// JSONObject triggerJson = JSONObject.parseObject(triggerMechanism);
// String locationType = triggerJson.get("locationType").toString();
DcEventVehicleAccident dcEventVehicleAccident = event.getDcEventVehicleAccident();
String eventLocationType = dcEventVehicleAccident.getLocationType().toString();
return locationType.equals(eventLocationType);
return triggerMechanism.equals(eventLocationType);
})
.collect(Collectors.toList());
} else if (eventType == EventTypeEnum.TRAFFIC_CONTROL.getCode()) {
@ -118,13 +131,13 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
return dcEmergencyPlansList.stream()
.filter(dcEmergencyPlans -> {
String triggerMechanism = dcEmergencyPlans.getTriggerMechanism();
JSONObject triggerJson = JSONObject.parseObject(triggerMechanism);
// JSONObject triggerJson = JSONObject.parseObject(triggerMechanism);
// 分类
Integer classify = Integer.parseInt(triggerJson.get("classify").toString());
// Integer classify = Integer.parseInt(triggerJson.get("classify").toString());
// 事件--交通管制数据
DcEventTrafficControl dcEventTrafficControl = event.getDcEventTrafficControl();
Integer eventClassify = Integer.parseInt(dcEventTrafficControl.getClassify().toString());
return classify.equals(eventClassify);
return Integer.parseInt(triggerMechanism) == eventClassify;
})
.collect(Collectors.toList());
} else {
@ -394,7 +407,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
* @return 结果
*/
@Override
public int executionEventConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) {
public JSONArray executionEventConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) {
// 获取事件数据
DcEvent dcEvent = dcEventAnDcEmergencyPlans.getDcEvent();
// 方向
@ -453,7 +466,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
eventType == EventTypeEnum.ROADBLOCK_CLEARANCE.getCode()) {
String content = Arrays.stream(EventSubclassEnum.values())
.filter(eventSubclassEnum -> eventSubclassEnum.getCode().equals(dcEvent.getEventSubclass()))
.filter(eventSubclassEnum -> eventSubclassEnum.getCode().equals(dcEvent.getSubclass()))
.findFirst()
.map(EventSubclassEnum::getText)
.orElse("请注意前方危险");
@ -497,7 +510,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
* @return
*/
@Override
public int executionWarningConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) {
public JSONArray executionWarningConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) {
// 获取事件数据
DcWarning dcWarning = dcEventAnDcEmergencyPlans.getDcWarning();
@ -514,7 +527,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
* @param dcEventAnDcEmergencyPlans 事件数据 事件预案数据
* @return
*/
public int executionConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans,
public JSONArray executionConfirmation(DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans,
String stakeMark,
String direction,
String id) {
@ -572,14 +585,15 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
eventPlanAssoc.setExecutingControlDevice(deviceIds.toString().replaceFirst(";", ""));
eventPlanAssoc.setExecutingControlResult(resultArray.toJSONString());
eventPlanAssoc.setCreateTime(DateUtils.getNowDate());
return eventPlanAssocMapper.insertEventPlanAssoc(eventPlanAssoc);
eventPlanAssocMapper.insertEventPlanAssoc(eventPlanAssoc);
} else {
EventPlanAssoc selectEventPlanAssoc = eventPlanAssocMapper.selectByEventId(eventPlanAssoc);
selectEventPlanAssoc.setUpdateTime(DateUtils.getNowDate());
selectEventPlanAssoc.setRecoveredControlDevice(deviceIds.toString().replaceFirst(";", ""));
selectEventPlanAssoc.setRecoveredControlResult(resultArray.toJSONString());
return eventPlanAssocMapper.updateEventPlanAssoc(selectEventPlanAssoc);
eventPlanAssocMapper.updateEventPlanAssoc(selectEventPlanAssoc);
}
return resultArray;
}
/**
@ -606,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);
@ -879,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);
// 可控设备 数据处理
@ -892,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()

96
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,98 @@ 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);
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);
}
return flag;
}
/**
* 修改事件信息
*

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

@ -1,11 +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.*;
import com.zc.business.enums.ValueConverter;
import com.zc.business.mapper.DcEventMapper;
import com.zc.business.mapper.DcWarningMapper;
@ -16,6 +16,8 @@ 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.Calendar;
import java.util.HashMap;
import java.util.List;
@ -42,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);
}
@ -74,9 +76,11 @@ public class DcWarningServiceImpl implements IDcWarningService
public int insertDcWarning(DcWarning dcWarning)
{
dcWarning.setCreateTime(DateUtils.getNowDate());
if (dcWarning.getId()==null) {
//设置事件Id UUID无下划线格式32
String uuid = IdUtils.fastSimpleUUID();
dcWarning.setId(uuid);
}
return dcWarningMapper.insertDcWarning(dcWarning);
}
@ -144,8 +148,13 @@ public class DcWarningServiceImpl implements IDcWarningService
if (dcWarning.getWarningType()!=null) {
dcEvent.setEventType((long) ValueConverter.convertValueHost(dcWarning.getWarningType()));//事件主类
}
if (StringUtils.isBlank(dcWarning.getWarningSubclass())) {
dcEvent.setEventSubclass(ValueConverter.convertValueSon(dcWarning.getWarningSubclass()));//事件子类
if (StringUtils.isBlank(dcWarning.getWarningSubclass())&&dcWarning.getWarningType()!=7&&
dcWarning.getWarningType()!=10) {
dcEvent.setEventSubclass(ValueConverter.convertValueSon(dcWarning.getWarningSubclass()));//事件子类(7与10不转)
}
if (StringUtils.isBlank(dcWarning.getWarningSubclass())&&(dcWarning.getWarningType()==7||
dcWarning.getWarningType()==10)){
dcEvent.setEventSubclass(dcWarning.getWarningSubclass());//事件子类(7与10主类对应的子类直接set)
}
dcEvent.setEventTitle(dcWarning.getWarningTitle());//标题
dcEvent.setLang(dcWarning.getLane());//车道
@ -170,4 +179,230 @@ 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());//处置人员
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);
}
//批量更改感知事件状态
dcWarningMapper.batchUpdateState(SecurityUtils.getUserId(),dcWarningList);
//批量插入事件表
dcEventService.batchInsertDcEventWarning(dcEventList);
}
} else {
return AjaxResult.error("请选择感知事件");
}
return AjaxResult.success("批量操作成功");
}
}

2
zc-business/src/main/java/com/zc/business/service/impl/DcWeatherMonitoringServiceImpl.java

@ -45,7 +45,7 @@ public class DcWeatherMonitoringServiceImpl implements IDcWeatherMonitoringServi
DcDevice dcDevice = new DcDevice();
dcDevice.setDeviceType(3);
dcDevice.setDeviceType("3");
List<DcDevice> deviceList = dcDeviceService.listDevice(dcDevice);
//正常路段里程

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

6
zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml

@ -105,4 +105,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="numberOfDevicesByType" parameterType="dcDevice" resultMap="DcDevice">
SELECT COALESCE(child_type, device_type) AS device_type, COUNT(*) AS sumAll
FROM dc_device
GROUP BY device_type, child_type;
</select>
</mapper>

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

@ -76,6 +76,7 @@
<result property="roadName" column="road_name" />
<result property="organizationName" column="organization_name" />
<result property="isPerceived" column="is_perceived" />
<result property="subclass" column="subclass" />
</resultMap>
@ -144,6 +145,7 @@
SELECT
id,
dc_event.dept_id as dept_id,
sys_dept.dept_name,
stake_mark,
CASE direction
WHEN '1' THEN '菏泽方向'
@ -257,6 +259,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,
@ -444,7 +447,7 @@
WHEN '10-9' THEN'其他'
WHEN '11-1' THEN'其他事件'
END AS event_subclass,
dc_event.event_subclass AS subclass,
dc_event.event_cause,
dc_event.description,
dc_event.event_state,
@ -542,6 +545,67 @@
<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 dc_event

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

@ -59,10 +59,12 @@ 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>
<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>
@ -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>

10
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
@ -99,6 +99,12 @@
<if test="status.type != null">
AND (d.device_type = #{status.type} or d.child_type=#{status.type})
</if>
<if test="status.deviceId != null">
AND s.device_id = #{status.deviceId}
</if>
<if test="status.useState != null">
AND d.use_state = #{status.useState}
</if>
</where>
</select>

Loading…
Cancel
Save