init
This commit is contained in:
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.cai.domain.CaiAnchorApply;
|
||||
import com.ruoyi.cai.dto.admin.vo.CaiAnchorApplyAdminVo;
|
||||
import com.ruoyi.cai.dto.app.vo.AnchorJoinHomeVo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
||||
/**
|
||||
@@ -14,5 +15,11 @@ import com.ruoyi.common.core.domain.PageQuery;
|
||||
*/
|
||||
public interface CaiAnchorApplyService extends IService<CaiAnchorApply> {
|
||||
|
||||
CaiAnchorApply getByUserId(Long userId);
|
||||
|
||||
Page<CaiAnchorApplyAdminVo> pageAdmin(PageQuery pageQuery, CaiAnchorApplyAdminVo bo);
|
||||
|
||||
AnchorJoinHomeVo joinHome(Long userId);
|
||||
|
||||
boolean joinAnchor(Long userId);
|
||||
}
|
||||
|
||||
@@ -31,4 +31,6 @@ public interface CaiUserService extends IService<CaiUser> {
|
||||
CaiUser getByUserCode(String userCode);
|
||||
|
||||
void updateVideoStatus(Long userId, int videoStatus);
|
||||
|
||||
boolean agreeProtocol(Long userId);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
package com.ruoyi.cai.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cai.domain.CaiAnchorApply;
|
||||
import com.ruoyi.cai.domain.CaiUser;
|
||||
import com.ruoyi.cai.dto.admin.vo.CaiAnchorApplyAdminVo;
|
||||
import com.ruoyi.cai.dto.app.vo.AnchorJoinHomeVo;
|
||||
import com.ruoyi.cai.mapper.CaiAnchorApplyMapper;
|
||||
import com.ruoyi.cai.service.CaiAnchorApplyService;
|
||||
import com.ruoyi.cai.service.CaiUserService;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 播主申请管理Service业务层处理
|
||||
*
|
||||
@@ -18,8 +26,67 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class CaiAnchorApplyServiceImpl extends ServiceImpl<CaiAnchorApplyMapper,CaiAnchorApply> implements CaiAnchorApplyService {
|
||||
|
||||
@Autowired
|
||||
private CaiUserService userService;
|
||||
|
||||
@Override
|
||||
public CaiAnchorApply getByUserId(Long userId){
|
||||
return this.getOne(Wrappers.lambdaQuery(CaiAnchorApply.class)
|
||||
.eq(CaiAnchorApply::getUserId,userId).last("limit 1"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CaiAnchorApplyAdminVo> pageAdmin(PageQuery pageQuery, CaiAnchorApplyAdminVo bo) {
|
||||
return baseMapper.pageAdmin(pageQuery.build(),bo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnchorJoinHomeVo joinHome(Long userId) {
|
||||
CaiUser user = userService.getById(userId);
|
||||
CaiAnchorApply anchorApply = this.getByUserId(userId);
|
||||
AnchorJoinHomeVo vo = new AnchorJoinHomeVo();
|
||||
vo.setFinishStatus(user.getFinishStatus());
|
||||
vo.setPhotoStatus(user.getPhotoStatus());
|
||||
vo.setCameraStatus(user.getCameraStatus());
|
||||
vo.setAgreeProtocol(user.getAgreeProtocol());
|
||||
if(anchorApply != null){
|
||||
vo.setApplyStatus(user.getStatus());
|
||||
}else{
|
||||
vo.setApplyStatus(0);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean joinAnchor(Long userId) {
|
||||
CaiUser user = userService.getById(userId);
|
||||
if(user.getIsAnchor() == 1){
|
||||
throw new ServiceException("您已经是主播,不能重复申请");
|
||||
}
|
||||
if(user.getFinishStatus() != 1){
|
||||
throw new ServiceException("您还未完善个人资料");
|
||||
}
|
||||
if(user.getPhotoStatus() != 1){
|
||||
throw new ServiceException("请选上传相册");
|
||||
}
|
||||
if(user.getCameraStatus() != 1){
|
||||
throw new ServiceException("您还未完成自拍认证");
|
||||
}
|
||||
if(user.getAgreeProtocol() != 1){
|
||||
throw new ServiceException("您还未同意个人协议");
|
||||
}
|
||||
CaiAnchorApply anchorApply = this.getByUserId(userId);
|
||||
if(anchorApply != null && anchorApply.getStatus() == 1){
|
||||
throw new ServiceException("您的提交的申请正在审核中请耐心等待");
|
||||
}
|
||||
if(anchorApply == null){
|
||||
anchorApply = new CaiAnchorApply();
|
||||
}else{
|
||||
anchorApply.setAuditCount(anchorApply.getAuditCount()+1);
|
||||
}
|
||||
anchorApply.setStatus(1);
|
||||
anchorApply.setCreateTime(LocalDateTime.now());
|
||||
this.saveOrUpdate(anchorApply);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,4 +102,12 @@ public class CaiUserServiceImpl extends ServiceImpl<CaiUserMapper, CaiUser> impl
|
||||
.eq(CaiUser::getId,userId)
|
||||
.set(CaiUser::getVideoStatus,videoStatus));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agreeProtocol(Long userId) {
|
||||
this.update(Wrappers.lambdaUpdate(CaiUser.class)
|
||||
.eq(CaiUser::getId,userId)
|
||||
.set(CaiUser::getAgreeProtocol,1));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user