huanghongfa
2021-09-02 177249c76aeea0b4bf8d8816d4994e3b445b45ce
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralUserServiceImpl.java
@@ -1,5 +1,13 @@
package com.panzhihua.service_community.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -14,7 +22,6 @@
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_community.dao.ComActDAO;
import com.panzhihua.service_community.dao.ComActIntegralRuleMapper;
import com.panzhihua.service_community.dao.ComActIntegralUserMapper;
import com.panzhihua.service_community.dao.ComActUserWalletMapper;
import com.panzhihua.service_community.model.dos.ComActDO;
@@ -24,15 +31,8 @@
import com.panzhihua.service_community.service.ComActIntegralRuleService;
import com.panzhihua.service_community.service.ComActIntegralUserService;
import com.panzhihua.service_community.service.ComActIntegralUserTradeService;
import com.panzhihua.service_community.service.ComActService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
 * @auther lyq
@@ -41,7 +41,8 @@
 */
@Slf4j
@Service
public class ComActIntegralUserServiceImpl extends ServiceImpl<ComActIntegralUserMapper, ComActIntegralUserDO> implements ComActIntegralUserService {
public class ComActIntegralUserServiceImpl extends ServiceImpl<ComActIntegralUserMapper, ComActIntegralUserDO>
    implements ComActIntegralUserService {
    @Resource
    private ComActUserWalletMapper comActUserWalletMapper;
@@ -54,6 +55,7 @@
    /**
     * 小程序-查询积分说明
     *
     * @return  积分说明
     */
    @Override
@@ -76,14 +78,18 @@
    /**
     * 用户查询当前社区可领取积分规则列表
     * @param userId    用户id
     * @param communityId   社区id
     *
     * @param userId
     *            用户id
     * @param communityId
     *            社区id
     * @return  可领取积分规则列表
     */
    @Override
    public R getIntegralReceiveApplets(Long userId,Long communityId){
        List<ComActIntegralUserRuleVO> integralUserRuleList = comActIntegralRuleService.getIntegralReceiveApplets(communityId);
        List<ComActIntegralUserRuleVO> integralUserRuleList =
            comActIntegralRuleService.getIntegralReceiveApplets(communityId);
        if(integralUserRuleList.isEmpty()){
            //如果没有查询到列表数据,增给社区增加默认规则列表再查询
            List<ComActIntegralRuleDO> integralRuleList = comActIntegralRuleService.getIntegralRuleList(communityId);
@@ -121,7 +127,9 @@
    /**
     * 小程序-查询用户积分列表
     * @param userId    用户id
     *
     * @param userId
     *            用户id
     * @return  用户积分列表
     */
    @Override
@@ -129,7 +137,8 @@
        ComActIntegralUserVO integralUserVO = new ComActIntegralUserVO();
        Integer amount = 0;
        //查询该用户在本社区下的积分账户是否存在,不存在则需要给用户创建
        ComActIntegralUserDO integralUserDO = this.baseMapper.selectOne(new QueryWrapper<ComActIntegralUserDO>().lambda()
        ComActIntegralUserDO integralUserDO =
            this.baseMapper.selectOne(new QueryWrapper<ComActIntegralUserDO>().lambda()
                .eq(ComActIntegralUserDO::getCommunityId,communityId).eq(ComActIntegralUserDO::getUserId,userId));
        if(integralUserDO == null){
            integralUserDO = new ComActIntegralUserDO();
@@ -144,7 +153,8 @@
        if(!integralUserList.isEmpty()){
            for (ComActIntegralUserListVO integralUser:integralUserList) {
                //查询用户在本社区积分排行
                IntegralUserRankVO userRank = this.baseMapper.getIntegralUserRank(integralUser.getCommunityId(),userId);
                IntegralUserRankVO userRank =
                    this.baseMapper.getIntegralUserRank(integralUser.getCommunityId(), userId);
                if(userRank != null){
                    integralUser.setRank(userRank.getRank());
                    amount += integralUser.getAmount();
@@ -164,17 +174,22 @@
    /**
     * 查询社区积分账户排行榜
     * @param communityRankDTO  请求参数
     *
     * @param communityRankDTO
     *            请求参数
     * @return  社区积分账户排行榜
     */
    @Override
    public R getIntegralCommunityRankApplets(ComActIntegralCommunityRankDTO communityRankDTO){
        return R.ok(this.baseMapper.getIntegralCommunityRankApplets(new Page(communityRankDTO.getPageNum(),communityRankDTO.getPageSize()),communityRankDTO));
        return R.ok(this.baseMapper.getIntegralCommunityRankApplets(
            new Page(communityRankDTO.getPageNum(), communityRankDTO.getPageSize()), communityRankDTO));
    }
    /**
     * 根据社区活动id查询社区活动报名人员列表
     * @param activityId    活动id
     *
     * @param activityId
     *            活动id
     * @return  社区活动报名人员列表
     */
    @Override