同步长庆数据

This commit is contained in:
张博 2024-10-18 09:55:39 +08:00
parent c62f70daa9
commit 87d31e4e6f
6 changed files with 185 additions and 5 deletions

View File

@ -140,7 +140,7 @@ public class RtspFrameGrabber {
BufferedImage bi = java2DFrameConverter.getBufferedImage(frame);
byte[] bytes = imageToBytes(bi, "jpg");
// 读取图片
BufferedImage image = ImageIO.read(new File("\"C:\\\\Users\\\\zhangbo\\\\OneDrive\\\\图片\\\\Camera Roll\\\\1寸相片.jpg\""));
BufferedImage image = ImageIO.read(new File("C:\\Users\\zhangbo\\OneDrive\\图片\\Camera Roll\\1寸相片.jpg"));
// 创建字节输出流
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@ -151,7 +151,7 @@ public class RtspFrameGrabber {
// 转换为byte数组
byte[] imageBytes = baos.toByteArray();
if (imageBytes != null && imageBytes.length > 0) {
ImageInfo imageInfo = ImageFactory.getRGBData(bytes);
ImageInfo imageInfo = ImageFactory.getRGBData(imageBytes);
List<FaceInfo> faceInfoList = faceEngineService.detectFaces(imageInfo);
if (CollectionUtil.isNotEmpty(faceInfoList)) {
faceInfoList.forEach(faceInfo -> {
@ -161,9 +161,9 @@ public class RtspFrameGrabber {
if (featureBytes != null) {
List<UserInfo> userInfoList = UserRamGroup.getUserList(cellId);
List<UserCompareInfo> userCompareInfoList = faceEngineService.faceRecognition(featureBytes,userInfoList,Float.parseFloat(globalValue.getRecFaceThd()));
userCompareInfoList.forEach(userCompareInfo -> {
UserCompareInfo userCompareInfo = userCompareInfoList.get(0);
personService.update(new LambdaUpdateWrapper<TenPersonEntity>().set(TenPersonEntity::getIsWatchSafeVideo,1).eq(TenPersonEntity::getPersonId,userCompareInfo.getFaceId()));
});
} else {
log.error("图片不合格,未检测到人脸");
}

View File

@ -0,0 +1,63 @@
package net.shapelight.modules.ten.entity;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
/**
*
* @TableName ten_person_cert
*/
@Data
public class TenPersonCert implements Serializable {
/**
*
*/
@NotNull(message="[]不能为空")
@ApiModelProperty("")
private Integer id;
/**
* 人员ID
*/
@NotNull(message="[人员ID]不能为空")
@ApiModelProperty("人员ID")
private Long person;
/**
* 证书ID
*/
@Size(max= 255,message="编码长度不能超过255")
@ApiModelProperty("证书ID")
@Length(max= 255,message="编码长度不能超过255")
private String pmContractorCertId;
/**
* 证书名称
*/
@Size(max= 255,message="编码长度不能超过255")
@ApiModelProperty("证书名称")
@Length(max= 255,message="编码长度不能超过255")
private String certName;
/**
* 发证日期
*/
@ApiModelProperty("发证日期")
private Date certObtainDate;
/**
* 证书有效期
*/
@ApiModelProperty("证书有效期")
private Date effectiveDate;
/**
* 证书类型
*/
@Size(max= 255,message="编码长度不能超过255")
@ApiModelProperty("证书类型")
@Length(max= 255,message="编码长度不能超过255")
private String certType;
}

View File

@ -0,0 +1,66 @@
package net.shapelight.modules.ten.entity;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
/**
*
* @TableName ten_person_train
*/
@Data
public class TenPersonTrain implements Serializable {
/**
*
*/
@NotNull(message="[]不能为空")
@ApiModelProperty("")
private Integer id;
/**
* 人员ID
*/
@NotNull(message="[人员ID]不能为空")
@ApiModelProperty("人员ID")
private Long personId;
/**
* 培训记录ID
*/
@NotBlank(message="[培训记录ID]不能为空")
@Size(max= 255,message="编码长度不能超过255")
@ApiModelProperty("培训记录ID")
@Length(max= 255,message="编码长度不能超过255")
private String pmContractorTrainId;
/**
* 培训内容
*/
@Size(max= 255,message="编码长度不能超过255")
@ApiModelProperty("培训内容")
@Length(max= 255,message="编码长度不能超过255")
private String trainContent;
/**
* 培训开始日期
*/
@ApiModelProperty("培训开始日期")
private Date trainStartDate;
/**
* 培训结束日期
*/
@ApiModelProperty("培训结束日期")
private Date trainEndDate;
/**
* 是否合格
*/
@Size(max= 2,message="编码长度不能超过2")
@ApiModelProperty("是否合格")
@Length(max= 2,message="编码长度不能超过2")
private int isQualified;
}

View File

@ -0,0 +1,15 @@
package net.shapelight.modules.ten.service;
import com.baomidou.mybatisplus.extension.service.IService;
import net.shapelight.modules.ten.entity.TenPersonCert;
/**
* @author zhangbo
* @description 针对表ten_person_cert的数据库操作Service
* @createDate 2024-10-16 19:43:27
*/
public interface TenPersonCertService extends IService<TenPersonCert> {
public void saveOrUpdateByField(TenPersonCert entity, String fieldName);
}

View File

@ -0,0 +1,14 @@
package net.shapelight.modules.ten.service;
import com.baomidou.mybatisplus.extension.service.IService;
import net.shapelight.modules.ten.entity.TenPersonCert;
import net.shapelight.modules.ten.entity.TenPersonTrain;
/**
* @author zhangbo
* @description 针对表ten_person_train的数据库操作Service
* @createDate 2024-10-16 19:50:29
*/
public interface TenPersonTrainService extends IService<TenPersonTrain> {
public void saveOrUpdateByField(TenPersonTrain entity, String fieldName);
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.shapelight.modules.ten.dao.TenPersonTrainDao">
<resultMap id="BaseResultMap" type="net.shapelight.modules.ten.entity.TenPersonTrain">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="personId" column="person_id" jdbcType="BIGINT"/>
<result property="pmContractorTrainId" column="pm_contractor_train_id" jdbcType="VARCHAR"/>
<result property="trainContent" column="train_content" jdbcType="VARCHAR"/>
<result property="trainStartDate" column="train_start_date" jdbcType="TIMESTAMP"/>
<result property="trainEndDate" column="train_end_date" jdbcType="TIMESTAMP"/>
<result property="isQualified" column="is_qualified" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,person_id,pm_contractor_train_id,
train_content,train_start_date,train_end_date,
is_qualified
</sql>
</mapper>