11
This commit is contained in:
1 parent
d18167e084
commit
cf35795f3d
2 files changed
+16
-16
No files matched your search
+3
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.order;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.DecimalMax;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
@@ -70,6 +71,7 @@ public class HardOrderEvidenceMetadataDto {
|
||||
/**
|
||||
* 识别时终端人脸快照对应的后台更新时间;旧终端允许为空,新终端用于识别同地址内容替换。
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss[.SSS]", timezone = "Asia/Shanghai")
|
||||
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
|
||||
@Schema(description = "参考人脸来源版本")
|
||||
private LocalDateTime referenceImageVersion;
|
||||
@@ -93,6 +95,7 @@ public class HardOrderEvidenceMetadataDto {
|
||||
/**
|
||||
* 终端实际完成识别的本地时间;为空时服务端仅保留订单创建时间。
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss[.SSS]", timezone = "Asia/Shanghai")
|
||||
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
|
||||
@Schema(description = "终端采集时间")
|
||||
private LocalDateTime capturedAt;
|
||||
|
||||
+13
-16
@@ -363,8 +363,8 @@ public class HardOrderEvidenceImageServiceImpl extends ServiceImpl<HardOrderEvid
|
||||
* 通过 UPMS 权威记录校验参考图,来源已变化时标记永久缺失,远程暂时失败则保留 PENDING 重试。
|
||||
*/
|
||||
private HardOrderEvidenceUploadResultVo copyReferenceImage(HardOrderEvidenceImageEntity entity,
|
||||
HardOrderEntity order,
|
||||
HardOrderEvidenceMetadataDto dto) {
|
||||
HardOrderEntity order,
|
||||
HardOrderEvidenceMetadataDto dto) {
|
||||
R<SysUserFaceEvidenceSourceVo> sourceResult = remoteUserFaceService.getEvidenceSource(dto.getUserId(), dto.getFaceSampleId());
|
||||
if (sourceResult == null || !sourceResult.isOk()) {
|
||||
throw new RuntimeException(sourceResult == null || StrUtil.isBlank(sourceResult.getMsg())
|
||||
@@ -418,15 +418,11 @@ public class HardOrderEvidenceImageServiceImpl extends ServiceImpl<HardOrderEvid
|
||||
* 写入文件中心并在成功响应后原子更新证据记录,不删除任何历史证据文件。
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void storeImage(HardOrderEvidenceImageEntity entity, HardOrderEntity order,
|
||||
ImageSnapshot image, String originalName) {
|
||||
MultipartFile uploadFile = new MockMultipartFile("file", originalName, image.contentType(),
|
||||
new ByteArrayInputStream(image.bytes()));
|
||||
R<?> uploadResult = remoteFileService.innerUpload(uploadFile,
|
||||
FILE_DIRECTORY_PREFIX + "/" + order.getId(), null, FILE_TYPE);
|
||||
private void storeImage(HardOrderEvidenceImageEntity entity, HardOrderEntity order, ImageSnapshot image, String originalName) {
|
||||
MultipartFile uploadFile = new MockMultipartFile("file", originalName, image.contentType(), image.bytes());
|
||||
R<?> uploadResult = remoteFileService.innerUpload(uploadFile, FILE_DIRECTORY_PREFIX + "/" + order.getId(), null, FILE_TYPE);
|
||||
if (uploadResult == null || !uploadResult.isOk() || !(uploadResult.getData() instanceof Map<?, ?> storage)) {
|
||||
throw new RuntimeException(uploadResult == null || StrUtil.isBlank(uploadResult.getMsg())
|
||||
? "订单证据写入文件中心失败" : uploadResult.getMsg());
|
||||
throw new RuntimeException(uploadResult == null || StrUtil.isBlank(uploadResult.getMsg()) ? "订单证据写入文件中心失败" : uploadResult.getMsg());
|
||||
}
|
||||
entity.setSysFileId(numberValue(storage.get("id")));
|
||||
entity.setStorageFileName(requiredString(storage.get("fileName"), "文件中心未返回对象名"));
|
||||
@@ -645,13 +641,14 @@ public class HardOrderEvidenceImageServiceImpl extends ServiceImpl<HardOrderEvid
|
||||
/**
|
||||
* 已校验图片的不可变内存快照,避免上传前后再次读取可变临时文件。
|
||||
*
|
||||
* @param bytes 图片原始字节
|
||||
* @param hash SHA-256 哈希
|
||||
* @param width 图片宽度,单位像素
|
||||
* @param height 图片高度,单位像素
|
||||
* @param extension 由字节签名确定的扩展名
|
||||
* @param bytes 图片原始字节
|
||||
* @param hash SHA-256 哈希
|
||||
* @param width 图片宽度,单位像素
|
||||
* @param height 图片高度,单位像素
|
||||
* @param extension 由字节签名确定的扩展名
|
||||
* @param contentType 与扩展名一致的 MIME 类型
|
||||
*/
|
||||
private record ImageSnapshot(byte[] bytes, String hash, int width, int height, String extension, String contentType) {
|
||||
private record ImageSnapshot(byte[] bytes, String hash, int width, int height, String extension,
|
||||
String contentType) {
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user