diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java index 5ff2370..5232b12 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java @@ -1,11 +1,9 @@ package com.mcwl.web.controller.resource; -import cn.hutool.core.lang.Dict; 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.ModelProduct; import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.service.ModelVersionService; import com.mcwl.system.init.DictInit; @@ -17,7 +15,6 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.util.ArrayList; -import java.util.Date; import java.util.List; /** 模型版本 @@ -85,7 +82,16 @@ public class ModelVersionController extends BaseController { } + /** + * 详情页 版本列表 + * @param modelId + * @return + */ + @GetMapping("/selectByModelId") + public AjaxResult selectByModelId(@RequestParam Long modelId){ + return modelVersionService.selectByModelId(modelId); + } @ApiOperation(value = "模型版本列表") @PostMapping("list") diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java new file mode 100644 index 0000000..e667ac5 --- /dev/null +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java @@ -0,0 +1,72 @@ +package com.mcwl.web.controller.resource; + +import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.resource.domain.Report; +import com.mcwl.resource.domain.vo.PageVo; +import com.mcwl.resource.service.ReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 举报功能 + * @author DaiZibo + * @date 2025/1/18 + * @apiNote + */ + +@RequestMapping("/report") +@RestController +public class ReportController { + + @Autowired + private ReportService reportService; + + /** + * 新增举报内容 + * @param report + * @return + */ + @PostMapping("/addReport") + public AjaxResult addReport(@RequestBody Report report){ + + reportService.addReport(report); + return AjaxResult.success("举报成功"); + } + + /** + * 查询举报列表 + * @param pageVo + * @return + */ + @PostMapping("/selectReport") + public AjaxResult selectReport(@RequestBody PageVo pageVo){ + + + return reportService.selectReport(pageVo); + } + + /** + * 删除举报 + * @param id + * @return + */ + @GetMapping("/deleteReport") + public AjaxResult deleteReport(@RequestParam Long id){ + + reportService.deleteReport(id); + return AjaxResult.success("删除成功"); + } + + /** + * 修改状态 + * @param id + * @return + */ + @GetMapping("/updateStatus") + public AjaxResult updateStatus(@RequestParam Long id){ + + reportService.updateStatus(id); + return AjaxResult.success("修改成功"); + } + +} diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ToActivityController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ToActivityController.java index f71e490..31ff596 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ToActivityController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ToActivityController.java @@ -48,7 +48,7 @@ public class ToActivityController extends BaseController { @PostMapping("finById") public AjaxResult finById(@RequestBody ToActivity toActivity) { - return AjaxResult.success(toActivityService.getById(toActivity)); + return AjaxResult.success(toActivityService.getById(toActivity.getId())); } 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 296e3a3..2238e14 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 @@ -3,7 +3,6 @@ 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 io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -11,9 +10,7 @@ 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; /** @@ -44,11 +41,6 @@ public class ModelProduct extends BaseEntity { */ @ApiModelProperty(value = "名称") private String modelName; - /** - * 描述 - */ - @ApiModelProperty(value = "描述") - private String versionDescription; /*** * 用户id */ @@ -113,7 +105,14 @@ public class ModelProduct extends BaseEntity { * 审核状态 */ @ApiModelProperty(value = "审核状态") - private Integer auditSatus; + private Integer auditStatus; + + /** + * 审核(1公开 2自见) + */ + @ApiModelProperty(value = "审核") + private Integer jurisdiction; + /** * 审核失败原因 */ 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 7ac3cde..dac955b 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 @@ -37,7 +37,7 @@ public class ModelVersion extends BaseEntity { /** * 版本名称 */ - @ApiModelProperty(value = "版本名称") + @ApiModelProperty(value = "模型ID") private Long modelId; /** * 版本名称 @@ -84,11 +84,21 @@ public class ModelVersion extends BaseEntity { */ @ApiModelProperty(value = "cfg") private Integer cfg; + /** + * 是否免费 + */ + @ApiModelProperty(value = "是否免费") + private Integer isFree; /** * 是否公开 */ @ApiModelProperty(value = "是否公开") private Integer isPublic; + /** + * 是否加密 + */ + @ApiModelProperty(value = "是否加密") + private String isEncrypt; /** * 是否在线使用 */ @@ -138,7 +148,7 @@ public class ModelVersion extends BaseEntity { * 审核状态 */ @ApiModelProperty(value = "审核状态") - private Integer auditSatus; + private Integer auditStatus; /** * 审核失败原因 */ diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/Report.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/Report.java new file mode 100644 index 0000000..675a170 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/Report.java @@ -0,0 +1,73 @@ +package com.mcwl.resource.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * 举报表 + * @author DaiZibo + * @date 2025/1/18 + * @apiNote + */ + +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +@TableName("report") +public class Report { + + /** + * 主键ID + */ + private Long id; + + /** + * 被举报的商品ID + */ + private Long productId; + + /** + * 举报人ID + */ + private Long userId; + + /** + * 举报类型 + */ + private Integer reportId; + + /** + * 区分举报内容(1模型 2图片 3工作流) + */ + private Integer type; + + /** + * 举报描述 + */ + private String text; + + /** + * 状态(0未处理 1已处理) + */ + private Integer status = 0; + + /** + * 创建时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") + private Date createTime; + + /** + * 逻辑删除(0展示 2删除) + */ + private Integer delFlag = 0; +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ToActivity.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ToActivity.java index 51662f7..c370231 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ToActivity.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ToActivity.java @@ -2,7 +2,6 @@ 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 io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -22,7 +21,7 @@ import lombok.NoArgsConstructor; @Data @ApiModel(description = "活动") @TableName("to_activity") -public class ToActivity extends BaseEntity { +public class ToActivity{ /** * 主键 */ diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/PageVo.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/PageVo.java index dbde791..1e4aad2 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/PageVo.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/PageVo.java @@ -9,6 +9,7 @@ import lombok.NoArgsConstructor; /** * 分页+条件 + * * @author DaiZibo * @date 2025/1/13 * @apiNote @@ -21,12 +22,14 @@ import lombok.NoArgsConstructor; @ApiModel(description = "分页+条件") public class PageVo { - @ApiModelProperty(value = "页码") - private Integer pageNumber; -@ApiModelProperty(value = "每页条数") - private Integer pageSize; -@ApiModelProperty(value = "名称") - private String name; -@ApiModelProperty(value = "排序") - private Integer order; + @ApiModelProperty(value = "页码") + private Integer pageNumber; + @ApiModelProperty(value = "每页条数") + private Integer pageSize; + @ApiModelProperty(value = "名称") + private String name; + @ApiModelProperty(value = "排序") + private Integer order; + @ApiModelProperty(value = "条件过滤") + private Integer type; } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelVersionMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelVersionMapper.java index e495c36..70ca73c 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelVersionMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelVersionMapper.java @@ -20,6 +20,6 @@ import java.util.List; public interface ModelVersionMapper extends BaseMapper { void addModelVersion(@Param("modelProduct") ModelProduct modelProduct, @Param("modelVersionList") List modelVersionList); - + void updateByName(ModelVersion modelVersion); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ReportMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ReportMapper.java new file mode 100644 index 0000000..a0badf3 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ReportMapper.java @@ -0,0 +1,15 @@ +package com.mcwl.resource.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mcwl.resource.domain.Report; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author DaiZibo + * @date 2025/1/18 + * @apiNote + */ + +@Mapper +public interface ReportMapper extends BaseMapper { +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowLikeMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowLikeMapper.java index 2664d26..88d8ec0 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowLikeMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowLikeMapper.java @@ -17,4 +17,6 @@ import org.apache.ibatis.annotations.Param; public interface WorkFlowLikeMapper extends BaseMapper { WorkFlowLike getLike(@Param("userId") Long userId, @Param("modelId") Long modelId); + void updateStatus(WorkFlowLike workFlowLike); + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelVersionService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelVersionService.java index 5e77324..f98735e 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelVersionService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelVersionService.java @@ -1,6 +1,7 @@ package com.mcwl.resource.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.resource.domain.ModelVersion; import java.util.List; @@ -18,4 +19,6 @@ public interface ModelVersionService extends IService { List selectLogininforList(ModelVersion modelVersion); + AjaxResult selectByModelId(Long modelId); + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java new file mode 100644 index 0000000..a45b898 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java @@ -0,0 +1,24 @@ +package com.mcwl.resource.service; + +import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.resource.domain.Report; +import com.mcwl.resource.domain.vo.PageVo; + +/** + * 举报 业务层 + * + * @author DaiZibo + * @date 2025/1/18 + * @apiNote + */ + +public interface ReportService { + void addReport(Report report); + + AjaxResult selectReport(PageVo pageVo); + + void deleteReport(Long id); + + void updateStatus(Long id); + +} 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 691cd91..ce59e0b 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 @@ -1,6 +1,8 @@ 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; @@ -14,6 +16,7 @@ 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; @@ -28,6 +31,7 @@ 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; @@ -59,6 +63,9 @@ public class ModelServiceImpl extends ServiceImpl impl @Autowired private ISysUserService sysUserService; + @Autowired + private ThreadPoolTaskExecutor threadPoolTaskExecutor; + @Override public Page selectByUserId(MallProductVo mallProductVo) { @@ -73,8 +80,6 @@ public class ModelServiceImpl extends ServiceImpl impl mallProductLambdaQueryWrapper.eq(ModelProduct::getUserId,userId); mallProductLambdaQueryWrapper.eq(ModelProduct::getDelFlag,0); - - // 开始时间和结束时间过滤 if (mallProductVo.getStartTime() != null && mallProductVo.getEndTime() != null) { // 查询开始时间和结束时间之间的商品 @@ -115,7 +120,7 @@ public class ModelServiceImpl extends ServiceImpl impl page.addOrder(orderItem); LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); - lqw.eq(imagePageRes.getStatus() != null, ModelProduct::getAuditSatus, imagePageRes.getStatus()) + 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()); @@ -165,19 +170,160 @@ public class ModelServiceImpl extends ServiceImpl impl //批量添加版本 modelVersionMapper.addModelVersion(requestModel.getModelProduct(),requestModel.getModelVersionList()); + //执行审核方法 + audit(requestModel); + return AjaxResult.success("添加成功,等待审核"); } + private void audit(RequestModel requestModel) { + + // 执行审核操作 + threadPoolTaskExecutor.submit(() -> { + ModelProduct modelProduct = requestModel.getModelProduct(); + + if (modelProduct != null){ + + if (modelProduct.getModelName() != null){ + + //审核名称 + String s = BaiduCensor.TextCensor(modelProduct.getModelName()+","+modelProduct.getTags()); + // 解析 JSON 字符串 + JSONObject jsonObject = JSONObject.parseObject(s); + // 获取 'conclusion' 字段的值 + String conclusion = jsonObject.getString("conclusion"); + + if (conclusion.equals("不合规")) { + + //更改状态,添加原因 -> 结束任务 + // 获取 'data' 数组 + JSONArray dataArray = jsonObject.getJSONArray("data"); + + // 存储所有的失败原因 + List failureReasons = new ArrayList<>(); + // 遍历 'data' 数组中的每个元素 + for (Object itemObj : dataArray) { + JSONObject item = (JSONObject) itemObj; + String msg = item.getString("msg"); + failureReasons.add(msg); + } + // 使用逗号拼接所有的失败原因 + String concatenatedReasons = String.join(", ", failureReasons); + modelProduct.setAuditText(concatenatedReasons); + + //修改状态以及失败原因 + modelProduct.setAuditStatus(4); + baseMapper.updateById(modelProduct); + log.info("模型审核未通过"); + //结束任务 + return; + } + + //修改为合格 + modelProduct.setAuditText(""); + modelProduct.setAuditStatus(modelProduct.getJurisdiction()); + baseMapper.updateById(modelProduct); + } + } + + + List modelVersionList = requestModel.getModelVersionList(); + + if (modelVersionList != null){ + //审核版本 + for (ModelVersion modelVersion : modelVersionList) { + modelVersion.setModelId(modelProduct.getId()); + //版本名称 + String s1 = BaiduCensor.TextCensor(modelVersion.getVersionName() + "," + + modelVersion.getVersionDescription()+","+modelVersion.getTriggerWords()); + // 解析 JSON 字符串 + JSONObject jsonObject1 = JSONObject.parseObject(s1); + // 获取 'conclusion' 字段的值 + String conclusion1 = jsonObject1.getString("conclusion"); + if (conclusion1.equals("不合规")) { + + //更改版本状态->跳出循环 审核下一个版本 + // 获取 'data' 数组 + JSONArray dataArray1 = jsonObject1.getJSONArray("data"); + // 存储所有的失败原因 + List failureReasons = new ArrayList<>(); + // 遍历 'data' 数组中的每个元素 + for (Object itemObj : dataArray1) { + JSONObject item = (JSONObject) itemObj; + String msg = item.getString("msg"); + failureReasons.add(msg); + } + // 使用逗号拼接所有的失败原因 + String concatenatedReasons = String.join(", ", failureReasons); + modelVersion.setAuditText(concatenatedReasons); + modelVersion.setAuditStatus(4); + //校验id是否存在 区别修改审核或者新增审核 + if (modelVersion.getId() != null){ + modelVersionMapper.updateById(modelVersion); + }else { + modelVersionMapper.updateByName(modelVersion); + } + log.info("版本审核未通过"); + continue; + } + + //审核版本图片 + String[] split = modelVersion.getFilePath().split(","); + for (String path : split) { + String s2 = BaiduCensor.ImageCnesor(path); + JSONObject jsonObject2 = JSONObject.parseObject(s2); + if (jsonObject2.getString("conclusion").equals("不合规")) { + + //修改状态->跳出循环 判断下一个版本 + // 获取 'data' 数组 + JSONArray dataArray2 = jsonObject2.getJSONArray("data"); + // 存储所有的失败原因 + List failureReasons = new ArrayList<>(); + // 遍历 'data' 数组中的每个元素 + for (Object itemObj : dataArray2) { + JSONObject item = (JSONObject) itemObj; + String msg = item.getString("msg"); + failureReasons.add(msg); + } + // 使用逗号拼接所有的失败原因 + String concatenatedReasons = String.join(", ", failureReasons); + modelVersion.setAuditText(concatenatedReasons); + modelVersion.setAuditStatus(4); + //校验id是否存在 区别修改审核或者新增审核 + if (modelVersion.getId() != null){ + modelVersionMapper.updateById(modelVersion); + }else { + modelVersionMapper.updateByName(modelVersion); + } + modelVersionMapper.updateByName(modelVersion); + log.info("图片审核未通过"); + break; + } + } + + //修改版本成功审核状态 + modelProduct.setAuditText(""); + modelVersion.setAuditStatus(1); + modelVersionMapper.updateByName(modelVersion); + log.info("全部通过审核"); + } + } + + }); + + } + @Override public void updaModel(RequestModel requestModel) { //修改模版的信息 ModelProduct modelProduct = requestModel.getModelProduct(); - if (ObjectUtils.isEmpty(modelProduct)){ + if (ObjectUtils.isNotEmpty(modelProduct)){ - } - if (StringUtils.isNotNull(modelProduct.getId())){ - modelProduct.setAuditSatus(3); - postMapper.updateModel(requestModel.getModelProduct()); + if (StringUtils.isNotNull(modelProduct.getId())){ + modelProduct.setAuditStatus(3); + modelProduct.setUpdateTime(new Date()); + postMapper.updateById(requestModel.getModelProduct()); + } } //修改工作流版本的信息 @@ -185,7 +331,7 @@ public class ModelServiceImpl extends ServiceImpl impl //批量修改 for (ModelVersion modelVersion : requestModel.getModelVersionList()) { - modelVersion.setAuditSatus(3); + modelVersion.setAuditStatus(3); modelVersionMapper.updateById(modelVersion); } @@ -194,9 +340,11 @@ public class ModelServiceImpl extends ServiceImpl impl getModelId()).build(); model.setUpdateTime(new Date()); postMapper.updateById(model); - } + //审核 + audit(requestModel); + } @Override diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java index 974ae78..773a9e1 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java @@ -2,13 +2,17 @@ package com.mcwl.resource.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mcwl.common.constant.DictConstants; +import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.utils.StringUtils; import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.mapper.ModelVersionMapper; import com.mcwl.resource.service.ModelVersionService; +import com.mcwl.system.init.DictInit; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; /**模型版本 业务实现层 @@ -49,15 +53,30 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo return modelVersionMapper.selectList(queryWrapper); } + @Override + public AjaxResult selectByModelId(Long modelId) { + //根据模型ID查询所有的版本信息 + LambdaQueryWrapper modelVersionLambdaQueryWrapper = new LambdaQueryWrapper<>(); + modelVersionLambdaQueryWrapper.eq(ModelVersion::getModelId,modelId); + modelVersionLambdaQueryWrapper.eq(ModelVersion::getDelFlag,0); + List modelVersions = modelVersionMapper.selectList(modelVersionLambdaQueryWrapper); + for (ModelVersion modelVersion : modelVersions) { + ArrayList arrayList = new ArrayList<>(); + //获取 + String[] split = modelVersion.getHigh().split(","); + for (String s : split) { + arrayList.add(DictInit.getDictValue(DictConstants.DICT_TYPE_MODEL_VERSION_HIGH,s)); + } - - - + modelVersion.setHighList(arrayList); + } + return AjaxResult.success(modelVersions); + } } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java new file mode 100644 index 0000000..552505a --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java @@ -0,0 +1,72 @@ +package com.mcwl.resource.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.utils.SecurityUtils; +import com.mcwl.resource.domain.Report; +import com.mcwl.resource.domain.vo.PageVo; +import com.mcwl.resource.mapper.ReportMapper; +import com.mcwl.resource.service.ReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + * 举报 业务实现层 + * + * @author DaiZibo + * @date 2025/1/18 + * @apiNote + */ + +@Service +public class ReportServiceImpl implements ReportService { + + + @Autowired + private ReportMapper reportMapper; + + @Override + public void addReport(Report report) { + + report.setCreateTime(new Date()); + report.setUserId(SecurityUtils.getUserId()); + reportMapper.insert(report); + } + + @Override + public AjaxResult selectReport(PageVo pageVo) { + + Page page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize()); + + //构造查询条件 + LambdaQueryWrapper reportLambdaQueryWrapper = new LambdaQueryWrapper<>(); + reportLambdaQueryWrapper.eq(Report::getDelFlag, 0); + if (pageVo.getType() != null) { + reportLambdaQueryWrapper.eq(Report::getStatus, 0); + } + + return AjaxResult.success(reportMapper.selectPage(page, reportLambdaQueryWrapper)); + } + + @Override + public void deleteReport(Long id) { + + Report report = new Report().builder().id(id) + .delFlag(2).build(); + + reportMapper.updateById(report); + } + + @Override + public void updateStatus(Long id) { + + Report report = new Report().builder().id(id) + .status(1) + .build(); + + reportMapper.updateById(report); + } +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowCommentServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowCommentServiceImpl.java index 66a2546..6284e04 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowCommentServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowCommentServiceImpl.java @@ -40,10 +40,12 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl i } //修改为合格 + workFlow.setAuditText(""); workFlow.setAuditStatus(workFlow.getJurisdiction()); flowMapper.updateById(workFlow); } @@ -170,7 +171,7 @@ public class WorkFlowServiceImpl extends ServiceImpl i } // 使用逗号拼接所有的失败原因 String concatenatedReasons = String.join(", ", failureReasons); - workFlow.setAuditText(concatenatedReasons); + workFlowVersion.setAuditText(concatenatedReasons); workFlowVersion.setAuditStatus(4); //校验id是否存在 区别修改审核或者新增审核 if (workFlowVersion.getId() != null){ @@ -202,7 +203,7 @@ public class WorkFlowServiceImpl extends ServiceImpl i } // 使用逗号拼接所有的失败原因 String concatenatedReasons = String.join(", ", failureReasons); - workFlow.setAuditText(concatenatedReasons); + workFlowVersion.setAuditText(concatenatedReasons); workFlowVersion.setAuditStatus(4); //校验id是否存在 区别修改审核或者新增审核 if (workFlowVersion.getId() != null){ @@ -217,6 +218,7 @@ public class WorkFlowServiceImpl extends ServiceImpl i } //修改版本成功审核状态 + workFlow.setAuditText(""); workFlowVersion.setAuditStatus(1); workFlowVersionMapper.updateByName(workFlowVersion); log.info("全部通过审核"); diff --git a/mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml index 7ac880f..b9dce78 100644 --- a/mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml +++ b/mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml @@ -7,24 +7,30 @@ INSERT INTO model_version ( - version_name, model_type, file_path, trigger_words, sampling, high, vae, cfg, + model_id,version_name, model_type, file_path, 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 ) VALUES - + ( - #{item.versionName}, #{item.modelType}, #{item.filePath}, #{item.triggerWords}, + #{modelProduct.id},#{item.versionName}, #{item.modelType}, #{item.filePath}, #{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}, #{item.auditStatus}, - #{item.auditText}, #{item.delFlag} + #{item.sampleImagePaths}, #{item.hideImageGenInfo}, 3, + #{item.auditText},'0' ) + + update model_version set audit_status = #{auditStatus}, + audit_text = #{auditText} + where version_name = #{versionName} and model_id = #{modelId} + + diff --git a/mcwl-resource/src/main/resources/mapper/resource/WorkFlowLikeMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/WorkFlowLikeMapper.xml index c8d918b..f40d9d2 100644 --- a/mcwl-resource/src/main/resources/mapper/resource/WorkFlowLikeMapper.xml +++ b/mcwl-resource/src/main/resources/mapper/resource/WorkFlowLikeMapper.xml @@ -4,18 +4,31 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + UPDATE work_flow_like + SET user_id = #{userId}, + work_flow_id = #{workFlowId}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + del_flag = #{delFlag} + WHERE id = #{id} + +