一个流程对应多个角色图的检测功能增强,查询角色图是否有相关

This commit is contained in:
446052889@qq.com 2025-04-18 10:19:15 +08:00
parent 01c2022472
commit 037824201a
10 changed files with 260 additions and 7 deletions

View File

@ -0,0 +1,74 @@
package com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo;
import java.io.Serializable;
import com.actionsoft.bpms.util.UUIDGener;
public class RoleRelatedModelVO implements Serializable {
private static final long serialVersionUID = 1L;
private String currShapeName;
private String currShapeId;
private String modelName;
private String shapeName;
private String modelId;
private String shapeId;
private String id;
public RoleRelatedModelVO(String currShapeName, String currShapeId, String modelName, String shapeName, String modelId, String shapeId) {
this.id = UUIDGener.getObjectId();
this.currShapeName = currShapeName;
this.currShapeId = currShapeId;
this.modelName = modelName;
this.shapeName = shapeName;
this.modelId = modelId;
this.shapeId = shapeId;
}
public String getCurrShapeName() {
return currShapeName;
}
public void setCurrShapeName(String currShapeName) {
this.currShapeName = currShapeName;
}
public String getCurrShapeId() {
return currShapeId;
}
public void setCurrShapeId(String currShapeId) {
this.currShapeId = currShapeId;
}
public String getModelName() {
return modelName;
}
public void setModelName(String modelName) {
this.modelName = modelName;
}
public String getShapeName() {
return shapeName;
}
public void setShapeName(String shapeName) {
this.shapeName = shapeName;
}
public String getModelId() {
return modelId;
}
public void setModelId(String modelId) {
this.modelId = modelId;
}
public String getShapeId() {
return shapeId;
}
public void setShapeId(String shapeId) {
this.shapeId = shapeId;
}
}

View File

@ -0,0 +1,93 @@
package com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo;
import java.io.Serializable;
import java.util.List;
public class RoleVersionIdErrorChildVO extends RoleVersionIdErrorVO implements Serializable {
private static final long serialVersionUID = 1L;
private int activeRelationCount;// 主动关联数量
private int passiveRelationCount;// 被动关联数量
List<RoleRelatedModelVO> activeRelationList;
List<RoleRelatedModelVO> passiveRelationList;
private String color;
private String createUser;
private String createTime;
private String updateUser;
private String updateTime;
public RoleVersionIdErrorChildVO(String processId, String processName, String processVersionId, String processVersion, String roleId, String roleName, String roleVersionId, String roleVersion) {
super(processId, processName, processVersionId, processVersion, roleId, roleName, roleVersionId, roleVersion);
}
public int getActiveRelationCount() {
return activeRelationCount;
}
public void setActiveRelationCount(int activeRelationCount) {
this.activeRelationCount = activeRelationCount;
}
public int getPassiveRelationCount() {
return passiveRelationCount;
}
public void setPassiveRelationCount(int passiveRelationCount) {
this.passiveRelationCount = passiveRelationCount;
}
public List<RoleRelatedModelVO> getActiveRelationList() {
return activeRelationList;
}
public void setActiveRelationList(List<RoleRelatedModelVO> activeRelationList) {
this.activeRelationList = activeRelationList;
}
public List<RoleRelatedModelVO> getPassiveRelationList() {
return passiveRelationList;
}
public void setPassiveRelationList(List<RoleRelatedModelVO> passiveRelationList) {
this.passiveRelationList = passiveRelationList;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getCreateUser() {
return createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateUser() {
return updateUser;
}
public void setUpdateUser(String updateUser) {
this.updateUser = updateUser;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -1,6 +1,7 @@
package com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.web;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -11,10 +12,16 @@ import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dao.RolePALRepo
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dto.RoleUseUpdateDTO;
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dto.RoleVerUpdateDTO;
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dto.RoleVersionIdUpdateDTO;
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo.RoleRelatedModelVO;
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo.RoleUseErrorVO;
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo.RoleVerErrorVO;
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo.RoleVersionIdErrorChildVO;
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo.RoleVersionIdErrorVO;
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.relation.cache.DesignerShapeRelationCache;
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.ws.dao.CoeWorkSpace;
import com.actionsoft.apps.coe.pal.pal.ws.model.CoeWorkSpaceModel;
@ -22,6 +29,7 @@ import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil;
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.UtilDate;
import com.actionsoft.bpms.util.UtilString;
public class RoleErrorWeb extends ActionWeb {
@ -552,7 +560,7 @@ public class RoleErrorWeb extends ActionWeb {
*/
ResponseObject ro = ResponseObject.newOkResponse();
List<RoleVersionIdErrorVO> errorList = new ArrayList<>();
List<RoleVersionIdErrorChildVO> errorList = new ArrayList<>();
List<PALRepositoryModel> allModelList = getAllModelList();// 所有模型
@ -590,7 +598,21 @@ public class RoleErrorWeb extends ActionWeb {
String roleName = roleModel.getName();
String roleVerId = roleModel.getVersionId();
String roleVer = VersionUtil.getVersionStrV(roleModel.getVersion());
errorList.add(new RoleVersionIdErrorVO(processId, processName, processVerId, processVer, roleId, roleName, roleVerId, roleVer));
// 查询角色主动关联其他模型数据
List<RoleRelatedModelVO> activeRelationList = getActiveRelationListByRole(roleId);
// 查询角色被动关联其他模型数据关联角色
List<RoleRelatedModelVO> passiveRelationList = getPassiveRelationListByRole(roleId);
RoleVersionIdErrorChildVO vo = new RoleVersionIdErrorChildVO(processId, processName, processVerId, processVer, roleId, roleName, roleVerId, roleVer);
vo.setActiveRelationCount(activeRelationList.size());
vo.setPassiveRelationCount(passiveRelationList.size());
vo.setActiveRelationList(activeRelationList);
vo.setPassiveRelationList(passiveRelationList);
// 人员
vo.setCreateUser(roleModel.getCreateUser());
vo.setUpdateUser(roleModel.getModifyUser());
vo.setCreateTime(UtilDate.datetimeFormat24(roleModel.getCreateDate()));
vo.setUpdateTime(UtilDate.datetimeFormat24(roleModel.getModifyDate()));
errorList.add(vo);
}
}
}
@ -611,9 +633,73 @@ public class RoleErrorWeb extends ActionWeb {
for (int i = 0; i < errorList.size(); i++) {
errorList.get(i).setNo(i+1);
}
// 设置显示的背景色
setTableRowColor(errorList);
}
ro.put("list", errorList);
ro.put("desc", "共有 " + errorList.size() + " 条错误数据");
return ro.toString();
}
private void setTableRowColor(List<RoleVersionIdErrorChildVO> errorList) {
List<String> BG_COLORS = Arrays.asList(
"#FFEBEE", "#F1F8E9", "#E3F2FD", "#EDE7F6",
"#E8F5E9", "#FFF3E0", "#E0F7FA", "#FCE4EC",
"#E8EAF6", "#F9FBE7"
);
// 为连续相同的元素分配颜色
String prevGroup = null;
int colorIndex = -1;
for (RoleVersionIdErrorChildVO item : errorList) {
String currentGroup = item.getProcessId();
if (!currentGroup.equals(prevGroup)) {
// 遇到新组切换到下一个颜色循环使用
colorIndex = (colorIndex + 1) % BG_COLORS.size();
prevGroup = currentGroup;
}
item.setColor(BG_COLORS.get(colorIndex));
}
}
private List<RoleRelatedModelVO> getPassiveRelationListByRole(String roleId) {
List<DesignerShapeRelationModel> list = new DesignerShapeRelationDao().query(null, null, null, roleId, null);
List<RoleRelatedModelVO> result = new ArrayList<>();
for (DesignerShapeRelationModel model : list) {
String fileId = model.getFileId();
String fileName = model.getFileId();
PALRepositoryModel m = PALRepositoryCache.getCache().get(fileId);
if (m != null) {
fileName = m.getName();
}
RoleRelatedModelVO vo = new RoleRelatedModelVO(UtilString.isNotEmpty(model.getRelationShapeId()) ? model.getRelationShapeText() : "", model.getRelationShapeId(), fileName, UtilString.isNotEmpty(model.getShapeId()) ? model.getShapeText() : "", model.getFileId(), model.getRelationShapeId());
result.add(vo);
}
return result;
}
private List<RoleRelatedModelVO> getActiveRelationListByRole(String roleId) {
List<DesignerShapeRelationModel> list = new DesignerShapeRelationDao().getModelListByFileId(roleId);
List<RoleRelatedModelVO> result = new ArrayList<>();
for (DesignerShapeRelationModel model : list) {
String relationFileId = model.getRelationFileId();
String relationShapeId = model.getRelationShapeId();
String fileName = model.getRelationFileId();
if (UtilString.isEmpty(relationShapeId)) {
List<PALRepositoryModel> mList = PALRepositoryCache.getByVersionId(relationFileId);
for (PALRepositoryModel m : mList) {
if (m.isUse()) {
fileName = m.getName();
}
}
} else {
PALRepositoryModel m = PALRepositoryCache.getCache().get(relationFileId);
if (m != null) {
fileName = m.getName();
}
}
RoleRelatedModelVO vo = new RoleRelatedModelVO(UtilString.isNotEmpty(model.getShapeId()) ? model.getShapeText() : "", model.getShapeId(), fileName, UtilString.isNotEmpty(model.getRelationShapeId()) ? model.getRelationShapeText() : "", model.getRelationFileId(), model.getRelationShapeId());
result.add(vo);
}
return result;
}
}

View File

@ -22,8 +22,8 @@
const production = true;
const devUserInfo = {};
</script>
<script type="module" crossorigin src="../apps/com.actionsoft.apps.coe.pal.datamigration/main/js/entry-index-5af1bb51.js"></script>
<link rel="stylesheet" href="../apps/com.actionsoft.apps.coe.pal.datamigration/main/assets/asset-style-886f8869.css">
<script type="module" crossorigin src="../apps/com.actionsoft.apps.coe.pal.datamigration/main/js/entry-index-d3daa6b5.js"></script>
<link rel="stylesheet" href="../apps/com.actionsoft.apps.coe.pal.datamigration/main/assets/asset-style-16cdca61.css">
</head>
<body style="margin:0;">
<div id="app"></div>