JSK 解决出入门禁无记录的问题
This commit is contained in:
parent
e5f4f3cf70
commit
fd5d0c3b4b
|
|
@ -6,12 +6,15 @@ import com.bonus.canteen.core.kitchen.domain.AccessAuthority;
|
|||
import com.bonus.canteen.core.kitchen.domain.KitchenStaffInfo;
|
||||
import com.bonus.canteen.core.kitchen.service.IKitchenDeviceInfoService;
|
||||
import com.bonus.canteen.core.kitchen.service.IKitchenStaffInfoService;
|
||||
import com.bonus.canteen.core.kitchen.utils.NetSDK.Alarm;
|
||||
import com.bonus.canteen.core.kitchen.utils.NetSDK.FMSGCallBack_V31;
|
||||
import com.bonus.canteen.core.kitchen.utils.NetSDK.FaceManage;
|
||||
import com.bonus.canteen.core.kitchen.utils.NetSDK.UserManage;
|
||||
import com.bonus.canteen.core.kitchen.utils.initServer;
|
||||
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceListVO;
|
||||
import com.bonus.canteen.core.utils.BnsUtils;
|
||||
import com.bonus.common.houqin.constant.DeviceTypeEnum;
|
||||
import com.sun.jna.Pointer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -52,11 +55,11 @@ public class KitchenStaffInfoFaceTask {
|
|||
return;
|
||||
}
|
||||
List<KitchenStaffInfo> list=this.kitchenStaffInfoService.selectKitchenStaffInfoList(new KitchenStaffInfo());
|
||||
int userl=-1;
|
||||
// int userl=-1;
|
||||
String ip="192.168.20.51";
|
||||
String user="admin";
|
||||
String pass="JYY202509";
|
||||
userl=initServer.LoginReture(ip,user,pass,(short) 8000,1);
|
||||
// userl=initServer.LoginReture(ip,user,pass,(short) 8000,1);
|
||||
for(KitchenStaffInfo info:list){
|
||||
if("1".equals(info.getFaceFlage())){
|
||||
continue;
|
||||
|
|
@ -73,17 +76,17 @@ public class KitchenStaffInfoFaceTask {
|
|||
if(devlist!=null&&devlist.size()>0){
|
||||
for(AccessAuthority aaInfo:devlist){
|
||||
KitchenDeviceListVO vo=kitchenDeviceInfoService.selectKitchenDeviceInfoByDeviceId(aaInfo.getDeviceId());
|
||||
if(userl==-1){
|
||||
if(initServer.lUserID==-1){
|
||||
logger.info("[定时修复发送门禁人脸信息]:{},{}", ip+"无法登录", LocalDateTime.now());
|
||||
}else{
|
||||
logger.info("[定时修复发送门禁人脸信息]:{},{}", ip+"登录成功", LocalDateTime.now());
|
||||
logger.info(info.getStaffNo());
|
||||
logger.info(info.getFaceUrl());
|
||||
// UserManage.deleteUserInfo(userl,info.getStaffNo());
|
||||
UserManage.addUserInfo(userl,info.getStaffNo(),info.getStaffName());
|
||||
UserManage.addUserInfo(initServer.lUserID,info.getStaffNo(),info.getStaffName());
|
||||
File file = BnsUtils.getFile(info.getFaceUrl(),info.getFaceUrl().substring(info.getFaceUrl().indexOf("/")));
|
||||
System.out.println(file.getAbsolutePath());
|
||||
int faceres=FaceManage.AddFaceByBinaryFile(userl,info.getStaffNo(),file);
|
||||
int faceres=FaceManage.AddFaceByBinaryFile(initServer.lUserID,info.getStaffNo(),file);
|
||||
if(faceres==1){
|
||||
info.setFaceFlage("1");
|
||||
kitchenStaffInfoService.updateKitchenStaffInfoFaceFlage(info);
|
||||
|
|
@ -95,11 +98,99 @@ public class KitchenStaffInfoFaceTask {
|
|||
}
|
||||
}
|
||||
}
|
||||
initServer.logout(userl);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("[定时修复发送门禁人脸信息]结束:{},{}", "1", LocalDateTime.now());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时初始化厨房门禁设备权柄;防止设备突发出现断联
|
||||
*/
|
||||
@Scheduled(fixedDelay = 10 * 60 * 1000)
|
||||
public void InitDev() throws InterruptedException {
|
||||
System.out.println("检查门禁设备及初始化设备!");
|
||||
boolean dd=initServer.hCNetSDK.NET_DVR_RemoteControl(initServer.lUserID,20005,null,0);
|
||||
if(dd){
|
||||
System.out.println("=========前门门禁识别设备在线!");
|
||||
}else{
|
||||
System.out.println("==========前门门禁识别设备不在线!重新注册");
|
||||
if(initServer.hCNetSDK == null){
|
||||
if(!initServer.CreateSDKInstance()){
|
||||
System.out.println("Load SDK fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
initServer.hCNetSDK.NET_DVR_Init();
|
||||
boolean i= initServer.hCNetSDK.NET_DVR_SetLogToFile(3, "..//sdklog", false);
|
||||
//设置报警回调函
|
||||
if (initServer.fMSFCallBack_V31 == null) {
|
||||
initServer.fMSFCallBack_V31 = new FMSGCallBack_V31();
|
||||
Pointer pUser = null;
|
||||
if (!initServer.hCNetSDK.NET_DVR_SetDVRMessageCallBack_V31(initServer.fMSFCallBack_V31, pUser)) {
|
||||
System.out.println("设置回调函数失败!");
|
||||
} else {
|
||||
System.out.println("设置回调函数成功!");
|
||||
}
|
||||
}
|
||||
initServer.Login(initServer.devIp,initServer.devUser,initServer.devPass,(short) 8000,1); //登陆
|
||||
Thread.sleep(2000);
|
||||
Alarm.SetAlarm(initServer.lUserID);
|
||||
}
|
||||
boolean dd3=initServer.hCNetSDK.NET_DVR_RemoteControl(initServer.lUserID3,20005,null,0);
|
||||
if(dd3){
|
||||
System.out.println("=========后门门禁识别设备在线!");
|
||||
}else{
|
||||
System.out.println("==========后门门禁识别设备不在线!重新注册");
|
||||
if(initServer.hCNetSDK == null){
|
||||
if(!initServer.CreateSDKInstance()){
|
||||
System.out.println("Load SDK fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
initServer.hCNetSDK.NET_DVR_Init();
|
||||
boolean i= initServer.hCNetSDK.NET_DVR_SetLogToFile(3, "..//sdklog", false);
|
||||
//设置报警回调函
|
||||
if (initServer.fMSFCallBack_V31 == null) {
|
||||
initServer.fMSFCallBack_V31 = new FMSGCallBack_V31();
|
||||
Pointer pUser = null;
|
||||
if (!initServer.hCNetSDK.NET_DVR_SetDVRMessageCallBack_V31(initServer.fMSFCallBack_V31, pUser)) {
|
||||
System.out.println("设置回调函数失败!");
|
||||
} else {
|
||||
System.out.println("设置回调函数成功!");
|
||||
}
|
||||
}
|
||||
initServer.Login(initServer.devIp3,initServer.devUser,initServer.devPass,(short) 8000,3); //登陆
|
||||
Thread.sleep(2000);
|
||||
Alarm.SetAlarm(initServer.lUserID3);
|
||||
}
|
||||
boolean video=initServer.hCNetSDK.NET_DVR_RemoteControl(initServer.lUserID2,20005,null,0);
|
||||
if(video){
|
||||
System.out.println("=========智能摄像头识别设备在线!");
|
||||
}else{
|
||||
System.out.println("==========智能摄像头识别设备不在线!重新注册");
|
||||
if(initServer.hCNetSDK == null){
|
||||
if(!initServer.CreateSDKInstance()){
|
||||
System.out.println("Load SDK fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
initServer.hCNetSDK.NET_DVR_Init();
|
||||
boolean i= initServer.hCNetSDK.NET_DVR_SetLogToFile(3, "..//sdklog", false);
|
||||
//设置报警回调函
|
||||
if (initServer.fMSFCallBack_V31 == null) {
|
||||
initServer.fMSFCallBack_V31 = new FMSGCallBack_V31();
|
||||
Pointer pUser = null;
|
||||
if (!initServer.hCNetSDK.NET_DVR_SetDVRMessageCallBack_V31(initServer.fMSFCallBack_V31, pUser)) {
|
||||
System.out.println("设置回调函数失败!");
|
||||
} else {
|
||||
System.out.println("设置回调函数成功!");
|
||||
}
|
||||
}
|
||||
initServer.Login(initServer.devIp2,initServer.devUser,initServer.devPass,(short) 8000,2); //登陆
|
||||
}
|
||||
|
||||
// initServer.Login(initServer.devIp4,initServer.devUser,initServer.devPass,(short) 8000,4); //登陆
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ public class KitchenStaffEnterExitRecord extends BaseEntity {
|
|||
private String endDate;
|
||||
private String articleTitle;
|
||||
private String employeeNo;
|
||||
private String photoUrl;
|
||||
|
||||
private String subPlaceId;
|
||||
|
||||
|
|
|
|||
|
|
@ -198,8 +198,14 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
|||
|
||||
//获取门禁设备
|
||||
if(results !=null && results.length>0){
|
||||
initServer.Login(initServer.devIp,initServer.devUser,initServer.devPass,(short) 8000,1); //登陆
|
||||
initServer.Login(initServer.devIp3,initServer.devUser,initServer.devPass,(short) 8000,3); //登陆
|
||||
boolean dd=initServer.hCNetSDK.NET_DVR_RemoteControl(initServer.lUserID,20005,null,0);
|
||||
if(!dd){
|
||||
initServer.Login(initServer.devIp,initServer.devUser,initServer.devPass,(short) 8000,1);
|
||||
}
|
||||
dd=initServer.hCNetSDK.NET_DVR_RemoteControl(initServer.lUserID3,20005,null,0);
|
||||
if(!dd){
|
||||
initServer.Login(initServer.devIp3,initServer.devUser,initServer.devPass,(short) 8000,3); //登陆
|
||||
}
|
||||
List<KitchenDeviceListVO> deviceListVOList = kitchenDeviceInfoMapper.selectKitchenDeviceInfoByDeviceIds(results);
|
||||
if(faceUrl !=null && !"".equals(faceUrl) ){
|
||||
if(deviceListVOList !=null && deviceListVOList.size()>0){
|
||||
|
|
@ -220,8 +226,6 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
|||
}
|
||||
}
|
||||
}
|
||||
initServer.logout(initServer.lUserID);
|
||||
initServer.logout(initServer.lUserID3);
|
||||
}else{
|
||||
System.err.println("没有上传人脸信息");
|
||||
}
|
||||
|
|
@ -249,8 +253,14 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateKitchenStaffInfo(KitchenStaffInfo kitchenStaffInfo) {
|
||||
initServer.Login(initServer.devIp,initServer.devUser,initServer.devPass,(short) 8000,1); //登陆
|
||||
initServer.Login(initServer.devIp3,initServer.devUser,initServer.devPass,(short) 8000,3); //登陆
|
||||
boolean dd=initServer.hCNetSDK.NET_DVR_RemoteControl(initServer.lUserID,20005,null,0);
|
||||
if(!dd){
|
||||
initServer.Login(initServer.devIp,initServer.devUser,initServer.devPass,(short) 8000,1);
|
||||
}
|
||||
dd=initServer.hCNetSDK.NET_DVR_RemoteControl(initServer.lUserID3,20005,null,0);
|
||||
if(!dd){
|
||||
initServer.Login(initServer.devIp3,initServer.devUser,initServer.devPass,(short) 8000,3); //登陆
|
||||
}
|
||||
try {
|
||||
if(Objects.isNull(kitchenStaffInfo.getStaffId())) {
|
||||
throw new ServiceException("员工ID不能为空");
|
||||
|
|
@ -313,8 +323,6 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
|||
}
|
||||
}
|
||||
|
||||
initServer.logout(initServer.lUserID);
|
||||
initServer.logout(initServer.lUserID3);
|
||||
addDevicePrivileges(kitchenStaffInfo);
|
||||
System.err.println("修改人脸信息了");
|
||||
KitchenStaffFace kitchenStaffFace = new KitchenStaffFace();
|
||||
|
|
@ -332,8 +340,8 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
|||
* 求 oldResult 相对于 newResult 的差集(在old中但不在new中)
|
||||
*/
|
||||
public static Long[] difference(Long[] oldResult, Long[] newResult) {
|
||||
if (oldResult == null) return new Long[0];
|
||||
if (newResult == null) return Arrays.copyOf(oldResult, oldResult.length);
|
||||
if (oldResult == null) {return new Long[0];}
|
||||
if (newResult == null) {return Arrays.copyOf(oldResult, oldResult.length);}
|
||||
|
||||
Set<Long> newSet = Arrays.stream(newResult)
|
||||
.filter(Objects::nonNull)
|
||||
|
|
@ -395,7 +403,12 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
|||
try{
|
||||
boolean dd=initServer.hCNetSDK.NET_DVR_RemoteControl(lUserID,20005,null,0);
|
||||
if(!dd){
|
||||
initServer.Login(devIp,initServer.devUser,initServer.devPass,(short) 8000,1);
|
||||
if("192.168.20.52".equals(devIp)){
|
||||
initServer.Login(devIp,initServer.devUser,initServer.devPass,(short) 8000,1);
|
||||
}else{
|
||||
initServer.Login(devIp,initServer.devUser,initServer.devPass,(short) 8000,3);
|
||||
}
|
||||
|
||||
}
|
||||
deleteFaceInfo(lUserID,kitchenStaffInfo.getStaffNo());
|
||||
UserManage.addUserInfo(lUserID,kitchenStaffInfo.getStaffNo(),kitchenStaffInfo.getStaffName());
|
||||
|
|
|
|||
|
|
@ -5,47 +5,5 @@ import com.sun.jna.Pointer;
|
|||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
public class InitDevTask {
|
||||
/**
|
||||
* 定时初始化厨房门禁设备权柄;防止设备突发出现断联
|
||||
*/
|
||||
@Scheduled(fixedDelay = 30*60*1000)
|
||||
public void InitDev(){
|
||||
boolean dd=initServer.hCNetSDK.NET_DVR_RemoteControl(initServer.lUserID,20005,null,0);
|
||||
if(dd){
|
||||
System.out.println("=========门禁识别设备在线!");
|
||||
return;
|
||||
}else{
|
||||
System.out.println("==========门禁识别设备不在线!重新注册");
|
||||
}
|
||||
|
||||
boolean video=initServer.hCNetSDK.NET_DVR_RemoteControl(initServer.lUserID2,20005,null,0);
|
||||
if(video){
|
||||
System.out.println("=========智能摄像头识别设备在线!");
|
||||
return;
|
||||
}else{
|
||||
System.out.println("==========智能摄像头识别设备不在线!重新注册");
|
||||
}
|
||||
if(initServer.hCNetSDK == null){
|
||||
if(!initServer.CreateSDKInstance()){
|
||||
System.out.println("Load SDK fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
initServer.hCNetSDK.NET_DVR_Init();
|
||||
boolean i= initServer.hCNetSDK.NET_DVR_SetLogToFile(3, "..//sdklog", false);
|
||||
//设置报警回调函
|
||||
if (initServer.fMSFCallBack_V31 == null) {
|
||||
initServer.fMSFCallBack_V31 = new FMSGCallBack_V31();
|
||||
Pointer pUser = null;
|
||||
if (!initServer.hCNetSDK.NET_DVR_SetDVRMessageCallBack_V31(initServer.fMSFCallBack_V31, pUser)) {
|
||||
System.out.println("设置回调函数失败!");
|
||||
} else {
|
||||
System.out.println("设置回调函数成功!");
|
||||
}
|
||||
}
|
||||
// initServer.Login(initServer.devIp,initServer.devUser,initServer.devPass,(short) 8000,1); //登陆
|
||||
initServer.Login(initServer.devIp2,initServer.devUser,initServer.devPass,(short) 8000,2); //登陆
|
||||
// initServer.Login(initServer.devIp3,initServer.devUser,initServer.devPass,(short) 8000,3); //登陆
|
||||
// initServer.Login(initServer.devIp4,initServer.devUser,initServer.devPass,(short) 8000,4); //登陆
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,14 @@ import cn.hutool.core.thread.ThreadException;
|
|||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.bonus.canteen.core.kitchen.domain.KitchenStaffEnterExitRecord;
|
||||
import com.bonus.canteen.core.kitchen.dto.VideoPhotoDTO;
|
||||
import com.bonus.canteen.core.kitchen.feign.FileServiceClient;
|
||||
import com.bonus.canteen.core.kitchen.service.IKitchenStaffEnterExitRecordService;
|
||||
import com.bonus.canteen.core.kitchen.service.IKitchenStaffIllegalWarningService;
|
||||
import com.bonus.canteen.core.kitchen.utils.ByteStringUtils;
|
||||
import com.bonus.canteen.core.kitchen.utils.ImageUtils;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
import com.sun.jna.Pointer;
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.apache.commons.fileupload.FileItemFactory;
|
||||
|
|
@ -30,17 +33,18 @@ import java.util.Objects;
|
|||
public class FMSGCallBack_V31 implements HCNetSDK.FMSGCallBack_V31 {
|
||||
|
||||
IKitchenStaffIllegalWarningService kitchenStaffIllegalWarningService = SpringUtil.getBean(IKitchenStaffIllegalWarningService.class);
|
||||
|
||||
FileServiceClient fileServiceClient=SpringUtil.getBean(FileServiceClient.class);
|
||||
// @Resource
|
||||
// private IKitchenStaffIllegalWarningService kitchenStaffIllegalWarningService;
|
||||
//报警信息回调函数
|
||||
@Override
|
||||
public boolean invoke(int lCommand, HCNetSDK.NET_DVR_ALARMER pAlarmer, Pointer pAlarmInfo, int dwBufLen, Pointer pUser) {
|
||||
// System.out.println("报警类型1 lCommand:" + Integer.toHexString(lCommand));
|
||||
AlarmDataHandle(lCommand, pAlarmer, pAlarmInfo, dwBufLen, pUser);
|
||||
return true;
|
||||
}
|
||||
public void AlarmDataHandle(int lCommand, HCNetSDK.NET_DVR_ALARMER pAlarmer, Pointer pAlarmInfo, int dwBufLen, Pointer pUser) {
|
||||
// System.out.println("报警类型 lCommand:" + Integer.toHexString(lCommand));
|
||||
// System.out.println("报警类型2 lCommand:" + Integer.toHexString(lCommand));
|
||||
switch (lCommand) {
|
||||
case HCNetSDK.COMM_ALARM_ACS: //门禁主机报警信息
|
||||
HCNetSDK.NET_DVR_ACS_ALARM_INFO strACSInfo = new HCNetSDK.NET_DVR_ACS_ALARM_INFO();
|
||||
|
|
@ -79,16 +83,17 @@ public class FMSGCallBack_V31 implements HCNetSDK.FMSGCallBack_V31 {
|
|||
String mino=strACSInfo.struTime.dwMinute>=10?strACSInfo.struTime.dwMinute+"":("0"+strACSInfo.struTime.dwMinute)+"";
|
||||
String seco=strACSInfo.struTime.dwSecond>=10?strACSInfo.struTime.dwSecond+"":("0"+strACSInfo.struTime.dwSecond)+"";
|
||||
String SwipeTime=yearo+"-"+montho+"-"+dayo+" "+houro+":"+mino+":"+seco;
|
||||
System.out.println(SwipeTime+"====={正在获取工号:"+new String(strAcsInfoEx.byEmployeeNo).trim()+"}"+"{正在获取读卡器当前验证方式:"+strAcsInfoEx.byCurrentVerifyMode+"}"+"{正在获取是否为实时事件:"+strAcsInfoEx.byCurrentEvent+"}");
|
||||
String deviceIp = new String(pAlarmer.sDeviceIP).trim();
|
||||
System.out.println(SwipeTime+"====={正在获取工号:"+new String(strAcsInfoEx.byEmployeeNo).trim()+"}"+"{正在获取读卡器当前验证方式:"+strAcsInfoEx.byCurrentVerifyMode+"}"+"{正在获取是否为实时事件:"+strAcsInfoEx.byCurrentEvent+"}"+deviceIp);
|
||||
if (strACSInfo.dwPicDataLen > 0) {
|
||||
IKitchenStaffEnterExitRecordService kitchenStaffEnterExitRecordService = SpringUtil.getBean(IKitchenStaffEnterExitRecordService.class);
|
||||
String employeeNo=new String(strAcsInfoEx.byEmployeeNo).trim();
|
||||
KitchenStaffEnterExitRecord user=kitchenStaffEnterExitRecordService.selectKitchenStaffByEmployeeNo(employeeNo);
|
||||
if(user==null){
|
||||
if(user==null||user.getStaffName()==null){
|
||||
return;
|
||||
}
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
KitchenStaffEnterExitRecord userRecord=kitchenStaffEnterExitRecordService.selectKitchenStaffByEmployeeNo(employeeNo);
|
||||
KitchenStaffEnterExitRecord userRecord=kitchenStaffEnterExitRecordService.selectKitchenStaffEnterExitRecordByEmployeeNo(employeeNo);
|
||||
Date swipedata=null;
|
||||
try{
|
||||
swipedata=sdf.parse(SwipeTime);
|
||||
|
|
@ -104,18 +109,44 @@ public class FMSGCallBack_V31 implements HCNetSDK.FMSGCallBack_V31 {
|
|||
}catch (Exception e){
|
||||
}
|
||||
KitchenStaffEnterExitRecord vo=new KitchenStaffEnterExitRecord();
|
||||
vo.setStaffId(user.getStaffId());
|
||||
vo.setEnterTime(swipedata);
|
||||
vo.setDeviceId(13L);
|
||||
vo.setCreateTime(new Date());
|
||||
vo.setInoutType("人脸");
|
||||
vo.setInoutDirection("进入");
|
||||
String photoUrl=null;
|
||||
try{
|
||||
if (strACSInfo.dwPicDataLen > 0) {
|
||||
//将字节写入文件
|
||||
long offset = 0;
|
||||
ByteBuffer buffers = strACSInfo.pPicData.getByteBuffer(offset, strACSInfo.dwPicDataLen);
|
||||
byte[] bytes = new byte[strACSInfo.dwPicDataLen];
|
||||
AjaxResult ar = fileServiceClient.uploadVideoFile(convertByteToMultipartFile(bytes,"demo.jpg"));
|
||||
SysFile sysFile = ar.getDataAs(SysFile.class);
|
||||
photoUrl=sysFile.getUrl();
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
if("192.168.20.51".equals(deviceIp)){
|
||||
vo.setStaffId(user.getStaffId());
|
||||
vo.setEnterTime(swipedata);
|
||||
vo.setDeviceId(6L);
|
||||
vo.setCreateTime(new Date());
|
||||
vo.setInoutType("人脸");
|
||||
vo.setEnterImgUrl(photoUrl==null?user.getPhotoUrl():photoUrl);
|
||||
vo.setInoutDirection("进入");
|
||||
}else {
|
||||
vo.setStaffId(user.getStaffId());
|
||||
vo.setExitTime(swipedata);
|
||||
vo.setDeviceId(7L);
|
||||
vo.setExitImgUrl(photoUrl==null?user.getPhotoUrl():photoUrl);
|
||||
vo.setCreateTime(new Date());
|
||||
vo.setInoutType("人脸");
|
||||
vo.setInoutDirection("出去");
|
||||
}
|
||||
|
||||
try{
|
||||
kitchenStaffEnterExitRecordService.insertKitchenStaffEnterExitRecord(vo);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
// FileOutputStream fout;
|
||||
// FileOutputStream fout;fileServiceClient
|
||||
// try {
|
||||
// /*** 人脸保存路径*/
|
||||
// String filename = "C:/video/" +SwipeTime+"_"+ new String(strAcsInfoEx.byEmployeeNo).trim() + ".jpg";
|
||||
|
|
|
|||
|
|
@ -54,19 +54,32 @@ public class initServer implements CommandLineRunner {
|
|||
fMSFCallBack_V31 = new FMSGCallBack_V31();
|
||||
Pointer pUser = null;
|
||||
if (!initServer.hCNetSDK.NET_DVR_SetDVRMessageCallBack_V31(fMSFCallBack_V31, pUser)) {
|
||||
System.out.println("设置回调函数失败!");
|
||||
System.out.println("初始设置回调函数失败!");
|
||||
} else {
|
||||
System.out.println("设置回调函数成功!");
|
||||
System.out.println("初始设置回调函数成功!");
|
||||
}
|
||||
}
|
||||
// Login(devIp,devUser,devPass,(short) 8000,1); //登陆
|
||||
Login(devIp2,devUser,devPass,(short) 8000,2); //登陆
|
||||
// Login(devIp3,devUser,devPass,(short) 8000,3); //登陆
|
||||
boolean dd=initServer.hCNetSDK.NET_DVR_RemoteControl(initServer.lUserID,20005,null,0);
|
||||
if(dd){
|
||||
System.out.println("初始:"+devIp);
|
||||
Login(devIp,devUser,devPass,(short) 8000,1); //登陆
|
||||
Thread.sleep(2000);
|
||||
Alarm.SetAlarm(initServer.lUserID);
|
||||
}
|
||||
dd=initServer.hCNetSDK.NET_DVR_RemoteControl(initServer.lUserID2,20005,null,0);
|
||||
if(dd){
|
||||
System.out.println("初始:"+devIp2);
|
||||
Login(devIp2,devUser,devPass,(short) 8000,2); //登陆
|
||||
}
|
||||
dd=initServer.hCNetSDK.NET_DVR_RemoteControl(initServer.lUserID3,20005,null,0);
|
||||
if(dd){
|
||||
System.out.println("初始:"+devIp3);
|
||||
Login(devIp3,devUser,devPass,(short) 8000,3); //登陆
|
||||
Thread.sleep(2000);
|
||||
Alarm.SetAlarm(initServer.lUserID3);
|
||||
}
|
||||
System.err.println("hCNetSDK1111111111111=="+hCNetSDK);
|
||||
// Login(devIp4,devUser,devPass,(short) 8000,4); //登陆
|
||||
// Alarm.SetAlarm(lUserID2);
|
||||
// Thread.sleep(2000);
|
||||
// Alarm.SetAlarm(lUserID);
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
|
@ -196,7 +209,7 @@ public class initServer implements CommandLineRunner {
|
|||
if (lUserID == -1){
|
||||
System.out.println("门禁登录失败,错误码为" + hCNetSDK.NET_DVR_GetLastError());
|
||||
}else{
|
||||
System.out.println("门禁登录成功!");
|
||||
System.out.println(ipadress+"门禁登录成功!");
|
||||
m_strDeviceInfo.read();
|
||||
iCharEncodeType = m_strDeviceInfo.byCharEncodeType;
|
||||
}
|
||||
|
|
@ -205,7 +218,7 @@ public class initServer implements CommandLineRunner {
|
|||
if (lUserID2 == -1){
|
||||
System.out.println("智能识别登录失败,错误码为" + hCNetSDK.NET_DVR_GetLastError());
|
||||
}else{
|
||||
System.out.println("智能识别登录成功!");
|
||||
System.out.println(ipadress+"智能识别登录成功!");
|
||||
m_strDeviceInfo.read();
|
||||
iCharEncodeType = m_strDeviceInfo.byCharEncodeType;
|
||||
}
|
||||
|
|
@ -214,7 +227,7 @@ public class initServer implements CommandLineRunner {
|
|||
if (lUserID3 == -1){
|
||||
System.out.println("门禁登录失败,错误码为" + hCNetSDK.NET_DVR_GetLastError());
|
||||
}else{
|
||||
System.out.println("门禁登录成功!");
|
||||
System.out.println(ipadress+"门禁登录成功!");
|
||||
m_strDeviceInfo.read();
|
||||
iCharEncodeType = m_strDeviceInfo.byCharEncodeType;
|
||||
}
|
||||
|
|
@ -223,7 +236,7 @@ public class initServer implements CommandLineRunner {
|
|||
if (lUserID4 == -1){
|
||||
System.out.println("晨检机登录失败,错误码为" + hCNetSDK.NET_DVR_GetLastError());
|
||||
}else{
|
||||
System.out.println("晨检机登录成功!");
|
||||
System.out.println(ipadress+"晨检机登录成功!");
|
||||
m_strDeviceInfo.read();
|
||||
iCharEncodeType = m_strDeviceInfo.byCharEncodeType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.beans.BeanWrapper;
|
||||
import org.springframework.beans.BeanWrapperImpl;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
|
@ -87,4 +86,20 @@ public class BnsUtils {
|
|||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
public static void saveImage(byte[] imageBytes, String outputPath) {
|
||||
try {
|
||||
// 将byte数组转换为输入流
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(imageBytes);
|
||||
// 读取图像
|
||||
BufferedImage image = ImageIO.read(inputStream);
|
||||
// 确保输入流被关闭
|
||||
inputStream.close();
|
||||
// 写入图像到文件
|
||||
File outputFile = new File(outputPath);
|
||||
ImageIO.write(image, "jpg", outputFile); // 指定格式为jpg
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="inoutType" column="inout_type" />
|
||||
<result property="inoutDirection" column="inout_direction" />
|
||||
<result property="subPlaceName" column="sub_place_name" />
|
||||
<result property="photoUrl" column="photo_url" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectKitchenStaffEnterExitRecordVo">
|
||||
|
|
|
|||
Loading…
Reference in New Issue