TASK: 保存画布时返回画布id
BUGFIX: 用户输入的prompt没有传入flux
This commit is contained in:
34
src/main/java/com/ai/da/common/enums/FluxTaskStatusEnum.java
Normal file
34
src/main/java/com/ai/da/common/enums/FluxTaskStatusEnum.java
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package com.ai.da.common.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum FluxTaskStatusEnum {
|
||||||
|
|
||||||
|
SUCCESS("Ready"),
|
||||||
|
|
||||||
|
TASK_NOT_FOUND("Task not found"),
|
||||||
|
|
||||||
|
REQUEST_MODERATED("Request Moderated"),
|
||||||
|
|
||||||
|
CONTENT_MODERATED("Content Moderated"),
|
||||||
|
|
||||||
|
ERROR("Error"),
|
||||||
|
|
||||||
|
PENDING_F("Pending");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public static FluxTaskStatusEnum fromName(String name) {
|
||||||
|
for (FluxTaskStatusEnum status : values()) {
|
||||||
|
if (status.name.equalsIgnoreCase(name)) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 或者返回默认值
|
||||||
|
return TASK_NOT_FOUND;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.ai.da.common.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum WangXiangTaskStatusEnum {
|
||||||
|
|
||||||
|
SUCCEEDED("SUCCEEDED"),
|
||||||
|
|
||||||
|
UNKNOWN_W("UNKNOWN"),
|
||||||
|
|
||||||
|
FAILED("FAILED"),
|
||||||
|
|
||||||
|
RUNNING("RUNNING"),
|
||||||
|
|
||||||
|
PENDING_W("PENDING");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
// 通过name查找枚举的静态方法
|
||||||
|
public static WangXiangTaskStatusEnum fromName(String name) {
|
||||||
|
for (WangXiangTaskStatusEnum status : values()) {
|
||||||
|
if (status.name.equalsIgnoreCase(name)) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 或者返回默认值
|
||||||
|
return UNKNOWN_W;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -178,7 +178,7 @@ public class SavedCollectionController {
|
|||||||
|
|
||||||
@ApiOperation(value = "exportSave")
|
@ApiOperation(value = "exportSave")
|
||||||
@PostMapping("/exportSave")
|
@PostMapping("/exportSave")
|
||||||
public Response<Boolean> exportSave(@RequestParam("file") MultipartFile file, @RequestParam(value = "projectId", required = false) Long projectId,
|
public Response<Long> exportSave(@RequestParam("file") MultipartFile file, @RequestParam(value = "projectId", required = false) Long projectId,
|
||||||
@RequestParam("module") String module, @RequestParam(value = "designItemDetailId", required = false) Long designItemDetailId) {
|
@RequestParam("module") String module, @RequestParam(value = "designItemDetailId", required = false) Long designItemDetailId) {
|
||||||
return Response.success(userLikeGroupService.exportSave(file, projectId, module, designItemDetailId));
|
return Response.success(userLikeGroupService.exportSave(file, projectId, module, designItemDetailId));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@TableName("t_API_generate")
|
@TableName("t_api_generate")
|
||||||
@ApiModel("调用第三方api的所有记录")
|
@ApiModel("调用第三方api的所有记录")
|
||||||
public class APIGenerate extends BaseEntity{
|
public class APIGenerate extends BaseEntity{
|
||||||
|
// 用户id
|
||||||
|
private Long accountId;
|
||||||
// 任务id 加唯一索引
|
// 任务id 加唯一索引
|
||||||
private String taskId;
|
private String taskId;
|
||||||
// 什么功能调用的api
|
// 什么功能调用的api
|
||||||
|
|||||||
@@ -3599,6 +3599,7 @@ public class PythonService {
|
|||||||
log.info("promptTranslation请求入参content###{}", jsonString);
|
log.info("promptTranslation请求入参content###{}", jsonString);
|
||||||
response = client.newCall(request).execute();
|
response = client.newCall(request).execute();
|
||||||
} catch (IOException ioException) {
|
} catch (IOException ioException) {
|
||||||
|
response.close();
|
||||||
log.error("PythonService##promptTranslation异常###{}", ExceptionUtil.getThrowableList(ioException));
|
log.error("PythonService##promptTranslation异常###{}", ExceptionUtil.getThrowableList(ioException));
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,13 @@ package com.ai.da.service;
|
|||||||
import com.ai.da.mapper.primary.entity.APIGenerate;
|
import com.ai.da.mapper.primary.entity.APIGenerate;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface APIGenerateService extends IService<APIGenerate> {
|
public interface APIGenerateService extends IService<APIGenerate> {
|
||||||
|
|
||||||
void addAPIGenerateRecordAsync(String taskId, String function, String modelName, String status);
|
void addAPIGenerateRecordAsync(Long accountId, String taskId, String function, String modelName, String status);
|
||||||
|
|
||||||
void updateAPIGenerateStatusAsync(String taskId, String status);
|
void updateAPIGenerateStatusAsync(String taskId, String status);
|
||||||
|
|
||||||
|
List<APIGenerate> getPendingTaskByStatus(String modelName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
|||||||
|
|
||||||
void updateDate(Long id,String timeZone);
|
void updateDate(Long id,String timeZone);
|
||||||
|
|
||||||
Boolean exportSave(MultipartFile file, Long projectId, String module, Long designItemDetailId);
|
Long exportSave(MultipartFile file, Long projectId, String module, Long designItemDetailId);
|
||||||
|
|
||||||
List<ToProductImageResultVO> toProduct(ToProductImageDTO toProductImageDTO);
|
List<ToProductImageResultVO> toProduct(ToProductImageDTO toProductImageDTO);
|
||||||
|
|
||||||
|
|||||||
@@ -12,17 +12,24 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static com.ai.da.common.enums.FluxTaskStatusEnum.PENDING_F;
|
||||||
|
import static com.ai.da.common.enums.WangXiangTaskStatusEnum.PENDING_W;
|
||||||
|
import static com.ai.da.common.enums.WangXiangTaskStatusEnum.RUNNING;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class APIGenerateServiceImpl extends ServiceImpl<APIGenerateMapper, APIGenerate> implements APIGenerateService {
|
public class APIGenerateServiceImpl extends ServiceImpl<APIGenerateMapper, APIGenerate> implements APIGenerateService {
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
public void addAPIGenerateRecordAsync(String taskId, String function, String modelName, String status){
|
public void addAPIGenerateRecordAsync(Long accountId, String taskId, String function, String modelName, String status){
|
||||||
log.info("异步执行添加");
|
log.info("异步执行添加");
|
||||||
if (!StringUtil.isNullOrEmpty(taskId) && !StringUtil.isNullOrEmpty(modelName)){
|
if (!StringUtil.isNullOrEmpty(taskId) && !StringUtil.isNullOrEmpty(modelName)){
|
||||||
APIGenerate apiGenerate = new APIGenerate();
|
APIGenerate apiGenerate = new APIGenerate();
|
||||||
|
apiGenerate.setAccountId(accountId);
|
||||||
apiGenerate.setTaskId(taskId);
|
apiGenerate.setTaskId(taskId);
|
||||||
apiGenerate.setFunc(function);
|
apiGenerate.setFunc(function);
|
||||||
apiGenerate.setModelName(modelName);
|
apiGenerate.setModelName(modelName);
|
||||||
@@ -65,4 +72,14 @@ public class APIGenerateServiceImpl extends ServiceImpl<APIGenerateMapper, APIGe
|
|||||||
public void updateAPIGenerateRecord(APIGenerate apiGenerate){
|
public void updateAPIGenerateRecord(APIGenerate apiGenerate){
|
||||||
baseMapper.updateById(apiGenerate);
|
baseMapper.updateById(apiGenerate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<APIGenerate> getPendingTaskByStatus(String modelName){
|
||||||
|
QueryWrapper<APIGenerate> qw = new QueryWrapper<>();
|
||||||
|
// 仅获取还在运行中的任务,成功的,失败的,均需排除
|
||||||
|
// flux 任务状态:
|
||||||
|
List<String> pendingStatus = Arrays.asList(PENDING_F.getName(), PENDING_W.getName(), RUNNING.getName());
|
||||||
|
qw.lambda().eq(APIGenerate::getModelName, modelName).in(APIGenerate::getStatus, pendingStatus);
|
||||||
|
|
||||||
|
return baseMapper.selectList(qw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ import org.bytedeco.javacv.FFmpegFrameGrabber;
|
|||||||
import org.bytedeco.javacv.Java2DFrameConverter;
|
import org.bytedeco.javacv.Java2DFrameConverter;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.dao.DuplicateKeyException;
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@@ -72,6 +71,8 @@ import static com.ai.da.common.enums.CollectionLevel1TypeEnum.*;
|
|||||||
import static com.ai.da.common.enums.CreditsEventsEnum.PATTERN;
|
import static com.ai.da.common.enums.CreditsEventsEnum.PATTERN;
|
||||||
import static com.ai.da.common.enums.CreditsEventsEnum.TO_PRODUCT_IMAGE;
|
import static com.ai.da.common.enums.CreditsEventsEnum.TO_PRODUCT_IMAGE;
|
||||||
import static com.ai.da.common.enums.CreditsEventsEnum.TO_PRODUCT_IMAGE_FLUX;
|
import static com.ai.da.common.enums.CreditsEventsEnum.TO_PRODUCT_IMAGE_FLUX;
|
||||||
|
import static com.ai.da.common.enums.WangXiangTaskStatusEnum.FAILED;
|
||||||
|
import static com.ai.da.common.enums.WangXiangTaskStatusEnum.UNKNOWN_W;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@@ -437,6 +438,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
}
|
}
|
||||||
// generate.setText(text);
|
// generate.setText(text);
|
||||||
default:
|
default:
|
||||||
|
text = translated;
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
@@ -1481,7 +1483,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
taskId = animateAnyone(poseTransformDTO, accountId);
|
taskId = animateAnyone(poseTransformDTO, accountId);
|
||||||
if (!StringUtil.isNullOrEmpty(taskId)){
|
if (!StringUtil.isNullOrEmpty(taskId)){
|
||||||
isRequestSuccess = true;
|
isRequestSuccess = true;
|
||||||
apiGenerateService.addAPIGenerateRecordAsync(taskId, Module.poseTransfer.getValue(), "wx", "Pending");
|
apiGenerateService.addAPIGenerateRecordAsync(accountId, taskId, Module.poseTransfer.getValue(), "wx", "Pending");
|
||||||
}
|
}
|
||||||
poseTransformation.setModelName("wx");
|
poseTransformation.setModelName("wx");
|
||||||
} else {
|
} else {
|
||||||
@@ -2282,7 +2284,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
JSONObject jsonResponse = JSONUtil.parseObj(resp);
|
JSONObject jsonResponse = JSONUtil.parseObj(resp);
|
||||||
JSONObject output = jsonResponse.getJSONObject("output");
|
JSONObject output = jsonResponse.getJSONObject("output");
|
||||||
String status = output.getStr("task_status");
|
String status = output.getStr("task_status");
|
||||||
if (status.equals(STATUS_FAILED) || status.equals(STATUS_UNKNOWN)) {
|
if (status.equals(FAILED.getName()) || status.equals(UNKNOWN_W.getName())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return output.getStr("task_id");
|
return output.getStr("task_id");
|
||||||
@@ -2355,13 +2357,6 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
return templateId;
|
return templateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 定义任务状态常量
|
|
||||||
private static final String STATUS_SUCCESS = "SUCCEEDED";
|
|
||||||
private static final String STATUS_FAILED = "FAILED";
|
|
||||||
private static final String STATUS_UNKNOWN = "UNKNOWN";
|
|
||||||
private static final String STATUS_RUNNING = "RUNNING";
|
|
||||||
private static final String STATUS_PENDING = "PENDING";
|
|
||||||
|
|
||||||
public String pollTemplateIdResult(String taskId) {
|
public String pollTemplateIdResult(String taskId) {
|
||||||
int attempt = 0;
|
int attempt = 0;
|
||||||
boolean isCompleted = false;
|
boolean isCompleted = false;
|
||||||
@@ -2382,21 +2377,21 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
JSONObject response = JSONUtil.parseObj(httpResponse.body());
|
JSONObject response = JSONUtil.parseObj(httpResponse.body());
|
||||||
JSONObject output = JSONUtil.parseObj(response.getStr("output"));
|
JSONObject output = JSONUtil.parseObj(response.getStr("output"));
|
||||||
String taskStatus = output.getStr("task_status", "UNKNOWN");
|
String taskStatus = output.getStr("task_status", "UNKNOWN");
|
||||||
|
WangXiangTaskStatusEnum statusEnum = WangXiangTaskStatusEnum.fromName(taskStatus);
|
||||||
System.out.println("当前任务状态: " + taskStatus);
|
System.out.println("当前任务状态: " + taskStatus);
|
||||||
|
|
||||||
switch (taskStatus) {
|
switch (statusEnum) {
|
||||||
case STATUS_SUCCESS:
|
case SUCCEEDED:
|
||||||
templateId = handleSuccessResponse(response);
|
templateId = handleSuccessResponse(response);
|
||||||
isCompleted = true;
|
isCompleted = true;
|
||||||
break;
|
break;
|
||||||
case STATUS_FAILED:
|
case FAILED:
|
||||||
case STATUS_UNKNOWN:
|
case UNKNOWN_W:
|
||||||
handleFailedResponse(response);
|
handleFailedResponse(response);
|
||||||
isCompleted = true;
|
isCompleted = true;
|
||||||
break;
|
break;
|
||||||
case STATUS_RUNNING:
|
case RUNNING:
|
||||||
case STATUS_PENDING:
|
case PENDING_W:
|
||||||
// 任务仍在运行,继续等待
|
// 任务仍在运行,继续等待
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -2455,12 +2450,13 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
JSONObject output = JSONUtil.parseObj(outputStr);
|
JSONObject output = JSONUtil.parseObj(outputStr);
|
||||||
String videoUrl = output.getStr("video_url");
|
String videoUrl = output.getStr("video_url");
|
||||||
String status = output.getStr("task_status");
|
String status = output.getStr("task_status");
|
||||||
|
WangXiangTaskStatusEnum statusEnum = WangXiangTaskStatusEnum.fromName(status);
|
||||||
|
|
||||||
apiGenerateService.updateAPIGenerateStatusAsync(taskId, status);
|
apiGenerateService.updateAPIGenerateStatusAsync(taskId, status);
|
||||||
|
|
||||||
PoseTransformationVO poseTransformationVO = new PoseTransformationVO();
|
PoseTransformationVO poseTransformationVO = new PoseTransformationVO();
|
||||||
switch (status) {
|
switch (statusEnum) {
|
||||||
case STATUS_SUCCESS:
|
case SUCCEEDED:
|
||||||
List<PoseTransformation> poseTransformations = poseTransformationMapper.selectList(new QueryWrapper<PoseTransformation>().eq("unique_id", taskId).orderByDesc("id"));
|
List<PoseTransformation> poseTransformations = poseTransformationMapper.selectList(new QueryWrapper<PoseTransformation>().eq("unique_id", taskId).orderByDesc("id"));
|
||||||
if (!poseTransformations.isEmpty()) {
|
if (!poseTransformations.isEmpty()) {
|
||||||
PoseTransformation poseTransformation = poseTransformations.get(0);
|
PoseTransformation poseTransformation = poseTransformations.get(0);
|
||||||
@@ -2488,13 +2484,13 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
redisUtil.addToString(key, new Gson().toJson(poseTransformationVO), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
|
redisUtil.addToString(key, new Gson().toJson(poseTransformationVO), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case STATUS_FAILED:
|
case FAILED:
|
||||||
throw new BusinessException(output.getStr("message"), ResultEnum.PROMPT.getCode());
|
throw new BusinessException(output.getStr("message"), ResultEnum.PROMPT.getCode());
|
||||||
case STATUS_UNKNOWN:
|
case UNKNOWN_W:
|
||||||
poseTransformationVO.setStatus("Fail");
|
poseTransformationVO.setStatus("Fail");
|
||||||
break;
|
break;
|
||||||
case STATUS_RUNNING:
|
case RUNNING:
|
||||||
case STATUS_PENDING:
|
case PENDING_W:
|
||||||
// 任务仍在运行,继续等待
|
// 任务仍在运行,继续等待
|
||||||
poseTransformationVO.setStatus("Executing");
|
poseTransformationVO.setStatus("Executing");
|
||||||
break;
|
break;
|
||||||
@@ -2786,6 +2782,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
requestBody.set("output_format", "png");
|
requestBody.set("output_format", "png");
|
||||||
|
|
||||||
log.info("flux 请求入参:{}", requestBody);
|
log.info("flux 请求入参:{}", requestBody);
|
||||||
|
if (prompt.isEmpty())throw new BusinessException("test");
|
||||||
if (!StringUtil.isNullOrEmpty(imagePath)) {
|
if (!StringUtil.isNullOrEmpty(imagePath)) {
|
||||||
try {
|
try {
|
||||||
String imageAsBase64 = null;
|
String imageAsBase64 = null;
|
||||||
@@ -2816,7 +2813,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
String key = RedisUtil.FLUX_POLLING_URL + taskId;
|
String key = RedisUtil.FLUX_POLLING_URL + taskId;
|
||||||
redisUtil.addToString(key, pollingUrl, CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
|
redisUtil.addToString(key, pollingUrl, CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
|
||||||
// 添加到api_generate表中,以便之后对结果查询做补偿
|
// 添加到api_generate表中,以便之后对结果查询做补偿
|
||||||
apiGenerateService.addAPIGenerateRecordAsync(taskId, func.getName(), "flux", "Pending");
|
apiGenerateService.addAPIGenerateRecordAsync(UserContext.getUserHolder().getId(), taskId, func.getName(), "flux", "Pending");
|
||||||
|
|
||||||
return taskId;
|
return taskId;
|
||||||
}
|
}
|
||||||
@@ -2842,23 +2839,23 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
|
|
||||||
JSONObject respObj = JSONUtil.parseObj(resp);
|
JSONObject respObj = JSONUtil.parseObj(resp);
|
||||||
String status = respObj.getStr("status");
|
String status = respObj.getStr("status");
|
||||||
|
FluxTaskStatusEnum statusEnum = FluxTaskStatusEnum.fromName(status);
|
||||||
// 异步更新状态
|
// 异步更新状态
|
||||||
apiGenerateService.updateAPIGenerateStatusAsync(taskId, status);
|
apiGenerateService.updateAPIGenerateStatusAsync(taskId, status);
|
||||||
|
|
||||||
// 处理不同状态
|
// 处理不同状态
|
||||||
switch (status) {
|
switch (statusEnum) {
|
||||||
case "Task not found":
|
case TASK_NOT_FOUND:
|
||||||
// 审核没过
|
// 审核没过
|
||||||
case "Request Moderated":
|
case REQUEST_MODERATED:
|
||||||
// 审核没过
|
// 审核没过
|
||||||
case "Content Moderated":
|
case CONTENT_MODERATED:
|
||||||
// 出错
|
// 出错
|
||||||
case "Error":
|
case ERROR:
|
||||||
return "Fail";
|
return "Fail";
|
||||||
case "Pending":
|
case PENDING_F:
|
||||||
return "Pending";
|
return "Pending";
|
||||||
case "Ready":
|
case SUCCESS:
|
||||||
// 已完成 获取结果
|
// 已完成 获取结果
|
||||||
return handleReadyStatus(respObj, objectName);
|
return handleReadyStatus(respObj, objectName);
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean exportSave(MultipartFile file, Long projectId, String module, Long designItemDetailId) {
|
public Long exportSave(MultipartFile file, Long projectId, String module, Long designItemDetailId) {
|
||||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||||
if (Objects.isNull(projectId) && !module.equals("designItemDetail")){
|
if (Objects.isNull(projectId) && !module.equals("designItemDetail")){
|
||||||
log.warn("用户 {} 保存 {} 模块的画布时, projectId为空", userHolder.getId(), module);
|
log.warn("用户 {} 保存 {} 模块的画布时, projectId为空", userHolder.getId(), module);
|
||||||
@@ -377,8 +377,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
}
|
}
|
||||||
// String upload = minioUtil.upload("aida-users", userHolder.getId() + "/exportFile", file);
|
// String upload = minioUtil.upload("aida-users", userHolder.getId() + "/exportFile", file);
|
||||||
|
|
||||||
|
ExportFile exportFile = null;
|
||||||
if (CollectionUtil.isNotEmpty(exportFiles)) {
|
if (CollectionUtil.isNotEmpty(exportFiles)) {
|
||||||
ExportFile exportFile = exportFiles.get(0);
|
exportFile = exportFiles.get(0);
|
||||||
// 更新画布信息时,只重新上传图片,不用修改数据库url
|
// 更新画布信息时,只重新上传图片,不用修改数据库url
|
||||||
String url = exportFile.getUrl();
|
String url = exportFile.getUrl();
|
||||||
String path = url.substring(url.indexOf("/") + 1);
|
String path = url.substring(url.indexOf("/") + 1);
|
||||||
@@ -387,7 +388,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
// exportFileMapper.updateById(exportFile);
|
// exportFileMapper.updateById(exportFile);
|
||||||
}else {
|
}else {
|
||||||
String upload = minioUtil.upload("aida-users", userHolder.getId() + "/exportFile", file);
|
String upload = minioUtil.upload("aida-users", userHolder.getId() + "/exportFile", file);
|
||||||
ExportFile exportFile = new ExportFile();
|
exportFile = new ExportFile();
|
||||||
exportFile.setProjectId(projectId);
|
exportFile.setProjectId(projectId);
|
||||||
exportFile.setModule(module);
|
exportFile.setModule(module);
|
||||||
exportFile.setUrl(upload);
|
exportFile.setUrl(upload);
|
||||||
@@ -396,7 +397,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
designItemDetailService.saveDesignItemDetailCanvas(designItemDetailId, exportFile.getId());
|
designItemDetailService.saveDesignItemDetailCanvas(designItemDetailId, exportFile.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Boolean.TRUE;
|
return exportFile.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1268,7 +1269,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
if (toProductImageResult.getStatus().equals("Success") && !StringUtil.isNullOrEmpty(toProductImageResult.getUrl())){
|
if (toProductImageResult.getStatus().equals("Success") && !StringUtil.isNullOrEmpty(toProductImageResult.getUrl())){
|
||||||
fluxResult = toProductImageResult.getUrl();
|
fluxResult = toProductImageResult.getUrl();
|
||||||
}else {
|
}else {
|
||||||
String objectName = project.getAccountId() + "/product_image/" + taskId + ".png";
|
String objectName = project.getAccountId() + "/relight_image/" + taskId + ".png";
|
||||||
fluxResult = generateService.getFluxResult(taskId, objectName);
|
fluxResult = generateService.getFluxResult(taskId, objectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user