zhanghua
2024-10-09 b11443475114cacb529130a04d45c7c9981ff375
ycl-platform/src/main/java/com/dahua/netsdk/lib/callback/impl/AnalyzerDataCB.java
@@ -8,6 +8,7 @@
import java.util.List;
import java.util.Objects;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.dahua.netsdk.lib.Utils;
import com.dahua.netsdk.lib.enumeration.EM_EVENT_IVS_TYPE;
@@ -15,14 +16,22 @@
import com.sun.jna.Pointer;
import com.dahua.netsdk.lib.NetSDKLib;
import com.dahua.netsdk.lib.ToolKits;
import com.ycl.common.constant.GlobalQueue;
import com.ycl.entity.video.VideoAlarmReport;
import com.ycl.entity.video.VideoPoint;
import com.ycl.service.caseHandler.IViolationsService;
import com.ycl.service.caseHandler.impl.ViolationsServiceImpl;
import com.ycl.service.oss.OssService;
import com.ycl.service.oss.impl.OssServiceImpl;
import com.ycl.service.redis.RedisService;
import com.ycl.service.video.IVideoAlarmReportService;
import com.ycl.service.video.impl.IVideoPointService;
import com.ycl.service.video.impl.VideoAlarmReportServiceImpl;
import com.ycl.service.video.impl.VideoPointServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
 * 智能报警事件回调
@@ -30,23 +39,10 @@
@Component
public class AnalyzerDataCB implements NetSDKLib.fAnalyzerDataCallBack {
    @Autowired
    private OssService ossService;
    @Autowired
    private IVideoPointService videoPointService;
    @Autowired
    private IVideoAlarmReportService videoAlarmReportService;
    @Autowired
    private IViolationsService violationsService;
    private final File picturePath;
    private static AnalyzerDataCB instance;
    private AnalyzerDataCB() {
    public AnalyzerDataCB() {
        picturePath = new File("./AnalyzerPicture/");
        if (!picturePath.exists()) {
            picturePath.mkdirs();
@@ -102,7 +98,7 @@
                ToolKits.GetPointerData(pAlarmInfo, msg);
                String Picture = picturePath + "\\" + System.currentTimeMillis() + ".jpg";
                ToolKits.savePicture(pBuffer, 0, dwBufSize, Picture);
                System.out.println(" 斗殴事件 时间(UTC):" + msg.UTC + " 通道号:" + msg.nChannelID);
//                System.out.println(" 斗殴事件 时间(UTC):" + msg.UTC + " 通道号:" + msg.nChannelID);
                break;
            }
            case EVENT_IVS_RIOTERDETECTION: // 聚众事件
@@ -119,15 +115,15 @@
            {
                NetSDKLib.DEV_EVENT_MANNUM_DETECTION_INFO msg = new NetSDKLib.DEV_EVENT_MANNUM_DETECTION_INFO();
                ToolKits.GetPointerData(pAlarmInfo, msg);
                System.out.println(" 立体视觉区域内人数统计事件 时间(UTC):" + msg.UTC + " 通道号:" + msg.nChannelID + " 区域人员列表数量:"
                        + msg.nManListCount + " 人员身高:" + msg.stuManList[0].nStature);
//                System.out.println(" 立体视觉区域内人数统计事件 时间(UTC):" + msg.UTC + " 通道号:" + msg.nChannelID + " 区域人员列表数量:"
//                        + msg.nManListCount + " 人员身高:" + msg.stuManList[0].nStature);
                break;
            }
            case EVENT_IVS_CROWDDETECTION: /// < 人群密度检测事件
            {
                NetSDKLib.DEV_EVENT_CROWD_DETECTION_INFO msg = new NetSDKLib.DEV_EVENT_CROWD_DETECTION_INFO();
                ToolKits.GetPointerData(pAlarmInfo, msg);
                System.out.println(" 人群密度检测事件 时间(UTC):" + msg.UTC + " 通道号:" + msg.nChannelID);
//                System.out.println(" 人群密度检测事件 时间(UTC):" + msg.UTC + " 通道号:" + msg.nChannelID);
                break;
            }
            case EVENT_IVS_CITY_MOTORPARKING: /// 1 城市机动车违停事件
@@ -135,20 +131,16 @@
                NetSDKLib.DEV_EVENT_CITY_MOTORPARKING_INFO info = new NetSDKLib.DEV_EVENT_CITY_MOTORPARKING_INFO();
                ToolKits.GetPointerData(pAlarmInfo, info);
                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
                // videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
                videoAlarmReport.setAlarmTime(LocalDateTime.of(info.UTC.dwYear, info.UTC.dwMonth, info.UTC.dwDay, info.UTC.dwHour, info.UTC.dwMinute, info.UTC.dwSecond));
                VideoPoint videoPoint = videoPointService.getByChannelId(info.nChannelID);
                videoAlarmReport.setChannel(String.valueOf(info.nChannelID));
                videoAlarmReport.setAlarmId(String.valueOf(info.nEventID));
                videoAlarmReport.setAlarmName("非机动车乱停放");
                if (videoPoint != null) {
                    videoAlarmReport.setPlatResourceId(videoPoint.getPlatResourceId());
                }
                videoAlarmReport.setAlarmName("机动车乱停放");
                stuFileInfo = info.stuFileInfo;
                System.out.println(" 城市机动车违停事件 时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "违停持续时长(单位秒):"
                        + info.nParkingDuration + "检测到的物体个数:" + info.nObjectNum);
//                System.out.println(" 城市机动车违停事件 时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "违停持续时长(单位秒):"
//                        + info.nParkingDuration + "检测到的物体个数:" + info.nObjectNum);
//                if (stuFileInfo != null) { // 保存图片
//                    String bigPicture = picturePath + File.separator
@@ -191,20 +183,17 @@
                NetSDKLib.DEV_EVENT_CITY_NONMOTORPARKING_INFO info = new NetSDKLib.DEV_EVENT_CITY_NONMOTORPARKING_INFO();
                ToolKits.GetPointerData(pAlarmInfo, info);
                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
//                System.out.println(JSON.toJSONString(info));
//                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
                videoAlarmReport.setAlarmTime(LocalDateTime.of(info.UTC.dwYear, info.UTC.dwMonth, info.UTC.dwDay, info.UTC.dwHour, info.UTC.dwMinute, info.UTC.dwSecond));
                VideoPoint videoPoint = videoPointService.getByChannelId(info.nChannelID);
                videoAlarmReport.setChannel(String.valueOf(info.nChannelID));
                videoAlarmReport.setAlarmId(String.valueOf(info.nEventID));
                videoAlarmReport.setAlarmName("非机动车乱停放");
                if (videoPoint != null) {
                    videoAlarmReport.setPlatResourceId(videoPoint.getPlatResourceId());
                }
                stuFileInfo = info.stuFileInfo;
                System.out.println(
                        " 城市非机动车违停事件 时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "检测到的物体个数:" + info.nObjectNum);
//                System.out.println(
//                        " 城市非机动车违停事件 时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "检测到的物体个数:" + info.nObjectNum);
                break;
            }
            case EVENT_IVS_HOLD_UMBRELLA: /// 6 违规撑伞检测事件
@@ -212,20 +201,16 @@
                NetSDKLib.DEV_EVENT_HOLD_UMBRELLA_INFO info = new NetSDKLib.DEV_EVENT_HOLD_UMBRELLA_INFO();
                ToolKits.GetPointerData(pAlarmInfo, info);
                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
//                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
                videoAlarmReport.setAlarmTime(LocalDateTime.of(info.UTC.dwYear, info.UTC.dwMonth, info.UTC.dwDay, info.UTC.dwHour, info.UTC.dwMinute, info.UTC.dwSecond));
                VideoPoint videoPoint = videoPointService.getByChannelId(info.nChannelID);
                videoAlarmReport.setChannel(String.valueOf(info.nChannelID));
                videoAlarmReport.setAlarmId(String.valueOf(info.nEventID));
                videoAlarmReport.setAlarmName("违规撑伞");
                if (videoPoint != null) {
                    videoAlarmReport.setPlatResourceId(videoPoint.getPlatResourceId());
                }
                stuFileInfo = info.stuFileInfo;
                System.out.println(
                        " 违规撑伞检测事件 时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "违法持续时长(单位秒)" + info.nViolationDuration);
//                System.out.println(
//                        " 违规撑伞检测事件 时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "违法持续时长(单位秒)" + info.nViolationDuration);
                break;
            }
            case EVENT_IVS_SHOPPRESENCE: /// 7 占道经营
@@ -233,20 +218,16 @@
                NetSDKLib.DEV_EVENT_SHOPPRESENCE_INFO info = new NetSDKLib.DEV_EVENT_SHOPPRESENCE_INFO();
                ToolKits.GetPointerData(pAlarmInfo, info);
                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
//                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
                videoAlarmReport.setAlarmTime(LocalDateTime.of(info.UTC.dwYear, info.UTC.dwMonth, info.UTC.dwDay, info.UTC.dwHour, info.UTC.dwMinute, info.UTC.dwSecond));
                VideoPoint videoPoint = videoPointService.getByChannelId(info.nChannelID);
                videoAlarmReport.setChannel(String.valueOf(info.nChannelID));
                videoAlarmReport.setAlarmId(String.valueOf(info.nEventID));
                videoAlarmReport.setAlarmName("占道经营");
                if (videoPoint != null) {
                    videoAlarmReport.setPlatResourceId(videoPoint.getPlatResourceId());
                }
                stuFileInfo = info.stuFileInfo;
                System.out.println(" 占道经营检测事件 时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "违法持续时长(单位秒)"
                        + info.nViolationDuration + "检测到的物体个数" + info.nObjectNum);
//                System.out.println(" 占道经营检测事件 时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "违法持续时长(单位秒)"
//                        + info.nViolationDuration + "检测到的物体个数" + info.nObjectNum);
                break;
            }
            case EVENT_IVS_DUSTBIN_OVER_FLOW: /// 9 垃圾桶满溢检测事件
@@ -254,20 +235,16 @@
                NetSDKLib.DEV_EVENT_DUSTBIN_OVER_FLOW_INFO info = new NetSDKLib.DEV_EVENT_DUSTBIN_OVER_FLOW_INFO();
                ToolKits.GetPointerData(pAlarmInfo, info);
                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
//                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
                videoAlarmReport.setAlarmTime(LocalDateTime.of(info.UTC.dwYear, info.UTC.dwMonth, info.UTC.dwDay, info.UTC.dwHour, info.UTC.dwMinute, info.UTC.dwSecond));
                VideoPoint videoPoint = videoPointService.getByChannelId(info.nChannelID);
                videoAlarmReport.setChannel(String.valueOf(info.nChannelID));
                videoAlarmReport.setAlarmId(String.valueOf(info.nEventID));
                videoAlarmReport.setAlarmName("垃圾箱满溢");
                if (videoPoint != null) {
                    videoAlarmReport.setPlatResourceId(videoPoint.getPlatResourceId());
                }
                stuFileInfo = info.stuFileInfo;
                System.out.println(" 垃圾桶满溢检测事件 时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "违法持续时长(单位秒)"
                        + info.nViolationDuration + "检测到的物体个数" + info.nObjectNum);
//                System.out.println(" 垃圾桶满溢检测事件 时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "违法持续时长(单位秒)"
//                        + info.nViolationDuration + "检测到的物体个数" + info.nObjectNum);
                break;
            }
            case EVENT_IVS_GARBAGE_PLASTICBAG: /// 10 打包垃圾
@@ -275,20 +252,16 @@
                NetSDKLib.DEV_EVENT_GARBAGE_EXPOSURE_INFO info = new NetSDKLib.DEV_EVENT_GARBAGE_EXPOSURE_INFO();
                ToolKits.GetPointerData(pAlarmInfo, info);
                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
//                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
                videoAlarmReport.setAlarmTime(LocalDateTime.of(info.UTC.dwYear, info.UTC.dwMonth, info.UTC.dwDay, info.UTC.dwHour, info.UTC.dwMinute, info.UTC.dwSecond));
                VideoPoint videoPoint = videoPointService.getByChannelId(info.nChannelID);
                videoAlarmReport.setChannel(String.valueOf(info.nChannelID));
                videoAlarmReport.setAlarmId(String.valueOf(info.nEventID));
                videoAlarmReport.setAlarmName("打包垃圾");
                if (videoPoint != null) {
                    videoAlarmReport.setPlatResourceId(videoPoint.getPlatResourceId());
                }
                stuFileInfo = info.stuFileInfo;
                System.out.println(" 打包垃圾检测事件  时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "违法持续时长(单位秒)"
                        + info.nViolationDuration + "检测到的物体个数" + info.nObjectNum);
//                System.out.println(" 打包垃圾检测事件  时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "违法持续时长(单位秒)"
//                        + info.nViolationDuration + "检测到的物体个数" + info.nObjectNum);
                break;
            }
            case EVENT_IVS_DOOR_FRONT_DIRTY: /// < 门前脏乱检测事件
@@ -296,8 +269,8 @@
                NetSDKLib.DEV_EVENT_DOOR_FRONT_DIRTY_INFO msg = new NetSDKLib.DEV_EVENT_DOOR_FRONT_DIRTY_INFO();
                ToolKits.GetPointerData(pAlarmInfo, msg);
                stuFileInfo = msg.stuFileInfo;
                System.out.println(" 门前脏乱检测事件  时间(UTC):" + msg.UTC + " 通道号:" + msg.nChannelID + "违法持续时长(单位秒)"
                        + msg.nViolationDuration + "检测到的物体个数" + msg.nObjectNum);
//                System.out.println(" 门前脏乱检测事件  时间(UTC):" + msg.UTC + " 通道号:" + msg.nChannelID + "违法持续时长(单位秒)"
//                        + msg.nViolationDuration + "检测到的物体个数" + msg.nObjectNum);
                break;
            }
            case EVENT_IVS_GARBAGE_EXPOSURE: /// 11 垃圾暴露检测事件
@@ -305,20 +278,16 @@
                NetSDKLib.DEV_EVENT_GARBAGE_EXPOSURE_INFO info = new NetSDKLib.DEV_EVENT_GARBAGE_EXPOSURE_INFO();
                ToolKits.GetPointerData(pAlarmInfo, info);
                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
//                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
                videoAlarmReport.setAlarmTime(LocalDateTime.of(info.UTC.dwYear, info.UTC.dwMonth, info.UTC.dwDay, info.UTC.dwHour, info.UTC.dwMinute, info.UTC.dwSecond));
                VideoPoint videoPoint = videoPointService.getByChannelId(info.nChannelID);
                videoAlarmReport.setChannel(String.valueOf(info.nChannelID));
                videoAlarmReport.setAlarmId(String.valueOf(info.nEventID));
                videoAlarmReport.setAlarmName("暴露垃圾");
                if (videoPoint != null) {
                    videoAlarmReport.setPlatResourceId(videoPoint.getPlatResourceId());
                }
                stuFileInfo = info.stuFileInfo;
                System.out.println(" 垃圾暴露检测事件  时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "违法持续时长(单位秒)"
                        + info.nViolationDuration + "检测到的物体个数" + info.nObjectNum);
//                System.out.println(" 垃圾暴露检测事件  时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + "违法持续时长(单位秒)"
//                        + info.nViolationDuration + "检测到的物体个数" + info.nObjectNum);
                break;
            }
            case EVENT_IVS_VIOLENT_THROW_DETECTION: /// < 暴力抛物事件事件
@@ -330,8 +299,8 @@
                    ToolKits.savePicture(pBuffer, msg.stuSceneImage.nOffSet, msg.stuSceneImage.nLength, bigPicture);
                }
                stuFileInfo = msg.stuFileInfo;
                System.out.println(" 暴力抛物事件事件  时间(UTC):" + msg.UTC + " 通道号:" + msg.nChannelID + "暴力抛物检测区域名称"
                        + new String(msg.szRegionName, Charset.forName(Utils.getPlatformEncode())));
//                System.out.println(" 暴力抛物事件事件  时间(UTC):" + msg.UTC + " 通道号:" + msg.nChannelID + "暴力抛物检测区域名称"
//                        + new String(msg.szRegionName, Charset.forName(Utils.getPlatformEncode())));
                break;
            }
            case EVENT_IVS_SHOP_WINDOW_POST:// 橱窗张贴事件
@@ -339,9 +308,9 @@
                DEV_EVENT_SHOP_WINDOW_POST_INFO info = new DEV_EVENT_SHOP_WINDOW_POST_INFO();
                ToolKits.GetPointerData(pAlarmInfo, info);
                stuFileInfo = info.stuFileInfo;
                System.out.println(" 橱窗张贴事件  时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + " 商铺地址: "
                        + new String(info.szShopAddress, Charset.forName(Utils.getPlatformEncode())).trim() + " 违法持续时间: "
                        + info.nViolationDuration + " 检测到的物体数量: " + info.nObjectNum);
//                System.out.println(" 橱窗张贴事件  时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + " 商铺地址: "
//                        + new String(info.szShopAddress, Charset.forName(Utils.getPlatformEncode())).trim() + " 违法持续时间: "
//                        + info.nViolationDuration + " 检测到的物体数量: " + info.nObjectNum);
                for (int i = 0; i < info.nObjectNum; i++) {
                    stPicInfo = info.stuObjects[i].stPicInfo;
                    if (stPicInfo != null && stPicInfo.dwFileLenth > 0) {
@@ -360,20 +329,16 @@
                DEV_EVENT_STREET_SUNCURE_INFO info = new DEV_EVENT_STREET_SUNCURE_INFO();
                ToolKits.GetPointerData(pAlarmInfo, info);
                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
//                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
                videoAlarmReport.setAlarmTime(LocalDateTime.of(info.UTC.dwYear, info.UTC.dwMonth, info.UTC.dwDay, info.UTC.dwHour, info.UTC.dwMinute, info.UTC.dwSecond));
                VideoPoint videoPoint = videoPointService.getByChannelId(info.nChannelID);
                videoAlarmReport.setChannel(String.valueOf(info.nChannelID));
                videoAlarmReport.setAlarmId(String.valueOf(info.nEventID));
                videoAlarmReport.setAlarmName("沿街晾挂");
                if (videoPoint != null) {
                    videoAlarmReport.setPlatResourceId(videoPoint.getPlatResourceId());
                }
                stuFileInfo = info.stuFileInfo;
                System.out.println(" 沿街晾晒事件  时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + " 违法持续时间: "
                        + info.nViolationDuration + " 检测到的物体数量: " + info.nObjectNum);
//                System.out.println(" 沿街晾晒事件  时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + " 违法持续时间: "
//                        + info.nViolationDuration + " 检测到的物体数量: " + info.nObjectNum);
                break;
            }
@@ -382,20 +347,16 @@
                DEV_EVENT_OUTDOOR_ADVERTISEMENT_INFO info = new DEV_EVENT_OUTDOOR_ADVERTISEMENT_INFO();
                ToolKits.GetPointerData(pAlarmInfo, info);
                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
//                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
                videoAlarmReport.setAlarmTime(LocalDateTime.of(info.UTC.dwYear, info.UTC.dwMonth, info.UTC.dwDay, info.UTC.dwHour, info.UTC.dwMinute, info.UTC.dwSecond));
                VideoPoint videoPoint = videoPointService.getByChannelId(info.nChannelID);
                videoAlarmReport.setChannel(String.valueOf(info.nChannelID));
                videoAlarmReport.setAlarmId(String.valueOf(info.nEventID));
                videoAlarmReport.setAlarmName("违规户外广告");
                if (videoPoint != null) {
                    videoAlarmReport.setPlatResourceId(videoPoint.getPlatResourceId());
                }
                stuFileInfo = info.stuFileInfo;
                System.out.println(" 户外广告事件  时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + " 违法持续时间: "
                        + info.nViolationDuration + " 检测到的物体数量: " + info.nObjectNum);
//                System.out.println(" 户外广告事件  时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + " 违法持续时间: "
//                        + info.nViolationDuration + " 检测到的物体数量: " + info.nObjectNum);
                break;
@@ -404,20 +365,16 @@
            {
                DEV_EVENT_HUDDLE_MATERIAL_INFO info = new DEV_EVENT_HUDDLE_MATERIAL_INFO();
                ToolKits.GetPointerData(pAlarmInfo, info);
                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
//                videoAlarmReport.setAlarmObj(JSON.toJSONString(info));
                videoAlarmReport.setAlarmTime(LocalDateTime.of(info.UTC.dwYear, info.UTC.dwMonth, info.UTC.dwDay, info.UTC.dwHour, info.UTC.dwMinute, info.UTC.dwSecond));
                VideoPoint videoPoint = videoPointService.getByChannelId(info.nChannelID);
                videoAlarmReport.setChannel(String.valueOf(info.nChannelID));
                videoAlarmReport.setAlarmId(String.valueOf(info.nEventID));
                videoAlarmReport.setAlarmName("乱堆物料");
                if (videoPoint != null) {
                    videoAlarmReport.setPlatResourceId(videoPoint.getPlatResourceId());
                }
                stuFileInfo = info.stuFileInfo;
                System.out.println(" 乱堆物料检测事件  时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + " 违法持续时间: "
                        + info.nViolationDuration + " 检测到的物体数量: " + info.nObjectNum);
//                System.out.println(" 乱堆物料检测事件  时间(UTC):" + info.UTC + " 通道号:" + info.nChannelID + " 违法持续时间: "
//                        + info.nViolationDuration + " 检测到的物体数量: " + info.nObjectNum);
//                for (int i = 0; i < info.nObjectNum; i++) {
//                    stPicInfo = info.stuObjects[i].stPicInfo;
//                    if (stPicInfo != null && stPicInfo.dwFileLenth > 0) {
@@ -439,17 +396,17 @@
                ToolKits.GetPointerDataToStruct(pAlarmInfo, 0, trashEvent);
                String date = trashEvent.UTC.toStringTime();
                System.out.println("nChannelID = " + trashEvent.nChannelID);
                System.out.println("szName(GBK) = " + new String(trashEvent.szName, Charset.forName("GBK")));
                System.out.println("szName(UTF-8) = " + new String(trashEvent.szName, Charset.forName("UTF-8")));
                System.out.println("nImageInfoNum = " + trashEvent.nImageInfoNum);
                System.out.println("UTC = " + trashEvent.UTC.toStringTime());
//                System.out.println("nChannelID = " + trashEvent.nChannelID);
//                System.out.println("szName(GBK) = " + new String(trashEvent.szName, Charset.forName("GBK")));
//                System.out.println("szName(UTF-8) = " + new String(trashEvent.szName, Charset.forName("UTF-8")));
//                System.out.println("nImageInfoNum = " + trashEvent.nImageInfoNum);
//                System.out.println("UTC = " + trashEvent.UTC.toStringTime());
                // save the picture
                String imageName = "trashEvent_" + trashEvent.UTC.toStringTitle() + ".jpg";
                String savePath = picturePath + "/" + imageName;
                ToolKits.savePicture(pBuffer, dwBufSize, savePath);
                System.out.println("save picture to " + savePath);
//                System.out.println("save picture to " + savePath);
                break;
            }
@@ -471,21 +428,16 @@
//                        stuFileInfo.bFileType, stuFileInfo.nGroupId);
//                ToolKits.savePicture(pBuffer, stPicInfo.dwOffSet, stPicInfo.dwFileLenth, smallPicture);
//            }
            try {
                String extension = "jpg";
                String picData = ossService.uploadImages(new ByteArrayInputStream(pBuffer.getByteArray(stPicInfo.dwOffSet, dwBufSize)), extension);
                videoAlarmReport.setPicData(picData);
            } catch (Exception ex) {
                System.out.println("保存图片错误:" + ex.getMessage());
            }
//            try {
            byte[] bytes = pBuffer.getByteArray(0, dwBufSize);
            videoAlarmReport.setPicByte(bytes);
//            } catch (Exception ex) {
//                System.out.println("保存图片错误:");
//                System.out.println(ex);
//            }
        }
        videoAlarmReportService.save(videoAlarmReport);
        List<VideoAlarmReport> videoAlarmReports = new ArrayList<>();
        videoAlarmReports.add(videoAlarmReport);
        violationsService.saveFromVideo(videoAlarmReports);
        if (!StringUtils.isEmpty(videoAlarmReport.getAlarmName()))
            GlobalQueue.add(videoAlarmReport);
        return 0;
    }