新增陪玩管理
This commit is contained in:
@@ -317,7 +317,7 @@ public class JwtToken {
|
||||
CustomSecurityContextHolder.set(SecurityConstants.LOGIN_USER, loginUser);
|
||||
return loginUser;
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error("getNewLoginUser error", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.starry.admin.modules.order.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -14,6 +11,9 @@ import com.starry.admin.modules.order.module.entity.OrderLogInfoEntity;
|
||||
import com.starry.admin.modules.order.service.IOrderLogInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service业务层处理
|
||||
@@ -44,7 +44,7 @@ public class OrderLogInfoServiceImpl extends ServiceImpl<OrderLogInfoMapper, Ord
|
||||
@Override
|
||||
public IPage<OrderLogInfoEntity> selectOrderLogInfoByPage(OrderLogInfoEntity orderLogInfo) {
|
||||
Page<OrderLogInfoEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<OrderLogInfoEntity>());
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.starry.admin.modules.play.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.common.oss.service.IOssFileService;
|
||||
import com.starry.admin.modules.play.module.entity.PlayResourcesInfoEntity;
|
||||
import com.starry.admin.modules.play.module.vo.PlayResourcesInfoAddVo;
|
||||
import com.starry.admin.modules.play.module.vo.PlayResourcesInfoReviewVo;
|
||||
import com.starry.admin.modules.play.service.IPlayResourcesInfoService;
|
||||
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.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 陪玩资源Controller
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/play/resource/info")
|
||||
public class PlayResourcesInfoController {
|
||||
@Resource
|
||||
private IPlayResourcesInfoService playResourcesInfoService;
|
||||
|
||||
@Resource
|
||||
private IOssFileService ossFileService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询陪玩资源列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
||||
@GetMapping("/list")
|
||||
public R list(PlayResourcesInfoEntity playResourcesInfo) {
|
||||
IPage<PlayResourcesInfoEntity> list = playResourcesInfoService.selectPlayResourcesInfoByPage(playResourcesInfo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取陪玩资源详细信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R getInfo(@PathVariable("id") String id) {
|
||||
return R.ok(playResourcesInfoService.selectPlayResourcesInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 陪玩上传资源(图片/签名/视频/录音小样等)
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||
@Log(title = "陪玩资源", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/create")
|
||||
public R create(@RequestBody PlayResourcesInfoAddVo vo, @RequestParam("file") MultipartFile file) throws IOException {
|
||||
//校验文件类型是否正常
|
||||
|
||||
//上传文件到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("成功");
|
||||
}
|
||||
return R.error("添加失败");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 陪玩资料审核
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:edit')")
|
||||
@Log(title = "陪玩资源审核", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/examine")
|
||||
public R examinePlayResourcesInfo(@RequestBody PlayResourcesInfoReviewVo vo) {
|
||||
//验证权限,判断当前接口调用人是否有权限操作该接口
|
||||
|
||||
//资料审核
|
||||
playResourcesInfoService.examinePlayResourcesInfo(vo.getId(), vo.isSuccess(), vo.getRemark());
|
||||
return R.ok("成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除陪玩资源
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
|
||||
@Log(title = "陪玩资源", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R remove(@PathVariable String[] ids) {
|
||||
return R.ok(playResourcesInfoService.deletePlayResourcesInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
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.service.IPlayUserInfoService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
import com.starry.common.result.R;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 陪玩用户Controller
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/play/user/info")
|
||||
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);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取陪玩用户详细信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R getInfo(@PathVariable("id") String id) {
|
||||
return R.ok(playUserInfoService.selectPlayUserInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增陪玩用户
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||
@Log(title = "陪玩用户", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/create")
|
||||
public R create(@RequestBody PlayUserInfoEntity playUserInfo) {
|
||||
boolean success = playUserInfoService.create(playUserInfo);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("添加失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改陪玩用户
|
||||
*/
|
||||
@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);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除陪玩用户
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
|
||||
@Log(title = "陪玩用户", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R remove(@PathVariable String[] ids) {
|
||||
return R.ok(playUserInfoService.deletePlayUserInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.starry.admin.modules.play.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.starry.admin.modules.play.module.entity.PlayResourcesInfoEntity;
|
||||
|
||||
/**
|
||||
* 陪玩资源Mapper接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-23
|
||||
*/
|
||||
public interface PlayResourcesInfoMapper extends BaseMapper<PlayResourcesInfoEntity> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +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接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
*/
|
||||
public interface PlayUserInfoMapper extends BaseMapper<PlayUserInfoEntity> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.starry.admin.modules.play.module.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.starry.common.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 陪玩资源对象 play_resources_info
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("play_resources_info")
|
||||
public class PlayResourcesInfoEntity extends BaseEntity<PlayResourcesInfoEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 陪玩用户ID
|
||||
*/
|
||||
private String playUserId;
|
||||
|
||||
/**
|
||||
* 陪玩展示资源类型[0;1;2;3;4]
|
||||
* 0:签名
|
||||
* 1:录音小样
|
||||
* 2:视频小样
|
||||
* 3:轮播图
|
||||
*/
|
||||
private String resourcesType;
|
||||
|
||||
/**
|
||||
* 资源存放地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 上传时间
|
||||
*/
|
||||
private Date uploadTime;
|
||||
|
||||
/**
|
||||
* 资源状态[0;1;2;3]
|
||||
* 0:未审核
|
||||
* 1:审核通过
|
||||
* 2:审核未通过
|
||||
*/
|
||||
private String resourcesState;
|
||||
|
||||
/**
|
||||
* 审核人
|
||||
*/
|
||||
private String reviewedBy;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
private Date reviewedTime;
|
||||
|
||||
/**
|
||||
* 审核内容
|
||||
*/
|
||||
private String reviewedRemark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.starry.admin.modules.play.module.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.starry.common.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 陪玩用户对象 ply_user_info
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("play_user_info")
|
||||
public class PlayUserInfoEntity extends BaseEntity<PlayUserInfoEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 证件号码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 账户余额
|
||||
*/
|
||||
private String accountBalance;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
private String profilePicture;
|
||||
|
||||
/**
|
||||
* 陪玩状态[0,1,2]
|
||||
* 0:正常,
|
||||
* 1:被标记:
|
||||
* 2:被封禁
|
||||
*/
|
||||
private String userState;
|
||||
|
||||
/**
|
||||
* 陪玩登记
|
||||
*/
|
||||
private String 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;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.starry.admin.modules.play.module.vo;
|
||||
|
||||
import com.starry.common.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 新增陪玩资料对象
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class PlayResourcesInfoAddVo extends BaseEntity<PlayResourcesInfoAddVo> {
|
||||
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@NotNull(message = "租户ID不能为空")
|
||||
private String tenantId;
|
||||
|
||||
|
||||
/**
|
||||
* 陪玩展示资源类型[0;1;2;3;4]
|
||||
* 0:签名
|
||||
* 1:录音小样
|
||||
* 2:视频小样
|
||||
* 3:轮播图
|
||||
*/
|
||||
@NotNull(message = "资源类型不能为空")
|
||||
private String resourcesType;
|
||||
|
||||
|
||||
/**
|
||||
* 资源状态[0;1;2;3]
|
||||
* 0:未审核
|
||||
* 1:审核通过
|
||||
* 2:审核未通过
|
||||
*/
|
||||
private String resourcesState = "0";
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.starry.admin.modules.play.module.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 陪玩资料审核
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class PlayResourcesInfoReviewVo {
|
||||
|
||||
|
||||
@NotNull(message = "ID不能为空")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@NotNull(message = "租户ID不能为空")
|
||||
private String tenantId;
|
||||
|
||||
|
||||
/**
|
||||
* 是否通过
|
||||
*/
|
||||
private boolean success;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
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.PlayResourcesInfoEntity;
|
||||
|
||||
/**
|
||||
* 陪玩资源Service接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
*/
|
||||
public interface IPlayResourcesInfoService extends IService<PlayResourcesInfoEntity> {
|
||||
/**
|
||||
* 查询陪玩资源
|
||||
*
|
||||
* @param id 陪玩资源主键
|
||||
* @return 陪玩资源
|
||||
*/
|
||||
PlayResourcesInfoEntity selectPlayResourcesInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询陪玩资源列表
|
||||
*
|
||||
* @param playResourcesInfo 陪玩资源
|
||||
* @return 陪玩资源集合
|
||||
*/
|
||||
IPage<PlayResourcesInfoEntity> selectPlayResourcesInfoByPage(PlayResourcesInfoEntity playResourcesInfo);
|
||||
|
||||
/**
|
||||
* 新增陪玩资源
|
||||
*
|
||||
* @param playResourcesInfo 陪玩资源
|
||||
* @return 结果
|
||||
*/
|
||||
boolean create(PlayResourcesInfoEntity playResourcesInfo);
|
||||
|
||||
|
||||
/**
|
||||
* 审核陪玩资源信息
|
||||
*
|
||||
* @param id 资源ID
|
||||
* @param success 是否通过
|
||||
* @param remark 备注
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean examinePlayResourcesInfo(String id, boolean success, String remark);
|
||||
|
||||
/**
|
||||
* 修改陪玩资源
|
||||
*
|
||||
* @param playResourcesInfo 陪玩资源
|
||||
* @return 结果
|
||||
*/
|
||||
boolean update(PlayResourcesInfoEntity playResourcesInfo);
|
||||
|
||||
/**
|
||||
* 批量删除陪玩资源
|
||||
*
|
||||
* @param ids 需要删除的陪玩资源主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayResourcesInfoByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除陪玩资源信息
|
||||
*
|
||||
* @param id 陪玩资源主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayResourcesInfoById(String id);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 【陪玩用户Service接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
*/
|
||||
public interface IPlayUserInfoService extends IService<PlayUserInfoEntity> {
|
||||
/**
|
||||
* 查询【陪玩用户
|
||||
*
|
||||
* @param id 【陪玩用户主键
|
||||
* @return 【陪玩用户
|
||||
*/
|
||||
PlayUserInfoEntity selectPlayUserInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询【陪玩用户列表
|
||||
*
|
||||
* @param playUserInfo 【陪玩用户
|
||||
* @return 【陪玩用户集合
|
||||
*/
|
||||
IPage<PlayUserInfoEntity> selectPlayUserInfoByPage(PlayUserInfoEntity playUserInfo);
|
||||
|
||||
/**
|
||||
* 新增【陪玩用户
|
||||
*
|
||||
* @param playUserInfo 【陪玩用户
|
||||
* @return 结果
|
||||
*/
|
||||
boolean create(PlayUserInfoEntity playUserInfo);
|
||||
|
||||
/**
|
||||
* 修改【陪玩用户
|
||||
*
|
||||
* @param playUserInfo 【陪玩用户
|
||||
* @return 结果
|
||||
*/
|
||||
boolean update(PlayUserInfoEntity playUserInfo);
|
||||
|
||||
/**
|
||||
* 批量删除【陪玩用户
|
||||
*
|
||||
* @param ids 需要删除的【陪玩用户主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayUserInfoByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除【陪玩用户信息
|
||||
*
|
||||
* @param id 【陪玩用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayUserInfoById(String id);
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.starry.admin.modules.play.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
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.starry.admin.common.exception.CustomException;
|
||||
import com.starry.admin.modules.play.mapper.PlayResourcesInfoMapper;
|
||||
import com.starry.admin.modules.play.module.entity.PlayResourcesInfoEntity;
|
||||
import com.starry.admin.modules.play.service.IPlayResourcesInfoService;
|
||||
import com.starry.admin.utils.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 陪玩资源Service业务层处理
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
*/
|
||||
@Service
|
||||
public class PlayResourcesInfoServiceImpl extends ServiceImpl<PlayResourcesInfoMapper, PlayResourcesInfoEntity> implements IPlayResourcesInfoService {
|
||||
@Resource
|
||||
private PlayResourcesInfoMapper playResourcesInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询陪玩资源
|
||||
*
|
||||
* @param id 陪玩资源主键
|
||||
* @return 陪玩资源
|
||||
*/
|
||||
@Override
|
||||
public PlayResourcesInfoEntity selectPlayResourcesInfoById(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询陪玩资源列表
|
||||
*
|
||||
* @param playResourcesInfo 陪玩资源
|
||||
* @return 陪玩资源
|
||||
*/
|
||||
@Override
|
||||
public IPage<PlayResourcesInfoEntity> selectPlayResourcesInfoByPage(PlayResourcesInfoEntity playResourcesInfo) {
|
||||
Page<PlayResourcesInfoEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayResourcesInfoEntity>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增陪玩资源
|
||||
*
|
||||
* @param playResourcesInfo 陪玩资源
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean create(PlayResourcesInfoEntity playResourcesInfo) {
|
||||
if (StrUtil.isBlankIfStr(playResourcesInfo.getId())) {
|
||||
playResourcesInfo.setId(IdUtil.fastSimpleUUID());
|
||||
}
|
||||
playResourcesInfo.setPlayUserId(SecurityUtils.getLoginUser().getUserId());
|
||||
return save(playResourcesInfo);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean examinePlayResourcesInfo(String id, boolean success, String remark) {
|
||||
PlayResourcesInfoEntity entity = this.selectPlayResourcesInfoById(id);
|
||||
if (entity == null) {
|
||||
throw new CustomException("资源不存在,请检查");
|
||||
}
|
||||
entity.setResourcesState(success ? "1" : "2");
|
||||
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());
|
||||
lambdaQueryWrapper.eq(PlayResourcesInfoEntity::getResourcesType, entity.getResourcesType());
|
||||
for (PlayResourcesInfoEntity item : this.baseMapper.selectList(lambdaQueryWrapper)) {
|
||||
if (!id.equals(item.getId())) {
|
||||
this.deletePlayResourcesInfoById(item.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
this.update(entity);
|
||||
//查询旧资源
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改陪玩资源
|
||||
*
|
||||
* @param playResourcesInfo 陪玩资源
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean update(PlayResourcesInfoEntity playResourcesInfo) {
|
||||
return updateById(playResourcesInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除陪玩资源
|
||||
*
|
||||
* @param ids 需要删除的陪玩资源主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayResourcesInfoByIds(String[] ids) {
|
||||
return playResourcesInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除陪玩资源信息
|
||||
*
|
||||
* @param id 陪玩资源主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayResourcesInfoById(String id) {
|
||||
return playResourcesInfoMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.starry.admin.modules.play.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
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.starry.admin.modules.play.mapper.PlayUserInfoMapper;
|
||||
import com.starry.admin.modules.play.module.entity.PlayUserInfoEntity;
|
||||
import com.starry.admin.modules.play.service.IPlayUserInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 陪玩用户Service业务层处理
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-03-24
|
||||
*/
|
||||
@Service
|
||||
public class PlayUserInfoServiceImpl extends ServiceImpl<PlayUserInfoMapper, PlayUserInfoEntity> implements IPlayUserInfoService {
|
||||
@Resource
|
||||
private PlayUserInfoMapper playUserInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询陪玩用户
|
||||
*
|
||||
* @param id 陪玩用户主键
|
||||
* @return 陪玩用户
|
||||
*/
|
||||
@Override
|
||||
public PlayUserInfoEntity selectPlayUserInfoById(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询陪玩用户列表
|
||||
*
|
||||
* @param playUserInfo 陪玩用户
|
||||
* @return 陪玩用户
|
||||
*/
|
||||
@Override
|
||||
public IPage<PlayUserInfoEntity> selectPlayUserInfoByPage(PlayUserInfoEntity playUserInfo) {
|
||||
Page<PlayUserInfoEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayUserInfoEntity>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增陪玩用户
|
||||
*
|
||||
* @param playUserInfo 陪玩用户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean create(PlayUserInfoEntity playUserInfo) {
|
||||
if (StrUtil.isBlankIfStr(playUserInfo.getId())) {
|
||||
playUserInfo.setId(IdUtil.fastSimpleUUID());
|
||||
}
|
||||
return save(playUserInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改陪玩用户
|
||||
*
|
||||
* @param playUserInfo 陪玩用户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean update(PlayUserInfoEntity playUserInfo) {
|
||||
return updateById(playUserInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除陪玩用户
|
||||
*
|
||||
* @param ids 需要删除的陪玩用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayUserInfoByIds(String[] ids) {
|
||||
return playUserInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除陪玩用户信息
|
||||
*
|
||||
* @param id 陪玩用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayUserInfoById(String id) {
|
||||
return playUserInfoMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user