长庆项目10.23
This commit is contained in:
parent
9927f980de
commit
a861cad96f
|
@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
//import org.bytedeco.opencv.opencv_core.CvPoint;
|
//import org.bytedeco.opencv.opencv_core.CvPoint;
|
||||||
//import org.bytedeco.opencv.opencv_imgproc.CvFont;
|
//import org.bytedeco.opencv.opencv_imgproc.CvFont;
|
||||||
import net.shapelight.common.config.CxFeignConfig;
|
import net.shapelight.common.config.CxFeignConfig;
|
||||||
|
import net.shapelight.common.utils.SslUtils;
|
||||||
import net.shapelight.modules.feignClient.CxFeignClient;
|
import net.shapelight.modules.feignClient.CxFeignClient;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
|
@ -31,8 +32,8 @@ import javax.annotation.PostConstruct;
|
||||||
@EnableFeignClients
|
@EnableFeignClients
|
||||||
//@MapperScan("net.shapelight.modules.sys.dao")
|
//@MapperScan("net.shapelight.modules.sys.dao")
|
||||||
public class AdminApplication {
|
public class AdminApplication {
|
||||||
@Autowired
|
/*@Autowired
|
||||||
CxFeignClient cxFeignClient;
|
CxFeignClient cxFeignClient;*/
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(AdminApplication.class, args);
|
SpringApplication.run(AdminApplication.class, args);
|
||||||
|
@ -60,9 +61,9 @@ public class AdminApplication {
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @Bean
|
/*@PostConstruct
|
||||||
@PostConstruct
|
void init() throws Exception {
|
||||||
void init(){
|
SslUtils.ignoreSsl();
|
||||||
String res = cxFeignClient.getToken("5bb50ad0cc40e10565089c35aa61e7f3","k9?8bCqaQ*R1e2Wx0f65AzY4^]LDp@_Z");
|
String res = cxFeignClient.getToken("5bb50ad0cc40e10565089c35aa61e7f3","k9?8bCqaQ*R1e2Wx0f65AzY4^]LDp@_Z");
|
||||||
CxFeignConfig.token = res;
|
CxFeignConfig.token = res;
|
||||||
}*/
|
}*/
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package net.shapelight.common.utils;
|
||||||
|
|
||||||
|
import javax.net.ssl.*;
|
||||||
|
import java.security.cert.CertificateException;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
|
||||||
|
public class SslUtils {
|
||||||
|
private static void trustAllHttpsCertificates() throws Exception {
|
||||||
|
TrustManager[] trustAllCerts = new TrustManager[1];
|
||||||
|
TrustManager tm = new miTM();
|
||||||
|
trustAllCerts[0] = tm;
|
||||||
|
SSLContext sc = SSLContext.getInstance("SSL");
|
||||||
|
sc.init(null, trustAllCerts, null);
|
||||||
|
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||||
|
}
|
||||||
|
static class miTM implements TrustManager,X509TrustManager {
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public boolean isServerTrusted(X509Certificate[] certs) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public boolean isClientTrusted(X509Certificate[] certs) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public void checkServerTrusted(X509Certificate[] certs, String authType)
|
||||||
|
throws CertificateException {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
public void checkClientTrusted(X509Certificate[] certs, String authType)
|
||||||
|
throws CertificateException {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 忽略HTTPS请求的SSL证书,必须在openConnection之前调用
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static void ignoreSsl() throws Exception{
|
||||||
|
HostnameVerifier hv = new HostnameVerifier() {
|
||||||
|
public boolean verify(String urlHostName, SSLSession session) {
|
||||||
|
System.out.println("Warning: URL Host: " + urlHostName + " vs. " + session.getPeerHost());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
trustAllHttpsCertificates();
|
||||||
|
HttpsURLConnection.setDefaultHostnameVerifier(hv);
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,4 +8,5 @@ import net.shapelight.modules.face.util.UserRamCache;
|
||||||
@Data
|
@Data
|
||||||
public class UserCompareInfo extends UserInfo {
|
public class UserCompareInfo extends UserInfo {
|
||||||
private Float similar;
|
private Float similar;
|
||||||
|
private Integer isHeadOnView; //0否1是
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.arcsoft.face.enums.ExtractType;
|
||||||
import com.arcsoft.face.toolkit.ImageFactory;
|
import com.arcsoft.face.toolkit.ImageFactory;
|
||||||
import com.arcsoft.face.toolkit.ImageInfo;
|
import com.arcsoft.face.toolkit.ImageInfo;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.shapelight.common.config.GlobalValue;
|
import net.shapelight.common.config.GlobalValue;
|
||||||
|
@ -24,6 +25,9 @@ import net.shapelight.modules.face.service.impl.FaceEngineServiceImpl;
|
||||||
import net.shapelight.modules.face.util.UserInfo;
|
import net.shapelight.modules.face.util.UserInfo;
|
||||||
import net.shapelight.modules.face.util.UserRamGroup;
|
import net.shapelight.modules.face.util.UserRamGroup;
|
||||||
import net.shapelight.modules.feignClient.CxFeignClient;
|
import net.shapelight.modules.feignClient.CxFeignClient;
|
||||||
|
import net.shapelight.modules.iCq.controller.video.vo.FaceVideoVo;
|
||||||
|
import net.shapelight.modules.ten.dao.TenCellDao;
|
||||||
|
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||||
import net.shapelight.modules.ten.entity.TenPersonEntity;
|
import net.shapelight.modules.ten.entity.TenPersonEntity;
|
||||||
import net.shapelight.modules.ten.service.TenPersonService;
|
import net.shapelight.modules.ten.service.TenPersonService;
|
||||||
import net.shapelight.modules.ten.service.impl.TenPersonServiceImpl;
|
import net.shapelight.modules.ten.service.impl.TenPersonServiceImpl;
|
||||||
|
@ -96,6 +100,10 @@ public class RtspFrameGrabber {
|
||||||
@Autowired
|
@Autowired
|
||||||
private TenPersonServiceImpl tenPersonService;
|
private TenPersonServiceImpl tenPersonService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TenCellDao tenCellDao;
|
||||||
|
|
||||||
|
|
||||||
private void createGrabber() {
|
private void createGrabber() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -198,39 +206,80 @@ public class RtspFrameGrabber {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recognition(MultipartFile file,String cellId) {
|
public List<FaceVideoVo> recognition(MultipartFile file,String cellId) {
|
||||||
try {
|
try {
|
||||||
byte[] bytes = file.getBytes();
|
byte[] bytes = file.getBytes();
|
||||||
imageRecognition(bytes,cellId);
|
return imageRecognition(bytes, cellId);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void imageRecognition(byte[] bytes,String cellId) {
|
private List<FaceVideoVo> imageRecognition(byte[] bytes,String cellId) {
|
||||||
|
List<FaceVideoVo> temp = new ArrayList<>();
|
||||||
if (bytes != null && bytes.length > 0) {
|
if (bytes != null && bytes.length > 0) {
|
||||||
ImageInfo imageInfo = ImageFactory.getRGBData(bytes);
|
ImageInfo imageInfo = ImageFactory.getRGBData(bytes);
|
||||||
List<FaceInfo> faceInfoList = faceEngineService.detectFaces(imageInfo);
|
List<FaceInfo> faceInfoList = faceEngineService.detectFaces(imageInfo);
|
||||||
|
|
||||||
|
|
||||||
|
/* for (FaceInfo faceInfo : faceInfoList) {
|
||||||
|
System.out.println(faceInfo.getFace3DAngle());
|
||||||
|
//Yaw上下 Pitch左右
|
||||||
|
if (faceInfo.getFace3DAngle().getYaw() > 20 || faceInfo.getFace3DAngle().getYaw() < -20) {
|
||||||
|
System.out.println("没在好好看!!!");
|
||||||
|
// faceInfoList.remove(faceInfo);
|
||||||
|
}
|
||||||
|
if (faceInfo.getFace3DAngle().getPitch() > 20 || faceInfo.getFace3DAngle().getPitch() < -20) {
|
||||||
|
System.out.println("没在好好看!!!");
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(faceInfoList)) {
|
if (CollectionUtil.isNotEmpty(faceInfoList)) {
|
||||||
faceInfoList.forEach(faceInfo -> {
|
faceInfoList.forEach(faceInfo -> {
|
||||||
FaceRecognitionResDTO faceRecognitionResDTO = new FaceRecognitionResDTO();
|
/* FaceRecognitionResDTO faceRecognitionResDTO = new FaceRecognitionResDTO();
|
||||||
faceRecognitionResDTO.setRect(faceInfo.getRect());
|
faceRecognitionResDTO.setRect(faceInfo.getRect());*/
|
||||||
byte[] featureBytes = faceEngineService.extractFaceFeature(imageInfo, faceInfo, ExtractType.REGISTER);
|
|
||||||
|
byte[] featureBytes = faceEngineService.extractFaceFeature(imageInfo,
|
||||||
|
faceInfo, ExtractType.REGISTER);
|
||||||
if (featureBytes != null) {
|
if (featureBytes != null) {
|
||||||
|
//底库
|
||||||
List<UserInfo> userInfoList = UserRamGroup.getUserList(cellId);
|
List<UserInfo> userInfoList = UserRamGroup.getUserList(cellId);
|
||||||
List<UserCompareInfo> userCompareInfoList = faceEngineService.faceRecognition(featureBytes,userInfoList,Float.parseFloat(globalValue.getRecFaceThd()));
|
//人脸对比 这里长度永远为1
|
||||||
|
List<UserCompareInfo> userCompareInfoList = faceEngineService
|
||||||
|
.faceRecognition(featureBytes, userInfoList, Float.parseFloat(globalValue.getRecFaceThd()));
|
||||||
|
|
||||||
|
for (UserCompareInfo userCompareInfo : userCompareInfoList) {
|
||||||
|
FaceVideoVo faceVideoVo = new FaceVideoVo();
|
||||||
|
if (faceInfo.getFace3DAngle().getYaw() > 20 || faceInfo.getFace3DAngle().getYaw() < -20) {
|
||||||
|
faceVideoVo.setIsHeadOnView(0);
|
||||||
|
}else if (faceInfo.getFace3DAngle().getPitch() > 20 || faceInfo.getFace3DAngle().getPitch() < -20) {
|
||||||
|
faceVideoVo.setIsHeadOnView(0);
|
||||||
|
}else {
|
||||||
|
faceVideoVo.setIsHeadOnView(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
faceVideoVo.setPersonId(userCompareInfo.getFaceId()).setName(userCompareInfo.getName());
|
||||||
|
|
||||||
|
temp.add(faceVideoVo);
|
||||||
|
}
|
||||||
if (!userCompareInfoList.isEmpty()) {
|
if (!userCompareInfoList.isEmpty()) {
|
||||||
UserCompareInfo userCompareInfo = userCompareInfoList.get(0);
|
|
||||||
|
for (UserCompareInfo userCompareInfo : userCompareInfoList) {
|
||||||
TenPersonEntity tenPerson = personService.getOne(new LambdaQueryWrapper<TenPersonEntity>()
|
TenPersonEntity tenPerson = personService.getOne(new LambdaQueryWrapper<TenPersonEntity>()
|
||||||
.eq(TenPersonEntity::getPersonId, userCompareInfo.getFaceId()));
|
.eq(TenPersonEntity::getPersonId, userCompareInfo.getFaceId()));
|
||||||
Map<Integer, String> personnelTypeMap = new HashMap<>();
|
Map<Integer, String> personnelTypeMap = new HashMap<>();
|
||||||
personnelTypeMap.put(Constant.PERSON_TYPE_OWNER, "2");//内部人员
|
personnelTypeMap.put(Constant.PERSON_TYPE_OWNER, "2");//内部人员
|
||||||
personnelTypeMap.put(Constant.PERSON_TYPE_MEMBER, "1");//承包商
|
personnelTypeMap.put(Constant.PERSON_TYPE_MEMBER, "1");//承包商
|
||||||
personnelTypeMap.put(Constant.PERSON_TYPE_TENANT, "3");//长期供应商
|
personnelTypeMap.put(Constant.PERSON_TYPE_TENANT, "3");//长期供应商
|
||||||
|
personnelTypeMap.put(Constant.PERSON_TYPE_GUEST, "4");//访客
|
||||||
|
|
||||||
|
//
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("pmWatchVideoRecordId", "");
|
params.put("pmWatchVideoRecordId", "");
|
||||||
params.put("orgId", tenPerson.getOrgId());
|
params.put("orgId", tenPerson.getOrgId());
|
||||||
params.put("orgName","");
|
params.put("orgName", tenCellDao.selectOne(new QueryWrapper<TenCellEntity>().eq("cell_id", tenPerson.getCellId())));
|
||||||
params.put("personnelName", tenPerson.getName());
|
params.put("personnelName", tenPerson.getName());
|
||||||
params.put("personnelId", tenPerson.getOpenId());
|
params.put("personnelId", tenPerson.getOpenId());
|
||||||
params.put("personnelCardId", tenPerson.getIdCard());
|
params.put("personnelCardId", tenPerson.getIdCard());
|
||||||
|
@ -239,15 +288,20 @@ public class RtspFrameGrabber {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||||
params.put("watchVideoTime", sdf.format(System.currentTimeMillis()));
|
params.put("watchVideoTime", sdf.format(System.currentTimeMillis()));
|
||||||
tenPerson.setIsWatchSafeVideo(1);
|
tenPerson.setIsWatchSafeVideo(1);
|
||||||
JSONObject jsonObject = feignClient.savePmWatchVideoRecord(params);
|
tenPersonService.updateById(tenPerson);
|
||||||
|
|
||||||
|
System.out.println("params = " + params);
|
||||||
|
|
||||||
|
/* JSONObject jsonObject = feignClient.savePmWatchVideoRecord(params);
|
||||||
if (jsonObject.getBool("success") != null && jsonObject.getBool("success")) {
|
if (jsonObject.getBool("success") != null && jsonObject.getBool("success")) {
|
||||||
personService.update(new LambdaUpdateWrapper<TenPersonEntity>()
|
personService.update(new LambdaUpdateWrapper<TenPersonEntity>()
|
||||||
.set(TenPersonEntity::getIsWatchSafeVideo, 1)
|
.set(TenPersonEntity::getIsWatchSafeVideo, 1)
|
||||||
.eq(TenPersonEntity::getPersonId, userCompareInfo.getFaceId()));
|
.eq(TenPersonEntity::getPersonId, userCompareInfo.getFaceId()));
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log.error("图片不合格,未检测到人脸");
|
log.error("图片不合格,未检测到人脸");
|
||||||
}
|
}
|
||||||
|
@ -257,7 +311,9 @@ public class RtspFrameGrabber {
|
||||||
log.error("图片不合格,未检测到人脸");
|
log.error("图片不合格,未检测到人脸");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
}
|
}
|
||||||
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -113,7 +113,9 @@ public class FaceEngineServiceImpl implements FaceEngineService {
|
||||||
//人脸检测得到人脸列表
|
//人脸检测得到人脸列表
|
||||||
List<FaceInfo> faceInfoList = new ArrayList<FaceInfo>();
|
List<FaceInfo> faceInfoList = new ArrayList<FaceInfo>();
|
||||||
//人脸检测
|
//人脸检测
|
||||||
int errorCode = faceEngine.detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList);
|
int errorCode = faceEngine.detectFaces(imageInfo.getImageData(),
|
||||||
|
imageInfo.getWidth(), imageInfo.getHeight(),
|
||||||
|
imageInfo.getImageFormat(), faceInfoList);
|
||||||
if (errorCode == 0) {
|
if (errorCode == 0) {
|
||||||
return faceInfoList;
|
return faceInfoList;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
package net.shapelight.modules.iCq.controller;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import net.shapelight.common.utils.R;
|
||||||
|
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigCellMapper;
|
||||||
|
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigMapper;
|
||||||
|
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigTypeMapper;
|
||||||
|
import net.shapelight.modules.iCq.service.enter.CqEnterServiceImpl;
|
||||||
|
import net.shapelight.modules.job.task.PersonSynchronousTask;
|
||||||
|
import net.shapelight.modules.ten.dao.TenCellDao;
|
||||||
|
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("cq/demo")
|
||||||
|
@Api(value = "入场校验", tags = {"入场校验"})
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DemoController {
|
||||||
|
|
||||||
|
private final CqEnterServiceImpl cqEnterService;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PersonSynchronousTask task;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TenCellDao tenCellDao;
|
||||||
|
|
||||||
|
@GetMapping("/save1")
|
||||||
|
public void saveSupplier(){
|
||||||
|
/* System.out.println("测试开始");
|
||||||
|
|
||||||
|
TenCellEntity tenCellEntity = tenCellDao.selectOne(new QueryWrapper<TenCellEntity>().eq("cell_id", "1255898969448382468"));
|
||||||
|
|
||||||
|
|
||||||
|
String jsonString = "{\n" +
|
||||||
|
" \"success\": true,\n" +
|
||||||
|
" \"message\": null,\n" +
|
||||||
|
" \"errCode\": \"0\",\n" +
|
||||||
|
" \"resCode\": 1,\n" +
|
||||||
|
" \"apiVersion\": \"1\",\n" +
|
||||||
|
" \"timestamp\": 1726651858,\n" +
|
||||||
|
" \"data\": {\n" +
|
||||||
|
" \"apiVersion\": null,\n" +
|
||||||
|
" \"list\": [\n" +
|
||||||
|
" {\n" +
|
||||||
|
" \"pmSupplierId\": \"75c0fd40bbda47528917898a69957683\",\n" +
|
||||||
|
" \"orgId\": \"ORGACQ100005358\",\n" +
|
||||||
|
" \"orgName\": \"油田开发事业部\",\n" +
|
||||||
|
" \"userName\": \"姓名\",\n" +
|
||||||
|
" \"supplierName\": \"23\",\n" +
|
||||||
|
" \"supplierCardId\": \"412345676543456765\",\n" +
|
||||||
|
" \"mobile\": \"13567543546\",\n" +
|
||||||
|
" \"enterValidPeriod\": \"2024-08-13 00:00:00\",\n" +
|
||||||
|
" \"enterValidPeriodEnd\": \"2024-09-26 00:00:00\",\n" +
|
||||||
|
" \"isEnterSulfurArea\": \"否\",\n" +
|
||||||
|
" \"isProtectDevice\": \"是\",\n" +
|
||||||
|
" \"isBlackList\": \"否\",\n" +
|
||||||
|
" \"isWatchVideo\": \"未观看\",\n" +
|
||||||
|
" \"attachment\": null\n" +
|
||||||
|
" }\n" +
|
||||||
|
" ],\n" +
|
||||||
|
" \"total\": 1\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}";
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject jsonObject = new JSONObject(jsonString);
|
||||||
|
|
||||||
|
task.save(jsonObject, tenCellEntity);*/
|
||||||
|
|
||||||
|
task.getPmInternalPersonnelList2();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigCellMapper;
|
||||||
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigMapper;
|
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigMapper;
|
||||||
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigTypeMapper;
|
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigTypeMapper;
|
||||||
import net.shapelight.modules.iCq.service.enter.CqEnterServiceImpl;
|
import net.shapelight.modules.iCq.service.enter.CqEnterServiceImpl;
|
||||||
|
import net.shapelight.modules.job.task.PersonSynchronousTask;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +21,10 @@ public class CqEnterController {
|
||||||
private final CqEnterServiceImpl cqEnterService;
|
private final CqEnterServiceImpl cqEnterService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
@ApiOperation(value = "配置首页列表查询")
|
@ApiOperation(value = "配置首页列表查询")
|
||||||
public R list(String operator, Long cellId){
|
public R list(String operator, Long cellId){
|
||||||
|
@ -49,4 +54,19 @@ public class CqEnterController {
|
||||||
return R.error();
|
return R.error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("demo")
|
||||||
|
public R demo(String operator, Long cellId){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return R.ok()
|
||||||
|
.put("data", cqEnterService.list(operator, cellId))
|
||||||
|
.put("total", cqEnterService.list(operator, cellId).size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -4,9 +4,12 @@ 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.utils.R;
|
import net.shapelight.common.utils.R;
|
||||||
|
import net.shapelight.modules.face.dto.FaceRecognitionResDTO;
|
||||||
|
import net.shapelight.modules.face.entity.UserCompareInfo;
|
||||||
import net.shapelight.modules.face.rtsp.RtspFrameGrabber;
|
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.FaceVideoVo;
|
||||||
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;
|
||||||
|
@ -17,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,8 +99,8 @@ public class CqSafeVideoController {
|
||||||
|
|
||||||
@PostMapping("/face/recognition")
|
@PostMapping("/face/recognition")
|
||||||
public R aWatchStart(@RequestParam("image") MultipartFile image, @RequestParam String cellId) {
|
public R aWatchStart(@RequestParam("image") MultipartFile image, @RequestParam String cellId) {
|
||||||
rtspFrameGrabber.recognition(image,cellId);
|
List<FaceVideoVo> recognition = rtspFrameGrabber.recognition(image, cellId);
|
||||||
return R.ok();
|
return R.ok().put("data", recognition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package net.shapelight.modules.iCq.controller.video.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class FaceVideoVo {
|
||||||
|
/**
|
||||||
|
* 人员id
|
||||||
|
*/
|
||||||
|
private String personId;
|
||||||
|
/**
|
||||||
|
* 人员name
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 是否正脸
|
||||||
|
*/
|
||||||
|
|
||||||
|
private Integer isHeadOnView; //0否1是
|
||||||
|
|
||||||
|
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -97,6 +97,7 @@ public class SysUserEntity extends BaseEntity implements Serializable {
|
||||||
* 部门ID
|
* 部门ID
|
||||||
*/
|
*/
|
||||||
//@NotNull(message="部门不能为空", groups = {AddGroup.class, UpdateGroup.class})
|
//@NotNull(message="部门不能为空", groups = {AddGroup.class, UpdateGroup.class})
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
@ApiModelProperty("所属部门ID")
|
@ApiModelProperty("所属部门ID")
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,11 @@ package net.shapelight.modules.ten.controller;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
@ -41,6 +44,7 @@ import net.shapelight.modules.sys.controller.AbstractController;
|
||||||
import net.shapelight.modules.sys.entity.SysUserEntity;
|
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||||
import net.shapelight.modules.sys.service.SysUserRoleService;
|
import net.shapelight.modules.sys.service.SysUserRoleService;
|
||||||
import net.shapelight.modules.sys.service.SysUserService;
|
import net.shapelight.modules.sys.service.SysUserService;
|
||||||
|
import net.shapelight.modules.ten.dao.TenCellDao;
|
||||||
import net.shapelight.modules.ten.entity.*;
|
import net.shapelight.modules.ten.entity.*;
|
||||||
import net.shapelight.modules.ten.service.*;
|
import net.shapelight.modules.ten.service.*;
|
||||||
import net.shapelight.modules.ten.vo.PersonExcelModel;
|
import net.shapelight.modules.ten.vo.PersonExcelModel;
|
||||||
|
@ -106,6 +110,9 @@ public class TenPersonController extends AbstractController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private CxFeignClient cxFeignClient;
|
private CxFeignClient cxFeignClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TenCellDao tenCellDao;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询住户列表
|
* 查询住户列表
|
||||||
|
@ -441,7 +448,7 @@ public class TenPersonController extends AbstractController {
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
@RequiresPermissions("ten:person")
|
@RequiresPermissions("ten:person")
|
||||||
@ApiOperation(value = "保存人员信息")
|
@ApiOperation(value = "保存人员信息")
|
||||||
public R save(@RequestBody TenPersonEntity tenPerson) {
|
public R save(@RequestBody TenPersonEntity tenPerson) throws IOException {
|
||||||
// TenPersonEntity room = tenPersonService.queryByNumberAndLayer(tenRoom.getRoomNumber(),
|
// TenPersonEntity room = tenPersonService.queryByNumberAndLayer(tenRoom.getRoomNumber(),
|
||||||
// tenRoom.getLayer(),
|
// tenRoom.getLayer(),
|
||||||
// tenRoom.getBuildId(),
|
// tenRoom.getBuildId(),
|
||||||
|
@ -510,27 +517,70 @@ public class TenPersonController extends AbstractController {
|
||||||
tenPerson.setCreateTime(new Date());
|
tenPerson.setCreateTime(new Date());
|
||||||
tenPerson.setRegisterType(Constant.RESGISTER_TYPE_WEB);
|
tenPerson.setRegisterType(Constant.RESGISTER_TYPE_WEB);
|
||||||
tenPerson.setStatus(Constant.PESON_SUATUS_NOMOR);
|
tenPerson.setStatus(Constant.PESON_SUATUS_NOMOR);
|
||||||
|
|
||||||
|
//长庆新增
|
||||||
|
//setOrgId
|
||||||
|
tenPerson.setOrgId(tenCellDao.selectOne(new QueryWrapper<TenCellEntity>()
|
||||||
|
.eq("cell_id", tenPerson.getCellId())).getOrgId());
|
||||||
|
|
||||||
|
System.out.println("tenPerson = " + tenPerson);
|
||||||
|
|
||||||
|
|
||||||
int res = tenPersonService.saveTenPerson(tenPerson);
|
int res = tenPersonService.saveTenPerson(tenPerson);
|
||||||
if (res==2) {
|
if (res==2) {
|
||||||
return R.error("照片未检测到人脸");
|
return R.error("照片未检测到人脸");
|
||||||
}
|
}
|
||||||
|
/* System.out.println(tenPerson.getPersonType() == Constant.PERSON_TYPE_GUEST);*/
|
||||||
if(tenPerson.getPersonType() == Constant.PERSON_TYPE_GUEST) {
|
if(tenPerson.getPersonType() == Constant.PERSON_TYPE_GUEST) {
|
||||||
|
|
||||||
|
|
||||||
|
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("pmVisitorPersonnelId", "");
|
params.put("pmVisitorPersonnelId", "");
|
||||||
params.put("orgId", tenPerson.getOrgId());
|
params.put("orgId", tenPerson.getOrgId());
|
||||||
params.put("orgName", tenPerson.getCellName());
|
params.put("orgName", tenPerson.getCellName());
|
||||||
params.put("personnelName", tenPerson.getName());
|
params.put("personnelName", tenPerson.getName());
|
||||||
params.put("personnelId",tenPerson.getOpenId());
|
//params.put("personnelId",tenPerson.getOpenId());
|
||||||
params.put("personnelCardId", tenPerson.getIdCard());
|
params.put("personnelCardId", tenPerson.getIdCard());
|
||||||
params.put("enterValidPeriod",tenPerson.getLiveStart().toString());
|
|
||||||
params.put("enterValidPeriodEnd",tenPerson.getLiveEnd().toString());
|
|
||||||
|
params.put("enterValidPeriod", targetFormat.format(tenPerson.getLiveStart()));
|
||||||
|
params.put("enterValidPeriodEnd", targetFormat.format(tenPerson.getLiveEnd()));
|
||||||
|
|
||||||
params.put("mobile", tenPerson.getMobile());
|
params.put("mobile", tenPerson.getMobile());
|
||||||
params.put("isEnterSulfurArea", tenPerson.getIsEnterSulfurArea() == 1 ? "是" : "否");
|
params.put("isEnterSulfurArea", tenPerson.getIsEnterSulfurArea() == 1 ? "是" : "否");
|
||||||
params.put("isProtectDevice", tenPerson.getIsProtectDevice() == 1 ? "是" : "否");
|
params.put("isProtectDevice", tenPerson.getIsProtectDevice() == 1 ? "是" : "否");
|
||||||
params.put("isBlacklistPersonnel", "否");
|
params.put("isBlacklistPersonnel", "否");
|
||||||
params.put("isWatchSafeVideo",tenPerson.getIsWatchSafeVideo()==1?"是":"否");
|
params.put("isWatchSafeVideo", tenPerson.getIsWatchSafeVideo() == 1 ? "已观看" : "未观看");
|
||||||
params.put("attachment",tenPerson.getIsWatchSafeVideo());
|
|
||||||
|
|
||||||
|
String base64 = null;
|
||||||
|
try {
|
||||||
|
URL url = new URL(globalValue.getMinioEndpoint() + "/" +
|
||||||
|
globalValue.getMinioBucketName() + "/" + tenPerson.getFaceImage());
|
||||||
|
// 从URL获取图片
|
||||||
|
try (InputStream is = url.openStream()) {
|
||||||
|
// 使用ByteArrayOutputStream来收集数据
|
||||||
|
ByteArrayOutputStream bao = new ByteArrayOutputStream();
|
||||||
|
byte[] buffer = new byte[4096];
|
||||||
|
int length;
|
||||||
|
// 循环读取数据直到输入流结束
|
||||||
|
while ((length = is.read(buffer)) != -1) {
|
||||||
|
bao.write(buffer, 0, length);
|
||||||
|
}
|
||||||
|
// 将图片数据转换为Base64编码
|
||||||
|
base64 = Base64.getEncoder().encodeToString(bao.toByteArray());
|
||||||
|
// 打印Base64编码的字符串
|
||||||
|
System.out.println("data:image/jpeg;base64," + base64);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
params.put("attachment", "data:image/jpeg;base64," + base64);
|
||||||
|
|
||||||
|
System.out.println("params = " + params);
|
||||||
//cxFeignClient.savePmVisitorPersonnel(params);
|
//cxFeignClient.savePmVisitorPersonnel(params);
|
||||||
}
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
|
|
@ -384,5 +384,9 @@ public class TenPersonEntity extends BaseEntity implements Serializable {
|
||||||
private Integer isWatchSafeVideo;
|
private Integer isWatchSafeVideo;
|
||||||
private String belongContractorName;
|
private String belongContractorName;
|
||||||
private Integer isBlacklistPersonnel;
|
private Integer isBlacklistPersonnel;
|
||||||
|
/**
|
||||||
|
* 是否核验证书
|
||||||
|
*/
|
||||||
|
private Integer isCheckCert;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ public class TenPersonCertServiceImpl extends ServiceImpl<TenPersonCertDao, TenP
|
||||||
* @param fieldName 字段名称
|
* @param fieldName 字段名称
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//pmContractorCertId
|
||||||
public void saveOrUpdateByField(TenPersonCert entity, String fieldName) {
|
public void saveOrUpdateByField(TenPersonCert entity, String fieldName) {
|
||||||
QueryWrapper<TenPersonCert> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<TenPersonCert> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq(fieldName, MyBeanUtils.getFieldValueByName(entity,fieldName));
|
queryWrapper.eq(fieldName, MyBeanUtils.getFieldValueByName(entity,fieldName));
|
||||||
|
|
|
@ -558,6 +558,20 @@ public class TenPersonServiceImpl extends ServiceImpl<TenPersonDao,TenPersonEnti
|
||||||
entity.setCreateTime(now);
|
entity.setCreateTime(now);
|
||||||
entity.setLastUpdateTime(now);
|
entity.setLastUpdateTime(now);
|
||||||
|
|
||||||
|
entity.setIsEnterSulfurArea(entity.getIsEnterSulfurArea());
|
||||||
|
entity.setIsProtectDevice(entity.getIsProtectDevice());
|
||||||
|
entity.setIsWatchSafeVideo(entity.getIsWatchSafeVideo());
|
||||||
|
entity.setIsBlacklistPersonnel(0);
|
||||||
|
|
||||||
|
if (entity.getIsCheckCert()==null){
|
||||||
|
entity.setIsCheckCert(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//setOrgId
|
||||||
|
entity.setOrgId(entity.getOrgId());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////访客添加状态
|
////访客添加状态
|
||||||
// Date now = new Date();
|
// Date now = new Date();
|
||||||
// log.info("now:"+now.getTime()+" start:"+entity.getLiveStart().getTime()
|
// log.info("now:"+now.getTime()+" start:"+entity.getLiveStart().getTime()
|
||||||
|
|
|
@ -328,6 +328,12 @@
|
||||||
<if test="isBlacklistPersonnel != null">
|
<if test="isBlacklistPersonnel != null">
|
||||||
is_blacklist_personnel,
|
is_blacklist_personnel,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="orgId != null">
|
||||||
|
org_id,
|
||||||
|
</if>
|
||||||
|
<if test="isCheckCert != null">
|
||||||
|
is_check_cert,
|
||||||
|
</if>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -513,7 +519,13 @@
|
||||||
#{isWatchSafeVideo},
|
#{isWatchSafeVideo},
|
||||||
</if>
|
</if>
|
||||||
<if test="isBlacklistPersonnel != null">
|
<if test="isBlacklistPersonnel != null">
|
||||||
#{is_blacklist_personnel},
|
#{isBlacklistPersonnel},
|
||||||
|
</if>
|
||||||
|
<if test=" orgId != null">
|
||||||
|
#{orgId},
|
||||||
|
</if>
|
||||||
|
<if test=" isCheckCert != null">
|
||||||
|
#{isCheckCert},
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
</trim>
|
</trim>
|
||||||
|
|
Loading…
Reference in New Issue