Compare commits

..

No commits in common. "a87d8c2295463fce94aee04f2a3ae94571711ea2" and "53fcee7adad8f6554648f833465291b15701955c" have entirely different histories.

17 changed files with 142 additions and 181 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,20 +116,22 @@ public class FileController {
/** /**
* *
* @param name
* @param type
* @return * @return
*/ */
@PostMapping("/selectFileName") @GetMapping("/selectFileName")
@ApiOperation(value = "根据文件名查找是否存在并返回秘钥") @ApiOperation(value = "根据文件名查找是否存在并返回秘钥")
public AjaxResult selectFileName(@RequestBody FileVo fileVo){ public AjaxResult selectFileName(@RequestParam String name,String type){
return fileService.selectFileName(fileVo.getName(), fileVo.getType()); return fileService.selectFileName(name,type);
} }
@PostMapping("/selectFile") @GetMapping("/selectFile")
@ApiOperation(value = "根据文件名查找是否存在") @ApiOperation(value = "根据文件名查找是否存在")
public AjaxResult selectFile(@RequestBody FileVo fileVo){ public AjaxResult selectFile(@RequestParam String name,String type){
return fileService.selectFile(fileVo.getName(), fileVo.getType()); return fileService.selectFile(name,type);
} }
@GetMapping("/download") @GetMapping("/download")
@ -292,4 +294,44 @@ 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,6 +2,7 @@ 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;
@ -117,21 +118,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,9 +2,11 @@ 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;
@ -99,21 +101,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/encryptAndUpload encryptUrl: http://113.45.190.154:9090/encrypt_and_upload
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,17 +1,15 @@
package com.mcwl.framework.interceptor; package com.mcwl.framework.interceptor;
import com.alibaba.fastjson2.JSON; import java.lang.reflect.Method;
import com.mcwl.common.annotation.RepeatSubmit; import javax.servlet.http.HttpServletRequest;
import com.mcwl.common.constant.HttpStatus; import javax.servlet.http.HttpServletResponse;
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 javax.servlet.http.HttpServletRequest; import com.mcwl.common.annotation.RepeatSubmit;
import javax.servlet.http.HttpServletResponse; import com.mcwl.common.core.domain.AjaxResult;
import java.lang.reflect.Method; import com.mcwl.common.utils.ServletUtils;
/** /**
* *
@ -33,7 +31,7 @@ public abstract class RepeatSubmitInterceptor implements HandlerInterceptor
{ {
if (this.isRepeatSubmit(request, annotation)) if (this.isRepeatSubmit(request, annotation))
{ {
AjaxResult ajaxResult = AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,annotation.message()); AjaxResult ajaxResult = AjaxResult.error(annotation.message());
ServletUtils.renderString(response, JSON.toJSONString(ajaxResult)); ServletUtils.renderString(response, JSON.toJSONString(ajaxResult));
return false; return false;
} }

View File

@ -198,14 +198,7 @@ public class ModelVersion extends BaseEntity {
*/ */
@ApiModelProperty(value = "是否收藏") @ApiModelProperty(value = "是否收藏")
@TableField(exist = false) @TableField(exist = false)
private Integer isCollect; private Integer isCollect = 0;
/**
*
*/
@ApiModelProperty(value = "是否下载")
@TableField(exist = false)
private Integer isDownload;
/** /**
* hash * hash
@ -213,10 +206,4 @@ 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,11 +47,6 @@ public class RequestFile {
/** /**
* *
*/ */
private String encryptionFileSize; private String encryptFileSize;
/**
*
*/
private String encryptionFileName;
} }

View File

@ -32,12 +32,6 @@ 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;
@ -59,6 +53,6 @@ public class ResponseCollect {
private Integer isDownload; private Integer isDownload;
@ApiModelProperty(value = "触发词") @ApiModelProperty(value = "触发词")
private String triggerWords; private String triggerWords = "-";
} }

View File

@ -1,28 +0,0 @@
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,6 +27,4 @@ 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,17 +78,9 @@ 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,9 +5,10 @@ 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.DownloadRecord; import com.mcwl.resource.domain.*;
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.*;
@ -58,43 +59,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.selectByEncryptionFileName(name); ModelVersion modelVersion = versionMapper.selectByFileName(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,9 +121,7 @@ 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()) .encryptionObjectKey(requestFile.getEncryptionObjectKey()).build();
.encryptionFileName(requestFile.getEncryptionFileName())
.encryptionFileSize(requestFile.getEncryptionFileSize()).build();
versionMapper.updateById(modelVersion); versionMapper.updateById(modelVersion);

View File

@ -27,7 +27,10 @@ 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.*; import com.mcwl.resource.mapper.ModelLikeMapper;
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;
@ -62,8 +65,6 @@ 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;
@ -130,9 +131,6 @@ 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);
@ -144,9 +142,6 @@ 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);
@ -278,7 +273,6 @@ 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,14 +100,9 @@ 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;
//校验是否收藏 //校验是否收藏
@ -139,11 +134,7 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
} }
if (modelVersion.getIsEncrypt() == 1){ if (modelVersion.getIsEncrypt() == 1){
if (StringUtils.isEmpty(modelVersion.getEncryptionFilePath())){ return R.ok(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,8 +26,7 @@
</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, 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.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,8 +58,5 @@
<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>