同步长庆数据
This commit is contained in:
parent
87d31e4e6f
commit
ae8d25d96e
|
@ -295,11 +295,11 @@
|
|||
<!-- <classifier>${javacv.platform}</classifier>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>com.pig4cloud.plugin</groupId>
|
||||
<artifactId>oss-spring-boot-starter</artifactId>
|
||||
<version>1.0.5</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.shapelight.modules.face.rtsp;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.arcsoft.face.FaceEngine;
|
||||
import com.arcsoft.face.FaceFeature;
|
||||
import com.arcsoft.face.FaceInfo;
|
||||
|
@ -12,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.shapelight.common.config.GlobalValue;
|
||||
import net.shapelight.common.utils.Constant;
|
||||
import net.shapelight.modules.face.dto.FaceRecognitionResDTO;
|
||||
import net.shapelight.modules.face.entity.UserCompareInfo;
|
||||
import net.shapelight.modules.face.enums.ErrorCodeEnum;
|
||||
|
@ -21,6 +23,7 @@ import net.shapelight.modules.face.service.FaceEngineService;
|
|||
import net.shapelight.modules.face.service.impl.FaceEngineServiceImpl;
|
||||
import net.shapelight.modules.face.util.UserInfo;
|
||||
import net.shapelight.modules.face.util.UserRamGroup;
|
||||
import net.shapelight.modules.feignClient.CxFeignClient;
|
||||
import net.shapelight.modules.ten.entity.TenPersonEntity;
|
||||
import net.shapelight.modules.ten.service.TenPersonService;
|
||||
import org.apache.commons.pool2.impl.GenericObjectPool;
|
||||
|
@ -28,6 +31,7 @@ import org.bytedeco.javacpp.avutil;
|
|||
import org.bytedeco.javacv.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
@ -36,9 +40,8 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static org.bytedeco.javacpp.avutil.AV_LOG_ERROR;
|
||||
|
@ -55,6 +58,9 @@ public class RtspFrameGrabber {
|
|||
|
||||
@Autowired
|
||||
private GlobalValue globalValue;
|
||||
|
||||
@Autowired
|
||||
private CxFeignClient feignClient;
|
||||
/**
|
||||
* 用于记录人脸识别相关状态
|
||||
*/
|
||||
|
@ -139,7 +145,7 @@ public class RtspFrameGrabber {
|
|||
// logger.info("处理帧.............................................");
|
||||
BufferedImage bi = java2DFrameConverter.getBufferedImage(frame);
|
||||
byte[] bytes = imageToBytes(bi, "jpg");
|
||||
// 读取图片
|
||||
/* // 读取图片
|
||||
BufferedImage image = ImageIO.read(new File("C:\\Users\\zhangbo\\OneDrive\\图片\\Camera Roll\\1寸相片.jpg"));
|
||||
|
||||
// 创建字节输出流
|
||||
|
@ -149,9 +155,9 @@ public class RtspFrameGrabber {
|
|||
ImageIO.write(image, "jpg", baos);
|
||||
|
||||
// 转换为byte数组
|
||||
byte[] imageBytes = baos.toByteArray();
|
||||
if (imageBytes != null && imageBytes.length > 0) {
|
||||
ImageInfo imageInfo = ImageFactory.getRGBData(imageBytes);
|
||||
byte[] imageBytes = baos.toByteArray();*/
|
||||
if (bytes != null && bytes.length > 0) {
|
||||
ImageInfo imageInfo = ImageFactory.getRGBData(bytes);
|
||||
List<FaceInfo> faceInfoList = faceEngineService.detectFaces(imageInfo);
|
||||
if (CollectionUtil.isNotEmpty(faceInfoList)) {
|
||||
faceInfoList.forEach(faceInfo -> {
|
||||
|
@ -161,8 +167,33 @@ public class RtspFrameGrabber {
|
|||
if (featureBytes != null) {
|
||||
List<UserInfo> userInfoList = UserRamGroup.getUserList(cellId);
|
||||
List<UserCompareInfo> userCompareInfoList = faceEngineService.faceRecognition(featureBytes,userInfoList,Float.parseFloat(globalValue.getRecFaceThd()));
|
||||
UserCompareInfo userCompareInfo = userCompareInfoList.get(0);
|
||||
personService.update(new LambdaUpdateWrapper<TenPersonEntity>().set(TenPersonEntity::getIsWatchSafeVideo,1).eq(TenPersonEntity::getPersonId,userCompareInfo.getFaceId()));
|
||||
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("图片不合格,未检测到人脸");
|
||||
|
|
|
@ -14,24 +14,45 @@ import java.util.Map;
|
|||
@Component
|
||||
public interface CxFeignClient {
|
||||
|
||||
/*
|
||||
获取token
|
||||
*/
|
||||
@GetMapping("/Auth/getToken")
|
||||
String getToken(@RequestParam String appid, @RequestParam String appsecret);
|
||||
|
||||
/*
|
||||
同步安全视频观看记录
|
||||
*/
|
||||
@PostMapping("/ExternalService/SavePmWatchVideoRecord")
|
||||
JSONObject savePmWatchVideoRecord(@RequestParam Map<String,Object> params);
|
||||
|
||||
/*
|
||||
同步进出场记录
|
||||
*/
|
||||
@PostMapping("/ExternalService/SavePmEntryExitRecord")
|
||||
JSONObject savePmEntryExitRecord(@RequestParam Map<String,Object> params);
|
||||
|
||||
/*
|
||||
同步访客记录
|
||||
*/
|
||||
@PostMapping("/ExternalService/SavePmVisitorPersonnel")
|
||||
JSONObject savePmVisitorPersonnel(@RequestParam Map<String,Object> params);
|
||||
|
||||
/*
|
||||
获取内部人员信息
|
||||
*/
|
||||
@GetMapping("/ExternalService/GetPmInternalPersonnelList")
|
||||
JSONObject getPmInternalPersonnelList(@RequestParam Map<String,Object> params);
|
||||
|
||||
/*
|
||||
获取承包商信息
|
||||
*/
|
||||
@GetMapping("/ExternalService/GetPmContractorDataList")
|
||||
JSONObject getPmContractorDataList(@RequestParam Map<String,Object> params);
|
||||
|
||||
/*
|
||||
获取长期供应商信息
|
||||
*/
|
||||
@GetMapping("/ExternalService/GetPmSupplierDataList")
|
||||
JSONObject getPmSupplierDataList(@RequestParam Map<String,Object> params);
|
||||
}
|
||||
|
|
|
@ -834,7 +834,12 @@ public class HttpApiController {
|
|||
params.put("accessControlName",memberEntity.getOpenId());
|
||||
params.put("state","");
|
||||
params.put("failureReason","");
|
||||
cxFeignClient.savePmEntryExitRecord(params);
|
||||
cn.hutool.json.JSONObject jsonObject = cxFeignClient.savePmEntryExitRecord(params);
|
||||
if(jsonObject.getBool("success")!=null && jsonObject.getBool("success")){
|
||||
log.debug("同步进出场记录成功");
|
||||
}else {
|
||||
log.debug("同步进出场记录失败"+"姓名:"+memberEntity.getName()+",errorMessage"+jsonObject.getStr("message"));
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -92,13 +92,16 @@ public class PersonSynchronousTask implements ITask {
|
|||
} else {
|
||||
json = cxFeignClient.getPmSupplierDataList(params);
|
||||
}
|
||||
if (json.getBool("success")) {
|
||||
if (json.getBool("success")!=null&&json.getBool("success")) {
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
JSONArray dataList = data.getJSONArray("list");
|
||||
List<JSONObject> list1 = dataList.toList(JSONObject.class);
|
||||
list1.forEach(person -> {
|
||||
save(person,item);
|
||||
});
|
||||
log.debug("获取人员信息成功"+type);
|
||||
} else {
|
||||
log.debug("获取人员信息失败"+json.getStr("message"));
|
||||
}
|
||||
log.debug("同步inxex:"+(i+1));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue