联调工作流+模型

master
Diyu0904 2025-02-14 13:36:17 +08:00
parent 5b359ed6a3
commit 7891130482
11 changed files with 99 additions and 56 deletions

View File

@ -1,18 +1,20 @@
package com.mcwl.web.controller.resource;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mcwl.common.core.controller.BaseController;
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.utils.SecurityUtils;
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.mapper.ModelVersionMapper;
import com.mcwl.resource.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@ -54,6 +56,9 @@ public class MallProductController extends BaseController {
@Autowired
private ModelImageLikeService modelImageLikeService;
@Autowired
private ModelVersionMapper modelVersionMapper;
/**
*
@ -67,10 +72,21 @@ public class MallProductController extends BaseController {
@ApiOperation(value = "模型详情")
@PostMapping("finbyid")
public AjaxResult finbyid(@RequestBody ModelProduct modelVersion) {
ModelProduct modelVersion1 = modelService.getById(modelVersion.getId());
return AjaxResult.success(modelVersion1);
@GetMapping("finbyid")
public AjaxResult finbyid(@Valid @NotNull(message = "模型id不能为空") @RequestParam Long id) {
RequestModel requestModel = new RequestModel();
ModelProduct modelVersion1 = modelService.getById(id);
LambdaQueryWrapper<ModelVersion> modelVersionLambdaQueryWrapper = new LambdaQueryWrapper<>();
modelVersionLambdaQueryWrapper.eq(ModelVersion::getModelId,id);
modelVersionLambdaQueryWrapper.eq(ModelVersion::getDelFlag,"0");
List<ModelVersion> modelVersions = modelVersionMapper.selectList(modelVersionLambdaQueryWrapper);
requestModel.setModelProduct(modelVersion1);
requestModel.setModelVersionList(modelVersions);
return AjaxResult.success(requestModel);
}
@ -100,7 +116,7 @@ public class MallProductController extends BaseController {
@ApiOperation(value = "删除模型")
@GetMapping("delete")
public AjaxResult delete(@Valid @NotNull(message = "模型id不能为空") Long id) {
public AjaxResult delete(@Valid @NotNull(message = "模型id不能为空") @RequestParam Long id) {
modelService.removeById(id);
return AjaxResult.success();
}
@ -113,7 +129,7 @@ public class MallProductController extends BaseController {
*/
@ApiOperation(value = "查询模型详情")
@GetMapping("/selectModelById")
public AjaxResult selectModelById(@RequestParam Long id) {
public AjaxResult selectModelById(@Valid @NotNull(message = "模型id不能为空") @RequestParam Long id) {
return modelService.selectModelById(id);
}
@ -134,19 +150,6 @@ public class MallProductController extends BaseController {
}
/**
*
*
* @return
*/
@ApiOperation(value = "获取置顶的模型列表")
@GetMapping
public ResponseEntity<List<ModelProduct>> fetchModelsSortedByTopStatus() {
List<ModelProduct> models = modelService.fetchModelsSortedByTopStatus();
return ResponseEntity.ok(models);
}
/**
* -
*/

View File

@ -56,9 +56,9 @@ public class ModelVersionController extends BaseController {
{
ModelVersion modelVersion1 = modelVersionService.getById(id);
List<ModelVersion> modelVersionList = modelVersionService.finbyid(id);
return AjaxResult.success(modelVersion1);
return AjaxResult.success(modelVersionList);
}

View File

@ -47,8 +47,8 @@ public class ModelVersion extends BaseEntity {
/**
* ID
*/
@ApiModelProperty(value = "模型类型ID")
private Long modelType;
@ApiModelProperty(value = "基础模型")
private Long modelVersionType;
/**
*
*/
@ -152,13 +152,13 @@ public class ModelVersion extends BaseEntity {
/**
*
*/
@ApiModelProperty(value = "审核状态")
private Integer auditStatus;
/**
*
*/
@ApiModelProperty(value = "审核失败原因")
private String auditText;
// @ApiModelProperty(value = "审核状态")
// private Integer auditStatus;
// /**
// * 审核失败原因
// */
// @ApiModelProperty(value = "审核失败原因")
// private String auditText;
/**
* 0 2
*/

View File

@ -170,10 +170,18 @@ public class WorkFlow {
private List<String> typeList;
/**
* 0 1
* 0 1
*/
@ApiModelProperty(value = "是否关注 0关注 1关注")
@ApiModelProperty(value = "是否关注 0关注 1关注")
@TableField(exist = false)
private Integer isAttention;
/**
* 0 1
*/
@ApiModelProperty(value = "是否点赞 0未点赞 1点赞")
@TableField(exist = false)
private Integer isLike;
}

View File

@ -21,4 +21,6 @@ public interface ModelVersionService extends IService<ModelVersion> {
AjaxResult selectByModelId(Long modelId);
List<ModelVersion> finbyid(Long id);
}

View File

@ -20,4 +20,6 @@ public interface WorkFlowLikeService extends IService<WorkFlowLike> {
void like(Long imageId);
TableDataInfo listByPage(PageDomain pageDomain);
WorkFlowLike selectWorkFlowLikeById(Long userId, Long id);
}

View File

@ -186,7 +186,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
@Override
public AjaxResult addModel(RequestModel requestModel) {
//获取封面图
String filePath = requestModel.getModelVersionList().get(0).getFilePath();
String filePath = requestModel.getModelVersionList().get(0).getSampleImagePaths();
String[] split = filePath.split(",");
ModelProduct modelProduct = requestModel.getModelProduct();
modelProduct.setSurfaceUrl(split[0]);
@ -225,7 +225,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
//批量修改
for (ModelVersion modelVersion : requestModel.getModelVersionList()) {
modelVersion.setAuditStatus(3);
modelVersionMapper.updateById(modelVersion);
}
@ -303,9 +303,9 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
}
//修改为合格
modelProduct.setAuditText("");
modelProduct.setAuditStatus(modelProduct.getJurisdiction());
baseMapper.updateById(modelProduct);
// modelProduct.setAuditText("");
// modelProduct.setAuditStatus(modelProduct.getJurisdiction());
// baseMapper.updateById(modelProduct);
}
}

View File

@ -78,5 +78,21 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
return AjaxResult.success(modelVersions);
}
@Override
public List<ModelVersion> finbyid(Long id) {
LambdaQueryWrapper<ModelVersion> modelVersionLambdaQueryWrapper = new LambdaQueryWrapper<>();
modelVersionLambdaQueryWrapper.eq(ModelVersion::getModelId,id);
modelVersionLambdaQueryWrapper.eq(ModelVersion::getDelFlag,0);
List<ModelVersion> modelVersions = baseMapper.selectList(modelVersionLambdaQueryWrapper);
for (ModelVersion modelVersion : modelVersions) {
}
return modelVersions;
}
}

View File

@ -1,6 +1,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.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -11,11 +12,8 @@ import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.exception.ServiceException;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.ModelLike;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.WorkFlow;
import com.mcwl.resource.domain.WorkFlowLike;
import com.mcwl.resource.domain.vo.ModelLikeVo;
import com.mcwl.resource.domain.vo.WorkFlowLikeVo;
import com.mcwl.resource.mapper.WorkFlowLikeMapper;
import com.mcwl.resource.mapper.WorkFlowMapper;
@ -134,6 +132,16 @@ public class WorkFlowLikeServiceImpl extends ServiceImpl<WorkFlowLikeMapper, Wor
return tableDataInfo;
}
@Override
public WorkFlowLike selectWorkFlowLikeById(Long userId, Long id) {
LambdaQueryWrapper<WorkFlowLike> workFlowLikeLambdaQueryWrapper = new LambdaQueryWrapper<>();
workFlowLikeLambdaQueryWrapper.eq(WorkFlowLike::getWorkFlowId,id);
workFlowLikeLambdaQueryWrapper.eq(WorkFlowLike::getUserId,userId);
return baseMapper.selectOne(workFlowLikeLambdaQueryWrapper);
}
private Page<WorkFlowLike> initPage(PageDomain pageDomain) {
Page<WorkFlowLike> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());

View File

@ -19,6 +19,7 @@ import com.mcwl.common.utils.StringUtils;
import com.mcwl.common.utils.baidu.BaiduCensor;
import com.mcwl.resource.domain.SysUserAttention;
import com.mcwl.resource.domain.WorkFlow;
import com.mcwl.resource.domain.WorkFlowLike;
import com.mcwl.resource.domain.WorkFlowVersion;
import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
@ -28,7 +29,6 @@ import com.mcwl.resource.domain.vo.WorkFlowVo;
import com.mcwl.resource.mapper.SysUserAttentionMapper;
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;
@ -61,7 +61,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
private WorkFlowVersionMapper workFlowVersionMapper;
@Autowired
private ToActivityService toActivityService;
private WorkFlowLikeServiceImpl workFlowLikeService;
@Autowired
private SysUserAttentionMapper sysUserAttentionMapper;
@ -162,9 +162,9 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
}
//修改为合格
workFlow.setAuditText("");
workFlow.setAuditStatus(workFlow.getJurisdiction());
flowMapper.updateById(workFlow);
// workFlow.setAuditText("");
// workFlow.setAuditStatus(workFlow.getJurisdiction());
// flowMapper.updateById(workFlow);
}
}
@ -382,16 +382,22 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
ArrayList<String> strings = new ArrayList<>();
String[] split = workFlow.getType().split(",");
for (String s : split) {
if (s != "") {
if (s.equals("")) {
strings.add(DictInit.getDictValue(DictConstants.WORK_FLOW_TYPE_CHILD, s));
}
}
workFlow.setTypeList(strings);
}
workFlow.setIsAttention(0);
workFlow.setIsAttention(1);
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserId(), workFlow.getUserId());
if (sysUserAttention == null){
workFlow.setIsAttention(1);
workFlow.setIsAttention(0);
}
WorkFlowLike workFlowLike = workFlowLikeService.selectWorkFlowLikeById(SecurityUtils.getUserId(),workFlow.getId());
workFlow.setIsLike(1);
if (workFlowLike == null){
workFlow.setIsLike(0);
}
return AjaxResult.success(workFlow);
}

View File

@ -7,22 +7,20 @@
<insert id="addModelVersion">
INSERT INTO model_version (
model_id,version_name, model_type, file_path, trigger_words, sampling, high, vae, cfg,
model_id,version_name,version_description,model_version_type, file_path,file_name, trigger_words, sampling, high, vae, cfg,
is_free, is_public, is_encrypt, is_online_use, allow_download_image,
allow_software_use, allow_fusion, allow_commercial_use, allow_usage,
is_exclusive_model, sample_image_paths, hide_image_gen_info, audit_status,
audit_text, del_flag
is_exclusive_model, sample_image_paths, hide_image_gen_info, del_flag
)
VALUES
<foreach collection="modelVersionList" item="item" separator=",">
(
#{modelProduct.id},#{item.versionName}, #{item.modelType}, #{item.filePath}, #{item.triggerWords},
#{item.sampling}, #{item.high}, #{item.vae}, #{item.cfg},
#{modelProduct.id},#{item.versionName}, #{item.versionDescription},#{item.modelVersionType}, #{item.filePath},
#{item.fileName},#{item.triggerWords},#{item.sampling}, #{item.high}, #{item.vae}, #{item.cfg},
#{item.isFree}, #{item.isPublic}, #{item.isEncrypt}, #{item.isOnlineUse},
#{item.allowDownloadImage}, #{item.allowSoftwareUse}, #{item.allowFusion},
#{item.allowCommercialUse}, #{item.allowUsage}, #{item.isExclusiveModel},
#{item.sampleImagePaths}, #{item.hideImageGenInfo}, 3,
#{item.auditText},'0'
#{item.sampleImagePaths}, #{item.hideImageGenInfo},'0'
)
</foreach>
</insert>