处理代码格式

This commit is contained in:
袁东强 2025-07-14 13:57:41 +08:00
parent e96ff031a4
commit 5f4988c5aa

View File

@ -3,48 +3,31 @@ package com.actionsoft.apps.coe.pal.pal.repository.designer.web;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
//import com.actionsoft.apps.AppsConst;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
//import com.actionsoft.apps.coe.pal.pal.method.validate.constant.ValidateStatusEnum;
//import com.actionsoft.apps.coe.pal.pal.processexec.ProcessExecAPIManager;
//import com.actionsoft.apps.coe.pal.pal.processexec.util.ProcessExecUtil;
//import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.cache.CoeProcessLevelCorrelateCache;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.constant.CoeDesignerConstant;
import com.actionsoft.apps.coe.pal.pal.repository.designer.dto.VersionCompareDTO;
import com.actionsoft.apps.coe.pal.pal.repository.designer.dto.VersionListDTO;
//import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerDcUtil;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.DesignerVersionUtil;
import com.actionsoft.apps.coe.pal.pal.repository.designer.vo.VersionListVO;
import com.actionsoft.apps.coe.pal.pal.repository.model.CoeProcessLevelCorrelateModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil;
//import com.actionsoft.apps.coe.pal.util.CoeDcUtil;
import com.actionsoft.bpms.bpmn.constant.ProcessDefinitionConst;
import com.actionsoft.bpms.bpmn.engine.cache.ProcessDefCache;
import com.actionsoft.bpms.bpmn.engine.cache.util.ProcessDefVersionUtil;
import com.actionsoft.bpms.bpmn.engine.model.def.ProcessDefinition;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.fs.DCContext;
import com.actionsoft.bpms.util.UtilDate;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.AWSException;
import com.actionsoft.i18n.I18nRes;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
/**
@ -107,169 +90,6 @@ public class CoeDesignerVersionWeb extends ActionWeb {
return ro.toString();
}
// /**
// * PAL版本管理-查询版本数据
// *
// * @param wsId 资产库ID
// * @param teamId 小组ID
// * @param id 模型ID
// */
// public String getPalProcessLevelVersionData(String wsId, String teamId, String id) {
// PALRepositoryModel plModel = PALRepositoryCache.getCache().get(id);
// if (plModel == null) {
// return ResponseObject.newErrResponse(I18nRes.findValue(CoEConstant.APP_ID, "文件不存在")).toString();
// }
// ResponseObject ro = ResponseObject.newOkResponse();
// ro.put("isCorrelatebpms", false);
// ro.put("hasHistory", false);
// ro.put("processDefId", "");
//
// boolean isPalManage = CoeProcessLevelUtil.isPalManage();
// boolean bpmSupportMinor = false;
// Set<String> palVersionNoSet = new HashSet<>();
// JSONArray array = new JSONArray();
// JSONArray historyArray = new JSONArray();
// boolean hasProcessControlPerm = true;
// List<PALRepositoryModel> plVersionModels = PALRepositoryCache.getByVersionId(plModel.getVersionId());
// for (PALRepositoryModel model : plVersionModels) {
// String plId = model.getId();
// palVersionNoSet.add(VersionUtil.getVerAndVerD(model.getVersion(), model.getVersionD(), false));
// CoeProcessLevelCorrelateModel correlateModel = CoeProcessLevelCorrelateCache.getCache().get(plId);
// if (correlateModel == null) {
// JSONObject obj = wrapperHistoryVersionObj(model);
// historyArray.add(obj);
// continue;
// }
// String processDefId = correlateModel.isCorrelate() ? correlateModel.getPlAwsId() : correlateModel.getSourceAwsId();
// if (UtilString.isEmpty(processDefId)) {
// JSONObject obj = wrapperHistoryVersionObj(model);
// historyArray.add(obj);
// continue;
// }
// ProcessDefinition processDefinition = ProcessDefCache.getInstance().get(processDefId);
// if (processDefinition == null) {
// JSONObject obj = wrapperHistoryVersionObj(model);
// historyArray.add(obj);
// } else {
// // 判断bpm端是否支持小版本迭代
// bpmSupportMinor = PALRepositoryQueryAPIManager.getInstance().isBpmSupportMinorVersion(processDefinition);
// JSONObject obj = wrapperCorrelateVersionObj(model, processDefinition, isPalManage);
// array.add(obj);
// ro.put("isCorrelatebpms", true);
// // 梳理到执行 流程是否重命名新建版本 受到参数管控
// hasProcessControlPerm = ProcessExecAPIManager.getInstance().hasProcessControlPerm(id);
// }
// }
// if (array.isEmpty()) {
// ro.put("tableData", historyArray);
// ro.put("hasProcessControlPerm", hasProcessControlPerm);
// return ro.toString();
// } else {
// // 按时间逆序
// array.sort(Comparator.comparingLong(o -> ((JSONObject) o).getLongValue("correlateTime")).reversed()
// // 按版本号排序
// .thenComparing(o -> ((JSONObject) o).getString("palVersionNo")));
// }
// ro.put("isBpmSupportMinor", bpmSupportMinor);
// ro.put("versionNoSet", palVersionNoSet);
// ro.put("hasHistory", !historyArray.isEmpty());
// ro.put("historyData", historyArray);
// ro.put("tableData", array);
// ro.put("hasProcessControlPerm", hasProcessControlPerm);
// return ro.toString();
// }
//
// /**
// * 组装历史版本数据
// */
// private JSONObject wrapperHistoryVersionObj(PALRepositoryModel plModel) {
// JSONObject history = new JSONObject();
// history.put("id", plModel.getId());
// // 历史版本无设计中状态
// history.put("isUse", plModel.isUse());
// history.put("isPublish", plModel.isPublish());
// history.put("isStop", plModel.isStop());
// history.put("isApproval", plModel.isApproval());
// history.put("versionNo", VersionUtil.getVerAndVerD(plModel.getVersion(), plModel.getVersionD(), false));
// history.put("name", plModel.getName());
// history.put("createUser", SDK.getORGAPI().getUser(plModel.getCreateUser()) == null ? plModel.getCreateUser() : SDK.getORGAPI().getUser(plModel.getCreateUser()).getUserNameI18N());
// history.put("createDate", UtilDate.dateFormat(plModel.getCreateDate()));
// // 历史版本状态均为未关联状态
// history.put("bpmState", "未关联");
// history.put("bpmStateCode", "未关联");
// history.put("bpmStateColor", "#606266");
// ValidateStatusEnum validateStatusEnum = ValidateStatusEnum.getInstance(plModel.getValidateStatus());
// history.put("validateStatus", validateStatusEnum.getStatus());
// history.put("validateStatusColor", validateStatusEnum.getStatusColor());
// // 用于缩略图显示
// String photoType = "image";
// String photo = "";
// DCContext smallPngDc = CoeDesignerDcUtil.getDefineDc(plModel.getWsId(), plModel.getId(), CoeDesignerConstant.FILE_SUFFIX_SMALL_PNG);
// if (!smallPngDc.existFile()) {
// // 生成缩略图
// PALRepositoryQueryAPIManager.getInstance().saveImage(plModel.getId(), false, true);
// if (smallPngDc.existFile()) {
// photo = CoeDcUtil.dcContextToBase64(smallPngDc);
// } else {
// photoType = "icon";
// photo = "&#59101;";
// }
// }
// history.put("photo", photo);
// history.put("photoType", photoType);
// history.put("hasProcessControlPerm", true);
// return history;
//
// }
//
// /**
// * 组装已关联版本数据
// */
// private JSONObject wrapperCorrelateVersionObj(PALRepositoryModel plModel, ProcessDefinition processDefinition, boolean isPalManage) {
// JSONObject obj = new JSONObject();
// String versionStatus = "";
// String color = "#4E7FF9";
// int versionState = processDefinition.getVersionStatus();
// if (versionState == ProcessDefinitionConst.VERSION_STATUS_CLOSED) {
// versionStatus = ProcessDefVersionUtil.getVersionName(ProcessDefinitionConst.VERSION_STATUS_CLOSED);
// color = "#D9001B";
// } else if (versionState == ProcessDefinitionConst.VERSION_STATUS_DESIGN) {
// versionStatus = ProcessDefVersionUtil.getVersionName(ProcessDefinitionConst.VERSION_STATUS_DESIGN);
// } else if (versionState == ProcessDefinitionConst.VERSION_STATUS_RELEASE) {
// versionStatus = ProcessDefVersionUtil.getVersionName(ProcessDefinitionConst.VERSION_STATUS_RELEASE);
// color = "#1AA477";
// }
// obj.put("versionNo", VersionUtil.getBpmVersionNo(processDefinition, false));
// obj.put("palVersionNo", VersionUtil.getVerAndVerD(plModel.getVersion(), plModel.getVersionD(), false));
// obj.put("name", plModel.getName());
// obj.put("createUser", SDK.getORGAPI().getUser(processDefinition.getCreateUser()) == null ? processDefinition.getCreateUser() : SDK.getORGAPI().getUser(processDefinition.getCreateUser()).getUserNameI18N());
// obj.put("createDate", UtilDate.dateFormat(processDefinition.getCreateTime()));
// obj.put("bpmState", I18nRes.findValue(AppsConst.SYS_APP_PLATFORM, versionStatus));
// obj.put("bpmStateCode", versionStatus);
// obj.put("bpmStateColor", color);
// obj.put("isUse", plModel.isUse());
// obj.put("isPublish", plModel.isPublish());
// obj.put("isStop", plModel.isStop());
// obj.put("isApproval", plModel.isApproval());
// obj.put("id", plModel.getId());
// obj.put("awsId", processDefinition.getId());
// obj.put("isFirst", processDefinition.getId().equals(processDefinition.getVersionId()));
// obj.put("versionStatus", processDefinition.getVersionStatus());
// ValidateStatusEnum validateStatusEnum = ValidateStatusEnum.getInstance(plModel.getValidateStatus());
// obj.put("validateStatus", validateStatusEnum.getStatus());
// obj.put("validateStatusColor", validateStatusEnum.getStatusColor());
// obj.put("isCorrelate", false);
// obj.put("correlateTime", plModel.getCreateDate().getTime());
// CoeProcessLevelCorrelateModel correlateModel = CoeProcessLevelCorrelateCache.getCache().get(plModel.getId());
// if (isPalManage) {
// if (correlateModel != null && "show".equals(correlateModel.getExt1()) && correlateModel.getCorrelateType() == 1) {
// obj.put("isCorrelate", true);
// obj.put("correlateTime", correlateModel.getCreateDate().getTime());
// }
// }
// return obj;
// }
/**
* 版本对比
*
@ -279,20 +99,6 @@ public class CoeDesignerVersionWeb extends ActionWeb {
Map<String, Object> macroLibraries = queryDesignerVersionCompareMap(versionCompareDTO);
return HtmlPageTemplate.merge(CoEConstant.APP_ID, CoeDesignerConstant.DESIGNER_VERSION_COMPARE_PAGE, macroLibraries);
}
//
// /**
// * 版本对比
// *
// * @param versionCompareDTO 版本对比参数
// */
// public String designerVersionCompareParams(VersionCompareDTO versionCompareDTO) {
// // 获取对比版本的数据
// Map<String, Object> macroLibraries = queryDesignerVersionCompareMap(versionCompareDTO);
//
// ResponseObject ro = ResponseObject.newOkResponse();
// ro.setData(macroLibraries);
// return ro.toString();
// }
/**
* 获取 版本对比 map参数
@ -314,83 +120,4 @@ public class CoeDesignerVersionWeb extends ActionWeb {
return DesignerVersionUtil.queryDesignerVersionCompareMap(plModel.getWsId(), plModel.getMethodId(), plModel.getName(), versionCompareDTO.getCompareVerId(), versionData, versionCompareDTO.getCurId(), curData, false, false);
}
// /**
// * 与BPM端流程对比
// *
// * @param plId PAL 流程Id
// * @return 对比页面
// */
// public String compareBPMProcess(String plId) {
// CoeProcessLevelCorrelateModel correlateModel = CoeProcessLevelCorrelateCache.getCache().get(plId);
// if (correlateModel == null) {
// throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "获取流程关联信息失败"));
// }
// PALRepositoryModel plModel = PALRepositoryCache.getCache().get(plId);
// if (plModel == null) {
// throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "获取当前使用的版本数据失败"));
// }
// String awsId = correlateModel.getPlAwsId();
// // 获取BPM流程对比数据
// JSONObject curData = ProcessExecUtil.getBPMCompareData(awsId, plModel);
// // 获取PAL对比数据
// JSONObject versionData = ProcessExecUtil.getPALCompareData(plModel);
//
// Map<String, Object> macroLibraries = DesignerVersionUtil.queryDesignerVersionCompareMap(plModel.getWsId(), plModel.getMethodId(), plModel.getName(), plId, versionData, plId, curData, true, false);
// return HtmlPageTemplate.merge(CoEConstant.APP_ID, CoeDesignerConstant.DESIGNER_VERSION_COMPARE_PAGE, macroLibraries);
// }
//
// /**
// * 与BPM端流程对比
// *
// * @param plId PAL 流程Id
// * @return 对比页面
// */
// public String compareBPMProcessParams(String plId) {
// CoeProcessLevelCorrelateModel correlateModel = CoeProcessLevelCorrelateCache.getCache().get(plId);
// if (correlateModel == null) {
// throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "获取流程关联信息失败"));
// }
// PALRepositoryModel plModel = PALRepositoryCache.getCache().get(plId);
// if (plModel == null) {
// throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "获取当前使用的版本数据失败"));
// }
// String awsId = correlateModel.getPlAwsId();
// // 获取BPM流程对比数据
// JSONObject curData = ProcessExecUtil.getBPMCompareData(awsId, plModel);
// // 获取PAL对比数据
// JSONObject versionData = ProcessExecUtil.getPALCompareData(plModel);
//
// Map<String, Object> macroLibraries = DesignerVersionUtil.queryDesignerVersionCompareMap(plModel.getWsId(), plModel.getMethodId(), plModel.getName(), plId, versionData, plId, curData, true, false);
// ResponseObject ro = ResponseObject.newOkResponse();
// ro.setData(macroLibraries);
// return ro.toString();
// }
//
// /**
// * 与BPM端流程对比页面
// *
// * @param awsId BPM端流程Id
// * @return 对比页面
// */
// public String compareProcessToBPM(String awsId) {
// // 查询关联的PAL流程Id
// CoeProcessLevelCorrelateModel corrModel = CoeProcessLevelUtil.queryCorrelateModelyPlAwsId(awsId);
// if (corrModel == null) {
// throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "获取流程关联信息失败"));
// }
// String plId = corrModel.getPlId();
// PALRepositoryModel plModel = PALRepositoryCache.getCache().get(plId);
// if (plModel == null) {
// throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "获取当前使用的版本数据失败"));
// }
// // 获取PAL对比数据
// JSONObject curData = ProcessExecUtil.getPALCompareData(plModel);
// // 获取BPM流程对比数据
// JSONObject versionData = ProcessExecUtil.getBPMCompareData(awsId, plModel);
// if (versionData == null) {
// throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "获取流程定义信息失败"));
// }
// Map<String, Object> macroLibraries = DesignerVersionUtil.queryDesignerVersionCompareMap(plModel.getWsId(), plModel.getMethodId(), plModel.getName(), plId, versionData, plId, curData, true, true);
// return HtmlPageTemplate.merge(CoEConstant.APP_ID, CoeDesignerConstant.DESIGNER_VERSION_COMPARE_PAGE, macroLibraries);
// }
}