init
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.cai.domain.AnchorApply;
|
import com.ruoyi.cai.domain.AnchorApply;
|
||||||
import com.ruoyi.cai.dto.admin.vo.AnchorApplyAdminVo;
|
import com.ruoyi.cai.dto.admin.vo.AnchorApplyAdminVo;
|
||||||
|
import com.ruoyi.cai.dto.app.query.IdRes;
|
||||||
import com.ruoyi.cai.service.AnchorApplyService;
|
import com.ruoyi.cai.service.AnchorApplyService;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
@@ -58,26 +59,20 @@ public class AnchorApplyController extends BaseController {
|
|||||||
return R.ok(anchorApplyService.getById(id));
|
return R.ok(anchorApplyService.getById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@SaCheckPermission("cai:anchorApply:audit")
|
||||||
* 新增播主申请管理
|
@Log(title = "播主申请管理", businessType = BusinessType.UPDATE)
|
||||||
*/
|
@PostMapping("/auditAnchorSuccess")
|
||||||
@SaCheckPermission("cai:anchorApply:add")
|
public R<Void> auditAnchorSuccess(@RequestBody IdRes id) {
|
||||||
@Log(title = "播主申请管理", businessType = BusinessType.INSERT)
|
anchorApplyService.auditAnchorSuccess(id.getId());
|
||||||
@RepeatSubmit()
|
return R.ok();
|
||||||
@PostMapping()
|
|
||||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody AnchorApply bo) {
|
|
||||||
return toAjax(anchorApplyService.save(bo));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@SaCheckPermission("cai:anchorApply:audit")
|
||||||
* 修改播主申请管理
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("cai:anchorApply:edit")
|
|
||||||
@Log(title = "播主申请管理", businessType = BusinessType.UPDATE)
|
@Log(title = "播主申请管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
@PostMapping("/auditAnchorFail")
|
||||||
@PutMapping()
|
public R<Void> auditAnchorFail(@RequestBody IdRes id) {
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AnchorApply bo) {
|
anchorApplyService.auditAnchorFail(id.getId());
|
||||||
return toAjax(anchorApplyService.updateById(bo));
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.ruoyi.cai.domain.Anchor;
|
import com.ruoyi.cai.domain.Anchor;
|
||||||
import com.ruoyi.cai.domain.User;
|
import com.ruoyi.cai.domain.User;
|
||||||
|
import com.ruoyi.cai.domain.UserOnline;
|
||||||
import com.ruoyi.cai.dto.admin.vo.AnchorAdminVo;
|
import com.ruoyi.cai.dto.admin.vo.AnchorAdminVo;
|
||||||
|
import com.ruoyi.cai.dto.admin.vo.AnchorFullAdminVo;
|
||||||
import com.ruoyi.cai.service.AnchorService;
|
import com.ruoyi.cai.service.AnchorService;
|
||||||
|
import com.ruoyi.cai.service.UserInfoService;
|
||||||
|
import com.ruoyi.cai.service.UserOnlineService;
|
||||||
import com.ruoyi.cai.service.UserService;
|
import com.ruoyi.cai.service.UserService;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
@@ -33,8 +37,10 @@ import javax.validation.constraints.NotNull;
|
|||||||
@RequestMapping("/cai/anchor")
|
@RequestMapping("/cai/anchor")
|
||||||
public class AnchorController extends BaseController {
|
public class AnchorController extends BaseController {
|
||||||
|
|
||||||
private final AnchorService caiAnchorService;
|
private final AnchorService anchorService;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
private final UserInfoService userInfoService;
|
||||||
|
private final UserOnlineService userOnlineService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询女神列表列表
|
* 查询女神列表列表
|
||||||
@@ -42,7 +48,7 @@ public class AnchorController extends BaseController {
|
|||||||
@SaCheckPermission("cai:anchor:list")
|
@SaCheckPermission("cai:anchor:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<AnchorAdminVo> list(AnchorAdminVo bo, PageQuery pageQuery) {
|
public TableDataInfo<AnchorAdminVo> list(AnchorAdminVo bo, PageQuery pageQuery) {
|
||||||
IPage<AnchorAdminVo> page = caiAnchorService.pageAdmin(pageQuery, bo);
|
IPage<AnchorAdminVo> page = anchorService.pageAdmin(pageQuery, bo);
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +62,18 @@ public class AnchorController extends BaseController {
|
|||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public R<Anchor> getInfo(@NotNull(message = "主键不能为空")
|
public R<Anchor> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable Integer id) {
|
@PathVariable Integer id) {
|
||||||
return R.ok(caiAnchorService.getById(id));
|
return R.ok(anchorService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/full")
|
||||||
|
public R<AnchorFullAdminVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
Long userId) {
|
||||||
|
AnchorFullAdminVo vo = new AnchorFullAdminVo();
|
||||||
|
vo.setUser(userService.getById(userId));
|
||||||
|
vo.setAnchor(anchorService.getByUserId(userId));
|
||||||
|
vo.setUserOnline(userOnlineService.getByUserId(userId));
|
||||||
|
vo.setUserInfo(userInfoService.getByUserId(userId));
|
||||||
|
return R.ok(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SaCheckPermission("cai:anchor:add")
|
@SaCheckPermission("cai:anchor:add")
|
||||||
@@ -68,7 +85,7 @@ public class AnchorController extends BaseController {
|
|||||||
if(user == null){
|
if(user == null){
|
||||||
return R.fail("用户不存在");
|
return R.fail("用户不存在");
|
||||||
}
|
}
|
||||||
caiAnchorService.joinAnchor(user.getId());
|
anchorService.joinAnchor(user.getId());
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +94,7 @@ public class AnchorController extends BaseController {
|
|||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody Anchor bo) {
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody Anchor bo) {
|
||||||
return toAjax(caiAnchorService.updateById(bo));
|
return toAjax(anchorService.updateById(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SaCheckPermission("cai:anchor:remove")
|
@SaCheckPermission("cai:anchor:remove")
|
||||||
@@ -86,7 +103,7 @@ public class AnchorController extends BaseController {
|
|||||||
public R<Void> remove(@NotNull(message = "主键不能为空")
|
public R<Void> remove(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable Long userId) {
|
@PathVariable Long userId) {
|
||||||
|
|
||||||
caiAnchorService.closeAnchor(userId);
|
anchorService.closeAnchor(userId);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,15 +28,11 @@ public class AnchorApply implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 用户ID
|
* 用户ID
|
||||||
*/
|
*/
|
||||||
private Integer userId;
|
private Long userId;
|
||||||
/**
|
/**
|
||||||
* 审核状态 0 未申请 1 审核中 2 审核不通过 3 审核通过
|
* 审核状态
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer auditStatus;
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private Integer auditCount;
|
|
||||||
/**
|
/**
|
||||||
* 审核时间
|
* 审核时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import java.math.BigDecimal;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("cai_user_info")
|
@TableName("cai_user_info")
|
||||||
@Deprecated
|
|
||||||
public class UserInfo {
|
public class UserInfo {
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
private static final long serialVersionUID=1L;
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.cai.dto.admin.vo;
|
||||||
|
|
||||||
|
import com.ruoyi.cai.domain.Anchor;
|
||||||
|
import com.ruoyi.cai.domain.User;
|
||||||
|
import com.ruoyi.cai.domain.UserInfo;
|
||||||
|
import com.ruoyi.cai.domain.UserOnline;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AnchorFullAdminVo {
|
||||||
|
private User user;
|
||||||
|
private Anchor anchor;
|
||||||
|
private UserOnline userOnline;
|
||||||
|
private UserInfo userInfo;
|
||||||
|
}
|
||||||
@@ -22,4 +22,8 @@ public interface AnchorApplyService extends IService<AnchorApply> {
|
|||||||
AnchorJoinHomeVo joinHome(Long userId);
|
AnchorJoinHomeVo joinHome(Long userId);
|
||||||
|
|
||||||
boolean joinAnchor(Long userId);
|
boolean joinAnchor(Long userId);
|
||||||
|
|
||||||
|
void auditAnchorSuccess(Long id);
|
||||||
|
|
||||||
|
void auditAnchorFail(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,17 +3,24 @@ package com.ruoyi.cai.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.cai.domain.Anchor;
|
||||||
import com.ruoyi.cai.domain.AnchorApply;
|
import com.ruoyi.cai.domain.AnchorApply;
|
||||||
import com.ruoyi.cai.domain.User;
|
import com.ruoyi.cai.domain.User;
|
||||||
import com.ruoyi.cai.dto.admin.vo.AnchorApplyAdminVo;
|
import com.ruoyi.cai.dto.admin.vo.AnchorApplyAdminVo;
|
||||||
import com.ruoyi.cai.dto.app.vo.AnchorJoinHomeVo;
|
import com.ruoyi.cai.dto.app.vo.AnchorJoinHomeVo;
|
||||||
|
import com.ruoyi.cai.enums.AuditStatusEnum;
|
||||||
|
import com.ruoyi.cai.enums.GenderEnum;
|
||||||
|
import com.ruoyi.cai.enums.SystemConfigEnum;
|
||||||
|
import com.ruoyi.cai.manager.SystemConfigManager;
|
||||||
import com.ruoyi.cai.mapper.AnchorApplyMapper;
|
import com.ruoyi.cai.mapper.AnchorApplyMapper;
|
||||||
import com.ruoyi.cai.service.AnchorApplyService;
|
import com.ruoyi.cai.service.AnchorApplyService;
|
||||||
|
import com.ruoyi.cai.service.AnchorService;
|
||||||
import com.ruoyi.cai.service.UserService;
|
import com.ruoyi.cai.service.UserService;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@@ -28,6 +35,10 @@ public class AnchorApplyServiceImpl extends ServiceImpl<AnchorApplyMapper, Ancho
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
@Autowired
|
||||||
|
private AnchorService anchorService;
|
||||||
|
@Autowired
|
||||||
|
private SystemConfigManager systemConfigManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AnchorApply getByUserId(Long userId){
|
public AnchorApply getByUserId(Long userId){
|
||||||
@@ -76,17 +87,62 @@ public class AnchorApplyServiceImpl extends ServiceImpl<AnchorApplyMapper, Ancho
|
|||||||
throw new ServiceException("您还未同意个人协议");
|
throw new ServiceException("您还未同意个人协议");
|
||||||
}
|
}
|
||||||
AnchorApply anchorApply = this.getByUserId(userId);
|
AnchorApply anchorApply = this.getByUserId(userId);
|
||||||
if(anchorApply != null && anchorApply.getStatus() == 1){
|
if(anchorApply != null && AuditStatusEnum.AUDITING.getCode().equals(anchorApply.getAuditStatus())){
|
||||||
throw new ServiceException("您的提交的申请正在审核中请耐心等待");
|
throw new ServiceException("您的提交的申请正在审核中请耐心等待");
|
||||||
}
|
}
|
||||||
if(anchorApply == null){
|
|
||||||
anchorApply = new AnchorApply();
|
anchorApply = new AnchorApply();
|
||||||
}else{
|
anchorApply.setUserId(userId);
|
||||||
anchorApply.setAuditCount(anchorApply.getAuditCount()+1);
|
anchorApply.setAuditStatus(AuditStatusEnum.AUDITING.getCode());
|
||||||
}
|
|
||||||
anchorApply.setStatus(1);
|
|
||||||
anchorApply.setCreateTime(LocalDateTime.now());
|
anchorApply.setCreateTime(LocalDateTime.now());
|
||||||
this.saveOrUpdate(anchorApply);
|
this.save(anchorApply);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void auditAnchorSuccess(Long id) {
|
||||||
|
AnchorApply anchorApply = this.getById(id);
|
||||||
|
if(anchorApply == null){
|
||||||
|
throw new ServiceException("审核失败,数据不存在");
|
||||||
|
}
|
||||||
|
Long userId = anchorApply.getUserId();
|
||||||
|
User user = userService.getById(userId);
|
||||||
|
Anchor anchor = anchorService.getByUserId(userId);
|
||||||
|
if(user == null){
|
||||||
|
throw new ServiceException("用户不存在");
|
||||||
|
}
|
||||||
|
if(user.getIsAnchor() == 1 || anchor != null){
|
||||||
|
throw new ServiceException("改用户已经是主播");
|
||||||
|
}
|
||||||
|
if(!GenderEnum.WOMEN.getCode().equals(user.getGender())){
|
||||||
|
throw new ServiceException("只有女用户可以加入主播");
|
||||||
|
}
|
||||||
|
boolean boo = userService.update(Wrappers.lambdaUpdate(User.class)
|
||||||
|
.eq(User::getId, user.getId()).eq(User::getIsAnchor, 0)
|
||||||
|
.set(User::getIsAnchor, 1));
|
||||||
|
if(!boo){
|
||||||
|
throw new ServiceException("加入主播失败");
|
||||||
|
}
|
||||||
|
this.update(Wrappers.lambdaUpdate(AnchorApply.class)
|
||||||
|
.eq(AnchorApply::getId,id)
|
||||||
|
.set(AnchorApply::getAuditTime,LocalDateTime.now())
|
||||||
|
.set(AnchorApply::getAuditStatus,AuditStatusEnum.SUCCESS.getCode()));
|
||||||
|
Long price = systemConfigManager.getSystemConfigOfLong(SystemConfigEnum.DEFAULT_ANCHOR_PRICE);
|
||||||
|
Anchor save = new Anchor();
|
||||||
|
save.setUserId(user.getId());
|
||||||
|
save.setPrice(price);
|
||||||
|
save.setVideoRate(systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.DEFAULT_ANCHOR_VIDEO_PRICE));
|
||||||
|
save.setGuardRate(systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.DEFAULT_ANCHOR_GUARD_PRICE));
|
||||||
|
save.setGiftRate(systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.DEFAULT_ANCHOR_GIFT_PRICE));
|
||||||
|
anchorService.save(save);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void auditAnchorFail(Long id) {
|
||||||
|
this.update(Wrappers.lambdaUpdate(AnchorApply.class)
|
||||||
|
.eq(AnchorApply::getId,id)
|
||||||
|
.set(AnchorApply::getAuditTime,LocalDateTime.now())
|
||||||
|
.set(AnchorApply::getAuditStatus,AuditStatusEnum.FAIL.getCode()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import com.ruoyi.common.exception.ServiceException;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 女神列表Service业务层处理
|
* 女神列表Service业务层处理
|
||||||
@@ -36,6 +37,7 @@ public class AnchorServiceImpl extends ServiceImpl<AnchorMapper, Anchor> impleme
|
|||||||
private SystemConfigManager systemConfigManager;
|
private SystemConfigManager systemConfigManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void joinAnchor(Long userId){
|
public void joinAnchor(Long userId){
|
||||||
User user = userService.getById(userId);
|
User user = userService.getById(userId);
|
||||||
Anchor anchor = this.getByUserId(userId);
|
Anchor anchor = this.getByUserId(userId);
|
||||||
@@ -72,6 +74,7 @@ public class AnchorServiceImpl extends ServiceImpl<AnchorMapper, Anchor> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void closeAnchor(Long userId){
|
public void closeAnchor(Long userId){
|
||||||
User user = userService.getById(userId);
|
User user = userService.getById(userId);
|
||||||
Anchor anchor = this.getByUserId(userId);
|
Anchor anchor = this.getByUserId(userId);
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<resultMap type="com.ruoyi.cai.domain.AnchorApply" id="CaiAnchorApplyResult">
|
<resultMap type="com.ruoyi.cai.domain.AnchorApply" id="CaiAnchorApplyResult">
|
||||||
<result property="id" column="id"/>
|
<result property="id" column="id"/>
|
||||||
<result property="userId" column="user_id"/>
|
<result property="userId" column="user_id"/>
|
||||||
<result property="agreeProtocol" column="agree_protocol"/>
|
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
<result property="status" column="status"/>
|
<result property="status" column="status"/>
|
||||||
<result property="auditCount" column="audit_count"/>
|
<result property="auditCount" column="audit_count"/>
|
||||||
@@ -18,6 +17,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select t1.*,t2.age,t2.avatar,t2.usercode,t2.nickname,t2.mobile,t2.gender
|
select t1.*,t2.age,t2.avatar,t2.usercode,t2.nickname,t2.mobile,t2.gender
|
||||||
from cai_anchor_apply t1
|
from cai_anchor_apply t1
|
||||||
left join cai_user t2 on t1.user_id = t2.id
|
left join cai_user t2 on t1.user_id = t2.id
|
||||||
|
<where>
|
||||||
|
<if test="bo.mobile != null and bo.mobile != ''">
|
||||||
|
and t2.mobile = #{bo.mobile}
|
||||||
|
</if>
|
||||||
|
<if test="bo.usercode != null and bo.usercode != ''">
|
||||||
|
and t2.usercode = #{bo.usercode}
|
||||||
|
</if>
|
||||||
|
<if test="bo.auditStatus != null">
|
||||||
|
and t1.audit_status = #{bo.auditStatus}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by t2.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user