Merge remote-tracking branch 'origin/dev-ltx' into dev/3.1_release_merge

This commit is contained in:
litianxiang
2025-11-20 10:50:17 +08:00
5 changed files with 147 additions and 5 deletions

View File

@@ -3270,7 +3270,11 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
private String buildAdvancedPrompt(Long projectId, String prompt) {
String process = projectService.getById(projectId).getProcess();
String ageGroup = workspaceService.getWSByProjectId(projectId).getAgeGroup();
String ageGroup = null;
if (!"TO_PRODUCT_IMAGE".equals(process)) {
//高级工具转产品图不需要这个字段
ageGroup = workspaceService.getWSByProjectId(projectId).getAgeGroup();
}
String suffixCommon = "Pay attention to the size of the garment, the print, and the fabric texture, real photo, 8K, HDR, DOF, soft lighting, high detail, high quality, Do not return the original image.";
String suffixModelAdult = "Transform this image into a real model standing," + suffixCommon;
String suffixModelChild = "Transform this image into a real child model standing," + suffixCommon;

View File

@@ -10,6 +10,8 @@ import com.ai.da.common.response.ResultEnum;
import com.ai.da.common.utils.*;
import com.ai.da.mapper.primary.*;
import com.ai.da.mapper.primary.entity.*;
import com.ai.da.mapper.secondary.AttributeRetrievalMapper;
import com.ai.da.mapper.secondary.entity.AttributeRetrieval;
import com.ai.da.model.dto.ProjectDTO;
import com.ai.da.model.dto.WorkspaceDTO;
import com.ai.da.model.dto.WorkspaceSaveDTO;
@@ -26,6 +28,7 @@ import io.netty.util.internal.StringUtil;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -37,6 +40,7 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.annotation.Resource;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -610,10 +614,138 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
}
}
//上传衣服
@Autowired
private AttributeRetrievalMapper attributeRetrievalMapper;
@Override
@Transactional
public void maleDataInsert() throws FileNotFoundException {
String directoryPath = "C:\\workspace\\fileData\\aida_men_library";
String directoryPath = "C:\\Users\\39093\\Desktop\\generated_sketch_gemini_updated_regendered\\unisex\\Post_apocalyptic";
List<File> pngFiles = getPNGFiles(directoryPath);
for (File pngFile : pngFiles) {
String category = Paths.get(directoryPath).getFileName().toString();
String fileName = category + "_2_" + pngFile.getName();
String tableName = null;
SysFile sysFile = new SysFile();
sysFile.setName(fileName);
sysFile.setLevel1Type("Images");
AttributeRetrieval attributeRetrievalAttrDict = new AttributeRetrieval();
attributeRetrievalAttrDict.setStyle("POST_APOCALYPTIC");
String absolutePath = pngFile.getAbsolutePath();
StringBuilder sb = new StringBuilder();
sb.append("aida-sys-image/images");
if (absolutePath.contains("Coat_Jacket") || absolutePath.contains("coat_jacket")) {
if (absolutePath.contains("\\male")) {
tableName = "male_outwear";
sb.append("/male/outwear/");
sysFile.setLevel3Type("Male");
} else if (absolutePath.contains("\\female")) {
tableName = "female_outwear";
sb.append("/female/outwear/");
sysFile.setLevel3Type("Female");
} else if (absolutePath.contains("\\unisex")) {
tableName = "female_outwear";
sb.append("/female/outwear/");
sysFile.setLevel3Type("Female");
}
sysFile.setLevel2Type("Outwear");
attributeRetrievalAttrDict.setImgName("outwear/" + fileName);
}
if (absolutePath.contains("Pants") || absolutePath.contains("pants")) {
if (absolutePath.contains("\\male")) {
tableName = "male_bottoms";
sb.append("/male/bottoms/");
sysFile.setLevel3Type("Male");
} else if (absolutePath.contains("\\female")) {
tableName = "female_trousers";
sb.append("/female/trousers/");
sysFile.setLevel3Type("Female");
} else if (absolutePath.contains("\\unisex")) {
tableName = "female_trousers";
sb.append("/female/trousers/");
sysFile.setLevel3Type("Female");
}
sysFile.setLevel2Type("Trousers");
attributeRetrievalAttrDict.setImgName("trousers/" + fileName);
}
if (absolutePath.contains("Top_Shirt") || absolutePath.contains("top_shirt")) {
if (absolutePath.contains("\\male")) {
tableName = "male_tops";
sb.append("/male/tops/");
sysFile.setLevel3Type("Male");
} else if (absolutePath.contains("\\female")) {
tableName = "female_blouse";
sb.append("/female/blouse/");
sysFile.setLevel3Type("Female");
} else if (absolutePath.contains("\\unisex")) {
tableName = "female_blouse";
sb.append("/female/blouse/");
sysFile.setLevel3Type("Female");
}
sysFile.setLevel2Type("Blouse");
attributeRetrievalAttrDict.setImgName("blouse/" + fileName);
}
if (absolutePath.contains("Dress") || absolutePath.contains("dress")) {
tableName = "female_dress";
sb.append("/female/dress/");
sysFile.setLevel2Type("Dress");
sysFile.setLevel3Type("Female");
attributeRetrievalAttrDict.setImgName("dress/" + fileName);
}
if (absolutePath.contains("skirt") || absolutePath.contains("Skirt")) {
tableName = "female_skirt";
sb.append("/female/skirt/");
sysFile.setLevel2Type("Skirt");
sysFile.setLevel3Type("Female");
attributeRetrievalAttrDict.setImgName("skirt/" + fileName);
}
sb.append(fileName);
String url = sb.toString();
sysFile.setUrl(url);
sysFile.setMd5(MD5Utils.encryptFile(new FileInputStream(pngFile)));
attributeRetrievalMapper.insertSketch(attributeRetrievalAttrDict, tableName);
sysFile.setCreateDate(new Date());
sysFile.setId(null);
sysFileMapper.insert(sysFile);
FileItem a = getMultipartFile(pngFile, fileName);
MultipartFile multipartFile = new CommonsMultipartFile(a);
minioUtil.upload(url.substring(0, 14), url.substring(15), multipartFile, "");
System.out.println("上传成功url:" + url);
if (absolutePath.contains("unisex")) {
if (tableName.equals("female_outwear")) {
tableName = "male_outwear";
url = url.replace("/female/outwear/", "/male/outwear/");
} else if (tableName.equals("female_blouse")) {
tableName = "male_tops";
attributeRetrievalAttrDict.setImgName("tops/" + fileName);
sysFile.setLevel2Type("Tops");
url = url.replace("/female/blouse/", "/male/tops/");
} else if (tableName.equals("female_trousers")) {
tableName = "male_bottoms";
attributeRetrievalAttrDict.setImgName("bottoms/" + fileName);
sysFile.setLevel2Type("Bottoms");
url = url.replace("/female/trousers/", "/male/bottoms/");
}
minioUtil.upload(url.substring(0, 14), url.substring(15), multipartFile, "");
sysFile.setLevel3Type("Male");
sysFile.setId(null);
sysFile.setUrl(url);
sysFileMapper.insert(sysFile);
attributeRetrievalMapper.insertSketch(attributeRetrievalAttrDict, tableName);
System.out.println("上传成功url:" + url);
}
}
System.out.println("结束");
}
//上传衣服
public void maleDataInsert1() throws FileNotFoundException {
String directoryPath = "C:\\Users\\39093\\Desktop\\generated_sketch_gemini_updated_regendered";
List<File> pngFiles = getPNGFiles(directoryPath);
for (File pngFile : pngFiles) {
SysFile sysFile = new SysFile();