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