Skip to content

Commit 8e81625

Browse files
authored
Merge pull request #94 from xtreme1-io/dev
Dev
2 parents d46c129 + bb686d8 commit 8e81625

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

backend/src/main/java/ai/basic/x1/usecase/DataInfoUseCase.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
import java.io.File;
4747
import java.io.FileFilter;
4848
import java.io.IOException;
49+
import java.net.URLDecoder;
50+
import java.net.URLEncoder;
4951
import java.nio.charset.Charset;
52+
import java.nio.charset.StandardCharsets;
5053
import java.nio.file.Paths;
5154
import java.time.OffsetDateTime;
5255
import java.util.*;
@@ -590,7 +593,7 @@ private void parseImageUploadFile(DataInfoUploadBO dataInfoUploadBO) {
590593
var file = FileUtil.file(dataInfoUploadBO.getSavePath());
591594
var imageExtraInfoBO = ImageExtraInfoBO.builder().height(Img.from(file).getImg().getHeight(null))
592595
.width(Img.from(file).getImg().getWidth(null)).build();
593-
var fileUrl = DecompressionFileUtils.removeUrlParameter(dataInfoUploadBO.getFileUrl());
596+
var fileUrl = DecompressionFileUtils.removeUrlParameter(URLUtil.decode(dataInfoUploadBO.getFileUrl()));
594597
var path = fileUrl.replace(minioProp.getEndpoint(), "").replace(minioProp.getBucketName() + "/", "");
595598
var fileBO = FileBO.builder().name(file.getName()).originalName(file.getName()).bucketName(minioProp.getBucketName())
596599
.size(file.length()).path(path).type(FileUtil.getMimeType(path)).extraInfo(JSONUtil.parseObj(imageExtraInfoBO)).build();
@@ -867,7 +870,7 @@ public ModelObjectBO getModelAnnotateResult(Long serialNo, List<Long> dataIds) {
867870
private <T extends DataInfoUploadBO> void downloadAndDecompressionFile(T dataInfoUploadBO, Consumer<T> function) throws IOException {
868871
var fileUrl = URLUtil.decode(dataInfoUploadBO.getFileUrl());
869872
var datasetId = dataInfoUploadBO.getDatasetId();
870-
var path = DecompressionFileUtils.removeUrlParameter(dataInfoUploadBO.getFileUrl());
873+
var path = DecompressionFileUtils.removeUrlParameter(fileUrl);
871874
dataInfoUploadBO.setFileName(FileUtil.getPrefix(path));
872875
var baseSavePath = String.format("%s%s/", tempPath, UUID.randomUUID().toString().replace("-", ""));
873876
var savePath = baseSavePath + FileUtil.getName(path);

backend/src/main/resources/mybatis/mapper/ClassificationMapper.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
id, ontology_id, name, color, dataset_type, is_required, input_type, options,created_at, created_by, updated_at, updated_by
88
</sql>
99
<insert id="saveOrUpdateBatch">
10-
INSERT INTO classification (ontology_id, name, is_required, input_type,options, created_by, updated_by)
10+
INSERT INTO classification (ontology_id, name, is_required, input_type,attribute, created_by, updated_by)
1111
VALUES
1212
<foreach collection="list" item="item" separator=",">
1313
(#{item.ontologyId},#{item.name},#{item.isRequired},#{item.inputType},
14-
#{item.options,jdbcType=OTHER,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
14+
#{item.attribute,jdbcType=OTHER,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
1515
#{item.createdBy},#{item.updatedBy})
1616
</foreach>
1717
ON DUPLICATE KEY UPDATE is_required=VALUES(is_required),
1818
input_type=VALUES(input_type),
19-
options=VALUES(options),
19+
attribute=VALUES(attribute),
2020
updated_by=VALUES(updated_by)
2121
</insert>
2222

backend/src/main/resources/mybatis/mapper/DatasetClassificationMapper.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
<mapper namespace="ai.basic.x1.adapter.port.dao.mybatis.mapper.DatasetClassificationMapper">
44

55
<insert id="saveOrUpdateBatch">
6-
INSERT INTO dataset_classification (dataset_id, name, is_required, input_type,options, created_by, updated_by)
6+
INSERT INTO dataset_classification (dataset_id, name, is_required, input_type,attribute, created_by, updated_by)
77
VALUES
88
<foreach collection="list" item="item" separator=",">
99
(#{item.datasetId},#{item.name},#{item.isRequired},#{item.inputType},
10-
#{item.options,jdbcType=OTHER,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
10+
#{item.attribute,jdbcType=OTHER,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
1111
#{item.createdBy},#{item.updatedBy})
1212
</foreach>
1313
ON DUPLICATE KEY UPDATE is_required=VALUES(is_required),
1414
input_type=VALUES(input_type),
15-
options=VALUES(options),
15+
attribute=VALUES(attribute),
1616
updated_by=VALUES(updated_by)
1717
</insert>
1818
</mapper>

frontend/pc-tool/src/packages/pc-editor/utils/classification.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,39 @@ export function traverseClassification2Arr(data: any[]) {
55
let classifications = [] as IClassification[];
66

77
data.forEach((e: any) => {
8+
let attribute = e.attribute || e;
89
let classificationId = e.id + '';
10+
911
let classification: IClassification = {
1012
id: classificationId,
1113
name: e.name,
1214
label: e.name,
1315
attrs: [],
1416
};
15-
let options = e.options || [];
17+
let options = attribute.options || [];
18+
if (e.inputType) {
19+
attribute.type = e.inputType;
20+
}
1621
let classificationAttr: IClassificationAttr = {
17-
id: e.id,
18-
key: e.name,
22+
id: attribute.id,
23+
key: attribute.name,
1924
classificationId,
2025
parent: '',
2126
parentValue: '',
2227
parentAttr: e.name,
23-
type: e.inputType,
24-
name: e.name,
25-
label: e.name,
26-
value: e.inputType === AttrType.MULTI_SELECTION ? [] : '',
27-
required: e.isRequired,
28+
type: attribute.type,
29+
name: attribute.name,
30+
label: attribute.name,
31+
value: attribute.type === AttrType.MULTI_SELECTION ? [] : '',
32+
required: attribute.required,
2833
options: options.map((e: any) => {
2934
return { value: e.name, label: e.name };
3035
}),
3136
};
3237

3338
classification.attrs.push(classificationAttr);
3439
options.forEach((option: any) => {
35-
traverseOption(classification, option, classificationAttr.id, e.name);
40+
traverseOption(classification, option, classificationAttr.id, attribute.name);
3641
});
3742
classifications.push(classification);
3843
});
@@ -50,7 +55,7 @@ export function traverseClassification2Arr(data: any[]) {
5055
option.attributes.forEach((attr: any) => {
5156
let name = attr.name;
5257
let classificationAttr: IClassificationAttr = {
53-
id: attr.id || attr.uuid,
58+
id: attr.id,
5459
key: `${parent}[${option.name}]-${name}`,
5560
classificationId: classification.id,
5661
parent,
@@ -72,6 +77,7 @@ export function traverseClassification2Arr(data: any[]) {
7277
});
7378
}
7479
}
80+
7581
export function traverseClass2Arr(data: any) {
7682
let classTypes = [] as IClassType[];
7783
data.forEach((config: any) => {

0 commit comments

Comments
 (0)