xiangpei
2024-08-30 10f65333417f064377b01a89064d2ce716603a07
Merge remote-tracking branch 'origin/master'
13个文件已修改
3个文件已添加
30681 ■■■■■ 已修改文件
include/NetDEVSDK.h 30394 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libs/jna.jar 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/ImageResourceSecurity.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/api/DH/module/LoginModule.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/api/HK/HKApi.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/api/YS/NetDemo.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/api/YS/YSApi.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/api/YS/YSInit.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/api/YS/lib/NetDEVSDKLib.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/ImageResourceSecurityServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/task/ImageResourceSecurityTask.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/task/OsdTask.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/application-dev.yml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/application-prod.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
include/NetDEVSDK.h
New file
Diff too large
libs/jna.jar
Binary files differ
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/ImageResourceSecurity.java
@@ -1,6 +1,7 @@
package com.ycl.platform.domain.entity;
import annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ycl.system.entity.BaseEntity;
import lombok.Data;
@@ -46,4 +47,7 @@
    @Excel(name = "视频传输网边界完整性检测扣分项")
    private BigDecimal boundaryIntegrity;
    @TableField(exist = false)
    private BigDecimal imageResourceSecurity;
}
ycl-server/src/main/java/com/ycl/api/DH/module/LoginModule.java
@@ -130,7 +130,6 @@
        // 登陆句柄
        LLong m_hLoginHandle = new LLong(0);
        m_hLoginHandle = netsdk.CLIENT_LoginWithHighLevelSecurity(pstInParam, pstOutParam);
        log.info("大华登录"+m_hLoginHandle);
        if (m_hLoginHandle.longValue() == 0) {
//            System.err.printf("Login Device[%s] Port[%d]Failed. %s\n", m_strIp, m_nPort, ToolKits.getErrorCodePrint());
        } else {
ycl-server/src/main/java/com/ycl/api/HK/HKApi.java
@@ -8,16 +8,14 @@
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.*;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -35,27 +33,30 @@
public class HKApi {
    public static OSDResult getOsdByIP(String ip, String userName, String password) {
        OSDResult osdResult = new OSDResult();
        CloseableHttpClient httpClient = HttpClients.createDefault();
        String hostUrl = "http://" + ip;
        try {
            //获取OSD
            HttpResponse OSDResponse = getHttpResponse(httpClient, hostUrl + ApiConstants.HK_OSD_PATH, userName, password);
            String OSDString = EntityUtils.toString(OSDResponse.getEntity(), "utf-8");
            String OSDString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_PATH, userName, password);
            if (OSDString == null) return null;
            //解析xml
            parseXMl(OSDString, "TextOverlay", "displayText", osdResult, null);
            parseXMl(OSDString, "TextOverlay", "displayText", osdResult, null,ip);
            //获取Time
            HttpResponse TimeResponse = getHttpResponse(httpClient, hostUrl + ApiConstants.HK_OSD_TIME, userName, password);
            String timeString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_TIME, userName, password);
            if (timeString == null) return null;
            Date date = new Date();
            String timeString = EntityUtils.toString(TimeResponse.getEntity(), "utf-8");
            //解析xml
            parseXMl(timeString, "Time", "localTime", osdResult, date);
            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) 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();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document document = builder.parse(new InputSource(new StringReader(OSDString)));
@@ -88,13 +89,21 @@
                osdResult.setOsdTime(Date.from(dateTime.toInstant()));
            }
        }
        } catch (Exception e) {
           log.error("ip:{}出现异常,{}",ip,e.getMessage());
           throw new RuntimeException(e.getMessage());
        }
    }
    private static HttpResponse getHttpResponse(CloseableHttpClient httpClient, String url, String userName, String password) throws URISyntaxException, IOException {
    private static String getHttpResponse(String url, String userName, String password) throws URISyntaxException, IOException {
        CredentialsProvider credsProvider = new BasicCredentialsProvider();
        credsProvider.setCredentials(
                new AuthScope(new URI(url).getHost(), new URI(url).getPort()),
                new UsernamePasswordCredentials(userName, password));
        // 绑定凭证提供者到HttpClient
        CloseableHttpClient httpClient = HttpClientBuilder.create()
                .setDefaultCredentialsProvider(credsProvider)
                .build();
        HttpGet httpGet = new HttpGet(url);
@@ -104,15 +113,16 @@
                .setSocketTimeout(1000)
                .build();
        httpGet.setConfig(requestConfig);
        // 绑定凭证提供者到HttpClient
        httpClient = HttpClientBuilder.create()
                .setDefaultCredentialsProvider(credsProvider)
                .build();
        try {
            return httpClient.execute(httpGet);
        } catch (Exception e){
            throw new RuntimeException("海康OSD执行失败");
        try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
            int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode == 200) {
                return EntityUtils.toString(response.getEntity(), "utf-8");
            } else {
                return null;
        }
        } catch (Exception e) {
            throw new RuntimeException("海康OSD执行失败", e);
        }
    }
}
ycl-server/src/main/java/com/ycl/api/YS/NetDemo.java
@@ -787,27 +787,27 @@
    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    NetDemo window = new NetDemo();
                    window.frame.setResizable(false);
                    window.frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
//    public static void main(String[] args) {
//        EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                try {
//                    NetDemo window = new NetDemo();
//                    window.frame.setResizable(false);
//                    window.frame.setVisible(true);
//                } catch (Exception e) {
//                    e.printStackTrace();
//                }
//            }
//        });
//    }
    /**
     * Create the application.
     */
    public NetDemo() {
        initialize();
        init();
    }
//    public NetDemo() {
//        initialize();
//        init();
//    }
    public void init() {
        String strLogPath = "./sdklog/";
ycl-server/src/main/java/com/ycl/api/YS/YSApi.java
New file
@@ -0,0 +1,64 @@
package com.ycl.api.YS;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import com.ycl.api.DH.utils.DHApi;
import com.ycl.api.YS.lib.NetDEVSDKLib;
import com.ycl.api.YS.login.Login;
import com.ycl.platform.domain.result.OSDResult;
import lombok.extern.slf4j.Slf4j;
import java.nio.charset.StandardCharsets;
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);
        //登录
        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();
        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);
        log.info("登录返回id:{}",lpUserID);
        if(lpUserID !=null) {
            log.info("登录成功");
            //获取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);
            if (!bRet) {
                log.error("error code"+YSInit.netdevsdk.NETDEV_GetLastError());
                return null;
            }
            stOSDInfo.read();
            for (NetDEVSDKLib.NETDEV_OSD_TEXT_OVERLAY_S osd : stOSDInfo.astTextOverlay) {
                String text = new String(osd.szOSDText, StandardCharsets.UTF_8);
                log.info("text:" + text);
            }
            //登出
            YSInit.netdevsdk.NETDEV_Logout(lpUserID);
        }else {
            log.error("error code"+YSInit.netdevsdk.NETDEV_GetLastError());
        }
        return null;
    }
    public static void demo(){
        Login.loginIn();
    }
}
ycl-server/src/main/java/com/ycl/api/YS/YSInit.java
New file
@@ -0,0 +1,57 @@
package com.ycl.api.YS;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.ycl.api.YS.lib.NetDEVSDKLib;
import com.ycl.api.YS.util.Common;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.File;
@Component
@Slf4j
public class YSInit {
    @Value("${spring.profiles.active}")
    private String activeEnv;
    public static NetDEVSDKLib netdevsdk = NetDEVSDKLib.NETDEVSDK_INSTANCE;
    public static String strPicturePath = "."+File.separator+"Picture"+File.separator;
    @PostConstruct
    void init() {
        if("prod".equals(activeEnv)) {
            String strLogPath = "./sdklog/";
            boolean bRet = netdevsdk.NETDEV_SetLogPath(strLogPath);
            if(false == bRet){
                System.out.printf("NETDEV_SetLogPath failed:%d", netdevsdk.NETDEV_GetLastError());
            }
            bRet = netdevsdk.NETDEV_Init();
            if(false == bRet){
                System.out.printf("Initialize failed:%d", netdevsdk.NETDEV_GetLastError());
                return;
            }
            try {
                Common.updateStructureByReferenceMethod = Structure.class.getDeclaredMethod("updateStructureByReference", Class.class, Structure.class, Pointer.class);
                Common.updateStructureByReferenceMethod.setAccessible(true);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            File file=new File(strPicturePath);
            if(!file.exists()){
                file.mkdir();
            }
        }
    }
    @PreDestroy
    void clean(){
        if("prod".equals(activeEnv)) {
            netdevsdk.NETDEV_Cleanup();
        }
    }
}
ycl-server/src/main/java/com/ycl/api/YS/lib/NetDEVSDKLib.java
@@ -1,8 +1,10 @@
package com.ycl.api.YS.lib;
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;
@@ -128,6 +130,7 @@
     * @brief 设备登录信息
     * @attention
     */
    @Structure.FieldOrder({"byRes", "dwDeviceType" ,"dwLoginProto","dwPort","szIPAddr","szPassword","szUserName"})
    public class NETDEV_DEVICE_LOGIN_INFO_S extends Structure
    {
        public byte[]      szIPAddr = new byte[NETDEV_LEN_260];    /* IP地址/域名 */
@@ -144,6 +147,7 @@
     * @brief 安全登录信息
     * @attention
     */
    @Structure.FieldOrder({"byRes", "dwSELogCount","dwSELogTime"})
    public class NETDEV_SELOG_INFO_S extends Structure {
        public int         dwSELogCount;             /* 安全登录次数 */
        public int         dwSELogTime;              /* 安全登录时间 */
@@ -5974,6 +5978,7 @@
     * @brief  区域 Area
     * @attention 无 None
     */
    @Structure.FieldOrder({"dwLocateX", "dwLocateY"})
    public class NETDEV_AREA_SCOPE_S extends Structure {
        public int  dwLocateX;             /** 顶点x坐标值[0,10000] * Coordinates of top point x [0,10000] */
        public int  dwLocateY;             /** 顶点y坐标值[0,10000] * Coordinates of top point y [0,10000] */
@@ -5983,29 +5988,39 @@
     * @brief OSD时间配置信息 OSD time configuration information
     * @attention 无 None
     */
    @Structure.FieldOrder({"bEnableFlag", "bWeekEnableFlag","stAreaScope","udwDateFormat","udwTimeFormat"})
    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) */
        public NETDEV_AREA_SCOPE_S     stAreaScope;        /** 区域坐标 * Area coordinates */
        public int                  udwTimeFormat;      /** 时间OSD时间格式,详见 NETDEV_OSD_TIME_FORMAT_CAP_E * Time OSD format, see NETDEV_OSD_TIME_FORMAT_E */
        public int                  udwDateFormat;      /** 日期OSD时间格式,详见 NETDEV_OSD_DATE_FORMAT_CAP_E * Date OSD format, see NETDEV_OSD_TIME_FORMAT_E */
        public NETDEV_OSD_TIME_S() {
            // 初始化代码
        }
    }
    /**
     * @brief OSD字符叠加信息 OSD text overlay information
     * @attention
     */
    @Structure.FieldOrder({"bEnableFlag", "byRes","stAreaScope","szOSDText"})
    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 */
        public byte[]                szOSDText=new byte[NETDEV_OSD_TEXT_MAX_LEN];    /** OSD字符叠加名称字符串 * OSD text overlay name strings */
        public byte[]                byRes=new byte[4];                               /* 保留字段  Reserved */
        public NETDEV_OSD_TEXT_OVERLAY_S() {
            // 初始化代码
        }
    }
    /**
     * @brief 通道OSD的基本属性信息 Basic channel OSD information
     * @attention
     */
    @Structure.FieldOrder({"astTextOverlay", "stNameOSD","stTimeOSD","wTextNum"})
    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 */
ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java
@@ -1017,7 +1017,11 @@
        Page<ImageResourceSecurityDetail> page = PageHelper.startPage(query.getPageNum(), query.getPageSize());
        securityDetailMapper.selectImageResourceSecurityDetailList(imageResourceSecurityDetail);
        return  Result.ok().data(page.getResult()).total(page.getTotal());
        // 统计数
        HashMap<String, Object> map = new HashMap<>();
        map.put("count", CollectionUtils.EMPTY_COLLECTION);
        map.put("list", page);
        return Result.ok().data(map).total(page.getTotal());
    }
}
ycl-server/src/main/java/com/ycl/platform/service/impl/ImageResourceSecurityServiceImpl.java
@@ -2,9 +2,12 @@
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.listener.PageReadListener;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.ycl.handler.ImageResourceHandler;
import com.ycl.platform.domain.entity.CheckIndexVideo;
import com.ycl.platform.domain.entity.ImageResourceSecurity;
import com.ycl.platform.domain.entity.ImageResourceSecurityDetail;
import com.ycl.platform.mapper.CheckIndexVideoMapper;
import com.ycl.platform.mapper.ImageResourceSecurityDetailMapper;
import com.ycl.platform.mapper.ImageResourceSecurityMapper;
import com.ycl.platform.service.IImageResourceSecurityService;
@@ -34,6 +37,7 @@
    private final ImageResourceSecurityMapper imageResourceSecurityMapper;
    private final ImageResourceSecurityDetailMapper imageResourceSecurityDetailMapper;
    private final ISysDeptService deptService;
    private final CheckIndexVideoMapper checkIndexVideoMapper;
    @Override
    public ImageResourceSecurity selectImageResourceSecurityById(Long id) {
@@ -42,7 +46,14 @@
    @Override
    public List<ImageResourceSecurity> selectImageResourceSecurityList(ImageResourceSecurity imageResourceSecurity) {
        return imageResourceSecurityMapper.selectImageResourceSecurityList(imageResourceSecurity);
        List<ImageResourceSecurity> list = imageResourceSecurityMapper.selectImageResourceSecurityList(imageResourceSecurity);
        list.forEach(item -> item.setImageResourceSecurity(new LambdaQueryChainWrapper<>(checkIndexVideoMapper)
                .eq(CheckIndexVideo::getDeptId, item.getDeptId())
                .orderByDesc(CheckIndexVideo::getCreateTime, CheckIndexVideo::getImageResourceSecurity)
                .last("limit 1")
                .one()
                .getImageResourceSecurity()));
        return list;
    }
    @Override
ycl-server/src/main/java/com/ycl/task/ImageResourceSecurityTask.java
@@ -11,6 +11,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -29,9 +30,12 @@
    private final CheckIndexVideoMapper checkIndexVideoMapper;
    private final ImageResourceSecurityDetailMapper imageResourceSecurityDetailMapper;
    private static final BigDecimal NUM = new BigDecimal("0.15");
    /**
     * 每天晚上1点执行
     */
    @Transactional
    @Scheduled(cron = "0 0 1 * * ?")
    public void calc() {
        ArrayList<ImageResourceSecurity> imageResourceSecurities = new ArrayList<>();
@@ -53,17 +57,20 @@
            for (ImageResourceSecurityDetail imageResourceSecurityDetail : detailList) {
                // 扣除分数
                score -= imageResourceSecurityDetail.getAlarmCategory().getScore();
                imageResourceSecurity.setWeakPassword(BigDecimal.valueOf(score));
                // 统计数量
                if (Integer.parseInt(imageResourceSecurityDetail.getAlarmLevel().getValue()) > 1) {
                    count++;
                }
            }
            imageResourceSecurity.setWeakPassword(BigDecimal.valueOf(score));
            // 获取字典值-总数
            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));
            checkIndexVideoMapper.updateById(checkIndexVideo);
        }
        imageResourceSecurityService.saveBatch(imageResourceSecurities);
ycl-server/src/main/java/com/ycl/task/OsdTask.java
@@ -7,6 +7,8 @@
import com.ycl.api.DH.module.LoginModule;
import com.ycl.api.DH.utils.DHApi;
import com.ycl.api.HK.HKApi;
import com.ycl.api.YS.YSApi;
import com.ycl.api.YS.YSInit;
import com.ycl.platform.domain.entity.TMonitor;
import com.ycl.platform.domain.result.OSDResult;
import com.ycl.platform.domain.result.UY.MonitorQualifyResult;
@@ -49,6 +51,10 @@
    public String DHUserName;
    @Value("${DH.password}")
    public String DHPassword;
    @Value("${YS.userName}")
    public String YSUserName;
    @Value("${YS.password}")
    public String YSPassword;
    @Autowired
    private MongoTemplate mongoTemplate;
    @Autowired
@@ -72,6 +78,9 @@
     */
    public void getOSD() {
        log.info("开始获取OSD");
//            YSApi.getOsd("51.95.66.42",YSUserName,YSPassword);
        DHApi.getOsd("51.95.67.189",DHUserName,DHPassword);
        //批量修改海康品牌集合
        List<String> hkList = new ArrayList<>();
        //批量修改大华品牌集合
@@ -84,9 +93,10 @@
        List<MonitorQualifyResult> oneMachineFileResults = mongoTemplate.find(query, MonitorQualifyResult.class);
        //需要考核的数据
        List<String> serialNumbers = oneMachineFileResults.stream().map(result -> result.getSerialNumber().getValue()).collect(Collectors.toList());
        if(!CollectionUtils.isEmpty(serialNumbers)) {
        List<TMonitor> monitors = monitorMapper.selectByNumbers(serialNumbers);
        monitors = monitors.stream().filter(monitor -> monitor.getId()<7000).collect(Collectors.toList());
            monitors = monitors.stream().filter(monitor -> !StringUtils.isEmpty(monitor.getIp()) && !"127.0.0.1".equals(monitor.getIp())).collect(Collectors.toList());
//            monitors = monitors.stream().filter(monitor -> monitor.getId() < 7000).collect(Collectors.toList());
        log.info("处理数据大小{}",monitors.size());
        for (TMonitor monitor : monitors) {
            executorService.submit(() -> {
@@ -126,8 +136,6 @@
        } catch (InterruptedException e) {
            // 当前线程在等待过程中被中断
            executorService.shutdownNow();
            // 处理中断,例如重新抛出异常或记录日志
            Thread.currentThread().interrupt(); // 保持中断状态
        }
        //结束api执行,开始校验
        List<OsdCheckResult> checkResults = new ArrayList<>();
@@ -162,6 +170,7 @@
            monitorMapper.batchUpdateDeviceType(dhList,DeviceType.DH.getType());
        }
        //TODO:宇视
        }
        log.info("结束获取OSD");
    }
@@ -244,6 +253,7 @@
        OSDResult hkosd = HKApi.getOsdByIP(monitor.getIp(), HKUserName, HKPassword);
        if (hkosd != null) {
            hkosd.setSerialNumber(monitor.getSerialNumber());
            log.info("海康调用成功"+hkosd);
            synchronized (hkList) {
                hkList.add(monitor.getSerialNumber());
            }
@@ -253,6 +263,7 @@
        OSDResult dhosd = DHApi.getOsd(monitor.getIp(), DHUserName, DHPassword);
        if (dhosd != null) {
            dhosd.setSerialNumber(monitor.getSerialNumber());
            log.info("大华调用成功"+dhosd);
            synchronized (dhList) {
                dhList.add(monitor.getSerialNumber());
            }
ycl-server/src/main/resources/application-dev.yml
@@ -151,6 +151,11 @@
DH:
  userName: admin
  password: zg@2024dx
YS:
  userName: admin
  password: zg2024dx
# gb281视频网关地址,用于获取rtsp格式的流地址
rtsp:
  server: http://192.168.3.88:7788
ycl-server/src/main/resources/application-prod.yml
@@ -128,6 +128,10 @@
DH:
  userName: admin
  password: zg@2024dx
YS:
  userName: admin
  password: zg2024dx
# gb281视频网关地址,用于获取rtsp格式的流地址
rtsp:
  server: http://192.168.3.88:7788
ycl-server/src/main/resources/mapper/zgyw/CheckIndexVideoMapper.xml
@@ -185,6 +185,7 @@
    <select id="selectAndDeptName" resultType="com.ycl.platform.domain.entity.CheckIndexVideo">
        WITH temp AS (
            SELECT
                r.id,
                r.dept_id,
                r.platform_online,
                r.monitor_qualification,
@@ -196,6 +197,7 @@
                sys_dept d ON r.dept_id = d.dept_id
        )
        SELECT
            id,
            dept_id,
            area as deptName,
            platform_online,