diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java index 7442adf..b2bfc54 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java @@ -2,11 +2,11 @@ package com.mcwl.web.controller.resource; import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.resource.domain.request.RequestWorkFlow; +import com.mcwl.resource.service.impl.WorkFlowServiceImpl; import com.mcwl.web.controller.common.OssUtil; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -25,9 +25,10 @@ import org.springframework.web.multipart.MultipartFile; public class WorkFlowController extends BaseController { + @Autowired + private WorkFlowServiceImpl workFlowService; /*** - * * 图片 * @param file * @return @@ -39,7 +40,6 @@ public class WorkFlowController extends BaseController { return AjaxResult.success(s); } - /*** * * zip @@ -53,8 +53,6 @@ public class WorkFlowController extends BaseController { } - - /*** * * 下载zip @@ -68,6 +66,17 @@ public class WorkFlowController extends BaseController { } -// @PostMapping("/add") -// public AjaxResult + @PostMapping("/addWorkFlow") + public AjaxResult addWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow){ + + return workFlowService.addWorkFlow(requestWorkFlow); + } + + @PostMapping("/updateWorkFlow") + public AjaxResult updateWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow){ + + workFlowService.updateWorkFlow(requestWorkFlow); + + return AjaxResult.success("修改成功"); + } } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlow.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlow.java index 4c4b729..c5e97d8 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlow.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlow.java @@ -56,4 +56,29 @@ public class WorkFlow { */ private String del_flag; + /** + * 审核状态(0全部状态 1已发布-公开 2已发布-仅自己可见 3审核中 4审核未通过) + */ + private Integer auditStatus = 0; + + /** + * 审核失败原因 + */ + private String auditText; + + /** + * 原文作者名字 + */ + private String authorName; + + /** + * 使用数量 + */ + private Long useNumber = 0L; + + /** + *下载数量 + */ + private Long downloadNumber = 0L; + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlowVersion.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlowVersion.java index 2ccdab7..2b996bd 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlowVersion.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlowVersion.java @@ -44,9 +44,74 @@ public class WorkFlowVersion { /** * 是否隐藏图片生成信息 */ - private String hideGenInfo; + private Integer hideGenInfo; /** * 删除标志(0代表存在 2代表删除) */ private String delFlag; + + /** + * 审核状态(0全部状态 1已发布-公开 2已发布-仅自己可见 3审核中 4审核未通过) + */ + private Integer auditStatus = 0; + + /** + * 审核失败原因 + */ + private String auditText; + + /** + * 模型ID + */ + private Long workFlowId; + + /** + * 基础模型 + */ + private Integer basicModel; + + /** + * 权限状态 + */ + private Integer jurisdiction; + + /** + *是否允许在本软件使用(0授权 1不允许 + */ + private Integer itselfUse; + + /** + * 是否允许在旗下软件使用(0授权 1不允许) + */ + private Integer subordinateUse; + + /** + * 是否允许下载生图(0授权 1不允许) + */ + private Integer download; + + /** + * 是否允许下载融合(0授权 1不允许) + */ + private Integer fuse; + + /** + * 生成的图片是否允许出售(0授权 1不允许) + */ + private Integer sell; + + /** + * 是否允许融合后(0授权 1不允许) + */ + private Integer fuseSell; + + /** + * 是否独家设置(0授权 1不允许) + */ + private Integer exclusive; + + /** + * 文件名字 + */ + private String fileName; } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestWorkFlow.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestWorkFlow.java new file mode 100644 index 0000000..277a314 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestWorkFlow.java @@ -0,0 +1,29 @@ +package com.mcwl.resource.domain.request; + +import com.mcwl.resource.domain.WorkFlow; +import com.mcwl.resource.domain.WorkFlowVersion; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 工作流入参 工作流+版本 + * @author DaiZibo + * @date 2025/1/9 + * @apiNote + */ + +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Data +public class RequestWorkFlow { + + private WorkFlow workFlow; + + private List workFlowVersionList; + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowMapper.java index b233fe7..e72f22a 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowMapper.java @@ -14,5 +14,6 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface WorkFlowMapper extends BaseMapper { + void updateWorkFlow(WorkFlow workFlow); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowVersionMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowVersionMapper.java index 3a91407..1ec04ca 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowVersionMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowVersionMapper.java @@ -1,8 +1,12 @@ package com.mcwl.resource.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mcwl.resource.domain.WorkFlow; import com.mcwl.resource.domain.WorkFlowVersion; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 工作流版本 业务实现层 @@ -13,4 +17,9 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface WorkFlowVersionMapper extends BaseMapper { + + void addWorkFlowVersion(@Param("workFlow") WorkFlow workFlow, @Param("list") List workFlowVersionList); + + void updateWorkFlowVersion(WorkFlowVersion workFlowVersion); + } 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 3a60ffc..1e1f9ca 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 @@ -1,5 +1,8 @@ package com.mcwl.resource.service; +import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.resource.domain.request.RequestWorkFlow; + /** * 工作流 业务层 * @author DaiZibo @@ -8,4 +11,8 @@ package com.mcwl.resource.service; */ public interface WorkFlowService { + AjaxResult addWorkFlow(RequestWorkFlow requestWorkFlow); + + void updateWorkFlow(RequestWorkFlow requestWorkFlow); + } 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 875acf2..3bc1148 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 @@ -1,6 +1,13 @@ package com.mcwl.resource.service.impl; +import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.resource.domain.WorkFlowVersion; +import com.mcwl.resource.domain.request.RequestWorkFlow; +import com.mcwl.resource.mapper.WorkFlowMapper; +import com.mcwl.resource.mapper.WorkFlowVersionMapper; import com.mcwl.resource.service.WorkFlowService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** @@ -10,8 +17,48 @@ import org.springframework.stereotype.Service; * @apiNote */ +@Slf4j @Service public class WorkFlowServiceImpl implements WorkFlowService { + @Autowired + private WorkFlowMapper flowMapper; + @Autowired + private WorkFlowVersionMapper workFlowVersionMapper; + + @Override + public AjaxResult addWorkFlow(RequestWorkFlow requestWorkFlow) { + + //添加模型表数据 + flowMapper.insert(requestWorkFlow.getWorkFlow()); + + log.info("获取到的入参:{}",requestWorkFlow.getWorkFlow()); + + //批量添加版本 + workFlowVersionMapper.addWorkFlowVersion(requestWorkFlow.getWorkFlow(),requestWorkFlow.getWorkFlowVersionList()); + + return AjaxResult.success("添加成功,等待审核"); + } + + @Override + public void updateWorkFlow(RequestWorkFlow requestWorkFlow) { + + //修改工作流的信息 + if (requestWorkFlow.getWorkFlow().getId() != null){ + + requestWorkFlow.getWorkFlow().setAuditStatus(3); + flowMapper.updateWorkFlow(requestWorkFlow.getWorkFlow()); + } + + //修改工作流版本的信息 + if (requestWorkFlow.getWorkFlowVersionList().size() != 0){ + + //批量修改 + for (WorkFlowVersion workFlowVersion : requestWorkFlow.getWorkFlowVersionList()) { + workFlowVersion.setAuditStatus(3); + workFlowVersionMapper.updateWorkFlowVersion(workFlowVersion); + } + } + } } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowVersionServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowVersionServiceImpl.java index 8b0ba03..20164ba 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowVersionServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowVersionServiceImpl.java @@ -1,6 +1,6 @@ package com.mcwl.resource.service.impl; -import com.mcwl.resource.service.WorkFlowService; +import com.mcwl.resource.service.WorkFlowVersionService; import org.springframework.stereotype.Service; /** @@ -11,6 +11,6 @@ import org.springframework.stereotype.Service; */ @Service -public class WorkFlowVersionServiceImpl implements WorkFlowService { +public class WorkFlowVersionServiceImpl implements WorkFlowVersionService { } diff --git a/mcwl-resource/src/main/resources/mapper/resource/WorkFlowMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/WorkFlowMapper.xml new file mode 100644 index 0000000..39b24cd --- /dev/null +++ b/mcwl-resource/src/main/resources/mapper/resource/WorkFlowMapper.xml @@ -0,0 +1,34 @@ + + + + + + UPDATE work_flow + + + workflow_name = #{workflowName}, + + + category = #{category}, + + + theme = #{theme}, + + + style = #{style}, + + + functions = #{functions}, + + + activity_participation = #{activityParticipation} + + + audit_status = #{auditStatus} + + + WHERE id = #{id} + + diff --git a/mcwl-resource/src/main/resources/mapper/resource/WorkFlowVersionMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/WorkFlowVersionMapper.xml new file mode 100644 index 0000000..251a000 --- /dev/null +++ b/mcwl-resource/src/main/resources/mapper/resource/WorkFlowVersionMapper.xml @@ -0,0 +1,22 @@ + + + + + + + INSERT INTO work_flow_version (version_name,version_description,file_path,image_paths,hide_gen_info,del_flag, + audit_status,work_flow_id,basic_model,jurisdiction,itself_use,subordinate_use, + download,fuse,sell,fuse_sell,exclusive,file_name) + VALUES + + (#{item.versionName}, #{item.versionDescription}, #{item.filePath}, #{item.imagePaths},#{item.hideGenInfo}, + 0,#{item.auditStatus},#{workFlow.id},#{item.basicModel},#{item.jurisdiction},#{item.itselfUse}, + #{item.subordinateUse},#{item.download},#{item.fuse},#{item.sell},#{item.fuseSell},#{item.exclusive},#{item.fileName}) + + + +-- update work_flow_version + +