晨检一体机人脸修改

This commit is contained in:
jjLv 2025-09-28 10:08:41 +08:00
parent bc362431c9
commit 04b953dd8f
5 changed files with 52 additions and 1 deletions

View File

@ -59,6 +59,11 @@ public class UserFaceController extends BaseController {
public AjaxResult saveAppFaceEigenvalue(@RequestBody @Valid AppUserFace dto) {
return UserFaceService.saveAppFaceEigenvalue(dto);
}
@ApiOperation("保存APP人脸图片特征值")
@PostMapping({"/saveHealthAppFaceEigenvalue"})
@RequiresGuest
public AjaxResult saveHealthAppFaceEigenvalue(@RequestBody @Valid AppUserFace dto) {
return UserFaceService.saveHealthAppFaceEigenvalue(dto);
}
}

View File

@ -16,4 +16,6 @@ public interface UserFaceMapper {
int deleteUserFace(UserFace userFace);
int saveBatch(@Param("list") List<UserFace> list);
int saveHealthBatch(@Param("list") List<UserFace> list);
}

View File

@ -29,4 +29,6 @@ public interface IUserFaceService {
* @return 人员生物识别特征
*/
AjaxResult saveAppFaceEigenvalue(AppUserFace dto);
AjaxResult saveHealthAppFaceEigenvalue(AppUserFace dto);
}

View File

@ -144,4 +144,30 @@ public class UserFaceServiceImpl implements IUserFaceService {
}
}
@Override
public AjaxResult saveHealthAppFaceEigenvalue(AppUserFace dto) {
if (ObjectUtil.isNull(dto)) {
throw new ServiceException("参数为空!");
}
if (ObjectUtil.isNull(dto.getUserFaceList()) || dto.getUserFaceList().isEmpty()) {
throw new ServiceException("人脸特征值为空!");
}
List<UserFace> list = dto.getUserFaceList();
list.forEach(faceVO -> {
faceVO.setErrorMsg("[软件]成功");
faceVO.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
faceVO.setUpdateTime(DateUtils.getTime());
faceVO.setPhotoType(1L);
});
int code = userFaceMapper.saveHealthBatch(list);
if (code > 0) {
DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePersonPhoto(null, "update");
MqUtil.pushToTenantAllDevice(bean, LeMqConstant.Topic.MORNING_INSPECTION_DEVICE_UPDATE_PERSONAL_CONFIG_V4);
return AjaxResult.success();
} else {
throw new ServiceException("保存失败");
}
}
}

View File

@ -32,4 +32,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_time = values(update_time),
features_state = '1'
</insert>
<select id="saveHealthBatch" resultType="int">
insert into kitchen_staff_face(staff_id, photo_url, features, create_by, error_msg, create_time, update_by,
update_time, features_state)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.userId}, #{item.photoUrl}, #{item.features}, #{item.createBy}, #{item.errorMsg}, #{item.createTime},
#{item.updateBy}, #{item.updateTime}, '1')
</foreach>
on duplicate key update features = values(features),
photo_url = values(photo_url),
error_msg = values(error_msg),
update_by = values(update_by),
update_time = values(update_time),
features_state = '1'
</select>
</mapper>