BUGFIX: cloud;
This commit is contained in:
@@ -30,6 +30,7 @@ import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@@ -378,12 +379,14 @@ public class GenerateConsumer {
|
||||
log.info("task_id : {} start ", generateResult.get("task_id"));
|
||||
if (!StringUtils.isEmpty(generateResult.getString("progress"))) {
|
||||
String progress = generateResult.getString("progress");
|
||||
JSONObject result = generateResult.getJSONObject("result");
|
||||
String url = null;
|
||||
if (!progress.equals("OK") && !StringUtils.isEmpty(result)) {
|
||||
url = result.getString("product_img");
|
||||
String taskId = generateResult.getString("task_id");
|
||||
userLikeGroupService.toProductBatch(taskId, url, progress);
|
||||
if (!progress.startsWith("0") && !progress.equals("OK")) {
|
||||
JSONObject result = generateResult.getJSONObject("result");
|
||||
if (Objects.nonNull(result)) {
|
||||
url = result.getString("product_img");
|
||||
String taskId = generateResult.getString("task_id");
|
||||
userLikeGroupService.toProductBatch(taskId, url, progress);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 修改redis中的数据状态为exception
|
||||
@@ -429,12 +432,14 @@ public class GenerateConsumer {
|
||||
log.info("task_id : {} start ", generateResult.get("task_id"));
|
||||
if (!StringUtils.isEmpty(generateResult.getString("progress"))) {
|
||||
String progress = generateResult.getString("progress");
|
||||
JSONObject result = generateResult.getJSONObject("result");
|
||||
String url = null;
|
||||
if (!StringUtils.isEmpty(result)) {
|
||||
url = result.getString("relight_img");
|
||||
String taskId = generateResult.getString("task_id");
|
||||
userLikeGroupService.relightBatch(taskId, url, progress);
|
||||
if (!progress.startsWith("0") && !progress.equals("OK")) {
|
||||
JSONObject result = generateResult.getJSONObject("result");
|
||||
if (Objects.nonNull(result)) {
|
||||
url = result.getString("relight_img");
|
||||
String taskId = generateResult.getString("task_id");
|
||||
userLikeGroupService.relightBatch(taskId, url, progress);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 修改redis中的数据状态为exception
|
||||
@@ -604,21 +609,21 @@ public class GenerateConsumer {
|
||||
public void getDesignBatchResult(Message msg, Channel channel) {
|
||||
processDesignBatchResult(msg, channel);
|
||||
}
|
||||
// @RabbitListener(queues = "#{rabbitMQProperties.queues.toProductImageBatch}")
|
||||
// @RabbitHandler
|
||||
// public void getToProductImageBatchResult(Message msg, Channel channel) {
|
||||
// processToProductImageBatchResult(msg, channel);
|
||||
// }
|
||||
//
|
||||
// @RabbitListener(queues = "#{rabbitMQProperties.queues.relightBatch}")
|
||||
// @RabbitHandler
|
||||
// public void getRelightBatchResult(Message msg, Channel channel) {
|
||||
// processRelightBatchResult(msg, channel);
|
||||
// }
|
||||
//
|
||||
// @RabbitListener(queues = "#{rabbitMQProperties.queues.poseTransformBatch}")
|
||||
// @RabbitHandler
|
||||
// public void getPoseTransformBatchResult(Message msg, Channel channel) {
|
||||
// processPoseTransformBatchResult(msg, channel);
|
||||
// }
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.toProductImageBatch}")
|
||||
@RabbitHandler
|
||||
public void getToProductImageBatchResult(Message msg, Channel channel) {
|
||||
processToProductImageBatchResult(msg, channel);
|
||||
}
|
||||
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.relightBatch}")
|
||||
@RabbitHandler
|
||||
public void getRelightBatchResult(Message msg, Channel channel) {
|
||||
processRelightBatchResult(msg, channel);
|
||||
}
|
||||
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.poseTransformBatch}")
|
||||
@RabbitHandler
|
||||
public void getPoseTransformBatchResult(Message msg, Channel channel) {
|
||||
processPoseTransformBatchResult(msg, channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1893,6 +1893,13 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
project.setUpdateTime(now);
|
||||
projectService.save(project);
|
||||
projectId = project.getId();
|
||||
for (ToProductImageVO toProductImageVO : toProductImageDTO.getToProductImageVOList()) {
|
||||
if (toProductImageVO.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageVO.getElementId());
|
||||
toProductElement.setProjectId(projectId);
|
||||
toProductElementMapper.updateById(toProductElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
UserLikeGroup userLikeGroup = userLikeGroupService.getByProjectId(projectId);
|
||||
Long userLikeGroupId = null;
|
||||
@@ -1993,8 +2000,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}else {
|
||||
sb.append(",high quality clothing details,").append(prompt).append(",8K realistic,HDR");
|
||||
}
|
||||
|
||||
taskId = UUID.randomUUID() + "-" + i + "-" + userHolder.getId();
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageVO.getElementId());
|
||||
// 走模型
|
||||
List<BatchParamDTO> paramList = new ArrayList<>();
|
||||
@@ -2065,6 +2070,13 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
project.setUpdateTime(now);
|
||||
projectService.save(project);
|
||||
projectId = project.getId();
|
||||
for (ToProductImageVO toProductImageVO : toProductImageDTO.getToProductImageVOList()) {
|
||||
if (toProductImageVO.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageVO.getElementId());
|
||||
toProductElement.setProjectId(projectId);
|
||||
toProductElementMapper.updateById(toProductElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
UserLikeGroup userLikeGroup = userLikeGroupService.getByProjectId(projectId);
|
||||
Long userLikeGroupId = null;
|
||||
@@ -2198,6 +2210,27 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
cloudTaskMapper.insert(cloudTask);
|
||||
return batchTaskId;
|
||||
} else if (cloudTaskDTO.getBuildType().equals(BuildType.POSE_TRANSFORM.getValue())) {
|
||||
Long projectId = cloudTaskDTO.getProjectId();
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
if (null == projectId) {
|
||||
Project project = new Project();
|
||||
project.setName(DesignProcess.POSE_TRANSFER.getValue());
|
||||
project.setProcess(DesignProcess.POSE_TRANSFER.name());
|
||||
project.setOriginal(1);
|
||||
project.setAccountId(userHolder.getId());
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
project.setCreateTime(now);
|
||||
project.setUpdateTime(now);
|
||||
projectService.save(project);
|
||||
projectId = project.getId();
|
||||
for (ToProductImageVO toProductImageVO : cloudTaskDTO.getToProductImage().getToProductImageVOList()) {
|
||||
if (toProductImageVO.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageVO.getElementId());
|
||||
toProductElement.setProjectId(projectId);
|
||||
toProductElementMapper.updateById(toProductElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
Boolean preDeduction = creditsService.creditsPreDeduction(Integer.parseInt(CreditsEventsEnum.POSE_TRANSFORMATION.getValue()) * cloudTaskDTO.getNums());
|
||||
if (!preDeduction) {
|
||||
@@ -2215,7 +2248,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
String taskId = uuid + "-" + accountId;
|
||||
|
||||
PoseTransformation poseTransformation = new PoseTransformation();
|
||||
poseTransformation.setProjectId(cloudTaskDTO.getProjectId());
|
||||
poseTransformation.setProjectId(projectId);
|
||||
poseTransformation.setAccountId(accountId);
|
||||
poseTransformation.setUniqueId(taskId);
|
||||
poseTransformation.setProductImage(poseTransformBatchDTO.getProductImage());
|
||||
|
||||
Reference in New Issue
Block a user