解决创建默认错误数据问题

This commit is contained in:
zhal 2022-07-05 13:56:32 +08:00
parent 943714276c
commit 2ba17f768b
3 changed files with 130 additions and 27 deletions

View File

@ -2900,6 +2900,11 @@ public class CoEPALController {
}
@Mapping("com.actionsoft.apps.coe.pal_processlevel_repository_create_save_Designer")
public String saveCreatePalProcessLevelRepositoryDesigner(UserContext me, String wsId, String teamId, String category, String method, String parentId, String container,Integer securityLevel,String name) {
CoeProcessLevelWeb web = new CoeProcessLevelWeb(me);
return web.saveCreatePalProcessLevelRepositoryDesigner(wsId, teamId, category, method, parentId, container,securityLevel,name);
}
/**
* 校验重名功能

View File

@ -47,7 +47,7 @@ public class SynchronousOrgJob implements IJob {
String plRid1 = UUIDGener.getUUID();
String id1 = UUIDGener.getUUID();
orgdepartmentList = DBSql.getMaps("select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID,ORDERINDEX from ORGDEPARTMENT limit 20");
orgdepartmentList = DBSql.getMaps("select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID,ORDERINDEX from ORGDEPARTMENT ");
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
@ -190,7 +190,7 @@ public class SynchronousOrgJob implements IJob {
if(orgdepartmentList.size()>0){
for(int i=0;i<orgdepartmentList.size();i++){
/* for(int i=0;i<orgdepartmentList.size();i++){
//新建一个uuid
String shapeId1 = UUIDGener.getObjectId();
@ -216,7 +216,7 @@ public class SynchronousOrgJob implements IJob {
elements.put(shapeId1, shape1);
}
}
}*/
}

View File

@ -2492,8 +2492,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
// 排序
propertys.sort((p1, p2) -> (sortAttrMap.containsKey(p1.getPropertyId()) ? sortAttrMap.get(p1.getPropertyId()) : 0) - (sortAttrMap.containsKey(p2.getPropertyId()) ? sortAttrMap.get(p2.getPropertyId()) : 0));
JSONArray repositoryPathData = CoeProcessLevelUtil.getRepositoryPath(m.getId());
StringBuilder content = new StringBuilder();
StringBuilder sb = new StringBuilder();
JSONObject refs = new JSONObject();
@ -2614,16 +2612,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
boolean isRequired = attributeModel.getIsRequired();
/****************************************判断如果添加组织架构则修改显示值 by zhaolei*******************************************************************/
String input = null;
if(attributeModel.getKey().contains("Process_Architecture") && (repositoryPathData.size()!=index)) {
String name = ((JSONObject) repositoryPathData.get(index)).getString("name");
input="<input type='text' class='awsui-textbox' name=\"" + id + "\" id=\"" + id + "\" value=\"" + name + "\" sid=\"" + sid + "\" uuid=\"" + uuid + "\" data-originvalue='"+ name +"' isRequired='" + isRequired + "' onblur='saveContent($(this));' readonly=true />";
index++;
}else{
input="<input type='text' class='awsui-textbox' name=\"" + id + "\" id=\"" + id + "\" value=\"" + inputValue + "\" sid=\"" + sid + "\" uuid=\"" + uuid + "\" data-originvalue='"+ inputValue +"' isRequired='" + isRequired + "' onblur='saveContent($(this));'/>";
}
//String input = "<input type='text' class='awsui-textbox' name=\"" + id + "\" id=\"" + id + "\" value=\"" + inputValue + "\" sid=\"" + sid + "\" uuid=\"" + uuid + "\" data-originvalue='"+ inputValue +"' " + event + "/>";
String input = "<input type='text' class='awsui-textbox' name=\"" + id + "\" id=\"" + id + "\" value=\"" + inputValue + "\" sid=\"" + sid + "\" uuid=\"" + uuid + "\" data-originvalue='"+ inputValue +"' " + event + "/>";
String type = attributeModel.getType();
@ -8004,6 +7993,120 @@ public class CoeProcessLevelWeb extends ActionWeb {
}
// 保存文件属性
PALRepositoryAPIManager.getInstance().updateRepositoryProperty(model.getId());
// 小组权限设置
if (!UtilString.isEmpty(teamId)) {
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(_uc, teamId, model.getVersionId(), true, true);
}
ro.put("id", id);
// 操作行为日志记录
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_CREATE);
}
return ro.toString();
}
public String saveCreatePalProcessLevelRepositoryDesigner(String wsId, String teamId, String category, String method, String parentId, String container,Integer securityLevel,String name){
ResponseObject ro = ResponseObject.newOkResponse();
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
String parentVersionId = "";
int level = 1;
if (parentId.length() < 36) {// 父节点是大类
parentVersionId = parentId;
} else {
PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(parentId);
parentVersionId = parentModel.getVersionId();
level = parentModel.getLevel() + 1;
}
int orderIndex = coeProcessLevel.getChildrenMaxOrderIndexByPidAndWsId(parentId, wsId) + 1;
String uid = _uc.getUID();
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
String plRid = UUIDGener.getUUID();
String id = UUIDGener.getUUID();
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id, plRid, wsId, name, "", orderIndex, parentVersionId, category, true, 1,
id, false, method, "0", level, null, null, uid, uid, nowTime, null, null, null, null, null, null, null, null, null,securityLevel);
// 创建
try {
coeProcessLevel.insert(model);
// 流程发布用户组权限和父级同步
PALRepositoryModel parentModel = (PALRepositoryModel) coeProcessLevel.getInstance(parentId);
if (parentModel != null) {
PublishUserGroupPerm dao = new PublishUserGroupPerm();
List<PublishUserGroupPermModel> list = dao.getAllPermsByResourceId(parentModel.getVersionId());
for (PublishUserGroupPermModel parentPModel : list) {
PublishUserGroupPermModel newPModel = new PublishUserGroupPermModel();
newPModel.setId(UUIDGener.getUUID());
newPModel.setGroupId(parentPModel.getGroupId());
newPModel.setPermType(parentPModel.getPermType());
newPModel.setResourceId(model.getId());
dao.insert(newPModel);
}
}
} catch (Exception e) {
e.printStackTrace();
}
// 如果有模板复制模板中的内容
if (container != null && !"".equals(container) && !"_blank".equals(container)) {
PALMethodTemplateModel templateModel = PALMethodTemplateCache.getCache().get(container);
BaseModel defineModel;
if (category.contains("bpmn2")) {
defineModel = CoeDesignerUtil.createBPMNModel(model.getId(), 0);
} else {
defineModel = CoeDesignerUtil.createModel(model.getId(), 0);
}
defineModel.setDefinition(copyDefine(model.getId(), templateModel.getDefine().toString()));
if (category.contains("bpmn2")) {
CoeDesignerAPIManager.getInstance().storeDefinitionOfBpmn((BPMNModel) defineModel);
} else {
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);
}
// 保存模型属性(依照最新的属性进行保存不再取模板属性)
// String tempId = templateModel.getDefine().getString("uuid");
// String json = CoePropertyUtil.getPropertyValue(tempId + "_attr");
// if (!UtilString.isEmpty(json)) {
// JSONArray jsonArr = JSONArray.parseArray(json);
// for (int i = 0; i < jsonArr.size(); i++) {
// JSONObject attribute = jsonArr.getJSONObject(i);
// attribute.put("value", "");
// }
// try {
// PALRepositoryAPIManager.getInstance().updatePropertysByPLId(model.getId(), jsonArr);
// } catch (SQLException e) {
// e.printStackTrace();
// }
// }
}
// 保存文件属性
PALRepositoryAPIManager.getInstance().updateRepositoryProperty(model.getId());
JSONArray repositoryPathData = CoeProcessLevelUtil.getRepositoryPath(parentId);
PALRepositoryPropertyDao propertyDao = new PALRepositoryPropertyDao();
// 一级架构默认值处理
int index=1;
if(repositoryPathData.size()>0){
for(int i=0;i<repositoryPathData.size();i++){
String name1=((JSONObject) repositoryPathData.get(i)).getString("name");
if(UtilString.isNotEmpty(name1)){
propertyDao.updatePropertyByPropertyId(model.getId(), "Process_Architecture_L"+index, name1);
index++;
}
}
}
// 小组权限设置
if (!UtilString.isEmpty(teamId)) {
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(_uc, teamId, model.getVersionId(), true, true);
@ -8018,16 +8121,15 @@ public class CoeProcessLevelWeb extends ActionWeb {
/***************************************************获取当前文件位置 byzhaolei**********************************************/
// 获取当前文件路径
JSONArray repositoryPathData = CoeProcessLevelUtil.getRepositoryPath(parentId);
StringBuffer sb = new StringBuffer();
StringBuffer sb = new StringBuffer();
if(repositoryPathData.size()>0){
for(int i=0;i<repositoryPathData.size();i++){
String name=((JSONObject) repositoryPathData.get(i)).getString("name");
sb.append(name).append("\\");
}
}
for(int i=0;i<repositoryPathData.size();i++){
String name2=((JSONObject) repositoryPathData.get(i)).getString("name");
sb.append(name2).append("\\");
}
}
String keywordStr = sb.deleteCharAt(sb.length() - 1).toString();//去掉最后一个逗号
String keywordStr = sb.deleteCharAt(sb.length() - 1).toString();//去掉最后一个逗号
ro.put("repositoryPathData",keywordStr);
return ro.toString();
@ -8035,7 +8137,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
/**
*校验是否存在重复标题
* @param title
@ -8270,11 +8371,8 @@ public class CoeProcessLevelWeb extends ActionWeb {
}
}
PALMethodModel methodModel = PALMethodCache.getPALMethodModelById(m.getMethodId());
List<PALMethodAttributeGroupModel> groups = methodModel.getGroup();
PALRepositoryPropertyDao dao = new PALRepositoryPropertyDao();
List<PALRepositoryPropertyModel> propertys = dao.getPropertysByPlid(uuid, null);
// 排序
propertys.sort((p1, p2) -> (sortAttrMap.containsKey(p1.getPropertyId()) ? sortAttrMap.get(p1.getPropertyId()) : 0) - (sortAttrMap.containsKey(p2.getPropertyId()) ? sortAttrMap.get(p2.getPropertyId()) : 0));
Boolean flag1=false;