报告生成器增加发布部门筛选条件

This commit is contained in:
zhaol 2024-11-11 16:48:39 +08:00
parent fc669650ec
commit 44806670f4
6 changed files with 407 additions and 29 deletions

View File

@ -1751,6 +1751,14 @@ public class CoEPALController {
return outPutReport.PALFileJsonDataRootTreeData(methodType, wsid, versionType, teamId);
}
// @Mapping("COE_PAL_OUTPUTREPORT_PAL_FILE_JSON_DATA_ROOT_TREE_DATA")
@Mapping("com.actionsoft.apps.coe.pal_outputreport_pal_file_json_data_root_tree_dataByDepartment")
public String COEPALOutPutReportPALFileJsonDataRootTreeDataByDepartment(UserContext me, String methodType, String wsid, String versionType, String teamId,String departId) {
OutPutReportWeb outPutReport = new OutPutReportWeb(me);
return outPutReport.PALFileJsonDataRootTreeDataByDepartment(methodType, wsid, versionType, teamId,departId);
}
// @Mapping("COE_PAL_OUTPUTREPORT_PAL_FILE_RELATION_JSON_DATA_ROOT")
@Mapping("com.actionsoft.apps.coe.pal_file_relation_json_data_root")
public String COEPALOutPutReportPALFileRelationJsonDataRoot(UserContext me, String methodType, String wsid, String versionType, String teamId) {

View File

@ -1267,6 +1267,13 @@ public class PALRepositoryQueryAPIManager {
return list;
}
public List<PALRepositoryModel> getPalRepositoryModelsByTeamIdByDeptId(String wsId, String userId, String teamId, boolean isUsed, boolean isPublished,String departId) {
List<PALRepositoryModel> list = CoeProcessLevelUtil.getPermRepositoryListByDeptId(wsId, teamId, userId, null, null, isUsed, isPublished,departId);
return list;
}
/**
* 获取流程资产库下所有使用中的流程
*
@ -1596,6 +1603,94 @@ public class PALRepositoryQueryAPIManager {
return result;
}
public JSONArray getPalRepositoryTreeDataByDeptId(UserContext context, String wsId, String methods, String type,String departId) {
JSONArray result = new JSONArray();
String[] methodArray;
if (methods == null || "".equals(methods)) {
methodArray = new String[] { "process", "org", "data", "itsystem", "control" };
} else {
methodArray = methods.split(",");
}
int i = 1;
Set<String> methodSet = new HashSet<String>();
for (String method : methodArray) {
String category = "";
if (method.indexOf(".") != -1) {
category = method.substring(0, method.indexOf("."));
} else {
category = method;
}
if (methodSet.contains(category)) {
continue;
} else {
methodSet.add(category);
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", category);
String name = I18nRes.findValue(CoEConstant.APP_ID, category);
jsonObject.put("name", name);
jsonObject.put("icon", "../apps/" + CoEConstant.APP_ID + "/img/method/" + category + ".png");
jsonObject.put("menu", false);
jsonObject.put("url", "./w?sid=" + context.getSessionId() + "&cmd=com.actionsoft.apps.coe.pal_pl_repository_portal_page&ruuid=" + category + "&type=0&wsid=" + wsId);
jsonObject.put("open", i == 1);
jsonObject.put("nocheck", true);
result.add(jsonObject);
}
List<PALRepositoryModel> modelList = new ArrayList<PALRepositoryModel>();
boolean isUsed = false;
boolean isPublished = false;
if ("isUsed".equals(type) || "designer".equals(type)) {
modelList = getUsedPalRepositoryModelsByWsId(wsId, category);
isUsed = true;
} else if ("isPublished".equals(type)) {
modelList = getPublishedPalRepositoryModelsByWsId(wsId, category);
isPublished = true;
}
StringBuilder removeIds = new StringBuilder();
if (modelList.size() > 0) {
if (methods != null && !"".equals(methods)) {
List<PALRepositoryModel> removeList = new ArrayList<PALRepositoryModel>();
for (PALRepositoryModel model : modelList) {
// 如果限制的方法是小类需判断模型方法Id如果限制的方法是大类需判断模型的category
if ((method.indexOf(".") != -1 && methods.indexOf(model.getMethodId()) == -1) || (method.indexOf(".") == -1 && !method.equals(model.getMethodCategory()))) {
removeList.add(model);
removeIds.append(model.getId()).append(",");
}
}
// modelList.removeAll(removeList);
}
}
// 若type为designer并且有数据则过滤掉已发布的
if ("designer".equals(type) && modelList.size() > 0) {
List<PALRepositoryModel> tempList = new ArrayList<PALRepositoryModel>();
for (PALRepositoryModel model : modelList) {
if (!model.isPublish()) {
tempList.add(model);
}
}
modelList = tempList;
}
List<PALRepositoryModel> newList = setNewPid(modelList);
Collections.sort(newList, new Comparator1());
result.addAll(list2Json(context, newList, isUsed, isPublished, removeIds.toString(), type, true));
i++;
}
return result;
}
/**************************************************** 获取流程树 **********************************************************/
/**
@ -2016,6 +2111,99 @@ public class PALRepositoryQueryAPIManager {
return result;
}
public JSONArray getPermPalRepositoryTreeDataByMethodsByDeptId(UserContext context, String wsId, String teamId, String type, String methods,String departId) {
JSONArray result = new JSONArray();
List<PALRepositoryModel> list = null;
boolean isUsed = false;
boolean isPublished = false;
if ("isUsed".equals(type) || "designer".equals(type)) {
isUsed = true;
} else if ("isPublished".equals(type)) {
isPublished = true;
}
list = getPalRepositoryModelsByTeamIdByDeptId(wsId, context.getUID(), teamId, isUsed, isPublished,departId);
if (list == null) {
list = new ArrayList<PALRepositoryModel>();
}
List<PALRepositoryModel> removeList = new ArrayList<PALRepositoryModel>();
StringBuilder removeIds = new StringBuilder();
// 若type为designer并且有数据则过滤掉已发布的
if ("designer".equals(type) && list != null && list.size() > 0) {
List<PALRepositoryModel> tempList = new ArrayList<PALRepositoryModel>();
for (PALRepositoryModel model : list) {
if (!model.isPublish()) {
tempList.add(model);
}
}
list = tempList;
}
Collections.sort(list, new Comparator1()); // 按级别排序
List<PALRepositoryModel> newList = setNewPid(list);
List<String> categorys = PALMethodCache.getPalMehtodList(teamId, context.getUID(), isUsed, isPublished, true);
int i = 1;
for (String category : categorys) {
if (methods != null && !"".equals(methods)) {
if (methods.indexOf(category) == -1) {
//制度图与表单图特殊处理
if ("data.form".equals(methods)) {
if (!category.equals("process")) {
continue;
}
} else if ("control.policy".equals(methods)) {
if (!category.equals("process")) {
continue;
}
} else {
continue;
}
}
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", category);
jsonObject.put("nocheck", true);
String name = I18nRes.findValue(CoEConstant.APP_ID, category);
jsonObject.put("name", name);
jsonObject.put("icon", "../apps/" + CoEConstant.APP_ID + "/img/method/" + category + ".png");
jsonObject.put("menu", false);
jsonObject.put("url", "./w?sid=" + context.getSessionId() + "&cmd=com.actionsoft.apps.coe.pal_pl_repository_portal_page&ruuid=" + category + "&type=0&wsid=" + wsId);
jsonObject.put("open", i == 1);
result.add(jsonObject);
i++;
}
// 过滤掉method以外的
for (PALRepositoryModel model : list) {
if (!methods.contains(model.getMethodId())) {
removeIds.append(model.getId()).append(",");
}
}
result.addAll(list2Json(context, newList, isUsed, isPublished, removeIds.toString(), type, true));
return result;
}
/**
* 获取当前节点的第一级子节点
*

View File

@ -22,6 +22,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.actionsoft.bpms.commons.database.RowMap;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
@ -1611,6 +1612,39 @@ public class CoeProcessLevelUtil {
return result;
}
public static List<PALRepositoryModel> getPermRepositoryListByDeptId(String wsId, String teamId, String userId, String category, String method, boolean isUse, boolean isPublish,String departId) {
List<PALRepositoryModel> result = new ArrayList<>();
Set<String> versionIds = getPermRepositoryVersionIds(wsId, teamId, userId, category, method);
for (String versionId : versionIds) {
List<PALRepositoryModel> list = PALRepositoryCache.getByVersionId(versionId);
if (list != null) {
for (PALRepositoryModel model : list) {
if ((isUse && model.isUse()) || (isPublish && model.isPublish())) {
List<RowMap> rlatRowMap = DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID = '" + model.getId() + "' and ATTRID='Issuing_department'");
if (rlatRowMap.size() > 0) {
// 发布部门
String dempId = "";
for (RowMap oneRowMap : rlatRowMap) {
String relationshapetext = oneRowMap.getString("RELATIONSHAPETEXT");
JSONObject js = JSONObject.parseObject(relationshapetext);
String getDepartId=js.getString("id");
if(getDepartId.equals(departId)){
result.add(model);
}
}
}
}
}
}
}
return result;
}
/**
* 获取最近编辑的模型文件
*

View File

@ -1,39 +1,116 @@
<!Doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>报告生成器</title>
<script src="../commons/js/jquery/scripts/jquery.js"></script>
<script type="text/javascript" src="../commons/js/jquery/scripts/jquery.js"></script>
<script type="text/javascript" src="../commons/js/awsui.js"></script>
<script type="text/javascript" src="../commons/js/jquery/scripts/ui/aws.util.js"></script>
<link rel="stylesheet" href="../commons/css/awsui.css">
<style>
#tableContent thead th {
text-align: left;
}
<meta charset="UTF-8">
<title>报告生成器</title>
<script src="../commons/js/jquery/scripts/jquery.js"></script>
<script type="text/javascript" src="../commons/js/jquery/scripts/jquery.js"></script>
<script type="text/javascript" src="../commons/js/awsui.js"></script>
<script type="text/javascript" src="../commons/js/jquery/scripts/ui/aws.util.js"></script>
<link rel="stylesheet" href="../commons/css/awsui.css">
<style>
#tableContent thead th {
text-align: left;
}
.pagination {
padding-left: 0px;
}
.pagination {
padding-left: 0px;
}
#palShapes li {
margin: 5px 0px;
}
</style>
#palShapes li {
margin: 5px 0px;
}
</style>
</head>
<body>
<ul id="tree" style="overflow: visible; height: 300px; float: left;" class="ui-tree"></ul>
<ul id="palShapes" style="width: 40%; float: right; padding: 10px; display: none;"></ul>
</body>
<script type="text/javascript">
var data ="";
var sid = "<#sid>";
var targetMethodType = "<#targetMethodType>";
var methodType = "<#methodType>";
var wsid = "<#wsid>";
var teamId = "<#teamId>";
var versionType = "<#versionType>";
var data ="";
var sid = "<#sid>";
var targetMethodType = "<#targetMethodType>";
var methodType = "<#methodType>";
var wsid = "<#wsid>";
var teamId = "<#teamId>";
var versionType = "<#versionType>";
</script>
<input id="sid" value="<#sid>" type="hidden"/>
<div class="input-with-button">
<input id="address_dept" type="text" class="input-field" >
<button class="input-button" onclick="searchDataByDep()">查询</button>
</div>
<ul id="tree" style="overflow: visible; height: 300px; float: left;" class="ui-tree"></ul>
<ul id="palShapes" style="width: 40%; float: right; padding: 10px; display: none;"></ul>
</body>
<script>
$(document).ready(function() {
var options = {
filter : {
addressType: "dept",
deptSourceField : "DEPTID",
deptTargetField : "address_dept",
isAdvMode: true,//是否启用高级模式
addressSetting: {
rootDetpId: "",
isDisplayMap: true,
isDisplayOtherMap: false,
layerFrom: "",
layerTo: "",
range: "department",//department:部门,role:角色,team:团队
delimiter: " ",
choiceType: "multiple",//single:单选; multiple:多选
leafType: "dept",//叶子节点类型,user:用户;dept:部门
filterClass: ""//过滤事件
},
},
};
$("#address_dept").address(options);
});
</script>
<script type='text/javascript' src='../apps/com.actionsoft.apps.coe.pal/js/pal.pl.repository.outputreport.pal.file.tree.js'></script>
<style>
.input-with-button {
display: flex;
align-items: center;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 4px;
padding: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
height: 30px;
}
.input-field {
flex: 1; /* 占据剩余空间 */
border: none;
outline: none;
padding: 5px;
font-size: 16px;
}
.input-button {
border: none;
background-color: #007BFF;
color: #fff;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s;
margin-left: 1px; /* 与输入框之间的间距 */
}
.input-button:hover {
background-color: #0056b3;
}
#awsui-address-address_dept{
position:relative !important;
width:665.4px !important;
}
</style>
</html>

View File

@ -22,7 +22,31 @@ $(document).ready(function() {
}
$.simpleAlert("正在加载", "loading", 3000, {model:true});
setTimeout("initTreeData()", 100);
setTimeout("initTreeData()", 100);
var options = {
filter : {
addressType: "dept",
deptSourceField : "DEPTID",
deptTargetField : "address_dept",
isAdvMode: true,//是否启用高级模式
addressSetting: {
rootDetpId: "",
isDisplayMap: true,
isDisplayOtherMap: false,
layerFrom: "",
layerTo: "",
range: "department",//department:部门,role:角色,team:团队
delimiter: " ",
choiceType: "multiple",//single:单选; multiple:多选
leafType: "dept",//叶子节点类型,user:用户;dept:部门
filterClass: ""//过滤事件
},
},
};
$("#address_dept").address(options);
});
function initTreeData() {
@ -63,6 +87,53 @@ function initTreeData() {
});
}
function searchDataByDep() {
$.simpleAlert("正在查询", "loading", 3000, {model:true});
$("#tree").empty();
var params = {
versionType: versionType,
wsid: wsid,
teamId: teamId,
methodType: methodType,
departId:$("#address_dept").val()
}
$.ajax({
url : "./jd?sid=" + encodeURIComponent(sid) + "&cmd=com.actionsoft.apps.coe.pal_outputreport_pal_file_json_data_root_tree_dataByDepartment",
data : params,
type : "post",
success : function(msg) {
var temp = msg;
// 设置全部可选使用effective标记是否选择有效
for(var i = 0; i < temp.length; i++) {
if(temp[i].nocheck == false) {
temp[i].effective = true;
} else {
temp[i].effective = false;
}
}
// for(var i = 0; i < temp.length; i++) {
// temp[i].nocheck = false;
// }
data = temp;
setting.dataModel = {
data : data
};
checkTree = awsui.tree.init($("#tree"), setting);
$("#tree").css("height", "300px");
checkedNodeById();
$.simpleAlert('close');
}
});
}
//返回选中的流程文件
function getCheckedNode() {
if (targetMethodType == "") {