refactor(biz): 优化代码中的条件判断逻辑

- 将 Integer 类型的比较改为 Boolean 类型的比较,提高代码可读性和性能
- 修改涉及 scenicConfig 的条件判断,使用 Boolean.TRUE进行比较
- 优化部分代码结构,保持逻辑一致性
This commit is contained in:
2025-08-27 16:40:32 +08:00
parent f2ac6aaea0
commit 98bbaccb3a
3 changed files with 7 additions and 7 deletions

View File

@@ -50,10 +50,10 @@ public class PriceBiz {
}).forEach(goodsList::add);
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
if (scenicConfig != null) {
if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) {
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceVideo())) {
goodsList.add(new GoodsListRespVO(1L, "录像集"));
}
if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceImage())) {
if (!Boolean.TRUE.equals(scenicConfig.getDisableSourceImage())) {
goodsList.add(new GoodsListRespVO(2L, "照片集"));
}
}

View File

@@ -139,9 +139,9 @@ public class GoodsServiceImpl implements GoodsService {
List<SourceRespVO> goods = faceEntry.getValue();
return goods.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).keySet().stream().filter(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)) {
return !Integer.valueOf(1).equals(scenicConfig.getDisableSourceImage());
return !Boolean.TRUE.equals(scenicConfig.getDisableSourceImage());
}
return true;
}).map(type -> {

View File

@@ -324,7 +324,7 @@ public class FaceServiceImpl implements FaceService {
}
} 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 photoCount = memberSourceEntityList.stream().filter(item -> item.getType().equals(2)).count();
if (photoCount > videoCount) {
@@ -443,7 +443,7 @@ public class FaceServiceImpl implements FaceService {
sourceVideoContent.setLockType(-1);
sourceImageContent.setLockType(-1);
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);
sourceImageContent.setSourceType(isBuyRespVO.getGoodsType());
sourceImageContent.setContentId(isBuyRespVO.getGoodsId());
@@ -462,7 +462,7 @@ public class FaceServiceImpl implements FaceService {
sourceImageContent.setFreeCount((int) freeCount);
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);
sourceVideoContent.setSourceType(isBuyRespVO.getGoodsType());
sourceVideoContent.setContentId(isBuyRespVO.getGoodsId());