增加证书实现类
This commit is contained in:
parent
4df0355c0f
commit
a9267ccd65
|
@ -96,10 +96,4 @@ public class TenSafeVideoController {
|
||||||
tenSafeVideoService.removeByIds(Arrays.asList(ids));
|
tenSafeVideoService.removeByIds(Arrays.asList(ids));
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/camara")
|
|
||||||
public R watchStart(String cellId) {
|
|
||||||
rtspFrameGrabber.startGrabber(cellId);
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -33,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
@ -157,55 +158,8 @@ public class RtspFrameGrabber {
|
||||||
|
|
||||||
// 转换为byte数组
|
// 转换为byte数组
|
||||||
byte[] imageBytes = baos.toByteArray();*/
|
byte[] imageBytes = baos.toByteArray();*/
|
||||||
if (bytes != null && bytes.length > 0) {
|
imageRecognition(bytes,cellId);
|
||||||
ImageInfo imageInfo = ImageFactory.getRGBData(bytes);
|
|
||||||
List<FaceInfo> faceInfoList = faceEngineService.detectFaces(imageInfo);
|
|
||||||
if (CollectionUtil.isNotEmpty(faceInfoList)) {
|
|
||||||
faceInfoList.forEach(faceInfo -> {
|
|
||||||
FaceRecognitionResDTO faceRecognitionResDTO = new FaceRecognitionResDTO();
|
|
||||||
faceRecognitionResDTO.setRect(faceInfo.getRect());
|
|
||||||
byte[] featureBytes = faceEngineService.extractFaceFeature(imageInfo, faceInfo, ExtractType.REGISTER);
|
|
||||||
if (featureBytes != null) {
|
|
||||||
List<UserInfo> userInfoList = UserRamGroup.getUserList(cellId);
|
|
||||||
List<UserCompareInfo> userCompareInfoList = faceEngineService.faceRecognition(featureBytes,userInfoList,Float.parseFloat(globalValue.getRecFaceThd()));
|
|
||||||
if(!userCompareInfoList.isEmpty()) {
|
|
||||||
UserCompareInfo userCompareInfo = userCompareInfoList.get(0);
|
|
||||||
TenPersonEntity tenPerson = personService.getOne(new LambdaQueryWrapper<TenPersonEntity>()
|
|
||||||
.eq(TenPersonEntity::getPersonId,userCompareInfo.getFaceId()));
|
|
||||||
Map<Integer,String> personnelTypeMap = new HashMap<>();
|
|
||||||
personnelTypeMap.put(Constant.PERSON_TYPE_OWNER,"2");//内部人员
|
|
||||||
personnelTypeMap.put(Constant.PERSON_TYPE_MEMBER,"1");//承包商
|
|
||||||
personnelTypeMap.put(Constant.PERSON_TYPE_TENANT,"3");//长期供应商
|
|
||||||
Map<String,Object> params = new HashMap<>();
|
|
||||||
params.put("pmWatchVideoRecordId","");
|
|
||||||
params.put("orgId",tenPerson.getOrgId());
|
|
||||||
params.put("orgName","");
|
|
||||||
params.put("personnelName",tenPerson.getName());
|
|
||||||
params.put("personnelId",tenPerson.getOpenId());
|
|
||||||
params.put("personnelCardId",tenPerson.getIdCard());
|
|
||||||
params.put("personnelType",personnelTypeMap.get(tenPerson.getPersonType()));
|
|
||||||
params.put("dictSex",tenPerson.getGender()==0?"女":"男");
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
||||||
params.put("watchVideoTime",sdf.format(System.currentTimeMillis()));
|
|
||||||
JSONObject jsonObject = feignClient.savePmWatchVideoRecord(params);
|
|
||||||
if(jsonObject.getBool("success")!=null&&jsonObject.getBool("success")) {
|
|
||||||
personService.update(new LambdaUpdateWrapper<TenPersonEntity>()
|
|
||||||
.set(TenPersonEntity::getIsWatchSafeVideo,1)
|
|
||||||
.eq(TenPersonEntity::getPersonId,userCompareInfo.getFaceId()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
log.error("图片不合格,未检测到人脸");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
log.error("图片不合格,未检测到人脸");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
log.error("解码失败");
|
log.error("解码失败");
|
||||||
if (grabber != null) {
|
if (grabber != null) {
|
||||||
|
@ -241,6 +195,67 @@ public class RtspFrameGrabber {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void recognition(MultipartFile file,String cellId) {
|
||||||
|
try {
|
||||||
|
byte[] bytes = file.getBytes();
|
||||||
|
imageRecognition(bytes,cellId);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void imageRecognition(byte[] bytes,String cellId) {
|
||||||
|
if (bytes != null && bytes.length > 0) {
|
||||||
|
ImageInfo imageInfo = ImageFactory.getRGBData(bytes);
|
||||||
|
List<FaceInfo> faceInfoList = faceEngineService.detectFaces(imageInfo);
|
||||||
|
if (CollectionUtil.isNotEmpty(faceInfoList)) {
|
||||||
|
faceInfoList.forEach(faceInfo -> {
|
||||||
|
FaceRecognitionResDTO faceRecognitionResDTO = new FaceRecognitionResDTO();
|
||||||
|
faceRecognitionResDTO.setRect(faceInfo.getRect());
|
||||||
|
byte[] featureBytes = faceEngineService.extractFaceFeature(imageInfo, faceInfo, ExtractType.REGISTER);
|
||||||
|
if (featureBytes != null) {
|
||||||
|
List<UserInfo> userInfoList = UserRamGroup.getUserList(cellId);
|
||||||
|
List<UserCompareInfo> userCompareInfoList = faceEngineService.faceRecognition(featureBytes,userInfoList,Float.parseFloat(globalValue.getRecFaceThd()));
|
||||||
|
if(!userCompareInfoList.isEmpty()) {
|
||||||
|
UserCompareInfo userCompareInfo = userCompareInfoList.get(0);
|
||||||
|
TenPersonEntity tenPerson = personService.getOne(new LambdaQueryWrapper<TenPersonEntity>()
|
||||||
|
.eq(TenPersonEntity::getPersonId,userCompareInfo.getFaceId()));
|
||||||
|
Map<Integer,String> personnelTypeMap = new HashMap<>();
|
||||||
|
personnelTypeMap.put(Constant.PERSON_TYPE_OWNER,"2");//内部人员
|
||||||
|
personnelTypeMap.put(Constant.PERSON_TYPE_MEMBER,"1");//承包商
|
||||||
|
personnelTypeMap.put(Constant.PERSON_TYPE_TENANT,"3");//长期供应商
|
||||||
|
Map<String,Object> params = new HashMap<>();
|
||||||
|
params.put("pmWatchVideoRecordId","");
|
||||||
|
params.put("orgId",tenPerson.getOrgId());
|
||||||
|
params.put("orgName","");
|
||||||
|
params.put("personnelName",tenPerson.getName());
|
||||||
|
params.put("personnelId",tenPerson.getOpenId());
|
||||||
|
params.put("personnelCardId",tenPerson.getIdCard());
|
||||||
|
params.put("personnelType",personnelTypeMap.get(tenPerson.getPersonType()));
|
||||||
|
params.put("dictSex",tenPerson.getGender()==0?"女":"男");
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||||
|
params.put("watchVideoTime",sdf.format(System.currentTimeMillis()));
|
||||||
|
/*JSONObject jsonObject = feignClient.savePmWatchVideoRecord(params);
|
||||||
|
if(jsonObject.getBool("success")!=null&&jsonObject.getBool("success")) {
|
||||||
|
personService.update(new LambdaUpdateWrapper<TenPersonEntity>()
|
||||||
|
.set(TenPersonEntity::getIsWatchSafeVideo,1)
|
||||||
|
.eq(TenPersonEntity::getPersonId,userCompareInfo.getFaceId()));
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
log.error("图片不合格,未检测到人脸");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
log.error("图片不合格,未检测到人脸");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图片转字节数组
|
* 图片转字节数组
|
||||||
*
|
*
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -24,19 +25,19 @@ public interface CxFeignClient {
|
||||||
同步安全视频观看记录
|
同步安全视频观看记录
|
||||||
*/
|
*/
|
||||||
@PostMapping("/ExternalService/SavePmWatchVideoRecord")
|
@PostMapping("/ExternalService/SavePmWatchVideoRecord")
|
||||||
JSONObject savePmWatchVideoRecord(@RequestParam Map<String,Object> params);
|
JSONObject savePmWatchVideoRecord(@RequestBody Map<String,Object> params);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
同步进出场记录
|
同步进出场记录
|
||||||
*/
|
*/
|
||||||
@PostMapping("/ExternalService/SavePmEntryExitRecord")
|
@PostMapping("/ExternalService/SavePmEntryExitRecord")
|
||||||
JSONObject savePmEntryExitRecord(@RequestParam Map<String,Object> params);
|
JSONObject savePmEntryExitRecord(@RequestBody Map<String,Object> params);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
同步访客记录
|
同步访客记录
|
||||||
*/
|
*/
|
||||||
@PostMapping("/ExternalService/SavePmVisitorPersonnel")
|
@PostMapping("/ExternalService/SavePmVisitorPersonnel")
|
||||||
JSONObject savePmVisitorPersonnel(@RequestParam Map<String,Object> params);
|
JSONObject savePmVisitorPersonnel(@RequestBody Map<String,Object> params);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
获取内部人员信息
|
获取内部人员信息
|
||||||
|
|
|
@ -2,12 +2,12 @@ package net.shapelight.modules.iCq.controller.video;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.pig4cloud.plugin.oss.service.OssTemplate;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import net.shapelight.common.config.MinioConfig;
|
import net.shapelight.common.config.MinioConfig;
|
||||||
import net.shapelight.common.utils.R;
|
import net.shapelight.common.utils.R;
|
||||||
|
import net.shapelight.modules.face.rtsp.RtspFrameGrabber;
|
||||||
import net.shapelight.modules.iCq.controller.video.dto.UpdateVideoDto;
|
import net.shapelight.modules.iCq.controller.video.dto.UpdateVideoDto;
|
||||||
import net.shapelight.modules.iCq.controller.video.dto.UploadVideoDto;
|
import net.shapelight.modules.iCq.controller.video.dto.UploadVideoDto;
|
||||||
import net.shapelight.modules.iCq.controller.video.vo.Unit;
|
import net.shapelight.modules.iCq.controller.video.vo.Unit;
|
||||||
|
@ -15,6 +15,7 @@ import net.shapelight.modules.iCq.dal.dataobject.video.File;
|
||||||
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
|
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
|
||||||
import net.shapelight.modules.iCq.dal.mysql.video.CqFileMapper;
|
import net.shapelight.modules.iCq.dal.mysql.video.CqFileMapper;
|
||||||
import net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper;
|
import net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@ -34,14 +35,15 @@ public class CqSafeVideoController {
|
||||||
|
|
||||||
private static String BUCKET_NAME = "cqyt";
|
private static String BUCKET_NAME = "cqyt";
|
||||||
|
|
||||||
private final OssTemplate template;
|
|
||||||
|
|
||||||
private final MinioConfig minioConfig;
|
private final MinioConfig minioConfig;
|
||||||
|
|
||||||
private final CqSafeVideoMapper cqSafeVideoMapper;
|
private final CqSafeVideoMapper cqSafeVideoMapper;
|
||||||
|
|
||||||
private final CqFileMapper cqFileMapper;
|
private final CqFileMapper cqFileMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RtspFrameGrabber rtspFrameGrabber;
|
||||||
|
|
||||||
@GetMapping("/getTopUnits")
|
@GetMapping("/getTopUnits")
|
||||||
@ApiOperation(value = "获取单位列表")
|
@ApiOperation(value = "获取单位列表")
|
||||||
public R getTopUnits() {
|
public R getTopUnits() {
|
||||||
|
@ -183,6 +185,19 @@ public class CqSafeVideoController {
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/camara")
|
||||||
|
public R watchStart(String cellId) {
|
||||||
|
rtspFrameGrabber.startGrabber(cellId);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/face/recognition")
|
||||||
|
public R aWatchStart(@RequestParam("image") MultipartFile image,@RequestParam String cellId) {
|
||||||
|
rtspFrameGrabber.recognition(image,cellId);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -266,11 +266,13 @@ public class TenPersonEntity extends BaseEntity implements Serializable {
|
||||||
* 临时身份证正面照片
|
* 临时身份证正面照片
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty("临时身份证正面照片")
|
@ApiModelProperty("临时身份证正面照片")
|
||||||
|
@TableField(exist = false)
|
||||||
private String idFrontImageTemp;
|
private String idFrontImageTemp;
|
||||||
/**
|
/**
|
||||||
* 临时身份证反面照片
|
* 临时身份证反面照片
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty("临时身份证反面照片")
|
@ApiModelProperty("临时身份证反面照片")
|
||||||
|
@TableField(exist = false)
|
||||||
private String idBackImageTemp;
|
private String idBackImageTemp;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue