1、车船模块fix bug
2、运力模块fix bug 3、新增设备台账 4、其他bug 修复 5、调整组织、人员模块
This commit is contained in:
@@ -5,18 +5,14 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.tool.utils.CollectionUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.file.convert.OCRConverter;
|
||||
import org.springblade.file.pojo.dto.FileCertificateBatchRecognitionDTO;
|
||||
import org.springblade.file.service.IFileService;
|
||||
import org.springblade.file.service.IOCRConvertService;
|
||||
import org.springblade.thirdparty.ocr.pojo.dto.CertificateBatchRecognitionDTO;
|
||||
import org.springblade.thirdparty.ocr.pojo.vo.TransportCertificateVO;
|
||||
import org.springblade.thirdparty.ocr.service.IOCRService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author bfhuange
|
||||
* @since 2025/3/13
|
||||
@@ -26,7 +22,6 @@ import java.util.List;
|
||||
@Service
|
||||
public class OCRConvertServiceImpl implements IOCRConvertService {
|
||||
|
||||
private final IFileService fileService;
|
||||
private final IOCRService ocrService;
|
||||
private final OCRConverter converter;
|
||||
|
||||
@@ -34,48 +29,26 @@ public class OCRConvertServiceImpl implements IOCRConvertService {
|
||||
public TransportCertificateVO recognitionTransportCertificate(FileCertificateBatchRecognitionDTO param) {
|
||||
Func.requireNotNull(param, "参数不能为空");
|
||||
if (CollectionUtil.isEmpty(param.getObjectKeys())) {
|
||||
throw new ServiceException("图像obs key不能为空");
|
||||
throw new ServiceException("图像 URL 列表不能为空");
|
||||
}
|
||||
CertificateBatchRecognitionDTO ocrParam = converter.dto2ocr(param);
|
||||
ocrParam.setPoundUrls(resolveFileUrls(param.getPoundUrls()));
|
||||
ocrParam.setCarFrontUrls(resolveFileUrls(param.getCarFrontUrls()));
|
||||
ocrParam.setDriverLicenseUrls(resolveFileUrls(param.getDriverLicenseUrls()));
|
||||
ocrParam.setVehicleLicenseUrls(resolveFileUrls(param.getVehicleLicenseUrls()));
|
||||
if (!hasTypedObjectKeys(param)) {
|
||||
// 旧格式字符串数组仍按通用 urls 传递。
|
||||
List<String> fileUrls = param.getObjectKeys().stream()
|
||||
.map(this::resolveFileUrl)
|
||||
.toList();
|
||||
ocrParam.setUrls(fileUrls);
|
||||
ocrParam.setPoundUrls(param.getPoundUrls());
|
||||
ocrParam.setCarFrontUrls(param.getCarFrontUrls());
|
||||
ocrParam.setDriverLicenseUrls(param.getDriverLicenseUrls());
|
||||
ocrParam.setVehicleLicenseUrls(param.getVehicleLicenseUrls());
|
||||
if (!hasTypedUrls(param)) {
|
||||
ocrParam.setUrls(param.getObjectKeys());
|
||||
} else {
|
||||
ocrParam.setUrls(null);
|
||||
}
|
||||
return ocrService.recognitionTransportCertificate(ocrParam);
|
||||
}
|
||||
|
||||
private boolean hasTypedObjectKeys(FileCertificateBatchRecognitionDTO param) {
|
||||
private boolean hasTypedUrls(FileCertificateBatchRecognitionDTO param) {
|
||||
return CollectionUtil.isNotEmpty(param.getPoundUrls())
|
||||
|| CollectionUtil.isNotEmpty(param.getCarFrontUrls())
|
||||
|| CollectionUtil.isNotEmpty(param.getDriverLicenseUrls())
|
||||
|| CollectionUtil.isNotEmpty(param.getVehicleLicenseUrls());
|
||||
}
|
||||
|
||||
private List<String> resolveFileUrls(List<String> objectKeys) {
|
||||
if (CollectionUtil.isEmpty(objectKeys)) {
|
||||
return null;
|
||||
}
|
||||
return objectKeys.stream()
|
||||
.map(this::resolveFileUrl)
|
||||
.toList();
|
||||
}
|
||||
|
||||
private String resolveFileUrl(String objectKey) {
|
||||
if (StringUtil.isBlank(objectKey)) {
|
||||
return objectKey;
|
||||
}
|
||||
if (objectKey.startsWith("http://") || objectKey.startsWith("https://")) {
|
||||
return objectKey;
|
||||
}
|
||||
return fileService.getFileUrl(objectKey, null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user