Commit a13aef6d authored by shyWang's avatar shyWang

PDM前端改造

转试图问题处理,分页
parent 28ec9090
...@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
public class AbstractBaseController { public class AbstractBaseController {
...@@ -30,9 +31,9 @@ public class AbstractBaseController { ...@@ -30,9 +31,9 @@ public class AbstractBaseController {
//@ApiOperation("配置规范查询") //@ApiOperation("配置规范查询")
@PostMapping({"findBySpec"}) @PostMapping({"findBySpec"})
List<IdVO> findByConfigSpec(@RequestBody SearchQueryCondition specSearch) { Map<String, Object> findByConfigSpec(@RequestBody SearchQueryCondition specSearch) {
try { try {
List<IdVO> partVOS = BaseSearchService.findByConfigSpecSelect(specSearch); Map<String, Object> partVOS = BaseSearchService.findByConfigSpecSelect(specSearch);
return partVOS; return partVOS;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -42,9 +43,9 @@ public class AbstractBaseController { ...@@ -42,9 +43,9 @@ public class AbstractBaseController {
//@ApiOperation("深度查询") //@ApiOperation("深度查询")
@PostMapping({"find/recursion"}) @PostMapping({"find/recursion"})
List<IdVO> findRecursion(@RequestBody SearchQueryCondition specSearch) { Map<String, Object> findRecursion(@RequestBody SearchQueryCondition specSearch) {
try { try {
List<IdVO> partVOS = BaseSearchService.findByConfigSpecSelect(specSearch); Map<String, Object> partVOS = BaseSearchService.findByConfigSpecSelect(specSearch);
return partVOS; return partVOS;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -19,6 +19,7 @@ import wt.content.ApplicationData; ...@@ -19,6 +19,7 @@ import wt.content.ApplicationData;
import wt.content.ContentHolder; import wt.content.ContentHolder;
import wt.content.ContentRoleType; import wt.content.ContentRoleType;
import wt.doc.WTDocument; import wt.doc.WTDocument;
import wt.fc.PagingQueryResult;
import wt.fc.WTObject; import wt.fc.WTObject;
import wt.log4j.LogR; import wt.log4j.LogR;
import wt.method.RemoteAccess; import wt.method.RemoteAccess;
...@@ -29,7 +30,10 @@ import wt.session.SessionHelper; ...@@ -29,7 +30,10 @@ import wt.session.SessionHelper;
import wt.util.WTProperties; import wt.util.WTProperties;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class BaseSearchService <V extends IdVO> implements RemoteAccess { public class BaseSearchService <V extends IdVO> implements RemoteAccess {
...@@ -56,16 +60,33 @@ public class BaseSearchService <V extends IdVO> implements RemoteAccess { ...@@ -56,16 +60,33 @@ public class BaseSearchService <V extends IdVO> implements RemoteAccess {
return null; return null;
} }
public static List findByConfigSpecSelect (SearchQueryCondition searchQueryCondition) throws Exception { public static Map<String, Object> findByConfigSpecSelect (SearchQueryCondition searchQueryCondition) throws Exception {
if (!RemoteMethodServer.ServerFlag) { if (!RemoteMethodServer.ServerFlag) {
return (List) RemoteMethodServer.getDefault().invoke("findByConfigSpecSelect", BaseSearchService.class.getName(), null, return (Map) RemoteMethodServer.getDefault().invoke("findByConfigSpecSelect", BaseSearchService.class.getName(), null,
new Class[] { SearchQueryCondition.class}, new Class[] { SearchQueryCondition.class},
new Object[] { searchQueryCondition}); new Object[] { searchQueryCondition});
} }
logger.error("findByConfigSpecSelect===111" + searchQueryCondition.toString()); logger.error("findByConfigSpecSelect===111" + searchQueryCondition.toString());
Map<String, Object> resultMap = new HashMap<String, Object>();
List<IdVO> partList = DxSearchUtil.findByConfigSpecSelect(searchQueryCondition);; List<String> indices = searchQueryCondition.getIndices();
return partList; PagingQueryResult queryResult = DxSearchUtil.findByConfigSpecSelect(searchQueryCondition);
logger.error("ResultSize====" + queryResult.size());
List partList = new ArrayList();
while (queryResult.hasMoreElements()) {
Object element = queryResult.nextElement();
WTObject o = null;
logger.error("[]=====arrysList" + element);
if (element instanceof Object[]) {
Object[] objects = (Object[]) element;
o = (WTObject) objects[0];
} else {
o = (WTObject) element;
}
DxSearchUtil.buildQueryResult(o, partList, indices);
}
resultMap.put("totalSize", queryResult.getTotalSize());
resultMap.put("result", partList);
return resultMap;
} }
public static boolean delObjByIds(List<String> ids, Class<?> cls) throws Exception { public static boolean delObjByIds(List<String> ids, Class<?> cls) throws Exception {
if (!RemoteMethodServer.ServerFlag) { if (!RemoteMethodServer.ServerFlag) {
......
package com.yonde.basedata.vo.lc; package com.yonde.basedata.vo.lc;
public class LifecycleStateVO { import com.yonde.basedata.vo.IdVO;
import java.io.Serializable;
public class LifecycleStateVO extends IdVO implements Serializable {
//@ApiModelProperty("对应字典code")
private String keyCode;
//@ApiModelProperty("对应字典项code")
private String code;
//@ApiModelProperty("是否起始节点")
private Boolean isStart;
/* @ApiModelProperty("所属模板id")
@NotNull(
message = "节点必须属于某个模板"
)*/
private Long lifecycleTemplateId;
public String getKeyCode() {
return keyCode;
}
public void setKeyCode(String keyCode) {
this.keyCode = keyCode;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Boolean getStart() {
return isStart;
}
public void setStart(Boolean start) {
isStart = start;
}
public Long getLifecycleTemplateId() {
return lifecycleTemplateId;
}
public void setLifecycleTemplateId(Long lifecycleTemplateId) {
this.lifecycleTemplateId = lifecycleTemplateId;
}
} }
package com.yonde.basedata.vo.lc; package com.yonde.basedata.vo.lc;
import com.yonde.basedata.vo.IdVO;
import wt.lifecycle.LifeCycleTemplate;
import java.io.Serializable;
import java.util.List; import java.util.List;
public class LifecycleTemplateVO { public class LifecycleTemplateVO extends IdVO implements Serializable {
//@ApiModelProperty("描述") //@ApiModelProperty("描述")
private String description; private String description;
...@@ -10,14 +14,48 @@ public class LifecycleTemplateVO { ...@@ -10,14 +14,48 @@ public class LifecycleTemplateVO {
private Boolean enable; private Boolean enable;
//@ApiModelProperty("状态变化流程图描述") //@ApiModelProperty("状态变化流程图描述")
private String layout; private String layout;
/* @XmlElementProperty(
name = "stateVos",
isList = true
)*/
private List<LifecycleStateVO> stateVos; private List<LifecycleStateVO> stateVos;
/* @XmlElementProperty( /* @XmlElementProperty(
name = "stateTraceVos", name = "stateTraceVos",
isList = true isList = true
)*/ )*/
//private List<LifecycleStateTraceVO> stateTraceVos; //private List<LifecycleStateTraceVO> stateTraceVos;
public LifecycleTemplateVO(LifeCycleTemplate lifeCycleTemplate) {
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Boolean getEnable() {
return enable;
}
public void setEnable(Boolean enable) {
this.enable = enable;
}
public String getLayout() {
return layout;
}
public void setLayout(String layout) {
this.layout = layout;
}
public List<LifecycleStateVO> getStateVos() {
return stateVos;
}
public void setStateVos(List<LifecycleStateVO> stateVos) {
this.stateVos = stateVos;
}
} }
...@@ -808,5 +808,36 @@ public class CommonUtil implements RemoteAccess { ...@@ -808,5 +808,36 @@ public class CommonUtil implements RemoteAccess {
} }
} }
/**
* 获取指定容器下指定路径的文件
*
* @param location
* @param cref
* @return
* @throws WTException
*/
public static Folder getFolder(String location, WTContainerRef cref)
throws WTException {
Folder folder = null;
if (location == null)
location = "/Default/";
String loc = location.replace('\\', '/');
String[] fol = loc.split("/");
String shortPath = "";
for (int i = 1; i < fol.length; i++) {
shortPath = shortPath + "/" + fol[i];
try {
folder = FolderHelper.service.getFolder(shortPath, cref);
} catch (Exception e) {
// 忽略权限
boolean ac = SessionServerHelper.manager
.setAccessEnforced(false);
folder = FolderHelper.service.createSubFolder(shortPath, cref); // 找不到路径则创建路径
SessionServerHelper.manager.setAccessEnforced(ac);
}
}
return folder;
}
} }
...@@ -17,6 +17,7 @@ import wt.fc.PersistenceHelper; ...@@ -17,6 +17,7 @@ import wt.fc.PersistenceHelper;
import wt.fc.PersistenceServerHelper; import wt.fc.PersistenceServerHelper;
import wt.fc.QueryResult; import wt.fc.QueryResult;
import wt.fc.WTObject; import wt.fc.WTObject;
import wt.fc.collections.WTCollection;
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;
...@@ -45,6 +46,7 @@ import java.lang.reflect.InvocationTargetException; ...@@ -45,6 +46,7 @@ import java.lang.reflect.InvocationTargetException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
public class DxPartUtil implements RemoteAccess, Serializable { public class DxPartUtil implements RemoteAccess, Serializable {
private static Logger logger = LogR.getLogger(DxPartUtil.class.getName()); private static Logger logger = LogR.getLogger(DxPartUtil.class.getName());
...@@ -656,4 +658,30 @@ public class DxPartUtil implements RemoteAccess, Serializable { ...@@ -656,4 +658,30 @@ public class DxPartUtil implements RemoteAccess, Serializable {
return part; return part;
} }
/**
* 获取文件夹下所有部件
* @param ret
* @param folder
* @param flag true则遍历子文件夹
* @throws WTException
*/
public static <T> void getFolderContents(Set<T> ret, Folder folder, boolean flag) throws WTException {
QueryResult qr = FolderHelper.service.findFolderContents(folder);
while (qr.hasMoreElements()) {
Object obj = (Object) qr.nextElement();
if(obj instanceof WTPart){
ret.add((T) obj);
}
}
if (flag) {
QueryResult subFolders = FolderHelper.service.findSubFolders(folder);
while (subFolders.hasMoreElements()) {
Folder subFolder = (Folder) subFolders.nextElement();
getFolderContents(ret, subFolder, flag);
}
}
}
} }
...@@ -73,12 +73,12 @@ public class DxSearchUtil implements RemoteAccess, Serializable { ...@@ -73,12 +73,12 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
return DxPageImpl.fromPage(ts); return DxPageImpl.fromPage(ts);
} }
public static List<IdVO> findByConfigSpecSelect (SearchQueryCondition searchQueryCondition) throws Exception { public static PagingQueryResult findByConfigSpecSelect (SearchQueryCondition searchQueryCondition) throws Exception {
if (!RemoteMethodServer.ServerFlag) { /* if (!RemoteMethodServer.ServerFlag) {
return (List<IdVO>) RemoteMethodServer.getDefault().invoke("findByConfigSpecSelect", DxSearchUtil.class.getName(), null, return (List<IdVO>) RemoteMethodServer.getDefault().invoke("findByConfigSpecSelect", DxSearchUtil.class.getName(), null,
new Class[] { SearchQueryCondition.class}, new Class[] { SearchQueryCondition.class},
new Object[] { searchQueryCondition}); new Object[] { searchQueryCondition});
} }*/
CommonUtil.initSessionContext(null); CommonUtil.initSessionContext(null);
boolean enforce = SessionServerHelper.manager.setAccessEnforced(false); boolean enforce = SessionServerHelper.manager.setAccessEnforced(false);
List partList; List partList;
...@@ -88,16 +88,14 @@ public class DxSearchUtil implements RemoteAccess, Serializable { ...@@ -88,16 +88,14 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
cls = WTDocument.class; cls = WTDocument.class;
} }
try { try {
//合并查询条件
SearchItems searchItems = searchQueryCondition.getSearchItems(); SearchItems searchItems = searchQueryCondition.getSearchItems();
if (ObjectsUtil.isNull(searchItems)) { if (ObjectsUtil.isNull(searchItems)) {
searchItems = searchQueryCondition.getSearchVersion().getSearchItems(); searchItems = searchQueryCondition.getSearchVersion().getSearchItems();
} }
/* List<SearchItems> children = searchItems.getChildren(); //构建查询
for (SearchItems child : children) {
List<SearchItem> items = child.getItems();
}*/
QuerySpec querySpec = DxSearchUtil.buildQuerySpec(searchItems, cls); QuerySpec querySpec = DxSearchUtil.buildQuerySpec(searchItems, cls);
//通用查询条件
// Case 1:检入状态 // Case 1:检入状态
if (querySpec.getConditionCount() > 0) { if (querySpec.getConditionCount() > 0) {
querySpec.appendAnd(); querySpec.appendAnd();
...@@ -116,6 +114,7 @@ public class DxSearchUtil implements RemoteAccess, Serializable { ...@@ -116,6 +114,7 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
} }
//创建时间排序 //创建时间排序
querySpec.appendOrderBy(cls, "thePersistInfo.createStamp", true); querySpec.appendOrderBy(cls, "thePersistInfo.createStamp", true);
//page
BasicPageableQuerySpec bpqs = new BasicPageableQuerySpec(); BasicPageableQuerySpec bpqs = new BasicPageableQuerySpec();
bpqs.setPrimaryStatement(querySpec); bpqs.setPrimaryStatement(querySpec);
logger.error("pageFrom====" + (searchQueryCondition.getPageFrom()-1)*searchQueryCondition.getPageSize()); logger.error("pageFrom====" + (searchQueryCondition.getPageFrom()-1)*searchQueryCondition.getPageSize());
...@@ -123,29 +122,17 @@ public class DxSearchUtil implements RemoteAccess, Serializable { ...@@ -123,29 +122,17 @@ public class DxSearchUtil implements RemoteAccess, Serializable {
bpqs.setOffset((searchQueryCondition.getPageFrom()-1)*searchQueryCondition.getPageSize()); bpqs.setOffset((searchQueryCondition.getPageFrom()-1)*searchQueryCondition.getPageSize());
bpqs.setRange(searchQueryCondition.getPageSize()); bpqs.setRange(searchQueryCondition.getPageSize());
bpqs.setBackgroundThreadEnabled(false); bpqs.setBackgroundThreadEnabled(false);
QueryResult qr = PersistenceHelper.manager.find(bpqs); PagingQueryResult qr = (PagingQueryResult) PersistenceHelper.manager.find(bpqs);
return qr;
//LatestConfigSpec lcs = new LatestConfigSpec(); //LatestConfigSpec lcs = new LatestConfigSpec();
//qr = lcs.process(qr); //qr = lcs.process(qr);
logger.error("ResultSize====" + qr.size());
partList = new ArrayList();
while (qr.hasMoreElements()) {
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);
}
} finally { } finally {
SessionServerHelper.manager.setAccessEnforced(enforce); SessionServerHelper.manager.setAccessEnforced(enforce);
} }
logger.error("IdVOList=====" + partList.size()); //logger.error("IdVOList=====" + partList.size());
return partList; //return partList;
} }
public static void buildQueryResult(WTObject o, List partList, List<String> indices) throws Exception { public static void buildQueryResult(WTObject o, List partList, List<String> indices) throws Exception {
......
...@@ -41,17 +41,17 @@ public class DxPartService implements RemoteAccess, Serializable { ...@@ -41,17 +41,17 @@ public class DxPartService implements RemoteAccess, Serializable {
return byConfigSpecSelect; return byConfigSpecSelect;
} }
public static List findByConfigSpecSelect (SearchQueryCondition searchQueryCondition) throws Exception { /* public static List findByConfigSpecSelect (SearchQueryCondition searchQueryCondition) throws Exception {
if (!RemoteMethodServer.ServerFlag) { if (!RemoteMethodServer.ServerFlag) {
return (List) RemoteMethodServer.getDefault().invoke("findByConfigSpecSelect", DxPartService.class.getName(), null, return (List) RemoteMethodServer.getDefault().invoke("findByConfigSpecSelect", DxPartService.class.getName(), null,
new Class[] { SearchQueryCondition.class}, new Class[] { SearchQueryCondition.class},
new Object[] { searchQueryCondition}); new Object[] { searchQueryCondition});
} }
logger.error("findByConfigSpecSelect===111" + searchQueryCondition.toString()); logger.error("findByConfigSpecSelect===111" + searchQueryCondition.toString());
/*boolean enforce = SessionServerHelper.manager.setAccessEnforced(false);*/ *//*boolean enforce = SessionServerHelper.manager.setAccessEnforced(false);*//*
List<IdVO> partList = DxSearchUtil.findByConfigSpecSelect(searchQueryCondition); List<IdVO> partList = DxSearchUtil.findByConfigSpecSelect(searchQueryCondition);
return partList; return partList;
} }*/
public static DxPageImpl<DxPartVO> findByConfigSpecPage(BaseSearchCondition specSearch) { public static DxPageImpl<DxPartVO> findByConfigSpecPage(BaseSearchCondition specSearch) {
......
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