From bf86c2ddaeddb32d55689d2a584fa2472cdba761 Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Tue, 2 Apr 2024 18:25:48 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E6=83=85=E6=8A=A5=E6=9D=BF=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E8=AE=B0=E5=BD=95=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DcBoardReleaseLogController.java | 18 ++++++++++++++++++ .../zc/business/domain/DcBoardReleaseLog.java | 6 +++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcBoardReleaseLogController.java b/zc-business/src/main/java/com/zc/business/controller/DcBoardReleaseLogController.java index 6a926a72..8d034717 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcBoardReleaseLogController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcBoardReleaseLogController.java @@ -1,8 +1,11 @@ package com.zc.business.controller; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletResponse; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -62,6 +65,21 @@ public class DcBoardReleaseLogController extends BaseController public void export(HttpServletResponse response, DcBoardReleaseLog dcBoardReleaseLog) { List list = dcBoardReleaseLogService.selectDcBoardReleaseLogList(dcBoardReleaseLog); + for (DcBoardReleaseLog releaseLog : list) { + String content = releaseLog.getReleaseContent(); + List> contentList = JSONArray.parseObject(content,List.class); + if (contentList != null){ + StringBuilder contentText = new StringBuilder(); + for (int i = 0; i < contentList.size(); i++) { + String contentItem = contentList.get(i+1).get("CONTENT").toString().replace("\\\\n"," "); + contentText.append(i).append(".").append(contentItem).append("\n"); + } + releaseLog.setReleaseContent(contentText.toString()); + } else { + releaseLog.setReleaseContent(""); + } + + } ExcelUtil util = new ExcelUtil<>(DcBoardReleaseLog.class); util.exportExcel(response, list, "情报板内容发布日志数据"); } diff --git a/zc-business/src/main/java/com/zc/business/domain/DcBoardReleaseLog.java b/zc-business/src/main/java/com/zc/business/domain/DcBoardReleaseLog.java index 262dc44c..00eed7d1 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcBoardReleaseLog.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcBoardReleaseLog.java @@ -40,7 +40,7 @@ public class DcBoardReleaseLog extends BaseEntity private String stakeMark; /** 方向1-上行,2-中,3-下行 */ - @Excel(name = "方向1-上行,2-中,3-下行") + @Excel(name = "方向",readConverterExp = "1=上行,2=中,3=下行") @ApiModelProperty(value="方向1-上行,2-中,3-下行") private String direction; @@ -50,7 +50,7 @@ public class DcBoardReleaseLog extends BaseEntity private String releaseContent; /** 发布状态(0:成功;1:失败) */ - @Excel(name = "发布状态", readConverterExp = "0=:成功;1:失败") + @Excel(name = "发布状态", readConverterExp = "0=成功,1失败") @ApiModelProperty(value="发布状态0=:成功;1:失败") private String releaseStatus; @@ -81,7 +81,7 @@ public class DcBoardReleaseLog extends BaseEntity private String releaseUserId; /** 发布端 */ - @Excel(name = "发布端") + @Excel(name = "发布端", readConverterExp = "00=系统用户,01=智慧大脑,02=GIS+BIM") @ApiModelProperty(value="发布端(00=系统用户,01=智慧大脑,02=GIS+BIM") private String platform; From fdbb32a582169709d461e1711838078fdab997fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Wed, 3 Apr 2024 09:50:35 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=A9=E6=B0=94?= =?UTF-8?q?=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/handler/DeviceMessageHandler.java | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java index ec36ba9f..949a00df 100644 --- a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java +++ b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java @@ -37,6 +37,7 @@ public class DeviceMessageHandler { private final int EVENT_AI = 1; private final int EVENT_STATE = 1; private final int EVENTEND_STATE = 4; + private final int VISIBILITY_LEVEL = 8; private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Resource @@ -113,7 +114,7 @@ public class DeviceMessageHandler { // 气象检测器 if (IotProductEnum.WEATHER_DETECTOR.value().equals(productId)) { weatherDetectorMessageHandle(data); - return; + return; } // 护栏碰撞 @@ -168,8 +169,12 @@ public class DeviceMessageHandler { dcWarning.setWarningTime(new Date(captureTime)); // 信息来源 dcWarning.setWarningSource(WarningSourceEnum.VIDEO_AI.getCode()); + // 事件主类型 dcWarning.setWarningType(data.getInteger("warningType")); + if (data.getInteger("warningType") == VISIBILITY_LEVEL) { + dcWarning.setWarningLevel(data.getInteger("visibilityLevel")); + } String warningSubclass = data.getString("warningSubclass"); // 子类型 @@ -181,10 +186,10 @@ public class DeviceMessageHandler { //方向 if (arr[2] != null) { if (arr[2].equals("上行")) { - direction=arr[0]+" "+arr[1]+ " 菏泽方向 "; + direction = arr[0] + " " + arr[1] + " 菏泽方向 "; } if (arr[2].equals("下行")) { - direction=arr[0]+" "+arr[1]+ " 济南方向 "; + direction = arr[0] + " " + arr[1] + " 济南方向 "; } } @@ -349,7 +354,7 @@ public class DeviceMessageHandler { * @param msg 设备消息 */ private void oneStopDeviceMessageHandle(JSONObject msg) { - dcTrafficSectionDataService.processRealtimeOneStopMessage(msg); + dcTrafficSectionDataService.processRealtimeOneStopMessage(msg); } @@ -445,12 +450,12 @@ public class DeviceMessageHandler { */ private void weatherDetectorMessageHandle(JSONObject msg) { - // DcMeteorologicalDetectorData meteorologicalDetectorData = (DcMeteorologicalDetectorData) msg.get("properties"); + // DcMeteorologicalDetectorData meteorologicalDetectorData = (DcMeteorologicalDetectorData) msg.get("properties"); JSONObject jsonObject = (JSONObject) msg.get("properties"); DcMeteorologicalDetectorData meteorologicalDetectorData = jsonObject.toJavaObject(DcMeteorologicalDetectorData.class); - JSONObject jsonObjectHeaders = (JSONObject)msg.get("headers"); + JSONObject jsonObjectHeaders = (JSONObject) msg.get("headers"); String parts = jsonObjectHeaders.getString("deviceName"); String[] strings = parts.split("-"); String deviceName = strings[0]; @@ -474,19 +479,19 @@ public class DeviceMessageHandler { mdDeviceData.setTimeStamp(new Date()); mdDeviceData.setCreatorUserId("自动存储"); - Map expands = new HashMap<>(); - expands.put("rainFall",meteorologicalDetectorData.getRainfall()); //雨量 - 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("waterThick",meteorologicalDetectorData.getWaterFilmIceSnowValue()); //水膜厚度 - expands.put("wet",meteorologicalDetectorData.getWetSlipperyCoefficient()); //湿滑 - expands.put("rainXingTai",meteorologicalDetectorData.getPrecipitationType()); //雨量降水形态 - expands.put("visibility",meteorologicalDetectorData.getVisibility()); //能见度 - expands.put("remoteRoadSurfaceTemperature",meteorologicalDetectorData.getRemoteRoadSurfaceTemperature()); //路面温度 - expands.put("pathContactZhuang",meteorologicalDetectorData.getRemoteRoadSurfaceStatus()); //路面状况 + Map expands = new HashMap<>(); + expands.put("rainFall", meteorologicalDetectorData.getRainfall()); //雨量 + 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("waterThick", meteorologicalDetectorData.getWaterFilmIceSnowValue()); //水膜厚度 + expands.put("wet", meteorologicalDetectorData.getWetSlipperyCoefficient()); //湿滑 + expands.put("rainXingTai", meteorologicalDetectorData.getPrecipitationType()); //雨量降水形态 + expands.put("visibility", meteorologicalDetectorData.getVisibility()); //能见度 + expands.put("remoteRoadSurfaceTemperature", meteorologicalDetectorData.getRemoteRoadSurfaceTemperature()); //路面温度 + expands.put("pathContactZhuang", meteorologicalDetectorData.getRemoteRoadSurfaceStatus()); //路面状况 mdDeviceData.setExpands(JSONObject.toJSONString(expands)); From ca0ebb2cc8f98843549fe9de4d563cb55df5c2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Wed, 3 Apr 2024 09:51:23 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=A9=E6=B0=94?= =?UTF-8?q?=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zc/business/message/device/handler/DeviceMessageHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java index 949a00df..d2c12a66 100644 --- a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java +++ b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java @@ -172,6 +172,7 @@ public class DeviceMessageHandler { // 事件主类型 dcWarning.setWarningType(data.getInteger("warningType")); + //异常天气等级 if (data.getInteger("warningType") == VISIBILITY_LEVEL) { dcWarning.setWarningLevel(data.getInteger("visibilityLevel")); } From 6631a1ccd8c1baba52dc6b8c88f9df08d8d5715e Mon Sep 17 00:00:00 2001 From: zhaoxianglong Date: Wed, 3 Apr 2024 15:06:28 +0800 Subject: [PATCH 04/18] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=93=8D=E4=BD=9C=E5=8A=9F=E8=83=BD=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zc/business/controller/DcDeviceController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index 1cee37f7..b71a2ad2 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -459,7 +459,7 @@ public class DcDeviceController extends BaseController { JSONObject functionJSONObject = (JSONObject) JSON.toJSON(function); //JSONObject functionJSONObject = (JSONObject) JSON.toJSON(function.toString()) ; String functionId = functionJSONObject.getString("functionId"); - JSONObject jsonObject = functionJSONObject.getJSONObject("params") == null?functionJSONObject.getJSONObject("params"):new JSONObject(); + JSONObject jsonObject = functionJSONObject.getJSONObject("params") != null?functionJSONObject.getJSONObject("params"):new JSONObject(); resultArray.add(getResult(device, iotDeviceId, functionId, jsonObject)); } } From 128c6f3ca61876e41d8c91064e0aff5f03c4ab59 Mon Sep 17 00:00:00 2001 From: "Mr.Wang" Date: Wed, 3 Apr 2024 15:31:57 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=BD=93=E5=A4=A9=E8=AE=BE=E5=A4=87=E6=8C=87=E5=AE=9A=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zc/business/controller/DcDeviceController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index b71a2ad2..c77cb89c 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -247,7 +247,7 @@ public class DcDeviceController extends BaseController { JSONObject formatValue = JSON.parseObject(jsonObject.get("formatValue").toString()); map.put("1", formatValue.get("1")); map.put("3", formatValue.get("3")); - map.put("timestamp", jsonObject.get("timestamp")); + map.put("timestamp", jsonObject.get("equipmentReportingTime")); list.add(map); }); return AjaxResult.success(list); From 416dbfa3f9a9de0f85adaaad489820644d6dfc78 Mon Sep 17 00:00:00 2001 From: "Mr.Wang" Date: Wed, 3 Apr 2024 15:34:42 +0800 Subject: [PATCH 06/18] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=BD=93=E5=A4=A9=E8=AE=BE=E5=A4=87=E6=8C=87=E5=AE=9A=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zc/business/controller/DcDeviceController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index c77cb89c..00b09ef1 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -247,7 +247,7 @@ public class DcDeviceController extends BaseController { JSONObject formatValue = JSON.parseObject(jsonObject.get("formatValue").toString()); map.put("1", formatValue.get("1")); map.put("3", formatValue.get("3")); - map.put("timestamp", jsonObject.get("equipmentReportingTime")); + map.put("timestamp", formatValue.get("equipmentReportingTime")); list.add(map); }); return AjaxResult.success(list); From 30447a66552fc4eb2a8ce52f4162f3b0bb68633d Mon Sep 17 00:00:00 2001 From: "Mr.Wang" Date: Wed, 3 Apr 2024 15:52:09 +0800 Subject: [PATCH 07/18] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=BD=93=E5=A4=A9=E8=AE=BE=E5=A4=87=E6=8C=87=E5=AE=9A=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zc/business/controller/DcDeviceController.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index 00b09ef1..06802610 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -240,7 +240,7 @@ public class DcDeviceController extends BaseController { Object data = JSON.parseObject(queryDeviceProperties(deviceId, propertyId, props).get("data").toString()).get("data"); JSONArray dataArray = JSON.parseArray(data.toString()); - List list = new ArrayList<>(); + List> list = new ArrayList<>(); dataArray.forEach(o -> { Map map = new HashMap<>(); JSONObject jsonObject = JSON.parseObject(o.toString()); @@ -250,6 +250,12 @@ public class DcDeviceController extends BaseController { map.put("timestamp", formatValue.get("equipmentReportingTime")); list.add(map); }); + Collections.sort(list, new Comparator>() { + @Override + public int compare(Map map1, Map map2) { + return map1.get("timestamp").toString().compareTo(map2.get("timestamp").toString()); + } + }); return AjaxResult.success(list); } From 2a3bea215165c22b283caa11587daa3c7f2eb609 Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Wed, 3 Apr 2024 16:08:13 +0800 Subject: [PATCH 08/18] =?UTF-8?q?=E9=AB=98=E9=80=9F=E5=BF=AB=E6=8A=A5?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/controller/WordController.java | 123 +++++++++--------- 1 file changed, 65 insertions(+), 58 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/WordController.java b/zc-business/src/main/java/com/zc/business/controller/WordController.java index b2879914..775ff31f 100644 --- a/zc-business/src/main/java/com/zc/business/controller/WordController.java +++ b/zc-business/src/main/java/com/zc/business/controller/WordController.java @@ -128,68 +128,75 @@ public class WordController { PoiUtil.createHeading2(doc,"天气情况统计"); - XWPFTable table = doc.createTable(9, 25); - //列宽自动分割 - CTTblWidth infoTableWidth = table.getCTTbl().addNewTblPr().addNewTblW(); - infoTableWidth.setType(STTblWidth.DXA); - infoTableWidth.setW(BigInteger.valueOf(9072)); - AjaxResult ajaxResult = weatherForecastController.hourlyWeather(); if (ajaxResult.get("code").equals(200)) { + Map>> data = (Map>>) ajaxResult.get("data"); - data.keySet().forEach(key ->{ - if ("hourlyWeather1".equals(key)){ - setTableFonts(table.getRow(1).getCell(0), "长清区"); - List> weatherList = data.get(key); - for (int i = 0; i < weatherList.size(); i++) { - OffsetDateTime offsetDateTime = OffsetDateTime.parse(weatherList.get(i).get("fxTime").toString()); - setTableFonts(table.getRow(0).getCell(i+1),offsetDateTime.format(DateTimeFormatter.ofPattern("dd日HH时"))); - setTableFonts(table.getRow(1).getCell(i+1), weatherList.get(i).get("text").toString()); - } - } else if ("hourlyWeather2".equals(key)){ - setTableFonts(table.getRow(2).getCell(0), "平阴县"); - List> weatherList = data.get(key); - for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(2).getCell(i+1), weatherList.get(i).get("text").toString()); - } - } else if ("hourlyWeather3".equals(key)){ - setTableFonts(table.getRow(3).getCell(0), "东平县"); - List> weatherList = data.get(key); - for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(3).getCell(i+1), weatherList.get(i).get("text").toString()); - } - } else if ("hourlyWeather4".equals(key)){ - setTableFonts(table.getRow(4).getCell(0), "汶上县"); - List> weatherList = data.get(key); - for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(4).getCell(i+1), weatherList.get(i).get("text").toString()); - } - } else if ("hourlyWeather5".equals(key)){ - setTableFonts(table.getRow(5).getCell(0), "梁山县"); - List> weatherList = data.get(key); - for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(5).getCell(i+1), weatherList.get(i).get("text").toString()); + if (data != null && data.size() != 0){ + + XWPFTable table = doc.createTable(9, 25); + //列宽自动分割 + CTTblWidth infoTableWidth = table.getCTTbl().addNewTblPr().addNewTblW(); + infoTableWidth.setType(STTblWidth.DXA); + infoTableWidth.setW(BigInteger.valueOf(9072)); + + data.keySet().forEach(key ->{ + if ("hourlyWeather1".equals(key)){ + setTableFonts(table.getRow(1).getCell(0), "长清区"); + List> weatherList = data.get(key); + for (int i = 0; i < weatherList.size(); i++) { + OffsetDateTime offsetDateTime = OffsetDateTime.parse(weatherList.get(i).get("fxTime").toString()); + setTableFonts(table.getRow(0).getCell(i+1),offsetDateTime.format(DateTimeFormatter.ofPattern("dd日HH时"))); + setTableFonts(table.getRow(1).getCell(i+1), weatherList.get(i).get("text").toString()); + } + } else if ("hourlyWeather2".equals(key)){ + setTableFonts(table.getRow(2).getCell(0), "平阴县"); + List> weatherList = data.get(key); + for (int i = 0; i < weatherList.size(); i++) { + setTableFonts(table.getRow(2).getCell(i+1), weatherList.get(i).get("text").toString()); + } + } else if ("hourlyWeather3".equals(key)){ + setTableFonts(table.getRow(3).getCell(0), "东平县"); + List> weatherList = data.get(key); + for (int i = 0; i < weatherList.size(); i++) { + setTableFonts(table.getRow(3).getCell(i+1), weatherList.get(i).get("text").toString()); + } + } else if ("hourlyWeather4".equals(key)){ + setTableFonts(table.getRow(4).getCell(0), "汶上县"); + List> weatherList = data.get(key); + for (int i = 0; i < weatherList.size(); i++) { + setTableFonts(table.getRow(4).getCell(i+1), weatherList.get(i).get("text").toString()); + } + } else if ("hourlyWeather5".equals(key)){ + setTableFonts(table.getRow(5).getCell(0), "梁山县"); + List> weatherList = data.get(key); + for (int i = 0; i < weatherList.size(); i++) { + setTableFonts(table.getRow(5).getCell(i+1), weatherList.get(i).get("text").toString()); + } + } else if ("hourlyWeather6".equals(key)){ + setTableFonts(table.getRow(6).getCell(0), "嘉祥县"); + List> weatherList = data.get(key); + for (int i = 0; i < weatherList.size(); i++) { + setTableFonts(table.getRow(6).getCell(i+1), weatherList.get(i).get("text").toString()); + } + } else if ("hourlyWeather7".equals(key)){ + setTableFonts(table.getRow(7).getCell(0), "巨野县"); + List> weatherList = data.get(key); + for (int i = 0; i < weatherList.size(); i++) { + setTableFonts(table.getRow(7).getCell(i+1), weatherList.get(i).get("text").toString()); + } + } else if ("hourlyWeather8".equals(key)){ + setTableFonts(table.getRow(8).getCell(0), "郓城县"); + List> weatherList = data.get(key); + for (int i = 0; i < weatherList.size(); i++) { + setTableFonts(table.getRow(8).getCell(i+1), weatherList.get(i).get("text").toString()); + } } - } else if ("hourlyWeather6".equals(key)){ - setTableFonts(table.getRow(6).getCell(0), "嘉祥县"); - List> weatherList = data.get(key); - for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(6).getCell(i+1), weatherList.get(i).get("text").toString()); - } - } else if ("hourlyWeather7".equals(key)){ - setTableFonts(table.getRow(7).getCell(0), "巨野县"); - List> weatherList = data.get(key); - for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(7).getCell(i+1), weatherList.get(i).get("text").toString()); - } - } else if ("hourlyWeather8".equals(key)){ - setTableFonts(table.getRow(8).getCell(0), "郓城县"); - List> weatherList = data.get(key); - for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(8).getCell(i+1), weatherList.get(i).get("text").toString()); - } - } - }); + }); + } else { + addDescription(doc,"暂无数据"); + } + } //换行 From e1b9eb5c86342d7aae4acd15a5d59bcf5662b911 Mon Sep 17 00:00:00 2001 From: "Mr.Wang" Date: Wed, 3 Apr 2024 16:18:58 +0800 Subject: [PATCH 09/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=A4=E8=B0=83?= =?UTF-8?q?=E8=BD=A6=E6=B5=81=E9=87=8F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zc/business/controller/DcDeviceController.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index 06802610..bc99bd59 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -31,6 +31,7 @@ import javax.validation.Valid; import java.io.IOException; import java.lang.reflect.Field; import java.util.*; +import java.util.stream.Collectors; /** * 设备Controller @@ -247,16 +248,19 @@ public class DcDeviceController extends BaseController { JSONObject formatValue = JSON.parseObject(jsonObject.get("formatValue").toString()); map.put("1", formatValue.get("1")); map.put("3", formatValue.get("3")); - map.put("timestamp", formatValue.get("equipmentReportingTime")); + map.put("timestamp", formatValue.get("equipmentReportingTime") == null? "":formatValue.get("equipmentReportingTime")); list.add(map); }); - Collections.sort(list, new Comparator>() { + List> newList = list.stream() + .filter(map-> !map.get("timestamp").equals("")) + .collect(Collectors.toList()); + Collections.sort(newList, new Comparator>() { @Override public int compare(Map map1, Map map2) { return map1.get("timestamp").toString().compareTo(map2.get("timestamp").toString()); } }); - return AjaxResult.success(list); + return AjaxResult.success(newList); } /** From 7e70d96caa4626cc6a19a904a15723f6481e571f Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Sun, 7 Apr 2024 10:59:22 +0800 Subject: [PATCH 10/18] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=90=88=E6=88=90?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DcWarningServiceImpl.java | 136 +++++++----------- 1 file changed, 52 insertions(+), 84 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index 0ad11a12..b5a36aae 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -117,12 +117,8 @@ public class DcWarningServiceImpl implements IDcWarningService String key=dcWarning.getStakeMark()+dcWarning.getDirection()+dcWarning.getWarningSource(). toString()+dcWarning.getWarningType().toString()+dcWarning.getWarningSubclass();//key,redis存储事件的key(桩号+方向+事件源+类型) String dataId = redisCache.getCacheObject(WARNINGDATA + key);//查看redis是否存在数据(id的值) - HashMap redisValueOne = redisWarningStrategy.get(redisKye+"1");//查看传入的事件类型是否配置策略1(优先级策略) - if(redisValueOne!=null){//执行策略1(暂时未定义,定义后开发) - return dcWarningMapper.insertDcWarning(dcWarning);//未定义直接走新增; - } HashMap redisValueTwo = redisWarningStrategy.get(redisKye+"2");//查看传入的事件类型是否配置策略2(延迟策略) - if (redisValueOne==null&&redisValueTwo!=null){ //执行策略2,执行到这里说明1不存在或者1未满足过滤条件 + if (redisValueTwo!=null){ //执行策略2, String strategyTime = redisValueTwo.get("strategyTime").toString();//策略时长 if (dataId==null){//如果不存在直接加入数据库,加入缓存,配置对应的过期时间 int insertDcWarning = dcWarningMapper.insertDcWarning(dcWarning);//加入数据库 @@ -147,85 +143,27 @@ public class DcWarningServiceImpl implements IDcWarningService otherConfig = map.get("otherConfig").toString(); //取出原id的配置信息 } String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息 - JSONObject jsonObjectOne = new JSONObject(otherConfig); - JSONObject jsonObjectTwo = new JSONObject(otherConfigString); - DcWarningServiceImpl dcWarningService = new DcWarningServiceImpl();//合成新的json - JSONObject jsonObject = dcWarningService.mergeJsonObjects(jsonObjectOne, jsonObjectTwo); - Integer integer = dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置 - redisCache.setCacheObject(WARNINGDATA+key,dataId,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//重新设置延迟时间 - if (integer==0){ - return 0; - } - return 1; - } - HashMap redisValueThree = redisWarningStrategy.get(redisKye+"3");//查看传入的事件类型是否配置策略3(时间窗口策略) - if (redisValueOne==null&&redisValueTwo==null&&redisValueThree!=null){ //执行策略3,执行到这里说明1不存在或者2不存在或者1未满足过滤条件 - String strategyTime = redisValueThree.get("strategyTime").toString();//策略时长 - if (dataId==null){//如果不存在直接加入数据库,加入缓存,配置对应的过期时间 - int insertDcWarning = dcWarningMapper.insertDcWarning(dcWarning);//加入数据库 - if (insertDcWarning==0){ - return 0; - } - String id = dcWarning.getId();//取出加入后的id作为value - redisCache.setCacheObject(WARNINGDATA+key,id,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//加入缓存并设置延迟时间(单位分钟) - return 1;//结束 - } - //redis存在数据,取出redis的id找对对应事件的配置,合成事件配置 - HashMap map = dcWarningMapper.selectDcWarningById(dataId); - if (map==null){//redis中有id但是数据库中没有这条数据,那就删除这条redis数据,新数据加入到数据库,并加入到redis - redisCache.deleteObject(WARNINGDATA+key); - dcWarningMapper.insertDcWarning(dcWarning); - String id = dcWarning.getId(); - redisCache.setCacheObject(WARNINGDATA+key,id,Integer.parseInt(strategyTime),TimeUnit.MINUTES); - return 1; - } - String otherConfig=""; - otherConfig = map.get("otherConfig").toString();//取出原id的配置信息 - String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息 - JSONObject jsonObjectOne = new JSONObject(otherConfig); + JSONObject jsonObjectOne = new JSONObject(otherConfig);//原始数据库数据 JSONObject jsonObjectTwo = new JSONObject(otherConfigString); - JSONObject jsonObject = new DcWarningServiceImpl().mergeJsonObjects(jsonObjectOne, jsonObjectTwo);//合成新的json - Integer integer = dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置 - if (integer==0){ - return 0; - } - return 1; - } - HashMap redisValueFour = redisWarningStrategy.get(redisKye+"4");//查看传入的事件类型是否配置策略3(自动结束策略) - if (redisValueOne==null&&redisValueTwo==null&&redisValueThree==null&&redisValueFour!=null){ //执行策略4,执行到这里说明1不存在或者2、3不存在或者1未满足过滤条件 - if (dataId==null){//如果不存在直接加入数据库,加入缓存 - int insertDcWarning = dcWarningMapper.insertDcWarning(dcWarning);//加入数据库 - if (insertDcWarning==0){ - return 0; + int videoListLength = jsonObjectOne.getJSONArray("videoList").length();//已经存在数据库的图片的长度 + if (videoListLength>=10&&jsonObjectTwo.get("videoList")!=null){//如果数据长度大于等于10,对第十位进行替换 + JSONArray videoList = jsonObjectOne.getJSONArray("videoList");//获取图片数组 + videoList.put(9,jsonObjectTwo.get("videoList")); //替换第十个元素 + jsonObjectOne.put("videoList", videoList);//更新 jsonObjectOne 中的 videoList 数组 + if (jsonObjectOne.getJSONArray("pictures").length()>=10&&jsonObjectTwo.get("pictures")!=null){ + JSONArray pictures = jsonObjectOne.getJSONArray("pictures"); + pictures.put(9,jsonObjectTwo.get("pictures")); + jsonObjectOne.put("pictures",pictures); } - String id = dcWarning.getId();//取出加入后的id作为value - redisCache.setCacheObject(WARNINGDATA+key,id,24,TimeUnit.HOURS);//加入缓存,防止redis数据累计,这里也要设置过期时间,设置为24小时 - return 1;//结束 - } - //redis存在数据,取出redis的id找对对应事件的配置,合成事件配置 - HashMap map = dcWarningMapper.selectDcWarningById(dataId); - if (map==null){//redis中有id但是数据库中没有这条数据,那就删除这条redis数据,新数据加入到数据库,并加入到redis - redisCache.deleteObject(WARNINGDATA+key); - dcWarningMapper.insertDcWarning(dcWarning); - String id = dcWarning.getId(); - redisCache.setCacheObject(WARNINGDATA+key,id); - return 1; - } - String otherConfig=""; - otherConfig = map.get("otherConfig").toString();//取出原id的配置信息 - String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息 - JSONObject jsonObjectOne = new JSONObject(otherConfig); - JSONObject jsonObjectTwo = new JSONObject(otherConfigString); - JSONObject jsonObject = new DcWarningServiceImpl().mergeJsonObjects(jsonObjectOne, jsonObjectTwo);//合成新的json - Integer integer = dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置 - redisCache.deleteObject(WARNINGDATA + key);//删除redis存储的数据 - if (integer==0){ - return 0; + redisCache.setCacheObject(WARNINGDATA+key,dataId,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//重新设置延迟时间 + return dcWarningMapper.updateOtherConfig(dataId,jsonObjectOne.toString());//修改数据库配置 } - return 1; + DcWarningServiceImpl dcWarningService = new DcWarningServiceImpl();//合成工具类 + JSONObject jsonObject = dcWarningService.mergeJsonObjects(jsonObjectOne, jsonObjectTwo); + redisCache.setCacheObject(WARNINGDATA+key,dataId,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//重新设置延迟时间 + return dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置 } return dcWarningMapper.insertDcWarning(dcWarning);//如果没有配置策略直接加入数据库; - } //优先级策略(还差优先级策略需要配置) @@ -260,10 +198,40 @@ public class DcWarningServiceImpl implements IDcWarningService String dataId = redisCache.getCacheObject(WARNINGDATA + key);//查看redis是否存在数据(id的值) HashMap redisValueOne = redisWarningStrategy.get(redisKye+"1");//查看传入的事件类型是否配置策略1(优先级策略) if(redisValueOne!=null){//执行策略1(暂时未定义,定义后开发) - + String priority = redisValueOne.get("priority").toString();//全部的优先等级 + String[] split = priority.split(","); + for (int i = 0; i < split.length; i++){ + String priorityValue=split[i];//取出当前循环的优先级类型 + String keys=dcWarning.getStakeMark()+dcWarning.getDirection()+dcWarning.getWarningSource(). + toString()+dcWarning.getWarningType().toString()+priorityValue;//redis存储事件的key + String dataIds = redisCache.getCacheObject(WARNINGDATA + keys);//查看redis是否存在数据(id的值) + if (dataIds==null){ //没有对应的优先级类型的id值,结束当前循环 + continue; + } + //redis存在数据,取出redis的id找对对应事件的配置,合成事件配置 + HashMap map = dcWarningMapper.selectDcWarningById(dataId); + if (map==null){//redis中有id但是数据库中没有这条数据,那就直接新增这个事件 + return dcWarningMapper.insertDcWarning(dcWarning); + } + String warningState = map.get("warningState").toString();//事件上报状态 + if ("1".equals(warningState)==false){ //状态不为上报,不用合成事件,删除之前的redis数据 + redisCache.deleteObject(WARNINGDATA+keys); + continue; + } + String otherConfig=""; + if (map.get("otherConfig")!=null){ + otherConfig = map.get("otherConfig").toString(); //取出原id的配置信息 + } + String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息 + JSONObject jsonObjectOne = new JSONObject(otherConfig); + JSONObject jsonObjectTwo = new JSONObject(otherConfigString); + DcWarningServiceImpl dcWarningService = new DcWarningServiceImpl();//合成新的json + JSONObject jsonObject = dcWarningService.mergeJsonObjects(jsonObjectOne, jsonObjectTwo); + return dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置 + } } HashMap redisValueTwo = redisWarningStrategy.get(redisKye+"2");//查看传入的事件类型是否配置策略2(延迟策略) - if (redisValueOne==null&&redisValueTwo!=null){ //执行策略2,执行到这里说明1不存在或者1未满足过滤条件 + if (redisValueTwo!=null){ //执行策略2,执行到这里说明1不存在或者1未满足过滤条件 String strategyTime = redisValueTwo.get("strategyTime").toString();//策略时长 if (dataId==null){//如果不存在直接加入数据库,加入缓存,配置对应的过期时间 int insertDcWarning = dcWarningMapper.insertDcWarning(dcWarning);//加入数据库 @@ -300,7 +268,7 @@ public class DcWarningServiceImpl implements IDcWarningService return 1; } HashMap redisValueThree = redisWarningStrategy.get(redisKye+"3");//查看传入的事件类型是否配置策略3(时间窗口策略) - if (redisValueOne==null&&redisValueTwo==null&&redisValueThree!=null){ //执行策略3,执行到这里说明1不存在或者2不存在或者1未满足过滤条件 + if (redisValueTwo==null&&redisValueThree!=null){ //执行策略3,执行到这里说明1不存在或者2不存在或者1未满足过滤条件 String strategyTime = redisValueThree.get("strategyTime").toString();//策略时长 if (dataId==null){//如果不存在直接加入数据库,加入缓存,配置对应的过期时间 int insertDcWarning = dcWarningMapper.insertDcWarning(dcWarning);//加入数据库 @@ -333,14 +301,14 @@ public class DcWarningServiceImpl implements IDcWarningService return 1; } HashMap redisValueFour = redisWarningStrategy.get(redisKye+"4");//查看传入的事件类型是否配置策略3(自动结束策略) - if (redisValueOne==null&&redisValueTwo==null&&redisValueThree==null&&redisValueFour!=null){ //执行策略4,执行到这里说明1不存在或者2、3不存在或者1未满足过滤条件 + if (redisValueTwo==null&&redisValueThree==null&&redisValueFour!=null){ //执行策略4,执行到这里说明1不存在或者2、3不存在或者1未满足过滤条件 if (dataId==null){//如果不存在直接加入数据库,加入缓存 int insertDcWarning = dcWarningMapper.insertDcWarning(dcWarning);//加入数据库 if (insertDcWarning==0){ return 0; } String id = dcWarning.getId();//取出加入后的id作为value - redisCache.setCacheObject(WARNINGDATA+key,id);//加入缓存????存在问题会数据累计 + redisCache.setCacheObject(WARNINGDATA+key,id,24,TimeUnit.HOURS);//加入缓存,防止redis数据累计,这里也要设置过期时间,设置为24小时 return 1;//结束 } //redis存在数据,取出redis的id找对对应事件的配置,合成事件配置 From 5832ff2a07a95f9d72a1bba16b3afa0c1b9f9b81 Mon Sep 17 00:00:00 2001 From: zhaoxianglong Date: Sun, 7 Apr 2024 11:43:27 +0800 Subject: [PATCH 11/18] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/controller/StatusController.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/StatusController.java b/zc-business/src/main/java/com/zc/business/controller/StatusController.java index 0bbc786a..aab1f2c6 100644 --- a/zc-business/src/main/java/com/zc/business/controller/StatusController.java +++ b/zc-business/src/main/java/com/zc/business/controller/StatusController.java @@ -107,7 +107,7 @@ public class StatusController extends BaseController { @GetMapping ("/rule") public AjaxResult setRule(String rule) { - redisCache.setCacheSetValue(ORDERRULE,rule); + redisCache.setCacheObject(ORDERRULE,rule); return AjaxResult.success(); } @@ -354,19 +354,19 @@ public class StatusController extends BaseController { //总数 maps.put("sum",String.valueOf(list.size())); subMap.put("全部设备",maps); -// Map ruleMap=new HashMap<>(); -// String orderRule=redisCache.getCacheObject(ORDERRULE); -// if(StringUtil.isNotEmpty(orderRule)){ -// ruleMap.put("rule",orderRule); -// subMap.put("排序规则",ruleMap); -// }else{ -// String[] rules = {"全部设备","高清网络枪型固定摄像机","高清网络球形摄像机","桥下高清网络球形摄像机","360°全景摄像机","180°全景摄像机", -// "门架式可变信息标志","雨棚可变信息标志","站前悬臂式可变信息标志","气象检测器","路段语音广播系统","护栏碰撞预警系统","毫米波雷达", -// "合流区预警系统","激光疲劳唤醒","一类交通量调查站","智能行车诱导系统"}; -// orderRule= Arrays.toString(rules); -// ruleMap.put("rule",orderRule); -// subMap.put("排序规则",ruleMap); -// } + Map ruleMap=new HashMap<>(); + String orderRule=redisCache.getCacheObject(ORDERRULE); + if(StringUtil.isNotEmpty(orderRule)){ + ruleMap.put("rule",orderRule); + subMap.put("排序规则",ruleMap); + }else{ + String[] rules = {"全部设备","高清网络枪型固定摄像机","高清网络球形摄像机","桥下高清网络球形摄像机","360°全景摄像机","180°全景摄像机", + "门架式可变信息标志","雨棚可变信息标志","站前悬臂式可变信息标志","气象检测器","路段语音广播系统","护栏碰撞预警系统","毫米波雷达", + "合流区预警系统","激光疲劳唤醒","一类交通量调查站","智能行车诱导系统"}; + orderRule= Arrays.toString(rules); + ruleMap.put("rule",orderRule); + subMap.put("排序规则",ruleMap); + } return AjaxResult.success(subMap); } From 70f05d73178b0a62b3ccf28fe9c38f084eeb10ea Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Sun, 7 Apr 2024 11:46:32 +0800 Subject: [PATCH 12/18] =?UTF-8?q?=E7=AD=96=E7=95=A5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DcWarningServiceImpl.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index b5a36aae..8b32d013 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -145,15 +145,15 @@ public class DcWarningServiceImpl implements IDcWarningService String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息 JSONObject jsonObjectOne = new JSONObject(otherConfig);//原始数据库数据 JSONObject jsonObjectTwo = new JSONObject(otherConfigString); - int videoListLength = jsonObjectOne.getJSONArray("videoList").length();//已经存在数据库的图片的长度 - if (videoListLength>=10&&jsonObjectTwo.get("videoList")!=null){//如果数据长度大于等于10,对第十位进行替换 - JSONArray videoList = jsonObjectOne.getJSONArray("videoList");//获取图片数组 - videoList.put(9,jsonObjectTwo.get("videoList")); //替换第十个元素 - jsonObjectOne.put("videoList", videoList);//更新 jsonObjectOne 中的 videoList 数组 - if (jsonObjectOne.getJSONArray("pictures").length()>=10&&jsonObjectTwo.get("pictures")!=null){ - JSONArray pictures = jsonObjectOne.getJSONArray("pictures"); - pictures.put(9,jsonObjectTwo.get("pictures")); - jsonObjectOne.put("pictures",pictures); + int picturesLength = jsonObjectOne.getJSONArray("pictures").length();//已经存在数据库的图片的长度 + if (picturesLength>=10&&jsonObjectTwo.get("pictures")!=null){//如果数据长度大于等于10,对第十位进行替换 + JSONArray pictures = jsonObjectOne.getJSONArray("pictures");//获取图片数组 + pictures.put(9,jsonObjectTwo.getJSONArray("pictures").getString(0)); //替换第十个元素 + jsonObjectOne.put("pictures", pictures);//更新 jsonObjectOne中的pictures 数组 + if (jsonObjectOne.getJSONArray("videoList").length()>=10&&jsonObjectTwo.get("videoList")!=null){ + JSONArray videoList = jsonObjectOne.getJSONArray("videoList"); + videoList.put(9,jsonObjectTwo.getJSONArray("videoList").getString(0)); + jsonObjectOne.put("videoList",videoList); } redisCache.setCacheObject(WARNINGDATA+key,dataId,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//重新设置延迟时间 return dcWarningMapper.updateOtherConfig(dataId,jsonObjectOne.toString());//修改数据库配置 From d3e1566a0f3cb160fad1379dc7fa0d3c9dafa634 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Sun, 7 Apr 2024 14:07:45 +0800 Subject: [PATCH 13/18] =?UTF-8?q?=E7=AD=96=E7=95=A5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zc/business/service/impl/DcWarningServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index 8b32d013..4a2870c4 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -148,11 +148,12 @@ public class DcWarningServiceImpl implements IDcWarningService int picturesLength = jsonObjectOne.getJSONArray("pictures").length();//已经存在数据库的图片的长度 if (picturesLength>=10&&jsonObjectTwo.get("pictures")!=null){//如果数据长度大于等于10,对第十位进行替换 JSONArray pictures = jsonObjectOne.getJSONArray("pictures");//获取图片数组 - pictures.put(9,jsonObjectTwo.getJSONArray("pictures").getString(0)); //替换第十个元素 + pictures.put(picturesLength-1,jsonObjectTwo.getJSONArray("pictures").getString(0)); //替换第十个元素 jsonObjectOne.put("pictures", pictures);//更新 jsonObjectOne中的pictures 数组 - if (jsonObjectOne.getJSONArray("videoList").length()>=10&&jsonObjectTwo.get("videoList")!=null){ + int videoListLength = jsonObjectOne.getJSONArray("pictures").length();//已经存在数据库的视频的长度 + if (videoListLength>=10&&jsonObjectTwo.get("videoList")!=null){ JSONArray videoList = jsonObjectOne.getJSONArray("videoList"); - videoList.put(9,jsonObjectTwo.getJSONArray("videoList").getString(0)); + videoList.put(videoListLength-1,jsonObjectTwo.getJSONArray("videoList").getString(0)); jsonObjectOne.put("videoList",videoList); } redisCache.setCacheObject(WARNINGDATA+key,dataId,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//重新设置延迟时间 From 636d0fb44c1792d6fa1479f264f50f7646321c45 Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Sun, 7 Apr 2024 15:38:19 +0800 Subject: [PATCH 14/18] =?UTF-8?q?=E6=83=85=E6=8A=A5=E6=9D=BF=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E8=AE=B0=E5=BD=95=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zc/business/domain/DcBoardReleaseLog.java | 33 ++++++++++++++++--- .../business/DcBoardReleaseLogMapper.xml | 2 ++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/domain/DcBoardReleaseLog.java b/zc-business/src/main/java/com/zc/business/domain/DcBoardReleaseLog.java index 00eed7d1..4cca0529 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcBoardReleaseLog.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcBoardReleaseLog.java @@ -49,9 +49,9 @@ public class DcBoardReleaseLog extends BaseEntity @ApiModelProperty(value="发布内容") private String releaseContent; - /** 发布状态(0:成功;1:失败) */ - @Excel(name = "发布状态", readConverterExp = "0=成功,1失败") - @ApiModelProperty(value="发布状态0=:成功;1:失败") + /** 发布状态(0:失败;1:成功) */ + @Excel(name = "发布状态", readConverterExp = "0=失败,1成功") + @ApiModelProperty(value="发布状态0=:失败;1:成功") private String releaseStatus; /** 发布时间 */ @@ -60,6 +60,14 @@ public class DcBoardReleaseLog extends BaseEntity @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date releaseTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value="范围查询-开始时间") + private Date startTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value="范围查询-结束时间") + private Date endTime; + /** 发布机构 */ @Excel(name = "发布机构") @ApiModelProperty(value="发布机构") @@ -161,7 +169,24 @@ public class DcBoardReleaseLog extends BaseEntity { return releaseTime; } - public void setReleaseDeptName(String releaseDeptName) + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public void setReleaseDeptName(String releaseDeptName) { this.releaseDeptName = releaseDeptName; } diff --git a/zc-business/src/main/resources/mapper/business/DcBoardReleaseLogMapper.xml b/zc-business/src/main/resources/mapper/business/DcBoardReleaseLogMapper.xml index 39f25722..8613d775 100644 --- a/zc-business/src/main/resources/mapper/business/DcBoardReleaseLogMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcBoardReleaseLogMapper.xml @@ -36,6 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and t1.release_content = #{releaseContent} and t1.release_status = #{releaseStatus} and t1.release_time = #{releaseTime} + and date_format(t1.release_time,'%Y-%m-%d %H:%i:%s') >= date_format(#{startTime},'%Y-%m-%d %H:%i:%s') + and date_format(t1.release_time,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s') and t1.release_dept_name like concat('%', #{releaseDeptName}, '%') and t1.release_dept_id = #{releaseDeptId} and t1.release_user_name like concat('%', #{releaseUserName}, '%') From a2f7efe447bd927c206b8c8c38499bb4602cb078 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Mon, 8 Apr 2024 08:55:31 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E7=AD=96=E7=95=A5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zc/business/service/impl/DcWarningServiceImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index 4a2870c4..25747caa 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -131,12 +131,11 @@ public class DcWarningServiceImpl implements IDcWarningService } //redis存在数据,取出redis的id找对对应事件的配置,合成事件配置,重新定义延迟时间 HashMap map = dcWarningMapper.selectDcWarningById(dataId); - if (map==null){//redis中有id但是数据库中没有这条数据,那就删除这条redis数据,新数据加入到数据库,并加入到redis + if (map==null||(map.get("warningState")!=null&&!map.get("warningState").toString().equals("1"))){//redis中有id但是数据库中没有这条数据,或则数据库中有数据但是状态不为上报,那就删除这条redis数据,新数据加入到数据库,并加入到redis redisCache.deleteObject(WARNINGDATA+key); - dcWarningMapper.insertDcWarning(dcWarning); String id = dcWarning.getId(); redisCache.setCacheObject(WARNINGDATA+key,id,Integer.parseInt(strategyTime),TimeUnit.MINUTES); - return 1; + return dcWarningMapper.insertDcWarning(dcWarning); } String otherConfig=""; if (map.get("otherConfig")!=null){ From c24faf3d8ad3ae400a9bf3c8d5c59c3bf82c8efa Mon Sep 17 00:00:00 2001 From: "Mr.Wang" Date: Mon, 8 Apr 2024 11:23:40 +0800 Subject: [PATCH 16/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=A4=E8=B0=83?= =?UTF-8?q?=E8=BD=A6=E6=B5=81=E9=87=8F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zc/business/controller/DcDeviceController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index bc99bd59..9a4b4312 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -248,7 +248,7 @@ public class DcDeviceController extends BaseController { JSONObject formatValue = JSON.parseObject(jsonObject.get("formatValue").toString()); map.put("1", formatValue.get("1")); map.put("3", formatValue.get("3")); - map.put("timestamp", formatValue.get("equipmentReportingTime") == null? "":formatValue.get("equipmentReportingTime")); + map.put("timestamp", formatValue.get("equipmentReportingTime") == null? "":Long.valueOf(formatValue.get("equipmentReportingTime").toString())); list.add(map); }); List> newList = list.stream() From 4d9bc0583f1111b92b66ffb76669b07c9576b85c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Mon, 8 Apr 2024 11:28:30 +0800 Subject: [PATCH 17/18] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=A9=E6=B0=94?= =?UTF-8?q?=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/application-druid.yml | 10 ++++++---- ruoyi-admin/src/main/resources/application.yml | 12 ++++++------ .../com/ruoyi/framework/config/SecurityConfig.java | 6 +++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index b66131c4..53280b64 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -8,10 +8,12 @@ spring: master: # 公司数据库地址 # url: jdbc:mysql://10.168.3.169:3306/athena?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 - url: jdbc:mysql://10.168.56.204:3306/jihe-dc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true - username: root -# password: Platform123!@# - password: Platform123!@# +# url: jdbc:mysql://127.0.0.1:3308/event_iot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true +# url: jdbc:mysql://127.0.0.1:3308/jihe-dc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true + url: jdbc:mysql://10.168.56.204:3306/jihe-dc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 + username: root + # password: root + password: Platform123!@# # 从库数据源 slave: # 从数据源开关/默认关闭 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index f0180661..ae61f5d9 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -67,9 +67,9 @@ spring: # 端口,默认为6379 port: 6379 # 数据库索引 - database: 0 + database: 1 # 密码 - password: Redis123!@# + password: # 连接超时时间 timeout: 10s lettuce: @@ -156,7 +156,7 @@ aj: iot: # 物联平台地址 - address: http://127.0.0.1:8080 + address: https://10.0.81.202:8081 # redis 配置 redis: # 地址 @@ -164,9 +164,9 @@ iot: # 端口,默认为6379 port: 6379 # 数据库索引 - database: 10 + database: 0 # 密码 - password: Redis123!@# + password: # 连接超时时间 timeout: 10s lettuce: @@ -183,4 +183,4 @@ iot: # 允许访问的ip地址 allowed: - ips: 10.0.81.202,10.168.73.54,10.168.71.194 + ips: 10.0.81.202,10.168.73.54,10.168.71.194, diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 046648e7..f76628c4 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -116,7 +116,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { // 过滤请求 .authorizeRequests() // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - .antMatchers("/login", "/register", "/captchaImage").anonymous() + .antMatchers("/login", "/register", "/captchaImage","/dc/**").anonymous() .antMatchers( HttpMethod.GET, "/", @@ -126,8 +126,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { "/**/*.js", "/profile/**" ).permitAll() -// .antMatchers("/swagger-ui.html").anonymous() -// .antMatchers("/swagger-resources/**").anonymous() + .antMatchers("/swagger-ui.html").anonymous() + .antMatchers("/swagger-resources/**").anonymous() .antMatchers("/webjars/**").anonymous() .antMatchers("/*/api-docs").anonymous() .antMatchers("/druid/**").anonymous() From 30b5b8ce373303ff8ed687fb3f897cd7a6c29a73 Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Mon, 8 Apr 2024 16:52:18 +0800 Subject: [PATCH 18/18] =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=B8=8A=E4=B8=8B?= =?UTF-8?q?=E8=A1=8C=E5=88=97=E8=A1=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/config/SecurityConfig.java | 6 +++--- .../business/controller/VideoController.java | 21 +++++++------------ .../service/impl/DcBoardServiceImpl.java | 2 +- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index f76628c4..ead83dcd 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -116,7 +116,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { // 过滤请求 .authorizeRequests() // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - .antMatchers("/login", "/register", "/captchaImage","/dc/**").anonymous() + .antMatchers("/login", "/register", "/captchaImage").anonymous() .antMatchers( HttpMethod.GET, "/", @@ -126,8 +126,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { "/**/*.js", "/profile/**" ).permitAll() - .antMatchers("/swagger-ui.html").anonymous() - .antMatchers("/swagger-resources/**").anonymous() +// .antMatchers("/swagger-ui.html").anonymous() +// .antMatchers("/swagger-resources/**").anonymous() .antMatchers("/webjars/**").anonymous() .antMatchers("/*/api-docs").anonymous() .antMatchers("/druid/**").anonymous() diff --git a/zc-business/src/main/java/com/zc/business/controller/VideoController.java b/zc-business/src/main/java/com/zc/business/controller/VideoController.java index 2021f8a4..7c374ad6 100644 --- a/zc-business/src/main/java/com/zc/business/controller/VideoController.java +++ b/zc-business/src/main/java/com/zc/business/controller/VideoController.java @@ -412,35 +412,30 @@ public class VideoController extends BaseController { Integer pileNumDistance = pileNumTransformMetre(pileNum); Map result = new HashMap<>(); - //上行列表 + //上行列表(包含双向) List> 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; }) + .filter(item -> + ("0".equals(item.get("camOrientation")) || "2".equals(item.get("camOrientation"))) + && Integer.parseInt(item.get("distance").toString()) < 2000) .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<>()); - } + result.put("upCamera",upCameraList); + //下行列表 List> 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; }) + .filter(item -> "1".equals(item.get("camOrientation")) && Integer.parseInt(item.get("distance").toString()) < 2000) .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<>()); - } + result.put("downCamera",downCameraList); return AjaxResult.success(result); diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcBoardServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcBoardServiceImpl.java index 8a2c0a1f..a8c06783 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcBoardServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcBoardServiceImpl.java @@ -260,7 +260,7 @@ public class DcBoardServiceImpl implements IDcBoardService { result.add(map); }else { status = "0"; - map.put("code",status); + map.put("code",status); map.put("msg",ajaxResult13.get("msg").toString()); result.add(map); }