From 8c20007bf2342db9d7a1d76729c84042bf7e2ef8 Mon Sep 17 00:00:00 2001
From: xiepufeng <1072271977@qq.com>
Date: Fri, 2 Feb 2024 19:59:45 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E5=8E=BB=E9=99=A4ruyi-commonn=E4=B8=AD?=
=?UTF-8?q?=E6=97=A0=E7=94=A8=E7=9A=84=E4=BE=9D=E8=B5=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ruoyi-common/pom.xml | 25 +++----------------
zc-business/pom.xml | 1 +
.../device/handler/DeviceMessageHandler.java | 17 ++++++++++---
3 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml
index 6d52927e..014dc766 100644
--- a/ruoyi-common/pom.xml
+++ b/ruoyi-common/pom.xml
@@ -58,7 +58,7 @@
org.apache.commons
commons-lang3
-
+
com.fasterxml.jackson.core
@@ -150,14 +150,6 @@
4.11
-
-
-
- org.bouncycastle
- bcpkix-jdk15on
- 1.57
-
-
commons-codec
@@ -185,6 +177,7 @@
core
3.3.3
+
com.google.zxing
javase
@@ -197,18 +190,6 @@
4.1.0
-
- com.aliyun.mns
- aliyun-sdk-mns
- 1.1.8
-
-
-
- com.aliyun
- aliyun-java-sdk-dyvmsapi
- 1.2.2
-
-
com.baomidou
@@ -225,4 +206,4 @@
-
\ No newline at end of file
+
diff --git a/zc-business/pom.xml b/zc-business/pom.xml
index 90649c6b..e83ad99b 100644
--- a/zc-business/pom.xml
+++ b/zc-business/pom.xml
@@ -27,6 +27,7 @@
artemis-http-client
1.1.11-SNAPSHOT
+
io.springfox
springfox-boot-starter
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 21b22f26..a03eecf9 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
@@ -29,10 +29,10 @@ public class DeviceMessageHandler {
WEATHER_DETECTOR("zc-meteorological"),
// 设备箱
- ZC_SHE_BEI_XIANG("zc-shebeixiang-1883"),
+ EQUIPMENT_BOX("zc-shebeixiang-1883"),
// 一站式情况调查产品
- STANDARD_JTT("zc-yzsqkdc-3131")
+ ONE_STOP_PRODUCT("zc-yzsqkdc-3131")
;
private final String value;
@@ -81,7 +81,18 @@ public class DeviceMessageHandler {
// 摄像头检测事件
if (productId.equals(ProductType.CAMERA_DETECTION_EVENT.value)) {
- return;
+ this.cameraDetectionEventHandle(data);
}
}
+
+
+ /**
+ * 摄像头检测事件处理
+ * @param event 事件数据
+ */
+ private void cameraDetectionEventHandle(JSONObject event) {
+
+ }
+
+
}
From 4b154d0413a491e0dcb020caffb3f6ee5d026cd3 Mon Sep 17 00:00:00 2001
From: zhaoxianglong
Date: Sun, 4 Feb 2024 08:53:24 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E6=89=AB=E7=A0=81=E6=8A=A5=E8=AD=A6?=
=?UTF-8?q?=E4=B8=8A=E6=8A=A5=E4=BA=8B=E4=BB=B6=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/resources/application.yml | 4 ++
.../framework/config/SecurityConfig.java | 53 +++++++++++-----
.../CodeScanningAlarmController.java | 63 +++++++++++++++++++
3 files changed, 104 insertions(+), 16 deletions(-)
create mode 100644 zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index 8ded2934..f0180661 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -180,3 +180,7 @@ iot:
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
+
+# 允许访问的ip地址
+allowed:
+ 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 cc2d93eb..3590526d 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
@@ -1,6 +1,7 @@
package com.ruoyi.framework.config;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
@@ -13,24 +14,26 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.logout.LogoutFilter;
+import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.web.filter.CorsFilter;
import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl;
import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
/**
* spring security配置
- *
*/
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
-public class SecurityConfig extends WebSecurityConfigurerAdapter
-{
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
/**
* 自定义用户认证逻辑
*/
@Autowired
private UserDetailsService userDetailsService;
-
+
/**
* 认证失败处理类
*/
@@ -48,13 +51,32 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
*/
@Autowired
private JwtAuthenticationTokenFilter authenticationTokenFilter;
-
+
/**
* 跨域过滤器
*/
@Autowired
private CorsFilter corsFilter;
-
+
+ /**
+ * 允许访问的ip地址
+ */
+ @Value("${allowed.ips}")
+ private String allowedIPs;
+
+ // 定义一个RequestMatcher
+ RequestMatcher requestMatcher = new RequestMatcher() {
+ @Override
+ public boolean matches(HttpServletRequest request) {
+ // 获取请求的IP
+ String requestIP = request.getRemoteAddr();
+ // 将配置文件中的IP字符串分割为数组
+ String[] ips = allowedIPs.split(",");
+ // 检查请求的IP是否在允许的IP数组中
+ return Arrays.asList(ips).contains(requestIP);
+ }
+ };
+
/**
* 解决 无法直接注入 AuthenticationManager
*
@@ -63,8 +85,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
*/
@Bean
@Override
- public AuthenticationManager authenticationManagerBean() throws Exception
- {
+ public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@@ -84,8 +105,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
* authenticated | 用户登录后可访问
*/
@Override
- protected void configure(HttpSecurity httpSecurity) throws Exception
- {
+ protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
// CSRF禁用,因为不使用session
.csrf().disable()
@@ -117,11 +137,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 添加统一支付 回调接口
.antMatchers("/payment/wxPay/notify").anonymous()
// 滑块验证码
- .antMatchers( "/captcha/get", "/captcha/check", "/captchaConfig").anonymous()
+ .antMatchers("/captcha/get", "/captcha/check", "/captchaConfig").anonymous()
// license
.antMatchers("/license/identityCode", "/license/authentication").anonymous()
// 第三方、小程序、APP
- .antMatchers("/api/**").anonymous()
+ //.antMatchers("/api/**").anonymous()
+
+ // 对于满足requestMatcher的请求,允许所有用户访问。
+ .requestMatchers(requestMatcher).permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
@@ -139,8 +162,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
* 强散列哈希加密实现
*/
@Bean
- public BCryptPasswordEncoder bCryptPasswordEncoder()
- {
+ public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}
@@ -148,8 +170,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
* 身份认证接口
*/
@Override
- protected void configure(AuthenticationManagerBuilder auth) throws Exception
- {
+ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
}
}
diff --git a/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java b/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java
new file mode 100644
index 00000000..4b1edea2
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java
@@ -0,0 +1,63 @@
+package com.zc.business.controller;
+
+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;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * License
+ *
+ * @author Athena-xiepufeng
+ */
+@Api(tags = "扫码报警")
+@RestController
+@RequestMapping("/codeScanningAlarm")
+public class CodeScanningAlarmController extends BaseController {
+
+ @Resource
+ private IDcWarningService dcWarningService;
+
+ /**
+ * 扫码报警事件回调函数
+ *
+ * @param returnParameters 事件回参
+ * @return 结果
+ */
+ @PostMapping(value = "/event")
+ public AjaxResult codeScanningAlarmControllerEvent(@RequestBody Map returnParameters) {
+ DcWarning dcWarning = new DcWarning();
+ //设置事件Id UUID无下划线格式32
+ String uuid = IdUtils.fastSimpleUUID();
+ dcWarning.setId(uuid);
+ dcWarning.setStakeMark(String.valueOf(returnParameters.get("stakeNum")));
+ String roadCode = String.valueOf(returnParameters.get("roadCode"));
+ dcWarning.setDirection(Objects.equals(roadCode, "1") ? "3" : "1");
+ String createTime = String.valueOf(returnParameters.get("createTime"));
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmXXX");
+ try {
+ dcWarning.setWarningTime(format.parse(createTime));
+ } catch (ParseException e) {
+ dcWarning.setWarningTime(new Date());
+ }
+ dcWarning.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 ? "交通事故事件" : "车辆故障事件");
+ dcWarning.setWarningTitle(warningTitle);
+ dcWarning.setOtherConfig(returnParameters.toString());
+ dcWarning.setWarningSource(5);
+ dcWarning.setWarningState(1);
+ return AjaxResult.success(dcWarningService.insertDcWarning(dcWarning));
+ }
+}
From 5d571b71ba67166670ad4096f8b61c4034066452 Mon Sep 17 00:00:00 2001
From: lau572 <1010031226@qq.com>
Date: Sun, 4 Feb 2024 10:46:43 +0800
Subject: [PATCH 3/6] =?UTF-8?q?=E4=BA=A4=E9=80=9A=E6=B0=94=E8=B1=A1?=
=?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DcWeatherMonitoringController.java | 41 +++
.../domain/DcMeteorologicalDetectorData.java | 331 ++++++++++++++++++
.../DcMeteorologicalDetectorDataMapper.java | 61 ++++
.../mapper/DcWeatherMonitoringMapper.java | 26 ++
.../IDcMeteorologicalDetectorDataService.java | 61 ++++
.../service/IDcWeatherMonitoringService.java | 24 ++
...MeteorologicalDetectorDataServiceImpl.java | 93 +++++
.../impl/DcWeatherMonitoringServiceImpl.java | 88 +++++
.../DcMeteorologicalDetectorDataMapper.xml | 159 +++++++++
.../business/DcWeatherMinitoringMapper.xml | 22 ++
10 files changed, 906 insertions(+)
create mode 100644 zc-business/src/main/java/com/zc/business/controller/DcWeatherMonitoringController.java
create mode 100644 zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java
create mode 100644 zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java
create mode 100644 zc-business/src/main/java/com/zc/business/mapper/DcWeatherMonitoringMapper.java
create mode 100644 zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java
create mode 100644 zc-business/src/main/java/com/zc/business/service/IDcWeatherMonitoringService.java
create mode 100644 zc-business/src/main/java/com/zc/business/service/impl/DcMeteorologicalDetectorDataServiceImpl.java
create mode 100644 zc-business/src/main/java/com/zc/business/service/impl/DcWeatherMonitoringServiceImpl.java
create mode 100644 zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml
create mode 100644 zc-business/src/main/resources/mapper/business/DcWeatherMinitoringMapper.xml
diff --git a/zc-business/src/main/java/com/zc/business/controller/DcWeatherMonitoringController.java b/zc-business/src/main/java/com/zc/business/controller/DcWeatherMonitoringController.java
new file mode 100644
index 00000000..a7521b30
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/controller/DcWeatherMonitoringController.java
@@ -0,0 +1,41 @@
+package com.zc.business.controller;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.zc.business.service.IDcWeatherMonitoringService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Description 交通气象检测
+ *
+ * @author liuwenge
+ * @date 2024/2/1 9:41
+ */
+@Api(tags = "交通气象检测")
+@RestController
+@RequestMapping("/business/weatherMonitoring")
+public class DcWeatherMonitoringController {
+
+ @Autowired
+ private IDcWeatherMonitoringService weatherMonitoringService;
+
+ /**
+ * @Description 路网交通状况
+ *
+ * @author liuwenge
+ * @date 2024/2/1 10:10
+ * @param
+ * @return com.ruoyi.common.core.domain.AjaxResult
+ */
+ @ApiOperation("路网交通状况")
+ @GetMapping("/getTrafficConditions")
+ public AjaxResult getTrafficConditions(){
+ return weatherMonitoringService.getTrafficConditions();
+ }
+
+
+}
diff --git a/zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java b/zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java
new file mode 100644
index 00000000..436edfa8
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java
@@ -0,0 +1,331 @@
+package com.zc.business.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 气象检测器数据对象 dc_meteorological_detector_data
+ *
+ * @author ruoyi
+ * @date 2024-02-01
+ */
+public class DcMeteorologicalDetectorData extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+
+ /** 物联设备id */
+ @Excel(name = "物联设备id")
+ private String iotDeviceId;
+
+ /** 降雨量毫米 */
+ @Excel(name = "降雨量毫米")
+ private String rainfall;
+
+ /** 能见度类型 */
+ @Excel(name = "能见度类型")
+ private String visibilityType;
+
+ /** 能见度 */
+ @Excel(name = "能见度")
+ private String visibility;
+
+ /** 路面状况 */
+ @Excel(name = "路面状况")
+ private String roadSurfaceStatus;
+
+ /** 气压 */
+ @Excel(name = "气压")
+ private String atmosphericPressure;
+
+ /** 气温 */
+ @Excel(name = "气温")
+ private String temperature;
+
+ /** 湿度 */
+ @Excel(name = "湿度")
+ private String humidity;
+
+ /** 风向 */
+ @Excel(name = "风向")
+ private String windDirection;
+
+ /** 风速 */
+ @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 wetSlipperyCoefficient;
+
+ /** 传感器温度 */
+ @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)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setIotDeviceId(String iotDeviceId)
+ {
+ this.iotDeviceId = iotDeviceId;
+ }
+
+ public String getIotDeviceId()
+ {
+ return iotDeviceId;
+ }
+ public void setRainfall(String rainfall)
+ {
+ this.rainfall = rainfall;
+ }
+
+ public String getRainfall()
+ {
+ return rainfall;
+ }
+ public void setVisibilityType(String visibilityType)
+ {
+ this.visibilityType = visibilityType;
+ }
+
+ public String getVisibilityType()
+ {
+ return visibilityType;
+ }
+ public void setVisibility(String visibility)
+ {
+ this.visibility = visibility;
+ }
+
+ public String getVisibility()
+ {
+ return visibility;
+ }
+ public void setRoadSurfaceStatus(String roadSurfaceStatus)
+ {
+ this.roadSurfaceStatus = roadSurfaceStatus;
+ }
+
+ public String getRoadSurfaceStatus()
+ {
+ return roadSurfaceStatus;
+ }
+ public void setAtmosphericPressure(String atmosphericPressure)
+ {
+ this.atmosphericPressure = atmosphericPressure;
+ }
+
+ public String getAtmosphericPressure()
+ {
+ return atmosphericPressure;
+ }
+ public void setTemperature(String temperature)
+ {
+ this.temperature = temperature;
+ }
+
+ public String getTemperature()
+ {
+ return temperature;
+ }
+ public void setHumidity(String humidity)
+ {
+ this.humidity = humidity;
+ }
+
+ public String getHumidity()
+ {
+ return humidity;
+ }
+ public void setWindDirection(String windDirection)
+ {
+ this.windDirection = windDirection;
+ }
+
+ public String getWindDirection()
+ {
+ return windDirection;
+ }
+ public void setWindSpeed(String windSpeed)
+ {
+ this.windSpeed = windSpeed;
+ }
+
+ public String getWindSpeed()
+ {
+ 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;
+ }
+
+ public String getPrecipitationType()
+ {
+ return precipitationType;
+ }
+ public void setWetSlipperyCoefficient(String wetSlipperyCoefficient)
+ {
+ this.wetSlipperyCoefficient = wetSlipperyCoefficient;
+ }
+
+ public String getWetSlipperyCoefficient()
+ {
+ return wetSlipperyCoefficient;
+ }
+ public void setSensorTemperature(String sensorTemperature)
+ {
+ this.sensorTemperature = sensorTemperature;
+ }
+
+ public String getSensorTemperature()
+ {
+ return sensorTemperature;
+ }
+ public void setRemoteRoadSurfaceTemperature(String remoteRoadSurfaceTemperature)
+ {
+ this.remoteRoadSurfaceTemperature = remoteRoadSurfaceTemperature;
+ }
+
+ public String getRemoteRoadSurfaceTemperature()
+ {
+ return remoteRoadSurfaceTemperature;
+ }
+ public void setRemoteRoadSurfaceStatus(String remoteRoadSurfaceStatus)
+ {
+ this.remoteRoadSurfaceStatus = remoteRoadSurfaceStatus;
+ }
+
+ public String getRemoteRoadSurfaceStatus()
+ {
+ return remoteRoadSurfaceStatus;
+ }
+ public void setSubSurfaceTemperature(String subSurfaceTemperature)
+ {
+ this.subSurfaceTemperature = subSurfaceTemperature;
+ }
+
+ public String getSubSurfaceTemperature()
+ {
+ return subSurfaceTemperature;
+ }
+ public void setWaterFilmIceSnowValue(String waterFilmIceSnowValue)
+ {
+ this.waterFilmIceSnowValue = waterFilmIceSnowValue;
+ }
+
+ public String getWaterFilmIceSnowValue()
+ {
+ return waterFilmIceSnowValue;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("iotDeviceId", getIotDeviceId())
+ .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();
+ }
+}
diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java
new file mode 100644
index 00000000..3a0868cb
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java
@@ -0,0 +1,61 @@
+package com.zc.business.mapper;
+
+import java.util.List;
+import com.zc.business.domain.DcMeteorologicalDetectorData;
+
+/**
+ * 气象检测器数据Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-02-01
+ */
+public interface DcMeteorologicalDetectorDataMapper
+{
+ /**
+ * 查询气象检测器数据
+ *
+ * @param id 气象检测器数据主键
+ * @return 气象检测器数据
+ */
+ public DcMeteorologicalDetectorData selectDcMeteorologicalDetectorDataById(Long id);
+
+ /**
+ * 查询气象检测器数据列表
+ *
+ * @param dcMeteorologicalDetectorData 气象检测器数据
+ * @return 气象检测器数据集合
+ */
+ List selectDcMeteorologicalDetectorDataList(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
+
+ /**
+ * 新增气象检测器数据
+ *
+ * @param dcMeteorologicalDetectorData 气象检测器数据
+ * @return 结果
+ */
+ int insertDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
+
+ /**
+ * 修改气象检测器数据
+ *
+ * @param dcMeteorologicalDetectorData 气象检测器数据
+ * @return 结果
+ */
+ int updateDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
+
+ /**
+ * 删除气象检测器数据
+ *
+ * @param id 气象检测器数据主键
+ * @return 结果
+ */
+ int deleteDcMeteorologicalDetectorDataById(Long id);
+
+ /**
+ * 批量删除气象检测器数据
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ int deleteDcMeteorologicalDetectorDataByIds(Long[] ids);
+}
diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcWeatherMonitoringMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcWeatherMonitoringMapper.java
new file mode 100644
index 00000000..6b9962ec
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/mapper/DcWeatherMonitoringMapper.java
@@ -0,0 +1,26 @@
+package com.zc.business.mapper;
+
+import com.zc.business.domain.DcMeteorologicalDetectorData;
+
+import java.util.List;
+
+/**
+ * @Description 交通气象检测Mapper接口
+ *
+ * @author liuwenge
+ * @date 2024/2/1 9:46
+ */
+public interface DcWeatherMonitoringMapper {
+
+
+ /**
+ * @Description 查询当天每个设备最新的数据
+ *
+ * @author liuwenge
+ * @date 2024/2/4 9:33
+ * @param
+ * @return java.util.List
+ */
+ List selectMeteorologicalDetectorData();
+
+}
diff --git a/zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java b/zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java
new file mode 100644
index 00000000..f3810b7d
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java
@@ -0,0 +1,61 @@
+package com.zc.business.service;
+
+import java.util.List;
+import com.zc.business.domain.DcMeteorologicalDetectorData;
+
+/**
+ * 气象检测器数据Service接口
+ *
+ * @author ruoyi
+ * @date 2024-02-01
+ */
+public interface IDcMeteorologicalDetectorDataService
+{
+ /**
+ * 查询气象检测器数据
+ *
+ * @param id 气象检测器数据主键
+ * @return 气象检测器数据
+ */
+ public DcMeteorologicalDetectorData selectDcMeteorologicalDetectorDataById(Long id);
+
+ /**
+ * 查询气象检测器数据列表
+ *
+ * @param dcMeteorologicalDetectorData 气象检测器数据
+ * @return 气象检测器数据集合
+ */
+ List selectDcMeteorologicalDetectorDataList(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
+
+ /**
+ * 新增气象检测器数据
+ *
+ * @param dcMeteorologicalDetectorData 气象检测器数据
+ * @return 结果
+ */
+ int insertDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
+
+ /**
+ * 修改气象检测器数据
+ *
+ * @param dcMeteorologicalDetectorData 气象检测器数据
+ * @return 结果
+ */
+ int updateDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData);
+
+ /**
+ * 批量删除气象检测器数据
+ *
+ * @param ids 需要删除的气象检测器数据主键集合
+ * @return 结果
+ */
+ int deleteDcMeteorologicalDetectorDataByIds(Long[] ids);
+
+ /**
+ * 删除气象检测器数据信息
+ *
+ * @param id 气象检测器数据主键
+ * @return 结果
+ */
+ int deleteDcMeteorologicalDetectorDataById(Long id);
+}
diff --git a/zc-business/src/main/java/com/zc/business/service/IDcWeatherMonitoringService.java b/zc-business/src/main/java/com/zc/business/service/IDcWeatherMonitoringService.java
new file mode 100644
index 00000000..ca1ae917
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/service/IDcWeatherMonitoringService.java
@@ -0,0 +1,24 @@
+package com.zc.business.service;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+
+/**
+ * @Description 交通气象检测Service接口
+ *
+ * @author liuwenge
+ * @date 2024/2/1 9:42
+ */
+public interface IDcWeatherMonitoringService {
+
+ /**
+ * @Description 路网交通状况
+ *
+ * @author liuwenge
+ * @date 2024/2/1 10:36
+ * @param
+ * @return com.ruoyi.common.core.domain.AjaxResult
+ */
+ AjaxResult getTrafficConditions();
+
+
+}
diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcMeteorologicalDetectorDataServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcMeteorologicalDetectorDataServiceImpl.java
new file mode 100644
index 00000000..2e7d772b
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/service/impl/DcMeteorologicalDetectorDataServiceImpl.java
@@ -0,0 +1,93 @@
+package com.zc.business.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.zc.business.mapper.DcMeteorologicalDetectorDataMapper;
+import com.zc.business.domain.DcMeteorologicalDetectorData;
+import com.zc.business.service.IDcMeteorologicalDetectorDataService;
+
+/**
+ * 气象检测器数据Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-02-01
+ */
+@Service
+public class DcMeteorologicalDetectorDataServiceImpl implements IDcMeteorologicalDetectorDataService
+{
+ @Autowired
+ private DcMeteorologicalDetectorDataMapper dcMeteorologicalDetectorDataMapper;
+
+ /**
+ * 查询气象检测器数据
+ *
+ * @param id 气象检测器数据主键
+ * @return 气象检测器数据
+ */
+ @Override
+ public DcMeteorologicalDetectorData selectDcMeteorologicalDetectorDataById(Long id)
+ {
+ return dcMeteorologicalDetectorDataMapper.selectDcMeteorologicalDetectorDataById(id);
+ }
+
+ /**
+ * 查询气象检测器数据列表
+ *
+ * @param dcMeteorologicalDetectorData 气象检测器数据
+ * @return 气象检测器数据
+ */
+ @Override
+ public List selectDcMeteorologicalDetectorDataList(DcMeteorologicalDetectorData dcMeteorologicalDetectorData)
+ {
+ return dcMeteorologicalDetectorDataMapper.selectDcMeteorologicalDetectorDataList(dcMeteorologicalDetectorData);
+ }
+
+ /**
+ * 新增气象检测器数据
+ *
+ * @param dcMeteorologicalDetectorData 气象检测器数据
+ * @return 结果
+ */
+ @Override
+ public int insertDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData)
+ {
+ return dcMeteorologicalDetectorDataMapper.insertDcMeteorologicalDetectorData(dcMeteorologicalDetectorData);
+ }
+
+ /**
+ * 修改气象检测器数据
+ *
+ * @param dcMeteorologicalDetectorData 气象检测器数据
+ * @return 结果
+ */
+ @Override
+ public int updateDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData)
+ {
+ return dcMeteorologicalDetectorDataMapper.updateDcMeteorologicalDetectorData(dcMeteorologicalDetectorData);
+ }
+
+ /**
+ * 批量删除气象检测器数据
+ *
+ * @param ids 需要删除的气象检测器数据主键
+ * @return 结果
+ */
+ @Override
+ public int deleteDcMeteorologicalDetectorDataByIds(Long[] ids)
+ {
+ return dcMeteorologicalDetectorDataMapper.deleteDcMeteorologicalDetectorDataByIds(ids);
+ }
+
+ /**
+ * 删除气象检测器数据信息
+ *
+ * @param id 气象检测器数据主键
+ * @return 结果
+ */
+ @Override
+ public int deleteDcMeteorologicalDetectorDataById(Long id)
+ {
+ return dcMeteorologicalDetectorDataMapper.deleteDcMeteorologicalDetectorDataById(id);
+ }
+}
diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWeatherMonitoringServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWeatherMonitoringServiceImpl.java
new file mode 100644
index 00000000..9b02b980
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWeatherMonitoringServiceImpl.java
@@ -0,0 +1,88 @@
+package com.zc.business.service.impl;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.StringUtils;
+import com.zc.business.domain.DcMeteorologicalDetectorData;
+import com.zc.business.mapper.DcWeatherMonitoringMapper;
+import com.zc.business.service.IDcWeatherMonitoringService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description 交通气象检测Service业务层处理
+ *
+ * @author liuwenge
+ * @date 2024/2/1 9:45
+ */
+@Service
+public class DcWeatherMonitoringServiceImpl implements IDcWeatherMonitoringService {
+
+
+ @Autowired
+ private DcWeatherMonitoringMapper weatherMonitoringMapper;
+
+
+ /**
+ * @Description 路网交通状况
+ *
+ * @author liuwenge
+ * @date 2024/2/1 10:37
+ * @param
+ * @return com.ruoyi.common.core.domain.AjaxResult
+ */
+ @Override
+ public AjaxResult getTrafficConditions(){
+
+
+ //正常路段里程
+ BigDecimal normalMileage = new BigDecimal("154.585");
+ //降水里程
+ BigDecimal rainfallMileage = BigDecimal.ZERO;
+ //团雾路段(处)
+ int heavyFogNum = 0;
+ //团雾里程
+ BigDecimal heavyFogMileage = BigDecimal.ZERO;
+ //异常数量
+ int anomalies = 0;
+ //设备数量
+ int deviceNum = 10;
+
+ //每个设备的检测范围
+ BigDecimal detectionRange = new BigDecimal("15.4585");
+
+ List dataList = weatherMonitoringMapper.selectMeteorologicalDetectorData();
+ for (DcMeteorologicalDetectorData meteorologicalDetectorData : dataList) {
+ //
+ if (StringUtils.isNotEmpty(meteorologicalDetectorData.getRainfall()) || StringUtils.isNotEmpty(meteorologicalDetectorData.getVisibilityType())){
+ BigDecimal rainfall = new BigDecimal(meteorologicalDetectorData.getRainfall());
+ if (rainfall.compareTo(BigDecimal.ZERO) > 0 || !"4".equals(meteorologicalDetectorData.getVisibilityType())){
+ normalMileage = normalMileage.subtract(detectionRange);
+ anomalies ++;
+ if (rainfall.compareTo(BigDecimal.ZERO) > 0){
+ rainfallMileage = rainfallMileage.add(detectionRange);
+ }
+ if (!"4".equals(meteorologicalDetectorData.getVisibilityType())){
+ heavyFogNum ++;
+ heavyFogMileage = heavyFogMileage.add(detectionRange);
+ }
+ }
+ }
+ }
+
+ Map result = new HashMap<>();
+ result.put("normalMileage",normalMileage);
+ result.put("rainfallMileage",rainfallMileage);
+ result.put("heavyFogNum",heavyFogNum);
+ result.put("heavyFogMileage",heavyFogMileage);
+ result.put("anomalies",anomalies);
+ result.put("deviceNum",deviceNum);
+
+ return AjaxResult.success(result);
+ }
+
+}
diff --git a/zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml b/zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml
new file mode 100644
index 00000000..f0055df1
--- /dev/null
+++ b/zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select id, iot_device_id, rainfall, visibility_type, visibility, road_surface_status, atmospheric_pressure, temperature, humidity, wind_direction, wind_speed, freezing_point_temperature, salinity_value, road_surface_temperature, water_film_thickness, precipitation_type, wet_slippery_coefficient, sensor_temperature, remote_road_surface_temperature, remote_road_surface_status, sub_surface_temperature, water_film_ice_snow_value,create_time from dc_meteorological_detector_data
+
+
+
+
+
+
+
+ insert into dc_meteorological_detector_data
+
+ iot_device_id,
+ rainfall,
+ visibility_type,
+ visibility,
+ road_surface_status,
+ atmospheric_pressure,
+ temperature,
+ humidity,
+ wind_direction,
+ wind_speed,
+ freezing_point_temperature,
+ salinity_value,
+ road_surface_temperature,
+ water_film_thickness,
+ precipitation_type,
+ wet_slippery_coefficient,
+ sensor_temperature,
+ remote_road_surface_temperature,
+ remote_road_surface_status,
+ sub_surface_temperature,
+ water_film_ice_snow_value,
+ create_time
+
+
+ #{iotDeviceId},
+ #{rainfall},
+ #{visibilityType},
+ #{visibility},
+ #{roadSurfaceStatus},
+ #{atmosphericPressure},
+ #{temperature},
+ #{humidity},
+ #{windDirection},
+ #{windSpeed},
+ #{freezingPointTemperature},
+ #{salinityValue},
+ #{roadSurfaceTemperature},
+ #{waterFilmThickness},
+ #{precipitationType},
+ #{wetSlipperyCoefficient},
+ #{sensorTemperature},
+ #{remoteRoadSurfaceTemperature},
+ #{remoteRoadSurfaceStatus},
+ #{subSurfaceTemperature},
+ #{waterFilmIceSnowValue},
+ current_date
+
+
+
+
+ update dc_meteorological_detector_data
+
+ iot_device_id = #{iotDeviceId},
+ rainfall = #{rainfall},
+ visibility_type = #{visibilityType},
+ visibility = #{visibility},
+ road_surface_status = #{roadSurfaceStatus},
+ atmospheric_pressure = #{atmosphericPressure},
+ temperature = #{temperature},
+ humidity = #{humidity},
+ wind_direction = #{windDirection},
+ wind_speed = #{windSpeed},
+ freezing_point_temperature = #{freezingPointTemperature},
+ salinity_value = #{salinityValue},
+ road_surface_temperature = #{roadSurfaceTemperature},
+ water_film_thickness = #{waterFilmThickness},
+ precipitation_type = #{precipitationType},
+ wet_slippery_coefficient = #{wetSlipperyCoefficient},
+ sensor_temperature = #{sensorTemperature},
+ remote_road_surface_temperature = #{remoteRoadSurfaceTemperature},
+ remote_road_surface_status = #{remoteRoadSurfaceStatus},
+ sub_surface_temperature = #{subSurfaceTemperature},
+ water_film_ice_snow_value = #{waterFilmIceSnowValue},
+
+ where id = #{id}
+
+
+
+ delete from dc_meteorological_detector_data where id = #{id}
+
+
+
+ delete from dc_meteorological_detector_data where id in
+
+ #{id}
+
+
+
\ No newline at end of file
diff --git a/zc-business/src/main/resources/mapper/business/DcWeatherMinitoringMapper.xml b/zc-business/src/main/resources/mapper/business/DcWeatherMinitoringMapper.xml
new file mode 100644
index 00000000..134223c5
--- /dev/null
+++ b/zc-business/src/main/resources/mapper/business/DcWeatherMinitoringMapper.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
\ No newline at end of file
From 7d3e6b7484651cda7f3d44dc844018494544a630 Mon Sep 17 00:00:00 2001
From: lau572 <1010031226@qq.com>
Date: Sun, 4 Feb 2024 11:22:11 +0800
Subject: [PATCH 4/6] =?UTF-8?q?redis=E6=B6=88=E6=81=AF=E8=AE=A2=E9=98=85?=
=?UTF-8?q?=E6=B0=94=E8=B1=A1=E7=9B=91=E6=B5=8B=E5=99=A8=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DevicePropertyReportListener.java | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java b/zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java
index 9f1de3c8..d7370696 100644
--- a/zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java
+++ b/zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java
@@ -1,5 +1,10 @@
package com.zc.business.message.device.listener;
+import com.alibaba.fastjson.JSON;
+import com.google.gson.JsonObject;
+import com.zc.business.domain.DcDevice;
+import com.zc.business.domain.DcMeteorologicalDetectorData;
+import com.zc.business.service.IDcMeteorologicalDetectorDataService;
import com.zc.common.core.redis.stream.RedisStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -7,8 +12,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.stream.ObjectRecord;
import org.springframework.data.redis.connection.stream.RecordId;
import org.springframework.data.redis.stream.StreamListener;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* 设备属性上报消息监听
*/
@@ -19,12 +30,32 @@ public class DevicePropertyReportListener implements StreamListener message) {
String streamKay = message.getStream();
RecordId recordId = message.getId();
+ threadPoolTaskExecutor.execute(() -> {
+ Map data = JSON.parseObject(message.getValue(), HashMap.class);
+ Map headers = (Map) data.get("headers");
+ if (headers.get("productId") != null){
+ String productId = headers.get("productId").toString();
+ //气象检测器
+ if ("zc-meteorological".equals(productId)){
+ DcMeteorologicalDetectorData meteorologicalDetectorData = (DcMeteorologicalDetectorData) data.get("properties");
+ meteorologicalDetectorData.setIotDeviceId(data.get("deviceId").toString());
+ meteorologicalDetectorDataService.insertDcMeteorologicalDetectorData(meteorologicalDetectorData);
+ } else if ("zc-yzsqkdc-3131".equals(productId)){
+ //交调
+
+ }
+ }
+ });
// 消费完后直接删除消息
redisStream.del(streamKay, String.valueOf(recordId));
}
From d0788b65dc2dfd97a42c1bcf0ece19d28c86e3f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com>
Date: Sun, 4 Feb 2024 14:50:40 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E5=BD=B1=E5=93=8D=E8=BD=A6=E9=81=93?=
=?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA=20string=20=E5=A4=9A?=
=?UTF-8?q?=E4=B8=AA=E8=BD=A6=E9=81=93=E9=87=87=E7=94=A8=E2=80=9C=EF=BC=8C?=
=?UTF-8?q?=E2=80=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zc-business/src/main/java/com/zc/business/domain/DcEvent.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEvent.java b/zc-business/src/main/java/com/zc/business/domain/DcEvent.java
index b7b52bd0..a48aec33 100644
--- a/zc-business/src/main/java/com/zc/business/domain/DcEvent.java
+++ b/zc-business/src/main/java/com/zc/business/domain/DcEvent.java
@@ -214,8 +214,8 @@ public class DcEvent extends BaseEntity {
@ApiModelProperty("是否是感知事件 0 表示 false,1 表示 true")
private Integer isPerceived;
@Excel(name = "影响车道")
- @ApiModelProperty("影响车道")
- private Long lang;
+ @ApiModelProperty("影响车道 车道占用:0-应急1-行1,2-行2,3-行3,4-行4")
+ private String lang;
@ApiModelProperty("高速名")
@TableField(exist = false)
private String roadName;
From 7741c39c68e766aec6844628f3d7a2a7e2791c38 Mon Sep 17 00:00:00 2001
From: zhaoxianglong
Date: Mon, 5 Feb 2024 11:12:44 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AE?=
=?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=A1=A9=E5=8F=B7=E8=8C=83=E5=9B=B4=E6=9F=A5?=
=?UTF-8?q?=E8=AF=A2=E8=AE=BE=E5=A4=87=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../controller/DcDeviceController.java | 14 +++++
.../zc/business/service/IDcDeviceService.java | 3 ++
.../service/impl/DcDeviceServiceImpl.java | 51 +++++++++++++++++--
3 files changed, 63 insertions(+), 5 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 118be3f9..af4114a7 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
@@ -26,6 +26,7 @@ import javax.validation.Valid;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* 设备Controller
@@ -83,6 +84,19 @@ public class DcDeviceController extends BaseController {
return AjaxResult.success(dcDeviceService.listDevice(dcDevice));
}
+ /**
+ * 无分页根据设备桩号查询设备列表
+ *
+ * @param parameter 请求参数
+ * @return 查询结果
+ */
+ @ApiOperation("无分页根据设备桩号查询设备列表")
+ @PreAuthorize("@ss.hasPermi('iot:device:query')")
+ @PostMapping("pileNumberQuery")
+ public AjaxResult devicePileNumberQueryDevice(@RequestBody Map parameter) {
+ return AjaxResult.success(dcDeviceService.devicePileNumberQueryDevice(parameter));
+ }
+
/**
* 根据id查询设备信息
*
diff --git a/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java b/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java
index 71345747..2e4b12b3 100644
--- a/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java
+++ b/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java
@@ -6,6 +6,7 @@ import com.zc.business.domain.DcDevice;
import com.zc.business.domain.DcStakeMark;
import java.util.List;
+import java.util.Map;
/**
* 设备Service接口
@@ -74,4 +75,6 @@ public interface IDcDeviceService extends IService {
DcStakeMark exampleQueryTheAssociatedPileNumber(DcDevice dcDevice);
Long statisticalAnomalyDevice();
+
+ List devicePileNumberQueryDevice(Map parameter);
}
diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java
index c0858d00..3f4a497a 100644
--- a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java
+++ b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java
@@ -16,9 +16,9 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* 设备Service业务层处理
@@ -35,6 +35,7 @@ public class DcDeviceServiceImpl extends ServiceImpl i
@Resource
private DcDeviceMapper dcDeviceMapper;
+ private static String REGEX_CHINESE = "[\u4e00-\u9fa5]";// 中文正则
public LambdaQueryWrapper deviceQueryWrapper(DcDevice dcDevice) {
@@ -254,8 +255,8 @@ public class DcDeviceServiceImpl extends ServiceImpl i
public boolean batchUpdate(List listDevice) {
for (DcDevice device : listDevice) {
LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(DcDevice::getIotDeviceId,device.getIotDeviceId());
- update(device,queryWrapper);
+ queryWrapper.eq(DcDevice::getIotDeviceId, device.getIotDeviceId());
+ update(device, queryWrapper);
}
return true;
}
@@ -295,5 +296,45 @@ public class DcDeviceServiceImpl extends ServiceImpl i
lambdaQueryWrapper.eq(DcDevice::getDeviceState, 0).or().isNull(DcDevice::getDeviceState);
return (long) list(lambdaQueryWrapper).size();
}
+
+ @Override
+ public List devicePileNumberQueryDevice(Map parameter) {
+ ArrayList dcDevices = new ArrayList<>();
+ Integer startStakeMark = Integer.parseInt(String.valueOf(parameter.get("startStakeMark").get(0)) + String.valueOf(parameter.get("startStakeMark").get(1)));
+ Integer endStakeMark = Integer.parseInt(String.valueOf(parameter.get("endStakeMark").get(0)) + String.valueOf(parameter.get("endStakeMark").get(1)));
+ LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>();
+ ArrayList integers = new ArrayList<>();
+ integers.add(6);
+ lambdaQueryWrapper.notIn(DcDevice::getDeviceType,integers);
+ List list = list(lambdaQueryWrapper);
+ for (DcDevice dcDevice : list) {
+ String stakeMark = dcDevice.getStakeMark();
+ Pattern pat = Pattern.compile(REGEX_CHINESE);
+ Matcher mat = pat.matcher(stakeMark);
+ stakeMark = mat.replaceAll("");
+ if (stakeMark == null || stakeMark.equals("")) {
+ continue;
+ }
+
+ if (stakeMark.startsWith("-")) {
+ String[] split = stakeMark.replace("K", "").replace("k", "").split("-");
+ for (String s : split) {
+ String[] ks = s.split("\\+");
+ double integer = Double.parseDouble(ks[0] + ks[1]);
+ if (startStakeMark <= integer && endStakeMark >= integer) {
+ dcDevices.add(dcDevice);
+ }
+ }
+ } else {
+ String[] ks = stakeMark.replace("K", "").replace("k", "").split("\\+");
+ double integer = Double.parseDouble(ks[0] + ks[1]);
+ if (startStakeMark <= integer && endStakeMark >= integer) {
+ dcDevices.add(dcDevice);
+ }
+ }
+ }
+
+ return dcDevices;
+ }
}