完善订单和陪玩功能
This commit is contained in:
@@ -61,9 +61,9 @@ public class PlayUserInfoEntity extends BaseEntity<PlayUserInfoEntity> {
|
||||
private String userState;
|
||||
|
||||
/**
|
||||
* 陪玩登记
|
||||
* 陪玩等级
|
||||
*/
|
||||
private String level;
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 陪玩在线状态[0:1]
|
||||
|
||||
@@ -5,57 +5,95 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
|
||||
|
||||
/**
|
||||
* 【陪玩用户Service接口
|
||||
* 陪玩用户Service接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
*/
|
||||
public interface IPlayUserInfoService extends IService<PlayUserInfoEntity> {
|
||||
/**
|
||||
* 查询【陪玩用户
|
||||
* 查询陪玩用户
|
||||
*
|
||||
* @param id 【陪玩用户主键
|
||||
* @return 【陪玩用户
|
||||
* @param id 陪玩用户主键
|
||||
* @return 陪玩用户
|
||||
*/
|
||||
PlayUserInfoEntity selectPlayUserInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询【陪玩用户列表
|
||||
* 查询陪玩用户列表
|
||||
*
|
||||
* @param playUserInfo 【陪玩用户
|
||||
* @return 【陪玩用户集合
|
||||
* @param playUserInfo 陪玩用户
|
||||
* @return 陪玩用户集合
|
||||
*/
|
||||
IPage<PlayUserInfoEntity> selectPlayUserInfoByPage(PlayUserInfoEntity playUserInfo);
|
||||
|
||||
/**
|
||||
* 新增【陪玩用户
|
||||
* 新增陪玩用户
|
||||
*
|
||||
* @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);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ 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.service.IPlayUserInfoService;
|
||||
@@ -36,6 +37,57 @@ public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, Pla
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询陪玩用户列表
|
||||
*
|
||||
@@ -45,7 +97,7 @@ public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, Pla
|
||||
@Override
|
||||
public IPage<PlayUserInfoEntity> selectPlayUserInfoByPage(PlayUserInfoEntity playUserInfo) {
|
||||
Page<PlayUserInfoEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayUserInfoEntity>());
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user