iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/dev/dahua/DHSavePath.java
@@ -17,9 +17,9 @@ private static DHSavePath instance = new DHSavePath(); public final static String capturePath = "Z:/irs/Capture/"; public final static String capturePath = "D:/irs/Capture/"; public final static String modelPath = "Z:/irs/Model/"; public final static String modelPath = "D:/irs/Model/"; public final static String capturePathUbuntu = "/home/dell/DLUT/irs/Capture/"; iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/dev/service/impl/DevCameraServiceImpl.java
@@ -8,6 +8,7 @@ import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.framework.web.core.util.WebFrameworkUtils; import com.iailab.module.data.dev.controller.admin.camera.vo.DevCameraPageReqVO; import com.iailab.module.data.dev.dao.DevCameraDao; import com.iailab.module.data.dev.dto.DevCameraDTO; @@ -87,6 +88,7 @@ public void save(DevCameraDTO dto) { DevCameraEntity entity = ConvertUtils.sourceToTarget(dto, DevCameraEntity.class); entity.setCreateDate(new Date()); entity.setCreator(WebFrameworkUtils.getLoginUserId()); insert(entity); } @@ -94,6 +96,7 @@ public void update(DevCameraDTO dto) { DevCameraEntity entity = ConvertUtils.sourceToTarget(dto, DevCameraEntity.class); entity.setUpdateDate(new Date()); entity.setUpdater(WebFrameworkUtils.getLoginUserId()); updateById(entity); } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/dev/service/impl/DevNvrServiceImpl.java
@@ -8,6 +8,7 @@ import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.framework.web.core.util.WebFrameworkUtils; import com.iailab.module.data.dev.controller.admin.nvr.vo.DevNvrPageReqVO; import com.iailab.module.data.dev.controller.admin.nvr.vo.DevNvrSaveReqVO; import com.iailab.module.data.dev.dahua.DHCapturePictureClient; @@ -102,6 +103,7 @@ public String save(DevNvrSaveReqVO saveReqVO) { DevNvrEntity entity = BeanUtils.toBean(saveReqVO, DevNvrEntity.class); entity.setCreateDate(new Date()); entity.setUpdater(WebFrameworkUtils.getLoginUserId()); insert(entity); return entity.getId(); } @@ -109,7 +111,8 @@ @Override public String update(DevNvrSaveReqVO saveReqVO) { DevNvrEntity entity = BeanUtils.toBean(saveReqVO, DevNvrEntity.class); entity.setCreateDate(new Date()); entity.setUpdateDate(new Date()); entity.setUpdater(WebFrameworkUtils.getLoginUserId()); updateById(entity); return entity.getId(); } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/task/DevCameraDahuaTask.java
对比新文件 @@ -0,0 +1,79 @@ package com.iailab.module.data.job.task; import com.iailab.module.data.dev.controller.admin.camera.vo.DevCameraPageReqVO; import com.iailab.module.data.dev.dahua.DHCapturePictureClient; import com.iailab.module.data.dev.dahua.DHClientFactory; import com.iailab.module.data.dev.dto.DevCameraDTO; import com.iailab.module.data.dev.enums.CaptureTypeEnum; import com.iailab.module.data.dev.service.DevCameraService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.time.LocalDateTime; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * 大华摄像头截图定时任务 * * @author Houzhongjian * @Description * @createTime 2024年10月30日 */ @Component("devCameraDahuaTask") public class DevCameraDahuaTask implements ITask { private Logger logger = LoggerFactory.getLogger(getClass()); @Resource private DevCameraService devCameraService; @Resource private DHClientFactory dhClientFactory; @Override public void run(String params) { logger.info("devCameraDahuaTask定时任务正在执行,参数为:{}", params); try { DevCameraPageReqVO cameraPageReqVO = new DevCameraPageReqVO(); List<DevCameraDTO> list = devCameraService.list(cameraPageReqVO); if (CollectionUtils.isEmpty(list)) { logger.info("Alarm List 为空"); return; } Map<String, List<DevCameraDTO>> alarmGroup = list.stream().collect(Collectors.groupingBy(DevCameraDTO::getNvrId)); for (Map.Entry<String, List<DevCameraDTO>> nvr : alarmGroup.entrySet()) { DHCapturePictureClient client = dhClientFactory.getClient(nvr.getKey()); try { if(!client.isLogin()) { dhClientFactory.reLogin(client, nvr.getKey()); } if(!client.isLogin()) { continue; } List<DevCameraDTO> cameraList = nvr.getValue(); for (int i = 0; i < cameraList.size(); i++) { DevCameraDTO camera = cameraList.get(i); boolean captureResult = false; if (CaptureTypeEnum.LOCAL.getCode().equals(camera.getCaptureType())) { captureResult = client.localCapturePicture(camera.getChannel(), camera.getCode()); } else { captureResult = client.remoteCapturePicture(camera.getChannel(), camera.getCode()); } logger.info(camera.getCode() + ":captureResult = " + captureResult); Thread.sleep(100); } } catch (Exception ex) { logger.info("item:" + ex.getMessage()); } } logger.info("devCameraDahuaTask定时任务执行完成:" + LocalDateTime.now()); } catch (Exception ex) { ex.printStackTrace(); logger.info("devCameraDahuaTask定时任务失败时间:" + LocalDateTime.now()); } } } iailab-module-system/iailab-module-system-biz/src/main/resources/application-dev.yaml
@@ -76,7 +76,7 @@ xxl: job: admin: addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址 addresses: http://172.16.8.100:9090/xxl-job-admin # 调度中心部署跟地址 --- #################### 服务保障相关配置 #################### @@ -132,15 +132,17 @@ # 平台配置项,设置当前项目所有自定义的配置 iailab: env: # 多环境的配置项 tag: ${HOSTNAME} security: mock-enable: true access-log: # 访问日志的配置项 enable: false xss: enable: false exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 pay: pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify pay-return-url: http://niubi.natapp1.cc/api/pay/order/return refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify demo: false # 开启演示模式 captcha: enable: false # 本地环境,暂时关闭图片验证码,方便登录等接口的测试