Merge branch 'apps_dev_ydq_portal_home' into apps_4_test

This commit is contained in:
袁东强 2025-09-25 10:01:38 +08:00
commit d87c2b92d9
6 changed files with 320 additions and 7 deletions

View File

@ -0,0 +1,125 @@
package com.awspaas.user.apps.nqms.portal.indexpage.job;
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
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.PalCategoryEnum;
import com.awspaas.user.apps.nqms.portal.indexpage.service.IndexService;
import com.awspaas.user.apps.nqms.portal.indexpage.service.UtilService;
import org.apache.commons.lang.StringUtils;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created with IntelliJ IDEA.
*
* @Author: yuandongqiang
* @Date: 2025/9/6
* @Description:
*/
public class CountKpiJob implements IJob {
Logger log = LoggerFactory.getLogger(CountKpiJob.class);
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.info("抓取控制分类下绩效数据定时器=========开始执行");
UtilService service = UtilService.getInstance();
String wsId = service.getDefaultWsId();
if (StringUtils.isEmpty(wsId)) {
log.info("抓取控制分类下绩效数据定时器=========获取资产库ID失败取消执行");
throw new RuntimeException("获取资产库ID失败");
}
log.info("抓取控制分类下绩效数据定时器=========开始获取绩效数据");
List<BO> kpiDutyData = getKpiDutyData(wsId);
log.info("抓取控制分类下绩效数据定时器=========获取绩效数据完成");
log.info("抓取控制分类下绩效数据定时器=========清空绩效表数据");
DBSql.update("TRUNCATE TABLE BO_EU_PORTAL_PERSON_KPI");
log.info("抓取控制分类下绩效数据定时器=========创建最新绩效数据");
SDK.getBOAPI().createDataBO("BO_EU_PORTAL_PERSON_KPI", kpiDutyData, UserContext.fromUID("admin"));
log.info("抓取控制分类下绩效数据定时器=========创建最新绩效数据完成");
log.info("抓取控制分类下绩效数据定时器=========执行完成");
}
/**
* 获取绩效数据
* wsId 资产库ID
* id 父级ID
*
* @return
*/
public List<BO> getKpiDutyData(String wsId) {
Map<String, String> attributesTobo = attributesTobo();
List<BO> data = new ArrayList<>();
List<PALRepositoryModel> list = new ArrayList<>();
PALRepositoryQueryAPIManager.getInstance().getAllPublishedPalRepositoryModelsByPid(wsId, PalCategoryEnum.CONTROL.getKey(), 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()) {
JSONObject value = elements.getJSONObject(key);
BO bo = new BO();
bo.set("FILE_NAME", model.getName());//文件名称
bo.set("FILE_ID", model.getId());//文件ID
bo.set("KPI_NAME", value.getString("text"));//绩效名称
bo.set("KPI_IP", value.getString("id"));//绩效ID
bo.set("TYPE", value.getString("title"));//类型
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 (attributesTobo.containsKey(attId)) {
bo.set(attributesTobo.get(attId), jsonArray.getJSONObject(i).getString("value"));
}
}
data.add(bo);
}
}
return data;
}
/**
* 属性与bo字段转化
*
* @return
*/
public Map<String, String> attributesTobo() {
Map<String, String> map = new HashMap<>();
map.put("Number_of_the_associated_flow_file", "PROCESS_NUM");//关联流程文件编号
map.put("Associated_process_name", "PROCESS_NAME");//关联流程名称
map.put("Process_performance_indicator_Number", "PROCESS_KPI_NUM");//流程绩效指标编号
map.put("Index_definition", "KPI_DEFINITIOM");//指标定义
map.put("unit_measurement", "UNIT");//计量单位
map.put("statistical_period", "STATISTICAL_PERIOD");//统计周期
map.put("ndicator_User_defined_label", "NDICATOT_DEFINED_LANLE");//指标定义标签
map.put("The_upstream_indicators", "UPSTREAM_INDICATORS");//上游指标
map.put("Downstream_target", "DOWNSTREAM_TARGET");//下游指标
map.put("Platform_data_Display", "PLATFORM_DATA");//平台数据展示
map.put("remark", "REMARK");//备注
map.put("set_the_purpose", "PURPOSE");//设置目的
map.put("explain", "KPI_EXPLAIN");//说明
map.put("tagContentTableTr", "ELEMENT");//元素
map.put("desc", "KPI_DESC");//描述
map.put("Data_fetch_logic", "DATA_FETCH_LOGIN");//数据取数逻辑
map.put("Take_the_number_aperture", "NUMBER_APERTURE");//取数路径
map.put("data_sources", "DATA_SOURCES");//数据来源
map.put("computational_formula", "COMPUTATIONAL_FORMULA");//计算公式
return map;
}
}

View File

@ -0,0 +1,88 @@
package com.awspaas.user.apps.nqms.portal.indexpage.job;
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.apps.nqms.portal.indexpage.constant.PalCategoryEnum;
import com.awspaas.user.apps.nqms.portal.indexpage.service.IndexService;
import com.awspaas.user.apps.nqms.portal.indexpage.service.UtilService;
import org.apache.commons.lang.StringUtils;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* Created with IntelliJ IDEA.
*
* @Author: yuandongqiang
* @Date: 2025/8/28
* @Description:
*/
public class CountProcessGraphJob implements IJob {
Logger log = LoggerFactory.getLogger(CountProcessGraphJob.class);
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.info("抓取流程制度分类下泳道图、EPC图下的模型块数据定时器=========开始执行");
UtilService service = UtilService.getInstance();
String wsId = service.getDefaultWsId();
if (StringUtils.isEmpty(wsId)) {
log.info("抓取流程制度分类下泳道图、EPC图下的模型块数据定时器=========获取资产库ID失败取消执行");
throw new RuntimeException("获取资产库ID失败");
}
log.info("抓取流程制度分类下泳道图、EPC图下的模型块数据定时器=========开始获取数据");
List<BO> postDutyData = getProcessGraph(wsId);
log.info("抓取流程制度分类下泳道图、EPC图下的模型块数据定时器=========获取数据完成");
log.info("抓取流程制度分类下泳道图、EPC图下的模型块数据定时器=========清空表数据");
DBSql.update("TRUNCATE TABLE BO_EU_PORTAL_INDEX_PRO_GRAPH");
log.info("抓取流程制度分类下泳道图、EPC图下的模型块数据定时器=========创建最新数据");
SDK.getBOAPI().createDataBO("BO_EU_PORTAL_INDEX_PRO_GRAPH", postDutyData, UserContext.fromUID("admin"));
log.info("抓取流程制度分类下泳道图、EPC图下的模型块数据定时器=========创建最新数据完成");
log.info("抓取流程制度分类下泳道图、EPC图下的模型块数据定时器=========执行完成");
}
/**
* 获取泳道图EPC图下的模型块数据
*
* @param wsId 资产库ID
* @return 数据
*/
public List<BO> getProcessGraph(String wsId) {
List<BO> data = new ArrayList<>();
List<JSONObject> allFiles = new ArrayList<>();
IndexService instance = IndexService.getInstance();
instance.getProcess1(wsId, allFiles);
for (JSONObject process : allFiles) {
String methodId = process.getString("methodId");
if (!PalCategoryEnum.FLOWCHART.getValue().equals(methodId) && !PalCategoryEnum.EPC.getValue().equals(methodId)) {
continue;
}
try {
String define = PALRepositoryQueryAPIManager.getInstance().getProcessDefinition(null, process.getString("id"));
JSONObject definition = JSONObject.parseObject(define);
JSONObject elements = definition.getJSONObject("elements");// 形状列表
for (String key : elements.keySet()) {
BO bo = new BO();
JSONObject value = elements.getJSONObject(key);
bo.set("GRAPH_ID", value.getString("id"));
bo.set("GRAPH_NAME", value.getString("text"));
bo.set("FILE_ID", process.getString("id"));
bo.set("FILE_NAME", process.getString("name"));
data.add(bo);
}
} catch (Exception e) {
log.error("获取关联数据失败", e);
}
}
return data;
}
}

View File

@ -0,0 +1,29 @@
package com.awspaas.user.apps.nqms.portal.indexpage.plugin;
import com.actionsoft.apps.coe.pal.aslp.QueryIsActiveWorkSpace;
import com.actionsoft.apps.listener.PluginListener;
import com.actionsoft.apps.resource.AppContext;
import com.actionsoft.apps.resource.plugin.profile.ASLPPluginProfile;
import com.actionsoft.apps.resource.plugin.profile.AWSPluginProfile;
import com.actionsoft.apps.resource.plugin.profile.HttpASLP;
import com.awspaas.user.apps.nqms.portal.indexpage.plugin.aslp.QueryAllProcessFiles;
import java.util.ArrayList;
import java.util.List;
/**
* Created with IntelliJ IDEA.
*
* @Author: yuandongqiang
* @Date: 2025/8/28
* @Description:
*/
public class Plugins implements PluginListener {
@Override
public List<AWSPluginProfile> register(AppContext appContext) {
List<AWSPluginProfile> list = new ArrayList<AWSPluginProfile>();
list.add(new ASLPPluginProfile("queryAllProcessFiles", QueryAllProcessFiles.class.getName(), "获取流程制度分类下所有的文件数据", new HttpASLP(HttpASLP.AUTH_AWS_SID, null)));
return list;
}
}

View File

@ -0,0 +1,60 @@
package com.awspaas.user.apps.nqms.portal.indexpage.plugin.aslp;
import com.actionsoft.apps.coe.pal.aslp.AslpUtil;
import com.actionsoft.apps.resource.interop.aslp.ASLP;
import com.actionsoft.apps.resource.interop.aslp.Meta;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.server.UserContext;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.apps.nqms.portal.indexpage.service.IndexService;
import com.awspaas.user.apps.nqms.portal.indexpage.service.UtilService;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created with IntelliJ IDEA.
*
* @Author: yuandongqiang
* @Date: 2025/8/28
* @Description:
*/
public class QueryAllProcessFiles implements ASLP {
@Override
@Meta(parameter = {"name:'sid',required:true,allowEmpty:false,desc:'sessionId'"})
public ResponseObject call(Map<String, Object> params) {
ResponseObject checkParams = AslpUtil.isParamsEmpty(params);
if (checkParams.isErr()) {
return checkParams;
}
if (!params.containsKey("sid")) {
return ResponseObject.newErrResponse().err("sid参数不允许为空!");
}
String sid = params.get("sid").toString();
UserContext userContext = null;
try {
userContext = UserContext.fromSessionId(sid);
} catch (Exception e) {
return ResponseObject.newErrResponse().err("生成用户上下文失败!");
}
if (userContext == null) {
return ResponseObject.newErrResponse().err("sessionId无效!");
}
List<JSONObject> allFiles = new ArrayList<>();
UtilService service = UtilService.getInstance();
String wsId = service.getDefaultWsId();
if (StringUtils.isEmpty(wsId)) {
return ResponseObject.newWarnResponse("请检查【门户首页】应用中参数[默认资产库名称]是否配置正确");
}
IndexService instance = IndexService.getInstance();
instance.getProcess1(wsId, allFiles);
IndexService indexService = IndexService.getInstance();
allFiles = indexService.setProcessAttr(userContext, allFiles);
ResponseObject result = ResponseObject.newOkResponse();
result.setData(allFiles);
return result;
}
}

View File

@ -1,17 +1,12 @@
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.bo.engine.BO;
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;
@ -279,6 +274,8 @@ public class IndexService {
group = "Operations";
} else if (zclSet.contains(String.valueOf( index))) {
group = "SupportAndServices";
}else {
continue;
}
if (!"1.0".equals(version) && StringUtils.isNotBlank(versionId)) {
id = versionId;
@ -577,7 +574,7 @@ public class IndexService {
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);
ProcessFileVO processFileVO = new ProcessFileVO(url, id, type, row.getString("methodId"), row.getString("name"), fileNo, dutyDept, processL1, processL2, processL3, changeUser, auditor, reviewer, approver, changeDate, effectiveDate);
data.add(processFileVO);
}
return data;

View File

@ -18,6 +18,10 @@ public class ProcessFileVO {
* 分类
*/
private String type;
/**
* 分类ID
*/
private String methodId;
/**
* 文件名称
*/
@ -99,6 +103,14 @@ public class ProcessFileVO {
this.type = type;
}
public String getMethodId() {
return methodId;
}
public void setMethodId(String methodId) {
this.methodId = methodId;
}
public String getFileName() {
return fileName;
}
@ -193,6 +205,7 @@ public class ProcessFileVO {
"url='" + url + '\'' +
", id='" + id + '\'' +
", type='" + type + '\'' +
", methodId='" + methodId + '\'' +
", fileName='" + fileName + '\'' +
", fileNo='" + fileNo + '\'' +
", dutyDept='" + dutyDept + '\'' +
@ -208,10 +221,11 @@ public class ProcessFileVO {
'}';
}
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) {
public ProcessFileVO(String url, String id, String type, String methodId, 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.methodId = methodId;
this.fileName = fileName;
this.fileNo = fileNo;
this.dutyDept = dutyDept;