Commit 7552ec3e authored by shyWang's avatar shyWang

PDM前端改造

流程 任务
parent f2c66700
...@@ -48,6 +48,8 @@ public class SearchOperatorEnumUtil { ...@@ -48,6 +48,8 @@ public class SearchOperatorEnumUtil {
public static final Map<Class<?>, String> typeItemMap = new HashMap();// 类型映射 public static final Map<Class<?>, String> typeItemMap = new HashMap();// 类型映射
public static final Map<String, String> typeStrPrefixMap = new HashMap();// 类型映射
public static final Map<String, String> viewMap = new HashMap();// 视图映射 public static final Map<String, String> viewMap = new HashMap();// 视图映射
public static final Map<Class<?>, String> typePrefixMap = new HashMap();// 类型映射 public static final Map<Class<?>, String> typePrefixMap = new HashMap();// 类型映射
...@@ -79,6 +81,9 @@ public class SearchOperatorEnumUtil { ...@@ -79,6 +81,9 @@ public class SearchOperatorEnumUtil {
typePrefixMap.put(DxPartReferenceLinkVO.class, "wt.part.WTPartReferenceLink:"); typePrefixMap.put(DxPartReferenceLinkVO.class, "wt.part.WTPartReferenceLink:");
typePrefixMap.put(DxPartDescribeLinkVO.class, "wt.part.WTPartDescribeLink:"); typePrefixMap.put(DxPartDescribeLinkVO.class, "wt.part.WTPartDescribeLink:");
//TODO add //TODO add
typeStrPrefixMap.put("com.yonde.dcs.xbom.common.entity.vo.DxPartVO", "wt.part.WTPart:");
typeStrPrefixMap.put("com.yonde.dcs.document.common.entity.vo.DxDocumentVO", "wt.doc.WTDocument:");
} }
public static void initTypeItemMap() { public static void initTypeItemMap() {
......
...@@ -63,7 +63,6 @@ public class BaseSearchService <V extends IdVO> implements RemoteAccess { ...@@ -63,7 +63,6 @@ public class BaseSearchService <V extends IdVO> implements RemoteAccess {
new Object[] { searchQueryCondition}); new Object[] { searchQueryCondition});
} }
logger.error("findByConfigSpecSelect===111" + searchQueryCondition.toString()); logger.error("findByConfigSpecSelect===111" + searchQueryCondition.toString());
/*boolean enforce = SessionServerHelper.manager.setAccessEnforced(false);*/
List<IdVO> partList = DxSearchUtil.findByConfigSpecSelect(searchQueryCondition);; List<IdVO> partList = DxSearchUtil.findByConfigSpecSelect(searchQueryCondition);;
return partList; return partList;
......
...@@ -13,25 +13,26 @@ import wt.util.WTException; ...@@ -13,25 +13,26 @@ import wt.util.WTException;
import java.io.Serializable; import java.io.Serializable;
import java.util.Locale; import java.util.Locale;
public class DxMasterVO implements Serializable { public class DxMasterVO extends IdVO implements Serializable {
private String number; private String number;
private String name; private String name;
private String objectType; private String objectType;
private String createTime; /* private String createTime;
private String modifyTime; private String modifyTime;*/
private Long creatorId; private Long creatorId;
private Long modifierId; private Long modifierId;
private DxUserVO creator; /* private DxUserVO creator;
private DxUserVO modifier; private DxUserVO modifier;
private Long id; private Long id;*/
public DxMasterVO() { public DxMasterVO() {
} }
public DxMasterVO(RevisionControlled controlled) throws WTException { public DxMasterVO(RevisionControlled controlled) throws WTException {
super(controlled);
if(null != controlled) { if(null != controlled) {
if (controlled instanceof WTDocument) { if (controlled instanceof WTDocument) {
WTDocument doc = (WTDocument) controlled; WTDocument doc = (WTDocument) controlled;
...@@ -39,22 +40,19 @@ public class DxMasterVO implements Serializable { ...@@ -39,22 +40,19 @@ public class DxMasterVO implements Serializable {
this.id = PersistenceHelper.getObjectIdentifier(wtDocumentMaster).getId(); this.id = PersistenceHelper.getObjectIdentifier(wtDocumentMaster).getId();
this.number = wtDocumentMaster.getNumber(); this.number = wtDocumentMaster.getNumber();
this.name = wtDocumentMaster.getName(); this.name = wtDocumentMaster.getName();
this.createTime = DateTimeUtil.timeStampToString(wtDocumentMaster.getCreateTimestamp());
this.modifyTime = DateTimeUtil.timeStampToString(wtDocumentMaster.getModifyTimestamp());
} else if(controlled instanceof WTPart) { } else if(controlled instanceof WTPart) {
WTPart part = (WTPart) controlled; WTPart part = (WTPart) controlled;
WTPartMaster wtPartMaster = (WTPartMaster) part.getMaster(); WTPartMaster wtPartMaster = (WTPartMaster) part.getMaster();
this.id = PersistenceHelper.getObjectIdentifier(wtPartMaster).getId(); this.id = PersistenceHelper.getObjectIdentifier(wtPartMaster).getId();
this.number = wtPartMaster.getNumber(); this.number = wtPartMaster.getNumber();
this.name = wtPartMaster.getName(); this.name = wtPartMaster.getName();
this.createTime = DateTimeUtil.timeStampToString(wtPartMaster.getCreateTimestamp());
this.modifyTime = DateTimeUtil.timeStampToString(wtPartMaster.getModifyTimestamp());
} }
this.objectType = controlled.getDisplayType().getLocalizedMessage(Locale.SIMPLIFIED_CHINESE); this.objectType = controlled.getDisplayType().toString();
this.creator = new DxUserVO(controlled.getCreator().getPrincipal()); this.setCreator(new DxUserVO(controlled.getCreator().getPrincipal()));
this.modifier = new DxUserVO(controlled.getModifier().getPrincipal()); this.setModifier(new DxUserVO(controlled.getModifier().getPrincipal()));
this.creatorId = creator.getUserId(); this.creatorId = this.getCreator().getUserId();
this.modifierId = modifier.getUserId(); this.modifierId = this.getModifier().getUserId();
this.subTypeName = "DxMaster";
} }
} }
...@@ -82,22 +80,6 @@ public class DxMasterVO implements Serializable { ...@@ -82,22 +80,6 @@ public class DxMasterVO implements Serializable {
this.objectType = objectType; this.objectType = objectType;
} }
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getModifyTime() {
return modifyTime;
}
public void setModifyTime(String modifyTime) {
this.modifyTime = modifyTime;
}
public Long getCreatorId() { public Long getCreatorId() {
return creatorId; return creatorId;
} }
...@@ -114,27 +96,4 @@ public class DxMasterVO implements Serializable { ...@@ -114,27 +96,4 @@ public class DxMasterVO implements Serializable {
this.modifierId = modifierId; this.modifierId = modifierId;
} }
public DxUserVO getCreator() {
return creator;
}
public void setCreator(DxUserVO creator) {
this.creator = creator;
}
public DxUserVO getModifier() {
return modifier;
}
public void setModifier(DxUserVO modifier) {
this.modifier = modifier;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
} }
...@@ -3,12 +3,10 @@ package com.yonde.common; ...@@ -3,12 +3,10 @@ package com.yonde.common;
import com.ptc.windchill.enterprise.templateutil.ActionValidator; import com.ptc.windchill.enterprise.templateutil.ActionValidator;
import com.yonde.basedata.vo.ObjFileLinkVO; import com.yonde.basedata.vo.ObjFileLinkVO;
import com.yonde.basedata.vo.RepoFileVO; import com.yonde.basedata.vo.RepoFileVO;
import com.yonde.part.vo.DxPartVO;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile;
import wt.access.AccessControlHelper; import wt.access.AccessControlHelper;
import wt.access.AccessPermission; import wt.access.AccessPermission;
...@@ -23,9 +21,7 @@ import wt.fc.WTObject; ...@@ -23,9 +21,7 @@ import wt.fc.WTObject;
import wt.folder.Folder; import wt.folder.Folder;
import wt.folder.FolderHelper; import wt.folder.FolderHelper;
import wt.inf.container.WTContainerRef; import wt.inf.container.WTContainerRef;
import wt.lifecycle.LifeCycleHelper; import wt.lifecycle.*;
import wt.lifecycle.LifeCycleManaged;
import wt.lifecycle.State;
import wt.log4j.LogR; import wt.log4j.LogR;
import wt.method.RemoteAccess; import wt.method.RemoteAccess;
import wt.method.RemoteMethodServer; import wt.method.RemoteMethodServer;
...@@ -408,4 +404,17 @@ public class DxCommonUtils implements RemoteAccess, Serializable { ...@@ -408,4 +404,17 @@ public class DxCommonUtils implements RemoteAccess, Serializable {
return folderStr; return folderStr;
} }
/**
* 重置对象的生命周期模板和状态
*/
public static void reassignLifeCycle(WTContainerRef cref, LifeCycleManaged obj, String LifeCycleTemplateName, String state) throws WTException {
if (LifeCycleTemplateName != null && LifeCycleTemplateName.length() > 0) {
LifeCycleTemplate template = LifeCycleHelper.service.getLifeCycleTemplate(LifeCycleTemplateName, cref);
LifeCycleTemplateReference templateRef = template.getLifeCycleTemplateReference();
obj = LifeCycleHelper.service.reassign(obj, templateRef);
}
if (state != null && state.length() > 0) {
LifeCycleHelper.service.setLifeCycleState(obj, State.toState(state));
}
}
} }
...@@ -10,15 +10,16 @@ import com.yonde.part.vo.*; ...@@ -10,15 +10,16 @@ import com.yonde.part.vo.*;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.tools.ant.taskdefs.SQLExec;
import wt.doc.WTDocument; import wt.doc.WTDocument;
import wt.doc.WTDocumentMaster; import wt.doc.WTDocumentMaster;
import wt.enterprise.RevisionControlled; import wt.enterprise.RevisionControlled;
import wt.fc.*; import wt.fc.PersistenceHelper;
import wt.fc.PersistenceServerHelper;
import wt.fc.QueryResult;
import wt.fc.WTObject;
import wt.fc.collections.WTValuedHashMap; import wt.fc.collections.WTValuedHashMap;
import wt.folder.Folder; import wt.folder.Folder;
import wt.folder.FolderHelper; import wt.folder.FolderHelper;
import wt.iba.value.IBAHolder;
import wt.inf.container.WTContainer; import wt.inf.container.WTContainer;
import wt.inf.container.WTContainerRef; import wt.inf.container.WTContainerRef;
import wt.log4j.LogR; import wt.log4j.LogR;
...@@ -26,12 +27,15 @@ import wt.method.RemoteAccess; ...@@ -26,12 +27,15 @@ import wt.method.RemoteAccess;
import wt.method.RemoteMethodServer; import wt.method.RemoteMethodServer;
import wt.part.*; import wt.part.*;
import wt.pom.Transaction; import wt.pom.Transaction;
import wt.query.QuerySpec;
import wt.query.SearchCondition;
import wt.session.SessionContext; import wt.session.SessionContext;
import wt.util.WTContext; import wt.session.SessionServerHelper;
import wt.util.WTException; import wt.util.WTException;
import wt.vc.VersionControlHelper; import wt.vc.VersionControlHelper;
import wt.vc.views.View; import wt.vc.views.View;
import wt.vc.views.ViewHelper; import wt.vc.views.ViewHelper;
import wt.vc.views.ViewReference;
import wt.vc.wip.CheckoutLink; import wt.vc.wip.CheckoutLink;
import wt.vc.wip.WorkInProgressHelper; import wt.vc.wip.WorkInProgressHelper;
...@@ -195,73 +199,52 @@ public class DxPartUtil implements RemoteAccess, Serializable { ...@@ -195,73 +199,52 @@ public class DxPartUtil implements RemoteAccess, Serializable {
return workingPart; return workingPart;
} }
public static WTPart createPart(DxPartVO dxPartVO) { public static WTPart createPart(DxPartVO dxPartVO) throws Exception {
try {
if (!RemoteMethodServer.ServerFlag) { if (!RemoteMethodServer.ServerFlag) {
return (WTPart) RemoteMethodServer.getDefault().invoke("createPart", DxPartUtil.class.getName(), null, return (WTPart) RemoteMethodServer.getDefault().invoke("createPart", DxPartUtil.class.getName(), null,
new Class[]{DxPartVO.class}, new Class[]{DxPartVO.class},
new Object[]{dxPartVO}); new Object[]{dxPartVO});
} else { }
WTPart part = null; WTPart part = null;
try {
String partSource = ""; String partSource = "";
String partAssembly = ""; String partAssembly = "";
String partView = ""; String partView = "";
String number = dxPartVO.getNumber(); String number = dxPartVO.getNumber();
String name = dxPartVO.getName(); String name = dxPartVO.getName();
if (number == null || number.equalsIgnoreCase("")) {
number = PartUtil.getDefaultPartSeqNumber();
} else {
WTPart existPart = PartUtil.getPart(number, false);
if (existPart != null) {
existPart = (WTPart) IBAUtil.forceSetIBAValues(existPart, dxPartVO.getDynamicAttrs());
return existPart;
}
}
DxViewVO dxView = dxPartVO.getDxView(); DxViewVO dxView = dxPartVO.getDxView();
logger.error("dxView====" + dxView); logger.error("dxView====" + dxView);
if (ObjectsUtil.nonNull(dxView)) { if (ObjectsUtil.nonNull(dxView)) {
logger.error("dxView id====" + dxView.getId());
if (ObjectsUtil.isNull(dxView.getName())) { if (ObjectsUtil.isNull(dxView.getName())) {
partView = SearchOperatorEnumUtil.viewMap.get(String.valueOf(dxView.getId())); partView = SearchOperatorEnumUtil.viewMap.get(String.valueOf(dxView.getId()));
logger.error("dxView name====" + partView);
} else { } else {
partView = dxView.getName(); partView = dxView.getName();
} }
} }
if (number == null || number.equalsIgnoreCase("")) {
number = PartUtil.getDefaultPartSeqNumber();
} else {
WTPart existPart = getPartByNumberAndView(number, partView, false);
if (existPart != null) {
existPart = (WTPart) IBAUtil.forceSetIBAValues(existPart, dxPartVO.getDynamicAttrs());
return existPart;
}
}
String partType = ""; String partType = "";
String partFolder = ""; String partFolder = "";
DxContextVO dxContext = dxPartVO.getDxContext(); DxContextVO dxContext = dxPartVO.getDxContext();
WTContainer container = null; WTContainer container = null;
logger.error("dxContext Name======" + dxContext);
if (ObjectsUtil.nonNull(dxContext)) { if (ObjectsUtil.nonNull(dxContext)) {
String contextName = dxContext.getName(); String contextName = dxContext.getName();
logger.error("container Name======" + contextName);
container = ContainerUtil.getContainerByName(contextName); container = ContainerUtil.getContainerByName(contextName);
logger.error("container======" + container);
} }
/* if (attributes != null) {
partSource = (String) attributes.get(PartUtil.SOURCE);
partAssembly = (String) attributes.get(PartUtil.ASSEMBLY);
partView = (String) attributes.get(PartUtil.VIEW);
partType = (String) attributes.get(PartUtil.TYPE);
partFolder = (String) attributes.get(PartUtil.FOLDER);
}*/
if (container == null) { if (container == null) {
return null; return null;
} }
if (name == null || name.equalsIgnoreCase("")) { if (name == null || name.equalsIgnoreCase("")) {
return null; return null;
} }
Source part_source = null; Source part_source = null;
try { try {
if (partSource == null || partSource.equals("")) { if (partSource == null || partSource.equals("")) {
...@@ -270,7 +253,6 @@ public class DxPartUtil implements RemoteAccess, Serializable { ...@@ -270,7 +253,6 @@ public class DxPartUtil implements RemoteAccess, Serializable {
part_source = Source.toSource(partSource); part_source = Source.toSource(partSource);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
part_source = Source.MAKE; part_source = Source.MAKE;
} }
...@@ -283,7 +265,6 @@ public class DxPartUtil implements RemoteAccess, Serializable { ...@@ -283,7 +265,6 @@ public class DxPartUtil implements RemoteAccess, Serializable {
part_assembly = PartType.toPartType(partAssembly); part_assembly = PartType.toPartType(partAssembly);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
part_assembly = PartType.SEPARABLE; part_assembly = PartType.SEPARABLE;
} }
...@@ -305,7 +286,6 @@ public class DxPartUtil implements RemoteAccess, Serializable { ...@@ -305,7 +286,6 @@ public class DxPartUtil implements RemoteAccess, Serializable {
if (partType == null || partType.equalsIgnoreCase("")) { if (partType == null || partType.equalsIgnoreCase("")) {
partType = "wt.part.WTPart"; partType = "wt.part.WTPart";
} }
if (partFolder == null || partFolder.equalsIgnoreCase("")) { if (partFolder == null || partFolder.equalsIgnoreCase("")) {
partFolder = "/Default"; partFolder = "/Default";
} else { } else {
...@@ -324,7 +304,6 @@ public class DxPartUtil implements RemoteAccess, Serializable { ...@@ -324,7 +304,6 @@ public class DxPartUtil implements RemoteAccess, Serializable {
part.setContainerReference(containerRef); part.setContainerReference(containerRef);
Folder location = null; Folder location = null;
try { try {
location = FolderHelper.service.getFolder(partFolder, containerRef); location = FolderHelper.service.getFolder(partFolder, containerRef);
} catch (Exception e) { } catch (Exception e) {
...@@ -348,19 +327,11 @@ public class DxPartUtil implements RemoteAccess, Serializable { ...@@ -348,19 +327,11 @@ public class DxPartUtil implements RemoteAccess, Serializable {
part = (WTPart) PersistenceHelper.manager.save(part); part = (WTPart) PersistenceHelper.manager.save(part);
part = (WTPart) PersistenceHelper.manager.refresh(part); part = (WTPart) PersistenceHelper.manager.refresh(part);
if (ObjectsUtil.nonNull(dxPartVO.getDynamicAttrs())) {
part = (WTPart) IBAUtil.forceSetIBAValues(part, dxPartVO.getDynamicAttrs()); part = (WTPart) IBAUtil.forceSetIBAValues(part, dxPartVO.getDynamicAttrs());
} catch (Exception e) {
e.printStackTrace();
} }
return part; return part;
} }
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static WTPartUsageLink saveWTPartUsageLink(DxUsageLinkVO usageLinkVO) throws Exception { public static WTPartUsageLink saveWTPartUsageLink(DxUsageLinkVO usageLinkVO) throws Exception {
Transaction ts = null; Transaction ts = null;
...@@ -644,4 +615,45 @@ public class DxPartUtil implements RemoteAccess, Serializable { ...@@ -644,4 +615,45 @@ public class DxPartUtil implements RemoteAccess, Serializable {
return docList; return docList;
} }
public static WTPart getPartByNumberAndView(String number, String viewStr, boolean accessControlled) throws WTException {
WTPart part = null;
try {
number = number.toUpperCase();
if (!RemoteMethodServer.ServerFlag) {
return (WTPart) RemoteMethodServer.getDefault().invoke("getPartByNumberAndView", DxPartUtil.class.getName(),
null, new Class[]{String.class, String.class, boolean.class}, new Object[]{number, viewStr, accessControlled});
} else {
boolean enforce = SessionServerHelper.manager.setAccessEnforced(accessControlled);
try {
QuerySpec querySpec = new QuerySpec(WTPart.class);
SearchCondition searchCondition = new SearchCondition(WTPart.class, WTPart.NUMBER, SearchCondition.LIKE, "%" + number.toUpperCase() + "%", false);
querySpec.appendWhere(searchCondition, new int[]{0});
querySpec.appendAnd();
querySpec.appendWhere(new SearchCondition(WTPart.class, WTPart.LATEST_ITERATION, SearchCondition.IS_TRUE), new int[]{0});
querySpec.appendAnd();
querySpec.appendOpenParen();
View view = ViewHelper.service.getView(viewStr);
querySpec.appendWhere(new SearchCondition(WTPart.class, WTPart.VIEW + "."
+ ViewReference.KEY, SearchCondition.EQUAL, PersistenceHelper
.getObjectIdentifier(view)), new int[]{0});
querySpec.appendOr();
querySpec.appendWhere(new SearchCondition(WTPart.class, WTPart.VIEW, true), new int[]{0});
querySpec.appendCloseParen();
QueryResult queryResult = PersistenceHelper.manager.find(querySpec);
if (queryResult.hasMoreElements()) {
part = (WTPart) queryResult.nextElement();
}
} finally {
SessionServerHelper.manager.setAccessEnforced(enforce);
}
}
} catch (RemoteException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return part;
}
} }
...@@ -22,16 +22,14 @@ import wt.part.WTPart; ...@@ -22,16 +22,14 @@ import wt.part.WTPart;
import wt.pds.StatementSpec; import wt.pds.StatementSpec;
import wt.query.*; import wt.query.*;
import wt.session.SessionServerHelper; import wt.session.SessionServerHelper;
import wt.util.WTAttributeNameIfc;
import wt.util.WTException; import wt.util.WTException;
import wt.util.WTPropertyVetoException;
import wt.vc.Iterated; import wt.vc.Iterated;
import wt.vc.views.View; import wt.vc.views.View;
import wt.vc.views.ViewHelper; import wt.vc.views.ViewHelper;
import wt.vc.wip.WorkInProgressHelper; import wt.vc.wip.WorkInProgressHelper;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.rmi.RemoteException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -41,6 +39,7 @@ public class DxSearchUtil implements RemoteAccess, Serializable { ...@@ -41,6 +39,7 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
private static Logger logger = LogR.getLogger(DxSearchUtil.class.getName()); private static Logger logger = LogR.getLogger(DxSearchUtil.class.getName());
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Deprecated
public static DxPageImpl findByConfigSpec (SearchQueryCondition searchQueryCondition) throws Exception { public static DxPageImpl findByConfigSpec (SearchQueryCondition searchQueryCondition) throws Exception {
if (!RemoteMethodServer.ServerFlag) { if (!RemoteMethodServer.ServerFlag) {
return (DxPageImpl) RemoteMethodServer.getDefault().invoke("findByConfigSpecSelect", DxSearchUtil.class.getName(), null, return (DxPageImpl) RemoteMethodServer.getDefault().invoke("findByConfigSpecSelect", DxSearchUtil.class.getName(), null,
...@@ -57,11 +56,7 @@ public class DxSearchUtil implements RemoteAccess, Serializable { ...@@ -57,11 +56,7 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
searchItems = searchQueryCondition.getSearchVersion().getSearchItems(); searchItems = searchQueryCondition.getSearchVersion().getSearchItems();
} }
QuerySpec querySpec = DxSearchUtil.buildQuerySpec(searchItems, WTPart.class); QuerySpec querySpec = DxSearchUtil.buildQuerySpec(searchItems, WTPart.class);
/* LatestConfigSpec ls = new LatestConfigSpec();
querySpec = ls.appendSearchCriteria(querySpec);*/
QueryResult qr = PersistenceHelper.manager.find((StatementSpec) querySpec); QueryResult qr = PersistenceHelper.manager.find((StatementSpec) querySpec);
//LatestConfigSpec lcs = new LatestConfigSpec();
//qr = lcs.process(qr);
partList = new ArrayList<DxPartVO>(); partList = new ArrayList<DxPartVO>();
while (qr.hasMoreElements()) { while (qr.hasMoreElements()) {
WTObject o = (WTObject) qr.nextElement(); WTObject o = (WTObject) qr.nextElement();
...@@ -103,12 +98,28 @@ public class DxSearchUtil implements RemoteAccess, Serializable { ...@@ -103,12 +98,28 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
QuerySpec querySpec = DxSearchUtil.buildQuerySpec(searchItems, cls); QuerySpec querySpec = DxSearchUtil.buildQuerySpec(searchItems, cls);
/* LatestConfigSpec ls = new LatestConfigSpec(); /* LatestConfigSpec ls = new LatestConfigSpec();
querySpec = ls.appendSearchCriteria(querySpec);*/ querySpec = ls.appendSearchCriteria(querySpec);*/
QueryResult qr = PersistenceHelper.manager.find((StatementSpec) querySpec); BasicPageableQuerySpec bpqs = new BasicPageableQuerySpec();
bpqs.setPrimaryStatement(querySpec);
logger.error("pageFrom====" + (searchQueryCondition.getPageFrom()-1)*searchQueryCondition.getPageSize());
logger.error("pageSize====" + searchQueryCondition.getPageSize());
bpqs.setOffset((searchQueryCondition.getPageFrom()-1)*searchQueryCondition.getPageSize());
bpqs.setRange(searchQueryCondition.getPageSize());
bpqs.setBackgroundThreadEnabled(false);
QueryResult qr = PersistenceHelper.manager.find(querySpec);
//LatestConfigSpec lcs = new LatestConfigSpec(); //LatestConfigSpec lcs = new LatestConfigSpec();
//qr = lcs.process(qr); //qr = lcs.process(qr);
partList = new ArrayList<DxPartVO>();
partList = new ArrayList();
while (qr.hasMoreElements()) { while (qr.hasMoreElements()) {
WTObject o = (WTObject) qr.nextElement(); Object element = qr.nextElement();
WTObject o = null;
logger.error("[]=====arrysList" + element);
if (element instanceof Object[]) {
Object[] objects = (Object[]) element;
o = (WTObject) objects[0];
} else {
o = (WTObject) element;
}
buildQueryResult(o, partList, indices); buildQueryResult(o, partList, indices);
} }
} finally { } finally {
...@@ -199,20 +210,23 @@ public class DxSearchUtil implements RemoteAccess, Serializable { ...@@ -199,20 +210,23 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
/* if (fieldName.equals("masterId")) { /* if (fieldName.equals("masterId")) {
return null; return null;
}*/ }*/
// TODO // TODO fieldName.equals(SearchOperatorEnumUtil.DX_ID)||
if (fieldName.equals("checkOuted") || fieldName.equals(SearchOperatorEnumUtil.DX_ID)|| fieldName.equals("creatorId")) { if (fieldName.equals("checkOuted") || fieldName.equals("creatorId")) {
continue; continue;
} }
//视图 //视图
if (fieldName.equals(SearchOperatorEnumUtil.DX_VIEWID)) { if (fieldName.equals(SearchOperatorEnumUtil.DX_VIEWID)) {
addQuerySpecOp(querySpec, operator);
String viewName = SearchOperatorEnumUtil.viewMap.get(String.valueOf(item.value)); String viewName = SearchOperatorEnumUtil.viewMap.get(String.valueOf(item.value));
logger.error("viewName=========" + viewName); logger.error("viewName=========" + viewName);
if (StringUtils.isEmpty(viewName)) {
continue;
}
View view = ViewHelper.service.getView(viewName); View view = ViewHelper.service.getView(viewName);
logger.error("view=========" + view); logger.error("view=========" + view);
if (view == null) { if (view == null) {
continue; continue;
} }
addQuerySpecOp(querySpec, operator);
SearchCondition sc = buildScd(clazz, typeSearchMap.get(fieldName), item.operator.name(), PersistenceHelper SearchCondition sc = buildScd(clazz, typeSearchMap.get(fieldName), item.operator.name(), PersistenceHelper
.getObjectIdentifier(view).getId()); .getObjectIdentifier(view).getId());
if (ObjectsUtil.nonNull(sc)) { if (ObjectsUtil.nonNull(sc)) {
...@@ -266,7 +280,7 @@ public class DxSearchUtil implements RemoteAccess, Serializable { ...@@ -266,7 +280,7 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
op, scVal); op, scVal);
return sc; return sc;
} }
if (value instanceof Long || fieldName.contains(Iterated.MASTER_REFERENCE)) { if (value instanceof Long || fieldName.contains(Iterated.MASTER_REFERENCE) || fieldName.equalsIgnoreCase(WTAttributeNameIfc.ID_NAME)) {
sc = new SearchCondition(clazz, fieldName, sc = new SearchCondition(clazz, fieldName,
op, Long.valueOf(String.valueOf(value))); op, Long.valueOf(String.valueOf(value)));
return sc; return sc;
......
...@@ -6,6 +6,7 @@ import wt.fc.ReferenceFactory; ...@@ -6,6 +6,7 @@ import wt.fc.ReferenceFactory;
import wt.fc.WTObject; import wt.fc.WTObject;
import wt.fc.WTReference; import wt.fc.WTReference;
import wt.lifecycle.LifeCycleHelper; import wt.lifecycle.LifeCycleHelper;
import wt.method.RemoteMethodServer;
import wt.part.WTPart; import wt.part.WTPart;
import wt.session.SessionContext; import wt.session.SessionContext;
import wt.session.SessionHelper; import wt.session.SessionHelper;
...@@ -94,4 +95,30 @@ public class RfUtil { ...@@ -94,4 +95,30 @@ public class RfUtil {
} }
return p; return p;
} }
/**
* 根据对象oid获取WTReference
*
* @param oid
* @return
*/
public static WTReference getObjectRefByOid(String oid) {
try {
boolean enforce = SessionServerHelper.manager.setAccessEnforced(false);
WTReference wtreference = null;
try {
ReferenceFactory referencefactory = new ReferenceFactory();
wtreference = referencefactory.getReference(oid);
return wtreference;
} catch (Exception e) {
e.printStackTrace();
} finally {
SessionServerHelper.manager.setAccessEnforced(enforce);
}
return wtreference;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
} }
package com.yonde.common;
import wt.fc.PersistenceHelper;
import wt.fc.QueryResult;
import wt.org.WTUser;
import wt.query.QuerySpec;
import wt.query.SearchCondition;
import wt.util.WTException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
public class WTUserUtil {
public static WTUser getUserById(String s) throws WTException {
WTUser wtuser = null;
QuerySpec queryspec = null;
QueryResult queryresult = null;
queryspec = new QuerySpec(WTUser.class);
if (s.equalsIgnoreCase("wcadmin")) {
s = "Administrator";
}
SearchCondition searchcondition = new SearchCondition(WTUser.class, "name", "LIKE", s, false);
queryspec.appendSearchCondition(searchcondition);
queryspec.appendAnd();
queryspec.appendWhere(new SearchCondition(WTUser.class, WTUser.DISABLED, SearchCondition.IS_FALSE));
queryresult = PersistenceHelper.manager.find(queryspec);
if (queryresult.hasMoreElements()) {
wtuser = (WTUser) queryresult.nextElement();
}
return wtuser;
}
public static WTUser getUser(String userName) {
WTUser user = null;
try {
if (userName != null) {
if (userName.equalsIgnoreCase("wcadmin")) {
userName = "Administrator";
}
QuerySpec qs = new QuerySpec(WTUser.class);
// 条件: 指定编号
qs.appendWhere(new SearchCondition(WTUser.class, WTUser.NAME, SearchCondition.EQUAL, userName));
qs.appendAnd();
qs.appendWhere(new SearchCondition(WTUser.class, WTUser.DISABLED, SearchCondition.IS_FALSE));
QueryResult qr = PersistenceHelper.manager.find(qs);
if (qr.hasMoreElements()) {
user = (WTUser) qr.nextElement();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return user;
}
/**
* 通过用户名称模糊查询系统中用户对象。
*
* @param userName
* @return
*/
public static List<WTUser> getUsers(String userName) {
List<WTUser> userList = new ArrayList<WTUser>();
WTUser user = null;
try {
if (userName != null) {
QuerySpec qs = new QuerySpec(WTUser.class);
qs.appendOpenParen();
// 条件: 指定编号
//qs.appendWhere(new SearchCondition(WTUser.class, WTUser.NAME, SearchCondition.LIKE, userName, false));
qs.appendWhere(new SearchCondition(WTUser.class, WTUser.FULL_NAME, SearchCondition.LIKE, "%" + userName + "%", false));
qs.appendOr();
qs.appendSearchCondition(new SearchCondition(WTUser.class, WTUser.NAME, SearchCondition.LIKE, "%" + userName + "%", false));
qs.appendCloseParen();
qs.appendAnd();
qs.appendWhere(new SearchCondition(WTUser.class, WTUser.DISABLED, SearchCondition.IS_FALSE));
QueryResult qr = PersistenceHelper.manager.find(qs);
while (qr.hasMoreElements()) {
user = (WTUser) qr.nextElement();
if (!user.isDisabled()) {
userList.add(user);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return userList;
}
public static void main(String[] args) throws Exception {
QuerySpec qs = new QuerySpec(WTUser.class);
qs.appendOpenParen();
// 条件: 指定编号
//qs.appendWhere(new SearchCondition(WTUser.class, WTUser.NAME, SearchCondition.LIKE, userName, false));
qs.appendWhere(new SearchCondition(WTUser.class, WTUser.FULL_NAME, SearchCondition.LIKE, "%111%", false));
qs.appendOr();
qs.appendSearchCondition(new SearchCondition(WTUser.class, WTUser.NAME, SearchCondition.LIKE, "%555%", false));
qs.appendCloseParen();
qs.appendAnd();
qs.appendWhere(new SearchCondition(WTUser.class, WTUser.DISABLED, SearchCondition.IS_FALSE));
System.out.print(qs);
}
/**
* 通过用户全名获取用户对象
*
* @param userFullName
* @return
*/
public static WTUser getUserByFullName(String userFullName) {
WTUser user = null;
try {
if (userFullName != null) {
QuerySpec qs = new QuerySpec(WTUser.class);
// 条件: 指定编号
qs.appendWhere(new SearchCondition(WTUser.class, WTUser.FULL_NAME, SearchCondition.EQUAL, userFullName, false));
qs.appendAnd();
qs.appendWhere(new SearchCondition(WTUser.class, WTUser.DISABLED, SearchCondition.IS_FALSE));
QueryResult qr = PersistenceHelper.manager.find(qs);
while (qr.hasMoreElements()) {
user = (WTUser) qr.nextElement();
if (!user.isDisabled()) {
return user;
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return user;
}
public static Boolean isAdministrator(WTUser principal) throws WTException {
try {
Enumeration groupNames = principal.parentGroupNames();
while (groupNames.hasMoreElements()) {
if ("Administrators".equals(groupNames.nextElement())) {
return true;
}
}
} catch (WTException e) {
throw new WTException(e.getLocalizedMessage());
}
return false;
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; ...@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
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.basedata.vo.*; import com.yonde.basedata.vo.*;
import com.yonde.common.CommonUtil;
import com.yonde.common.DxCommonUtils; import com.yonde.common.DxCommonUtils;
import com.yonde.common.IBAHelper; import com.yonde.common.IBAHelper;
import com.yonde.context.vo.DxContextVO; import com.yonde.context.vo.DxContextVO;
...@@ -16,6 +17,7 @@ import wt.session.SessionHelper; ...@@ -16,6 +17,7 @@ import wt.session.SessionHelper;
import wt.type.ClientTypedUtility; import wt.type.ClientTypedUtility;
import wt.util.WTException; import wt.util.WTException;
import wt.vc.wip.WorkInProgressHelper; import wt.vc.wip.WorkInProgressHelper;
import wt.vc.wip.Workable;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
...@@ -88,7 +90,7 @@ public class DxDocumentVO extends RevisionControlledVO implements Serializable { ...@@ -88,7 +90,7 @@ public class DxDocumentVO extends RevisionControlledVO implements Serializable {
this.number = wtDoc.getNumber(); this.number = wtDoc.getNumber();
this.setModifier(new DxUserVO(wtDoc.getModifier().getPrincipal())); this.setModifier(new DxUserVO(wtDoc.getModifier().getPrincipal()));
this.setCreator(new DxUserVO(wtDoc.getCreator().getPrincipal())); this.setCreator(new DxUserVO(wtDoc.getCreator().getPrincipal()));
this.dynamicAttrs = IBAHelper.getAllIBAValues(wtDoc);
this.state = wtDoc.getState().getState().toString(); this.state = wtDoc.getState().getState().toString();
//this.subTypeName = ClientTypedUtility.getTypeIdentifier(wtDoc).getTypename(); //this.subTypeName = ClientTypedUtility.getTypeIdentifier(wtDoc).getTypename();
this.subTypeName = "managementDoc";//TODO 要映射 this.subTypeName = "managementDoc";//TODO 要映射
...@@ -96,10 +98,15 @@ public class DxDocumentVO extends RevisionControlledVO implements Serializable { ...@@ -96,10 +98,15 @@ public class DxDocumentVO extends RevisionControlledVO implements Serializable {
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();
if (WorkInProgressHelper.isCheckedOut(wtDoc)) {
wtDoc = (WTDocument) CommonUtil.getWorkingCopyVersion(wtDoc);
}
this.dynamicAttrs = IBAHelper.getAllIBAValues(wtDoc);
if (StringUtils.isNotEmpty(wtDoc.getDescription())) { if (StringUtils.isNotEmpty(wtDoc.getDescription())) {
this.getDynamicAttrs().put("description", wtDoc.getDescription()); this.getDynamicAttrs().put("description", wtDoc.getDescription());
} }
this.lifecycleTemplateId = PersistenceHelper.getObjectIdentifier(wtDoc.getLifeCycleTemplate().getObject()).getId();
this.setObjFileLinks(DxCommonUtils.buildObjFileLinks(wtDoc)); this.setObjFileLinks(DxCommonUtils.buildObjFileLinks(wtDoc));
} finally { } finally {
SessionContext.setContext(previous); SessionContext.setContext(previous);
......
...@@ -553,12 +553,9 @@ public class DxPartService implements RemoteAccess, Serializable { ...@@ -553,12 +553,9 @@ public class DxPartService implements RemoteAccess, Serializable {
new Class[] { Long.class}, new Class[] { Long.class},
new Object[] { id}); new Object[] { id});
} }
/* SessionContext previous = SessionContext.newContext(); SessionContext previous = SessionContext.newContext();
try { try {
SessionHelper.manager.setAdministrator(); SessionHelper.manager.setAdministrator();
} finally {
SessionContext.setContext(previous);
}*/
WTPart partById = DxPartUtil.getPartById(id); WTPart partById = DxPartUtil.getPartById(id);
String viewName = partById.getViewName(); String viewName = partById.getViewName();
if(!viewName.equalsIgnoreCase("Planning")){ if(!viewName.equalsIgnoreCase("Planning")){
...@@ -586,5 +583,9 @@ public class DxPartService implements RemoteAccess, Serializable { ...@@ -586,5 +583,9 @@ public class DxPartService implements RemoteAccess, Serializable {
throw new Exception("无需转视图"); throw new Exception("无需转视图");
} }
} finally {
SessionContext.setContext(previous);
}
} }
} }
...@@ -9,6 +9,8 @@ import com.yonde.basedata.vo.RevisionControlledVO; ...@@ -9,6 +9,8 @@ import com.yonde.basedata.vo.RevisionControlledVO;
import com.yonde.common.CommonUtil; import com.yonde.common.CommonUtil;
import com.yonde.common.IBAHelper; import com.yonde.common.IBAHelper;
import com.yonde.context.vo.DxContextVO; import com.yonde.context.vo.DxContextVO;
import org.apache.commons.lang.StringUtils;
import wt.doc.WTDocument;
import wt.fc.PersistenceHelper; import wt.fc.PersistenceHelper;
import wt.org.WTOrganization; import wt.org.WTOrganization;
import wt.part.WTPart; import wt.part.WTPart;
...@@ -112,7 +114,6 @@ public class DxPartVO extends RevisionControlledVO implements Serializable { ...@@ -112,7 +114,6 @@ public class DxPartVO extends RevisionControlledVO implements Serializable {
this.setVersion(new DxVersionVO(wtPart)); this.setVersion(new DxVersionVO(wtPart));
this.setDxContext(new DxContextVO(wtPart.getContainer())); this.setDxContext(new DxContextVO(wtPart.getContainer()));
this.dynamicAttrs = IBAHelper.getAllIBAValues(wtPart);
this.state = wtPart.getState().getState().toString(); this.state = wtPart.getState().getState().toString();
this.subTypeName = "Component";//TODO 要映射 this.subTypeName = "Component";//TODO 要映射
//ClientTypedUtility.getTypeIdentifier(wtPart).getTypename(); //ClientTypedUtility.getTypeIdentifier(wtPart).getTypename();
...@@ -121,6 +122,10 @@ public class DxPartVO extends RevisionControlledVO implements Serializable { ...@@ -121,6 +122,10 @@ public class DxPartVO extends RevisionControlledVO implements Serializable {
this.checkOuted = WorkInProgressHelper.isCheckedOut(wtPart); this.checkOuted = WorkInProgressHelper.isCheckedOut(wtPart);
this.lifecycleTemplateId = PersistenceHelper.getObjectIdentifier(wtPart.getLifeCycleTemplate().getObject()).getId(); this.lifecycleTemplateId = PersistenceHelper.getObjectIdentifier(wtPart.getLifeCycleTemplate().getObject()).getId();
if (this.checkOuted) {
wtPart = (WTPart) CommonUtil.getWorkingCopyVersion(wtPart);
}
this.dynamicAttrs = IBAHelper.getAllIBAValues(wtPart);
this.defaultUnit = wtPart.getDefaultUnit().getDisplay(); this.defaultUnit = wtPart.getDefaultUnit().getDisplay();
this.endItem = wtPart.isEndItem(); this.endItem = wtPart.isEndItem();
......
...@@ -3,6 +3,7 @@ package com.yonde.part.vo; ...@@ -3,6 +3,7 @@ package com.yonde.part.vo;
import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.yonde.basedata.vo.IdVO; import com.yonde.basedata.vo.IdVO;
import com.yonde.common.IBAHelper; import com.yonde.common.IBAHelper;
import com.yonde.common.ObjectsUtil;
import com.yonde.common.PartUtil; import com.yonde.common.PartUtil;
import wt.fc.PersistenceHelper; import wt.fc.PersistenceHelper;
import wt.part.Quantity; import wt.part.Quantity;
...@@ -51,11 +52,13 @@ public class DxUsageLinkVO extends IdVO implements Serializable { ...@@ -51,11 +52,13 @@ public class DxUsageLinkVO extends IdVO implements Serializable {
this.setUnit(qt.getUnit().toString()); this.setUnit(qt.getUnit().toString());
WTPartMaster uses = (WTPartMaster) usageLink.getUses(); WTPartMaster uses = (WTPartMaster) usageLink.getUses();
WTPart child = PartUtil.getLatestPartByNoViewWithState(uses.getNumber(), parent.getViewName(), null, false); WTPart child = PartUtil.getLatestPartByNoViewWithState(uses.getNumber(), parent.getViewName(), null, false);
if (ObjectsUtil.nonNull(child)) {
this.setTargetId(PersistenceHelper.getObjectIdentifier(child.getMaster()).getId()); this.setTargetId(PersistenceHelper.getObjectIdentifier(child.getMaster()).getId());
this.setSourceId(PersistenceHelper.getObjectIdentifier(parent).getId());
if (level > 0) { if (level > 0) {
this.setTarget(new DxPartVO(child)); this.setTarget(new DxPartVO(child));
} }
}
this.setSourceId(PersistenceHelper.getObjectIdentifier(parent).getId());
if (level < 0) { if (level < 0) {
this.setSource(new DxPartVO(parent)); this.setSource(new DxPartVO(parent));
} }
......
package com.yonde.wfc.controller;
import com.yonde.basedata.entity.api.ApiResult;
import com.yonde.basedata.vo.IdVO;
import com.yonde.wfc.service.WfcProcessService;
import com.yonde.wfc.vo.*;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = "/workflow")
public class WfcProcessController {
@PostMapping("/inst")
//@ApiOperation("查询流程实例列表")
public List<DxWfProcessVO> getProcessList(@RequestBody DxWfProcessSearchVO processInstSearchVO) {
List<DxWfProcessVO> allProcess = new ArrayList<DxWfProcessVO>();
try {
allProcess = WfcProcessService.getAllProcess(processInstSearchVO);
} catch (Exception e) {
e.printStackTrace();
}
return allProcess;
}
@GetMapping({"/task/hisTaskList"})
//@ApiOperation("历史任务列表")
public List<DxWfProcessTaskVO> getHisTaskList(@RequestParam("instId") String instId, @RequestParam(value = "activityId",required = false) String activityId) {
List<DxWfProcessTaskVO> hisTaskList = new ArrayList<DxWfProcessTaskVO>();
try {
hisTaskList = WfcProcessService.getHisTaskList(instId);
} catch (Exception e) {
e.printStackTrace();
}
return hisTaskList;
}
@GetMapping({"/task/todo"})
//@ApiOperation("查询待办任务列表")
public List<DxWfProcessTaskVO> getTodoTaskList(@RequestParam("userName") String userName) {
List<DxWfProcessTaskVO> todoTaskList = new ArrayList<DxWfProcessTaskVO>();
try {
todoTaskList = WfcProcessService.getTodoTaskList(userName);
} catch (Exception e) {
e.printStackTrace();
}
return todoTaskList;
}
@GetMapping({"/task/countOfType"})
public Map<String, Integer> getTaskTypeAndCount(@RequestParam("userName") String userName) {
Map<String, Integer> resultMap = new HashMap<String, Integer>();
List<DxWfProcessTaskVO> todoTaskList = null;
try {
todoTaskList = WfcProcessService.getTodoTaskList(userName);
resultMap.put("todoTask", todoTaskList.size());
resultMap.put("forwardTask", 0);
resultMap.put("unClaimedTask", 0);
} catch (Exception e) {
e.printStackTrace();
}
return resultMap;
}
@GetMapping({"/task/finished"})
//@ApiOperation("查询已办任务列表")
public List<DxWfProcessTaskVO> getFinishedTaskList(DxWfProcessTaskSearchVO taskSearchVO, @RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int size) {
return null;
}
@GetMapping({"/inst/{instId}"})
//@ApiOperation("流程实例详情")
public DxWfProcessVO getProcessDetail(@PathVariable("instId") String instId) {
DxWfProcessVO processDetail = null;
try {
processDetail = WfcProcessService.getProcessDetail(instId);
} catch (Exception e) {
e.printStackTrace();
}
return processDetail;
}
@GetMapping({"/inst/{instId}/bizPBO"})
//@ApiOperation("查询流程业务对象PBO")
public Object getProcessBusinessObjectById(@PathVariable("instId") String instId) {
IdVO idVO = null;
try {
idVO = WfcProcessService.getProcessBusinessObjectById(instId);
} catch (Exception e) {
e.printStackTrace();
}
return idVO;
}
@GetMapping({"/task/{id}"})
//@ApiOperation("任务详情")
public DxWfProcessTaskVO getTaskDetail(@PathVariable String id) {
DxWfProcessTaskVO taskDetail = null;
try {
taskDetail = WfcProcessService.getTaskDetail(id);
} catch (Exception e) {
e.printStackTrace();
}
return taskDetail;
}
@PostMapping({"/template/operation"})
//@ApiOperation("常用操作的提交")
public ApiResult executeOperation(@RequestBody DxWfTaskOperationArgsVO operationArgsVO) {
try {
WfcProcessService.executeOperation(operationArgsVO);
} catch (Exception e) {
e.printStackTrace();
return ApiResult.error("501", "操作失败", e);
}
return ApiResult.ok((Object)null, "操作成功");
}
}
package com.yonde.wfc.service;
import com.yonde.basedata.search.SearchOperatorEnumUtil;
import com.yonde.basedata.vo.IdVO;
import com.yonde.common.ObjectsUtil;
import com.yonde.common.RfUtil;
import com.yonde.common.WTUserUtil;
import com.yonde.common.WorkflowUtil;
import com.yonde.doc.vo.DxDocumentVO;
import com.yonde.part.vo.DxPartVO;
import com.yonde.wfc.vo.DxWfProcessSearchVO;
import com.yonde.wfc.vo.DxWfProcessTaskVO;
import com.yonde.wfc.vo.DxWfProcessVO;
import com.yonde.wfc.vo.DxWfTaskOperationArgsVO;
import org.apache.commons.lang.StringUtils;
import wt.doc.WTDocument;
import wt.fc.Persistable;
import wt.fc.WTObject;
import wt.method.RemoteAccess;
import wt.method.RemoteMethodServer;
import wt.org.WTUser;
import wt.part.WTPart;
import wt.session.SessionContext;
import wt.session.SessionHelper;
import wt.util.WTException;
import wt.workflow.engine.WfProcess;
import wt.workflow.work.WorkItem;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
public class WfcProcessService implements RemoteAccess {
/**
* 获取对象所有流程
* @param processInstSearchVO
* @return
* @throws Exception
*/
public static List<DxWfProcessVO> getAllProcess(DxWfProcessSearchVO processInstSearchVO) throws Exception{
if (!RemoteMethodServer.ServerFlag) {
return (List<DxWfProcessVO>)RemoteMethodServer.getDefault().invoke("getAllProcess", WfcProcessService.class.getName(), null,
new Class[] { DxWfProcessSearchVO.class},
new Object[] { processInstSearchVO });
}
List<DxWfProcessVO> processVOList = new ArrayList<DxWfProcessVO>();
SessionContext previous = SessionContext.newContext();
try {
SessionHelper.manager.setAdministrator();
String pboClass = processInstSearchVO.getPboClass();
String prefix = SearchOperatorEnumUtil.typeStrPrefixMap.get(pboClass);
Long pboId = processInstSearchVO.getPboId();
WTObject wtObjectByOid = RfUtil.getWTObjectByOid("OR:" + prefix + pboId);
if (ObjectsUtil.nonNull(wtObjectByOid)) {
List<WfProcess> allProcess = WorkflowUtil.getAllProcess(wtObjectByOid);
for (WfProcess process : allProcess) {
DxWfProcessVO wfProcessVO = new DxWfProcessVO(process);
processVOList.add(wfProcessVO);
}
}
} finally {
SessionContext.setContext(previous);
}
return processVOList;
}
/**
* 获取流程详情
* @param instId
* @return
* @throws Exception
*/
public static DxWfProcessVO getProcessDetail(String instId) throws Exception {
if (!RemoteMethodServer.ServerFlag) {
return (DxWfProcessVO)RemoteMethodServer.getDefault().invoke("getProcessDetail", WfcProcessService.class.getName(), null,
new Class[] { String.class},
new Object[] { instId });
}
DxWfProcessVO wfProcessVO = null;
SessionContext previous = SessionContext.newContext();
try {
SessionHelper.manager.setAdministrator();
String workflowOid = "OR:wt.workflow.engine.WfProcess:" + instId;
WfProcess process = (WfProcess) RfUtil.getWTObjectByOid(workflowOid);
if (ObjectsUtil.nonNull(process)) {
wfProcessVO = new DxWfProcessVO(process);
}
} finally {
SessionContext.setContext(previous);
}
return wfProcessVO;
}
/**
* 获取流程主对象
* @param instId
* @return
* @throws Exception
*/
public static IdVO getProcessBusinessObjectById(String instId) throws Exception {
if (!RemoteMethodServer.ServerFlag) {
return (IdVO)RemoteMethodServer.getDefault().invoke("getProcessBusinessObjectById", WfcProcessService.class.getName(), null,
new Class[] { String.class},
new Object[] { instId });
}
IdVO objVO = null;
SessionContext previous = SessionContext.newContext();
try {
SessionHelper.manager.setAdministrator();
String workflowOid = "OR:wt.workflow.engine.WfProcess:" + instId;
WfProcess process = (WfProcess) RfUtil.getWTObjectByOid(workflowOid);
if (ObjectsUtil.nonNull(process)) {
Persistable pbo = (Persistable) process.getContext().getValue("primaryBusinessObject");
if (ObjectsUtil.nonNull(pbo)) {
if (pbo instanceof WTDocument) {
WTDocument document = (WTDocument) pbo;
objVO = new DxDocumentVO(document);
} else if (pbo instanceof WTPart) {
WTPart part = (WTPart) pbo;
objVO = new DxPartVO(part);
} else {
// TODO 其他类型
}
}
}
} finally {
SessionContext.setContext(previous);
}
return objVO;
}
/**
* 获取流程历史待办
* @param processId
* @return
* @throws Exception
*/
public static List<DxWfProcessTaskVO> getHisTaskList(String processId) throws Exception {
if (!RemoteMethodServer.ServerFlag) {
return (List<DxWfProcessTaskVO>)RemoteMethodServer.getDefault().invoke("getHisTaskList", WfcProcessService.class.getName(), null,
new Class[] { String.class},
new Object[] { processId });
}
List<DxWfProcessTaskVO> taskVOList = new ArrayList<DxWfProcessTaskVO>();
SessionContext previous = SessionContext.newContext();
try {
SessionHelper.manager.setAdministrator();
String workflowOid = "OR:wt.workflow.engine.WfProcess:" + processId;
WfProcess wtObjectByOid = (WfProcess) RfUtil.getWTObjectByOid(workflowOid);
if (ObjectsUtil.nonNull(wtObjectByOid)) {
List<WorkItem> workItemList = WorkflowUtil.getWorkItemByprocess(wtObjectByOid);
for (WorkItem wfActivity : workItemList) {
DxWfProcessTaskVO dxWfProcessTaskVO = new DxWfProcessTaskVO(wfActivity);
taskVOList.add(dxWfProcessTaskVO);
}
}
} finally {
SessionContext.setContext(previous);
}
return taskVOList;
}
/**
* 获取用户未完成待办
* @param userName
* @return
* @throws Exception
*/
public static List<DxWfProcessTaskVO> getTodoTaskList(String userName) throws Exception {
if (!RemoteMethodServer.ServerFlag) {
return (List<DxWfProcessTaskVO>)RemoteMethodServer.getDefault().invoke("getTodoTaskList", WfcProcessService.class.getName(), null,
new Class[] { String.class},
new Object[] { userName });
}
List<DxWfProcessTaskVO> taskVOList = new ArrayList<DxWfProcessTaskVO>();
SessionContext previous = SessionContext.newContext();
try {
SessionHelper.manager.setAdministrator();
WTUser user = WTUserUtil.getUser(userName);
List<WorkItem> userWorks = WorkflowUtil.getUserWorks(user);
for (WorkItem userWork : userWorks) {
DxWfProcessTaskVO dxWfProcessTaskVO = new DxWfProcessTaskVO(userWork);
taskVOList.add(dxWfProcessTaskVO);
}
} finally {
SessionContext.setContext(previous);
}
return taskVOList;
}
/**
* 获取待办详情
* @param id
* @return
* @throws Exception
*/
public static DxWfProcessTaskVO getTaskDetail(String id) throws Exception{
if (!RemoteMethodServer.ServerFlag) {
return (DxWfProcessTaskVO)RemoteMethodServer.getDefault().invoke("getTaskDetail", WfcProcessService.class.getName(), null,
new Class[] { String.class },
new Object[] { id });
}
SessionContext previous = SessionContext.newContext();
DxWfProcessTaskVO dxWfProcessTaskVO = null;
try {
SessionHelper.manager.setAdministrator();
String workItemOid = "OR:wt.workflow.work.WorkItem:" + id;
WorkItem workItem = (WorkItem) RfUtil.getWTObjectByOid(workItemOid);
if (ObjectsUtil.nonNull(workItem)) {
dxWfProcessTaskVO = new DxWfProcessTaskVO(workItem);
}
} finally {
SessionContext.setContext(previous);
}
return dxWfProcessTaskVO;
}
public static void executeOperation(DxWfTaskOperationArgsVO operationArgsVO) throws Exception {
if (!RemoteMethodServer.ServerFlag) {
RemoteMethodServer.getDefault().invoke("executeOperation", WfcProcessService.class.getName(), null,
new Class[] { DxWfTaskOperationArgsVO.class },
new Object[] { operationArgsVO });
return;
}
String operationName = operationArgsVO.getOperationName();
SessionContext previous = SessionContext.newContext();
try {
String userName = operationArgsVO.getOperator();
if (StringUtils.isNotEmpty(userName)) {
SessionHelper.manager.setPrincipal(userName);
} else {
SessionHelper.manager.setAdministrator();
}
String id = operationArgsVO.getId();
String workItemOid = "OR:wt.workflow.work.WorkItem:" + id;
WorkItem workItem = (WorkItem) RfUtil.getWTObjectByOid(workItemOid);
if ("completeTask".equalsIgnoreCase(operationName)) {
String description = operationArgsVO.getDescription();
String routerSelect = operationArgsVO.getRouterSelect();
Vector vector = null;
if (ObjectsUtil.nonNull(routerSelect)) {
vector = WorkflowUtil.toVector(routerSelect);
}
WorkflowUtil.completeTask(workItem,vector,description);
}
if ("delegateTask".equalsIgnoreCase(operationName)) {
String targetUserName = operationArgsVO.getTargetUserId();
WTUser user = WTUserUtil.getUser(targetUserName);
if (ObjectsUtil.isNull(user)) {
throw new WTException(targetUserName + "用户在PDM系统中不存在!");
}
WorkflowUtil.reAssignWorkItem(workItem, user, "");
}
} finally {
SessionContext.setContext(previous);
}
}
}
package com.yonde.wfc.vo;
import com.yonde.common.WorkflowUtil;
import wt.doc.WTDocument;
import wt.fc.Persistable;
import wt.part.WTPart;
import wt.workflow.engine.WfProcess;
import wt.workflow.engine.WfTemplateProcessor;
import java.io.Serializable;
import java.util.Map;
public class DxWfBizExtInfo implements Serializable {
private String taskTitle;
private String processTitle;
private String bizObjectState;
private String bizTitle;
private Map<String, Object> bizAttrValues;
private String bizConfig;
public DxWfBizExtInfo() {
}
public DxWfBizExtInfo(String taskTitle, String processTitle, String bizObjectState) {
this.taskTitle = taskTitle;
this.processTitle = processTitle;
this.bizObjectState = bizObjectState;
}
public DxWfBizExtInfo(WfProcess process) {
Persistable pbo = WorkflowUtil.getPBO(process);
String taskTitle = "";
if (pbo instanceof WTDocument) {
WTDocument document = (WTDocument) pbo;
taskTitle = document.getName() + "_" + document.getNumber();
this.bizObjectState = document.getState().toString();
} else if (pbo instanceof WTPart) {
WTPart part = (WTPart) pbo;
taskTitle = part.getName() + "_" + part.getNumber();
this.bizObjectState = part.getState().toString();
} else {
// TODO 更改单 等
}
this.taskTitle = taskTitle;
String processName = process.getTemplate().getName();
this.processTitle = processName + "_" + taskTitle;
}
public String getTaskTitle() {
return taskTitle;
}
public void setTaskTitle(String taskTitle) {
this.taskTitle = taskTitle;
}
public String getProcessTitle() {
return processTitle;
}
public void setProcessTitle(String processTitle) {
this.processTitle = processTitle;
}
public String getBizObjectState() {
return bizObjectState;
}
public void setBizObjectState(String bizObjectState) {
this.bizObjectState = bizObjectState;
}
public String getBizTitle() {
return bizTitle;
}
public void setBizTitle(String bizTitle) {
this.bizTitle = bizTitle;
}
public Map<String, Object> getBizAttrValues() {
return bizAttrValues;
}
public void setBizAttrValues(Map<String, Object> bizAttrValues) {
this.bizAttrValues = bizAttrValues;
}
public String getBizConfig() {
return bizConfig;
}
public void setBizConfig(String bizConfig) {
this.bizConfig = bizConfig;
}
}
package com.yonde.wfc.vo;
import wt.project.Role;
import java.io.Serializable;
import java.util.Locale;
public class DxWfParticipantInfoExtVO implements Serializable {
private static final long serialVersionUID = 1L;
private String dxClassname = "com.yonde.dex.wfc.common.vo.extension.DxWfParticipantInfoExtVO";
private String pluginName;
private String pluginContent;
private String pluginShowContent;
/** @deprecated */
@Deprecated
private Boolean isRequired;
public DxWfParticipantInfoExtVO() {
}
public DxWfParticipantInfoExtVO(Role role) {
this.pluginShowContent = role.getDisplay(Locale.SIMPLIFIED_CHINESE);
this.pluginContent = role.getDisplay();
this.pluginName = role.getStringValue();
}
public String getDxClassname() {
return dxClassname;
}
public void setDxClassname(String dxClassname) {
this.dxClassname = dxClassname;
}
public String getPluginName() {
return pluginName;
}
public void setPluginName(String pluginName) {
this.pluginName = pluginName;
}
public String getPluginContent() {
return pluginContent;
}
public void setPluginContent(String pluginContent) {
this.pluginContent = pluginContent;
}
public String getPluginShowContent() {
return pluginShowContent;
}
public void setPluginShowContent(String pluginShowContent) {
this.pluginShowContent = pluginShowContent;
}
public Boolean getRequired() {
return isRequired;
}
public void setRequired(Boolean required) {
isRequired = required;
}
}
package com.yonde.wfc.vo;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class DxWfProcessSearchVO implements Serializable {
private String procInstId;
//private ProcessStateEnum state;
private String name;
private String modelName;
private List<String> processDefId;
private String processDefKey;
private String startedUserId;
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private Date gmtCreateStart;
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private Date gmtCreateEnd;
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private Date gmtFinishStart;
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private Date gmtFinishEnd;
private Boolean hasTimeout;
private List<String> pbos;
private String pbo;
private String pboClass;
private Long pboId;
private List<String> appNames;
private String category;
private Boolean checkOwnerSignAddFlag = false;
public String getProcInstId() {
return procInstId;
}
public void setProcInstId(String procInstId) {
this.procInstId = procInstId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getModelName() {
return modelName;
}
public void setModelName(String modelName) {
this.modelName = modelName;
}
public List<String> getProcessDefId() {
return processDefId;
}
public void setProcessDefId(List<String> processDefId) {
this.processDefId = processDefId;
}
public String getProcessDefKey() {
return processDefKey;
}
public void setProcessDefKey(String processDefKey) {
this.processDefKey = processDefKey;
}
public String getStartedUserId() {
return startedUserId;
}
public void setStartedUserId(String startedUserId) {
this.startedUserId = startedUserId;
}
public Date getGmtCreateStart() {
return gmtCreateStart;
}
public void setGmtCreateStart(Date gmtCreateStart) {
this.gmtCreateStart = gmtCreateStart;
}
public Date getGmtCreateEnd() {
return gmtCreateEnd;
}
public void setGmtCreateEnd(Date gmtCreateEnd) {
this.gmtCreateEnd = gmtCreateEnd;
}
public Date getGmtFinishStart() {
return gmtFinishStart;
}
public void setGmtFinishStart(Date gmtFinishStart) {
this.gmtFinishStart = gmtFinishStart;
}
public Date getGmtFinishEnd() {
return gmtFinishEnd;
}
public void setGmtFinishEnd(Date gmtFinishEnd) {
this.gmtFinishEnd = gmtFinishEnd;
}
public Boolean getHasTimeout() {
return hasTimeout;
}
public void setHasTimeout(Boolean hasTimeout) {
this.hasTimeout = hasTimeout;
}
public List<String> getPbos() {
return pbos;
}
public void setPbos(List<String> pbos) {
this.pbos = pbos;
}
public String getPbo() {
return pbo;
}
public void setPbo(String pbo) {
this.pbo = pbo;
}
public String getPboClass() {
return pboClass;
}
public void setPboClass(String pboClass) {
this.pboClass = pboClass;
}
public Long getPboId() {
return pboId;
}
public void setPboId(Long pboId) {
this.pboId = pboId;
}
public List<String> getAppNames() {
return appNames;
}
public void setAppNames(List<String> appNames) {
this.appNames = appNames;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public Boolean getCheckOwnerSignAddFlag() {
return checkOwnerSignAddFlag;
}
public void setCheckOwnerSignAddFlag(Boolean checkOwnerSignAddFlag) {
this.checkOwnerSignAddFlag = checkOwnerSignAddFlag;
}
}
package com.yonde.wfc.vo;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class DxWfProcessTaskSearchVO implements Serializable {
//TaskQueryTypeEnum taskQueryType;
private String procInstId;
private String processInstName;
private String taskName;
private String assignee;
//private TaskStateEnum taskState;
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private Date receiveTime1;
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private Date receiveTime2;
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private Date finishTime1;
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private Date finishTime2;
private Boolean hasTimeout;
private List<String> pbos;
private String pbo;
private String pboClass;
private Long pboId;
private String pboStatus;
private String taskDefinitionKey;
private List<String> taskDefinitionKeys;
private List<String> processDefKey;
private List<String> appNames;
private List<String> categorys;
private String proxyUser;
}
package com.yonde.wfc.vo;
import com.ptc.core.components.rendering.guicomponents.DateDisplayComponent;
import com.ptc.core.components.rendering.guicomponents.TextDisplayComponent;
import com.ptc.windchill.enterprise.workflow.WorkflowDataUtility;
import com.yonde.common.DateTimeUtil;
import com.yonde.common.ObjectsUtil;
import com.yonde.common.WorkflowUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import wt.fc.Persistable;
import wt.fc.PersistenceHelper;
import wt.org.WTPrincipalReference;
import wt.project.Role;
import wt.team.TeamTemplateReference;
import wt.util.WTException;
import wt.workflow.definer.WfProcessTemplate;
import wt.workflow.engine.WfActivity;
import wt.workflow.engine.WfProcess;
import wt.workflow.work.WorkItem;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.*;
public class DxWfProcessTaskVO implements Serializable {
private String state;
private String id;
private String startTime;
private String endTime;
private String description;
private String assignee;
private String assigneeName;
private String resolver;
private String resolverName;
private String name;
private String aliasName;
private String owner;
private String deleteReason;
private String processDefinitionId;
private String procDefKey;
private String procDefName;
private DxWfProcessVO processVO;
private String taskType = "NORMAL";
private String dueDate;
private Long expireTimeInMillis;
private String taskDefinitionKey;
private Integer priority;
private String processInstanceId;
private String processInstanceName;
private String result;
private List<String> attachments;
private List<String> comments = new ArrayList<String>();
private Long costTimeInMillis;
private List<DxWfRouteExtInfoVO> routes;
//private List<DxWfTaskExtFormInfoVO> formInfo;
//private NodeTypeEnum nodeType;
//private List<DxWfOperationPluginExtVO> operationInfo;
private Object primaryBusinessObject;
private String instruction;
private String layoutId = "defaultInfo";
private List<String> lastComments;
private DxWfBizExtInfo bizExtInfo;
//private DxWfTaskExtRelationInfoVO DxWfTaskExtRelationInfoVO;
private String parentTaskId;
private boolean forwardFlag;
private boolean withdrawFlag;
private boolean unClaimedFlag = false;
private String businessKey;
private String pboClass;
private String pboId;
private DxWfParticipantInfoExtVO participantInfo;
//private List<DxWfTaskApprovalObjectVO> approvalObject;
private List<DxWfTaskOtherFormInfoVO> otherFormInfo = new ArrayList<DxWfTaskOtherFormInfoVO>();;
private String delegationState;
public DxWfProcessTaskVO() {
}
public DxWfProcessTaskVO(WorkItem workItem) throws Exception {
this.id = String.valueOf(PersistenceHelper.getObjectIdentifier(workItem).getId());
// 根据workItem获取流程对象
WfProcess process = WorkflowUtil.getWfProcess(workItem);
WfProcessTemplate template = (WfProcessTemplate) process.getTemplate().getObject();
this.procDefName = template.getName();
this.procDefKey = template.getIdentity();
this.processDefinitionId = String.valueOf(PersistenceHelper.getObjectIdentifier(template).getId());
this.processInstanceId = String.valueOf(PersistenceHelper.getObjectIdentifier(process).getId());
this.processInstanceName = process.getName();
WfActivity wfActivity = (WfActivity) workItem.getSource().getObject();
this.name = wfActivity.getName();
this.aliasName = wfActivity.getName();
this.taskDefinitionKey = String.valueOf(PersistenceHelper.getObjectIdentifier(wfActivity).getId());
this.state = wfActivity.getState().toString();
WTPrincipalReference owner = workItem.getOwnership().getOwner();
if (owner != null) {
this.assignee = String.valueOf(PersistenceHelper.getObjectIdentifier(owner.getObject()).getId());
this.assigneeName = owner.getFullName();
}
String remark = "";
try {
remark = wfActivity.getContext().getValue("remark").toString();
} catch (Exception e) {
remark = "";
}
if (StringUtils.isEmpty(remark)) {
remark = workItem.getDescription();
remark = remark == null?"":remark.trim();
comments.add(remark);
}
this.startTime = DateTimeUtil.timeStampToString(wfActivity.getStartTime());
WorkflowDataUtility wdu = new WorkflowDataUtility();
// 处理当前任务未完成时,后台反馈给前台的结束时间未: 0000-00-00 00:00
if (null == wfActivity.getEndTime()) {
Object workCompletedDate = wdu.getDataValue("workCompletedDate", workItem, null);
if (workCompletedDate != null) {
Timestamp endTimeStamp = new Timestamp(((DateDisplayComponent) workCompletedDate).getValue().getTime());
String completedDate = DateTimeUtil.timeStampToString(endTimeStamp);
String workVote = ((TextDisplayComponent) wdu.getDataValue("workVote", workItem, null)).getValue();
this.result = workVote==null?"":workVote.trim();
this.endTime = completedDate;
}
} else {
Object workCompletedDate = wdu.getDataValue("workCompletedDate", workItem, null);
if (workCompletedDate != null) {
Timestamp endTimeStamp = new Timestamp(((DateDisplayComponent) workCompletedDate).getValue().getTime());
String completedDate = DateTimeUtil.timeStampToString(endTimeStamp);
this.endTime = completedDate;
} else {
this.endTime = DateTimeUtil.timeStampToString(wfActivity.getEndTime());
}
}
Role role = workItem.getRole();
if (ObjectsUtil.nonNull(role)) {
this.participantInfo = new DxWfParticipantInfoExtVO(role);
}
//路由
List voteList = WorkflowUtil.getVoteList(workItem);
if (CollectionUtils.isNotEmpty(voteList)) {
List<DxWfRouteExtInfoVO> routeList = new ArrayList<DxWfRouteExtInfoVO>();
for (Object o : voteList) {
DxWfRouteExtInfoVO routeExtInfoVO = new DxWfRouteExtInfoVO((String) o);
if (routeList.size() == 0) {
routeExtInfoVO.setDefault(true);
}
routeList.add(routeExtInfoVO);
}
this.routes = routeList;
}
DxWfBizExtInfo dxWfBizExtInfo = new DxWfBizExtInfo(process);
this.bizExtInfo = dxWfBizExtInfo;
//添加其他tab页
otherFormInfo.add(new DxWfTaskOtherFormInfoVO("流程历史", "DxDocumentProcessHistory"));
// TODO 流程图先隐藏
//otherFormInfo.add(new DxWfTaskOtherFormInfoVO("流程图", "processTracking"));
}
public DxWfProcessTaskVO(WfActivity wfActivity) throws WTException {
this.name = wfActivity.getName();
this.aliasName = wfActivity.getName();
//this.assigneeName = wfActivity.get
//List<WorkItem> workItems = WorkflowUtil.getWorkItems(wfActivity);
//List<AccsUser> accsUsers = new ArrayList<AccsUser>();
//List<AccsRole> roles = new ArrayList<>();
/*for (WorkItem workItem : workItems) {
//流程正在运行活动只处理未完成活动
WfAssignment wfAssignment = (WfAssignment) workItem.getParentWA().getObject();
if (StringUtils.equalsIgnoreCase(wfAssignment.getStatus().getDisplay(), LifeCycleState.STATE)) {
if (StringUtils.isBlank(workItem.getCompletedBy())) {
continue;
}
}
WTPrincipalReference wtPrincipalReference = workItem.getOwnership().getOwner();
if (wtPrincipalReference != null) {
// 活动负责人
WTPrincipal principal = wtPrincipalReference.getPrincipal();
//AccsUser accsUser = toEntity(principal);
//accsUserMap.put(accsUser.getOid(), accsUser);
//accsUsers.add(accsUser);
// 活动角色
Role role = workItem.getRole();
if (role != null) {
//AccsRole accsRole = toEntity(role);
//roleMap.put(accsRole.getName(), accsRole);
//roles.add(accsRole);
}
}
}*/
}
public DxWfBizExtInfo getBizExtInfo() {
return bizExtInfo;
}
public void setBizExtInfo(DxWfBizExtInfo bizExtInfo) {
this.bizExtInfo = bizExtInfo;
}
public List<DxWfTaskOtherFormInfoVO> getOtherFormInfo() {
return otherFormInfo;
}
public void setOtherFormInfo(List<DxWfTaskOtherFormInfoVO> otherFormInfo) {
this.otherFormInfo = otherFormInfo;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAssignee() {
return assignee;
}
public void setAssignee(String assignee) {
this.assignee = assignee;
}
public String getAssigneeName() {
return assigneeName;
}
public void setAssigneeName(String assigneeName) {
this.assigneeName = assigneeName;
}
public String getResolver() {
return resolver;
}
public void setResolver(String resolver) {
this.resolver = resolver;
}
public String getResolverName() {
return resolverName;
}
public void setResolverName(String resolverName) {
this.resolverName = resolverName;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAliasName() {
return aliasName;
}
public void setAliasName(String aliasName) {
this.aliasName = aliasName;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getDeleteReason() {
return deleteReason;
}
public void setDeleteReason(String deleteReason) {
this.deleteReason = deleteReason;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public String getProcDefKey() {
return procDefKey;
}
public void setProcDefKey(String procDefKey) {
this.procDefKey = procDefKey;
}
public String getProcDefName() {
return procDefName;
}
public void setProcDefName(String procDefName) {
this.procDefName = procDefName;
}
public DxWfProcessVO getProcessVO() {
return processVO;
}
public void setProcessVO(DxWfProcessVO processVO) {
this.processVO = processVO;
}
public String getTaskType() {
return taskType;
}
public void setTaskType(String taskType) {
this.taskType = taskType;
}
public String getDueDate() {
return dueDate;
}
public void setDueDate(String dueDate) {
this.dueDate = dueDate;
}
public Long getExpireTimeInMillis() {
return expireTimeInMillis;
}
public void setExpireTimeInMillis(Long expireTimeInMillis) {
this.expireTimeInMillis = expireTimeInMillis;
}
public String getTaskDefinitionKey() {
return taskDefinitionKey;
}
public void setTaskDefinitionKey(String taskDefinitionKey) {
this.taskDefinitionKey = taskDefinitionKey;
}
public Integer getPriority() {
return priority;
}
public void setPriority(Integer priority) {
this.priority = priority;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getProcessInstanceName() {
return processInstanceName;
}
public void setProcessInstanceName(String processInstanceName) {
this.processInstanceName = processInstanceName;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public List<String> getAttachments() {
return attachments;
}
public void setAttachments(List<String> attachments) {
this.attachments = attachments;
}
public List<String> getComments() {
return comments;
}
public void setComments(List<String> comments) {
this.comments = comments;
}
public Long getCostTimeInMillis() {
return costTimeInMillis;
}
public void setCostTimeInMillis(Long costTimeInMillis) {
this.costTimeInMillis = costTimeInMillis;
}
public List<DxWfRouteExtInfoVO> getRoutes() {
return routes;
}
public void setRoutes(List<DxWfRouteExtInfoVO> routes) {
this.routes = routes;
}
public Object getPrimaryBusinessObject() {
return primaryBusinessObject;
}
public void setPrimaryBusinessObject(Object primaryBusinessObject) {
this.primaryBusinessObject = primaryBusinessObject;
}
public String getInstruction() {
return instruction;
}
public void setInstruction(String instruction) {
this.instruction = instruction;
}
public String getLayoutId() {
return layoutId;
}
public void setLayoutId(String layoutId) {
this.layoutId = layoutId;
}
public List<String> getLastComments() {
return lastComments;
}
public void setLastComments(List<String> lastComments) {
this.lastComments = lastComments;
}
public String getParentTaskId() {
return parentTaskId;
}
public void setParentTaskId(String parentTaskId) {
this.parentTaskId = parentTaskId;
}
public boolean isForwardFlag() {
return forwardFlag;
}
public void setForwardFlag(boolean forwardFlag) {
this.forwardFlag = forwardFlag;
}
public boolean isWithdrawFlag() {
return withdrawFlag;
}
public void setWithdrawFlag(boolean withdrawFlag) {
this.withdrawFlag = withdrawFlag;
}
public boolean isUnClaimedFlag() {
return unClaimedFlag;
}
public void setUnClaimedFlag(boolean unClaimedFlag) {
this.unClaimedFlag = unClaimedFlag;
}
public String getBusinessKey() {
return businessKey;
}
public void setBusinessKey(String businessKey) {
this.businessKey = businessKey;
}
public String getPboClass() {
return pboClass;
}
public void setPboClass(String pboClass) {
this.pboClass = pboClass;
}
public String getPboId() {
return pboId;
}
public void setPboId(String pboId) {
this.pboId = pboId;
}
public DxWfParticipantInfoExtVO getParticipantInfo() {
return participantInfo;
}
public void setParticipantInfo(DxWfParticipantInfoExtVO participantInfo) {
this.participantInfo = participantInfo;
}
public String getDelegationState() {
return delegationState;
}
public void setDelegationState(String delegationState) {
this.delegationState = delegationState;
}
}
package com.yonde.wfc.vo;
import com.yonde.basedata.search.SearchOperatorEnumUtil;
import com.yonde.common.DateTimeUtil;
import com.yonde.common.ObjectsUtil;
import wt.fc.Persistable;
import wt.fc.PersistenceHelper;
import wt.util.WTException;
import wt.workflow.definer.WfProcessTemplate;
import wt.workflow.engine.WfProcess;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Locale;
public class DxWfProcessVO implements Serializable {
private String id;
private String name;
private String businessKey;
private String businessName;
private String status;
private String procDefId;
private String procDefKey;
private String procDefName;
private String procDefVersion;
private String owner;
private String ownerName;
private String gmtCreate;
private String gmtFinished;
private Long costTimeInMillis;
private Long expireTimeInMillis;
private String dueDate;
//private DxWfBizExtInfo bizExtInfo;
private String pboClass;
private String pboId;
private String appName;
private String category;
private boolean ownerSignAddFlag;
private String businessStatus;
public DxWfProcessVO() {
}
public DxWfProcessVO(WfProcess process) throws WTException {
if (process == null) {
return;
}
this.id = String.valueOf(PersistenceHelper.getObjectIdentifier(process).getId());
this.name = process.getName();
this.status = process.getState().getDisplay(Locale.CHINA);
this.businessStatus = process.getState().toString();
this.owner = String.valueOf(PersistenceHelper.getObjectIdentifier(process.getCreator().getObject()).getId());
this.ownerName = process.getCreator().getDisplayName();
Persistable pbo = (Persistable) process.getContext().getValue("primaryBusinessObject");
this.pboId = String.valueOf(PersistenceHelper.getObjectIdentifier(pbo).getId());
this.pboClass = SearchOperatorEnumUtil.typeItemMap.get(pbo.getClass());
WfProcessTemplate template = (WfProcessTemplate) process.getTemplate().getObject();
this.procDefName = template.getName();
this.procDefKey = template.getIdentity();
this.procDefId = String.valueOf(PersistenceHelper.getObjectIdentifier(template).getId());
this.gmtCreate = DateTimeUtil.timeStampToString(process.getCreateTimestamp());
Timestamp endTime = process.getEndTime();
if (ObjectsUtil.nonNull(endTime)) {
this.gmtFinished = DateTimeUtil.timeStampToString(endTime);
this.dueDate = this.gmtFinished;
}
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBusinessKey() {
return businessKey;
}
public void setBusinessKey(String businessKey) {
this.businessKey = businessKey;
}
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getProcDefId() {
return procDefId;
}
public void setProcDefId(String procDefId) {
this.procDefId = procDefId;
}
public String getProcDefKey() {
return procDefKey;
}
public void setProcDefKey(String procDefKey) {
this.procDefKey = procDefKey;
}
public String getProcDefName() {
return procDefName;
}
public void setProcDefName(String procDefName) {
this.procDefName = procDefName;
}
public String getProcDefVersion() {
return procDefVersion;
}
public void setProcDefVersion(String procDefVersion) {
this.procDefVersion = procDefVersion;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public Long getCostTimeInMillis() {
return costTimeInMillis;
}
public void setCostTimeInMillis(Long costTimeInMillis) {
this.costTimeInMillis = costTimeInMillis;
}
public Long getExpireTimeInMillis() {
return expireTimeInMillis;
}
public void setExpireTimeInMillis(Long expireTimeInMillis) {
this.expireTimeInMillis = expireTimeInMillis;
}
public String getPboClass() {
return pboClass;
}
public void setPboClass(String pboClass) {
this.pboClass = pboClass;
}
public String getPboId() {
return pboId;
}
public void setPboId(String pboId) {
this.pboId = pboId;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public boolean isOwnerSignAddFlag() {
return ownerSignAddFlag;
}
public void setOwnerSignAddFlag(boolean ownerSignAddFlag) {
this.ownerSignAddFlag = ownerSignAddFlag;
}
public String getBusinessStatus() {
return businessStatus;
}
public void setBusinessStatus(String businessStatus) {
this.businessStatus = businessStatus;
}
public String getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
public String getGmtFinished() {
return gmtFinished;
}
public void setGmtFinished(String gmtFinished) {
this.gmtFinished = gmtFinished;
}
public String getDueDate() {
return dueDate;
}
public void setDueDate(String dueDate) {
this.dueDate = dueDate;
}
}
package com.yonde.wfc.vo;
import java.io.Serializable;
public class DxWfRouteExtInfoVO implements Serializable {
private String dxClassname = "com.yonde.dex.wfc.common.vo.extension.DxWfRouteExtInfoVO";
private String name;
private String displayName;
//private RouteActionTypeEnum routeActionType;
private Boolean isDefault = false;
private Boolean isCheckForm = false;
private Boolean isCheckParticipant = false;
//private List<DxWfTaskExtServiceMappingVO> serviceMappings;
public DxWfRouteExtInfoVO() {
}
public DxWfRouteExtInfoVO(String name) {
this.name = name;
this.displayName = name;
if (!"驳回".equals(name) && !"取消".equals(name)) {
this.isCheckParticipant = true;
}
}
public String getDxClassname() {
return dxClassname;
}
public void setDxClassname(String dxClassname) {
this.dxClassname = dxClassname;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public Boolean getDefault() {
return isDefault;
}
public void setDefault(Boolean aDefault) {
isDefault = aDefault;
}
public Boolean getCheckForm() {
return isCheckForm;
}
public void setCheckForm(Boolean checkForm) {
isCheckForm = checkForm;
}
public Boolean getCheckParticipant() {
return isCheckParticipant;
}
public void setCheckParticipant(Boolean checkParticipant) {
isCheckParticipant = checkParticipant;
}
}
package com.yonde.wfc.vo;
import java.io.Serializable;
import java.util.Map;
public class DxWfTaskOperationArgsVO implements Serializable {
private String operationName;
private String routerSelect;
private String taskDefinitionKey;
private String processDefinitionId;
private String processInstId;
private String description;
private String operator;
private String targetUserId;
private String id;
private Map<String, Object> participants;
private Map<String, Object> variables;
private Boolean isBefore;
public DxWfTaskOperationArgsVO() {
}
public String getOperationName() {
return operationName;
}
public void setOperationName(String operationName) {
this.operationName = operationName;
}
public String getRouterSelect() {
return routerSelect;
}
public void setRouterSelect(String routerSelect) {
this.routerSelect = routerSelect;
}
public String getTaskDefinitionKey() {
return taskDefinitionKey;
}
public void setTaskDefinitionKey(String taskDefinitionKey) {
this.taskDefinitionKey = taskDefinitionKey;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public String getProcessInstId() {
return processInstId;
}
public void setProcessInstId(String processInstId) {
this.processInstId = processInstId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public String getTargetUserId() {
return targetUserId;
}
public void setTargetUserId(String targetUserId) {
this.targetUserId = targetUserId;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Map<String, Object> getParticipants() {
return participants;
}
public void setParticipants(Map<String, Object> participants) {
this.participants = participants;
}
public Map<String, Object> getVariables() {
return variables;
}
public void setVariables(Map<String, Object> variables) {
this.variables = variables;
}
public Boolean getIsBefore() {
return isBefore;
}
public void setBefore(Boolean before) {
isBefore = before;
}
}
package com.yonde.wfc.vo;
import java.io.Serializable;
public class DxWfTaskOtherFormInfoVO implements Serializable {
private String tabName;
private String configName;
private Boolean isInner = true;
private Boolean isShow = true;
private String webServerName;
private String comType;
private String dxClassname = "com.yonde.dex.wfc.common.vo.extension.DxWfTaskOtherFormInfoVO";
public DxWfTaskOtherFormInfoVO() {
}
public DxWfTaskOtherFormInfoVO(String tabName, String configName) {
this.tabName = tabName;
this.configName = configName;
}
public String getTabName() {
return tabName;
}
public void setTabName(String tabName) {
this.tabName = tabName;
}
public String getConfigName() {
return configName;
}
public void setConfigName(String configName) {
this.configName = configName;
}
public Boolean getIsInner() {
return isInner;
}
public void setInner(Boolean inner) {
isInner = inner;
}
public Boolean getIsShow() {
return isShow;
}
public void setShow(Boolean show) {
isShow = show;
}
public String getWebServerName() {
return webServerName;
}
public void setWebServerName(String webServerName) {
this.webServerName = webServerName;
}
public String getComType() {
return comType;
}
public void setComType(String comType) {
this.comType = comType;
}
public String getDxClassname() {
return dxClassname;
}
public void setDxClassname(String dxClassname) {
this.dxClassname = dxClassname;
}
}
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