zhanghua
2022-09-27 6aae0fb74bb0414cf158bac825858006c92733ea
视频报警后将数据同步到违规事件中
5个文件已修改
2个文件已添加
131 ■■■■■ 已修改文件
ycl-platform/src/main/java/com/ycl/entity/caseHandler/BaseCase.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/entity/caseHandler/EventSource.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/entity/caseHandler/QuestionCategory.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/entity/caseHandler/Violations.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/entity/video/VideoPoint.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/service/video/impl/IVideoPointService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/entity/caseHandler/BaseCase.java
@@ -74,13 +74,13 @@
     * 定位信息
     */
    @TableField("longitude")
    private Float longitude;
    private Double longitude;
    /**
     * 定位-纬度
     */
    @TableField("latitude")
    private Float latitude;
    private Double latitude;
    /**
     * 报警时间
ycl-platform/src/main/java/com/ycl/entity/caseHandler/EventSource.java
New file
@@ -0,0 +1,39 @@
package com.ycl.entity.caseHandler;
/**
 * EvnetSource 事件来源
 *
 * @author: AI
 * @date:  2022-09-27 17:40
 * @version V1.0
**/
public enum EventSource {
    VIDEO(1,"视频"),
    MANUAL(2,"手动添加")
    ;
    private Integer code;
    private String name;
    EventSource(int code, String name) {
        this.code = code;
        this.name = name;
    }
    public Integer getCode() {
        return code;
    }
    public void setCode(Integer code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
ycl-platform/src/main/java/com/ycl/entity/caseHandler/QuestionCategory.java
New file
@@ -0,0 +1,37 @@
package com.ycl.entity.caseHandler;
/**
 * EventType 事件类型
 *
 * @version V1.0
 * @author: AI
 * @date: 2022-09-27 17:47
 **/
public enum QuestionCategory {
    VIOLATION(1, "违规"),
    ILLEGAL_BUILDING(2, "违建");
    private Integer code;
    private String name;
    QuestionCategory(int code, String name) {
        this.code = code;
        this.name = name;
    }
    public Integer getCode() {
        return code;
    }
    public void setCode(Integer code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
ycl-platform/src/main/java/com/ycl/entity/caseHandler/Violations.java
@@ -5,8 +5,11 @@
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
 * <p>
@@ -19,6 +22,8 @@
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("ums_violations")
@Builder
@NoArgsConstructor
public class Violations implements Serializable {
    private static final long serialVersionUID = 1L;
ycl-platform/src/main/java/com/ycl/entity/video/VideoPoint.java
@@ -35,13 +35,13 @@
     * 点位经度
     */
    @TableField("longitude")
    private BigDecimal longitude;
    private Double longitude;
    /**
     * 点位纬度
     */
    @TableField("latitude")
    private BigDecimal latitude;
    private Double latitude;
    /**
     * 点位名称
ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java
@@ -1,13 +1,22 @@
package com.ycl.service.caseHandler.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ycl.entity.caseHandler.BaseCase;
import com.ycl.entity.caseHandler.EventSource;
import com.ycl.entity.caseHandler.QuestionCategory;
import com.ycl.entity.caseHandler.Violations;
import com.ycl.entity.dict.DataDictionary;
import com.ycl.entity.video.VideoAlarmReport;
import com.ycl.entity.video.VideoPoint;
import com.ycl.mapper.caseHandler.ViolationsMapper;
import com.ycl.service.caseHandler.IBaseCaseService;
import com.ycl.service.caseHandler.IViolationsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.service.video.impl.IVideoPointService;
import com.ycl.service.video.impl.VideoPointServiceImpl;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -21,11 +30,40 @@
@Service
public class ViolationsServiceImpl extends ServiceImpl<ViolationsMapper, Violations> implements IViolationsService {
    private IVideoPointService videoPointService;
    private IBaseCaseService baseCaseService;
    public void setVideoPointService(IVideoPointService videoPointService) {
        this.videoPointService = videoPointService;
    }
    public void setBaseCaseService(IBaseCaseService baseCaseService) {
        this.baseCaseService = baseCaseService;
    }
    @Override
    public void saveFromVideo(List<VideoAlarmReport> videoAlarmReports) {
        for (VideoAlarmReport videoAlarmReport : videoAlarmReports) {
            VideoPoint videoPoint = null;
            LambdaQueryWrapper<VideoPoint> queryWrapper = new LambdaQueryWrapper<VideoPoint>().eq(VideoPoint::getPlatResourceId, videoAlarmReport.getPlatResourceId());
            List<VideoPoint> pointList = videoPointService.list(queryWrapper);
            if (pointList.size() > 0) {
                videoPoint = pointList.get(0);
            }
            BaseCase baseCase = BaseCase.builder().eventSource(EventSource.VIDEO.getCode()).category(QuestionCategory.VIOLATION.getCode())
                    .createTime(LocalDateTime.now()).createUser(0).alarmTime(videoAlarmReport.getAlarmTime()).build();
            Violations violations = new Violations();
            if (videoPoint != null) {
                baseCase.setLatitude(videoPoint.getLatitude());
                baseCase.setLongitude(videoPoint.getLongitude());
                baseCase.setStreetId(videoPoint.getStreetId());
                baseCase.setCommunityId(videoPoint.getCommunityId());
            BaseCase baseCase = BaseCase.builder().build();
                violations.setVideoAlarmReportId(videoAlarmReport.getId());
            }
            baseCaseService.save(baseCase);
            violations.setId(baseCase.getId());
            baseMapper.insert(violations);
        }
    }
}
ycl-platform/src/main/java/com/ycl/service/video/impl/IVideoPointService.java
@@ -12,6 +12,6 @@
 * @author zhanghua
 * @since 2022-09-26
 */
interface IVideoPointService extends IService<VideoPoint> {
public interface IVideoPointService extends IService<VideoPoint> {
}