|
|
|
|
@@ -1,14 +1,18 @@
|
|
|
|
|
package com.starry.admin.modules.follow.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import com.starry.common.utils.IdUtils;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
|
|
|
|
|
import com.starry.admin.modules.follow.mapper.PlayCustomFollowInfoMapper;
|
|
|
|
|
import com.starry.admin.modules.follow.module.entity.PlayCustomFollowInfoEntity;
|
|
|
|
|
import com.starry.admin.modules.follow.service.IPlayCustomFollowInfoService;
|
|
|
|
|
import com.starry.admin.modules.weichat.entity.PlayClerkFollowQueryVo;
|
|
|
|
|
import com.starry.admin.modules.weichat.entity.PlayClerkFollowReturnVo;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
@@ -41,8 +45,8 @@ public class PlayCustomFollowInfoServiceImpl extends ServiceImpl<PlayCustomFollo
|
|
|
|
|
@Override
|
|
|
|
|
public String queryFollowState(String customUserId, String clerkUserId) {
|
|
|
|
|
LambdaQueryWrapper<PlayCustomFollowInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getClerkUserId, clerkUserId);
|
|
|
|
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getCustomUserId, customUserId);
|
|
|
|
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getClerkId, clerkUserId);
|
|
|
|
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getCustomId, customUserId);
|
|
|
|
|
PlayCustomFollowInfoEntity entity = this.baseMapper.selectOne(lambdaQueryWrapper);
|
|
|
|
|
return entity == null ? "0" : entity.getFollowState();
|
|
|
|
|
}
|
|
|
|
|
@@ -50,14 +54,14 @@ public class PlayCustomFollowInfoServiceImpl extends ServiceImpl<PlayCustomFollo
|
|
|
|
|
@Override
|
|
|
|
|
public void updateFollowState(String customUserId, String clerkUserId, String followState) {
|
|
|
|
|
LambdaQueryWrapper<PlayCustomFollowInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getClerkUserId, clerkUserId);
|
|
|
|
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getCustomUserId, customUserId);
|
|
|
|
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getClerkId, clerkUserId);
|
|
|
|
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getCustomId, customUserId);
|
|
|
|
|
PlayCustomFollowInfoEntity entity = this.baseMapper.selectOne(lambdaQueryWrapper);
|
|
|
|
|
if (entity == null) {
|
|
|
|
|
entity = new PlayCustomFollowInfoEntity();
|
|
|
|
|
entity.setCustomUserId(customUserId);
|
|
|
|
|
entity.setCustomId(customUserId);
|
|
|
|
|
entity.setFollowState(followState);
|
|
|
|
|
entity.setClerkUserId(clerkUserId);
|
|
|
|
|
entity.setClerkId(clerkUserId);
|
|
|
|
|
entity.setFollowTime(new Date());
|
|
|
|
|
this.baseMapper.insert(entity);
|
|
|
|
|
} else {
|
|
|
|
|
@@ -66,6 +70,30 @@ public class PlayCustomFollowInfoServiceImpl extends ServiceImpl<PlayCustomFollo
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IPage<PlayClerkFollowReturnVo> selectByPage(PlayClerkFollowQueryVo vo) {
|
|
|
|
|
MPJLambdaWrapper<PlayCustomFollowInfoEntity> lambdaQueryWrapper = new MPJLambdaWrapper<PlayCustomFollowInfoEntity>()
|
|
|
|
|
// 查询主表全部字段
|
|
|
|
|
.selectAll(PlayCustomFollowInfoEntity.class)
|
|
|
|
|
// 陪聊用户表全部字段
|
|
|
|
|
.selectAll(PlayClerkUserInfoEntity.class)
|
|
|
|
|
// 陪聊用户表
|
|
|
|
|
.leftJoin(PlayClerkUserInfoEntity.class, PlayClerkUserInfoEntity::getId, PlayCustomFollowInfoEntity::getClerkId);
|
|
|
|
|
if (StrUtil.isNotBlank(vo.getCustomId())) {
|
|
|
|
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getCustomId, vo.getCustomId());
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotBlank(vo.getFollowState())) {
|
|
|
|
|
lambdaQueryWrapper.eq(PlayCustomFollowInfoEntity::getFollowState, vo.getFollowState());
|
|
|
|
|
}
|
|
|
|
|
IPage<PlayClerkFollowReturnVo> iPage = this.baseMapper.selectJoinPage(new Page<>(vo.getPageNum(), vo.getPageSize()), PlayClerkFollowReturnVo.class, lambdaQueryWrapper);
|
|
|
|
|
for (PlayClerkFollowReturnVo record : iPage.getRecords()) {
|
|
|
|
|
LambdaQueryWrapper<PlayCustomFollowInfoEntity> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
|
|
lambdaQueryWrapper1.eq(PlayCustomFollowInfoEntity::getClerkId,record.getClerkId());
|
|
|
|
|
record.setFollowNumber(this.baseMapper.selectList(lambdaQueryWrapper1).size());
|
|
|
|
|
}
|
|
|
|
|
return iPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询顾客关注陪聊信息列表
|
|
|
|
|
*
|
|
|
|
|
@@ -87,7 +115,7 @@ public class PlayCustomFollowInfoServiceImpl extends ServiceImpl<PlayCustomFollo
|
|
|
|
|
@Override
|
|
|
|
|
public boolean create(PlayCustomFollowInfoEntity playCustomFollowInfo) {
|
|
|
|
|
if (StrUtil.isBlankIfStr(playCustomFollowInfo.getId())) {
|
|
|
|
|
playCustomFollowInfo.setId(IdUtil.fastSimpleUUID());
|
|
|
|
|
playCustomFollowInfo.setId(IdUtils.getUuid());
|
|
|
|
|
}
|
|
|
|
|
return save(playCustomFollowInfo);
|
|
|
|
|
}
|
|
|
|
|
|