Merge branch 'feature/admin' into preview
commit
59e1e87b2a
|
@ -6,6 +6,7 @@ import com.mcwl.resource.service.impl.FileServiceImpl;
|
|||
import com.mcwl.web.controller.common.OssUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -22,6 +23,7 @@ import java.util.Map;
|
|||
* @apiNote
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "上传文件")
|
||||
@RestController
|
||||
@RequestMapping("/file")
|
||||
|
@ -62,6 +64,7 @@ public class FileController {
|
|||
@PostMapping("/fileUpload")
|
||||
public AjaxResult fileUpload(@RequestParam MultipartFile file) {
|
||||
|
||||
log.info("开始上传文件...");
|
||||
Map<String, String> map = obsUtils.uploadFile(file);
|
||||
|
||||
return AjaxResult.success(map);
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.mcwl.resource.domain.request.RequestModel;
|
|||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
import com.mcwl.resource.mapper.ModelVersionMapper;
|
||||
import com.mcwl.resource.service.*;
|
||||
import com.mcwl.system.service.impl.SysUserServiceImpl;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -63,6 +64,9 @@ public class MallProductController extends BaseController {
|
|||
@Autowired
|
||||
private ModelVersionMapper modelVersionMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserServiceImpl sysUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 模型列表
|
||||
|
@ -234,5 +238,13 @@ public class MallProductController extends BaseController {
|
|||
return R.ok(modelProductPage);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "个人中心更改背景")
|
||||
@GetMapping("/updateBackgroundImg")
|
||||
public R updateBackgroundImg(@RequestParam Long id,String path){
|
||||
|
||||
sysUserService.updateBackgroundImg(id,path);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -129,7 +129,6 @@ public class WorkFlowController extends BaseController {
|
|||
|
||||
/**
|
||||
* 查询工作流详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.mcwl.system.service.ISysDeptService;
|
|||
import com.mcwl.system.service.ISysPostService;
|
||||
import com.mcwl.system.service.ISysRoleService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
@ -261,8 +262,9 @@ public class SysUserController extends BaseController
|
|||
* 查询个人信息
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "个人中心查询个人数据")
|
||||
@GetMapping("/selectUserById")
|
||||
public AjaxResult selectUserById(@RequestParam Long id){
|
||||
public AjaxResult selectUserById(@RequestParam(name = "id", required = false) Long id){
|
||||
if (id == null){
|
||||
id = SecurityUtils.getUserId();
|
||||
}
|
||||
|
|
|
@ -375,7 +375,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.2.1</version>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.mcwl.common.constant;
|
||||
|
||||
import java.util.Locale;
|
||||
import io.jsonwebtoken.Claims;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 通用常量信息
|
||||
*
|
||||
|
@ -10,6 +11,17 @@ import io.jsonwebtoken.Claims;
|
|||
*/
|
||||
public class Constants
|
||||
{
|
||||
|
||||
/**
|
||||
* 工作流
|
||||
*/
|
||||
public static final String WORKFLOW = "workflow";
|
||||
|
||||
/**
|
||||
* 模型
|
||||
*/
|
||||
public static final String MODEL = "model";
|
||||
|
||||
/**
|
||||
* UTF-8 字符集
|
||||
*/
|
||||
|
|
|
@ -120,14 +120,62 @@ public class SysUser extends BaseEntity
|
|||
*/
|
||||
private Double wallet;
|
||||
|
||||
/**
|
||||
* 是否关注
|
||||
*/
|
||||
private Boolean isAttention;
|
||||
|
||||
/**
|
||||
* 背景地址
|
||||
*/
|
||||
private String backgroundImg;
|
||||
|
||||
|
||||
public SysUser()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysUser{" +
|
||||
"userId=" + userId +
|
||||
", deptId=" + deptId +
|
||||
", userName='" + userName + '\'' +
|
||||
", nickName='" + nickName + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", phonenumber='" + phonenumber + '\'' +
|
||||
", sex='" + sex + '\'' +
|
||||
", avatar='" + avatar + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", status='" + status + '\'' +
|
||||
", delFlag='" + delFlag + '\'' +
|
||||
", loginIp='" + loginIp + '\'' +
|
||||
", loginDate=" + loginDate +
|
||||
", dept=" + dept +
|
||||
", roles=" + roles +
|
||||
", roleIds=" + Arrays.toString(roleIds) +
|
||||
", postIds=" + Arrays.toString(postIds) +
|
||||
", roleId=" + roleId +
|
||||
", brief='" + brief + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", idCard='" + idCard + '\'' +
|
||||
", inviterUserId=" + inviterUserId +
|
||||
", freePoints=" + freePoints +
|
||||
", wallet=" + wallet +
|
||||
", isAttention=" + isAttention +
|
||||
", backgroundImg='" + backgroundImg + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String getBackgroundImg() {
|
||||
return backgroundImg;
|
||||
}
|
||||
|
||||
public void setBackgroundImg(String backgroundImg) {
|
||||
this.backgroundImg = backgroundImg;
|
||||
}
|
||||
|
||||
public SysUser(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
|
@ -379,35 +427,6 @@ public class SysUser extends BaseEntity
|
|||
this.wallet = wallet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysUser{" +
|
||||
"userId=" + userId +
|
||||
", deptId=" + deptId +
|
||||
", userName='" + userName + '\'' +
|
||||
", nickName='" + nickName + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", phonenumber='" + phonenumber + '\'' +
|
||||
", sex='" + sex + '\'' +
|
||||
", avatar='" + avatar + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", status='" + status + '\'' +
|
||||
", delFlag='" + delFlag + '\'' +
|
||||
", loginIp='" + loginIp + '\'' +
|
||||
", loginDate=" + loginDate +
|
||||
", dept=" + dept +
|
||||
", roles=" + roles +
|
||||
", roleIds=" + Arrays.toString(roleIds) +
|
||||
", postIds=" + Arrays.toString(postIds) +
|
||||
", roleId=" + roleId +
|
||||
", brief='" + brief + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", idCard='" + idCard + '\'' +
|
||||
", inviterUserId=" + inviterUserId +
|
||||
", freePoints=" + freePoints +
|
||||
'}';
|
||||
}
|
||||
|
||||
public Boolean getAttention() {
|
||||
return isAttention;
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@ import java.net.URLEncoder;
|
|||
public class BaiduCensor {
|
||||
|
||||
//设置APPID/AK/SK
|
||||
public static final String APP_ID = "6273132";
|
||||
public static final String API_KEY = "8cxN3yyAbQeKGhS0cHAVzlNN";
|
||||
public static final String SECRET_KEY = "hubX4QXVGJbV9ccEVGv4Ifd2w80B71nD";
|
||||
public static final String APP_ID = "117094023";
|
||||
public static final String API_KEY = "bAfO5WLsaMoGTgznvYTIoxwA";
|
||||
public static final String SECRET_KEY = "BU6PmWntW44IMRfotl3ySF6rTHLleVtT";
|
||||
|
||||
//图像审核
|
||||
public static String ImageCnesor(String filePath) {
|
||||
|
@ -113,5 +113,9 @@ public class BaiduCensor {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String s = ImageCnesor("https://ybl2112.oss-cn-beijing.aliyuncs.com/2025/MARCH/4/11/53/009ddedc-3102-4ec2-82d2-e69399ba51fa.jpg");
|
||||
System.out.println(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,26 +1,29 @@
|
|||
package com.mcwl.common.utils.http;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.mcwl.common.constant.Constants;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.net.ssl.*;
|
||||
import java.io.*;
|
||||
import java.net.ConnectException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.cert.X509Certificate;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.mcwl.common.constant.Constants;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通用http发送方法
|
||||
|
@ -189,6 +192,65 @@ public class HttpUtils
|
|||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
public static String pythonPost(String url, HashMap<String,String> map){
|
||||
|
||||
//转换JSOn格式
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonPayload = "";
|
||||
try {
|
||||
jsonPayload = objectMapper.writeValueAsString(map);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
String s = HttpUtils.sendPost(url, jsonPayload);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发送 POST 请求
|
||||
* @param requestUrl 请求地址
|
||||
* @param params 请求参数
|
||||
* @return 响应字符串
|
||||
*/
|
||||
public static String sendPost(String requestUrl, Map<String, String> params) {
|
||||
// 创建 HttpClient 实例
|
||||
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
|
||||
// 创建 HttpPost 实例
|
||||
HttpPost httpPost = new HttpPost(requestUrl);
|
||||
|
||||
// 设置请求头
|
||||
httpPost.setHeader("Content-Type", "application/json");
|
||||
|
||||
// 构建请求体
|
||||
StringBuilder postData = new StringBuilder();
|
||||
for (Map.Entry<String, String> param : params.entrySet()) {
|
||||
if (postData.length() != 0) postData.append('&');
|
||||
postData.append(java.net.URLEncoder.encode(param.getKey(), StandardCharsets.UTF_8.toString()));
|
||||
postData.append('=');
|
||||
postData.append(java.net.URLEncoder.encode(String.valueOf(param.getValue()), StandardCharsets.UTF_8.toString()));
|
||||
}
|
||||
|
||||
// 设置请求实体
|
||||
StringEntity entity = new StringEntity(postData.toString(), StandardCharsets.UTF_8);
|
||||
httpPost.setEntity(entity);
|
||||
|
||||
// 执行请求并获取响应
|
||||
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
||||
HttpEntity responseEntity = response.getEntity();
|
||||
if (responseEntity != null) {
|
||||
return EntityUtils.toString(responseEntity, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static String sendSSLPost(String url, String param)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
|
|
@ -50,6 +50,7 @@ public class ObsUtils {
|
|||
inputStream.close();
|
||||
map.put("path",putObjectResult.getObjectUrl());
|
||||
map.put("objectKey",putObjectResult.getObjectKey());
|
||||
map.put("size",multipartFile.getSize()+"");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.mcwl.common.core.domain.BaseEntity;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
@ -21,6 +22,7 @@ import java.util.ArrayList;
|
|||
* @Description TODO
|
||||
* @Date:2025/1/8 19:25
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
|
@ -102,7 +104,7 @@ public class ModelVersion extends BaseEntity {
|
|||
/**
|
||||
* 是否加密(0不加密 1加密)
|
||||
*/
|
||||
@ApiModelProperty(value = "是否加密")
|
||||
@ApiModelProperty(value = "是否加密(0不加密 1加密)")
|
||||
private Integer isEncrypt;
|
||||
/**
|
||||
* 是否在线使用
|
||||
|
@ -158,15 +160,23 @@ public class ModelVersion extends BaseEntity {
|
|||
private String keyRate;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*文件key
|
||||
*/
|
||||
// @ApiModelProperty(value = "审核状态")
|
||||
// private Integer auditStatus;
|
||||
// /**
|
||||
// * 审核失败原因
|
||||
// */
|
||||
// @ApiModelProperty(value = "审核失败原因")
|
||||
// private String auditText;
|
||||
@ApiModelProperty(value = "文件的key标识")
|
||||
private String objectKey;
|
||||
|
||||
/**
|
||||
* 加密后文件地址
|
||||
*/
|
||||
@ApiModelProperty(value = "加密后文件地址")
|
||||
private String encryptionFilePath;
|
||||
|
||||
/**
|
||||
* 加密后文件key标识
|
||||
*/
|
||||
@ApiModelProperty(value = "加密后文件key标识")
|
||||
private String encryptionObjectKey;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
|
|
|
@ -61,18 +61,6 @@ public class WorkFlowVersion {
|
|||
@ApiModelProperty("删除标志(0代表存在 2代表删除)")
|
||||
private String delFlag;
|
||||
|
||||
// /**
|
||||
// * 审核状态(0全部状态 1已发布-公开 2已发布-仅自己可见 3审核中 4审核未通过)
|
||||
// */
|
||||
// @ApiModelProperty("审核状态(0全部状态 1已发布-公开 2已发布-仅自己可见 3审核中 4审核未通过)")
|
||||
// private Integer auditStatus = 3;
|
||||
//
|
||||
// /**
|
||||
// * 审核失败原因
|
||||
// */
|
||||
// @ApiModelProperty("审核失败原因")
|
||||
// private String auditText;
|
||||
|
||||
/**
|
||||
* 工作流ID
|
||||
*/
|
||||
|
@ -97,4 +85,10 @@ public class WorkFlowVersion {
|
|||
*/
|
||||
@ApiModelProperty(value = "是否加密")
|
||||
private Integer isEncrypt;
|
||||
|
||||
/**
|
||||
* 文件key
|
||||
*/
|
||||
@ApiModelProperty(value = "文件的key")
|
||||
private String objectKey;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package com.mcwl.resource.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
|
@ -18,10 +15,12 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface ModelVersionMapper extends BaseMapper<ModelVersion> {
|
||||
void addModelVersion(@Param("modelProduct") ModelProduct modelProduct, @Param("modelVersionList") List<ModelVersion> modelVersionList);
|
||||
// void addModelVersion(@Param("modelProduct") ModelProduct modelProduct, @Param("modelVersionList") List<ModelVersion> modelVersionList);
|
||||
|
||||
void updateByName(ModelVersion modelVersion);
|
||||
|
||||
ModelVersion selectByFileName(@Param("name") String name);
|
||||
|
||||
void addModelVersion (ModelVersion modelVersion);
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ 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.github.pagehelper.PageInfo;
|
||||
import com.mcwl.common.constant.Constants;
|
||||
import com.mcwl.common.constant.DictConstants;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
|
@ -17,13 +18,14 @@ 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.common.utils.http.HttpUtils;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
import com.mcwl.resource.domain.SysUserAttention;
|
||||
import com.mcwl.resource.domain.WorkFlowLike;
|
||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||
import com.mcwl.resource.domain.response.ResponseModelProduct;
|
||||
import com.mcwl.resource.domain.request.RequestModel;
|
||||
import com.mcwl.resource.domain.response.ResponseModelProduct;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
import com.mcwl.resource.domain.vo.ModelVo;
|
||||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
|
@ -40,10 +42,7 @@ 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;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**模型 业务实现层
|
||||
|
@ -189,7 +188,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
|
||||
// 设置模型类型
|
||||
if (Objects.nonNull(modelImage.getModelType())) {
|
||||
String modelTypeName = DictInit.getDictValue(DictConstants.MODEL_CATEGORY, modelImage.getModelType().toString());
|
||||
String modelTypeName = DictInit.getDictValue(DictConstants.MODEL_TYPE, modelImage.getModelType().toString());
|
||||
modelVo.setModelType(modelTypeName);
|
||||
}
|
||||
|
||||
|
@ -231,7 +230,11 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
log.info("获取到的入参:{}",requestModel.getModelProduct());
|
||||
|
||||
//批量添加版本
|
||||
modelVersionMapper.addModelVersion(requestModel.getModelProduct(),requestModel.getModelVersionList());
|
||||
// modelVersionMapper.addModelVersion(requestModel.getModelProduct(),requestModel.getModelVersionList());
|
||||
for (ModelVersion modelVersion : requestModel.getModelVersionList()) {
|
||||
modelVersion.setModelId(requestModel.getModelProduct().getId());
|
||||
modelVersionMapper.addModelVersion(modelVersion);
|
||||
}
|
||||
|
||||
//执行审核方法
|
||||
audit(requestModel);
|
||||
|
@ -258,7 +261,14 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
//批量修改
|
||||
for (ModelVersion modelVersion : requestModel.getModelVersionList()) {
|
||||
|
||||
|
||||
if (modelVersion.getId() != null){
|
||||
modelVersionMapper.updateById(modelVersion);
|
||||
}else {
|
||||
modelVersion.setModelId(modelProduct.getId());
|
||||
modelVersionMapper.insert(modelVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ModelProduct model = ModelProduct.builder().
|
||||
|
@ -275,17 +285,11 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
private void audit(RequestModel requestModel) {
|
||||
|
||||
// 执行审核操作
|
||||
threadPoolTaskExecutor.submit(() -> {
|
||||
// threadPoolTaskExecutor.submit(() -> {
|
||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||
|
||||
if (modelProduct != null){
|
||||
|
||||
//判断模型是否删除
|
||||
if (modelProduct.getDelFlag().equals("2")){
|
||||
//不做审核
|
||||
log.info("删除工作流信息,不做审核校验");
|
||||
return;
|
||||
}
|
||||
|
||||
if (modelProduct.getModelName() != null){
|
||||
|
||||
|
@ -296,7 +300,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
|
||||
//获取状态码
|
||||
String code = jsonObject.getString("code");
|
||||
if (!code.equals("200")){
|
||||
if (code != null){
|
||||
//审核失败,数据有问题
|
||||
modelProduct.setAuditStatus(4);
|
||||
modelProduct.setAuditText("审核失败");
|
||||
|
@ -334,10 +338,6 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
return;
|
||||
}
|
||||
|
||||
//修改为合格
|
||||
// modelProduct.setAuditText("");
|
||||
// modelProduct.setAuditStatus(modelProduct.getJurisdiction());
|
||||
// baseMapper.updateById(modelProduct);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -376,17 +376,6 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
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("版本审核未通过");
|
||||
// 使用逗号拼接所有的失败原因
|
||||
String concatenatedReasons = String.join(", ", failureReasons);
|
||||
modelProduct.setAuditText(concatenatedReasons);
|
||||
|
@ -399,7 +388,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
}
|
||||
|
||||
//审核版本图片
|
||||
String[] split = modelVersion.getFilePath().split(",");
|
||||
String[] split = modelVersion.getSampleImagePaths().split(",");
|
||||
for (String path : split) {
|
||||
String s2 = BaiduCensor.ImageCnesor(path);
|
||||
JSONObject jsonObject2 = JSONObject.parseObject(s2);
|
||||
|
@ -416,19 +405,6 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
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;
|
||||
String concatenatedReasons = String.join(", ", failureReasons);
|
||||
modelProduct.setAuditText(concatenatedReasons);
|
||||
|
||||
|
@ -440,11 +416,43 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
}
|
||||
}
|
||||
|
||||
// //修改版本成功审核状态
|
||||
// modelProduct.setAuditText("");
|
||||
// modelVersion.setAuditStatus(1);
|
||||
// modelVersionMapper.updateByName(modelVersion);
|
||||
// log.info("全部通过审核");
|
||||
//获取出key准备拉取文件
|
||||
String key = modelVersion.getObjectKey();
|
||||
|
||||
//审核成功,查看时候加密,拉取文件到ui
|
||||
if (modelVersion.getIsEncrypt() == 1){
|
||||
|
||||
//调用加密/创建参数
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
param.put("object_key",modelVersion.getObjectKey());
|
||||
param.put("model_id",modelVersion.getId()+"");
|
||||
param.put("file_type", Constants.MODEL);
|
||||
|
||||
String s = HttpUtils.pythonPost("http://1.13.246.108:9090/encrypt_and_upload", param);
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(s);
|
||||
JSONObject data = JSONObject.parseObject(jsonObject.getString("data"));
|
||||
String objectKey = data.getString("objectKey");
|
||||
String path = data.getString("path");
|
||||
String secretKey = data.getString("secret_key");
|
||||
|
||||
key = objectKey;
|
||||
|
||||
ModelVersion modelVersion1 = ModelVersion.builder().id(modelVersion.getId())
|
||||
.encryptionObjectKey(objectKey)
|
||||
.encryptionFilePath(path)
|
||||
.keyRate(secretKey).build();
|
||||
//更新加密后数据
|
||||
modelVersionMapper.updateById(modelVersion1);
|
||||
}
|
||||
|
||||
//调用ui拉取文件接口
|
||||
log.info("开始拉取文件...");
|
||||
HashMap<String, String> hashMap = new HashMap<>();
|
||||
hashMap.put("objectKey",key);
|
||||
hashMap.put("type",DictInit.getDictValue(DictConstants.MODEL_TYPE,modelProduct.getModelType()+""));
|
||||
HttpUtils.pythonPost("http://1.13.246.108:8188/api/experiment/models/upload",hashMap);
|
||||
|
||||
//修改为合格
|
||||
modelProduct.setAuditText("");
|
||||
modelProduct.setAuditStatus(modelProduct.getJurisdiction());
|
||||
|
@ -453,11 +461,13 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
}
|
||||
}
|
||||
|
||||
});
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public R<ModelProduct> selectModelById(Long id) {
|
||||
//查询详情
|
||||
|
|
|
@ -25,8 +25,8 @@ 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;
|
||||
import com.mcwl.resource.domain.response.ResponseWorkFlow;
|
||||
import com.mcwl.resource.domain.request.RequestWorkFlow;
|
||||
import com.mcwl.resource.domain.response.ResponseWorkFlow;
|
||||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
import com.mcwl.resource.domain.vo.WorkFlowVo;
|
||||
import com.mcwl.resource.mapper.SysUserAttentionMapper;
|
||||
|
@ -112,12 +112,12 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
|
||||
if (workFlow != null) {
|
||||
|
||||
//判断是否删除
|
||||
if (workFlow.getDelFlag().equals("2")) {
|
||||
//不做审核
|
||||
log.info("删除工作流信息,不做审核校验");
|
||||
return;
|
||||
}
|
||||
// //判断是否删除
|
||||
// if (workFlow.getDelFlag().equals("2")) {
|
||||
// //不做审核
|
||||
// log.info("删除工作流信息,不做审核校验");
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (workFlow.getWorkflowName() != null) {
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
JSONObject jsonObject = JSONObject.parseObject(s);
|
||||
//获取状态码
|
||||
String code = jsonObject.getString("code");
|
||||
if (!code.equals("200")) {
|
||||
if (code != null) {
|
||||
//审核失败,数据有问题
|
||||
workFlow.setAuditStatus(4);
|
||||
workFlow.setAuditText("审核失败");
|
||||
|
@ -164,10 +164,6 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
return;
|
||||
}
|
||||
|
||||
//修改为合格
|
||||
// workFlow.setAuditText("");
|
||||
// workFlow.setAuditStatus(workFlow.getJurisdiction());
|
||||
// flowMapper.updateById(workFlow);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +187,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
// 解析 JSON 字符串
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(s1);
|
||||
String code = jsonObject1.getString("code");
|
||||
if (!code.equals("200")) {
|
||||
if (code != null) {
|
||||
//审核失败,数据有问题
|
||||
workFlow.setAuditStatus(4);
|
||||
workFlow.setAuditText("审核失败");
|
||||
|
@ -221,25 +217,18 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
//修改状态以及失败原因
|
||||
workFlow.setAuditStatus(4);
|
||||
flowMapper.updateById(workFlow);
|
||||
// workFlowVersion.setAuditText(concatenatedReasons);
|
||||
// workFlowVersion.setAuditStatus(4);
|
||||
// //校验id是否存在 区别修改审核或者新增审核
|
||||
// if (workFlowVersion.getId() != null){
|
||||
// workFlowVersionMapper.updateById(workFlowVersion);
|
||||
// }else {
|
||||
// workFlowVersionMapper.updateByName(workFlowVersion);
|
||||
// }
|
||||
|
||||
log.info("版本审核文字未通过");
|
||||
return;
|
||||
}
|
||||
|
||||
//审核版本图片
|
||||
String[] split = workFlowVersion.getFilePath().split(",");
|
||||
String[] split = workFlowVersion.getImagePaths().split(",");
|
||||
for (String path : split) {
|
||||
String s2 = BaiduCensor.ImageCnesor(path);
|
||||
JSONObject jsonObject2 = JSONObject.parseObject(s2);
|
||||
String code1 = jsonObject2.getString("code");
|
||||
if (!code1.equals("200")) {
|
||||
if (code1 != null) {
|
||||
//审核失败,数据有问题
|
||||
workFlow.setAuditStatus(4);
|
||||
workFlow.setAuditText("审核失败");
|
||||
|
@ -267,24 +256,12 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
//修改状态以及失败原因
|
||||
workFlow.setAuditStatus(4);
|
||||
flowMapper.updateById(workFlow);
|
||||
// workFlowVersion.setAuditText(concatenatedReasons);
|
||||
// workFlowVersion.setAuditStatus(4);
|
||||
// //校验id是否存在 区别修改审核或者新增审核
|
||||
// if (workFlowVersion.getId() != null){
|
||||
// workFlowVersionMapper.updateById(workFlowVersion);
|
||||
// }else {
|
||||
// workFlowVersionMapper.updateByName(workFlowVersion);
|
||||
// }
|
||||
|
||||
log.info("工作流图片审核未通过");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//修改版本成功审核状态
|
||||
// workFlow.setAuditText("");
|
||||
// workFlowVersion.setAuditStatus(1);
|
||||
// workFlowVersionMapper.updateByName(workFlowVersion);
|
||||
// log.info("全部通过审核");
|
||||
|
||||
//修改为合格
|
||||
workFlow.setAuditText("");
|
||||
|
@ -384,7 +361,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
ArrayList<String> strings = new ArrayList<>();
|
||||
String[] split = workFlow.getType().split(",");
|
||||
for (String s : split) {
|
||||
if (s.equals("")) {
|
||||
if (!s.equals("")) {
|
||||
strings.add(DictInit.getDictValue(DictConstants.WORK_FLOW_TYPE_CHILD, s));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mcwl.resource.mapper.ModelVersionMapper">
|
||||
|
||||
|
||||
<insert id="addModelVersion">
|
||||
<insert id="addModelVersion" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO model_version (
|
||||
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,
|
||||
|
@ -13,18 +11,37 @@
|
|||
is_exclusive_model, sample_image_paths, hide_image_gen_info, del_flag
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="modelVersionList" item="item" separator=",">
|
||||
(
|
||||
#{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},'0'
|
||||
#{modelId},#{versionName}, #{versionDescription},#{modelVersionType}, #{filePath},
|
||||
#{fileName},#{triggerWords},#{sampling}, #{high}, #{vae}, #{cfg},
|
||||
#{isFree}, #{isPublic}, #{isEncrypt}, #{isOnlineUse},
|
||||
#{allowDownloadImage}, #{allowSoftwareUse}, #{allowFusion},
|
||||
#{allowCommercialUse}, #{allowUsage}, #{isExclusiveModel},
|
||||
#{sampleImagePaths}, #{hideImageGenInfo},'0'
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- <insert id="addModelVersion" useGeneratedKeys="true" keyProperty="item.id">-->
|
||||
<!-- INSERT INTO model_version (-->
|
||||
<!-- 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, del_flag-->
|
||||
<!-- )-->
|
||||
<!-- VALUES-->
|
||||
<!-- <foreach collection="modelVersionList" item="item" separator=",">-->
|
||||
<!-- (-->
|
||||
<!-- #{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},'0'-->
|
||||
<!-- )-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </insert>-->
|
||||
|
||||
<update id="updateByName">
|
||||
update model_version set audit_status = #{auditStatus},
|
||||
audit_text = #{auditText}
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
<insert id="addWorkFlowVersion">
|
||||
INSERT INTO work_flow_version (version_name,version_description,file_path,image_paths,hide_gen_info,del_flag,
|
||||
audit_status,work_flow_id,file_name)
|
||||
work_flow_id,file_name)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.versionName}, #{item.versionDescription}, #{item.filePath}, #{item.imagePaths},#{item.hideGenInfo},
|
||||
0,#{item.auditStatus},#{workFlow.id},#{item.fileName})
|
||||
0,#{workFlow.id},#{item.fileName})
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateWorkFlowVersion">
|
||||
|
|
|
@ -39,7 +39,7 @@ public class DictInit implements ApplicationRunner {
|
|||
|
||||
// 查询所有字典数据 查询所有状态为启用的正常的,sql太简单就不写了
|
||||
List<SysDictData> allDicts = sysDictDataMapper.selectDictDataList(dictData);
|
||||
|
||||
log.info("获取到的字典值:{}",allDicts);
|
||||
|
||||
// 根据 dictType 分组
|
||||
Map<String, List<SysDictData>> groupedByType = allDicts.stream()
|
||||
|
|
|
@ -142,4 +142,6 @@ public interface SysUserMapper
|
|||
|
||||
List<SysUser> selectToUserPage(@Param("userId") Long userId);
|
||||
|
||||
void updateBackgroundImg(@Param("id") Long id, @Param("path") String path);
|
||||
|
||||
}
|
||||
|
|
|
@ -217,4 +217,6 @@ public interface ISysUserService
|
|||
AjaxResult updateIdCard(SysUser sysUser);
|
||||
|
||||
List<SysUser> listByIds(List<Long> userIdList);
|
||||
|
||||
void updateBackgroundImg(Long id, String path);
|
||||
}
|
||||
|
|
|
@ -659,6 +659,12 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
return userMapper.listByIds(userIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBackgroundImg(Long id, String path) {
|
||||
|
||||
userMapper.updateBackgroundImg(id,path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成随机密码
|
||||
|
|
|
@ -151,7 +151,7 @@
|
|||
</select>
|
||||
|
||||
<select id="selectUserInfoById" resultType="com.mcwl.common.core.domain.entity.SysUser">
|
||||
select user_id,avatar,brief,nick_name,name from sys_user where user_id = #{userId}
|
||||
select user_id,avatar,brief,nick_name,name,background_img from sys_user where user_id = #{userId}
|
||||
</select>
|
||||
<select id="selectByIdCard" resultType="com.mcwl.common.core.domain.entity.SysUser">
|
||||
select * from sys_user where id_card = #{idCard}
|
||||
|
@ -261,6 +261,12 @@
|
|||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateBackgroundImg">
|
||||
UPDATE sys_user
|
||||
SET background_img = #{path}
|
||||
WHERE user_id = #{id};
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserById" parameterType="Long">
|
||||
update sys_user set del_flag = '2' where user_id = #{userId}
|
||||
</delete>
|
||||
|
|
Loading…
Reference in New Issue