Commit 4adeaf5a authored by hanson.yao's avatar hanson.yao

Merge branch 'master' into ywq-dev

parents 4323d8aa f089ffce
......@@ -7,8 +7,8 @@ import com.yonde.basedata.search.SearchQueryCondition;
import com.yonde.basedata.service.BaseSearchService;
import com.yonde.basedata.vo.IdVO;
import com.yonde.basedata.vo.lc.LifecycleTemplateVO;
import com.yonde.change.service.DXChangeOrderService;
import com.yonde.common.ObjectsUtil;
import com.yonde.common.entity.DXFolder;
import com.yonde.part.vo.DxPartDescribeLinkVO;
import com.yonde.part.vo.DxPartReferenceLinkVO;
import com.yonde.part.vo.DxUsageLinkVO;
......@@ -116,6 +116,22 @@ public class AbstractBaseController {
return list;
}
@GetMapping({"/folder/getFolderList"})
//@ApiOperation("获取副本")
public DXFolder getFolderList(@RequestParam String containerName, @RequestParam(value = "id", required = false) String id, HttpServletRequest request) {
DXFolder dxFolder = null;
try {
if (StringUtils.isEmpty(id)) {
dxFolder = BaseSearchService.getFolderList(containerName);
} else {
dxFolder = BaseSearchService.getFolderList(containerName, Long.valueOf(id));
}
} catch (Exception e) {
e.printStackTrace();
}
return dxFolder;
}
public SearchItems getPermSearchItems(BaseSearchCondition permSearchParams) {
SearchItems searchItems = new SearchItems();
searchItems.setOperator(SearchItems.BooleanOperator.AND);
......
......@@ -44,7 +44,7 @@ public class SearchOperatorEnumUtil {
public static final String DX_CONTEXT_NAME = "dxContext-name";
public static final String DX_FOLDER_ID = "folderName";
public static final String DX_FOLDER_ID = "folderId";
public static final String DX_SUBTYPE_NAME = "subTypeName";
......
......@@ -13,6 +13,8 @@ import com.yonde.change.vo.ecn.DxChangeNoticeVo;
import com.yonde.change.vo.ecr.DxChangeRequestVo;
import com.yonde.change.vo.pr.DxProblemReportVo;
import com.yonde.common.*;
import com.yonde.common.entity.DXFolder;
import com.yonde.common.util.FolderUtil;
import com.yonde.doc.vo.DxDocumentVO;
import com.yonde.part.vo.DxPartVO;
import org.apache.commons.collections.CollectionUtils;
......@@ -30,6 +32,9 @@ import wt.doc.WTDocument;
import wt.epm.EPMDocument;
import wt.fc.PagingQueryResult;
import wt.fc.WTObject;
import wt.folder.Cabinet;
import wt.folder.Folder;
import wt.folder.SubFolder;
import wt.log4j.LogR;
import wt.method.RemoteAccess;
import wt.method.RemoteMethodServer;
......@@ -37,6 +42,7 @@ import wt.part.WTPart;
import wt.session.SessionContext;
import wt.session.SessionHelper;
import wt.session.SessionServerHelper;
import wt.util.WTException;
import wt.util.WTProperties;
import wt.vc.baseline.ManagedBaseline;
import wt.vc.wip.WorkInProgressHelper;
......@@ -311,4 +317,59 @@ public class BaseSearchService <V extends IdVO> implements RemoteAccess {
}
}
/**
* 获取文件件目录
* @param containerName
* @return
* @throws Exception
*/
public static DXFolder getFolderList(String containerName) throws Exception {
if (!RemoteMethodServer.ServerFlag) {
return (DXFolder)RemoteMethodServer.getDefault().invoke("getFolderList", BaseSearchService.class.getName(), null,
new Class[] { String.class },
new Object[] { containerName });
}
CommonUtil.initSessionContext(null);
Cabinet rootFolder = FolderUtil.getRootFolder(containerName);
return getDxFolder(rootFolder);
}
/**
* 获取子文件夹目录
* @param containerName
* @param id
* @return
* @throws Exception
*/
public static DXFolder getFolderList(String containerName, Long id) throws Exception {
if (!RemoteMethodServer.ServerFlag) {
return (DXFolder)RemoteMethodServer.getDefault().invoke("getFolderList", BaseSearchService.class.getName(), null,
new Class[] { String.class, Long.class },
new Object[] { containerName, id });
}
CommonUtil.initSessionContext(null);
Folder folder = FolderUtil.getFolder("OR:wt.folder.SubFolder:" + id);
if (ObjectsUtil.isNull(folder)) {
folder = FolderUtil.getRootFolder(containerName);
}
return getDxFolder(folder);
}
private static DXFolder getDxFolder(Folder folder) throws WTException {
DXFolder dxFolder = new DXFolder(folder);
List<SubFolder> subFolders = FolderUtil.getSubFolders(folder, false);
if (CollectionUtils.isNotEmpty(subFolders)) {
List<DXFolder> subList = new ArrayList<DXFolder>();
for (SubFolder subFolder : subFolders) {
subList.add(new DXFolder(subFolder));
}
dxFolder.setChildren(subList);
} else {
dxFolder.setLeaf(true);
}
return dxFolder;
}
}
package com.yonde.basedata.vo;
import com.yonde.doc.vo.DxDocumentVO;
import wt.fc.PersistenceHelper;
import wt.folder.Folder;
import java.util.List;
......@@ -8,10 +10,19 @@ public class DxDocumentFolderVO extends IdVO{
private String fullPath;
private String name;
private Boolean isLeaf;
private Boolean isLeaf = true;
private List<DxDocumentVO> dxDocuments;
public DxDocumentFolderVO() {
}
public DxDocumentFolderVO(Folder folder) {
this.id = PersistenceHelper.getObjectIdentifier(folder).getId();
this.name = folder.getName();
this.fullPath = folder.getFolderPath();
}
public String getFullPath() {
return fullPath;
}
......
......@@ -79,7 +79,7 @@ public class DXChangeOrderService implements RemoteAccess {
}
if (container != null) {
changeIssue.setContainer(container);
String folderPath = null;
/* String folderPath = null;
DxDocumentFolderVO folderVO = null;
if (ObjectsUtil.nonNull(folderVO)) {
folderPath = folderVO.getFullPath();
......@@ -92,7 +92,7 @@ public class DXChangeOrderService implements RemoteAccess {
FolderHelper.assignLocations(loacationMap);
} else {
throw new WTException(String.format("未找到工程更改文件夹%d", folderPath));
}
}*/
} else {
throw new WTException(String.format("型号上下文%d不存在", dxContext.getName()));
}
......@@ -232,7 +232,7 @@ public class DXChangeOrderService implements RemoteAccess {
}
if (container != null) {
ecr.setContainer(container);
String folderPath = null;
/*String folderPath = null;
DxDocumentFolderVO folderVO = null;
if (ObjectsUtil.nonNull(folderVO)) {
folderPath = folderVO.getFullPath();
......@@ -245,7 +245,7 @@ public class DXChangeOrderService implements RemoteAccess {
FolderHelper.assignLocations(loacationMap);
} else {
System.out.println("未找到工程更改文件夹");
}
}*/
}
// TODO 动态获取变更类型
/* String type = entityVO.getSubTypeName();
......@@ -400,7 +400,7 @@ public class DXChangeOrderService implements RemoteAccess {
}
if (container != null) {
wtChangeOrder2.setContainer(container);
String folderPath = null;
/*String folderPath = null;
DxDocumentFolderVO folderVO = null;
if (ObjectsUtil.nonNull(folderVO)) {
folderPath = folderVO.getFullPath();
......@@ -413,7 +413,7 @@ public class DXChangeOrderService implements RemoteAccess {
FolderHelper.assignLocations(loacationMap);
} else {
System.out.println("未找到工程更改文件夹");
}
}*/
}
}
wtChangeOrder2 = ChangeOrderUtil.createWTChangeOrder2(wtChangeOrder2, changeNoticeVo.getName(), null,
......
......@@ -58,9 +58,9 @@ public class BaseLineUtil {
baseline.setTypeDefinitionReference(typeDef);
/*LifeCycleHelper.setLifeCycle(baseline,
LifeCycleHelper.service.getLifeCycleTemplate("", container.getContainerReference()));*/
WTContainerRef containerRef = WTContainerRef.newWTContainerRef(baseline.getContainer());
/* WTContainerRef containerRef = WTContainerRef.newWTContainerRef(baseline.getContainer());
Folder assignedFolder = FolderHelper.service.saveFolderPath("/Default", containerRef);
FolderHelper.assignLocation((FolderEntry) baseline, assignedFolder);
FolderHelper.assignLocation((FolderEntry) baseline, assignedFolder);*/
baseline = (ManagedBaseline) PersistenceHelper.manager.save(baseline);
ManagedBaselineIdentity identificationObject = (ManagedBaselineIdentity)baseline.getIdentificationObject();
......
......@@ -1250,18 +1250,10 @@ public class DocUtil implements RemoteAccess, Serializable {
document.setNumber(docNum);
}
// Set Folder
if (docFold == null) {
docFold = FolderHelper.service.getFolder("Default", WTContainerRef.newWTContainerRef(container));
/*
* if (folder == null || "".equals(folder)) {
* docFold = FolderHelper.service.getFolder("Default", WTContainerRef.newWTContainerRef(container));
* } else {
* docFold = FolderHelper.service.getFolder("Default/" + folder,
* WTContainerRef.newWTContainerRef(container));
* }
*/
}
if (docFold != null) {
FolderHelper.assignLocation((FolderEntry) document, docFold);
}
// Set Container
PersistenceHelper.manager.save(document);
logger.debug("=============create doc end============");
......
......@@ -4,6 +4,7 @@ import com.yonde.basedata.vo.DxDocumentFolderVO;
import com.yonde.context.vo.DxContextVO;
import com.yonde.doc.vo.DxDocumentVO;
import com.yonde.part.vo.DxPartVO;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import wt.doc.WTDocument;
import wt.folder.Folder;
......@@ -50,22 +51,21 @@ public class DxDocUtil implements RemoteAccess, Serializable {
public static WTDocument createDoc(DxDocumentVO dxDocumentVO) throws WTException {
WTContainer container = null;
DxContextVO dxContext = dxDocumentVO.getDxContext();
logger.error("dxContext Name======" + dxContext);
if (ObjectsUtil.nonNull(dxContext)) {
String contextName = dxContext.getName();
logger.error("container Name======" + contextName);
container = ContainerUtil.getContainerByName(contextName);
logger.error("container======" + container);
}
if (ObjectsUtil.isNull(container)) {
return null;
}
String folderPath = null;
Folder folder = null;
DxDocumentFolderVO folderVO = dxDocumentVO.getDxDocumentFolder();
if (ObjectsUtil.nonNull(folderVO)) {
folderPath = folderVO.getFullPath();
String folderPath = folderVO.getFullPath();
if (StringUtils.isNotEmpty(folderPath)) {
folder = DxCommonUtils.makeFolder(folderPath, container.getContainerReference());
}
}
Folder folder = DxCommonUtils.makeFolder(folderPath, container.getContainerReference());
//dxDocumentVO.getSubTypeName()
WTDocument doc = DocUtil.createDoc(dxDocumentVO.getNumber(), dxDocumentVO.getName(),
container, folder, null);
......
......@@ -205,11 +205,6 @@ public class DxPartUtil implements RemoteAccess, Serializable {
}
public static WTPart createPart(DxPartVO dxPartVO) throws Exception {
/* if (!RemoteMethodServer.ServerFlag) {
return (WTPart) RemoteMethodServer.getDefault().invoke("createPart", DxPartUtil.class.getName(), null,
new Class[]{DxPartVO.class},
new Object[]{dxPartVO});
}*/
WTPart part = null;
String partSource = "";
String partAssembly = "";
......@@ -291,14 +286,6 @@ public class DxPartUtil implements RemoteAccess, Serializable {
if (partType == null || partType.equalsIgnoreCase("")) {
partType = "wt.part.WTPart";
}
if (partFolder == null || partFolder.equalsIgnoreCase("")) {
partFolder = "/Default";
} else {
if (!partFolder.startsWith("/Default")) {
partFolder = "/Default/" + partFolder;
}
}
part = WTPart.newWTPart(number, name, QuantityUnit.EA);
if (partType != null) {
......@@ -308,13 +295,16 @@ public class DxPartUtil implements RemoteAccess, Serializable {
WTContainerRef containerRef = WTContainerRef.newWTContainerRef(container);
part.setContainerReference(containerRef);
if (StringUtils.isNotEmpty(partFolder)) {
if (!partFolder.startsWith("/Default")) {
partFolder = "/Default/" + partFolder;
}
Folder location = null;
try {
location = FolderHelper.service.getFolder(partFolder, containerRef);
} catch (Exception e) {
location = null;
}
if (location == null)
location = FolderHelper.service.saveFolderPath(partFolder, containerRef);
......@@ -323,6 +313,7 @@ public class DxPartUtil implements RemoteAccess, Serializable {
map.put(part, location);
FolderHelper.assignLocations(map);
}
}
part.setPartType(part_assembly);
......
package com.yonde.common.entity;
import com.yonde.basedata.vo.IdVO;
import com.yonde.common.RfUtil;
import wt.fc.PersistenceHelper;
import wt.folder.Folder;
import java.util.ArrayList;
import java.util.List;
public class DXFolder {
public class DXFolder extends IdVO {
//文件夹名称
private String name = "";
......@@ -18,10 +23,20 @@ public class DXFolder {
private String containerName = "";
//容器oid
private String containerOid = "";
//文件夹软类型全路径(本期项目文件夹有子类型)
private String fullType = "";
private Boolean isLeaf = false;
//子文件夹
private List<DXFolder> children = new ArrayList<DXFolder>();
public DXFolder() {
}
public DXFolder(Folder folder) {
this.id = PersistenceHelper.getObjectIdentifier(folder).getId();
this.name = folder.getName();
this.containerName = folder.getContainerName();
this.fullPath = folder.getFolderPath();
}
public String getName() {
return name;
}
......@@ -58,18 +73,16 @@ public class DXFolder {
public void setContainerOid(String containerOid) {
this.containerOid = containerOid;
}
public String getFullType() {
return fullType;
}
public void setFullType(String fullType) {
this.fullType = fullType;
}
public List<DXFolder> getChildren() {
return children;
}
public void setChildren(List<DXFolder> children) {
this.children = children;
}
public Boolean getLeaf() {
return isLeaf;
}
public void setLeaf(Boolean leaf) {
isLeaf = leaf;
}
}
......@@ -58,7 +58,7 @@ public class FolderUtil implements RemoteAccess {
dxFolder.setContainerOid(CommonUtil.getPersistableOid((WTObject)container));
dxFolder.setCabinetOid(CommonUtil.getPersistableOid(cabinet));
dxFolder.setFullType(CommonUtil.getType((WTObject)parentFolder));
//dxFolder.setFullType(CommonUtil.getType((WTObject)parentFolder));
dxFolder.setName(parentFolder.getName());
dxFolder.setFullPath(parentFolder.getFolderPath());
dxFolder.setOid(CommonUtil.getPersistableOid((WTObject)parentFolder));
......@@ -204,7 +204,6 @@ public class FolderUtil implements RemoteAccess {
public static Folder getFolder(String oid) throws WTException {
WTObject obj = (WTObject) CommonUtil.getPersistableByOid(oid);
Folder folder = null;
if(obj instanceof WTContainer){
WTContainerRef containerRef = WTContainerRef.newWTContainerRef((WTContainer)obj);
Cabinet rootFolder = ((WTContainer) containerRef.getObject()).getDefaultCabinet();
......
......@@ -67,8 +67,8 @@ public class DxDocUtil {
}
String name = dxDocumentVO.getName();
String containerName = dxDocumentVO.getDxContext().getName();
DxDocumentFolderVO dxDocumentFolder = dxDocumentVO.getDxDocumentFolder();
String folderPath = dxDocumentFolder == null?"/Default":dxDocumentFolder.getFullPath();
/*DxDocumentFolderVO dxDocumentFolder = dxDocumentVO.getDxDocumentFolder();
String folderPath = dxDocumentFolder == null?"/Default":dxDocumentFolder.getFullPath();*/
String lifecycleTemplateName = null;//TODO
String state = dxDocumentVO.getState();
......@@ -91,7 +91,7 @@ public class DxDocUtil {
WTContainerRef cref = WTContainerRef.newWTContainerRef(container);
doc.setContainerReference(cref);
CommonUtil.setFolder(cref, doc, folderPath);
//CommonUtil.setFolder(cref, doc, folderPath);
/*
* if(folderPath != null){ Folder folder = FolderHelper.service.getFolder(folderPath, cref);
* FolderHelper.assignLocation(doc, folder); }
......
......@@ -235,4 +235,17 @@ public class DxPartController extends AbstractBaseController {
}
return resultList;
}
@GetMapping({"/pdmPlanning/search"})
//@ApiOperation("获取更改相关对象")
public DxPartVO getPdmPlanningPart(@RequestParam(value = "number") String number, @RequestParam(value = "version") String version, HttpServletRequest request) {
DxPartVO dxPartVO = null;
try {
//下游对等件
dxPartVO = DxPartService.getPlanningPart(number, version);
} catch (Exception e) {
e.printStackTrace();
}
return dxPartVO;
}
}
......@@ -25,6 +25,7 @@ import wt.session.SessionContext;
import wt.session.SessionHelper;
import wt.session.SessionServerHelper;
import wt.util.WTException;
import wt.vc.VersionControlHelper;
import wt.vc.views.ViewHelper;
import wt.vc.wip.WorkInProgressHelper;
......@@ -675,4 +676,33 @@ public class DxPartService implements RemoteAccess, Serializable {
}
return resultList;
}
/**
* 获取planning
* @param number
* @return
* @throws Exception
*/
public static DxPartVO getPlanningPart(String number, String version) throws Exception {
if (!RemoteMethodServer.ServerFlag) {
return (DxPartVO) RemoteMethodServer.getDefault().invoke("getPlanningPart", DxPartService.class.getName(), null,
new Class[] { String.class, String.class },
new Object[] { number, version});
}
DxPartVO nextVersion = null;
CommonUtil.initSessionContext(null);
WTPart wtPart = DxPartUtil.getPartByNumberAndView(number, SearchOperatorEnumUtil.viewMap.get("2"), false);
if (ObjectsUtil.nonNull(wtPart)) {
QueryResult qr = VersionControlHelper.service.allVersionsOf(wtPart.getMaster());
while (qr.hasMoreElements()) {
wtPart = (WTPart) qr.nextElement();
if (wtPart.getViewName().equals(SearchOperatorEnumUtil.viewMap.get("2"))
&& wtPart.getVersionIdentifier().getValue().startsWith(version)) {
nextVersion = new DxPartVO(wtPart);
break;
}
}
}
return nextVersion;
}
}
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