上传初版门户首页代码

This commit is contained in:
袁东强 2025-08-15 15:06:48 +08:00 committed by zhaolei
parent 117fb05d96
commit c5326a8c01
11 changed files with 1510 additions and 0 deletions

View File

@ -0,0 +1,15 @@
package com.awspaas.user.apps.nqms.portal.indexpage.constant;
import com.actionsoft.sdk.local.SDK;
/**
* @author ydq
* @date 2025/08/15
* @description
*/
public class Constants {
public static String openCmd="com.actionsoft.apps.coe.pal.publisher_publish_file_open";
public static String COE_APP_ID="com.actionsoft.apps.coe.pal";
}

View File

@ -0,0 +1,52 @@
package com.awspaas.user.apps.nqms.portal.indexpage.constant;
/**
* 建模分类
*/
public enum PalCategoryEnum {
//资产文件类型
EPC("EPC","process.epc"),//过程链图
FLOWCHART("FLOWCHART","process.flowchart"),//泳道图
SCHEME("SCHEME","process.scheme"),//方案图
STANDARD("STANDARD","engineering.standard"),//方案图
FORM("FORM","data.form"),//表单图
POLICY("POLICY","control.policy"),//制度图
//建模大类
PROCESS("process", "流程"),//流程
ORG("org", "组织"),//组织
CONTROL("control", "控制"),//控制
FORMLIBRARY("formLibrary", "表单库"),//NQMS
KPILIBRARY("kpiLibrary", "绩效指标库"),//NQMS 原绩效库
POLICYLIBRARY("policyLibrary", "制度库"),//NQMS
RISKLIBRARY("riskLibrary", "风险控制库"),//NQMS 原风险库
CONTROLLIBRARY("controlLibrary", "标准库"),//NQMS 原控制库
TERMLIBRARY("termLibrary", "操作指导库"),//NQMS
STANDARDLIBRARY("standardLibrary", "流程图库"),//NQMS
COMPLIANCELIBRARY("complianceLibrary", "方案库");
public String key;
public String value;
PalCategoryEnum(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}

View File

@ -0,0 +1,75 @@
package com.awspaas.user.apps.nqms.portal.indexpage.controller;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.bind.annotation.Controller;
import com.actionsoft.bpms.server.bind.annotation.Mapping;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.awspaas.user.apps.nqms.portal.indexpage.service.IndexService;
import java.util.HashMap;
/**
* @author ydq
* @date 2025/08/15
* @description
*/
@Controller
public class IndexController {
/**
* 页面入口
* @param ux
* @return
*/
@Mapping("com.awspaas.user.apps.nqms.portal.indexpage_toPage")
public String toHomePage(UserContext ux,String click){
HashMap<String, Object> macroLibraries = new HashMap<>();
macroLibraries.put("sid",ux.getSessionId());
macroLibraries.put("uid",ux.getUID());
macroLibraries.put("click",click);
macroLibraries.put("settingParam", JSON.toJSON(macroLibraries));
return HtmlPageTemplate.merge("com.awspaas.user.apps.nqms.portal.indexpage", "main.html", macroLibraries);
}
/**
* 初始化数据
* @param ux
* @return
*/
@Mapping("com.awspaas.user.apps.nqms.portal.indexpage_getInitData")
public String getInitData(UserContext ux){
return IndexService.getInstance().getInitData(ux);
}
/**
* 初始化岗位数据
* @param ux
* @return
*/
@Mapping("com.awspaas.user.apps.nqms.portal.indexpage_getPostData")
public String getPostData(UserContext ux){
return IndexService.getInstance().getPostOrRoleData(ux, "岗位", "岗位模型");
}
/**
* 初始化角色数据
* @param ux
* @return
*/
@Mapping("com.awspaas.user.apps.nqms.portal.indexpage_getRoleData")
public String getRoleData(UserContext ux){
return IndexService.getInstance().getPostOrRoleData(ux, "流程角色", "角色模型");
}
/**
* 查询文件详情
* @param ux
* @param type
* @return
*/
@Mapping("com.awspaas.user.apps.nqms.portal.indexpage_queryRelFile")
public String queryRelFile(UserContext ux,String type,String id,int page,int size){
SDK.getLogAPI().consoleInfo("查询人" + ux.getUID() + "查询条件为 type:" + type + "page:" + page + "size:" + size);
return IndexService.getInstance().queryRelFile(ux, type,id, page, size);
}
}

View File

@ -0,0 +1,22 @@
package com.awspaas.user.apps.nqms.portal.indexpage.dao;
import com.actionsoft.bpms.util.DBSql;
/**
* @author ydq
* @date 2025/08/15
* @description
*/
public class RepositoryDao {
public String getWsId(String wsName) {
String sql = "SELECT ID FROM APP_ACT_COE_PAL_WORKSPACE WHERE WSNAME=?";
String wsId = DBSql.getString(sql, new Object[]{wsName});
return wsId;
}
public String getDefaultWsId() {
String sql = "SELECT ID FROM APP_ACT_COE_PAL_WORKSPACE ";
String id = DBSql.getString(sql);
return id;
}
}

View File

@ -0,0 +1,687 @@
package com.awspaas.user.apps.nqms.portal.indexpage.service;
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryPropertyCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.i18n.I18nRes;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.apps.nqms.portal.indexpage.constant.Constants;
import com.awspaas.user.apps.nqms.portal.indexpage.constant.PalCategoryEnum;
import com.awspaas.user.apps.nqms.portal.indexpage.util.ViewUtil;
import com.awspaas.user.apps.nqms.portal.indexpage.vo.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ydq
* @date 2025/08/15
* @description
*/
public class IndexService {
private IndexService() {
}
private static class indexInstance {
public static IndexService instance = new IndexService();
}
public static IndexService getInstance() {
return indexInstance.instance;
}
/**
* 首页初始化数据
*
* @return
*/
public String getInitData(UserContext ux) {
List<JSONObject> allFiles = new ArrayList<>();
List<IndexVO> indexData = new ArrayList<>();
UtilService service = UtilService.getInstance();
String wsId = service.getDefaultWsId();
if (StringUtils.isEmpty(wsId)) {
return service.getWsIdWarnMsg();
}
List<HashMap> processGroupList = getProcess1(wsId, allFiles);
Map<String, String> logoSrcMap = service.getLogoSrc(ux);
String topSrc = logoSrcMap.get("topSrc");
String bottomSrc = logoSrcMap.get("bottomSrc");
indexData.add(new IndexVO("role", "role", "流程角色", "FeatureClass", 0, 0, null));
indexData.add(new IndexVO("post", "post", "岗位", "FeatureClass", 0, 0, null));
getFile(wsId, allFiles, indexData);
swap(indexData, 0, 2);
Map collect = indexData.stream().collect(Collectors.groupingBy(el -> el.getGroup()));
ResponseObject ro = ResponseObject.newOkResponse();
ro.put(collect);
String item1 = SDK.getAppAPI().getProperty("com.awspaas.user.apps.nqms.portal.indexpage", "item1");
String item2 = SDK.getAppAPI().getProperty("com.awspaas.user.apps.nqms.portal.indexpage", "item2");
String item3 = SDK.getAppAPI().getProperty("com.awspaas.user.apps.nqms.portal.indexpage", "item3");
ro.put("item1", item1);
ro.put("item2", item2);
ro.put("item3", item3);
ro.put("processGroupList", processGroupList);
ro.put("topIconUrl", topSrc);
ro.put("bottomIconUrl", bottomSrc);
return ro.toString();
}
/**
* 初始化岗位/角色数据
*
* @param ux
* @return
*/
public String getPostOrRoleData(UserContext ux, String lab了Name, String palName) {
UtilService service = UtilService.getInstance();
String wsId = service.getDefaultWsId();
if (StringUtils.isEmpty(wsId)) {
return service.getWsIdWarnMsg();
}
IndexVO roleOrPost = getRoleOrPost(wsId, lab了Name, palName);
ResponseObject ro = ResponseObject.newOkResponse();
ro.setData(roleOrPost);
return ro.toString();
}
/**
* 调换两个元素的位置
*
* @param list
* @param pos1
* @param pos2
*/
public void swap(List<IndexVO> list, int pos1, int pos2) {
//判断list是否为空
if (CollectionUtils.isEmpty(list)) {
return;
}
//创建一个临时变量存储数据
IndexVO e = list.get(pos1);
//调换
list.set(pos1, list.get(pos2));
list.set(pos2, e);
}
/**
* 设置角色/岗位
*
* @param wsId
* @return
*/
public IndexVO getRoleOrPost(String wsId, String lableName, String palName) {
System.out.println(lableName + "开始时间" + System.currentTimeMillis());
IndexVO indexVO = new IndexVO("role", "role", lableName, "FeatureClass", 0, 0, null);
UtilService service = UtilService.getInstance();
List<JSONObject> firstProcessPalByPid = service.getFirstProcessPalByPid(wsId, PalCategoryEnum.ORG.getKey());
String id = "";
for (JSONObject process : firstProcessPalByPid) {
String name = process.getString("name");
if (palName.equals(name)) {
String versionId = process.getString("versionId");
String version = process.getString("version");
id = process.getString("id");
if (!"1.0".equals(version) && StringUtils.isNotBlank(versionId)) {
id = versionId;
}
break;
}
}
List<PALRepositoryModel> list = new ArrayList<>();
PALRepositoryQueryAPIManager.getInstance().getAllPublishedPalRepositoryModelsByPid(wsId, id, list);
int pubCount = 0;
for (PALRepositoryModel model : list) {
String define = PALRepositoryQueryAPIManager.getInstance().getProcessDefinition(null, model.getId());
JSONObject definition = JSONObject.parseObject(define);
JSONObject elements = definition.getJSONObject("elements");// 形状列表
pubCount += elements.size();
}
indexVO.setPubCount(pubCount);
System.out.println(lableName + "结束时间" + System.currentTimeMillis());
return indexVO;
}
/**
* 查询文件类型数据
*
* @param wsId
* @param allFiles
* @param data
* @return
*/
public List<IndexVO> getFile(String wsId, List<JSONObject> allFiles, List<IndexVO> data) {
UtilService service = UtilService.getInstance();
//风险控制
IndexVO riskVO = new IndexVO("risk", "risk", getCategoryName(PalCategoryEnum.RISKLIBRARY.getValue()), "FeatureClass", 0, 0, null);
long count = SDK.getBOAPI().query("BO_EU_RISK_CONTROL").addQuery("MODELSTATUS = ", "已发布").count();
riskVO.setPubCount(Math.toIntExact(count));
data.add(riskVO);
//绩效指标
List<JSONObject> kpi = service.getAllProcessPalByPid(wsId, PalCategoryEnum.CONTROL.getKey());
IndexVO kpiVO = new IndexVO("kpi", "kpi", getCategoryName(PalCategoryEnum.KPILIBRARY.getValue()), "FeatureClass", 0, kpi.size(), null);
data.add(kpiVO);
//表单
int formCount = 0;
//制度
int policyCount = 0;
//操作指导
int termCount = 0;
//流程图
int stnadCount = 0;
//方案图
int comCount = 0;
//标准
int controlCount = 0;
for (JSONObject process : allFiles) {
String methodId = process.getString("methodId");
if (PalCategoryEnum.FORM.getValue().equals(methodId)) {
formCount++;
} else if (PalCategoryEnum.POLICY.getValue().equals(methodId)) {
String ext3 = process.getString("ext3");
if (StringUtils.isNotBlank(ext3) && "regulation".equals(ext3)) {
//制度 regulation就是制度
policyCount++;
} else {
//操作指导 I/O_L4是操作指导
termCount++;
}
} else if (PalCategoryEnum.FLOWCHART.getValue().equals(methodId) || PalCategoryEnum.EPC.getValue().equals(methodId)) {
stnadCount++;
} else if (PalCategoryEnum.SCHEME.getValue().equals(methodId)) {
comCount++;
} else if (PalCategoryEnum.STANDARD.getValue().equals(methodId)) {
controlCount++;
}
}
//表单
IndexVO formVO = new IndexVO("form", "form", getCategoryName(PalCategoryEnum.FORMLIBRARY.getValue()), "FeatureClass", 0, 0, null);
formVO.setPubCount(formCount);
data.add(formVO);
//制度
IndexVO policyVO = new IndexVO("regime", "regime", getCategoryName(PalCategoryEnum.POLICYLIBRARY.getValue()), "FeatureClass", 0, 0, null);
policyVO.setPubCount(policyCount);
data.add(policyVO);
//操作指导
IndexVO termVO = new IndexVO("term", "term", getCategoryName(PalCategoryEnum.TERMLIBRARY.getValue()), "FeatureClass", 0, 0, null);
termVO.setPubCount(termCount);
data.add(termVO);
//流程图
IndexVO stnadVO = new IndexVO("stand", "stand", getCategoryName(PalCategoryEnum.STANDARDLIBRARY.getValue()), "FeatureClass", 0, 0, null);
stnadVO.setPubCount(stnadCount);
data.add(stnadVO);
//方案
IndexVO comVO = new IndexVO("compliance", "compliance", getCategoryName(PalCategoryEnum.COMPLIANCELIBRARY.getValue()), "FeatureClass", 0, 0, null);
comVO.setPubCount(comCount);
data.add(comVO);
//标准
IndexVO controlVO = new IndexVO("system", "system", getCategoryName(PalCategoryEnum.CONTROLLIBRARY.getValue()), "FeatureClass", 0, 0, null);
controlVO.setPubCount(controlCount);
data.add(controlVO);
return data;
}
public String getCategoryName(String categoryId) {
String value = I18nRes.findValue("com.actionsoft.apps.coe.pal", categoryId);
String name = value.replace("", "");
return name;
}
/**
* 设置各个业务域的情况
*
* @param wsId
* @param allFiles
* @param
*/
public List<HashMap> getProcess1(String wsId, List<JSONObject> allFiles) {
ArrayList<IndexVO> data = new ArrayList<>();
UtilService service = UtilService.getInstance();
List<JSONObject> processType = service.getFirstProcessPalByPid(wsId, PalCategoryEnum.PROCESS.getKey());
String strategy = "战略类";
String Operations = "运营类";
String SupportAndServices = "支持与服务类";
for (JSONObject type : processType) {
String name = type.getString("name");
String id = type.getString("id");
int index = type.getIntValue("orderIndex");
String version = type.getString("version");
String versionId = type.getString("versionId");
String group = "";
if (!name.startsWith(String.valueOf(index))) {
continue;
}
if (index == 1) {
group = "strategy";
} else if (index > 1 && index <= 7) {
group = "Operations";
} else {
group = "SupportAndServices";
}
if (!"1.0".equals(version) && StringUtils.isNotBlank(versionId)) {
id = versionId;
}
List<JSONObject> busProcess = service.getAllProcessPalByPid(wsId, id);
allFiles.addAll(busProcess);
IndexVO vo = new IndexVO("process", id, name, group, 0, busProcess.size(), null);
data.add(vo);
}
Map<String, List<IndexVO>> collect = data.stream().collect(Collectors.groupingBy(IndexVO::getGroup));
HashMap<Object, Object> map1 = new HashMap<>();
HashMap<Object, Object> map2 = new HashMap<>();
HashMap<Object, Object> map3 = new HashMap<>();
map1.put("id", "strategy");
map1.put("name", strategy);
List<IndexVO> strategyList = collect.get("strategy");
map1.put("data", CollectionUtils.isEmpty(strategyList) ? new ArrayList<>() : strategyList);
map2.put("id", "Operations");
map2.put("name", Operations);
List<IndexVO> operationsList = collect.get("Operations");
map2.put("data", CollectionUtils.isEmpty(operationsList) ? new ArrayList<>() : operationsList);
map3.put("id", "SupportAndServices");
map3.put("name", SupportAndServices);
List<IndexVO> supportAndServicesList = collect.get("SupportAndServices");
map3.put("data", CollectionUtils.isEmpty(supportAndServicesList) ? new ArrayList<>() : supportAndServicesList);
ArrayList<HashMap> processGroupList = new ArrayList<>();
processGroupList.add(map1);
processGroupList.add(map2);
processGroupList.add(map3);
return processGroupList;
}
/**
* 获取流程制度中所有发布文件
*
* @return
*/
public List<JSONObject> getProcessAllFiles() {
List<JSONObject> allFiles = new ArrayList<>();
UtilService service = UtilService.getInstance();
String wsId = service.getDefaultWsId();
if (StringUtils.isEmpty(wsId)) {
return allFiles;
}
List<JSONObject> processType = service.getFirstProcessPalByPid(wsId, PalCategoryEnum.PROCESS.getKey());
for (JSONObject type : processType) {
String name = type.getString("name");
String id = type.getString("id");
int index = type.getIntValue("orderIndex");
String version = type.getString("version");
String versionId = type.getString("versionId");
if (!name.startsWith(String.valueOf(index))) {
continue;
}
if (!"1.0".equals(version) && StringUtils.isNotBlank(versionId)) {
id = versionId;
}
List<JSONObject> busProcess = service.getAllProcessPalByPid(wsId, id);
allFiles.addAll(busProcess);
}
return allFiles;
}
/**
* 查询文件详情
*
* @return
*/
public String queryRelFile(UserContext ux, String type, String id, int page, int size) {
ResponseObject ro = ResponseObject.newOkResponse();
long start = System.currentTimeMillis();
UtilService service = UtilService.getInstance();
String wsId = service.getDefaultWsId();
List list = new ArrayList<>();
if (type.equals("undefined") || id.equals("undefined")) {
ro.put("listData", new ArrayList<>());
ro.put("count", 0);
return ro.toString();
}
if (type.equals("process")) {
if (StringUtils.isEmpty(id)) {
ro.put("listData", new ArrayList<>());
ro.put("count", 0);
return ro.toString();
}
String fileData = getFileData(ux, id, page, size, wsId);
JSONObject jsonObject = JSONObject.parseObject(fileData);
JSONObject json = jsonObject.getJSONObject("data");
ro.put("listData", json.get("fileData"));
ro.put("count", json.get("count"));
long end1 = System.currentTimeMillis();
SDK.getLogAPI().consoleInfo("首页查询" + type + "数据耗时" + (end1 - start) + "毫秒");
return ro.toString();
} else if (type.equals("role")) {
list = getRoleData(wsId);
} else if (type.equals("post")) {
list = getPostDutyData(wsId);
} else {
String factorData = getFactor(ux, wsId, type, page, size);
JSONObject jsonObject = JSONObject.parseObject(factorData);
JSONObject json = jsonObject.getJSONObject("data");
ro.put("listData", json.get("fileData"));
ro.put("count", json.get("count"));
long end1 = System.currentTimeMillis();
SDK.getLogAPI().consoleInfo("首页查询" + type + "数据耗时" + (end1 - start) + "毫秒");
return ro.toString();
}
ro.put("listData", ViewUtil.pageUtil(list, page, size));
ro.put("count", list.size());
long end1 = System.currentTimeMillis();
SDK.getLogAPI().consoleInfo("首页查询" + type + "数据耗时" + (end1 - start) + "毫秒");
return ro.toString();
}
/**
* 岗位
*
* @return
*/
public List<PostVO> getPostDutyData(String wsId) {
List<PostVO> data = new ArrayList<>();
UtilService service = UtilService.getInstance();
List<JSONObject> firstProcessPalByPid = service.getFirstProcessPalByPid(wsId, PalCategoryEnum.ORG.getKey());
String id = "";
for (JSONObject process : firstProcessPalByPid) {
String name = process.getString("name");
if ("岗位模型".equals(name)) {
String versionId = process.getString("versionId");
String version = process.getString("version");
id = process.getString("id");
if (!"1.0".equals(version) && StringUtils.isNotBlank(versionId)) {
id = versionId;
}
break;
}
}
List<PALRepositoryModel> list = new ArrayList<>();
PALRepositoryQueryAPIManager.getInstance().getAllPublishedPalRepositoryModelsByPid(wsId, id, list);
for (PALRepositoryModel model : list) {
String define = PALRepositoryQueryAPIManager.getInstance().getProcessDefinition(null, model.getId());
JSONObject definition = JSONObject.parseObject(define);
JSONObject elements = definition.getJSONObject("elements");// 形状列表
for (String key : elements.keySet()) {
PostVO postVO = new PostVO();
JSONObject value = elements.getJSONObject(key);
postVO.setPostId(value.getString("id"));
JSONArray dataAttributes = value.getJSONArray("dataAttributes");
for (int i = 0; i < dataAttributes.size(); i++) {
String attId = dataAttributes.getJSONObject(i).getString("id");
if ("number".equals(attId)) {
postVO.setPostNO(dataAttributes.getJSONObject(i).getString("value"));
break;
}
}
postVO.setPostName(value.getString("text"));
postVO.setFileId(model.getId());
postVO.setFileName(model.getName());
data.add(postVO);
}
}
return data;
}
/**
* 获取角色数据
*
* @return
*/
public List<RoleVO> getRoleData(String wsId) {
List<RoleVO> data = new ArrayList<>();
UtilService service = UtilService.getInstance();
List<JSONObject> firstProcessPalByPid = service.getFirstProcessPalByPid(wsId, PalCategoryEnum.ORG.getKey());
String id = "";
for (JSONObject process : firstProcessPalByPid) {
String name = process.getString("name");
if ("角色模型".equals(name)) {
String versionId = process.getString("versionId");
String version = process.getString("version");
id = process.getString("id");
if (!"1.0".equals(version) && StringUtils.isNotBlank(versionId)) {
id = versionId;
}
break;
}
}
List<PALRepositoryModel> list = new ArrayList<>();
PALRepositoryQueryAPIManager.getInstance().getAllPublishedPalRepositoryModelsByPid(wsId, id, list);
for (PALRepositoryModel model : list) {
String define = PALRepositoryQueryAPIManager.getInstance().getProcessDefinition(null, model.getId());
JSONObject definition = JSONObject.parseObject(define);
JSONObject elements = definition.getJSONObject("elements");// 形状列表
for (String key : elements.keySet()) {
RoleVO roleVO = new RoleVO();
JSONObject value = elements.getJSONObject(key);
roleVO.setRoleId(value.getString("id"));
JSONArray dataAttributes = value.getJSONArray("dataAttributes");
JSONArray jsonArray = new JSONArray();
if (dataAttributes != null && dataAttributes.size() > 0) {
jsonArray = dataAttributes.getJSONObject(0).getJSONArray("attributesJsonArray");
}
for (int i = 0; i < jsonArray.size(); i++) {
String attId = jsonArray.getJSONObject(i).getString("id");
if ("number".equals(attId)) {
roleVO.setRoleNo(jsonArray.getJSONObject(i).getString("value"));
break;
}
}
List<DesignerShapeRelationModel> listByShapeIdAndRelationShapeId = new DesignerShapeRelationDao().getModelListByShapeIdAndRelationShapeId(model.getId(), value.getString("id"), null, null);
if (listByShapeIdAndRelationShapeId != null && listByShapeIdAndRelationShapeId.size() > 0) {
List<String> postName = new ArrayList<>();
for (DesignerShapeRelationModel post : listByShapeIdAndRelationShapeId) {
if ("post".equals(post.getAttrId())) {
postName.add(post.getRelationShapeText());
}
}
roleVO.setRelPost(postName);
}
roleVO.setName(value.getString("text"));
roleVO.setFileId(model.getId());
roleVO.setFileName(model.getName());
data.add(roleVO);
}
}
return data;
}
/**
* 要素
*
* @param ux
* @param wsId 资产库id
* @param type 要素类型
* @return
*/
public String getFactor(UserContext ux, String wsId, String type, int page, int size) {
List<JSONObject> processAllFiles = new ArrayList<>();
UtilService service = UtilService.getInstance();
switch (type) {
case "kpi":
//绩效指标
processAllFiles = service.getAllProcessPalByPid(wsId, PalCategoryEnum.CONTROL.getKey());
break;
case "form":
//表单
List<JSONObject> formFiles = getProcessAllFiles();
for (JSONObject file : formFiles) {
String methodId = file.getString("methodId");
if (PalCategoryEnum.FORM.getValue().equals(methodId)) {
processAllFiles.add(file);
}
}
break;
case "regime":
//制度
List<JSONObject> regimeFiles = getProcessAllFiles();
for (JSONObject file : regimeFiles) {
String methodId = file.getString("methodId");
String ext3 = file.getString("ext3");
if (PalCategoryEnum.POLICY.getValue().equals(methodId) && StringUtils.isNotBlank(ext3) && "regulation".equals(ext3)) {
processAllFiles.add(file);
}
}
break;
case "term":
//操作指导
List<JSONObject> termFiles = getProcessAllFiles();
for (JSONObject file : termFiles) {
String methodId = file.getString("methodId");
String ext3 = file.getString("ext3");
if (PalCategoryEnum.POLICY.getValue().equals(methodId) && !(StringUtils.isNotBlank(ext3) && "regulation".equals(ext3))) {
processAllFiles.add(file);
}
}
break;
case "stand":
//流程图
List<JSONObject> standFiles = getProcessAllFiles();
for (JSONObject file : standFiles) {
String methodId = file.getString("methodId");
if (PalCategoryEnum.FLOWCHART.getValue().equals(methodId) || PalCategoryEnum.EPC.getValue().equals(methodId)) {
processAllFiles.add(file);
}
}
break;
case "compliance":
//方案
List<JSONObject> complianceFiles = getProcessAllFiles();
for (JSONObject file : complianceFiles) {
String methodId = file.getString("methodId");
if (PalCategoryEnum.SCHEME.getValue().equals(methodId)) {
processAllFiles.add(file);
}
}
break;
case "system":
//标准
List<JSONObject> systemFiles = getProcessAllFiles();
for (JSONObject file : systemFiles) {
String methodId = file.getString("methodId");
if (PalCategoryEnum.STANDARD.getValue().equals(methodId)) {
processAllFiles.add(file);
}
}
break;
}
List data = ViewUtil.pageUtil(setProcessAttr(ux, processAllFiles), page, size);
ResponseObject ro = ResponseObject.newOkResponse();
ro.put("fileData", data);
ro.put("count", processAllFiles.size());
ro.put("processCount", processAllFiles.size());
return ro.toString();
}
/**
* 获取战略运营支持与服务数据明细
*
* @param ux
* @param parentId
* @param page
* @param size
* @return
*/
public String getFileData(UserContext ux, String parentId, int page, int size, String wsId) {
UtilService service = UtilService.getInstance();
List<JSONObject> files = service.getAllProcessPalByPid(wsId, parentId);
List data = ViewUtil.pageUtil(setProcessAttr(ux, files), page, size);
ResponseObject ro = ResponseObject.newOkResponse();
ro.put("fileData", data);
ro.put("count", files.size());
ro.put("processCount", files.size());
return ro.toString();
}
/**
* 获取流程文件数据
*
* @param ux 用户上下文
* @param files 文件明细
* @return
*/
public List setProcessAttr(UserContext ux, List<JSONObject> files) {
List<ProcessFileVO> data = new ArrayList<>();
String sid = ux.getSessionId();
for (JSONObject row : files) {
String id = row.getString("id");
//跳转链接
String url = "./w?sid=" + sid + "&cmd=" + Constants.openCmd + "&uuid=" + id + "&taskId=";
//文件类型
String type = I18nRes.findValue(Constants.COE_APP_ID, row.getString("methodId"));
//文件编号
String fileNo = getFileProper(id, "file_number");
//发布部门
String dutyDept = getFileProper(id, "Issuing_department");
if (StringUtils.isNotEmpty(dutyDept)){
try {
JSONObject jsonObject = JSONObject.parseObject(dutyDept);
dutyDept = jsonObject.getString("shapeText");
}catch (Exception e){
e.printStackTrace();
System.out.println("发布部门非JSON格式转化失败显示原值。文件ID"+ id);
}
}
//流程架构L1
String processL1 = getFileProper(id, "Process_Architecture_L1");
//流程架构L2
String processL2 = getFileProper(id, "Process_Architecture_L2");
//流程架构L3
String processL3 = getFileProper(id, "Process_Architecture_L3");
//拟制/修订人
String changeUser = getFileProper(id, "Drafted_and_revised_by");
//审核人
String auditor = getFileProper(id, "auditor");
//复核人
String reviewer = getFileProper(id, "reviewer");
//审批人
String approver = getFileProper(id, "approver");
//拟制/修订日期
String changeDate = getFileProper(id, "Drafted_and_revised_date");
//生效日期
String effectiveDate = getFileProper(id, "effective_date");
ProcessFileVO processFileVO = new ProcessFileVO(url, id, type, row.getString("name"), fileNo, dutyDept, processL1, processL2, processL3, changeUser, auditor, reviewer, approver, changeDate, effectiveDate);
data.add(processFileVO);
}
return data;
}
/**
* 获取文件属性
*
* @param id 文件ID
* @param propertyId 属性ID
* @return
*/
public String getFileProper(String id, String propertyId) {
PALRepositoryPropertyModel propModel = PALRepositoryPropertyCache.getPropertyByPropertyId(id, propertyId);
if (propModel != null) {
return propModel.getPropertyValue();
} else {
return "";
}
}
}

View File

@ -0,0 +1,94 @@
package com.awspaas.user.apps.nqms.portal.indexpage.service;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.apps.nqms.portal.indexpage.dao.RepositoryDao;
import org.apache.commons.lang.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ydq
* @date 2025/08/15
* @description
*/
public class UtilService {
private UtilService() {
}
private static class FactorInstance {
private static UtilService instance = new UtilService();
}
public static UtilService getInstance() {
return FactorInstance.instance;
}
/**
* 查询默认访问的资产库id
*
* @return
*/
public String getDefaultWsId() {
String wsName = SDK.getAppAPI().getProperty("com.awspaas.user.apps.nqms.portal.indexpage", "wsName");
RepositoryDao repositoryDao = new RepositoryDao();
String wsId = "";
if (StringUtils.isEmpty(wsName)) {
wsId = repositoryDao.getDefaultWsId();
}
wsId = repositoryDao.getWsId(wsName);
return wsId;
}
public String getWsIdWarnMsg() {
ResponseObject ro = ResponseObject.newWarnResponse("请检查【门户首页】应用中参数[默认资产库名称]是否配置正确");
return ro.toString();
}
/**
* 根据根id获取下面的全部数据(流程类)
* 不包含文件夹
*
* @param wsId
* @param pid
* @return
*/
public List<JSONObject> getAllProcessPalByPid(String wsId, String pid) {
List<JSONObject> list = SDK.getPALRepositoryQueryAPI().getAllPublishedPalRepositoryModelsByPid(wsId, pid);
return list;
}
/**
* 根据根id获取第一级子流程(流程类)
*
* @param wsId
* @param pid
* @return
*/
public List<JSONObject> getFirstProcessPalByPid(String wsId, String pid) {
List<JSONObject> list = SDK.getPALRepositoryQueryAPI().getPalRepositoryModelsByPid(wsId, pid);
list = list.stream().filter(el -> el.getBoolean("use")).collect(Collectors.toList());
return list;
}
/**
* 获取门户战略屋的logo图片地址
*
* @param ux
* @return
*/
public Map<String, String> getLogoSrc(UserContext ux) {
String rootSrc = "../apps/com.awspaas.user.apps.nqms.portal.indexpage/img/";
String topSrc = rootSrc + "topIcon.png";
String bottomSrc = rootSrc + "bottomIcon.png";
HashMap<String, String> map = new HashMap<>();
map.put("topSrc", topSrc);
map.put("bottomSrc", bottomSrc);
return map;
}
}

View File

@ -0,0 +1,29 @@
package com.awspaas.user.apps.nqms.portal.indexpage.util;
import com.actionsoft.bpms.commons.database.RowMap;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @author ydq
* @date 2025/08/15
* @description
*/
public class ViewUtil {
public static List pageUtil(List list, int page, int size) {
if (page==0&&size==0){
return list;
}
List data = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
if (size * (page - 1) <= i && i < (size * page)) {
data.add(list.get(i));
}
}
return data;
}
}

View File

@ -0,0 +1,109 @@
package com.awspaas.user.apps.nqms.portal.indexpage.vo;
import java.util.ArrayList;
import java.util.List;
/**
* @author wym
* @date 2023-04-25 9:25
* @description
*/
public class IndexVO {
/**
* 业务域id
*/
private String id;
/**
* 内容
*/
private String name;
/**
* 所属分类
*/
private String type;
/**
* 所属分组
*/
private String group;
/**
* 总数
*/
private int allCount;
/**
* 有权限查看的文件数量
*/
private int pubCount;
/**
* 已发布文件的id集合
*/
private List<String> list = new ArrayList<>();
public IndexVO() {
}
public IndexVO(String type, String id, String name, String group, int allCount, int pubCount, List<String> list) {
this.id = id;
this.name = name;
this.type = type;
this.group = group;
this.allCount = allCount;
this.pubCount = pubCount;
this.list = list;
}
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 getGroup() {
return group;
}
public void setGroup(String group) {
this.group = group;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getAllCount() {
return allCount;
}
public void setAllCount(int allCount) {
this.allCount = allCount;
}
public int getPubCount() {
return pubCount;
}
public void setPubCount(int pubCount) {
this.pubCount = pubCount;
}
public List<String> getList() {
return list;
}
public void setList(List<String> list) {
this.list = list;
}
}

View File

@ -0,0 +1,83 @@
package com.awspaas.user.apps.nqms.portal.indexpage.vo;
import com.actionsoft.sdk.local.SDK;
import com.alipay.remoting.util.StringUtils;
import java.util.List;
/**
* @author wym
* @date 2023-04-28 10:36
* @description 岗位视图
*/
public class PostVO {
/**
*
*/
private String fileId;
/**
* 文件名称
*/
private String fileName;
/**
*
*/
private String postId;
/**
* 岗位编号
*/
private String postNO;
/**
* 岗位名称
*/
private String postName;
public PostVO() {
}
public PostVO(String postId, String postNO, String postName, String postDuty, List<String> relProcess) {
this.postId = postId;
this.postNO = postNO;
this.postName = postName;
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getPostId() {
return postId;
}
public void setPostId(String postId) {
this.postId = postId;
}
public String getPostNO() {
return postNO;
}
public void setPostNO(String postNO) {
this.postNO = postNO;
}
public String getPostName() {
return postName;
}
public void setPostName(String postName) {
this.postName = postName;
}
}

View File

@ -0,0 +1,228 @@
package com.awspaas.user.apps.nqms.portal.indexpage.vo;
/**
* @author wym
* @date 2023-04-23 15:34
* @description
*/
public class ProcessFileVO {
/**
*
*/
private String url;
/**
*
*/
private String id;
/**
* 分类
*/
private String type;
/**
* 文件名称
*/
private String fileName;
/**
* 文件编号
*/
private String fileNo;
/**
* 发布部门
*/
private String dutyDept;
/**
* 流程架构L1
*/
private String processL1;
/**
* 流程架构L2
*/
private String processL2;
/**
* 流程架构L3
*/
private String processL3;
/**
* 拟制/修订人
*/
private String changeUser;
/**
* 审核人
*/
private String auditor;
/**
* 复核人
*/
private String reviewer;
/**
* 审批人
*/
private String approver;
/**
* 拟制/修订日期
*/
private String changeDate;
/**
* 生效日期
*/
private String effectiveDate;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDutyDept() {
return dutyDept;
}
public void setDutyDept(String dutyDept) {
this.dutyDept = dutyDept;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileNo() {
return fileNo;
}
public void setFileNo(String fileNo) {
this.fileNo = fileNo;
}
public String getProcessL1() {
return processL1;
}
public void setProcessL1(String processL1) {
this.processL1 = processL1;
}
public String getProcessL2() {
return processL2;
}
public void setProcessL2(String processL2) {
this.processL2 = processL2;
}
public String getProcessL3() {
return processL3;
}
public void setProcessL3(String processL3) {
this.processL3 = processL3;
}
public String getChangeUser() {
return changeUser;
}
public void setChangeUser(String changeUser) {
this.changeUser = changeUser;
}
public String getAuditor() {
return auditor;
}
public void setAuditor(String auditor) {
this.auditor = auditor;
}
public String getReviewer() {
return reviewer;
}
public void setReviewer(String reviewer) {
this.reviewer = reviewer;
}
public String getApprover() {
return approver;
}
public void setApprover(String approver) {
this.approver = approver;
}
public String getChangeDate() {
return changeDate;
}
public void setChangeDate(String changeDate) {
this.changeDate = changeDate;
}
public String getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(String effectiveDate) {
this.effectiveDate = effectiveDate;
}
@Override
public String toString() {
return "ProcessFileVO{" +
"url='" + url + '\'' +
", id='" + id + '\'' +
", type='" + type + '\'' +
", fileName='" + fileName + '\'' +
", fileNo='" + fileNo + '\'' +
", dutyDept='" + dutyDept + '\'' +
", processL1='" + processL1 + '\'' +
", processL2='" + processL2 + '\'' +
", processL3='" + processL3 + '\'' +
", changeUser='" + changeUser + '\'' +
", auditor='" + auditor + '\'' +
", reviewer='" + reviewer + '\'' +
", approver='" + approver + '\'' +
", changeDate='" + changeDate + '\'' +
", effectiveDate='" + effectiveDate + '\'' +
'}';
}
public ProcessFileVO(String url, String id, String type, String fileName, String fileNo, String dutyDept, String processL1, String processL2, String processL3, String changeUser, String auditor, String reviewer, String approver, String changeDate, String effectiveDate) {
this.url = url;
this.id = id;
this.type = type;
this.fileName = fileName;
this.fileNo = fileNo;
this.dutyDept = dutyDept;
this.processL1 = processL1;
this.processL2 = processL2;
this.processL3 = processL3;
this.changeUser = changeUser;
this.auditor = auditor;
this.reviewer = reviewer;
this.approver = approver;
this.changeDate = changeDate;
this.effectiveDate = effectiveDate;
}
}

View File

@ -0,0 +1,116 @@
package com.awspaas.user.apps.nqms.portal.indexpage.vo;
import java.util.List;
/**
* Created with IntelliJ IDEA.
*
* @Author: yuandongqiang
* @Date: 2025/8/14
* @Description:
*/
public class RoleVO {
/**
* 角色id
*/
private String roleId;
/**
*角色编号
*/
private String roleNo;
/**
*角色名称
*/
private String name;
/**
* 所属文件id
*/
private String fileId;
/**
* 所属文件名称
*/
private String fileName;
/**
*关联岗位的名称
*/
private String relPost="";
public RoleVO() {
}
public RoleVO(String roleId, String roleNo, String name, List<String> relPost) {
this.roleId = roleId;
this.roleNo = roleNo;
this.name = name;
String join = String.join(",", relPost);
this.relPost = join;
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getRoleNo() {
return roleNo;
}
public void setRoleNo(String roleNo) {
this.roleNo = roleNo;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getRelPost() {
return this.relPost;
}
public void setRelPost(List<String> relPost) {
String join = String.join(",", relPost);
this.relPost = join;
}
@Override
public String toString() {
return "RoleVO{" +
"roleId='" + roleId + '\'' +
", roleNo='" + roleNo + '\'' +
", name='" + name + '\'' +
", fileId='" + fileId + '\'' +
", fileName='" + fileName + '\'' +
", relPost=" + relPost +
'}';
}
}