Merge branch 'feature/resource' of https://gitea.qinmian.online/CY/mcwl-ai into preview

feature/my-invitation
ChenYan 2025-01-14 18:47:09 +08:00
commit 6a5ad7403a
11 changed files with 112 additions and 23 deletions

View File

@ -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. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。

View File

@ -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);
}
/**
* -

View File

@ -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;

View File

@ -40,7 +40,7 @@
<dependency>
<groupId>com.mcwl</groupId>
<artifactId>mcwl-admin</artifactId>
<artifactId>mcwl-system</artifactId>
<version>3.8.8</version>
</dependency>

View File

@ -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<String> styleList;
}

View File

@ -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;
/**
*
*/

View File

@ -34,4 +34,6 @@ public interface ModelService extends IService<ModelProduct> {
void updaModel(RequestModel requestModel);
AjaxResult selectModelById(Long id);
}

View File

@ -27,4 +27,6 @@ public interface WorkFlowService extends IService<WorkFlow> {
AjaxResult selectWorkFlowById(Long id);
TableDataInfo listByPage(ModelImagePageRes imagePageRes);
}

View File

@ -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<ModelMapper,ModelProduct> impl
@Autowired
private RedisCache redisCache;
@Autowired
private ToActivityService toActivityService;
@Autowired
private ModelVersionMapper modelVersionMapper;
@Autowired
@ -145,6 +149,14 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> 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<ModelMapper,ModelProduct> 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<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);
}
}

View File

@ -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<WorkFlowMapper, WorkFlow> 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<WorkFlowMapper, WorkFlow> 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<WorkFlowMapper, WorkFlow> 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<WorkFlowMapper, WorkFlow> i
return rspData;
}
}

View File

@ -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;