diff --git a/src/main/java/com/ycwl/basic/mapper/SourceMapper.java b/src/main/java/com/ycwl/basic/mapper/SourceMapper.java index 027b303..17bb9f9 100644 --- a/src/main/java/com/ycwl/basic/mapper/SourceMapper.java +++ b/src/main/java/com/ycwl/basic/mapper/SourceMapper.java @@ -68,6 +68,7 @@ public interface SourceMapper { List listVideoByFaceRelation(Long memberId, Long faceId); List listImageByFaceRelation(Long memberId, Long faceId); + List listByFaceRelation(Long memberId, Long faceId, Integer type); SourceEntity getEntity(Long id); diff --git a/src/main/java/com/ycwl/basic/model/mobile/scenic/content/ContentPageVO.java b/src/main/java/com/ycwl/basic/model/mobile/scenic/content/ContentPageVO.java index 7cbe555..93d7d66 100644 --- a/src/main/java/com/ycwl/basic/model/mobile/scenic/content/ContentPageVO.java +++ b/src/main/java/com/ycwl/basic/model/mobile/scenic/content/ContentPageVO.java @@ -34,4 +34,5 @@ public class ContentPageVO { private Integer isBuy; private BigDecimal duration; private Integer goodsType; + private int freeCount; } diff --git a/src/main/java/com/ycwl/basic/service/pc/impl/FaceServiceImpl.java b/src/main/java/com/ycwl/basic/service/pc/impl/FaceServiceImpl.java index 1b36ffc..5a47294 100644 --- a/src/main/java/com/ycwl/basic/service/pc/impl/FaceServiceImpl.java +++ b/src/main/java/com/ycwl/basic/service/pc/impl/FaceServiceImpl.java @@ -418,12 +418,14 @@ public class FaceServiceImpl implements FaceService { } else { sourceImageContent.setIsBuy(0); } - List sourceEntities = sourceMapper.listImageByFaceRelation(faceRespVO.getMemberId(), faceId); - if (!sourceEntities.isEmpty()) { + List relations = sourceMapper.listByFaceRelation(faceRespVO.getMemberId(), faceId, 2); + if (!relations.isEmpty()) { sourceImageContent.setLockType(-1); } else { sourceImageContent.setLockType(1); } + long freeCount = relations.stream().filter(entity -> Integer.valueOf(1).equals(entity.getIsFree())).count(); + sourceImageContent.setFreeCount((int) freeCount); contentList.add(sourceImageContent); } if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) { @@ -435,12 +437,14 @@ public class FaceServiceImpl implements FaceService { } else { sourceVideoContent.setIsBuy(0); } - List sourceEntities = sourceMapper.listVideoByFaceRelation(faceRespVO.getMemberId(), faceId); - if (!sourceEntities.isEmpty()) { + List relations = sourceMapper.listByFaceRelation(faceRespVO.getMemberId(), faceId, 1); + if (!relations.isEmpty()) { sourceVideoContent.setLockType(-1); } else { sourceVideoContent.setLockType(1); } + long freeCount = relations.stream().filter(entity -> Integer.valueOf(1).equals(entity.getIsFree())).count(); + sourceVideoContent.setFreeCount((int) freeCount); contentList.add(sourceVideoContent); } sourceList.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).forEach((type, list) -> { diff --git a/src/main/resources/mapper/SourceMapper.xml b/src/main/resources/mapper/SourceMapper.xml index e024d49..e76ca9a 100644 --- a/src/main/resources/mapper/SourceMapper.xml +++ b/src/main/resources/mapper/SourceMapper.xml @@ -227,4 +227,11 @@ and ms.type = #{type} and ms.face_id = #{faceId} +