Compare commits

..

16 Commits

Author SHA1 Message Date
yang a87d8c2295 Merge branch 'feature/community-center' into preview 2025-03-27 11:38:29 +08:00
Diyu0904 619bc45f17 修改文件校验为POST请求 2025-03-24 09:22:42 +08:00
Diyu0904 502a10efe3 Merge branch 'feature/admin' into preview 2025-03-24 09:22:07 +08:00
Diyu0904 c9637b5ae6 模型广场新增下载
我的收藏列表新增参数
更改新增下载记录
2025-03-22 17:55:07 +08:00
Diyu0904 96141843ef 修改查询文件为POST请求 2025-03-22 15:36:29 +08:00
Diyu0904 500ff7f3d3 修改重复提交状态码为12202 2025-03-21 16:12:22 +08:00
Diyu0904 7fd5caec09 模型版本擦除敏感数据 2025-03-21 15:28:05 +08:00
Diyu0904 a9b0d8806c 更新根据名字查询秘钥接口 2025-03-21 14:41:43 +08:00
Diyu0904 156d3c18c2 修改加密接口路径 2025-03-21 14:32:00 +08:00
Diyu0904 9b675ab620 修改校验文件名字 2025-03-21 14:11:02 +08:00
Diyu0904 a3a0435850 更新文件解密查询名字 2025-03-21 14:06:44 +08:00
Diyu0904 0bfcbe9f0e Merge branch 'feature/admin' into preview 2025-03-21 13:54:55 +08:00
Diyu0904 37800e7f03 修改comfyui更细数据库字段名
新增加密后文件大小
新增触发词默认标志
2025-03-21 13:54:17 +08:00
Diyu0904 598c353014 Merge branch 'feature/admin' into preview 2025-03-21 09:28:47 +08:00
Diyu0904 e5e70950ae 模型新增加密后新名字 2025-03-21 09:27:42 +08:00
Diyu0904 9b4f92beed 删除修改时校验文件 2025-03-21 09:17:58 +08:00
17 changed files with 181 additions and 142 deletions

View File

@ -4,10 +4,10 @@ import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
import com.mcwl.common.utils.obs.ObsUtils; import com.mcwl.common.utils.obs.ObsUtils;
import com.mcwl.resource.domain.request.RequestFile; import com.mcwl.resource.domain.request.RequestFile;
import com.mcwl.resource.domain.vo.FileVo;
import com.mcwl.resource.service.impl.FileServiceImpl; import com.mcwl.resource.service.impl.FileServiceImpl;
import com.mcwl.web.controller.common.OssUtil; import com.mcwl.web.controller.common.OssUtil;
import com.obs.services.ObsClient; import com.obs.services.ObsClient;
import com.obs.services.exception.ObsException;
import com.obs.services.model.*; import com.obs.services.model.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -116,22 +116,20 @@ public class FileController {
/** /**
* *
* @param name
* @param type
* @return * @return
*/ */
@GetMapping("/selectFileName") @PostMapping("/selectFileName")
@ApiOperation(value = "根据文件名查找是否存在并返回秘钥") @ApiOperation(value = "根据文件名查找是否存在并返回秘钥")
public AjaxResult selectFileName(@RequestParam String name,String type){ public AjaxResult selectFileName(@RequestBody FileVo fileVo){
return fileService.selectFileName(name,type); return fileService.selectFileName(fileVo.getName(), fileVo.getType());
} }
@GetMapping("/selectFile") @PostMapping("/selectFile")
@ApiOperation(value = "根据文件名查找是否存在") @ApiOperation(value = "根据文件名查找是否存在")
public AjaxResult selectFile(@RequestParam String name,String type){ public AjaxResult selectFile(@RequestBody FileVo fileVo){
return fileService.selectFile(name,type); return fileService.selectFile(fileVo.getName(), fileVo.getType());
} }
@GetMapping("/download") @GetMapping("/download")
@ -294,44 +292,4 @@ public class FileController {
} }
@GetMapping("/test")
public R test(@RequestParam String filePath,String objectkey){
try {
UploadFileRequest request = new UploadFileRequest(bucketName, objectkey);
// 设置待上传的本地文件localfile为待上传的本地文件路径需要指定到具体带文件后缀的文件名
request.setUploadFile(filePath);
// 设置分段上传时的最大并发数
request.setTaskNum(5);
// 设置分段大小为10MB
request.setPartSize(10 * 1024 * 1024);
// 开启断点续传模式
request.setEnableCheckpoint(true);
// 进行断点续传上传
CompleteMultipartUploadResult result = obsClient.uploadFile(request);
log.info("上传完成:{}",result);
System.out.println("UploadFile successfully");
} catch (ObsException e) {
// 发生异常时可再次调用断点续传上传接口进行重新上传
System.out.println("UploadFile failed");
// 请求失败,打印http状态码
System.out.println("HTTP Code:" + e.getResponseCode());
// 请求失败,打印服务端错误码
System.out.println("Error Code:" + e.getErrorCode());
// 请求失败,打印详细错误信息
System.out.println("Error Message:" + e.getErrorMessage());
// 请求失败,打印请求id
System.out.println("Request ID:" + e.getErrorRequestId());
System.out.println("Host ID:" + e.getErrorHostId());
e.printStackTrace();
} catch (Exception e) {
System.out.println("UploadFile failed");
// 其他异常信息打印
e.printStackTrace();
}
return R.ok();
}
} }

View File

@ -2,7 +2,6 @@ package com.mcwl.web.controller.resource;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
@ -118,21 +117,21 @@ public class MallProductController extends BaseController {
public AjaxResult updateModel(@RequestBody RequestModel requestModel) { public AjaxResult updateModel(@RequestBody RequestModel requestModel) {
for (ModelVersion modelVersion : requestModel.getModelVersionList()) { // for (ModelVersion modelVersion : requestModel.getModelVersionList()) {
//
//校验名字 // //校验名字
ModelVersion modelVersion1 = modelVersionMapper.selectByFileName(modelVersion.getFileName()); // ModelVersion modelVersion1 = modelVersionMapper.selectByFileName(modelVersion.getFileName());
if (modelVersion1 != null) { // if (modelVersion1 != null) {
//
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件名字重复"); // return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件名字重复");
} // }
//校验hash // //校验hash
ModelVersion modelVersion2 = modelVersionMapper.selectByHash(modelVersion.getFileHash()); // ModelVersion modelVersion2 = modelVersionMapper.selectByHash(modelVersion.getFileHash());
if (modelVersion2 != null){ // if (modelVersion2 != null){
//
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件内容重复"); // return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件内容重复");
} // }
} // }
ModelProduct modelProduct = requestModel.getModelProduct(); ModelProduct modelProduct = requestModel.getModelProduct();

View File

@ -2,11 +2,9 @@ package com.mcwl.web.controller.resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
import com.mcwl.resource.domain.WorkFlow; import com.mcwl.resource.domain.WorkFlow;
import com.mcwl.resource.domain.WorkFlowVersion;
import com.mcwl.resource.domain.dto.AddRequestWorkFlow; import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
import com.mcwl.resource.domain.request.RequestWorkFlow; import com.mcwl.resource.domain.request.RequestWorkFlow;
import com.mcwl.resource.domain.response.ResponseWorkFlow; import com.mcwl.resource.domain.response.ResponseWorkFlow;
@ -101,21 +99,21 @@ public class WorkFlowController extends BaseController {
public R<Object> updateWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow) { public R<Object> updateWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow) {
for (WorkFlowVersion workFlowVersion : requestWorkFlow.getWorkFlowVersionList()) { // for (WorkFlowVersion workFlowVersion : requestWorkFlow.getWorkFlowVersionList()) {
//
//校验名字 // //校验名字
WorkFlowVersion workFlowVersion1 = workFlowVersionMapper.selectByFileName(workFlowVersion.getFileName()); // WorkFlowVersion workFlowVersion1 = workFlowVersionMapper.selectByFileName(workFlowVersion.getFileName());
if (workFlowVersion1 != null) { // if (workFlowVersion1 != null) {
//
return R.fail(HttpStatus.SHOW_ERROR_MSG,"文件名字重复"); // return R.fail(HttpStatus.SHOW_ERROR_MSG,"文件名字重复");
} // }
//校验hash // //校验hash
WorkFlowVersion workFlowVersion2 = workFlowVersionMapper.selectByHash(workFlowVersion.getFileHash()); // WorkFlowVersion workFlowVersion2 = workFlowVersionMapper.selectByHash(workFlowVersion.getFileHash());
if (workFlowVersion2 != null){ // if (workFlowVersion2 != null){
//
return R.fail(HttpStatus.SHOW_ERROR_MSG,"文件内容重复"); // return R.fail(HttpStatus.SHOW_ERROR_MSG,"文件内容重复");
} // }
} // }
workFlowService.updateWorkFlow(requestWorkFlow); workFlowService.updateWorkFlow(requestWorkFlow);

View File

@ -180,7 +180,7 @@ mqtt:
#用户头像与背景 #用户头像与背景
mcwl: mcwl:
encryptUrl: http://113.45.190.154:9090/encrypt_and_upload encryptUrl: http://113.45.190.154:9090/encryptAndUpload
user: user:
avatar: https://ybl2112.oss-cn-beijing.aliyuncs.com/2025/MARCH/10/7/53/3f5cc1d7-b062-4a22-9f7e-d442bc6dcf42.png avatar: https://ybl2112.oss-cn-beijing.aliyuncs.com/2025/MARCH/10/7/53/3f5cc1d7-b062-4a22-9f7e-d442bc6dcf42.png
backgroundImg: https://ybl2112.oss-cn-beijing.aliyuncs.com/2025/MARCH/10/8/2/c8387681-8138-4a29-a1c9-4a143da34c5a.png backgroundImg: https://ybl2112.oss-cn-beijing.aliyuncs.com/2025/MARCH/10/8/2/c8387681-8138-4a29-a1c9-4a143da34c5a.png

View File

@ -1,15 +1,17 @@
package com.mcwl.framework.interceptor; package com.mcwl.framework.interceptor;
import java.lang.reflect.Method; import com.alibaba.fastjson2.JSON;
import javax.servlet.http.HttpServletRequest; import com.mcwl.common.annotation.RepeatSubmit;
import javax.servlet.http.HttpServletResponse; import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.utils.ServletUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod; import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.HandlerInterceptor;
import com.alibaba.fastjson2.JSON;
import com.mcwl.common.annotation.RepeatSubmit; import javax.servlet.http.HttpServletRequest;
import com.mcwl.common.core.domain.AjaxResult; import javax.servlet.http.HttpServletResponse;
import com.mcwl.common.utils.ServletUtils; import java.lang.reflect.Method;
/** /**
* *
@ -31,7 +33,7 @@ public abstract class RepeatSubmitInterceptor implements HandlerInterceptor
{ {
if (this.isRepeatSubmit(request, annotation)) if (this.isRepeatSubmit(request, annotation))
{ {
AjaxResult ajaxResult = AjaxResult.error(annotation.message()); AjaxResult ajaxResult = AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,annotation.message());
ServletUtils.renderString(response, JSON.toJSONString(ajaxResult)); ServletUtils.renderString(response, JSON.toJSONString(ajaxResult));
return false; return false;
} }

View File

@ -198,7 +198,14 @@ public class ModelVersion extends BaseEntity {
*/ */
@ApiModelProperty(value = "是否收藏") @ApiModelProperty(value = "是否收藏")
@TableField(exist = false) @TableField(exist = false)
private Integer isCollect = 0; private Integer isCollect;
/**
*
*/
@ApiModelProperty(value = "是否下载")
@TableField(exist = false)
private Integer isDownload;
/** /**
* hash * hash
@ -206,4 +213,10 @@ public class ModelVersion extends BaseEntity {
@ApiModelProperty(value = "文件hash") @ApiModelProperty(value = "文件hash")
private String fileHash; private String fileHash;
@ApiModelProperty(value = "加密后文件新名字")
private String encryptionFileName;
@ApiModelProperty(value = "加密后文件大小")
private String encryptionFileSize;
} }

View File

@ -47,6 +47,11 @@ public class RequestFile {
/** /**
* *
*/ */
private String encryptFileSize; private String encryptionFileSize;
/**
*
*/
private String encryptionFileName;
} }

View File

@ -32,6 +32,12 @@ public class ResponseCollect {
@ApiModelProperty(value = "文件名") @ApiModelProperty(value = "文件名")
private String fileName; private String fileName;
@ApiModelProperty(value = "加密后文件名")
private String encryptionFileName;
@ApiModelProperty(value = "是否加密 0不加密 1加密")
private Integer isEncrypt;
@ApiModelProperty(value = "模型名") @ApiModelProperty(value = "模型名")
private String productName; private String productName;
@ -53,6 +59,6 @@ public class ResponseCollect {
private Integer isDownload; private Integer isDownload;
@ApiModelProperty(value = "触发词") @ApiModelProperty(value = "触发词")
private String triggerWords = "-"; private String triggerWords;
} }

View File

@ -0,0 +1,28 @@
package com.mcwl.resource.domain.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
*
* @author DaiZibo
* @date 2025/3/22
* @apiNote
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public class FileVo {
@ApiModelProperty("文件名字")
private String name;
@ApiModelProperty("文件类型 model/workflow")
private String type;
}

View File

@ -27,4 +27,6 @@ public interface ModelVersionMapper extends BaseMapper<ModelVersion> {
ModelVersion selectByProductId(@Param("id") Long id); ModelVersion selectByProductId(@Param("id") Long id);
ModelVersion selectByEncryptionFileName(@Param("name") String name);
} }

View File

@ -78,9 +78,17 @@ public class CollectServiceImpl implements CollectService {
//校验是否下载 //校验是否下载
for (ResponseCollect collect : responseCollectList) { for (ResponseCollect collect : responseCollectList) {
//校验是否加密
if (collect.getIsEncrypt() == 1){
collect.setFileName(collect.getEncryptionFileName());
}
collect.setIsDownload(downloadRecordService.selectDownloadByUser(userIdMax,collect.getId(),0)); collect.setIsDownload(downloadRecordService.selectDownloadByUser(userIdMax,collect.getId(),0));
//翻译类型 //翻译类型
collect.setType(DictInit.getDictValue(DictConstants.MODE_VERSION_TYPE,collect.getType())); collect.setType(DictInit.getDictValue(DictConstants.MODE_VERSION_TYPE,collect.getType()));
if (collect.getTriggerWords() == null){
collect.setTriggerWords("-");
}
} }
return R.ok(responseCollectList); return R.ok(responseCollectList);

View File

@ -5,10 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.common.constant.DictConstants; import com.mcwl.common.constant.DictConstants;
import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils; import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.*; import com.mcwl.resource.domain.DownloadRecord;
import com.mcwl.resource.domain.request.RequestDownload; import com.mcwl.resource.domain.request.RequestDownload;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.mapper.*; import com.mcwl.resource.mapper.*;
@ -59,43 +58,43 @@ public class DownloadRecordServiceImpl implements DownloadRecordService {
downloadRecord.setUserId(SecurityUtils.getUserId()); downloadRecord.setUserId(SecurityUtils.getUserId());
downloadRecord.setCreateTime(new Date()); downloadRecord.setCreateTime(new Date());
//获取作品信息 // //获取作品信息
if (downloadRecord.getProductType() == 0){ // if (downloadRecord.getProductType() == 0){
//
//查询文件/名称信息 // //查询文件/名称信息
ModelVersion modelVersion = modelVersionMapper.selectById(downloadRecord.getProductId()); // ModelVersion modelVersion = modelVersionMapper.selectById(downloadRecord.getProductId());
downloadRecord.setFileName(modelVersion.getFileName()); // downloadRecord.setFileName(modelVersion.getFileName());
downloadRecord.setFileSize(modelVersion.getFileSize()); // downloadRecord.setFileSize(modelVersion.getFileSize());
downloadRecord.setModelVersionType(modelVersion.getModelVersionType()+""); // downloadRecord.setModelVersionType(modelVersion.getModelVersionType()+"");
//
//根据版本查找封面信息 // //根据版本查找封面信息
ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId()); // ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId());
downloadRecord.setCover(modelProduct.getSurfaceUrl()); // downloadRecord.setCover(modelProduct.getSurfaceUrl());
downloadRecord.setProductName(modelProduct.getModelName()); // downloadRecord.setProductName(modelProduct.getModelName());
//
//查询作者信息 // //查询作者信息
SysUser sysUser = sysUserMapper.selectUserById(modelProduct.getUserId()); // SysUser sysUser = sysUserMapper.selectUserById(modelProduct.getUserId());
downloadRecord.setAuthorName(sysUser.getNickName()); // downloadRecord.setAuthorName(sysUser.getNickName());
//
}else { // }else {
//
//查询文件/名称信息 // //查询文件/名称信息
WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectById(downloadRecord.getProductId()); // WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectById(downloadRecord.getProductId());
downloadRecord.setFileName(workFlowVersion.getFileName()); // downloadRecord.setFileName(workFlowVersion.getFileName());
downloadRecord.setFileSize(workFlowVersion.getFileSize()); // downloadRecord.setFileSize(workFlowVersion.getFileSize());
//
//
//根据版本查找封面信息 // //根据版本查找封面信息
WorkFlow workFlow = workFlowMapper.selectById(workFlowVersion.getWorkFlowId()); // WorkFlow workFlow = workFlowMapper.selectById(workFlowVersion.getWorkFlowId());
downloadRecord.setCover(workFlow.getCoverPath()); // downloadRecord.setCover(workFlow.getCoverPath());
downloadRecord.setProductName(workFlow.getWorkflowName()); // downloadRecord.setProductName(workFlow.getWorkflowName());
//
//
//查询作者信息 // //查询作者信息
SysUser sysUser = sysUserMapper.selectUserById(workFlow.getUserId()); // SysUser sysUser = sysUserMapper.selectUserById(workFlow.getUserId());
downloadRecord.setAuthorName(sysUser.getNickName()); // downloadRecord.setAuthorName(sysUser.getNickName());
//
} // }
downloadRecordMapper.insert(downloadRecord); downloadRecordMapper.insert(downloadRecord);

View File

@ -38,14 +38,14 @@ public class FileServiceImpl implements FileService {
if (type.equals("model")) { if (type.equals("model")) {
ModelVersion modelVersion = versionMapper.selectByFileName(name); ModelVersion modelVersion = versionMapper.selectByEncryptionFileName(name);
if (modelVersion == null) { if (modelVersion == null) {
return AjaxResult.error("文件不存在"); return AjaxResult.error("文件不存在");
} }
return AjaxResult.success(modelVersion); return AjaxResult.success(modelVersion);
}else if (type.equals("workflow")){ } else if (type.equals("workflow")){
WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectByFileName(name); WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectByFileName(name);
if (workFlowVersion == null) { if (workFlowVersion == null) {
@ -121,7 +121,9 @@ public class FileServiceImpl implements FileService {
ModelVersion modelVersion = ModelVersion.builder().id(requestFile.getId()) ModelVersion modelVersion = ModelVersion.builder().id(requestFile.getId())
.keyRate(requestFile.getKeyRate()) .keyRate(requestFile.getKeyRate())
.encryptionFilePath(requestFile.getEncryptionFilePath()) .encryptionFilePath(requestFile.getEncryptionFilePath())
.encryptionObjectKey(requestFile.getEncryptionObjectKey()).build(); .encryptionObjectKey(requestFile.getEncryptionObjectKey())
.encryptionFileName(requestFile.getEncryptionFileName())
.encryptionFileSize(requestFile.getEncryptionFileSize()).build();
versionMapper.updateById(modelVersion); versionMapper.updateById(modelVersion);

View File

@ -27,10 +27,7 @@ import com.mcwl.resource.domain.response.ResponseModelProduct;
import com.mcwl.resource.domain.vo.MallProductVo; import com.mcwl.resource.domain.vo.MallProductVo;
import com.mcwl.resource.domain.vo.ModelVo; import com.mcwl.resource.domain.vo.ModelVo;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.mapper.ModelLikeMapper; import com.mcwl.resource.mapper.*;
import com.mcwl.resource.mapper.ModelMapper;
import com.mcwl.resource.mapper.ModelVersionMapper;
import com.mcwl.resource.mapper.SysUserAttentionMapper;
import com.mcwl.resource.service.ModelService; import com.mcwl.resource.service.ModelService;
import com.mcwl.resource.service.ToActivityService; import com.mcwl.resource.service.ToActivityService;
import com.mcwl.system.init.DictInit; import com.mcwl.system.init.DictInit;
@ -65,6 +62,8 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
@Autowired @Autowired
private ISysUserService sysUserService; private ISysUserService sysUserService;
@Autowired
private DownloadRecordServiceImpl downloadRecordService;
@Autowired @Autowired
private ThreadPoolTaskExecutor threadPoolTaskExecutor; private ThreadPoolTaskExecutor threadPoolTaskExecutor;
@ -131,6 +130,9 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
if (userIdMax == 0){ if (userIdMax == 0){
//收藏为空 //收藏为空
modelVersion.setIsCollect(0); modelVersion.setIsCollect(0);
//下载为空
modelVersion.setIsDownload(0);
}else { }else {
//查询是否收藏 //查询是否收藏
Collect collect = collectService.selectCollectById(modelVersion.getId(), userIdMax, 0); Collect collect = collectService.selectCollectById(modelVersion.getId(), userIdMax, 0);
@ -142,6 +144,9 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
modelVersion.setIsCollect(1); modelVersion.setIsCollect(1);
} }
//校验是否下载
modelVersion.setIsDownload(downloadRecordService.selectDownloadByUser(userIdMax,modelVersion.getModelId(),0));
} }
responseModelProduct.setModelVersion(modelVersion); responseModelProduct.setModelVersion(modelVersion);
@ -273,6 +278,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
//校验是否实名 //校验是否实名
SysUser sysUser = sysUserService.selectUserInfoById(SecurityUtils.getUserId()); SysUser sysUser = sysUserService.selectUserInfoById(SecurityUtils.getUserId());
log.info("查询到的个人数据:{}",sysUser);
if (StringUtils.isEmpty(sysUser.getName())){ if (StringUtils.isEmpty(sysUser.getName())){
return R.fail(HttpStatus.SHOW_ERROR_MSG,"实名制后才可以发布"); return R.fail(HttpStatus.SHOW_ERROR_MSG,"实名制后才可以发布");

View File

@ -100,9 +100,14 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
Long userIdMax = SecurityUtils.getUserIdMax(); Long userIdMax = SecurityUtils.getUserIdMax();
if (userIdMax != 0){ if (userIdMax != 0){
//擦掉敏感数据
for (ModelVersion modelVersion : modelVersions) { for (ModelVersion modelVersion : modelVersions) {
modelVersion.setObjectKey("");
modelVersion.setEncryptionObjectKey("");
modelVersion.setFilePath(""); modelVersion.setFilePath("");
modelVersion.setEncryptionFilePath(""); modelVersion.setEncryptionFilePath("");
modelVersion.setKeyRate("");
//模型字典 0 工作流字典 1 //模型字典 0 工作流字典 1
Integer type = 0; Integer type = 0;
//校验是否收藏 //校验是否收藏
@ -134,7 +139,11 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
} }
if (modelVersion.getIsEncrypt() == 1){ if (modelVersion.getIsEncrypt() == 1){
return R.ok(modelVersion.getEncryptionFilePath()); if (StringUtils.isEmpty(modelVersion.getEncryptionFilePath())){
return R.fail(HttpStatus.SHOW_ERROR_MSG,"该模型加密未完成,请稍后再试");
}
return R.ok(modelVersion.getEncryptionFilePath(),modelVersion.getEncryptionFileName());
} }
return R.ok(modelVersion.getFilePath(),modelVersion.getFileName()); return R.ok(modelVersion.getFilePath(),modelVersion.getFileName());
} }

View File

@ -26,7 +26,8 @@
</select> </select>
<select id="selectCollectModel" resultType="com.mcwl.resource.domain.response.ResponseCollect"> <select id="selectCollectModel" resultType="com.mcwl.resource.domain.response.ResponseCollect">
SELECT c.product_id as id,m.surface_url as file_path,v.file_name,m.model_name as product_name,u.nick_name,v.file_size,c.create_time,v.model_version_type as type,v.trigger_words SELECT c.product_id as id,m.surface_url as file_path,v.file_name,m.model_name as product_name,u.nick_name,
v.file_size,c.create_time,v.model_version_type as type,v.trigger_words,v.is_encrypt,v.encryption_file_name
FROM collect as c FROM collect as c
LEFT JOIN model_version as v on c.product_id = v.id LEFT JOIN model_version as v on c.product_id = v.id
LEFT JOIN model as m on v.model_id = m.id LEFT JOIN model as m on v.model_id = m.id

View File

@ -58,5 +58,8 @@
<select id="selectByProductId" resultType="com.mcwl.resource.domain.ModelVersion"> <select id="selectByProductId" resultType="com.mcwl.resource.domain.ModelVersion">
SELECT * FROM model_version WHERE model_id = #{id} LIMIT 1 SELECT * FROM model_version WHERE model_id = #{id} LIMIT 1
</select> </select>
<select id="selectByEncryptionFileName" resultType="com.mcwl.resource.domain.ModelVersion">
select key_rate,is_encrypt from model_version where encryption_file_name = #{name}
</select>
</mapper> </mapper>