Skip to content

Commit

Permalink
Merge pull request #94 from xtreme1-io/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jaggerwang authored Mar 3, 2023
2 parents d46c129 + bb686d8 commit 8e81625
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -867,7 +870,7 @@ public ModelObjectBO getModelAnnotateResult(Long serialNo, List<Long> dataIds) {
private <T extends DataInfoUploadBO> void downloadAndDecompressionFile(T dataInfoUploadBO, Consumer<T> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
id, ontology_id, name, color, dataset_type, is_required, input_type, options,created_at, created_by, updated_at, updated_by
</sql>
<insert id="saveOrUpdateBatch">
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
<foreach collection="list" item="item" separator=",">
(#{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})
</foreach>
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)
</insert>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
<mapper namespace="ai.basic.x1.adapter.port.dao.mybatis.mapper.DatasetClassificationMapper">

<insert id="saveOrUpdateBatch">
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
<foreach collection="list" item="item" separator=",">
(#{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})
</foreach>
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)
</insert>
</mapper>
26 changes: 16 additions & 10 deletions frontend/pc-tool/src/packages/pc-editor/utils/classification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,39 @@ 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 };
}),
};

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);
});
Expand All @@ -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,
Expand All @@ -72,6 +77,7 @@ export function traverseClassification2Arr(data: any[]) {
});
}
}

export function traverseClass2Arr(data: any) {
let classTypes = [] as IClassType[];
data.forEach((config: any) => {
Expand Down

0 comments on commit 8e81625

Please sign in to comment.