处理一个流程的多个版本对应了多个角色图的问题(创建角色、流程升版、版本切换相关判断方法调整,同时创建角色时对于其他kpi绩效图、ma图也兼容处理,流程升版、版本切换未对角色图以外图形处理)
This commit is contained in:
parent
caa1246857
commit
ff1382fe01
Binary file not shown.
@ -16,6 +16,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import com.actionsoft.apps.AppsConst;
|
||||
import com.actionsoft.apps.lifecycle.api.AppsAPIManager;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
@ -4540,4 +4542,25 @@ public class PALRepository extends DaoObject<PALRepositoryModel> {
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据methodId和ext2查询符合的模型
|
||||
* @param methodId
|
||||
* @param ext2List 集合
|
||||
* @return
|
||||
*/
|
||||
public List<PALRepositoryModel> searchRepositoryByMethodIdAndExt2(String methodId, List<String> ext2List) {
|
||||
if (UtilString.isEmpty(methodId) || CollectionUtils.isEmpty(ext2List)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
StringBuilder idsb = new StringBuilder();
|
||||
for (String ext2 : ext2List) {
|
||||
idsb.append("'").append(ext2).append("',");
|
||||
}
|
||||
String idsString = idsb.toString();
|
||||
idsString = idsString.substring(0, idsString.lastIndexOf(","));
|
||||
String sql = "SELECT * FROM " + PALRepositoryModelImpl.DATABASE_ENTITY + " WHERE " + PALRepositoryModelImpl.FIELD_PL_METHODID + "=? AND " + PALRepositoryModelImpl.FIELD_PL_EXT2 + " IN(" + idsString + ")";
|
||||
Object[] param = new Object[] { methodId};
|
||||
return DBSql.query(sql, new PALRespositoryModelMapper(), param);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -23,6 +23,8 @@ import javax.imageio.ImageIO;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.*;
|
||||
import com.actionsoft.bpms.util.*;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||
@ -4743,16 +4745,9 @@ public class CoeDesignerWeb extends ActionWeb {
|
||||
}
|
||||
|
||||
//1.创建角色模型
|
||||
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
||||
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(oldUUID);
|
||||
|
||||
if (oldModelList.size() > 0) {
|
||||
for (DesignerShapeRelationModel oldModel : oldModelList) {
|
||||
if (oldModel.getAttrId().equals("role")) {
|
||||
CreateRelevanceRoleModel(isLargeIteration, oldUUID, PALRepositoryCache.getCache().get(newUUID), mapNewUUID, tempVer, teamId, oldModel.getRelationFileId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
String oldRoleModelId = getExistingModel(oldUUID, "org.role");// 查询与流程相关联的角色,即使流程内为关联具体的任何角色形状
|
||||
if (oldRoleModelId != null) {
|
||||
CreateRelevanceRoleModel(isLargeIteration, oldUUID, PALRepositoryCache.getCache().get(newUUID), mapNewUUID, tempVer, teamId, oldRoleModelId);
|
||||
}
|
||||
|
||||
//创建绩效关联关系
|
||||
@ -4787,6 +4782,41 @@ public class CoeDesignerWeb extends ActionWeb {
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已经存在的流程相关联的模型,例如流程关联的角色图
|
||||
* @param uuid 流程Id
|
||||
* @param methodId 对应的建模方法ID
|
||||
* @return
|
||||
*/
|
||||
private String getExistingModel(String uuid, String methodId) {
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid);
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
// 1.查询有关联的methodId模型
|
||||
List<String> paramList = new ArrayList<>();
|
||||
List data = new ArrayList();
|
||||
data.add(0, methodId.trim());
|
||||
data.add(1, model.getId().trim());
|
||||
String param = data.toString();// 查询参数
|
||||
paramList.add(param);
|
||||
// 2.查询符合的methodId模型列表并排序(理论上只会有一个)
|
||||
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
List<PALRepositoryModel> list = coeProcessLevel.searchRepositoryByMethodIdAndExt2(methodId, paramList);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
list.sort((m1,m2) -> {
|
||||
if (m1.getVersion() == m2.getVersion()) {
|
||||
return m1.getCreateDate().compareTo(m2.getCreateDate());
|
||||
}
|
||||
return m1.getVersion() > m2.getVersion() ? 1 : -1;
|
||||
});
|
||||
// 3.取排在首位的角色模型的模型ID
|
||||
return list.get(0).getId();
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作升级版本/复制副本
|
||||
*
|
||||
@ -5113,35 +5143,22 @@ public class CoeDesignerWeb extends ActionWeb {
|
||||
*/
|
||||
public String changePalDesignerVersionUseBycorrelationRoleModel(String wsId, String teamId, String id) {
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
||||
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(id);
|
||||
|
||||
if (oldModelList.size() > 0) {
|
||||
|
||||
int answer = 0;
|
||||
for (DesignerShapeRelationModel oneModel : oldModelList) {
|
||||
//如果关联角色图,则同步复制角色图关联关系
|
||||
String methodIds = "";
|
||||
if (oneModel.getAttrId().equals("role")) {
|
||||
|
||||
PALRepository repository = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
PALRepositoryModel lastPlModel = repository.getInstance(oneModel.getRelationFileId());
|
||||
answer = repository.updateStateOfVersionUuid(lastPlModel.getVersionId());// 更新所有的为0
|
||||
answer = repository.updateUseStateOfVersionUuid(lastPlModel.getId());// 更新当前版本为使用状态
|
||||
CoeProcessLevelNoCache.getInstance().reloadInBackground(lastPlModel.getWsId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
String roleId = getExistingModel(id, "org.role");
|
||||
int answer = 0;
|
||||
if (roleId != null) {
|
||||
PALRepository repository = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
PALRepositoryModel lastPlModel = repository.getInstance(roleId);
|
||||
answer = repository.updateStateOfVersionUuid(lastPlModel.getVersionId());// 更新所有的为0
|
||||
answer = repository.updateUseStateOfVersionUuid(lastPlModel.getId());// 更新当前版本为使用状态
|
||||
CoeProcessLevelNoCache.getInstance().reloadInBackground(lastPlModel.getWsId());
|
||||
if (answer > 0) {
|
||||
ro.put("id", id);
|
||||
return ro.toString();
|
||||
} else {
|
||||
return ResponseObject.newErrResponse("使用版本更新失败").toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ro.toString();
|
||||
return ResponseObject.newErrResponse("使用版本更新失败,角色图尚未建立").toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -9257,17 +9257,21 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
PALRepositoryModelImpl model;
|
||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
// 若已经存在了与其他流程版本相对应的模型图(角色、绩效等),则取对应的模型图的versionId作为版本ID,延续该流程版本ID
|
||||
String versionId = getExistingModelVersionId(uuid, methodId);
|
||||
versionId = versionId == null ? id : versionId;
|
||||
|
||||
//判断如果methodID为角色图,则创建到对应角色模型文件夹中
|
||||
if (methodId.equals("org.role")) {
|
||||
model = createPALRepositoryModelByVersion(id, plRid, wsId, plname + titleName, "", 1, checkAndCreatePalRoleFolderModel(coeProcessLevel, wsId), category, true, plver, id, false, methodId, "0", 1, null, null, "admin", "admin", nowTime, null, data.toString(), null, null, null, null, null, null, null, 1);
|
||||
model = createPALRepositoryModelByVersion(id, plRid, wsId, plname + titleName, "", 1, checkAndCreatePalRoleFolderModel(coeProcessLevel, wsId), category, true, plver, versionId, false, methodId, "0", 1, null, null, "admin", "admin", nowTime, null, data.toString(), null, null, null, null, null, null, null, 1);
|
||||
//如果control.kpi,创建末级流程绩效指标文件夹内
|
||||
} else if (methodId.equals("control.kpi")) {
|
||||
model = createPALRepositoryModelByVersion(id, plRid, wsId, plname + titleName, "", 1, checkAndCreatePalPerformanceFolderModel(coeProcessLevel, wsId), category, true, plver, id, false, methodId, "0", 1, null, null, "admin", "admin", nowTime, null, data.toString(), null, null, null, null, null, null, null, 1);
|
||||
model = createPALRepositoryModelByVersion(id, plRid, wsId, plname + titleName, "", 1, checkAndCreatePalPerformanceFolderModel(coeProcessLevel, wsId), category, true, plver, versionId, false, methodId, "0", 1, null, null, "admin", "admin", nowTime, null, data.toString(), null, null, null, null, null, null, null, 1);
|
||||
//如果是control.ma,创建L1-L3流程绩效文件夹内
|
||||
} else if (methodId.equals("control.ma")) {
|
||||
model = createPALRepositoryModelByVersion(id, plRid, wsId, plname + titleName, "", 1, checkAndCreatePalL1L3PerformanceFolderModel(coeProcessLevel, wsId), category, true, plver, id, false, methodId, "0", 1, null, null, "admin", "admin", nowTime, null, data.toString(), null, null, null, null, null, null, null, 1);
|
||||
model = createPALRepositoryModelByVersion(id, plRid, wsId, plname + titleName, "", 1, checkAndCreatePalL1L3PerformanceFolderModel(coeProcessLevel, wsId), category, true, plver, versionId, false, methodId, "0", 1, null, null, "admin", "admin", nowTime, null, data.toString(), null, null, null, null, null, null, null, 1);
|
||||
} else {
|
||||
model = createPALRepositoryModelByVersion(id, plRid, wsId, plname + titleName, "", 1, parentId, category, true, 1, id, false, methodId, "0", 1, null, null, "admin", "admin", nowTime, null, data.toString(), null, null, null, null, null, null, null, 1);
|
||||
model = createPALRepositoryModelByVersion(id, plRid, wsId, plname + titleName, "", 1, parentId, category, true, 1, versionId, false, methodId, "0", 1, null, null, "admin", "admin", nowTime, null, data.toString(), null, null, null, null, null, null, null, 1);
|
||||
}
|
||||
|
||||
coeProcessLevel.insert(model);
|
||||
@ -9430,6 +9434,47 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param uuid 流程Id
|
||||
* @param methodId 对应的建模方法ID
|
||||
* @return
|
||||
*/
|
||||
private String getExistingModelVersionId(String uuid, String methodId) {
|
||||
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(uuid);
|
||||
if (plModel == null) {
|
||||
return null;
|
||||
}
|
||||
// 1.查询所有流程版本
|
||||
List<PALRepositoryModel> verList = PALRepositoryCache.getCache().getByVersionId(plModel.getVersionId());
|
||||
if (CollectionUtils.isNotEmpty(verList)) {
|
||||
// 2.查询有关联的methodId模型
|
||||
List<String> paramList = new ArrayList<>();
|
||||
for (PALRepositoryModel model : verList) {
|
||||
List data = new ArrayList();
|
||||
data.add(0, methodId.trim());
|
||||
data.add(1, model.getId().trim());
|
||||
String param = data.toString();// 查询参数
|
||||
paramList.add(param);
|
||||
}
|
||||
// 3.查询符合的methodId模型列表并排序
|
||||
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
List<PALRepositoryModel> list = coeProcessLevel.searchRepositoryByMethodIdAndExt2(methodId, paramList);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
list.sort((m1,m2) -> {
|
||||
if (m1.getVersion() == m2.getVersion()) {
|
||||
return m1.getCreateDate().compareTo(m2.getCreateDate());
|
||||
}
|
||||
return m1.getVersion() > m2.getVersion() ? 1 : -1;
|
||||
});
|
||||
// 4.取排在首位的角色模型的版本ID
|
||||
return list.get(0).getVersionId();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义属性
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user