| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.corba.common.VCIError; |
| | | import com.vci.corba.framework.data.PvolumeInfo; |
| | | import com.vci.corba.volumn.method.VolumnManagement; |
| | | import com.vci.corba.volume.VolumeServicePrx; |
| | | import com.vci.file.constant.VciFileDefaultValueConstant; |
| | | import com.vci.file.constant.VciFileLangCodeConstant; |
| | | import com.vci.file.dto.VciFileObjectDTO; |
| | |
| | | import com.vci.web.service.WebBoServiceI; |
| | | import com.vci.web.service.WebSecretServiceI; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import plm.bs.bom.clientobject.ClientBusinessObject; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.*; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.RandomAccessFile; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | |
| | | if(vciFileObjectDO.getSecretGrade() == null) { |
| | | vciFileObjectDO.setSecretGrade(DataSecretEnum.NONE.getValue()); |
| | | } |
| | | revisionModelUtil.wrapperForAdd(vciFileObjectDO); |
| | | //todo 先写固定 |
| | | vciFileObjectDO.setCreator("admin"); |
| | | vciFileObjectDO.setLastModifier("admin"); |
| | | // revisionModelUtil.wrapperForAdd(vciFileObjectDO); |
| | | //随机路径 |
| | | String randomPath = VciBaseUtil.getPk(); |
| | | // String randomPath = VciBaseUtil.getPk(); |
| | | String randomPath = "rrt"; |
| | | //目标文件 |
| | | String targetFileName = vciFileObjectDO.getOid(); |
| | | // String targetFileName = vciFileObjectDO.getOid(); |
| | | String targetFileName = VciBaseUtil.getPk(); |
| | | |
| | | String filePath = randomPath+File.separator+targetFileName; |
| | | |
| | |
| | | } |
| | | }else if(VciFileTransProtocolEnum.CORBA.getValue().equalsIgnoreCase(vciFileVolumeDO.getTransProtocol())){ |
| | | String volumeName = vciFileVolumeDO.getName(); |
| | | VolumnManagement volumnCorbaService = null; |
| | | try { |
| | | volumnCorbaService = platformClientUtil.getVolumeService(vciFileVolumeDO.getServiceUrl(),volumeName).getVolumnService(); |
| | | } catch (VCIError vciError) { |
| | | throw new VciBaseException("没有获取到{}的卷服务",new String[]{volumeName},vciError); |
| | | VolumeServicePrx volumnCorbaService = platformClientUtil.getVolumeService(volumeName); |
| | | if(volumnCorbaService == null){ |
| | | throw new VciBaseException("没有获取到卷服务"); |
| | | } |
| | | InputStream in = null; |
| | | if("filePathField".equalsIgnoreCase(vciFileObjectDO.getFileDocClassify())){ |
| | |
| | | volumnCorbaService.receiveFile(vciFileObjectDO.getFilePath(), buffer, temp, currentTime, fileSize); |
| | | }catch(IOException e){ |
| | | throw new VciBaseException("读取文件[" + vciFileObjectDO.getName() + "]出现了错误," + e.getMessage() ,new String[0],e); |
| | | }catch (VCIError e){ |
| | | throw new VciBaseException("传输文件[" + vciFileObjectDO.getName() + "]出现了错误," + e.getMessage() ,new String[0],e); |
| | | }catch(Exception e){ |
| | | throw new VciBaseException("处理上传文件[" + vciFileObjectDO.getName() + "]出现了错误," + e.getMessage() ,new String[0],e); |
| | | }finally { |