feat(resource): 添加模特图片列表、详情、删除等功能
- 新增图片列表、详情、删除、修改等接口 - 实现分页查询功能 - 添加用户信息展示 - 优化图片上传和评论相关功能feature/my-invitation
parent
4d2b660faa
commit
7f22f046c8
File diff suppressed because one or more lines are too long
|
@ -144,6 +144,27 @@ public class OrderTradeController extends BaseController {
|
|||
return map.get("alipay_trade_query_response");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看余额
|
||||
*/
|
||||
@GetMapping("/balance")
|
||||
public void balance() throws Exception {
|
||||
aliPayIntegration.balance();
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现接口
|
||||
*/
|
||||
@Anonymous
|
||||
@PostMapping("/withdraw")
|
||||
public void withdraw(@RequestBody OrderTradeDto orderTradeDto, HttpServletResponse response) throws Exception {
|
||||
String outBizNo = UUID.fastUUID().toString(true);
|
||||
String payerUserId = "2088102167258880";
|
||||
String payeeUserId = "2088102167258880";
|
||||
String amount = "100";
|
||||
aliPayIntegration.transfer(outBizNo, payerUserId, payeeUserId, amount);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 支付回调接口
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.common.utils.oss.OssUtil;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelImageComment;
|
||||
|
@ -11,9 +20,12 @@ import com.mcwl.resource.domain.ModelImageLike;
|
|||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||
import com.mcwl.resource.domain.dto.ModelImageRes;
|
||||
import com.mcwl.resource.domain.vo.ModelImageCommentVo;
|
||||
import com.mcwl.resource.domain.vo.ModelImageVo;
|
||||
import com.mcwl.resource.service.ModelImageCommentLikeService;
|
||||
import com.mcwl.resource.service.ModelImageCommentService;
|
||||
import com.mcwl.resource.service.ModelImageLikeService;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -37,6 +49,55 @@ public class ModelImageController {
|
|||
|
||||
private final ModelImageCommentLikeService modelImageCommentLikeService;
|
||||
|
||||
private final ModelImageCommentService modelImageCommentService;
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 图片列表
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody PageDomain pageDomain) {
|
||||
|
||||
return modelImageService.listByPage(pageDomain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片详情
|
||||
*/
|
||||
@GetMapping("/detail/{imageId}")
|
||||
public AjaxResult detail(@PathVariable @NotNull(message = "图片id不能为空") Long imageId) {
|
||||
ModelImageVo modelImageVo = new ModelImageVo();
|
||||
ModelImage modelImage = modelImageService.getById(imageId);
|
||||
if (Objects.nonNull(modelImage)) {
|
||||
BeanUtil.copyProperties(modelImage, modelImageVo);
|
||||
SysUser sysUser = sysUserService.selectUserById(modelImage.getUserId());
|
||||
modelImageVo.setUserId(SecurityUtils.getUserId());
|
||||
modelImageVo.setUserName(SecurityUtils.getUsername());
|
||||
modelImageVo.setUserAvatar(sysUser.getAvatar());
|
||||
}
|
||||
return AjaxResult.success(modelImageVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片删除
|
||||
*/
|
||||
@GetMapping("/delete/{imageId}")
|
||||
public AjaxResult delete(@PathVariable @NotNull(message = "图片id不能为空") Long imageId) {
|
||||
modelImageService.removeById(imageId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody ModelImageRes modelImageRes) {
|
||||
modelImageService.updateById(modelImageRes);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 图片上传
|
||||
|
@ -62,7 +123,7 @@ public class ModelImageController {
|
|||
* 图片点赞/取消
|
||||
*/
|
||||
@GetMapping("/imageLike/{imageId}")
|
||||
public AjaxResult like(@PathVariable Long imageId) {
|
||||
public AjaxResult like(@PathVariable @NotNull(message = "图片id不能为空") Long imageId) {
|
||||
modelImageLikeService.like(imageId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
@ -81,11 +142,20 @@ public class ModelImageController {
|
|||
* 图片评论点赞/取消
|
||||
*/
|
||||
@GetMapping("/commentLike/{commentId}")
|
||||
public AjaxResult commentLike(@PathVariable Long commentId) {
|
||||
public AjaxResult commentLike(@PathVariable @NotNull(message = "评论id不能为空") Long commentId) {
|
||||
modelImageCommentLikeService.like(commentId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图片评论
|
||||
*/
|
||||
@GetMapping("/commentDelete/{commentId}")
|
||||
public AjaxResult commentDelete(@PathVariable @NotNull(message = "评论id不能为空") Long commentId) {
|
||||
modelImageCommentService.removeById(commentId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片评论
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.mcwl.common.core.page;
|
|||
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 分页数据
|
||||
*
|
||||
|
@ -10,9 +12,11 @@ import com.mcwl.common.utils.StringUtils;
|
|||
public class PageDomain
|
||||
{
|
||||
/** 当前记录起始索引 */
|
||||
@NotNull(message = "当前记录起始索引不能为空")
|
||||
private Integer pageNum;
|
||||
|
||||
/** 每页显示记录数 */
|
||||
@NotNull(message = "每页显示记录数不能为空")
|
||||
private Integer pageSize;
|
||||
|
||||
/** 排序列 */
|
||||
|
|
|
@ -7,6 +7,10 @@ import javax.validation.constraints.NotBlank;
|
|||
|
||||
@Data
|
||||
public class ModelImageRes {
|
||||
/**
|
||||
* 图片id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 图片地址(最多8张,切割)
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
package com.mcwl.resource.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ModelImageVo {
|
||||
/**
|
||||
* 图片ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String userAvatar;
|
||||
/**
|
||||
* 图片地址(最多8张,切割)
|
||||
*/
|
||||
private String imagePaths;
|
||||
/**
|
||||
* 是否添加水印
|
||||
*/
|
||||
private Integer hasWatermark;
|
||||
/**
|
||||
* 是否会员下载
|
||||
*/
|
||||
private Integer isMemberDownload;
|
||||
/**
|
||||
* 是否不可下载
|
||||
*/
|
||||
private Integer isNotDownloadable;
|
||||
/**
|
||||
* 是否隐藏生成信息
|
||||
*/
|
||||
private Integer hideGenInfo;
|
||||
/**
|
||||
* 图片标题(最多30字)
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 图片标签(多个,切割)
|
||||
*/
|
||||
private String tags;
|
||||
/**
|
||||
* 描述信息(最多500)
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 在线生成数
|
||||
*/
|
||||
private Integer onlineGenNum;
|
||||
/**
|
||||
* 下载数
|
||||
*/
|
||||
private Integer downloadNum;
|
||||
/**
|
||||
* 返图数
|
||||
*/
|
||||
private Integer returnNum;
|
||||
/**
|
||||
* 点赞数
|
||||
*/
|
||||
private Integer likeNum;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -3,6 +3,8 @@ package com.mcwl.resource.service;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||
|
@ -14,6 +16,11 @@ import java.util.List;
|
|||
|
||||
|
||||
public interface ModelImageService extends IService<ModelImage> {
|
||||
/**
|
||||
* 根据id更新
|
||||
* @param modelImageRes 更新对象
|
||||
*/
|
||||
void updateById(ModelImageRes modelImageRes);
|
||||
|
||||
/**
|
||||
* 发布
|
||||
|
@ -33,4 +40,11 @@ public interface ModelImageService extends IService<ModelImage> {
|
|||
* @return 评论区
|
||||
*/
|
||||
List<ModelImageCommentVo> getComment(Long imageId);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param pageDomain 分页参数
|
||||
* @return 分页数据
|
||||
*/
|
||||
TableDataInfo listByPage(PageDomain pageDomain);
|
||||
}
|
||||
|
|
|
@ -1,27 +1,28 @@
|
|||
package com.mcwl.resource.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelImageComment;
|
||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||
import com.mcwl.resource.domain.dto.ModelImageRes;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
import com.mcwl.resource.domain.vo.ModelImageCommentVo;
|
||||
import com.mcwl.resource.mapper.MallProductLikeMapper;
|
||||
import com.mcwl.resource.domain.vo.ModelImageVo;
|
||||
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
||||
import com.mcwl.resource.mapper.ModelImageMapper;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -61,6 +62,18 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateById(ModelImageRes modelImageRes) {
|
||||
if (Objects.isNull(modelImageRes.getId())) {
|
||||
return;
|
||||
}
|
||||
ModelImage modelImage = new ModelImage();
|
||||
BeanUtil.copyProperties(modelImageRes, modelImage);
|
||||
modelImage.setUpdateBy(SecurityUtils.getUsername());
|
||||
modelImage.setUpdateTime(new Date());
|
||||
modelImageMapper.updateById(modelImage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publish(ModelImageRes modelImageRes) {
|
||||
|
||||
|
@ -102,6 +115,52 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
|||
return modelImageCommentVoList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param pageDomain 分页参数
|
||||
* @return 分页数据
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo listByPage(PageDomain pageDomain) {
|
||||
|
||||
Page<ModelImage> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
if (StringUtils.isEmpty(pageDomain.getOrderByColumn())) {
|
||||
pageDomain.setOrderByColumn("create_time");
|
||||
}
|
||||
// 设置排序
|
||||
boolean isAsc = Objects.equals(pageDomain.getIsAsc(), "asc");
|
||||
OrderItem orderItem = new OrderItem(pageDomain.getOrderByColumn(), isAsc);
|
||||
page.addOrder(orderItem);
|
||||
modelImageMapper.selectPage(page, null);
|
||||
// 获取分页数据
|
||||
List<ModelImage> modelImageList = page.getRecords();
|
||||
|
||||
// ModelImage数据转为ModelImagePageVo
|
||||
List<ModelImageVo> modelImageVoList = new ArrayList<>();
|
||||
for (ModelImage modelImage : modelImageList) {
|
||||
ModelImageVo modelImageVo = new ModelImageVo();
|
||||
BeanUtil.copyProperties(modelImage, modelImageVo);
|
||||
// 获取用户信息
|
||||
SysUser sysUser = sysUserService.selectUserById(modelImage.getUserId());
|
||||
modelImageVo.setUserId(sysUser.getUserId());
|
||||
modelImageVo.setUserName(sysUser.getUserName());
|
||||
modelImageVo.setUserAvatar(sysUser.getAvatar());
|
||||
modelImageVoList.add(modelImageVo);
|
||||
}
|
||||
|
||||
// 封装分页数据
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(HttpStatus.SUCCESS);
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setRows(modelImageVoList);
|
||||
rspData.setTotal(page.getTotal());
|
||||
|
||||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建ModelImageCommentVo对象
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue