修改架构视图增加部门过滤

This commit is contained in:
Mr-wang 2023-06-27 10:08:26 +08:00
parent f54e31b0b5
commit bb3445f5a9

View File

@ -156,28 +156,45 @@ public class ToPageService extends ActionWeb {
String fileType = params.get("fileType");
String departId =params.get("departId");
List<String> list = new ArrayList<>();
if (departId.contains(",")){
String[] split = departId.split(",");
for (String departID:
split) {
ArrayList<String> childDept = getChildDept(departID, new ArrayList<>());
if (childDept.size()>0){
for (String departid:
childDept) {
list.add(departid);
if (departId.contains(uc.getCompanyModel().getId())){
List<RowMap> maps = DBSql.getMaps("select ID from orgdepartment where 1=1 AND closed = '0'");
for (RowMap rowMap:
maps) {
String id = rowMap.getString("ID");
list.add(id);
}
}else {
if (UtilString.isNotEmpty(departId)){
if (departId.contains(",")){
String[] split = departId.split(",");
for (String departID:
split) {
ArrayList<String> childDept = getChildDept(departID, new ArrayList<>());
if (childDept.size()>0){
for (String departid:
childDept) {
list.add(departid);
}
}
}
}else {
ArrayList<String> childDept = getChildDept(departId, new ArrayList<>());
if (childDept.size()>0){
for (String departid:
childDept) {
list.add(departid);
}
}
}
}
}
System.out.println("list>>>>>>>>>>"+list);
String sb ="(";
for (String departids:
list) {
sb+="'"+departids+"'"+",";
}
sb = sb.substring(0,sb.length()-1);
sb+=")";
System.out.println("sb>>>>>>>"+sb);
ro.put("departId",list.toString());
String sb = getAppendOrAndInString(list);
ro.put("sb",sb);
ro.put("frameIDtoFrameView",frameIDtoFrameView);
System.out.println("======frameIDtoFrameView======" + frameIDtoFrameView);
if (null != frameIDtoFrameView && !frameIDtoFrameView.equals("")) {
//SDK.getLogAPI().consoleInfo("当前架构ID1"+frameID);
@ -208,9 +225,8 @@ public class ToPageService extends ActionWeb {
List<RowMap> fileRowMaps =null;
//List<RowMap> fileRowMaps = DBSql.getMaps("SELECT FILEID,PLPARENTID,PLNAME,PLMETHODID,SUPPORTFILE,PUBDEPT,PUBDATETIME,PLORDERINDEX,PLLEVEL,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE PLPARENTID=? AND FILESTATE='1' AND (PLMETHODID='process.epc' OR PLMETHODID='process.flowchart' OR PLMETHODID='control.policy') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams);
if (sb.contains("'")){
fileRowMaps = DBSql.getMaps("SELECT ID AS FILEID,PLPARENTID,PLNAME,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLPARENTID=? AND ISPUBLISH = 1 AND EXT6 IN"+sb+" AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams);
fileRowMaps = DBSql.getMaps("SELECT ID AS FILEID,PLPARENTID,PLNAME,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLPARENTID=? AND ISPUBLISH = 1 AND "+sb+" AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams);
} else {
fileRowMaps = DBSql.getMaps("SELECT ID AS FILEID,PLPARENTID,PLNAME,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLPARENTID=? AND ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams);
}
System.out.println("fileRowMaps>>>>>>>>>>"+fileRowMaps);
@ -260,120 +276,154 @@ public class ToPageService extends ActionWeb {
}
}
}
}
}
fileRowMaps.addAll(fileHandleRowMaps);
}
System.out.println("========fileRowMaps2========>" + fileRowMaps.size());
if (null != fileType && !fileType.equals("")) {
fileHandleRowMaps = new ArrayList<>();
if (null != fileRowMaps && !fileRowMaps.isEmpty()) {
for (RowMap fileRowMap : fileRowMaps) {
if (fileType.equals("processFile")) {
if (fileRowMap.getString("PLMETHODID").equals("process.epc") || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) {
fileHandleRowMaps.add(fileRowMap);
}
}
System.out.println("========fileHandleRowMaps3========>" + fileHandleRowMaps.size());
if (fileType.equals("policyFile")) {
if (fileRowMap.getString("PLMETHODID").equals("control.policy") && (fileRowMap.getString("POLICYTYPE").equals("regulation") || null == fileRowMap.getString("POLICYTYPE") || fileRowMap.getString("POLICYTYPE").equals(""))) {
fileHandleRowMaps.add(fileRowMap);
}
}
// && fileRowMap.getString("POLICYTYPE").equals("regulation")
if (fileType.equals("guideFile")) {
if (fileRowMap.getString("PLMETHODID").equals("control.policy") && fileRowMap.getString("POLICYTYPE").equals("I/O_L4")) {
fileHandleRowMaps.add(fileRowMap);
}
}
if (fileType.equals("formFile")) {
if (fileRowMap.getString("PLMETHODID").equals("data.form")) {
fileHandleRowMaps.add(fileRowMap);
String PLPARENTID = fileRowMap.getString("PLPARENTID");
PALRepositoryModel reFileModel = PALRepositoryCache.getCache().get(PLPARENTID);
String PLMETHODID = reFileModel.getMethodId();
String PUBDEPT = fileRowMap.getString("PUBDEPT");
Integer PLLEVEL = fileRowMap.getInt("PLLEVEL");
if (!PLMETHODID.equals("process.framework")) {
reFileMap = new HashMap<>();
reFileMap.put("FILEID", reFileModel.getId());
reFileMap.put("PLNAME", reFileModel.getName());
reFileMap.put("PLPARENTID", reFileModel.getParentId());
reFileMap.put("PLMETHODID", PLMETHODID);
reFileMap.put("PUBDEPT", PUBDEPT);
reFileMap.put("PLLEVEL", (PLLEVEL - 1));
reFileMap.put("PLORDERINDEX", reFileModel.getOrderIndex());
reFileRowMap = new RowMap(reFileMap);
fileHandleRowMaps.add(reFileRowMap);
}
}
}
if (fileType.equals("totalFile")) {
fileRowMaps.addAll(fileHandleRowMaps);
}
System.out.println("========fileRowMaps2========>" + fileRowMaps.size());
if (null != fileType && !fileType.equals("")) {
fileHandleRowMaps = new ArrayList<>();
if (null != fileRowMaps && !fileRowMaps.isEmpty()) {
for (RowMap fileRowMap : fileRowMaps) {
if (fileType.equals("processFile")) {
if (fileRowMap.getString("PLMETHODID").equals("process.epc") || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) {
fileHandleRowMaps.add(fileRowMap);
}
}
}
fileHandleRowMaps = fileHandleRowMaps.stream().collect(collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getString("FILEID")))),
ArrayList::new));
fileRowMaps = fileHandleRowMaps;
}
if (null != fileRowMaps && !fileRowMaps.isEmpty()) {
for (RowMap fileRowMap : fileRowMaps) {
fileMap = new HashMap<String, Object>();
model = PALRepositoryCache.getCache().get(fileRowMap.getString("FILEID"));
if (model != null) {
if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册
taskId = getLastPublishTaskIdByModelId(model.getId());
System.out.println("========fileHandleRowMaps3========>" + fileHandleRowMaps.size());
if (fileType.equals("policyFile")) {
if (fileRowMap.getString("PLMETHODID").equals("control.policy") && (fileRowMap.getString("POLICYTYPE").equals("regulation") || null == fileRowMap.getString("POLICYTYPE") || fileRowMap.getString("POLICYTYPE").equals(""))) {
fileHandleRowMaps.add(fileRowMap);
}
}
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + "uuid=" + fileRowMap.getString("FILEID") + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
nodeType = "file";
fileMap.put("ID", fileRowMap.getString("FILEID"));
fileMap.put("PARENTID", fileRowMap.getString("PLPARENTID"));
fileMap.put("name", fileRowMap.getString("PLNAME"));
fileMap.put("PLMETHODID", fileRowMap.getString("PLMETHODID"));
fileMap.put("PUBDATETIME", fileRowMap.getString("PUBDATETIME"));
fileMap.put("path", path);
fileMap.put("ORDERINDEX", fileRowMap.getString("PLORDERINDEX"));
fileMap.put("TLEVEL", fileRowMap.getString("PLLEVEL"));
fileMap.put("nodeType", nodeType);
if (fileRowMap.getString("PLMETHODID").equals("process.epc") || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) {
fileMap.put("fileType", "processFile");
} else if (fileRowMap.getString("PLMETHODID").equals("control.policy") && (fileRowMap.getString("POLICYTYPE").equals("regulation") || null == fileRowMap.getString("POLICYTYPE") || fileRowMap.getString("POLICYTYPE").equals(""))) {
// && fileRowMap.getString("POLICYTYPE").equals("regulation")
fileMap.put("fileType", "policyFile");
} else if (fileRowMap.getString("PLMETHODID").equals("control.policy") && fileRowMap.getString("POLICYTYPE").equals("I/O_L4")) {
fileMap.put("fileType", "guideFile");
} else if (fileRowMap.getString("PLMETHODID").equals("data.form")) {
fileMap.put("fileType", "formFile");
// && fileRowMap.getString("POLICYTYPE").equals("regulation")
if (fileType.equals("guideFile")) {
if (fileRowMap.getString("PLMETHODID").equals("control.policy") && fileRowMap.getString("POLICYTYPE").equals("I/O_L4")) {
fileHandleRowMaps.add(fileRowMap);
}
}
if (fileType.equals("formFile")) {
if (fileRowMap.getString("PLMETHODID").equals("data.form")) {
fileHandleRowMaps.add(fileRowMap);
String PLPARENTID = fileRowMap.getString("PLPARENTID");
PALRepositoryModel reFileModel = PALRepositoryCache.getCache().get(PLPARENTID);
String PLMETHODID = reFileModel.getMethodId();
String PUBDEPT = fileRowMap.getString("PUBDEPT");
Integer PLLEVEL = fileRowMap.getInt("PLLEVEL");
if (!PLMETHODID.equals("process.framework")) {
reFileMap = new HashMap<>();
reFileMap.put("FILEID", reFileModel.getId());
reFileMap.put("PLNAME", reFileModel.getName());
reFileMap.put("PLPARENTID", reFileModel.getParentId());
reFileMap.put("PLMETHODID", PLMETHODID);
reFileMap.put("PUBDEPT", PUBDEPT);
reFileMap.put("PLLEVEL", (PLLEVEL - 1));
reFileMap.put("PLORDERINDEX", reFileModel.getOrderIndex());
reFileRowMap = new RowMap(reFileMap);
fileHandleRowMaps.add(reFileRowMap);
}
}
}
if (fileType.equals("totalFile")) {
fileHandleRowMaps.add(fileRowMap);
}
fileMaps.add(fileMap);
}
System.out.println("fileMaps============"+fileMaps);
List<Map> fileTreeNodes = TreeUtil.buildTree("1", fileMaps, null, "frame", null, null);
ro.put("fileMaps", fileTreeNodes);
System.err.println("============fileMaps============" + fileMaps);
System.err.println("============fileTreeNodes==========" + fileTreeNodes);
return ro.toString();
} else {
ro.ok("暂无文件");
fileMaps = new ArrayList<>();
ro.put("fileMaps", fileMaps);
return ro.toString();
}
fileHandleRowMaps = fileHandleRowMaps.stream().collect(collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getString("FILEID")))),
ArrayList::new));
fileRowMaps = fileHandleRowMaps;
}
if (null != fileRowMaps && !fileRowMaps.isEmpty()) {
for (RowMap fileRowMap : fileRowMaps) {
fileMap = new HashMap<String, Object>();
model = PALRepositoryCache.getCache().get(fileRowMap.getString("FILEID"));
if (model != null) {
if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册
taskId = getLastPublishTaskIdByModelId(model.getId());
}
}
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + "uuid=" + fileRowMap.getString("FILEID") + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
nodeType = "file";
fileMap.put("ID", fileRowMap.getString("FILEID"));
fileMap.put("PARENTID", fileRowMap.getString("PLPARENTID"));
fileMap.put("name", fileRowMap.getString("PLNAME"));
fileMap.put("PLMETHODID", fileRowMap.getString("PLMETHODID"));
fileMap.put("PUBDATETIME", fileRowMap.getString("PUBDATETIME"));
fileMap.put("path", path);
fileMap.put("ORDERINDEX", fileRowMap.getString("PLORDERINDEX"));
fileMap.put("TLEVEL", fileRowMap.getString("PLLEVEL"));
fileMap.put("nodeType", nodeType);
if (fileRowMap.getString("PLMETHODID").equals("process.epc") || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) {
fileMap.put("fileType", "processFile");
} else if (fileRowMap.getString("PLMETHODID").equals("control.policy") && (fileRowMap.getString("POLICYTYPE").equals("regulation") || null == fileRowMap.getString("POLICYTYPE") || fileRowMap.getString("POLICYTYPE").equals(""))) {
// && fileRowMap.getString("POLICYTYPE").equals("regulation")
fileMap.put("fileType", "policyFile");
} else if (fileRowMap.getString("PLMETHODID").equals("control.policy") && fileRowMap.getString("POLICYTYPE").equals("I/O_L4")) {
fileMap.put("fileType", "guideFile");
} else if (fileRowMap.getString("PLMETHODID").equals("data.form")) {
fileMap.put("fileType", "formFile");
}
fileMaps.add(fileMap);
}
System.out.println("fileMaps============"+fileMaps);
List<Map> fileTreeNodes = TreeUtil.buildTree("1", fileMaps, null, "frame", null, null);
ro.put("fileMaps", fileTreeNodes);
System.err.println("============fileMaps============" + fileMaps);
System.err.println("============fileTreeNodes==========" + fileTreeNodes);
return ro.toString();
} else {
ro.ok("无效架构");
ro.ok("暂无文件");
fileMaps = new ArrayList<>();
ro.put("fileMaps", fileMaps);
return ro.toString();
}
} else {
ro.ok("未传入有效架构ID");
ro.ok("无效架构");
fileMaps = new ArrayList<>();
ro.put("fileMaps", fileMaps);
return ro.toString();
}
return ro.toString();
} else {
ro.ok("未传入有效架构ID");
}
return ro.toString();
}
private static String getAppendOrAndInString(List<String> list){
StringBuffer sb=new StringBuffer();
String returnString="";
sb.append("(");
for(int i=0;i<list.size();i++){
if(i==0){
sb.append("EXT6 ");
sb.append(" in (");
}
sb.append("'").append(list.get(i).toString()).append("'");
if(i>=900&&i<list.size()-1){
if(i%900==0){
sb.append(") or ");
sb.append("EXT6");
sb.append(" in (");
}else{
sb.append(",");
}
}else{
if(i<list.size()-1){
sb.append(",");
}
}
if(i==list.size()-1){
sb.substring(0,sb.length()-1);
sb.append(")");
}
}
sb.append(")");
returnString=sb.toString();
return returnString;
}
}