1、修复菜单无法编辑
2、完善运输计划 3、完善运单管理 4、新增配置管理
This commit is contained in:
@@ -31,4 +31,20 @@ public class CertificateBatchRecognitionDTO implements Serializable {
|
||||
* 目录名称
|
||||
*/
|
||||
private String dirName;
|
||||
/**
|
||||
* 磅单url列表
|
||||
*/
|
||||
private List<String> poundUrls;
|
||||
/**
|
||||
* 车头url列表
|
||||
*/
|
||||
private List<String> carFrontUrls;
|
||||
/**
|
||||
* 驾驶证url列表
|
||||
*/
|
||||
private List<String> driverLicenseUrls;
|
||||
/**
|
||||
* 行驶证url列表
|
||||
*/
|
||||
private List<String> vehicleLicenseUrls;
|
||||
}
|
||||
|
||||
@@ -47,10 +47,26 @@ public class OCRServiceImpl implements IOCRService {
|
||||
@Override
|
||||
public TransportCertificateVO recognitionTransportCertificate(CertificateBatchRecognitionDTO param) {
|
||||
log.info("ocr 批量识别参数:{}", JSONUtil.toJsonStr(param));
|
||||
if (param == null || CollectionUtils.isEmpty(param.getUrls())) {
|
||||
if (param == null) {
|
||||
throw new OCRException("图像链接不能为空");
|
||||
}
|
||||
List<OCRResultVO<OCRBigCommonCardVO>> result = this.getCardResult(() -> client.batchRecognition(new OCRBigCommonCardBatchDTO(param.getUrls(), param.getProjectAbbreviation(), param.getDirName()), param.getCode()), "批量磅单卡证识别");
|
||||
if (hasTypedUrls(param)) {
|
||||
return convertTransportCertificate(recognitionTransportCertificateWithTypedUrls(param));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(param.getUrls())) {
|
||||
throw new OCRException("图像链接不能为空");
|
||||
}
|
||||
List<OCRResultVO<OCRBigCommonCardVO>> result = this.getCardResult(
|
||||
() -> client.batchRecognition(
|
||||
new OCRBigCommonCardBatchDTO(
|
||||
param.getUrls(),
|
||||
param.getProjectAbbreviation(),
|
||||
param.getDirName()
|
||||
),
|
||||
param.getCode()
|
||||
),
|
||||
"批量磅单卡证识别"
|
||||
);
|
||||
List<OCRBigCommonCardVO> cards = result.stream()
|
||||
.map(OCRResultVO::getResult)
|
||||
.toList();
|
||||
@@ -134,6 +150,108 @@ public class OCRServiceImpl implements IOCRService {
|
||||
}
|
||||
}
|
||||
|
||||
private List<OCRBigCommonCardVO> recognitionTransportCertificateWithTypedUrls(CertificateBatchRecognitionDTO param) {
|
||||
List<OCRBigCommonCardVO> cards = new ArrayList<>(4);
|
||||
addPoundRecognitionCards(cards, param);
|
||||
addDriverLicenseRecognitionCards(cards, param);
|
||||
addVehicleLicenseRecognitionCards(cards, param);
|
||||
addCarFrontRecognitionCards(cards, param);
|
||||
return cards;
|
||||
}
|
||||
|
||||
private void addPoundRecognitionCards(List<OCRBigCommonCardVO> cards, CertificateBatchRecognitionDTO param) {
|
||||
for (String url : Optional.ofNullable(param.getPoundUrls()).orElse(List.of())) {
|
||||
if (StringUtil.isBlank(url)) {
|
||||
continue;
|
||||
}
|
||||
OCRBigCommonCardVO card = this.getCardResult(
|
||||
() -> client.poundRecognition(
|
||||
new OCRSingleDTO(url, param.getProjectAbbreviation()), param.getCode()
|
||||
),
|
||||
"磅单单独识别"
|
||||
);
|
||||
addCard(cards, card);
|
||||
}
|
||||
}
|
||||
|
||||
private void addDriverLicenseRecognitionCards(List<OCRBigCommonCardVO> cards, CertificateBatchRecognitionDTO param) {
|
||||
List<String> driverLicenseUrls = Optional.ofNullable(param.getDriverLicenseUrls()).orElse(List.of());
|
||||
for (String url : driverLicenseUrls) {
|
||||
if (StringUtil.isBlank(url)) {
|
||||
continue;
|
||||
}
|
||||
OCRBigCommonCardVO card = this.getCardResult(
|
||||
() -> client.singleRecognition(
|
||||
new OCRBigCommonCardDTO(
|
||||
url,
|
||||
param.getProjectAbbreviation(),
|
||||
List.of(
|
||||
OCRImageType.DRIVER_LICENSE_MAIN.getId(),
|
||||
OCRImageType.DRIVER_LICENSE_SIDE.getId(),
|
||||
OCRImageType.DRIVER_LICENSE_ELEC.getId()
|
||||
)
|
||||
),
|
||||
param.getCode()
|
||||
),
|
||||
"驾驶证识别"
|
||||
);
|
||||
addCard(cards, card);
|
||||
}
|
||||
}
|
||||
|
||||
private void addVehicleLicenseRecognitionCards(List<OCRBigCommonCardVO> cards, CertificateBatchRecognitionDTO param) {
|
||||
List<String> vehicleLicenseUrls = Optional.ofNullable(param.getVehicleLicenseUrls()).orElse(List.of());
|
||||
for (String url : vehicleLicenseUrls) {
|
||||
if (StringUtil.isBlank(url)) {
|
||||
continue;
|
||||
}
|
||||
OCRBigCommonCardVO card = this.getCardResult(
|
||||
() -> client.singleRecognition(
|
||||
new OCRBigCommonCardDTO(
|
||||
url,
|
||||
param.getProjectAbbreviation(),
|
||||
List.of(
|
||||
OCRImageType.VEHICLE_LICENSE_MAIN_GUA.getId(),
|
||||
OCRImageType.VEHICLE_LICENSE_MAIN.getId(),
|
||||
OCRImageType.VEHICLE_LICENSE_SIDE.getId()
|
||||
)
|
||||
),
|
||||
param.getCode()
|
||||
),
|
||||
"行驶证识别"
|
||||
);
|
||||
addCard(cards, card);
|
||||
}
|
||||
}
|
||||
|
||||
private void addCarFrontRecognitionCards(List<OCRBigCommonCardVO> cards, CertificateBatchRecognitionDTO param) {
|
||||
for (String url : Optional.ofNullable(param.getCarFrontUrls()).orElse(List.of())) {
|
||||
if (StringUtil.isBlank(url)) {
|
||||
continue;
|
||||
}
|
||||
OCRBigCommonCardVO card = this.getCardResult(
|
||||
() -> client.plateNoRecognition(
|
||||
new OCRSingleDTO(url, param.getProjectAbbreviation()), param.getCode()
|
||||
),
|
||||
"⻋牌单独识别"
|
||||
);
|
||||
addCard(cards, card);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasTypedUrls(CertificateBatchRecognitionDTO param) {
|
||||
return CollectionUtil.isNotEmpty(param.getPoundUrls())
|
||||
|| CollectionUtil.isNotEmpty(param.getCarFrontUrls())
|
||||
|| CollectionUtil.isNotEmpty(param.getDriverLicenseUrls())
|
||||
|| CollectionUtil.isNotEmpty(param.getVehicleLicenseUrls());
|
||||
}
|
||||
|
||||
private static void addCard(List<OCRBigCommonCardVO> cards, OCRBigCommonCardVO card) {
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换车辆凭证
|
||||
* @param cards
|
||||
|
||||
Reference in New Issue
Block a user