| | |
| | | * 通道名(monitor的设备名) |
| | | */ |
| | | private String name; |
| | | /** |
| | | * OSD4、5都可能为名字,两条一起比对 |
| | | */ |
| | | private String name2; |
| | | |
| | | //osd左下 |
| | | /** |
| | | * 固、枪、路、西北 |
| | |
| | | osdResult.setOSD3(osdStr); |
| | | }else if(num ==3){ |
| | | osdResult.setName(osdStr); |
| | | }else if(num ==4){ |
| | | osdResult.setName2(osdStr); |
| | | } |
| | | } |
| | | num++; |
| | |
| | | package com.ycl.api.HK; |
| | | |
| | | import com.ycl.platform.domain.result.OSDResult; |
| | | import com.ycl.utils.StringUtils; |
| | | import constant.ApiConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.http.HttpResponse; |
| | |
| | | if (OSDString == null) return null; |
| | | |
| | | //解析xml |
| | | parseXMl(OSDString, "TextOverlay", "displayText", osdResult, null,ip); |
| | | parseXMl(OSDString, "TextOverlay", "displayText", osdResult, null, ip); |
| | | //获取Time |
| | | String timeString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_TIME, userName, password); |
| | | if (timeString == null) return null; |
| | | |
| | | Date date = new Date(); |
| | | //解析xml |
| | | parseXMl(timeString, "Time", "localTime", osdResult, date,ip); |
| | | parseXMl(timeString, "Time", "localTime", osdResult, date, ip); |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | return osdResult; |
| | | } |
| | | |
| | | private static void parseXMl(String OSDString, String tagName1, String tagName2, OSDResult osdResult, Date date,String ip) throws ParserConfigurationException, SAXException, IOException { |
| | | private static void parseXMl(String OSDString, String tagName1, String tagName2, OSDResult osdResult, Date date, String ip) throws ParserConfigurationException, SAXException, IOException { |
| | | |
| | | try { |
| | | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
| | |
| | | Node node = nodeList.item(i); |
| | | if (node.getNodeType() == Node.ELEMENT_NODE && "TextOverlay".equals(tagName1)) { |
| | | Element element = (Element) node; |
| | | String id = element.getElementsByTagName("id").item(0).getTextContent(); |
| | | String textContent = element.getElementsByTagName(tagName2).item(0).getTextContent(); |
| | | // log.info("TEXT : " + textContent); |
| | | if ("1".equals(id)) { |
| | | // log.info("TEXT : " + textContent); |
| | | if (i == 0) { |
| | | osdResult.setOSD1(textContent); |
| | | } else if ("2".equals(id)) { |
| | | } else if (i == 1) { |
| | | osdResult.setOSD2(textContent); |
| | | } else if ("3".equals(id)) { |
| | | } else if (i == 2) { |
| | | osdResult.setOSD3(textContent); |
| | | } else if ("4".equals(id)) { |
| | | } else if (i == 3) { |
| | | osdResult.setName(textContent); |
| | | } else if ("5".equals(id)) { |
| | | osdResult.setName2(textContent); |
| | | } else if ("7".equals(id)) { |
| | | } else if (i == 4) { |
| | | osdResult.setOSD4(textContent); |
| | | } |
| | | } else if (node.getNodeType() == Node.ELEMENT_NODE && "Time".equals(tagName1)) { |
| | | Element element = (Element) node; |
| | | String textContent = element.getElementsByTagName(tagName2).item(0).getTextContent(); |
| | | // log.info("TEXT : " + textContent); |
| | | // log.info("TEXT : " + textContent); |
| | | osdResult.setCheckTime(date); |
| | | OffsetDateTime dateTime = OffsetDateTime.parse(textContent); |
| | | // 将OffsetDateTime转换为Date对象 |
| | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("ip:{}出现异常,{}",ip,e.getMessage()); |
| | | throw new RuntimeException(e.getMessage()); |
| | | log.error("ip:{}出现异常,{}", ip, e.getMessage()); |
| | | throw new RuntimeException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import com.sun.jna.Pointer; |
| | | import com.sun.jna.ptr.IntByReference; |
| | | import com.ycl.api.DH.lib.ToolKits; |
| | | import com.ycl.api.DH.utils.DHApi; |
| | | import com.ycl.api.YS.lib.NetDEVSDKLib; |
| | | import com.ycl.api.YS.login.Login; |
| | | import com.ycl.api.YS.util.Common; |
| | | import com.ycl.platform.domain.result.OSDResult; |
| | | import com.ycl.utils.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import javax.swing.*; |
| | | import javax.swing.table.DefaultTableModel; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Vector; |
| | | |
| | | import static com.ycl.api.YS.lib.NetDEVSDKLib.NETDEV_LOGIN_PROTO_E.NETDEV_LOGIN_PROTO_ONVIF; |
| | | |
| | | @Slf4j |
| | | public class YSApi { |
| | | |
| | | public static OSDResult getOsd(String ip, String userName, String password){ |
| | | log.info("ip:{},用户:{},密码:{}",ip,userName,password); |
| | | public static OSDResult getOsd(String ip, String userName, String password) { |
| | | log.info("ip:{},用户:{},密码:{}", ip, userName, password); |
| | | //登录 |
| | | NetDEVSDKLib.NETDEV_DEVICE_LOGIN_INFO_S stDevLoginInfo = new NetDEVSDKLib.NETDEV_DEVICE_LOGIN_INFO_S(); |
| | | NetDEVSDKLib.NETDEV_SELOG_INFO_S stSELogInfo = new NetDEVSDKLib.NETDEV_SELOG_INFO_S(); |
| | | // System.arraycopy(userName.getBytes(), 0, stDevLoginInfo.szUserName, 0, userName.getBytes().length); |
| | | // System.arraycopy(password.getBytes(), 0, stDevLoginInfo.szPassword, 0, password.getBytes().length); |
| | | // System.arraycopy(ip.getBytes(), 0, stDevLoginInfo.szIPAddr, 0, ip.getBytes().length); |
| | | stDevLoginInfo.szUserName = userName.getBytes(); |
| | | stDevLoginInfo.szPassword = password.getBytes(); |
| | | stDevLoginInfo.szIPAddr = ip.getBytes(); |
| | | System.arraycopy(userName.getBytes(), 0, stDevLoginInfo.szUserName, 0, userName.getBytes().length); |
| | | System.arraycopy(password.getBytes(), 0, stDevLoginInfo.szPassword, 0, password.getBytes().length); |
| | | System.arraycopy(ip.getBytes(), 0, stDevLoginInfo.szIPAddr, 0, ip.getBytes().length); |
| | | stDevLoginInfo.dwPort = 80; |
| | | //登录协议 |
| | | stDevLoginInfo.dwLoginProto = NETDEV_LOGIN_PROTO_ONVIF; |
| | | log.info("SDK传参ip:{},用户:{},密码:{}",stDevLoginInfo.szIPAddr,stDevLoginInfo.szUserName,stDevLoginInfo.szPassword); |
| | | Pointer lpUserID = YSInit.netdevsdk.NETDEV_Login_V30(stDevLoginInfo, stSELogInfo); |
| | | Pointer lpUserID = YSInit.netdevsdk.NETDEV_Login_V30(stDevLoginInfo, stSELogInfo); |
| | | if (lpUserID != null) { |
| | | OSDResult osdResult = new OSDResult(); |
| | | //获取通道 |
| | | int nMaxChlCount = 256; |
| | | IntByReference dwChlCount = new IntByReference(nMaxChlCount); |
| | | NetDEVSDKLib.NETDEV_VIDEO_CHL_DETAIL_INFO_EX_S[] stVideoChlList = (NetDEVSDKLib.NETDEV_VIDEO_CHL_DETAIL_INFO_EX_S[]) new NetDEVSDKLib.NETDEV_VIDEO_CHL_DETAIL_INFO_EX_S().toArray(nMaxChlCount); |
| | | boolean bRe = YSInit.netdevsdk.NETDEV_QueryVideoChlDetailListEx(lpUserID, dwChlCount, stVideoChlList); |
| | | if (!bRe) { |
| | | log.error("error code" + YSInit.netdevsdk.NETDEV_GetLastError()); |
| | | return null; |
| | | } |
| | | //获取时间 |
| | | NetDEVSDKLib.NETDEV_TIME_CFG_S stTimeCfg = new NetDEVSDKLib.NETDEV_TIME_CFG_S(); |
| | | stTimeCfg.write(); |
| | | boolean bRetime = NetDemo.netdevsdk.NETDEV_GetSystemTimeCfg(lpUserID, stTimeCfg); |
| | | if (!bRetime) { |
| | | log.error("error code" + YSInit.netdevsdk.NETDEV_GetLastError()); |
| | | return null; |
| | | } else { |
| | | stTimeCfg.read(); |
| | | String strTime = "" + stTimeCfg.stTime.dwYear + "-"; |
| | | if (stTimeCfg.stTime.dwMonth < 10) { |
| | | strTime += "0"; |
| | | } |
| | | strTime = strTime + stTimeCfg.stTime.dwMonth + "-"; |
| | | if (stTimeCfg.stTime.dwDay < 10) { |
| | | strTime += "0"; |
| | | } |
| | | strTime = strTime + stTimeCfg.stTime.dwDay + " "; |
| | | if (stTimeCfg.stTime.dwHour < 10) { |
| | | strTime += "0"; |
| | | } |
| | | strTime = strTime + stTimeCfg.stTime.dwHour + ":"; |
| | | if (stTimeCfg.stTime.dwMinute < 10) { |
| | | strTime += "0"; |
| | | } |
| | | strTime = strTime + stTimeCfg.stTime.dwMinute + ":"; |
| | | |
| | | log.info("登录返回id:{}",lpUserID); |
| | | if(lpUserID !=null) { |
| | | log.info("登录成功"); |
| | | if (stTimeCfg.stTime.dwSecond < 10) { |
| | | strTime += "0"; |
| | | } |
| | | strTime = strTime + stTimeCfg.stTime.dwSecond; |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | try { |
| | | osdResult.setOsdTime(format.parse(strTime)); |
| | | } catch (Exception e) { |
| | | log.error(ip + "时间解析有误"); |
| | | } |
| | | } |
| | | //获取osd |
| | | NetDEVSDKLib.NETDEV_VIDEO_OSD_CFG_S stOSDInfo = new NetDEVSDKLib.NETDEV_VIDEO_OSD_CFG_S(); |
| | | stOSDInfo.write(); |
| | | IntByReference dwBytesReturned = new IntByReference(); |
| | | |
| | | boolean bRet = YSInit.netdevsdk.NETDEV_GetDevConfig(lpUserID, 0, NetDEVSDKLib.NETDEV_CONFIG_COMMAND_E.NETDEV_GET_OSDCFG, stOSDInfo.getPointer(), 616, dwBytesReturned); |
| | | boolean bRet = YSInit.netdevsdk.NETDEV_GetDevConfig(lpUserID, stVideoChlList[0].dwChannelID, NetDEVSDKLib.NETDEV_CONFIG_COMMAND_E.NETDEV_GET_OSDCFG, stOSDInfo.getPointer(), 616, dwBytesReturned); |
| | | if (!bRet) { |
| | | log.error("error code"+YSInit.netdevsdk.NETDEV_GetLastError()); |
| | | log.error("error code" + YSInit.netdevsdk.NETDEV_GetLastError()); |
| | | return null; |
| | | } |
| | | stOSDInfo.read(); |
| | | //省份 |
| | | String name = new String(stOSDInfo.stNameOSD.szOSDText, StandardCharsets.UTF_8); |
| | | osdResult.setOSD1(name); |
| | | int num = 0; |
| | | for (NetDEVSDKLib.NETDEV_OSD_TEXT_OVERLAY_S osd : stOSDInfo.astTextOverlay) { |
| | | String text = new String(osd.szOSDText, StandardCharsets.UTF_8); |
| | | log.info("text:" + text); |
| | | String text = new String(osd.szOSDText, StandardCharsets.UTF_8).trim(); |
| | | if (num == 0) { |
| | | osdResult.setOSD2(text); |
| | | } else if (num == 1) { |
| | | osdResult.setOSD3(text); |
| | | } else if (num == 2) { |
| | | osdResult.setName(text); |
| | | } else if (num == 3) { |
| | | osdResult.setOSD4(text); |
| | | } |
| | | num++; |
| | | } |
| | | //登出 |
| | | YSInit.netdevsdk.NETDEV_Logout(lpUserID); |
| | | }else { |
| | | log.error("error code"+YSInit.netdevsdk.NETDEV_GetLastError()); |
| | | return osdResult; |
| | | } else { |
| | | log.error("error code" + YSInit.netdevsdk.NETDEV_GetLastError()); |
| | | } |
| | | return null; |
| | | } |
| | | public static void demo(){ |
| | | |
| | | public static void demo() { |
| | | Login.loginIn(); |
| | | } |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.swing.*; |
| | | import java.io.File; |
| | | |
| | | @Component |
| | |
| | | file.mkdir(); |
| | | } |
| | | |
| | | NetDEVSDKLib.NETDEV_REV_TIMEOUT_S pstRevTimeout=new NetDEVSDKLib.NETDEV_REV_TIMEOUT_S(); |
| | | pstRevTimeout.dwRevTimeOut=2; |
| | | pstRevTimeout.dwFileReportTimeOut=30; |
| | | pstRevTimeout.write(); |
| | | boolean rbet1=netdevsdk.NETDEV_SetRevTimeOut(pstRevTimeout); |
| | | boolean rbet2=netdevsdk.NETDEV_SetConnectTime(2, 1); |
| | | |
| | | |
| | | } |
| | | } |
| | | @PreDestroy |
| | |
| | | import com.sun.jna.Library; |
| | | import com.sun.jna.Native; |
| | | import com.sun.jna.Pointer; |
| | | |
| | | import com.sun.jna.Structure; |
| | | import com.sun.jna.ptr.IntByReference; |
| | | import com.sun.jna.ptr.LongByReference; |
| | |
| | | * @brief 设备登录信息 |
| | | * @attention |
| | | */ |
| | | @Structure.FieldOrder({"byRes", "dwDeviceType" ,"dwLoginProto","dwPort","szIPAddr","szPassword","szUserName"}) |
| | | @Structure.FieldOrder({"szIPAddr", "dwPort" ,"szUserName","szPassword","dwLoginProto","dwDeviceType","byRes"}) |
| | | public class NETDEV_DEVICE_LOGIN_INFO_S extends Structure |
| | | { |
| | | public byte[] szIPAddr = new byte[NETDEV_LEN_260]; /* IP地址/域名 */ |
| | |
| | | * @brief 安全登录信息 |
| | | * @attention |
| | | */ |
| | | @Structure.FieldOrder({"byRes", "dwSELogCount","dwSELogTime"}) |
| | | @Structure.FieldOrder({"dwSELogCount", "dwSELogTime","byRes"}) |
| | | public class NETDEV_SELOG_INFO_S extends Structure { |
| | | public int dwSELogCount; /* 安全登录次数 */ |
| | | public int dwSELogTime; /* 安全登录时间 */ |
| | |
| | | * @brief 视频通道详细信息 结构体定义 Structure definition |
| | | * @attention 无 None |
| | | */ |
| | | @Structure.FieldOrder({"dwChannelID","bPtzSupported","enStatus","dwStreamNum","enChannelType","enVideoFormat","enAddressType", "szIPAddr","dwPort", |
| | | "szChnName","allowDistribution","dwDeviceType","szManufacturer","szDeviceModel","udwAccessProtocol","pstExtendedInformation","byRes"}) |
| | | public class NETDEV_VIDEO_CHL_DETAIL_INFO_EX_S extends Structure { |
| | | public int dwChannelID; /* 通道ID Channel ID */ |
| | | public int bPtzSupported; /* 是否支持云台 Whether ptz is supported */ |
| | |
| | | * @brief 超时时间 结构体定义 Timeout structure definition |
| | | * @attention |
| | | */ |
| | | @Structure.FieldOrder({"dwRevTimeOut", "dwFileReportTimeOut","byRes"}) |
| | | public class NETDEV_REV_TIMEOUT_S extends Structure { |
| | | public int dwRevTimeOut; /* 设置接收超时时间 Set timeout for receiving */ |
| | | public int dwFileReportTimeOut; /* 设置文件操作超时时间 Set timeout for file operation */ |
| | |
| | | * @brief OSD时间配置信息 OSD time configuration information |
| | | * @attention 无 None |
| | | */ |
| | | @Structure.FieldOrder({"bEnableFlag", "bWeekEnableFlag","stAreaScope","udwDateFormat","udwTimeFormat"}) |
| | | @Structure.FieldOrder({"bEnableFlag", "bWeekEnableFlag","stAreaScope","udwTimeFormat","udwDateFormat"}) |
| | | public class NETDEV_OSD_TIME_S extends Structure { |
| | | public int bEnableFlag; /** 时间OSD使能, BOOL_TRUE为使能,BOOL_FALSE为非使能 * Enable time OSD, BOOL_TRUE means enable and BOOL_FALSE means disable */ |
| | | public int bWeekEnableFlag; /** 是否显示星期(预留) * Display week or not (reserved) */ |
| | |
| | | * @brief OSD字符叠加信息 OSD text overlay information |
| | | * @attention |
| | | */ |
| | | @Structure.FieldOrder({"bEnableFlag", "byRes","stAreaScope","szOSDText"}) |
| | | @Structure.FieldOrder({"bEnableFlag", "stAreaScope","szOSDText","byRes"}) |
| | | public class NETDEV_OSD_TEXT_OVERLAY_S extends Structure { |
| | | public int bEnableFlag; /** OSD字符叠加使能, BOOL_TRUE为使能,BOOL_FALSE为非使能 * Enable OSD text overlay, BOOL_TRUE means enable and BOOL_FALSE means disable */ |
| | | public NETDEV_AREA_SCOPE_S stAreaScope; /** OSD字符叠加区域坐标 * OSD text overlay area coordinates */ |
| | |
| | | * @brief 通道OSD的基本属性信息 Basic channel OSD information |
| | | * @attention |
| | | */ |
| | | @Structure.FieldOrder({"astTextOverlay", "stNameOSD","stTimeOSD","wTextNum"}) |
| | | @Structure.FieldOrder({"stTimeOSD", "stNameOSD","wTextNum","astTextOverlay"}) |
| | | public class NETDEV_VIDEO_OSD_CFG_S extends Structure { |
| | | public NETDEV_OSD_TIME_S stTimeOSD; /* 通道的时间OSD信息 Information of channel time OSD */ |
| | | public NETDEV_OSD_TEXT_OVERLAY_S stNameOSD; /* 通道的名称OSD信息 Information of channel name OSD */ |
| | |
| | | * @brief 时间配置 结构体定义 Time configuration structure definition |
| | | * @attention |
| | | */ |
| | | @Structure.FieldOrder({"dwMonth", "dwWeekInMonth" ,"dwDayInWeek","dwHour"}) |
| | | public class NETDEV_TIME_DST_S extends Structure{ |
| | | public int dwMonth; /* 月(1~12) Month(1~12)*/ |
| | | public int dwWeekInMonth; /* 每月的第N周(1~5) 1 for the first week and 5 for the last week in the month */ |
| | |
| | | * @brief 时间配置 结构体定义 Time configuration structure definition |
| | | * @attention |
| | | */ |
| | | @Structure.FieldOrder({"stBeginTime", "stEndTime" ,"dwOffsetTime"}) |
| | | public class NETDEV_TIME_DST_CFG_S extends Structure{ |
| | | public NETDEV_TIME_DST_S stBeginTime; /* 夏令时开始时间 参见枚举#NETDEV_TIME_DST_S DST begin time see enumeration NETDEV_TIME_DST_S */ |
| | | public NETDEV_TIME_DST_S stEndTime; /* 夏令时结束时间 参见枚举#NETDEV_TIME_DST_S DST end time see enumeration NETDEV_TIME_DST_S */ |
| | |
| | | * @brief 时间参数 结构体定义 Time parameter Structure definition |
| | | * @attention 无 None |
| | | */ |
| | | @Structure.FieldOrder({"dwYear", "dwMonth" ,"dwDay","dwHour","dwMinute","dwSecond"}) |
| | | public class NETDEV_TIME_S extends Structure{ |
| | | public int dwYear; /* 年 Year */ |
| | | public int dwMonth; /* 月 Month */ |
| | |
| | | * @brief 时间配置 结构体定义 Time configuration structure definition |
| | | * @attention |
| | | */ |
| | | @Structure.FieldOrder({"dwTimeZone", "stTime" ,"bEnableDST","stTimeDSTCfg","udwDateFormat","udwHourFormat","byRes"}) |
| | | public class NETDEV_TIME_CFG_S extends Structure{ |
| | | public int dwTimeZone; /* 时区 参见枚举# NETDEV_TIME_ZONE_E Time zone, see enumeration #NETDEV_TIME_ZONE_E */ |
| | | public NETDEV_TIME_S stTime; /* 时间 Time */ |
| | |
| | | * @return TRUE表示成功,其他表示失败 TRUE means success, and any other value means failure. |
| | | * @note |
| | | */ |
| | | |
| | | public boolean NETDEV_SetConnectTime(int dwWaitTime, int dwTrytimes); |
| | | |
| | | /** |
| | |
| | | public BigDecimal viewConnectStability(Map<String, Object> param) { |
| | | BigDecimal totalDataSum = new BigDecimal((Integer) param.get("totalDataSum")); |
| | | BigDecimal avgCount = (BigDecimal) param.get("avgCount"); |
| | | log.info("视图库对接稳定性,totalDataSum:{},avgCount:{}",totalDataSum,avgCount); |
| | | return BigDecimal.ZERO.compareTo(totalDataSum) == 0 ? BigDecimal.ZERO : avgCount.divide(totalDataSum, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //标注正确率 |
| | | |
| | | public BigDecimal infoAccuracy(Map<String, Object> param) { |
| | | BigDecimal totalSitesCount = new BigDecimal((Integer) param.get("totalSites")); |
| | | BigDecimal qualifySiteCount = new BigDecimal((Integer) param.get("qualifySite")); |
| | |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "列表", notes = "列表") |
| | | @PreAuthorize("@ss.hasPermi('point:list')") |
| | | // @PreAuthorize("@ss.hasPermi('point:list')") |
| | | public Result list() { |
| | | return ywPointService.all(); |
| | | } |
| | |
| | | import com.mongodb.client.result.DeleteResult; |
| | | import com.ycl.api.DH.utils.DHApi; |
| | | import com.ycl.api.HK.HKApi; |
| | | import com.ycl.api.YS.YSApi; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.result.OSDResult; |
| | | import com.ycl.platform.domain.result.UY.MonitorQualifyResult; |
| | |
| | | */ |
| | | public void getOSD() { |
| | | log.info("开始获取OSD"); |
| | | // YSApi.getOsd("51.95.66.42",YSUserName,YSPassword); |
| | | //批量修改海康品牌集合 |
| | | List<String> hkList = new ArrayList<>(); |
| | | //批量修改大华品牌集合 |
| | |
| | | for (TMonitor monitor : monitors) { |
| | | executorService.submit(() -> { |
| | | if (DeviceType.HK.getType().equals(monitor.getDeviceType())) { |
| | | //海康品牌 |
| | | //海康 |
| | | OSDResult osd = HKApi.getOsdByIP(monitor.getIp(), HKUserName, HKPassword); |
| | | if (checkSuccess(osdResultList, monitor, osd)) { |
| | | log.info("海康调用成功" + osd); |
| | | return; |
| | | } |
| | | } else if (DeviceType.DH.getType().equals(monitor.getDeviceType())) { |
| | | //大华品牌 |
| | | //大华 |
| | | OSDResult osd = DHApi.getOsd(monitor.getIp(), DHUserName, DHPassword); |
| | | if (checkSuccess(osdResultList, monitor, osd)) { |
| | | log.info("大华调用成功" + osd); |
| | | return; |
| | | } |
| | | } else if (DeviceType.YS.getType().equals(monitor.getDeviceType())) { |
| | | //TODO:宇视api |
| | | //宇视 |
| | | OSDResult osd = YSApi.getOsd(monitor.getIp(), YSUserName, YSPassword); |
| | | if (checkSuccess(osdResultList, monitor, osd)) { |
| | | log.info("宇视调用成功" + osd); |
| | | return; |
| | | } |
| | | } |
| | | //未知品牌或者api调用失败,挨个执行所有api |
| | | OSDResult osd = tryAllApi(monitor, hkList, dhList, ysList); |
| | |
| | | } |
| | | //修改数据库品牌 |
| | | if (!CollectionUtils.isEmpty(hkList)) { |
| | | log.info("修改品牌"); |
| | | monitorMapper.batchUpdateDeviceType(hkList, DeviceType.HK.getType()); |
| | | } |
| | | if (!CollectionUtils.isEmpty(dhList)) { |
| | | log.info("修改品牌"); |
| | | monitorMapper.batchUpdateDeviceType(dhList, DeviceType.DH.getType()); |
| | | } |
| | | //TODO:宇视 |
| | | if (!CollectionUtils.isEmpty(ysList)) { |
| | | monitorMapper.batchUpdateDeviceType(ysList, DeviceType.YS.getType()); |
| | | } |
| | | } |
| | | log.info("结束获取OSD"); |
| | | } |
| | |
| | | } |
| | | } |
| | | //检查通道名是否正确 |
| | | //TODO:校验规则,这里暂时不比较全景和细节两字。 |
| | | //校验规则,这里暂时不比较全景和细节两字。 |
| | | if (!StringUtils.isEmpty(osdResult.getName()) && !StringUtils.isEmpty(monitor.getName())) { |
| | | if (monitor.getName().equals(osdResult.getName()) || monitor.getName().replace("全景","细节").equals(osdResult.getName()) || monitor.getName().replace("细节","全景").equals(osdResult.getName())) { |
| | | //OSD4和5都可能为名字、比较其中一条正确即可,正确了改为正确名字 |
| | | osdCheckResult.setOsdNameCorrect(ApiConstants.OSD_Correct); |
| | | osdCheckResult.setOsdName(osdResult.getName()); |
| | | }else if (monitor.getName().equals(osdResult.getName2()) || monitor.getName().replace("全景","细节").equals(osdResult.getName2()) || monitor.getName().replace("细节","全景").equals(osdResult.getName2())) { |
| | | //OSD4和5都可能为名字、比较其中一条正确即可,正确了改为正确名字 |
| | | osdCheckResult.setOsdName(osdResult.getName2()); |
| | | osdCheckResult.setOsdNameCorrect(ApiConstants.OSD_Correct); |
| | | }else { |
| | | osdCheckResult.setOsdNameCorrect(ApiConstants.OSD_Error); |
| | | } |
| | |
| | | } |
| | | return dhosd; |
| | | } |
| | | //TODO:宇视api |
| | | //宇视api |
| | | OSDResult ysosd = YSApi.getOsd(monitor.getIp(), YSUserName, YSPassword); |
| | | if (ysosd != null) { |
| | | ysosd.setSerialNumber(monitor.getSerialNumber()); |
| | | log.info("宇视调用成功"+ysosd); |
| | | synchronized (ysList) { |
| | | ysList.add(monitor.getSerialNumber()); |
| | | } |
| | | return ysosd; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | calculator.calculate(tMonitorVOS); |
| | | log.info("结束计算一机一档注册率、档案考核比"); |
| | | } |
| | | public void oneMonitorQualifyTask(){ |
| | | |
| | | public void oneMonitorQualifyTask() { |
| | | log.info("开始计算一机一档合格率"); |
| | | //计算一机一档合格率 |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | |
| | | calculator.calculate(results); |
| | | log.info("结束计算一机一档合格率"); |
| | | } |
| | | |
| | | public void platformOnlineTask() { |
| | | log.info("开始计算平台在线率"); |
| | | //计算平台在线率 |
| | |
| | | calculator.calculate(list); |
| | | log.info("结束计算平台在线率"); |
| | | } |
| | | |
| | | public void osdTask() { |
| | | log.info("开始计算Osd标注、时间准确率"); |
| | | //计算Osd标注、时间准确率 |
| | |
| | | /** |
| | | * 视频图像资源安全,需要排在平台在线率后面。 |
| | | */ |
| | | //手动打分取最近数据,前端页面加打分规则提示 |
| | | @Transactional |
| | | public void videoSecurity() { |
| | | ArrayList<ImageResourceSecurity> imageResourceSecurities = new ArrayList<>(); |
| | |
| | | count++; |
| | | } |
| | | } |
| | | imageResourceSecurity.setWeakPassword(BigDecimal.valueOf(score).divide(new BigDecimal(100),4, RoundingMode.HALF_UP)); |
| | | imageResourceSecurity.setWeakPassword(BigDecimal.valueOf(score).divide(new BigDecimal(100), 4, RoundingMode.HALF_UP)); |
| | | // 获取字典值-总数 |
| | | int onlineAssetsTotal = Integer.parseInt(DictUtils.getDictValue("online_assets_total", checkIndexVideo.getDeptName())); |
| | | imageResourceSecurity.setRiskProperty(BigDecimal.valueOf(count / onlineAssetsTotal)); |
| | | imageResourceSecurity.setCreateTime(DateUtils.getNowDate()); |
| | | imageResourceSecurities.add(imageResourceSecurity); |
| | | // 更新指标数据 |
| | | checkIndexVideo.setImageResourceSecurity(imageResourceSecurity.getPlatformOnline().add(imageResourceSecurity.getPropertyAccuracy().add(imageResourceSecurity.getWeakPassword().add(imageResourceSecurity.getRiskProperty()))).multiply(NUM)); |
| | | checkIndexVideo.setImageResourceSecurity( |
| | | imageResourceSecurity.getPlatformOnline() |
| | | .add(imageResourceSecurity.getPropertyAccuracy() |
| | | .add(imageResourceSecurity.getWeakPassword() |
| | | .add(imageResourceSecurity.getRiskProperty()))).multiply(NUM) |
| | | .add(imageResourceSecurity.getBoundaryIntegrity()).multiply(new BigDecimal("0.45")) |
| | | ); |
| | | checkIndexVideoMapper.updateById(checkIndexVideo); |
| | | } |
| | | imageResourceSecurityService.saveBatch(imageResourceSecurities); |