渲染流程状态、使用状态、流程分类搜索框,调整数据查询逻辑

This commit is contained in:
袁东强 2025-07-26 10:23:56 +08:00
parent 82df8cc6d8
commit e77bbf11f6

View File

@ -3,6 +3,7 @@ package com.actionsoft.apps.coe.pal.processlist.web;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -117,6 +118,35 @@ public class PALRepositoryListWeb extends ActionWeb {
macroLibraries.put("defaultSelectVal", defaultSelectVal); macroLibraries.put("defaultSelectVal", defaultSelectVal);
macroLibraries.put("teamId", teamId); macroLibraries.put("teamId", teamId);
macroLibraries.put("settingParam", JSON.toJSON(macroLibraries)); macroLibraries.put("settingParam", JSON.toJSON(macroLibraries));
JSONArray processStatusFilters = getProcessStatusFilters();
for(int i=0;i<processStatusFilters.size();i++){
JSONObject jsonObject = processStatusFilters.getJSONObject(i);
jsonObject.put("label", jsonObject.get("text"));
}
macroLibraries.put("statusSelect", processStatusFilters);
JSONArray useStatusSelect = new JSONArray();
JSONObject syz = new JSONObject();
syz.put("value", 1);
syz.put("label", "使用中");
useStatusSelect.add(syz);
JSONObject fsyz = new JSONObject();
fsyz.put("value", 2);
fsyz.put("label", "非使用中");
useStatusSelect.add(fsyz);
macroLibraries.put("useStatusSelect", useStatusSelect);
List<String> palMethodCategoryList = PALMethodCache.getPALMethodList(true);
JSONArray categorySelect = new JSONArray();
for (int i=0;i<palMethodCategoryList.size();i++){
String s = palMethodCategoryList.get(i);
List<PALMethodModel> list = PALMethodCache.getPALMethodModelListByMethod(s);
for (PALMethodModel model : list) {
JSONObject category = new JSONObject();
category.put("value", model.getId());
category.put("label", I18nRes.findValue(CoEConstant.APP_ID, model.getId()));
categorySelect.add(category);
}
}
macroLibraries.put("categorySelect", categorySelect);
// 操作行为日志记录 // 操作行为日志记录
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) { if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_APPCENTER, CoEOpLogConst.OP_ACCESS, CoEOpLogConst.INFO_APPCENTER_ACCESS_PREFIX + SDK.getAppAPI().getAppContext(ProcessListConstant.PROCESSLIST).getName() + CoEOpLogConst.INFO_APPCENTER_ACCESS_SUFFIX); CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_APPCENTER, CoEOpLogConst.OP_ACCESS, CoEOpLogConst.INFO_APPCENTER_ACCESS_PREFIX + SDK.getAppAPI().getAppContext(ProcessListConstant.PROCESSLIST).getName() + CoEOpLogConst.INFO_APPCENTER_ACCESS_SUFFIX);
@ -664,10 +694,98 @@ public class PALRepositoryListWeb extends ActionWeb {
permVerIds = CoeProcessLevelUtil.getPermRepositoryVersionIds(wsId, teamId, _uc.getUID(), null, null); permVerIds = CoeProcessLevelUtil.getPermRepositoryVersionIds(wsId, teamId, _uc.getUID(), null, null);
} }
//文件状态
JSONArray statusFilter = customFilterObj.getJSONArray("statusFilter");//流程架构L1
Set<String> statusSet = new HashSet<>();
for (int i = 0; i < statusFilter.size(); i++) {
statusSet.add(statusFilter.getString(i));
}
//使用状态
JSONArray useFilter = customFilterObj.getJSONArray("useStatusFilter");
Set<String> useSet = new HashSet<>();
for (int i = 0; i < useFilter.size(); i++) {
useSet.add(useFilter.getString(i));
}
//生效日期
JSONArray effectiveDate = customFilterObj.getJSONArray("effectiveDate");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
long startTime = 0;
if (effectiveDate.size() > 0){
String startTimeString = effectiveDate.getString(0);
try {
Date date = formatter.parse(startTimeString);
startTime = date.getTime();
} catch (ParseException e) {
System.out.println("流程清单数据过滤时,生效日期的开始时间转化失败");
e.printStackTrace();
}
}
long endTime = 0;
if (effectiveDate.size() > 1){
String endTimeString = effectiveDate.getString(1);
try {
Date date = formatter.parse(endTimeString);
endTime = date.getTime();
} catch (ParseException e) {
System.out.println("流程清单数据过滤时,生效日期的结束时间转化失败");
e.printStackTrace();
}
}
//流程分类
JSONArray categoryFilter = customFilterObj.getJSONArray("categoryFilter");
Set<String> categorySet = new HashSet<>();
for (int i = 0; i < categoryFilter.size(); i++) {
categorySet.add(categoryFilter.getString(i));
}
for (PALRepositoryModel model: palList) { for (PALRepositoryModel model: palList) {
// if (!model.isUse()) {// 非设计中状态过滤 // if (!model.isUse()) {// 非设计中状态过滤
// continue; // continue;
// } // }
//文件状态
if (statusSet.size()>0){
String type = model.isPublish()?"publish":model.isStop()?"stop":"designer";
if (!statusSet.contains( type)){
continue;
}
}
//使用状态
if (useSet.size()>0){
String isUse= model.isUse()?"1":"2";
if (!useSet.contains(isUse)){
continue;
}
}
//流程分类
if (categorySet.size()>0){
if (!categorySet.contains(model.getMethodId())){
continue;
}
}
//生效日期
if (startTime > 0 || endTime > 0) {
try {
PALRepositoryPropertyModel propModel = PALRepositoryPropertyCache.getPropertyByPropertyId(model.getId(), "fileExpiryDate");
if (propModel == null) {
continue;
}
String expiryDate = propModel.getPropertyValue();
if (UtilString.isEmpty(expiryDate)) {
continue;
}
Date date = formatter.parse(expiryDate);
if (startTime > 0 && date.getTime() <= startTime) {
continue;
}
if (endTime > 0 && date.getTime() >= endTime) {
continue;
}
} catch (Exception e) {
System.out.println("流程清单数据过滤时,文件有效期转化失败");
e.printStackTrace();
}
}
if (!UtilString.isEmpty(searchInput)) {// 流程名称条件不为空时过滤名称 if (!UtilString.isEmpty(searchInput)) {// 流程名称条件不为空时过滤名称
if (!model.getName().toUpperCase().contains(searchInput.toUpperCase())) { if (!model.getName().toUpperCase().contains(searchInput.toUpperCase())) {
continue; continue;