diff --git a/nursing-unit-common/src/main/java/com/nu/dto/IotCameraCapabilityMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/IotCameraCapabilityMQDto.java new file mode 100644 index 0000000..838809d --- /dev/null +++ b/nursing-unit-common/src/main/java/com/nu/dto/IotCameraCapabilityMQDto.java @@ -0,0 +1,50 @@ +package com.nu.dto; + +import lombok.Data; + +/** + * @Description: TPLINK摄像头能力集信息 + * @Author: caolei + * @Date: 2025-08-11 + * @Version: V1.0 + */ +@Data +public class IotCameraCapabilityMQDto{ + /**ID*/ + private Integer id; + /**设备序号*/ + private String deviceIndex; + /**力集属性*/ + private String motionDetection; + /**视频封面*/ + private String videoCover; + /**云台*/ + private String ptz; + private String motor; + /**变焦,0不可变焦 1可变焦*/ + private String smartCode; + /**强制在H.264编码过程中生成IDR帧的函数*/ + private String forceIdrFrame; + /**音频*/ + private String audio; + /**本地存储*/ + private String localStorage; + /**回放API本版*/ + private String playbackApiVersionTwo; + /**多变性*/ + private String multitrans; + /**客流*/ + private String passengerFlow; + /**获取预览缩略图*/ + private String getPreviewThumbnail; + /**JPG预览缩略图*/ + private String previewThumbnailJpeg; + /**走廊*/ + private String corridorMod; + /**背光共存*/ + private String backlightCoexistence; + /**是否同步 0 未同步 1已同步*/ + private String syncType; + /**日志ID*/ + private String logId; +} diff --git a/nursing-unit-common/src/main/java/com/nu/dto/IotCameraInfoMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/IotCameraInfoMQDto.java new file mode 100644 index 0000000..d7e6756 --- /dev/null +++ b/nursing-unit-common/src/main/java/com/nu/dto/IotCameraInfoMQDto.java @@ -0,0 +1,87 @@ +package com.nu.dto; + +import lombok.Data; + +/** + * @Description: TPLINK摄像头信息 + * @Author: caolei + * @Date: 2025-08-11 + * @Version: V1.0 + */ +@Data +public class IotCameraInfoMQDto{ + /**ID*/ + private Integer id; + /**sn*/ + private String sn; + /**设备序号*/ + private String deviceIndex; + /**设备名称*/ + private String deviceName; + /**设备类型*/ + private String deviceType; + /**设备状态 0 离线 1 在线 2 重启中 3 升级中 4 配置中 5 同步中*/ + private String deviceStatus; + /**设备型号*/ + private String deviceModel; + /**IP地址*/ + private String ip; + /**MAC地址*/ + private String mac; + /**分组ID*/ + private String regionId; + /**分组名称*/ + private String regionName; + /**父设备ID*/ + private String parentId; + /**父设备名称*/ + private String parentDeviceName; + /**项目ID*/ + private String projectId; + /**项目名称*/ + private String projectName; + /**软件版本*/ + private String firmwareVer; + /**硬件版本*/ + private String hardwareVer; + /**用户权限类型 -1 无权限 0 可读 1 可控制 2 可配置 3 可控制/配置 4 所有*/ + private String managerAuthType; + /**告警消息权限 1 有权限 -1 无权限*/ + private String msgAuthType; + /**国标编码*/ + private String sipCode; + /**位置名称*/ + private String locationName; + /**系统类型 public 通用*/ + private String systemType; + /**协议类型*/ + private String protocol; + /**录像计划ID**/ + private String recordPlanId; + /**回放视频转FTP上传IP**/ + private String ftpIp; + /**回放视频转FTP上传端口**/ + private String ftpPort; + /**回放视频转FTP上传用户**/ + private String ftpUsername; + /**回放视频转FTP上传密码**/ + private String ftpPassword; + /**回放视频转FTP上传路径**/ + private String ftpUploadpath; + /**区域编码*/ + private String nuId; + /**区域编码*/ + private String nuName; + /**机构ID*/ + private String departId; + /**机构名称*/ + private String departName; + /**机构服务地址*/ + private String departServerUrl; + /**是否同步 0 未同步 1已同步*/ + private String syncType; + /**维修状态*/ + private String maintainStatus; + /**日志ID*/ + private String logId; +} diff --git a/nursing-unit-common/src/main/java/com/nu/dto/IotEleWaterCollectorMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/IotEleWaterCollectorMQDto.java new file mode 100644 index 0000000..47ca4fa --- /dev/null +++ b/nursing-unit-common/src/main/java/com/nu/dto/IotEleWaterCollectorMQDto.java @@ -0,0 +1,31 @@ +package com.nu.dto; + +import lombok.Data; + +/** + * @Description: 电水表采集器 + * @Author: caolei + * @Date: 2025-08-12 + * @Version: V1.0 + */ +@Data +public class IotEleWaterCollectorMQDto{ + /**主键*/ + private Integer id; + /**采集器*/ + private String cid; + /**在线状态*/ + private String online; + /**信号值*/ + private String csq; + /**上次掉线时间*/ + private String disconnectTime; + /**上次上线时间*/ + private String connectTime; + /**描述*/ + private String remark; + /**是否同步 0 未同步 1已同步*/ + private String syncType; + /**日志ID*/ + private String logId; +} \ No newline at end of file diff --git a/nursing-unit-common/src/main/java/com/nu/dto/IotElectricityMeterMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/IotElectricityMeterMQDto.java new file mode 100644 index 0000000..55521ca --- /dev/null +++ b/nursing-unit-common/src/main/java/com/nu/dto/IotElectricityMeterMQDto.java @@ -0,0 +1,41 @@ +package com.nu.dto; + +import lombok.Data; + +/** + * @Description: 水表 + * @Author: caolei + * @Date: 2025-08-12 + * @Version: V1.0 + */ +@Data +public class IotElectricityMeterMQDto{ + /**主键*/ + private Integer id; + /**采集器*/ + private String cid; + /**表号*/ + private String address; + /**电表值*/ + private String eleValue; + /**阀门状态*/ + private String relayState; + /**描述*/ + private String remark; + /**区域编码*/ + private String nuId; + /**区域名称*/ + private String nuName; + /**机构ID*/ + private String departId; + /**机构名称*/ + private String departName; + /**机构服务地址*/ + private String departServerUrl; + /**是否同步*/ + private String syncType; + /**维修状态*/ + private String maintainStatus; + /**日志ID*/ + private String logId; +} \ No newline at end of file diff --git a/nursing-unit-common/src/main/java/com/nu/dto/IotHumidDeviceMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/IotHumidDeviceMQDto.java new file mode 100644 index 0000000..90fc662 --- /dev/null +++ b/nursing-unit-common/src/main/java/com/nu/dto/IotHumidDeviceMQDto.java @@ -0,0 +1,75 @@ +package com.nu.dto; + +import lombok.Data; + +/** + * @Description: 温湿度计 + * @Author: caolei + * @Date: 2025-08-12 + * @Version: V1.0 + */ +@Data +public class IotHumidDeviceMQDto{ + /**主键*/ + private Integer id; + /**设备SN号*/ + private String sn; + /**设备名称*/ + private String deviceName; + /**设备所在时区*/ + private String timeCode; + /**设备类型*/ + private String deviceTypes; + /**上报间隔*/ + private String reportingInterval; + /**记录间隔*/ + private String recordInterval; + /**历史数据上报时刻*/ + private String historyReportTime; + /**历史数据上报间隔*/ + private String historyInterval; + /**温度预警范围 上限值*/ + private String temperatureHigh; + /**温度预警范围 下限值*/ + private String temperatureLow; + /**温度缓冲值*/ + private String temperatureBuffer; + /**湿度预警范围 上限值*/ + private String humidityHigh; + /**湿度预警范围 下限值*/ + private String humidityLow; + /**湿度缓冲值*/ + private String humidityBuffer; + /**断电报警"*/ + private String izOutages; + /**低电报警*/ + private String izLowBattery; + /**上下线通知*/ + private String izOnline; + /**温度*/ + private String temperature; + /**湿度*/ + private String humidity; + /**在线状态*/ + private String status; + /**最新上报时间*/ + private String reportingTime; + /**电量*/ + private String electricity; + /**区域编码*/ + private String nuId; + /**区域名称*/ + private String nuName; + /**机构ID*/ + private String departId; + /**机构名称*/ + private String departName; + /**机构服务地址*/ + private String departServerUrl; + /**是否同步 0 未同步 1已同步*/ + private String syncType; + /**维修状态*/ + private String maintainStatus; + /**日志ID*/ + private String logId; +} \ No newline at end of file diff --git a/nursing-unit-common/src/main/java/com/nu/dto/IotNuBaseInfoMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/IotNuBaseInfoMQDto.java new file mode 100644 index 0000000..c8229bf --- /dev/null +++ b/nursing-unit-common/src/main/java/com/nu/dto/IotNuBaseInfoMQDto.java @@ -0,0 +1,26 @@ +package com.nu.dto; + +import lombok.Data; + +@Data +public class IotNuBaseInfoMQDto { + /**ID*/ + private String id; + /**区域编码*/ + private String nuId; + /**区域名称*/ + private String nuName; + /**区域标签*/ + private String areaFlag; + /**是否删除*/ + private String delFlag; + /**所属机构*/ + private String orgCode; + /**所属机构*/ + private String orgName; + /**是否同步*/ + private String izSync; + /**日志ID*/ + private String logId; + +} diff --git a/nursing-unit-common/src/main/java/com/nu/dto/IotSyncBizMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/IotSyncBizMQDto.java new file mode 100644 index 0000000..2be07f8 --- /dev/null +++ b/nursing-unit-common/src/main/java/com/nu/dto/IotSyncBizMQDto.java @@ -0,0 +1,17 @@ +package com.nu.dto; + +import lombok.Data; + +import java.util.List; + +@Data +public class IotSyncBizMQDto { + private IotNuBaseInfoMQDto nuBaseInfo; + private List cameraInfoList; + private List capabilityList; + private List electricityMeterList; + private List waterMeterList; + private List collectorList; + private List humidDeviceList; + +} diff --git a/nursing-unit-common/src/main/java/com/nu/dto/IotWaterMeterMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/IotWaterMeterMQDto.java new file mode 100644 index 0000000..566521e --- /dev/null +++ b/nursing-unit-common/src/main/java/com/nu/dto/IotWaterMeterMQDto.java @@ -0,0 +1,43 @@ +package com.nu.dto; + +import lombok.Data; + +/** + * @Description: 电表 + * @Author: caolei + * @Date: 2025-08-12 + * @Version: V1.0 + */ +@Data +public class IotWaterMeterMQDto{ + /**主键*/ + private Integer id; + /**采集器*/ + private String cid; + /**表号*/ + private String address; + /**水表值*/ + private String waterValue; + /**阀门状态*/ + private String relayState; + /**水表电池状态*/ + private String batteryState; + /**描述*/ + private String remark; + /**区域编码*/ + private String nuId; + /**区域名称*/ + private String nuName; + /**机构ID*/ + private String departId; + /**机构名称*/ + private String departName; + /**机构服务地址*/ + private String departServerUrl; + /**是否同步*/ + private String syncType; + /**维修状态*/ + private String maintainStatus; + /**日志ID*/ + private String logId; +} \ No newline at end of file diff --git a/nursing-unit-common/src/main/java/com/nu/dto/StatusListMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/StatusListMQDto.java new file mode 100644 index 0000000..4826a6a --- /dev/null +++ b/nursing-unit-common/src/main/java/com/nu/dto/StatusListMQDto.java @@ -0,0 +1,10 @@ +package com.nu.dto; + +import lombok.Data; + +import java.util.List; + +@Data +public class StatusListMQDto { + List statusList; +} diff --git a/nursing-unit-iot/nu-iot-biz/pom.xml b/nursing-unit-iot/nu-iot-biz/pom.xml index ee0fb0f..eb3b0d9 100644 --- a/nursing-unit-iot/nu-iot-biz/pom.xml +++ b/nursing-unit-iot/nu-iot-biz/pom.xml @@ -41,7 +41,13 @@ tums-auth 2.0.0 + + com.nursingunit.boot + nu-admin-biz + 2.0.0 + compile + - + diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/entity/SyncBizLog.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/entity/SyncBizLog.java new file mode 100644 index 0000000..b315977 --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/entity/SyncBizLog.java @@ -0,0 +1,47 @@ +package com.nu.modules.syncLog.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description: 配置同步日志 + * @Author: jeecg-boot + * @Date: 2025-08-08 + * @Version: V1.0 + */ +@Data +@TableName("nu_iot_sync_biz_log") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="nu_iot_sync_biz_log", description="设备同步日志") +public class SyncBizLog implements Serializable { + private static final long serialVersionUID = 1L; + /**id*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private String id; + private String logId; + private String orgCode; //机构编码 + private String orgName; //机构名称 + private String content; + private String syncType; + private String status; + private String serverType; + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date createTime; + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date updateTime; +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/mapper/SyncBizLogMapper.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/mapper/SyncBizLogMapper.java new file mode 100644 index 0000000..290223d --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/mapper/SyncBizLogMapper.java @@ -0,0 +1,16 @@ +package com.nu.modules.syncLog.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.nu.modules.syncLog.entity.SyncBizLog; + +/** + * @Description: 同步日志 + * @Author: jeecg-boot + * @Date: 2025-08-08 + * @Version: V1.0 + */ +public interface SyncBizLogMapper extends BaseMapper { + void addLog(SyncBizLog syncBizLog); + void updateLog(SyncBizLog syncBizLog); + void deleteLog(SyncBizLog syncBizLog); +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/mapper/xml/SyncBizLogMapper.xml b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/mapper/xml/SyncBizLogMapper.xml new file mode 100644 index 0000000..09ffa6d --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/mapper/xml/SyncBizLogMapper.xml @@ -0,0 +1,54 @@ + + + + + insert into nu_iot_sync_biz_log ( + log_id, + org_code, + org_name, + content, + sync_type, + status, + server_type, + create_time + ) + values ( + #{logId}, + #{orgCode}, + #{orgName}, + #{content}, + #{syncType}, + #{status}, + #{serverType}, + now() + ) + + + + UPDATE nu_iot_sync_biz_log + SET + status = #{status}, + update_time = now() + where log_id = #{logId} + + + + delete from nu_iot_sync_biz_log where log_id = #{logId} + + + + \ No newline at end of file diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/service/ISyncBizLogService.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/service/ISyncBizLogService.java new file mode 100644 index 0000000..660659e --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/service/ISyncBizLogService.java @@ -0,0 +1,16 @@ +package com.nu.modules.syncLog.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.nu.modules.syncLog.entity.SyncBizLog; + +/** + * @Description: 同步日志 + * @Author: jeecg-boot + * @Date: 2025-08-08 + * @Version: V1.0 + */ +public interface ISyncBizLogService extends IService { + void addLog(SyncBizLog syncBizLog); + void updateLog(SyncBizLog syncBizLog); + void deleteLog(SyncBizLog syncBizLog); +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/service/impl/SyncBizLogServiceImpl.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/service/impl/SyncBizLogServiceImpl.java new file mode 100644 index 0000000..92eb12d --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncLog/service/impl/SyncBizLogServiceImpl.java @@ -0,0 +1,29 @@ +package com.nu.modules.syncLog.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.nu.modules.syncLog.entity.SyncBizLog; +import com.nu.modules.syncLog.mapper.SyncBizLogMapper; +import com.nu.modules.syncLog.service.ISyncBizLogService; +import org.springframework.stereotype.Service; + +/** + * @Description: 同步日志 + * @Author: jeecg-boot + * @Date: 2025-08-08 + * @Version: V1.0 + */ +@Service +public class SyncBizLogServiceImpl extends ServiceImpl implements ISyncBizLogService { + @Override + public void addLog(SyncBizLog syncBizLog){ + baseMapper.addLog(syncBizLog); + } + @Override + public void updateLog(SyncBizLog syncBizLog){ + baseMapper.updateLog(syncBizLog); + } + @Override + public void deleteLog(SyncBizLog syncBizLog){ + baseMapper.deleteLog(syncBizLog); + } +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/controller/SyncBizController.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/controller/SyncBizController.java new file mode 100644 index 0000000..e3a3cf6 --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/controller/SyncBizController.java @@ -0,0 +1,37 @@ +package com.nu.modules.syncbiz.controller; + +import com.nu.modules.syncbiz.entity.NuBaseInfo; +import com.nu.modules.syncbiz.service.ISyncBizService; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * @Description: 物联同步-所有设备同步到业务系统 + * @Author: caolei + * @Date: 2025-08-11 + * @Version: V1.0 + */ +@Slf4j +@RestController +@RequestMapping("/iot/syncbiz") +public class SyncBizController extends JeecgController { + + @Autowired + private ISyncBizService service; + + /** + * 同步设备信息 + * + * @param nuId + * @return + */ + @GetMapping(value = "/syncIot") + public Result syncIot(@RequestParam("nuId") String nuId) { + return service.syncIot(nuId); + + } + +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/CameraCapability.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/CameraCapability.java new file mode 100644 index 0000000..00b2ab2 --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/CameraCapability.java @@ -0,0 +1,55 @@ +package com.nu.modules.syncbiz.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description: TPLINK摄像头能力集信息 + * @Author: caolei + * @Date: 2025-08-11 + * @Version: V1.0 + */ +@Data +public class CameraCapability implements Serializable { + private static final long serialVersionUID = 1L; + /**ID*/ + private Integer id; + /**设备序号*/ + private String deviceIndex; + /**力集属性*/ + private String motionDetection; + /**视频封面*/ + private String videoCover; + /**云台*/ + private String ptz; + private String motor; + /**变焦,0不可变焦 1可变焦*/ + private String smartCode; + /**强制在H.264编码过程中生成IDR帧的函数*/ + private String forceIdrFrame; + /**音频*/ + private String audio; + /**本地存储*/ + private String localStorage; + /**回放API本版*/ + private String playbackApiVersionTwo; + /**多变性*/ + private String multitrans; + /**客流*/ + private String passengerFlow; + /**获取预览缩略图*/ + private String getPreviewThumbnail; + /**JPG预览缩略图*/ + private String previewThumbnailJpeg; + /**走廊*/ + private String corridorMod; + /**背光共存*/ + private String backlightCoexistence; + /**是否同步 0 未同步 1已同步*/ + private String syncType; + /**日志ID*/ + private String logId; +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/CameraInfo.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/CameraInfo.java new file mode 100644 index 0000000..ce2c4e9 --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/CameraInfo.java @@ -0,0 +1,92 @@ +package com.nu.modules.syncbiz.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description: TPLINK摄像头信息 + * @Author: caolei + * @Date: 2025-08-11 + * @Version: V1.0 + */ +@Data +public class CameraInfo implements Serializable { + private static final long serialVersionUID = 1L; + /**ID*/ + private Integer id; + /**sn*/ + private String sn; + /**设备序号*/ + private String deviceIndex; + /**设备名称*/ + private String deviceName; + /**设备类型*/ + private String deviceType; + /**设备状态 0 离线 1 在线 2 重启中 3 升级中 4 配置中 5 同步中*/ + private String deviceStatus; + /**设备型号*/ + private String deviceModel; + /**IP地址*/ + private String ip; + /**MAC地址*/ + private String mac; + /**分组ID*/ + private String regionId; + /**分组名称*/ + private String regionName; + /**父设备ID*/ + private String parentId; + /**父设备名称*/ + private String parentDeviceName; + /**项目ID*/ + private String projectId; + /**项目名称*/ + private String projectName; + /**软件版本*/ + private String firmwareVer; + /**硬件版本*/ + private String hardwareVer; + /**用户权限类型 -1 无权限 0 可读 1 可控制 2 可配置 3 可控制/配置 4 所有*/ + private String managerAuthType; + /**告警消息权限 1 有权限 -1 无权限*/ + private String msgAuthType; + /**国标编码*/ + private String sipCode; + /**位置名称*/ + private String locationName; + /**系统类型 public 通用*/ + private String systemType; + /**协议类型*/ + private String protocol; + /**录像计划ID**/ + private String recordPlanId; + /**回放视频转FTP上传IP**/ + private String ftpIp; + /**回放视频转FTP上传端口**/ + private String ftpPort; + /**回放视频转FTP上传用户**/ + private String ftpUsername; + /**回放视频转FTP上传密码**/ + private String ftpPassword; + /**回放视频转FTP上传路径**/ + private String ftpUploadpath; + /**区域编码*/ + private String nuId; + /**区域编码*/ + private String nuName; + /**机构ID*/ + private String departId; + /**机构名称*/ + private String departName; + /**机构服务地址*/ + private String departServerUrl; + /**是否同步 0 未同步 1已同步*/ + private String syncType; + /**维修状态*/ + private String maintainStatus; + /**日志ID*/ + private String logId; +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/EleWaterCollector.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/EleWaterCollector.java new file mode 100644 index 0000000..3a434f3 --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/EleWaterCollector.java @@ -0,0 +1,36 @@ +package com.nu.modules.syncbiz.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description: 电水表采集器 + * @Author: caolei + * @Date: 2025-08-12 + * @Version: V1.0 + */ +@Data +public class EleWaterCollector implements Serializable { + private static final long serialVersionUID = 1L; + /**主键*/ + private Integer id; + /**采集器*/ + private String cid; + /**在线状态*/ + private String online; + /**信号值*/ + private String csq; + /**上次掉线时间*/ + private String disconnectTime; + /**上次上线时间*/ + private String connectTime; + /**描述*/ + private String remark; + /**是否同步 0 未同步 1已同步*/ + private String syncType; + /**日志ID*/ + private String logId; +} \ No newline at end of file diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/ElectricityMeter.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/ElectricityMeter.java new file mode 100644 index 0000000..9efa1bd --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/ElectricityMeter.java @@ -0,0 +1,46 @@ +package com.nu.modules.syncbiz.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description: 水表 + * @Author: caolei + * @Date: 2025-08-12 + * @Version: V1.0 + */ +@Data +public class ElectricityMeter implements Serializable { + private static final long serialVersionUID = 1L; + /**主键*/ + private Integer id; + /**采集器*/ + private String cid; + /**表号*/ + private String address; + /**电表值*/ + private String eleValue; + /**阀门状态*/ + private String relayState; + /**描述*/ + private String remark; + /**区域编码*/ + private String nuId; + /**区域名称*/ + private String nuName; + /**机构ID*/ + private String departId; + /**机构名称*/ + private String departName; + /**机构服务地址*/ + private String departServerUrl; + /**是否同步*/ + private String syncType; + /**维修状态*/ + private String maintainStatus; + /**日志ID*/ + private String logId; +} \ No newline at end of file diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/HumidDevice.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/HumidDevice.java new file mode 100644 index 0000000..7df774d --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/HumidDevice.java @@ -0,0 +1,80 @@ +package com.nu.modules.syncbiz.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description: 温湿度计 + * @Author: caolei + * @Date: 2025-08-12 + * @Version: V1.0 + */ +@Data +public class HumidDevice implements Serializable { + private static final long serialVersionUID = 1L; + /**主键*/ + private Integer id; + /**设备SN号*/ + private String sn; + /**设备名称*/ + private String deviceName; + /**设备所在时区*/ + private String timeCode; + /**设备类型*/ + private String deviceTypes; + /**上报间隔*/ + private String reportingInterval; + /**记录间隔*/ + private String recordInterval; + /**历史数据上报时刻*/ + private String historyReportTime; + /**历史数据上报间隔*/ + private String historyInterval; + /**温度预警范围 上限值*/ + private String temperatureHigh; + /**温度预警范围 下限值*/ + private String temperatureLow; + /**温度缓冲值*/ + private String temperatureBuffer; + /**湿度预警范围 上限值*/ + private String humidityHigh; + /**湿度预警范围 下限值*/ + private String humidityLow; + /**湿度缓冲值*/ + private String humidityBuffer; + /**断电报警"*/ + private String izOutages; + /**低电报警*/ + private String izLowBattery; + /**上下线通知*/ + private String izOnline; + /**温度*/ + private String temperature; + /**湿度*/ + private String humidity; + /**在线状态*/ + private String status; + /**最新上报时间*/ + private String reportingTime; + /**电量*/ + private String electricity; + /**区域编码*/ + private String nuId; + /**区域名称*/ + private String nuName; + /**机构ID*/ + private String departId; + /**机构名称*/ + private String departName; + /**机构服务地址*/ + private String departServerUrl; + /**是否同步 0 未同步 1已同步*/ + private String syncType; + /**维修状态*/ + private String maintainStatus; + /**日志ID*/ + private String logId; +} \ No newline at end of file diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/NuBaseInfo.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/NuBaseInfo.java new file mode 100644 index 0000000..2ec4877 --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/NuBaseInfo.java @@ -0,0 +1,34 @@ +package com.nu.modules.syncbiz.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; +import java.io.Serializable; + +/** + * @Description: 物联同步-所有设备同步到业务系统 + * @Author: caolei + * @Date: 2025-08-11 + * @Version: V1.0 + */ +@Data +public class NuBaseInfo implements Serializable { + private static final long serialVersionUID = 1L; + /**ID*/ + private String id; + /**区域编码*/ + private String nuId; + /**区域名称*/ + private String nuName; + /**区域标签*/ + private String areaFlag; + /**是否删除*/ + private String delFlag; + /**所属机构*/ + private String orgCode; + /**所属机构*/ + private String orgName; + /**是否同步*/ + private String izSync; + /**日志ID*/ + private String logId; +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/WaterMeter.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/WaterMeter.java new file mode 100644 index 0000000..dfccdbc --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/entity/WaterMeter.java @@ -0,0 +1,48 @@ +package com.nu.modules.syncbiz.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description: 电表 + * @Author: caolei + * @Date: 2025-08-12 + * @Version: V1.0 + */ +@Data +public class WaterMeter implements Serializable { + private static final long serialVersionUID = 1L; + /**主键*/ + private Integer id; + /**采集器*/ + private String cid; + /**表号*/ + private String address; + /**水表值*/ + private String waterValue; + /**阀门状态*/ + private String relayState; + /**水表电池状态*/ + private String batteryState; + /**描述*/ + private String remark; + /**区域编码*/ + private String nuId; + /**区域名称*/ + private String nuName; + /**机构ID*/ + private String departId; + /**机构名称*/ + private String departName; + /**机构服务地址*/ + private String departServerUrl; + /**是否同步*/ + private String syncType; + /**维修状态*/ + private String maintainStatus; + /**日志ID*/ + private String logId; +} \ No newline at end of file diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/mapper/SyncBizMapper.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/mapper/SyncBizMapper.java new file mode 100644 index 0000000..fb36435 --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/mapper/SyncBizMapper.java @@ -0,0 +1,24 @@ +package com.nu.modules.syncbiz.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.nu.modules.syncbiz.entity.*; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Description: 物联同步-所有设备同步到业务系统 + * @Author: caolei + * @Date: 2025-08-11 + * @Version: V1.0 + */ +@Mapper +public interface SyncBizMapper extends BaseMapper { + NuBaseInfo getNuBaseInfoByNuId(String nuId); + List getCameraListByNuId(String nuId); + List getCameraCapabilityByNuId(String nuId); + List getElectricityMeterListByNuId(String nuId); + List getWaterMeterListByNuId(String nuId); + List getCollectorListByNuId(String nuId); + List getHumidDeviceListByNuId(String nuId); +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/mapper/xml/SyncBizMapper.xml b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/mapper/xml/SyncBizMapper.xml new file mode 100644 index 0000000..daa8d50 --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/mapper/xml/SyncBizMapper.xml @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/service/ISyncBizService.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/service/ISyncBizService.java new file mode 100644 index 0000000..9d7dbbc --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/service/ISyncBizService.java @@ -0,0 +1,15 @@ +package com.nu.modules.syncbiz.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.nu.modules.syncbiz.entity.NuBaseInfo; +import org.jeecg.common.api.vo.Result; + +/** + * @Description: 物联同步-所有设备同步到业务系统 + * @Author: caolei + * @Date: 2025-08-11 + * @Version: V1.0 + */ +public interface ISyncBizService extends IService { + Result syncIot(String nuId); +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/service/impl/SyncBizServiceImpl.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/service/impl/SyncBizServiceImpl.java new file mode 100644 index 0000000..2baa13e --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/syncbiz/service/impl/SyncBizServiceImpl.java @@ -0,0 +1,192 @@ +package com.nu.modules.syncbiz.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.nu.dto.*; +import com.nu.modules.syncLog.entity.SyncBizLog; +import com.nu.modules.syncLog.service.ISyncBizLogService; +import com.nu.modules.syncbiz.entity.*; +import com.nu.modules.syncbiz.mapper.SyncBizMapper; +import com.nu.modules.syncbiz.service.ISyncBizService; +import com.nu.modules.yiweilian.common.entity.YiweilianConfig; +import com.nu.utils.RabbitMQUtil; +import me.zhyd.oauth.utils.UuidUtils; +import org.jeecg.common.api.vo.Result; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; + +/** + * @Description: 物联同步-所有设备同步到业务系统 + * @Author: caolei + * @Date: 2025-08-11 + * @Version: V1.0 + */ +@Service +public class SyncBizServiceImpl extends ServiceImpl implements ISyncBizService { + + @Autowired + private RabbitMQUtil rabbitMQUtil; + + @Autowired + private ISyncBizLogService logService; + + @Override + public Result syncIot(String nuId){ + //通过nuId获取区域信息 + NuBaseInfo nuBaseInfo = baseMapper.getNuBaseInfoByNuId(nuId); + if(nuBaseInfo!=null){ + IotSyncBizMQDto dto = new IotSyncBizMQDto(); + String orgCode = nuBaseInfo.getOrgCode(); + String orgName = nuBaseInfo.getOrgName(); + String type = "更新"; + if(nuBaseInfo.getIzSync().equals("0")){ + type = "新增"; + } + String logId = addLog(orgCode,orgName, JSON.toJSONString(nuBaseInfo),type,"区域"); + nuBaseInfo.setLogId(logId); + IotNuBaseInfoMQDto iotNuBaseInfoMQDto = new IotNuBaseInfoMQDto(); + BeanUtils.copyProperties(nuBaseInfo,iotNuBaseInfoMQDto); + //将区域信息存放到MQ类中 + dto.setNuBaseInfo(iotNuBaseInfoMQDto); + + //通过nuId获取摄像头列表 + List cameraList = baseMapper.getCameraListByNuId(nuId); + if(cameraList.size()>0){ + for(int i=0;i cameraMQDtoList = BeanUtil.copyToList(cameraList, IotCameraInfoMQDto.class); + //将摄像头信息存放到MQ类中 + dto.setCameraInfoList(cameraMQDtoList); + } + + //通过摄像头获取能力集信息 + List capabilityList = baseMapper.getCameraCapabilityByNuId(nuId); + if(capabilityList.size()>0){ + for(int i=0;i capabilityMQDtoList = BeanUtil.copyToList(capabilityList, IotCameraCapabilityMQDto.class); + //将能力集信息存放到MQ类中 + dto.setCapabilityList(capabilityMQDtoList); + } + + //通过nuId获取电表信息 + List electricityList = baseMapper.getElectricityMeterListByNuId(nuId); + if(electricityList.size()>0){ + for(int i=0;i electricityMQDtoList = BeanUtil.copyToList(electricityList, IotElectricityMeterMQDto.class); + //将电表信息存放到MQ类中 + dto.setElectricityMeterList(electricityMQDtoList); + } + + //通过nuId获取水表信息 + List waterList = baseMapper.getWaterMeterListByNuId(nuId); + if(waterList.size()>0){ + for(int i=0;i waterMQDtoList = BeanUtil.copyToList(waterList, IotWaterMeterMQDto.class); + //将电表信息存放到MQ类中 + dto.setWaterMeterList(waterMQDtoList); + } + + //通过nuId获取采集器信息 + List collectorList = baseMapper.getCollectorListByNuId(nuId); + if(collectorList.size()>0){ + for(int i=0;i collectorMQDtoList = BeanUtil.copyToList(collectorList, IotEleWaterCollectorMQDto.class); + //将采集器信息存放到MQ类中 + dto.setCollectorList(collectorMQDtoList); + } + + //通过nuId获取温湿度计信息 + List humidList = baseMapper.getHumidDeviceListByNuId(nuId); + if(humidList.size()>0){ + for(int i=0;i humidMQDtoList = BeanUtil.copyToList(humidList, IotHumidDeviceMQDto.class); + //将温湿度计信息存放到MQ类中 + dto.setHumidDeviceList(humidMQDtoList); + } + + //发送MQ + rabbitMQUtil.sendToExchange("hldy.iotsyncbiz", orgCode + ".iotsyncbiz.async", dto); + + //=========>业务MQ接收到数据,判断是否存在,不存在则添加;存在则判断维护状态是否一致,一致则忽略,不一致则更新; + //=========>MQ接收结果,成功和失败更新日志表,忽略则删除日志表 + + return Result.ok("同步成功"); + }else{ + return Result.error("同步区域错误,区域为空"); + } + } + + /** + * 添加日志表 + * @param orgCode 区域编码 + * @param orgName 区域名称 + * @param json 实体属性 + * @param type 操作类型 + * @param iotType 设备类型 + * @return + */ + private String addLog(String orgCode,String orgName,String json,String type,String iotType){ + String logId = UuidUtils.getUUID(); + SyncBizLog log = new SyncBizLog(); + log.setLogId(logId); + log.setOrgCode(orgCode); + log.setOrgName(orgName); + log.setContent(json); + log.setSyncType(type); + log.setStatus("同步中"); + log.setServerType(iotType); + logService.addLog(log); + return logId; + } + +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/entity/CameraCapability.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/entity/CameraCapability.java new file mode 100644 index 0000000..7590bc5 --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/entity/CameraCapability.java @@ -0,0 +1,53 @@ +package com.nu.modules.tplink.camera.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description: TPLINK摄像头能力集信息 + * @Author: caolei + * @Date: 2025-08-11 + * @Version: V1.0 + */ +@Data +@TableName("nu_iot_tplink_camera_capability") +public class CameraCapability implements Serializable { + private static final long serialVersionUID = 1L; + /**ID*/ + private Integer id; + /**设备序号*/ + private String deviceIndex; + /**力集属性*/ + private String motionDetection; + /**视频封面*/ + private String videoCover; + /**云台*/ + private String ptz; + private String motor; + /**变焦,0不可变焦 1可变焦*/ + private String smartCode; + /**强制在H.264编码过程中生成IDR帧的函数*/ + private String forceIdrFrame; + /**音频*/ + private String audio; + /**本地存储*/ + private String localStorage; + /**回放API本版*/ + private String playbackApiVersionTwo; + /**多变性*/ + private String multitrans; + /**客流*/ + private String passengerFlow; + /**获取预览缩略图*/ + private String getPreviewThumbnail; + /**JPG预览缩略图*/ + private String previewThumbnailJpeg; + /**走廊*/ + private String corridorMod; + /**背光共存*/ + private String backlightCoexistence; + /**是否同步 0 未同步 1已同步*/ + private String syncType; +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/entity/CameraInfo.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/entity/CameraInfo.java index ab75448..dffe867 100644 --- a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/entity/CameraInfo.java +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/entity/CameraInfo.java @@ -34,6 +34,10 @@ public class CameraInfo implements Serializable { @TableId(type = IdType.AUTO) @ApiModelProperty(value = "ID") private Integer id; + /**设备编码*/ + @Excel(name = "设备编码", width = 15) + @ApiModelProperty(value = "设备编码") + private String sn; /**设备序号*/ @Excel(name = "设备序号", width = 15) @ApiModelProperty(value = "设备序号") diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/mapper/CameraCapabilityMapper.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/mapper/CameraCapabilityMapper.java new file mode 100644 index 0000000..5042bef --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/mapper/CameraCapabilityMapper.java @@ -0,0 +1,16 @@ +package com.nu.modules.tplink.camera.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.nu.modules.tplink.camera.entity.CameraCapability; +import org.apache.ibatis.annotations.Mapper; + +/** + * @Description: 护理单元-物联管理-摄像头能力集信息 + * @Author: jeecg-boot + * @Date: 2025-08-12 + * @Version: V1.0 + */ + +@Mapper +public interface CameraCapabilityMapper extends BaseMapper { +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/mapper/xml/CameraCapabilityMapper.xml b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/mapper/xml/CameraCapabilityMapper.xml new file mode 100644 index 0000000..21b3e6c --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/mapper/xml/CameraCapabilityMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/service/ICameraCapabilityService.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/service/ICameraCapabilityService.java new file mode 100644 index 0000000..c47acce --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/service/ICameraCapabilityService.java @@ -0,0 +1,13 @@ +package com.nu.modules.tplink.camera.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.nu.modules.tplink.camera.entity.CameraCapability; + +/** + * @Description: 护理单元-物联管理-摄像头能力集信息 + * @Author: jeecg-boot + * @Date: 2025-08-12 + * @Version: V1.0 + */ +public interface ICameraCapabilityService extends IService { +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/service/impl/CameraCapabilityServiceImpl.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/service/impl/CameraCapabilityServiceImpl.java new file mode 100644 index 0000000..310e941 --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tplink/camera/service/impl/CameraCapabilityServiceImpl.java @@ -0,0 +1,20 @@ +package com.nu.modules.tplink.camera.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.nu.modules.tplink.camera.entity.CameraCapability; +import com.nu.modules.tplink.camera.mapper.CameraCapabilityMapper; +import com.nu.modules.tplink.camera.service.ICameraCapabilityService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * @Description: 护理单元-物联管理-摄像头能力集信息 + * @Author: jeecg-boot + * @Date: 2025-08-12 + * @Version: V1.0 + */ +@Service +@Slf4j +public class CameraCapabilityServiceImpl extends ServiceImpl implements ICameraCapabilityService { + +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tq/common/entity/TqDeviceInfo.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tq/common/entity/TqDeviceInfo.java index 00c2f09..464e6bd 100644 --- a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tq/common/entity/TqDeviceInfo.java +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/modules/tq/common/entity/TqDeviceInfo.java @@ -35,4 +35,6 @@ public class TqDeviceInfo implements Serializable { private String disconnectTime; //采集器-上次掉线时间 online = false 时 private String connectTime; //采集器-上次上线时间 online = true 时 private String remark; //备注 + /**是否同步 0 未同步 1已同步*/ + private String syncType; } diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/mq/device/exceptionhandler/IotDeviceMQExceptionHandler.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/mq/device/exceptionhandler/IotDeviceMQExceptionHandler.java new file mode 100644 index 0000000..77c387d --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/mq/device/exceptionhandler/IotDeviceMQExceptionHandler.java @@ -0,0 +1,28 @@ +package com.nu.mq.device.exceptionhandler; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.AmqpRejectAndDontRequeueException; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.listener.api.RabbitListenerErrorHandler; +import org.springframework.amqp.rabbit.support.ListenerExecutionFailedException; +import org.springframework.stereotype.Component; + +@Slf4j +@Component("iotDeviceMQErrorHandler") +public class IotDeviceMQExceptionHandler implements RabbitListenerErrorHandler { + + @Override + public Object handleError(Message message, org.springframework.messaging.Message message1, ListenerExecutionFailedException e) { + log.error("MQ消息处理失败 | 消息体: {} | 异常原因: {}", new String(message.getBody()), e.getCause().getMessage()); + + // 根据异常类型选择处理策略 +// if (isRetryable(e)) { +// // 可重试异常:抛出异常触发重试 +// throw e; +// } else { + // 不可恢复异常:拒绝消息且不重新入队 + throw new AmqpRejectAndDontRequeueException("消息处理失败且禁止重试", e); +// } + } + +} diff --git a/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/mq/device/listener/IotDeviceMQListener.java b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/mq/device/listener/IotDeviceMQListener.java new file mode 100644 index 0000000..9f2a487 --- /dev/null +++ b/nursing-unit-iot/nu-iot-biz/src/main/java/com/nu/mq/device/listener/IotDeviceMQListener.java @@ -0,0 +1,131 @@ +package com.nu.mq.device.listener; + +import com.nu.dto.StatusListMQDto; +import com.nu.dto.StatusMQDto; +import com.nu.modules.nuBaseInfo.entity.NuBaseInfo; +import com.nu.modules.nuBaseInfo.service.INuBaseInfoService; +import com.nu.modules.syncLog.entity.SyncBizLog; +import com.nu.modules.syncLog.service.ISyncBizLogService; +import com.nu.modules.tplink.camera.entity.CameraCapability; +import com.nu.modules.tplink.camera.entity.CameraInfo; +import com.nu.modules.tplink.camera.service.ICameraCapabilityService; +import com.nu.modules.tplink.camera.service.ICameraInfoService; +import com.nu.modules.tq.common.entity.TqDeviceInfo; +import com.nu.modules.tq.common.service.ITqDeviceInfoService; +import com.nu.modules.tq.electricity.entity.ElectricityMeter; +import com.nu.modules.tq.electricity.service.IElectricityMeterService; +import com.nu.modules.tq.water.entity.WaterMeter; +import com.nu.modules.tq.water.service.IWaterMeterService; +import com.nu.modules.yiweilian.humid.entity.HumidDevice; +import com.nu.modules.yiweilian.humid.service.IHumidDeviceService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.core.ExchangeTypes; +import org.springframework.amqp.rabbit.annotation.Exchange; +import org.springframework.amqp.rabbit.annotation.Queue; +import org.springframework.amqp.rabbit.annotation.QueueBinding; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Slf4j +@Component +public class IotDeviceMQListener { + + @Autowired + private ISyncBizLogService logService; + + @Autowired + private INuBaseInfoService nuBaseInfoService; + + @Autowired + private ICameraInfoService cameraService; + + @Autowired + private ICameraCapabilityService cameraCapabilityService; + + @Autowired + private IElectricityMeterService electricityService; + + @Autowired + private IWaterMeterService waterService; + + @Autowired + private ITqDeviceInfoService collectorService; + + @Autowired + private IHumidDeviceService humidDeviceService; + + @RabbitListener( + bindings = @QueueBinding( + value = @Queue(name = "iotsyncbiz.async.result", durable = "true"), + exchange = @Exchange(name = "hldy.iotsyncbiz", type = ExchangeTypes.DIRECT), + key = "iotsyncbiz.async.result" + ), + errorHandler = "iotDeviceMQErrorHandler" + ) + public void tumsHandleMessage(StatusListMQDto dto) { + List statusList = dto.getStatusList(); + if(statusList.size()>0){ + for(int i=0;i