店员管理/店员等级/账户管理

This commit is contained in:
starrySky
2024-03-31 13:52:29 +08:00
parent ccaa00990f
commit c7f81acbe5
125 changed files with 2670 additions and 1033 deletions

View File

@@ -60,18 +60,18 @@ public class PlayResourcesInfoController {
@Log(title = "陪玩资源", businessType = BusinessType.INSERT)
@PostMapping("/create")
public R create(@RequestBody PlayResourcesInfoAddVo vo, @RequestParam("file") MultipartFile file) throws IOException {
//校验文件类型是否正常
// 校验文件类型是否正常
//上传文件到OSS
// 上传文件到OSS
String fileAddress = ossFileService.upload(file.getInputStream(), "", file.getOriginalFilename());
//保持陪玩资源
// 保持陪玩资源
PlayResourcesInfoEntity entity = ConvertUtil.entityToVo(vo, PlayResourcesInfoEntity.class);
entity.setAddress(fileAddress);
boolean success = playResourcesInfoService.create(entity);
//发送审核通知给对应的管理员
// 发送审核通知给对应的管理员
//返回信息
// 返回信息
if (success) {
return R.ok("成功");
}
@@ -86,9 +86,9 @@ public class PlayResourcesInfoController {
@Log(title = "陪玩资源审核", businessType = BusinessType.UPDATE)
@PostMapping("/examine")
public R examinePlayResourcesInfo(@RequestBody PlayResourcesInfoReviewVo vo) {
//验证权限,判断当前接口调用人是否有权限操作该接口
// 验证权限,判断当前接口调用人是否有权限操作该接口
//资料审核
// 资料审核
playResourcesInfoService.examinePlayResourcesInfo(vo.getId(), vo.isSuccess(), vo.getRemark());
return R.ok("成功");
}

View File

@@ -2,40 +2,44 @@ package com.starry.admin.modules.play.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
import com.starry.admin.modules.play.module.vo.PlayUserInfoAddVo;
import com.starry.admin.modules.play.module.vo.PlayUserInfoQueryVo;
import com.starry.admin.modules.play.module.vo.PlayUserInfoUpdateVo;
import com.starry.admin.modules.play.service.IPlayUserInfoService;
import com.starry.common.annotation.Log;
import com.starry.common.enums.BusinessType;
import com.starry.common.result.R;
import com.starry.common.utils.ConvertUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 陪玩用户Controller
* 账号Controller
*
* @author admin
* @since 2024-03-24
* @since 2024-03-30
*/
@RestController
@RequestMapping("/play/user/info")
@RequestMapping("/play/user")
public class PlayUserInfoController {
@Resource
private IPlayUserInfoService playUserInfoService;
/**
* 查询陪玩用户列表
* 查询账号列表
*/
@PreAuthorize("@customSs.hasPermission('play:info:list')")
@GetMapping("/list")
public R list(PlayUserInfoEntity playUserInfo) {
IPage<PlayUserInfoEntity> list = playUserInfoService.selectPlayUserInfoByPage(playUserInfo);
public R list(PlayUserInfoQueryVo vo) {
IPage<PlayUserInfoEntity> list = playUserInfoService.selectPlayUserInfoByPage(vo);
return R.ok(list);
}
/**
* 获取陪玩用户详细信息
* 获取账号详细信息
*/
@PreAuthorize("@customSs.hasPermission('play:info:query')")
@GetMapping(value = "/{id}")
@@ -44,13 +48,14 @@ public class PlayUserInfoController {
}
/**
* 新增陪玩用户
* 新增账号
*/
@PreAuthorize("@customSs.hasPermission('play:info:create')")
@Log(title = "陪玩用户", businessType = BusinessType.INSERT)
@Log(title = "账号", businessType = BusinessType.INSERT)
@PostMapping("/create")
public R create(@RequestBody PlayUserInfoEntity playUserInfo) {
boolean success = playUserInfoService.create(playUserInfo);
public R create(@Validated @RequestBody PlayUserInfoAddVo vo) {
PlayUserInfoEntity entity = ConvertUtil.entityToVo(vo, PlayUserInfoEntity.class);
boolean success = playUserInfoService.create(entity);
if (success) {
return R.ok();
}
@@ -58,14 +63,14 @@ public class PlayUserInfoController {
}
/**
* 修改陪玩用户
* 修改账号
*/
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
@Log(title = "陪玩用户", businessType = BusinessType.UPDATE)
@PostMapping(value = "/update/{id}")
public R update(@PathVariable String id, @RequestBody PlayUserInfoEntity playUserInfo) {
playUserInfo.setId(id);
boolean success = playUserInfoService.update(playUserInfo);
@Log(title = "账号", businessType = BusinessType.UPDATE)
@PostMapping(value = "/update")
public R update(@Validated @RequestBody PlayUserInfoUpdateVo vo) {
PlayUserInfoEntity entity = ConvertUtil.entityToVo(vo, PlayUserInfoEntity.class);
boolean success = playUserInfoService.update(entity);
if (success) {
return R.ok();
}
@@ -73,10 +78,10 @@ public class PlayUserInfoController {
}
/**
* 删除陪玩用户
* 删除账号
*/
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
@Log(title = "陪玩用户", businessType = BusinessType.DELETE)
@Log(title = "账号", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R remove(@PathVariable String[] ids) {
return R.ok(playUserInfoService.deletePlayUserInfoByIds(ids));

View File

@@ -1,13 +1,15 @@
package com.starry.admin.modules.play.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
/**
* 陪玩用户Mapper接口
* 账号Mapper接口
*
* @author admin
* @since 2024-03-24
* @since 2024-03-30
*/
public interface PlayUserInfoMapper extends BaseMapper<PlayUserInfoEntity> {

View File

@@ -6,10 +6,10 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 陪玩用户对象 ply_user_info
* 账号对象 play_user_info
*
* @author admin
* @since 2024-03-24
* @since 2024-03-30
*/
@Data
@EqualsAndHashCode(callSuper = false)
@@ -28,84 +28,13 @@ public class PlayUserInfoEntity extends BaseEntity<PlayUserInfoEntity> {
private String tenantId;
/**
* 姓名
* 账户名称(手机号码)
*/
private String name;
private String username;
/**
* 证件号码
* 手机号码区号
*/
private String code;
private String areaCode;
/**
* 账户余额
*/
private String accountBalance;
/**
* 昵称
*/
private String nickName;
/**
* 头像地址
*/
private String profilePicture;
/**
* 陪玩状态[0,1,2]
* 0正常
* 1被标记:
* 2被封禁
*/
private String userState;
/**
* 陪玩等级
*/
private Integer level;
/**
* 陪玩在线状态[0:1]
* 0在线
* 1离线
*/
private String presenceState;
/**
* 性别
*/
private String sex;
/**
* 年龄
*/
private Long age;
/**
* 所在城市
*/
private String city;
/**
* 所在国家
*/
private String country;
/**
* 所在省份
*/
private String province;
/**
* 手机号码
*/
private String phone;
/**
* 用户语言
*/
private String language;
}
}

View File

@@ -0,0 +1,35 @@
package com.starry.admin.modules.play.module.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class PlayUserInfoAddVo {
/**
* 账户名称(手机号码)
*/
@NotBlank(message = "手机号码不能为空")
private String username;
/**
* 手机号码区号
*/
@NotBlank(message = "手机号码区号不能为空")
private String areaCode;
/**
* 验证码
*/
@NotBlank(message = "手机号码区号不能为空")
private String verificationCode;
/**
* 陪玩用户ID
*/
@NotBlank(message = "绑定用户不能为空")
private String playUserId;
}

View File

@@ -0,0 +1,21 @@
package com.starry.admin.modules.play.module.vo;
import com.starry.common.domain.BasePageEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class PlayUserInfoQueryVo extends BasePageEntity {
private String id;
private String username;
private String areaCode;
private String ruleId;
}

View File

@@ -0,0 +1,20 @@
package com.starry.admin.modules.play.module.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class PlayUserInfoUpdateVo {
@NotBlank(message = "ID不能为空")
private String id;
/**
* 陪玩用户ID
*/
@NotBlank(message = "绑定用户不能为空")
private String playUserId;
}

View File

@@ -3,97 +3,60 @@ package com.starry.admin.modules.play.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
import com.starry.admin.modules.play.module.vo.PlayUserInfoQueryVo;
/**
* 陪玩用户Service接口
* 账号Service接口
*
* @author admin
* @since 2024-03-24
* @since 2024-03-30
*/
public interface IPlayUserInfoService extends IService<PlayUserInfoEntity> {
/**
* 查询陪玩用户
* 查询账号
*
* @param id 陪玩用户主键
* @return 陪玩用户
* @param id 账号主键
* @return 账号
*/
PlayUserInfoEntity selectPlayUserInfoById(String id);
/**
* 查询陪玩用户列表
* 查询账号列表
*
* @param playUserInfo 陪玩用户
* @return 陪玩用户集合
* @param vo 账号查询实体
* @return 账号集合
*/
IPage<PlayUserInfoEntity> selectPlayUserInfoByPage(PlayUserInfoEntity playUserInfo);
IPage<PlayUserInfoEntity> selectPlayUserInfoByPage(PlayUserInfoQueryVo vo);
/**
* 新增陪玩用户
* 新增账号
*
* @param playUserInfo 陪玩用户
* @param playUserInfo 账号
* @return 结果
*/
boolean create(PlayUserInfoEntity playUserInfo);
/**
* 修改陪玩用户
* 修改账号
*
* @param playUserInfo 陪玩用户
* @param playUserInfo 账号
* @return 结果
*/
boolean update(PlayUserInfoEntity playUserInfo);
/**
* 批量删除陪玩用户
* 批量删除账号
*
* @param ids 需要删除的陪玩用户主键集合
* @param ids 需要删除的账号主键集合
* @return 结果
*/
int deletePlayUserInfoByIds(String[] ids);
/**
* 删除陪玩用户信息
* 删除账号信息
*
* @param id 陪玩用户主键
* @param id 账号主键
* @return 结果
*/
int deletePlayUserInfoById(String id);
/**
* 修改陪玩账户余额
*
* @param id 陪玩ID
* @param accountBalance 账户余额
* @param operate 余额操作【add or reduce】
*/
void editAccountBalance(String id, String accountBalance, String operate);
/**
* 修改陪玩账户等级
*
* @param id 陪玩ID
* @param level 陪玩等级
*/
void editLevel(String id, int level);
/**
* 修改陪玩账户等级
*
* @param id 陪玩ID
* @param state 陪玩状态
*/
void editState(String id, String state);
/**
* 修改陪玩在线状态
*
* @param id 陪玩ID
* @param presenceState 陪玩在线状态
*/
void editPresenceState(String id, String presenceState);
}

View File

@@ -77,9 +77,9 @@ public class PlayResourcesInfoServiceImpl extends ServiceImpl<PlayResourcesInfoM
entity.setReviewedBy(SecurityUtils.getLoginUser().getUserId());
entity.setReviewedTime(new Date());
entity.setReviewedRemark(remark);
//审核通过后,先删除旧的资源,然后将新的资源标识审核通过状态
// 审核通过后,先删除旧的资源,然后将新的资源标识审核通过状态
if (success) {
//查询当前用户,所有同类型的资源,然后删除之前的资源
// 查询当前用户,所有同类型的资源,然后删除之前的资源
LambdaQueryWrapper<PlayResourcesInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PlayResourcesInfoEntity::getPlayUserId, entity.getPlayUserId());
lambdaQueryWrapper.eq(PlayResourcesInfoEntity::getTenantId, entity.getTenantId());
@@ -91,7 +91,7 @@ public class PlayResourcesInfoServiceImpl extends ServiceImpl<PlayResourcesInfoM
}
}
this.update(entity);
//查询旧资源
// 查询旧资源
return true;
}

View File

@@ -6,9 +6,9 @@ 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.starry.admin.common.exception.CustomException;
import com.starry.admin.modules.play.mapper.PlayUserInfoMapper;
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
import com.starry.admin.modules.play.module.vo.PlayUserInfoQueryVo;
import com.starry.admin.modules.play.service.IPlayUserInfoService;
import org.springframework.stereotype.Service;
@@ -16,10 +16,10 @@ import javax.annotation.Resource;
import java.util.Arrays;
/**
* 陪玩用户Service业务层处理
* 账号Service业务层处理
*
* @author admin
* @since 2024-03-24
* @since 2024-03-30
*/
@Service
public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, PlayUserInfoEntity> implements IPlayUserInfoService {
@@ -27,83 +27,42 @@ public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, Pla
private PlayUserInfoMapper playUserInfoMapper;
/**
* 查询陪玩用户
* 查询账号
*
* @param id 陪玩用户主键
* @return 陪玩用户
* @param id 账号主键
* @return 账号
*/
@Override
public PlayUserInfoEntity selectPlayUserInfoById(String id) {
return this.baseMapper.selectById(id);
}
@Override
public void editAccountBalance(String id, String accountBalance, String operate) {
PlayUserInfoEntity entity = this.selectPlayUserInfoById(id);
if (entity == null) {
throw new CustomException("陪玩不存在");
}
long accountBalanceLong = Long.parseLong(entity.getAccountBalance());
if ("add".equals(operate)) {
accountBalanceLong += Long.parseLong(accountBalance);
} else if ("reduce".equals(operate)) {
accountBalanceLong -= Long.parseLong(accountBalance);
if (accountBalanceLong < 0) {
throw new CustomException("陪玩余额不足,操作失败");
}
}
entity.setAccountBalance(String.valueOf(accountBalanceLong));
this.update(entity);
}
@Override
public void editLevel(String id, int level) {
PlayUserInfoEntity entity = this.selectPlayUserInfoById(id);
if (entity == null) {
throw new CustomException("陪玩不存在");
}
entity.setLevel(level);
this.update(entity);
}
@Override
public void editState(String id, String state) {
PlayUserInfoEntity entity = this.selectPlayUserInfoById(id);
if (entity == null) {
throw new CustomException("陪玩不存在");
}
entity.setUserState(state);
this.update(entity);
}
@Override
public void editPresenceState(String id, String presenceState) {
PlayUserInfoEntity entity = this.selectPlayUserInfoById(id);
if (entity == null) {
throw new CustomException("陪玩不存在");
}
entity.setPresenceState(presenceState);
this.update(entity);
}
/**
* 查询陪玩用户列表
* 查询账号列表
*
* @param playUserInfo 陪玩用户
* @return 陪玩用户
* @param vo 账号查询实体
* @return 账号
*/
@Override
public IPage<PlayUserInfoEntity> selectPlayUserInfoByPage(PlayUserInfoEntity playUserInfo) {
Page<PlayUserInfoEntity> page = new Page<>(1, 10);
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
public IPage<PlayUserInfoEntity> selectPlayUserInfoByPage(PlayUserInfoQueryVo vo) {
LambdaQueryWrapper<PlayUserInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if (StrUtil.isNotBlank(vo.getId())) {
lambdaQueryWrapper.eq(PlayUserInfoEntity::getId, vo.getId());
}
if (StrUtil.isNotBlank(vo.getUsername())) {
lambdaQueryWrapper.eq(PlayUserInfoEntity::getUsername, vo.getUsername());
}
if (StrUtil.isNotBlank(vo.getAreaCode())) {
lambdaQueryWrapper.eq(PlayUserInfoEntity::getAreaCode, vo.getAreaCode());
}
Page<PlayUserInfoEntity> page = new Page<>(vo.getPageNum(), vo.getPageSize());
return this.baseMapper.selectPage(page, lambdaQueryWrapper);
}
/**
* 新增陪玩用户
* 新增账号
*
* @param playUserInfo 陪玩用户
* @param playUserInfo 账号
* @return 结果
*/
@Override
@@ -115,9 +74,9 @@ public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, Pla
}
/**
* 修改陪玩用户
* 修改账号
*
* @param playUserInfo 陪玩用户
* @param playUserInfo 账号
* @return 结果
*/
@Override
@@ -126,9 +85,9 @@ public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, Pla
}
/**
* 批量删除陪玩用户
* 批量删除账号
*
* @param ids 需要删除的陪玩用户主键
* @param ids 需要删除的账号主键
* @return 结果
*/
@Override
@@ -137,9 +96,9 @@ public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, Pla
}
/**
* 删除陪玩用户信息
* 删除账号信息
*
* @param id 陪玩用户主键
* @param id 账号主键
* @return 结果
*/
@Override