BUGFIX:系统模特上传;

This commit is contained in:
shahaibo
2023-10-04 14:58:06 +08:00
parent 9e7ed913ce
commit 00fcdf9cbf
3 changed files with 16 additions and 12 deletions

View File

@@ -12,6 +12,7 @@ import com.ai.da.common.utils.*;
import com.ai.da.mapper.entity.Library;
import com.ai.da.mapper.entity.LibraryModelPoint;
import com.ai.da.model.dto.*;
import com.ai.da.model.enums.ModelType;
import com.ai.da.model.vo.*;
import com.ai.da.service.LibraryModelPointService;
import com.ai.da.service.LibraryService;
@@ -79,7 +80,7 @@ public class LibraryController {
if (StringUtils.isEmpty(modelType)) {
throw new BusinessException("modelType can't be null");
}
if (StringUtils.isEmpty(sex)) {
if (modelType.equals(ModelType.SYSTEM.getValue()) && StringUtils.isEmpty(sex)) {
throw new BusinessException("sex can't be null");
}
FileVO fileVO = FileUtil.getFileSize(file);

View File

@@ -447,17 +447,18 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
// Assert.notNull(modelPoint, "template cannot by empty!");
// Library library = libraryService.getById(modelPoint.getLibraryId());
// Assert.notNull(library, "template library cannot by empty!");
if (designDTO.getModelType().equals(ModelType.LIBRARY.getValue())) {
Library byId = libraryService.getById(designDTO.getTemplateId());
QueryWrapper<LibraryModelPoint> qw = new QueryWrapper<>();
qw.lambda().eq(LibraryModelPoint::getModelType, ModelType.LIBRARY.getValue());
qw.lambda().eq(LibraryModelPoint::getRelationId, byId.getId());
LibraryModelPoint modelPoint = libraryModelPointService.getOne(qw);
if (Objects.isNull(modelPoint)) {
throw new BusinessException("error modelPoint get");
}
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint,1654,1170,byId.getUrl()));
}
// if (designDTO.getModelType().equals(ModelType.LIBRARY.getValue())) {
// Library byId = libraryService.getById(designDTO.getTemplateId());
// QueryWrapper<LibraryModelPoint> qw = new QueryWrapper<>();
// qw.lambda().eq(LibraryModelPoint::getModelType, ModelType.LIBRARY.getValue());
// qw.lambda().eq(LibraryModelPoint::getRelationId, byId.getId());
// LibraryModelPoint modelPoint = libraryModelPointService.getOne(qw);
// if (Objects.isNull(modelPoint)) {
// throw new BusinessException("error modelPoint get");
// }
// elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint,1654,1170,byId.getUrl()));
// }
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(null,null,null,null));
}
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(null,null,null,null));
return elementVO;

View File

@@ -38,6 +38,7 @@ import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -505,6 +506,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
DesignItemDetailPrint print = new DesignItemDetailPrint();
print.setDesignItemDetailId(designItemDetail.getId());
print.setPath(designItemDetail.getPrintPath());
print.setCreateDate(LocalDateTime.now());
designItemDetailPrintService.save(print);
}
}