Compare commits
16 Commits
53fcee7ada
...
a87d8c2295
Author | SHA1 | Date |
---|---|---|
|
a87d8c2295 | |
|
619bc45f17 | |
|
502a10efe3 | |
|
c9637b5ae6 | |
|
96141843ef | |
|
500ff7f3d3 | |
|
7fd5caec09 | |
|
a9b0d8806c | |
|
156d3c18c2 | |
|
9b675ab620 | |
|
a3a0435850 | |
|
0bfcbe9f0e | |
|
37800e7f03 | |
|
598c353014 | |
|
e5e70950ae | |
|
9b4f92beed |
|
@ -4,10 +4,10 @@ import com.mcwl.common.core.domain.AjaxResult;
|
|||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.obs.ObsUtils;
|
||||
import com.mcwl.resource.domain.request.RequestFile;
|
||||
import com.mcwl.resource.domain.vo.FileVo;
|
||||
import com.mcwl.resource.service.impl.FileServiceImpl;
|
||||
import com.mcwl.web.controller.common.OssUtil;
|
||||
import com.obs.services.ObsClient;
|
||||
import com.obs.services.exception.ObsException;
|
||||
import com.obs.services.model.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -116,22 +116,20 @@ public class FileController {
|
|||
|
||||
/**
|
||||
* 根据文件名查找是否存在
|
||||
* @param name
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectFileName")
|
||||
@PostMapping("/selectFileName")
|
||||
@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 = "根据文件名查找是否存在")
|
||||
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")
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.mcwl.web.controller.resource;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
|
@ -118,21 +117,21 @@ public class MallProductController extends BaseController {
|
|||
public AjaxResult updateModel(@RequestBody RequestModel requestModel) {
|
||||
|
||||
|
||||
for (ModelVersion modelVersion : requestModel.getModelVersionList()) {
|
||||
|
||||
//校验名字
|
||||
ModelVersion modelVersion1 = modelVersionMapper.selectByFileName(modelVersion.getFileName());
|
||||
if (modelVersion1 != null) {
|
||||
|
||||
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件名字重复");
|
||||
}
|
||||
//校验hash
|
||||
ModelVersion modelVersion2 = modelVersionMapper.selectByHash(modelVersion.getFileHash());
|
||||
if (modelVersion2 != null){
|
||||
|
||||
return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件内容重复");
|
||||
}
|
||||
}
|
||||
// for (ModelVersion modelVersion : requestModel.getModelVersionList()) {
|
||||
//
|
||||
// //校验名字
|
||||
// ModelVersion modelVersion1 = modelVersionMapper.selectByFileName(modelVersion.getFileName());
|
||||
// if (modelVersion1 != null) {
|
||||
//
|
||||
// return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件名字重复");
|
||||
// }
|
||||
// //校验hash
|
||||
// ModelVersion modelVersion2 = modelVersionMapper.selectByHash(modelVersion.getFileHash());
|
||||
// if (modelVersion2 != null){
|
||||
//
|
||||
// return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件内容重复");
|
||||
// }
|
||||
// }
|
||||
|
||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||
|
||||
|
|
|
@ -2,11 +2,9 @@ package com.mcwl.web.controller.resource;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.WorkFlow;
|
||||
import com.mcwl.resource.domain.WorkFlowVersion;
|
||||
import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
|
||||
import com.mcwl.resource.domain.request.RequestWorkFlow;
|
||||
import com.mcwl.resource.domain.response.ResponseWorkFlow;
|
||||
|
@ -101,21 +99,21 @@ public class WorkFlowController extends BaseController {
|
|||
public R<Object> updateWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow) {
|
||||
|
||||
|
||||
for (WorkFlowVersion workFlowVersion : requestWorkFlow.getWorkFlowVersionList()) {
|
||||
|
||||
//校验名字
|
||||
WorkFlowVersion workFlowVersion1 = workFlowVersionMapper.selectByFileName(workFlowVersion.getFileName());
|
||||
if (workFlowVersion1 != null) {
|
||||
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"文件名字重复");
|
||||
}
|
||||
//校验hash
|
||||
WorkFlowVersion workFlowVersion2 = workFlowVersionMapper.selectByHash(workFlowVersion.getFileHash());
|
||||
if (workFlowVersion2 != null){
|
||||
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"文件内容重复");
|
||||
}
|
||||
}
|
||||
// for (WorkFlowVersion workFlowVersion : requestWorkFlow.getWorkFlowVersionList()) {
|
||||
//
|
||||
// //校验名字
|
||||
// WorkFlowVersion workFlowVersion1 = workFlowVersionMapper.selectByFileName(workFlowVersion.getFileName());
|
||||
// if (workFlowVersion1 != null) {
|
||||
//
|
||||
// return R.fail(HttpStatus.SHOW_ERROR_MSG,"文件名字重复");
|
||||
// }
|
||||
// //校验hash
|
||||
// WorkFlowVersion workFlowVersion2 = workFlowVersionMapper.selectByHash(workFlowVersion.getFileHash());
|
||||
// if (workFlowVersion2 != null){
|
||||
//
|
||||
// return R.fail(HttpStatus.SHOW_ERROR_MSG,"文件内容重复");
|
||||
// }
|
||||
// }
|
||||
|
||||
workFlowService.updateWorkFlow(requestWorkFlow);
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ mqtt:
|
|||
|
||||
#用户头像与背景
|
||||
mcwl:
|
||||
encryptUrl: http://113.45.190.154:9090/encrypt_and_upload
|
||||
encryptUrl: http://113.45.190.154:9090/encryptAndUpload
|
||||
user:
|
||||
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
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package com.mcwl.framework.interceptor;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.mcwl.common.annotation.RepeatSubmit;
|
||||
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.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.mcwl.common.annotation.RepeatSubmit;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.utils.ServletUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* 防止重复提交拦截器
|
||||
|
@ -31,7 +33,7 @@ public abstract class RepeatSubmitInterceptor implements HandlerInterceptor
|
|||
{
|
||||
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));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -198,7 +198,14 @@ public class ModelVersion extends BaseEntity {
|
|||
*/
|
||||
@ApiModelProperty(value = "是否收藏")
|
||||
@TableField(exist = false)
|
||||
private Integer isCollect = 0;
|
||||
private Integer isCollect;
|
||||
|
||||
/**
|
||||
* 是否下载
|
||||
*/
|
||||
@ApiModelProperty(value = "是否下载")
|
||||
@TableField(exist = false)
|
||||
private Integer isDownload;
|
||||
|
||||
/**
|
||||
* 文件hash
|
||||
|
@ -206,4 +213,10 @@ public class ModelVersion extends BaseEntity {
|
|||
@ApiModelProperty(value = "文件hash")
|
||||
private String fileHash;
|
||||
|
||||
@ApiModelProperty(value = "加密后文件新名字")
|
||||
private String encryptionFileName;
|
||||
|
||||
@ApiModelProperty(value = "加密后文件大小")
|
||||
private String encryptionFileSize;
|
||||
|
||||
}
|
||||
|
|
|
@ -47,6 +47,11 @@ public class RequestFile {
|
|||
/**
|
||||
* 加密后文件大小
|
||||
*/
|
||||
private String encryptFileSize;
|
||||
private String encryptionFileSize;
|
||||
|
||||
/**
|
||||
* 加密后新文件名字
|
||||
*/
|
||||
private String encryptionFileName;
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,12 @@ public class ResponseCollect {
|
|||
@ApiModelProperty(value = "文件名")
|
||||
private String fileName;
|
||||
|
||||
@ApiModelProperty(value = "加密后文件名")
|
||||
private String encryptionFileName;
|
||||
|
||||
@ApiModelProperty(value = "是否加密 0不加密 1加密")
|
||||
private Integer isEncrypt;
|
||||
|
||||
@ApiModelProperty(value = "模型名")
|
||||
private String productName;
|
||||
|
||||
|
@ -53,6 +59,6 @@ public class ResponseCollect {
|
|||
private Integer isDownload;
|
||||
|
||||
@ApiModelProperty(value = "触发词")
|
||||
private String triggerWords = "-";
|
||||
private String triggerWords;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
|
@ -27,4 +27,6 @@ public interface ModelVersionMapper extends BaseMapper<ModelVersion> {
|
|||
|
||||
ModelVersion selectByProductId(@Param("id") Long id);
|
||||
|
||||
ModelVersion selectByEncryptionFileName(@Param("name") String name);
|
||||
|
||||
}
|
||||
|
|
|
@ -78,9 +78,17 @@ public class CollectServiceImpl implements CollectService {
|
|||
//校验是否下载
|
||||
for (ResponseCollect collect : responseCollectList) {
|
||||
|
||||
//校验是否加密
|
||||
if (collect.getIsEncrypt() == 1){
|
||||
collect.setFileName(collect.getEncryptionFileName());
|
||||
}
|
||||
|
||||
collect.setIsDownload(downloadRecordService.selectDownloadByUser(userIdMax,collect.getId(),0));
|
||||
//翻译类型
|
||||
collect.setType(DictInit.getDictValue(DictConstants.MODE_VERSION_TYPE,collect.getType()));
|
||||
if (collect.getTriggerWords() == null){
|
||||
collect.setTriggerWords("-");
|
||||
}
|
||||
}
|
||||
|
||||
return R.ok(responseCollectList);
|
||||
|
|
|
@ -5,10 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.mcwl.common.constant.DictConstants;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
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.StringUtils;
|
||||
import com.mcwl.resource.domain.*;
|
||||
import com.mcwl.resource.domain.DownloadRecord;
|
||||
import com.mcwl.resource.domain.request.RequestDownload;
|
||||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
import com.mcwl.resource.mapper.*;
|
||||
|
@ -59,43 +58,43 @@ public class DownloadRecordServiceImpl implements DownloadRecordService {
|
|||
downloadRecord.setUserId(SecurityUtils.getUserId());
|
||||
downloadRecord.setCreateTime(new Date());
|
||||
|
||||
//获取作品信息
|
||||
if (downloadRecord.getProductType() == 0){
|
||||
|
||||
//查询文件/名称信息
|
||||
ModelVersion modelVersion = modelVersionMapper.selectById(downloadRecord.getProductId());
|
||||
downloadRecord.setFileName(modelVersion.getFileName());
|
||||
downloadRecord.setFileSize(modelVersion.getFileSize());
|
||||
downloadRecord.setModelVersionType(modelVersion.getModelVersionType()+"");
|
||||
|
||||
//根据版本查找封面信息
|
||||
ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId());
|
||||
downloadRecord.setCover(modelProduct.getSurfaceUrl());
|
||||
downloadRecord.setProductName(modelProduct.getModelName());
|
||||
|
||||
//查询作者信息
|
||||
SysUser sysUser = sysUserMapper.selectUserById(modelProduct.getUserId());
|
||||
downloadRecord.setAuthorName(sysUser.getNickName());
|
||||
|
||||
}else {
|
||||
|
||||
//查询文件/名称信息
|
||||
WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectById(downloadRecord.getProductId());
|
||||
downloadRecord.setFileName(workFlowVersion.getFileName());
|
||||
downloadRecord.setFileSize(workFlowVersion.getFileSize());
|
||||
|
||||
|
||||
//根据版本查找封面信息
|
||||
WorkFlow workFlow = workFlowMapper.selectById(workFlowVersion.getWorkFlowId());
|
||||
downloadRecord.setCover(workFlow.getCoverPath());
|
||||
downloadRecord.setProductName(workFlow.getWorkflowName());
|
||||
|
||||
|
||||
//查询作者信息
|
||||
SysUser sysUser = sysUserMapper.selectUserById(workFlow.getUserId());
|
||||
downloadRecord.setAuthorName(sysUser.getNickName());
|
||||
|
||||
}
|
||||
// //获取作品信息
|
||||
// if (downloadRecord.getProductType() == 0){
|
||||
//
|
||||
// //查询文件/名称信息
|
||||
// ModelVersion modelVersion = modelVersionMapper.selectById(downloadRecord.getProductId());
|
||||
// downloadRecord.setFileName(modelVersion.getFileName());
|
||||
// downloadRecord.setFileSize(modelVersion.getFileSize());
|
||||
// downloadRecord.setModelVersionType(modelVersion.getModelVersionType()+"");
|
||||
//
|
||||
// //根据版本查找封面信息
|
||||
// ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId());
|
||||
// downloadRecord.setCover(modelProduct.getSurfaceUrl());
|
||||
// downloadRecord.setProductName(modelProduct.getModelName());
|
||||
//
|
||||
// //查询作者信息
|
||||
// SysUser sysUser = sysUserMapper.selectUserById(modelProduct.getUserId());
|
||||
// downloadRecord.setAuthorName(sysUser.getNickName());
|
||||
//
|
||||
// }else {
|
||||
//
|
||||
// //查询文件/名称信息
|
||||
// WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectById(downloadRecord.getProductId());
|
||||
// downloadRecord.setFileName(workFlowVersion.getFileName());
|
||||
// downloadRecord.setFileSize(workFlowVersion.getFileSize());
|
||||
//
|
||||
//
|
||||
// //根据版本查找封面信息
|
||||
// WorkFlow workFlow = workFlowMapper.selectById(workFlowVersion.getWorkFlowId());
|
||||
// downloadRecord.setCover(workFlow.getCoverPath());
|
||||
// downloadRecord.setProductName(workFlow.getWorkflowName());
|
||||
//
|
||||
//
|
||||
// //查询作者信息
|
||||
// SysUser sysUser = sysUserMapper.selectUserById(workFlow.getUserId());
|
||||
// downloadRecord.setAuthorName(sysUser.getNickName());
|
||||
//
|
||||
// }
|
||||
|
||||
downloadRecordMapper.insert(downloadRecord);
|
||||
|
||||
|
|
|
@ -38,14 +38,14 @@ public class FileServiceImpl implements FileService {
|
|||
|
||||
if (type.equals("model")) {
|
||||
|
||||
ModelVersion modelVersion = versionMapper.selectByFileName(name);
|
||||
ModelVersion modelVersion = versionMapper.selectByEncryptionFileName(name);
|
||||
if (modelVersion == null) {
|
||||
|
||||
return AjaxResult.error("文件不存在");
|
||||
}
|
||||
|
||||
return AjaxResult.success(modelVersion);
|
||||
}else if (type.equals("workflow")){
|
||||
} else if (type.equals("workflow")){
|
||||
WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectByFileName(name);
|
||||
if (workFlowVersion == null) {
|
||||
|
||||
|
@ -121,7 +121,9 @@ public class FileServiceImpl implements FileService {
|
|||
ModelVersion modelVersion = ModelVersion.builder().id(requestFile.getId())
|
||||
.keyRate(requestFile.getKeyRate())
|
||||
.encryptionFilePath(requestFile.getEncryptionFilePath())
|
||||
.encryptionObjectKey(requestFile.getEncryptionObjectKey()).build();
|
||||
.encryptionObjectKey(requestFile.getEncryptionObjectKey())
|
||||
.encryptionFileName(requestFile.getEncryptionFileName())
|
||||
.encryptionFileSize(requestFile.getEncryptionFileSize()).build();
|
||||
|
||||
versionMapper.updateById(modelVersion);
|
||||
|
||||
|
|
|
@ -27,10 +27,7 @@ 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;
|
||||
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.mapper.*;
|
||||
import com.mcwl.resource.service.ModelService;
|
||||
import com.mcwl.resource.service.ToActivityService;
|
||||
import com.mcwl.system.init.DictInit;
|
||||
|
@ -65,6 +62,8 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private DownloadRecordServiceImpl downloadRecordService;
|
||||
|
||||
@Autowired
|
||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||
|
@ -131,6 +130,9 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
if (userIdMax == 0){
|
||||
//收藏为空
|
||||
modelVersion.setIsCollect(0);
|
||||
|
||||
//下载为空
|
||||
modelVersion.setIsDownload(0);
|
||||
}else {
|
||||
//查询是否收藏
|
||||
Collect collect = collectService.selectCollectById(modelVersion.getId(), userIdMax, 0);
|
||||
|
@ -142,6 +144,9 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
modelVersion.setIsCollect(1);
|
||||
}
|
||||
|
||||
//校验是否下载
|
||||
modelVersion.setIsDownload(downloadRecordService.selectDownloadByUser(userIdMax,modelVersion.getModelId(),0));
|
||||
|
||||
}
|
||||
|
||||
responseModelProduct.setModelVersion(modelVersion);
|
||||
|
@ -273,6 +278,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
|
||||
//校验是否实名
|
||||
SysUser sysUser = sysUserService.selectUserInfoById(SecurityUtils.getUserId());
|
||||
log.info("查询到的个人数据:{}",sysUser);
|
||||
if (StringUtils.isEmpty(sysUser.getName())){
|
||||
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"实名制后才可以发布");
|
||||
|
|
|
@ -100,9 +100,14 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
|
|||
Long userIdMax = SecurityUtils.getUserIdMax();
|
||||
if (userIdMax != 0){
|
||||
|
||||
//擦掉敏感数据
|
||||
for (ModelVersion modelVersion : modelVersions) {
|
||||
modelVersion.setObjectKey("");
|
||||
modelVersion.setEncryptionObjectKey("");
|
||||
modelVersion.setFilePath("");
|
||||
modelVersion.setEncryptionFilePath("");
|
||||
modelVersion.setKeyRate("");
|
||||
|
||||
//模型字典 0 工作流字典 1
|
||||
Integer type = 0;
|
||||
//校验是否收藏
|
||||
|
@ -134,7 +139,11 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
|
|||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
</select>
|
||||
|
||||
<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
|
||||
LEFT JOIN model_version as v on c.product_id = v.id
|
||||
LEFT JOIN model as m on v.model_id = m.id
|
||||
|
|
|
@ -58,5 +58,8 @@
|
|||
<select id="selectByProductId" resultType="com.mcwl.resource.domain.ModelVersion">
|
||||
SELECT * FROM model_version WHERE model_id = #{id} LIMIT 1
|
||||
</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>
|
||||
|
|
Loading…
Reference in New Issue