优化表单图新建位置/解决角色图点击有时不生效问题/优化保存标题提示信息
This commit is contained in:
parent
6d2582509d
commit
8a5414e41c
@ -1814,7 +1814,7 @@ public class PALRepositoryQueryAPIManager {
|
||||
data.add(1,uuid);
|
||||
|
||||
RowMap rowMap = DBSql.getMap("SELECT EXT2 FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=? AND EXT2=?",model.getId(),data.toString());
|
||||
if (rowMap != null) {
|
||||
if (rowMap != null || model.getName().equals("角色模型")) {
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("id", model.getId().trim());
|
||||
object.put("pid", model.getNewParentId().trim());
|
||||
|
||||
@ -3729,6 +3729,12 @@ public class CoeDesignerWeb extends ActionWeb {
|
||||
if (!UtilString.isEmpty(property)) {
|
||||
CoePropertyUtil.createProperty(newUUID + "_attr", property);
|
||||
}
|
||||
|
||||
//创建关联关系
|
||||
CreateincidenceRelation(isLargeIteration,oldUUID,PALRepositoryCache.getCache().get(newUUID),mapNewUUID,tempVer);
|
||||
|
||||
|
||||
|
||||
CoeProcessLevelUtil.copyRepositoryProperty(PALRepositoryCache.getCache().get(oldUUID), PALRepositoryCache.getCache().get(newUUID), mapNewUUID, _uc);
|
||||
ro = ResponseObject.newOkResponse("创建成功");
|
||||
ro.put("uuid", lastplModel.getId());
|
||||
@ -3736,12 +3742,122 @@ public class CoeDesignerWeb extends ActionWeb {
|
||||
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
||||
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_REPOSITORY, CoEOpLogConst.OP_CREATE, CoEOpLogConst.INFO_REPOSITORY_NEW_VERSION_CREATE);
|
||||
}
|
||||
|
||||
ro = ResponseObject.newOkResponse("创建成功");
|
||||
ro.put("uuid", lastplModel.getId());
|
||||
} else {
|
||||
ro = ResponseObject.newWarnResponse("创建失败");
|
||||
}
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 操作升级版本/复制副本 创建对应角色/绩效关联关系
|
||||
* @param isLargeIteration
|
||||
* @param olduuid
|
||||
*/
|
||||
public String CreateincidenceRelation(boolean isLargeIteration,String olduuid,PALRepositoryModel newModel,Map<String, String> mapNewUUID,Double tempVer){
|
||||
ResponseObject ro = null;
|
||||
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
||||
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(olduuid);
|
||||
for (DesignerShapeRelationModel oldModel : oldModelList) {
|
||||
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(newModel.getId());
|
||||
//如果关联角色图,则同步复制角色图关联关系
|
||||
String methodIds="";
|
||||
if(oldModel.getAttrId().equals("role")){
|
||||
methodIds="org.role";
|
||||
if (mapNewUUID.containsKey(oldModel.getShapeId())) {
|
||||
|
||||
String srcPath = "";// 源文件路径
|
||||
String targetPath = "";// 目标文件路径
|
||||
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
PALRepositoryModelImpl lastplModel = (PALRepositoryModelImpl) coeProcessLevel.getInstance(oldModel.getRelationFileId());
|
||||
final String oldUUID = lastplModel.getId();
|
||||
lastplModel.setId(UUIDGener.getUUID());
|
||||
final String newUUID = lastplModel.getId();
|
||||
//大小版本号处理
|
||||
tempVer = isLargeIteration ? coeProcessLevel.getMaxVersionNum(lastplModel.getVersionId()) : coeProcessLevel.getMaxVersionNum(lastplModel.getVersionId(),lastplModel.getVersion());
|
||||
lastplModel.setHistoryMaxVersion("0");
|
||||
lastplModel.setVersion(VersionUtil.increaseVersionNo(tempVer,isLargeIteration));
|
||||
lastplModel.setUse(false);
|
||||
srcPath = lastplModel.getFilePath();
|
||||
if (!"".equals(srcPath) && srcPath != null) {
|
||||
targetPath = srcPath.replace(oldModel.getId(), lastplModel.getId());
|
||||
}
|
||||
lastplModel.setFilePath(targetPath);
|
||||
lastplModel.setPublish(false);
|
||||
lastplModel.setStop(false);
|
||||
lastplModel.setApproval(false);
|
||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||
String uid = super.getContext().getUID();
|
||||
lastplModel.setCreateUser(uid);
|
||||
lastplModel.setCreateDate(nowTime);
|
||||
lastplModel.setModifyUser(uid);
|
||||
lastplModel.setModifyDate(nowTime);
|
||||
List data=new ArrayList<>();
|
||||
data.add(0,"org.role");
|
||||
data.add(1,newModel.getId());
|
||||
lastplModel.setExt2(data.toString());
|
||||
//密级
|
||||
lastplModel.setSecurityLevel(-1);
|
||||
int store = 0;
|
||||
try {
|
||||
store = CoeProcessLevelDaoFacotory.createCoeProcessLevel().insert(lastplModel);
|
||||
if (store == 1) {
|
||||
// 修改设计器文件
|
||||
CoeFile fileUtil = new CoeFile();
|
||||
fileUtil.copyDefaultVersion(srcPath, oldUUID, targetPath, lastplModel.getId());
|
||||
|
||||
// 获取新旧节点关联关系
|
||||
final Map<String, String> mapNewUUID1 = createShapeIdRelation(PALRepositoryCache.getCache().get(oldModel.getRelationFileId()), true);
|
||||
// 处理流程属性
|
||||
String property = CoePropertyUtil.getPropertyValue(oldModel.getRelationFileId() + "_attr");
|
||||
if (!UtilString.isEmpty(property)) {
|
||||
CoePropertyUtil.createProperty(newUUID + "_attr", property);
|
||||
}
|
||||
|
||||
//重新设置修订关联关系
|
||||
DesignerShapeRelationModel newModel1 = new DesignerShapeRelationModel();
|
||||
newModel1.setId(UUIDGener.getUUID());
|
||||
newModel1.setFileId(newModel.getId());
|
||||
newModel1.setShapeId(mapNewUUID.get(oldModel.getShapeId()));
|
||||
newModel1.setShapeText(oldModel.getShapeText());
|
||||
newModel1.setAttrId(oldModel.getAttrId());
|
||||
newModel1.setRelationFileId(newUUID);
|
||||
newModel1.setRelationShapeId(oldModel.getRelationShapeId());
|
||||
newModel1.setRelationShapeText(oldModel.getRelationShapeText());
|
||||
dao.insert(newModel1);
|
||||
|
||||
|
||||
CoeProcessLevelUtil.copyRepositoryProperty(PALRepositoryCache.getCache().get(oldModel.getRelationFileId()), PALRepositoryCache.getCache().get(newUUID), mapNewUUID1, _uc);
|
||||
ro = ResponseObject.newOkResponse("创建成功");
|
||||
ro.put("uuid", lastplModel.getId());
|
||||
}else{
|
||||
ro = ResponseObject.newWarnResponse("创建失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ro = ResponseObject.newWarnResponse("创建失败," + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return ro.toString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设计器-删除某版本文件(放入回收站)
|
||||
* @param wsId
|
||||
@ -3766,6 +3882,7 @@ public class CoeDesignerWeb extends ActionWeb {
|
||||
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
||||
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_REPOSITORY, CoEOpLogConst.OP_DELETE, CoEOpLogConst.INFO_REPOSITORY_VERSION_DELETE);
|
||||
}
|
||||
deletePalCorrelationModel(wsId,teamId,id);
|
||||
} else {
|
||||
ro = ResponseObject.newErrResponse();
|
||||
ro.msg("删除失败");
|
||||
@ -3773,6 +3890,46 @@ public class CoeDesignerWeb extends ActionWeb {
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步删除关联绩效角色数据模型
|
||||
* @param wsId
|
||||
* @param teamId
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public String deletePalCorrelationModel (String wsId, String teamId, String id) {
|
||||
ResponseObject ro=ResponseObject.newOkResponse();
|
||||
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
||||
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(id);
|
||||
for (DesignerShapeRelationModel oldModel : oldModelList) {
|
||||
//如果关联角色图,则同步复制角色图关联关系
|
||||
String methodIds = "";
|
||||
if (oldModel.getAttrId().equals("role")) {
|
||||
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(oldModel.getRelationFileId());
|
||||
List<PALRepositoryModel> list = new ArrayList<PALRepositoryModel>();
|
||||
list.add(plModel);
|
||||
CoeProcessRecycleWeb recycleWeb = new CoeProcessRecycleWeb(_uc);
|
||||
boolean insertFlag = recycleWeb.saveRecycleProcesses(plModel, list); // 流程信息存入回收站
|
||||
|
||||
if (insertFlag) {
|
||||
CoeProcessLevelDaoFacotory.createCoeProcessLevel().deletePalRepositoryVersion(oldModel.getRelationFileId());
|
||||
CoeProcessLevelNoCache.getInstance().reloadInBackground(plModel.getWsId()); // 重新装载编号
|
||||
ro.msg("已放入回收站");
|
||||
// 操作行为日志记录
|
||||
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
||||
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_REPOSITORY, CoEOpLogConst.OP_DELETE, CoEOpLogConst.INFO_REPOSITORY_VERSION_DELETE);
|
||||
}
|
||||
} else {
|
||||
ro = ResponseObject.newErrResponse();
|
||||
ro.msg("删除失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设计器-切换版本状态为使用中
|
||||
* @param wsId
|
||||
@ -3790,12 +3947,56 @@ public class CoeDesignerWeb extends ActionWeb {
|
||||
if (answer > 0) {
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
ro.put("id", id);
|
||||
|
||||
//将关联模型(角色、绩效)同步更改使用中状态
|
||||
changePalDesignerVersionUseBycorrelationModel(wsId,teamId,id);
|
||||
|
||||
return ro.toString();
|
||||
} else {
|
||||
return ResponseObject.newErrResponse("使用版本更新失败").toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将关联模型(角色、绩效)同步更改使用中状态
|
||||
* @param wsId
|
||||
* @param teamId
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public String changePalDesignerVersionUseBycorrelationModel(String wsId, String teamId, String id) {
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
||||
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(id);
|
||||
for (DesignerShapeRelationModel oldModel : oldModelList) {
|
||||
|
||||
//如果关联角色图,则同步复制角色图关联关系
|
||||
String methodIds = "";
|
||||
if (oldModel.getAttrId().equals("role")) {
|
||||
int answer = 0;
|
||||
PALRepository repository = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
PALRepositoryModel lastPlModel = repository.getInstance(oldModel.getRelationFileId());
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 生成更多特性的json串
|
||||
public String getMoreAttritbute(UserContext me, String type, String wsId, String uuid, String processDefId, String shapeName, String category, String defaultCategory) {
|
||||
if (UtilString.isEmpty(category)) {
|
||||
|
||||
@ -421,7 +421,6 @@ public class UpfileWeb extends ActionWeb {
|
||||
UpFileDao upfileDao = new UpFileDao();
|
||||
|
||||
try {
|
||||
|
||||
long times = System.currentTimeMillis();
|
||||
final String zipName = "批量下载"+ toolbarname + ".zip";
|
||||
String targetDir = AWSServerConf.getProperty("dc.path") + File.separator + "com.actionsoft.apps.coe.pal" + File.separator + "tmp/grouppackage/zip" + times + "/";
|
||||
|
||||
@ -694,7 +694,12 @@ public class CoeProcessLevelUtil {
|
||||
//文件属性存在流程绩效,则同步创建关联关系
|
||||
if(propertyModel.getPropertyId().equals("Process_performance_metrics")){
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(newUuid);
|
||||
CoeProcessLevelWeb.createCorrelationDialogModel(newUuid,"control.kpi",model.getWsId(),"");
|
||||
/*CoeProcessLevelWeb.createCorrelationDialogModel(newUuid,"control.kpi",model.getWsId(),"");*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -714,19 +719,12 @@ public class CoeProcessLevelUtil {
|
||||
//bybzp 如果图形是过程链图和BPMN图 则不复制流程绩效和角色
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(uuId);
|
||||
String methodId = model.getMethodId();
|
||||
if("process.bpmn2".contains(methodId)){
|
||||
if("process.bpmn2,process.epc".contains(methodId) /*&& "Process_performance_metrics,role".contains(oldModel.getAttrId())*/){
|
||||
continue;
|
||||
}
|
||||
//by bzp end
|
||||
if (mapNewUUID.containsKey(oldModel.getShapeId())) {
|
||||
|
||||
//如果关联角色图,则同步复制角色图关联关系
|
||||
String methodIds="";
|
||||
if(oldModel.getAttrId().equals("role")){
|
||||
methodIds="org.role";
|
||||
}
|
||||
CoeProcessLevelWeb.createCorrelationDialogModel(model.getId(),methodIds,model.getWsId(),"");
|
||||
|
||||
DesignerShapeRelationModel newModel = new DesignerShapeRelationModel();
|
||||
newModel.setId(UUIDGener.getUUID());
|
||||
newModel.setFileId(uuId);
|
||||
@ -751,10 +749,11 @@ public class CoeProcessLevelUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 更新PAL与BPMS之间的关联(含PAL推送到BPMS运行,BPMS关联到PAL梳理)关系
|
||||
* 由APP_ACT_COE_PROP表数据更新转换至APP_ACT_COE_PAL_CORRELATE
|
||||
|
||||
@ -7,6 +7,8 @@ import com.actionsoft.apps.coe.pal.cooperation.cache.CooperationCache;
|
||||
import com.actionsoft.apps.coe.pal.cooperation.constant.CoeCooperationConst;
|
||||
import com.actionsoft.apps.coe.pal.cooperation.model.CoeCooperationMemberModel;
|
||||
import com.actionsoft.apps.coe.pal.cooperation.model.CoeCooperationTeamModel;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.constant.Constant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.LogUtil;
|
||||
import com.actionsoft.apps.coe.pal.log.CoEOpLogAPI;
|
||||
import com.actionsoft.apps.coe.pal.log.CoEOpLogConst;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.util.OutputWordUtil;
|
||||
@ -8283,7 +8285,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
* by zhaolei
|
||||
*/
|
||||
public String checkCreatePalProcessLevelRepository(String title,String method){
|
||||
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
RowMap rowMap=DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME=? AND PLMETHODID=?",title,method);
|
||||
if(rowMap!=null){
|
||||
@ -8404,10 +8405,10 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
try {
|
||||
|
||||
RowMap rowMap = DBSql.getMap("SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?", uuid);
|
||||
RowMap rowMap = DBSql.getMap("SELECT PLNAME,PLPARENTID FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?", uuid);
|
||||
if (rowMap != null) {
|
||||
String plname = rowMap.getString("PLNAME");
|
||||
|
||||
String plparentid=rowMap.getString("PLPARENTID");
|
||||
String titleName=null;
|
||||
String shapName=null;
|
||||
String parentId=null;
|
||||
@ -8420,9 +8421,10 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
category="org";
|
||||
graphTitle="角色";
|
||||
}else if(methodId.equals("data.form")){
|
||||
//如果新建表单图需与当前模型建立在同一级目录下
|
||||
titleName="表单图";
|
||||
shapName="form";
|
||||
parentId="process";
|
||||
parentId=plparentid;
|
||||
category="data";
|
||||
methodId="data.form";
|
||||
graphTitle="表单";
|
||||
@ -8445,8 +8447,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
data.add(0,methodId);
|
||||
data.add(1,uuid);
|
||||
|
||||
|
||||
|
||||
//判断如果methodID为角色图,则创建到对应角色模型文件夹中
|
||||
if(methodId.equals("org.role")){
|
||||
RowMap rowMaprole=DBSql.getMap("SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME='角色模型' and PLCATEGORY='org'");
|
||||
@ -8579,179 +8579,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建角色/绩效/表单模型
|
||||
* @return
|
||||
* by zhaolei
|
||||
*/
|
||||
public static String createCorrelationDialogModel(String uuid,String methodId,String wsId,String teamId){
|
||||
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
try {
|
||||
|
||||
RowMap rowMap = DBSql.getMap("SELECT PLNAME,CREATEUSER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?", uuid);
|
||||
if (rowMap != null) {
|
||||
String plname = rowMap.getString("PLNAME");
|
||||
|
||||
String titleName=null;
|
||||
String shapName=null;
|
||||
String parentId=null;
|
||||
String category=null;
|
||||
String graphTitle=null;
|
||||
if(methodId.equals("org.role")){
|
||||
titleName="角色图";
|
||||
shapName="role";
|
||||
parentId="org";
|
||||
category="org";
|
||||
graphTitle="角色";
|
||||
}else if(methodId.equals("control.kpi")){
|
||||
titleName="绩效图";
|
||||
shapName="kpi";
|
||||
parentId="control";
|
||||
category="control";
|
||||
graphTitle="绩效";
|
||||
}
|
||||
|
||||
|
||||
//先执行新建操作产生plid
|
||||
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
|
||||
String plRid = UUIDGener.getUUID();
|
||||
String id = UUIDGener.getUUID();
|
||||
|
||||
List data=new ArrayList();
|
||||
data.add(0,methodId);
|
||||
data.add(1,uuid);
|
||||
|
||||
|
||||
|
||||
//判断如果methodID为角色图,则创建到对应角色模型文件夹中
|
||||
if(methodId.equals("org.role")){
|
||||
RowMap rowMaprole=DBSql.getMap("SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME='角色模型' and PLCATEGORY='org'");
|
||||
if(rowMaprole!=null){
|
||||
parentId=rowMaprole.getString("ID");
|
||||
}else{
|
||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
String roleplRid = UUIDGener.getUUID();
|
||||
String roleid = UUIDGener.getUUID();
|
||||
|
||||
//新建文件夹
|
||||
PALRepositoryModelImpl modeldefault = CoeProcessLevelUtil.createPALRepositoryModel(roleid, roleplRid, wsId, "角色模型",
|
||||
"", 1, "org", "org", true, 1,
|
||||
roleid, false, "default", "0", 1, null,
|
||||
null, "admin", "admin", nowTime, null, null,
|
||||
null, null, null, null, null, null, null, 1);
|
||||
coeProcessLevel.insert(modeldefault);
|
||||
return modeldefault.getId();
|
||||
|
||||
}
|
||||
}
|
||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(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);
|
||||
|
||||
coeProcessLevel.insert(model);
|
||||
|
||||
|
||||
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(model.getId(), 0);
|
||||
if (defineModel == null) {
|
||||
defineModel = CoeDesignerUtil.createModel(model.getId(), 0);
|
||||
defineModel.setCreateHistory(false);
|
||||
}
|
||||
|
||||
String define = defineModel.getDefinition();
|
||||
JSONObject definition = JSONObject.parseObject(define);
|
||||
JSONObject elements = definition.getJSONObject("elements");
|
||||
|
||||
|
||||
//新建一个uuid
|
||||
String shapeId = UUIDGener.getObjectId();
|
||||
|
||||
//拿到基础结构
|
||||
JSONObject shape = ShapeUtils.getProcessShapeDefinitionByName(methodId, shapName);
|
||||
shape.put("id", shapeId);
|
||||
shape.put("text", graphTitle);
|
||||
|
||||
|
||||
JSONArray shapes = new JSONArray();
|
||||
/************************************************数据属性*********************************************************/
|
||||
|
||||
//图形的数据属性配置
|
||||
List<PALMethodAttributeModel> attributeModels = CoeDesignerShapeAPIManager.getInstance().getAllValidShapeAttributeModels(wsId, model.getMethodId());
|
||||
for (PALMethodAttributeModel attributeModel : attributeModels) {
|
||||
|
||||
//todo:根据importProperty的类型获取具体保存数据值
|
||||
|
||||
JSONObject arributeObj = new JSONObject();
|
||||
arributeObj.put("key", attributeModel.getKey());
|
||||
arributeObj.put("isRequired", attributeModel.getIsRequired());
|
||||
arributeObj.put("ref", attributeModel.getRef());
|
||||
arributeObj.put("readonly", attributeModel.getReadonly());
|
||||
arributeObj.put("scope", attributeModel.getScope());
|
||||
arributeObj.put("name", attributeModel.getTitle());
|
||||
arributeObj.put("id", attributeModel.getKey());
|
||||
arributeObj.put("type", attributeModel.getType());
|
||||
arributeObj.put("groupPath", attributeModel.getGroupPath());
|
||||
arributeObj.put("desc", attributeModel.getDesc());
|
||||
arributeObj.put("value", attributeModel.getValue());
|
||||
|
||||
JSONArray dataAttributes = shape.getJSONArray("dataAttributes");
|
||||
if (!dataAttributes.isEmpty() && dataAttributes.size() > 0) {
|
||||
for (Object attribute : dataAttributes) {
|
||||
JSONObject obj = (JSONObject) attribute;
|
||||
if (obj.containsKey("attributesJsonArray")) {
|
||||
obj.getJSONArray("attributesJsonArray").add(arributeObj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/************************************************文件属性*********************************************************/
|
||||
|
||||
|
||||
//复制文件属性
|
||||
updateCorrelationFileProperty(uuid,model.getId());
|
||||
|
||||
shapes.add(shape);
|
||||
JSONArray newShapes = getMethodCorrelationElementsJSONArray(shapes, 1);
|
||||
JSONObject newElements = new JSONObject();
|
||||
for (int i = 0; i < newShapes.size(); i++) {
|
||||
JSONObject shapeObj = newShapes.getJSONObject(i);
|
||||
newElements.put(shapeObj.getString("id"), shapeObj);
|
||||
}
|
||||
|
||||
definition.put("elements", newElements);
|
||||
|
||||
// 设置画布大小
|
||||
DiagramsUtil.setDiagramHeightWidth(definition, newElements);
|
||||
defineModel.setDefinition(definition.toString());
|
||||
// 保存文件
|
||||
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
|
||||
|
||||
|
||||
String createuser=rowMap.getString("CREATEUSER");
|
||||
// 小组权限设置
|
||||
if (!UtilString.isEmpty(teamId)) {
|
||||
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(UserContext.fromUID(createuser), teamId, model.getVersionId(), true, true);
|
||||
}
|
||||
|
||||
ro.put("uuid", id);
|
||||
ro.put("result", "ok");
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
ro.put("result","error");
|
||||
}
|
||||
|
||||
return ro.toString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -10404,19 +10232,98 @@ public String deleteReply(String replyid, String messageid) {
|
||||
}
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(sourceId);
|
||||
String result = copyFile(wsId, teamId, sourceId, targetId, "all");
|
||||
|
||||
JSONObject moveRo = JSONObject.parseObject(result);
|
||||
if (!"ok".equals(moveRo.getString("result"))) {
|
||||
SDK.getLogAPI().consoleErr("复制文件[" + model.getName() + "][" + model.getId() + "]失败," + moveRo.getString("msg"));
|
||||
return ResponseObject.newErrResponse(moveRo.getString("msg")).toString();
|
||||
}
|
||||
//copyPalProcessLevelCorrelationModelRepository(wsId,teamId,sourceIds);
|
||||
}
|
||||
// 操作行为日志记录
|
||||
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
||||
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_REPOSITORY, CoEOpLogConst.OP_CREATE, CoEOpLogConst.INFO_REPOSITORY_COPY_CREATE);
|
||||
}
|
||||
|
||||
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步复制角色、绩效模型图信息
|
||||
* @param wsId
|
||||
* @param teamId
|
||||
* @param sourceIds
|
||||
* @param targetId
|
||||
* @return
|
||||
*/
|
||||
public String copyPalProcessLevelCorrelationModelRepository(String wsId, String teamId, String sourceIds) {
|
||||
|
||||
JSONArray sourceIdArr = JSONArray.parseArray(sourceIds);
|
||||
for (int i = 0; i < sourceIdArr.size(); i++) {
|
||||
String sourceId = sourceIdArr.getString(i);
|
||||
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
||||
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(sourceId);
|
||||
for (DesignerShapeRelationModel oldModel : oldModelList) {
|
||||
|
||||
//如果关联角色图,则同步复制角色图关联关系
|
||||
String methodIds = "";
|
||||
if (oldModel.getAttrId().equals("role")) {
|
||||
|
||||
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
String targetId = checkAndCreatePalRoleFolderModel(coeProcessLevel,wsId);
|
||||
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(oldModel.getRelationFileId());
|
||||
String result = copyFile(wsId, teamId, oldModel.getRelationFileId(), targetId, "all");
|
||||
|
||||
JSONObject moveRo = JSONObject.parseObject(result);
|
||||
if (!"ok".equals(moveRo.getString("result"))) {
|
||||
SDK.getLogAPI().consoleErr("复制文件[" + model.getName() + "][" + model.getId() + "]失败," + moveRo.getString("msg"));
|
||||
return ResponseObject.newErrResponse(moveRo.getString("msg")).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 校验和创建角色模型文件夹
|
||||
* @param coeProcessLevel
|
||||
* @param wsId
|
||||
* @return 已经存在的或新创建的角色模型ID
|
||||
*/
|
||||
private String checkAndCreatePalRoleFolderModel(PALRepository coeProcessLevel, String wsId) {
|
||||
// 组织下创建[角色模型]文件夹
|
||||
List<PALRepositoryModel> defaultModels = PALRepositoryQueryAPIManager.getInstance().getPalRepositoryModelsByWsIdAndMethodId(wsId, "org");
|
||||
defaultModels = defaultModels.stream()
|
||||
.filter(model -> "default".equals(model.getMethodId()))
|
||||
.filter(model -> Constant.DEFAULT_FOLDER_NAME.equals(model.getName())).collect(Collectors.toList());
|
||||
if (defaultModels.size() == 0) {
|
||||
String id = UUIDGener.getUUID();
|
||||
|
||||
int orderIndex = coeProcessLevel.getChildrenMaxOrderIndexByPidAndWsId("org", wsId) + 1;
|
||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||
PALRepositoryModelImpl defaultModel = CoeProcessLevelUtil.createPALRepositoryModel(id, UUIDGener.getUUID(), wsId, Constant.DEFAULT_FOLDER_NAME, "", orderIndex, "org", "org", true, 1,
|
||||
id, false, "default", "0", 1, null, null, _uc.getUID(), _uc.getUID(), nowTime, null, null, null, null,
|
||||
null, null, null, null, null, -1);
|
||||
coeProcessLevel.insert(defaultModel);
|
||||
defaultModels.add(defaultModel);
|
||||
return defaultModel.getId();
|
||||
} else {
|
||||
return defaultModels.get(0).getId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除模型文件
|
||||
* @param wsId
|
||||
|
||||
@ -3543,7 +3543,9 @@ function openRelationDig(obj,value) {
|
||||
uuid:ruuid,
|
||||
methodId:methodId
|
||||
},
|
||||
async: false,
|
||||
success : function(msg) {
|
||||
debugger;
|
||||
if (msg.data.result == "ok") {
|
||||
window.top.$.simpleAlert("请勿重复新建角色模型!!!");
|
||||
}else{
|
||||
|
||||
@ -64,7 +64,7 @@ var UI = {
|
||||
changeTitle(newTitle);
|
||||
} else {
|
||||
console.log(r);
|
||||
$.simpleAlert(newTitle+"名称重复,请重新输入!!!", 'error');
|
||||
$.simpleAlert("保存失败!"+newTitle+"名称已存在记录,请重新输入", 'error');
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
@ -105,6 +105,7 @@ var UI = {
|
||||
+ appId,
|
||||
async : false,// 同步,默认为异步
|
||||
ok : function(msg) {
|
||||
$.simpleAlert("保存成功", 'ok');
|
||||
//同步设置文件属性中的流程名称
|
||||
$("#file_attribute").contents().find("input[id='plName']").val(title);
|
||||
try {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user