From dd678ba29a3631558ab0c0c90b5be73ae489324b Mon Sep 17 00:00:00 2001 From: yuxc <yuxc@vci-tech.com> Date: 星期二, 02 七月 2024 17:00:33 +0800 Subject: [PATCH] 升版本/次等功能上传 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java index 84b6487..55ac98a 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java @@ -1,5 +1,6 @@ package com.vci.web.service.impl; +import com.vci.corba.common.PLException; import com.vci.corba.volume.VolumeServicePrx; import com.vci.file.constant.VciFileDefaultValueConstant; import com.vci.file.constant.VciFileLangCodeConstant; @@ -145,8 +146,6 @@ */ @Override public BaseResult uploadFile(MultipartFile multipartFile, VciFileObjectDTO fileObjectDTO) throws VciBaseException { - VciBaseUtil.alertNotNull(fileObjectDTO.getFileDocClassify(), "鏂囨。绫诲瀷缂栧彿"); - String sourceFileName = multipartFile.getOriginalFilename(); String fileExtension = getFileExtension(sourceFileName); String fileNameNoExtension = getFileNameNoExtension(sourceFileName); @@ -206,9 +205,6 @@ if(vciFileObjectDO.getSecretGrade() == null) { vciFileObjectDO.setSecretGrade(DataSecretEnum.NONE.getValue()); } - //todo 鐧诲綍杩樻湭寮勫ソ闇�瑕佷慨鏀� - vciFileObjectDO.setCreator("1"); - vciFileObjectDO.setLastModifier("1"); revisionModelUtil.wrapperForAdd(vciFileObjectDO); //闅忔満璺緞 String randomPath = VciBaseUtil.getPk(); @@ -265,7 +261,7 @@ long currentTime = volumnCorbaService.getCurrrentTimeMillions(); in = multipartFile.getInputStream(); long fileSize = multipartFile.getSize(); - int blockSize = (int)webProperties.getBlockLength()*1024; + int blockSize = webProperties.getBlockLength()*1024; byte[] buffer = new byte[blockSize]; long temp =0L; for(temp = 0L; temp < fileSize - (long)blockSize; temp += (long)blockSize) { @@ -306,6 +302,18 @@ sourceFileObject.setFileSize(vciFileObjectDO.getFileSize()); vciFileObjectMapper.updateByPrimaryKey(sourceFileObject); //娌″姙娉曞垹闄や箣鍓嶇殑鏂囦欢锛� + + String volumeName = vciFileVolumeDO.getName(); + VolumeServicePrx volumnCorbaService = platformClientUtil.getVolumeService(volumeName); + if(volumnCorbaService == null){ + throw new VciBaseException("娌℃湁鑾峰彇鍒板嵎鏈嶅姟"); + } + try { + volumnCorbaService.deleteFile(sourceFileObject.getFilePath()); + } catch (PLException e) { + e.printStackTrace(); + System.out.println("鍒犻櫎浠撳簱涓殑鏂囦欢澶辫触锛�"+e.getMessage()); + } }else { vciFileObjectMapper.insert(vciFileObjectDO); } -- Gitblit v1.9.3