You've already forked FrameTour-BE
refactor(biz): 优化代码中的条件判断逻辑
- 将 Integer 类型的比较改为 Boolean 类型的比较,提高代码可读性和性能 - 修改涉及 scenicConfig 的条件判断,使用 Boolean.TRUE进行比较 - 优化部分代码结构,保持逻辑一致性
This commit is contained in:
@@ -50,10 +50,10 @@ public class PriceBiz {
|
|||||||
}).forEach(goodsList::add);
|
}).forEach(goodsList::add);
|
||||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||||
if (scenicConfig != null) {
|
if (scenicConfig != null) {
|
||||||
if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) {
|
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceVideo())) {
|
||||||
goodsList.add(new GoodsListRespVO(1L, "录像集"));
|
goodsList.add(new GoodsListRespVO(1L, "录像集"));
|
||||||
}
|
}
|
||||||
if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceImage())) {
|
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceImage())) {
|
||||||
goodsList.add(new GoodsListRespVO(2L, "照片集"));
|
goodsList.add(new GoodsListRespVO(2L, "照片集"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -139,9 +139,9 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
List<SourceRespVO> goods = faceEntry.getValue();
|
List<SourceRespVO> goods = faceEntry.getValue();
|
||||||
return goods.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).keySet().stream().filter(type -> {
|
return goods.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).keySet().stream().filter(type -> {
|
||||||
if (Integer.valueOf(1).equals(type)) {
|
if (Integer.valueOf(1).equals(type)) {
|
||||||
return !Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo());
|
return !Boolean.TRUE.equals(scenicConfig.getDisableSourceVideo());
|
||||||
} else if (Integer.valueOf(2).equals(type)) {
|
} else if (Integer.valueOf(2).equals(type)) {
|
||||||
return !Integer.valueOf(1).equals(scenicConfig.getDisableSourceImage());
|
return !Boolean.TRUE.equals(scenicConfig.getDisableSourceImage());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}).map(type -> {
|
}).map(type -> {
|
||||||
|
@@ -324,7 +324,7 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 重新切视频逻辑
|
// 重新切视频逻辑
|
||||||
if (scenicConfig != null && !Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) {
|
if (scenicConfig != null && !Boolean.TRUE.equals(scenicConfig.getDisableSourceVideo())) {
|
||||||
long videoCount = memberSourceEntityList.stream().filter(item -> item.getType().equals(1)).count();
|
long videoCount = memberSourceEntityList.stream().filter(item -> item.getType().equals(1)).count();
|
||||||
long photoCount = memberSourceEntityList.stream().filter(item -> item.getType().equals(2)).count();
|
long photoCount = memberSourceEntityList.stream().filter(item -> item.getType().equals(2)).count();
|
||||||
if (photoCount > videoCount) {
|
if (photoCount > videoCount) {
|
||||||
@@ -443,7 +443,7 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
sourceVideoContent.setLockType(-1);
|
sourceVideoContent.setLockType(-1);
|
||||||
sourceImageContent.setLockType(-1);
|
sourceImageContent.setLockType(-1);
|
||||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(faceRespVO.getScenicId());
|
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(faceRespVO.getScenicId());
|
||||||
if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceImage())) {
|
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceImage())) {
|
||||||
IsBuyRespVO isBuyRespVO = orderBiz.isBuy(userId, faceRespVO.getScenicId(), 2, faceId);
|
IsBuyRespVO isBuyRespVO = orderBiz.isBuy(userId, faceRespVO.getScenicId(), 2, faceId);
|
||||||
sourceImageContent.setSourceType(isBuyRespVO.getGoodsType());
|
sourceImageContent.setSourceType(isBuyRespVO.getGoodsType());
|
||||||
sourceImageContent.setContentId(isBuyRespVO.getGoodsId());
|
sourceImageContent.setContentId(isBuyRespVO.getGoodsId());
|
||||||
@@ -462,7 +462,7 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
sourceImageContent.setFreeCount((int) freeCount);
|
sourceImageContent.setFreeCount((int) freeCount);
|
||||||
contentList.add(sourceImageContent);
|
contentList.add(sourceImageContent);
|
||||||
}
|
}
|
||||||
if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) {
|
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceVideo())) {
|
||||||
IsBuyRespVO isBuyRespVO = orderBiz.isBuy(userId, faceRespVO.getScenicId(), 1, faceId);
|
IsBuyRespVO isBuyRespVO = orderBiz.isBuy(userId, faceRespVO.getScenicId(), 1, faceId);
|
||||||
sourceVideoContent.setSourceType(isBuyRespVO.getGoodsType());
|
sourceVideoContent.setSourceType(isBuyRespVO.getGoodsType());
|
||||||
sourceVideoContent.setContentId(isBuyRespVO.getGoodsId());
|
sourceVideoContent.setContentId(isBuyRespVO.getGoodsId());
|
||||||
|
Reference in New Issue
Block a user