TASK:模块化;
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.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;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -34,6 +35,9 @@ public class GenerateConsumer {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserLikeGroupService userLikeGroupService;
|
private UserLikeGroupService userLikeGroupService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DesignService designService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RabbitMQProperties rabbitMQProperties;
|
private RabbitMQProperties rabbitMQProperties;
|
||||||
|
|
||||||
@@ -305,6 +309,15 @@ public class GenerateConsumer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void processDesignBatchResult(Message msg, Channel channel) {
|
||||||
|
log.info("============processDesignBatchResult listening==========");
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
|
Map<String, Object> generateResult = JSONObject.parseObject(msg.getBody(), Map.class);
|
||||||
|
log.info("designBatch response : {}", generateResult);
|
||||||
|
designService.processDesignBatch(generateResult);
|
||||||
|
}
|
||||||
|
|
||||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
|
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
|
||||||
@RabbitHandler
|
@RabbitHandler
|
||||||
public void generateConsumer1(Message msg, Channel channel) {
|
public void generateConsumer1(Message msg, Channel channel) {
|
||||||
@@ -382,4 +395,9 @@ public class GenerateConsumer {
|
|||||||
public void getPoseTransformationResult(Message msg, Channel channel) {
|
public void getPoseTransformationResult(Message msg, Channel channel) {
|
||||||
processPoseTransformResult(msg, channel);
|
processPoseTransformResult(msg, channel);
|
||||||
}
|
}
|
||||||
|
@RabbitListener(queues = "#{rabbitMQProperties.queues.designBatch}")
|
||||||
|
@RabbitHandler
|
||||||
|
public void getDesignBatchResult(Message msg, Channel channel) {
|
||||||
|
processDesignBatchResult(msg, channel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public class RabbitMQProperties {
|
|||||||
private String toProductImageResult;
|
private String toProductImageResult;
|
||||||
private String relightResult;
|
private String relightResult;
|
||||||
private String poseTransform;
|
private String poseTransform;
|
||||||
|
private String designBatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.ai.da.controller;
|
package com.ai.da.controller;
|
||||||
|
|
||||||
import com.ai.da.common.config.exception.BusinessException;
|
import com.ai.da.common.config.exception.BusinessException;
|
||||||
|
import com.ai.da.common.response.PageBaseResponse;
|
||||||
import com.ai.da.common.response.Response;
|
import com.ai.da.common.response.Response;
|
||||||
|
import com.ai.da.mapper.primary.entity.CloudTask;
|
||||||
import com.ai.da.model.dto.*;
|
import com.ai.da.model.dto.*;
|
||||||
import com.ai.da.model.vo.CollectionSketchVO;
|
import com.ai.da.model.vo.*;
|
||||||
import com.ai.da.model.vo.DesignCollectionVO;
|
|
||||||
import com.ai.da.model.vo.DesignLikeVO;
|
|
||||||
import com.ai.da.service.DesignService;
|
import com.ai.da.service.DesignService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -97,8 +97,19 @@ public class DesignController {
|
|||||||
|
|
||||||
@ApiOperation(value = "云生成")
|
@ApiOperation(value = "云生成")
|
||||||
@PostMapping("/designCloud")
|
@PostMapping("/designCloud")
|
||||||
@CrossOrigin
|
public Response<String> designCloud(@Valid @RequestBody CloudTaskDTO cloudTaskDTO) {
|
||||||
public Response<String> designCloud(@Valid @RequestBody DesignCollectionDTO designDTO) {
|
return Response.success(designService.designCloud(cloudTaskDTO));
|
||||||
return Response.success(designService.designCloud(designDTO));
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "云生成page")
|
||||||
|
@PostMapping("/cloudPage")
|
||||||
|
public Response<PageBaseResponse<CloudTaskVO>> cloudPage(@Valid @RequestBody CloudPageDTO cloudPageDTO) {
|
||||||
|
return Response.success(PageBaseResponse.success(designService.cloudPage(cloudPageDTO)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取design云生成结果")
|
||||||
|
@PostMapping("/getDesignCloudResult")
|
||||||
|
public Response<PageBaseResponse<DesignCollectionItemVO>> getDesignCloudResult(@Valid @RequestBody DesignCloudResultQuery designCloudResultQuery) {
|
||||||
|
return Response.success(PageBaseResponse.success(designService.getDesignCloudResult(designCloudResultQuery)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.ai.da.mapper.primary;
|
||||||
|
|
||||||
|
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||||
|
import com.ai.da.mapper.primary.entity.CloudTask;
|
||||||
|
|
||||||
|
public interface CloudTaskMapper extends CommonMapper<CloudTask> {
|
||||||
|
}
|
||||||
47
src/main/java/com/ai/da/mapper/primary/entity/CloudTask.java
Normal file
47
src/main/java/com/ai/da/mapper/primary/entity/CloudTask.java
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package com.ai.da.mapper.primary.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.apache.poi.hpsf.Decimal;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("cloud_task")
|
||||||
|
public class CloudTask implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
private Long collectionId;
|
||||||
|
|
||||||
|
private Long designId;
|
||||||
|
|
||||||
|
private String buildType;
|
||||||
|
|
||||||
|
private Integer nums;
|
||||||
|
|
||||||
|
private Integer completedNum;
|
||||||
|
|
||||||
|
private Decimal costCredits;
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
private String taskId;
|
||||||
|
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@@ -35,6 +35,8 @@ public class Project implements Serializable {
|
|||||||
|
|
||||||
private Long originalPortfolioId;
|
private Long originalPortfolioId;
|
||||||
|
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|||||||
9
src/main/java/com/ai/da/model/dto/CloudPageDTO.java
Normal file
9
src/main/java/com/ai/da/model/dto/CloudPageDTO.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package com.ai.da.model.dto;
|
||||||
|
|
||||||
|
import com.ai.da.model.vo.PageQueryBaseVo;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CloudPageDTO extends PageQueryBaseVo {
|
||||||
|
private Long projectId;
|
||||||
|
}
|
||||||
9
src/main/java/com/ai/da/model/dto/CloudTaskDTO.java
Normal file
9
src/main/java/com/ai/da/model/dto/CloudTaskDTO.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package com.ai.da.model.dto;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.primary.entity.CloudTask;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CloudTaskDTO extends CloudTask {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.ai.da.model.dto;
|
||||||
|
|
||||||
|
import com.ai.da.model.vo.PageQueryBaseVo;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DesignCloudResultQuery extends PageQueryBaseVo {
|
||||||
|
private String taskId;
|
||||||
|
}
|
||||||
9
src/main/java/com/ai/da/model/vo/CloudTaskVO.java
Normal file
9
src/main/java/com/ai/da/model/vo/CloudTaskVO.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package com.ai.da.model.vo;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.primary.entity.CloudTask;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CloudTaskVO extends CloudTask {
|
||||||
|
private String process;
|
||||||
|
}
|
||||||
@@ -5,6 +5,8 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@@ -13,5 +15,5 @@ public class DesignModuleChooseVO {
|
|||||||
private Long userGroupId;
|
private Long userGroupId;
|
||||||
|
|
||||||
@ApiModelProperty("分组详细数组")
|
@ApiModelProperty("分组详细数组")
|
||||||
private java.util.List<UserLikeVO> userLikeDetails;
|
private List<UserLikeVO> userLikeDetails;
|
||||||
}
|
}
|
||||||
|
|||||||
8
src/main/java/com/ai/da/service/CloudTaskService.java
Normal file
8
src/main/java/com/ai/da/service/CloudTaskService.java
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package com.ai.da.service;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.primary.entity.CloudTask;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
public interface CloudTaskService extends IService<CloudTask> {
|
||||||
|
CloudTask getByTaskId(String taskId);
|
||||||
|
}
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
package com.ai.da.service;
|
package com.ai.da.service;
|
||||||
|
|
||||||
|
import com.ai.da.common.response.PageBaseResponse;
|
||||||
import com.ai.da.mapper.primary.entity.Design;
|
import com.ai.da.mapper.primary.entity.Design;
|
||||||
import com.ai.da.model.dto.*;
|
import com.ai.da.model.dto.*;
|
||||||
import com.ai.da.model.vo.CollectionSketchVO;
|
import com.ai.da.model.vo.*;
|
||||||
import com.ai.da.model.vo.DesignCollectionVO;
|
|
||||||
import com.ai.da.model.vo.DesignItemDetailVO;
|
|
||||||
import com.ai.da.model.vo.DesignLikeVO;
|
|
||||||
import com.ai.da.python.vo.DesignPythonObjects;
|
import com.ai.da.python.vo.DesignPythonObjects;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -109,9 +108,13 @@ public interface DesignService extends IService<Design> {
|
|||||||
|
|
||||||
DesignCollectionVO getDesignResult(String requestId, List<String> objectSignList);
|
DesignCollectionVO getDesignResult(String requestId, List<String> objectSignList);
|
||||||
|
|
||||||
String designCloud(DesignCollectionDTO designDTO);
|
String designCloud(CloudTaskDTO cloudTaskDTO);
|
||||||
|
|
||||||
void processDesignBatch(Map<String, Object> designBatchResult);
|
void processDesignBatch(Map<String, Object> designBatchResult);
|
||||||
|
|
||||||
Boolean sort(UserLikeSortDTO userLikeSortDTO);
|
Boolean sort(UserLikeSortDTO userLikeSortDTO);
|
||||||
|
|
||||||
|
IPage<CloudTaskVO> cloudPage(CloudPageDTO cloudPageDTO);
|
||||||
|
|
||||||
|
IPage<DesignCollectionItemVO> getDesignCloudResult(DesignCloudResultQuery designCloudResultQuery);
|
||||||
}
|
}
|
||||||
|
|||||||
28
src/main/java/com/ai/da/service/ProjectService.java
Normal file
28
src/main/java/com/ai/da/service/ProjectService.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package com.ai.da.service;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.primary.entity.Design;
|
||||||
|
import com.ai.da.mapper.primary.entity.Project;
|
||||||
|
import com.ai.da.model.dto.*;
|
||||||
|
import com.ai.da.model.vo.CollectionSketchVO;
|
||||||
|
import com.ai.da.model.vo.DesignCollectionVO;
|
||||||
|
import com.ai.da.model.vo.DesignItemDetailVO;
|
||||||
|
import com.ai.da.model.vo.DesignLikeVO;
|
||||||
|
import com.ai.da.python.vo.DesignPythonObjects;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务类
|
||||||
|
*
|
||||||
|
* @author yanglei
|
||||||
|
* @since 2022-09-11
|
||||||
|
*/
|
||||||
|
public interface ProjectService extends IService<Project> {
|
||||||
|
|
||||||
|
Set<Long> getChildProjectIdSet(Long projectId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.ai.da.service.impl;
|
||||||
|
|
||||||
|
import com.ai.da.mapper.primary.AccountMapper;
|
||||||
|
import com.ai.da.mapper.primary.CloudTaskMapper;
|
||||||
|
import com.ai.da.mapper.primary.entity.Account;
|
||||||
|
import com.ai.da.mapper.primary.entity.CloudTask;
|
||||||
|
import com.ai.da.service.ClassificationService;
|
||||||
|
import com.ai.da.service.CloudTaskService;
|
||||||
|
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 javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class CloudTaskServiceImpl extends ServiceImpl<CloudTaskMapper, CloudTask> implements CloudTaskService {
|
||||||
|
@Resource
|
||||||
|
private CloudTaskMapper cloudTaskMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CloudTask getByTaskId(String taskId) {
|
||||||
|
QueryWrapper<CloudTask> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CloudTask::getTaskId, taskId);
|
||||||
|
return cloudTaskMapper.selectOne(qw);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,10 @@ import com.alibaba.fastjson.JSONException;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -37,6 +40,7 @@ import javax.annotation.Resource;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -116,6 +120,14 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserLikeSortMapper userLikeSortMapper;
|
private UserLikeSortMapper userLikeSortMapper;
|
||||||
|
@Resource
|
||||||
|
private ProjectService projectService;
|
||||||
|
@Resource
|
||||||
|
private WorkspaceService workspaceService;
|
||||||
|
@Resource
|
||||||
|
private CloudTaskMapper cloudTaskMapper;
|
||||||
|
@Resource
|
||||||
|
private CloudTaskService cloudTaskService;
|
||||||
|
|
||||||
private final ConcurrentHashMap<String, Map<String, Object>> designContext = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, Map<String, Object>> designContext = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@@ -1769,23 +1781,164 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String designCloud(DesignCollectionDTO designDTO) {
|
public String designCloud(CloudTaskDTO cloudTaskDTO) {
|
||||||
|
|
||||||
|
Long projectId = cloudTaskDTO.getProjectId();
|
||||||
|
Project project = projectService.getById(projectId);
|
||||||
|
project.setParentId(projectId);
|
||||||
|
project.setId(null);
|
||||||
|
project.setName(project.getName() + "_cloud");
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
project.setCreateTime(now);
|
||||||
|
project.setUpdateTime(now);
|
||||||
|
projectService.getBaseMapper().insert(project);
|
||||||
|
Long workspaceId = workspaceService.getByProjectId(projectId);
|
||||||
|
Workspace workspace = workspaceService.getById(workspaceId);
|
||||||
|
workspace.setProjectId(project.getId());
|
||||||
|
workspace.setId(null);
|
||||||
|
workspaceService.getBaseMapper().insert(workspace);
|
||||||
|
|
||||||
|
DesignCollectionDTO designDTO = transDesignParam(projectId, project.getId());
|
||||||
|
designDTO.setDesignNum(cloudTaskDTO.getNums());
|
||||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||||
|
|
||||||
//校验collection element
|
//校验collection element
|
||||||
ValidateElementVO elementVO = collectionElementService.validateElement(designDTO);
|
ValidateElementVO elementVO = collectionElementService.validateElement(designDTO);
|
||||||
|
|
||||||
//design
|
//design
|
||||||
return designBatch(designDTO, userInfo, null, elementVO);
|
String taskId = designBatch(designDTO, userInfo, null, elementVO, cloudTaskDTO, project.getId());
|
||||||
|
return taskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String designBatch(DesignCollectionDTO designDTO, AuthPrincipalVo userInfo, Long collectionIdParam, ValidateElementVO elementVO) {
|
private DesignCollectionDTO transDesignParam(Long projectId, Long projectIdNew) {
|
||||||
if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
DesignCollectionDTO designCollectionDTO = new DesignCollectionDTO();
|
||||||
//编辑sketchBoard
|
List<CollectionElement> collectionElementList = collectionElementService.getByProjectId(projectId);
|
||||||
collectionElementService.editSketchBoardsElement(elementVO, designDTO.getSketchBoards());
|
if (CollectionUtil.isNotEmpty(collectionElementList)) {
|
||||||
|
Map<String, List<CollectionElement>> groupedMap = collectionElementList.stream().collect(Collectors.groupingBy(CollectionElement::getLevel1Type));
|
||||||
|
if (CollectionUtil.isNotEmpty(groupedMap.get("Moodboard"))) {
|
||||||
|
List<DesignCollectionElementDTO> moodBoards = new ArrayList<>();
|
||||||
|
List<CollectionElement> moodboardList = groupedMap.get("Moodboard");
|
||||||
|
for (CollectionElement collectionElement : moodboardList) {
|
||||||
|
collectionElement.setProjectId(projectIdNew);
|
||||||
|
collectionElement.setCollectionId(null);
|
||||||
|
Date date = new Date();
|
||||||
|
collectionElement.setCreateDate(date);
|
||||||
|
collectionElement.setUpdateDate(date);
|
||||||
|
collectionElement.setId(null);
|
||||||
|
collectionElementService.getBaseMapper().insert(collectionElement);
|
||||||
|
if (collectionElement.getIsCompositeImage() != null && collectionElement.getIsCompositeImage() == 1) {
|
||||||
|
designCollectionDTO.setMoodTemplateId(String.valueOf(collectionElement.getId()));
|
||||||
|
designCollectionDTO.setMoodboardPosition(collectionService.getMoodboardPositionString(collectionElement.getId()));
|
||||||
|
}else {
|
||||||
|
DesignCollectionElementDTO dto = new DesignCollectionElementDTO();
|
||||||
|
dto.setId(collectionElement.getId());
|
||||||
|
dto.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
|
||||||
|
moodBoards.add(dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
designCollectionDTO.setMoodBoards(moodBoards);
|
||||||
|
}else {
|
||||||
|
designCollectionDTO.setMoodBoards(new ArrayList<>());
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(groupedMap.get("Printboard"))) {
|
||||||
|
List<DesignCollectionPrintElementDTO> printBoards = new ArrayList<>();
|
||||||
|
List<CollectionElement> printBoardList = groupedMap.get("Printboard");
|
||||||
|
for (CollectionElement collectionElement : printBoardList) {
|
||||||
|
collectionElement.setProjectId(projectIdNew);
|
||||||
|
collectionElement.setCollectionId(null);
|
||||||
|
Date date = new Date();
|
||||||
|
collectionElement.setCreateDate(date);
|
||||||
|
collectionElement.setUpdateDate(date);
|
||||||
|
collectionElement.setId(null);
|
||||||
|
collectionElementService.getBaseMapper().insert(collectionElement);
|
||||||
|
DesignCollectionPrintElementDTO dto = new DesignCollectionPrintElementDTO();
|
||||||
|
dto.setId(collectionElement.getId());
|
||||||
|
dto.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
|
||||||
|
printBoards.add(dto);
|
||||||
|
}
|
||||||
|
designCollectionDTO.setPrintBoards(printBoards);
|
||||||
|
}else {
|
||||||
|
designCollectionDTO.setPrintBoards(new ArrayList<>());
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(groupedMap.get("Colorboard"))) {
|
||||||
|
List<CollectionColorDTO> colorBoards = new ArrayList<>();
|
||||||
|
List<CollectionElement> colorBoardList = groupedMap.get("Colorboard");
|
||||||
|
for (CollectionElement collectionElement : colorBoardList) {
|
||||||
|
collectionElement.setProjectId(projectIdNew);
|
||||||
|
collectionElement.setCollectionId(null);
|
||||||
|
Date date = new Date();
|
||||||
|
collectionElement.setCreateDate(date);
|
||||||
|
collectionElement.setUpdateDate(date);
|
||||||
|
collectionElement.setId(null);
|
||||||
|
collectionElementService.getBaseMapper().insert(collectionElement);
|
||||||
|
CollectionColorDTO dto = new CollectionColorDTO();
|
||||||
|
String name = collectionElement.getName();
|
||||||
|
if (name.contains("_")) {
|
||||||
|
String[] split = name.split("_");
|
||||||
|
dto.setId(Integer.valueOf(split[0]));
|
||||||
|
dto.setName(split[1]);
|
||||||
|
dto.setTcx(split[2]);
|
||||||
|
}
|
||||||
|
dto.setRgbValue(collectionElement.getColorRgb());
|
||||||
|
if (collectionElement.getGradientString() != null && !collectionElement.getGradientString().equals("null")) {
|
||||||
|
dto.setGradientString(collectionElement.getGradientString());
|
||||||
|
}
|
||||||
|
colorBoards.add(dto);
|
||||||
|
}
|
||||||
|
designCollectionDTO.setColorBoards(colorBoards);
|
||||||
|
}else {
|
||||||
|
designCollectionDTO.setColorBoards(new ArrayList<>());
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(groupedMap.get("Sketchboard"))) {
|
||||||
|
List<CollectionSketchDTO> sketchBoards = new ArrayList<>();
|
||||||
|
List<CollectionElement> sketchBoardList = groupedMap.get("Sketchboard");
|
||||||
|
for (CollectionElement collectionElement : sketchBoardList) {
|
||||||
|
collectionElement.setProjectId(projectIdNew);
|
||||||
|
collectionElement.setCollectionId(null);
|
||||||
|
Date date = new Date();
|
||||||
|
collectionElement.setCreateDate(date);
|
||||||
|
collectionElement.setUpdateDate(date);
|
||||||
|
collectionElement.setId(null);
|
||||||
|
collectionElementService.getBaseMapper().insert(collectionElement);
|
||||||
|
CollectionSketchDTO dto = new CollectionSketchDTO();
|
||||||
|
dto.setSketchBoardId(collectionElement.getId());
|
||||||
|
dto.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
|
||||||
|
dto.setLevel2Type(collectionElement.getLevel2Type());
|
||||||
|
dto.setIsPin(collectionElement.getHasPin());
|
||||||
|
sketchBoards.add(dto);
|
||||||
|
}
|
||||||
|
designCollectionDTO.setSketchBoards(sketchBoards);
|
||||||
|
}else {
|
||||||
|
designCollectionDTO.setSketchBoards(new ArrayList<>());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
designCollectionDTO.setMoodBoards(new ArrayList<>());
|
||||||
|
designCollectionDTO.setPrintBoards(new ArrayList<>());
|
||||||
|
designCollectionDTO.setColorBoards(new ArrayList<>());
|
||||||
|
designCollectionDTO.setSketchBoards(new ArrayList<>());
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(designDTO.getPrintBoards())) {
|
Long workspaceId = workspaceService.getByProjectId(projectIdNew);
|
||||||
//编辑printBoard
|
Workspace workspace = workspaceService.getById(workspaceId);
|
||||||
collectionElementService.editPrintBoardsElement(elementVO, designDTO.getPrintBoards());
|
designCollectionDTO.setSystemScale(
|
||||||
|
BigDecimal.valueOf(workspace.getSystemDesignerPercentage())
|
||||||
|
.divide(BigDecimal.valueOf(100), 4, RoundingMode.HALF_UP)
|
||||||
|
);
|
||||||
|
designCollectionDTO.setModelSex(workspace.getSex());
|
||||||
|
if (workspace.getSex().equals("Female")) {
|
||||||
|
designCollectionDTO.setTemplateId(workspace.getMannequinFemaleId());
|
||||||
|
designCollectionDTO.setModelType(workspace.getMannequinFemaleType());
|
||||||
}
|
}
|
||||||
|
if (workspace.getPosition().equals("Overall")) {
|
||||||
|
designCollectionDTO.setSingleOverall("overall");
|
||||||
|
}else {
|
||||||
|
designCollectionDTO.setSingleOverall("single");
|
||||||
|
designCollectionDTO.setSwitchCategory(workspace.getPosition());
|
||||||
|
}
|
||||||
|
designCollectionDTO.setTimeZone("Etc/GMT-8");
|
||||||
|
return designCollectionDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String designBatch(DesignCollectionDTO designDTO, AuthPrincipalVo userInfo, Long collectionIdParam, ValidateElementVO elementVO, CloudTaskDTO cloudTaskDTO, Long projectId) {
|
||||||
//保存collection
|
//保存collection
|
||||||
Long collectionId;
|
Long collectionId;
|
||||||
if (null == collectionIdParam) {
|
if (null == collectionIdParam) {
|
||||||
@@ -1796,16 +1949,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
List<Long> elementIds = getElementId(elementVO);
|
List<Long> elementIds = getElementId(elementVO);
|
||||||
//批量关联element 到 collection
|
//批量关联element 到 collection
|
||||||
collectionElementService.relationCollection(elementIds, collectionId);
|
collectionElementService.relationCollection(elementIds, collectionId);
|
||||||
//library转化为collection(生成)
|
|
||||||
saveCollectionElemntsByLibrarys(elementVO, collectionId);
|
|
||||||
//generate转化为collection(生成)
|
|
||||||
saveCollectionElemntsByGenerates(elementVO, collectionId);
|
|
||||||
//保存颜色版
|
|
||||||
collectionElementService.saveColorBoard(designDTO.getColorBoards(), collectionId, designDTO.getTimeZone());
|
|
||||||
//保存design
|
//保存design
|
||||||
Long designId = saveOne(designDTO, collectionId, userInfo.getId());
|
Long designId = saveOne(designDTO, collectionId, userInfo.getId());
|
||||||
//计算library
|
|
||||||
// calculateLibraryAndSysFile(designDTO, elementVO, userInfo);
|
|
||||||
//组装design入参
|
//组装design入参
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
DesignPythonObjects pythonObjects = pythonService.covertDesignParam(designDTO.getSystemScale(),
|
DesignPythonObjects pythonObjects = pythonService.covertDesignParam(designDTO.getSystemScale(),
|
||||||
@@ -1826,17 +1972,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||||
String taskId = pythonService.designBatch(pythonObjects, userHolder.getId(), elementVO.getDesignNum(), requestId);
|
String taskId = pythonService.designBatch(pythonObjects, userHolder.getId(), elementVO.getDesignNum(), requestId);
|
||||||
|
|
||||||
DesignBatch designBatch = new DesignBatch();
|
|
||||||
|
|
||||||
designBatch.setAccountId(userInfo.getId());
|
|
||||||
designBatch.setDesignId(designId);
|
|
||||||
designBatch.setCollectionId(collectionId);
|
|
||||||
designBatch.setTaskId(taskId);
|
|
||||||
designBatch.setCreateTime(LocalDateTime.now());
|
|
||||||
designBatch.setStatus(0);
|
|
||||||
designBatch.setTotalNum(elementVO.getDesignNum());
|
|
||||||
designBatchMapper.insert(designBatch);
|
|
||||||
|
|
||||||
endTime = System.currentTimeMillis();
|
endTime = System.currentTimeMillis();
|
||||||
totalTimeInSeconds = (endTime - startTime) / 1000;
|
totalTimeInSeconds = (endTime - startTime) / 1000;
|
||||||
log.info("design python端运行时间:" + totalTimeInSeconds + " 秒");
|
log.info("design python端运行时间:" + totalTimeInSeconds + " 秒");
|
||||||
@@ -1844,9 +1979,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
startTime = System.currentTimeMillis();
|
startTime = System.currentTimeMillis();
|
||||||
generateLibrary(elementVO, designDTO.getTimeZone());
|
generateLibrary(elementVO, designDTO.getTimeZone());
|
||||||
//处理关联关系,修复element覆盖得情况
|
//处理关联关系,修复element覆盖得情况
|
||||||
List<CollectionElement> relationElements = collectionElementService.getByOnlyCollectionId(collectionId);
|
// List<CollectionElement> relationElements = collectionElementService.getByOnlyCollectionId(collectionId);
|
||||||
List<Long> relationElementIds = relationElements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
// List<Long> relationElementIds = relationElements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||||
handleCollectionElementRelation(collectionId, null != collectionIdParam, relationElementIds);
|
// handleCollectionElementRelation(collectionId, null != collectionIdParam, relationElementIds);
|
||||||
endTime = System.currentTimeMillis();
|
endTime = System.currentTimeMillis();
|
||||||
totalTimeInSeconds = (endTime - startTime) / 1000;
|
totalTimeInSeconds = (endTime - startTime) / 1000;
|
||||||
log.info("处理关联关系运行时间:" + totalTimeInSeconds + " 秒");
|
log.info("处理关联关系运行时间:" + totalTimeInSeconds + " 秒");
|
||||||
@@ -1863,6 +1998,15 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
|
|
||||||
// 将上下文存入全局设计上下文中
|
// 将上下文存入全局设计上下文中
|
||||||
designContext.put(taskId, context);
|
designContext.put(taskId, context);
|
||||||
|
CloudTask cloudTask = CopyUtil.copyObject(cloudTaskDTO, CloudTask.class);
|
||||||
|
cloudTask.setProjectId(projectId);
|
||||||
|
cloudTask.setDesignId(designId);
|
||||||
|
cloudTask.setCollectionId(collectionId);
|
||||||
|
cloudTask.setTaskId(taskId);
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
cloudTask.setCreateTime(now);
|
||||||
|
cloudTask.setUpdateTime(now);
|
||||||
|
cloudTaskMapper.insert(cloudTask);
|
||||||
return taskId;
|
return taskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1875,28 +2019,29 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
if (progress.equals("ok")) {
|
if (progress.equals("ok")) {
|
||||||
String taskId = (String) designBatchResult.get("task_id");
|
String taskId = (String) designBatchResult.get("task_id");
|
||||||
QueryWrapper<DesignBatch> qw = new QueryWrapper<>();
|
QueryWrapper<CloudTask> qw = new QueryWrapper<>();
|
||||||
qw.lambda().eq(DesignBatch::getTaskId, taskId);
|
qw.lambda().eq(CloudTask::getTaskId, taskId);
|
||||||
List<DesignBatch> designBatches = designBatchMapper.selectList(qw);
|
List<CloudTask> cloudTaskList = cloudTaskMapper.selectList(qw);
|
||||||
if (CollectionUtil.isNotEmpty(designBatches)) {
|
if (CollectionUtil.isNotEmpty(cloudTaskList)) {
|
||||||
DesignBatch designBatch = designBatches.get(0);
|
CloudTask cloudTask = cloudTaskList.get(0);
|
||||||
designBatch.setStatus(1);
|
cloudTask.setCompletedNum(cloudTask.getNums());
|
||||||
designBatchMapper.updateById(designBatch);
|
cloudTask.setStatus(1);
|
||||||
|
cloudTaskMapper.updateById(cloudTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
String taskId = (String) designBatchResult.get("task_id");
|
String taskId = (String) designBatchResult.get("task_id");
|
||||||
QueryWrapper<DesignBatch> qw = new QueryWrapper<>();
|
QueryWrapper<CloudTask> qw = new QueryWrapper<>();
|
||||||
qw.lambda().eq(DesignBatch::getTaskId, taskId);
|
qw.lambda().eq(CloudTask::getTaskId, taskId);
|
||||||
List<DesignBatch> designBatches = designBatchMapper.selectList(qw);
|
List<CloudTask> cloudTaskList = cloudTaskMapper.selectList(qw);
|
||||||
if (CollectionUtil.isNotEmpty(designBatches)) {
|
if (CollectionUtil.isNotEmpty(cloudTaskList)) {
|
||||||
DesignBatch designBatch = designBatches.get(0);
|
CloudTask cloudTask = cloudTaskList.get(0);
|
||||||
if (designBatch.getCompletedNum() == null) {
|
if (cloudTask.getCompletedNum() == null) {
|
||||||
designBatch.setCompletedNum(1);
|
cloudTask.setCompletedNum(1);
|
||||||
}else {
|
}else {
|
||||||
designBatch.setCompletedNum(designBatch.getCompletedNum() + 1);
|
cloudTask.setCompletedNum(cloudTask.getCompletedNum() + 1);
|
||||||
}
|
}
|
||||||
designBatchMapper.updateById(designBatch);
|
cloudTaskMapper.updateById(cloudTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer i = (Integer) progress;
|
Integer i = (Integer) progress;
|
||||||
@@ -1915,7 +2060,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
String timeZone = (String) context.get("timeZone");
|
String timeZone = (String) context.get("timeZone");
|
||||||
String singleOverall = (String) context.get("singleOverall");
|
String singleOverall = (String) context.get("singleOverall");
|
||||||
|
|
||||||
DesignPythonObject item = pythonObjects.getObjects().get(i);
|
DesignPythonObject item = pythonObjects.getObjects().get(i-1);
|
||||||
DesignItem designItem = new DesignItem();
|
DesignItem designItem = new DesignItem();
|
||||||
designItem.setAccountId(userInfo.getId());
|
designItem.setAccountId(userInfo.getId());
|
||||||
designItem.setCollectionId(collectionId);
|
designItem.setCollectionId(collectionId);
|
||||||
@@ -2029,12 +2174,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// for (int i = 0; i < pythonObjects.getObjects().size(); i++) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// response.setProcessId(pythonObjects.getProcess_id());
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2050,4 +2189,71 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<CloudTaskVO> cloudPage(CloudPageDTO cloudPageDTO) {
|
||||||
|
// 分页数据
|
||||||
|
Set<Long> childProjectIdSet = projectService.getChildProjectIdSet(cloudPageDTO.getProjectId());
|
||||||
|
|
||||||
|
QueryWrapper<CloudTask> queryWrapper = new QueryWrapper<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(childProjectIdSet)) {
|
||||||
|
queryWrapper.lambda().in(CloudTask::getProjectId, childProjectIdSet);
|
||||||
|
}else {
|
||||||
|
return new Page<>();
|
||||||
|
}
|
||||||
|
IPage<CloudTask> page = cloudTaskMapper.selectPage(
|
||||||
|
new Page<>(cloudPageDTO.getPage(), cloudPageDTO.getSize()), queryWrapper);
|
||||||
|
if (CollectionUtils.isEmpty(page.getRecords())) {
|
||||||
|
return new Page<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
IPage<CloudTaskVO> convert = page.convert((Function<CloudTask, CloudTaskVO>) cloudTask -> {
|
||||||
|
if (cloudTask != null) {
|
||||||
|
CloudTaskVO cloudTaskVO = CopyUtil.copyObject(cloudTask, CloudTaskVO.class);
|
||||||
|
if (cloudTaskVO.getCompletedNum() == null) {
|
||||||
|
cloudTaskVO.setProcess("0%");
|
||||||
|
}else {
|
||||||
|
BigDecimal completed = BigDecimal.valueOf(cloudTaskVO.getCompletedNum());
|
||||||
|
BigDecimal total = BigDecimal.valueOf(cloudTaskVO.getNums());
|
||||||
|
|
||||||
|
BigDecimal percent = completed
|
||||||
|
.divide(total, 4, RoundingMode.HALF_UP) // 先计算小数百分比,保留4位防止精度问题
|
||||||
|
.multiply(BigDecimal.valueOf(100)) // 乘以100变成百分比
|
||||||
|
.setScale(2, RoundingMode.HALF_UP); // 最终保留2位小数
|
||||||
|
|
||||||
|
cloudTaskVO.setProcess(percent.toPlainString() + "%");
|
||||||
|
}
|
||||||
|
return cloudTaskVO;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
return convert;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<DesignCollectionItemVO> getDesignCloudResult(DesignCloudResultQuery query) {
|
||||||
|
CloudTask cloudTask = cloudTaskService.getByTaskId(query.getTaskId());
|
||||||
|
if (Objects.nonNull(cloudTask)) {
|
||||||
|
Long collectionId = cloudTask.getCollectionId();
|
||||||
|
if (null != collectionId) {
|
||||||
|
QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(TDesignPythonOutfit::getCollectionId, collectionId);
|
||||||
|
Page<TDesignPythonOutfit> page = designPythonOutfitMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw);
|
||||||
|
IPage<DesignCollectionItemVO> convert = page.convert((Function<TDesignPythonOutfit, DesignCollectionItemVO>) outfit -> {
|
||||||
|
if (outfit != null) {
|
||||||
|
DesignCollectionItemVO vo = new DesignCollectionItemVO();
|
||||||
|
vo.setDesignOutfitId(outfit.getId());
|
||||||
|
vo.setDesignOutfitUrl(minioUtil.getPreSignedUrl(outfit.getDesignUrl(), 24 * 60));
|
||||||
|
vo.setDesignItemId(outfit.getDesignItemId());
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
return convert;
|
||||||
|
}else {
|
||||||
|
return new Page<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Page<>();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
68
src/main/java/com/ai/da/service/impl/ProjectServiceImpl.java
Normal file
68
src/main/java/com/ai/da/service/impl/ProjectServiceImpl.java
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
package com.ai.da.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
|
import com.ai.da.common.config.FileProperties;
|
||||||
|
import com.ai.da.common.config.exception.BusinessException;
|
||||||
|
import com.ai.da.common.constant.CommonConstant;
|
||||||
|
import com.ai.da.common.context.UserContext;
|
||||||
|
import com.ai.da.common.enums.CollectionLevel1TypeEnum;
|
||||||
|
import com.ai.da.common.enums.DesignTypeEnum;
|
||||||
|
import com.ai.da.common.enums.SingleOverallEnum;
|
||||||
|
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
|
||||||
|
import com.ai.da.common.utils.*;
|
||||||
|
import com.ai.da.mapper.primary.*;
|
||||||
|
import com.ai.da.mapper.primary.entity.Collection;
|
||||||
|
import com.ai.da.mapper.primary.entity.*;
|
||||||
|
import com.ai.da.model.dto.*;
|
||||||
|
import com.ai.da.model.vo.*;
|
||||||
|
import com.ai.da.python.PythonService;
|
||||||
|
import com.ai.da.python.vo.*;
|
||||||
|
import com.ai.da.service.*;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONException;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import io.netty.util.internal.StringUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import okhttp3.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.ai.da.python.vo.DesignPythonItem.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements ProjectService {
|
||||||
|
@Resource
|
||||||
|
private ProjectMapper projectMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Long> getChildProjectIdSet(Long projectId) {
|
||||||
|
QueryWrapper<Project> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(Project::getParentId, projectId);
|
||||||
|
List<Project> projectList = projectMapper.selectList(qw);
|
||||||
|
if (CollectionUtil.isNotEmpty(projectList)) {
|
||||||
|
return projectList.stream().map(Project::getId).collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
return new HashSet<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1283,6 +1283,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
queryWrapper.eq("account_id", authPrincipalVo.getId());
|
queryWrapper.eq("account_id", authPrincipalVo.getId());
|
||||||
|
queryWrapper.isNull("parent_id");
|
||||||
if (!StringUtils.isEmpty(query.getProjectName())) {
|
if (!StringUtils.isEmpty(query.getProjectName())) {
|
||||||
queryWrapper.like("name", query.getProjectName());
|
queryWrapper.like("name", query.getProjectName());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ rabbitmq.queues.toProductImageResult=ToProductImage-dev
|
|||||||
rabbitmq.queues.relightResult=Relight-dev
|
rabbitmq.queues.relightResult=Relight-dev
|
||||||
rabbitmq.queues.poseTransform=PoseTransform-dev
|
rabbitmq.queues.poseTransform=PoseTransform-dev
|
||||||
rabbitmq.exchange.generate=generate-exchange
|
rabbitmq.exchange.generate=generate-exchange
|
||||||
|
rabbitmq.queues.designBatch=DesignBatch
|
||||||
|
|
||||||
orderList.link=https://develop.aida.com.hk/home/homePage?order=
|
orderList.link=https://develop.aida.com.hk/home/homePage?order=
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user