| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.mall.YesOrNoEnum; |
| | | import cc.mrbird.febs.mall.dto.AdminSystemPayDto; |
| | | import cc.mrbird.febs.mall.entity.ChatAmountFlow; |
| | | import cc.mrbird.febs.mall.entity.ChatUser; |
| | | import cc.mrbird.febs.mall.entity.MemberCoinWithdraw; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.ChatAmountFlowMapper; |
| | | import cc.mrbird.febs.mall.mapper.ChatGroupMapper; |
| | | import cc.mrbird.febs.mall.mapper.ChatUserMapper; |
| | | import cc.mrbird.febs.mall.mapper.DataDictionaryMapper; |
| | | import cc.mrbird.febs.mall.service.IAdminChatService; |
| | | import cc.mrbird.febs.mall.vo.AdminChatAmountFlowVo; |
| | | import cc.mrbird.febs.mall.vo.AdminChatCahrgeVo; |
| | | import cc.mrbird.febs.mall.vo.AdminChatUserVo; |
| | | import cc.mrbird.febs.mall.vo.AdminChatWithDrawVo; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import cc.mrbird.febs.rabbit.producter.AgentProducer; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | |
| | | public class AdminChatServiceImpl extends ServiceImpl<ChatUserMapper, ChatUser> implements IAdminChatService { |
| | | |
| | | private final ChatAmountFlowMapper chatAmountFlowMapper; |
| | | private final DataDictionaryMapper dataDictionaryMapper; |
| | | private final ChatGroupMapper chatGroupMapper; |
| | | private final AgentProducer agentProducer; |
| | | private final RedisUtils redisUtils; |
| | | |
| | | @Override |
| | | public IPage<AdminChatUserVo> getUserList(ChatUser chatUser, QueryRequest request) { |
| | |
| | | return new FebsResponse().fail().message("会员信息不存在"); |
| | | } |
| | | this.baseMapper.updateStatusByUserId(userId,YesOrNoEnum.NO.getCode()); |
| | | if (chatUser != null) { |
| | | // 清理token |
| | | String token = chatUser.getToken(); |
| | | if (!StringUtils.isEmpty(token)) { |
| | | String TOKEN_REDIS_APP = "token:app:"; |
| | | redisUtils.del(TOKEN_REDIS_APP + token); |
| | | } |
| | | } |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse openSwitchIsRobot(String userId) { |
| | | ChatUser chatUser = this.baseMapper.selectByUserId(userId); |
| | | if(ObjectUtil.isEmpty(chatUser)) { |
| | | return new FebsResponse().fail().message("会员信息不存在"); |
| | | } |
| | | this.baseMapper.updateIsRobotByUserId(userId,1); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse closeSwitchIsRobot(String userId) { |
| | | ChatUser chatUser = this.baseMapper.selectByUserId(userId); |
| | | if(ObjectUtil.isEmpty(chatUser)) { |
| | | return new FebsResponse().fail().message("会员信息不存在"); |
| | | } |
| | | this.baseMapper.updateIsRobotByUserId(userId,0); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateDataDic(String type, String code, String modelType) { |
| | | DataDictionary dic = this.baseMapper.selectDicDataByTypeAndCode(type, code); |
| | | if (dic != null) { |
| | | dic.setValue(modelType); |
| | | dataDictionaryMapper.updateById(dic); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public IPage<AdminGroupVo> getGroupList(ChatUser chatUser, QueryRequest request) { |
| | | Page<AdminGroupVo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | return this.baseMapper.selectGroupListInPage(page, chatUser); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse closeSwitchUseRobot(String id) { |
| | | this.baseMapper.updateIsRobotByGroupId(id,0); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse openSwitchUseRobot(String id) { |
| | | this.baseMapper.updateIsRobotByGroupId(id,1); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse updateGroupInfo(AdminGroupInfoVo adminGroupInfoVo) { |
| | | ChatGroup chatGroup = chatGroupMapper.selectById(adminGroupInfoVo.getId()); |
| | | if(ObjectUtil.isEmpty(chatGroup)) { |
| | | return new FebsResponse().fail().message("信息不存在"); |
| | | } |
| | | chatGroup.setAmountMin(adminGroupInfoVo.getAmountMin()); |
| | | chatGroup.setAmountMax(adminGroupInfoVo.getAmountMax()); |
| | | chatGroup.setRedBagCnt(adminGroupInfoVo.getRedBagCnt()); |
| | | chatGroup.setModelType(adminGroupInfoVo.getModelType()); |
| | | chatGroupMapper.updateById(chatGroup); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse registerMember() { |
| | | agentProducer.sendAddRobotMsg("20845477"); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse openModelType(String userId) { |
| | | ChatUser chatUser = this.baseMapper.selectByUserId(userId); |
| | | if(ObjectUtil.isEmpty(chatUser)) { |
| | | return new FebsResponse().fail().message("会员信息不存在"); |
| | | } |
| | | this.baseMapper.updateModelTypeByUserId(userId,1); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse closeModelType(String userId) { |
| | | ChatUser chatUser = this.baseMapper.selectByUserId(userId); |
| | | if(ObjectUtil.isEmpty(chatUser)) { |
| | | return new FebsResponse().fail().message("会员信息不存在"); |
| | | } |
| | | this.baseMapper.updateModelTypeByUserId(userId,2); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse updateRegisterMember(AdminRegisterMemberVo adminRegisterMemberVo) { |
| | | agentProducer.sendAddRobotMsg(adminRegisterMemberVo.getInviteId()); |
| | | return new FebsResponse().success(); |
| | | } |
| | | } |