From 22ec70f29b6431d4e773ccf529d82c586edafb23 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期一, 26 九月 2022 17:49:39 +0800 Subject: [PATCH] 视频点位管理 --- ycl-platform/src/main/java/com/ycl/service/video/impl/VideoPointServiceImpl.java | 19 +++ ycl-platform/src/main/java/com/ycl/service/video/impl/IVideoPointService.java | 17 ++ ycl-platform/src/main/java/com/ycl/controller/video/VideoPointController.java | 21 +++ ycl-platform/src/main/java/com/ycl/entity/caseHandler/BaseCase.java | 3 ycl-platform/src/main/java/com/ycl/service/caseHandler/IViolationsService.java | 12 ++ ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java | 11 + ycl-generator/src/main/java/com/ycl/MysqlGenerator.java | 2 ycl-platform/src/main/java/com/ycl/dto/video/CameraInfParam.java | 3 ycl-platform/src/main/java/com/ycl/dto/video/AlarmParam.java | 2 ycl-platform/src/main/java/com/ycl/service/video/IVideoAlarmReportService.java | 9 /dev/null | 7 - ycl-platform/src/main/java/com/ycl/entity/video/VideoAlarmReport.java | 2 ycl-platform/src/main/java/com/ycl/controller/dict/DatabaseDictionaryController.java | 14 +- ycl-platform/src/main/java/com/ycl/controller/platformApi/AlarmController.java | 4 ycl-platform/src/main/java/com/ycl/entity/video/VideoPoint.java | 95 +++++++++++++++ ycl-generator/src/main/resources/mapper/video/VideoPointMapper.xml | 25 ++++ ycl-platform/src/main/java/com/ycl/mapper/video/VideoPointMapper.java | 16 ++ ycl-platform/src/main/resources/mapper/video/VideoAlarmReportMapper.xml | 4 ycl-platform/src/main/java/com/ycl/mapper/video/VideoAlarmReportMapper.java | 14 ++ ycl-platform/src/main/java/com/ycl/dto/video/AlarmDataParam.java | 2 ycl-platform/src/main/java/com/ycl/entity/caseHandler/Violations.java | 5 ycl-platform/src/main/java/com/ycl/service/video/impl/VideoAlarmReportServiceImpl.java | 38 +++-- 22 files changed, 280 insertions(+), 45 deletions(-) diff --git a/ycl-generator/src/main/java/com/ycl/MysqlGenerator.java b/ycl-generator/src/main/java/com/ycl/MysqlGenerator.java index ef859a5..fb96cad 100644 --- a/ycl-generator/src/main/java/com/ycl/MysqlGenerator.java +++ b/ycl-generator/src/main/java/com/ycl/MysqlGenerator.java @@ -59,7 +59,7 @@ GlobalConfig gc = new GlobalConfig(); final String projectPath = System.getProperty("user.dir"); gc.setOutputDir(projectPath + "/ycl-generator/src/main/java"); - gc.setAuthor("wl");//浣滆�� + gc.setAuthor("zhanghua");//浣滆�� gc.setBaseResultMap(true); //mapper.xml 鐢熸垚 ResultMap gc.setBaseColumnList(true); //mapper.xml 鐢熸垚 ColumnList // gc.setSwagger2(true); diff --git a/ycl-generator/src/main/resources/mapper/video/VideoPointMapper.xml b/ycl-generator/src/main/resources/mapper/video/VideoPointMapper.xml new file mode 100644 index 0000000..fb8d8cb --- /dev/null +++ b/ycl-generator/src/main/resources/mapper/video/VideoPointMapper.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.ycl.mapper.video.VideoPointMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="com.ycl.entity.video.VideoPoint"> + <id column="id" property="id" /> + <result column="longitude" property="longitude" /> + <result column="latitude" property="latitude" /> + <result column="name" property="name" /> + <result column="plat_resource_id" property="platResourceId" /> + <result column="equipment_brand" property="equipmentBrand" /> + <result column="equipment_model" property="equipmentModel" /> + <result column="equipment_ip" property="equipmentIp" /> + <result column="url_address" property="urlAddress" /> + <result column="street_id" property="streetId" /> + <result column="community_id" property="communityId" /> + </resultMap> + + <!-- 閫氱敤鏌ヨ缁撴灉鍒� --> + <sql id="Base_Column_List"> + id, longitude, latitude, name, plat_resource_id, equipment_brand, equipment_model, equipment_ip, url_address, street_id, community_id + </sql> + +</mapper> diff --git a/ycl-platform/src/main/java/com/ycl/controller/dict/DatabaseDictionaryController.java b/ycl-platform/src/main/java/com/ycl/controller/dict/DatabaseDictionaryController.java index 1b3d6d0..79df82e 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/dict/DatabaseDictionaryController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/dict/DatabaseDictionaryController.java @@ -3,8 +3,8 @@ import com.ycl.api.CommonResult; import com.ycl.controller.BaseController; -import com.ycl.entity.dict.DatabaseDictionary; -import com.ycl.service.dict.IDatabaseDictionaryService; +import com.ycl.entity.dict.DataDictionary; +import com.ycl.service.dict.IDataDictionaryService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; @@ -28,18 +28,18 @@ @Api(tags = "瀛楀吀妯″潡") public class DatabaseDictionaryController extends BaseController { @Resource - private IDatabaseDictionaryService iDatabaseDictionaryService; + private IDataDictionaryService iDatabaseDictionaryService; @GetMapping("/listAll") @ApiOperation("鑾峰彇鎵�鏈夊瓧鍏�") - private CommonResult<List<DatabaseDictionary>> listAll() { + private CommonResult<List<DataDictionary>> listAll() { return CommonResult.success(iDatabaseDictionaryService.getAll()); } @GetMapping("/queryByCode") @ApiOperation(("/鏍规嵁code鑾峰彇瀛楁淇℃伅")) - private CommonResult<DatabaseDictionary> queryByCode(@RequestParam(value = "code") String code){ - DatabaseDictionary databaseDictionary = iDatabaseDictionaryService.queryByCode(code); - return CommonResult.success(databaseDictionary); + private CommonResult<DataDictionary> queryByCode(@RequestParam(value = "code") String code){ + DataDictionary dataDictionary = iDatabaseDictionaryService.queryByCode(code); + return CommonResult.success(dataDictionary); } } diff --git a/ycl-platform/src/main/java/com/ycl/controller/platformApi/AlarmController.java b/ycl-platform/src/main/java/com/ycl/controller/platformApi/AlarmController.java index dc22b34..00f1924 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/platformApi/AlarmController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/platformApi/AlarmController.java @@ -1,9 +1,9 @@ package com.ycl.controller.platformApi; import com.ycl.api.CommonResult; -import com.ycl.dto.videoAlarm.AlarmParam; +import com.ycl.dto.video.AlarmParam; import com.ycl.enums.common.ResultCode; -import com.ycl.service.videoAlarm.IVideoAlarmReportService; +import com.ycl.service.video.IVideoAlarmReportService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; diff --git a/ycl-platform/src/main/java/com/ycl/controller/video/VideoPointController.java b/ycl-platform/src/main/java/com/ycl/controller/video/VideoPointController.java new file mode 100644 index 0000000..cc5df9e --- /dev/null +++ b/ycl-platform/src/main/java/com/ycl/controller/video/VideoPointController.java @@ -0,0 +1,21 @@ +package com.ycl.controller.video; + + +import com.ycl.controller.BaseController; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + * <p> + * 鐐逛綅绠$悊 鍓嶇鎺у埗鍣� + * </p> + * + * @author zhanghua + * @since 2022-09-26 + */ +@RestController +@RequestMapping("/video-point") +public class VideoPointController extends BaseController { + +} diff --git a/ycl-platform/src/main/java/com/ycl/dto/videoAlarm/AlarmDataParam.java b/ycl-platform/src/main/java/com/ycl/dto/video/AlarmDataParam.java similarity index 95% rename from ycl-platform/src/main/java/com/ycl/dto/videoAlarm/AlarmDataParam.java rename to ycl-platform/src/main/java/com/ycl/dto/video/AlarmDataParam.java index 33e292f..458f73c 100644 --- a/ycl-platform/src/main/java/com/ycl/dto/videoAlarm/AlarmDataParam.java +++ b/ycl-platform/src/main/java/com/ycl/dto/video/AlarmDataParam.java @@ -1,4 +1,4 @@ -package com.ycl.dto.videoAlarm; +package com.ycl.dto.video; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; diff --git a/ycl-platform/src/main/java/com/ycl/dto/videoAlarm/AlarmParam.java b/ycl-platform/src/main/java/com/ycl/dto/video/AlarmParam.java similarity index 96% rename from ycl-platform/src/main/java/com/ycl/dto/videoAlarm/AlarmParam.java rename to ycl-platform/src/main/java/com/ycl/dto/video/AlarmParam.java index 6e1e241..285624f 100644 --- a/ycl-platform/src/main/java/com/ycl/dto/videoAlarm/AlarmParam.java +++ b/ycl-platform/src/main/java/com/ycl/dto/video/AlarmParam.java @@ -1,4 +1,4 @@ -package com.ycl.dto.videoAlarm; +package com.ycl.dto.video; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; diff --git a/ycl-platform/src/main/java/com/ycl/dto/videoAlarm/CameraInfParam.java b/ycl-platform/src/main/java/com/ycl/dto/video/CameraInfParam.java similarity index 93% rename from ycl-platform/src/main/java/com/ycl/dto/videoAlarm/CameraInfParam.java rename to ycl-platform/src/main/java/com/ycl/dto/video/CameraInfParam.java index d4a12fc..ccb7aa2 100644 --- a/ycl-platform/src/main/java/com/ycl/dto/videoAlarm/CameraInfParam.java +++ b/ycl-platform/src/main/java/com/ycl/dto/video/CameraInfParam.java @@ -1,7 +1,6 @@ -package com.ycl.dto.videoAlarm; +package com.ycl.dto.video; import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.models.auth.In; import lombok.Data; /** diff --git a/ycl-platform/src/main/java/com/ycl/entity/caseHandler/BaseCase.java b/ycl-platform/src/main/java/com/ycl/entity/caseHandler/BaseCase.java index a01e8e5..c309fa4 100644 --- a/ycl-platform/src/main/java/com/ycl/entity/caseHandler/BaseCase.java +++ b/ycl-platform/src/main/java/com/ycl/entity/caseHandler/BaseCase.java @@ -7,6 +7,8 @@ import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.TableField; import java.io.Serializable; + +import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; @@ -21,6 +23,7 @@ @Data @EqualsAndHashCode(callSuper = false) @TableName("ums_base_case") +@Builder public class BaseCase implements Serializable { private static final long serialVersionUID = 1L; diff --git a/ycl-platform/src/main/java/com/ycl/entity/caseHandler/Violations.java b/ycl-platform/src/main/java/com/ycl/entity/caseHandler/Violations.java index 1cbdc43..2f9bb72 100644 --- a/ycl-platform/src/main/java/com/ycl/entity/caseHandler/Violations.java +++ b/ycl-platform/src/main/java/com/ycl/entity/caseHandler/Violations.java @@ -95,5 +95,10 @@ @TableField("informant_id_card") private String informantIdCard; + /** + * 瑙嗛鎶ヨid + */ + @TableField("video_alarm_report_id") + private Integer videoAlarmReportId; } diff --git a/ycl-platform/src/main/java/com/ycl/entity/videoAlarm/VideoAlarmReport.java b/ycl-platform/src/main/java/com/ycl/entity/video/VideoAlarmReport.java similarity index 97% rename from ycl-platform/src/main/java/com/ycl/entity/videoAlarm/VideoAlarmReport.java rename to ycl-platform/src/main/java/com/ycl/entity/video/VideoAlarmReport.java index 02621d9..29b6059 100644 --- a/ycl-platform/src/main/java/com/ycl/entity/videoAlarm/VideoAlarmReport.java +++ b/ycl-platform/src/main/java/com/ycl/entity/video/VideoAlarmReport.java @@ -1,4 +1,4 @@ -package com.ycl.entity.videoAlarm; +package com.ycl.entity.video; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/ycl-platform/src/main/java/com/ycl/entity/video/VideoPoint.java b/ycl-platform/src/main/java/com/ycl/entity/video/VideoPoint.java new file mode 100644 index 0000000..efd0a1c --- /dev/null +++ b/ycl-platform/src/main/java/com/ycl/entity/video/VideoPoint.java @@ -0,0 +1,95 @@ +package com.ycl.entity.video; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.Version; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * <p> + * 鐐逛綅绠$悊 + * </p> + * + * @author zhanghua + * @since 2022-09-26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("ums_video_point") +public class VideoPoint implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 涓婚敭 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 鐐逛綅缁忓害 + */ + @TableField("longitude") + private BigDecimal longitude; + + /** + * 鐐逛綅绾害 + */ + @TableField("latitude") + private BigDecimal latitude; + + /** + * 鐐逛綅鍚嶇О + */ + @TableField("name") + private String name; + + /** + * 璁惧缂栫爜鍞竴 + */ + @TableField("plat_resource_id") + private String platResourceId; + + /** + * 璁惧鍝佺墝 + */ + @TableField("equipment_brand") + private String equipmentBrand; + + /** + * 璁惧鍨嬪彿 + */ + @TableField("equipment_model") + private String equipmentModel; + + /** + * 璁惧IP鍦板潃 + */ + @TableField("equipment_ip") + private String equipmentIp; + + /** + * URL鍦板潃 + */ + @TableField("url_address") + private String urlAddress; + + /** + * 琛楅亾id + */ + @TableField("street_id") + private Integer streetId; + + /** + * 绀惧尯id + */ + @TableField("community_id") + private Integer communityId; + + +} diff --git a/ycl-platform/src/main/java/com/ycl/mapper/video/VideoAlarmReportMapper.java b/ycl-platform/src/main/java/com/ycl/mapper/video/VideoAlarmReportMapper.java new file mode 100644 index 0000000..816ce88 --- /dev/null +++ b/ycl-platform/src/main/java/com/ycl/mapper/video/VideoAlarmReportMapper.java @@ -0,0 +1,14 @@ +package com.ycl.mapper.video; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ycl.entity.video.VideoAlarmReport; + +/** + * VideoAlarmReportMapper + * + * @author: AI + * @date: 2022-09-26 17:20 + * @version V1.0 +**/ +public interface VideoAlarmReportMapper extends BaseMapper<VideoAlarmReport> { +} diff --git a/ycl-platform/src/main/java/com/ycl/mapper/video/VideoPointMapper.java b/ycl-platform/src/main/java/com/ycl/mapper/video/VideoPointMapper.java new file mode 100644 index 0000000..3f41baf --- /dev/null +++ b/ycl-platform/src/main/java/com/ycl/mapper/video/VideoPointMapper.java @@ -0,0 +1,16 @@ +package com.ycl.mapper.video; + +import com.ycl.entity.video.VideoPoint; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * <p> + * 鐐逛綅绠$悊 Mapper 鎺ュ彛 + * </p> + * + * @author zhanghua + * @since 2022-09-26 + */ +public interface VideoPointMapper extends BaseMapper<VideoPoint> { + +} diff --git a/ycl-platform/src/main/java/com/ycl/mapper/videoAlarm/VideoAlarmReportMapper.java b/ycl-platform/src/main/java/com/ycl/mapper/videoAlarm/VideoAlarmReportMapper.java deleted file mode 100644 index 052a138..0000000 --- a/ycl-platform/src/main/java/com/ycl/mapper/videoAlarm/VideoAlarmReportMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.ycl.mapper.videoAlarm; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ycl.entity.videoAlarm.VideoAlarmReport; - -public interface VideoAlarmReportMapper extends BaseMapper<VideoAlarmReport> { -} diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/IViolationsService.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/IViolationsService.java index 3dff499..d453d4d 100644 --- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/IViolationsService.java +++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/IViolationsService.java @@ -2,6 +2,9 @@ import com.ycl.entity.caseHandler.Violations; import com.baomidou.mybatisplus.extension.service.IService; +import com.ycl.entity.video.VideoAlarmReport; + +import java.util.List; /** * <p> @@ -13,4 +16,13 @@ */ public interface IViolationsService extends IService<Violations> { + /** + * 淇濆瓨鏉ヨ嚜瑙嗛鐨勬姤璀︽暟鎹� + * + * @param videoAlarmReports + * @return void + * @author AI + * @date 2022-09-26 17:25 + */ + void saveFromVideo(List<VideoAlarmReport> videoAlarmReports); } diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java index 6cc78f5..8bab837 100644 --- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java @@ -1,10 +1,14 @@ package com.ycl.service.caseHandler.impl; +import com.ycl.entity.caseHandler.BaseCase; import com.ycl.entity.caseHandler.Violations; +import com.ycl.entity.video.VideoAlarmReport; import com.ycl.mapper.caseHandler.ViolationsMapper; import com.ycl.service.caseHandler.IViolationsService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; + +import java.util.List; /** * <p> @@ -17,4 +21,11 @@ @Service public class ViolationsServiceImpl extends ServiceImpl<ViolationsMapper, Violations> implements IViolationsService { + @Override + public void saveFromVideo(List<VideoAlarmReport> videoAlarmReports) { + for (VideoAlarmReport videoAlarmReport : videoAlarmReports) { + + BaseCase baseCase = BaseCase.builder().build(); + } + } } diff --git a/ycl-platform/src/main/java/com/ycl/service/videoAlarm/IVideoAlarmReportService.java b/ycl-platform/src/main/java/com/ycl/service/video/IVideoAlarmReportService.java similarity index 74% rename from ycl-platform/src/main/java/com/ycl/service/videoAlarm/IVideoAlarmReportService.java rename to ycl-platform/src/main/java/com/ycl/service/video/IVideoAlarmReportService.java index dfcf780..a745258 100644 --- a/ycl-platform/src/main/java/com/ycl/service/videoAlarm/IVideoAlarmReportService.java +++ b/ycl-platform/src/main/java/com/ycl/service/video/IVideoAlarmReportService.java @@ -1,10 +1,8 @@ -package com.ycl.service.videoAlarm; +package com.ycl.service.video; import com.baomidou.mybatisplus.extension.service.IService; -import com.ycl.dto.videoAlarm.AlarmParam; -import com.ycl.entity.videoAlarm.VideoAlarmReport; - -import java.util.List; +import com.ycl.dto.video.AlarmParam; +import com.ycl.entity.video.VideoAlarmReport; /** * 瑙嗛鎶ヨ鎺ㄩ�佽褰曡〃(UmsVideoAlarmReport)琛ㄦ湇鍔℃帴鍙� @@ -22,4 +20,5 @@ * @date 2022-09-20 17:36 */ void save(AlarmParam alarmParam); + } diff --git a/ycl-platform/src/main/java/com/ycl/service/video/impl/IVideoPointService.java b/ycl-platform/src/main/java/com/ycl/service/video/impl/IVideoPointService.java new file mode 100644 index 0000000..7ba16eb --- /dev/null +++ b/ycl-platform/src/main/java/com/ycl/service/video/impl/IVideoPointService.java @@ -0,0 +1,17 @@ +package com.ycl.service.video.impl; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ycl.entity.video.VideoPoint; + +/** + * <p> + * 鐐逛綅绠$悊 鏈嶅姟绫� + * </p> + * + * @author zhanghua + * @since 2022-09-26 + */ +interface IVideoPointService extends IService<VideoPoint> { + +} diff --git a/ycl-platform/src/main/java/com/ycl/service/videoAlarm/impl/VideoAlarmReportServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/video/impl/VideoAlarmReportServiceImpl.java similarity index 76% rename from ycl-platform/src/main/java/com/ycl/service/videoAlarm/impl/VideoAlarmReportServiceImpl.java rename to ycl-platform/src/main/java/com/ycl/service/video/impl/VideoAlarmReportServiceImpl.java index 14414c1..4cac604 100644 --- a/ycl-platform/src/main/java/com/ycl/service/videoAlarm/impl/VideoAlarmReportServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/video/impl/VideoAlarmReportServiceImpl.java @@ -1,32 +1,28 @@ -package com.ycl.service.videoAlarm.impl; +package com.ycl.service.video.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ycl.dto.media.Media; -import com.ycl.dto.media.PictureZoomParameter; -import com.ycl.dto.videoAlarm.AlarmDataParam; -import com.ycl.dto.videoAlarm.AlarmParam; -import com.ycl.dto.videoAlarm.CameraInfParam; -import com.ycl.entity.videoAlarm.VideoAlarmReport; -import com.ycl.mapper.videoAlarm.VideoAlarmReportMapper; -import com.ycl.service.videoAlarm.IVideoAlarmReportService; +import com.ycl.dto.video.AlarmDataParam; +import com.ycl.dto.video.AlarmParam; +import com.ycl.dto.video.CameraInfParam; +import com.ycl.entity.video.VideoAlarmReport; +import com.ycl.mapper.video.VideoAlarmReportMapper; +import com.ycl.service.caseHandler.IViolationsService; +import com.ycl.service.video.IVideoAlarmReportService; import com.ycl.utils.MediaFileUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; import javax.xml.bind.DatatypeConverter; import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; import java.io.InputStream; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Instant; -import java.time.LocalDateTime; import java.time.ZoneId; -import java.time.format.DateTimeFormatter; +import java.util.ArrayList; import java.util.Date; +import java.util.List; /** * VideoAlarmReportServiceImpl @@ -39,10 +35,16 @@ public class VideoAlarmReportServiceImpl extends ServiceImpl<VideoAlarmReportMapper, VideoAlarmReport> implements IVideoAlarmReportService { private MediaFileUtil mediaFileUtil; + private IViolationsService violationsService; @Autowired public void setMediaFileUtil(MediaFileUtil mediaFileUtil) { this.mediaFileUtil = mediaFileUtil; + } + + @Autowired + public void setViolationsService(IViolationsService violationsService) { + this.violationsService = violationsService; } @Override @@ -58,7 +60,7 @@ InputStream inputStream = new ByteArrayInputStream(data); try { picData = mediaFileUtil.savePicture(inputStream, extension); - + List<VideoAlarmReport> videoAlarmReports = new ArrayList<>(); for (int i = 0; i < alarmParam.getAlarmData().size(); i++) { AlarmDataParam alarmData = alarmParam.getAlarmData().get(i); /******************** 澶勭悊鍥剧墖 **********************/ @@ -75,11 +77,15 @@ .alarmId(alarmData.getAlarmID()).algoType(alarmData.getAlgoType()) .algoName(alarmData.getAlgoName()).alarmObj(JSON.toJSONString(alarmData.getAlarmObject())) .build(); - baseMapper.insert(videoAlarmReport); + videoAlarmReports.add(videoAlarmReport); + } catch (ParseException e) { e.printStackTrace(); } } + this.saveBatch(videoAlarmReports, videoAlarmReports.size()); + + violationsService.saveFromVideo(videoAlarmReports); } catch (Exception e) { e.printStackTrace(); } diff --git a/ycl-platform/src/main/java/com/ycl/service/video/impl/VideoPointServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/video/impl/VideoPointServiceImpl.java new file mode 100644 index 0000000..52ea0da --- /dev/null +++ b/ycl-platform/src/main/java/com/ycl/service/video/impl/VideoPointServiceImpl.java @@ -0,0 +1,19 @@ +package com.ycl.service.video.impl; + +import com.ycl.entity.video.VideoPoint; +import com.ycl.mapper.video.VideoPointMapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * <p> + * 鐐逛綅绠$悊 鏈嶅姟瀹炵幇绫� + * </p> + * + * @author zhanghua + * @since 2022-09-26 + */ +@Service +public class VideoPointServiceImpl extends ServiceImpl<VideoPointMapper, VideoPoint> implements IVideoPointService { + +} diff --git a/ycl-platform/src/main/resources/mapper/videoAlarm/VideoAlarmReportMapper.xml b/ycl-platform/src/main/resources/mapper/video/VideoAlarmReportMapper.xml similarity index 84% rename from ycl-platform/src/main/resources/mapper/videoAlarm/VideoAlarmReportMapper.xml rename to ycl-platform/src/main/resources/mapper/video/VideoAlarmReportMapper.xml index b6234bc..c8b1cf5 100644 --- a/ycl-platform/src/main/resources/mapper/videoAlarm/VideoAlarmReportMapper.xml +++ b/ycl-platform/src/main/resources/mapper/video/VideoAlarmReportMapper.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ycl.mapper.videoAlarm.VideoAlarmReportMapper"> +<mapper namespace="com.ycl.mapper.video.VideoAlarmReportMapper"> - <resultMap type="com.ycl.entity.videoAlarm.VideoAlarmReport" id="VideoAlarmReportMap"> + <resultMap type="com.ycl.entity.video.VideoAlarmReport" id="VideoAlarmReportMap"> <result property="id" column="id"/> <result property="ip" column="ip"/> <result property="port" column="port"/> -- Gitblit v1.8.0