Commit ee6bf74d authored by hanson.yao's avatar hanson.yao

develop 3d view

parent 9a2c6e4b
...@@ -9,7 +9,7 @@ Catia.Transfer.B3d.port=8081 ...@@ -9,7 +9,7 @@ Catia.Transfer.B3d.port=8081
Catia.Transfer.B3d.targetNameSpace=www.ptc.com/ws Catia.Transfer.B3d.targetNameSpace=www.ptc.com/ws
Catia.Transfer.B3d.serviceName=ConvertModel2B3dService Catia.Transfer.B3d.serviceName=ConvertModel2B3dService
#For FTP Config #For FTP Config
Catia.ftp.host=192.168.1.235 Catia.ftp.host=192.168.1.177
Catia.ftp.port=21 Catia.ftp.port=21
Catia.ftp.username=ftpuser Catia.ftp.username=ftpuser
Catia.ftp.password=Aa12345678! Catia.ftp.password=Aa12345678!
......
...@@ -3,17 +3,13 @@ package com.yonde.cadpro.checker.impl; ...@@ -3,17 +3,13 @@ package com.yonde.cadpro.checker.impl;
import com.yonde.cadpro.checker.AbstractCADProChecker; import com.yonde.cadpro.checker.AbstractCADProChecker;
import com.yonde.cadpro.config.CADProConfigPropertiesUtil; import com.yonde.cadpro.config.CADProConfigPropertiesUtil;
import com.yonde.cadpro.util.CADProUtil; import com.yonde.cadpro.util.CADProUtil;
import org.apache.log4j.Logger;
import wt.fc.WTObject; import wt.fc.WTObject;
import wt.log4j.LogR;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class DICOpenChecker extends AbstractCADProChecker { public class DICOpenChecker extends AbstractCADProChecker {
private static final Logger log = LogR.getLogger(DICOpenChecker.class.getName());
@Override @Override
public List<WTObject> check(List<String> ids) throws Exception { public List<WTObject> check(List<String> ids) throws Exception {
//必选校验 //必选校验
......
...@@ -5,10 +5,8 @@ import com.yonde.cadpro.checker.AbstractCADProChecker; ...@@ -5,10 +5,8 @@ import com.yonde.cadpro.checker.AbstractCADProChecker;
import com.yonde.cadpro.config.CADProConfigPropertiesUtil; import com.yonde.cadpro.config.CADProConfigPropertiesUtil;
import com.yonde.cadpro.util.EPMUtil; import com.yonde.cadpro.util.EPMUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import wt.epm.EPMDocument; import wt.epm.EPMDocument;
import wt.fc.WTObject; import wt.fc.WTObject;
import wt.log4j.LogR;
import wt.part.WTPart; import wt.part.WTPart;
import wt.util.WTException; import wt.util.WTException;
...@@ -16,7 +14,6 @@ import java.util.ArrayList; ...@@ -16,7 +14,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class NewOpenChecker extends AbstractCADProChecker { public class NewOpenChecker extends AbstractCADProChecker {
private static final Logger log = LogR.getLogger(NewOpenChecker.class.getName());
@Override @Override
public List<WTObject> check(List<String> ids) throws Exception { public List<WTObject> check(List<String> ids) throws Exception {
......
package com.yonde.cadpro.config;
/**
* Created on 2023/5/5 0005
* <p>
* * #For FTP Config
*
* @author
*/
public class CadFTPConfig {
public static final String HOST = "192.168.1.240";
public static final Integer PORT = 21;
public static final String USERNAME = "ftpuser";
public static final String PASSWORD = "Aa12345678!";
public static final String REMOTEPATH = "/";
public static final String ROOTPATH = "D:/Inetpub/ftproot";
public static final String VISUALIZATIONPATH = "D:/Inetpub/ftproot/Visualization";
public static final String TRANSFERRESULTPATH = "D:/Inetpub/ftproot/3D_transfer_result";
}
...@@ -536,7 +536,6 @@ public class CadCheckService implements RemoteAccess { ...@@ -536,7 +536,6 @@ public class CadCheckService implements RemoteAccess {
searchUtil.setConfigSpec(new LatestConfigSpec()); searchUtil.setConfigSpec(new LatestConfigSpec());
QueryResult epmQr = searchUtil.queryObjects(); QueryResult epmQr = searchUtil.queryObjects();
//epmQr = filterIterationsByModifyTime(epmQr);
if (epmQr != null && epmQr.hasMoreElements()) { if (epmQr != null && epmQr.hasMoreElements()) {
epm = (EPMDocument) epmQr.nextElement(); epm = (EPMDocument) epmQr.nextElement();
} }
...@@ -558,7 +557,6 @@ public class CadCheckService implements RemoteAccess { ...@@ -558,7 +557,6 @@ public class CadCheckService implements RemoteAccess {
} }
if (!isIngoreUpdate) { if (!isIngoreUpdate) {
//已存在,校验EPM是否被当前用户检出 //已存在,校验EPM是否被当前用户检出
System.out.println("EPM已经存在");
if (CommonUtil.isCheckedOut(epm)) { if (CommonUtil.isCheckedOut(epm)) {
if (!CommonUtil.isCheckedOut(epm, null)) { if (!CommonUtil.isCheckedOut(epm, null)) {
WTPrincipal checkoutUser = null; WTPrincipal checkoutUser = null;
......
...@@ -7,7 +7,6 @@ import com.yonde.cadpro.bean.MBDAttribute; ...@@ -7,7 +7,6 @@ import com.yonde.cadpro.bean.MBDAttribute;
import com.yonde.cadpro.bean.MBDAttributes; import com.yonde.cadpro.bean.MBDAttributes;
import com.yonde.cadpro.bean.MaterialUsedRDefinitionBean; import com.yonde.cadpro.bean.MaterialUsedRDefinitionBean;
import com.yonde.cadpro.bean.ModelBaseInfo; import com.yonde.cadpro.bean.ModelBaseInfo;
import com.yonde.cadpro.config.CadFTPConfig;
import com.yonde.cadpro.config.CatiaClientConfig; import com.yonde.cadpro.config.CatiaClientConfig;
import com.yonde.cadpro.config.CatiaInteConfigPropertiesUtil; import com.yonde.cadpro.config.CatiaInteConfigPropertiesUtil;
import com.yonde.cadpro.util.*; import com.yonde.cadpro.util.*;
...@@ -1160,8 +1159,12 @@ public class ModelService { ...@@ -1160,8 +1159,12 @@ public class ModelService {
remotePath = remotePath.substring(0, remotePath.lastIndexOf("/")); remotePath = remotePath.substring(0, remotePath.lastIndexOf("/"));
System.out.println("remotePath : " + remotePath); System.out.println("remotePath : " + remotePath);
ExtProperties catiaTransferConfig = VisualizationFacade.catiaTransferConfig;
FTPOperation ftpOperation = new FTPOperation(); FTPOperation ftpOperation = new FTPOperation();
boolean connect = ftpOperation.connect(CadFTPConfig.HOST, CadFTPConfig.PORT, CadFTPConfig.USERNAME, CadFTPConfig.PASSWORD); boolean connect = ftpOperation.connect(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_HOST),
Integer.valueOf(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PORT)),
catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_USERNAME),
catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PASSWORD));
if (!connect) { if (!connect) {
throw new WTException("FTP连接失败,请重试或联系系统管理员。"); throw new WTException("FTP连接失败,请重试或联系系统管理员。");
} }
...@@ -2676,9 +2679,12 @@ public class ModelService { ...@@ -2676,9 +2679,12 @@ public class ModelService {
String remotePath = FilenameUtils.getFullPath(modelFileUri); String remotePath = FilenameUtils.getFullPath(modelFileUri);
System.out.println("remotePath : " + remotePath); System.out.println("remotePath : " + remotePath);
ExtProperties catiaTransferConfig = VisualizationFacade.catiaTransferConfig;
FTPOperation ftpOperation = new FTPOperation(); FTPOperation ftpOperation = new FTPOperation();
boolean connect = ftpOperation.connect(CadFTPConfig.HOST, CadFTPConfig.PORT, CadFTPConfig.USERNAME, CadFTPConfig.PASSWORD); boolean connect = ftpOperation.connect(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_HOST),
Integer.valueOf(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PORT)),
catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_USERNAME),
catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PASSWORD));
if (!connect) { if (!connect) {
throw new WTException("FTP连接失败,请重试或联系系统管理员。"); throw new WTException("FTP连接失败,请重试或联系系统管理员。");
...@@ -2734,10 +2740,12 @@ public class ModelService { ...@@ -2734,10 +2740,12 @@ public class ModelService {
throw new WTException("modelFileUri[" + modelFileUri + "] must catzip format"); throw new WTException("modelFileUri[" + modelFileUri + "] must catzip format");
} }
ExtProperties catiaTransferConfig = VisualizationFacade.catiaTransferConfig;
FTPOperation ftpOperation = new FTPOperation(); FTPOperation ftpOperation = new FTPOperation();
boolean connect = ftpOperation.connect(CadFTPConfig.HOST, CadFTPConfig.PORT, CadFTPConfig.USERNAME, CadFTPConfig.PASSWORD); boolean connect = ftpOperation.connect(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_HOST),
Integer.valueOf(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PORT)),
catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_USERNAME),
catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PASSWORD));
if (!connect) { if (!connect) {
throw new WTException("FTP连接失败,请重试或联系系统管理员。"); throw new WTException("FTP连接失败,请重试或联系系统管理员。");
} }
...@@ -2792,7 +2800,9 @@ public class ModelService { ...@@ -2792,7 +2800,9 @@ public class ModelService {
String remotePath = FilenameUtils.getFullPath(modelFileUri); String remotePath = FilenameUtils.getFullPath(modelFileUri);
System.out.println("remotePath : " + remotePath); System.out.println("remotePath : " + remotePath);
String absoluteRootPath = CadFTPConfig.ROOTPATH;
String absoluteRootPath = CatiaInteConfigPropertiesUtil.getFtpRootPath();;
absoluteRootPath = absoluteRootPath.replace("\\", "/"); absoluteRootPath = absoluteRootPath.replace("\\", "/");
if (absoluteRootPath.endsWith("/")) { if (absoluteRootPath.endsWith("/")) {
absoluteRootPath.substring(0, absoluteRootPath.length() - 1); absoluteRootPath.substring(0, absoluteRootPath.length() - 1);
...@@ -2890,8 +2900,12 @@ public class ModelService { ...@@ -2890,8 +2900,12 @@ public class ModelService {
modelThumbnailName = modelThumbnailName + "." + extension; modelThumbnailName = modelThumbnailName + "." + extension;
} }
ExtProperties catiaTransferConfig = VisualizationFacade.catiaTransferConfig;
FTPOperation ftpOperation = new FTPOperation(); FTPOperation ftpOperation = new FTPOperation();
boolean connect = ftpOperation.connect(CadFTPConfig.HOST, CadFTPConfig.PORT, CadFTPConfig.USERNAME, CadFTPConfig.PASSWORD); boolean connect = ftpOperation.connect(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_HOST),
Integer.valueOf(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PORT)),
catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_USERNAME),
catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PASSWORD));
if (!connect) { if (!connect) {
...@@ -2930,7 +2944,7 @@ public class ModelService { ...@@ -2930,7 +2944,7 @@ public class ModelService {
String remotePath = FilenameUtils.getFullPath(modelFileUri); String remotePath = FilenameUtils.getFullPath(modelFileUri);
System.out.println("remotePath : " + remotePath); System.out.println("remotePath : " + remotePath);
String absoluteRootPath = CadFTPConfig.ROOTPATH; String absoluteRootPath = CatiaInteConfigPropertiesUtil.getFtpRootPath();;
absoluteRootPath = absoluteRootPath.replace("\\", "/"); absoluteRootPath = absoluteRootPath.replace("\\", "/");
if (absoluteRootPath.endsWith("/")) { if (absoluteRootPath.endsWith("/")) {
absoluteRootPath.substring(0, absoluteRootPath.length() - 1); absoluteRootPath.substring(0, absoluteRootPath.length() - 1);
......
...@@ -100,10 +100,12 @@ public class PartVisService implements RemoteAccess { ...@@ -100,10 +100,12 @@ public class PartVisService implements RemoteAccess {
*/ */
public static DxCADBomVo expandCADBom(String oid, String userName) throws Exception { public static DxCADBomVo expandCADBom(String oid, String userName) throws Exception {
if (!RemoteMethodServer.ServerFlag) { if (!RemoteMethodServer.ServerFlag) {
return (DxCADBomVo) RemoteMethodServer.getDefault().invoke("expandCADBom", PartVisService.class.getName(), null, Object obj = RemoteMethodServer.getDefault().invoke("expandCADBom", PartVisService.class.getName(), null,
new Class[]{String.class, String.class}, new Class[]{String.class, String.class},
new Object[]{oid, userName}); new Object[]{oid, userName});
return obj == null ? null : (DxCADBomVo) obj;
} else { } else {
DxCADBomVo rootVo = null;
oid = WTPARTIDPREFIX + oid; oid = WTPARTIDPREFIX + oid;
System.out.println(">>>expandCADBom oid:" + oid + " userName:" + userName); System.out.println(">>>expandCADBom oid:" + oid + " userName:" + userName);
boolean enforced = true; boolean enforced = true;
...@@ -121,7 +123,6 @@ public class PartVisService implements RemoteAccess { ...@@ -121,7 +123,6 @@ public class PartVisService implements RemoteAccess {
} else if (per instanceof EPMDocument) { } else if (per instanceof EPMDocument) {
rootEPM = (EPMDocument) per; rootEPM = (EPMDocument) per;
} }
DxCADBomVo rootVo = null;
if (rootEPM != null) { if (rootEPM != null) {
System.out.println("process rootEPM : " + rootEPM.getDisplayIdentifier()); System.out.println("process rootEPM : " + rootEPM.getDisplayIdentifier());
Matrix4d rootMatrix = calculateMatrixByAssembleTransformInfo2(null, null); Matrix4d rootMatrix = calculateMatrixByAssembleTransformInfo2(null, null);
...@@ -132,11 +133,11 @@ public class PartVisService implements RemoteAccess { ...@@ -132,11 +133,11 @@ public class PartVisService implements RemoteAccess {
rootVo.setTransform(trans); rootVo.setTransform(trans);
} }
} }
return rootVo;
} catch (Exception e) { } catch (Exception e) {
throw new WTException(e); e.printStackTrace();
} finally { } finally {
SessionServerHelper.manager.setAccessEnforced(enforced); SessionServerHelper.manager.setAccessEnforced(enforced);
return rootVo;
} }
} }
} }
...@@ -158,8 +159,7 @@ public class PartVisService implements RemoteAccess { ...@@ -158,8 +159,7 @@ public class PartVisService implements RemoteAccess {
EPMDocConfigSpec epmDocConfigSpec = new EPMDocConfigSpec(); EPMDocConfigSpec epmDocConfigSpec = new EPMDocConfigSpec();
epmDocConfigSpec.setLatestActive(); epmDocConfigSpec.setLatestActive();
QueryResult qr = StructHelper.service.navigateUsesToIteration(epmDoc, QueryResult qr = StructHelper.service.navigateUsesToIteration(epmDoc, EPMMemberLink.class, false, epmDocConfigSpec);
EPMMemberLink.class, false, epmDocConfigSpec);
if (qr != null) { if (qr != null) {
while (qr.hasMoreElements()) { while (qr.hasMoreElements()) {
Persistable[] pp = (Persistable[]) qr.nextElement(); Persistable[] pp = (Persistable[]) qr.nextElement();
...@@ -167,15 +167,13 @@ public class PartVisService implements RemoteAccess { ...@@ -167,15 +167,13 @@ public class PartVisService implements RemoteAccess {
Persistable per = pp[1]; Persistable per = pp[1];
if (per instanceof EPMDocument) { if (per instanceof EPMDocument) {
EPMDocument childEPM = (EPMDocument) per; EPMDocument childEPM = (EPMDocument) per;
System.out.println("put memberLink[" + memberLink + "] = childEPM[" System.out.println("put memberLink[" + memberLink + "] = childEPM[" + childEPM.getDisplayIdentity() + "] to allChildsWithLink...");
+ childEPM.getDisplayIdentity() + "] to allChildsWithLink...");
childEPM = assemblyOriginal(childEPM); childEPM = assemblyOriginal(childEPM);
allChildsWithLink.put(memberLink, childEPM); allChildsWithLink.put(memberLink, childEPM);
if (!allChilds.contains(childEPM)) { if (!allChilds.contains(childEPM)) {
System.out.println("add childEPM[" + childEPM.getDisplayIdentity() System.out.println("add childEPM[" + childEPM.getDisplayIdentity() + "] to allChilds...");
+ "] to allChilds...");
allChilds.add(childEPM); allChilds.add(childEPM);
} }
} else if (per instanceof EPMDocumentMaster) { } else if (per instanceof EPMDocumentMaster) {
...@@ -195,14 +193,12 @@ public class PartVisService implements RemoteAccess { ...@@ -195,14 +193,12 @@ public class PartVisService implements RemoteAccess {
appendEPMInfo(cadStructureBuilder, childEPM); appendEPMInfo(cadStructureBuilder, childEPM);
} }
String cadStructureKey = cadStructureBuilder.toString(); String cadStructureKey = cadStructureBuilder.toString();
AssembleTransformSnapshot snapshot = getAssembleTransformSnapshotByStructure( AssembleTransformSnapshot snapshot = getAssembleTransformSnapshotByStructure(cadStructureKey, epmDoc);
cadStructureKey, epmDoc);
Set<EPMMemberLink> allMemberlinks = allChildsWithLink.keySet(); Set<EPMMemberLink> allMemberlinks = allChildsWithLink.keySet();
for (EPMMemberLink epmMemberLink : allMemberlinks) { for (EPMMemberLink epmMemberLink : allMemberlinks) {
EPMDocument linkedChildEPM = allChildsWithLink.get(epmMemberLink); EPMDocument linkedChildEPM = allChildsWithLink.get(epmMemberLink);
System.out.println("process epmMemberLink : " + epmMemberLink + ", linkedChildEPM : " System.out.println("process epmMemberLink : " + epmMemberLink + ", linkedChildEPM : " + linkedChildEPM);
+ linkedChildEPM);
DxCADBomVo childVo = null; DxCADBomVo childVo = null;
Matrix4d calculateMatrix = null; Matrix4d calculateMatrix = null;
...@@ -463,7 +459,6 @@ public class PartVisService implements RemoteAccess { ...@@ -463,7 +459,6 @@ public class PartVisService implements RemoteAccess {
try { try {
int structureKeyHash = cadStructureKey.hashCode(); int structureKeyHash = cadStructureKey.hashCode();
System.out.println("structureKeyHash : " + structureKeyHash); System.out.println("structureKeyHash : " + structureKeyHash);
assembleTransformSnapshot = AssembleTransformUtil.findAssembleTransformSnapshot(EPMUtil.getOROid(parentEPM), structureKeyHash); assembleTransformSnapshot = AssembleTransformUtil.findAssembleTransformSnapshot(EPMUtil.getOROid(parentEPM), structureKeyHash);
System.out.println("assembleTransformSnapshot by structureKeyHash[" + structureKeyHash + "]:" + assembleTransformSnapshot); System.out.println("assembleTransformSnapshot by structureKeyHash[" + structureKeyHash + "]:" + assembleTransformSnapshot);
......
...@@ -443,12 +443,9 @@ public class CADProUtil { ...@@ -443,12 +443,9 @@ public class CADProUtil {
*/ */
public static Map<String, String> getCADProIbaMapping() { public static Map<String, String> getCADProIbaMapping() {
try { try {
String mappingFile = CADProConstants.wthome + CAD_PRO_IBA_MAPPING_FILE; String mappingFile = CADProConstants.wthome + CAD_PRO_IBA_MAPPING_FILE;
log.debug("mappingFile : " + mappingFile);
String jsonStr = FileUtils.readFileToString(new File(mappingFile), "UTF-8"); String jsonStr = FileUtils.readFileToString(new File(mappingFile), "UTF-8");
return (Map<String, String>) JSONObject.parseObject(jsonStr, Map.class); return (Map<String, String>) JSONObject.parseObject(jsonStr, Map.class);
} catch (Exception e) { } catch (Exception e) {
log.error("getCADProIbaMapping error...", e); log.error("getCADProIbaMapping error...", e);
} }
......
This diff is collapsed.
...@@ -11,6 +11,7 @@ import wt.util.WTException; ...@@ -11,6 +11,7 @@ import wt.util.WTException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
...@@ -33,16 +34,19 @@ public class AssembleTransformUtil { ...@@ -33,16 +34,19 @@ public class AssembleTransformUtil {
} }
StringBuffer sql = new StringBuffer("select * from ASSEMBLETRANSFORMSNAPSHOT ast where 1 =1 "); StringBuffer sql = new StringBuffer("select * from ASSEMBLETRANSFORMSNAPSHOT ast where 1 =1 ");
if (StringUtils.isNotBlank(parentId)) { if (StringUtils.isNotBlank(parentId)) {
sql.append("and PARENTID = " + parentId); sql.append("and PARENTID = '" + parentId + "' ");
} }
if (snapshotHash != 0) { if (snapshotHash != 0) {
sql.append("and SNAPSHOTHASH = '" + snapshotHash+"' "); sql.append("and SNAPSHOTHASH = '" + snapshotHash + "' ");
} }
System.out.println(">>>findAssembleTransformSnapshot sql:" + sql); System.out.println(">>>findAssembleTransformSnapshot sql:" + sql);
Object obj = DBUtil.queryForObject(sql.toString(), AssembleTransformSnapshot.class); Object obj = DBUtil.queryForMap(sql.toString());
if (obj != null) { if (obj != null) {
return (AssembleTransformSnapshot) obj; System.out.println(">>>findAssembleTransformSnapshot map:" + obj);
return new AssembleTransformSnapshot((Map<String, Object>)obj);
} else { } else {
System.out.println(">>>findAssembleTransformSnapshot map is null");
return null; return null;
} }
} }
......
package com.yonde.cadpro.visualization.coordinate; package com.yonde.cadpro.visualization.coordinate;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map;
/** /**
* @description: 装配矩阵关系对象,用于保存装配的装配关系各模型版本快照 * @description: 装配矩阵关系对象,用于保存装配的装配关系各模型版本快照
...@@ -22,6 +23,16 @@ public class AssembleTransformSnapshot implements Serializable { ...@@ -22,6 +23,16 @@ public class AssembleTransformSnapshot implements Serializable {
*/ */
private String snapshotHash; private String snapshotHash;
public AssembleTransformSnapshot(Map<String,Object> map) {
if (!map.isEmpty()){
this.id = String.valueOf(map.get("id"));
this.parentId = String.valueOf(map.get("parentId"));
this.snapshotHash = String.valueOf(map.get("snapshotHash"));
}else {
new AssembleTransformSnapshot();
}
}
public String getId() { public String getId() {
return id; return id;
} }
......
...@@ -10,7 +10,6 @@ import com.yonde.cadpro.visualization.catia.xmlb3dbean.B3dRoot; ...@@ -10,7 +10,6 @@ import com.yonde.cadpro.visualization.catia.xmlb3dbean.B3dRoot;
import com.yonde.cadpro.visualization.catia.xmlb3dbean.B3dStructer; import com.yonde.cadpro.visualization.catia.xmlb3dbean.B3dStructer;
import com.yonde.cadpro.visualization.coordinate.AssembleTransformInfo; import com.yonde.cadpro.visualization.coordinate.AssembleTransformInfo;
import com.yonde.cadpro.visualization.coordinate.AssembleTransformSnapshot; import com.yonde.cadpro.visualization.coordinate.AssembleTransformSnapshot;
import com.yonde.common.CommonUtil;
import com.yonde.common.RfUtil; import com.yonde.common.RfUtil;
import com.yonde.doc.entity.WsResult; import com.yonde.doc.entity.WsResult;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
...@@ -96,17 +95,15 @@ public class VisualizationService { ...@@ -96,17 +95,15 @@ public class VisualizationService {
//1. 下载文件至临时目录 //1. 下载文件至临时目录
String uuidStr = UUID.randomUUID().toString(); String uuidStr = UUID.randomUUID().toString();
//pdm临时目录
String tempFolderPath = CADProConstants.wttemp + catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_TEMPFOLDERPATH) + uuidStr + "/"; String tempFolderPath = CADProConstants.wttemp + catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_TEMPFOLDERPATH) + uuidStr + "/";
tempFolderPath = tempFolderPath.replace("\\", "/"); tempFolderPath = tempFolderPath.replace("\\", "/");
System.out.println("tempFolderPath : " + tempFolderPath);
File tempFolder = new File(tempFolderPath); File tempFolder = new File(tempFolderPath);
if (!tempFolder.exists()) { if (!tempFolder.exists()) {
tempFolder.mkdirs(); tempFolder.mkdirs();
} }
File appDataFile = ContentUtil.downloadApplicationData(appData, tempFolderPath, "", contentHolder); File appDataFile = ContentUtil.downloadApplicationData(appData, tempFolderPath, "", contentHolder);
System.out.println("appDataFile : " + appDataFile);
List<File> uploadFiles = new ArrayList<File>(); List<File> uploadFiles = new ArrayList<File>();
if (!transferModel) { if (!transferModel) {
...@@ -119,38 +116,30 @@ public class VisualizationService { ...@@ -119,38 +116,30 @@ public class VisualizationService {
retriveChildrenAppDataFiles(rootEpm, childrenAppDataFiles, tempFolderPath); retriveChildrenAppDataFiles(rootEpm, childrenAppDataFiles, tempFolderPath);
uploadFiles.addAll(childrenAppDataFiles); uploadFiles.addAll(childrenAppDataFiles);
} }
System.out.println("uploadFiles : " + uploadFiles);
//2. 上传至FTP目录 //2. 上传worker机至FTP目录
FtpUtil ftpUtil = new FtpUtil(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_HOST), FtpUtil ftpUtil = new FtpUtil(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_HOST),
Integer.valueOf(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PORT)), Integer.valueOf(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PORT)),
catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_USERNAME), catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_USERNAME),
catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PASSWORD)); catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PASSWORD));
if (!ftpUtil.connectServer()) { if (!ftpUtil.connectServer()) {
throw new WTException("FTP连接失败,请重试或联系系统管理员。"); throw new WTException("FTP连接失败,请重试或联系系统管理员。");
} }
String ftpRemoteFolder = ""; String ftpRemoteFolder = "";
if (transferModel) { if (transferModel) {
ftpRemoteFolder = catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_TEMPFOLDERPATH) + uuidStr + "/"; ftpRemoteFolder = catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_TEMPFOLDERPATH) + uuidStr + "/";
} }
ftpRemoteFolder = ftpRemoteFolder.replace("\\", "/"); ftpRemoteFolder = ftpRemoteFolder.replace("\\", "/");
System.out.println("ftpRemoteFolder : " + ftpRemoteFolder);
ftpUtil.uploadFile(ftpRemoteFolder, uploadFiles); ftpUtil.uploadFile(ftpRemoteFolder, uploadFiles);
ftpUtil.closeServer(); ftpUtil.closeServer();
String remoteFilePath = ftpRemoteFolder + appDataFile.getName(); String remoteFilePath = ftpRemoteFolder + appDataFile.getName();
remoteFilePath = remoteFilePath.replace("\\", "/"); remoteFilePath = remoteFilePath.replace("\\", "/");
System.out.println("remoteFilePath :" + remoteFilePath);
//此处的文件路径为worker机catia.zip的路径 //此处的文件路径为worker机catia.zip的路径
//3. 调用转可视化服务 //3. 调用worker机转可视化服务
WsResult wsResult = null; WsResult wsResult = null;
if (contentHolder instanceof EPMDocument) { if (contentHolder instanceof EPMDocument) {
//处理三维可视化
wsResult = new ConvertCatia2B3dUtil(catiaTransferConfig).convert(remoteFilePath); wsResult = new ConvertCatia2B3dUtil(catiaTransferConfig).convert(remoteFilePath);
} }
...@@ -161,7 +150,6 @@ public class VisualizationService { ...@@ -161,7 +150,6 @@ public class VisualizationService {
if (wsResult.isResult()) { if (wsResult.isResult()) {
transformedFileRemotePath = wsResult.getInfo(); transformedFileRemotePath = wsResult.getInfo();
transformedFileRemotePath = transformedFileRemotePath.replace("\\", "/"); transformedFileRemotePath = transformedFileRemotePath.replace("\\", "/");
System.out.println("transformedFileRemotePath :" + transformedFileRemotePath);
String transformedFtpFullPath = ""; String transformedFtpFullPath = "";
if (!transferModel) { if (!transferModel) {
...@@ -174,7 +162,6 @@ public class VisualizationService { ...@@ -174,7 +162,6 @@ public class VisualizationService {
} }
} }
transformedFtpFullPath = transformedFtpFullPath.replace("\\", "/"); transformedFtpFullPath = transformedFtpFullPath.replace("\\", "/");
System.out.println("transformedFtpFullPath :" + transformedFtpFullPath);
if (StringUtils.isBlank(transformedFtpFullPath)) { if (StringUtils.isBlank(transformedFtpFullPath)) {
throw new WTException("获取可视化转换文件失败"); throw new WTException("获取可视化转换文件失败");
...@@ -190,7 +177,7 @@ public class VisualizationService { ...@@ -190,7 +177,7 @@ public class VisualizationService {
} }
System.out.println("transformedFtpPath :" + transformedFtpPath); System.out.println("transformedFtpPath :" + transformedFtpPath);
System.out.println("transformedFileName :" + transformedFileName); System.out.println("transformedFileName :" + transformedFileName);
//woker机b3d转换完成后将文件通过ftp下载到pdm codebase/tempDownload/时间戳/ 文件夹下 //worker机b3d转换完成后将文件通过ftp下载到pdm codebase/tempDownload/时间戳/ 文件夹下
ftpUtil = new FtpUtil( ftpUtil = new FtpUtil(
VisualizationFacade.catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_HOST), VisualizationFacade.catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_HOST),
Integer.valueOf(VisualizationFacade.catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PORT)), Integer.valueOf(VisualizationFacade.catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PORT)),
...@@ -255,10 +242,8 @@ public class VisualizationService { ...@@ -255,10 +242,8 @@ public class VisualizationService {
String b3dFilePath = part.getFilePath(); String b3dFilePath = part.getFilePath();
b3dFilePath = tempFolderPath + b3dFilePath; b3dFilePath = tempFolderPath + b3dFilePath;
System.out.println("b3dFilePath : " + b3dFilePath); System.out.println("b3dFilePath : " + b3dFilePath);
String transform = StringUtils.trimToEmpty(part.getRelativeTransform()); String transform = StringUtils.trimToEmpty(part.getRelativeTransform());
System.out.println("transform : " + transform); System.out.println("transform : " + transform);
Set<String> b3ds = numberVisMap.get(cadNumber); Set<String> b3ds = numberVisMap.get(cadNumber);
if (b3ds == null) { if (b3ds == null) {
b3ds = new HashSet<String>(); b3ds = new HashSet<String>();
...@@ -407,7 +392,7 @@ public class VisualizationService { ...@@ -407,7 +392,7 @@ public class VisualizationService {
} }
} }
if (snapshot == null) { if (snapshot == null) {
snapshot = AssembleTransformUtil.newAssembleTransformSnapshot(CommonUtil.getPersistableOid(rootCAD), cadStructureKey); snapshot = AssembleTransformUtil.newAssembleTransformSnapshot( EPMUtil.getOROid(rootCAD), String.valueOf(structureKeyHash));
} }
if (snapshot != null) { if (snapshot != null) {
Set<EPMMemberLink> allMembership = memberLinkWithTrasform Set<EPMMemberLink> allMembership = memberLinkWithTrasform
...@@ -582,6 +567,11 @@ public class VisualizationService { ...@@ -582,6 +567,11 @@ public class VisualizationService {
try { try {
FileUtils.cleanDirectory(tempFolder); FileUtils.cleanDirectory(tempFolder);
FileUtils.deleteQuietly(tempFolder); FileUtils.deleteQuietly(tempFolder);
File xmlFile = new File(downloadFile);
if (xmlFile.exists()){
FileUtils.cleanDirectory(xmlFile.getParentFile());
FileUtils.deleteQuietly(xmlFile.getParentFile());
}
} catch (Exception e) { } catch (Exception e) {
logger.error("Delete tempFolder[" + tempFolder + "] error...", e); logger.error("Delete tempFolder[" + tempFolder + "] error...", e);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment