BUGFIX:1、userLikeService中业务划分不清晰导致与generateService出现循环依赖问题。解决:将CollectionSort单独划分为一个Service
2、新建t_api_generate表用于补偿查询生成结果
This commit is contained in:
@@ -5,6 +5,7 @@ import com.ai.da.common.utils.RedisUtil;
|
|||||||
import com.ai.da.model.dto.GenerateThroughImageTextDTO;
|
import com.ai.da.model.dto.GenerateThroughImageTextDTO;
|
||||||
import com.ai.da.model.vo.GenerateResultVO;
|
import com.ai.da.model.vo.GenerateResultVO;
|
||||||
import com.ai.da.model.vo.PoseTransformationVO;
|
import com.ai.da.model.vo.PoseTransformationVO;
|
||||||
|
import com.ai.da.service.CloudTaskService;
|
||||||
import com.ai.da.service.DesignService;
|
import com.ai.da.service.DesignService;
|
||||||
import com.ai.da.service.GenerateService;
|
import com.ai.da.service.GenerateService;
|
||||||
import com.ai.da.service.UserLikeGroupService;
|
import com.ai.da.service.UserLikeGroupService;
|
||||||
@@ -46,6 +47,9 @@ public class GenerateConsumer {
|
|||||||
@Resource
|
@Resource
|
||||||
private DesignService designService;
|
private DesignService designService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CloudTaskService cloudTaskService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RabbitMQProperties rabbitMQProperties;
|
private RabbitMQProperties rabbitMQProperties;
|
||||||
|
|
||||||
@@ -394,12 +398,12 @@ public class GenerateConsumer {
|
|||||||
} else if (progress.startsWith("0/")) {
|
} else if (progress.startsWith("0/")) {
|
||||||
String batchTaskId = generateResult.getString("task_id");
|
String batchTaskId = generateResult.getString("task_id");
|
||||||
if (!StringUtils.isEmpty(batchTaskId)) {
|
if (!StringUtils.isEmpty(batchTaskId)) {
|
||||||
userLikeGroupService.startTask(batchTaskId);
|
cloudTaskService.startTask(batchTaskId);
|
||||||
}
|
}
|
||||||
} else if (progress.equals("OK")) {
|
} else if (progress.equals("OK")) {
|
||||||
String batchTaskId = generateResult.getString("task_id");
|
String batchTaskId = generateResult.getString("task_id");
|
||||||
if (!StringUtils.isEmpty(batchTaskId)) {
|
if (!StringUtils.isEmpty(batchTaskId)) {
|
||||||
userLikeGroupService.completeTask(batchTaskId);
|
cloudTaskService.completeTask(batchTaskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -458,12 +462,12 @@ public class GenerateConsumer {
|
|||||||
} else if (progress.startsWith("0/")) {
|
} else if (progress.startsWith("0/")) {
|
||||||
String batchTaskId = generateResult.getString("task_id");
|
String batchTaskId = generateResult.getString("task_id");
|
||||||
if (!StringUtils.isEmpty(batchTaskId)) {
|
if (!StringUtils.isEmpty(batchTaskId)) {
|
||||||
userLikeGroupService.startTask(batchTaskId);
|
cloudTaskService.startTask(batchTaskId);
|
||||||
}
|
}
|
||||||
} else if (progress.equals("OK")) {
|
} else if (progress.equals("OK")) {
|
||||||
String batchTaskId = generateResult.getString("task_id");
|
String batchTaskId = generateResult.getString("task_id");
|
||||||
if (!StringUtils.isEmpty(batchTaskId)) {
|
if (!StringUtils.isEmpty(batchTaskId)) {
|
||||||
userLikeGroupService.completeTask(batchTaskId);
|
cloudTaskService.completeTask(batchTaskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public class MyTaskScheduler {
|
|||||||
List<ToProductImageResult> toProductImageResultList1 = toProductImageResultMapper.selectList(toProductImageResultQueryWrapper1);
|
List<ToProductImageResult> toProductImageResultList1 = toProductImageResultMapper.selectList(toProductImageResultQueryWrapper1);
|
||||||
if (!CollectionUtils.isEmpty(toProductImageResultList1)) {
|
if (!CollectionUtils.isEmpty(toProductImageResultList1)) {
|
||||||
for (ToProductImageResult toProductImageResult : toProductImageResultList1) {
|
for (ToProductImageResult toProductImageResult : toProductImageResultList1) {
|
||||||
designService.addCollectionSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), collectionSort.getProjectId(), collectionSort.getId());
|
collectionSortService.addCollectionSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), collectionSort.getProjectId(), collectionSort.getId());
|
||||||
|
|
||||||
QueryWrapper<ToProductImageResult> relightResultQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<ToProductImageResult> relightResultQueryWrapper = new QueryWrapper<>();
|
||||||
relightResultQueryWrapper.lambda().eq(ToProductImageResult::getElementId, toProductImageResult.getId());
|
relightResultQueryWrapper.lambda().eq(ToProductImageResult::getElementId, toProductImageResult.getId());
|
||||||
@@ -115,7 +115,7 @@ public class MyTaskScheduler {
|
|||||||
|
|
||||||
if (!CollectionUtils.isEmpty(toProductImageResultList2)) {
|
if (!CollectionUtils.isEmpty(toProductImageResultList2)) {
|
||||||
for (ToProductImageResult relight : toProductImageResultList2) {
|
for (ToProductImageResult relight : toProductImageResultList2) {
|
||||||
designService.addCollectionSort(relight.getId(), CollectionType.RELIGHT.getValue(), collectionSort.getProjectId(), collectionSort.getId());
|
collectionSortService.addCollectionSort(relight.getId(), CollectionType.RELIGHT.getValue(), collectionSort.getProjectId(), collectionSort.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,6 +153,8 @@ public class MyTaskScheduler {
|
|||||||
private ExportFileMapper exportFileMapper;
|
private ExportFileMapper exportFileMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private PortfolioMapper portfolioMapper;
|
private PortfolioMapper portfolioMapper;
|
||||||
|
@Resource
|
||||||
|
private CollectionSortService collectionSortService;
|
||||||
|
|
||||||
// 定时任务,每十五天执行一次
|
// 定时任务,每十五天执行一次
|
||||||
// @Scheduled(cron = "0 0 0 ? * MON")
|
// @Scheduled(cron = "0 0 0 ? * MON")
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.ai.da.mapper.primary;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.primary.entity.APIGenerate;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
public interface APIGenerateMapper extends BaseMapper<APIGenerate> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.ai.da.mapper.primary.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@TableName("t_API_generate")
|
||||||
|
@ApiModel("调用第三方api的所有记录")
|
||||||
|
public class APIGenerate extends BaseEntity{
|
||||||
|
|
||||||
|
// 任务id 加唯一索引
|
||||||
|
private String taskId;
|
||||||
|
// 什么功能调用的api
|
||||||
|
private String func;
|
||||||
|
// 第三方api的服务商 目前只有ali-万相 和 flux
|
||||||
|
// private String service;
|
||||||
|
// 模型名
|
||||||
|
private String modelName;
|
||||||
|
// 任务状态
|
||||||
|
private String status;
|
||||||
|
// 获取结果的重试次数
|
||||||
|
private int retry_count;
|
||||||
|
}
|
||||||
@@ -5,4 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
|
|
||||||
public interface CloudTaskService extends IService<CloudTask> {
|
public interface CloudTaskService extends IService<CloudTask> {
|
||||||
CloudTask getByTaskId(String taskId);
|
CloudTask getByTaskId(String taskId);
|
||||||
|
|
||||||
|
void startTask(String batchTaskId);
|
||||||
|
|
||||||
|
void completeTask(String batchTaskId);
|
||||||
}
|
}
|
||||||
|
|||||||
21
src/main/java/com/ai/da/service/CollectionSortService.java
Normal file
21
src/main/java/com/ai/da/service/CollectionSortService.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.ai.da.service;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.primary.entity.CollectionSort;
|
||||||
|
import com.ai.da.model.dto.CollectionSortDTO;
|
||||||
|
|
||||||
|
public interface CollectionSortService {
|
||||||
|
|
||||||
|
CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long collectionSortParentId);
|
||||||
|
|
||||||
|
int getNextSort(Long projectId, Long parentId);
|
||||||
|
|
||||||
|
void deleteCollectionSort(Long relationId, String relationType, Long projectId, Long parentId);
|
||||||
|
|
||||||
|
CollectionSort getUserLikeSortByUserLikeId(Long relationId, String relationType, Long projectId);
|
||||||
|
|
||||||
|
Boolean sort(CollectionSortDTO userLikeSortDTO);
|
||||||
|
|
||||||
|
Integer rearrangeChildSort(Long childId, String relationType, Long parentId, Long userLikeSortId);
|
||||||
|
|
||||||
|
Long getParentIdByElementIdAndElementType(Long elementId, String elementType);
|
||||||
|
}
|
||||||
@@ -61,12 +61,6 @@ public interface DesignService extends IService<Design> {
|
|||||||
*/
|
*/
|
||||||
DesignLikeVO like(DesignLikeDTO designLikeDTO);
|
DesignLikeVO like(DesignLikeDTO designLikeDTO);
|
||||||
|
|
||||||
CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long parentId);
|
|
||||||
|
|
||||||
CollectionSort queryCollectionSortByRelation(Long relationId, String relationType, Long projectId);
|
|
||||||
|
|
||||||
int getNextSort(Long projectId, Long parentId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dislike
|
* dislike
|
||||||
*
|
*
|
||||||
@@ -75,10 +69,6 @@ public interface DesignService extends IService<Design> {
|
|||||||
*/
|
*/
|
||||||
Boolean dislike(DisDesignLikeDTO disDesignLikeDTO);
|
Boolean dislike(DisDesignLikeDTO disDesignLikeDTO);
|
||||||
|
|
||||||
void deleteCollectionSort(Long relationId, String relationType, Long projectId, Long parentId);
|
|
||||||
|
|
||||||
CollectionSort getUserLikeSortByUserLikeId(Long userLikeId, String relationType, Long projectId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generateHighDesign
|
* generateHighDesign
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
|||||||
|
|
||||||
List<ToProductImageResultVO> toProduct(ToProductImageDTO toProductImageDTO);
|
List<ToProductImageResultVO> toProduct(ToProductImageDTO toProductImageDTO);
|
||||||
|
|
||||||
Integer rearrangeChildSort(Long childId, String relationType, Long parentId, Long userLikeSortId);
|
|
||||||
|
|
||||||
void toProduct(String taskId);
|
void toProduct(String taskId);
|
||||||
|
|
||||||
ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId);
|
ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId);
|
||||||
@@ -58,8 +56,6 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
|||||||
|
|
||||||
List<MagicToolResultVO> getToProductImageResultList(List<String> taskIdList);
|
List<MagicToolResultVO> getToProductImageResultList(List<String> taskIdList);
|
||||||
|
|
||||||
Long getParentIdByElementIdAndElementType(Long elementId, String elementType);
|
|
||||||
|
|
||||||
JSONObject exportSearch(ExportSearchDTO exportSearchDTO);
|
JSONObject exportSearch(ExportSearchDTO exportSearchDTO);
|
||||||
|
|
||||||
CanvasElementUpload canvasElementUpload(MultipartFile file);
|
CanvasElementUpload canvasElementUpload(MultipartFile file);
|
||||||
@@ -125,8 +121,4 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
|||||||
Boolean toProductImageElementDelete(Long id);
|
Boolean toProductImageElementDelete(Long id);
|
||||||
|
|
||||||
ToProductElementVO convertRelightElement(Long id);
|
ToProductElementVO convertRelightElement(Long id);
|
||||||
|
|
||||||
void startTask(String batchTaskId);
|
|
||||||
|
|
||||||
void completeTask(String batchTaskId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,23 +6,51 @@ import com.ai.da.mapper.primary.entity.Account;
|
|||||||
import com.ai.da.mapper.primary.entity.CloudTask;
|
import com.ai.da.mapper.primary.entity.CloudTask;
|
||||||
import com.ai.da.service.ClassificationService;
|
import com.ai.da.service.ClassificationService;
|
||||||
import com.ai.da.service.CloudTaskService;
|
import com.ai.da.service.CloudTaskService;
|
||||||
|
import com.ai.da.service.CreditsService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class CloudTaskServiceImpl extends ServiceImpl<CloudTaskMapper, CloudTask> implements CloudTaskService {
|
public class CloudTaskServiceImpl extends ServiceImpl<CloudTaskMapper, CloudTask> implements CloudTaskService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CloudTaskMapper cloudTaskMapper;
|
private CreditsService creditsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CloudTask getByTaskId(String taskId) {
|
public CloudTask getByTaskId(String taskId) {
|
||||||
QueryWrapper<CloudTask> qw = new QueryWrapper<>();
|
QueryWrapper<CloudTask> qw = new QueryWrapper<>();
|
||||||
qw.lambda().eq(CloudTask::getTaskId, taskId);
|
qw.lambda().eq(CloudTask::getTaskId, taskId);
|
||||||
return cloudTaskMapper.selectOne(qw);
|
return baseMapper.selectOne(qw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startTask(String batchTaskId) {
|
||||||
|
QueryWrapper<CloudTask> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CloudTask::getTaskId, batchTaskId);
|
||||||
|
CloudTask cloudTask = baseMapper.selectOne(qw);
|
||||||
|
cloudTask.setStartTime(LocalDateTime.now());
|
||||||
|
baseMapper.updateById(cloudTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void completeTask(String batchTaskId) {
|
||||||
|
QueryWrapper<CloudTask> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CloudTask::getTaskId, batchTaskId);
|
||||||
|
CloudTask cloudTask = baseMapper.selectOne(qw);
|
||||||
|
cloudTask.setStatus(1);
|
||||||
|
// cloudTask.setCompletedNum(cloudTask.getNums());
|
||||||
|
cloudTask.setUpdateTime(LocalDateTime.now());
|
||||||
|
baseMapper.updateById(cloudTask);
|
||||||
|
|
||||||
|
// 扣除积分
|
||||||
|
Boolean b = creditsService.taskCreditsDeduction(cloudTask.getAccountId(), cloudTask.getTaskId());
|
||||||
|
// 记录积分变更
|
||||||
|
if (b) creditsService.updateChangedCredits(String.valueOf(cloudTask.getAccountId()), cloudTask.getTaskId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,188 @@
|
|||||||
|
package com.ai.da.service.impl;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.primary.CollectionSortMapper;
|
||||||
|
import com.ai.da.mapper.primary.entity.CollectionSort;
|
||||||
|
import com.ai.da.model.dto.CollectionSortDTO;
|
||||||
|
import com.ai.da.model.enums.CollectionType;
|
||||||
|
import com.ai.da.service.CollectionSortService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class CollectionSortServiceImpl extends ServiceImpl<CollectionSortMapper, CollectionSort> implements CollectionSortService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long collectionSortParentId) {
|
||||||
|
CollectionSort collectionSort = queryCollectionSortByRelation(relationId, relationType, projectId);
|
||||||
|
if (Objects.nonNull(collectionSort)){
|
||||||
|
return collectionSort;
|
||||||
|
}
|
||||||
|
int sort = getNextSort(projectId, collectionSortParentId);
|
||||||
|
CollectionSort userLikeSort = new CollectionSort();
|
||||||
|
// userLikeSort.setUserLikeGroupId(userGroupId);
|
||||||
|
// userLikeSort.setUserLikeId(relationId);
|
||||||
|
userLikeSort.setProjectId(projectId);
|
||||||
|
userLikeSort.setRelationId(relationId);
|
||||||
|
userLikeSort.setRelationType(relationType);
|
||||||
|
userLikeSort.setSort(sort);
|
||||||
|
if (null != collectionSortParentId) {
|
||||||
|
userLikeSort.setParentId(collectionSortParentId);
|
||||||
|
}
|
||||||
|
userLikeSort.setCreateTime(LocalDateTime.now());
|
||||||
|
baseMapper.insert(userLikeSort);
|
||||||
|
return userLikeSort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CollectionSort queryCollectionSortByRelation(Long relationId, String relationType, Long projectId){
|
||||||
|
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CollectionSort::getProjectId, projectId).
|
||||||
|
eq(CollectionSort::getRelationId, relationId).
|
||||||
|
eq(CollectionSort::getRelationType, relationType);
|
||||||
|
return baseMapper.selectOne(qw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNextSort(Long projectId, Long parentId) {
|
||||||
|
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CollectionSort::getProjectId, projectId);
|
||||||
|
if (null != parentId) {
|
||||||
|
qw.lambda().eq(CollectionSort::getParentId, parentId);
|
||||||
|
}else {
|
||||||
|
qw.lambda().isNull(CollectionSort::getParentId);
|
||||||
|
}
|
||||||
|
List<CollectionSort> userLikeSorts = baseMapper.selectList(qw);
|
||||||
|
if (CollectionUtils.isEmpty(userLikeSorts)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return userLikeSorts.size() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteCollectionSort(Long relationId, String relationType, Long projectId, Long parentId) {
|
||||||
|
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CollectionSort::getProjectId, projectId);
|
||||||
|
if (null != parentId) {
|
||||||
|
qw.lambda().eq(CollectionSort::getParentId, parentId);
|
||||||
|
}else {
|
||||||
|
qw.lambda().isNull(CollectionSort::getParentId);
|
||||||
|
}
|
||||||
|
qw.lambda().orderByDesc(CollectionSort::getSort);
|
||||||
|
List<CollectionSort> userLikeSorts = baseMapper.selectList(qw);
|
||||||
|
CollectionSort userLikeSort = getUserLikeSortByUserLikeId(relationId, relationType, projectId);
|
||||||
|
if (Objects.nonNull(userLikeSort)) {
|
||||||
|
Long userLikeSortId = userLikeSort.getId();
|
||||||
|
for (CollectionSort likeSort : userLikeSorts) {
|
||||||
|
if (Objects.equals(likeSort.getId(), userLikeSortId)) {
|
||||||
|
baseMapper.deleteById(likeSort);
|
||||||
|
deleteByParentId(likeSort.getId());
|
||||||
|
break;
|
||||||
|
}else {
|
||||||
|
likeSort.setSort(likeSort.getSort() - 1);
|
||||||
|
baseMapper.updateById(likeSort);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteByParentId(Long parentId) {
|
||||||
|
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CollectionSort::getParentId, parentId);
|
||||||
|
baseMapper.delete(qw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CollectionSort getUserLikeSortByUserLikeId(Long relationId, String relationType, Long projectId) {
|
||||||
|
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CollectionSort::getRelationId, relationId);
|
||||||
|
qw.lambda().eq(CollectionSort::getRelationType, relationType);
|
||||||
|
qw.lambda().eq(CollectionSort::getProjectId, projectId);
|
||||||
|
CollectionSort userLikeSort = baseMapper.selectOne(qw);
|
||||||
|
return userLikeSort;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean sort(CollectionSortDTO userLikeSortDTO) {
|
||||||
|
for (CollectionSort userLikeSort : userLikeSortDTO.getUserLikeSortList()) {
|
||||||
|
baseMapper.updateById(userLikeSort);
|
||||||
|
}
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 只有当使用子集中的元素进行生成时,才需要重新排序
|
||||||
|
* @param childId 生成元素的id
|
||||||
|
* @param parentId 父级id
|
||||||
|
* @param relationType 生成功能
|
||||||
|
* @param userLikeSortId 子集排序表中的id
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public Integer rearrangeChildSort(Long childId, String relationType, Long parentId, Long userLikeSortId) {
|
||||||
|
// 对父级元素进行生成不需要重新排序
|
||||||
|
if (Objects.isNull(userLikeSortId) || parentId.equals(userLikeSortId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 相同的relation_id,relation_type重复排序,有脏数据
|
||||||
|
List<CollectionSort> childList = baseMapper.selectList(
|
||||||
|
new QueryWrapper<CollectionSort>().eq("relation_id", childId)
|
||||||
|
.eq("relation_type", relationType).orderByDesc("id"));
|
||||||
|
if (childList.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}else if (childList.size() > 1){
|
||||||
|
log.error("CollectionSort表中,relation_id为{},relation_type为{}的记录有 {} 条,", childId, relationType, childList.size());
|
||||||
|
}
|
||||||
|
CollectionSort child = childList.get(0);
|
||||||
|
CollectionSort collectionSort = baseMapper.selectById(userLikeSortId);
|
||||||
|
if (Objects.isNull(collectionSort)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
child.setSort(collectionSort.getSort());
|
||||||
|
// 原来排序的大于等于userLikeSortId的排序的,都要+1
|
||||||
|
baseMapper.increaseGenerateSortAbove(parentId, relationType, collectionSort.getSort() - 1);
|
||||||
|
// 当前的生成结果则填入userLikeSortId的排序位置
|
||||||
|
child.setUpdateTime(LocalDateTime.now());
|
||||||
|
baseMapper.updateById(child);
|
||||||
|
return collectionSort.getSort();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getParentIdByElementIdAndElementType(Long elementId, String elementType) {
|
||||||
|
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CollectionSort::getRelationId, elementId);
|
||||||
|
|
||||||
|
elementType = transElementType(elementType);
|
||||||
|
qw.lambda().eq(CollectionSort::getRelationType, elementType);
|
||||||
|
List<CollectionSort> collectionSortList = baseMapper.selectList(qw);
|
||||||
|
if (CollectionUtils.isEmpty(collectionSortList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
CollectionSort collectionSort = collectionSortList.get(0);
|
||||||
|
Long parentId = collectionSort.getParentId();
|
||||||
|
if (parentId == null) {
|
||||||
|
return collectionSort.getId();
|
||||||
|
}
|
||||||
|
return collectionSort.getParentId();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String transElementType(String elementType) {
|
||||||
|
if (elementType.equals("DesignOutfit")) {
|
||||||
|
return CollectionType.DESIGN.getValue();
|
||||||
|
}else if (elementType.equals("ToProductImage")) {
|
||||||
|
return CollectionType.TO_PRODUCT_IMAGE.getValue();
|
||||||
|
}else if (elementType.equals("PoseTransfer")) {
|
||||||
|
return CollectionType.POSE_TRANSFORM.getValue();
|
||||||
|
}else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -111,9 +111,10 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
private ToProductImageResultMapper toProductImageResultMapper;
|
private ToProductImageResultMapper toProductImageResultMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ToProductElementMapper toProductElementMapper;
|
private ToProductElementMapper toProductElementMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MoodboardPositionMapper moodboardPositionMapper;
|
private MoodboardPositionMapper moodboardPositionMapper;
|
||||||
|
@Resource
|
||||||
|
private CollectionSortService collectionSortService;
|
||||||
|
|
||||||
@Value("${minio.endpoint}")
|
@Value("${minio.endpoint}")
|
||||||
private String endpoint;
|
private String endpoint;
|
||||||
@@ -133,9 +134,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DesignBatchMapper designBatchMapper;
|
private DesignBatchMapper designBatchMapper;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CollectionSortMapper collectionSortMapper;
|
|
||||||
@Resource
|
@Resource
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -1213,7 +1211,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
userLikeService.save(userLike);
|
userLikeService.save(userLike);
|
||||||
Long userLikeSortId;
|
Long userLikeSortId;
|
||||||
CollectionSort userLikeSort = addCollectionSort(userLike.getId(), CollectionType.DESIGN.getValue(), designLikeDTO.getProjectId(), null);
|
CollectionSort userLikeSort = collectionSortService.addCollectionSort(userLike.getId(), CollectionType.DESIGN.getValue(), designLikeDTO.getProjectId(), null);
|
||||||
userLikeSortId = userLikeSort.getId();
|
userLikeSortId = userLikeSort.getId();
|
||||||
groupDetailId = userLike.getId();
|
groupDetailId = userLike.getId();
|
||||||
String designUrl = designPythonOutfitMapper.selectById(userLike.getDesignOutfitId()).getDesignUrl();
|
String designUrl = designPythonOutfitMapper.selectById(userLike.getDesignOutfitId()).getDesignUrl();
|
||||||
@@ -1260,52 +1258,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long collectionSortParentId) {
|
|
||||||
CollectionSort collectionSort = queryCollectionSortByRelation(relationId, relationType, projectId);
|
|
||||||
if (Objects.nonNull(collectionSort)){
|
|
||||||
return collectionSort;
|
|
||||||
}
|
|
||||||
int sort = getNextSort(projectId, collectionSortParentId);
|
|
||||||
CollectionSort userLikeSort = new CollectionSort();
|
|
||||||
// userLikeSort.setUserLikeGroupId(userGroupId);
|
|
||||||
// userLikeSort.setUserLikeId(relationId);
|
|
||||||
userLikeSort.setProjectId(projectId);
|
|
||||||
userLikeSort.setRelationId(relationId);
|
|
||||||
userLikeSort.setRelationType(relationType);
|
|
||||||
userLikeSort.setSort(sort);
|
|
||||||
if (null != collectionSortParentId) {
|
|
||||||
userLikeSort.setParentId(collectionSortParentId);
|
|
||||||
}
|
|
||||||
userLikeSort.setCreateTime(LocalDateTime.now());
|
|
||||||
collectionSortMapper.insert(userLikeSort);
|
|
||||||
return userLikeSort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CollectionSort queryCollectionSortByRelation(Long relationId, String relationType, Long projectId){
|
|
||||||
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
|
||||||
qw.lambda().eq(CollectionSort::getProjectId, projectId).
|
|
||||||
eq(CollectionSort::getRelationId, relationId).
|
|
||||||
eq(CollectionSort::getRelationType, relationType);
|
|
||||||
return collectionSortMapper.selectOne(qw);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getNextSort(Long projectId, Long parentId) {
|
|
||||||
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
|
||||||
qw.lambda().eq(CollectionSort::getProjectId, projectId);
|
|
||||||
if (null != parentId) {
|
|
||||||
qw.lambda().eq(CollectionSort::getParentId, parentId);
|
|
||||||
}else {
|
|
||||||
qw.lambda().isNull(CollectionSort::getParentId);
|
|
||||||
}
|
|
||||||
List<CollectionSort> userLikeSorts = collectionSortMapper.selectList(qw);
|
|
||||||
if (CollectionUtils.isEmpty(userLikeSorts)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return userLikeSorts.size() + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Long> validateMergeElement(List<CollectionElement> oldElements, List<DesignItemDetail> designItemDetails) {
|
private List<Long> validateMergeElement(List<CollectionElement> oldElements, List<DesignItemDetail> designItemDetails) {
|
||||||
List<DesignItemDetail> hasCollections = designItemDetails.stream()
|
List<DesignItemDetail> hasCollections = designItemDetails.stream()
|
||||||
.filter(f -> Objects.nonNull(f.getCollectionElementId()))
|
.filter(f -> Objects.nonNull(f.getCollectionElementId()))
|
||||||
@@ -1384,7 +1336,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
// userLikeGroupService.removeById(userLike.getUserLikeGroupId());
|
// userLikeGroupService.removeById(userLike.getUserLikeGroupId());
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteCollectionSort(userLike.getId(), CollectionType.DESIGN.getValue(), disDesignLikeDTO.getProjectId(), null);
|
collectionSortService.deleteCollectionSort(userLike.getId(), CollectionType.DESIGN.getValue(), disDesignLikeDTO.getProjectId(), null);
|
||||||
//删除对应的history
|
//删除对应的history
|
||||||
userLikeService.removeById(disDesignLikeDTO.getGroupDetailId());
|
userLikeService.removeById(disDesignLikeDTO.getGroupDetailId());
|
||||||
// 更新项目更新时间
|
// 更新项目更新时间
|
||||||
@@ -1392,49 +1344,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteCollectionSort(Long relationId, String relationType, Long projectId, Long parentId) {
|
|
||||||
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
|
||||||
qw.lambda().eq(CollectionSort::getProjectId, projectId);
|
|
||||||
if (null != parentId) {
|
|
||||||
qw.lambda().eq(CollectionSort::getParentId, parentId);
|
|
||||||
}else {
|
|
||||||
qw.lambda().isNull(CollectionSort::getParentId);
|
|
||||||
}
|
|
||||||
qw.lambda().orderByDesc(CollectionSort::getSort);
|
|
||||||
List<CollectionSort> userLikeSorts = collectionSortMapper.selectList(qw);
|
|
||||||
CollectionSort userLikeSort = getUserLikeSortByUserLikeId(relationId, relationType, projectId);
|
|
||||||
if (Objects.nonNull(userLikeSort)) {
|
|
||||||
Long userLikeSortId = userLikeSort.getId();
|
|
||||||
for (CollectionSort likeSort : userLikeSorts) {
|
|
||||||
if (Objects.equals(likeSort.getId(), userLikeSortId)) {
|
|
||||||
collectionSortMapper.deleteById(likeSort);
|
|
||||||
deleteByParentId(likeSort.getId());
|
|
||||||
break;
|
|
||||||
}else {
|
|
||||||
likeSort.setSort(likeSort.getSort() - 1);
|
|
||||||
collectionSortMapper.updateById(likeSort);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void deleteByParentId(Long parentId) {
|
|
||||||
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
|
||||||
qw.lambda().eq(CollectionSort::getParentId, parentId);
|
|
||||||
collectionSortMapper.delete(qw);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CollectionSort getUserLikeSortByUserLikeId(Long relationId, String relationType, Long projectId) {
|
|
||||||
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
|
||||||
qw.lambda().eq(CollectionSort::getRelationId, relationId);
|
|
||||||
qw.lambda().eq(CollectionSort::getRelationType, relationType);
|
|
||||||
qw.lambda().eq(CollectionSort::getProjectId, projectId);
|
|
||||||
CollectionSort userLikeSort = collectionSortMapper.selectOne(qw);
|
|
||||||
return userLikeSort;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String generateHighDesign(GenerateHighDesignDTO generateHighDesignDTO) {
|
public String generateHighDesign(GenerateHighDesignDTO generateHighDesignDTO) {
|
||||||
DesignItem designItem = designItemService.getById(generateHighDesignDTO.getDesignItemId());
|
DesignItem designItem = designItemService.getById(generateHighDesignDTO.getDesignItemId());
|
||||||
@@ -2763,13 +2672,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean sort(CollectionSortDTO userLikeSortDTO) {
|
public Boolean sort(CollectionSortDTO userLikeSortDTO) {
|
||||||
// QueryWrapper<UserLikeSort> qw = new QueryWrapper<>();
|
return collectionSortService.sort(userLikeSortDTO);
|
||||||
// qw.lambda().eq(UserLikeSort::getUserLikeGroupId, userLikeSortDTO.getUserLikeGroupId());
|
|
||||||
// userLikeSortMapper.delete(qw);
|
|
||||||
for (CollectionSort userLikeSort : userLikeSortDTO.getUserLikeSortList()) {
|
|
||||||
collectionSortMapper.updateById(userLikeSort);
|
|
||||||
}
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -101,6 +101,12 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
private SendRequestUtil sendRequestUtil;
|
private SendRequestUtil sendRequestUtil;
|
||||||
@Resource
|
@Resource
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
|
@Resource
|
||||||
|
private CollectionSortService collectionSortService;
|
||||||
|
@Resource
|
||||||
|
private CloudTaskService cloudTaskService;
|
||||||
|
@Resource
|
||||||
|
private APIGenerateMapper apiGenerateMapper;
|
||||||
|
|
||||||
@Value("${redis.key.orderForGenerate}")
|
@Value("${redis.key.orderForGenerate}")
|
||||||
private String consumptionOrderKey;
|
private String consumptionOrderKey;
|
||||||
@@ -1440,9 +1446,6 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
return new GenerateResultVO(id, url, "Success", category);
|
return new GenerateResultVO(id, url, "Success", category);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Resource
|
|
||||||
private UserLikeGroupService userLikeGroupService;
|
|
||||||
|
|
||||||
public ToProductImageResultVO poseTransform(PoseTransformDTO poseTransformDTO) {
|
public ToProductImageResultVO poseTransform(PoseTransformDTO poseTransformDTO) {
|
||||||
Long accountId = UserContext.getUserHolder().getId();
|
Long accountId = UserContext.getUserHolder().getId();
|
||||||
Long projectId = poseTransformDTO.getProjectId();
|
Long projectId = poseTransformDTO.getProjectId();
|
||||||
@@ -1497,7 +1500,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
poseTransformation.setUpdateTime(LocalDateTime.now());
|
poseTransformation.setUpdateTime(LocalDateTime.now());
|
||||||
poseTransformationMapper.updateById(poseTransformation);
|
poseTransformationMapper.updateById(poseTransformation);
|
||||||
Integer sort = addPoseTransferLike(poseTransformDTO, poseTransformation.getId());
|
Integer sort = addPoseTransferLike(poseTransformDTO, poseTransformation.getId());
|
||||||
Integer reSort = userLikeGroupService.rearrangeChildSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(),
|
Integer reSort = collectionSortService.rearrangeChildSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(),
|
||||||
poseTransformDTO.getParentId(), poseTransformDTO.getUserLikeSortId());
|
poseTransformDTO.getParentId(), poseTransformDTO.getUserLikeSortId());
|
||||||
toProductImageResultVO.setSort(Objects.isNull(reSort) ? sort : reSort);
|
toProductImageResultVO.setSort(Objects.isNull(reSort) ? sort : reSort);
|
||||||
} else if (Objects.nonNull(poseTransformDTO.getIsDefaultLike()) && Objects.nonNull(poseTransformDTO.getParentId())) {
|
} else if (Objects.nonNull(poseTransformDTO.getIsDefaultLike()) && Objects.nonNull(poseTransformDTO.getParentId())) {
|
||||||
@@ -1681,7 +1684,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
if (poseTransformation != null) {
|
if (poseTransformation != null) {
|
||||||
ToProductImageResult productResult = getProductResultByPath(poseTransformation.getProductImage());
|
ToProductImageResult productResult = getProductResultByPath(poseTransformation.getProductImage());
|
||||||
if (productResult != null) {
|
if (productResult != null) {
|
||||||
Long parentId = userLikeGroupService.getParentIdByElementIdAndElementType(
|
Long parentId = collectionSortService.getParentIdByElementIdAndElementType(
|
||||||
productResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue());
|
productResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue());
|
||||||
vo.setParentId(parentId);
|
vo.setParentId(parentId);
|
||||||
vo.setId(poseTransformation.getId());
|
vo.setId(poseTransformation.getId());
|
||||||
@@ -1696,45 +1699,6 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
return "Invalid".equals(status) || "Fail".equals(status);
|
return "Invalid".equals(status) || "Fail".equals(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public List<PoseTransformationVO> getPoseTransformationResult(List<String> taskIdList) {
|
|
||||||
ArrayList<PoseTransformationVO> poseTransformationVOS = new ArrayList<>();
|
|
||||||
for (String taskId : taskIdList) {
|
|
||||||
String type = resolveModelType(taskId, CreditsEventsEnum.POSE_TRANSFORMATION.getValue());
|
|
||||||
|
|
||||||
String key = generateResultKey + ":" + taskId;
|
|
||||||
String resultJson = redisUtil.getFromString(key);
|
|
||||||
PoseTransformationVO poseTransformationVO;
|
|
||||||
if (!StringUtil.isNullOrEmpty(resultJson)) {
|
|
||||||
poseTransformationVO = new Gson().fromJson(redisUtil.getFromString(key), PoseTransformationVO.class);
|
|
||||||
if (poseTransformationVO.getStatus().equals("Success") && !type.equals("wx")) {
|
|
||||||
// 处理各种URL
|
|
||||||
processUrl(poseTransformationVO.getGifUrl(), url ->
|
|
||||||
poseTransformationVO.setGifUrl(minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME)));
|
|
||||||
processUrl(poseTransformationVO.getVideoUrl(), url ->
|
|
||||||
poseTransformationVO.setVideoUrl(minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME)));
|
|
||||||
processUrl(poseTransformationVO.getFirstFrameUrl(), url ->
|
|
||||||
poseTransformationVO.setFirstFrameUrl(minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME)));
|
|
||||||
}
|
|
||||||
poseTransformationVO.setResultType(CollectionType.POSE_TRANSFORM.getValue());
|
|
||||||
} else if (type.equals("wx")) {
|
|
||||||
poseTransformationVO = getAnimateResult(taskId);
|
|
||||||
} else {
|
|
||||||
poseTransformationVO = new PoseTransformationVO(taskId, "Executing");
|
|
||||||
}
|
|
||||||
|
|
||||||
PoseTransformation poseTransformation = poseTransformationMapper.selectOne(new QueryWrapper<PoseTransformation>().eq("unique_id", taskId));
|
|
||||||
if (Objects.nonNull(poseTransformation)) {
|
|
||||||
ToProductImageResult productResultByPath = getProductResultByPath(poseTransformation.getProductImage());
|
|
||||||
if (Objects.nonNull(productResultByPath)) {
|
|
||||||
Long parentId = userLikeGroupService.getParentIdByElementIdAndElementType(productResultByPath.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue());
|
|
||||||
poseTransformationVO.setParentId(parentId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
poseTransformationVOS.add(poseTransformationVO);
|
|
||||||
}
|
|
||||||
return poseTransformationVOS;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public void updatePoseTransferStatus(String taskId, String status){
|
public void updatePoseTransferStatus(String taskId, String status){
|
||||||
PoseTransformation poseTransformation = poseTransformationMapper.selectOne(new QueryWrapper<PoseTransformation>().eq("unique_id", taskId));
|
PoseTransformation poseTransformation = poseTransformationMapper.selectOne(new QueryWrapper<PoseTransformation>().eq("unique_id", taskId));
|
||||||
|
|
||||||
@@ -1830,12 +1794,12 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
if (likeOrDislike.equals("like")) {
|
if (likeOrDislike.equals("like")) {
|
||||||
poseTransformation.setIsLiked((byte) 1);
|
poseTransformation.setIsLiked((byte) 1);
|
||||||
if (null != collectionSortParentId) {
|
if (null != collectionSortParentId) {
|
||||||
collectionSort = designService.addCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, collectionSortParentId);
|
collectionSort = collectionSortService.addCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, collectionSortParentId);
|
||||||
}
|
}
|
||||||
} else if (likeOrDislike.equals("dislike")) {
|
} else if (likeOrDislike.equals("dislike")) {
|
||||||
poseTransformation.setIsLiked((byte) 0);
|
poseTransformation.setIsLiked((byte) 0);
|
||||||
if (null != collectionSortParentId) {
|
if (null != collectionSortParentId) {
|
||||||
designService.deleteCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, collectionSortParentId);
|
collectionSortService.deleteCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, collectionSortParentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
poseTransformation.setUpdateTime(LocalDateTime.now());
|
poseTransformation.setUpdateTime(LocalDateTime.now());
|
||||||
@@ -2070,11 +2034,11 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
log.info("taskIdBatch:{}", taskIdBatch);
|
log.info("taskIdBatch:{}", taskIdBatch);
|
||||||
if (progress.equals("OK")) {
|
if (progress.equals("OK")) {
|
||||||
if (!StringUtils.isEmpty(taskIdBatch)) {
|
if (!StringUtils.isEmpty(taskIdBatch)) {
|
||||||
userLikeGroupService.completeTask(taskIdBatch);
|
cloudTaskService.completeTask(taskIdBatch);
|
||||||
}
|
}
|
||||||
}else if (progress.startsWith("0/")) {
|
}else if (progress.startsWith("0/")) {
|
||||||
if (!StringUtils.isEmpty(taskIdBatch)) {
|
if (!StringUtils.isEmpty(taskIdBatch)) {
|
||||||
userLikeGroupService.startTask(taskIdBatch);
|
cloudTaskService.startTask(taskIdBatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,6 +137,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
private ProductImageService productImageService;
|
private ProductImageService productImageService;
|
||||||
@Resource
|
@Resource
|
||||||
private CollectionElementRelModelMapper collectionElementRelModelMapper;
|
private CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||||
|
@Resource
|
||||||
|
private CollectionSortService collectionSortService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteUserGroup(Long userGroupId) {
|
public void deleteUserGroup(Long userGroupId) {
|
||||||
@@ -496,7 +498,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
// 满足条件情况下默认添加到like
|
// 满足条件情况下默认添加到like
|
||||||
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
|
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
|
||||||
// 重新排序
|
// 重新排序
|
||||||
Integer reSort = rearrangeChildSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(),
|
Integer reSort = collectionSortService.rearrangeChildSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(),
|
||||||
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
|
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
|
||||||
// 将生成结果的排序返回
|
// 将生成结果的排序返回
|
||||||
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
||||||
@@ -551,7 +553,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
// 满足条件情况下默认添加到like
|
// 满足条件情况下默认添加到like
|
||||||
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
|
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
|
||||||
// 重新排序
|
// 重新排序
|
||||||
Integer reSort = rearrangeChildSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(),
|
Integer reSort = collectionSortService.rearrangeChildSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(),
|
||||||
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
|
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
|
||||||
// 将生成结果的排序返回
|
// 将生成结果的排序返回
|
||||||
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
||||||
@@ -583,43 +585,6 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 只有当使用子集中的元素进行生成时,才需要重新排序
|
|
||||||
* @param childId 生成元素的id
|
|
||||||
* @param parentId 父级id
|
|
||||||
* @param relationType 生成功能
|
|
||||||
* @param userLikeSortId 子集排序表中的id
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
public Integer rearrangeChildSort(Long childId, String relationType, Long parentId, Long userLikeSortId) {
|
|
||||||
// 对父级元素进行生成不需要重新排序
|
|
||||||
if (Objects.isNull(userLikeSortId) || parentId.equals(userLikeSortId)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 相同的relation_id,relation_type重复排序,有脏数据
|
|
||||||
List<CollectionSort> childList = collectionSortMapper.selectList(
|
|
||||||
new QueryWrapper<CollectionSort>().eq("relation_id", childId)
|
|
||||||
.eq("relation_type", relationType).orderByDesc("id"));
|
|
||||||
if (childList.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}else if (childList.size() > 1){
|
|
||||||
log.error("CollectionSort表中,relation_id为{},relation_type为{}的记录有 {} 条,", childId, relationType, childList.size());
|
|
||||||
}
|
|
||||||
CollectionSort child = childList.get(0);
|
|
||||||
CollectionSort collectionSort = collectionSortMapper.selectById(userLikeSortId);
|
|
||||||
if (Objects.isNull(collectionSort)){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
child.setSort(collectionSort.getSort());
|
|
||||||
// 原来排序的大于等于userLikeSortId的排序的,都要+1
|
|
||||||
collectionSortMapper.increaseGenerateSortAbove(parentId, relationType, collectionSort.getSort() - 1);
|
|
||||||
// 当前的生成结果则填入userLikeSortId的排序位置
|
|
||||||
child.setUpdateTime(LocalDateTime.now());
|
|
||||||
collectionSortMapper.updateById(child);
|
|
||||||
return collectionSort.getSort();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void toProduct(String taskId) {
|
public void toProduct(String taskId) {
|
||||||
@@ -720,11 +685,11 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
CollectionSort collectionSort = null;
|
CollectionSort collectionSort = null;
|
||||||
if (toProductImageResult1.getResultType().equals("Relight")) {
|
if (toProductImageResult1.getResultType().equals("Relight")) {
|
||||||
if (null != productImageLikeDTO.getCollectionSortParentId()) {
|
if (null != productImageLikeDTO.getCollectionSortParentId()) {
|
||||||
collectionSort = designService.addCollectionSort(toProductImageResult1.getId(), CollectionType.RELIGHT.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getCollectionSortParentId());
|
collectionSort = collectionSortService.addCollectionSort(toProductImageResult1.getId(), CollectionType.RELIGHT.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getCollectionSortParentId());
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if (null != productImageLikeDTO.getCollectionSortParentId()) {
|
if (null != productImageLikeDTO.getCollectionSortParentId()) {
|
||||||
collectionSort = designService.addCollectionSort(toProductImageResult1.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getCollectionSortParentId());
|
collectionSort = collectionSortService.addCollectionSort(toProductImageResult1.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getCollectionSortParentId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 更新项目更新时间
|
// 更新项目更新时间
|
||||||
@@ -798,7 +763,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
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));
|
||||||
|
|
||||||
Long parentId = getParentIdByElementIdAndElementType(toProductImageResult.getElementId(), toProductImageResult.getElementType());
|
Long parentId = collectionSortService.getParentIdByElementIdAndElementType(toProductImageResult.getElementId(), toProductImageResult.getElementType());
|
||||||
magicToolResultVO.setParentId(parentId);
|
magicToolResultVO.setParentId(parentId);
|
||||||
}else {
|
}else {
|
||||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResult.getElementId());
|
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResult.getElementId());
|
||||||
@@ -809,7 +774,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
List<UserLike> userLikeList = userLikeMapper.selectList(userLikeQueryWrapper);
|
List<UserLike> userLikeList = userLikeMapper.selectList(userLikeQueryWrapper);
|
||||||
if (!CollectionUtils.isEmpty(userLikeList)) {
|
if (!CollectionUtils.isEmpty(userLikeList)) {
|
||||||
UserLike userLike = userLikeList.get(0);
|
UserLike userLike = userLikeList.get(0);
|
||||||
Long parentId = getParentIdByElementIdAndElementType(userLike.getId(), toProductImageResult.getElementType());
|
Long parentId = collectionSortService.getParentIdByElementIdAndElementType(userLike.getId(), toProductImageResult.getElementType());
|
||||||
magicToolResultVO.setParentId(parentId);
|
magicToolResultVO.setParentId(parentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -823,36 +788,6 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getParentIdByElementIdAndElementType(Long elementId, String elementType) {
|
|
||||||
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
|
||||||
qw.lambda().eq(CollectionSort::getRelationId, elementId);
|
|
||||||
|
|
||||||
elementType = transElementType(elementType);
|
|
||||||
qw.lambda().eq(CollectionSort::getRelationType, elementType);
|
|
||||||
List<CollectionSort> collectionSortList = collectionSortMapper.selectList(qw);
|
|
||||||
if (CollectionUtils.isEmpty(collectionSortList)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
CollectionSort collectionSort = collectionSortList.get(0);
|
|
||||||
Long parentId = collectionSort.getParentId();
|
|
||||||
if (parentId == null) {
|
|
||||||
return collectionSort.getId();
|
|
||||||
}
|
|
||||||
return collectionSort.getParentId();
|
|
||||||
}
|
|
||||||
|
|
||||||
private String transElementType(String elementType) {
|
|
||||||
if (elementType.equals("DesignOutfit")) {
|
|
||||||
return CollectionType.DESIGN.getValue();
|
|
||||||
}else if (elementType.equals("ToProductImage")) {
|
|
||||||
return CollectionType.TO_PRODUCT_IMAGE.getValue();
|
|
||||||
}else if (elementType.equals("PoseTransfer")) {
|
|
||||||
return CollectionType.POSE_TRANSFORM.getValue();
|
|
||||||
}else {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private MagicToolResultVO processFluxResult(String fluxImgMinioPath, ToProductImageResult toProductImageResult, String taskId, String prompt){
|
private MagicToolResultVO processFluxResult(String fluxImgMinioPath, ToProductImageResult toProductImageResult, String taskId, String prompt){
|
||||||
toProductImageResult.setTaskStatus("Success");
|
toProductImageResult.setTaskStatus("Success");
|
||||||
toProductImageResult.setUrl(fluxImgMinioPath);
|
toProductImageResult.setUrl(fluxImgMinioPath);
|
||||||
@@ -872,7 +807,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
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));
|
||||||
|
|
||||||
Long parentId = getParentIdByElementIdAndElementType(toProductImageResult.getElementId(), toProductImageResult.getElementType());
|
Long parentId = collectionSortService.getParentIdByElementIdAndElementType(toProductImageResult.getElementId(), toProductImageResult.getElementType());
|
||||||
magicToolResultVO.setParentId(parentId);
|
magicToolResultVO.setParentId(parentId);
|
||||||
} else if (toProductImageResult.getElementType().equals("DesignOutfit")){
|
} else if (toProductImageResult.getElementType().equals("DesignOutfit")){
|
||||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResult.getElementId());
|
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResult.getElementId());
|
||||||
@@ -883,18 +818,18 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
List<UserLike> userLikeList = userLikeMapper.selectList(userLikeQueryWrapper);
|
List<UserLike> userLikeList = userLikeMapper.selectList(userLikeQueryWrapper);
|
||||||
if (!CollectionUtils.isEmpty(userLikeList)) {
|
if (!CollectionUtils.isEmpty(userLikeList)) {
|
||||||
UserLike userLike = userLikeList.get(0);
|
UserLike userLike = userLikeList.get(0);
|
||||||
Long parentId = getParentIdByElementIdAndElementType(userLike.getId(), toProductImageResult.getElementType());
|
Long parentId = collectionSortService.getParentIdByElementIdAndElementType(userLike.getId(), toProductImageResult.getElementType());
|
||||||
magicToolResultVO.setParentId(parentId);
|
magicToolResultVO.setParentId(parentId);
|
||||||
}
|
}
|
||||||
} else if (toProductImageResult.getElementType().equals("ToProductImage")){
|
} else if (toProductImageResult.getElementType().equals("ToProductImage")){
|
||||||
ToProductImageResult toProductImage = toProductImageResultMapper.selectById(toProductImageResult.getElementId());
|
ToProductImageResult toProductImage = toProductImageResultMapper.selectById(toProductImageResult.getElementId());
|
||||||
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImage.getUrl(), 24 * 60));
|
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImage.getUrl(), 24 * 60));
|
||||||
|
|
||||||
Long parentId = getParentIdByElementIdAndElementType(toProductImageResult.getElementId(), toProductImageResult.getElementType());
|
Long parentId = collectionSortService.getParentIdByElementIdAndElementType(toProductImageResult.getElementId(), toProductImageResult.getElementType());
|
||||||
magicToolResultVO.setParentId(parentId);
|
magicToolResultVO.setParentId(parentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Long parentId = getParentIdByElementIdAndElementType(toProductImageResult.getId(), toProductImageResult.getResultType());
|
// Long parentId = collectionSortService.getParentIdByElementIdAndElementType(toProductImageResult.getId(), toProductImageResult.getResultType());
|
||||||
// magicToolResultVO.setParentId(parentId);
|
// magicToolResultVO.setParentId(parentId);
|
||||||
return magicToolResultVO;
|
return magicToolResultVO;
|
||||||
}
|
}
|
||||||
@@ -1048,11 +983,11 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
toProductImageResultMapper.updateById(toProductImageResult);
|
toProductImageResultMapper.updateById(toProductImageResult);
|
||||||
if (toProductImageResult.getResultType().equals(CollectionType.RELIGHT.getValue())) {
|
if (toProductImageResult.getResultType().equals(CollectionType.RELIGHT.getValue())) {
|
||||||
if (null != productImageLikeDTO.getCollectionSortParentId()) {
|
if (null != productImageLikeDTO.getCollectionSortParentId()) {
|
||||||
designService.deleteCollectionSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getCollectionSortParentId());
|
collectionSortService.deleteCollectionSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getCollectionSortParentId());
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if (null != productImageLikeDTO.getCollectionSortParentId()) {
|
if (null != productImageLikeDTO.getCollectionSortParentId()) {
|
||||||
designService.deleteCollectionSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getCollectionSortParentId());
|
collectionSortService.deleteCollectionSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getCollectionSortParentId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1200,7 +1135,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
// 满足条件情况下默认添加到like
|
// 满足条件情况下默认添加到like
|
||||||
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
|
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
|
||||||
// 重新排序
|
// 重新排序
|
||||||
Integer reSort = rearrangeChildSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(),
|
Integer reSort = collectionSortService.rearrangeChildSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(),
|
||||||
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
|
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
|
||||||
// 将生成结果的排序返回
|
// 将生成结果的排序返回
|
||||||
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
||||||
@@ -1245,7 +1180,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
// 满足条件情况下默认添加到like
|
// 满足条件情况下默认添加到like
|
||||||
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
|
Integer sort = addToProductLike(toProductImageVO.getParentId(), toProductImageResult.getId(), toProductImageDTO.getProjectId());
|
||||||
// 重新排序
|
// 重新排序
|
||||||
Integer reSort = rearrangeChildSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(),
|
Integer reSort = collectionSortService.rearrangeChildSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(),
|
||||||
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
|
toProductImageVO.getParentId(), toProductImageVO.getUserLikeSortId());
|
||||||
// 将生成结果的排序返回
|
// 将生成结果的排序返回
|
||||||
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
toProductImageResult.setSort(Objects.isNull(reSort) ? sort : reSort);
|
||||||
@@ -1331,7 +1266,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResult.getElementId());
|
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResult.getElementId());
|
||||||
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
|
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
|
||||||
}
|
}
|
||||||
Long parentId = getParentIdByElementIdAndElementType(toProductImageResult.getElementId(), toProductImageResult.getElementType());
|
Long parentId = collectionSortService.getParentIdByElementIdAndElementType(toProductImageResult.getElementId(), toProductImageResult.getElementType());
|
||||||
magicToolResultVO.setParentId(parentId);
|
magicToolResultVO.setParentId(parentId);
|
||||||
}
|
}
|
||||||
} else if (Objects.isNull(magicToolResultVO)) {
|
} else if (Objects.isNull(magicToolResultVO)) {
|
||||||
@@ -3051,29 +2986,4 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
toProductElementVO.setUrl(minioUtil.getPreSignedUrl(toProductElementVO.getUrl(), 24 * 60));
|
toProductElementVO.setUrl(minioUtil.getPreSignedUrl(toProductElementVO.getUrl(), 24 * 60));
|
||||||
return toProductElementVO;
|
return toProductElementVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void startTask(String batchTaskId) {
|
|
||||||
QueryWrapper<CloudTask> qw = new QueryWrapper<>();
|
|
||||||
qw.lambda().eq(CloudTask::getTaskId, batchTaskId);
|
|
||||||
CloudTask cloudTask = cloudTaskMapper.selectOne(qw);
|
|
||||||
cloudTask.setStartTime(LocalDateTime.now());
|
|
||||||
cloudTaskMapper.updateById(cloudTask);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void completeTask(String batchTaskId) {
|
|
||||||
QueryWrapper<CloudTask> qw = new QueryWrapper<>();
|
|
||||||
qw.lambda().eq(CloudTask::getTaskId, batchTaskId);
|
|
||||||
CloudTask cloudTask = cloudTaskMapper.selectOne(qw);
|
|
||||||
cloudTask.setStatus(1);
|
|
||||||
// cloudTask.setCompletedNum(cloudTask.getNums());
|
|
||||||
cloudTask.setUpdateTime(LocalDateTime.now());
|
|
||||||
cloudTaskMapper.updateById(cloudTask);
|
|
||||||
|
|
||||||
// 扣除积分
|
|
||||||
Boolean b = creditsService.taskCreditsDeduction(cloudTask.getAccountId(), cloudTask.getTaskId());
|
|
||||||
// 记录积分变更
|
|
||||||
if (b) creditsService.updateChangedCredits(String.valueOf(cloudTask.getAccountId()), cloudTask.getTaskId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user