Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the bug where the data id is incorrect when displaying in reverse. #228

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions backend/src/main/java/ai/basic/x1/usecase/UploadDataUseCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ public void commonParseUploadFile(DataInfoUploadBO dataInfoUploadBO, BiConsumer<
.parentId(sceneId)
.status(DataStatusEnum.VALID)
.annotationStatus(DataAnnotationStatusEnum.NOT_ANNOTATED)
.splitType(NOT_SPLIT)
.createdAt(OffsetDateTime.now())
.updatedAt(OffsetDateTime.now())
.createdBy(userId)
Expand All @@ -497,16 +498,24 @@ public void commonParseUploadFile(DataInfoUploadBO dataInfoUploadBO, BiConsumer<
subDataNameList.forEach(dataName -> {
var dataFiles = this.getSingleDataFiles(sceneFile, dataName, errorBuilder, datasetType);
if (CollectionUtil.isNotEmpty(dataFiles)) {
log.info("dataStart,dataName:{},dataFiles:{}",dataName,dataFiles.stream().map(File::getName).collect(Collectors.toList()));
var tempDataId = ByteUtil.bytesToLong(SecureUtil.md5().digest(UUID.randomUUID().toString()));
var dataAnnotationObjectBO = dataAnnotationObjectBOBuilder.dataId(tempDataId).build();
var dataAnnotationObjectBO = dataAnnotationObjectBOBuilder.build();
dataAnnotationObjectBO.setDataId(tempDataId);
handleDataResult(sceneFile, dataName, dataAnnotationObjectBO, dataAnnotationObjectBOList, errorBuilder);
var fileNodeList = this.assembleContent(dataFiles, rootPath, dataInfoUploadBO);
log.info("Get data content,frameName:{},content:{} ", dataName, JSONUtil.toJsonStr(fileNodeList));
var dataInfoBO = dataInfoBOBuilder.name(dataName).orderName(NaturalSortUtil.convert(dataName)).content(fileNodeList).splitType(NOT_SPLIT).tempDataId(tempDataId).build();
var dataInfoBO = dataInfoBOBuilder.build();
dataInfoBO.setName(dataName);
dataInfoBO.setOrderName(NaturalSortUtil.convert(dataName));
dataInfoBO.setContent(fileNodeList);
dataInfoBO.setTempDataId(tempDataId);
dataInfoBOList.add(dataInfoBO);
}
});
if (CollectionUtil.isNotEmpty(dataInfoBOList)) {
log.info("dataInfoBOList:{}",dataInfoBOList.stream().map(DataInfoBO::getTempDataId).collect(Collectors.toList()));
log.info("dataAnnotationObjectBOList:{}",dataAnnotationObjectBOList.stream().map(DataAnnotationObjectBO::getDataId).collect(Collectors.toList()));
var resDataInfoList = this.insertBatch(dataInfoBOList, datasetId, errorBuilder, sceneId);
this.saveBatchDataResult(resDataInfoList, dataAnnotationObjectBOList);
}
Expand Down Expand Up @@ -651,6 +660,7 @@ public void handleDataResult(File file, String dataName, DataAnnotationObjectBO
.filter(fc -> fc.getName().toUpperCase().endsWith(JSON_SUFFIX) && dataName.equals(FileUtil.getPrefix(fc))
&& fc.getParentFile().getName().equalsIgnoreCase(RESULT)).findFirst();
if (resultFile.isPresent()) {
log.info("dataResult,dataName:{},resultFileName:{}",dataName,resultFile.get().getName());
try {
var resultJson = JSONUtil.readJSON(resultFile.get(), Charset.defaultCharset());
var result = new DataImportResultBO();
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ debug: false
logging:
level:
org.springframework.web.filter.CommonsRequestLoggingFilter: debug
ai.basic.basicai.user.adapter.port.dao.mybatis.mapper: debug
ai.basic.x1.adapter.port.dao.mybatis.mapper: debug
request:
maxPayloadLength: 100000

Expand Down
2 changes: 1 addition & 1 deletion deploy/mysql/migration/V2__Init_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ INSERT INTO `model`(`id`, `name`, `version`, `description`, `scenario`, `dataset
INSERT INTO `user`(`id`,`username`, `password`, `nickname`) VALUES (1,'admin', '$2a$10$0qk8vIkREsV6KYPeYJLU..C/JxJZc/ccfZIcEmFcnS8W9DtOD/y5K', 'admin');
INSERT INTO `model_class`(`model_id`, `name`, `code`, `created_at`, `created_by`, `updated_at`, `updated_by`) VALUES (2, 'Person', 'person', current_timestamp, 1, NULL, NULL);
INSERT INTO `model_class`(`model_id`, `name`, `code`, `created_at`, `created_by`, `updated_at`, `updated_by`) VALUES (2, 'Bicycle', 'bicycle', current_timestamp, 1, NULL, NULL);
INSERT INTO `model_class`(`model_id`, `name`, `code`, `created_at`, `created_by`, `updated_at`, `updated_by`) VALUES (2, 'Car', 'CAR', current_timestamp, 1, NULL, NULL);
INSERT INTO `model_class`(`model_id`, `name`, `code`, `created_at`, `created_by`, `updated_at`, `updated_by`) VALUES (2, 'Car', 'car', current_timestamp, 1, NULL, NULL);
INSERT INTO `model_class`(`model_id`, `name`, `code`, `created_at`, `created_by`, `updated_at`, `updated_by`) VALUES (2, 'Motorcycle', 'motorcycle', current_timestamp, 1, NULL, NULL);
INSERT INTO `model_class`(`model_id`, `name`, `code`, `created_at`, `created_by`, `updated_at`, `updated_by`) VALUES (2, 'Airplane', 'airplane', current_timestamp, 1, NULL, NULL);
INSERT INTO `model_class`(`model_id`, `name`, `code`, `created_at`, `created_by`, `updated_at`, `updated_by`) VALUES (2, 'Train', 'train', current_timestamp, 1, NULL, NULL);
Expand Down
Loading