|
@@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.Optional;
|
|
import java.util.concurrent.CompletableFuture;
|
|
import java.util.concurrent.CompletableFuture;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -140,6 +141,14 @@ public class MaterialServiceImpl implements MaterialService {
|
|
if (materialCategory == null) throw new CustException("素材分类不存在");
|
|
if (materialCategory == null) throw new CustException("素材分类不存在");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // [Filter] tag_id 过滤掉空值和 0
|
|
|
|
+ String cleaned = Optional.ofNullable(material.getTag_ids())
|
|
|
|
+ .orElse("")
|
|
|
|
+ .replaceAll("\\b0\\b,?", "")
|
|
|
|
+ .replaceAll(",{2,}", ",")
|
|
|
|
+ .replaceAll("^,|,$", "");
|
|
|
|
+ material.setTag_ids(cleaned);
|
|
|
|
+
|
|
// 编辑的时候,如果素材图片有修改,需要删除之前的图片
|
|
// 编辑的时候,如果素材图片有修改,需要删除之前的图片
|
|
|
|
|
|
// 生成缩略图,并填充缩略图地址
|
|
// 生成缩略图,并填充缩略图地址
|