TASK: 系统模特高宽调整;全局异常优化;
This commit is contained in:
@@ -35,6 +35,10 @@ public class DesignCollectionDTO {
|
||||
@ApiModelProperty("系统取图比列")
|
||||
private BigDecimal systemScale;
|
||||
|
||||
@NotNull(message = "templateId.cannot.be.empty")
|
||||
@ApiModelProperty("模特ID")
|
||||
private Long templateId;
|
||||
|
||||
@NotBlank(message = "modelType.cannot.be.empty")
|
||||
@ApiModelProperty("模特类型:System,Library")
|
||||
private String modelType;
|
||||
@@ -43,10 +47,6 @@ public class DesignCollectionDTO {
|
||||
@ApiModelProperty("模特性别")
|
||||
private String modelSex;
|
||||
|
||||
@NotNull(message = "templateId.cannot.be.empty")
|
||||
@ApiModelProperty("模特ID")
|
||||
private Long templateId;
|
||||
|
||||
@ApiModelProperty("mood版本id 没有传null")
|
||||
private String moodTemplateId;
|
||||
|
||||
|
||||
@@ -12,18 +12,18 @@ import java.math.BigDecimal;
|
||||
@ApiModel("Design like 入参")
|
||||
public class DesignLikeDTO {
|
||||
|
||||
@NotNull(message = "designItemId id cannot be empty!")
|
||||
@NotNull(message = "designItemId.cannot.be.empty")
|
||||
@ApiModelProperty("like图片对应的designItemId")
|
||||
private Long designItemId;
|
||||
|
||||
@NotNull(message = "designPythonOutfitId id cannot be empty!")
|
||||
@NotNull(message = "designPythonOutfitId.cannot.be.empty")
|
||||
@ApiModelProperty("like图片对应的designItemId")
|
||||
private Long designPythonOutfitId;
|
||||
|
||||
@ApiModelProperty("like design到对应collection 对应的userGroupId,不传表示selected collection 为null")
|
||||
private Long userGroupId;
|
||||
|
||||
@NotBlank(message = "timeZone cannot be empty!")
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
}
|
||||
|
||||
@@ -11,15 +11,15 @@ import javax.validation.constraints.NotNull;
|
||||
@ApiModel("Design dislike 入参")
|
||||
public class DisDesignLikeDTO {
|
||||
|
||||
@NotNull(message = "groupDetailId id cannot be empty!")
|
||||
@NotNull(message = "groupDetailId.cannot.be.empty")
|
||||
@ApiModelProperty("dislike图片对应的分组详情id")
|
||||
private Long groupDetailId;
|
||||
|
||||
@NotNull(message = "designId id cannot be empty!")
|
||||
@NotNull(message = "designId.cannot.be.empty")
|
||||
@ApiModelProperty("dislike图片到对应的designId中")
|
||||
private Long designId;
|
||||
|
||||
@NotBlank(message = "timeZone cannot be empty!")
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
@ApiModel("重新设计Collection 入参")
|
||||
public class ReDesignCollectionDTO {
|
||||
|
||||
@NotNull(message = "collectionId id cannot be empty!")
|
||||
@NotNull(message = "collectionId.cannot.be.empty")
|
||||
@ApiModelProperty("collectionId")
|
||||
private Long collectionId;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ReDesignCollectionDTO {
|
||||
@ApiModelProperty("印花板图片 数组")
|
||||
private List<DesignCollectionPrintElementDTO> printBoards;
|
||||
|
||||
@NotEmpty(message = "colorBoardRgbValues cannot be empty!")
|
||||
@NotEmpty(message = "colorBoards.cannot.be.empty")
|
||||
@ApiModelProperty("颜色板RGB值 数组")
|
||||
private List<CollectionColorDTO> colorBoards;
|
||||
|
||||
@@ -34,27 +34,34 @@ public class ReDesignCollectionDTO {
|
||||
@ApiModelProperty("市场手稿板图片id 数组")
|
||||
private List<DesignCollectionElementDTO> marketingSketchs;
|
||||
|
||||
@NotNull(message = "systemScale cannot be empty!")
|
||||
@NotNull(message = "colorBoards.cannot.be.empty")
|
||||
@ApiModelProperty("系统取图比列")
|
||||
private BigDecimal systemScale;
|
||||
|
||||
@ApiModelProperty("templateId")
|
||||
@NotNull(message = "templateId.cannot.be.empty")
|
||||
@ApiModelProperty("模特ID")
|
||||
private Long templateId;
|
||||
|
||||
@NotBlank(message = "modelType.cannot.be.empty")
|
||||
@ApiModelProperty("模特类型:System,Library")
|
||||
private String modelType;
|
||||
|
||||
@NotBlank(message = "modelSex.cannot.be.empty")
|
||||
@ApiModelProperty("模特性别")
|
||||
private String modelSex;
|
||||
|
||||
@NotBlank(message = "singleOverall cannot be empty!")
|
||||
@NotBlank(message = "singleOverall.cannot.be.empty")
|
||||
@ApiModelProperty("控制生成类型的参数,两个选项:outfit时候传 single , 另外一个传 overall")
|
||||
private String singleOverall;
|
||||
|
||||
@ApiModelProperty("single模式下的类别选择参数 选项有outwear,dress,blouse,skirt,trousers")
|
||||
private String switchCategory;
|
||||
|
||||
@NotBlank(message = "timeZone cannot be empty!")
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
|
||||
@NotBlank(message = "processId.cannot.be.empty")
|
||||
@ApiModelProperty("python端design进程ID")
|
||||
private String processId;
|
||||
}
|
||||
|
||||
@@ -509,7 +509,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
} else if (designDTO.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
||||
SysFileVO byId = sysFileService.getById(designDTO.getTemplateId());
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), designDTO.getModelType());
|
||||
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, 680, 200, byId.getUrl()));
|
||||
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, 1050, 500, byId.getUrl()));
|
||||
}
|
||||
elementVO.setModelSex(designDTO.getModelSex());
|
||||
return elementVO;
|
||||
|
||||
@@ -62,9 +62,7 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
|
||||
|
||||
@Override
|
||||
public Collection findById(Long id) {
|
||||
QueryWrapper<Collection> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("id", id);
|
||||
return collectionMapper.selectOne(queryWrapper);
|
||||
return collectionMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ 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;
|
||||
@@ -28,6 +29,7 @@ import com.google.common.collect.Lists;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -592,10 +594,13 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public DesignCollectionVO reDesignCollection(ReDesignCollectionDTO reDesignDTO) {
|
||||
//校验collection
|
||||
Collection collection = collectionService.findById(reDesignDTO.getCollectionId());
|
||||
Assert.notNull(collection, "Collection does not exist!");
|
||||
Collection collection = collectionService.getById(reDesignDTO.getCollectionId());
|
||||
if (Objects.isNull(collection)) {
|
||||
throw new BusinessException("collection.not.find");
|
||||
}
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
//查询用户 sketch library
|
||||
List<LibraryVo> libraryVos = libraryService.selectByAccountIdAnd1TypeList(userInfo.getId(),
|
||||
@@ -633,8 +638,10 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
|
||||
@Override
|
||||
public DesignCollectionVO designItemList(Long designId) {
|
||||
Design design = getById(designId);
|
||||
Assert.notNull(design, "design does not exist!");
|
||||
Design design = baseMapper.selectById(designId);
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.not.find");
|
||||
}
|
||||
List<DesignItem> designItems = designItemService.getByDesignId(designId);
|
||||
if (CollectionUtils.isEmpty(designItems)) {
|
||||
return new DesignCollectionVO(designId, design.getCollectionId(), null, null);
|
||||
@@ -651,27 +658,34 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public DesignLikeVO like(DesignLikeDTO designLikeDTO) {
|
||||
Long userGroupId = null;
|
||||
Long groupDetailId = null;
|
||||
Long userGroupId = designLikeDTO.getUserGroupId();;
|
||||
Long groupDetailId;
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
DesignItem designItem = designItemService.getById(designLikeDTO.getDesignItemId());
|
||||
Assert.notNull(designItem, "designItem does not exist!");
|
||||
if (Objects.isNull(designItem)) {
|
||||
throw new BusinessException("designItem.not.find");
|
||||
}
|
||||
String pictureName = null;
|
||||
UserLike userLike = null;
|
||||
if (Objects.nonNull(designLikeDTO.getUserGroupId())) {
|
||||
userGroupId = designLikeDTO.getUserGroupId();
|
||||
|
||||
UserLikeGroup userLikeGroup = userLikeGroupService.getById(designLikeDTO.getUserGroupId());
|
||||
Assert.notNull(userLikeGroup, "History does not exist!");
|
||||
UserLike userLike;
|
||||
if (Objects.nonNull(userGroupId)) {
|
||||
UserLikeGroup userLikeGroup = userLikeGroupService.getById(userGroupId);
|
||||
if (Objects.isNull(userLikeGroup)) {
|
||||
throw new BusinessException("userLikeGroup.not.find");
|
||||
}
|
||||
// if(designItem.getCollectionId().equals(userLikeGroup.getCollectionId())){
|
||||
// //相同collection直接跳过 不需要往element加元素
|
||||
// return new DesignLikeVO();
|
||||
// }
|
||||
List<CollectionElement> oldElements = collectionElementService.getByCollectionId(userLikeGroup.getCollectionId());
|
||||
Assert.notEmpty(oldElements, "old elements does not exist!");
|
||||
if (CollectionUtil.isEmpty(oldElements)) {
|
||||
throw new BusinessException("old.elements.not.find");
|
||||
}
|
||||
List<DesignItemDetail> designItemDetails = designItemDetailService.selectByDesignItemId(designLikeDTO.getDesignItemId());
|
||||
Assert.notEmpty(designItemDetails, "new designItemDetails does not exist!");
|
||||
if (CollectionUtil.isEmpty(designItemDetails)) {
|
||||
throw new BusinessException("new.designItemDetails.not.find");
|
||||
}
|
||||
//判断老的element合并到新的是否满足 数量不超过15
|
||||
List<Long> newElementIds = validateMergeElement(oldElements, designItemDetails);
|
||||
//合并,关联新的element到collection
|
||||
@@ -685,7 +699,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
if (CollectionUtils.isEmpty(tDesignPythonOutfits)) {
|
||||
throw new BusinessException("DesignItemId not found elements for ax elements to like! [" + designLikeDTO.getDesignItemId());
|
||||
}
|
||||
userLike = resolveUserLike(designLikeDTO.getUserGroupId(), designItem.getDesignId(),
|
||||
userLike = resolveUserLike(userGroupId, designItem.getDesignId(),
|
||||
designLikeDTO.getDesignItemId(), designLikeDTO.getDesignPythonOutfitId(), tDesignPythonOutfits.get(0).getDesignUrl(), designLikeDTO.getTimeZone());
|
||||
|
||||
} else {
|
||||
@@ -893,29 +907,28 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
.url("http://18.167.251.121:9991/api/get_progress")
|
||||
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
|
||||
.method("POST", body)
|
||||
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
.addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = null;
|
||||
Response response;
|
||||
try {
|
||||
response = client.newCall(request).execute();
|
||||
} catch (IOException ioException) {
|
||||
log.error("PythonService##design进度条异常###{}", ExceptionUtil.getThrowableList(ioException));
|
||||
}
|
||||
//去除限流
|
||||
// AccessLimitUtils.validateOut("design");
|
||||
if (Objects.isNull(response)) {
|
||||
log.error("PythonService##design进度条异常###{}", "response or body is empty!");
|
||||
throw new BusinessException("system error!");
|
||||
} catch (IOException e) {
|
||||
log.error("PythonService##design进度条异常###{}", ExceptionUtil.getThrowableList(e));
|
||||
return 0;
|
||||
}
|
||||
if (response.isSuccessful()) {
|
||||
try {
|
||||
String responseBody = response.body().string();
|
||||
JSONObject responseObject = JSON.parseObject(responseBody);
|
||||
String num = responseObject.getString("data");
|
||||
return Integer.valueOf(num);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
if (Objects.nonNull(response.body())) {
|
||||
String responseBody = response.body().string();
|
||||
JSONObject responseObject = JSON.parseObject(responseBody);
|
||||
String num = responseObject.getString("data");
|
||||
return Integer.valueOf(num);
|
||||
}
|
||||
return 0;
|
||||
} catch (IOException | JSONException e) {
|
||||
log.error("PythonService##design进度条异常###{}", ExceptionUtil.getThrowableList(e));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user