TASK: cloud、posetransfer、sort;
This commit is contained in:
@@ -114,8 +114,8 @@ public class GenerateController {
|
||||
|
||||
@ApiOperation("喜欢或取消喜欢姿势变换生成的图片")
|
||||
@PostMapping("/likeOrDislike")
|
||||
public Response<Object> likeOrDislike(@ApiParam("id") @RequestParam Long transformedId, @ApiParam("like || dislike") @RequestParam String likeOrDislike, @RequestParam("projectId") Long projectId) {
|
||||
return Response.success(generateService.disOrLikePose(transformedId, likeOrDislike, projectId));
|
||||
public Response<Object> likeOrDislike(@ApiParam("id") @RequestParam Long transformedId, @ApiParam("like || dislike") @RequestParam String likeOrDislike, @RequestParam("projectId") Long projectId, @RequestParam("sortLikeParentId") Long sortLikeParentId) {
|
||||
return Response.success(generateService.disOrLikePose(transformedId, likeOrDislike, projectId, sortLikeParentId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改模特比例")
|
||||
|
||||
@@ -25,5 +25,5 @@ public class CollectionSort implements Serializable {
|
||||
private Long relationId;
|
||||
private String relationType;
|
||||
|
||||
// private Long parentId;
|
||||
private Long parentId;
|
||||
}
|
||||
@@ -8,4 +8,6 @@ import java.util.List;
|
||||
public class ProductImageLikeDTO {
|
||||
private List<Long> toProductImageResultId;
|
||||
private Long projectId;
|
||||
|
||||
private Long sortLikeParentId;
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ public interface DesignService extends IService<Design> {
|
||||
*/
|
||||
DesignLikeVO like(DesignLikeDTO designLikeDTO);
|
||||
|
||||
CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId);
|
||||
CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long parentId);
|
||||
|
||||
int getNextSort(Long projectId);
|
||||
int getNextSort(Long projectId, Long parentId);
|
||||
|
||||
/**
|
||||
* dislike
|
||||
@@ -73,7 +73,7 @@ public interface DesignService extends IService<Design> {
|
||||
*/
|
||||
Boolean dislike(DisDesignLikeDTO disDesignLikeDTO);
|
||||
|
||||
void deleteCollectionSort(Long relationId, String relationType, Long projectId);
|
||||
void deleteCollectionSort(Long relationId, String relationType, Long projectId, Long parentId);
|
||||
|
||||
CollectionSort getUserLikeSortByUserLikeId(Long userLikeId, String relationType, Long projectId);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public interface GenerateService extends IService<Generate> {
|
||||
|
||||
List<PoseTransformationVO> getPoseTransformationResultList(Long projectId, boolean like);
|
||||
|
||||
Object disOrLikePose(Long transformedId, String likeOrDislike, Long projectId);
|
||||
Object disOrLikePose(Long transformedId, String likeOrDislike, Long projectId, Long sortLikeParentId);
|
||||
|
||||
String modifyModelProportion(ModifyModelProportionDTO proportionDTO);
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.google.common.collect.Lists;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
import org.apache.catalina.User;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -1209,7 +1210,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}
|
||||
userLikeService.save(userLike);
|
||||
Long userLikeSortId;
|
||||
CollectionSort userLikeSort = addCollectionSort(userLike.getId(), CollectionType.DESIGN.getValue(), designLikeDTO.getProjectId());
|
||||
CollectionSort userLikeSort = addCollectionSort(userLike.getId(), CollectionType.DESIGN.getValue(), designLikeDTO.getProjectId(), null);
|
||||
userLikeSortId = userLikeSort.getId();
|
||||
groupDetailId = userLike.getId();
|
||||
String designUrl = designPythonOutfitMapper.selectById(userLike.getDesignOutfitId()).getDesignUrl();
|
||||
@@ -1246,8 +1247,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId) {
|
||||
int sort = getNextSort(projectId);
|
||||
public CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long sortParentId) {
|
||||
int sort = getNextSort(projectId, sortParentId);
|
||||
CollectionSort userLikeSort = new CollectionSort();
|
||||
// userLikeSort.setUserLikeGroupId(userGroupId);
|
||||
// userLikeSort.setUserLikeId(relationId);
|
||||
@@ -1255,14 +1256,20 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
userLikeSort.setRelationId(relationId);
|
||||
userLikeSort.setRelationType(relationType);
|
||||
userLikeSort.setSort(sort);
|
||||
if (null != sortParentId) {
|
||||
userLikeSort.setParentId(sortParentId);
|
||||
}
|
||||
collectionSortMapper.insert(userLikeSort);
|
||||
return userLikeSort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextSort(Long projectId) {
|
||||
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);
|
||||
}
|
||||
List<CollectionSort> userLikeSorts = collectionSortMapper.selectList(qw);
|
||||
if (CollectionUtils.isEmpty(userLikeSorts)) {
|
||||
return 1;
|
||||
@@ -1348,16 +1355,19 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
// userLikeGroupService.removeById(userLike.getUserLikeGroupId());
|
||||
}
|
||||
|
||||
deleteCollectionSort(userLike.getId(), CollectionType.DESIGN.getValue(), disDesignLikeDTO.getProjectId());
|
||||
deleteCollectionSort(userLike.getId(), CollectionType.DESIGN.getValue(), disDesignLikeDTO.getProjectId(), null);
|
||||
//删除对应的history
|
||||
userLikeService.removeById(disDesignLikeDTO.getGroupDetailId());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCollectionSort(Long relationId, String relationType, Long projectId) {
|
||||
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);
|
||||
}
|
||||
qw.lambda().orderByDesc(CollectionSort::getSort);
|
||||
List<CollectionSort> userLikeSorts = collectionSortMapper.selectList(qw);
|
||||
CollectionSort userLikeSort = getUserLikeSortByUserLikeId(relationId, relationType, projectId);
|
||||
@@ -1858,11 +1868,11 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
|
||||
@Override
|
||||
public String designCloud(CloudTaskDTO cloudTaskDTO) {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
if (cloudTaskDTO.getBuildType().equals(BuildType.DESIGN.getValue())) {
|
||||
Long projectId = cloudTaskDTO.getProjectId();
|
||||
DesignCollectionDTO designDTO = transDesignParam(projectId);
|
||||
designDTO.setDesignNum(cloudTaskDTO.getNums());
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
|
||||
//校验collection element
|
||||
ValidateElementVO elementVO = collectionElementService.validateElement(designDTO);
|
||||
@@ -2046,6 +2056,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
cloudTask.setCreateTime(now);
|
||||
cloudTask.setUpdateTime(now);
|
||||
cloudTask.setStatus(0);
|
||||
cloudTask.setAccountId(userInfo.getId());
|
||||
cloudTaskMapper.insert(cloudTask);
|
||||
return batchTaskId;
|
||||
}else if (cloudTaskDTO.getBuildType().equals(BuildType.RELIGHT.getValue())) {
|
||||
|
||||
@@ -1225,36 +1225,46 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
List<PoseTransformationVO> vos = new ArrayList<>();
|
||||
if (poseTransformations != null && poseTransformations.size() > 1){
|
||||
poseTransformations.forEach(item -> {
|
||||
PoseTransformationVO poseTransformationVO = new PoseTransformationVO();
|
||||
if (StringUtils.isNotBlank(item.getVideoUrl())) {
|
||||
String taskId = item.getUniqueId();
|
||||
String key = generateResultKey + ":" + taskId;
|
||||
String resultJson = redisUtil.getFromString(key);
|
||||
|
||||
if (!StringUtil.isNullOrEmpty(resultJson)) {
|
||||
PoseTransformationVO poseTransformationVO = new Gson().fromJson(redisUtil.getFromString(key), PoseTransformationVO.class);
|
||||
poseTransformationVO.setId(item.getId());
|
||||
poseTransformationVO.setProductImage(minioUtil.getPreSignedUrl(item.getProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
poseTransformationVO.setGifUrl(minioUtil.getPreSignedUrl(item.getGifUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
poseTransformationVO.setVideoUrl(minioUtil.getPreSignedUrl(item.getVideoUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
poseTransformationVO.setFirstFrameUrl(minioUtil.getPreSignedUrl(item.getFirstFrameUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
poseTransformationVO.setIsLiked(item.getIsLiked());
|
||||
poseTransformationVO.setStatus("Success");
|
||||
}else {
|
||||
poseTransformationVO.setTaskId(item.getUniqueId());
|
||||
poseTransformationVO.setStatus("Invalid");
|
||||
if (poseTransformationVO.getStatus().equals("Success")) {
|
||||
poseTransformationVO.setProductImage(minioUtil.getPreSignedUrl(item.getProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
if (!poseTransformationVO.getGifUrl().equals("None")) {
|
||||
poseTransformationVO.setGifUrl(minioUtil.getPreSignedUrl(poseTransformationVO.getGifUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
}
|
||||
if (!poseTransformationVO.getVideoUrl().equals("None")) {
|
||||
poseTransformationVO.setVideoUrl(minioUtil.getPreSignedUrl(poseTransformationVO.getVideoUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
}
|
||||
if (!poseTransformationVO.getFirstFrameUrl().equals("None")) {
|
||||
poseTransformationVO.setFirstFrameUrl(minioUtil.getPreSignedUrl(poseTransformationVO.getFirstFrameUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
}
|
||||
}
|
||||
if (!poseTransformationVO.getStatus().equals("Invalid") && !poseTransformationVO.getStatus().equals("Failed")) {
|
||||
vos.add(poseTransformationVO);
|
||||
}
|
||||
}
|
||||
vos.add(poseTransformationVO);
|
||||
});
|
||||
}
|
||||
return vos;
|
||||
}
|
||||
|
||||
public Object disOrLikePose(Long transformedId, String likeOrDislike, Long projectId){
|
||||
public Object disOrLikePose(Long transformedId, String likeOrDislike, Long projectId, Long sortLikeParentId){
|
||||
PoseTransformation poseTransformation = poseTransformationMapper.selectById(transformedId);
|
||||
Long collectionSortId = null;
|
||||
if (Objects.nonNull(poseTransformation)){
|
||||
if (likeOrDislike.equals("like")){
|
||||
poseTransformation.setIsLiked((byte)1);
|
||||
CollectionSort collectionSort = designService.addCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId);
|
||||
CollectionSort collectionSort = designService.addCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, sortLikeParentId);
|
||||
collectionSortId = collectionSort.getId();
|
||||
}else if (likeOrDislike.equals("dislike")){
|
||||
poseTransformation.setIsLiked((byte)0);
|
||||
designService.deleteCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId);
|
||||
designService.deleteCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, sortLikeParentId);
|
||||
}
|
||||
poseTransformation.setUpdateTime(LocalDateTime.now());
|
||||
poseTransformationMapper.updateById(poseTransformation);
|
||||
|
||||
@@ -611,10 +611,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultId.get(0));
|
||||
Long collectionSortId = null;
|
||||
if (toProductImageResult1.getResultType().equals("Relight")) {
|
||||
CollectionSort collectionSort = designService.addCollectionSort(toProductImageResult1.getId(), CollectionType.RELIGHT.getValue(), productImageLikeDTO.getProjectId());
|
||||
CollectionSort collectionSort = designService.addCollectionSort(toProductImageResult1.getId(), CollectionType.RELIGHT.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getSortLikeParentId());
|
||||
collectionSortId = collectionSort.getId();
|
||||
}else {
|
||||
CollectionSort collectionSort = designService.addCollectionSort(toProductImageResult1.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), productImageLikeDTO.getProjectId());
|
||||
CollectionSort collectionSort = designService.addCollectionSort(toProductImageResult1.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getSortLikeParentId());
|
||||
collectionSortId = collectionSort.getId();
|
||||
}
|
||||
return collectionSortId;
|
||||
@@ -853,9 +853,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
toProductImageResult.setIsLike(0);
|
||||
toProductImageResultMapper.updateById(toProductImageResult);
|
||||
if (toProductImageResult.getResultType().equals("Relight")) {
|
||||
designService.deleteCollectionSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(), productImageLikeDTO.getProjectId());
|
||||
designService.deleteCollectionSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getSortLikeParentId());
|
||||
}else {
|
||||
designService.deleteCollectionSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), productImageLikeDTO.getProjectId());
|
||||
designService.deleteCollectionSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getSortLikeParentId());
|
||||
}
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
|
||||
Reference in New Issue
Block a user