From 779e8a0b27819d2541c5ddff65971850c2722f2d Mon Sep 17 00:00:00 2001 From: fyb Date: Thu, 2 Mar 2023 10:10:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix=EF=BC=9Afile=20with=20special=20symbols?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/ai/basic/x1/usecase/DataInfoUseCase.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/ai/basic/x1/usecase/DataInfoUseCase.java b/backend/src/main/java/ai/basic/x1/usecase/DataInfoUseCase.java index a2fcb53d..dba39e9d 100644 --- a/backend/src/main/java/ai/basic/x1/usecase/DataInfoUseCase.java +++ b/backend/src/main/java/ai/basic/x1/usecase/DataInfoUseCase.java @@ -46,7 +46,10 @@ import java.io.File; import java.io.FileFilter; import java.io.IOException; +import java.net.URLDecoder; +import java.net.URLEncoder; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.nio.file.Paths; import java.time.OffsetDateTime; import java.util.*; @@ -590,7 +593,7 @@ private void parseImageUploadFile(DataInfoUploadBO dataInfoUploadBO) { var file = FileUtil.file(dataInfoUploadBO.getSavePath()); var imageExtraInfoBO = ImageExtraInfoBO.builder().height(Img.from(file).getImg().getHeight(null)) .width(Img.from(file).getImg().getWidth(null)).build(); - var fileUrl = DecompressionFileUtils.removeUrlParameter(dataInfoUploadBO.getFileUrl()); + var fileUrl = DecompressionFileUtils.removeUrlParameter(URLUtil.decode(dataInfoUploadBO.getFileUrl())); var path = fileUrl.replace(minioProp.getEndpoint(), "").replace(minioProp.getBucketName() + "/", ""); var fileBO = FileBO.builder().name(file.getName()).originalName(file.getName()).bucketName(minioProp.getBucketName()) .size(file.length()).path(path).type(FileUtil.getMimeType(path)).extraInfo(JSONUtil.parseObj(imageExtraInfoBO)).build(); @@ -867,7 +870,7 @@ public ModelObjectBO getModelAnnotateResult(Long serialNo, List dataIds) { private void downloadAndDecompressionFile(T dataInfoUploadBO, Consumer function) throws IOException { var fileUrl = URLUtil.decode(dataInfoUploadBO.getFileUrl()); var datasetId = dataInfoUploadBO.getDatasetId(); - var path = DecompressionFileUtils.removeUrlParameter(dataInfoUploadBO.getFileUrl()); + var path = DecompressionFileUtils.removeUrlParameter(fileUrl); dataInfoUploadBO.setFileName(FileUtil.getPrefix(path)); var baseSavePath = String.format("%s%s/", tempPath, UUID.randomUUID().toString().replace("-", "")); var savePath = baseSavePath + FileUtil.getName(path); From c3b4b3dae02f09ba26c9012d77d71f54eb80fdaa Mon Sep 17 00:00:00 2001 From: chenchao Date: Fri, 3 Mar 2023 14:24:47 +0800 Subject: [PATCH 2/3] fix bug: import class and classification --- .../main/resources/mybatis/mapper/ClassificationMapper.xml | 6 +++--- .../mybatis/mapper/DatasetClassificationMapper.xml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/src/main/resources/mybatis/mapper/ClassificationMapper.xml b/backend/src/main/resources/mybatis/mapper/ClassificationMapper.xml index 7ee3603f..b7b18cff 100644 --- a/backend/src/main/resources/mybatis/mapper/ClassificationMapper.xml +++ b/backend/src/main/resources/mybatis/mapper/ClassificationMapper.xml @@ -7,16 +7,16 @@ id, ontology_id, name, color, dataset_type, is_required, input_type, options,created_at, created_by, updated_at, updated_by - INSERT INTO classification (ontology_id, name, is_required, input_type,options, created_by, updated_by) + INSERT INTO classification (ontology_id, name, is_required, input_type,attribute, created_by, updated_by) VALUES (#{item.ontologyId},#{item.name},#{item.isRequired},#{item.inputType}, - #{item.options,jdbcType=OTHER,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, + #{item.attribute,jdbcType=OTHER,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, #{item.createdBy},#{item.updatedBy}) ON DUPLICATE KEY UPDATE is_required=VALUES(is_required), input_type=VALUES(input_type), - options=VALUES(options), + attribute=VALUES(attribute), updated_by=VALUES(updated_by) diff --git a/backend/src/main/resources/mybatis/mapper/DatasetClassificationMapper.xml b/backend/src/main/resources/mybatis/mapper/DatasetClassificationMapper.xml index e6ab4f00..5b4c0bd2 100644 --- a/backend/src/main/resources/mybatis/mapper/DatasetClassificationMapper.xml +++ b/backend/src/main/resources/mybatis/mapper/DatasetClassificationMapper.xml @@ -3,16 +3,16 @@ - INSERT INTO dataset_classification (dataset_id, name, is_required, input_type,options, created_by, updated_by) + INSERT INTO dataset_classification (dataset_id, name, is_required, input_type,attribute, created_by, updated_by) VALUES (#{item.datasetId},#{item.name},#{item.isRequired},#{item.inputType}, - #{item.options,jdbcType=OTHER,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, + #{item.attribute,jdbcType=OTHER,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, #{item.createdBy},#{item.updatedBy}) ON DUPLICATE KEY UPDATE is_required=VALUES(is_required), input_type=VALUES(input_type), - options=VALUES(options), + attribute=VALUES(attribute), updated_by=VALUES(updated_by) \ No newline at end of file From bb686d8916b8b99b98b539cdbc8bd7489e4b576b Mon Sep 17 00:00:00 2001 From: guhao Date: Fri, 3 Mar 2023 16:41:54 +0800 Subject: [PATCH 3/3] fix: classifcation bug --- .../pc-editor/utils/classification.ts | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/frontend/pc-tool/src/packages/pc-editor/utils/classification.ts b/frontend/pc-tool/src/packages/pc-editor/utils/classification.ts index e4960b97..3f5891fd 100644 --- a/frontend/pc-tool/src/packages/pc-editor/utils/classification.ts +++ b/frontend/pc-tool/src/packages/pc-editor/utils/classification.ts @@ -5,26 +5,31 @@ export function traverseClassification2Arr(data: any[]) { let classifications = [] as IClassification[]; data.forEach((e: any) => { + let attribute = e.attribute || e; let classificationId = e.id + ''; + let classification: IClassification = { id: classificationId, name: e.name, label: e.name, attrs: [], }; - let options = e.options || []; + let options = attribute.options || []; + if (e.inputType) { + attribute.type = e.inputType; + } let classificationAttr: IClassificationAttr = { - id: e.id, - key: e.name, + id: attribute.id, + key: attribute.name, classificationId, parent: '', parentValue: '', parentAttr: e.name, - type: e.inputType, - name: e.name, - label: e.name, - value: e.inputType === AttrType.MULTI_SELECTION ? [] : '', - required: e.isRequired, + type: attribute.type, + name: attribute.name, + label: attribute.name, + value: attribute.type === AttrType.MULTI_SELECTION ? [] : '', + required: attribute.required, options: options.map((e: any) => { return { value: e.name, label: e.name }; }), @@ -32,7 +37,7 @@ export function traverseClassification2Arr(data: any[]) { classification.attrs.push(classificationAttr); options.forEach((option: any) => { - traverseOption(classification, option, classificationAttr.id, e.name); + traverseOption(classification, option, classificationAttr.id, attribute.name); }); classifications.push(classification); }); @@ -50,7 +55,7 @@ export function traverseClassification2Arr(data: any[]) { option.attributes.forEach((attr: any) => { let name = attr.name; let classificationAttr: IClassificationAttr = { - id: attr.id || attr.uuid, + id: attr.id, key: `${parent}[${option.name}]-${name}`, classificationId: classification.id, parent, @@ -72,6 +77,7 @@ export function traverseClassification2Arr(data: any[]) { }); } } + export function traverseClass2Arr(data: any) { let classTypes = [] as IClassType[]; data.forEach((config: any) => {