| | |
| | | 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 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<AdminChatUserPerkVo> getUserPerkList(ChatUser chatUser, QueryRequest request) { |
| | | Page<AdminChatUserPerkVo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | 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); |
| | | } |
| | | } |
| | | return chatUserPerkVoIPage; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse openAccount(String userId) { |
| | | ChatUser chatUser = this.baseMapper.selectByUserId(userId); |
| | | if(ObjectUtil.isEmpty(chatUser)) { |