Compare commits

...

3 Commits

Author SHA1 Message Date
Diyu0904 2b791a875a 合并分支 图片审核+模型审核待合并 2025-01-21 17:15:45 +08:00
Diyu0904 cb5af5202f Merge branch 'feature/admin' into preview
# Conflicts:
#	mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelImage.java
#	mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageServiceImpl.java
2025-01-21 17:05:14 +08:00
Diyu0904 71f1c01674 修复工作流审核bug
新增图片审核
2025-01-21 17:01:59 +08:00
7 changed files with 8 additions and 303 deletions

View File

@ -1,12 +1,10 @@
package com.mcwl.web.controller.resource;
import com.mcwl.common.constant.DictConstants;
import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.resource.domain.ModelVersion;
import com.mcwl.resource.service.ModelVersionService;
import com.mcwl.system.init.DictInit;
import com.mcwl.web.controller.common.OssUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -14,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
/**
@ -104,21 +101,12 @@ public class ModelVersionController extends BaseController {
@ApiOperation(value = "模型版本详情")
@PostMapping("finbyid")
public AjaxResult finbyid(@RequestBody ModelVersion modelVersion)
@GetMapping("finbyid")
public AjaxResult finbyid(@RequestParam Long id)
{
ModelVersion modelVersion1 = modelVersionService.getById(modelVersion.getId());
ArrayList<String> arrayList = new ArrayList<>();
//获取
String[] split = modelVersion1.getHigh().split(",");
for (String s : split) {
arrayList.add(DictInit.getDictValue(DictConstants.DICT_TYPE_MODEL_VERSION_HIGH,s));
}
ModelVersion modelVersion1 = modelVersionService.getById(id);
return AjaxResult.success(modelVersion1);
}

View File

@ -110,10 +110,9 @@ public class ModelImage extends BaseEntity {
@ApiModelProperty(value = "是否置顶")
private Integer isTop;
/**
* 1 2
*
*/
@ApiModelProperty(value = "审核1公开 2自见")
private Integer jurisdiction;
@ApiModelProperty(value = "审核失败原因")
private String auditText;
}

View File

@ -95,10 +95,10 @@ public class ModelVersion extends BaseEntity {
@ApiModelProperty(value = "是否公开")
private Integer isPublic;
/**
*
* (0 1)
*/
@ApiModelProperty(value = "是否加密")
private String isEncrypt;
private Integer isEncrypt;
/**
* 线使
*/

View File

@ -2,7 +2,6 @@ package com.mcwl.resource.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import javax.validation.constraints.NotBlank;

View File

@ -7,19 +7,13 @@ 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.entity.SysDictData;
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.ModelProduct;
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
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.mapper.ModelImageCommentMapper;
import com.mcwl.resource.mapper.ModelImageMapper;
@ -30,9 +24,7 @@ import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;

View File

@ -1,272 +0,0 @@
package com.mcwl.resource.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.core.redis.RedisCache;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.common.utils.baidu.BaiduCensor;
import com.mcwl.resource.domain.ModelProduct;
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.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.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @AuthorChenYan
* @ProjectMcWl
* @Packagecom.mcwl.resource.service.impl
* @FilenameMallProductServiceImpl
* @Description TODO
* @Date2024/12/30 18:22
*/
@Log4j2
@Service
public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> implements ModelService {
@Autowired
private RedisCache redisCache;
@Autowired
private ToActivityService toActivityService;
@Autowired
private ModelVersionMapper modelVersionMapper;
@Autowired
private ModelMapper postMapper;
@Autowired
private ISysUserService sysUserService;
@Autowired
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
/**
*
*
* @param modelId ID
* @param isTop
*/
@Override
public void setModelTop(Long id, boolean isTop) {
postMapper.updateTopStatus(id, isTop ? 1 : 0);
}
/**
*
*
* @param
* @return
*/
@Override
public List<ModelProduct> fetchModelsSortedByTopStatus() {
return postMapper.selectAllModelsSortedByTopStatus();
}
@Override
public Page<ModelProduct> selectByUserId(MallProductVo mallProductVo) {
// 创建分页对象
Page<ModelProduct> mallProductPage = new Page<>(mallProductVo.getPageNumber(), mallProductVo.getPageSize());
//获取当前登录人ID
Long userId = SecurityUtils.getUserId();
LambdaQueryWrapper<ModelProduct> mallProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
mallProductLambdaQueryWrapper.eq(ModelProduct::getUserId,userId);
mallProductLambdaQueryWrapper.eq(ModelProduct::getDelFlag,0);
// 开始时间和结束时间过滤
if (mallProductVo.getStartTime() != null && mallProductVo.getEndTime() != null) {
// 查询开始时间和结束时间之间的商品
mallProductLambdaQueryWrapper.between(ModelProduct::getCreateTime, mallProductVo.getStartTime(), mallProductVo.getEndTime());
} else if (mallProductVo.getStartTime() != null) {
// 只有开始时间,查询大于等于开始时间的商品
mallProductLambdaQueryWrapper.ge(ModelProduct::getCreateTime, mallProductVo.getStartTime());
} else if (mallProductVo.getEndTime() != null) {
// 只有结束时间,查询小于等于结束时间的商品
mallProductLambdaQueryWrapper.le(ModelProduct::getCreateTime, mallProductVo.getEndTime());
}
return postMapper.selectPage(mallProductPage, mallProductLambdaQueryWrapper);
}
@Override
public Page<ModelProduct> pageLike(MallProductVo mallProductVo, List<Long> list) {
return null;
}
/**
*
*
* @param imagePageRes
* @return
*/
@Override
public TableDataInfo listByPage(ModelImagePageRes imagePageRes) {
Page<ModelProduct> 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<ModelProduct> lqw = new LambdaQueryWrapper<>();
lqw.eq(imagePageRes.getStatus() != null, ModelProduct::getAuditStatus, imagePageRes.getStatus())
.eq(imagePageRes.getUserId() != null, ModelProduct::getUserId, imagePageRes.getUserId())
.ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime())
.le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime());
postMapper.selectPage(page, lqw);
// 获取分页数据
List<ModelProduct> modelImageList = page.getRecords();
// Model数据转为ModelPageVo
List<ModelVo> modelVoList = new ArrayList<>();
for (ModelProduct modelImage : modelImageList) {
ModelVo modelVo = new ModelVo();
BeanUtil.copyProperties(modelImage, modelVo);
// 获取用户信息
SysUser sysUser = sysUserService.selectUserById(modelImage.getUserId());
modelVo.setUserId(sysUser.getUserId());
modelVo.setUserName(sysUser.getUserName());
modelVo.setUserAvatar(sysUser.getAvatar());
modelVoList.add(modelVo);
}
// 封装分页数据
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(modelVoList);
rspData.setTotal(page.getTotal());
return rspData;
}
@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());
log.info("获取到的入参:{}",requestModel.getModelProduct());
//批量添加版本
modelVersionMapper.addModelVersion(requestModel.getModelProduct(),requestModel.getModelVersionList());
//执行审核方法
audit(requestModel);
return AjaxResult.success("添加成功,等待审核");
}
@Override
public void updaModel(RequestModel requestModel) {
//修改模版的信息
ModelProduct modelProduct = requestModel.getModelProduct();
if (ObjectUtils.isNotEmpty(modelProduct)){
if (StringUtils.isNotNull(modelProduct.getId())){
modelProduct.setAuditStatus(3);
modelProduct.setUpdateTime(new Date());
postMapper.updateById(requestModel.getModelProduct());
}
}
//修改工作流版本的信息
if (requestModel.getModelVersionList().size() != 0){
//批量修改
for (ModelVersion modelVersion : requestModel.getModelVersionList()) {
modelVersion.setAuditStatus(3);
modelVersionMapper.updateById(modelVersion);
}
ModelProduct model = ModelProduct.builder().
id(requestModel.getModelVersionList().get(0).
getModelId()).build();
model.setUpdateTime(new Date());
postMapper.updateById(model);
}
//审核
audit(requestModel);
}
@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

@ -211,7 +211,6 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
}else {
workFlowVersionMapper.updateByName(workFlowVersion);
}
workFlowVersionMapper.updateByName(workFlowVersion);
log.info("图片审核未通过");
break;
}