BUGFIX:生成没出结果之前获取结果报空指针
This commit is contained in:
@@ -316,7 +316,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
}
|
||||
ToProductImageResult toProductImageResult = toProductImageResults.get(0);
|
||||
toProductImageResult.setUrl(url);
|
||||
toProductImageResult.setResultType("ToProductImage");
|
||||
// toProductImageResult.setResultType("ToProductImage");
|
||||
toProductImageResultMapper.updateById(toProductImageResult);
|
||||
|
||||
String key = toProductImageResultKey + ":" + taskId;
|
||||
@@ -829,7 +829,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
pythonService.bright(url, toProductImageResult.getBrightenValue());
|
||||
}
|
||||
toProductImageResult.setUrl(url);
|
||||
toProductImageResult.setResultType("Relight");
|
||||
// toProductImageResult.setResultType("Relight");
|
||||
toProductImageResultMapper.updateById(toProductImageResult);
|
||||
|
||||
String key = relightResultKey + ":" + taskId;
|
||||
|
||||
@@ -485,6 +485,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
||||
}
|
||||
toProductImageResult.setImageStrength(toProductImageDTO.getImageStrength());
|
||||
toProductImageResult.setResultType("ToProductImage");
|
||||
toProductImageResultMapper.insert(toProductImageResult);
|
||||
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||
result.add(toProductImageResult);
|
||||
@@ -526,6 +527,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
toProductImageResult.setUserLikeGroupId(userLikeGroupId);
|
||||
}
|
||||
toProductImageResult.setImageStrength(toProductImageDTO.getImageStrength());
|
||||
toProductImageResult.setResultType("ToProductImage");
|
||||
toProductImageResultMapper.insert(toProductImageResult);
|
||||
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||
result.add(toProductImageResult);
|
||||
@@ -1081,6 +1083,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
toProductImageResult.setBrightenValue(toProductImageDTO.getBrightenValue());
|
||||
}
|
||||
toProductImageResult.setDirection(toProductImageDTO.getDirection());
|
||||
toProductImageResult.setResultType("Relight");
|
||||
toProductImageResultMapper.insert(toProductImageResult);
|
||||
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||
result.add(toProductImageResult);
|
||||
@@ -1112,6 +1115,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
toProductImageResult.setBrightenValue(toProductImageDTO.getBrightenValue());
|
||||
}
|
||||
toProductImageResult.setDirection(toProductImageDTO.getDirection());
|
||||
toProductImageResult.setResultType("Relight");
|
||||
toProductImageResultMapper.insert(toProductImageResult);
|
||||
// toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||
result.add(toProductImageResult);
|
||||
@@ -1781,18 +1785,18 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
for (CollectionSort userLikeSort : childSortList) {
|
||||
if (userLikeSort.getRelationType().equals(CollectionType.TO_PRODUCT_IMAGE.getValue())) {
|
||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
|
||||
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||
toProductImageResult.setUrl(getMinioUrl(toProductImageResult.getUrl()));
|
||||
ToProductImageResultVO toProductImageResultVO = CopyUtil.copyObject(toProductImageResult, ToProductImageResultVO.class);
|
||||
|
||||
if (toProductImageResultVO.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(getMinioUrl(toProductElement.getUrl()));
|
||||
}else if ((toProductImageResultVO.getElementType().equals("DesignOutfit"))) {
|
||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(getMinioUrl(tDesignPythonOutfit.getDesignUrl()));
|
||||
}else {
|
||||
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(getMinioUrl(toProductImageResult1.getUrl()));
|
||||
}
|
||||
toProductImageResultVO.setCollectionType(CollectionType.TO_PRODUCT_IMAGE.getValue());
|
||||
toProductImageResultVO.setSort(userLikeSort.getSort());
|
||||
@@ -1802,18 +1806,18 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
childList.add(toProductImageResultVO);
|
||||
} else if (userLikeSort.getRelationType().equals(CollectionType.RELIGHT.getValue())) {
|
||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
|
||||
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||
toProductImageResult.setUrl(getMinioUrl(toProductImageResult.getUrl()));
|
||||
ToProductImageResultVO toProductImageResultVO = CopyUtil.copyObject(toProductImageResult, ToProductImageResultVO.class);
|
||||
|
||||
if (toProductImageResultVO.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(getMinioUrl(toProductElement.getUrl()));
|
||||
}else if ((toProductImageResultVO.getElementType().equals("DesignOutfit"))) {
|
||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(getMinioUrl(tDesignPythonOutfit.getDesignUrl()));
|
||||
}else {
|
||||
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(getMinioUrl(toProductImageResult1.getUrl()));
|
||||
}
|
||||
toProductImageResultVO.setCollectionType(CollectionType.RELIGHT.getValue());
|
||||
toProductImageResultVO.setSort(userLikeSort.getSort());
|
||||
@@ -1883,19 +1887,19 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
qw.lambda().eq(ToProductImageResult::getResultType, "ToProductImage");
|
||||
List<ToProductImageResult> toProductImageResults = toProductImageResultMapper.selectList(qw);
|
||||
for (ToProductImageResult toProductImageResult : toProductImageResults) {
|
||||
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||
toProductImageResult.setUrl(getMinioUrl(toProductImageResult.getUrl()));
|
||||
}
|
||||
List<ToProductImageResultVO> toProductImageResultVOS = CopyUtil.copyList(toProductImageResults, ToProductImageResultVO.class);
|
||||
for (ToProductImageResultVO toProductImageResultVO : toProductImageResultVOS) {
|
||||
if (toProductImageResultVO.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(getMinioUrl(toProductElement.getUrl()));
|
||||
}else if ((toProductImageResultVO.getElementType().equals("DesignOutfit"))) {
|
||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(getMinioUrl(tDesignPythonOutfit.getDesignUrl()));
|
||||
}else {
|
||||
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(getMinioUrl(toProductImageResult1.getUrl()));
|
||||
}
|
||||
}
|
||||
moduleChooseVO.setToProduct(toProductImageResultVOS);
|
||||
@@ -1910,19 +1914,19 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
qw.lambda().eq(ToProductImageResult::getResultType, "Relight");
|
||||
List<ToProductImageResult> toProductImageResults = toProductImageResultMapper.selectList(qw);
|
||||
for (ToProductImageResult toProductImageResult : toProductImageResults) {
|
||||
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||
toProductImageResult.setUrl(getMinioUrl(toProductImageResult.getUrl()));
|
||||
}
|
||||
List<ToProductImageResultVO> toProductImageResultVOS = CopyUtil.copyList(toProductImageResults, ToProductImageResultVO.class);
|
||||
for (ToProductImageResultVO toProductImageResultVO : toProductImageResultVOS) {
|
||||
if (toProductImageResultVO.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(getMinioUrl(toProductElement.getUrl()));
|
||||
}else if ((toProductImageResultVO.getElementType().equals("DesignOutfit"))) {
|
||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(getMinioUrl(tDesignPythonOutfit.getDesignUrl()));
|
||||
}else {
|
||||
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(getMinioUrl(toProductImageResult1.getUrl()));
|
||||
}
|
||||
}
|
||||
moduleChooseVO.setRelight(toProductImageResultVOS);
|
||||
@@ -1987,6 +1991,13 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
return moduleChooseVO;
|
||||
}
|
||||
|
||||
private String getMinioUrl(String minioPath){
|
||||
if (!StringUtil.isNullOrEmpty(minioPath)){
|
||||
return minioUtil.getPreSignedUrl(minioPath, CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private CollectionElementRelModel getCollectionElementRelModel(Long id) {
|
||||
QueryWrapper<CollectionElementRelModel> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(CollectionElementRelModel::getCollectionElementId, id);
|
||||
|
||||
Reference in New Issue
Block a user