diff --git a/README.md b/README.md index 4943b14..05e6922 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,8 @@ * 后端采用Spring Boot、Spring Security、Redis & Jwt。 * 权限认证使用Jwt,支持多终端认证系统。 * 支持加载动态权限菜单,多方式轻松权限控制。 -* 高效率开发,使用代码生成器可以一键生成前后端代码。 -* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[McWl-Vue3](https://gitcode.com/yangzongzhuan/McWl-Vue3),保持同步更新。 -* 提供了单应用版本[McWl-Vue-fast](https://gitcode.com/yangzongzhuan/McWl-Vue-fast),Oracle版本[McWl-Vue-Oracle](https://gitcode.com/yangzongzhuan/McWl-Vue-Oracle),保持同步更新。 -* 不分离版本,请移步[McWl](https://gitee.com/y_project/McWl),微服务版本,请移步[McWl-Cloud](https://gitee.com/y_project/McWl-Cloud) -* 阿里云折扣场:[点我进入](http://aly.mcwl.vip),腾讯云秒杀场:[点我进入](http://txy.mcwl.vip)   + + ## 内置功能 1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java index d2f4d80..85cdf95 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java @@ -134,7 +134,16 @@ public class MallProductController extends BaseController { modelService.removeById(modelVersion.getId()); return AjaxResult.success(); } + /** + * 查询模型详情 + * @param id + * @return + */ + @GetMapping("/selectModelById") + public AjaxResult selectModelById(@RequestParam Long id){ + return modelService.selectModelById(id); + } /** * 我的发布-模型 diff --git a/mcwl-common/src/main/java/com/mcwl/common/core/domain/BaseEntity.java b/mcwl-common/src/main/java/com/mcwl/common/core/domain/BaseEntity.java index 73d7409..e65f6ce 100644 --- a/mcwl-common/src/main/java/com/mcwl/common/core/domain/BaseEntity.java +++ b/mcwl-common/src/main/java/com/mcwl/common/core/domain/BaseEntity.java @@ -10,12 +10,14 @@ import com.baomidou.mybatisplus.annotation.TableLogic; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Builder; /** * Entity基类 * * @author mcwl */ + public class BaseEntity implements Serializable { private static final long serialVersionUID = 1L; diff --git a/mcwl-resource/pom.xml b/mcwl-resource/pom.xml index 6fd7aac..c5b6b86 100644 --- a/mcwl-resource/pom.xml +++ b/mcwl-resource/pom.xml @@ -40,7 +40,7 @@ com.mcwl - mcwl-admin + mcwl-system 3.8.8 diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelProduct.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelProduct.java index ef4dbc4..f84f3f2 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelProduct.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelProduct.java @@ -1,11 +1,18 @@ package com.mcwl.resource.domain; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import com.mcwl.common.core.domain.BaseEntity; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; /** * 模型表 @@ -19,6 +26,7 @@ import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor @Data +@Builder @TableName("model") public class ModelProduct extends BaseEntity { @@ -27,10 +35,6 @@ public class ModelProduct extends BaseEntity { */ @TableId private Long id; - /** - * 版本ID - */ - private Long versionId; /** * 名称 */ @@ -105,4 +109,11 @@ public class ModelProduct extends BaseEntity { private String delFlag; + /** + * 翻译后标签 + */ + @TableField(exist = false) + private List styleList; + + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java index fb853d3..a49c2aa 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java @@ -2,6 +2,7 @@ package com.mcwl.resource.domain; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.mcwl.common.core.domain.BaseEntity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -19,13 +20,17 @@ import lombok.NoArgsConstructor; @NoArgsConstructor @Data @TableName("model_version") -public class ModelVersion { +public class ModelVersion extends BaseEntity { /** * 主键ID */ @TableId private Long id; + /** + * 版本名称 + */ + private Long modelId; /** * 版本名称 */ diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelService.java index 2b39c16..c4e004d 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelService.java @@ -34,4 +34,6 @@ public interface ModelService extends IService { void updaModel(RequestModel requestModel); + AjaxResult selectModelById(Long id); + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowService.java index 2fff370..b8f762f 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowService.java @@ -27,4 +27,6 @@ public interface WorkFlowService extends IService { AjaxResult selectWorkFlowById(Long id); TableDataInfo listByPage(ModelImagePageRes imagePageRes); + + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java index 8965f38..691cd91 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; 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.HttpStatus; import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.entity.SysUser; @@ -18,18 +19,19 @@ import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.domain.dto.ModelImagePageRes; import com.mcwl.resource.domain.request.RequestModel; 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.ModelVersionMapper; 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 lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Objects; @@ -48,6 +50,8 @@ public class ModelServiceImpl extends ServiceImpl impl @Autowired private RedisCache redisCache; + @Autowired + private ToActivityService toActivityService; @Autowired private ModelVersionMapper modelVersionMapper; @Autowired @@ -145,6 +149,14 @@ public class ModelServiceImpl extends ServiceImpl impl @Override public AjaxResult addModel(RequestModel requestModel) { + //获取封面图 + String filePath = requestModel.getModelVersionList().get(0).getFilePath(); + String[] split = filePath.split(","); + ModelProduct modelProduct = requestModel.getModelProduct(); + modelProduct.setSurfaceUrl(split[0]); + modelProduct.setCreateTime(new Date()); + + //添加模型表数据 postMapper.insert(requestModel.getModelProduct()); @@ -176,8 +188,52 @@ public class ModelServiceImpl extends ServiceImpl impl modelVersion.setAuditSatus(3); modelVersionMapper.updateById(modelVersion); } + + ModelProduct model = ModelProduct.builder(). + id(requestModel.getModelVersionList().get(0). + getModelId()).build(); + model.setUpdateTime(new Date()); + postMapper.updateById(model); + } } + @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 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); + } + + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java index cfb4182..d15e5fd 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java @@ -2,6 +2,7 @@ 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.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -12,20 +13,18 @@ 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.resource.domain.ModelProduct; import com.mcwl.resource.domain.WorkFlow; 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.vo.ModelVo; 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.WorkFlowVersionMapper; import com.mcwl.resource.service.ToActivityService; import com.mcwl.resource.service.WorkFlowService; +import com.mcwl.system.init.DictInit; import com.mcwl.system.service.ISysUserService; -import com.mcwl.web.controller.init.DictInit; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -66,8 +65,9 @@ public class WorkFlowServiceImpl extends ServiceImpl i String[] split = filePath.split(","); - requestWorkFlow.getWorkFlow().setCoverPath(split[0]); - requestWorkFlow.getWorkFlow().setCreateTime(new Date()); + WorkFlow workFlow = requestWorkFlow.getWorkFlow(); + workFlow .setCoverPath(split[0]); + workFlow.setCreateTime(new Date()); //添加模型表数据 flowMapper.insert(requestWorkFlow.getWorkFlow()); @@ -81,11 +81,14 @@ public class WorkFlowServiceImpl extends ServiceImpl i @Override public void updateWorkFlow(RequestWorkFlow requestWorkFlow) { - + WorkFlow workFlows = requestWorkFlow.getWorkFlow(); //修改工作流的信息 - if (requestWorkFlow.getWorkFlow().getId() != null){ + if (ObjectUtils.isEmpty(workFlows)){ - requestWorkFlow.getWorkFlow().setAuditStatus(3); + } + if (StringUtils.isNotNull(workFlows.getId() )){ + + workFlows.setAuditStatus(3); // flowMapper.updateWorkFlow(requestWorkFlow.getWorkFlow()); flowMapper.updateById(requestWorkFlow.getWorkFlow()); } @@ -101,7 +104,7 @@ public class WorkFlowServiceImpl extends ServiceImpl i } WorkFlow workFlow = WorkFlow.builder().id(requestWorkFlow.getWorkFlowVersionList().get(0).getWorkFlowId()) - .createTime(new Date()).build(); + .updateTime(new Date()).build(); //更新时间 flowMapper.updateById(workFlow); @@ -231,4 +234,6 @@ public class WorkFlowServiceImpl extends ServiceImpl i return rspData; } + + } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/init/DictInit.java b/mcwl-system/src/main/java/com/mcwl/system/init/DictInit.java similarity index 98% rename from mcwl-admin/src/main/java/com/mcwl/web/controller/init/DictInit.java rename to mcwl-system/src/main/java/com/mcwl/system/init/DictInit.java index d70e223..921a836 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/init/DictInit.java +++ b/mcwl-system/src/main/java/com/mcwl/system/init/DictInit.java @@ -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.system.mapper.SysDictDataMapper;