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 5232b12..dacef45 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,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 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); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelImage.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelImage.java index e4c0d2d..570d3c2 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelImage.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelImage.java @@ -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; } 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 648ff16..4dfc188 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 @@ -95,10 +95,10 @@ public class ModelVersion extends BaseEntity { @ApiModelProperty(value = "是否公开") private Integer isPublic; /** - * 是否加密 + * 是否加密(0不加密 1加密) */ @ApiModelProperty(value = "是否加密") - private String isEncrypt; + private Integer isEncrypt; /** * 是否在线使用 */ diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/dto/ModelImageRes.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/dto/ModelImageRes.java index c690221..bd6c2d2 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/dto/ModelImageRes.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/dto/ModelImageRes.java @@ -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; diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageServiceImpl.java index ef7efa4..f9b66fb 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageServiceImpl.java @@ -1,25 +1,25 @@ 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.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.common.utils.baidu.BaiduCensor; 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; @@ -28,14 +28,16 @@ import com.mcwl.system.init.DictInit; import com.mcwl.system.service.ISysDictDataService; import com.mcwl.system.service.ISysUserService; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 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; +@Slf4j @Service @RequiredArgsConstructor public class ModelImageServiceImpl extends ServiceImpl implements ModelImageService { @@ -48,6 +50,8 @@ public class ModelImageServiceImpl extends ServiceImpl { + if (modelImage != null) { + + if (modelImage.getTitle() != null) { + + //审核名称 + String s = BaiduCensor.TextCensor(modelImage.getTitle() + "," + modelImage.getTags() + "," + + modelImage.getDescription()); + // 解析 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); + modelImage.setAuditText(concatenatedReasons); } @@ -156,4 +196,5 @@ public class ModelImageServiceImpl extends ServiceImpl i }else { workFlowVersionMapper.updateByName(workFlowVersion); } - workFlowVersionMapper.updateByName(workFlowVersion); log.info("图片审核未通过"); break; }