mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 17:38:48 +08:00
项目结构初始化
This commit is contained in:
parent
22babfb24f
commit
10ffca8d24
@ -3,8 +3,8 @@ package com.luban.api.controller;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.luban.api.entity.H5Project;
|
import com.luban.api.entity.H5Project;
|
||||||
|
import com.luban.api.mongo.entity.H5ProjectContent;
|
||||||
import com.luban.api.service.H5ProjectService;
|
import com.luban.api.service.H5ProjectService;
|
||||||
import com.luban.api.vo.H5ProjectContentVO;
|
|
||||||
import com.luban.api.vo.H5ProjectDetailVO;
|
import com.luban.api.vo.H5ProjectDetailVO;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -74,7 +74,7 @@ public class H5ProjectController {
|
|||||||
|
|
||||||
// 获取项目内容
|
// 获取项目内容
|
||||||
if (h5Project != null) {
|
if (h5Project != null) {
|
||||||
H5ProjectContentVO content = h5ProjectService.getProjectContent(h5Project.getId());
|
H5ProjectContent content = h5ProjectService.getProjectContent(h5Project.getId());
|
||||||
detailVO.setContent(content);
|
detailVO.setContent(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ public class H5ProjectController {
|
|||||||
public static class CreateH5ProjectRequest {
|
public static class CreateH5ProjectRequest {
|
||||||
private String type;
|
private String type;
|
||||||
private String title;
|
private String title;
|
||||||
private H5ProjectContentVO content;
|
private H5ProjectContent content;
|
||||||
private Long contentUpdatedAt;
|
private Long contentUpdatedAt;
|
||||||
private String description;
|
private String description;
|
||||||
private String previewUrl;
|
private String previewUrl;
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
package com.luban.api.mongo.entity;
|
package com.luban.api.mongo.entity;
|
||||||
|
|
||||||
import com.luban.api.vo.H5ProjectContentVO;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.mongodb.core.mapping.Document;
|
import org.springframework.data.mongodb.core.mapping.Document;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* H5项目内容实体类 (存储在MongoDB中)
|
* H5项目内容实体类 (存储在MongoDB中)
|
||||||
*
|
*
|
||||||
@ -21,9 +23,24 @@ public class H5ProjectContent {
|
|||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内容
|
* 版本号
|
||||||
*/
|
*/
|
||||||
private H5ProjectContentVO content;
|
private String version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全局配置
|
||||||
|
*/
|
||||||
|
private Global global;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 布局列表
|
||||||
|
*/
|
||||||
|
private List<Layout> layouts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间戳
|
* 创建时间戳
|
||||||
@ -35,4 +52,197 @@ public class H5ProjectContent {
|
|||||||
*/
|
*/
|
||||||
private Long updateTime;
|
private Long updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全局配置类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class Global {
|
||||||
|
private Double zoom;
|
||||||
|
private Integer dpi;
|
||||||
|
private String unit;
|
||||||
|
private Boolean showWatermark;
|
||||||
|
private BackgroundMusic backgroundMusic;
|
||||||
|
private String mode;
|
||||||
|
private Layout layout;
|
||||||
|
private PageTransition pageTransition;
|
||||||
|
private Webpage webpage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 背景音乐类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class BackgroundMusic {
|
||||||
|
private String src;
|
||||||
|
private Map<String, Object> options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面转换类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class PageTransition {
|
||||||
|
private String name;
|
||||||
|
private String value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网页信息类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class Webpage {
|
||||||
|
private String thumbnail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 布局类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class Layout {
|
||||||
|
private String title;
|
||||||
|
private String backgroundImage;
|
||||||
|
private String backgroundEffectImage;
|
||||||
|
private String backgroundColor;
|
||||||
|
private BackgroundImageInfo backgroundImageInfo;
|
||||||
|
private Boolean backgroundWatermarkEnable;
|
||||||
|
private String backgroundRepeat;
|
||||||
|
private Object backgroundGradient;
|
||||||
|
private BackgroundMask backgroundMask;
|
||||||
|
private Integer height;
|
||||||
|
private Integer width;
|
||||||
|
private Object mosaic;
|
||||||
|
private Object border;
|
||||||
|
private Object className;
|
||||||
|
private Object repeatId;
|
||||||
|
private Object repeatGroup;
|
||||||
|
private Map<String, Object> metaInfo;
|
||||||
|
private Boolean watermarkEnable;
|
||||||
|
private Object filter;
|
||||||
|
private Object filterInfo;
|
||||||
|
private Boolean borderEnable;
|
||||||
|
private Integer borderRadius;
|
||||||
|
private String borderImageRepeat;
|
||||||
|
private List<Element> elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 背景图片信息类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class BackgroundImageInfo {
|
||||||
|
private Integer width;
|
||||||
|
private Integer height;
|
||||||
|
private Double opacity;
|
||||||
|
private Transform transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 背景遮罩类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class BackgroundMask {
|
||||||
|
private String color;
|
||||||
|
private Double opacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 变换类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class Transform {
|
||||||
|
private Double a;
|
||||||
|
private Double b;
|
||||||
|
private Double c;
|
||||||
|
private Double d;
|
||||||
|
private Double tx;
|
||||||
|
private Double ty;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 元素类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class Element {
|
||||||
|
private String type;
|
||||||
|
private String category;
|
||||||
|
private Double opacity;
|
||||||
|
private List<Integer> padding;
|
||||||
|
private Double width;
|
||||||
|
private Double height;
|
||||||
|
private Double left;
|
||||||
|
private Double top;
|
||||||
|
private Transform transform;
|
||||||
|
private Object boxShadow;
|
||||||
|
private Integer resize;
|
||||||
|
private Boolean dragable;
|
||||||
|
private Boolean rotatable;
|
||||||
|
private Boolean editable;
|
||||||
|
private Boolean frozen;
|
||||||
|
private Boolean hidden;
|
||||||
|
private Boolean lock;
|
||||||
|
private Integer borderRadius;
|
||||||
|
private Map<String, Object> filter;
|
||||||
|
private Boolean watermarkEnable;
|
||||||
|
private Map<String, Object> metaInfo;
|
||||||
|
private String linkId;
|
||||||
|
private Boolean groupable;
|
||||||
|
private String url;
|
||||||
|
private String imageUrl;
|
||||||
|
private Integer effectedImageWidth;
|
||||||
|
private Integer effectedImageHeight;
|
||||||
|
private Integer effectedImageOffsetLeft;
|
||||||
|
private Integer effectedImageOffsetTop;
|
||||||
|
private List<Object> imageEffects;
|
||||||
|
private List<String> aggregatedColors;
|
||||||
|
private Object mainColor;
|
||||||
|
private Double effectScale;
|
||||||
|
private Transform imageTransform;
|
||||||
|
private FilterInfo filterInfo;
|
||||||
|
private Integer naturalWidth;
|
||||||
|
private Integer naturalHeight;
|
||||||
|
private String version;
|
||||||
|
private List<Animation> animations;
|
||||||
|
private String content;
|
||||||
|
private List<Object> contents;
|
||||||
|
private Boolean autoScale;
|
||||||
|
private List<Object> textEffects;
|
||||||
|
private String listStyle;
|
||||||
|
private Integer autoAdaptive;
|
||||||
|
private Object textDecoration;
|
||||||
|
private String writingMode;
|
||||||
|
private String textAlign;
|
||||||
|
private String verticalAlign;
|
||||||
|
private List<Object> parents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过滤信息类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class FilterInfo {
|
||||||
|
private Integer id;
|
||||||
|
private String zipUrl;
|
||||||
|
private String prunedZipUrl;
|
||||||
|
private Double strong;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动画类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class Animation {
|
||||||
|
private String type;
|
||||||
|
private Integer order;
|
||||||
|
private Map<String, Object> keyframes;
|
||||||
|
private List<String> easing;
|
||||||
|
private List<Double> offset;
|
||||||
|
private Integer delay;
|
||||||
|
private Integer duration;
|
||||||
|
private String fill;
|
||||||
|
private String name;
|
||||||
|
private Object customValues;
|
||||||
|
private Integer groupOrder;
|
||||||
|
private List<Object> excludeScale;
|
||||||
|
private String method;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,9 +1,8 @@
|
|||||||
package com.luban.api.service;
|
package com.luban.api.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.luban.api.dto.H5ProjectContentDTO;
|
|
||||||
import com.luban.api.entity.H5Project;
|
import com.luban.api.entity.H5Project;
|
||||||
import com.luban.api.vo.H5ProjectContentVO;
|
import com.luban.api.mongo.entity.H5ProjectContent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ public interface H5ProjectService extends IService<H5Project> {
|
|||||||
* @param groupIds 分组ID列表
|
* @param groupIds 分组ID列表
|
||||||
* @return 是否保存成功
|
* @return 是否保存成功
|
||||||
*/
|
*/
|
||||||
boolean saveH5ProjectWithContent(H5Project h5Project, H5ProjectContentVO content, List<Long> groupIds);
|
boolean saveH5ProjectWithContent(H5Project h5Project, H5ProjectContent content, List<Long> groupIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新H5项目及其内容
|
* 更新H5项目及其内容
|
||||||
@ -34,7 +33,7 @@ public interface H5ProjectService extends IService<H5Project> {
|
|||||||
* @param groupIds 分组ID列表
|
* @param groupIds 分组ID列表
|
||||||
* @return 是否更新成功
|
* @return 是否更新成功
|
||||||
*/
|
*/
|
||||||
boolean updateH5ProjectWithContent(H5Project h5Project, H5ProjectContentVO content, List<Long> groupIds);
|
boolean updateH5ProjectWithContent(H5Project h5Project, H5ProjectContent content, List<Long> groupIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID获取H5项目及其内容
|
* 根据ID获取H5项目及其内容
|
||||||
@ -66,5 +65,5 @@ public interface H5ProjectService extends IService<H5Project> {
|
|||||||
* @param contentId 内容ID
|
* @param contentId 内容ID
|
||||||
* @return 项目内容
|
* @return 项目内容
|
||||||
*/
|
*/
|
||||||
H5ProjectContentVO getProjectContent(Long contentId);
|
H5ProjectContent getProjectContent(Long contentId);
|
||||||
}
|
}
|
||||||
@ -8,7 +8,6 @@ import com.luban.api.entity.H5ProjectGroup;
|
|||||||
import com.luban.api.mongo.dao.H5ProjectContentRepository;
|
import com.luban.api.mongo.dao.H5ProjectContentRepository;
|
||||||
import com.luban.api.mongo.entity.H5ProjectContent;
|
import com.luban.api.mongo.entity.H5ProjectContent;
|
||||||
import com.luban.api.service.H5ProjectService;
|
import com.luban.api.service.H5ProjectService;
|
||||||
import com.luban.api.vo.H5ProjectContentVO;
|
|
||||||
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 org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -34,7 +33,7 @@ public class H5ProjectServiceImpl extends ServiceImpl<H5ProjectDao, H5Project> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean saveH5ProjectWithContent(H5Project h5Project, H5ProjectContentVO content, List<Long> groupIds) {
|
public boolean saveH5ProjectWithContent(H5Project h5Project, H5ProjectContent content, List<Long> groupIds) {
|
||||||
// 设置创建和更新时间戳
|
// 设置创建和更新时间戳
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
h5Project.setCreateTime(currentTime);
|
h5Project.setCreateTime(currentTime);
|
||||||
@ -45,13 +44,11 @@ public class H5ProjectServiceImpl extends ServiceImpl<H5ProjectDao, H5Project> i
|
|||||||
|
|
||||||
if (saved && content != null) {
|
if (saved && content != null) {
|
||||||
// 保存H5ProjectContent到MongoDB
|
// 保存H5ProjectContent到MongoDB
|
||||||
H5ProjectContent h5ProjectContent = new H5ProjectContent();
|
content.setId(h5Project.getId());
|
||||||
h5ProjectContent.setId(h5Project.getId());
|
content.setCreateTime(currentTime);
|
||||||
h5ProjectContent.setContent(content);
|
content.setUpdateTime(currentTime);
|
||||||
h5ProjectContent.setCreateTime(currentTime);
|
|
||||||
h5ProjectContent.setUpdateTime(currentTime);
|
|
||||||
|
|
||||||
h5ProjectContentRepository.save(h5ProjectContent);
|
h5ProjectContentRepository.save(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存项目与分组的关联关系
|
// 保存项目与分组的关联关系
|
||||||
@ -64,7 +61,7 @@ public class H5ProjectServiceImpl extends ServiceImpl<H5ProjectDao, H5Project> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean updateH5ProjectWithContent(H5Project h5Project, H5ProjectContentVO content, List<Long> groupIds) {
|
public boolean updateH5ProjectWithContent(H5Project h5Project, H5ProjectContent content, List<Long> groupIds) {
|
||||||
// 设置更新时间戳
|
// 设置更新时间戳
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
h5Project.setUpdateTime(currentTime);
|
h5Project.setUpdateTime(currentTime);
|
||||||
@ -74,12 +71,10 @@ public class H5ProjectServiceImpl extends ServiceImpl<H5ProjectDao, H5Project> i
|
|||||||
|
|
||||||
if (updated && content != null) {
|
if (updated && content != null) {
|
||||||
// 更新或创建H5ProjectContent到MongoDB
|
// 更新或创建H5ProjectContent到MongoDB
|
||||||
H5ProjectContent h5ProjectContent = h5ProjectContentRepository.findById(h5Project.getId()).orElse(new H5ProjectContent());
|
content.setId(h5Project.getId());
|
||||||
h5ProjectContent.setId(h5Project.getId());
|
content.setUpdateTime(currentTime);
|
||||||
h5ProjectContent.setContent(content);
|
|
||||||
h5ProjectContent.setUpdateTime(currentTime);
|
|
||||||
|
|
||||||
h5ProjectContentRepository.save(h5ProjectContent);
|
h5ProjectContentRepository.save(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新项目与分组的关联关系
|
// 更新项目与分组的关联关系
|
||||||
@ -110,10 +105,9 @@ public class H5ProjectServiceImpl extends ServiceImpl<H5ProjectDao, H5Project> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public H5ProjectContentVO getProjectContent(Long contentId) {
|
public H5ProjectContent getProjectContent(Long contentId) {
|
||||||
if (contentId != null) {
|
if (contentId != null) {
|
||||||
H5ProjectContent content = h5ProjectContentRepository.findById(contentId).orElse(null);
|
return h5ProjectContentRepository.findById(contentId).orElse(null);
|
||||||
return content != null ? content.getContent() : null;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.luban.api.vo;
|
package com.luban.api.vo;
|
||||||
|
|
||||||
import com.luban.api.entity.H5Project;
|
import com.luban.api.entity.H5Project;
|
||||||
|
import com.luban.api.mongo.entity.H5ProjectContent;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -27,7 +28,7 @@ public class H5ProjectDetailVO {
|
|||||||
* 项目内容
|
* 项目内容
|
||||||
*/
|
*/
|
||||||
@Schema(title = "项目内容")
|
@Schema(title = "项目内容")
|
||||||
private H5ProjectContentVO content;
|
private H5ProjectContent content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目关联的分组ID列表
|
* 项目关联的分组ID列表
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user