设备同步
This commit is contained in:
parent
282146d10b
commit
52cde52f30
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class IotSyncBizMQDto {
|
||||
private IotNuBaseInfoMQDto nuBaseInfo;
|
||||
private List<IotCameraInfoMQDto> cameraInfoList;
|
||||
private List<IotCameraCapabilityMQDto> capabilityList;
|
||||
private List<IotElectricityMeterMQDto> electricityMeterList;
|
||||
private List<IotWaterMeterMQDto> waterMeterList;
|
||||
private List<IotEleWaterCollectorMQDto> collectorList;
|
||||
private List<IotHumidDeviceMQDto> humidDeviceList;
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class StatusListMQDto {
|
||||
List<StatusMQDto> statusList;
|
||||
}
|
|
@ -41,7 +41,13 @@
|
|||
<artifactId>tums-auth</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nursingunit.boot</groupId>
|
||||
<artifactId>nu-admin-biz</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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<SyncBizLog> {
|
||||
void addLog(SyncBizLog syncBizLog);
|
||||
void updateLog(SyncBizLog syncBizLog);
|
||||
void deleteLog(SyncBizLog syncBizLog);
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
<?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.nu.modules.syncLog.mapper.SyncBizLogMapper">
|
||||
<insert id="addLog">
|
||||
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()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateLog">
|
||||
UPDATE nu_iot_sync_biz_log
|
||||
SET
|
||||
status = #{status},
|
||||
update_time = now()
|
||||
where log_id = #{logId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteLog">
|
||||
delete from nu_iot_sync_biz_log where log_id = #{logId}
|
||||
</delete>
|
||||
|
||||
<select id="findSyncLogPage" parameterType="com.nu.modules.syncLog.entity.SyncBizLog" resultType="com.nu.modules.syncLog.entity.SyncBizLog">
|
||||
select
|
||||
id,
|
||||
log_id as logId,
|
||||
org_code as orgCode,
|
||||
org_name as orgName,
|
||||
content,
|
||||
sync_type as syncType,
|
||||
status,
|
||||
server_type as serverType,
|
||||
create_time as createTime,
|
||||
update_time as updateTime
|
||||
from nu_iot_sync_biz_log
|
||||
order by id desc
|
||||
</select>
|
||||
</mapper>
|
|
@ -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<SyncBizLog> {
|
||||
void addLog(SyncBizLog syncBizLog);
|
||||
void updateLog(SyncBizLog syncBizLog);
|
||||
void deleteLog(SyncBizLog syncBizLog);
|
||||
}
|
|
@ -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<SyncBizLogMapper, SyncBizLog> 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);
|
||||
}
|
||||
}
|
|
@ -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<NuBaseInfo, ISyncBizService> {
|
||||
|
||||
@Autowired
|
||||
private ISyncBizService service;
|
||||
|
||||
/**
|
||||
* 同步设备信息
|
||||
*
|
||||
* @param nuId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/syncIot")
|
||||
public Result<String> syncIot(@RequestParam("nuId") String nuId) {
|
||||
return service.syncIot(nuId);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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> {
|
||||
NuBaseInfo getNuBaseInfoByNuId(String nuId);
|
||||
List<CameraInfo> getCameraListByNuId(String nuId);
|
||||
List<CameraCapability> getCameraCapabilityByNuId(String nuId);
|
||||
List<ElectricityMeter> getElectricityMeterListByNuId(String nuId);
|
||||
List<WaterMeter> getWaterMeterListByNuId(String nuId);
|
||||
List<EleWaterCollector> getCollectorListByNuId(String nuId);
|
||||
List<HumidDevice> getHumidDeviceListByNuId(String nuId);
|
||||
}
|
|
@ -0,0 +1,187 @@
|
|||
<?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.nu.modules.syncbiz.mapper.SyncBizMapper">
|
||||
|
||||
<select id="getNuBaseInfoByNuId" parameterType="String" resultType="com.nu.modules.syncbiz.entity.NuBaseInfo">
|
||||
select
|
||||
a.id,
|
||||
a.nu_id as nuId,
|
||||
a.nu_name as nuName,
|
||||
a.area_flag as areaFlag,
|
||||
a.del_flag as delFlag,
|
||||
a.sys_org_code as orgCode,
|
||||
b.depart_name as orgName,
|
||||
a.iz_sync as izSync
|
||||
from nu_base_info a
|
||||
inner join sys_depart b on a.sys_org_code = b.org_code
|
||||
where a.nu_id = #{nuId}
|
||||
order by a.id asc
|
||||
</select>
|
||||
|
||||
<select id="getCameraListByNuId" parameterType="String" resultType="com.nu.modules.syncbiz.entity.CameraInfo">
|
||||
select
|
||||
id,
|
||||
sn as sn,
|
||||
device_index as deviceIndex,
|
||||
device_name as deviceName,
|
||||
device_type as deviceType,
|
||||
device_status as deviceStatus,
|
||||
device_model as deviceModel,
|
||||
ip as ip,
|
||||
mac as mac,
|
||||
region_id as regionId,
|
||||
region_name as regionName,
|
||||
parent_id as parentId,
|
||||
parent_device_name as parentDeviceName,
|
||||
project_id as projectId,
|
||||
project_name as projectName,
|
||||
firmware_ver as firmwareVer,
|
||||
hardware_ver as hardwareVer,
|
||||
manager_auth_type as managerAuthType,
|
||||
msg_auth_type as msgAuthType,
|
||||
sip_code as sipCode,
|
||||
location_name as locationName,
|
||||
system_type as systemType,
|
||||
protocol as protocol,
|
||||
record_plan_id as recordPlanId,
|
||||
ftp_ip as ftpIp,
|
||||
ftp_port as ftpPort,
|
||||
ftp_username as ftpUsername,
|
||||
ftp_password as ftpPassword,
|
||||
ftp_uploadpath as ftpUploadpath,
|
||||
nu_id as nuId,
|
||||
nu_name as nuName,
|
||||
depart_id as departId,
|
||||
depart_name as departName,
|
||||
depart_server_url as departServerUrl,
|
||||
sync_type as syncType,
|
||||
maintain_status as maintainStatus
|
||||
from nu_iot_tplink_camera
|
||||
where nu_id = #{nuId}
|
||||
order by id asc
|
||||
</select>
|
||||
|
||||
<select id="getCameraCapabilityByNuId" parameterType="String" resultType="com.nu.modules.syncbiz.entity.CameraCapability">
|
||||
select
|
||||
a.id,
|
||||
a.device_index as deviceIndex,
|
||||
a.motion_detection as motionDetection,
|
||||
a.video_cover as videoCover,
|
||||
a.ptz,
|
||||
a.motor,
|
||||
a.smart_code as smartCode,
|
||||
a.force_idr_frame as forceIdrFrame,
|
||||
a.audio,
|
||||
a.local_storage as localStorage,
|
||||
a.playback_api_version_two as playbackApiVersionTwo,
|
||||
a.multitrans,
|
||||
a.passenger_flow as passengerFlow,
|
||||
a.get_preview_thumbnail as getPreviewThumbnail,
|
||||
a.preview_thumbnail_jpeg as previewThumbnailJpeg,
|
||||
a.corridor_mod as corridorMod,
|
||||
a.backlight_coexistence as backlightCoexistence,
|
||||
a.sync_type as syncType
|
||||
from nu_iot_tplink_camera_capability a
|
||||
inner join nu_iot_tplink_camera b on a.device_index = b.device_index
|
||||
where b.nu_id = #{nuId}
|
||||
order by a.id asc
|
||||
</select>
|
||||
|
||||
<select id="getElectricityMeterListByNuId" parameterType="String" resultType="com.nu.modules.syncbiz.entity.ElectricityMeter">
|
||||
select
|
||||
id,
|
||||
cid,
|
||||
address,
|
||||
ele_value as eleValue,
|
||||
relay_state as relayState,
|
||||
remark,
|
||||
nu_id as nuId,
|
||||
nu_name as nuName,
|
||||
depart_id as departId,
|
||||
depart_name as departName,
|
||||
depart_server_url as departServerUrl,
|
||||
sync_type as syncType,
|
||||
maintain_status as maintainStatus
|
||||
from nu_iot_tq_electricity_meter
|
||||
where nu_id = #{nuId}
|
||||
order by id asc
|
||||
</select>
|
||||
|
||||
<select id="getWaterMeterListByNuId" parameterType="String" resultType="com.nu.modules.syncbiz.entity.WaterMeter">
|
||||
select
|
||||
id,
|
||||
cid,
|
||||
address,
|
||||
water_value as waterValue,
|
||||
relay_state as relayState,
|
||||
battery_state as batteryState,
|
||||
remark,
|
||||
nu_id as nuId,
|
||||
nu_name as nuName,
|
||||
depart_id as departId,
|
||||
depart_name as departName,
|
||||
depart_server_url as departServerUrl,
|
||||
sync_type as syncType,
|
||||
maintain_status as maintainStatus
|
||||
from nu_iot_tq_water_meter
|
||||
where nu_id = #{nuId}
|
||||
order by id asc
|
||||
</select>
|
||||
|
||||
<select id="getCollectorListByNuId" parameterType="String" resultType="com.nu.modules.syncbiz.entity.EleWaterCollector">
|
||||
select
|
||||
id,
|
||||
cid,
|
||||
online,
|
||||
csq,
|
||||
disconnect_time as disconnectTime,
|
||||
connect_time as connectTime,
|
||||
remark,
|
||||
sync_type as syncType
|
||||
from nu_iot_tq_collector
|
||||
where cid in (
|
||||
select cid from nu_iot_tq_electricity_meter where nu_id = #{nuId}
|
||||
union all
|
||||
select cid from nu_iot_tq_water_meter where nu_id = #{nuId}
|
||||
)
|
||||
order by id asc
|
||||
</select>
|
||||
|
||||
<select id="getHumidDeviceListByNuId" parameterType="String" resultType="com.nu.modules.syncbiz.entity.HumidDevice">
|
||||
select
|
||||
id,
|
||||
sn,
|
||||
device_name as deviceName,
|
||||
time_code as timeCode,
|
||||
device_types as deviceTypes,
|
||||
reporting_interval as reportingInterval,
|
||||
record_interval as recordInterval,
|
||||
history_report_time as historyReportTime,
|
||||
history_interval as historyInterval,
|
||||
temperature_high as temperatureHigh,
|
||||
temperature_low as temperatureLow,
|
||||
temperature_buffer as temperatureBuffer,
|
||||
humidity_high as humidityHigh,
|
||||
humidity_low as humidityLow,
|
||||
humidity_buffer as humidityBuffer,
|
||||
iz_outages as izOutages,
|
||||
iz_low_battery as izLowBattery,
|
||||
iz_online as izOnline,
|
||||
temperature,
|
||||
humidity,
|
||||
status,
|
||||
reporting_time as reportingTime,
|
||||
electricity,
|
||||
nu_id as nuId,
|
||||
nu_name as nuName,
|
||||
depart_id as departId,
|
||||
depart_name as departName,
|
||||
depart_server_url as departServerUrl,
|
||||
sync_type as syncType,
|
||||
maintain_status as maintainStatus
|
||||
from nu_iot_yiweilian_humid_device
|
||||
where nu_id = #{nuId}
|
||||
order by id asc
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -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<NuBaseInfo> {
|
||||
Result<String> syncIot(String nuId);
|
||||
}
|
|
@ -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<SyncBizMapper, NuBaseInfo> implements ISyncBizService {
|
||||
|
||||
@Autowired
|
||||
private RabbitMQUtil rabbitMQUtil;
|
||||
|
||||
@Autowired
|
||||
private ISyncBizLogService logService;
|
||||
|
||||
@Override
|
||||
public Result<String> 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<CameraInfo> cameraList = baseMapper.getCameraListByNuId(nuId);
|
||||
if(cameraList.size()>0){
|
||||
for(int i=0;i<cameraList.size();i++){
|
||||
CameraInfo entity = cameraList.get(i);
|
||||
String actionType = "更新";
|
||||
if(entity.getSyncType().equals("0")){
|
||||
actionType = "新增";
|
||||
}
|
||||
String resId = addLog(orgCode,orgName, JSON.toJSONString(entity),actionType,"摄像头");
|
||||
entity.setLogId(resId);
|
||||
}
|
||||
List<IotCameraInfoMQDto> cameraMQDtoList = BeanUtil.copyToList(cameraList, IotCameraInfoMQDto.class);
|
||||
//将摄像头信息存放到MQ类中
|
||||
dto.setCameraInfoList(cameraMQDtoList);
|
||||
}
|
||||
|
||||
//通过摄像头获取能力集信息
|
||||
List<CameraCapability> capabilityList = baseMapper.getCameraCapabilityByNuId(nuId);
|
||||
if(capabilityList.size()>0){
|
||||
for(int i=0;i<capabilityList.size();i++){
|
||||
CameraCapability entity = capabilityList.get(i);
|
||||
String actionType = "更新";
|
||||
if(entity.getSyncType().equals("0")){
|
||||
actionType = "新增";
|
||||
}
|
||||
String resId = addLog(orgCode,orgName, JSON.toJSONString(entity),actionType,"摄像头能力集");
|
||||
entity.setLogId(resId);
|
||||
}
|
||||
List<IotCameraCapabilityMQDto> capabilityMQDtoList = BeanUtil.copyToList(capabilityList, IotCameraCapabilityMQDto.class);
|
||||
//将能力集信息存放到MQ类中
|
||||
dto.setCapabilityList(capabilityMQDtoList);
|
||||
}
|
||||
|
||||
//通过nuId获取电表信息
|
||||
List<ElectricityMeter> electricityList = baseMapper.getElectricityMeterListByNuId(nuId);
|
||||
if(electricityList.size()>0){
|
||||
for(int i=0;i<electricityList.size();i++){
|
||||
ElectricityMeter entity = electricityList.get(i);
|
||||
String actionType = "更新";
|
||||
if(entity.getSyncType().equals("0")){
|
||||
actionType = "新增";
|
||||
}
|
||||
String resId = addLog(orgCode,orgName, JSON.toJSONString(entity),actionType,"电表");
|
||||
entity.setLogId(resId);
|
||||
}
|
||||
List<IotElectricityMeterMQDto> electricityMQDtoList = BeanUtil.copyToList(electricityList, IotElectricityMeterMQDto.class);
|
||||
//将电表信息存放到MQ类中
|
||||
dto.setElectricityMeterList(electricityMQDtoList);
|
||||
}
|
||||
|
||||
//通过nuId获取水表信息
|
||||
List<WaterMeter> waterList = baseMapper.getWaterMeterListByNuId(nuId);
|
||||
if(waterList.size()>0){
|
||||
for(int i=0;i<waterList.size();i++){
|
||||
WaterMeter entity = waterList.get(i);
|
||||
String actionType = "更新";
|
||||
if(entity.getSyncType().equals("0")){
|
||||
actionType = "新增";
|
||||
}
|
||||
String resId = addLog(orgCode,orgName, JSON.toJSONString(entity),actionType,"水表");
|
||||
entity.setLogId(resId);
|
||||
}
|
||||
List<IotWaterMeterMQDto> waterMQDtoList = BeanUtil.copyToList(waterList, IotWaterMeterMQDto.class);
|
||||
//将电表信息存放到MQ类中
|
||||
dto.setWaterMeterList(waterMQDtoList);
|
||||
}
|
||||
|
||||
//通过nuId获取采集器信息
|
||||
List<EleWaterCollector> collectorList = baseMapper.getCollectorListByNuId(nuId);
|
||||
if(collectorList.size()>0){
|
||||
for(int i=0;i<collectorList.size();i++){
|
||||
EleWaterCollector entity = collectorList.get(i);
|
||||
String actionType = "更新";
|
||||
if(entity.getSyncType().equals("0")){
|
||||
actionType = "新增";
|
||||
}
|
||||
String resId = addLog(orgCode,orgName, JSON.toJSONString(entity),actionType,"电水表采集器");
|
||||
entity.setLogId(resId);
|
||||
}
|
||||
List<IotEleWaterCollectorMQDto> collectorMQDtoList = BeanUtil.copyToList(collectorList, IotEleWaterCollectorMQDto.class);
|
||||
//将采集器信息存放到MQ类中
|
||||
dto.setCollectorList(collectorMQDtoList);
|
||||
}
|
||||
|
||||
//通过nuId获取温湿度计信息
|
||||
List<HumidDevice> humidList = baseMapper.getHumidDeviceListByNuId(nuId);
|
||||
if(humidList.size()>0){
|
||||
for(int i=0;i<humidList.size();i++){
|
||||
HumidDevice entity = humidList.get(i);
|
||||
String actionType = "更新";
|
||||
if(entity.getSyncType().equals("0")){
|
||||
actionType = "新增";
|
||||
}
|
||||
String resId = addLog(orgCode,orgName, JSON.toJSONString(entity),actionType,"温湿度计");
|
||||
entity.setLogId(resId);
|
||||
}
|
||||
List<IotHumidDeviceMQDto> 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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 = "设备序号")
|
||||
|
|
|
@ -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<CameraCapability> {
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?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.nu.modules.tplink.camera.mapper.CameraCapabilityMapper">
|
||||
|
||||
</mapper>
|
|
@ -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<CameraCapability> {
|
||||
}
|
|
@ -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<CameraCapabilityMapper, CameraCapability> implements ICameraCapabilityService {
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
|
@ -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<StatusMQDto> statusList = dto.getStatusList();
|
||||
if(statusList.size()>0){
|
||||
for(int i=0;i<statusList.size();i++){
|
||||
StatusMQDto sdto = statusList.get(i);
|
||||
String message = sdto.getMessage();
|
||||
SyncBizLog log = new SyncBizLog();
|
||||
log.setLogId(sdto.getPrimaryKey());
|
||||
if(message.equals("忽略")){
|
||||
logService.deleteLog(log);
|
||||
}else{
|
||||
log.setStatus(sdto.getMessage());
|
||||
logService.updateLog(log);
|
||||
if(message.equals("成功")){
|
||||
String bizId = sdto.getAsyncId();
|
||||
String note = sdto.getNote();
|
||||
if(note.equals("区域")){
|
||||
NuBaseInfo nuBaseInfo = new NuBaseInfo();
|
||||
nuBaseInfo.setIzSync("1");
|
||||
nuBaseInfo.setId(bizId);
|
||||
nuBaseInfoService.updateById(nuBaseInfo);
|
||||
}
|
||||
if(note.equals("摄像头")){
|
||||
CameraInfo cameraInfo = new CameraInfo();
|
||||
cameraInfo.setSyncType("1");
|
||||
cameraInfo.setId(Integer.valueOf(bizId));
|
||||
cameraService.updateById(cameraInfo);
|
||||
}
|
||||
if(note.equals("摄像头能力集")){
|
||||
CameraCapability cameraCapability = new CameraCapability();
|
||||
cameraCapability.setSyncType("1");
|
||||
cameraCapability.setId(Integer.valueOf(bizId));
|
||||
cameraCapabilityService.updateById(cameraCapability);
|
||||
}
|
||||
if(note.equals("电表")){
|
||||
ElectricityMeter electricityMeter = new ElectricityMeter();
|
||||
electricityMeter.setSyncType("1");
|
||||
electricityMeter.setId(Integer.valueOf(bizId));
|
||||
electricityService.updateById(electricityMeter);
|
||||
}
|
||||
if(note.equals("水表")){
|
||||
WaterMeter waterMeter = new WaterMeter();
|
||||
waterMeter.setSyncType("1");
|
||||
waterMeter.setId(Integer.valueOf(bizId));
|
||||
waterService.updateById(waterMeter);
|
||||
}
|
||||
if(note.equals("电水表采集器")){
|
||||
TqDeviceInfo tqDeviceInfo = new TqDeviceInfo();
|
||||
tqDeviceInfo.setSyncType("1");
|
||||
tqDeviceInfo.setId(Integer.valueOf(bizId));
|
||||
collectorService.updateById(tqDeviceInfo);
|
||||
}
|
||||
if(note.equals("温湿度计")){
|
||||
HumidDevice humidDevice = new HumidDevice();
|
||||
humidDevice.setSyncType("1");
|
||||
humidDevice.setId(Integer.valueOf(bizId));
|
||||
humidDeviceService.updateById(humidDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue