فهرست منبع

commit 家族圈

Hai Lin 1 هفته پیش
والد
کامیت
7d8f7bba2a

+ 28 - 6
mirage-service/src/main/java/com/mirage/mirageservice/controller/FamilyController.java

@@ -20,6 +20,7 @@ import javax.annotation.Resource;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 /**
@@ -364,22 +365,43 @@ public class FamilyController {
         }
         return familyService.deleteComment(momentsRequest.getCommentId());
     }
-    
-    // TODO 自己发的家族圈列表.
 
+    /**
+     * 自己发的家族圈列表.
+     *
+     * @param pageIndex
+     * @param pageSize
+     * @return
+     */
+    @Auth(value = AuthType.COOKIES)
+    @RequestMapping(value = "/member/moment/self", method = RequestMethod.GET)
+    public Object getUserFamilyMomentsList(@RequestParam Integer pageIndex, @RequestParam Integer pageSize){
+        return familyService.getUserFamilyMomentsList(AppContext.getUid(), pageIndex, pageSize);
+    }
 
+    /**
+     * 家族圈部分可见校验.
+     *
+     * @param memberInfo
+     * @param momentsRequest
+     * @return
+     */
     private boolean checkVisibleLegitimacy(FamilyMemberInfo memberInfo, MomentsRequest momentsRequest){
-        if(momentsRequest.getVisibleType() == 0){
+        if(Objects.equals(momentsRequest.getVisibleType(), MomentsVisibleTypeEnum.ALL_MEMBER.getType())){
             return true;
         }
         // 可见范围:0:全员 1:支系堂派 2:聚落 3:家族内男性 4:出生地
-        if(momentsRequest.getVisibleType() == 1
+        if(Objects.equals(momentsRequest.getVisibleType(), MomentsVisibleTypeEnum.SPECIAL_BRANCH_HALL.getType())
                 && StringUtils.isBlank(memberInfo.getBranchFamilyHall())){
             throw new AppRuntimeException("仅支持发布到自己设置的支系堂派!");
-        } else if (momentsRequest.getVisibleType() == 2
+        } else if (Objects.equals(momentsRequest.getVisibleType(), MomentsVisibleTypeEnum.SPECIAL_CLUSTER_PLACE.getType())
                 && StringUtils.isBlank(memberInfo.getClusterPlace())) {
             throw new AppRuntimeException("仅支持发布到自己设置的聚落!");
-        } else if (momentsRequest.getVisibleType() == 4
+        } else if (Objects.equals(momentsRequest.getVisibleType(), MomentsVisibleTypeEnum.SPECIAL_SEX.getType())
+                && (StringUtils.isBlank(momentsRequest.getVisibleValue())
+                || (!"1".equals(momentsRequest.getVisibleValue()) && !"2".equals(momentsRequest.getVisibleValue())))) {
+            throw new AppRuntimeException("性别可见设置错误!");
+        } else if (Objects.equals(momentsRequest.getVisibleType(), MomentsVisibleTypeEnum.SPECIAL_BIRTH_PLACE.getType())
                 && StringUtils.isBlank(memberInfo.getBirthPlace())) {
             throw new AppRuntimeException("仅支持发布到自己设置的出生第!");
         }

+ 1 - 0
mirage-service/src/main/java/com/mirage/mirageservice/mapper/mysql/FamilyMomentsCommentMapper.java

@@ -23,4 +23,5 @@ public interface FamilyMomentsCommentMapper {
     int updateByPrimaryKey(FamilyMomentsComment record);
 
     List<MomentsCommentsResponse> selectCommentsByMomentId(@Param("momentId")Long momentId);
+
 }

+ 4 - 0
mirage-service/src/main/java/com/mirage/mirageservice/mapper/mysql/FamilyMomentsMapper.java

@@ -23,4 +23,8 @@ public interface FamilyMomentsMapper {
     List<FamilyMoments> selectAllByTypeAndExpireTimeGreaterThanOrExpireTimeAndIsDeletedAndVisibleTypeOrderByPublishTimeDesc(@Param("type")Integer type,@Param("minExpireTime")Long minExpireTime,@Param("expireTime")Long expireTime,@Param("isDeleted")Integer isDeleted,@Param("visibleType")Integer visibleType);
 
     List<FamilyMoments> selectAllMoments(@Param("type")Integer type, @Param("isDeleted")Integer isDeleted, @Param("visibleType")Integer visibleType, @Param("id")Long id, @Param("pageSize")Integer pageSize);
+
+    List<FamilyMoments> selectAllByPublishUidAndIsDeletedOrderByPublishTimeDesc(@Param("publishUid")Long publishUid,@Param("isDeleted")Integer isDeleted);
+
+
 }

+ 20 - 0
mirage-service/src/main/java/com/mirage/mirageservice/service/FamilyService.java

@@ -608,6 +608,26 @@ public class FamilyService {
         familyMomentsCommentMapper.updateByPrimaryKeySelective(familyMomentsComment);
         return true;
     }
+
+    public PageResultVo<FamilyMomentsAndPublishInfo> getUserFamilyMomentsList(Long uid, Integer pageIndex, Integer pageSize){
+        FamilyMemberInfo memberInfo = this.getMemberByUid(uid);
+        if(null == memberInfo){
+            return new PageResultVo<>();
+        }
+        PageHelper.startPage(pageIndex, pageSize);
+        List<FamilyMoments> moments = familyMomentsMapper.selectAllByPublishUidAndIsDeletedOrderByPublishTimeDesc(uid, 0);
+        if(null == moments || moments.isEmpty()){
+            return new PageResultVo<>();
+        }
+        PageResultVo<FamilyMoments> list = PageUtil.convertPageResult(moments);
+        List<FamilyMomentsAndPublishInfo> result = Lists.newArrayList();
+        for(FamilyMoments myMoment : moments){
+            List<MomentsLikeInfo> likeInfoList = familyMomentsLikeMapper.selectMomentLikeListAndMemberInfo(myMoment.getId());
+            List<MomentsCommentsResponse> commentsResponses = familyMomentsCommentMapper.selectCommentsByMomentId(myMoment.getId());
+            result.add(new FamilyMomentsAndPublishInfo(myMoment, memberInfo, likeInfoList, commentsResponses));
+        }
+        return new PageResultVo<>(list.getQuery(), result);
+    }
 }
 
 

+ 1 - 0
mirage-service/src/main/resources/com/mirage/mirageservice/mapper/mysql/FamilyMomentsCommentMapper.xml

@@ -172,4 +172,5 @@
     SELECT * FROM comment_tree
     ORDER BY path;
   </select>
+
 </mapper>

+ 9 - 0
mirage-service/src/main/resources/com/mirage/mirageservice/mapper/mysql/FamilyMomentsMapper.xml

@@ -207,4 +207,13 @@
     </where>
     order by id desc LIMIT #{pageSize,jdbcType=INTEGER}
   </select>
+
+<!--auto generated by MybatisCodeHelper on 2025-10-27-->
+  <select id="selectAllByPublishUidAndIsDeletedOrderByPublishTimeDesc" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from family_moments
+        where publish_uid=#{publishUid,jdbcType=BIGINT} and is_deleted=#{isDeleted,jdbcType=INTEGER} order by
+        publish_time desc
+    </select>
 </mapper>