From 87d31e4e6f39118f765d5dbc9c810b2dc8349aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=8D=9A?= Date: Fri, 18 Oct 2024 09:55:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=95=BF=E5=BA=86=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/face/rtsp/RtspFrameGrabber.java | 10 +-- .../modules/ten/entity/TenPersonCert.java | 63 ++++++++++++++++++ .../modules/ten/entity/TenPersonTrain.java | 66 +++++++++++++++++++ .../ten/service/TenPersonCertService.java | 15 +++++ .../ten/service/TenPersonTrainService.java | 14 ++++ .../mapper/ten/TenPersonTrainDao.xml | 22 +++++++ 6 files changed, 185 insertions(+), 5 deletions(-) create mode 100644 shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonCert.java create mode 100644 shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonTrain.java create mode 100644 shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonCertService.java create mode 100644 shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonTrainService.java create mode 100644 shapelight-admin/src/main/resources/mapper/ten/TenPersonTrainDao.xml diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/face/rtsp/RtspFrameGrabber.java b/shapelight-admin/src/main/java/net/shapelight/modules/face/rtsp/RtspFrameGrabber.java index 9f9e31f..369267e 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/face/rtsp/RtspFrameGrabber.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/face/rtsp/RtspFrameGrabber.java @@ -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 faceInfoList = faceEngineService.detectFaces(imageInfo); if (CollectionUtil.isNotEmpty(faceInfoList)) { faceInfoList.forEach(faceInfo -> { @@ -161,9 +161,9 @@ public class RtspFrameGrabber { if (featureBytes != null) { List userInfoList = UserRamGroup.getUserList(cellId); List userCompareInfoList = faceEngineService.faceRecognition(featureBytes,userInfoList,Float.parseFloat(globalValue.getRecFaceThd())); - userCompareInfoList.forEach(userCompareInfo -> { - personService.update(new LambdaUpdateWrapper().set(TenPersonEntity::getIsWatchSafeVideo,1).eq(TenPersonEntity::getPersonId,userCompareInfo.getFaceId())); - }); + UserCompareInfo userCompareInfo = userCompareInfoList.get(0); + personService.update(new LambdaUpdateWrapper().set(TenPersonEntity::getIsWatchSafeVideo,1).eq(TenPersonEntity::getPersonId,userCompareInfo.getFaceId())); + } else { log.error("图片不合格,未检测到人脸"); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonCert.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonCert.java new file mode 100644 index 0000000..05ec359 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonCert.java @@ -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; +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonTrain.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonTrain.java new file mode 100644 index 0000000..4ce1b63 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonTrain.java @@ -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; + +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonCertService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonCertService.java new file mode 100644 index 0000000..544bda6 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonCertService.java @@ -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 { + + public void saveOrUpdateByField(TenPersonCert entity, String fieldName); +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonTrainService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonTrainService.java new file mode 100644 index 0000000..8891ad9 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonTrainService.java @@ -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 { + public void saveOrUpdateByField(TenPersonTrain entity, String fieldName); +} diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenPersonTrainDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenPersonTrainDao.xml new file mode 100644 index 0000000..3b9a1a3 --- /dev/null +++ b/shapelight-admin/src/main/resources/mapper/ten/TenPersonTrainDao.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + id,person_id,pm_contractor_train_id, + train_content,train_start_date,train_end_date, + is_qualified + +