| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ComActIntegralUserServiceImpl extends ServiceImpl<ComActIntegralUserMapper, ComActIntegralUserDO> implements ComActIntegralUserService { |
| | | public class ComActIntegralUserServiceImpl extends ServiceImpl<ComActIntegralUserMapper, ComActIntegralUserDO> |
| | | implements ComActIntegralUserService { |
| | | |
| | | @Resource |
| | | private ComActUserWalletMapper comActUserWalletMapper; |
| | |
| | | |
| | | /** |
| | | * 小程序-查询积分说明 |
| | | * |
| | | * @return 积分说明 |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * 用户查询当前社区可领取积分规则列表 |
| | | * @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); |
| | |
| | | |
| | | /** |
| | | * 小程序-查询用户积分列表 |
| | | * @param userId 用户id |
| | | * |
| | | * @param userId |
| | | * 用户id |
| | | * @return 用户积分列表 |
| | | */ |
| | | @Override |
| | |
| | | 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(); |
| | |
| | | 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(); |
| | |
| | | |
| | | /** |
| | | * 查询社区积分账户排行榜 |
| | | * @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 |