Administrator
2 days ago fe70ca5db711b458714bfbe4a6eda6cf7d8a0421
src/main/java/cc/mrbird/febs/mall/service/impl/HappyActivityServiceImpl.java
@@ -29,6 +29,7 @@
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
@@ -62,6 +63,7 @@
    private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
    private final HappyMemberLevelMapper happyMemberLevelMapper;
    private final IMallMoneyFlowService mallMoneyFlowService;
    private final ClothesSocialMapper clothesSocialMapper;
    @Override
    public FebsResponse activityList(ApiActivityInfoDto dto) {
@@ -78,13 +80,23 @@
                // 查询关注点赞转发记录,筛选出关注活动类型且未删除的关注记录,并按ID升序排序,限制结果数量为3
                List<HappyFollow> happyFollows = happyFollowMapper.selectList(
                        new LambdaQueryWrapper<HappyFollow>()
                                .select(HappyFollow::getMemberId)
                                .eq(HappyFollow::getSourceType, StateUpDownEnum.SOURCE_TYPE_ACTIVITY.getCode())
                                .eq(HappyFollow::getSourceId, record.getId())
                                .eq(HappyFollow::getDeleteFlag, StateUpDownEnum.DOWN.getCode())
                                .groupBy(HappyFollow::getMemberId)
                                .orderByAsc(HappyFollow::getId)
                                .last("limit 3")
                );
//                // 查询关注点赞转发记录,筛选出关注活动类型且未删除的关注记录,并按ID升序排序,限制结果数量为3
//                List<HappyFollow> happyFollows = happyFollowMapper.selectList(
//                        new LambdaQueryWrapper<HappyFollow>()
//                                .eq(HappyFollow::getSourceType, StateUpDownEnum.SOURCE_TYPE_ACTIVITY.getCode())
//                                .eq(HappyFollow::getSourceId, record.getId())
//                                .eq(HappyFollow::getDeleteFlag, StateUpDownEnum.DOWN.getCode())
//                                .groupBy(HappyFollow::getMemberId)
//                                .orderByAsc(HappyFollow::getId)
//                                .last("limit 3")
//                );
                // 检查关注记录是否不为空
                if(CollUtil.isNotEmpty(happyFollows)){
                    // 使用Stream流操作关注记录,获取所有成员ID的集合
@@ -1107,6 +1119,32 @@
    }
    @Override
    public void getAddLike(Long socialId) {
        ClothesSocial clothesSocial = clothesSocialMapper.selectById(socialId);
        if (ObjectUtil.isNotNull(clothesSocial)){
            clothesSocialMapper.update(null,
                    Wrappers.lambdaUpdate(ClothesSocial.class)
                    .set(ClothesSocial::getLikeCnt, clothesSocial.getLikeCnt()+1)
                    .eq(ClothesSocial::getId, socialId)
                    );
        }
    }
    @Override
    public void getAddCollect(Long socialId) {
        ClothesSocial clothesSocial = clothesSocialMapper.selectById(socialId);
        if (ObjectUtil.isNotNull(clothesSocial)){
            clothesSocialMapper.update(null,
                    Wrappers.lambdaUpdate(ClothesSocial.class)
                            .set(ClothesSocial::getCollectCnt, clothesSocial.getCollectCnt()+1)
                            .eq(ClothesSocial::getId, socialId)
            );
        }
    }
    @Override
    public FebsResponse voteActivityHot(Long id) {
        ApiVoteActivityHotVo apiVoteActivityHotVo = new ApiVoteActivityHotVo();