Merge branch 'dev/dev' into dev/dev_xp
# Conflicts: # src/main/java/com/ai/da/service/impl/DesignServiceImpl.java # src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java
This commit is contained in:
@@ -26,9 +26,9 @@ public class MQConfig {
|
|||||||
// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-local";
|
// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-local";
|
||||||
public static final String GENERATE_RESULT_QUEUE = "GenerateImage-dev";
|
public static final String GENERATE_RESULT_QUEUE = "GenerateImage-dev";
|
||||||
|
|
||||||
public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-local";
|
public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-dev";
|
||||||
|
|
||||||
public static final String RELIGHT_RESULT_QUEUE = "Relight-local";
|
public static final String RELIGHT_RESULT_QUEUE = "Relight-dev";
|
||||||
public MQConfig() {
|
public MQConfig() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -218,17 +218,17 @@ public class SRConsumer {
|
|||||||
taskListService.updateTaskStatusOrOutputRedis(uniqueId, "fail", null);
|
taskListService.updateTaskStatusOrOutputRedis(uniqueId, "fail", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @RabbitListener(queues = MQConfig.SR_QUEUE)
|
@RabbitListener(queues = MQConfig.SR_QUEUE)
|
||||||
// @RabbitHandler
|
@RabbitHandler
|
||||||
// public void SRConsumer1(Message msg, Channel channel) {
|
public void SRConsumer1(Message msg, Channel channel) {
|
||||||
// superResolution(msg, channel, "consumer 1");
|
superResolution(msg, channel, "consumer 1");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//
|
|
||||||
// @RabbitListener(queues = MQConfig.SR_RESULT_QUEUE)
|
@RabbitListener(queues = MQConfig.SR_RESULT_QUEUE)
|
||||||
// @RabbitHandler
|
@RabbitHandler
|
||||||
// public void SRResultConsumer1(Message msg, Channel channel) {
|
public void SRResultConsumer1(Message msg, Channel channel) {
|
||||||
// getSRResult(msg, channel, "consumer 1");
|
getSRResult(msg, channel, "consumer 1");
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ai.da.common.config;
|
package com.ai.da.common.config;
|
||||||
|
|
||||||
|
import com.ai.da.common.utils.ExcelReader;
|
||||||
import com.ai.da.common.utils.MinioUtil;
|
import com.ai.da.common.utils.MinioUtil;
|
||||||
import com.ai.da.common.utils.SendEmailUtil;
|
import com.ai.da.common.utils.SendEmailUtil;
|
||||||
import com.ai.da.mapper.primary.*;
|
import com.ai.da.mapper.primary.*;
|
||||||
@@ -26,6 +27,9 @@ import java.time.LocalDate;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@@ -34,6 +38,7 @@ public class MyTaskScheduler {
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void test() {
|
public void test() {
|
||||||
// clearMinio();
|
// clearMinio();
|
||||||
|
// addSystemFileStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -214,30 +219,104 @@ public class MyTaskScheduler {
|
|||||||
private AttributeRetrievalMapper attributeRetrievalMapper;
|
private AttributeRetrievalMapper attributeRetrievalMapper;
|
||||||
|
|
||||||
public void addSystemFileStyle() {
|
public void addSystemFileStyle() {
|
||||||
String directoryPath = "C:\\Users\\10233\\Downloads\\blouse done\\blouse done\\废土风";
|
ExecutorService executorService = Executors.newFixedThreadPool(5);
|
||||||
List<String> fileNames = getFileNames(directoryPath);
|
|
||||||
for (String fileName : fileNames) {
|
try {
|
||||||
String tableName = "female_top";
|
String[] filePaths = {
|
||||||
String style = "feitufeng";
|
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Blouse style output updated25.6.2024.xlsx",
|
||||||
Long idByFileName = attributeRetrievalMapper.getIdByFileName(fileName, tableName);
|
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Dress style output updated25.6.2024.xlsx",
|
||||||
attributeRetrievalMapper.updateStyleById(idByFileName, style, tableName);
|
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Outerwear style output.xlsx",
|
||||||
|
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Skirt style output .xlsx",
|
||||||
|
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Trousers style output.xlsx"
|
||||||
|
};
|
||||||
|
|
||||||
|
for (String filePath : filePaths) {
|
||||||
|
executorService.submit(() -> processExcelFile(filePath));
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
executorService.shutdown();
|
||||||
|
try {
|
||||||
|
if (!executorService.awaitTermination(60, TimeUnit.MINUTES)) {
|
||||||
|
executorService.shutdownNow();
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
executorService.shutdownNow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getFileNames(String directoryPath) {
|
private void processExcelFile(String filePath) {
|
||||||
List<String> fileNames = new ArrayList<>();
|
System.out.println("线程开始");
|
||||||
Path path = Paths.get(directoryPath);
|
try {
|
||||||
|
List<List<String>> excelData = ExcelReader.readExcel(filePath);
|
||||||
|
String tableName = getTableNameFromFilePath(filePath);
|
||||||
|
String prefix = getPrefixFromFilePath(filePath);
|
||||||
|
|
||||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(path)) {
|
for (List<String> columnData : excelData) {
|
||||||
for (Path entry : stream) {
|
String style = columnData.get(0);
|
||||||
if (Files.isRegularFile(entry)) {
|
for (int i = 1; i < columnData.size(); i++) {
|
||||||
fileNames.add(entry.getFileName().toString());
|
String fileName = columnData.get(i);
|
||||||
|
if (StringUtils.isBlank(fileName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ("X".equals(style)) {
|
||||||
|
attributeRetrievalMapper.updateStyleByFileName("X", prefix + fileName, tableName);
|
||||||
|
System.out.println(fileName);
|
||||||
|
} else {
|
||||||
|
attributeRetrievalMapper.updateStyleByFileName(style, prefix + fileName, tableName);
|
||||||
|
System.out.println(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Error reading directory: " + e.getMessage());
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return fileNames;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getTableNameFromFilePath(String filePath) {
|
||||||
|
if (filePath.contains("Blouse")) {
|
||||||
|
return "female_top";
|
||||||
|
} else if (filePath.contains("Dress")) {
|
||||||
|
return "female_dress";
|
||||||
|
} else if (filePath.contains("Outerwear")) {
|
||||||
|
return "female_outwear";
|
||||||
|
} else if (filePath.contains("Skirt")) {
|
||||||
|
return "female_skirt";
|
||||||
|
} else if (filePath.contains("Trousers")) {
|
||||||
|
return "female_pants";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getPrefixFromFilePath(String filePath) {
|
||||||
|
if (filePath.contains("Blouse")) {
|
||||||
|
return "blouse/";
|
||||||
|
} else if (filePath.contains("Dress")) {
|
||||||
|
return "dress/";
|
||||||
|
} else if (filePath.contains("Outerwear")) {
|
||||||
|
return "outwear/";
|
||||||
|
} else if (filePath.contains("Skirt")) {
|
||||||
|
return "skirt/";
|
||||||
|
} else if (filePath.contains("Trousers")) {
|
||||||
|
return "trousers/";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static List<String> getFileNames(String directoryPath) {
|
||||||
|
// List<String> fileNames = new ArrayList<>();
|
||||||
|
// Path path = Paths.get(directoryPath);
|
||||||
|
//
|
||||||
|
// try (DirectoryStream<Path> stream = Files.newDirectoryStream(path)) {
|
||||||
|
// for (Path entry : stream) {
|
||||||
|
// if (Files.isRegularFile(entry)) {
|
||||||
|
// fileNames.add(entry.getFileName().toString());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// System.err.println("Error reading directory: " + e.getMessage());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return fileNames;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
33
src/main/java/com/ai/da/common/utils/ExcelReader.java
Normal file
33
src/main/java/com/ai/da/common/utils/ExcelReader.java
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package com.ai.da.common.utils;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ExcelReader {
|
||||||
|
public static List<List<String>> readExcel(String filePath) throws IOException {
|
||||||
|
List<List<String>> data = new ArrayList<>();
|
||||||
|
try (FileInputStream fis = new FileInputStream(filePath);
|
||||||
|
Workbook workbook = new XSSFWorkbook(fis)) {
|
||||||
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
int numberOfColumns = sheet.getRow(0).getLastCellNum();
|
||||||
|
|
||||||
|
for (int i = 0; i < numberOfColumns; i++) {
|
||||||
|
List<String> columnData = new ArrayList<>();
|
||||||
|
for (Row row : sheet) {
|
||||||
|
columnData.add(row.getCell(i).getStringCellValue());
|
||||||
|
}
|
||||||
|
data.add(columnData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -405,6 +405,22 @@ public class MinioUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPresignedUrl(String path, int expiry, boolean resetCache) {
|
||||||
|
if (resetCache || LocalCacheUtils.getPresignedUrlCache(path) == null) {
|
||||||
|
if (!path.contains("/")) {
|
||||||
|
throw new BusinessException("The path is error!");
|
||||||
|
}
|
||||||
|
int index = path.indexOf("/");
|
||||||
|
String bucketName = path.substring(0, index);
|
||||||
|
String fileName = path.substring(index + 1);
|
||||||
|
String presignedUrl = getPresignedUrl(bucketName, fileName, expiry);
|
||||||
|
LocalCacheUtils.setPresignedUrlCache(path, presignedUrl);
|
||||||
|
return presignedUrl;
|
||||||
|
} else {
|
||||||
|
return LocalCacheUtils.getPresignedUrlCache(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将桶名、文件名从url中分离出来
|
* 将桶名、文件名从url中分离出来
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -32,6 +32,12 @@ public class PortfolioController {
|
|||||||
return Response.success(portfolioService.publish(canvas, data));
|
return Response.success(portfolioService.publish(canvas, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除作品集")
|
||||||
|
@GetMapping("/delete")
|
||||||
|
public Response<Boolean> delete(@RequestParam("id") Long id) {
|
||||||
|
return Response.success(portfolioService.delete(id));
|
||||||
|
}
|
||||||
|
|
||||||
@CrossOrigin
|
@CrossOrigin
|
||||||
@ApiOperation(value = "作品集page")
|
@ApiOperation(value = "作品集page")
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ public class SavedCollectionController {
|
|||||||
private MinioUtil minioUtil;
|
private MinioUtil minioUtil;
|
||||||
@Resource
|
@Resource
|
||||||
private ClassificationService classificationService;
|
private ClassificationService classificationService;
|
||||||
|
@Resource
|
||||||
|
private PortfolioService portfolioService;
|
||||||
|
|
||||||
@ApiOperation(value = "History用户分页分组列表")
|
@ApiOperation(value = "History用户分页分组列表")
|
||||||
@PostMapping("/queryUserGroup")
|
@PostMapping("/queryUserGroup")
|
||||||
@@ -122,6 +124,10 @@ public class SavedCollectionController {
|
|||||||
}
|
}
|
||||||
userLikeGroupVO.setGroupDetails(details);
|
userLikeGroupVO.setGroupDetails(details);
|
||||||
userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size());
|
userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size());
|
||||||
|
if (userLikeGroupVO.getOriginal() == 0) {
|
||||||
|
userLikeGroupVO.setOriginalAccountName(accountService.getById(userLikeGroupVO.getOriginalAccountId()).getUserName());
|
||||||
|
userLikeGroupVO.setOriginalPortfolioName(portfolioService.getById(userLikeGroupVO.getOriginalPortfolioId()).getPortfolioName());
|
||||||
|
}
|
||||||
return userLikeGroupVO;
|
return userLikeGroupVO;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -209,7 +215,7 @@ public class SavedCollectionController {
|
|||||||
|
|
||||||
@ApiOperation("productImageLikeList")
|
@ApiOperation("productImageLikeList")
|
||||||
@PostMapping("/productImageLikeList")
|
@PostMapping("/productImageLikeList")
|
||||||
public Response<List<ToProductImageResult>> productImageLikeList(@Valid @RequestBody ToProductImageDTO toProductImageDTO) {
|
public Response<List<ToProductImageResultVO>> productImageLikeList(@Valid @RequestBody ToProductImageDTO toProductImageDTO) {
|
||||||
return Response.success(userLikeGroupService.productImageLikeList(toProductImageDTO));
|
return Response.success(userLikeGroupService.productImageLikeList(toProductImageDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ public class Portfolio implements Serializable {
|
|||||||
@ApiModelProperty(value = "是否允许二次创作1允许0不允许")
|
@ApiModelProperty(value = "是否允许二次创作1允许0不允许")
|
||||||
private Integer openSource;
|
private Integer openSource;
|
||||||
|
|
||||||
|
private Integer original;
|
||||||
|
|
||||||
|
private Long originalAccountId;
|
||||||
|
|
||||||
|
private Long originalPortfolioId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "作品集作者ID")
|
@ApiModelProperty(value = "作品集作者ID")
|
||||||
private Long accountId;
|
private Long accountId;
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ public class UserLikeGroup implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
private Integer original;
|
||||||
|
|
||||||
|
private Long originalAccountId;
|
||||||
|
|
||||||
|
private Long originalPortfolioId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,13 +17,15 @@ import java.util.List;
|
|||||||
public interface AttributeRetrievalMapper {
|
public interface AttributeRetrievalMapper {
|
||||||
|
|
||||||
|
|
||||||
List<AttributeRetrieval> getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum);
|
List<AttributeRetrieval> getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum, @Param("style") String style);
|
||||||
|
|
||||||
AttributeRetrieval getSystemRandom(String tableName);
|
AttributeRetrieval getSystemRandom(String tableName, String style);
|
||||||
|
|
||||||
List<AttributeRetrieval> getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName);
|
List<AttributeRetrieval> getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName, String style);
|
||||||
|
|
||||||
Long getIdByFileName(String fileName, String tableName);
|
Long getIdByFileName(String fileName, String tableName);
|
||||||
|
|
||||||
void updateStyleById(Long idByFileName, String style, String tableName);
|
void updateStyleById(Long idByFileName, String style, String tableName);
|
||||||
|
|
||||||
|
void updateStyleByFileName(String style, String fileName, String tableName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ public class DesignCollectionPrintElementDTO {
|
|||||||
@ApiModelProperty("design类型 用户design生成时候区别library和collection")
|
@ApiModelProperty("design类型 用户design生成时候区别library和collection")
|
||||||
private String designType;
|
private String designType;
|
||||||
|
|
||||||
|
private String level2Type;
|
||||||
|
|
||||||
@ApiModelProperty("是否pin 1 pin 0 不pin")
|
@ApiModelProperty("是否pin 1 pin 0 不pin")
|
||||||
private Byte isPin;
|
private Byte isPin;
|
||||||
|
|
||||||
|
|||||||
@@ -71,4 +71,6 @@ public class ModelsDotDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String templateUrl;
|
private String templateUrl;
|
||||||
|
|
||||||
|
private String sex;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.ai.da.model.dto;
|
|||||||
import com.ai.da.model.vo.ToProductImageVO;
|
import com.ai.da.model.vo.ToProductImageVO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -10,4 +11,6 @@ public class ToProductImageDTO {
|
|||||||
private Long userLikeGroupId;
|
private Long userLikeGroupId;
|
||||||
private List<ToProductImageVO> toProductImageVOList;
|
private List<ToProductImageVO> toProductImageVOList;
|
||||||
private String prompt;
|
private String prompt;
|
||||||
|
private BigDecimal imageStrength;
|
||||||
|
private String direction;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,4 +22,6 @@ public class MagicToolResultVO {
|
|||||||
private String category;
|
private String category;
|
||||||
|
|
||||||
private String sourceUrl;
|
private String sourceUrl;
|
||||||
|
|
||||||
|
private String resultType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,8 @@ public class PortfolioVO extends Portfolio {
|
|||||||
private Long viewNums;
|
private Long viewNums;
|
||||||
|
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
|
private String originalUserName;
|
||||||
|
|
||||||
|
private String originalPortfolioName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,4 +33,6 @@ public class SysFileVO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String md5;
|
private String md5;
|
||||||
|
|
||||||
|
private String level3Type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.ai.da.model.vo;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.primary.entity.ToProductImageResult;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ToProductImageResultVO extends ToProductImageResult {
|
||||||
|
private String sourceUrl;
|
||||||
|
}
|
||||||
@@ -22,6 +22,12 @@ public class UserLikeGroupVO {
|
|||||||
@ApiModelProperty("创建者")
|
@ApiModelProperty("创建者")
|
||||||
private String author;
|
private String author;
|
||||||
|
|
||||||
|
private Integer original;
|
||||||
|
|
||||||
|
private Long originalAccountId;
|
||||||
|
|
||||||
|
private Long originalPortfolioId;
|
||||||
|
|
||||||
@ApiModelProperty("更新时间")
|
@ApiModelProperty("更新时间")
|
||||||
private Long updateDate;
|
private Long updateDate;
|
||||||
|
|
||||||
@@ -31,4 +37,7 @@ public class UserLikeGroupVO {
|
|||||||
@ApiModelProperty("分组对应的详情 一次行带出来")
|
@ApiModelProperty("分组对应的详情 一次行带出来")
|
||||||
private List<UserLikeVO> groupDetails;
|
private List<UserLikeVO> groupDetails;
|
||||||
|
|
||||||
|
private String originalAccountName;
|
||||||
|
private String originalPortfolioName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,4 +45,6 @@ public class ValidateElementVO {
|
|||||||
//透传sysFileVo用(attribute_retrieval 接口限定sysFile范围)
|
//透传sysFileVo用(attribute_retrieval 接口限定sysFile范围)
|
||||||
List<SysFileVO> sysFileVo;
|
List<SysFileVO> sysFileVo;
|
||||||
private String modelSex;
|
private String modelSex;
|
||||||
|
|
||||||
|
private String style;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -602,7 +602,7 @@ public class PythonService {
|
|||||||
} else if (systemScale.compareTo(BigDecimal.ONE) != 0) {
|
} else if (systemScale.compareTo(BigDecimal.ONE) != 0) {
|
||||||
BigDecimal collectNoPinSize = BigDecimal.valueOf(collectionNoPinSize);
|
BigDecimal collectNoPinSize = BigDecimal.valueOf(collectionNoPinSize);
|
||||||
poolNum = collectNoPinSize.divide(systemScale, 0, RoundingMode.DOWN).intValue();
|
poolNum = collectNoPinSize.divide(systemScale, 0, RoundingMode.DOWN).intValue();
|
||||||
List<CollectionElement> list = getSystemSketchPool(attributeRecognition, styleCategory, elementVO.getModelSex(), poolNum);
|
List<CollectionElement> list = getSystemSketchPool(attributeRecognition, styleCategory, elementVO.getModelSex(), poolNum, elementVO.getStyle());
|
||||||
collectionElements.addAll(list);
|
collectionElements.addAll(list);
|
||||||
int randomNum = RandomsUtil.randomSysFile(collectionElements.size());
|
int randomNum = RandomsUtil.randomSysFile(collectionElements.size());
|
||||||
if (randomNum < collectionNoPinSize) {
|
if (randomNum < collectionNoPinSize) {
|
||||||
@@ -612,7 +612,7 @@ public class PythonService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<CollectionElement> list = getSystemSketchPool(attributeRecognition, styleCategory, elementVO.getModelSex(), poolNum);
|
List<CollectionElement> list = getSystemSketchPool(attributeRecognition, styleCategory, elementVO.getModelSex(), poolNum, elementVO.getStyle());
|
||||||
int randomNum = RandomsUtil.randomSysFile(list.size());
|
int randomNum = RandomsUtil.randomSysFile(list.size());
|
||||||
return coverSketchToDesignPythonItem(null, list.get(randomNum), elementVO);
|
return coverSketchToDesignPythonItem(null, list.get(randomNum), elementVO);
|
||||||
}
|
}
|
||||||
@@ -622,7 +622,7 @@ public class PythonService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DesignPythonItem processAttributeRecognitionBySameCategory(JSONObject attributeRecognition, ValidateElementVO elementVO, String styleCategory) {
|
private DesignPythonItem processAttributeRecognitionBySameCategory(JSONObject attributeRecognition, ValidateElementVO elementVO, String styleCategory) {
|
||||||
List<CollectionElement> list = getSystemSketchPoolBySameCategory(attributeRecognition, styleCategory, elementVO.getModelSex());
|
List<CollectionElement> list = getSystemSketchPoolBySameCategory(attributeRecognition, styleCategory, elementVO.getModelSex(), elementVO.getStyle());
|
||||||
int randomNum = RandomsUtil.randomSysFile(list.size());
|
int randomNum = RandomsUtil.randomSysFile(list.size());
|
||||||
return coverSketchToDesignPythonItem(null, list.get(randomNum), elementVO);
|
return coverSketchToDesignPythonItem(null, list.get(randomNum), elementVO);
|
||||||
}
|
}
|
||||||
@@ -630,7 +630,7 @@ public class PythonService {
|
|||||||
@Resource
|
@Resource
|
||||||
private AttributeRetrievalMapper attributeRetrievalMapper;
|
private AttributeRetrievalMapper attributeRetrievalMapper;
|
||||||
|
|
||||||
private List<CollectionElement> getSystemSketchPool(JSONObject attributeRecognition, String styleCategory, String modelSex, int poolNum) {
|
private List<CollectionElement> getSystemSketchPool(JSONObject attributeRecognition, String styleCategory, String modelSex, int poolNum, String style) {
|
||||||
/**
|
/**
|
||||||
* female trousers->female_pants
|
* female trousers->female_pants
|
||||||
* female blouse->female_top
|
* female blouse->female_top
|
||||||
@@ -644,19 +644,19 @@ public class PythonService {
|
|||||||
AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON);
|
AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON);
|
||||||
String tableName;
|
String tableName;
|
||||||
tableName = getTableName(modelSex, styleCategory);
|
tableName = getTableName(modelSex, styleCategory);
|
||||||
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum);
|
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style);
|
||||||
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
||||||
attributeRetrievalAttrDict.setDesign(null);
|
attributeRetrievalAttrDict.setDesign(null);
|
||||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum);
|
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style);
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
||||||
attributeRetrievalAttrDict.setSilhouette(null);
|
attributeRetrievalAttrDict.setSilhouette(null);
|
||||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum);
|
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style);
|
||||||
}
|
}
|
||||||
return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex);
|
return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CollectionElement> getSystemSketchPoolBySameCategory(JSONObject attributeRecognition, String styleCategory, String modelSex) {
|
private List<CollectionElement> getSystemSketchPoolBySameCategory(JSONObject attributeRecognition, String styleCategory, String modelSex, String style) {
|
||||||
/**
|
/**
|
||||||
* female trousers->female_pants
|
* female trousers->female_pants
|
||||||
* female blouse->female_top
|
* female blouse->female_top
|
||||||
@@ -712,7 +712,7 @@ public class PythonService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName);
|
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style);
|
||||||
if (CollectionUtil.isEmpty(attributeRetrievalList)) {
|
if (CollectionUtil.isEmpty(attributeRetrievalList)) {
|
||||||
System.out.println(attributeRetrievalAttrDict);
|
System.out.println(attributeRetrievalAttrDict);
|
||||||
System.out.println(tableName);
|
System.out.println(tableName);
|
||||||
@@ -935,7 +935,7 @@ public class PythonService {
|
|||||||
Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
|
Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
|
||||||
String category = dressings.get(randomNum).getStyleCategory();
|
String category = dressings.get(randomNum).getStyleCategory();
|
||||||
String tableName = getTableName(validateElementVO.getModelSex(), category);
|
String tableName = getTableName(validateElementVO.getModelSex(), category);
|
||||||
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName);
|
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle());
|
||||||
CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
||||||
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
||||||
}
|
}
|
||||||
@@ -975,7 +975,7 @@ public class PythonService {
|
|||||||
Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
|
Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
|
||||||
String category = dressings.get(randomNum).getStyleCategory();
|
String category = dressings.get(randomNum).getStyleCategory();
|
||||||
String tableName = getTableName(validateElementVO.getModelSex(), category);
|
String tableName = getTableName(validateElementVO.getModelSex(), category);
|
||||||
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName);
|
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle());
|
||||||
CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
||||||
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
||||||
}
|
}
|
||||||
@@ -2800,24 +2800,28 @@ public class PythonService {
|
|||||||
|
|
||||||
private List<DesignPythonItem> coverToModelsDotPythonItem(ModelsDotDTO modelsDotDTO) {
|
private List<DesignPythonItem> coverToModelsDotPythonItem(ModelsDotDTO modelsDotDTO) {
|
||||||
List<DesignPythonItem> response = Lists.newArrayList();
|
List<DesignPythonItem> response = Lists.newArrayList();
|
||||||
if (modelsDotDTO.getTemplateUrl().contains("female")) {
|
if (modelsDotDTO.getSex().contains("Female")) {
|
||||||
DesignPythonItem dress = new DesignPythonItem();
|
DesignPythonItem dress = new DesignPythonItem();
|
||||||
dress.setType(SysFileLevel2TypeEnum.DRESS.getRealName());
|
dress.setType(SysFileLevel2TypeEnum.BLOUSE.getRealName());
|
||||||
dress.setColor("none");
|
dress.setColor("none");
|
||||||
dress.setIcon("none");
|
dress.setIcon("none");
|
||||||
DesignPythonItemPrint designPythonItemPrint = new DesignPythonItemPrint();
|
DesignPythonItemPrint designPythonItemPrint = new DesignPythonItemPrint();
|
||||||
designPythonItemPrint.setIfSingle(false);
|
designPythonItemPrint.setIfSingle(false);
|
||||||
designPythonItemPrint.setPrint_path_list(new ArrayList<>());
|
designPythonItemPrint.setPrint_path_list(new ArrayList<>());
|
||||||
dress.setPrint(designPythonItemPrint);
|
dress.setPrint(designPythonItemPrint);
|
||||||
dress.setPath("aida-sys-image/images/female/blouse/blouse_p5_817.jpg");
|
dress.setPath("aida-sys-image/images/female/blouse/0628001551.jpg");
|
||||||
response.add(dress);
|
response.add(dress);
|
||||||
|
|
||||||
DesignPythonItem skirt = new DesignPythonItem();
|
DesignPythonItem skirt = new DesignPythonItem();
|
||||||
skirt.setType(SysFileLevel2TypeEnum.TROUSERS.getRealName());
|
skirt.setType(SysFileLevel2TypeEnum.SKIRT.getRealName());
|
||||||
skirt.setColor("none");
|
skirt.setColor("none");
|
||||||
skirt.setIcon("none");
|
skirt.setIcon("none");
|
||||||
skirt.setPrint(designPythonItemPrint);
|
DesignPythonItemPrint designPythonItemPrint1 = new DesignPythonItemPrint();
|
||||||
skirt.setPath("aida-sys-image/images/female/trousers/trousers_974.jpg");
|
designPythonItemPrint1.setIfSingle(false);
|
||||||
|
designPythonItemPrint1.setPrint_path_list(new ArrayList<>());
|
||||||
|
skirt.setPrint(designPythonItemPrint1);
|
||||||
|
skirt.setPath("aida-sys-image/images/female/skirt/0628000022.jpg");
|
||||||
|
// skirt.setPath("aida-sys-image/images/female/dress/0628000000.jpg");
|
||||||
response.add(skirt);
|
response.add(skirt);
|
||||||
} else {
|
} else {
|
||||||
DesignPythonItem top = new DesignPythonItem();
|
DesignPythonItem top = new DesignPythonItem();
|
||||||
@@ -2839,7 +2843,7 @@ public class PythonService {
|
|||||||
designPythonItemPrint1.setIfSingle(false);
|
designPythonItemPrint1.setIfSingle(false);
|
||||||
designPythonItemPrint1.setPrint_path_list(new ArrayList<>());
|
designPythonItemPrint1.setPrint_path_list(new ArrayList<>());
|
||||||
bottom.setPrint(designPythonItemPrint1);
|
bottom.setPrint(designPythonItemPrint1);
|
||||||
bottom.setPath("aida-sys-image/images/male/bottoms/mens_test_10007.png");
|
bottom.setPath("aida-sys-image/images/male/bottoms/mens_test_6252.png");
|
||||||
response.add(bottom);
|
response.add(bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3307,7 +3311,7 @@ public class PythonService {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean toProductImage(String url, String taskId, String prompt) {
|
public Boolean toProductImage(String url, String taskId, String prompt, BigDecimal imageStrength) {
|
||||||
// todo 限流校验
|
// todo 限流校验
|
||||||
// AccessLimitUtils.validate("design",5);
|
// AccessLimitUtils.validate("design",5);
|
||||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||||
@@ -3318,12 +3322,14 @@ public class PythonService {
|
|||||||
.build();
|
.build();
|
||||||
MediaType mediaType = MediaType.parse("application/json");
|
MediaType mediaType = MediaType.parse("application/json");
|
||||||
//关闭FastJson的引用检测 防止出现$ref 现象
|
//关闭FastJson的引用检测 防止出现$ref 现象
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("tasks_id", taskId);
|
map.put("tasks_id", taskId);
|
||||||
map.put("image_url", url);
|
map.put("image_url", url);
|
||||||
map.put("prompt", prompt);
|
map.put("prompt", prompt);
|
||||||
|
map.put("image_strength", imageStrength);
|
||||||
log.info("toProductImage请求python 参数:####{}", map);
|
log.info("toProductImage请求python 参数:####{}", map);
|
||||||
String param = JSON.toJSONString(map, SerializerFeature.WriteNullStringAsEmpty);
|
String param = JSON.toJSONString(map, SerializerFeature.WriteNullStringAsEmpty);
|
||||||
|
System.out.println(param);
|
||||||
RequestBody body = RequestBody.create(mediaType, param);
|
RequestBody body = RequestBody.create(mediaType, param);
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
// .url(accessPythonIp + ":" + accessPythonPort + "/api/generate_product_image")
|
// .url(accessPythonIp + ":" + accessPythonPort + "/api/generate_product_image")
|
||||||
@@ -3348,4 +3354,48 @@ public class PythonService {
|
|||||||
//生成失败
|
//生成失败
|
||||||
throw new BusinessException("toProductImage.interface.exception");
|
throw new BusinessException("toProductImage.interface.exception");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean relight(String url, String taskId, String prompt, String direction) {
|
||||||
|
// todo 限流校验
|
||||||
|
// AccessLimitUtils.validate("design",5);
|
||||||
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||||
|
.connectTimeout(30, TimeUnit.SECONDS)
|
||||||
|
.pingInterval(5, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒)
|
||||||
|
.readTimeout(60, TimeUnit.SECONDS)//读取超时(单位:秒)
|
||||||
|
.writeTimeout(60, TimeUnit.SECONDS)//写入超时(单位:秒)
|
||||||
|
.build();
|
||||||
|
MediaType mediaType = MediaType.parse("application/json");
|
||||||
|
//关闭FastJson的引用检测 防止出现$ref 现象
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("tasks_id", taskId);
|
||||||
|
map.put("image_url", url);
|
||||||
|
map.put("prompt", prompt);
|
||||||
|
map.put("direction", direction);
|
||||||
|
log.info("relightImage请求python 参数:####{}", map);
|
||||||
|
String param = JSON.toJSONString(map, SerializerFeature.WriteNullStringAsEmpty);
|
||||||
|
log.info(param);
|
||||||
|
RequestBody body = RequestBody.create(mediaType, param);
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
// .url(accessPythonIp + ":" + accessPythonPort + "/api/generate_product_image")
|
||||||
|
// .url(accessPythonIp + ":9996/api/generate_product_image")
|
||||||
|
.url(accessPythonIp + ":9996/api/generate_relight_image")
|
||||||
|
.method("POST", body)
|
||||||
|
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||||
|
.addHeader("Content-Type", "application/json")
|
||||||
|
.build();
|
||||||
|
Response response;
|
||||||
|
String responseBody;
|
||||||
|
try {
|
||||||
|
response = client.newCall(request).execute();
|
||||||
|
} catch (IOException ioException) {
|
||||||
|
log.error("PythonService##relightImage异常###{}", ExceptionUtil.getThrowableList(ioException));
|
||||||
|
throw new BusinessException("relightImage.interface.exception");
|
||||||
|
}
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
log.error("PythonService##relightImage异常response###{}", response);
|
||||||
|
//生成失败
|
||||||
|
throw new BusinessException("relightImage.interface.exception");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,4 +37,6 @@ public interface PortfolioService extends IService<Portfolio> {
|
|||||||
Long viewsGet(Long id);
|
Long viewsGet(Long id);
|
||||||
|
|
||||||
Boolean commentDelete(CommentDTO commentDTO);
|
Boolean commentDelete(CommentDTO commentDTO);
|
||||||
|
|
||||||
|
Boolean delete(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
|||||||
|
|
||||||
CanvasElementUpload canvasElementUpload(MultipartFile file);
|
CanvasElementUpload canvasElementUpload(MultipartFile file);
|
||||||
|
|
||||||
List<ToProductImageResult> productImageLikeList(ToProductImageDTO toProductImageDTO);
|
List<ToProductImageResultVO> productImageLikeList(ToProductImageDTO toProductImageDTO);
|
||||||
|
|
||||||
Boolean productImageUnLike(ProductImageLikeDTO productImageLikeDTO);
|
Boolean productImageUnLike(ProductImageLikeDTO productImageLikeDTO);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.ai.da.mapper.primary.entity.*;
|
|||||||
import com.ai.da.model.dto.*;
|
import com.ai.da.model.dto.*;
|
||||||
import com.ai.da.model.enums.ModelType;
|
import com.ai.da.model.enums.ModelType;
|
||||||
import com.ai.da.model.enums.Sex;
|
import com.ai.da.model.enums.Sex;
|
||||||
|
import com.ai.da.model.enums.StyleEnum;
|
||||||
import com.ai.da.model.vo.*;
|
import com.ai.da.model.vo.*;
|
||||||
import com.ai.da.python.PythonService;
|
import com.ai.da.python.PythonService;
|
||||||
import com.ai.da.python.vo.DesignPythonItem;
|
import com.ai.da.python.vo.DesignPythonItem;
|
||||||
@@ -578,6 +579,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, byId.getHigh(), byId.getWidth(), byId.getUrl()));
|
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, byId.getHigh(), byId.getWidth(), byId.getUrl()));
|
||||||
} else if (designDTO.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
} else if (designDTO.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
||||||
SysFileVO byId = sysFileService.getById(designDTO.getTemplateId());
|
SysFileVO byId = sysFileService.getById(designDTO.getTemplateId());
|
||||||
|
if (!StringUtils.isEmpty(byId.getLevel3Type()) && byId.getLevel2Type().equals("Female")) {
|
||||||
|
elementVO.setStyle(byId.getLevel3Type());
|
||||||
|
}
|
||||||
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), designDTO.getModelType());
|
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), designDTO.getModelType());
|
||||||
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, 700, 320, byId.getUrl()));
|
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, 700, 320, byId.getUrl()));
|
||||||
}
|
}
|
||||||
@@ -664,6 +668,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
Generate byId = generateService.getById(o.getGenerateId());
|
Generate byId = generateService.getById(o.getGenerateId());
|
||||||
d.setAccountId(byId.getAccountId());
|
d.setAccountId(byId.getAccountId());
|
||||||
d.setLevel1Type(byId.getLevel1Type());
|
d.setLevel1Type(byId.getLevel1Type());
|
||||||
|
if (!StringUtils.isEmpty(byId.getLevel2Type())) {
|
||||||
|
d.setLevel2Type(byId.getLevel2Type());
|
||||||
|
}
|
||||||
d.setCreateDate(Date.from(o.getCreateDate().atZone(ZoneId.systemDefault()).toInstant()));
|
d.setCreateDate(Date.from(o.getCreateDate().atZone(ZoneId.systemDefault()).toInstant()));
|
||||||
if (null != idToMap) {
|
if (null != idToMap) {
|
||||||
DesignCollectionPrintElementDTO printDTO = idToMap.get(o.getId());
|
DesignCollectionPrintElementDTO printDTO = idToMap.get(o.getId());
|
||||||
|
|||||||
@@ -997,7 +997,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
response.setClothes(CopyUtil.copyList(filterDetail, DesignItemClothesDetailVO.class, (o, d) -> {
|
response.setClothes(CopyUtil.copyList(filterDetail, DesignItemClothesDetailVO.class, (o, d) -> {
|
||||||
d.setId(o.getId());
|
d.setId(o.getId());
|
||||||
d.setPath(minioUtil.getPreSignedUrl(o.getPath(), 24 * 60));
|
d.setPath(minioUtil.getPreSignedUrl(o.getPath(), 24 * 60, true));
|
||||||
d.setMinIOPath(o.getPath());
|
d.setMinIOPath(o.getPath());
|
||||||
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
||||||
d.setGradient(JSONObject.parseObject(o.getGradientString(), Gradient.class));
|
d.setGradient(JSONObject.parseObject(o.getGradientString(), Gradient.class));
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
|||||||
path = "models/" + libraryUploadDTO.getModelSex().toLowerCase();
|
path = "models/" + libraryUploadDTO.getModelSex().toLowerCase();
|
||||||
String filePath = minioUtil.upload(bucketName, path, libraryUploadDTO.getFile());
|
String filePath = minioUtil.upload(bucketName, path, libraryUploadDTO.getFile());
|
||||||
String newFilePath = processMannequins(filePath);
|
String newFilePath = processMannequins(filePath);
|
||||||
|
// String newFilePath = filePath;
|
||||||
Library library = resolveData(libraryUploadDTO, userInfo, newFilePath);
|
Library library = resolveData(libraryUploadDTO, userInfo, newFilePath);
|
||||||
LibraryUpdateVo libraryUpdateVo = CopyUtil.copyObject(library, LibraryUpdateVo.class);
|
LibraryUpdateVo libraryUpdateVo = CopyUtil.copyObject(library, LibraryUpdateVo.class);
|
||||||
libraryUpdateVo.setMinIOPath(libraryUpdateVo.getUrl());
|
libraryUpdateVo.setMinIOPath(libraryUpdateVo.getUrl());
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import sun.security.krb5.internal.crypto.Des;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -94,10 +95,33 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
@Resource
|
@Resource
|
||||||
private AccountMapper accountMapper;
|
private AccountMapper accountMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WorkspaceMapper workspaceMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysFileMapper sysFileMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private LibraryMapper libraryMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StyleMapper styleMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WorkspaceRelStyleMapper workspaceRelStyleMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean publish(MultipartFile file, String data) {
|
public Boolean publish(MultipartFile file, String data) {
|
||||||
PortfolioDTO portfolioDTO = JSONObject.parseObject(data, PortfolioDTO.class);
|
|
||||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||||
|
PortfolioDTO portfolioDTO = JSONObject.parseObject(data, PortfolioDTO.class);
|
||||||
|
QueryWrapper<Portfolio> existSameNameQw = new QueryWrapper<>();
|
||||||
|
existSameNameQw.lambda().eq(Portfolio::getPortfolioName, portfolioDTO.getPortfolioName());
|
||||||
|
existSameNameQw.lambda().eq(Portfolio::getAccountId, authPrincipalVo.getId());
|
||||||
|
List<Portfolio> portfoliosSameName = portfolioMapper.selectList(existSameNameQw);
|
||||||
|
if (!CollectionUtils.isEmpty(portfoliosSameName)) {
|
||||||
|
throw new BusinessException("The title of the published work has been used.");
|
||||||
|
}
|
||||||
if (file != null && file.getOriginalFilename() != null) {
|
if (file != null && file.getOriginalFilename() != null) {
|
||||||
String upload = minioUtil.upload("aida-canvas", String.valueOf(authPrincipalVo.getId()), file);
|
String upload = minioUtil.upload("aida-canvas", String.valueOf(authPrincipalVo.getId()), file);
|
||||||
Canvas canvas = new Canvas();
|
Canvas canvas = new Canvas();
|
||||||
@@ -108,14 +132,21 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
|
|
||||||
if (portfolioDTO.getOpenSource() == 1) {
|
if (portfolioDTO.getOpenSource() == 1) {
|
||||||
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId());
|
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId());
|
||||||
UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null);
|
UserLikeGroup userLikeGroupNew = CopyUtil.copyObject(userLikeGroup, UserLikeGroup.class);
|
||||||
|
userLikeGroupNew.setId(null);
|
||||||
userLikeGroupNew.setAccountId(-1L);
|
userLikeGroupNew.setAccountId(-1L);
|
||||||
Long collectionIdOld = userLikeGroup.getCollectionId();
|
Long collectionIdOld = userLikeGroup.getCollectionId();
|
||||||
|
QueryWrapper<Design> designQueryWrapper = new QueryWrapper<>();
|
||||||
|
designQueryWrapper.lambda().eq(Design::getCollectionId, collectionIdOld);
|
||||||
|
Design designOld = designMapper.selectOne(designQueryWrapper);
|
||||||
Collection collectionOld = collectionMapper.selectById(collectionIdOld);
|
Collection collectionOld = collectionMapper.selectById(collectionIdOld);
|
||||||
List<CollectionElement> collectionElementListOld = collectionElementService.getByCollectionId(collectionIdOld);
|
List<CollectionElement> collectionElementListOld = collectionElementService.getByCollectionId(collectionIdOld);
|
||||||
collectionOld.setId(null);
|
collectionOld.setId(null);
|
||||||
collectionMapper.insert(collectionOld);
|
collectionMapper.insert(collectionOld);
|
||||||
Long collectionIdNew = collectionOld.getId();
|
Long collectionIdNew = collectionOld.getId();
|
||||||
|
designOld.setCollectionId(collectionIdNew);
|
||||||
|
designOld.setId(null);
|
||||||
|
designMapper.insert(designOld);
|
||||||
userLikeGroupNew.setCollectionId(collectionIdNew);
|
userLikeGroupNew.setCollectionId(collectionIdNew);
|
||||||
userLikeGroupMapper.insert(userLikeGroupNew);
|
userLikeGroupMapper.insert(userLikeGroupNew);
|
||||||
for (CollectionElement element : collectionElementListOld) {
|
for (CollectionElement element : collectionElementListOld) {
|
||||||
@@ -135,6 +166,14 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
if (!CollectionUtils.isEmpty(portfolios)) {
|
if (!CollectionUtils.isEmpty(portfolios)) {
|
||||||
portfolio = portfolios.get(0);
|
portfolio = portfolios.get(0);
|
||||||
}
|
}
|
||||||
|
if (userLikeGroup.getOriginal() == 0) {
|
||||||
|
portfolio.setOriginal(0);
|
||||||
|
portfolio.setOriginalAccountId(userLikeGroup.getOriginalAccountId());
|
||||||
|
portfolio.setOriginalPortfolioId(userLikeGroup.getOriginalPortfolioId());
|
||||||
|
}else {
|
||||||
|
portfolio.setOriginal(1);
|
||||||
|
// portfolio.setOriginalAccountId(authPrincipalVo.getId());
|
||||||
|
}
|
||||||
portfolio.setPortfolioName(portfolioDTO.getPortfolioName());
|
portfolio.setPortfolioName(portfolioDTO.getPortfolioName());
|
||||||
portfolio.setPortfolioType("History");
|
portfolio.setPortfolioType("History");
|
||||||
portfolio.setCollectionId(collectionIdNew);
|
portfolio.setCollectionId(collectionIdNew);
|
||||||
@@ -154,17 +193,12 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<UserLike> userLikeList = userLikeService.getUserLikeList(portfolioDTO.getUserLikeGroupId());
|
List<UserLike> userLikeList = userLikeService.getUserLikeList(portfolioDTO.getUserLikeGroupId());
|
||||||
// Long coverIdNew = null;
|
|
||||||
// Boolean flag = false;
|
|
||||||
for (UserLike userLike : userLikeList) {
|
for (UserLike userLike : userLikeList) {
|
||||||
Long designOutfitIdOld = userLike.getDesignOutfitId();
|
Long designOutfitIdOld = userLike.getDesignOutfitId();
|
||||||
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(designOutfitIdOld);
|
TDesignPythonOutfit designPythonOutfit = designPythonOutfitMapper.selectById(designOutfitIdOld);
|
||||||
designPythonOutfit.setDesignId(-1L);
|
designPythonOutfit.setDesignId(-1L);
|
||||||
designPythonOutfit.setDesignItemId(-1L);
|
designPythonOutfit.setDesignItemId(-1L);
|
||||||
designPythonOutfit.setCollectionId(collectionIdNew);
|
designPythonOutfit.setCollectionId(collectionIdNew);
|
||||||
// if (designPythonOutfit.getId().equals(coverIdOld)) {
|
|
||||||
// flag = true;
|
|
||||||
// }
|
|
||||||
designPythonOutfit.setId(null);
|
designPythonOutfit.setId(null);
|
||||||
Long designItemIdOld = userLike.getDesignItemId();
|
Long designItemIdOld = userLike.getDesignItemId();
|
||||||
DesignItem designItemOld = designItemMapper.selectById(designItemIdOld);
|
DesignItem designItemOld = designItemMapper.selectById(designItemIdOld);
|
||||||
@@ -183,21 +217,12 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
qw.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, designOutfitIdOld);
|
qw.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, designOutfitIdOld);
|
||||||
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(qw);
|
List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(qw);
|
||||||
for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
||||||
// Long designPythonOutfitDetailIdOld = tDesignPythonOutfitDetail.getId();
|
|
||||||
tDesignPythonOutfitDetail.setId(null);
|
tDesignPythonOutfitDetail.setId(null);
|
||||||
tDesignPythonOutfitDetail.setDesignId(-1L);
|
tDesignPythonOutfitDetail.setDesignId(-1L);
|
||||||
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
|
tDesignPythonOutfitDetail.setDesignPythonOutfitId(designOutfitIdNew);
|
||||||
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
|
designPythonOutfitDetailMapper.insert(tDesignPythonOutfitDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (flag) {
|
|
||||||
// coverIdNew = designOutfitIdNew;
|
|
||||||
// portfolio.setCoverId(coverIdNew);
|
|
||||||
// portfolioMapper.updateById(portfolio);
|
|
||||||
// flag = false;
|
|
||||||
// }
|
|
||||||
// designPythonOutfitMapper.updateById(designPythonOutfit);
|
|
||||||
|
|
||||||
userLike.setDesignItemId(designItemIdNew);
|
userLike.setDesignItemId(designItemIdNew);
|
||||||
userLike.setId(null);
|
userLike.setId(null);
|
||||||
userLike.setDesignId(-1L);
|
userLike.setDesignId(-1L);
|
||||||
@@ -232,6 +257,15 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
if (!CollectionUtils.isEmpty(portfolios)) {
|
if (!CollectionUtils.isEmpty(portfolios)) {
|
||||||
portfolio = portfolios.get(0);
|
portfolio = portfolios.get(0);
|
||||||
}
|
}
|
||||||
|
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId());
|
||||||
|
if (userLikeGroup.getOriginal() == 0) {
|
||||||
|
portfolio.setOriginal(0);
|
||||||
|
portfolio.setOriginalAccountId(userLikeGroup.getOriginalAccountId());
|
||||||
|
portfolio.setOriginalPortfolioId(userLikeGroup.getOriginalPortfolioId());
|
||||||
|
}else {
|
||||||
|
portfolio.setOriginal(1);
|
||||||
|
// portfolio.setOriginalAccountId(authPrincipalVo.getId());
|
||||||
|
}
|
||||||
portfolio.setPortfolioName(portfolioDTO.getPortfolioName());
|
portfolio.setPortfolioName(portfolioDTO.getPortfolioName());
|
||||||
portfolio.setPortfolioType("Canvas");
|
portfolio.setPortfolioType("Canvas");
|
||||||
portfolio.setAccountId(authPrincipalVo.getId());
|
portfolio.setAccountId(authPrincipalVo.getId());
|
||||||
@@ -256,9 +290,18 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public PortfolioVO update(PortfolioDTO portfolioDTO) {
|
public PortfolioVO update(PortfolioDTO portfolioDTO) {
|
||||||
|
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||||
|
QueryWrapper<Portfolio> existSameNameQw = new QueryWrapper<>();
|
||||||
|
existSameNameQw.lambda().ne(Portfolio::getId, portfolioDTO.getId());
|
||||||
|
existSameNameQw.lambda().eq(Portfolio::getPortfolioName, portfolioDTO.getPortfolioName());
|
||||||
|
existSameNameQw.lambda().eq(Portfolio::getAccountId, authPrincipalVo.getId());
|
||||||
|
List<Portfolio> portfoliosSameName = portfolioMapper.selectList(existSameNameQw);
|
||||||
|
if (!CollectionUtils.isEmpty(portfoliosSameName)) {
|
||||||
|
throw new BusinessException("The title of the published work has been used.");
|
||||||
|
}
|
||||||
if (portfolioDTO.getPortfolioType().equals("History")) {
|
if (portfolioDTO.getPortfolioType().equals("History")) {
|
||||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
|
||||||
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId());
|
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(portfolioDTO.getUserLikeGroupId());
|
||||||
UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null);
|
UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null);
|
||||||
userLikeGroupNew.setAccountId(-1L);
|
userLikeGroupNew.setAccountId(-1L);
|
||||||
@@ -396,6 +439,11 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
vo.setCanvasUrl(minioUtil.getPreSignedUrl(canvas.getUrl(), 24 * 60));
|
vo.setCanvasUrl(minioUtil.getPreSignedUrl(canvas.getUrl(), 24 * 60));
|
||||||
vo.setLikeNum(redisUtil.getLikeCount(vo.getId()));
|
vo.setLikeNum(redisUtil.getLikeCount(vo.getId()));
|
||||||
vo.setViewNums(redisUtil.getViewCount(vo.getId()));
|
vo.setViewNums(redisUtil.getViewCount(vo.getId()));
|
||||||
|
Long accountId = vo.getAccountId();
|
||||||
|
vo.setUserName(accountMapper.selectById(accountId).getUserName());
|
||||||
|
if (vo.getOriginal() == 0) {
|
||||||
|
vo.setOriginalUserName(accountMapper.selectById(vo.getOriginalAccountId()).getUserName());
|
||||||
|
}
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -429,15 +477,23 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
Canvas canvas = canvasMapper.selectById(vo.getCanvasId());
|
Canvas canvas = canvasMapper.selectById(vo.getCanvasId());
|
||||||
vo.setCanvasUrl(minioUtil.getPreSignedUrl(canvas.getUrl(), 24 * 60));
|
vo.setCanvasUrl(minioUtil.getPreSignedUrl(canvas.getUrl(), 24 * 60));
|
||||||
vo.setLikeNum(redisUtil.getLikeCount(vo.getId()));
|
vo.setLikeNum(redisUtil.getLikeCount(vo.getId()));
|
||||||
boolean postLikedByUser = redisUtil.isPostLikedByUser(portfolioDTO.getId(), userHolder.getId());
|
if (userHolder == null) {
|
||||||
if (postLikedByUser) {
|
|
||||||
vo.setIsLike(1);
|
|
||||||
}else {
|
|
||||||
vo.setIsLike(0);
|
vo.setIsLike(0);
|
||||||
|
}else {
|
||||||
|
boolean postLikedByUser = redisUtil.isPostLikedByUser(portfolioDTO.getId(), userHolder.getId());
|
||||||
|
if (postLikedByUser) {
|
||||||
|
vo.setIsLike(1);
|
||||||
|
}else {
|
||||||
|
vo.setIsLike(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
redisUtil.increaseViewCount(portfolioDTO.getId());
|
redisUtil.increaseViewCount(portfolioDTO.getId());
|
||||||
vo.setViewNums(redisUtil.getViewCount(portfolioDTO.getId()));
|
vo.setViewNums(redisUtil.getViewCount(portfolioDTO.getId()));
|
||||||
vo.setUserName(accountMapper.selectById(vo.getAccountId()).getUserName());
|
vo.setUserName(accountMapper.selectById(vo.getAccountId()).getUserName());
|
||||||
|
if (vo.getOriginal() == 0) {
|
||||||
|
vo.setOriginalUserName(accountMapper.selectById(vo.getOriginalAccountId()).getUserName());
|
||||||
|
vo.setOriginalPortfolioName(portfolioMapper.selectById(vo.getOriginalPortfolioId()).getPortfolioName());
|
||||||
|
}
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,8 +509,22 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
if (Objects.isNull(userLikeGroup)) {
|
if (Objects.isNull(userLikeGroup)) {
|
||||||
throw new BusinessException("");
|
throw new BusinessException("");
|
||||||
}
|
}
|
||||||
// UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById();
|
UserLikeGroup userLikeGroupNew = CopyUtil.copyObject(userLikeGroup, UserLikeGroup.class);
|
||||||
UserLikeGroup userLikeGroupNew = userLikeGroup.setId(null);
|
userLikeGroupNew.setId(null);
|
||||||
|
userLikeGroupNew.setCreateDate(new Date());
|
||||||
|
if (portfolio.getOriginal() == 1) {
|
||||||
|
if (Objects.equals(portfolio.getAccountId(), authPrincipalVo.getId())) {
|
||||||
|
userLikeGroupNew.setOriginal(1);
|
||||||
|
}else {
|
||||||
|
userLikeGroupNew.setOriginal(0);
|
||||||
|
userLikeGroupNew.setOriginalAccountId(portfolio.getAccountId());
|
||||||
|
userLikeGroupNew.setOriginalPortfolioId(portfolio.getId());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
userLikeGroupNew.setOriginal(0);
|
||||||
|
userLikeGroupNew.setOriginalAccountId(portfolio.getOriginalAccountId());
|
||||||
|
userLikeGroupNew.setOriginalPortfolioId(portfolio.getId());
|
||||||
|
}
|
||||||
userLikeGroupNew.setAccountId(authPrincipalVo.getId());
|
userLikeGroupNew.setAccountId(authPrincipalVo.getId());
|
||||||
Long collectionIdOld = userLikeGroup.getCollectionId();
|
Long collectionIdOld = userLikeGroup.getCollectionId();
|
||||||
Collection collectionOld = collectionMapper.selectById(collectionIdOld);
|
Collection collectionOld = collectionMapper.selectById(collectionIdOld);
|
||||||
@@ -486,6 +556,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
designMapper.insert(design);
|
designMapper.insert(design);
|
||||||
|
|
||||||
userLikeGroupNew.setCollectionId(collectionIdNew);
|
userLikeGroupNew.setCollectionId(collectionIdNew);
|
||||||
|
userLikeGroupNew.setUpdateDate(new Date());
|
||||||
userLikeGroupMapper.insert(userLikeGroupNew);
|
userLikeGroupMapper.insert(userLikeGroupNew);
|
||||||
// List<TCollectionElementRelation> collectionElementRelationListNew = new ArrayList<>();
|
// List<TCollectionElementRelation> collectionElementRelationListNew = new ArrayList<>();
|
||||||
for (CollectionElement element : collectionElementListOld) {
|
for (CollectionElement element : collectionElementListOld) {
|
||||||
@@ -563,6 +634,117 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Long collectionId = portfolio.getCollectionId();
|
||||||
|
QueryWrapper<Design> getWorkspaceQw = new QueryWrapper<>();
|
||||||
|
getWorkspaceQw.lambda().eq(Design::getCollectionId, collectionId);
|
||||||
|
List<Design> designs = designMapper.selectList(getWorkspaceQw);
|
||||||
|
if (!CollectionUtils.isEmpty(designs)) {
|
||||||
|
Design design1 = designs.get(0);
|
||||||
|
Long accountId = authPrincipalVo.getId();
|
||||||
|
QueryWrapper<Workspace> currentWorkspaceQw = new QueryWrapper<>();
|
||||||
|
currentWorkspaceQw.lambda().eq(Workspace::getAccountId, accountId);
|
||||||
|
currentWorkspaceQw.lambda().eq(Workspace::getIsLastIndex, 1);
|
||||||
|
List<Workspace> workspaces = workspaceMapper.selectList(currentWorkspaceQw);
|
||||||
|
if (!CollectionUtils.isEmpty(workspaces)) {
|
||||||
|
Workspace workspace1 = workspaces.get(0);
|
||||||
|
workspace1.setIsLastIndex(0);
|
||||||
|
workspaceMapper.updateById(workspace1);
|
||||||
|
Workspace workspaceNew = new Workspace();
|
||||||
|
workspaceNew.setWorkSpaceName("workspace of " + portfolio.getPortfolioName());
|
||||||
|
workspaceNew.setAccountId(accountId);
|
||||||
|
workspaceNew.setIsDeleted(0);
|
||||||
|
workspaceNew.setIsLastIndex(1);
|
||||||
|
workspaceNew.setCreateTime(LocalDateTime.now());
|
||||||
|
workspaceNew.setSystemDesignerPercentage((design1.getSystemScale().multiply(BigDecimal.valueOf(100)).intValue()));
|
||||||
|
if (design1.getSingleOverall().equals("overall")) {
|
||||||
|
workspaceNew.setPosition("Overall");
|
||||||
|
}else {
|
||||||
|
workspaceNew.setPosition(design1.getSwitchCategory());
|
||||||
|
}
|
||||||
|
workspaceMapper.insert(workspaceNew);
|
||||||
|
if (design1.getModelType().equals("System")) {
|
||||||
|
SysFile sysFile = sysFileMapper.selectById(design1.getTemplateId());
|
||||||
|
if (sysFile.getLevel2Type().equals("Female")) {
|
||||||
|
workspaceNew.setSex("Female");
|
||||||
|
workspaceNew.setMannequinFemaleId(design1.getTemplateId());
|
||||||
|
workspaceNew.setMannequinFemaleType("System");
|
||||||
|
QueryWrapper<SysFile> getAnotherOneQw = new QueryWrapper<>();
|
||||||
|
getAnotherOneQw.lambda().eq(SysFile::getLevel1Type, "Models");
|
||||||
|
getAnotherOneQw.lambda().eq(SysFile::getLevel2Type, "Male");
|
||||||
|
if (!StringUtils.isEmpty(sysFile.getLevel3Type())) {
|
||||||
|
getAnotherOneQw.lambda().eq(SysFile::getLevel3Type, sysFile.getLevel3Type());
|
||||||
|
QueryWrapper<Style> styleQueryWrapper = new QueryWrapper<>();
|
||||||
|
styleQueryWrapper.lambda().eq(Style::getName, sysFile.getLevel3Type());
|
||||||
|
Style style = styleMapper.selectOne(styleQueryWrapper);
|
||||||
|
WorkspaceRelStyle workspaceRelStyle = new WorkspaceRelStyle();
|
||||||
|
workspaceRelStyle.setStyleId(style.getId());
|
||||||
|
workspaceRelStyle.setWorkspaceId(workspaceNew.getId());
|
||||||
|
workspaceRelStyleMapper.insert(workspaceRelStyle);
|
||||||
|
}
|
||||||
|
List<SysFile> anotherList = sysFileMapper.selectList(getAnotherOneQw);
|
||||||
|
if (!CollectionUtils.isEmpty(anotherList)) {
|
||||||
|
SysFile anotherOne = anotherList.get(0);
|
||||||
|
workspaceNew.setMannequinMaleId(anotherOne.getId());
|
||||||
|
workspaceNew.setMannequinMaleType("System");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
workspaceNew.setSex("Male");
|
||||||
|
workspaceNew.setMannequinMaleId(design1.getTemplateId());
|
||||||
|
workspaceNew.setMannequinMaleType("System");
|
||||||
|
QueryWrapper<SysFile> getAnotherOneQw = new QueryWrapper<>();
|
||||||
|
getAnotherOneQw.lambda().eq(SysFile::getLevel1Type, "Models");
|
||||||
|
getAnotherOneQw.lambda().eq(SysFile::getLevel2Type, "Female");
|
||||||
|
if (!StringUtils.isEmpty(sysFile.getLevel3Type())) {
|
||||||
|
getAnotherOneQw.lambda().eq(SysFile::getLevel3Type, sysFile.getLevel3Type());
|
||||||
|
QueryWrapper<Style> styleQueryWrapper = new QueryWrapper<>();
|
||||||
|
styleQueryWrapper.lambda().eq(Style::getName, sysFile.getLevel3Type());
|
||||||
|
Style style = styleMapper.selectOne(styleQueryWrapper);
|
||||||
|
WorkspaceRelStyle workspaceRelStyle = new WorkspaceRelStyle();
|
||||||
|
workspaceRelStyle.setStyleId(style.getId());
|
||||||
|
workspaceRelStyle.setWorkspaceId(workspaceNew.getId());
|
||||||
|
workspaceRelStyleMapper.insert(workspaceRelStyle);
|
||||||
|
}
|
||||||
|
List<SysFile> anotherList = sysFileMapper.selectList(getAnotherOneQw);
|
||||||
|
if (!CollectionUtils.isEmpty(anotherList)) {
|
||||||
|
SysFile anotherOne = anotherList.get(0);
|
||||||
|
workspaceNew.setMannequinFemaleId(anotherOne.getId());
|
||||||
|
workspaceNew.setMannequinFemaleType("System");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
Library library = libraryMapper.selectById(design1.getTemplateId());
|
||||||
|
if (library.getLevel2Type().equals("Female")) {
|
||||||
|
workspaceNew.setSex("Female");
|
||||||
|
workspaceNew.setMannequinFemaleId(design1.getTemplateId());
|
||||||
|
workspaceNew.setMannequinFemaleType("Library");
|
||||||
|
QueryWrapper<SysFile> getAnotherOneQw = new QueryWrapper<>();
|
||||||
|
getAnotherOneQw.lambda().eq(SysFile::getLevel1Type, "Models");
|
||||||
|
getAnotherOneQw.lambda().eq(SysFile::getLevel2Type, "Male");
|
||||||
|
List<SysFile> anotherList = sysFileMapper.selectList(getAnotherOneQw);
|
||||||
|
if (!CollectionUtils.isEmpty(anotherList)) {
|
||||||
|
SysFile anotherOne = anotherList.get(0);
|
||||||
|
workspaceNew.setMannequinMaleId(anotherOne.getId());
|
||||||
|
workspaceNew.setMannequinMaleType("System");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
workspaceNew.setSex("Male");
|
||||||
|
workspaceNew.setMannequinMaleId(design1.getTemplateId());
|
||||||
|
workspaceNew.setMannequinMaleType("Library");
|
||||||
|
QueryWrapper<SysFile> getAnotherOneQw = new QueryWrapper<>();
|
||||||
|
getAnotherOneQw.lambda().eq(SysFile::getLevel1Type, "Models");
|
||||||
|
getAnotherOneQw.lambda().eq(SysFile::getLevel2Type, "Female");
|
||||||
|
List<SysFile> anotherList = sysFileMapper.selectList(getAnotherOneQw);
|
||||||
|
if (!CollectionUtils.isEmpty(anotherList)) {
|
||||||
|
SysFile anotherOne = anotherList.get(0);
|
||||||
|
workspaceNew.setMannequinFemaleId(anotherOne.getId());
|
||||||
|
workspaceNew.setMannequinFemaleType("System");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
workspaceMapper.updateById(workspaceNew);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return userLikeGroupService.choose(userLikeGroupNew.getId());
|
return userLikeGroupService.choose(userLikeGroupNew.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,8 +823,11 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
Long id = commentDTO.getId();
|
Long id = commentDTO.getId();
|
||||||
Portfolio portfolio = portfolioMapper.selectById(commentDTO.getPortfolioId());
|
Portfolio portfolio = portfolioMapper.selectById(commentDTO.getPortfolioId());
|
||||||
Comment comment = commentMapper.selectById(id);
|
Comment comment = commentMapper.selectById(id);
|
||||||
if (!Objects.equals(comment.getAccountId(), commentDTO.getAccountId()) || !Objects.equals(portfolio.getAccountId(), commentDTO.getAccountId())) {
|
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||||
throw new BusinessException("You do not have the permission to delete this comment");
|
if (!Objects.equals(portfolio.getAccountId(), userHolder.getId())) {
|
||||||
|
if (!Objects.equals(comment.getAccountId(), userHolder.getId())) {
|
||||||
|
throw new BusinessException("You do not have the permission to delete this comment");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 删除主评论
|
// 删除主评论
|
||||||
commentMapper.deleteById(id);
|
commentMapper.deleteById(id);
|
||||||
@@ -657,6 +842,17 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
|||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean delete(Long id) {
|
||||||
|
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||||
|
Portfolio portfolio = portfolioMapper.selectById(id);
|
||||||
|
if (!Objects.equals(portfolio.getAccountId(), userHolder.getId())) {
|
||||||
|
throw new BusinessException("You do not have the permission to delete portfolio.");
|
||||||
|
}
|
||||||
|
portfolioMapper.deleteById(id);
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
private List<CommentVO> getChildCommentVOList(Long id) {
|
private List<CommentVO> getChildCommentVOList(Long id) {
|
||||||
QueryWrapper<Comment> qw = new QueryWrapper<>();
|
QueryWrapper<Comment> qw = new QueryWrapper<>();
|
||||||
qw.lambda().eq(Comment::getParentLevel1Id, id);
|
qw.lambda().eq(Comment::getParentLevel1Id, id);
|
||||||
|
|||||||
@@ -243,14 +243,18 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
// 翻译
|
// 翻译
|
||||||
String prompt = toProductImageDTO.getPrompt();
|
String prompt = toProductImageDTO.getPrompt();
|
||||||
String s = "";
|
String s = "";
|
||||||
if (!StringUtil.isNullOrEmpty(prompt)) s = pythonService.promptTranslate(prompt);
|
if (!StringUtil.isNullOrEmpty(prompt)) {
|
||||||
|
s = pythonService.promptTranslate(prompt);
|
||||||
|
}else {
|
||||||
|
s = "best quality, masterpiece. detailed, high-res, simple background, studio photography, extremely detailed, updo, detailed face, face, close-up, HDR, UHD, 8K realistic, Highly detailed, simple background, Studio lighting";
|
||||||
|
}
|
||||||
for (ToProductImageVO toProductImageVO : toProductImageDTO.getToProductImageVOList()) {
|
for (ToProductImageVO toProductImageVO : toProductImageDTO.getToProductImageVOList()) {
|
||||||
String taskId;
|
String taskId;
|
||||||
if (toProductImageVO.getElementType().equals("DesignOutfit")) {
|
if (toProductImageVO.getElementType().equals("DesignOutfit")) {
|
||||||
taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
||||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageVO.getElementId());
|
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageVO.getElementId());
|
||||||
// 走模型
|
// 走模型
|
||||||
pythonService.toProductImage(tDesignPythonOutfit.getDesignUrl(), taskId, s);
|
pythonService.toProductImage(tDesignPythonOutfit.getDesignUrl(), taskId, s, toProductImageDTO.getImageStrength());
|
||||||
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
||||||
toProductImageResult.setElementId(tDesignPythonOutfit.getId());
|
toProductImageResult.setElementId(tDesignPythonOutfit.getId());
|
||||||
toProductImageResult.setElementType("DesignOutfit");
|
toProductImageResult.setElementType("DesignOutfit");
|
||||||
@@ -267,7 +271,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
||||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageVO.getElementId());
|
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageVO.getElementId());
|
||||||
// 走模型
|
// 走模型
|
||||||
pythonService.toProductImage(toProductElement.getUrl(), taskId, s);
|
pythonService.toProductImage(toProductElement.getUrl(), taskId, s, toProductImageDTO.getImageStrength());
|
||||||
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
||||||
toProductImageResult.setElementId(toProductElement.getId());
|
toProductImageResult.setElementId(toProductElement.getId());
|
||||||
toProductImageResult.setElementType("ProductElement");
|
toProductImageResult.setElementType("ProductElement");
|
||||||
@@ -348,12 +352,13 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
if (Objects.isNull(toProductImageResult)) {
|
if (Objects.isNull(toProductImageResult)) {
|
||||||
throw new BusinessException("The source image does not exist.");
|
throw new BusinessException("The source image does not exist.");
|
||||||
}
|
}
|
||||||
|
magicToolResultVO.setResultType(toProductImageResult.getResultType());
|
||||||
if (toProductImageResult.getElementType().equals("ProductElement")) {
|
if (toProductImageResult.getElementType().equals("ProductElement")) {
|
||||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResult.getElementId());
|
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResult.getElementId());
|
||||||
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
|
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||||
}else {
|
}else {
|
||||||
UserLike userLike = userLikeMapper.selectById(toProductImageResult.getElementId());
|
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResult.getElementId());
|
||||||
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(userLike.getUrl(), 24 * 60));
|
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Objects.isNull(magicToolResultVO)) {
|
} else if (Objects.isNull(magicToolResultVO)) {
|
||||||
@@ -407,7 +412,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ToProductImageResult> productImageLikeList(ToProductImageDTO toProductImageDTO) {
|
public List<ToProductImageResultVO> productImageLikeList(ToProductImageDTO toProductImageDTO) {
|
||||||
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
||||||
qw.lambda().eq(ToProductImageResult::getIsLike, 1);
|
qw.lambda().eq(ToProductImageResult::getIsLike, 1);
|
||||||
qw.lambda().eq(ToProductImageResult::getUserLikeGroupId, toProductImageDTO.getUserLikeGroupId());
|
qw.lambda().eq(ToProductImageResult::getUserLikeGroupId, toProductImageDTO.getUserLikeGroupId());
|
||||||
@@ -415,7 +420,20 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
for (ToProductImageResult toProductImageResult : toProductImageResults) {
|
for (ToProductImageResult toProductImageResult : toProductImageResults) {
|
||||||
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||||
}
|
}
|
||||||
return toProductImageResults;
|
List<ToProductImageResultVO> toProductImageResultVOS = CopyUtil.copyList(toProductImageResults, ToProductImageResultVO.class);
|
||||||
|
for (ToProductImageResultVO toProductImageResultVO : toProductImageResultVOS) {
|
||||||
|
if (toProductImageResultVO.getElementType().equals("ProductElement")) {
|
||||||
|
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResultVO.getElementId());
|
||||||
|
toProductImageResultVO.setSourceUrl(minioUtil.getPresignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||||
|
}else if ((toProductImageResultVO.getElementType().equals("DesignOutfit"))) {
|
||||||
|
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResultVO.getElementId());
|
||||||
|
toProductImageResultVO.setSourceUrl(minioUtil.getPresignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||||
|
}else {
|
||||||
|
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultVO.getElementId());
|
||||||
|
toProductImageResultVO.setSourceUrl(minioUtil.getPresignedUrl(toProductImageResult1.getUrl(), 24 * 60));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return toProductImageResultVOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -447,17 +465,22 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
// 翻译
|
// 翻译
|
||||||
String prompt = toProductImageDTO.getPrompt();
|
String prompt = toProductImageDTO.getPrompt();
|
||||||
String s = pythonService.promptTranslate(prompt);
|
String s = "";
|
||||||
|
if (!StringUtil.isNullOrEmpty(prompt)) {
|
||||||
|
s = pythonService.promptTranslate(prompt);
|
||||||
|
}else {
|
||||||
|
s = "Snow moutain, snowy day, natural light";
|
||||||
|
}
|
||||||
for (ToProductImageVO toProductImageVO : toProductImageDTO.getToProductImageVOList()) {
|
for (ToProductImageVO toProductImageVO : toProductImageDTO.getToProductImageVOList()) {
|
||||||
if (toProductImageVO.getElementType().equals("ProductImage")) {
|
if (toProductImageVO.getElementType().equals("ToProductImage")) {
|
||||||
String taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
String taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
||||||
i ++;
|
i ++;
|
||||||
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageVO.getElementId());
|
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageVO.getElementId());
|
||||||
// 走模型
|
// 走模型
|
||||||
pythonService.toProductImage(toProductImageResult1.getUrl(), taskId, s);
|
pythonService.relight(toProductImageResult1.getUrl(), taskId, s, toProductImageDTO.getDirection());
|
||||||
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
||||||
toProductImageResult.setElementId(toProductImageResult1.getId());
|
toProductImageResult.setElementId(toProductImageResult1.getId());
|
||||||
toProductImageResult.setElementType("ProductImage");
|
toProductImageResult.setElementType("ToProductImage");
|
||||||
toProductImageResult.setCreateTime(LocalDateTime.now());
|
toProductImageResult.setCreateTime(LocalDateTime.now());
|
||||||
toProductImageResult.setToProductImageRecordId(toProductImageRecord.getId());
|
toProductImageResult.setToProductImageRecordId(toProductImageRecord.getId());
|
||||||
// toProductImageResult.setUrl(productImageUrl);
|
// toProductImageResult.setUrl(productImageUrl);
|
||||||
@@ -471,7 +494,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
String taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
String taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
||||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageVO.getElementId());
|
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageVO.getElementId());
|
||||||
// 走模型
|
// 走模型
|
||||||
pythonService.toProductImage(toProductElement.getUrl(), taskId, s);
|
pythonService.relight(toProductElement.getUrl(), taskId, s, toProductImageDTO.getDirection());
|
||||||
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
ToProductImageResult toProductImageResult = new ToProductImageResult();
|
||||||
toProductImageResult.setElementId(toProductElement.getId());
|
toProductImageResult.setElementId(toProductElement.getId());
|
||||||
toProductImageResult.setElementType("ProductElement");
|
toProductImageResult.setElementType("ProductElement");
|
||||||
@@ -494,7 +517,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
List<MagicToolResultVO> results = new ArrayList<>();
|
List<MagicToolResultVO> results = new ArrayList<>();
|
||||||
Set<String> collect = new HashSet<>();
|
Set<String> collect = new HashSet<>();
|
||||||
taskIdList.forEach(taskId -> {
|
taskIdList.forEach(taskId -> {
|
||||||
String key = toProductImageResultKey + ":" + taskId;
|
String key = relightResultKey + ":" + taskId;
|
||||||
MagicToolResultVO magicToolResultVO = new Gson().fromJson(redisUtil.getFromString(key), MagicToolResultVO.class);
|
MagicToolResultVO magicToolResultVO = new Gson().fromJson(redisUtil.getFromString(key), MagicToolResultVO.class);
|
||||||
if (!Objects.isNull(magicToolResultVO) && !StringUtil.isNullOrEmpty(magicToolResultVO.getUrl())) {
|
if (!Objects.isNull(magicToolResultVO) && !StringUtil.isNullOrEmpty(magicToolResultVO.getUrl())) {
|
||||||
String url = magicToolResultVO.getUrl();
|
String url = magicToolResultVO.getUrl();
|
||||||
@@ -508,6 +531,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
if (Objects.isNull(toProductImageResult)) {
|
if (Objects.isNull(toProductImageResult)) {
|
||||||
throw new BusinessException("The source image does not exist.");
|
throw new BusinessException("The source image does not exist.");
|
||||||
}
|
}
|
||||||
|
magicToolResultVO.setResultType(toProductImageResult.getResultType());
|
||||||
if (toProductImageResult.getElementType().equals("ProductElement")) {
|
if (toProductImageResult.getElementType().equals("ProductElement")) {
|
||||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResult.getElementId());
|
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResult.getElementId());
|
||||||
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
|
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ spring.datasource.primary.username=aida_con
|
|||||||
spring.datasource.primary.password=123456
|
spring.datasource.primary.password=123456
|
||||||
|
|
||||||
spring.datasource.secondary.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.secondary.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
spring.datasource.secondary.jdbcUrl=jdbc:mysql://18.167.251.121:33008/attribute_retrieval_new?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
spring.datasource.secondary.jdbcUrl=jdbc:mysql://18.167.251.121:33008/attribute_retrieval_new_style?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||||
spring.datasource.secondary.username=aida_con
|
spring.datasource.secondary.username=aida_con
|
||||||
spring.datasource.secondary.password=123456
|
spring.datasource.secondary.password=123456
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,10 @@
|
|||||||
<if test="attributeRetrievalAttrDict.silhouette != null">
|
<if test="attributeRetrievalAttrDict.silhouette != null">
|
||||||
AND silhouette = #{attributeRetrievalAttrDict.silhouette}
|
AND silhouette = #{attributeRetrievalAttrDict.silhouette}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="style != null">
|
||||||
|
AND style = #{style}
|
||||||
|
</if>
|
||||||
|
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
RAND()
|
RAND()
|
||||||
@@ -40,6 +44,12 @@
|
|||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
${tableName}
|
${tableName}
|
||||||
|
<trim prefix="WHERE" prefixOverrides="AND">
|
||||||
|
<if test="style != null">
|
||||||
|
AND style = #{style}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
</trim>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
RAND()
|
RAND()
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
@@ -60,6 +70,10 @@
|
|||||||
<if test="attributeRetrievalAttrDict.subtype != null">
|
<if test="attributeRetrievalAttrDict.subtype != null">
|
||||||
AND subtype = #{attributeRetrievalAttrDict.subtype}
|
AND subtype = #{attributeRetrievalAttrDict.subtype}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="style != null">
|
||||||
|
AND style = #{style}
|
||||||
|
</if>
|
||||||
|
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
RAND()
|
RAND()
|
||||||
@@ -79,4 +93,13 @@
|
|||||||
set style = #{style}
|
set style = #{style}
|
||||||
where ID = #{id}
|
where ID = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateStyleByFileName">
|
||||||
|
UPDATE
|
||||||
|
${tableName}
|
||||||
|
SET
|
||||||
|
style = #{style}
|
||||||
|
WHERE
|
||||||
|
image_name = #{fileName}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user