diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 9849822d..b66131c4 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -15,10 +15,10 @@ spring: # 从库数据源 slave: # 从数据源开关/默认关闭 - enabled: false - url: - username: - password: + enabled: true + url: jdbc:mysql://10.168.56.204:3306/jihe-md?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true + username: root + password: Platform123!@# # 初始连接数 initialSize: 5 # 最小连接池数量 diff --git a/zc-business/pom.xml b/zc-business/pom.xml index e83ad99b..275f2980 100644 --- a/zc-business/pom.xml +++ b/zc-business/pom.xml @@ -39,6 +39,10 @@ + + com.ruoyi + ruoyi-system + com.zc 1.0.0 diff --git a/zc-business/src/main/java/com/zc/business/controller/DcRampController.java b/zc-business/src/main/java/com/zc/business/controller/DcRampController.java index d6394d59..73c4923a 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcRampController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcRampController.java @@ -5,6 +5,8 @@ import javax.servlet.http.HttpServletResponse; import com.zc.business.domain.DcRamp; import com.zc.business.service.IDcRampService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -29,6 +31,8 @@ import com.ruoyi.common.core.page.TableDataInfo; * @author ruoyi * @date 2024-01-12 */ +@Api(value = "匝道信息",tags = {"匝道信息"}) + @RestController @RequestMapping("/system/ramp") public class DcRampController extends BaseController @@ -39,18 +43,33 @@ public class DcRampController extends BaseController /** * 查询匝道信息列表 */ - @PreAuthorize("@ss.hasPermi('system:ramp:list')") + @ApiOperation("查询匝道信息列表") + + //@PreAuthorize("@ss.hasPermi('system:ramp:list')") @GetMapping("/list") public TableDataInfo list(DcRamp dcRamp) { startPage(); List list = dcRampService.selectDcRampList(dcRamp); return getDataTable(list); + } /** + * 无分页查询匝道信息列表 + */ +@ApiOperation("无分页查询匝道信息列表") + +//@PreAuthorize("@ss.hasPermi('system:ramp:list')") + @GetMapping("/listAll") + public TableDataInfo listAll(DcRamp dcRamp) + { + List list = dcRampService.selectDcRampList(dcRamp); + return getDataTable(list); } /** * 根据设施类型 查询匝道信息列表 */ - // @PreAuthorize("@ss.hasPermi('system:ramp:list')") + @ApiOperation("根据设施类型 查询匝道信息列表") + + // @PreAuthorize("@ss.hasPermi('system:ramp:list')") @GetMapping("/listAll/{type}") public TableDataInfo listAll(@PathVariable("type") Long type) { @@ -61,7 +80,9 @@ public class DcRampController extends BaseController /** * 导出匝道信息列表 */ - @PreAuthorize("@ss.hasPermi('system:ramp:export')") + @ApiOperation("导出匝道信息列表") + + // @PreAuthorize("@ss.hasPermi('system:ramp:export')") @Log(title = "匝道信息", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, DcRamp dcRamp) @@ -74,7 +95,9 @@ public class DcRampController extends BaseController /** * 获取匝道信息详细信息 */ - @PreAuthorize("@ss.hasPermi('system:ramp:query')") + @ApiOperation("获取匝道信息详细信息") + + // @PreAuthorize("@ss.hasPermi('system:ramp:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { @@ -84,7 +107,9 @@ public class DcRampController extends BaseController /** * 新增匝道信息 */ - @PreAuthorize("@ss.hasPermi('system:ramp:add')") + @ApiOperation("新增匝道信息") + + // @PreAuthorize("@ss.hasPermi('system:ramp:add')") @Log(title = "匝道信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody DcRamp dcRamp) @@ -95,7 +120,9 @@ public class DcRampController extends BaseController /** * 修改匝道信息 */ - @PreAuthorize("@ss.hasPermi('system:ramp:edit')") + @ApiOperation("修改匝道信息") + + // @PreAuthorize("@ss.hasPermi('system:ramp:edit')") @Log(title = "匝道信息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody DcRamp dcRamp) @@ -106,7 +133,9 @@ public class DcRampController extends BaseController /** * 删除匝道信息 */ - @PreAuthorize("@ss.hasPermi('system:ramp:remove')") + @ApiOperation("删除匝道信息") + + // @PreAuthorize("@ss.hasPermi('system:ramp:remove')") @Log(title = "匝道信息", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) 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 99a2af28..d4544c30 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 @@ -9,6 +9,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; import com.zc.business.domain.DcDevice; import com.zc.business.service.IDcDeviceService; +import com.zc.business.service.IMiddleDatabaseService; import com.zc.common.core.httpclient.OkHttp; import com.zc.common.core.httpclient.exception.HttpException; import com.zc.common.core.httpclient.request.RequestParams; @@ -59,6 +60,9 @@ public class VideoController extends BaseController { @Resource private IDcDeviceService iDcDeviceService; + @Resource + private IMiddleDatabaseService middleDatabaseService; + /** * 查询附近相机 */ @@ -137,6 +141,10 @@ public class VideoController extends BaseController { } iDcDeviceService.batchUpdate(list); + + //更新中间库的设备状态 + middleDatabaseService.updateMiddleDatabaseDeviceByList(list); + logger.debug("执行:同步数据平台视频设备的设备状态成功!!"); } @@ -153,6 +161,10 @@ public class VideoController extends BaseController { dcDevices.add(dcDevice); } iDcDeviceService.batchUpdate(dcDevices); + + //更新中间库的设备状态 + middleDatabaseService.updateMiddleDatabaseDeviceByList(dcDevices); + logger.debug("执行:同步物联平台设备的设备状态成功!!"); } @@ -168,6 +180,9 @@ public class VideoController extends BaseController { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(DcDevice::getIotDeviceId, dcDevice.getIotDeviceId()); iDcDeviceService.update(dcDevice, queryWrapper); + + //更新中间库的设备状态 + middleDatabaseService.updateMiddleDatabaseDevice(dcDevice); } logger.debug("执行:同步广播设备的设备状态成功!!"); 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 a48aec33..1bb5a05b 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 @@ -40,8 +40,10 @@ public class DcEvent extends BaseEntity { * 所属部门 */ @ApiModelProperty("所属部门") - @Excel(name = "所属部门") private Long deptId; + @Excel(name = "所属部门") + private String deptName; + /** * 所在桩号 */ @@ -59,7 +61,8 @@ public class DcEvent extends BaseEntity { * 2-中 * 3-下 */ - @Excel(name = "方向") + @Excel(name = "方向", readConverterExp = "1=上行,3=下行") + //@Excel(name = "方向") @ApiModelProperty("方向") private String direction; /** @@ -196,10 +199,10 @@ public class DcEvent extends BaseEntity { /** * 是否处在隧道 */ - @Excel(name = "是否处在隧道") + @Excel(name = "是否处在隧道" , readConverterExp = "0=否,1=是") @ApiModelProperty("是否处在隧道 0 表示 false,1 表示 true") private Integer inTunnel; - @Excel(name = "高速") + //@Excel(name = "高速") @ApiModelProperty("高速公路") private Long roadId; @@ -210,9 +213,10 @@ public class DcEvent extends BaseEntity { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty("发生时间") private Date occurrenceTime; - @Excel(name = "是否是感知事件") + @Excel(name = "是否是感知事件" , readConverterExp = "0=否,1=是") @ApiModelProperty("是否是感知事件 0 表示 false,1 表示 true") private Integer isPerceived; + @Excel(name = "影响车道") @ApiModelProperty("影响车道 车道占用:0-应急1-行1,2-行2,3-行3,4-行4") private String lang; diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEventAccident.java b/zc-business/src/main/java/com/zc/business/domain/DcEventAccident.java index 3d1785e0..a794ccc1 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcEventAccident.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcEventAccident.java @@ -222,9 +222,13 @@ public class DcEventAccident extends BaseEntity { * 设施关联 */ @ApiModelProperty("设施关联") - private Integer facilityId; +@ApiModelProperty("匝道") + private Integer rampId; +@ApiModelProperty("地点") + private String location; + @ApiModelProperty("事件信息实体") //事件信息表 @TableField(exist = false) diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEventConstruction.java b/zc-business/src/main/java/com/zc/business/domain/DcEventConstruction.java index 778d75de..28b94856 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcEventConstruction.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcEventConstruction.java @@ -1,21 +1,19 @@ package com.zc.business.domain; import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -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_event_construction - * + *

+ * "施工分类"为事件“事件子类”对象 dc_event_construction + * * @author ruoyi * @date 2024-01-12 */ @@ -23,77 +21,104 @@ import com.ruoyi.common.core.domain.BaseEntity; @Data @AllArgsConstructor @NoArgsConstructor -public class DcEventConstruction extends BaseEntity -{ +public class DcEventConstruction extends BaseEntity { private static final long serialVersionUID = 1L; -@ApiModelProperty("事件编号") + @ApiModelProperty("事件编号") /** 事件编号 */ private String id; - /** 管制方式: - 1-封闭 - 2-不封闭 */ -@ApiModelProperty("管制方式") + /** + * 管制方式: + * 1-封闭 + * 2-不封闭 + */ + @ApiModelProperty("管制方式") private Long controlMode; - /** 地点类型: - 1-单点 - 2-多点 */ -@ApiModelProperty("地点类型:1-单点2-多点") + /** + * 地点类型: + * 1-单点 + * 2-多点 + */ + @ApiModelProperty("地点类型:1-单点2-多点") private Long locationType; - /** 特殊地点描述 */ + /** + * 特殊地点描述 + */ @Excel(name = "特殊地点描述") @ApiModelProperty("特殊地点描述") private String specialPlaceDescription; - /** 专项施工: - 1-专项工程施工 - 2-改扩建专项工程施工 - 3-桥梁专项工程施工 - 4-其他专项工程施工 */ -@ApiModelProperty(" 专项施工:1-专项工程施工2-改扩建专项工程施工3-桥梁专项工程施工\4-其他专项工程施工 ") + /** + * 专项施工: + * 1-专项工程施工 + * 2-改扩建专项工程施工 + * 3-桥梁专项工程施工 + * 4-其他专项工程施工 + */ + @ApiModelProperty(" 专项施工:1-专项工程施工2-改扩建专项工程施工3-桥梁专项工程施工\4-其他专项工程施工 ") private Long specialConstruction; - /** 其他施工名称 */ + /** + * 其他施工名称 + */ @Excel(name = "其他施工名称") @ApiModelProperty("其他施工名称") private String otherConstructionName; - /** 施工措施: - 0-无 - 1-并道行驶 - 2-临时保通 - 3-借路侧服务区通行 */ -@ApiModelProperty("施工措施 0-无1-并道行驶2-临时保通3-借路侧服务区通行") + /** + * 施工措施: + * 0-无 + * 1-并道行驶 + * 2-临时保通 + * 3-借路侧服务区通行 + */ + @ApiModelProperty("施工措施 0-无1-并道行驶2-临时保通3-借路侧服务区通行") private Long constructionMeasurement; - /** 字段名称对应: - 互通立交 - 收费站 - 服务区 - - */ -@ApiModelProperty("字段名称对应:互通立交 收费站 服务区") + /** + * 字段名称对应: + * 互通立交 + * 收费站 + * 服务区 + */ + @ApiModelProperty("字段名称对应:互通立交 收费站 服务区") private Long facilityId; - /** 出入口(收费站/服务区): - 1-出口 - 2-入口 */ + /** + * 出入口(收费站/服务区): + * 1-出口 + * 2-入口 + */ @ApiModelProperty(" 出入口(收费站/服务区):1-出口 2-入口 ") @Excel(name = "出入口", readConverterExp = "收=费站/服务区") private Long exitsInlets; - /** 占用车道 - */ -@ApiModelProperty("占用车道") + /** + * 占用车道 + */ + @ApiModelProperty("占用车道") private String laneOccupancy; - /** 通行情况: - 1-通行正常 - 2-通行受阻 */ -@ApiModelProperty("通行情况:1-通行正常 2-通行受阻") + /** + * 通行情况: + * 1-通行正常 + * 2-通行受阻 + */ + @ApiModelProperty("通行情况:1-通行正常 2-通行受阻") private Long trafficCondition; + @ApiModelProperty("匝道") + private Long rampId; + @ApiModelProperty("施工方式") + private Long constructionMethod; + @ApiModelProperty("地方道路名称") + private String localRoadName; + @ApiModelProperty("结束桩号") + private String endStakeMark; + @ApiModelProperty("地点") + private String location; + @ApiModelProperty("事件信息实体") //事件信息表 diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEventTrafficCongestion.java b/zc-business/src/main/java/com/zc/business/domain/DcEventTrafficCongestion.java index f667ebe2..1157c9be 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcEventTrafficCongestion.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcEventTrafficCongestion.java @@ -75,6 +75,14 @@ public class DcEventTrafficCongestion extends BaseEntity @ApiModelProperty("地点(收费站):1-入口 2-出口 3-入口内广场 4--出口内广场5-外广场6-入口车道7-出口车道8-入口匝道9-出口匝道 ") private Long location; + @ApiModelProperty("详细原因") + private Integer detailedReasons; + + @ApiModelProperty("地点类型") + private Integer locationType; + @ApiModelProperty("地点描述") + private String locationDescription; + @ApiModelProperty("事件信息实体") //事件信息表 diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEventVehicleAccident.java b/zc-business/src/main/java/com/zc/business/domain/DcEventVehicleAccident.java index 6001d2fb..25461bb3 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcEventVehicleAccident.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcEventVehicleAccident.java @@ -114,6 +114,15 @@ public class DcEventVehicleAccident extends BaseEntity /** 私密事件 */ @ApiModelProperty( "私密事件") private Integer isPrivate; + @ApiModelProperty("设施关联") + private Integer facilityId; + + @ApiModelProperty("匝道") + private Integer rampId; + @ApiModelProperty("地点") + private String location; + + @ApiModelProperty("事件信息实体") //事件信息表 diff --git a/zc-business/src/main/java/com/zc/business/domain/DcRamp.java b/zc-business/src/main/java/com/zc/business/domain/DcRamp.java index 120ac8b3..0c0585d8 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcRamp.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcRamp.java @@ -48,6 +48,7 @@ public class DcRamp extends BaseEntity @ApiModelProperty("匝道宽度(米)") private Long widthMeters; + public void setId(Long id) { this.id = id; diff --git a/zc-business/src/main/java/com/zc/business/domain/MdDeviceData.java b/zc-business/src/main/java/com/zc/business/domain/MdDeviceData.java new file mode 100644 index 00000000..71b467ed --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/MdDeviceData.java @@ -0,0 +1,194 @@ +package com.zc.business.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; + +/** + * @Description 中间库设备数据 + * + * @author liuwenge + * @date 2024/2/20 17:30 + */ +public class MdDeviceData { + + /** 主键 */ + private Long id; + + /** 设备编号 */ + @Excel(name = "设备编号") + private String devNo; + + /** 设备类型 */ + @Excel(name = "设备类型") + private String devType; + + /** 时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date timeStamp; + + /** 自定义字段 */ + @Excel(name = "自定义字段") + private String expands; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date creationTime; + + /** 创建人 */ + @Excel(name = "创建人") + private String creatorUserId; + + /** 最后修改时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "最后修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date lastModificationTime; + + /** 最后修改人 */ + @Excel(name = "最后修改人") + private Long lastModifierUserId; + + /** 是否删除 */ + @Excel(name = "是否删除") + private Integer isDeleted; + + /** 删除人 */ + @Excel(name = "删除人") + private Long deleterUserId; + + /** 删除时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "删除时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date deletionTime; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setDevNo(String devNo) + { + this.devNo = devNo; + } + + public String getDevNo() + { + return devNo; + } + + public String getDevType() { + return devType; + } + + public void setDevType(String devType) { + this.devType = devType; + } + + public void setTimeStamp(Date timeStamp) + { + this.timeStamp = timeStamp; + } + + public Date getTimeStamp() + { + return timeStamp; + } + public void setExpands(String expands) + { + this.expands = expands; + } + + public String getExpands() + { + return expands; + } + public void setCreationTime(Date creationTime) + { + this.creationTime = creationTime; + } + + public Date getCreationTime() + { + return creationTime; + } + public void setCreatorUserId(String creatorUserId) + { + this.creatorUserId = creatorUserId; + } + + public String getCreatorUserId() + { + return creatorUserId; + } + public void setLastModificationTime(Date lastModificationTime) + { + this.lastModificationTime = lastModificationTime; + } + + public Date getLastModificationTime() + { + return lastModificationTime; + } + public void setLastModifierUserId(Long lastModifierUserId) + { + this.lastModifierUserId = lastModifierUserId; + } + + public Long getLastModifierUserId() + { + return lastModifierUserId; + } + public void setIsDeleted(Integer isDeleted) + { + this.isDeleted = isDeleted; + } + + public Integer getIsDeleted() + { + return isDeleted; + } + public void setDeleterUserId(Long deleterUserId) + { + this.deleterUserId = deleterUserId; + } + + public Long getDeleterUserId() + { + return deleterUserId; + } + public void setDeletionTime(Date deletionTime) + { + this.deletionTime = deletionTime; + } + + public Date getDeletionTime() + { + return deletionTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("devNo", getDevNo()) + .append("timeStamp", getTimeStamp()) + .append("expands", getExpands()) + .append("creationTime", getCreationTime()) + .append("creatorUserId", getCreatorUserId()) + .append("lastModificationTime", getLastModificationTime()) + .append("lastModifierUserId", getLastModifierUserId()) + .append("isDeleted", getIsDeleted()) + .append("deleterUserId", getDeleterUserId()) + .append("deletionTime", getDeletionTime()) + .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 index b98086ce..7788b60e 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java @@ -2,6 +2,7 @@ package com.zc.business.mapper; import java.util.List; import com.zc.business.domain.DcMeteorologicalDetectorData; +import com.zc.business.domain.MdDeviceData; /** * 气象检测器数据Mapper接口 @@ -43,22 +44,6 @@ public interface DcMeteorologicalDetectorDataMapper */ int updateDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); - /** - * 中间库新增气象检测器数据 - * - * @param dcMeteorologicalDetectorData 气象检测器数据 - * @return 结果 - */ - Boolean insertIntermediateWarehouseData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); - - /** - * 中间库修改气象检测器数据 - * - * @param dcMeteorologicalDetectorData 气象检测器数据 - * @return 结果 - */ - Boolean updateIntermediateWarehouseData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); - /** * 删除气象检测器数据 * diff --git a/zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java b/zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java new file mode 100644 index 00000000..f2ed25e0 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java @@ -0,0 +1,33 @@ +package com.zc.business.mapper; + +import com.zc.business.domain.DcBoardReleaseLog; +import com.zc.business.domain.DcDevice; +import com.zc.business.domain.MdDeviceData; + +import java.util.List; + +/** + * 中间库Mapper接口 + * + * @author ruoyi + * @date 2024-01-05 + */ +public interface MiddleDatabaseMapper +{ + + /** + * 中间库新增设备数据 + * + * @param mdDeviceData 气象检测器数据 + * @return 结果 + */ + Boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData); + + /** + * 更新中间库设备 + * + * @param dcDevice 设备 + * @return 结果 + */ + boolean updateMiddleDatabaseDevice(DcDevice dcDevice); +} 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 e96500e0..b5d775b0 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 @@ -13,6 +13,7 @@ import com.zc.business.enums.WarningStateEnum; import com.zc.business.enums.WarningSubclassEnum; import com.zc.business.service.IDcDeviceService; import com.zc.business.service.IDcWarningService; +import com.zc.business.service.IMiddleDatabaseService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -42,6 +43,9 @@ public class DeviceMessageHandler { @Resource private IDcWarningService dcWarningService; + @Resource + private IMiddleDatabaseService middleDatabaseService; + @Resource private RedisCache redisCache; @@ -65,6 +69,9 @@ public class DeviceMessageHandler { // 批量更新设备状态 dcDeviceService.batchUpdate(dcDevices); + + // 批量更新中间库设备状态 + middleDatabaseService.updateMiddleDatabaseDeviceByList(dcDevices); } /** 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 110da462..172dadf8 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,11 +1,14 @@ package com.zc.business.message.device.listener; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.google.gson.JsonObject; import com.zc.business.domain.DcDevice; import com.zc.business.domain.DcMeteorologicalDetectorData; +import com.zc.business.domain.MdDeviceData; import com.zc.business.enums.IotProductEnum; import com.zc.business.service.IDcMeteorologicalDetectorDataService; +import com.zc.business.service.IMiddleDatabaseService; import com.zc.common.core.redis.stream.RedisStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -17,6 +20,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Component; import javax.annotation.Resource; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -36,6 +40,8 @@ public class DevicePropertyReportListener implements StreamListener message) { @@ -53,8 +59,31 @@ public class DevicePropertyReportListener implements StreamListener expands = new HashMap<>(); + expands.put("rainFall",meteorologicalDetectorData.getRainfall()); //雨量 + expands.put("windSpeed",meteorologicalDetectorData.getWindSpeed()); //风速 + expands.put("windDirection",meteorologicalDetectorData.getWindDirection()); //风向 + expands.put("temperature",meteorologicalDetectorData.getTemperature()); //大气温度 + expands.put("humidity",meteorologicalDetectorData.getHumidity()); //大气湿度 + expands.put("airPressure",meteorologicalDetectorData.getAtmosphericPressure()); //数字气压 + expands.put("wet",meteorologicalDetectorData.getWetSlipperyCoefficient()); //湿滑 + expands.put("rainXingTai",meteorologicalDetectorData.getPrecipitationType()); //雨量降水形态 + expands.put("visibility",meteorologicalDetectorData.getVisibility()); //能见度 + expands.put("pathContactLu",meteorologicalDetectorData.getRoadSurfaceTemperature()); //路面温度 + expands.put("pathContactBing",meteorologicalDetectorData.getFreezingPointTemperature()); //冰点温度 + expands.put("pathContactYan",meteorologicalDetectorData.getSalinityValue()); //路面盐度 + expands.put("pathContactZhuang",meteorologicalDetectorData.getRemoteRoadSurfaceStatus()); //路面状况 + + mdDeviceData.setExpands(JSONObject.toJSONString(expands)); + + middleDatabaseService.insertMiddleDatabaseDeviceData(mdDeviceData); } else if (IotProductEnum.ONE_STOP_PRODUCT.value().equals(productId)){ //交调 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 index 481967f4..4832955c 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java @@ -2,6 +2,7 @@ package com.zc.business.service; import java.util.List; import com.zc.business.domain.DcMeteorologicalDetectorData; +import com.zc.business.domain.MdDeviceData; /** * 气象检测器数据Service接口 @@ -35,14 +36,6 @@ public interface IDcMeteorologicalDetectorDataService */ int insertDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); - /** - * 中间库新增气象检测器数据 - * - * @param dcMeteorologicalDetectorData 气象检测器数据 - * @return 结果 - */ - boolean insertIntermediateWarehouseData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); - /** * 修改气象检测器数据 * diff --git a/zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java b/zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java new file mode 100644 index 00000000..926a56e0 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java @@ -0,0 +1,43 @@ +package com.zc.business.service; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.zc.business.domain.DcBoardPublish; +import com.zc.business.domain.DcDevice; +import com.zc.business.domain.MdDeviceData; + +import java.util.List; + +/** + * 中间库Service接口 + * + * @author ruoyi + * @date 2024-01-03 + */ +public interface IMiddleDatabaseService +{ + + /** + * 中间库新增设备数据 + * + * @param mdDeviceData 气象检测器数据 + * @return 结果 + */ + boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData); + + /** + * 批量更新中间库设备 + * + * @param listDevice 设备列表 + * @return 结果 + */ + boolean updateMiddleDatabaseDeviceByList(List listDevice); + + /** + * 更新中间库设备 + * + * @param device 设备 + * @return 结果 + */ + boolean updateMiddleDatabaseDevice(DcDevice device); + +} diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java index 2d18296f..a0c2b780 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java @@ -8,6 +8,7 @@ import java.util.Map; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.uuid.IdUtils; +import com.ruoyi.system.service.ISysDeptService; import com.zc.business.domain.*; import com.zc.business.mapper.*; import com.zc.business.service.IDcEventService; @@ -54,6 +55,9 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper; private DcProcessConfigMapper dcProcessConfigMapper; @Autowired private DcWarningMapper dcWarningMapper; + //部门信息 + @Autowired + private ISysDeptService deptService; @@ -89,6 +93,16 @@ private DcEventAbnormalWeatherMapper dcEventAbnormalWeatherMapper; String replace1 = dcEvent.getEndStakeMark().replace(" ", "+"); dcEvent.setEndStakeMark(replace1); } + List dcEventList = dcEventMapper.selectDcEventList(dcEvent); + + for (DcEvent dcEvents : dcEventList) { + // 根据 deptId 获取部门名称 + Long deptId = dcEvents.getDeptId(); + String deptName = deptService.selectDeptById(deptId).getDeptName(); + + // 将部门名称赋值给 deptName 字段 + dcEvents.setDeptName(deptName); + } return dcEventMapper.selectDcEventList(dcEvent); } @@ -112,6 +126,7 @@ dcEvent.setDeptId(SecurityUtils.getDeptId()); //用户 dcEvent.setUserId(SecurityUtils.getUserId()); + dcEvent.setCreateTime(DateUtils.getNowDate()); int i7 = dcEventMapper.insertDcEvent(dcEvent); 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 index c1d3d4da..56ed60eb 100644 --- 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 @@ -5,6 +5,7 @@ import java.util.List; import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.enums.DataSourceType; import com.zc.business.domain.DcDevice; +import com.zc.business.domain.MdDeviceData; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zc.business.mapper.DcMeteorologicalDetectorDataMapper; @@ -59,22 +60,6 @@ public class DcMeteorologicalDetectorDataServiceImpl implements IDcMeteorologica return dcMeteorologicalDetectorDataMapper.insertDcMeteorologicalDetectorData(dcMeteorologicalDetectorData); } - /** - * 中间库新增气象检测器数据 - * - * @param dcMeteorologicalDetectorData 气象检测器数据 - * @return 结果 - */ - @DataSource(value = DataSourceType.SLAVE)//切换数据源 - @Override - public boolean insertIntermediateWarehouseData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData) - { - if (!dcMeteorologicalDetectorDataMapper.updateIntermediateWarehouseData(dcMeteorologicalDetectorData)){ - return dcMeteorologicalDetectorDataMapper.insertIntermediateWarehouseData(dcMeteorologicalDetectorData); - } - return false; - } - /** * 修改气象检测器数据 * diff --git a/zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java new file mode 100644 index 00000000..0e47d6f5 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java @@ -0,0 +1,71 @@ +package com.zc.business.service.impl; + +import com.ruoyi.common.annotation.DataSource; +import com.ruoyi.common.enums.DataSourceType; +import com.zc.business.domain.DcDevice; +import com.zc.business.domain.MdDeviceData; +import com.zc.business.mapper.MiddleDatabaseMapper; +import com.zc.business.service.IMiddleDatabaseService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 中间库Service业务层处理 + * + * @author ruoyi + * @date 2024-01-03 + */ +@Service +public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { + + + @Autowired + private MiddleDatabaseMapper middleDatabaseMapper; + + + /** + * 中间库新增设备数据 + * + * @param mdDeviceData 气象检测器数据 + * @return 结果 + */ + @DataSource(value = DataSourceType.SLAVE)//切换数据源 + @Override + public boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData) + { + return middleDatabaseMapper.insertMiddleDatabaseDeviceData(mdDeviceData); + } + + + /** + * 批量更新中间库设备 + * + * @param listDevice 设备列表 + * @return 结果 + */ + @DataSource(value = DataSourceType.SLAVE)//切换数据源 + @Override + public boolean updateMiddleDatabaseDeviceByList(List listDevice) + { + for (DcDevice dcDevice : listDevice) { + middleDatabaseMapper.updateMiddleDatabaseDevice(dcDevice); + } + return true; + } + + + /** + * 更新中间库设备 + * + * @param device 设备 + * @return 结果 + */ + @DataSource(value = DataSourceType.SLAVE)//切换数据源 + @Override + public boolean updateMiddleDatabaseDevice(DcDevice device) + { + return middleDatabaseMapper.updateMiddleDatabaseDevice(device); + } +} diff --git a/zc-business/src/main/resources/mapper/business/DcEventAccidentMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventAccidentMapper.xml index ce16e770..aec41677 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventAccidentMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventAccidentMapper.xml @@ -30,10 +30,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - select id, reporter_name, reporter_phone_number, accident_type, location_type, traffic_jam, weather_condition, impact_level, is_reverse_cargo, is_maintenance, police_contact, towing_service_contact, congestion_ahead, at_intersection, on_curve, spillage_item, vehicle_owner_phone, small_car, trucks, buses, tankers, minor_injuries, serious_injuries, fatalities, is_private, facility_id from dc_event_accident + select id, reporter_name, reporter_phone_number, accident_type, location_type, traffic_jam, weather_condition, impact_level, is_reverse_cargo, is_maintenance, police_contact, towing_service_contact, congestion_ahead, at_intersection, on_curve, spillage_item, vehicle_owner_phone, small_car, trucks, buses, tankers, minor_injuries, serious_injuries, fatalities, is_private, facility_id,location,ramp_id from dc_event_accident @@ -40,7 +44,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and congestion_ahead = #{congestionAhead} and at_intersection = #{atIntersection} and on_curve = #{onCurve} - and lane_occupancy = #{laneOccupancy} and small_car = #{smallCar} and trucks = #{trucks} and buses = #{buses} @@ -69,7 +72,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" congestion_ahead, at_intersection, on_curve, - lane_occupancy, small_car, trucks, buses, @@ -78,6 +80,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" serious_injuries, fatalities, is_private, + location, + ramp_id, + facility_id, #{id}, @@ -89,7 +94,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{congestionAhead}, #{atIntersection}, #{onCurve}, - #{laneOccupancy}, #{smallCar}, #{trucks}, #{buses}, @@ -98,6 +102,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{seriousInjuries}, #{fatalities}, #{isPrivate}, + #{location}, + #{rampId}, + #{facilityId}, @@ -112,7 +119,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" congestion_ahead = #{congestionAhead}, at_intersection = #{atIntersection}, on_curve = #{onCurve}, - lane_occupancy = #{laneOccupancy}, small_car = #{smallCar}, trucks = #{trucks}, buses = #{buses}, @@ -121,6 +127,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" serious_injuries = #{seriousInjuries}, fatalities = #{fatalities}, is_private = #{isPrivate}, + location = #{location}, + ramp_id = #{rampId}, + facility_id = #{facilityId}, where id = #{id} diff --git a/zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml b/zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml index 673e82f7..88e7f843 100644 --- a/zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml @@ -146,44 +146,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} - - insert into meteorological_detector_data - - device_id, - temperature, - humidity, - precipitation_type, - rainfall, - road_surface_status, - water_film_thickness, - update_time - - - #{iotDeviceId}, - #{temperature}, - #{humidity}, - #{precipitationType}, - #{rainfall}, - #{roadSurfaceStatus}, - #{waterFilmThickness}, - current_date - - - - - update meteorological_detector_data - - temperature = #{temperature}, - humidity = #{humidity}, - precipitation_type = #{precipitationType}, - rainfall = #{rainfall}, - road_surface_status = #{roadSurfaceStatus}, - water_film_thickness = #{waterFilmThickness}, - update_time = current_date - - where device_id = #{iotDeviceId} - - delete from dc_meteorological_detector_data where id = #{id} diff --git a/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml b/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml new file mode 100644 index 00000000..ed10eb0f --- /dev/null +++ b/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml @@ -0,0 +1,40 @@ + + + + + + insert into device_data + + devNo, + devType, + `timeStamp`, + expands, + CreatorUserId, + LastModificationTime, + LastModifierUserId, + IsDeleted, + DeleterUserId, + DeletionTime, + CreationTime + + + #{devNo}, + #{devType}, + #{timeStamp}, + #{expands}, + #{creatorUserId}, + #{lastModificationTime}, + #{isDeleted}, + #{deleterUserId}, + #{deletionTime}, + current_date + + + + + update device set dev_status = #{deviceState} where dev_no = #{iotDeviceId} + + +