| | |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.framework.excel.core.util.ExcelUtils; |
| | | import com.iailab.framework.tenant.core.context.TenantContextHolder; |
| | | import com.iailab.module.data.api.dto.DeviceValueDTO; |
| | | import com.iailab.module.data.api.dto.IndexQueryDTO; |
| | | import com.iailab.module.data.api.dto.echarts.BarLineDTO; |
| | | import com.iailab.module.data.api.dto.echarts.SeriesItem; |
| | |
| | | import com.iailab.module.data.api.point.dto.ApiPointsValueQueryDTO; |
| | | import com.iailab.module.data.common.ApiDataQueryDTO; |
| | | import com.iailab.module.data.common.ApiDataValueDTO; |
| | | import com.iailab.module.data.common.utils.ApiSecurityUtils; |
| | | import com.iailab.module.data.ind.collection.IndItemCollector; |
| | | import com.iailab.module.data.ind.item.vo.IndItemValueVO; |
| | | import com.iailab.module.data.plan.item.entity.PlanItemEntity; |
| | | import com.iailab.module.data.plan.item.service.PlanItemService; |
| | | import com.iailab.module.data.plan.item.vo.PlanItemValueExportVO; |
| | | import com.iailab.module.data.point.common.PointDataTypeEnum; |
| | | import com.iailab.module.data.point.dto.DaPointDTO; |
| | | import com.iailab.module.data.point.service.DaPointService; |
| | | import com.iailab.module.data.api.dto.DeviceValueDTO; |
| | | import com.iailab.module.data.common.utils.ApiSecurityUtils; |
| | | import com.iailab.module.data.plan.item.service.PlanItemService; |
| | | import com.iailab.module.data.point.vo.DaPointExcelVO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | List<PlanItemValueExportVO> exportList = list.stream().map(item -> { |
| | | PlanItemValueExportVO exportVO = new PlanItemValueExportVO(); |
| | | exportVO.setDataTime(DateUtils.format(item.getDataTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); |
| | | exportVO.setDataValue(new BigDecimal(item.getDataValue()).setScale(0, BigDecimal.ROUND_HALF_UP).toString()); |
| | | exportVO.setDataValue(BigDecimal.valueOf(item.getDataValue()).setScale(0, RoundingMode.HALF_UP).toString()); |
| | | return exportVO; |
| | | }).collect(Collectors.toList()); |
| | | ExcelUtils.write(response, "计划数据.xls", "计划数据", PlanItemValueExportVO.class, exportList); |
| | |
| | | |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.data.api.plan.dto.ApiPlanDataDTO; |
| | | import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO; |
| | | import com.iailab.module.data.common.ApiDataQueryDTO; |
| | | import com.iailab.module.data.common.ApiDataValueDTO; |
| | | import com.iailab.module.data.plan.item.collection.PlanItemCollector; |
| | | import com.iailab.module.data.plan.item.entity.PlanItemEntity; |
| | | import com.iailab.module.data.plan.item.service.PlanItemService; |
| | | import com.iailab.module.data.plan.item.vo.PlanItemDataVO; |
| | | import com.iailab.module.data.plan.item.vo.PlanItemValueVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.LinkedHashMap; |
| | |
| | | @Autowired |
| | | private PlanItemCollector planItemCollector; |
| | | |
| | | @Autowired |
| | | private PlanItemService planItemService; |
| | | |
| | | @Override |
| | | public List<ApiDataValueDTO> queryPlanItemHistoryValue(ApiDataQueryDTO dto) { |
| | | List<PlanItemValueVO> list = planItemCollector.queryValue(dto.getItemNo(), dto.getStart(), dto.getEnd()); |
| | | return ConvertUtils.sourceToTarget(list, ApiDataValueDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public LinkedHashMap<String, List<ApiPlanDataDTO>> queryPlanItemRecordValue(ApiDataQueryDTO dto) { |
| | | LinkedHashMap<String, List<ApiPlanDataDTO>> result = new LinkedHashMap<>(); |
| | | if (CollectionUtils.isEmpty(dto.getItemNos())) { |
| | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public ApiPlanItemDTO getInfoByNo(String itemNo){ |
| | | PlanItemEntity entity = planItemService.getInfoByNo(itemNo); |
| | | return ConvertUtils.sourceToTarget(entity, ApiPlanItemDTO.class); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioDeviceEntity; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioDeviceService; |
| | | import com.iailab.module.data.channel.opcua.collector.OpcUaUtils; |
| | | import com.iailab.module.data.common.enums.CommonConstant; |
| | | import com.iailab.module.data.common.enums.DataSourceType; |
| | | import com.iailab.module.data.common.utils.TagUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.eclipse.milo.opcua.sdk.client.OpcUaClient; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | return kingIOClient; |
| | | } |
| | | |
| | | public String getTagValue(String sourceId, String tagName) throws Exception { |
| | | public String getTagValue(String sourceId, String tagName) { |
| | | String value = CommonConstant.BAD_VALUE.toString(); |
| | | try{ |
| | | KingIOClient client = this.getClient(sourceId); |
| | | String value = client.getTagValue(tagName); |
| | | value = client.getTagValue(tagName); |
| | | }catch (Exception ex){ |
| | | ex.printStackTrace(); |
| | | return value; |
| | | } |
| | | return value; |
| | | } |
| | | |
| | |
| | | return opcUaClient; |
| | | } |
| | | |
| | | public String getTagValue(String sourceId, String tagNo) throws Exception { |
| | | public String getTagValue(String sourceId, String tagNo) { |
| | | String value = CommonConstant.BAD_VALUE.toString(); |
| | | try{ |
| | | OpcUaClient opcUaClient = this.getClient(sourceId); |
| | | String value = OpcUaUtils.readNode(opcUaClient, tagNo); |
| | | value = OpcUaUtils.readNode(opcUaClient, tagNo); |
| | | }catch (Exception ex){ |
| | | ex.printStackTrace(); |
| | | return value; |
| | | } |
| | | return value; |
| | | } |
| | | |
| | |
| | | package com.iailab.module.data.common.utils; |
| | | |
| | | import com.iailab.framework.security.core.util.SecurityFrameworkUtils; |
| | | import com.iailab.framework.tenant.core.context.TenantContextHolder; |
| | | import org.apache.http.HttpEntity; |
| | | import org.apache.http.HttpResponse; |
| | |
| | | * @return |
| | | */ |
| | | public static String doPost(String url, String json, String charset, String token) { |
| | | Long tenantId = TenantContextHolder.getTenantId(); |
| | | org.apache.http.client.HttpClient httpClient = null; |
| | | HttpPost httpPost = null; |
| | | String result = null; |
| | |
| | | httpPost.addHeader("Accept", "application/json"); |
| | | httpPost.addHeader("Content-Type", "application/json;charset=UTF-8"); |
| | | httpPost.addHeader("token", token); |
| | | //传递租户id |
| | | httpPost.addHeader("Tenant-Id", String.valueOf(TenantContextHolder.getTenantId())); |
| | | httpPost.addHeader("Tenant-Id", String.valueOf(tenantId)); |
| | | StringEntity stringEntity = new StringEntity(json); |
| | | stringEntity.setContentEncoding("UTF-8"); |
| | | stringEntity.setContentType("application/json"); |
| | |
| | | import com.iailab.module.data.video.service.CameraService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | @Resource |
| | | private CameraService cameraService; |
| | | |
| | | @Resource |
| | | @Autowired |
| | | private DHClientFactory dhClientFactory; |
| | | |
| | | @Override |
| | | public void run(String params) { |
| | | logger.info("devCameraDahuaTask定时任务正在执行,参数为:{}", params); |
| | | //传递租户id |
| | | System.out.println(TenantContextHolder.getTenantId()); |
| | | String tenantId = String.valueOf(TenantContextHolder.getTenantId()); |
| | | try { |
| | | CameraPageReqVO cameraPageReqVO = new CameraPageReqVO(); |
| | | cameraPageReqVO.setType("2"); |
对比新文件 |
| | |
| | | package com.iailab.module.data.job.task; |
| | | |
| | | import com.iailab.module.data.video.controller.admin.camera.vo.CameraPageReqVO; |
| | | import com.iailab.module.data.video.config.VideoConfiguration; |
| | | import com.iailab.module.data.video.dto.CameraDTO; |
| | | import com.iailab.module.data.video.hikvision.utils.HIKDevice; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Component("devCameraHikvisionTask") |
| | | public class DevCameraHikvisionTask implements ITask { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | @Autowired |
| | | private static HIKDevice hikDevice; |
| | | |
| | | @Autowired |
| | | public void setHIKDevice(HIKDevice tHIKDevice) { |
| | | DevCameraHikvisionTask.hikDevice = tHIKDevice; |
| | | } |
| | | |
| | | @Override |
| | | public void run(String params) { |
| | | logger.info("devCameraDahuaTask定时任务正在执行,参数为:{}", params); |
| | | CameraPageReqVO cameraPageReqVO = new CameraPageReqVO(); |
| | | cameraPageReqVO.setType("1"); |
| | | List<CameraDTO> list = VideoConfiguration.staticCameraService.list(cameraPageReqVO); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | logger.info("Alarm List 为空"); |
| | | return; |
| | | } |
| | | list.stream().forEach(cameraDTO -> { |
| | | hikDevice.loginDevice(cameraDTO); |
| | | }); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.video.config; |
| | | |
| | | import com.iailab.module.data.video.service.CameraService; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 摄像头配置文件 |
| | | */ |
| | | @Configuration |
| | | public class VideoConfiguration { |
| | | |
| | | @Value("${video.capture-dir}") |
| | | public String captureDir; |
| | | |
| | | @Value("${video.dahua.path.capture-path}") |
| | | public String dhCapturePath; |
| | | |
| | | @Value("${video.dahua.path.model-path}") |
| | | public String dhModelPath; |
| | | |
| | | @Value("${video.hikvision.path.capture-path}") |
| | | public String hkCapturePath; |
| | | |
| | | @Value("${video.hikvision.path.model-path}") |
| | | public String hkModelPath; |
| | | |
| | | @Value("${video.hikvision.pic-size}") |
| | | public String picSize; |
| | | |
| | | @Value("${video.hikvision.pic-quality}") |
| | | public String picQuality; |
| | | |
| | | @Resource |
| | | public CameraService cameraService; |
| | | |
| | | public static String staticDhCapturePath; |
| | | |
| | | public static String staticDhModelPath; |
| | | |
| | | public static String staticHkCapturePath; |
| | | |
| | | public static String staticHkModelPath; |
| | | |
| | | public static String staticPicSize; |
| | | |
| | | public static String staticPicQuality; |
| | | |
| | | public static CameraService staticCameraService; |
| | | |
| | | @PostConstruct |
| | | public void initUrl() { |
| | | staticDhCapturePath = this.captureDir + this.dhCapturePath; |
| | | staticDhModelPath = this.captureDir + this.dhModelPath; |
| | | staticHkCapturePath = this.captureDir + this.hkCapturePath; |
| | | staticHkModelPath = this.captureDir + this.hkModelPath; |
| | | staticPicSize = this.picSize; |
| | | staticPicQuality = this.picQuality; |
| | | staticCameraService = this.cameraService; |
| | | } |
| | | } |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除") |
| | | @PreAuthorize("@ss.hasPermission('video:camera:delete')") |
| | | public CommonResult delete(@RequestBody String[] ids) { |
| | | cameraService.delete(ids); |
| | | public CommonResult delete(@RequestParam("id") String id) { |
| | | cameraService.delete(id); |
| | | return success(); |
| | | } |
| | | |
| | | @PostMapping("/DHCaptureCallback") |
| | | @Operation(summary = "大华摄像头截图成功后回调存储处理图片") |
| | | @PermitAll |
| | | public CommonResult DHCaptureCallback(@RequestBody Map<String, String> params) { |
| | | cameraService.dealCapture(params); |
| | | return success(); |
| | | } |
| | | // @PostMapping("/DHCaptureCallback") |
| | | // @Operation(summary = "大华摄像头截图成功后回调存储处理图片") |
| | | // @PermitAll |
| | | // public CommonResult DHCaptureCallback(@RequestBody Map<String, String> params) { |
| | | // cameraService.dealCapture(params); |
| | | // return success(); |
| | | // } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.video.controller.admin.camera; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.video.controller.admin.camera.vo.ImagePageReqVO; |
| | | import com.iailab.module.data.video.dto.ImageDTO; |
| | | import com.iailab.module.data.video.service.ImageService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author Houzhongjian |
| | | * @Description |
| | | * @createTime 2024年11月01日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/video/image") |
| | | @Tag(name = "截图管理") |
| | | public class ImageController { |
| | | |
| | | @Autowired |
| | | private ImageService imageService; |
| | | |
| | | @GetMapping("page") |
| | | @Operation(summary = "分页") |
| | | @PreAuthorize("@ss.hasPermission('video:image:query')") |
| | | public CommonResult<PageResult<ImageDTO>> page(@Valid ImagePageReqVO imagePageReqVO) { |
| | | return success(imageService.getPage(imagePageReqVO)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | @PreAuthorize("@ss.hasPermission('video:image:query')") |
| | | public CommonResult<List<ImageDTO>> list(@Valid ImagePageReqVO imagePageReqVO) { |
| | | List<ImageDTO> list = imageService.list(imagePageReqVO); |
| | | return success(list); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "信息") |
| | | @PreAuthorize("@ss.hasPermission('video:image:query')") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | public CommonResult<ImageDTO> get(@RequestParam("id") String id) { |
| | | ImageDTO data = imageService.get(id); |
| | | return success(data); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除") |
| | | @PreAuthorize("@ss.hasPermission('video:image:delete')") |
| | | public CommonResult delete(@RequestParam("id") String id) { |
| | | imageService.delete(id); |
| | | return success(); |
| | | } |
| | | |
| | | } |
| | |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author Houzhongjian |
| | | * @Description |
| | | * @createTime 2024年08月17日 |
| | | */ |
对比新文件 |
| | |
| | | package com.iailab.module.data.video.controller.admin.camera.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author Houzhongjian |
| | | * @Description |
| | | * @createTime 2024年08月17日 |
| | | */ |
| | | @Schema(description = "截图图片 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class ImagePageReqVO extends PageParam { |
| | | |
| | | private String cameraId; |
| | | |
| | | private String brand; |
| | | |
| | | private String code; |
| | | |
| | | private String device; |
| | | |
| | | } |
| | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除") |
| | | @PreAuthorize("@ss.hasPermission('video:nvr:delete')") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") Long id) { |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | devCameraService.delete(id); |
| | | return success(true); |
| | | } |
| | |
| | | package com.iailab.module.data.video.dahua; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.iailab.module.data.common.utils.HttpRequest; |
| | | import com.iailab.module.data.video.config.VideoConfiguration; |
| | | import com.iailab.module.data.video.dahua.frame.DHCapturePictureFrame; |
| | | import com.iailab.netsdk.common.Res; |
| | | import com.iailab.netsdk.demo.module.LoginModule; |
| | |
| | | import com.sun.jna.ptr.IntByReference; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | |
| | | import java.awt.*; |
| | | import java.io.File; |
| | |
| | | */ |
| | | public class DHCapturePictureClient { |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | // private String url = "http://localhost:48080/admin-api/data/video/camera/DHCaptureCallback"; |
| | | // @Value("${video.dahua.callback.url}") |
| | | // public String url; |
| | | |
| | | // 登陆句柄 |
| | | public static NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE; |
| | |
| | | return false; |
| | | } else { |
| | | System.out.println("CLIENT_CapturePicture success"); |
| | | // 回调处理图片 |
| | | // 处理图片 |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("strFileName", strFileName); |
| | | params.put("cmdSerial", cmdSerial); |
| | | HttpRequest.doPost(DHConfiguration.staticUrl, JSON.toJSONString(params), "utf-8", ""); |
| | | params.put("brand", "DH"); |
| | | VideoConfiguration.staticCameraService.dealCapture(params); |
| | | } |
| | | return true; |
| | | } catch (Exception ex) { |
| | |
| | | package com.iailab.module.data.video.dahua; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.iailab.module.data.common.utils.HttpRequest; |
| | | import com.iailab.module.data.video.config.VideoConfiguration; |
| | | import com.iailab.module.data.video.service.CameraService; |
| | | import com.iailab.netsdk.lib.NetSDKLib; |
| | | import com.sun.jna.Pointer; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.ByteArrayInputStream; |
| | |
| | | */ |
| | | public class DHCaptureReceiveCB implements NetSDKLib.fSnapRev { |
| | | |
| | | @Resource |
| | | private CameraService cameraService; |
| | | |
| | | @Override |
| | | public void invoke(NetSDKLib.LLong lLoginID, Pointer pBuf, int revLen, int encodeType, int cmdSerial, Pointer dwUser) { |
| | | System.out.println("DHCaptureReceiveCB:"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // calendar.set(Calendar.MONTH, 0); |
| | | // calendar.set(Calendar.SECOND, 0); |
| | | if (pBuf != null && revLen > 0) { |
| | | String strFileName = DHSavePath.getSavePath().getSaveCapturePath(String.valueOf(cmdSerial), calendar.getTime()); |
| | | System.out.println("cmdSerial=" + cmdSerial); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // 回调处理图片 |
| | | // 处理图片 |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("strFileName", strFileName); |
| | | params.put("cmdSerial", Integer.valueOf(cmdSerial).toString()); |
| | | HttpRequest.doPost(DHConfiguration.staticUrl, JSON.toJSONString(params), "utf-8", ""); |
| | | |
| | | params.put("brand", "DH"); |
| | | cameraService.dealCapture(params); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.video.dahua; |
| | | |
| | | import com.iailab.framework.tenant.core.context.TenantContextHolder; |
| | | import com.iailab.module.data.video.dto.LogDTO; |
| | | import com.iailab.module.data.video.dto.NvrDTO; |
| | | import com.iailab.module.data.video.enums.CameraStatusEnum; |
| | |
| | | package com.iailab.module.data.video.dahua; |
| | | |
| | | import com.iailab.module.data.video.config.VideoConfiguration; |
| | | import com.iailab.netsdk.lib.ToolKits; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | public String getSaveCapturePath(String channel, Date curDate) { |
| | | File path1 = new File(DHConfiguration.staticCapturePath); |
| | | File path1 = new File(VideoConfiguration.staticDhCapturePath); |
| | | if (!path1.exists()) { |
| | | path1.mkdir(); |
| | | } |
| | | |
| | | File path2 = new File(DHConfiguration.staticCapturePath + ToolKits.getDay() + "/" + channel + "/"); |
| | | File path2 = new File(VideoConfiguration.staticDhCapturePath + ToolKits.getDay() + "/" + channel + "/"); |
| | | if (!path2.exists()) { |
| | | path2.mkdirs(); |
| | | } |
| | |
| | | * @param curDate |
| | | * @return |
| | | */ |
| | | public String getSaveModelPath(String cameraCode, Date curDate) throws IOException { |
| | | // File path1 = new File(modelPath); |
| | | // if (!path1.exists()) { |
| | | // path1.mkdir(); |
| | | // public String getSaveModelPath(String cameraCode, Date curDate) throws IOException { |
| | | //// File path1 = new File(modelPath); |
| | | //// if (!path1.exists()) { |
| | | //// path1.mkdir(); |
| | | //// } |
| | | // |
| | | // File path2 = new File(DHConfiguration.staticModelPath + ToolKits.getDay() + "/" + cameraCode + "/"); |
| | | //// if (!path2.exists()) { |
| | | //// path2.mkdirs(); |
| | | //// } |
| | | // //return path2.getAbsolutePath() + "/"; |
| | | // return path2.getAbsolutePath(); |
| | | // } |
| | | |
| | | File path2 = new File(DHConfiguration.staticModelPath + ToolKits.getDay() + "/" + cameraCode + "/"); |
| | | // if (!path2.exists()) { |
| | | // path2.mkdirs(); |
| | | // } |
| | | //return path2.getAbsolutePath() + "/"; |
| | | return path2.getAbsolutePath(); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.video.dao; |
| | | |
| | | import com.iailab.framework.common.dao.BaseDao; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.framework.tenant.core.db.dynamic.TenantDS; |
| | | import com.iailab.module.data.video.controller.admin.camera.vo.ImagePageReqVO; |
| | | import com.iailab.module.data.video.entity.ImageEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface ImageDao extends BaseDao<ImageEntity> { |
| | | public interface ImageDao extends BaseMapperX<ImageEntity> { |
| | | |
| | | default PageResult<ImageEntity> selectPage(ImagePageReqVO pageReqVO) { |
| | | return selectPage(pageReqVO, new LambdaQueryWrapperX<ImageEntity>() |
| | | .likeIfPresent(ImageEntity::getCameraId, pageReqVO.getCameraId()) |
| | | .orderByDesc(ImageEntity::getId)); |
| | | } |
| | | |
| | | } |
| | |
| | | private String imageUrl; |
| | | |
| | | private Date createDate; |
| | | |
| | | private String brand; |
| | | |
| | | private String code; |
| | | |
| | | private String device; |
| | | |
| | | } |
| | |
| | | package com.iailab.module.data.video.hikvision.utils; |
| | | |
| | | import com.alibaba.fastjson.JSONException; |
| | | import com.iailab.module.data.video.config.VideoConfiguration; |
| | | import com.iailab.module.data.video.dto.CameraDTO; |
| | | import com.iailab.module.data.video.enums.CameraStatusEnum; |
| | | import com.sun.jna.Native; |
| | | import com.sun.jna.NativeLong; |
| | | import com.sun.jna.Platform; |
| | |
| | | |
| | | import javax.annotation.PreDestroy; |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Slf4j |
| | |
| | | |
| | | // 用户登录返回句柄 |
| | | public static int lUserID; |
| | | |
| | | //构造函数 |
| | | public HIKDevice(){ |
| | | if (hCNetSDK == null) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化资源配置 |
| | | */ |
| | |
| | | * userName-用户名 |
| | | * passWord-密码 |
| | | * */ |
| | | // public String loginDevice() throws JSONException { |
| | | // if (!getDeviceStatus()) { |
| | | // int init = initDevices(); |
| | | // if (init == 1) { |
| | | // return "初始化失败"; |
| | | // } |
| | | // ArrayList<String> list = mZnfxCodeService.getDriverInfo("driverinfo"); |
| | | // if (list != null && list.size() > 0) { |
| | | // String driverip = list.get(0); |
| | | // String driverport = list.get(1); |
| | | // String username = list.get(2); |
| | | // String password = list.get(3); |
| | | // String returnVal = Login_V40(driverip, Short.parseShort(driverport), username, password); |
| | | // System.out.println(returnVal); |
| | | // return returnVal; |
| | | // } else { |
| | | // return "获取设备信息失败!"; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // String result = captureJPEGPicture(); |
| | | // System.out.println(result); |
| | | // return result; |
| | | // } |
| | | // |
| | | // } |
| | | public String loginDevice(CameraDTO camera) throws JSONException { |
| | | if (!getDeviceStatus(camera.getId())) { |
| | | int init = initDevices(); |
| | | if (init == 1) { |
| | | return "初始化失败"; |
| | | } |
| | | String driverip = camera.getIp(); |
| | | String driverport = camera.getPort(); |
| | | String username = camera.getUsername(); |
| | | String password = camera.getPassword(); |
| | | String returnVal = Login_V40(driverip, Short.parseShort(driverport), username, password, camera); |
| | | System.out.println(returnVal); |
| | | return returnVal; |
| | | } else { |
| | | String result = captureJPEGPicture(camera); |
| | | System.out.println(result); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param m_sDeviceIP 设备ip地址 |
| | | * @param wPort 端口号,设备网络SDK登录默认端口8000 |
| | | * @param m_sUsername 用户名 |
| | | * @param m_sPassword 密码 |
| | | */ |
| | | public String Login_V40(String m_sDeviceIP,short wPort,String m_sUsername,String m_sPassword) { |
| | | public String Login_V40(String m_sDeviceIP, short wPort, String m_sUsername, String m_sPassword, CameraDTO camera) { |
| | | /* 注册 */ |
| | | // 设备登录信息 |
| | | HCNetSDK.NET_DVR_USER_LOGIN_INFO m_strLoginInfo = new HCNetSDK.NET_DVR_USER_LOGIN_INFO(); |
| | |
| | | |
| | | lUserID = hCNetSDK.NET_DVR_Login_V40(m_strLoginInfo, m_strDeviceInfo); |
| | | if (lUserID == -1) { |
| | | // updateZnfxPostalStatus(PostalStatus.ABNORMAL.value()); |
| | | // mZnfxPostalStatusService.changeStatus(MessageCode.POSTAL_STATUS_TYPE_CAMERA, PostalStatus.ABNORMAL.value()); |
| | | |
| | | VideoConfiguration.staticCameraService.setStatus(camera.getId(), CameraStatusEnum.OFFLINE.getCode()); |
| | | System.out.println("登录失败,错误码为" + hCNetSDK.NET_DVR_GetLastError()); |
| | | return "登录失败,错误码为" + hCNetSDK.NET_DVR_GetLastError(); |
| | | } else { |
| | | System.out.println("登录成功!"); |
| | | // read()后,结构体中才有对应的数据 |
| | | m_strDeviceInfo.read(); |
| | | // updateZnfxPostalStatus(PostalStatus.NORMAL.value()); |
| | | // mZnfxPostalStatusService.changeStatus(MessageCode.POSTAL_STATUS_TYPE_CAMERA, PostalStatus.NORMAL.value()); |
| | | |
| | | String result = captureJPEGPicture(); |
| | | |
| | | VideoConfiguration.staticCameraService.setStatus(camera.getId(), CameraStatusEnum.ONLIEN.getCode()); |
| | | String result = captureJPEGPicture(camera); |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | //注销设备 |
| | | public String logoutDevice() |
| | | { |
| | | public String logoutDevice() { |
| | | NativeLong nlUserID = new NativeLong(lUserID); |
| | | if (!hCNetSDK.NET_DVR_Logout(nlUserID)) |
| | | { |
| | | if (!hCNetSDK.NET_DVR_Logout(nlUserID)) { |
| | | System.out.println("注销失败,设备ID:"+ nlUserID.intValue() + "错误码:"+hCNetSDK.NET_DVR_GetLastError()); |
| | | return "{\"result\":\"loginDevice Fail\",\"userID\":"+nlUserID.intValue()+",\"errorCode\":"+hCNetSDK.NET_DVR_GetLastError()+"}"; |
| | | }else{ |
| | |
| | | return "{\"result\":\"logoutDevice Success\",\"userID\":"+nlUserID.intValue()+",\"errorCode\":0}"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设备抓图(无预览) |
| | | * 单帧设备抓取保存的图片为JPG,具体注意问题需要详细查看【设备网络sdk使用手册】 |
| | | * |
| | | * @return |
| | | */ |
| | | public String captureJPEGPicture() |
| | | { |
| | | // ArrayList<String> list = mZnfxCodeService.getDriverInfo("driverpic"); |
| | | List<String> list = new ArrayList<>(); |
| | | list.add("tlChannel"); |
| | | list.add("tlPicSize"); |
| | | list.add("tlPicQuality"); |
| | | if (list != null && list.size() > 0) { |
| | | int tlChannel = Integer.parseInt(list.get(0)); |
| | | int tlPicSize = Integer.parseInt(list.get(1)); |
| | | int tlPicQuality = Integer.parseInt(list.get(2)); |
| | | |
| | | public String captureJPEGPicture(CameraDTO camera) { |
| | | int tlChannel = camera.getChannel(); |
| | | String tlPicSize = VideoConfiguration.staticPicSize; |
| | | String tlPicQuality = VideoConfiguration.staticPicQuality; |
| | | NativeLong nlUserID = new NativeLong(lUserID); |
| | | NativeLong nChannel = new NativeLong(tlChannel); |
| | | HCNetSDK.NET_DVR_JPEGPARA lpJpegPara = new HCNetSDK.NET_DVR_JPEGPARA(); |
| | | lpJpegPara.wPicSize = (short)tlPicSize; |
| | | lpJpegPara.wPicQuality = (short)tlPicQuality; |
| | | lpJpegPara.wPicSize = Short.parseShort(tlPicSize); |
| | | lpJpegPara.wPicQuality = Short.parseShort(tlPicQuality); |
| | | // 参数必须写入到结构体,否则在保存图片的时候异常图片 |
| | | lpJpegPara.write(); |
| | | String tFiledirName = CommonUtils.getCurrDate();//yyyyMMdd |
| | | String tFilename = CommonUtils.getCurrDate();//yyyyMMdd |
| | | // 创建文件名称 |
| | | String tDatePath = MessageCode.DvrPicSavePath+"/"+tFiledirName; |
| | | String tDatePath = VideoConfiguration.staticHkCapturePath + tFilename; |
| | | // 判断文件夹是否创建 |
| | | File tFile = new File(tDatePath); |
| | | if (!tFile.exists()){ |
| | |
| | | // 全路径 |
| | | String tPath = tDatePath+"/"+tImageName; |
| | | // 开始抓图 |
| | | if (!hCNetSDK.NET_DVR_CaptureJPEGPicture(nlUserID, nChannel, lpJpegPara, tPath)) |
| | | { |
| | | if (!hCNetSDK.NET_DVR_CaptureJPEGPicture(nlUserID, nChannel, lpJpegPara, tPath)) { |
| | | return "失败编码:"+hCNetSDK.NET_DVR_GetLastError() ; |
| | | }else { |
| | | Long tImageId = CommonUtils.Getnum();//生成流水号 |
| | | // saveZnfxImageInfo(tFiledirName,tImageName,tPath,tImageId); |
| | | |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("strFileName", tPath); |
| | | params.put("cmdSerial", camera.getCode()); |
| | | params.put("brand", "HK"); |
| | | VideoConfiguration.staticCameraService.dealCapture(params); |
| | | return "success>>>>>>>>>>>" + tImageName; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return "login fail>>>>>>>>>>>"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 检查设备是否在线 |
| | | * |
| | | * @return |
| | | */ |
| | | private boolean getDeviceStatus() { |
| | | private boolean getDeviceStatus(String id) { |
| | | boolean isOnLine = hCNetSDK.NET_DVR_RemoteControl(lUserID, 20005, null, 0); |
| | | // if (!isOnLine) { |
| | | //// updateZnfxPostalStatus(PostalStatus.ABNORMAL.value()); //离线 |
| | | //// insertZnfxPostalStatusLog(PostalStatus.ABNORMAL.value()); |
| | | // mZnfxPostalStatusService.changeStatus(MessageCode.POSTAL_STATUS_TYPE_CAMERA, PostalStatus.ABNORMAL.value()); |
| | | // return false; |
| | | // } else { |
| | | // mZnfxPostalStatusService.changeStatus(MessageCode.POSTAL_STATUS_TYPE_CAMERA, PostalStatus.NORMAL.value()); |
| | | //// updateZnfxPostalStatus(PostalStatus.NORMAL.value());//在线 |
| | | // } |
| | | if (!isOnLine) { |
| | | VideoConfiguration.staticCameraService.setStatus(id, CameraStatusEnum.OFFLINE.getCode()); |
| | | return false; |
| | | } else { |
| | | VideoConfiguration.staticCameraService.setStatus(id, CameraStatusEnum.ONLIEN.getCode()); |
| | | } |
| | | return true; |
| | | } |
| | | // /** |
| | |
| | | |
| | | void update(CameraDTO dto); |
| | | |
| | | void delete(String[] ids); |
| | | void delete(String id); |
| | | |
| | | Long cheack(CameraDTO dto); |
| | | |
| | |
| | | CameraDTO getByCode(String code); |
| | | |
| | | void dealCapture(Map<String, String> params); |
| | | |
| | | void setStatus(String id, Integer status); |
| | | } |
| | |
| | | package com.iailab.module.data.video.service; |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.data.video.controller.admin.camera.vo.ImagePageReqVO; |
| | | import com.iailab.module.data.video.dto.ImageDTO; |
| | | import com.iailab.module.data.video.entity.DataEntity; |
| | | import com.iailab.module.data.video.entity.ImageEntity; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author Houzhongjian |
| | | * @Description |
| | | * @createTime 2024年02月27日 |
| | | */ |
| | | public interface ImageService extends BaseService<ImageEntity> { |
| | | |
| | | PageData<ImageDTO> page(Map<String, Object> params); |
| | | PageResult<ImageDTO> getPage(ImagePageReqVO imagePageReqVO); |
| | | |
| | | List<ImageDTO> list(@Valid ImagePageReqVO cameraPageReqVO); |
| | | |
| | | ImageDTO get(String id); |
| | | |
| | | List<DataEntity> getValueList(String cameraId, Date startTime, Date endTime); |
| | | |
| | | void save(ImageDTO dto); |
| | | |
| | | void update(ImageDTO dto); |
| | | |
| | | void delete(String[] ids); |
| | | |
| | | String getUrl(String cameraId, String imagePath); |
| | | void delete(String id); |
| | | |
| | | ImageDTO get(String cameraId, Date createDate); |
| | | |
| | |
| | | |
| | | String update(NvrSaveReqVO saveReqVO); |
| | | |
| | | void delete(Long id); |
| | | void delete(String id); |
| | | |
| | | // Long cheack(DevNvrDTO dto); |
| | | |
| | |
| | | import com.iailab.framework.web.core.util.WebFrameworkUtils; |
| | | import com.iailab.module.data.mq.consumer.ImageMessage; |
| | | import com.iailab.module.data.video.controller.admin.camera.vo.CameraPageReqVO; |
| | | import com.iailab.module.data.video.dahua.DHConfiguration; |
| | | import com.iailab.module.data.video.dahua.DHSavePath; |
| | | import com.iailab.module.data.video.config.VideoConfiguration; |
| | | import com.iailab.module.data.video.dao.CameraDao; |
| | | import com.iailab.module.data.video.dao.ImageDao; |
| | | import com.iailab.module.data.video.dto.CameraDTO; |
| | |
| | | import com.iailab.module.data.video.service.CameraService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | */ |
| | | @Service |
| | | public class CameraServiceImpl extends BaseServiceImpl<CameraDao, CameraEntity> implements CameraService { |
| | | |
| | | @Value("${video.capture-dir}") |
| | | public String captureDir; |
| | | |
| | | @Resource |
| | | private CameraDao cameraDao; |
| | |
| | | public void dealCapture(Map<String, String> params) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | Date captureDate = calendar.getTime(); |
| | | CameraDTO devCamera = getByCode(params.get("cmdSerial")); |
| | | String strFileName = params.get("strFileName"); |
| | | String brand = params.get("brand"); |
| | | String capturePath = ""; |
| | | String routingKey = ""; |
| | | switch (brand) { |
| | | case "DH": |
| | | capturePath = VideoConfiguration.staticDhCapturePath; |
| | | routingKey = ImageMessage.DAHUA_ROUTING_KEY; |
| | | break; |
| | | case "HK": |
| | | capturePath = VideoConfiguration.staticHkCapturePath; |
| | | routingKey = ImageMessage.HIKVISION_ROUTING_KEY; |
| | | break; |
| | | } |
| | | String imagePath = strFileName.replace("\\", "/"); |
| | | String imageUrl = imagePath.replace(DHConfiguration.staticCapturePath, ""); |
| | | String imageUrl = imagePath.replace(capturePath, ""); |
| | | ImageEntity image = new ImageEntity(); |
| | | image.setCameraId(devCamera.getId()); |
| | | image.setImagePath(imagePath); |
| | | image.setImageUrl("/Capture/" + imageUrl); |
| | | image.setImageUrl(capturePath.replace(captureDir, "") + imageUrl); |
| | | image.setCreateDate(captureDate); |
| | | imageDao.insert(image); |
| | | //存入rabbitmq消息队列,等待模型处理 |
| | | sendRabbitMQMessage(image); |
| | | sendRabbitMQMessage(image, routingKey); |
| | | } |
| | | |
| | | @Override |
| | | public void setStatus(String id, Integer status) { |
| | | CameraEntity cameraEntity = new CameraEntity(); |
| | | cameraEntity.setId(id); |
| | | cameraEntity.setStatus(status); |
| | | baseDao.updateById(cameraEntity); |
| | | } |
| | | |
| | | private QueryWrapper<CameraEntity> getWrapper(CameraPageReqVO cameraPageReqVO){ |
| | |
| | | |
| | | @Override |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | | public void delete(String[] ids) { |
| | | baseDao.deleteBatchIds(Arrays.asList(ids)); |
| | | public void delete(String id) { |
| | | baseDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | // 发送rabbitMQ消息 |
| | | private void sendRabbitMQMessage(ImageEntity image) { |
| | | private void sendRabbitMQMessage(ImageEntity image, String routingKey) { |
| | | String createTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | ImageMessage imageMessage = new ImageMessage(); |
| | | imageMessage.setMessageId(image.getId()); |
| | | imageMessage.setCreateTime(createTime); |
| | | imageMessage.setImageDTO(BeanUtils.toBean(image, ImageDTO.class)); |
| | | rabbitTemplate.convertAndSend(ImageMessage.EXCHANGE, ImageMessage.DAHUA_ROUTING_KEY, imageMessage); |
| | | rabbitTemplate.convertAndSend(ImageMessage.EXCHANGE, ImageMessage.HIKVISION_ROUTING_KEY, imageMessage); |
| | | rabbitTemplate.convertAndSend(ImageMessage.EXCHANGE, routingKey, imageMessage); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.constant.Constant; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | 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.module.data.video.controller.admin.camera.vo.ImagePageReqVO; |
| | | import com.iailab.module.data.video.dao.ImageDao; |
| | | import com.iailab.module.data.video.dto.ImageDTO; |
| | | import com.iailab.module.data.video.entity.DataEntity; |
| | | import com.iailab.module.data.video.entity.ImageEntity; |
| | | import com.iailab.module.data.video.entity.DataEntity; |
| | | import com.iailab.module.data.video.service.ImageService; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author Houzhongjian |
| | | * @Description |
| | | * @createTime 2024年02月27日 |
| | | */ |
| | |
| | | public class ImageServiceImpl extends BaseServiceImpl<ImageDao, ImageEntity> implements ImageService { |
| | | |
| | | @Override |
| | | public PageData<ImageDTO> page(Map<String, Object> params) { |
| | | IPage<ImageEntity> page = baseDao.selectPage( |
| | | getPage(params, Constant.CREATE_DATE, false), |
| | | getWrapper(params) |
| | | ); |
| | | return getPageData(page, ImageDTO.class); |
| | | public PageResult<ImageDTO> getPage(ImagePageReqVO imagePageReqVO) { |
| | | PageResult<ImageEntity> pageResult = baseDao.selectPage(imagePageReqVO); |
| | | return BeanUtils.toBean(pageResult, ImageDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ImageDTO> list(@Valid ImagePageReqVO imagePageReqVO) { |
| | | QueryWrapper<ImageEntity> queryWrapper = getWrapper(imagePageReqVO); |
| | | queryWrapper.orderByDesc(Constant.CREATE_DATE); |
| | | List<ImageEntity> list = baseDao.selectList(queryWrapper); |
| | | return ConvertUtils.sourceToTarget(list, ImageDTO.class); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return ConvertUtils.sourceToTarget(entity, ImageDTO.class); |
| | | } |
| | | |
| | | private QueryWrapper<ImageEntity> getWrapper(Map<String, Object> params){ |
| | | String cameraId = (String)params.get("cameraId"); |
| | | String startTime = (String)params.get("startTime"); |
| | | String endTime = (String)params.get("endTime"); |
| | | |
| | | QueryWrapper<ImageEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq(StringUtils.isNotBlank(cameraId), "camera_id", cameraId) |
| | | .ge(StringUtils.isNotBlank(startTime), "create_date", startTime) |
| | | .le(StringUtils.isNotBlank(endTime), "create_date", endTime); |
| | | |
| | | return wrapper; |
| | | } |
| | | |
| | | @Override |
| | | public List<DataEntity> getValueList(String cameraId, Date startTime, Date endTime) { |
| | | QueryWrapper<ImageEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq( "camera_id", cameraId) |
| | | .ge( "create_date", startTime) |
| | | .le( "create_date", endTime) |
| | | .orderByAsc("create_date"); |
| | | List<DataEntity> result = new ArrayList<>(); |
| | | List<ImageEntity> list = baseDao.selectList(wrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return result; |
| | | } |
| | | list.forEach(item -> { |
| | | DataEntity dataEntity = new DataEntity(); |
| | | dataEntity.setDataValue(item.getImagePath()); |
| | | dataEntity.setTimeStamp(item.getCreateDate()); |
| | | result.add(dataEntity); |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public String getUrl(String cameraId, String imagePath) { |
| | | String result = ""; |
| | | QueryWrapper<ImageEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq( "camera_id", cameraId) |
| | | .eq( "image_path", imagePath) |
| | | .orderByDesc("create_date"); |
| | | List<ImageEntity> devImageEntities = baseDao.selectList(wrapper); |
| | | ImageEntity entity = new ImageEntity(); |
| | | if (ObjectUtils.isNotEmpty(devImageEntities)) { |
| | | entity = devImageEntities.get(0); |
| | | } |
| | | if (entity != null) { |
| | | return entity.getImageUrl(); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public void save(ImageDTO dto) { |
| | | ImageEntity entity = ConvertUtils.sourceToTarget(dto, ImageEntity.class); |
| | | |
| | | //保存菜单 |
| | | insert(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(ImageDTO dto) { |
| | | ImageEntity entity = ConvertUtils.sourceToTarget(dto, ImageEntity.class); |
| | | |
| | | //更新菜单 |
| | | updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | | public void delete(String[] ids) { |
| | | public void delete(String id) { |
| | | //删除菜单 |
| | | baseDao.deleteBatchIds(Arrays.asList(ids)); |
| | | baseDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return ConvertUtils.sourceToTarget(entity, ImageDTO.class); |
| | | } |
| | | |
| | | private QueryWrapper<ImageEntity> getWrapper(ImagePageReqVO imagePageReqVO){ |
| | | String cameraId = imagePageReqVO.getCameraId(); |
| | | QueryWrapper<ImageEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq( "camera_id", cameraId); |
| | | return wrapper; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @Override |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | | public void delete(Long id) { |
| | | public void delete(String id) { |
| | | nvrDao.deleteById(id); |
| | | } |
| | | |
| | |
| | | upload-dir: D:/DLUT/upload/ |
| | | |
| | | video: |
| | | capture-dir: D:/iailab |
| | | dahua: |
| | | path: |
| | | capturePath: D:/irs/Capture/ |
| | | modelPath: D:/irs/Model/ |
| | | callback: |
| | | url: http://localhost:48080/admin-api/data/video/camera/DHCaptureCallback |
| | | capture-path: /Dahua/Capture/ |
| | | model-path: /Dahua/Model/ |
| | | hikvision: |
| | | path: |
| | | capture-path: /Hikvision/Capture/ |
| | | model-path: /Hikvision/Model/ |
| | | pic-size: 2 # size of picture 0=CIF, 1=QCIF, 2=D1 3=UXGA(1600x1200), 4=SVGA(800x600), 5=HD720p(1280x720),6=VGA |
| | | pic-quality: 0 # quality of picture 0-best 1-better 2-normal |
| | | |
| | |
| | | influx-db: |
| | | org: iailab |
| | | bucket: buk_shasteel |
| | | token: Q2qsriQG3FEfZ35lik1KSkFToma3bsgfQLwJrNQfSK06MC569sZ9mrQ0vLtsVYn70HMfQcC9gf_yUG16JQtm8w== |
| | | token: p-WkLXdPmHD4Cdij2PD-r92dLEQqjQ8V5KhyZYHYroBNVE0ZrW5VgzqWBNmXmiEdxEWaURC7rrKVzuM0XTEraQ== |
| | | url: http://172.16.8.200:8086 |
| | | username: root |
| | | password: iailab12345678 |
| | |
| | | upload-dir: D:/DLUT/upload/ |
| | | |
| | | video: |
| | | capture-dir: D:/iailab |
| | | dahua: |
| | | path: |
| | | capturePath: D:/irs/Capture/ |
| | | modelPath: D:/irs/Model/ |
| | | callback: |
| | | url: http://localhost:48080/admin-api/data/video/camera/DHCaptureCallback |
| | | capture-path: /Dahua/Capture/ |
| | | model-path: /Dahua/Model/ |
| | | hikvision: |
| | | path: |
| | | capture-path: /Hikvision/Capture/ |
| | | model-path: /Hikvision/Model/ |
| | | pic-size: 2 # size of picture 0=CIF, 1=QCIF, 2=D1 3=UXGA(1600x1200), 4=SVGA(800x600), 5=HD720p(1280x720),6=VGA |
| | | pic-quality: 0 # quality of picture 0-best 1-better 2-normal |
| | | |