Compare commits
3 Commits
421ca7dc9d
...
d49115ec61
Author | SHA1 | Date |
---|---|---|
|
d49115ec61 | |
|
90de149f8f | |
|
bd42786571 |
|
@ -1,8 +1,10 @@
|
||||||
package com.mcwl.web.controller.resource;
|
package com.mcwl.web.controller.resource;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.mcwl.common.core.controller.BaseController;
|
import com.mcwl.common.core.controller.BaseController;
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
|
import com.mcwl.common.core.page.PageDomain;
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
import com.mcwl.common.core.page.TableDataInfo;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.resource.domain.ModelProduct;
|
import com.mcwl.resource.domain.ModelProduct;
|
||||||
|
@ -12,6 +14,7 @@ import com.mcwl.resource.domain.request.RequestWorkFlow;
|
||||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||||
import com.mcwl.resource.service.ModelImageService;
|
import com.mcwl.resource.service.ModelImageService;
|
||||||
import com.mcwl.resource.service.ModelService;
|
import com.mcwl.resource.service.ModelService;
|
||||||
|
import com.mcwl.resource.service.WorkFlowService;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import com.mcwl.web.controller.common.OssUtil;
|
import com.mcwl.web.controller.common.OssUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -23,6 +26,7 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品
|
* 商品
|
||||||
|
*
|
||||||
* @Author:ChenYan
|
* @Author:ChenYan
|
||||||
* @Project:McWl
|
* @Project:McWl
|
||||||
* @Package:com.mcwl.web.controller.resource
|
* @Package:com.mcwl.web.controller.resource
|
||||||
|
@ -42,6 +46,9 @@ public class MallProductController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ModelImageService modelImageService;
|
private ModelImageService modelImageService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WorkFlowService workFlowService;
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*
|
*
|
||||||
|
@ -50,7 +57,7 @@ public class MallProductController extends BaseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/file")
|
@PostMapping("/file")
|
||||||
public AjaxResult Malifile(@RequestParam MultipartFile file){
|
public AjaxResult Malifile(@RequestParam MultipartFile file) {
|
||||||
|
|
||||||
String s = OssUtil.uploadMultipartFile(file);
|
String s = OssUtil.uploadMultipartFile(file);
|
||||||
return AjaxResult.success(s);
|
return AjaxResult.success(s);
|
||||||
|
@ -64,14 +71,12 @@ public class MallProductController extends BaseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/zipUrlFile")
|
@PostMapping("/zipUrlFile")
|
||||||
public AjaxResult zipUrlFile(@RequestParam MultipartFile file){
|
public AjaxResult zipUrlFile(@RequestParam MultipartFile file) {
|
||||||
String s = OssUtil.uploadMultipartFile(file);
|
String s = OssUtil.uploadMultipartFile(file);
|
||||||
return AjaxResult.success(s);
|
return AjaxResult.success(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*
|
*
|
||||||
* 下载zip
|
* 下载zip
|
||||||
|
@ -79,15 +84,12 @@ public class MallProductController extends BaseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/zipUrl")
|
@PostMapping("/zipUrl")
|
||||||
public AjaxResult zipUrl(@RequestParam MultipartFile file){
|
public AjaxResult zipUrl(@RequestParam MultipartFile file) {
|
||||||
String s = OssUtil.uploadMultipartFile(file);
|
String s = OssUtil.uploadMultipartFile(file);
|
||||||
return AjaxResult.success(s);
|
return AjaxResult.success(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模型列表
|
* 模型列表
|
||||||
*/
|
*/
|
||||||
|
@ -98,19 +100,15 @@ public class MallProductController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("finbyid")
|
@PostMapping("finbyid")
|
||||||
public AjaxResult finbyid(@RequestBody ModelProduct modelVersion)
|
public AjaxResult finbyid(@RequestBody ModelProduct modelVersion) {
|
||||||
{
|
|
||||||
ModelProduct modelVersion1 = modelService.getById(modelVersion.getId());
|
ModelProduct modelVersion1 = modelService.getById(modelVersion.getId());
|
||||||
return AjaxResult.success(modelVersion1);
|
return AjaxResult.success(modelVersion1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/insert")
|
@PostMapping("/insert")
|
||||||
public AjaxResult addupdateModel(@RequestBody RequestModel requestModel){
|
public AjaxResult addupdateModel(@RequestBody RequestModel requestModel) {
|
||||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
modelProduct.setUserId(userId);
|
modelProduct.setUserId(userId);
|
||||||
|
@ -119,7 +117,7 @@ public class MallProductController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public AjaxResult updateModel(@RequestBody RequestModel requestModel){
|
public AjaxResult updateModel(@RequestBody RequestModel requestModel) {
|
||||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||||
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
@ -132,48 +130,80 @@ public class MallProductController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("delete")
|
@PostMapping("delete")
|
||||||
public AjaxResult delete(@RequestBody ModelProduct modelVersion)
|
public AjaxResult delete(@RequestBody ModelProduct modelVersion) {
|
||||||
{
|
|
||||||
modelService.removeById(modelVersion.getId());
|
modelService.removeById(modelVersion.getId());
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看用户发布的作品
|
* 查询模型详情
|
||||||
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/selectByUserId")
|
@GetMapping("/selectModelById")
|
||||||
public AjaxResult selectByUserId(@RequestBody MallProductVo mallProductVo){
|
public AjaxResult selectModelById(@RequestParam Long id){
|
||||||
|
|
||||||
Page<ModelProduct> mallProductList = modelService.selectByUserId(mallProductVo);
|
return modelService.selectModelById(id);
|
||||||
return AjaxResult.success(mallProductList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的发布-模型
|
* 我的发布-模型
|
||||||
*/
|
*/
|
||||||
@PostMapping("/selectByUserIdModel")
|
@PostMapping("/selectByUserIdModel")
|
||||||
public AjaxResult selectByUserIdModel(@RequestBody MallProductVo mallProductVo){
|
public TableDataInfo selectByUserIdModel(@RequestBody ModelImagePageRes imagePageRes) {
|
||||||
|
|
||||||
return AjaxResult.success();
|
return modelService.listByPage(imagePageRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的发布-工作流
|
* 我的发布-工作流
|
||||||
*/
|
*/
|
||||||
@PostMapping("/selectByUserIdWorkFlow")
|
@PostMapping("/selectByUserIdWorkFlow")
|
||||||
public AjaxResult selectByUserIdWorkFlow(@RequestBody MallProductVo mallProductVo){
|
public TableDataInfo selectByUserIdWorkFlow(@RequestBody ModelImagePageRes imagePageRes) {
|
||||||
|
|
||||||
return AjaxResult.success();
|
return workFlowService.listByPage(imagePageRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的发布-图片
|
* 我的发布-图片
|
||||||
*/
|
*/
|
||||||
@PostMapping("/selectByUserIdImage")
|
@PostMapping("/selectByUserIdImage")
|
||||||
public TableDataInfo selectByUserIdImage(@RequestBody ModelImagePageRes imagePageRes){
|
public TableDataInfo selectByUserIdImage(@RequestBody ModelImagePageRes imagePageRes) {
|
||||||
|
|
||||||
return modelImageService.listByPage(imagePageRes);
|
return modelImageService.listByPage(imagePageRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点赞-模型
|
||||||
|
*/
|
||||||
|
@PostMapping("/likeModel")
|
||||||
|
public TableDataInfo likeModel(@RequestBody PageDomain pageDomain) {
|
||||||
|
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||||
|
BeanUtil.copyProperties(pageDomain, imagePageRes);
|
||||||
|
imagePageRes.setUserId(SecurityUtils.getUserId());
|
||||||
|
return modelService.listByPage(imagePageRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点赞-工作流
|
||||||
|
*/
|
||||||
|
@PostMapping("/likeWorkFlow")
|
||||||
|
public TableDataInfo likeWorkFlow(@RequestBody PageDomain pageDomain) {
|
||||||
|
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||||
|
BeanUtil.copyProperties(pageDomain, imagePageRes);
|
||||||
|
imagePageRes.setUserId(SecurityUtils.getUserId());
|
||||||
|
return workFlowService.listByPage(imagePageRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点赞-图片
|
||||||
|
*/
|
||||||
|
@PostMapping("/likeImage")
|
||||||
|
public TableDataInfo likeImage(@RequestBody PageDomain pageDomain) {
|
||||||
|
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||||
|
BeanUtil.copyProperties(pageDomain, imagePageRes);
|
||||||
|
imagePageRes.setUserId(SecurityUtils.getUserId());
|
||||||
|
return modelImageService.listByPage(imagePageRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.mcwl</groupId>
|
<groupId>com.mcwl</groupId>
|
||||||
<artifactId>mcwl-admin</artifactId>
|
<artifactId>mcwl-system</artifactId>
|
||||||
<version>3.8.8</version>
|
<version>3.8.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,10 @@ public class ModelProduct extends BaseEntity {
|
||||||
* 生图次数
|
* 生图次数
|
||||||
*/
|
*/
|
||||||
private Integer reals;
|
private Integer reals;
|
||||||
|
/**
|
||||||
|
* 封面图
|
||||||
|
*/
|
||||||
|
private String surfaceUrl;
|
||||||
/**
|
/**
|
||||||
* 下载次数
|
* 下载次数
|
||||||
*/
|
*/
|
||||||
|
@ -104,14 +108,9 @@ public class ModelProduct extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
/**
|
|
||||||
* 翻译后主体
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private List<String> themeList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 翻译后风格
|
* 翻译后标签
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<String> styleList;
|
private List<String> styleList;
|
||||||
|
|
|
@ -35,6 +35,10 @@ public class WorkFlow {
|
||||||
*/
|
*/
|
||||||
@TableId
|
@TableId
|
||||||
private Long id;
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
/**
|
/**
|
||||||
* 名称(最多30字)
|
* 名称(最多30字)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.mcwl.resource.domain.vo;
|
package com.mcwl.resource.domain.vo;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.mcwl.common.core.page.PageDomain;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
|
@ -5,9 +5,17 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
public class ModelVo {
|
public class ModelVo {
|
||||||
/**
|
/**
|
||||||
* 图片ID
|
* 模型id
|
||||||
*/
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 模型名称
|
||||||
|
*/
|
||||||
|
private String modelName;
|
||||||
|
/**
|
||||||
|
* 封面图
|
||||||
|
*/
|
||||||
|
private String surfaceUrl;
|
||||||
/**
|
/**
|
||||||
* 用户ID
|
* 用户ID
|
||||||
*/
|
*/
|
||||||
|
@ -20,54 +28,14 @@ public class ModelVo {
|
||||||
* 用户头像
|
* 用户头像
|
||||||
*/
|
*/
|
||||||
private String userAvatar;
|
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 reals;
|
||||||
/**
|
/**
|
||||||
* 下载数
|
* 下载数
|
||||||
*/
|
*/
|
||||||
private Integer downloadNum;
|
private Integer numbers;
|
||||||
/**
|
|
||||||
* 返图数
|
|
||||||
*/
|
|
||||||
private Integer returnNum;
|
|
||||||
/**
|
|
||||||
* 点赞数
|
|
||||||
*/
|
|
||||||
private Integer likeNum;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.mcwl.resource.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WorkFlowVo {
|
||||||
|
/**
|
||||||
|
* 工作流id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 工作流名称
|
||||||
|
*/
|
||||||
|
private String workflowName;
|
||||||
|
/**
|
||||||
|
* 封面图
|
||||||
|
*/
|
||||||
|
private String coverPath;
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
/**
|
||||||
|
* 用户头像
|
||||||
|
*/
|
||||||
|
private String userAvatar;
|
||||||
|
/**
|
||||||
|
* 在线生成数
|
||||||
|
*/
|
||||||
|
private Integer useNumber;
|
||||||
|
/**
|
||||||
|
* 下载数
|
||||||
|
*/
|
||||||
|
private Integer downloadNumber;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -34,4 +34,6 @@ public interface ModelService extends IService<ModelProduct> {
|
||||||
|
|
||||||
void updaModel(RequestModel requestModel);
|
void updaModel(RequestModel requestModel);
|
||||||
|
|
||||||
|
AjaxResult selectModelById(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package com.mcwl.resource.service;
|
package com.mcwl.resource.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
|
import com.mcwl.common.core.page.TableDataInfo;
|
||||||
|
import com.mcwl.resource.domain.WorkFlow;
|
||||||
|
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||||
import com.mcwl.resource.domain.request.RequestWorkFlow;
|
import com.mcwl.resource.domain.request.RequestWorkFlow;
|
||||||
import com.mcwl.resource.domain.vo.PageVo;
|
import com.mcwl.resource.domain.vo.PageVo;
|
||||||
|
|
||||||
|
@ -11,7 +15,7 @@ import com.mcwl.resource.domain.vo.PageVo;
|
||||||
* @apiNote
|
* @apiNote
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface WorkFlowService {
|
public interface WorkFlowService extends IService<WorkFlow> {
|
||||||
AjaxResult addWorkFlow(RequestWorkFlow requestWorkFlow);
|
AjaxResult addWorkFlow(RequestWorkFlow requestWorkFlow);
|
||||||
|
|
||||||
void updateWorkFlow(RequestWorkFlow requestWorkFlow);
|
void updateWorkFlow(RequestWorkFlow requestWorkFlow);
|
||||||
|
@ -21,4 +25,8 @@ public interface WorkFlowService {
|
||||||
AjaxResult selectWorkFlow(PageVo pageVo);
|
AjaxResult selectWorkFlow(PageVo pageVo);
|
||||||
|
|
||||||
AjaxResult selectWorkFlowById(Long id);
|
AjaxResult selectWorkFlowById(Long id);
|
||||||
|
|
||||||
|
TableDataInfo listByPage(ModelImagePageRes imagePageRes);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
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.mcwl.common.constant.DictConstants;
|
||||||
import com.mcwl.common.constant.HttpStatus;
|
import com.mcwl.common.constant.HttpStatus;
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
import com.mcwl.common.core.domain.entity.SysUser;
|
||||||
|
@ -15,15 +16,15 @@ import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
import com.mcwl.common.utils.StringUtils;
|
||||||
import com.mcwl.resource.domain.ModelProduct;
|
import com.mcwl.resource.domain.ModelProduct;
|
||||||
import com.mcwl.resource.domain.ModelVersion;
|
import com.mcwl.resource.domain.ModelVersion;
|
||||||
import com.mcwl.resource.domain.WorkFlow;
|
|
||||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||||
import com.mcwl.resource.domain.request.RequestModel;
|
import com.mcwl.resource.domain.request.RequestModel;
|
||||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||||
import com.mcwl.resource.domain.vo.ModelImageVo;
|
import com.mcwl.resource.domain.vo.ModelVo;
|
||||||
import com.mcwl.resource.mapper.ModelMapper;
|
import com.mcwl.resource.mapper.ModelMapper;
|
||||||
|
|
||||||
import com.mcwl.resource.mapper.ModelVersionMapper;
|
import com.mcwl.resource.mapper.ModelVersionMapper;
|
||||||
import com.mcwl.resource.service.ModelService;
|
import com.mcwl.resource.service.ModelService;
|
||||||
|
import com.mcwl.resource.service.ToActivityService;
|
||||||
|
import com.mcwl.system.init.DictInit;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -49,6 +50,8 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ToActivityService toActivityService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ModelVersionMapper modelVersionMapper;
|
private ModelVersionMapper modelVersionMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -114,7 +117,6 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
||||||
LambdaQueryWrapper<ModelProduct> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ModelProduct> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(imagePageRes.getStatus() != null, ModelProduct::getAuditSatus, imagePageRes.getStatus())
|
lqw.eq(imagePageRes.getStatus() != null, ModelProduct::getAuditSatus, imagePageRes.getStatus())
|
||||||
.eq(imagePageRes.getUserId() != null, ModelProduct::getUserId, imagePageRes.getUserId())
|
.eq(imagePageRes.getUserId() != null, ModelProduct::getUserId, imagePageRes.getUserId())
|
||||||
.eq(imagePageRes.getPageNum() != null, ModelProduct::getUserId, imagePageRes.getUserId())
|
|
||||||
.ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime())
|
.ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime())
|
||||||
.le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime());
|
.le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime());
|
||||||
|
|
||||||
|
@ -123,23 +125,23 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
||||||
List<ModelProduct> modelImageList = page.getRecords();
|
List<ModelProduct> modelImageList = page.getRecords();
|
||||||
|
|
||||||
// Model数据转为ModelPageVo
|
// Model数据转为ModelPageVo
|
||||||
List<ModelImageVo> modelImageVoList = new ArrayList<>();
|
List<ModelVo> modelVoList = new ArrayList<>();
|
||||||
for (ModelProduct modelImage : modelImageList) {
|
for (ModelProduct modelImage : modelImageList) {
|
||||||
ModelImageVo modelImageVo = new ModelImageVo();
|
ModelVo modelVo = new ModelVo();
|
||||||
BeanUtil.copyProperties(modelImage, modelImageVo);
|
BeanUtil.copyProperties(modelImage, modelVo);
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
SysUser sysUser = sysUserService.selectUserById(modelImage.getUserId());
|
SysUser sysUser = sysUserService.selectUserById(modelImage.getUserId());
|
||||||
modelImageVo.setUserId(sysUser.getUserId());
|
modelVo.setUserId(sysUser.getUserId());
|
||||||
modelImageVo.setUserName(sysUser.getUserName());
|
modelVo.setUserName(sysUser.getUserName());
|
||||||
modelImageVo.setUserAvatar(sysUser.getAvatar());
|
modelVo.setUserAvatar(sysUser.getAvatar());
|
||||||
modelImageVoList.add(modelImageVo);
|
modelVoList.add(modelVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 封装分页数据
|
// 封装分页数据
|
||||||
TableDataInfo rspData = new TableDataInfo();
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
rspData.setCode(HttpStatus.SUCCESS);
|
rspData.setCode(HttpStatus.SUCCESS);
|
||||||
rspData.setMsg("查询成功");
|
rspData.setMsg("查询成功");
|
||||||
rspData.setRows(modelImageVoList);
|
rspData.setRows(modelVoList);
|
||||||
rspData.setTotal(page.getTotal());
|
rspData.setTotal(page.getTotal());
|
||||||
|
|
||||||
return rspData;
|
return rspData;
|
||||||
|
@ -151,7 +153,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
||||||
String filePath = requestModel.getModelVersionList().get(0).getFilePath();
|
String filePath = requestModel.getModelVersionList().get(0).getFilePath();
|
||||||
String[] split = filePath.split(",");
|
String[] split = filePath.split(",");
|
||||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||||
modelProduct.setCategory(split[0]);
|
modelProduct.setSurfaceUrl(split[0]);
|
||||||
modelProduct.setCreateTime(new Date());
|
modelProduct.setCreateTime(new Date());
|
||||||
|
|
||||||
|
|
||||||
|
@ -197,4 +199,41 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult selectModelById(Long id) {
|
||||||
|
//查询详情
|
||||||
|
ModelProduct modelProduct = postMapper.selectById(id);
|
||||||
|
|
||||||
|
//翻译属性 垂类
|
||||||
|
if (StringUtils.isNotEmpty(modelProduct.getCategory())){
|
||||||
|
modelProduct.setCategory(DictInit.getDictValue(DictConstants.MODEL_CHILD_CATEGORY,modelProduct.getCategory()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//标签
|
||||||
|
if (StringUtils.isNotEmpty(modelProduct.getTags())){
|
||||||
|
ArrayList<String> strings = new ArrayList<>();
|
||||||
|
String[] split = modelProduct.getTags().split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
if (s != ""){
|
||||||
|
strings.add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
modelProduct.setStyleList(strings);
|
||||||
|
}
|
||||||
|
|
||||||
|
//功能
|
||||||
|
if (StringUtils.isNotEmpty(modelProduct.getFunctions())){
|
||||||
|
modelProduct.setCategory(DictInit.getDictValue(DictConstants.WORK_FLOW_FUNCTIONS,modelProduct.getFunctions()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//活动
|
||||||
|
if (StringUtils.isNotEmpty(modelProduct.getActivityId())){
|
||||||
|
modelProduct.setActivityId(toActivityService.getById(modelProduct.getActivityId()).getActivityName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return AjaxResult.success(modelProduct);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,38 @@
|
||||||
package com.mcwl.resource.service.impl;
|
package com.mcwl.resource.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
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.mcwl.common.constant.DictConstants;
|
import com.mcwl.common.constant.DictConstants;
|
||||||
|
import com.mcwl.common.constant.HttpStatus;
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
|
import com.mcwl.common.core.domain.entity.SysUser;
|
||||||
|
import com.mcwl.common.core.page.TableDataInfo;
|
||||||
import com.mcwl.common.utils.StringUtils;
|
import com.mcwl.common.utils.StringUtils;
|
||||||
import com.mcwl.resource.domain.WorkFlow;
|
import com.mcwl.resource.domain.WorkFlow;
|
||||||
import com.mcwl.resource.domain.WorkFlowVersion;
|
import com.mcwl.resource.domain.WorkFlowVersion;
|
||||||
|
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||||
import com.mcwl.resource.domain.request.RequestWorkFlow;
|
import com.mcwl.resource.domain.request.RequestWorkFlow;
|
||||||
import com.mcwl.resource.domain.vo.PageVo;
|
import com.mcwl.resource.domain.vo.PageVo;
|
||||||
|
import com.mcwl.resource.domain.vo.WorkFlowVo;
|
||||||
import com.mcwl.resource.mapper.WorkFlowMapper;
|
import com.mcwl.resource.mapper.WorkFlowMapper;
|
||||||
import com.mcwl.resource.mapper.WorkFlowVersionMapper;
|
import com.mcwl.resource.mapper.WorkFlowVersionMapper;
|
||||||
import com.mcwl.resource.service.ToActivityService;
|
import com.mcwl.resource.service.ToActivityService;
|
||||||
import com.mcwl.resource.service.WorkFlowService;
|
import com.mcwl.resource.service.WorkFlowService;
|
||||||
import com.mcwl.web.controller.init.DictInit;
|
import com.mcwl.system.init.DictInit;
|
||||||
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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 java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工作流 业务实现层
|
* 工作流 业务实现层
|
||||||
|
@ -32,7 +43,7 @@ import java.util.Date;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class WorkFlowServiceImpl implements WorkFlowService {
|
public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> implements WorkFlowService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WorkFlowMapper flowMapper;
|
private WorkFlowMapper flowMapper;
|
||||||
|
@ -43,6 +54,9 @@ public class WorkFlowServiceImpl implements WorkFlowService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ToActivityService toActivityService;
|
private ToActivityService toActivityService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService sysUserService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult addWorkFlow(RequestWorkFlow requestWorkFlow) {
|
public AjaxResult addWorkFlow(RequestWorkFlow requestWorkFlow) {
|
||||||
|
|
||||||
|
@ -173,4 +187,53 @@ public class WorkFlowServiceImpl implements WorkFlowService {
|
||||||
|
|
||||||
return AjaxResult.success(workFlow);
|
return AjaxResult.success(workFlow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableDataInfo listByPage(ModelImagePageRes imagePageRes) {
|
||||||
|
|
||||||
|
Page<WorkFlow> page = new Page<>(imagePageRes.getPageNum(), imagePageRes.getPageSize());
|
||||||
|
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
|
||||||
|
imagePageRes.setOrderByColumn("create_time");
|
||||||
|
}
|
||||||
|
// 设置排序
|
||||||
|
boolean isAsc = Objects.equals(imagePageRes.getIsAsc(), "asc");
|
||||||
|
OrderItem orderItem = new OrderItem(imagePageRes.getOrderByColumn(), isAsc);
|
||||||
|
page.addOrder(orderItem);
|
||||||
|
|
||||||
|
LambdaQueryWrapper<WorkFlow> lqw = new LambdaQueryWrapper<>();
|
||||||
|
lqw.eq(imagePageRes.getStatus() != null, WorkFlow::getAuditStatus, imagePageRes.getStatus())
|
||||||
|
.eq(imagePageRes.getUserId() != null, WorkFlow::getUserId, imagePageRes.getUserId())
|
||||||
|
.ge(imagePageRes.getStartTime() != null, WorkFlow::getCreateTime, imagePageRes.getStartTime())
|
||||||
|
.le(imagePageRes.getEndTime() != null, WorkFlow::getCreateTime, imagePageRes.getEndTime());
|
||||||
|
|
||||||
|
baseMapper.selectPage(page, lqw);
|
||||||
|
// 获取分页数据
|
||||||
|
List<WorkFlow> workFlowList = page.getRecords();
|
||||||
|
|
||||||
|
// WorkFlow数据转为WorkFlowVo
|
||||||
|
List<WorkFlowVo> workFlowVoList = new ArrayList<>();
|
||||||
|
for (WorkFlow workFlow : workFlowList) {
|
||||||
|
WorkFlowVo workFlowVo = new WorkFlowVo();
|
||||||
|
BeanUtil.copyProperties(workFlow, workFlowVo);
|
||||||
|
// 获取用户信息
|
||||||
|
SysUser sysUser = sysUserService.selectUserById(workFlow.getUserId());
|
||||||
|
workFlowVo.setUserId(sysUser.getUserId());
|
||||||
|
workFlowVo.setUserName(sysUser.getUserName());
|
||||||
|
workFlowVo.setUserAvatar(sysUser.getAvatar());
|
||||||
|
workFlowVoList.add(workFlowVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 封装分页数据
|
||||||
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
|
rspData.setCode(HttpStatus.SUCCESS);
|
||||||
|
rspData.setMsg("查询成功");
|
||||||
|
rspData.setRows(workFlowVoList);
|
||||||
|
rspData.setTotal(page.getTotal());
|
||||||
|
|
||||||
|
return rspData;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.mcwl.web.controller.init;
|
package com.mcwl.system.init;
|
||||||
|
|
||||||
import com.mcwl.common.core.domain.entity.SysDictData;
|
import com.mcwl.common.core.domain.entity.SysDictData;
|
||||||
import com.mcwl.system.mapper.SysDictDataMapper;
|
import com.mcwl.system.mapper.SysDictDataMapper;
|
Loading…
Reference in New Issue