21 changed files with 1124 additions and 48 deletions
@ -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<String, Object> 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)); |
|||
} |
|||
} |
@ -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(); |
|||
} |
|||
|
|||
|
|||
} |
@ -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(); |
|||
} |
|||
} |
@ -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<DcMeteorologicalDetectorData> 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); |
|||
} |
@ -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<com.zc.business.domain.DcMeteorologicalDetectorData> |
|||
*/ |
|||
List<DcMeteorologicalDetectorData> selectMeteorologicalDetectorData(); |
|||
|
|||
} |
@ -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<DcMeteorologicalDetectorData> 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); |
|||
} |
@ -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(); |
|||
|
|||
|
|||
} |
@ -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<DcMeteorologicalDetectorData> 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); |
|||
} |
|||
} |
@ -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<DcMeteorologicalDetectorData> 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<String,Object> 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); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,159 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.zc.business.mapper.DcMeteorologicalDetectorDataMapper"> |
|||
|
|||
<resultMap type="DcMeteorologicalDetectorData" id="DcMeteorologicalDetectorDataResult"> |
|||
<result property="id" column="id" /> |
|||
<result property="iotDeviceId" column="iot_device_id" /> |
|||
<result property="rainfall" column="rainfall" /> |
|||
<result property="visibilityType" column="visibility_type" /> |
|||
<result property="visibility" column="visibility" /> |
|||
<result property="roadSurfaceStatus" column="road_surface_status" /> |
|||
<result property="atmosphericPressure" column="atmospheric_pressure" /> |
|||
<result property="temperature" column="temperature" /> |
|||
<result property="humidity" column="humidity" /> |
|||
<result property="windDirection" column="wind_direction" /> |
|||
<result property="windSpeed" column="wind_speed" /> |
|||
<result property="freezingPointTemperature" column="freezing_point_temperature" /> |
|||
<result property="salinityValue" column="salinity_value" /> |
|||
<result property="roadSurfaceTemperature" column="road_surface_temperature" /> |
|||
<result property="waterFilmThickness" column="water_film_thickness" /> |
|||
<result property="precipitationType" column="precipitation_type" /> |
|||
<result property="wetSlipperyCoefficient" column="wet_slippery_coefficient" /> |
|||
<result property="sensorTemperature" column="sensor_temperature" /> |
|||
<result property="remoteRoadSurfaceTemperature" column="remote_road_surface_temperature" /> |
|||
<result property="remoteRoadSurfaceStatus" column="remote_road_surface_status" /> |
|||
<result property="subSurfaceTemperature" column="sub_surface_temperature" /> |
|||
<result property="waterFilmIceSnowValue" column="water_film_ice_snow_value" /> |
|||
<result property="createTime" column="create_time" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectDcMeteorologicalDetectorDataVo"> |
|||
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 |
|||
</sql> |
|||
|
|||
<select id="selectDcMeteorologicalDetectorDataList" parameterType="DcMeteorologicalDetectorData" resultMap="DcMeteorologicalDetectorDataResult"> |
|||
<include refid="selectDcMeteorologicalDetectorDataVo"/> |
|||
<where> |
|||
<if test="iotDeviceId != null and iotDeviceId != ''"> and iot_device_id = #{iotDeviceId}</if> |
|||
<if test="rainfall != null and rainfall != ''"> and rainfall = #{rainfall}</if> |
|||
<if test="visibilityType != null and visibilityType != ''"> and visibility_type = #{visibilityType}</if> |
|||
<if test="visibility != null and visibility != ''"> and visibility = #{visibility}</if> |
|||
<if test="roadSurfaceStatus != null and roadSurfaceStatus != ''"> and road_surface_status = #{roadSurfaceStatus}</if> |
|||
<if test="atmosphericPressure != null and atmosphericPressure != ''"> and atmospheric_pressure = #{atmosphericPressure}</if> |
|||
<if test="temperature != null and temperature != ''"> and temperature = #{temperature}</if> |
|||
<if test="humidity != null and humidity != ''"> and humidity = #{humidity}</if> |
|||
<if test="windDirection != null and windDirection != ''"> and wind_direction = #{windDirection}</if> |
|||
<if test="windSpeed != null and windSpeed != ''"> and wind_speed = #{windSpeed}</if> |
|||
<if test="freezingPointTemperature != null and freezingPointTemperature != ''"> and freezing_point_temperature = #{freezingPointTemperature}</if> |
|||
<if test="salinityValue != null and salinityValue != ''"> and salinity_value = #{salinityValue}</if> |
|||
<if test="roadSurfaceTemperature != null and roadSurfaceTemperature != ''"> and road_surface_temperature = #{roadSurfaceTemperature}</if> |
|||
<if test="waterFilmThickness != null and waterFilmThickness != ''"> and water_film_thickness = #{waterFilmThickness}</if> |
|||
<if test="precipitationType != null and precipitationType != ''"> and precipitation_type = #{precipitationType}</if> |
|||
<if test="wetSlipperyCoefficient != null and wetSlipperyCoefficient != ''"> and wet_slippery_coefficient = #{wetSlipperyCoefficient}</if> |
|||
<if test="sensorTemperature != null and sensorTemperature != ''"> and sensor_temperature = #{sensorTemperature}</if> |
|||
<if test="remoteRoadSurfaceTemperature != null and remoteRoadSurfaceTemperature != ''"> and remote_road_surface_temperature = #{remoteRoadSurfaceTemperature}</if> |
|||
<if test="remoteRoadSurfaceStatus != null and remoteRoadSurfaceStatus != ''"> and remote_road_surface_status = #{remoteRoadSurfaceStatus}</if> |
|||
<if test="subSurfaceTemperature != null and subSurfaceTemperature != ''"> and sub_surface_temperature = #{subSurfaceTemperature}</if> |
|||
<if test="waterFilmIceSnowValue != null and waterFilmIceSnowValue != ''"> and water_film_ice_snow_value = #{waterFilmIceSnowValue}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectDcMeteorologicalDetectorDataById" parameterType="Long" resultMap="DcMeteorologicalDetectorDataResult"> |
|||
<include refid="selectDcMeteorologicalDetectorDataVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
<insert id="insertDcMeteorologicalDetectorData" parameterType="DcMeteorologicalDetectorData" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into dc_meteorological_detector_data |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="iotDeviceId != null">iot_device_id,</if> |
|||
<if test="rainfall != null">rainfall,</if> |
|||
<if test="visibilityType != null">visibility_type,</if> |
|||
<if test="visibility != null">visibility,</if> |
|||
<if test="roadSurfaceStatus != null">road_surface_status,</if> |
|||
<if test="atmosphericPressure != null">atmospheric_pressure,</if> |
|||
<if test="temperature != null">temperature,</if> |
|||
<if test="humidity != null">humidity,</if> |
|||
<if test="windDirection != null">wind_direction,</if> |
|||
<if test="windSpeed != null">wind_speed,</if> |
|||
<if test="freezingPointTemperature != null">freezing_point_temperature,</if> |
|||
<if test="salinityValue != null">salinity_value,</if> |
|||
<if test="roadSurfaceTemperature != null">road_surface_temperature,</if> |
|||
<if test="waterFilmThickness != null">water_film_thickness,</if> |
|||
<if test="precipitationType != null">precipitation_type,</if> |
|||
<if test="wetSlipperyCoefficient != null">wet_slippery_coefficient,</if> |
|||
<if test="sensorTemperature != null">sensor_temperature,</if> |
|||
<if test="remoteRoadSurfaceTemperature != null">remote_road_surface_temperature,</if> |
|||
<if test="remoteRoadSurfaceStatus != null">remote_road_surface_status,</if> |
|||
<if test="subSurfaceTemperature != null">sub_surface_temperature,</if> |
|||
<if test="waterFilmIceSnowValue != null">water_film_ice_snow_value,</if> |
|||
create_time |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="iotDeviceId != null">#{iotDeviceId},</if> |
|||
<if test="rainfall != null">#{rainfall},</if> |
|||
<if test="visibilityType != null">#{visibilityType},</if> |
|||
<if test="visibility != null">#{visibility},</if> |
|||
<if test="roadSurfaceStatus != null">#{roadSurfaceStatus},</if> |
|||
<if test="atmosphericPressure != null">#{atmosphericPressure},</if> |
|||
<if test="temperature != null">#{temperature},</if> |
|||
<if test="humidity != null">#{humidity},</if> |
|||
<if test="windDirection != null">#{windDirection},</if> |
|||
<if test="windSpeed != null">#{windSpeed},</if> |
|||
<if test="freezingPointTemperature != null">#{freezingPointTemperature},</if> |
|||
<if test="salinityValue != null">#{salinityValue},</if> |
|||
<if test="roadSurfaceTemperature != null">#{roadSurfaceTemperature},</if> |
|||
<if test="waterFilmThickness != null">#{waterFilmThickness},</if> |
|||
<if test="precipitationType != null">#{precipitationType},</if> |
|||
<if test="wetSlipperyCoefficient != null">#{wetSlipperyCoefficient},</if> |
|||
<if test="sensorTemperature != null">#{sensorTemperature},</if> |
|||
<if test="remoteRoadSurfaceTemperature != null">#{remoteRoadSurfaceTemperature},</if> |
|||
<if test="remoteRoadSurfaceStatus != null">#{remoteRoadSurfaceStatus},</if> |
|||
<if test="subSurfaceTemperature != null">#{subSurfaceTemperature},</if> |
|||
<if test="waterFilmIceSnowValue != null">#{waterFilmIceSnowValue},</if> |
|||
current_date |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateDcMeteorologicalDetectorData" parameterType="DcMeteorologicalDetectorData"> |
|||
update dc_meteorological_detector_data |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="iotDeviceId != null">iot_device_id = #{iotDeviceId},</if> |
|||
<if test="rainfall != null">rainfall = #{rainfall},</if> |
|||
<if test="visibilityType != null">visibility_type = #{visibilityType},</if> |
|||
<if test="visibility != null">visibility = #{visibility},</if> |
|||
<if test="roadSurfaceStatus != null">road_surface_status = #{roadSurfaceStatus},</if> |
|||
<if test="atmosphericPressure != null">atmospheric_pressure = #{atmosphericPressure},</if> |
|||
<if test="temperature != null">temperature = #{temperature},</if> |
|||
<if test="humidity != null">humidity = #{humidity},</if> |
|||
<if test="windDirection != null">wind_direction = #{windDirection},</if> |
|||
<if test="windSpeed != null">wind_speed = #{windSpeed},</if> |
|||
<if test="freezingPointTemperature != null">freezing_point_temperature = #{freezingPointTemperature},</if> |
|||
<if test="salinityValue != null">salinity_value = #{salinityValue},</if> |
|||
<if test="roadSurfaceTemperature != null">road_surface_temperature = #{roadSurfaceTemperature},</if> |
|||
<if test="waterFilmThickness != null">water_film_thickness = #{waterFilmThickness},</if> |
|||
<if test="precipitationType != null">precipitation_type = #{precipitationType},</if> |
|||
<if test="wetSlipperyCoefficient != null">wet_slippery_coefficient = #{wetSlipperyCoefficient},</if> |
|||
<if test="sensorTemperature != null">sensor_temperature = #{sensorTemperature},</if> |
|||
<if test="remoteRoadSurfaceTemperature != null">remote_road_surface_temperature = #{remoteRoadSurfaceTemperature},</if> |
|||
<if test="remoteRoadSurfaceStatus != null">remote_road_surface_status = #{remoteRoadSurfaceStatus},</if> |
|||
<if test="subSurfaceTemperature != null">sub_surface_temperature = #{subSurfaceTemperature},</if> |
|||
<if test="waterFilmIceSnowValue != null">water_film_ice_snow_value = #{waterFilmIceSnowValue},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteDcMeteorologicalDetectorDataById" parameterType="Long"> |
|||
delete from dc_meteorological_detector_data where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteDcMeteorologicalDetectorDataByIds" parameterType="String"> |
|||
delete from dc_meteorological_detector_data where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
</mapper> |
@ -0,0 +1,22 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.zc.business.mapper.DcWeatherMonitoringMapper"> |
|||
|
|||
|
|||
<select id="selectMeteorologicalDetectorData" |
|||
resultType="com.zc.business.domain.DcMeteorologicalDetectorData"> |
|||
SELECT * |
|||
FROM |
|||
dc_meteorological_detector_data |
|||
WHERE |
|||
id IN ( |
|||
SELECT |
|||
MAX( id ) |
|||
FROM dc_meteorological_detector_data |
|||
where DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(now(),'%Y-%m-%d') |
|||
GROUP BY iot_device_id |
|||
) |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue