BUGFIX:图片分割参数值变更
This commit is contained in:
@@ -113,9 +113,9 @@ public class ElementController {
|
||||
@PostMapping("/imageSegmentation")
|
||||
public Response<List<CollectionElementVO>> selectedImageSeg(
|
||||
@RequestPart(value = "file", required = false) MultipartFile[] file,
|
||||
@RequestParam(value = "type", required = false) @Pattern(regexp = "sketch|product", message = "类型必须是sketch或product") String type,
|
||||
@RequestParam(value = "type", required = false) @Pattern(regexp = "sketch|product", message = "Please choose the image type") String type,
|
||||
@RequestParam(value = "id", required = false) Long id,
|
||||
@RequestParam(value = "sourceType", required = false) @Pattern(regexp = "library|upload", message = "id是从library中获取的还是上传的") String sourceType) {
|
||||
@RequestParam(value = "sourceType", required = false) @Pattern(regexp = "Library|Upload", message = "Select an image from the library or upload one.") String sourceType) {
|
||||
// 过滤空文件
|
||||
List<MultipartFile> nonEmptyFiles = Arrays.stream(file)
|
||||
.filter(item -> !item.isEmpty())
|
||||
|
||||
@@ -1018,7 +1018,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
resp.add(createCollectionElementVO(accountId, null, null, imageData.getImage_url(), imageData.getClothing_url()));
|
||||
}
|
||||
}
|
||||
} else if (Objects.nonNull(id) && sourceType.equals("library")) {
|
||||
} else if (Objects.nonNull(id) && sourceType.equals("Library")) {
|
||||
library = libraryService.getById(id);
|
||||
// 判断从library中选择的图片是否有分割数据
|
||||
if (Objects.isNull(library)) {
|
||||
@@ -1033,7 +1033,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
List<String> restoredList = Arrays.asList(library.getSegmentedData().split(","));
|
||||
resp.add(createCollectionElementVO(accountId, id, library.getLevel1Type(), library.getUrl(), restoredList));
|
||||
}
|
||||
} else if (Objects.nonNull(id) && sourceType.equals("upload")) {
|
||||
} else if (Objects.nonNull(id) && sourceType.equals("Upload")) {
|
||||
collectionElement = collectionElementMapper.selectById(id);
|
||||
// 判断id对应的数据是否存在
|
||||
if (Objects.isNull(collectionElement)) {
|
||||
@@ -1064,7 +1064,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
(imageData.getImage_url(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME), false);
|
||||
redisUtil.addToString(key, new Gson().toJson(imageData), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
|
||||
resp.add(createCollectionElementVO(accountId, null, null, imageData.getImage_url(), imageData.getClothing_url()));
|
||||
} else if (sourceType.equals("library")){
|
||||
} else if (sourceType.equals("Library")){
|
||||
// 从library中选择的图片需要更新数据库中对应图片的分割数据
|
||||
String segmentedData = String.join(",", imageData.getClothing_url());
|
||||
library.setSegmentedData(segmentedData);
|
||||
|
||||
Reference in New Issue
Block a user