Compare commits
	
		
			2 Commits
		
	
	
		
			49a31edad2
			...
			dd5cb05649
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| dd5cb05649 | |||
| 01b4d80adb | 
| @ -0,0 +1,43 @@ | |||||||
|  | package org.dromara.monitoring.config; | ||||||
|  |  | ||||||
|  | public class SnowFlakeUtil { | ||||||
|  |     // 起始时间戳 | ||||||
|  |     private static final long startTimeStamp = 1577808000000L; | ||||||
|  |     // 机器ID | ||||||
|  |     private static final long workID = 1L; | ||||||
|  |     // 数据中心ID | ||||||
|  |     private static final long dataCenterID = 1L; | ||||||
|  |     // 序列号 | ||||||
|  |     private static long sequence = 0L; | ||||||
|  |     // 数据中心ID移动位数 | ||||||
|  |     private static final long dataCenterIndex = 12L; | ||||||
|  |     // 机器ID移动位数 | ||||||
|  |     private static final long workIDIndex = 17L; | ||||||
|  |     // 时间戳移动位数 | ||||||
|  |     private static final long timeStampIndex = 22L; | ||||||
|  |     // 记录上一次时间戳 | ||||||
|  |     private static long lastTimeStamp = -1L; | ||||||
|  |     // 序列号掩码 | ||||||
|  |     private static final long sequenceMask = -1L ^ (-1L << 12); | ||||||
|  |     public synchronized static long getID() { | ||||||
|  |         long now = System.currentTimeMillis(); | ||||||
|  |         if (now < lastTimeStamp) { | ||||||
|  |             throw new RuntimeException("时钟回拨异常"); | ||||||
|  |         } | ||||||
|  |         if (now == lastTimeStamp) { | ||||||
|  |             sequence = (sequence + 1) & sequenceMask; | ||||||
|  |             if (sequence == 0L) { | ||||||
|  |                 try { | ||||||
|  |                     Thread.sleep(1L); | ||||||
|  |                 } catch (InterruptedException e) { | ||||||
|  |                     throw new RuntimeException(e); | ||||||
|  |                 } | ||||||
|  |                 now = System.currentTimeMillis(); | ||||||
|  |             } | ||||||
|  |         } else { | ||||||
|  |             sequence = 0L; | ||||||
|  |         } | ||||||
|  |         lastTimeStamp = now; | ||||||
|  |         return ((now - startTimeStamp) << timeStampIndex) | (dataCenterID << dataCenterIndex) | (workID << workIDIndex) | sequence; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,16 @@ | |||||||
|  | package org.dromara.monitoring.config; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import lombok.Data; | ||||||
|  | import org.springframework.boot.context.properties.ConfigurationProperties; | ||||||
|  | import org.springframework.stereotype.Component; | ||||||
|  |  | ||||||
|  | @Data | ||||||
|  | @Component | ||||||
|  | @ConfigurationProperties(prefix = "ys7") | ||||||
|  | public class YsDto { | ||||||
|  |     private String appKey; | ||||||
|  |     private String appSecret; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,116 @@ | |||||||
|  | package org.dromara.monitoring.controller; | ||||||
|  |  | ||||||
|  | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
|  | import jakarta.servlet.http.HttpServletResponse; | ||||||
|  | import jakarta.validation.constraints.NotNull; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.dromara.common.core.domain.R; | ||||||
|  | import org.dromara.common.core.validate.AddGroup; | ||||||
|  | import org.dromara.common.core.validate.EditGroup; | ||||||
|  | import org.dromara.common.excel.utils.ExcelUtil; | ||||||
|  | import org.dromara.common.idempotent.annotation.RepeatSubmit; | ||||||
|  | import org.dromara.common.log.annotation.Log; | ||||||
|  | import org.dromara.common.log.enums.BusinessType; | ||||||
|  | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
|  | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
|  | import org.dromara.common.web.core.BaseController; | ||||||
|  | import org.dromara.monitoring.domain.bo.MonDevicePresetBo; | ||||||
|  | import org.dromara.monitoring.domain.dto.DelYzd; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonDevicePresetVo; | ||||||
|  | import org.dromara.monitoring.service.IMonDevicePresetService; | ||||||
|  | import org.springframework.validation.annotation.Validated; | ||||||
|  | import org.springframework.web.bind.annotation.*; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 摄像头预置位 | ||||||
|  |  * 前端访问路由地址为:/camera/devicePreset | ||||||
|  |  * | ||||||
|  |  * @author LionLi | ||||||
|  |  * @date 2025-09-23 | ||||||
|  |  */ | ||||||
|  | @Validated | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @RestController | ||||||
|  | @RequestMapping("/devicePreset") | ||||||
|  | public class MonDevicePresetController extends BaseController { | ||||||
|  |  | ||||||
|  |     private final IMonDevicePresetService monDevicePresetService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询摄像头预置位列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("camera:devicePreset:list") | ||||||
|  |     @GetMapping("/list") | ||||||
|  |     public TableDataInfo<MonDevicePresetVo> list(MonDevicePresetBo bo, PageQuery pageQuery) { | ||||||
|  |         return monDevicePresetService.queryPageList(bo, pageQuery); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 导出摄像头预置位列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("camera:devicePreset:export") | ||||||
|  |     @Log(title = "摄像头预置位", businessType = BusinessType.EXPORT) | ||||||
|  |     @PostMapping("/export") | ||||||
|  |     public void export(MonDevicePresetBo bo, HttpServletResponse response) { | ||||||
|  |         List<MonDevicePresetVo> list = monDevicePresetService.queryList(bo); | ||||||
|  |         ExcelUtil.exportExcel(list, "摄像头预置位", MonDevicePresetVo.class, response); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取摄像头预置位详细信息 | ||||||
|  |      * | ||||||
|  |      * @param id 主键 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("camera:devicePreset:query") | ||||||
|  |     @GetMapping("/{id}") | ||||||
|  |     public R<MonDevicePresetVo> getInfo(@NotNull(message = "主键不能为空") | ||||||
|  |                                      @PathVariable("id") Long id) { | ||||||
|  |         return R.ok(monDevicePresetService.queryById(id)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增摄像头预置位 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("camera:devicePreset:add") | ||||||
|  |     @Log(title = "摄像头预置位", businessType = BusinessType.INSERT) | ||||||
|  |     @RepeatSubmit() | ||||||
|  |     @PostMapping() | ||||||
|  |     public R<Void> add(@Validated(AddGroup.class) @RequestBody MonDevicePresetBo bo) { | ||||||
|  |         return toAjax(monDevicePresetService.insertByBo(bo)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改摄像头预置位 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("camera:devicePreset:edit") | ||||||
|  |     @Log(title = "摄像头预置位", businessType = BusinessType.UPDATE) | ||||||
|  |     @RepeatSubmit() | ||||||
|  |     @PutMapping() | ||||||
|  |     public R<Void> edit(@Validated(EditGroup.class) @RequestBody MonDevicePresetBo bo) { | ||||||
|  |         return toAjax(monDevicePresetService.updateByBo(bo)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除摄像头预置位 | ||||||
|  |      * | ||||||
|  |      * @param | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("camera:devicePreset:remove") | ||||||
|  |     @Log(title = "摄像头预置位", businessType = BusinessType.DELETE) | ||||||
|  |     @DeleteMapping("/delYzd") | ||||||
|  |     public R<Void> remove(@RequestBody List<DelYzd> yzd) { | ||||||
|  |         return toAjax(monDevicePresetService.deleteWithValidByIds(yzd, true)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Log(title = "调用摄像头预置位", businessType = BusinessType.DELETE) | ||||||
|  |     @PostMapping("/callYzd") | ||||||
|  |     public R<Void> invoking(@RequestBody List<DelYzd> yzd) { | ||||||
|  |         return toAjax(monDevicePresetService.invoking(yzd)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,69 @@ | |||||||
|  | package org.dromara.monitoring.controller; | ||||||
|  |  | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.dromara.common.core.domain.R; | ||||||
|  | import org.dromara.common.log.annotation.Log; | ||||||
|  | import org.dromara.common.log.enums.BusinessType; | ||||||
|  | import org.dromara.monitoring.domain.dto.DelYzd; | ||||||
|  | import org.dromara.monitoring.domain.dto.MonitoringListDto; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonList; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonYsVo; | ||||||
|  | import org.dromara.monitoring.service.MonitoringYsService; | ||||||
|  | import org.springframework.validation.annotation.Validated; | ||||||
|  | import org.springframework.web.bind.annotation.*; | ||||||
|  |  | ||||||
|  | @Validated | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @RestController | ||||||
|  | @RequestMapping("/monitoriing") | ||||||
|  | /** | ||||||
|  |  * 监控管理 | ||||||
|  |  */ | ||||||
|  | public class MonitoriingYsColltroller { | ||||||
|  |  | ||||||
|  |     private final MonitoringYsService monitoringYsService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      *  获取token | ||||||
|  |      */ | ||||||
|  |     @GetMapping("/getToken") | ||||||
|  |     @Log(title = "获取莹石云token", businessType = BusinessType.INSERT) | ||||||
|  |     public R<String> getysTokenColltroller(){ | ||||||
|  |         return R.ok("ok",monitoringYsService.getYsTokenService()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      *  获取监控列表 | ||||||
|  |      */ | ||||||
|  |     @PostMapping("/getMonitoringList") | ||||||
|  |     @Log(title = "获取监控列表", businessType = BusinessType.INSERT) | ||||||
|  |     public R<MonList> getMonitoringList(@RequestBody MonitoringListDto dto){ | ||||||
|  |         return R.ok("请求成功",monitoringYsService.getMonitoringList(dto)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      *  获取大屏项目 | ||||||
|  |      */ | ||||||
|  |     @GetMapping("/getMonitoringDp") | ||||||
|  |     @Log(title = "数据组装", businessType = BusinessType.INSERT) | ||||||
|  |     public R<MonYsVo> getMonitoringDp(){ | ||||||
|  |         return R.ok("请求成功",monitoringYsService.getMonitoringDp()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      *  抓拍 | ||||||
|  |      */ | ||||||
|  |     @GetMapping("/capturePho") | ||||||
|  |     @Log(title = "抓拍接口:未用", businessType = BusinessType.INSERT) | ||||||
|  |     public R<String> capturePho(@RequestBody DelYzd dto){ | ||||||
|  |         return R.ok("请求成功",monitoringYsService.capturePho(dto)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     @GetMapping("/test") | ||||||
|  |     public R<Void> test(){ | ||||||
|  |         return R.ok("请求成功",monitoringYsService.test()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,59 @@ | |||||||
|  | package org.dromara.monitoring.domain; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableId; | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
|  | import lombok.Data; | ||||||
|  | import org.checkerframework.checker.i18nformatter.qual.I18nFormat; | ||||||
|  |  | ||||||
|  | import java.time.LocalDateTime; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 设备预置点记录 mon_device_preset | ||||||
|  |  */ | ||||||
|  | @TableName("mon_device_preset") | ||||||
|  | @Data | ||||||
|  | public class MonDevicePreset { | ||||||
|  |  | ||||||
|  |     private static final long serialVersionUID = 1L; | ||||||
|  |  | ||||||
|  |     /** 预置点ID */ | ||||||
|  |     @TableId(value = "id", type = com.baomidou.mybatisplus.annotation.IdType.AUTO) | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** 设备序列号 */ | ||||||
|  |     private String deviceSerial; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** 通道号 */ | ||||||
|  |     private Integer channelNo; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** 预置点序号 */ | ||||||
|  |     private Integer PresetIndex; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** 预置点名称 */ | ||||||
|  |     private String presetName; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /**创建时间 */ | ||||||
|  |     private LocalDateTime createTime; | ||||||
|  |  | ||||||
|  |     /**更新时间 */ | ||||||
|  |     private LocalDateTime updateTime; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,43 @@ | |||||||
|  | package org.dromara.monitoring.domain; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableId; | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
|  | import lombok.Data; | ||||||
|  |  | ||||||
|  | import java.time.LocalDateTime; | ||||||
|  |  | ||||||
|  | @Data | ||||||
|  | @TableName("mon_equipment_histroy") | ||||||
|  | /** | ||||||
|  |  * 设备点击历史记录表 mon_equipment_histroy | ||||||
|  |  */ | ||||||
|  | public class MonEquipmentHistroy { | ||||||
|  |     /** 历史id */ | ||||||
|  |     @TableId(value = "id") | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |     /** 设备序列号 */ | ||||||
|  |     private String deviceSerial; | ||||||
|  |  | ||||||
|  |     /** 设备名称 */ | ||||||
|  |     private String deviceName; | ||||||
|  |  | ||||||
|  |     /** 设备型号 */ | ||||||
|  |     private String deviceType; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** 用户id */ | ||||||
|  |     private Long userId; | ||||||
|  |  | ||||||
|  |     /** 部门id */ | ||||||
|  |     private Long deptId; | ||||||
|  |  | ||||||
|  |     /** 项目id */ | ||||||
|  |     private Long projectId; | ||||||
|  |  | ||||||
|  |     /** 点击时间 */ | ||||||
|  |     private LocalDateTime createTime; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,60 @@ | |||||||
|  | package org.dromara.monitoring.domain; | ||||||
|  |  | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableId; | ||||||
|  | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
|  | import lombok.Data; | ||||||
|  |  | ||||||
|  | import java.time.LocalDateTime; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 设备列表表 mon_equipment_list | ||||||
|  |  * | ||||||
|  |  * @author LionLi | ||||||
|  |  * @date 2023-08-09 | ||||||
|  |  */ | ||||||
|  | @TableName("mon_equipment_list") | ||||||
|  | @Data | ||||||
|  | public class MonEquipmentList { | ||||||
|  |  | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** 设备序列号 */ | ||||||
|  |     private String deviceSerial; | ||||||
|  |  | ||||||
|  |     /**设备名称	 */ | ||||||
|  |     private String deviceName; | ||||||
|  |  | ||||||
|  |     /**设备型号		 */ | ||||||
|  |     private String deviceType; | ||||||
|  |  | ||||||
|  |     /**设备在线状态,1-在线;0-离线	 */ | ||||||
|  |     private Integer status; | ||||||
|  |  | ||||||
|  |     /**布撤防状态	 */ | ||||||
|  |     private Integer defence; | ||||||
|  |  | ||||||
|  |     /**固件版本号	 */ | ||||||
|  |     private String deviceVersion; | ||||||
|  |  | ||||||
|  |     /**用户添加时间	 */ | ||||||
|  |     private LocalDateTime addTime; | ||||||
|  |  | ||||||
|  |     /**设备最后更新时间	 */ | ||||||
|  |     private LocalDateTime updateTime; | ||||||
|  |  | ||||||
|  |     /**设备二级类目名称	 */ | ||||||
|  |     private String parentCategory; | ||||||
|  |  | ||||||
|  |     /**设备风险安全等级,0-安全;大于0,有风险,风险越高,值越大	 */ | ||||||
|  |     private Integer riskLevel; | ||||||
|  |  | ||||||
|  |     /**设备IP地址	 */ | ||||||
|  |     private String netAddress; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     private Integer total; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,52 @@ | |||||||
|  | package org.dromara.monitoring.domain.bo; | ||||||
|  |  | ||||||
|  | import org.dromara.common.mybatis.core.domain.BaseEntity; | ||||||
|  | import org.dromara.common.core.validate.AddGroup; | ||||||
|  | import org.dromara.common.core.validate.EditGroup; | ||||||
|  | import io.github.linpeilie.annotations.AutoMapper; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.EqualsAndHashCode; | ||||||
|  | import jakarta.validation.constraints.*; | ||||||
|  | import org.dromara.monitoring.domain.MonDevicePreset; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 摄像头预置位业务对象 mon_device_preset | ||||||
|  |  * | ||||||
|  |  * @author LionLi | ||||||
|  |  * @date 2025-09-23 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | @EqualsAndHashCode(callSuper = true) | ||||||
|  | @AutoMapper(target = MonDevicePreset.class, reverseConvertGenerate = false) | ||||||
|  | public class MonDevicePresetBo extends BaseEntity { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 主键id | ||||||
|  |      */ | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备序列号 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "设备序列号不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private String deviceSerial; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 通道号 | ||||||
|  |      */ | ||||||
|  |     @NotNull(message = "通道号不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private Long channelNo; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 预置点序号 | ||||||
|  |      */ | ||||||
|  |     private Long presetIndex; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 预置点 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "预置点不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private String presetName; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,92 @@ | |||||||
|  | package org.dromara.monitoring.domain.bo; | ||||||
|  |  | ||||||
|  | import io.github.linpeilie.annotations.AutoMapper; | ||||||
|  | import jakarta.validation.constraints.NotBlank; | ||||||
|  | import jakarta.validation.constraints.NotNull; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.EqualsAndHashCode; | ||||||
|  | import org.dromara.common.core.validate.AddGroup; | ||||||
|  | import org.dromara.common.core.validate.EditGroup; | ||||||
|  | import org.dromara.common.mybatis.core.domain.BaseEntity; | ||||||
|  | import org.dromara.monitoring.domain.MonEquipmentList; | ||||||
|  |  | ||||||
|  | import java.util.Date; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 设备列业务对象 mon_equipment_list | ||||||
|  |  * | ||||||
|  |  * @author LionLi | ||||||
|  |  * @date 2025-09-25 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | @EqualsAndHashCode(callSuper = true) | ||||||
|  | @AutoMapper(target = MonEquipmentList.class, reverseConvertGenerate = false) | ||||||
|  | public class MonEquipmentListBo extends BaseEntity { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 主键 | ||||||
|  |      */ | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备序列号 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "设备序列号不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private String deviceSerial; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备名称 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "设备名称不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private String deviceName; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备型号 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "设备型号	不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private String deviceType; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备在线状态,1-在线;0-离线 | ||||||
|  |      */ | ||||||
|  |     @NotNull(message = "设备在线状态,1-在线;0-离线不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private Long status; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 布撤防状态 | ||||||
|  |      */ | ||||||
|  |     @NotNull(message = "布撤防状态不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private Long defence; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 固件版本号 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "固件版本号	不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private String deviceVersion; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 用户添加时间 | ||||||
|  |      */ | ||||||
|  |     @NotNull(message = "用户添加时间不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private Date addTime; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备二级类目名称 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "设备二级类目名称不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private String parentCategory; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备风险安全等级,0-安全;大于0,有风险,风险越高,值越大 | ||||||
|  |      */ | ||||||
|  |     @NotNull(message = "设备风险安全等级,0-安全;大于0,有风险,风险越高,值越大不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private Long riskLevel; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备IP地址 | ||||||
|  |      */ | ||||||
|  |     @NotBlank(message = "设备IP地址不能为空", groups = { AddGroup.class, EditGroup.class }) | ||||||
|  |     private String netAddress; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,26 @@ | |||||||
|  | package org.dromara.monitoring.domain.dto; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import lombok.Data; | ||||||
|  |  | ||||||
|  | @Data | ||||||
|  | /** | ||||||
|  |  * 删除预置点 | ||||||
|  |  */ | ||||||
|  | public class DelYzd { | ||||||
|  |  | ||||||
|  |     private Long id; | ||||||
|  |     /** | ||||||
|  |      *  设备序列号 | ||||||
|  |      */ | ||||||
|  |     private String deviceSerial; | ||||||
|  |     /** | ||||||
|  |      *  通道号 | ||||||
|  |      */ | ||||||
|  |     private Integer channelNo  = 1; | ||||||
|  |     /** | ||||||
|  |      *  预置点序号 | ||||||
|  |      */ | ||||||
|  |     private Integer presetIndex  ; | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,31 @@ | |||||||
|  | package org.dromara.monitoring.domain.dto; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import jakarta.validation.constraints.NotNull; | ||||||
|  | import lombok.Data; | ||||||
|  | import lombok.NonNull; | ||||||
|  |  | ||||||
|  | @Data | ||||||
|  | public class MonitoringListDto { | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 分页页码,起始页从0开始,不超过400页 | ||||||
|  |      */ | ||||||
|  |     private Integer pageStart; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 	分页大小,默认为10,不超过50 | ||||||
|  |      */ | ||||||
|  |     private Integer pageSize; | ||||||
|  |  | ||||||
|  | //    部门id | ||||||
|  |     @NotNull(message = "部门id不能为空") | ||||||
|  |     private Long projectId; | ||||||
|  |  | ||||||
|  |     @NotNull(message = "是否为历史数据") | ||||||
|  |     private Boolean isflow; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,62 @@ | |||||||
|  | package org.dromara.monitoring.domain.vo; | ||||||
|  |  | ||||||
|  | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||||||
|  | import cn.idev.excel.annotation.ExcelProperty; | ||||||
|  | import org.dromara.common.excel.annotation.ExcelDictFormat; | ||||||
|  | import org.dromara.common.excel.convert.ExcelDictConvert; | ||||||
|  | import io.github.linpeilie.annotations.AutoMapper; | ||||||
|  | import lombok.Data; | ||||||
|  | import org.dromara.monitoring.domain.MonDevicePreset; | ||||||
|  |  | ||||||
|  | import java.io.Serial; | ||||||
|  | import java.io.Serializable; | ||||||
|  | import java.util.Date; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 摄像头预置位视图对象 mon_device_preset | ||||||
|  |  * | ||||||
|  |  * @author LionLi | ||||||
|  |  * @date 2025-09-23 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | @ExcelIgnoreUnannotated | ||||||
|  | @AutoMapper(target = MonDevicePreset.class) | ||||||
|  | public class MonDevicePresetVo implements Serializable { | ||||||
|  |  | ||||||
|  |     @Serial | ||||||
|  |     private static final long serialVersionUID = 1L; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 主键id | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "主键id") | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备序列号 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "设备序列号") | ||||||
|  |     private String deviceSerial; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 通道号 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "通道号") | ||||||
|  |     private Long channelNo; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 预置点序号 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "预置点序号") | ||||||
|  |     private Long presetIndex; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 预置点 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "预置点") | ||||||
|  |     private String presetName; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,96 @@ | |||||||
|  | package org.dromara.monitoring.domain.vo; | ||||||
|  |  | ||||||
|  | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||||||
|  | import cn.idev.excel.annotation.ExcelProperty; | ||||||
|  | import io.github.linpeilie.annotations.AutoMapper; | ||||||
|  | import lombok.Data; | ||||||
|  | import org.dromara.monitoring.domain.MonEquipmentList; | ||||||
|  |  | ||||||
|  | import java.io.Serial; | ||||||
|  | import java.io.Serializable; | ||||||
|  | import java.util.Date; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 设备列视图对象 mon_equipment_list | ||||||
|  |  * | ||||||
|  |  * @author LionLi | ||||||
|  |  * @date 2025-09-25 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | @ExcelIgnoreUnannotated | ||||||
|  | @AutoMapper(target = MonEquipmentList.class) | ||||||
|  | public class MonEquipmentListVo implements Serializable { | ||||||
|  |  | ||||||
|  |     @Serial | ||||||
|  |     private static final long serialVersionUID = 1L; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 主键 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "主键") | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备序列号 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "设备序列号") | ||||||
|  |     private String deviceSerial; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备名称 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "设备名称	") | ||||||
|  |     private String deviceName; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备型号 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "设备型号	") | ||||||
|  |     private String deviceType; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备在线状态,1-在线;0-离线 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "设备在线状态,1-在线;0-离线") | ||||||
|  |     private Long status; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 布撤防状态 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "布撤防状态") | ||||||
|  |     private Long defence; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 固件版本号 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "固件版本号	") | ||||||
|  |     private String deviceVersion; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 用户添加时间 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "用户添加时间") | ||||||
|  |     private Date addTime; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备二级类目名称 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "设备二级类目名称") | ||||||
|  |     private String parentCategory; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备风险安全等级,0-安全;大于0,有风险,风险越高,值越大 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "设备风险安全等级,0-安全;大于0,有风险,风险越高,值越大") | ||||||
|  |     private Long riskLevel; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 设备IP地址 | ||||||
|  |      */ | ||||||
|  |     @ExcelProperty(value = "设备IP地址") | ||||||
|  |     private String netAddress; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,11 @@ | |||||||
|  | package org.dromara.monitoring.domain.vo; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import lombok.Data; | ||||||
|  |  | ||||||
|  | @Data | ||||||
|  | public class MonList { | ||||||
|  |  | ||||||
|  |     private Object object; | ||||||
|  |     private Integer sum; | ||||||
|  | } | ||||||
| @ -0,0 +1,23 @@ | |||||||
|  | package org.dromara.monitoring.domain.vo; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import lombok.Data; | ||||||
|  |  | ||||||
|  | @Data | ||||||
|  | public class MonYsVo { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 监控总数 | ||||||
|  |      */ | ||||||
|  |     private Integer sumMon; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 在线总数 | ||||||
|  |      */ | ||||||
|  |     private Long sumOnLine; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 离线总数 | ||||||
|  |      */ | ||||||
|  |     private Long sumOffLine; | ||||||
|  | } | ||||||
| @ -0,0 +1,17 @@ | |||||||
|  | package org.dromara.monitoring.mapper; | ||||||
|  |  | ||||||
|  | import org.apache.ibatis.annotations.Mapper; | ||||||
|  | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; | ||||||
|  | import org.dromara.monitoring.domain.MonDevicePreset; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonDevicePresetVo; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 摄像头预置位Mapper接口 | ||||||
|  |  * | ||||||
|  |  * @author LionLi | ||||||
|  |  * @date 2025-09-23 | ||||||
|  |  */ | ||||||
|  | @Mapper | ||||||
|  | public interface MonDevicePresetMapper extends BaseMapperPlus<MonDevicePreset, MonDevicePresetVo> { | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,16 @@ | |||||||
|  | package org.dromara.monitoring.mapper; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; | ||||||
|  | import org.dromara.monitoring.domain.MonEquipmentList; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonEquipmentListVo; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 设备列Mapper接口 | ||||||
|  |  * | ||||||
|  |  * @author LionLi | ||||||
|  |  * @date 2025-09-25 | ||||||
|  |  */ | ||||||
|  | public interface MonEquipmentListMapper extends BaseMapperPlus<MonEquipmentList, MonEquipmentListVo> { | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,27 @@ | |||||||
|  | package org.dromara.monitoring.mapper; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import org.apache.ibatis.annotations.Delete; | ||||||
|  | import org.apache.ibatis.annotations.Mapper; | ||||||
|  | import org.apache.ibatis.annotations.Param; | ||||||
|  | import org.dromara.monitoring.domain.MonEquipmentHistroy; | ||||||
|  | import org.dromara.monitoring.domain.MonEquipmentList; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  |  | ||||||
|  | @Mapper | ||||||
|  |     public interface MonitoringYsMapper { | ||||||
|  |  | ||||||
|  |  | ||||||
|  |      Integer setSunList(); | ||||||
|  |  | ||||||
|  |     void insettList(@Param("list") List<MonEquipmentList> tempList); | ||||||
|  |  | ||||||
|  |     void insertHistroy(@Param("data") List<MonEquipmentHistroy> data); | ||||||
|  |  | ||||||
|  |     @Delete("TRUNCATE TABLE mon_equipment_list") | ||||||
|  |     void delList(); | ||||||
|  |  | ||||||
|  |     List<MonEquipmentList> selDpList(); | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,18 @@ | |||||||
|  | package org.dromara.monitoring.monEnum; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | public enum ListConstant { | ||||||
|  |     PAGESTART(0), | ||||||
|  |     pageSize(300); | ||||||
|  |  | ||||||
|  |     private Integer constant; | ||||||
|  |  | ||||||
|  |     ListConstant(Integer constant) { | ||||||
|  |         this.constant = constant; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public Integer getConstant() { | ||||||
|  |         return constant; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,26 @@ | |||||||
|  | package org.dromara.monitoring.monEnum; | ||||||
|  |  | ||||||
|  | public enum QualityEnum { | ||||||
|  |  | ||||||
|  |     FLUENCY("流畅", "0"), | ||||||
|  |     HIGHDEFINITION("高清", "1"), | ||||||
|  |     CIF("4CIF", "2"), | ||||||
|  |     CIFG("1080P", "3"); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     private String name; | ||||||
|  |  | ||||||
|  |     private String value; | ||||||
|  |  | ||||||
|  |     private QualityEnum(String name, String value) { | ||||||
|  |         this.name = name; | ||||||
|  |         this.value = value; | ||||||
|  |     } | ||||||
|  |     public String getName() { | ||||||
|  |         return name; | ||||||
|  |     } | ||||||
|  |     public String getValue() { | ||||||
|  |         return value; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,36 @@ | |||||||
|  | package org.dromara.monitoring.monEnum; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | public enum YsPort { | ||||||
|  |     ON_OFF_LINE_TOPIC_TYP("设备在线状态类型","ys.onoffline"), | ||||||
|  |     GETTOKENURLBYPOST("获取token的url","https://open.ys7.com/api/lapp/token/get"), | ||||||
|  |     GETDEVICELISTURL("获取设备列表的url","https://open.ys7.com/api/lapp/device/list"), | ||||||
|  |     UPDATEDEVICENAMEURLBYPOST("修改设备名称的url","https://open.ys7.com/api/lapp/device/name/update"), | ||||||
|  |     ADDDEVICEPRESETURLBYPOST("添加设备预置点请求地址","https://open.ys7.com/api/lapp/device/preset/add"), | ||||||
|  |     MOVEDEVICEPRESETURLBYPOST("调用设备预置点请求地址","https://open.ys7.com/api/lapp/device/preset/move"), | ||||||
|  |     DELETEDEVICEPRESETURLBYPOST("删除设备预置点请求地址","https://open.ys7.com/api/lapp/device/preset/clear"), | ||||||
|  |     CAPTUREDEVICEURLBYPOST("设备拍照请求地址","https://open.ys7.com/api/lapp/device/capture"), | ||||||
|  |     DEVICESTORAGEMEDIUM ("设备存储介质格式化接口","https://open.ys7.com/api/v3/device/format/disk"), | ||||||
|  |     STORAGEMEDIUMSTATUS ("设备存储介质状态查询接口","https://open.ys7.com/api/v3/device/format/status"); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     // 成员变量 | ||||||
|  |     private final String sitename;  // 中文名称 | ||||||
|  |     private final String site; | ||||||
|  |  | ||||||
|  |     public String getSiteName() { | ||||||
|  |         return sitename; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public String getSite() { | ||||||
|  |         return site; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     YsPort(String sitename, String site) { | ||||||
|  |         this.sitename = sitename; | ||||||
|  |         this.site = site; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
| @ -0,0 +1,70 @@ | |||||||
|  | package org.dromara.monitoring.service; | ||||||
|  |  | ||||||
|  | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
|  | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
|  | import org.dromara.monitoring.domain.bo.MonDevicePresetBo; | ||||||
|  | import org.dromara.monitoring.domain.dto.DelYzd; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonDevicePresetVo; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 摄像头预置位Service接口 | ||||||
|  |  * | ||||||
|  |  * @author LionLi | ||||||
|  |  * @date 2025-09-23 | ||||||
|  |  */ | ||||||
|  | public interface IMonDevicePresetService { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询摄像头预置位 | ||||||
|  |      * | ||||||
|  |      * @param id 主键 | ||||||
|  |      * @return 摄像头预置位 | ||||||
|  |      */ | ||||||
|  |     MonDevicePresetVo queryById(Long id); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 分页查询摄像头预置位列表 | ||||||
|  |      * | ||||||
|  |      * @param bo        查询条件 | ||||||
|  |      * @param pageQuery 分页参数 | ||||||
|  |      * @return 摄像头预置位分页列表 | ||||||
|  |      */ | ||||||
|  |     TableDataInfo<MonDevicePresetVo> queryPageList(MonDevicePresetBo bo, PageQuery pageQuery); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询符合条件的摄像头预置位列表 | ||||||
|  |      * | ||||||
|  |      * @param bo 查询条件 | ||||||
|  |      * @return 摄像头预置位列表 | ||||||
|  |      */ | ||||||
|  |     List<MonDevicePresetVo> queryList(MonDevicePresetBo bo); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增摄像头预置位 | ||||||
|  |      * | ||||||
|  |      * @param bo 摄像头预置位 | ||||||
|  |      * @return 是否新增成功 | ||||||
|  |      */ | ||||||
|  |     Boolean insertByBo(MonDevicePresetBo bo); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改摄像头预置位 | ||||||
|  |      * | ||||||
|  |      * @param bo 摄像头预置位 | ||||||
|  |      * @return 是否修改成功 | ||||||
|  |      */ | ||||||
|  |     Boolean updateByBo(MonDevicePresetBo bo); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 校验并批量删除摄像头预置位信息 | ||||||
|  |      * | ||||||
|  |      * @param | ||||||
|  |      * @param isValid 是否进行有效性校验 | ||||||
|  |      * @return 是否删除成功 | ||||||
|  |      */ | ||||||
|  |     Boolean deleteWithValidByIds(List<DelYzd> yzd, Boolean isValid); | ||||||
|  |  | ||||||
|  |     boolean invoking(List<DelYzd> yzd); | ||||||
|  | } | ||||||
| @ -0,0 +1,69 @@ | |||||||
|  | package org.dromara.monitoring.service; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
|  | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
|  | import org.dromara.monitoring.domain.bo.MonEquipmentListBo; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonEquipmentListVo; | ||||||
|  |  | ||||||
|  | import java.util.Collection; | ||||||
|  | import java.util.List; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 设备列Service接口 | ||||||
|  |  * | ||||||
|  |  * @author LionLi | ||||||
|  |  * @date 2025-09-25 | ||||||
|  |  */ | ||||||
|  | public interface IMonEquipmentListService { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询设备列 | ||||||
|  |      * | ||||||
|  |      * @param id 主键 | ||||||
|  |      * @return 设备列 | ||||||
|  |      */ | ||||||
|  |     MonEquipmentListVo queryById(Long id); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 分页查询设备列列表 | ||||||
|  |      * | ||||||
|  |      * @param bo        查询条件 | ||||||
|  |      * @param pageQuery 分页参数 | ||||||
|  |      * @return 设备列分页列表 | ||||||
|  |      */ | ||||||
|  |     TableDataInfo<MonEquipmentListVo> queryPageList(MonEquipmentListBo bo, PageQuery pageQuery); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询符合条件的设备列列表 | ||||||
|  |      * | ||||||
|  |      * @param bo 查询条件 | ||||||
|  |      * @return 设备列列表 | ||||||
|  |      */ | ||||||
|  |     List<MonEquipmentListVo> queryList(MonEquipmentListBo bo); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增设备列 | ||||||
|  |      * | ||||||
|  |      * @param bo 设备列 | ||||||
|  |      * @return 是否新增成功 | ||||||
|  |      */ | ||||||
|  |     Boolean insertByBo(MonEquipmentListBo bo); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改设备列 | ||||||
|  |      * | ||||||
|  |      * @param bo 设备列 | ||||||
|  |      * @return 是否修改成功 | ||||||
|  |      */ | ||||||
|  |     Boolean updateByBo(MonEquipmentListBo bo); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 校验并批量删除设备列信息 | ||||||
|  |      * | ||||||
|  |      * @param ids     待删除的主键集合 | ||||||
|  |      * @param isValid 是否进行有效性校验 | ||||||
|  |      * @return 是否删除成功 | ||||||
|  |      */ | ||||||
|  |     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); | ||||||
|  | } | ||||||
| @ -0,0 +1,20 @@ | |||||||
|  | package org.dromara.monitoring.service; | ||||||
|  |  | ||||||
|  | import org.dromara.monitoring.domain.dto.DelYzd; | ||||||
|  | import org.dromara.monitoring.domain.dto.MonitoringListDto; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonList; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonYsVo; | ||||||
|  |  | ||||||
|  | public interface MonitoringYsService { | ||||||
|  |  | ||||||
|  |  | ||||||
|  |      String getYsTokenService(); | ||||||
|  |  | ||||||
|  |     MonList getMonitoringList(MonitoringListDto dto); | ||||||
|  |  | ||||||
|  |     MonYsVo getMonitoringDp(); | ||||||
|  |  | ||||||
|  |     String capturePho(DelYzd dto); | ||||||
|  |  | ||||||
|  |     Void test(); | ||||||
|  | } | ||||||
| @ -0,0 +1,206 @@ | |||||||
|  | package org.dromara.monitoring.service.impl; | ||||||
|  |  | ||||||
|  | import cn.hutool.http.HttpRequest; | ||||||
|  | import cn.hutool.json.JSONObject; | ||||||
|  | import cn.hutool.json.JSONUtil; | ||||||
|  | import org.dromara.common.core.utils.MapstructUtils; | ||||||
|  | import org.dromara.common.core.utils.StringUtils; | ||||||
|  | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
|  | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
|  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||||
|  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||||
|  | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import lombok.extern.slf4j.Slf4j; | ||||||
|  | import org.dromara.monitoring.config.SnowFlakeUtil; | ||||||
|  | import org.dromara.monitoring.domain.MonDevicePreset; | ||||||
|  | import org.dromara.monitoring.domain.bo.MonDevicePresetBo; | ||||||
|  | import org.dromara.monitoring.domain.dto.DelYzd; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonDevicePresetVo; | ||||||
|  | import org.dromara.monitoring.mapper.MonDevicePresetMapper; | ||||||
|  | import org.dromara.monitoring.monEnum.YsPort; | ||||||
|  | import org.dromara.monitoring.service.IMonDevicePresetService; | ||||||
|  | import org.dromara.monitoring.service.MonitoringYsService; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  | import java.util.Collection; | ||||||
|  | import java.util.stream.Collectors; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 摄像头预置位Service业务层处理 | ||||||
|  |  * | ||||||
|  |  * @author LionLi | ||||||
|  |  * @date 2025-09-23 | ||||||
|  |  */ | ||||||
|  | @Slf4j | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @Service | ||||||
|  | public class MonDevicePresetServiceImpl implements IMonDevicePresetService { | ||||||
|  |  | ||||||
|  |     private final MonDevicePresetMapper baseMapper; | ||||||
|  |  | ||||||
|  |     private  final MonitoringYsService monitoringYsService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询摄像头预置位 | ||||||
|  |      * | ||||||
|  |      * @param id 主键 | ||||||
|  |      * @return 摄像头预置位 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public MonDevicePresetVo queryById(Long id){ | ||||||
|  |         return baseMapper.selectVoById(id); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 分页查询摄像头预置位列表 | ||||||
|  |      * | ||||||
|  |      * @param bo        查询条件 | ||||||
|  |      * @param pageQuery 分页参数 | ||||||
|  |      * @return 摄像头预置位分页列表 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public TableDataInfo<MonDevicePresetVo> queryPageList(MonDevicePresetBo bo, PageQuery pageQuery) { | ||||||
|  |         LambdaQueryWrapper<MonDevicePreset> lqw = buildQueryWrapper(bo); | ||||||
|  |         Page<MonDevicePresetVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); | ||||||
|  |         return TableDataInfo.build(result); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询符合条件的摄像头预置位列表 | ||||||
|  |      * | ||||||
|  |      * @param bo 查询条件 | ||||||
|  |      * @return 摄像头预置位列表 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public List<MonDevicePresetVo> queryList(MonDevicePresetBo bo) { | ||||||
|  |         LambdaQueryWrapper<MonDevicePreset> lqw = buildQueryWrapper(bo); | ||||||
|  |         return baseMapper.selectVoList(lqw); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private LambdaQueryWrapper<MonDevicePreset> buildQueryWrapper(MonDevicePresetBo bo) { | ||||||
|  |         Map<String, Object> params = bo.getParams(); | ||||||
|  |         LambdaQueryWrapper<MonDevicePreset> lqw = Wrappers.lambdaQuery(); | ||||||
|  |         lqw.orderByAsc(MonDevicePreset::getId); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDeviceSerial()), MonDevicePreset::getDeviceSerial, bo.getDeviceSerial()); | ||||||
|  |         lqw.eq(bo.getChannelNo() != null, MonDevicePreset::getChannelNo, bo.getChannelNo()); | ||||||
|  |         lqw.eq(bo.getPresetIndex() != null, MonDevicePreset::getPresetIndex, bo.getPresetIndex()); | ||||||
|  |         lqw.like(StringUtils.isNotBlank(bo.getPresetName()), MonDevicePreset::getPresetName, bo.getPresetName()); | ||||||
|  |         return lqw; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增摄像头预置位 | ||||||
|  |      * | ||||||
|  |      * @param bo 摄像头预置位 | ||||||
|  |      * @return 是否新增成功 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean insertByBo(MonDevicePresetBo bo) { | ||||||
|  |         MonDevicePreset add = MapstructUtils.convert(bo, MonDevicePreset.class); | ||||||
|  |         validEntityBeforeSave(add); | ||||||
|  |         String jsonStr = HttpRequest | ||||||
|  |             .post(YsPort.ADDDEVICEPRESETURLBYPOST.getSite()). | ||||||
|  |             form("accessToken",monitoringYsService.getYsTokenService()) | ||||||
|  |             .form("deviceSerial", add.getDeviceSerial()) | ||||||
|  |             .form("channelNo", add.getChannelNo()) | ||||||
|  |             .execute().body(); | ||||||
|  |         JSONObject jsonObject = JSONUtil.parseObj(jsonStr.trim()); | ||||||
|  |  | ||||||
|  |         Map page1 = JSONUtil.parseObj(jsonObject.get("data")).toBean(Map.class); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         add.setPresetIndex(Integer.parseInt(page1.get("index").toString())); | ||||||
|  |         add.setId(SnowFlakeUtil.getID()); | ||||||
|  |  | ||||||
|  |         boolean flag = baseMapper.insert(add) > 0; | ||||||
|  |         if (flag) { | ||||||
|  |             bo.setId(add.getId()); | ||||||
|  |         } | ||||||
|  |         return flag; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改摄像头预置位 | ||||||
|  |      * | ||||||
|  |      * @param bo 摄像头预置位 | ||||||
|  |      * @return 是否修改成功 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean updateByBo(MonDevicePresetBo bo) { | ||||||
|  |         MonDevicePreset update = MapstructUtils.convert(bo, MonDevicePreset.class); | ||||||
|  |         String jsonStr = HttpRequest | ||||||
|  |             .post(YsPort.ADDDEVICEPRESETURLBYPOST.getSite()). | ||||||
|  |             form("accessToken",monitoringYsService.getYsTokenService()) | ||||||
|  |             .form("deviceSerial", update.getDeviceSerial()) | ||||||
|  |             .form("channelNo", update.getChannelNo()) | ||||||
|  |             .execute().body(); | ||||||
|  |         JSONObject jsonObject = JSONUtil.parseObj(jsonStr.trim()); | ||||||
|  |  | ||||||
|  |         Map page1 = JSONUtil.parseObj(jsonObject.get("data")).toBean(Map.class); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         update.setPresetIndex(Integer.parseInt(page1.get("index").toString())); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         validEntityBeforeSave(update); | ||||||
|  |         return baseMapper.updateById(update) > 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 保存前的数据校验 | ||||||
|  |      */ | ||||||
|  |     private void validEntityBeforeSave(MonDevicePreset entity){ | ||||||
|  |         //TODO 做一些数据校验,如唯一约束 | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 校验并批量删除摄像头预置位信息 | ||||||
|  |      * | ||||||
|  |      * @param | ||||||
|  |      * @param isValid 是否进行有效性校验 | ||||||
|  |      * @return 是否删除成功 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean deleteWithValidByIds(List<DelYzd> yzd, Boolean isValid) { | ||||||
|  |         if(isValid){ | ||||||
|  |             if (yzd.size() >0){ | ||||||
|  |                 yzd.stream().forEach(temp ->{ | ||||||
|  |                      HttpRequest | ||||||
|  |                         .post(YsPort.DELETEDEVICEPRESETURLBYPOST.getSite()). | ||||||
|  |                         form("accessToken",monitoringYsService.getYsTokenService()) | ||||||
|  |                         .form("deviceSerial", temp.getDeviceSerial()) | ||||||
|  |                         .form("channelNo", temp.getChannelNo()) | ||||||
|  |                         .form("index", temp.getPresetIndex()) | ||||||
|  |                         .execute().body(); | ||||||
|  |                 }); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         Collection<Long> collect = yzd.stream().map(temp -> { | ||||||
|  |             return temp.getId(); | ||||||
|  |         }).collect(Collectors.toList()); | ||||||
|  |         return baseMapper.deleteByIds(collect) > 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public boolean invoking(List<DelYzd> yzd) { | ||||||
|  |         try { | ||||||
|  |             yzd.stream().forEach(temp ->{{ | ||||||
|  |                 HttpRequest | ||||||
|  |                     .post(YsPort.MOVEDEVICEPRESETURLBYPOST.getSite()). | ||||||
|  |                     form("accessToken",monitoringYsService.getYsTokenService()) | ||||||
|  |                     .form("deviceSerial", temp.getDeviceSerial()) | ||||||
|  |                     .form("channelNo", temp.getChannelNo()) | ||||||
|  |                     .form("index", temp.getPresetIndex()) | ||||||
|  |                     .execute().body(); | ||||||
|  |             }}); | ||||||
|  |         }catch (Exception e) { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,141 @@ | |||||||
|  | package org.dromara.monitoring.service.impl; | ||||||
|  |  | ||||||
|  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||||
|  | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||||
|  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import lombok.extern.slf4j.Slf4j; | ||||||
|  | import org.dromara.common.core.utils.MapstructUtils; | ||||||
|  | import org.dromara.common.core.utils.StringUtils; | ||||||
|  | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
|  | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
|  | import org.dromara.monitoring.domain.MonEquipmentList; | ||||||
|  | import org.dromara.monitoring.domain.bo.MonEquipmentListBo; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonEquipmentListVo; | ||||||
|  | import org.dromara.monitoring.mapper.MonEquipmentListMapper; | ||||||
|  | import org.dromara.monitoring.service.IMonEquipmentListService; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  |  | ||||||
|  | import java.util.Collection; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 设备列Service业务层处理 | ||||||
|  |  * | ||||||
|  |  * @author LionLi | ||||||
|  |  * @date 2025-09-25 | ||||||
|  |  */ | ||||||
|  | @Slf4j | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @Service | ||||||
|  | public class MonEquipmentListServiceImpl implements IMonEquipmentListService { | ||||||
|  |  | ||||||
|  |     private final MonEquipmentListMapper baseMapper; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询设备列 | ||||||
|  |      * | ||||||
|  |      * @param id 主键 | ||||||
|  |      * @return 设备列 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public MonEquipmentListVo queryById(Long id){ | ||||||
|  |         return baseMapper.selectVoById(id); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 分页查询设备列列表 | ||||||
|  |      * | ||||||
|  |      * @param bo        查询条件 | ||||||
|  |      * @param pageQuery 分页参数 | ||||||
|  |      * @return 设备列分页列表 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public TableDataInfo<MonEquipmentListVo> queryPageList(MonEquipmentListBo bo, PageQuery pageQuery) { | ||||||
|  |         LambdaQueryWrapper<MonEquipmentList> lqw = buildQueryWrapper(bo); | ||||||
|  |         Page<MonEquipmentListVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); | ||||||
|  |         return TableDataInfo.build(result); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询符合条件的设备列列表 | ||||||
|  |      * | ||||||
|  |      * @param bo 查询条件 | ||||||
|  |      * @return 设备列列表 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public List<MonEquipmentListVo> queryList(MonEquipmentListBo bo) { | ||||||
|  |         LambdaQueryWrapper<MonEquipmentList> lqw = buildQueryWrapper(bo); | ||||||
|  |         return baseMapper.selectVoList(lqw); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private LambdaQueryWrapper<MonEquipmentList> buildQueryWrapper(MonEquipmentListBo bo) { | ||||||
|  |         Map<String, Object> params = bo.getParams(); | ||||||
|  |         LambdaQueryWrapper<MonEquipmentList> lqw = Wrappers.lambdaQuery(); | ||||||
|  |         lqw.orderByAsc(MonEquipmentList::getId); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDeviceSerial()), MonEquipmentList::getDeviceSerial, bo.getDeviceSerial()); | ||||||
|  |         lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), MonEquipmentList::getDeviceName, bo.getDeviceName()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDeviceType()), MonEquipmentList::getDeviceType, bo.getDeviceType()); | ||||||
|  |         lqw.eq(bo.getStatus() != null, MonEquipmentList::getStatus, bo.getStatus()); | ||||||
|  |         lqw.eq(bo.getDefence() != null, MonEquipmentList::getDefence, bo.getDefence()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getDeviceVersion()), MonEquipmentList::getDeviceVersion, bo.getDeviceVersion()); | ||||||
|  |         lqw.eq(bo.getAddTime() != null, MonEquipmentList::getAddTime, bo.getAddTime()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getParentCategory()), MonEquipmentList::getParentCategory, bo.getParentCategory()); | ||||||
|  |         lqw.eq(bo.getRiskLevel() != null, MonEquipmentList::getRiskLevel, bo.getRiskLevel()); | ||||||
|  |         lqw.eq(StringUtils.isNotBlank(bo.getNetAddress()), MonEquipmentList::getNetAddress, bo.getNetAddress()); | ||||||
|  |         return lqw; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增设备列 | ||||||
|  |      * | ||||||
|  |      * @param bo 设备列 | ||||||
|  |      * @return 是否新增成功 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean insertByBo(MonEquipmentListBo bo) { | ||||||
|  |         MonEquipmentList add = MapstructUtils.convert(bo, MonEquipmentList.class); | ||||||
|  |         validEntityBeforeSave(add); | ||||||
|  |         boolean flag = baseMapper.insert(add) > 0; | ||||||
|  |         if (flag) { | ||||||
|  |             bo.setId(add.getId()); | ||||||
|  |         } | ||||||
|  |         return flag; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改设备列 | ||||||
|  |      * | ||||||
|  |      * @param bo 设备列 | ||||||
|  |      * @return 是否修改成功 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean updateByBo(MonEquipmentListBo bo) { | ||||||
|  |         MonEquipmentList update = MapstructUtils.convert(bo, MonEquipmentList.class); | ||||||
|  |         validEntityBeforeSave(update); | ||||||
|  |         return baseMapper.updateById(update) > 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 保存前的数据校验 | ||||||
|  |      */ | ||||||
|  |     private void validEntityBeforeSave(MonEquipmentList entity){ | ||||||
|  |         //TODO 做一些数据校验,如唯一约束 | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 校验并批量删除设备列信息 | ||||||
|  |      * | ||||||
|  |      * @param ids     待删除的主键集合 | ||||||
|  |      * @param isValid 是否进行有效性校验 | ||||||
|  |      * @return 是否删除成功 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { | ||||||
|  |         if(isValid){ | ||||||
|  |             //TODO 做一些业务上的校验,判断是否需要校验 | ||||||
|  |         } | ||||||
|  |         return baseMapper.deleteByIds(ids) > 0; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,267 @@ | |||||||
|  | package org.dromara.monitoring.service.impl; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import cn.hutool.http.HttpRequest; | ||||||
|  | import cn.hutool.json.JSONArray; | ||||||
|  | import cn.hutool.json.JSONObject; | ||||||
|  | import cn.hutool.json.JSONUtil; | ||||||
|  | import lombok.RequiredArgsConstructor; | ||||||
|  | import lombok.extern.slf4j.Slf4j; | ||||||
|  | import org.dromara.common.core.utils.StringUtils; | ||||||
|  | import org.dromara.common.satoken.utils.LoginHelper; | ||||||
|  | import org.dromara.monitoring.config.SnowFlakeUtil; | ||||||
|  | import org.dromara.monitoring.config.YsDto; | ||||||
|  | import org.dromara.monitoring.domain.MonEquipmentHistroy; | ||||||
|  | import org.dromara.monitoring.domain.MonEquipmentList; | ||||||
|  | import org.dromara.monitoring.domain.dto.DelYzd; | ||||||
|  | import org.dromara.monitoring.domain.dto.MonitoringListDto; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonList; | ||||||
|  | import org.dromara.monitoring.domain.vo.MonYsVo; | ||||||
|  | import org.dromara.monitoring.mapper.MonitoringYsMapper; | ||||||
|  | import org.dromara.monitoring.monEnum.ListConstant; | ||||||
|  | import org.dromara.monitoring.monEnum.QualityEnum; | ||||||
|  | import org.dromara.monitoring.monEnum.YsPort; | ||||||
|  | import org.dromara.monitoring.service.MonitoringYsService; | ||||||
|  | import org.springframework.cache.annotation.Cacheable; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  |  | ||||||
|  | import java.time.LocalDateTime; | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  | import java.util.stream.Collectors; | ||||||
|  |  | ||||||
|  | @Slf4j | ||||||
|  | @RequiredArgsConstructor | ||||||
|  | @Service | ||||||
|  | public class MonitoringYsServiceImpl implements MonitoringYsService { | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     private final YsDto ysDto; | ||||||
|  |  | ||||||
|  |     private final MonitoringYsMapper monitoringYsMapper; | ||||||
|  |  | ||||||
|  |     private final String GETDEVICELISTURL = "https://open.ys7.com/api/lapp/device/list"; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     @Cacheable(cacheNames = "opsMonToken#432000s") | ||||||
|  |     public String getYsTokenService() { | ||||||
|  |  | ||||||
|  |         String jsonStr = HttpRequest.post(YsPort.GETTOKENURLBYPOST.getSite()). | ||||||
|  |             form("appKey", ysDto.getAppKey()) | ||||||
|  |             .form("appSecret", ysDto.getAppSecret()) | ||||||
|  |             .execute().body(); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         JSONObject jsonObject = JSONUtil.parseObj(jsonStr.trim()); | ||||||
|  |         String accessToken = jsonObject.getJSONObject("data").getStr("accessToken"); | ||||||
|  |         return accessToken; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public MonList getMonitoringList(MonitoringListDto dto) { | ||||||
|  |  | ||||||
|  |         MonList monList = new MonList(); | ||||||
|  |  | ||||||
|  |         if (StringUtils.isEmpty(dto.getPageSize().toString())){ | ||||||
|  |             dto.setPageSize(ListConstant.pageSize.getConstant()); | ||||||
|  |             dto.setPageStart(ListConstant.PAGESTART.getConstant()); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  | //        分页查询 | ||||||
|  |         String jsonStr = HttpRequest | ||||||
|  |             .post(YsPort.GETDEVICELISTURL.getSite()). | ||||||
|  |             form("accessToken",getYsTokenService()) | ||||||
|  |             .form("pageStart",dto.getPageStart() - 1) | ||||||
|  |             .form("pageSize",dto.getPageSize()) | ||||||
|  |             .execute().body(); | ||||||
|  |  | ||||||
|  |         JSONObject jsonObject = JSONUtil.parseObj(jsonStr.trim()); | ||||||
|  |         List<MonEquipmentList> data = (List<MonEquipmentList>)jsonObject.get("data"); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         Map page1 = JSONUtil.parseObj(jsonObject.get("page")).toBean(Map.class); | ||||||
|  |         monList.setSum(Integer.parseInt(page1.get("total").toString())); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         if(dto.getPageSize() != ListConstant.pageSize.getConstant()&& dto.getIsflow()) { | ||||||
|  |  | ||||||
|  |             List<MonEquipmentHistroy> monEquipmentHistroys = new ArrayList<MonEquipmentHistroy>(); | ||||||
|  |             data = JSONUtil.toList(data.toString(), MonEquipmentList.class); | ||||||
|  |  | ||||||
|  |             data.stream().forEach(item -> { | ||||||
|  |                 MonEquipmentHistroy monEquipmentHistroy = new MonEquipmentHistroy(); | ||||||
|  |                 monEquipmentHistroy.setId(SnowFlakeUtil.getID()); | ||||||
|  |                 monEquipmentHistroy.setDeviceSerial(item.getDeviceSerial()); | ||||||
|  |                 monEquipmentHistroy.setDeviceName(item.getDeviceName()); | ||||||
|  |                 monEquipmentHistroy.setDeviceType(item.getDeviceType()); | ||||||
|  |                 monEquipmentHistroy.setUserId(LoginHelper.getUserId()); | ||||||
|  |                 monEquipmentHistroy.setDeptId(LoginHelper.getDeptId()); | ||||||
|  |                 monEquipmentHistroy.setProjectId(dto.getProjectId()); | ||||||
|  |                 monEquipmentHistroy.setCreateTime(LocalDateTime.now()); | ||||||
|  |                 monEquipmentHistroys.add(monEquipmentHistroy); | ||||||
|  |             }); | ||||||
|  |  | ||||||
|  | //        将返回的数据列为点击数据 | ||||||
|  |             if (monEquipmentHistroys.size() > 0) { | ||||||
|  |                 monitoringYsMapper.insertHistroy(monEquipmentHistroys); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |               monList.setObject(data); | ||||||
|  |  | ||||||
|  | //        查询所有并将数据存入数据库 :先判断数据库里是否有数据 | ||||||
|  |       Integer sum =   monitoringYsMapper.setSunList(); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         if(sum != Integer.parseInt(page1.get("total").toString())){ | ||||||
|  |             monitoringYsMapper.delList(); | ||||||
|  |             insertMonitoring(Integer.parseInt(page1.get("total").toString()),1); | ||||||
|  |         } | ||||||
|  |         return monList; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public MonYsVo getMonitoringDp() { | ||||||
|  |        List<MonEquipmentList> list = monitoringYsMapper.selDpList(); | ||||||
|  |         MonYsVo monYsVo = new MonYsVo(); | ||||||
|  |         if (list.size() > 0){ | ||||||
|  |             monYsVo.setSumMon(list.size()); | ||||||
|  |             long count = list.stream().filter(item -> item.getStatus() == 1).count(); | ||||||
|  |             monYsVo.setSumOnLine(count); | ||||||
|  |             monYsVo.setSumOffLine(list.size() - count); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return monYsVo; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public String capturePho(DelYzd dto) { | ||||||
|  |         String temp = HttpRequest | ||||||
|  |             .post(YsPort.CAPTUREDEVICEURLBYPOST.getSite()). | ||||||
|  |             form("accessToken",getYsTokenService()) | ||||||
|  |             .form("deviceSerial",dto.getDeviceSerial()) | ||||||
|  |             .form("channelNo",dto.getChannelNo()) | ||||||
|  |             .form("quality", QualityEnum.HIGHDEFINITION.getValue()) | ||||||
|  |             .execute().body(); | ||||||
|  |         JSONObject jsonObject = JSONUtil.parseObj(temp.trim()); | ||||||
|  |         Map bean = JSONUtil.parseObj(jsonObject.get("data")).toBean(Map.class); | ||||||
|  |         /**Todo 后期照片需要对接ai识别 */ | ||||||
|  |         return bean.get("picUrl").toString(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public Void test() { | ||||||
|  | //        查询所有的设备 | ||||||
|  |         List<MonEquipmentList> monEquipmentList = monitoringYsMapper.selDpList(); | ||||||
|  |  | ||||||
|  |         monEquipmentList.forEach(item -> { | ||||||
|  |             serialNumber(item); | ||||||
|  |         }); | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     //格式化存储 | ||||||
|  |     public void serialNumber(MonEquipmentList equipmentList){ | ||||||
|  |  | ||||||
|  |         ArrayList<String> temp = selSTORAGEMEDIUMSTATUS(equipmentList.getDeviceSerial()); | ||||||
|  |         if (temp.size() == 0)return; | ||||||
|  |  | ||||||
|  |         temp.forEach(s -> { | ||||||
|  |             HttpRequest | ||||||
|  |                 .put(YsPort.DEVICESTORAGEMEDIUM.getSite()) | ||||||
|  |                 .header("accessToken",getYsTokenService()) | ||||||
|  |                 .form("deviceSerial",equipmentList.getDeviceSerial()) | ||||||
|  |                 .form("diskIndex",s) | ||||||
|  |                 .execute().body(); | ||||||
|  |         }); | ||||||
|  |  | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询存储状态 | ||||||
|  |      * @param deviceSerial | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     public ArrayList<String> selSTORAGEMEDIUMSTATUS(String deviceSerial){ | ||||||
|  |  | ||||||
|  |         ArrayList<String> res = new ArrayList<>(); | ||||||
|  |         String body = HttpRequest | ||||||
|  |             .get(YsPort.STORAGEMEDIUMSTATUS.getSite()) | ||||||
|  |             .header("accessToken", getYsTokenService()) | ||||||
|  |             .form("deviceSerial", deviceSerial) | ||||||
|  |             .execute().body(); | ||||||
|  |  | ||||||
|  |         JSONObject jsonObject = JSONUtil.parseObj(body.trim()); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         Map bean = JSONUtil.parseObj(jsonObject.get("data")).toBean(Map.class); | ||||||
|  |  | ||||||
|  |         if (bean.get("storageStatus") == null){return res;} | ||||||
|  |  | ||||||
|  |         JSONArray objects = JSONUtil.parseArray( bean.get("storageStatus").toString()); | ||||||
|  |  | ||||||
|  |         if (objects != null && objects.size() > 0){ | ||||||
|  |             objects.stream().forEach(temp ->{ | ||||||
|  |                 Map temoMap = JSONUtil.parseObj(temp.toString()).toBean(Map.class); | ||||||
|  |                 res.add(temoMap.get("index").toString()); | ||||||
|  |             }); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return res; | ||||||
|  |  | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     public void insertMonitoring(Integer sum,Integer start){ | ||||||
|  |         if (sum > 50){ | ||||||
|  |             String temp = HttpRequest | ||||||
|  |                 .post(YsPort.GETDEVICELISTURL.getSite()). | ||||||
|  |                 form("accessToken",getYsTokenService()) | ||||||
|  |                 .form("pageStart",start - 1) | ||||||
|  |                 .form("pageSize",50) | ||||||
|  |                 .execute().body(); | ||||||
|  |  | ||||||
|  |             JSONObject jsonTemp = JSONUtil.parseObj(temp.trim()); | ||||||
|  |             List<MonEquipmentList> tempList = (List<MonEquipmentList>)jsonTemp.get("data"); | ||||||
|  |             tempList = JSONUtil.toList(tempList.toString(), MonEquipmentList.class); | ||||||
|  |             List<MonEquipmentList> collect = tempList.stream().map(monEquipmentList -> { | ||||||
|  |  | ||||||
|  |                 monEquipmentList.setId(SnowFlakeUtil.getID()); | ||||||
|  |                 return monEquipmentList; | ||||||
|  |             }).collect(Collectors.toList()); | ||||||
|  |  | ||||||
|  |             monitoringYsMapper.insettList(collect); | ||||||
|  |             start++; | ||||||
|  |             sum = sum - 50; | ||||||
|  |             insertMonitoring(sum,start); | ||||||
|  |         }else { | ||||||
|  |             String temp = HttpRequest | ||||||
|  |                 .post(YsPort.GETDEVICELISTURL.getSite()). | ||||||
|  |                 form("accessToken",getYsTokenService()) | ||||||
|  |                 .form("pageStart",start - 1) | ||||||
|  |                 .form("pageSize",sum) | ||||||
|  |                 .execute().body(); | ||||||
|  |  | ||||||
|  |             JSONObject jsonTemp = JSONUtil.parseObj(temp.trim()); | ||||||
|  |             List<MonEquipmentList> tempList = (List<MonEquipmentList>)jsonTemp.get("data"); | ||||||
|  |             tempList = JSONUtil.toList(tempList.toString(), MonEquipmentList.class); | ||||||
|  |             List<MonEquipmentList> collect = tempList.stream().map(monEquipmentList -> { | ||||||
|  |  | ||||||
|  |                 monEquipmentList.setId(SnowFlakeUtil.getID()); | ||||||
|  |                 return monEquipmentList; | ||||||
|  |             }).collect(Collectors.toList()); | ||||||
|  |  | ||||||
|  |             monitoringYsMapper.insettList(collect); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
| @ -0,0 +1,33 @@ | |||||||
|  | <?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="org.dromara.monitoring.mapper.MonitoringYsMapper"> | ||||||
|  |     <insert id="insettList"> | ||||||
|  | insert into mon_equipment_list (id, device_serial, device_name, device_type, status,defence,device_version,add_time,update_time,parent_category,risk_level,net_address) | ||||||
|  | values | ||||||
|  |         <foreach collection="list" item="item" separator=","> | ||||||
|  |             (#{item.id},  #{item.deviceSerial}, #{item.deviceName}, #{item.deviceType}, #{item.status}, #{item.defence}, #{item.deviceVersion}, #{item.addTime}, #{item.updateTime}, #{item.parentCategory}, #{item.riskLevel}, #{item.netAddress}) | ||||||
|  | </foreach> | ||||||
|  |  | ||||||
|  |     </insert> | ||||||
|  |     <insert id="insertHistroy"> | ||||||
|  |     insert into mon_equipment_histroy (id, device_serial, device_name, device_type, user_id,dept_id,project_id,create_time) | ||||||
|  |     values | ||||||
|  |         <foreach collection="data" item="item" separator=","> | ||||||
|  |         (#{item.id}, #{item.deviceSerial}, #{item.deviceName}, #{item.deviceType}, #{item.userId}, #{item.deptId}, #{item.projectId}, #{item.createTime}) | ||||||
|  |         </foreach> | ||||||
|  |     </insert> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     <select id="setSunList"> | ||||||
|  |             select count(1) from mon_equipment_list | ||||||
|  |     </select> | ||||||
|  |     <select id="selDpList" resultType="org.dromara.monitoring.domain.MonEquipmentList"> | ||||||
|  |  | ||||||
|  |         select * from mon_equipment_list | ||||||
|  |     </select> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | </mapper> | ||||||
		Reference in New Issue
	
	Block a user
	