LAPTOP-KB9HII50\70708 2 years ago
parent
commit
78d1f590ab

+ 57 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/BaseDeviceFaceRecordDO.java

@ -0,0 +1,57 @@
package com.yihu.jw.entity.care.device;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 居民人脸记录数据
 * Created by yeshijie on 2022/6/2.
 */
@Entity
@Table(name = "base_device_face_record")
public class BaseDeviceFaceRecordDO extends UuidIdentityEntityWithCreateTime {
    private String patient;
    private String name;
    private String img;//人脸图片地址
    private String passTime;//通过时间
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "img")
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    @Column(name = "pass_time")
    public String getPassTime() {
        return passTime;
    }
    public void setPassTime(String passTime) {
        this.passTime = passTime;
    }
}

+ 77 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/BaseDevicePatientFaceDO.java

@ -0,0 +1,77 @@
package com.yihu.jw.entity.care.device;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 人脸库
 * Created by yeshijie on 2022/6/1.
 */
@Entity
@Table(name = "base_device_patient_face")
public class BaseDevicePatientFaceDO extends UuidIdentityEntityWithCreateTime {
    private Integer type;//人脸类型 1华联社区宇视
    private String patient;//居民id
    private String idcard;//身份证
    private String name;//姓名
    private String faceId;//人脸库id
    private String synTime;//人脸数据同步时间
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "idcard")
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "face_id")
    public String getFaceId() {
        return faceId;
    }
    public void setFaceId(String faceId) {
        this.faceId = faceId;
    }
    @Column(name = "syn_time")
    public String getSynTime() {
        return synTime;
    }
    public void setSynTime(String synTime) {
        this.synTime = synTime;
    }
}

+ 15 - 0
common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java

@ -537,6 +537,21 @@ public class DateUtil {
        }
    }
    public static String getNextMinute(String nowdate, int delay) {
        try {
            SimpleDateFormat format = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
            String mdate = "";
            Date date = strToDate(nowdate, YYYY_MM_DD_HH_MM_SS);
            Calendar cal = Calendar.getInstance();
            cal.setTime(date);
            cal.add(Calendar.MINUTE, delay);
            mdate = format.format(cal.getTime());
            return mdate;
        } catch (Exception e) {
            return "";
        }
    }
    /**
     * 得到一个时间延后或前移几天的时间,nowdate为时间,delay为前移或后延的天数
     */

+ 13 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/dao/face/BaseDeviceFaceRecordDao.java

@ -0,0 +1,13 @@
package com.yihu.jw.care.dao.face;
import com.yihu.jw.entity.care.device.BaseDeviceFaceRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2022/6/2.
 */
public interface BaseDeviceFaceRecordDao extends PagingAndSortingRepository<BaseDeviceFaceRecordDO,String>,
        JpaSpecificationExecutor<BaseDeviceFaceRecordDO> {
}

+ 21 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/dao/face/BaseDevicePatientFaceDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.care.dao.face;
import com.yihu.jw.entity.care.device.BaseDevicePatientFaceDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2022/6/1.
 */
public interface BaseDevicePatientFaceDao  extends PagingAndSortingRepository<BaseDevicePatientFaceDO,String>,
        JpaSpecificationExecutor<BaseDevicePatientFaceDO> {
    @Query("select a from BaseDevicePatientFaceDO a where a.idcard = ?1")
    BaseDevicePatientFaceDO findByIdcard(String idcard);
    @Query("select a from BaseDevicePatientFaceDO a where a.type = ?1")
    List<BaseDevicePatientFaceDO> findListByType(Integer type);
}

+ 48 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/NetdevTestController.java

@ -6,7 +6,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.*;
/**
@ -135,6 +134,25 @@ public class NetdevTestController extends BaseController {
        }
    }
    @ApiOperation("告警记录")
    @GetMapping(value = "queryAlarmRecord")
    public String queryAlarmRecord(
            @ApiParam(value="开始时间",defaultValue = "2022-05-15 13:46:59")
            @RequestParam(value = "strBeginTime", required = true)  String strBeginTime ,
            @ApiParam(value="结束时间",defaultValue = "2022-05-25 13:46:59")
            @RequestParam(value = "strEndTime", required = true)  String strEndTime,
            @ApiParam(value="监控类型 0 1",required = true)
            @RequestParam(value = "monitorType", required = true)  Integer monitorType)
    {
        try {
            netDevSdkService.queryAlarmRecord(strBeginTime,strEndTime,monitorType);
            return success();
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,e.getMessage());
        }
    }
    @ApiOperation("门禁查询出入记录")
    @GetMapping(value = "searchAccessRecords")
    public String searchAccessRecords(
@ -153,4 +171,33 @@ public class NetdevTestController extends BaseController {
            return error(-1,e.getMessage());
        }
    }
    /*********************************job 调用接口****************************************************/
    @GetMapping("updPatientFace")
    @ApiOperation("更新人脸库人员数据")
    public String updPatientFace(){
        try {
            String res = netDevSdkService.updPatientFace();
            if(res == null){
                return success();
            }else {
                return error(-1,res);
            }
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,e.getMessage());
        }
    }
    @GetMapping("synPatientFaceRecords")
    @ApiOperation("同步人脸数据")
    public String synPatientFaceRecords(){
        try {
            netDevSdkService.synPatientFaceRecords();
            return success();
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,e.getMessage());
        }
    }
}

+ 415 - 12
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/netdevsdk/NetDevSdkService.java

@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
import com.sun.jna.Memory;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.yihu.jw.care.dao.face.BaseDeviceFaceRecordDao;
import com.yihu.jw.care.dao.face.BaseDevicePatientFaceDao;
import com.yihu.jw.care.netdevsdk.lib.NetDEVSDKLib;
import com.yihu.jw.care.netdevsdk.lib.NetDEVSDKLib.NETDEV_DEVICE_TYPE_E;
import com.yihu.jw.care.netdevsdk.lib.NetDEVSDKLib.NETDEV_DEVICE_LOGIN_INFO_S;
@ -41,19 +43,24 @@ import com.yihu.jw.care.netdevsdk.lib.NetDEVSDKLib.NETDEV_ACS_ATTENDANCE_LOG_INF
import com.yihu.jw.care.netdevsdk.lib.NetDEVSDKLib.NETDEV_COMPARE_INFO_S;
import com.yihu.jw.care.netdevsdk.lib.NetDEVSDKLib.NETDEV_FACE_ATTR_S;
import com.yihu.jw.care.netdevsdk.util.Common;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.BaseDeviceFaceRecordDO;
import com.yihu.jw.entity.care.device.BaseDevicePatientFaceDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.swing.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import java.util.*;
/**
 * 宇视人脸摄像头sdk
@ -62,8 +69,16 @@ import java.util.Vector;
@Service
public class NetDevSdkService {
    @Autowired
    private BaseDevicePatientFaceDao devicePatientFaceDao;
    @Autowired
    private BaseDeviceFaceRecordDao faceRecordDao;
    @Autowired
    private BasePatientDao patientDao;
    private static final Logger logger = LoggerFactory.getLogger(NetDevSdkService.class);
    // http://zhyzh.gongshu.gov.cn:3001/ 开vpn后可以本地调试
    //IP:10.18.50.18   账号admin  密码Admin12345@    HTTP端口80  HTTPS端口  443  RTSP端口 554
    private static final int dwPort = 80;//端口号 443
    private static final String strUserName = "admin";//用户名
@ -277,6 +292,252 @@ public class NetDevSdkService {
        NetDemo.dwPersonRecognizeMointerID = -1;
    }
    /**
     * 同步人脸数据
     */
    public void synPatientFaceRecords(){
        List<BaseDevicePatientFaceDO> list = devicePatientFaceDao.findListByType(1);
        for (BaseDevicePatientFaceDO faceDO:list){
            try {
                sysPatientFaceRecord(faceDO);
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
    public String sysPatientFaceRecord(BaseDevicePatientFaceDO faceDO){
        String endTime = "";
        String idcard = faceDO.getIdcard();
        String patient = faceDO.getPatient();
        String name = faceDO.getName();
        if(null == NetDemo.lpUserID){
            return "未登录,请先登录";
        }
        if (StringUtils.isBlank(idcard)){
            return "身份证不能为空";
        }
        do {
            String startTime = faceDO.getSynTime();
            if(StringUtils.isBlank(startTime)){
                //第一次取当前时间的前30分钟数据
                endTime = DateUtil.getStringDate();
                startTime = DateUtil.getNextMinute(endTime, -30);
            }else{
                endTime = DateUtil.getNextMinute(startTime, 30);//采集30分钟后的数据
            }
            logger.info("startTime="+startTime+",endTime="+endTime);
            NETDEV_ALARM_LOG_COND_LIST_S stFindCond = new NETDEV_ALARM_LOG_COND_LIST_S();
            stFindCond.dwPageRow = 16;
            stFindCond.dwFirstRow = 0;
            stFindCond.dwCondSize = 5;
            stFindCond.astCondition[0] = new NETDEV_QUERY_INFO_S();
            stFindCond.astCondition[1] = new NETDEV_QUERY_INFO_S();
            stFindCond.astCondition[2] = new NETDEV_QUERY_INFO_S();
            stFindCond.astCondition[3] = new NETDEV_QUERY_INFO_S();
            stFindCond.astCondition[4] = new NETDEV_QUERY_INFO_S();
            stFindCond.astCondition[0].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
            stFindCond.astCondition[0].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_GREATER;
            Common.stringToByteArray(String.valueOf(Common.date2TimeStamp(startTime, NetDemo.DateFormat)), stFindCond.astCondition[0].szConditionData);   //NETDEV_ALARM_SMART_FACE_MATCH_LIST
            stFindCond.astCondition[1].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
            stFindCond.astCondition[1].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_NO_GREATER;
            Common.stringToByteArray(String.valueOf(Common.date2TimeStamp(endTime, NetDemo.DateFormat)), stFindCond.astCondition[1].szConditionData);   //NETDEV_ALARM_SMART_FACE_MATCH_LIST
            stFindCond.astCondition[2].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
            stFindCond.astCondition[2].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_DESC_ORDER;
            Common.stringToByteArray("", stFindCond.astCondition[2].szConditionData);
            stFindCond.astCondition[3].dwQueryType = 57;
            stFindCond.astCondition[3].dwLogicFlag = 0;
            //1表示匹配成功
            Common.stringToByteArray("1", stFindCond.astCondition[3].szConditionData);
            stFindCond.astCondition[4].dwQueryType = 58;
            stFindCond.astCondition[4].dwLogicFlag = 0;
            Common.stringToByteArray(idcard, stFindCond.astCondition[4].szConditionData);
            NETDEV_SMART_ALARM_LOG_RESULT_INFO_S stResultInfo = new NETDEV_SMART_ALARM_LOG_RESULT_INFO_S();
            boolean bRet = false;
            while(true)
            {
                Pointer lpFindRecordHandlePointer = NetDemo.netdevsdk.NETDEV_FindFaceRecordDetailList(NetDemo.lpUserID, stFindCond, stResultInfo);
                if(lpFindRecordHandlePointer != null)
                {
                    while(true)
                    {
                        logger.info("人脸数据stFindCond.dwFirstRow:"+stFindCond.dwFirstRow);
                        NETDEV_FACE_RECORD_SNAPSHOT_INFO_S stRecordInfo = new NETDEV_FACE_RECORD_SNAPSHOT_INFO_S();
                        stRecordInfo.stCompareInfo = new NETDEV_FACE_ALARM_CMP_INFO_S();
                        stRecordInfo.stCompareInfo.stSnapshotImage = new NETDEV_FACE_ALARM_SNAP_IMAGE_S();
                        stRecordInfo.stCompareInfo.stSnapshotImage.stBigImage = new NETDEV_FILE_INFO_S();
                        stRecordInfo.stCompareInfo.stSnapshotImage.stBigImage.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
                        stRecordInfo.stCompareInfo.stSnapshotImage.stBigImage.udwSize = Common.NETDEMO_PICTURE_SIZE;
                        stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage = new NETDEV_FILE_INFO_S();
                        stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
                        stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.udwSize = Common.NETDEMO_PICTURE_SIZE;
                        stRecordInfo.stCompareInfo.stSnapshotImage.stArea = new NETDEV_FACE_ALARM_IMAGE_AREA_S();
                        bRet = NetDemo.netdevsdk.NETDEV_FindNextFaceRecordDetail(lpFindRecordHandlePointer, stRecordInfo);
                        if(bRet == true)
                        {
                            String passTime = Common.timeStamp2Date(String.valueOf(stRecordInfo.udwPassTime),NetDemo.DateFormat);
                            String strTime = Common.getDate();
                            //nvr 没有大图 String strFileNameBig = NetDemo.strPicturePath  + "_" + "PassTime_"+ stRecordInfo.udwPassTime + "_" + "_" + strTime +"BigImage.jpg";
                            String strFileNameSmall = NetDemo.strPicturePath + "_" + "PassTime_"+ stRecordInfo.udwPassTime + "_" + strTime +"SmallImage.jpg";
                            Common.savePicture(stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.pcData, stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.udwSize, strFileNameSmall);
                            BaseDeviceFaceRecordDO faceRecordDO = new BaseDeviceFaceRecordDO();
                            faceRecordDO.setPatient(patient);
                            faceRecordDO.setName(name);
                            faceRecordDO.setPassTime(passTime);
                            faceRecordDO.setCreateTime(new Date());
                            faceRecordDO.setImg(strFileNameSmall);
                            faceRecordDao.save(faceRecordDO);
                        }
                        else
                        {
                            break;
                        }
                    }
                    bRet = NetDemo.netdevsdk.NETDEV_FindCloseFaceRecordDetail(lpFindRecordHandlePointer);
                    if(bRet != true)
                    {
                        logger.info("关闭人脸记录详情失败:{}", NetDemo.netdevsdk.NETDEV_GetLastError());
                    }
                    if(stResultInfo.udwTotal <= stFindCond.dwFirstRow)
                    {
                        break;
                    }
                    stFindCond.dwFirstRow += stFindCond.dwPageRow;
                }
                else
                {
                    logger.info("查询结束");
                    break;
                }
            }
            faceDO.setSynTime(endTime);
            devicePatientFaceDao.save(faceDO);
        }while (endTime.compareTo(DateUtil.getNextMin(DateUtil.getStringDate(), -30))<0);
        return null;
    }
    /**
     * 更新人脸库人员数据
     */
    public String updPatientFace(){
        if(null == NetDemo.lpUserID){
            return "未登录,请先登录";
        }
        Pointer pPersonLibHandle = NetDemo.netdevsdk.NETDEV_FindPersonLibList(NetDemo.lpUserID);
        if(null == pPersonLibHandle){
            return "获取人员库列表失败, "+NetDemo.netdevsdk.NETDEV_GetLastError();
        }
        else
        {
            boolean bRet = false;
            while(true)
            {
                NETDEV_LIB_INFO_S stPersonLibInfo = new NETDEV_LIB_INFO_S();
                bRet = NetDemo.netdevsdk.NETDEV_FindNextPersonLibInfo(pPersonLibHandle, stPersonLibInfo);
                if(false == bRet)
                {
                    logger.info("获取下一个人员库列表失败:{}", NetDemo.netdevsdk.NETDEV_GetLastError());
                    break;
                }
                String szName = Common.byteArrayToString(stPersonLibInfo.szName);
                NetDemo.mapPersonLib.put(szName, stPersonLibInfo);
                logger.info("人脸信息--szName:"+Common.byteArrayToString(stPersonLibInfo.szName));
            }
            //关闭资源
            bRet = NetDemo.netdevsdk.NETDEV_FindClosePersonLibList(pPersonLibHandle);
            if(false == bRet)
            {
                return "关闭人脸库资源失败:"+ NetDemo.netdevsdk.NETDEV_GetLastError();
            }
        }
        if(NetDemo.mapPersonLib.size()==0){
            return "人员库不存在";
        }
        for (NETDEV_LIB_INFO_S stPersonLibInfo: NetDemo.mapPersonLib.values()){
            NETDEV_PERSON_QUERY_INFO_S stQueryInfo = new NETDEV_PERSON_QUERY_INFO_S();
            stQueryInfo.udwNum = 0;
            stQueryInfo.udwOffset =  0;
            stQueryInfo.udwLimit = 16;
            NETDEV_BATCH_OPERATE_BASIC_S stQueryResultInfo = new NETDEV_BATCH_OPERATE_BASIC_S();
            boolean bRet = false;
            while(true)
            {
                Pointer lpPersonFindHandle = NetDemo.netdevsdk.NETDEV_FindPersonInfoList(NetDemo.lpUserID, stPersonLibInfo.udwID, stQueryInfo, stQueryResultInfo);
                if(lpPersonFindHandle == null || stQueryResultInfo.udwTotal == 0)
                {
                    logger.info("获取人员列表失败:{}", NetDemo.netdevsdk.NETDEV_GetLastError());
                    break;
                }
                else
                {
                    stQueryInfo.udwOffset += stQueryInfo.udwLimit;
                    while(true)
                    {
                        NETDEV_PERSON_INFO_S stPersonInfo = new NETDEV_PERSON_INFO_S();
                        stPersonInfo.stRegionInfo = new NETDEV_REGION_INFO_S();
                        stPersonInfo.stImageInfo[0] = new NETDEV_IMAGE_INFO_S();
                        stPersonInfo.stImageInfo[0].stFileInfo = new NETDEV_FILE_INFO_S();
                        stPersonInfo.stImageInfo[0].stFileInfo.udwSize = 1048576;
                        stPersonInfo.stImageInfo[0].stFileInfo.pcData = new Memory(stPersonInfo.stImageInfo[0].stFileInfo.udwSize);
                        stPersonInfo.write();
                        bRet = NetDemo.netdevsdk.NETDEV_FindNextPersonInfo(lpPersonFindHandle, stPersonInfo);
                        if(bRet != true)
                        {
                            break;
                        }
                        else
                        {
                            String udwPersonID = stPersonInfo.udwPersonID+"";
                            String szPersonName = Common.byteArrayToString(stPersonInfo.szPersonName);
                            if(stPersonInfo.udwIdentificationNum > 0){
                                String szNumber = Common.byteArrayToString(stPersonInfo.stIdentificationInfo[0].szNumber);
                                BaseDevicePatientFaceDO faceDO = devicePatientFaceDao.findByIdcard(szNumber);
                                if(faceDO == null){
                                    BasePatientDO patientDO = patientDao.findByIdcard(szNumber);
                                    if(patientDO!=null){
                                        faceDO = new BaseDevicePatientFaceDO();
                                        faceDO.setFaceId(udwPersonID);
                                        faceDO.setIdcard(szNumber);
                                        faceDO.setType(1);
                                        faceDO.setName(szPersonName);
                                        faceDO.setCreateTime(new Date());
                                        faceDO.setPatient(patientDO.getId());
                                        devicePatientFaceDao.save(faceDO);
                                    }
                                }
                            }else{
                                logger.info("人员没有身份证-- udwPersonID:"+udwPersonID
                                        +",szPersonName:"+szPersonName);
                            }
                        }
                    }
                    //关闭资源
                    bRet = NetDemo.netdevsdk.NETDEV_FindClosePersonInfoList(lpPersonFindHandle);
                    if(bRet == false)
                    {
                        logger.info("关闭人员列表资源失败:{}", NetDemo.netdevsdk.NETDEV_GetLastError());
                    }
                }
                if(stQueryInfo.udwOffset >= stQueryResultInfo.udwTotal)
                {
                    break;
                }
            }
        }
        return null;
    }
    /**
     * 查找人员库
     */
@ -492,10 +753,13 @@ public class NetDevSdkService {
        stFindCond.dwFirstRow = 0;
        if(StringUtils.isBlank(getPersonPassAlarmSource))
        {
            stFindCond.dwCondSize = 3;
            logger.info("没有告警源");
            stFindCond.dwCondSize = 5;
            stFindCond.astCondition[0] = new NETDEV_QUERY_INFO_S();
            stFindCond.astCondition[1] = new NETDEV_QUERY_INFO_S();
            stFindCond.astCondition[2] = new NETDEV_QUERY_INFO_S();
            stFindCond.astCondition[3] = new NETDEV_QUERY_INFO_S();
            stFindCond.astCondition[4] = new NETDEV_QUERY_INFO_S();
            stFindCond.astCondition[0].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
            stFindCond.astCondition[0].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_NO_LESS;
            Common.stringToByteArray(String.valueOf(Common.date2TimeStamp(strBeginTime, NetDemo.DateFormat)), stFindCond.astCondition[0].szConditionData);   //NETDEV_ALARM_SMART_FACE_MATCH_LIST
@ -505,6 +769,14 @@ public class NetDevSdkService {
            stFindCond.astCondition[2].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
            stFindCond.astCondition[2].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_DESC_ORDER;
            Common.stringToByteArray("", stFindCond.astCondition[2].szConditionData);
            stFindCond.astCondition[3].dwQueryType = 57;
            stFindCond.astCondition[3].dwLogicFlag = 0;
            Common.stringToByteArray("1", stFindCond.astCondition[3].szConditionData);
            stFindCond.astCondition[4].dwQueryType = 58;
            stFindCond.astCondition[4].dwLogicFlag = 0;
            Common.stringToByteArray("330103193303040742", stFindCond.astCondition[4].szConditionData);
        }
        else
        {
@ -533,8 +805,10 @@ public class NetDevSdkService {
            Pointer lpFindRecordHandlePointer = NetDemo.netdevsdk.NETDEV_FindFaceRecordDetailList(NetDemo.lpUserID, stFindCond, stResultInfo);
            if(lpFindRecordHandlePointer != null)
            {
                while(true)
                {
                    logger.info("人脸数据stFindCond.dwFirstRow:"+stFindCond.dwFirstRow);
                    NETDEV_FACE_RECORD_SNAPSHOT_INFO_S stRecordInfo = new NETDEV_FACE_RECORD_SNAPSHOT_INFO_S();
                    stRecordInfo.stCompareInfo = new NETDEV_FACE_ALARM_CMP_INFO_S();
                    stRecordInfo.stCompareInfo.stMemberInfo = new NETDEV_FACE_MEMBER_INFO_S();
@ -590,7 +864,136 @@ public class NetDevSdkService {
    }
    /**
     * 门禁查询出入记录
     * 告警记录 //数据量较大,建议采用分页形式展示
     * @param strBeginTime
     */
    public static void queryAlarmRecord(String strBeginTime,String strEndTime,Integer monitorType) {
        if(null == NetDemo.lpUserID)
        {
            logger.info("未登录,请先登录");
            return;
        }
        if(false == Common.isValidDate(strBeginTime, NetDemo.DateFormat) ||false == Common.isValidDate(strEndTime,NetDemo.DateFormat))
        {
            logger.info("Please check that the time format is correct.");
            return;
        }
        long get1=Common.date2TimeStamp(strBeginTime,NetDemo.DateFormat);
        long get2=Common.date2TimeStamp(strEndTime, NetDemo.DateFormat);
        if(get1>get2) {
            logger.info(" Start time can not more than end time");
            return;
        }
        NETDEV_ALARM_LOG_COND_LIST_S stFindCond = new NETDEV_ALARM_LOG_COND_LIST_S();
        stFindCond.dwPageRow = 16;
        stFindCond.dwFirstRow = 0;
        stFindCond.dwCondSize = 4;
        stFindCond.astCondition[0] = new NETDEV_QUERY_INFO_S();
        stFindCond.astCondition[1] = new NETDEV_QUERY_INFO_S();
        stFindCond.astCondition[2] = new NETDEV_QUERY_INFO_S();
        stFindCond.astCondition[3] = new NETDEV_QUERY_INFO_S();
        stFindCond.astCondition[0].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_ALARMTYPE;
        stFindCond.astCondition[0].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_EQUAL;
        if(monitorType == 0)
        {
            Common.stringToByteArray("1018", stFindCond.astCondition[0].szConditionData);   //NETDEV_ALARM_SMART_FACE_MATCH_LIST
        }
        else if(monitorType == 1)
        {
            Common.stringToByteArray("1020", stFindCond.astCondition[0].szConditionData);   //NETDEV_ALARM_SMART_FACE_MISMATCH_LIST
        }
        stFindCond.astCondition[1].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
        stFindCond.astCondition[1].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_NO_LESS;
        Common.stringToByteArray(String.valueOf(Common.date2TimeStamp(strBeginTime, NetDemo.DateFormat)), stFindCond.astCondition[1].szConditionData);
        stFindCond.astCondition[2].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
        stFindCond.astCondition[2].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_NO_GREATER;
        Common.stringToByteArray(String.valueOf(Common.date2TimeStamp(strEndTime, NetDemo.DateFormat)), stFindCond.astCondition[2].szConditionData);
        stFindCond.astCondition[3].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
        stFindCond.astCondition[3].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_DESC_ORDER;
        Common.stringToByteArray("", stFindCond.astCondition[3].szConditionData);   //NETDEV_ALARM_SMART_FACE_MATCH_LIST
        NETDEV_SMART_ALARM_LOG_RESULT_INFO_S  stResultInfo = new NETDEV_SMART_ALARM_LOG_RESULT_INFO_S();
        boolean bRet = false;
        while(true)
        {
            logger.info("告警记录1");
            Pointer lpFindRecordHandlePointer = NetDemo.netdevsdk.NETDEV_FindFaceRecordDetailList(NetDemo.lpUserID, stFindCond, stResultInfo);
            if(lpFindRecordHandlePointer != null)
            {
                while(true)
                {
                    logger.info("人脸数据1");
                    NETDEV_FACE_RECORD_SNAPSHOT_INFO_S stRecordInfo = new NETDEV_FACE_RECORD_SNAPSHOT_INFO_S();
                    stRecordInfo.stCompareInfo = new NETDEV_FACE_ALARM_CMP_INFO_S();
                    stRecordInfo.stCompareInfo.stMemberInfo = new NETDEV_FACE_MEMBER_INFO_S();
                    stRecordInfo.stCompareInfo.stMemberInfo.stMemberRegionInfo = new NETDEV_FACE_MEMBER_REGION_INFO_S();
                    stRecordInfo.stCompareInfo.stMemberInfo.stMemberIDInfo = new NETDEV_FACE_MEMBER_ID_INFO_S();
                    stRecordInfo.stCompareInfo.stMemberInfo.stMemberImageInfo = new NETDEV_FILE_INFO_S();
                    stRecordInfo.stCompareInfo.stMemberInfo.stMemberImageInfo.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
                    stRecordInfo.stCompareInfo.stMemberInfo.stMemberImageInfo.udwSize = Common.NETDEMO_PICTURE_SIZE;
                    stRecordInfo.stCompareInfo.stMemberInfo.stMemberSemiInfo = new NETDEV_FILE_INFO_S();
                    stRecordInfo.stCompareInfo.stMemberInfo.stMemberSemiInfo.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
                    stRecordInfo.stCompareInfo.stMemberInfo.stMemberSemiInfo.udwSize = Common.NETDEMO_PICTURE_SIZE;
                    stRecordInfo.stCompareInfo.stSnapshotImage = new NETDEV_FACE_ALARM_SNAP_IMAGE_S();
                    stRecordInfo.stCompareInfo.stSnapshotImage.stBigImage = new NETDEV_FILE_INFO_S();
                    stRecordInfo.stCompareInfo.stSnapshotImage.stBigImage.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
                    stRecordInfo.stCompareInfo.stSnapshotImage.stBigImage.udwSize = Common.NETDEMO_PICTURE_SIZE;
                    stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage = new NETDEV_FILE_INFO_S();
                    stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
                    stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.udwSize = Common.NETDEMO_PICTURE_SIZE;
                    stRecordInfo.stCompareInfo.stSnapshotImage.stArea = new NETDEV_FACE_ALARM_IMAGE_AREA_S();
                    bRet = NetDemo.netdevsdk.NETDEV_FindNextFaceRecordDetail(lpFindRecordHandlePointer, stRecordInfo);
                    if(bRet == true)
                    {
                        String strTime = Common.getDate();
//                        if(NetDemo.jComboBoxDeviceType.getSelectedIndex() == 1)
//                        {
                            String strFileNameBig = NetDemo.strPicturePath + strTime +"BigImage.jpg";
                            NETDEV_FILE_INFO_S stFileInfo = new NETDEV_FILE_INFO_S();
                            stFileInfo.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
                            stFileInfo.udwSize = Common.NETDEMO_PICTURE_SIZE;
                            bRet = NetDemo.netdevsdk.NETDEV_GetFaceRecordImageInfo(NetDemo.lpUserID, stRecordInfo.udwRecordID, 0, stFileInfo);
                            if(bRet == true)
                            {
                                Common.savePicture(stFileInfo.pcData, stFileInfo.udwSize, strFileNameBig);
                            }else {
                                System.out.printf("Get picture failed failed,error code"+NetDemo.netdevsdk.NETDEV_GetLastError());
                            }
//                        }
                        String strFileNameSmall = NetDemo.strPicturePath + strTime +"SmallImage.jpg";
                        Common.savePicture(stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.pcData, stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.udwSize, strFileNameSmall);
                    }
                    else
                    {
                        break;
                    }
                }
                bRet = NetDemo.netdevsdk.NETDEV_FindCloseFaceRecordDetail(lpFindRecordHandlePointer);
                if(bRet != true)
                {
                    logger.info("NETDEV_FindCloseFaceRecordDetail failed:"+NetDemo.netdevsdk.NETDEV_GetLastError());
                    return;
                }
                if(stFindCond.dwFirstRow >= stResultInfo.udwTotal)
                {
                    break;
                }
                stFindCond.dwFirstRow += stFindCond.dwPageRow;
            }
            else
            {   String strPicPath = System.getProperty("user.dir").replaceAll("%20"," ") + File.separator +"Picture";
                logger.info("Query ended.The path:"+strPicPath);
                break;
            }
        }
    }
    /**
     * 门禁查询出入记录 对接设备没有门禁记录
     */
    public void searchAccessRecords(String startTime,String endTime,String persionId) {
        if(null == NetDemo.lpUserID)
@ -625,13 +1028,13 @@ public class NetDevSdkService {
        Common.stringToByteArray(getendtTime, pstFindCond.astCondition[2].szConditionData);
        logger.info("pstFindCond.astCondition.length:"+ pstFindCond.astCondition.length);
        if(StringUtils.isNotBlank(persionId)){
            //人员id
            pstFindCond.astCondition[3]=new NETDEV_QUERY_INFO_S();
            pstFindCond.astCondition[3].dwQueryType=79;
            pstFindCond.astCondition[3].dwLogicFlag=0;
            Common.stringToByteArray(persionId, pstFindCond.astCondition[3].szConditionData);
        }
//        if(StringUtils.isNotBlank(persionId)){
//            //人员id
//            pstFindCond.astCondition[3]=new NETDEV_QUERY_INFO_S();
//            pstFindCond.astCondition[3].dwQueryType=79;
//            pstFindCond.astCondition[3].dwLogicFlag=0;
//            Common.stringToByteArray(persionId, pstFindCond.astCondition[3].szConditionData);
//        }
        NETDEV_BATCH_OPERATE_BASIC_S pstResultInfo=new NETDEV_BATCH_OPERATE_BASIC_S();
        pstResultInfo.udwOffset=0;

+ 1 - 1
svr/svr-cloud-device/src/main/resources/META-INF/MANIFEST.MF

@ -39,7 +39,7 @@ Class-Path: resources/ lib/spring-boot-starter-websocket-1.5.9.RELEASE
 ng3-3.12.0.jar lib/common-rest-model-2.0.0.jar lib/jackson-core-2.8.1
 0.jar lib/spring-beans-4.3.13.RELEASE.jar lib/swagger-annotations-1.5
 .20.jar lib/javax.servlet-api-3.1.0.jar lib/slf4j-api-1.7.25.jar lib/
 fastjson-1.2.76.jar lib/common-request-mapping-2.0.0.jar lib/common-e
 fastjson-1.2.83.jar lib/common-request-mapping-2.0.0.jar lib/common-e
 xception-2.0.0.jar lib/common-util-2.0.0.jar lib/spring-core-4.3.13.R
 ELEASE.jar lib/spring-context-4.3.13.RELEASE.jar lib/jpinyin-1.1.8.ja
 r lib/core-3.2.0.jar lib/javase-3.2.0.jar lib/utils-2.0.0.jar lib/htt