| | |
| | | import cc.mrbird.febs.mall.service.IAdminChatService; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import cc.mrbird.febs.rabbit.producter.AgentProducer; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | Page<AdminChatUserVo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<AdminChatUserVo> chatUserIPage = this.baseMapper.selectUserListInPage(page, chatUser); |
| | | return chatUserIPage; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<AdminChatUserPerkVo> getUserPerkList(ChatUser chatUser, QueryRequest request) { |
| | | Page<AdminChatUserPerkVo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | log.info(String.valueOf(chatUser.getIsRobot())); |
| | | IPage<AdminChatUserPerkVo> chatUserPerkVoIPage = this.baseMapper.selectUserPerkListInPage(page, chatUser); |
| | | List<AdminChatUserPerkVo> records = chatUserPerkVoIPage.getRecords(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(AdminChatUserPerkVo adminChatUserPerkVo : records){ |
| | | Long userId = adminChatUserPerkVo.getUserId(); |
| | | List<AdminChatRedBagVo> group = this.baseMapper.selectListByMsgType(userId,"GROUP", null); |
| | | // adminChatUserPerkVo.setGroupRedBagNum(CollUtil.isEmpty(group) ? 0 : group.size()); |
| | | BigDecimal redBagTotalAmount = group.stream().map(AdminChatRedBagVo::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | adminChatUserPerkVo.setRedBagTotalAmount(redBagTotalAmount); |
| | | BigDecimal redBagAvaAmount = group.stream().map(AdminChatRedBagVo::getAmountAva).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | adminChatUserPerkVo.setRedBagAvaAmount(redBagAvaAmount); |
| | | BigDecimal getRedbagAmount = this.baseMapper.selectTotalType(9, null, null); |
| | | adminChatUserPerkVo.setGetRedbagAmount(getRedbagAmount); |
| | | BigDecimal boomToAmount = this.baseMapper.selectTotalType(10, null, null); |
| | | adminChatUserPerkVo.setBoomToAmount(boomToAmount); |
| | | BigDecimal teamPerkAmount = this.baseMapper.selectTotalType(7, null, null); |
| | | adminChatUserPerkVo.setTeamPerkAmount(teamPerkAmount); |
| | | } |
| | | } |
| | | return chatUserPerkVoIPage; |
| | | } |
| | | |
| | | @Override |
| | |
| | | this.baseMapper.updateCreateGroupByUserId(userId,0); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse openSwitchGetBoom(String userId) { |
| | | ChatUser chatUser = this.baseMapper.selectByUserId(userId); |
| | | if(ObjectUtil.isEmpty(chatUser)) { |
| | | return new FebsResponse().fail().message("会员信息不存在"); |
| | | } |
| | | this.baseMapper.updateGetBoomByUserId(userId,1); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse closeSwitchGetBoom(String userId) { |
| | | ChatUser chatUser = this.baseMapper.selectByUserId(userId); |
| | | if(ObjectUtil.isEmpty(chatUser)) { |
| | | return new FebsResponse().fail().message("会员信息不存在"); |
| | | } |
| | | this.baseMapper.updateGetBoomByUserId(userId,0); |
| | | return new FebsResponse().success(); |
| | | } |
| | | } |