Commit a6e42507 authored by shyWang's avatar shyWang

PDM前端改造

文档相关改造
parent 1bbfbc6c
...@@ -2,6 +2,7 @@ package com.yonde.basedata.search; ...@@ -2,6 +2,7 @@ package com.yonde.basedata.search;
import com.yonde.basedata.entity.users.DxUserVO; import com.yonde.basedata.entity.users.DxUserVO;
import com.yonde.basedata.vo.DxMasterVO; import com.yonde.basedata.vo.DxMasterVO;
import com.yonde.basedata.vo.DxOrganizationVO;
import com.yonde.basedata.vo.DxVersionVO; import com.yonde.basedata.vo.DxVersionVO;
import com.yonde.context.vo.DxContextVO; import com.yonde.context.vo.DxContextVO;
import com.yonde.doc.vo.DxDocumentVO; import com.yonde.doc.vo.DxDocumentVO;
...@@ -80,7 +81,7 @@ public class SearchOperatorEnumUtil { ...@@ -80,7 +81,7 @@ public class SearchOperatorEnumUtil {
public static void initTypeItemMap() { public static void initTypeItemMap() {
typeItemMap.put(DxPartVO.class, "com.yonde.dcs.xbom.common.entity.vo.DxPartVO"); typeItemMap.put(DxPartVO.class, "com.yonde.dcs.xbom.common.entity.vo.DxPartVO");
typeItemMap.put(DxDocumentVO.class, "com.yonde.dcs.document.common.entity.vo.DxDocumentVO"); typeItemMap.put(DxDocumentVO.class, "com.yonde.dcs.document.common.entity.vo.DxDocumentVO");
typeItemMap.put(DxUserVO.class, ""); typeItemMap.put(DxUserVO.class, "com.yonde.dex.basedata.entity.users.DxUserVO");
typeItemMap.put(DxViewVO.class, "com.yonde.dex.view.common.entity.DxViewVO"); typeItemMap.put(DxViewVO.class, "com.yonde.dex.view.common.entity.DxViewVO");
typeItemMap.put(DxVersionVO.class, "com.yonde.dex.version.plugin.common.entity.DxVersionVO"); typeItemMap.put(DxVersionVO.class, "com.yonde.dex.version.plugin.common.entity.DxVersionVO");
typeItemMap.put(DxMasterVO.class, "com.yonde.dex.version.plugin.common.entity.DxMasterVO"); typeItemMap.put(DxMasterVO.class, "com.yonde.dex.version.plugin.common.entity.DxMasterVO");
...@@ -88,6 +89,7 @@ public class SearchOperatorEnumUtil { ...@@ -88,6 +89,7 @@ public class SearchOperatorEnumUtil {
typeItemMap.put(DxUsageLinkVO.class, "com.yonde.dcs.xbom.common.entity.vo.DxUsageLinkVO"); typeItemMap.put(DxUsageLinkVO.class, "com.yonde.dcs.xbom.common.entity.vo.DxUsageLinkVO");
typeItemMap.put(DxPartDescribeLinkVO.class, "com.yonde.dcs.xbom.common.entity.vo.DxPartDescribeLinkVO"); typeItemMap.put(DxPartDescribeLinkVO.class, "com.yonde.dcs.xbom.common.entity.vo.DxPartDescribeLinkVO");
typeItemMap.put(DxPartReferenceLinkVO.class, "com.yonde.dcs.xbom.common.entity.vo.DxPartReferenceLinkVO"); typeItemMap.put(DxPartReferenceLinkVO.class, "com.yonde.dcs.xbom.common.entity.vo.DxPartReferenceLinkVO");
typeItemMap.put(DxOrganizationVO.class, "com.yonde.dex.user.common.vo.DxOrganizationVO");
//TODO add //TODO add
} }
...@@ -116,7 +118,7 @@ public class SearchOperatorEnumUtil { ...@@ -116,7 +118,7 @@ public class SearchOperatorEnumUtil {
docSearchItemMap.put(DX_NAME, WTDocument.NAME); docSearchItemMap.put(DX_NAME, WTDocument.NAME);
docSearchItemMap.put(DX_STATE, WTDocument.LIFE_CYCLE_STATE); docSearchItemMap.put(DX_STATE, WTDocument.LIFE_CYCLE_STATE);
partSearchItemMap.put(DX_MASTER_ID, Iterated.MASTER_REFERENCE + "." + ObjectReference.KEY + "." + ObjectIdentifier.ID); docSearchItemMap.put(DX_MASTER_ID, Iterated.MASTER_REFERENCE + "." + ObjectReference.KEY + "." + ObjectIdentifier.ID);
//文档类型映射 //文档类型映射
......
...@@ -2,16 +2,23 @@ package com.yonde.basedata.vo; ...@@ -2,16 +2,23 @@ package com.yonde.basedata.vo;
import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.yonde.basedata.entity.users.DxUserVO; import com.yonde.basedata.entity.users.DxUserVO;
import com.yonde.common.CommonUtil;
import com.yonde.common.DateTimeUtil; import com.yonde.common.DateTimeUtil;
import com.yonde.common.ObjectsUtil;
import com.yonde.doc.vo.DxDocumentVO;
import com.yonde.part.vo.DxPartVO; import com.yonde.part.vo.DxPartVO;
import wt.doc.WTDocument;
import wt.enterprise.RevisionControlled; import wt.enterprise.RevisionControlled;
import wt.fc.Persistable; import wt.fc.Persistable;
import wt.locks.LockHelper; import wt.locks.LockHelper;
import wt.org.WTPrincipal; import wt.org.WTPrincipal;
import wt.org.WTUser; import wt.org.WTUser;
import wt.part.WTPart;
import wt.session.SessionContext; import wt.session.SessionContext;
import wt.session.SessionHelper; import wt.session.SessionHelper;
import wt.util.WTException; import wt.util.WTException;
import wt.vc.wip.WorkInProgressHelper;
import wt.vc.wip.Workable;
import java.io.Serializable; import java.io.Serializable;
...@@ -77,6 +84,44 @@ public class RevisionControlledVO extends IdVO implements Serializable { ...@@ -77,6 +84,44 @@ public class RevisionControlledVO extends IdVO implements Serializable {
} }
public void setLockerVO(RevisionControlled object) throws WTException { public void setLockerVO(RevisionControlled object) throws WTException {
Persistable persistable = LockHelper.getLocker(object);
//object.getLocker().getObject();
if (persistable != null) {
WTUser locker = ((WTUser) persistable);
this.setLockNote(object.getLockNote());
this.setLockDate(DateTimeUtil.timeStampToString(object.getLockDate()));
DxUserVO dxUserVO = new DxUserVO(locker);
dxUserVO.setLockerName(dxUserVO.getUserName());
this.setLocker(dxUserVO);
this.lockerId = this.getLocker().getId();
} else {
if (WorkInProgressHelper.isCheckedOut(object)) {
Workable copyVersion = CommonUtil.getWorkingCopyVersion(object);
if (ObjectsUtil.isNull(copyVersion.getLocker())) {
if (copyVersion instanceof WTDocument) {
WTDocument previousVersionDoc = CommonUtil.getPreviousVersionDoc((WTDocument) copyVersion);
this.setLockerSign(previousVersionDoc);
} else if (copyVersion instanceof WTPart) {
WTPart wtPart = CommonUtil.getPreviousVersion((WTPart) copyVersion);
this.setLockerSign(wtPart);
}
// TODO
}
} else {
if (WorkInProgressHelper.isWorkingCopy(object) && ObjectsUtil.isNull(this.getLocker())) {
DxUserVO dxUserVO = new DxUserVO(object.getModifier().getPrincipal());
this.setLocker(dxUserVO);
this.setLockerId(dxUserVO.getId());
}
}
}
}
public void setLockerSign(RevisionControlled object) throws WTException {
if (ObjectsUtil.isNull(object)) {
return;
}
Persistable persistable = LockHelper.getLocker(object); Persistable persistable = LockHelper.getLocker(object);
//object.getLocker().getObject(); //object.getLocker().getObject();
if (persistable != null) { if (persistable != null) {
......
...@@ -12,6 +12,7 @@ import wt.content.ContentHolder; ...@@ -12,6 +12,7 @@ import wt.content.ContentHolder;
import wt.content.ContentItem; import wt.content.ContentItem;
import wt.content.HolderToContent; import wt.content.HolderToContent;
import wt.doc.WTDocument; import wt.doc.WTDocument;
import wt.doc.WTDocumentMaster;
import wt.doc.WTDocumentMasterIdentity; import wt.doc.WTDocumentMasterIdentity;
import wt.enterprise.RevisionControlled; import wt.enterprise.RevisionControlled;
import wt.epm.EPMDocument; import wt.epm.EPMDocument;
...@@ -632,6 +633,26 @@ public class CommonUtil implements RemoteAccess { ...@@ -632,6 +633,26 @@ public class CommonUtil implements RemoteAccess {
return result; return result;
} }
public static WTDocument getPreviousVersionDoc(WTDocument document) {
WTDocument result = null;
try{
String vid = VersionControlHelper.getVersionIdentifier(document).getValue();
WTDocumentMaster docMaster = (WTDocumentMaster) document.getMaster();
QueryResult qr = VersionControlHelper.service.allVersionsOf(docMaster);
while (qr.hasMoreElements()) {
result = (WTDocument)qr.nextElement();
String vid2 = VersionControlHelper.getVersionIdentifier((Versioned)result).getValue();
if (vid2.compareTo(vid) < 0){
break;
}
}
}catch(WTException wte){
log.error(wte.getMessage());
wte.printStackTrace();
}
return result;
}
private static void deleteBizObj(RevisionControlled obj, boolean deleteAllVersion) throws Exception private static void deleteBizObj(RevisionControlled obj, boolean deleteAllVersion) throws Exception
{ {
Transaction tx = new Transaction(); Transaction tx = new Transaction();
...@@ -697,6 +718,9 @@ public class CommonUtil implements RemoteAccess { ...@@ -697,6 +718,9 @@ public class CommonUtil implements RemoteAccess {
//处理文件 //处理文件
List<String> folderPathList = new ArrayList<String>(); List<String> folderPathList = new ArrayList<String>();
recursionCreateFolder(s, folderPathList); recursionCreateFolder(s, folderPathList);
if (CollectionUtils.isEmpty(folderPathList)) {
folderPathList.add("/Default");
}
int i = 0; int i = 0;
String[] ida = new String[folderPathList.size()]; String[] ida = new String[folderPathList.size()];
for (Iterator it = folderPathList.iterator(); it.hasNext(); ) for (Iterator it = folderPathList.iterator(); it.hasNext(); )
...@@ -710,12 +734,6 @@ public class CommonUtil implements RemoteAccess { ...@@ -710,12 +734,6 @@ public class CommonUtil implements RemoteAccess {
return (x < y) ? -1 : ((x == y) ? 0 : 1); return (x < y) ? -1 : ((x == y) ? 0 : 1);
} }
}); });
/* folderPathList.stream()
.sorted(
(a, b) -> {
return Integer.compare(a.length(), b.length());
})
.collect(Collectors.toList());*/
System.out.println(">>>>>>folderPathList=" + folderPathList); System.out.println(">>>>>>folderPathList=" + folderPathList);
//创建不存在的文件夹信息 //创建不存在的文件夹信息
......
...@@ -7,10 +7,7 @@ import org.apache.commons.lang.StringUtils; ...@@ -7,10 +7,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import wt.access.NotAuthorizedException; import wt.access.NotAuthorizedException;
import wt.content.*; import wt.content.*;
import wt.doc.WTDocument; import wt.doc.*;
import wt.doc.WTDocumentDependencyLink;
import wt.doc.WTDocumentMaster;
import wt.doc.WTDocumentMasterIdentity;
import wt.fc.*; import wt.fc.*;
import wt.folder.Folder; import wt.folder.Folder;
import wt.folder.FolderEntry; import wt.folder.FolderEntry;
...@@ -26,6 +23,7 @@ import wt.method.RemoteAccess; ...@@ -26,6 +23,7 @@ import wt.method.RemoteAccess;
import wt.method.RemoteMethodServer; import wt.method.RemoteMethodServer;
import wt.org.WTPrincipal; import wt.org.WTPrincipal;
import wt.org.WTPrincipalReference; import wt.org.WTPrincipalReference;
import wt.part.WTPart;
import wt.query.ClassAttribute; import wt.query.ClassAttribute;
import wt.query.QuerySpec; import wt.query.QuerySpec;
import wt.query.SearchCondition; import wt.query.SearchCondition;
...@@ -49,6 +47,7 @@ import java.io.Serializable; ...@@ -49,6 +47,7 @@ import java.io.Serializable;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import static org.apache.commons.lang.StringUtils.isNotBlank; import static org.apache.commons.lang.StringUtils.isNotBlank;
...@@ -1266,4 +1265,21 @@ public class DocUtil implements RemoteAccess, Serializable { ...@@ -1266,4 +1265,21 @@ public class DocUtil implements RemoteAccess, Serializable {
} }
return wtdocument; return wtdocument;
} }
public static String getDefaultDocSeqNumber() {
String bitFormat = "";
try {
for (int i = 0; i < 10; i++) {
bitFormat = bitFormat + "0";
}
int seq = Integer.parseInt(PersistenceHelper.manager.getNextSequence(WTDocumentIDSeq.class));
DecimalFormat format = new DecimalFormat(bitFormat);
return format.format(seq);
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
} }
...@@ -14,10 +14,7 @@ import wt.inf.container.WTContainerRef; ...@@ -14,10 +14,7 @@ import wt.inf.container.WTContainerRef;
import wt.log4j.LogR; import wt.log4j.LogR;
import wt.method.RemoteAccess; import wt.method.RemoteAccess;
import wt.method.RemoteMethodServer; import wt.method.RemoteMethodServer;
import wt.part.PartType; import wt.part.*;
import wt.part.QuantityUnit;
import wt.part.Source;
import wt.part.WTPart;
import wt.pds.StatementSpec; import wt.pds.StatementSpec;
import wt.query.ArrayExpression; import wt.query.ArrayExpression;
import wt.query.ClassAttribute; import wt.query.ClassAttribute;
...@@ -247,7 +244,7 @@ public class PartUtil implements RemoteAccess { ...@@ -247,7 +244,7 @@ public class PartUtil implements RemoteAccess {
bitFormat = bitFormat + "0"; bitFormat = bitFormat + "0";
} }
int seq = Integer.parseInt(PersistenceHelper.manager.getNextSequence(WTPart.class)); int seq = Integer.parseInt(PersistenceHelper.manager.getNextSequence(WTPartIDSeq.class));
DecimalFormat format = new DecimalFormat(bitFormat); DecimalFormat format = new DecimalFormat(bitFormat);
return format.format(seq); return format.format(seq);
} catch (Exception ex) { } catch (Exception ex) {
......
package com.yonde.doc.controller; package com.yonde.doc.controller;
import com.alibaba.fastjson.JSON;
import com.yonde.basedata.controller.AbstractBaseController; import com.yonde.basedata.controller.AbstractBaseController;
import com.yonde.basedata.entity.api.ApiResult; import com.yonde.basedata.entity.api.ApiResult;
import com.yonde.doc.service.DxDocService; import com.yonde.doc.service.DxDocService;
import com.yonde.doc.vo.DxDocumentVO; import com.yonde.doc.vo.DxDocumentVO;
import com.yonde.part.vo.DxPartVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController @RestController
@RequestMapping({"/DxDocument"}) @RequestMapping({"/DxDocument"})
public class DxDocController extends AbstractBaseController { public class DxDocController extends AbstractBaseController {
...@@ -43,14 +47,14 @@ public class DxDocController extends AbstractBaseController { ...@@ -43,14 +47,14 @@ public class DxDocController extends AbstractBaseController {
@PostMapping({"/version/{id}/checkout"}) @PostMapping({"/version/{id}/checkout"})
//@ApiOperation("获取工作副本") //@ApiOperation("获取工作副本")
public DxDocumentVO checkout(@PathVariable Long id) { public DxDocumentVO checkout(@PathVariable Long id) {
DxDocumentVO DxDocumentVO = null; DxDocumentVO dxDocumentVO = null;
try { try {
DxDocumentVO = DxDocService.checkout(id, "Dex检出"); dxDocumentVO = DxDocService.checkout(id, "Dex检出");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return DxDocumentVO; return dxDocumentVO;
} }
@PostMapping({"/version/{id}/undoCheckout"}) @PostMapping({"/version/{id}/undoCheckout"})
...@@ -82,11 +86,13 @@ public class DxDocController extends AbstractBaseController { ...@@ -82,11 +86,13 @@ public class DxDocController extends AbstractBaseController {
//@ApiOperation("深度保存对象") //@ApiOperation("深度保存对象")
@PostMapping({"recursion"}) @PostMapping({"recursion"})
public ApiResult recursionObj(@RequestBody DxDocumentVO entity) { public ApiResult recursionObj(@RequestBody Map entity) {
//return ApiResult.ok(this.getService().saveRecursion(entity)); //return ApiResult.ok(this.getService().saveRecursion(entity));
try { try {
DxDocumentVO doc = DxDocService.createDxDoc(entity); String jsonString = JSON.toJSONString(entity);
return ApiResult.ok(doc); DxDocumentVO entityVO = JSON.parseObject(jsonString, DxDocumentVO.class);
entityVO = DxDocService.createDxDoc(entityVO);
return ApiResult.ok(entityVO);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return ApiResult.error("501", e.getLocalizedMessage(), e); return ApiResult.error("501", e.getLocalizedMessage(), e);
......
package com.yonde.doc.service; package com.yonde.doc.service;
import com.yonde.basedata.entity.users.DxUserVO;
import com.yonde.common.*; import com.yonde.common.*;
import com.yonde.doc.util.DxDocUtil; import com.yonde.doc.util.DxDocUtil;
import com.yonde.doc.vo.DxDocumentVO; import com.yonde.doc.vo.DxDocumentVO;
import com.yonde.part.service.DxPartService; import com.yonde.part.service.DxPartService;
import com.yonde.part.vo.DxPartVO; import org.apache.log4j.Logger;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import wt.doc.WTDocument; import wt.doc.WTDocument;
import wt.log4j.LogR;
import wt.method.RemoteAccess; import wt.method.RemoteAccess;
import wt.method.RemoteMethodServer; import wt.method.RemoteMethodServer;
import wt.part.WTPart;
import wt.session.SessionContext; import wt.session.SessionContext;
import wt.session.SessionHelper; import wt.session.SessionHelper;
import wt.util.WTException; import wt.util.WTException;
import wt.vc.wip.WorkInProgressHelper;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
...@@ -20,7 +22,7 @@ import java.util.List; ...@@ -20,7 +22,7 @@ import java.util.List;
@Service @Service
public class DxDocService implements RemoteAccess { public class DxDocService implements RemoteAccess {
private static Logger logger = LogR.getLogger(DxDocService.class.getName());
/** /**
* 获取工作副本 * 获取工作副本
* @param id * @param id
...@@ -42,10 +44,15 @@ public class DxDocService implements RemoteAccess { ...@@ -42,10 +44,15 @@ public class DxDocService implements RemoteAccess {
WTDocument document = (WTDocument) CommonUtil.getWorkingCopyVersion(docById); WTDocument document = (WTDocument) CommonUtil.getWorkingCopyVersion(docById);
dxDocumentVO = new DxDocumentVO(document); dxDocumentVO = new DxDocumentVO(document);
if (ObjectsUtil.isNull(dxDocumentVO.getLocker())) { if (ObjectsUtil.isNull(dxDocumentVO.getLocker())) {
dxDocumentVO.setLockerVO(docById); dxDocumentVO.setLockerVO(CommonUtil.getPreviousVersionDoc(docById));
} }
} else { } else {
dxDocumentVO = new DxDocumentVO(docById); dxDocumentVO = new DxDocumentVO(docById);
if (WorkInProgressHelper.isWorkingCopy(docById) && ObjectsUtil.isNull(dxDocumentVO.getLocker())) {
DxUserVO dxUserVO = new DxUserVO(docById.getModifier().getPrincipal());
dxDocumentVO.setLocker(dxUserVO);
dxDocumentVO.setLockerId(dxUserVO.getId());
}
} }
} finally { } finally {
...@@ -166,8 +173,9 @@ public class DxDocService implements RemoteAccess { ...@@ -166,8 +173,9 @@ public class DxDocService implements RemoteAccess {
SessionContext previous = SessionContext.newContext(); SessionContext previous = SessionContext.newContext();
try { try {
SessionHelper.manager.setAdministrator(); SessionHelper.manager.setAdministrator();
WTDocument part = DxDocUtil.createDoc(dxDocumentVO); logger.error("createDxDoc====" + dxDocumentVO);
dxDocumentVO = new DxDocumentVO(part); WTDocument doc = DxDocUtil.createDoc(dxDocumentVO);
dxDocumentVO = new DxDocumentVO(doc);
} finally { } finally {
SessionContext.setContext(previous); SessionContext.setContext(previous);
} }
......
...@@ -2,10 +2,9 @@ package com.yonde.doc.util; ...@@ -2,10 +2,9 @@ package com.yonde.doc.util;
import com.yonde.basedata.service.BaseSearchService; import com.yonde.basedata.service.BaseSearchService;
import com.yonde.basedata.vo.DxDocumentFolderVO; import com.yonde.basedata.vo.DxDocumentFolderVO;
import com.yonde.common.CommonUtil; import com.yonde.common.*;
import com.yonde.common.IBAUtil;
import com.yonde.common.RfUtil;
import com.yonde.doc.vo.DxDocumentVO; import com.yonde.doc.vo.DxDocumentVO;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import wt.doc.DepartmentList; import wt.doc.DepartmentList;
import wt.doc.DocumentType; import wt.doc.DocumentType;
...@@ -20,6 +19,7 @@ import wt.lifecycle.LifeCycleTemplate; ...@@ -20,6 +19,7 @@ import wt.lifecycle.LifeCycleTemplate;
import wt.lifecycle.State; import wt.lifecycle.State;
import wt.log4j.LogR; import wt.log4j.LogR;
import wt.method.RemoteMethodServer; import wt.method.RemoteMethodServer;
import wt.part.WTPart;
import wt.type.ClientTypedUtility; import wt.type.ClientTypedUtility;
import wt.type.TypeDefinitionReference; import wt.type.TypeDefinitionReference;
import wt.util.WTException; import wt.util.WTException;
...@@ -47,16 +47,31 @@ public class DxDocUtil { ...@@ -47,16 +47,31 @@ public class DxDocUtil {
} }
public static WTDocument createDoc(DxDocumentVO dxDocumentVO) public static WTDocument createDoc(DxDocumentVO dxDocumentVO)
throws WTException, WTPropertyVetoException, RemoteException, ParseException, InvocationTargetException { throws WTException, WTPropertyVetoException, RemoteException, InvocationTargetException {
String fullType = dxDocumentVO.getSubTypeName(); String fullType = dxDocumentVO.getSubTypeName();
String number = dxDocumentVO.getNumber(); String number = dxDocumentVO.getNumber();
Map ibaMap = dxDocumentVO.getDynamicAttrs();
if (StringUtils.isEmpty(number)) {
number = DocUtil.getDefaultDocSeqNumber();
} else {
WTDocument doc = DocUtil.getDoc(number);
if (ObjectsUtil.nonNull(doc)) {
Object description = ibaMap.get("description");
if (ObjectsUtil.nonNull(description)) {
doc.setDescription(String.valueOf(description));
ibaMap.remove("description");
}
doc = (WTDocument) IBAUtil.forceSetIBAValues(doc, ibaMap);
return doc;
}
}
String name = dxDocumentVO.getName(); String name = dxDocumentVO.getName();
String containerName = dxDocumentVO.getDxContext().getName(); String containerName = dxDocumentVO.getDxContext().getName();
DxDocumentFolderVO dxDocumentFolder = dxDocumentVO.getDxDocumentFolder(); DxDocumentFolderVO dxDocumentFolder = dxDocumentVO.getDxDocumentFolder();
String folderPath = dxDocumentFolder == null?"/Default":dxDocumentFolder.getFullPath(); String folderPath = dxDocumentFolder == null?"/Default":dxDocumentFolder.getFullPath();
String lifecycleTemplateName = null;//TODO String lifecycleTemplateName = null;//TODO
String state = dxDocumentVO.getState(); String state = dxDocumentVO.getState();
Map ibaMap = dxDocumentVO.getDynamicAttrs();
if (fullType == null || fullType.length() == 0) { if (fullType == null || fullType.length() == 0) {
fullType = "wt.doc.WTDocument"; fullType = "wt.doc.WTDocument";
} }
...@@ -64,7 +79,9 @@ public class DxDocUtil { ...@@ -64,7 +79,9 @@ public class DxDocUtil {
//WTDocument doc = (WTDocument) CoreMetaUtility.newInstance(objType); //WTDocument doc = (WTDocument) CoreMetaUtility.newInstance(objType);
WTDocument doc = WTDocument.newWTDocument(); WTDocument doc = WTDocument.newWTDocument();
TypeDefinitionReference tdr = ClientTypedUtility.getTypeDefinitionReference(fullType); TypeDefinitionReference tdr = ClientTypedUtility.getTypeDefinitionReference(fullType);
if (ObjectsUtil.nonNull(tdr)) {
doc.setTypeDefinitionReference(tdr); doc.setTypeDefinitionReference(tdr);
}
doc.setNumber(number); doc.setNumber(number);
doc.setName(name); doc.setName(name);
doc.setDocType(DocumentType.getDocumentTypeDefault()); doc.setDocType(DocumentType.getDocumentTypeDefault());
...@@ -91,23 +108,19 @@ public class DxDocUtil { ...@@ -91,23 +108,19 @@ public class DxDocUtil {
doc = (WTDocument) LifeCycleServerHelper.setState(doc, State.toState(state)); doc = (WTDocument) LifeCycleServerHelper.setState(doc, State.toState(state));
} }
doc = (WTDocument) PersistenceHelper.manager.save(doc); doc = (WTDocument) PersistenceHelper.manager.save(doc);
doc = (WTDocument) PersistenceHelper.manager.refresh(doc);
log.info(">>>>>>>>>refresh.doc=" + doc.getNumber()); log.info(">>>>>>>>>refresh.doc=" + doc.getNumber());
//doc = (WTDocument) PersistenceHelper.manager.refresh(doc); //doc = (WTDocument) PersistenceHelper.manager.refresh(doc);
Object description = ibaMap.get("description");
if (ObjectsUtil.nonNull(description)) {
doc.setDescription(String.valueOf(description));
ibaMap.remove("description");
}
int ibaSize = ibaMap == null ? 0 : ibaMap.size(); int ibaSize = ibaMap == null ? 0 : ibaMap.size();
log.debug("开始设置软属性,数:" + ibaSize); log.debug("开始设置软属性,数:" + ibaSize);
if (ibaSize > 0) { if (ibaSize > 0) {
doc = (WTDocument) IBAUtil.forceSetIBAValues(doc, ibaMap); doc = (WTDocument) IBAUtil.forceSetIBAValues(doc, ibaMap);
} }
/* if (ibaSize > 0) {
Set keySet = ibaMap.keySet();
for (Iterator it = keySet.iterator(); it.hasNext(); ) {
String ibaName = (String) it.next();
Object value = ibaMap.get(ibaName);
if (value != null) {
IBAUtility.setIBAAnyValue(doc, ibaName, value.toString());
}
}
}*/
log.debug("软属性设置结束..."); log.debug("软属性设置结束...");
if (doc != null) { if (doc != null) {
log.debug("文档创建成功:" + doc.getDisplayIdentity()); log.debug("文档创建成功:" + doc.getDisplayIdentity());
......
...@@ -90,7 +90,7 @@ public class DxDocumentVO extends RevisionControlledVO implements Serializable { ...@@ -90,7 +90,7 @@ public class DxDocumentVO extends RevisionControlledVO implements Serializable {
this.subTypeDisplayName = ClientTypedUtility.getLocalizedTypeName(wtDoc, Locale.SIMPLIFIED_CHINESE); this.subTypeDisplayName = ClientTypedUtility.getLocalizedTypeName(wtDoc, Locale.SIMPLIFIED_CHINESE);
this.latest = wtDoc.isLatestIteration(); this.latest = wtDoc.isLatestIteration();
this.checkOuted = WorkInProgressHelper.isCheckedOut(wtDoc); this.checkOuted = WorkInProgressHelper.isCheckedOut(wtDoc);
this.setOperator("NO_CHANGE"); //this.setOperator("NO_CHANGE");
this.lifecycleTemplateId = PersistenceHelper.getObjectIdentifier(wtDoc.getLifeCycleTemplate().getObject()).getId(); this.lifecycleTemplateId = PersistenceHelper.getObjectIdentifier(wtDoc.getLifeCycleTemplate().getObject()).getId();
} finally { } finally {
......
...@@ -64,4 +64,16 @@ public class DxPartDescribeLinkController extends AbstractBaseController { ...@@ -64,4 +64,16 @@ public class DxPartDescribeLinkController extends AbstractBaseController {
return dxPartDescribeLinkVOS; return dxPartDescribeLinkVOS;
} }
@PostMapping({"/searchByDoc/{id}"})
//@ApiOperation("获取工作副本")
public List<DxPartDescribeLinkVO> searchDesLinkByDoc(@PathVariable Long id) {
List<DxPartDescribeLinkVO> dxPartDescribeLinkVOS = new ArrayList<DxPartDescribeLinkVO>();
try {
dxPartDescribeLinkVOS = DxPartService.searchPartDesLinkByDoc(id);
} catch (Exception e) {
e.printStackTrace();
}
return dxPartDescribeLinkVOS;
}
} }
...@@ -22,6 +22,7 @@ import wt.session.SessionContext; ...@@ -22,6 +22,7 @@ import wt.session.SessionContext;
import wt.session.SessionHelper; import wt.session.SessionHelper;
import wt.util.WTException; import wt.util.WTException;
import wt.vc.VersionControlHelper; import wt.vc.VersionControlHelper;
import wt.vc.config.LatestConfigSpec;
import wt.vc.wip.WorkInProgressHelper; import wt.vc.wip.WorkInProgressHelper;
import java.io.Serializable; import java.io.Serializable;
...@@ -449,6 +450,41 @@ public class DxPartService implements RemoteAccess, Serializable { ...@@ -449,6 +450,41 @@ public class DxPartService implements RemoteAccess, Serializable {
return resultList; return resultList;
} }
public static List<DxPartDescribeLinkVO> searchPartDesLinkByDoc(Long id) throws Exception {
if (!RemoteMethodServer.ServerFlag) {
return (List) RemoteMethodServer.getDefault().invoke("searchPartDesLinkByDoc", DxPartService.class.getName(), null,
new Class[] { Long.class },
new Object[] { id });
}
List<DxPartDescribeLinkVO> resultList = new ArrayList<DxPartDescribeLinkVO>();
SessionContext previous = SessionContext.newContext();
try {
SessionHelper.manager.setAdministrator();
WTDocument docById = DxDocUtil.getDocById(id);
QueryResult qr = PersistenceHelper.manager.navigate(docById, WTPartDescribeLink.DESCRIBES_ROLE,
WTPartDescribeLink.class, false);
logger.error("searchPartDesLinkByDoc==" + id);
/* LatestConfigSpec lcs = new LatestConfigSpec();
qr = lcs.process(qr);*/
while (qr != null && qr.hasMoreElements()) {
WTPartDescribeLink nowLink = (WTPartDescribeLink) qr.nextElement();
/* if (nowLink.getRoleBObject() instanceof WTDocument) {
DxPartDescribeLinkVO describeLinkVO = new DxPartDescribeLinkVO(nowLink);
resultList.add(describeLinkVO);
}*/
DxPartDescribeLinkVO describeLinkVO = new DxPartDescribeLinkVO(nowLink);
if (describeLinkVO.getTarget().isLatest()) {
resultList.add(describeLinkVO);
}
logger.error("searchPartDesLinkByDoc describeLinkVO==" + describeLinkVO);
}
}finally {
SessionContext.setContext(previous);
}
return resultList;
}
public static List<DxPartReferenceLinkVO> searchPartRefLink(Long id) throws Exception { public static List<DxPartReferenceLinkVO> searchPartRefLink(Long id) throws Exception {
if (!RemoteMethodServer.ServerFlag) { if (!RemoteMethodServer.ServerFlag) {
return (List) RemoteMethodServer.getDefault().invoke("searchPartRefLink", DxPartService.class.getName(), null, return (List) RemoteMethodServer.getDefault().invoke("searchPartRefLink", DxPartService.class.getName(), null,
......
...@@ -44,8 +44,8 @@ public class DxPartVO extends RevisionControlledVO implements Serializable { ...@@ -44,8 +44,8 @@ public class DxPartVO extends RevisionControlledVO implements Serializable {
private boolean latest; private boolean latest;
private boolean checkOuted; private boolean checkOuted;
private String subTypeName; /* private String subTypeName;
private String subTypeDisplayName; private String subTypeDisplayName;*/
private Long lifecycleTemplateId; private Long lifecycleTemplateId;
......
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