1、修复菜单无法编辑

2、完善运输计划
3、完善运单管理
4、新增配置管理
This commit is contained in:
2026-08-04 20:53:57 +08:00
parent 30c51ba271
commit 62a110b6de
23 changed files with 2081 additions and 22 deletions

View File

@@ -29,7 +29,9 @@ import org.springframework.context.ApplicationEvent;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
@@ -145,8 +147,94 @@ public class FileController extends BladeController {
@ApiLog("OCR识别-识别车辆运输凭证(不知道类型)")
@Operation(summary = "识别车辆运输凭证,不知道类型", description = "参数:objectKeylist")
@PostMapping("/recognitionTransportCertificates")
public R<TransportCertificateVO> recognitionTransportCertificates(@RequestBody List<String> objectKeys, @RequestParam(value = "projectAbbreviation", required = false) String projectAbbreviation, @RequestParam(value = "code", required = false) String code) {
return R.data(ocrConvertService.recognitionTransportCertificate(new FileCertificateBatchRecognitionDTO(objectKeys, projectAbbreviation, code, null)));
public R<TransportCertificateVO> recognitionTransportCertificates(
@RequestBody List<Object> attachments,
@RequestParam(value = "projectAbbreviation", required = false) String projectAbbreviation,
@RequestParam(value = "code", required = false) String code) {
return R.data(ocrConvertService.recognitionTransportCertificate(
buildCertificateBatchRecognitionDTO(attachments, projectAbbreviation, code)
));
}
private FileCertificateBatchRecognitionDTO buildCertificateBatchRecognitionDTO(
List<Object> attachments, String projectAbbreviation, String code) {
List<String> objectKeys = new ArrayList<>();
List<String> poundUrls = new ArrayList<>();
List<String> carFrontUrls = new ArrayList<>();
List<String> driverLicenseUrls = new ArrayList<>();
List<String> vehicleLicenseUrls = new ArrayList<>();
for (Object attachment : Optional.ofNullable(attachments).orElse(List.of())) {
if (attachment instanceof String objectKey) {
if (StringUtil.isNotBlank(objectKey)) {
objectKeys.add(objectKey);
}
continue;
}
if (attachment instanceof Map<?, ?> attachmentMap) {
String objectKey = getAttachmentObjectKey(attachmentMap);
if (StringUtil.isBlank(objectKey)) {
continue;
}
objectKeys.add(objectKey);
addTypedObjectKeys(attachmentMap, poundUrls, carFrontUrls, driverLicenseUrls, vehicleLicenseUrls);
}
}
FileCertificateBatchRecognitionDTO dto = new FileCertificateBatchRecognitionDTO(
objectKeys, projectAbbreviation, code, null
);
dto.setPoundUrls(poundUrls);
dto.setCarFrontUrls(carFrontUrls);
dto.setDriverLicenseUrls(driverLicenseUrls);
dto.setVehicleLicenseUrls(vehicleLicenseUrls);
return dto;
}
private String getAttachmentObjectKey(Map<?, ?> map) {
String objectKey = getMapString(map, "objectKey");
if (StringUtil.isNotBlank(objectKey)) {
return objectKey;
}
String url = getMapString(map, "url");
if (StringUtil.isNotBlank(url)) {
return url;
}
String poundUrl = getMapString(map, "poundUrl");
if (StringUtil.isNotBlank(poundUrl)) {
return poundUrl;
}
String carFrontUrl = getMapString(map, "carFrontUrl");
if (StringUtil.isNotBlank(carFrontUrl)) {
return carFrontUrl;
}
String driverLicenseUrl = getMapString(map, "driverLicenseUrl");
if (StringUtil.isNotBlank(driverLicenseUrl)) {
return driverLicenseUrl;
}
return getMapString(map, "vehicleLicenseUrl");
}
private void addTypedObjectKeys(
Map<?, ?> map,
List<String> poundUrls,
List<String> carFrontUrls,
List<String> driverLicenseUrls,
List<String> vehicleLicenseUrls) {
addMapString(map, "poundUrl", poundUrls);
addMapString(map, "carFrontUrl", carFrontUrls);
addMapString(map, "driverLicenseUrl", driverLicenseUrls);
addMapString(map, "vehicleLicenseUrl", vehicleLicenseUrls);
}
private void addMapString(Map<?, ?> map, String key, List<String> values) {
String value = getMapString(map, key);
if (StringUtil.isNotBlank(value)) {
values.add(value);
}
}
private String getMapString(Map<?, ?> map, String key) {
Object value = map.get(key);
return value == null ? "" : String.valueOf(value);
}
@ApiLog("OCR识别-识别车辆运输凭证(知道类型)")

View File

@@ -37,12 +37,36 @@ public class OCRConvertServiceImpl implements IOCRConvertService {
throw new ServiceException("图像obs key不能为空");
}
CertificateBatchRecognitionDTO ocrParam = converter.dto2ocr(param);
// 转换文件链接
List<String> fileUrls = param.getObjectKeys().stream()
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);
} else {
ocrParam.setUrls(null);
}
return ocrService.recognitionTransportCertificate(ocrParam);
}
private boolean hasTypedObjectKeys(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();
ocrParam.setUrls(fileUrls);
return ocrService.recognitionTransportCertificate(ocrParam);
}
private String resolveFileUrl(String objectKey) {