上传视觉对比需求中,点击版本号展示版本信息功能

This commit is contained in:
yuandongqiang 2025-06-24 09:47:42 +08:00 committed by zhaolei
parent 5342d01460
commit 35957b9374
11 changed files with 1790 additions and 860 deletions

View File

@ -0,0 +1,31 @@
package com.actionsoft.apps.coe.pal;
import com.actionsoft.apps.coe.pal.pal.repository.designer.dto.VersionListDTO;
import com.actionsoft.apps.coe.pal.pal.repository.designer.web.CoeDesignerVersionWeb;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.bind.annotation.Controller;
import com.actionsoft.bpms.server.bind.annotation.Mapping;
/**
* @author oYang
* @Description 设计器-流程版本对比 控制类
* @createTime 2024年07月29日 11:04:00
*/
@Controller
public class CoEDesignerVersionController {
/**
* 设计器版本列表
*
* @param uc 用户上下文
* @param wsId 资产库Id
* @param teamId 小组Id
* @param id 模型Id
* @return 模型版本列表
*/
@Mapping("com.actionsoft.apps.coe.pal_pl_repository_designer_version_list")
public String designerVersionList(UserContext uc, String wsId, String teamId, String id) {
VersionListDTO versionListDTO = new VersionListDTO(wsId, teamId, id);
return new CoeDesignerVersionWeb(uc).getVersionList(versionListDTO);
}
}

View File

@ -0,0 +1,68 @@
package com.actionsoft.apps.coe.pal.pal.processexec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.actionsoft.apps.coe.pal.pal.processexec.constant.B2PControlModeEnum;
import com.actionsoft.apps.coe.pal.pal.processexec.constant.P2BControlModeEnum;
import com.actionsoft.apps.coe.pal.pal.repository.cache.CoeProcessLevelCorrelateCache;
import com.actionsoft.apps.coe.pal.pal.repository.model.CoeProcessLevelCorrelateModel;
/**
* @author oYang
* @Description 梳理到执行关联管理 业务逻辑处理
* @createTime 2024年09月10日 14:34:00
*/
public class ProcessExecAPIManager {
private static final Logger log = LoggerFactory.getLogger(ProcessExecAPIManager.class);
private ProcessExecAPIManager() {
}
public static ProcessExecAPIManager getInstance() {
return SingletonHolder.INSTANCE;
}
/**
* 梳理到执行 流程层面 判断是否有控制权限根据应用参数判定
*
* @param plId PAL端流程ID
* @return boolean
*/
public boolean hasProcessControlPerm(String plId) {
return hasProcessControlPerm(plId, true);
}
private static class SingletonHolder {
private static final ProcessExecAPIManager INSTANCE = new ProcessExecAPIManager();
}
/**
* 梳理到执行 流程层面 判断是否有控制权限根据应用参数判定
*
* @param plId PAL端流程ID
* @return boolean
*/
public boolean hasProcessControlPerm(String plId, boolean isPal) {
boolean hasPerm = true;
CoeProcessLevelCorrelateModel correlateModel = CoeProcessLevelCorrelateCache.getCache().get(plId);
if (correlateModel != null) {
int correlateType = correlateModel.getCorrelateType();
int controlMode = correlateModel.getControlMode();
if (correlateType == 1) {
P2BControlModeEnum controlModeEnum = P2BControlModeEnum.getByValue(controlMode);
if (controlModeEnum != null) {
return isPal ? controlModeEnum.getPalProcessHasPerm() : controlModeEnum.getBpmProcessHasPerm();
}
} else {
B2PControlModeEnum controlModeEnum = B2PControlModeEnum.getByValue(controlMode);
if (controlModeEnum != null) {
return isPal ? controlModeEnum.getPalProcessHasPerm() : controlModeEnum.getBpmProcessHasPerm();
}
}
}
return hasPerm;
}
}

View File

@ -0,0 +1,85 @@
package com.actionsoft.apps.coe.pal.pal.processexec.constant;
/**
* @author oYang
* @Description BPM推送PAL 流程控制模式
* @createTime 2024年09月20日 15:15:00
*/
public enum B2PControlModeEnum {
/**
* 以PAL为中心+BPM图结构只读
*/
PAL_BPM_READ_ONLY(1, "以PAL为中心+BPM图结构只读", false, false, true, true),
/**
* 以PAL为中心+BPM图可编辑
*/
PAL_BPM_EDIT(2, "以PAL为中心+BPM图可编辑", false, true, true, true),
/**
* 以BPM为中心+PAL图结构只读
*/
BPM_PAL_READ_ONLY(3, "以BPM为中心+PAL图结构只读", true, true, false, false),
/**
* 以BPM为中心+PAL图结构可编辑
*/
BPM_PAL_EDIT(4, "以BPM为中心+PAL图结构可编辑", true, true, false, true),
/**
* 不限制
*/
NONE(5, "不限制", true, true, true, true);
private final Integer value;
private final String desc;
private final Boolean bpmProcessHasPerm; // BPM流程层面控制权限
private final Boolean bpmProcessDiagramHasPerm; // BPM流程图结构控制权限
private final Boolean palProcessHasPerm; // PAL流程层面控制权限
private final Boolean palProcessDiagramHasPerm; // PAL流程图结构控制权限
B2PControlModeEnum(Integer value, String desc, Boolean bpmProcessHasPerm, Boolean bpmProcessDiagramHasPerm, Boolean palProcessHasPerm, Boolean palProcessDiagramHasPerm) {
this.value = value;
this.desc = desc;
this.bpmProcessHasPerm = bpmProcessHasPerm;
this.bpmProcessDiagramHasPerm = bpmProcessDiagramHasPerm;
this.palProcessHasPerm = palProcessHasPerm;
this.palProcessDiagramHasPerm = palProcessDiagramHasPerm;
}
public static B2PControlModeEnum getByValue(Integer value) {
for (B2PControlModeEnum mode : values()) {
if (mode.getValue().equals(value)) {
return mode;
}
}
return null;
}
public Integer getValue() {
return value;
}
public String getDesc() {
return desc;
}
public Boolean getBpmProcessHasPerm() {
return bpmProcessHasPerm;
}
public Boolean getBpmProcessDiagramHasPerm() {
return bpmProcessDiagramHasPerm;
}
public Boolean getPalProcessHasPerm() {
return palProcessHasPerm;
}
public Boolean getPalProcessDiagramHasPerm() {
return palProcessDiagramHasPerm;
}
}

View File

@ -0,0 +1,83 @@
package com.actionsoft.apps.coe.pal.pal.processexec.constant;
/**
* @author oYang
* @Description PAL端推送BPM端的流程控制模式
* @createTime 2024年09月20日 14:55:00
*/
public enum P2BControlModeEnum {
/**
* 以PAL为中心+BPM图结构只读
*/
PAL_BPM_READ_ONLY(1, "以PAL为中心+BPM图结构只读", false, false, true, true),
/**
* 以PAL为中心+BPM图可编辑
*/
PAL_BPM_EDIT(2, "以PAL为中心+BPM图可编辑", false, true, true, true),
/**
* 以BPM为中心+PAL图结构只读
*/
BPM_PAL_READ_ONLY(3, "以BPM为中心+PAL图结构只读", true, true, false, false),
/**
* 以BPM为中心+PAL图结构可编辑
*/
BPM_PAL_EDIT(4, "以BPM为中心+PAL图结构可编辑", true, true, false, true),
/**
* 不限制
*/
NONE(5, "不限制", true, true, true, true);
private final Integer value;
private final String desc;
private final Boolean bpmProcessHasPerm; // BPM流程层面控制权限
private final Boolean bpmProcessDiagramHasPerm; // BPM流程图结构控制权限
private final Boolean palProcessHasPerm; // PAL流程层面控制权限
private final Boolean palProcessDiagramHasPerm; // PAL流程图结构控制权限
P2BControlModeEnum(Integer value, String desc, Boolean bpmProcessHasPerm, Boolean bpmProcessDiagramHasPerm, Boolean palProcessHasPerm, Boolean palProcessDiagramHasPerm) {
this.value = value;
this.desc = desc;
this.bpmProcessHasPerm = bpmProcessHasPerm;
this.bpmProcessDiagramHasPerm = bpmProcessDiagramHasPerm;
this.palProcessHasPerm = palProcessHasPerm;
this.palProcessDiagramHasPerm = palProcessDiagramHasPerm;
}
public static P2BControlModeEnum getByValue(Integer value) {
for (P2BControlModeEnum mode : values()) {
if (mode.getValue().equals(value)) {
return mode;
}
}
return null;
}
public Integer getValue() {
return value;
}
public String getDesc() {
return desc;
}
public Boolean getBpmProcessHasPerm() {
return bpmProcessHasPerm;
}
public Boolean getBpmProcessDiagramHasPerm() {
return bpmProcessDiagramHasPerm;
}
public Boolean getPalProcessHasPerm() {
return palProcessHasPerm;
}
public Boolean getPalProcessDiagramHasPerm() {
return palProcessDiagramHasPerm;
}
}

View File

@ -0,0 +1,52 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.constant;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import com.actionsoft.bpms.util.UtilString;
/**
* @author oYang
* @Description 版本状态枚举
* @createTime 2024年07月29日 14:51:00
*/
public enum VersionStatusEnum {
USE("use", "设计中"), PUBLISH("publish", "已发布"), STOP("stop", "已停用"), APPROVAL("approval", "审核中"), DESIGNER("designer", "设计");
private static final Map<String, VersionStatusEnum> codeToStatus = new HashMap<>();
static {
for (VersionStatusEnum status : VersionStatusEnum.values()) {
codeToStatus.put(status.code, status);
}
}
String code;
String desc;
VersionStatusEnum(String code, String desc) {
if (UtilString.isEmpty(code) || UtilString.isEmpty(desc)) {
throw new IllegalArgumentException("Code and Desc must not be null");
}
this.code = code;
this.desc = desc;
}
public static Optional<VersionStatusEnum> getByCode(String code) {
if (UtilString.isEmpty(code)) {
throw new IllegalArgumentException("Code must not be null");
}
VersionStatusEnum status = codeToStatus.get(code);
return Optional.ofNullable(status);
}
public String getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

View File

@ -0,0 +1,46 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.dto;
/**
* @author oYang
* @Description 版本列表
* @createTime 2024年07月29日 11:12:00
*/
public class VersionListDTO {
private String wsId;
private String teamId;
private String id;
public VersionListDTO() {
}
public VersionListDTO(String wsId, String teamId, String id) {
this.wsId = wsId;
this.teamId = teamId;
this.id = id;
}
public String getWsId() {
return wsId;
}
public void setWsId(String wsId) {
this.wsId = wsId;
}
public String getTeamId() {
return teamId;
}
public void setTeamId(String teamId) {
this.teamId = teamId;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}

View File

@ -0,0 +1,143 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.util;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.actionsoft.apps.coe.pal.pal.processexec.ProcessExecAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.constant.VersionStatusEnum;
import com.actionsoft.apps.coe.pal.pal.repository.designer.vo.VersionListVO;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil;
import com.actionsoft.bpms.bpmn.engine.model.def.ProcessDefinition;
import com.actionsoft.bpms.util.UtilDate;
import com.actionsoft.sdk.local.SDK;
/**
* @author oYang
* @Description 设计器版本工具类
* @createTime 2024年07月29日 14:49:00
*/
public class DesignerVersionUtil {
private static final Logger log = LoggerFactory.getLogger(DesignerVersionUtil.class);
/**
* 返回版本状态
*
* @param model 当前模型
* @return 版本状态
*/
public static VersionStatusEnum getVersionStatus(PALRepositoryModel model) {
if (model.isUse()) {
return VersionStatusEnum.USE;
}
if (model.isApproval()) {
return VersionStatusEnum.APPROVAL;
}
if (model.isStop()) {
return VersionStatusEnum.STOP;
}
if (model.isPublish()) {
return VersionStatusEnum.PUBLISH;
}
return VersionStatusEnum.DESIGNER;
}
/**
* 获取版本列表Vo
*
* @param id PAL模型Id
* @param mapOfProcessDefId PAL模型ID与bpm流程定义Id映射
* @return List<VersionListVo>
*/
public static List<VersionListVO> getVersionListVoList(String id, Map<String, String> mapOfProcessDefId) {
List<VersionListVO> result = new ArrayList<>();
PALRepositoryModel model = PALRepositoryCache.getCache().get(id);
List<PALRepositoryModel> versions = PALRepositoryCache.getByVersionId(model.getVersionId());
versions.sort((o1, o2) -> VersionUtil.compareVersionNo(o1.getVersion(), o2.getVersion(), true));
for (PALRepositoryModel palModel : versions) {
//隐藏与bpm关联流程
if (mapOfProcessDefId.containsKey(palModel.getId())) {
continue;
}
VersionListVO versionListVo = getVersionListVo(palModel);
result.add(versionListVo);
}
return result;
}
/**
* 获取版本列表Vo
*
* @param palModel pal模型
* @return VersionListVo
*/
public static VersionListVO getVersionListVo(PALRepositoryModel palModel) {
String plId = palModel.getId();
String verAndVerD = String.valueOf(palModel.getVersion());
VersionStatusEnum versionStatus = getVersionStatus(palModel);
// 创建人
String createUser = getUserName(palModel.getCreateUser());
// 创建时间
String createTime = getDate(palModel.getCreateDate());
// 更新人
String updateUser = getUserName(palModel.getModifyUser());
// 更新时间
String updateTime = getModifyDate(palModel.getModifyDate());
// 梳理到执行 流程是否重命名新建版本 受到参数管控
boolean hasProcessControlPerm = !PALRepositoryQueryAPIManager.getInstance().isCorrelateBpms(plId, true) || ProcessExecAPIManager.getInstance().hasProcessControlPerm(plId);
return VersionListVO.VersionListBuilder.createBuilder().withPlId(plId).withVersionId(palModel.getVersionId()).withVersionNo(verAndVerD).withVersionStatus(versionStatus.getCode()).withCreateUser(createUser).withCreateTime(createTime).withUpdateUser(updateUser).withUpdateTime(updateTime).withHasCreatePerm(hasProcessControlPerm).build();
}
/**
* 获取版本列表Vo
*
* @param palModel pal模型
* @param processDefinition bpm平台流程定义信息
* @param correlateTime 关联时间
* @return VersionListVo
*/
public static VersionListVO getVersionListVo(PALRepositoryModel palModel, ProcessDefinition processDefinition, Timestamp correlateTime) {
String plId = palModel.getId();
String versionId = palModel.getVersionId();
// PAL端版本号
String palVersionNo = String.valueOf(palModel.getVersion());
// 版本状态
VersionStatusEnum versionStatus = getVersionStatus(palModel);
// 创建人
String createUser = getUserName(processDefinition.getCreateUser());
// 创建时间
String createTime = getDate(processDefinition.getCreateTime());
// 更新人
String updateUser = getUserName(processDefinition.getUpdateUser());
// 更新时间
String updateTime = getModifyDate(processDefinition.getUpdateTime());
// 梳理到执行 流程是否重命名新建版本 受到参数管控
boolean hasProcessControlPerm = !PALRepositoryQueryAPIManager.getInstance().isCorrelateBpms(plId, true) || ProcessExecAPIManager.getInstance().hasProcessControlPerm(plId);
return VersionListVO.VersionListBuilder.createBuilder().withPlId(plId).withVersionId(versionId).withVersionNo(palVersionNo).withVersionStatus(versionStatus.getCode()).withCreateUser(createUser).withCreateTime(createTime).withUpdateUser(updateUser).withUpdateTime(updateTime).withHasCreatePerm(hasProcessControlPerm).withCorrelateTime(correlateTime).build();
}
private static String getUserName(String userId) {
return SDK.getORGAPI().getUser(userId) == null ? userId : SDK.getORGAPI().getUser(userId).getUserNameI18N();
}
private static String getDate(Timestamp date) {
return UtilDate.dateFormat(date);
}
private static String getModifyDate(Timestamp date) {
if (date == null) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
return sdf.format(date);
}
}

View File

@ -0,0 +1,150 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.vo;
import java.sql.Timestamp;
/**
* @author oYang
* @Description 版本列表
* @createTime 2024年07月29日 11:47:00
*/
public class VersionListVO {
private final String plId;
private final String versionId;
private final String versionNo;
private final String versionStatus;
private final String createUser;
private final String createTime;
private final String updateUser;
private final String updateTime;
private final Boolean hasCreatePerm; // 是否有创建权限
private final Timestamp correlateTime;
private VersionListVO(VersionListBuilder builder) {
this.plId = builder.plId;
this.versionId = builder.versionId;
this.versionNo = builder.versionNo;
this.versionStatus = builder.versionStatus;
this.createUser = builder.createUser;
this.createTime = builder.createTime;
this.updateUser = builder.updateUser;
this.updateTime = builder.updateTime;
this.hasCreatePerm = builder.hasCreatePerm;
this.correlateTime = builder.correlateTime;
}
public String getPlId() {
return plId;
}
public String getVersionId() {
return versionId;
}
public String getVersionNo() {
return versionNo;
}
public String getVersionStatus() {
return versionStatus;
}
public String getCreateUser() {
return createUser;
}
public String getCreateTime() {
return createTime;
}
public String getUpdateUser() {
return updateUser;
}
public String getUpdateTime() {
return updateTime;
}
public Boolean getHasCreatePerm() {
return hasCreatePerm;
}
public Timestamp getCorrelateTime() {
return correlateTime;
}
public static final class VersionListBuilder {
private String plId;
private String versionId;
private String versionNo;
private String versionStatus;
private String createUser;
private String createTime;
private String updateUser;
private String updateTime;
private Boolean hasCreatePerm;
private Timestamp correlateTime;
private VersionListBuilder() {
}
public static VersionListBuilder createBuilder() {
return new VersionListBuilder();
}
public VersionListBuilder withPlId(String plId) {
this.plId = plId;
return this;
}
public VersionListBuilder withVersionId(String versionId) {
this.versionId = versionId;
return this;
}
public VersionListBuilder withVersionNo(String versionNo) {
this.versionNo = versionNo;
return this;
}
public VersionListBuilder withVersionStatus(String versionStatus) {
this.versionStatus = versionStatus;
return this;
}
public VersionListBuilder withCreateUser(String createUser) {
this.createUser = createUser;
return this;
}
public VersionListBuilder withCreateTime(String createTime) {
this.createTime = createTime;
return this;
}
public VersionListBuilder withUpdateUser(String updateUser) {
this.updateUser = updateUser;
return this;
}
public VersionListBuilder withUpdateTime(String updateTime) {
this.updateTime = updateTime;
return this;
}
public VersionListBuilder withHasCreatePerm(Boolean hasCreatePerm) {
this.hasCreatePerm = hasCreatePerm;
return this;
}
public VersionListBuilder withCorrelateTime(Timestamp correlateTime) {
this.correlateTime = correlateTime;
return this;
}
public VersionListVO build() {
return new VersionListVO(this);
}
}
}

View File

@ -0,0 +1,372 @@
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.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.dto.VersionListDTO;
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.bpms.bpmn.engine.cache.ProcessDefCache;
import com.actionsoft.bpms.bpmn.engine.model.def.ProcessDefinition;
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.util.UtilString;
/**
* 设计器流程版本对比 web层
*/
public class CoeDesignerVersionWeb extends ActionWeb {
private static final Logger LOGGER = LoggerFactory.getLogger(CoeDesignerVersionWeb.class);
private final UserContext uc;
public CoeDesignerVersionWeb(UserContext uc) {
super(uc);
this.uc = uc;
}
/**
* 获取版本列表
*
* @param versionListDTO 版本对比参数
*/
public String getVersionList(VersionListDTO versionListDTO) {
ResponseObject ro = ResponseObject.newOkResponse();
String id = versionListDTO.getId();
List<VersionListVO> versionListVoList = new ArrayList<>();
List<VersionListVO> historyVersionListVoList = new ArrayList<>();
PALRepositoryModel palModel = PALRepositoryCache.getCache().get(id);
if (palModel != null) {
// 维护pal模型Id与bpm平台模型Id映射
Map<String, String> mapOfProcessDefId = new HashMap<>();
List<PALRepositoryModel> plVersionModels = PALRepositoryCache.getByVersionId(palModel.getVersionId());
for (PALRepositoryModel model : plVersionModels) {
CoeProcessLevelCorrelateModel correlateModel = CoeProcessLevelCorrelateCache.getCache().get(model.getId());
if (correlateModel == null) {
continue;
}
String processDefId = correlateModel.isCorrelate() ? correlateModel.getPlAwsId() : correlateModel.getSourceAwsId();
if (UtilString.isEmpty(processDefId)) {
continue;
}
ProcessDefinition processDefinition = ProcessDefCache.getInstance().get(processDefId);
if (processDefinition == null) {
continue;
}
mapOfProcessDefId.put(model.getId(), processDefId);
VersionListVO versionListVo = DesignerVersionUtil.getVersionListVo(model, processDefinition, correlateModel.getCreateDate());
versionListVoList.add(versionListVo);
}
if (!versionListVoList.isEmpty()) {
versionListVoList.sort(Comparator.comparing(VersionListVO::getCorrelateTime).reversed());
// 历史版本
historyVersionListVoList = DesignerVersionUtil.getVersionListVoList(id, mapOfProcessDefId);
} else {
versionListVoList = DesignerVersionUtil.getVersionListVoList(id, mapOfProcessDefId);
}
}
ro.put("versionList", versionListVoList);
ro.put("historyList", historyVersionListVoList);
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;
// }
//
// /**
// * 版本对比
// *
// * @param versionCompareDTO 版本对比参数
// */
// public String designerVersionCompare(VersionCompareDTO versionCompareDTO) {
// 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参数
// *
// * @param versionCompareDTO 版本对比参数
// */
// private Map<String, Object> queryDesignerVersionCompareMap(VersionCompareDTO versionCompareDTO) {
// // 获取对比版本的模型数据
// PALRepositoryModel plModel = PALRepositoryCache.getCache().get(versionCompareDTO.getCompareVerId());
// JSONObject versionData = DesignerVersionUtil.getVersionData(uc, versionCompareDTO.getCompareVerId(), versionCompareDTO.getTeamId());
// if (versionData == null) {
// throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "获取待比对的版本数据失败"));
// }
// // 获取当前模型数据
// JSONObject curData = DesignerVersionUtil.getVersionData(uc, versionCompareDTO.getCurId(), versionCompareDTO.getTeamId());
// if (curData == null) {
// throw new AWSException(I18nRes.findValue(CoEConstant.APP_ID, "获取当前使用的版本数据失败"));
// }
// 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);
// }
}

View File

@ -1,5 +1,7 @@
package com.actionsoft.apps.coe.pal.pal.repository.model;
import java.sql.Timestamp;
import com.actionsoft.bpms.commons.mvc.model.ModelBean;
/**
@ -26,6 +28,10 @@ public class CoeProcessLevelCorrelateModel extends ModelBean{
public static final String FIELD_EXT2 = "EXT2";// add by sunlh
public static final String FIELD_EXT3 = "EXT3";// add by sunlh
public static final String FIELD_EXT4 = "EXT4";// add by sunlh
public static final String FIELD_SOURCEAWSID = "SOURCEAWSID"; // 来源AWS流程ID 版本迭代时当前流程是由哪个流程新建版本而来
public static final String FIELD_CREATEDATE = "CREATEDATE";
public static final String FIELD_CONTROLMODE = "CONTROLMODE"; // 流程管控模式
private int controlMode;
private String wsId;
private String plId;
@ -39,6 +45,8 @@ public class CoeProcessLevelCorrelateModel extends ModelBean{
private String ext2 = "";
private String ext3 = "";
private String ext4;
private String sourceAwsId;
private Timestamp createDate;
public CoeProcessLevelCorrelateModel() {
this.wsId = "";
@ -135,5 +143,25 @@ public class CoeProcessLevelCorrelateModel extends ModelBean{
public void setExt4(String ext4) {
this.ext4 = ext4;
}
public String getSourceAwsId() {
return sourceAwsId;
}
public void setSourceAwsId(String sourceAwsId) {
this.sourceAwsId = sourceAwsId;
}
public Timestamp getCreateDate() {
return createDate;
}
public void setCreateDate(Timestamp createDate) {
this.createDate = createDate;
}
public int getControlMode() {
return controlMode;
}
public void setControlMode(int controlMode) {
this.controlMode = controlMode;
}
}