新增修改工作流/模型文件校验
parent
ed9cad897f
commit
5726a63ec7
|
@ -2,20 +2,20 @@ 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;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
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.PageVo;
|
||||
import com.mcwl.resource.mapper.ModelVersionMapper;
|
||||
import com.mcwl.resource.service.*;
|
||||
import com.mcwl.resource.service.ModelService;
|
||||
import com.mcwl.system.service.impl.SysUserServiceImpl;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -95,6 +95,24 @@ public class MallProductController extends BaseController {
|
|||
@ApiOperation(value = "修改模型")
|
||||
@PostMapping("/update")
|
||||
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,"文件内容重复");
|
||||
}
|
||||
}
|
||||
|
||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
|
|
@ -2,13 +2,16 @@ 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;
|
||||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
import com.mcwl.resource.mapper.WorkFlowVersionMapper;
|
||||
import com.mcwl.resource.service.WorkFlowService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -40,6 +43,9 @@ public class WorkFlowController extends BaseController {
|
|||
@Autowired
|
||||
private WorkFlowService workFlowService;
|
||||
|
||||
@Autowired
|
||||
private WorkFlowVersionMapper workFlowVersionMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 设置工作流的置顶状态
|
||||
|
@ -94,6 +100,23 @@ public class WorkFlowController extends BaseController {
|
|||
@PostMapping("/updateWorkFlow")
|
||||
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,"文件内容重复");
|
||||
}
|
||||
}
|
||||
|
||||
workFlowService.updateWorkFlow(requestWorkFlow);
|
||||
|
||||
return R.ok();
|
||||
|
|
Loading…
Reference in New Issue