TASK:workspace、design模块代码;

This commit is contained in:
shahaibo
2023-09-14 13:19:54 +08:00
parent dc9957accf
commit e007d2353e
6 changed files with 48 additions and 33 deletions

View File

@@ -1,26 +1,12 @@
package com.ai.da.controller;
import com.ai.da.common.context.UserContext;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.Response;
import com.ai.da.common.utils.CopyUtil;
import com.ai.da.common.utils.MinioUtil;
import com.ai.da.mapper.entity.Account;
import com.ai.da.mapper.entity.UserLikeGroup;
import com.ai.da.mapper.entity.Workspace;
import com.ai.da.model.dto.QueryHistoryPageDTO;
import com.ai.da.model.dto.WorkspaceDTO;
import com.ai.da.model.enums.BizJson;
import com.ai.da.model.vo.AuthPrincipalVo;
import com.ai.da.model.vo.UserLikeGroupVO;
import com.ai.da.model.vo.UserLikeVO;
import com.ai.da.model.vo.WorkspaceVO;
import com.ai.da.service.WorkspaceService;
import com.baomidou.mybatisplus.core.conditions.query.Query;
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.google.common.base.Function;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -28,21 +14,12 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 控制器
@@ -61,8 +38,10 @@ public class WorkspaceController {
@Resource
private MinioUtil minIoUtil;
@Value("${minio.endpoint}")
private static String address;
@Value("${minio.bucketName}")
private static String bucketName;

View File

@@ -50,6 +50,11 @@ public class TDesignPythonOutfitDetail implements Serializable {
*/
@ApiModelProperty(value = "图层")
private String imageCategory;
/**
* imageSize
*/
@ApiModelProperty(value = "imageSize")
private String imageSize;
/**
* 对应的图片的绝对路径
*/

File diff suppressed because one or more lines are too long

View File

@@ -240,7 +240,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
// pythonObjects增加image_id关联
relationImageId(pythonObjects);
//design
JSONObject responseJSONObject= pythonService.designNew(pythonObjects);
JSONObject responseJSONObject = pythonService.designNew(pythonObjects);
//生成library
generateLibrary(elementVO,designDTO.getTimeZone());
//处理关联关系,修复element覆盖得情况
@@ -262,7 +262,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
for (DesignPythonItem item : o.getItems()) {
String path = item.getPath();
if (StringUtils.isEmpty(path)) {
item.setImageId(null);
String bodyPath = item.getBody_path();
Long imageId = pythonTAllInfoService.getImageIdByPath(bodyPath);
item.setImageId(imageId);
}else {
Long imageId = pythonTAllInfoService.getImageIdByPath(path);
item.setImageId(imageId);
@@ -364,6 +366,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
Long designItemId = designItemService.saveOne(designItem);
// python design返回入库及封装
JSONObject outfit = data.getJSONObject(i + "");
if (null == outfit) {
continue;
}
TDesignPythonOutfit designPythonOutfit = new TDesignPythonOutfit();
designPythonOutfit.setDesignItemId(designItemId);
designPythonOutfit.setUserId(userInfo.getId());
@@ -378,7 +383,30 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
TDesignPythonOutfitDetail designPythonOutfitDetail = new TDesignPythonOutfitDetail();
designPythonOutfitDetail.setDesignId(designId);
designPythonOutfitDetail.setDesignPythonOutfitId(designPythonOutfit.getId());
designPythonOutfitDetail.setPosition(jsonObject.getString("position"));
JSONArray position = jsonObject.getJSONArray("position");
if (position != null && !CollectionUtils.isEmpty(position)) {
StringBuilder builder = null;
for (int i2 = 0; i2 < position.size(); i2++) {
if (i2 != position.size() - 1) {
builder.append(position.getInteger(i2)).append(",");
}else {
builder.append(position.getInteger(i2));
}
}
designPythonOutfitDetail.setPosition(builder.toString());
}
JSONArray imageSize = jsonObject.getJSONArray("image_size");
if (imageSize != null && !CollectionUtils.isEmpty(position)) {
StringBuilder builder = null;
for (int i2 = 0; i2 < imageSize.size(); i2++) {
if (i2 != imageSize.size() - 1) {
builder.append(imageSize.getInteger(i2)).append(",");
}else {
builder.append(imageSize.getInteger(i2));
}
}
designPythonOutfitDetail.setImageSize(builder.toString());
}
designPythonOutfitDetail.setImageUrl(jsonObject.getString("image_url"));
designPythonOutfitDetail.setImageCategory(jsonObject.getString("image_category"));
designPythonOutfitDetail.setMaskUrl(jsonObject.getString("mask_url"));
@@ -470,6 +498,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
}
private List<Long> getElementId(ValidateElementVO elementVO){
List<Long> elementIds = Lists.newArrayList();
// collection type
if(CollectionUtil.isNotEmpty(elementVO.getSketchBoardElements())){
elementIds.addAll(elementVO.getSketchBoardElements().stream().map(CollectionElement::getId).collect(Collectors.toList()));
}
@@ -479,9 +508,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
if(CollectionUtil.isNotEmpty(elementVO.getPrintBoardElements())){
elementIds.addAll(elementVO.getPrintBoardElements().stream().map(CollectionElement::getId).collect(Collectors.toList()));
}
if(CollectionUtil.isNotEmpty(elementVO.getMarketingSketchElements())){
elementIds.addAll(elementVO.getMarketingSketchElements().stream().map(CollectionElement::getId).collect(Collectors.toList()));
}
// if(CollectionUtil.isNotEmpty(elementVO.getMarketingSketchElements())){
// elementIds.addAll(elementVO.getMarketingSketchElements().stream().map(CollectionElement::getId).collect(Collectors.toList()));
// }
return elementIds;
}

View File

@@ -122,8 +122,8 @@ public class PanToneServiceImpl extends ServiceImpl<PanToneMapper, PanTone> impl
@Override
public List<PantoneVO> getRgbByHsvBatch(List<GetRgbByHsvBatchDTO> hsvBatch) {
if(hsvBatch.size() >15){
throw new BusinessException("hsv value cannot exceed the maximum of 15");
if(hsvBatch.size() >8){
throw new BusinessException("hsv value cannot exceed the maximum of 8");
}
List<Integer> colorValues = Lists.newArrayList();
Map<Integer,GetRgbByHsvBatchDTO> valueToHsv = Maps.newHashMap();

View File

@@ -12,6 +12,7 @@
<result column="image_url" property="imageUrl"/>
<result column="mask_url" property="maskUrl"/>
<result column="position" property="position"/>
<result column="imageSize" property="image_size"/>
<result column="user_id" property="userId"/>
<result column="create_date" property="createDate"/>
<result column="update_date" property="updateDate"/>