diff --git a/com.actionsoft.apps.coe.pal.datamigration/lib/com.actionsoft.apps.coe.pal.datamigration.jar b/com.actionsoft.apps.coe.pal.datamigration/lib/com.actionsoft.apps.coe.pal.datamigration.jar index e55e8045..4d3416b3 100644 Binary files a/com.actionsoft.apps.coe.pal.datamigration/lib/com.actionsoft.apps.coe.pal.datamigration.jar and b/com.actionsoft.apps.coe.pal.datamigration/lib/com.actionsoft.apps.coe.pal.datamigration.jar differ diff --git a/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar b/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar index 7f19e122..40724595 100644 Binary files a/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar and b/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar differ diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java index 70cc9d68..91984c76 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java @@ -16,6 +16,7 @@ import java.util.concurrent.*; import java.util.stream.Collectors; import com.actionsoft.apps.coe.pal.constant.CoEConstant; +import com.actionsoft.apps.coe.pal.cooperation.cache.CooperationCache; import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager; import com.actionsoft.apps.coe.pal.cooperation.model.CoeCooperationTeamModel; import com.actionsoft.apps.coe.pal.pal.manage.publish.PublishAPIManager; @@ -1921,7 +1922,8 @@ public class ProcessPublishWeb extends ActionWeb { } } List list = dao.getPublishedRepositoryList(wsId); - List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, _uc.getUID()); +// List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, _uc.getUID()); + Set versionIds = CooperationCache.getUserDataVisitablePermission(teamId, _uc.getUID(), false); if (UtilString.isNotEmpty(teamId)) { if (list != null) { List removeList = new ArrayList(); @@ -1953,7 +1955,8 @@ public class ProcessPublishWeb extends ActionWeb { } } List list = dao.getPublishedRepositoryList(wsId); - List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, _uc.getUID()); +// List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, _uc.getUID()); + Set versionIds = CooperationCache.getUserDataVisitablePermission(teamId, _uc.getUID(), false); if (UtilString.isNotEmpty(teamId)) { if (list != null) { List removeList = new ArrayList(); diff --git a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar index f2a04834..e5bfd07f 100644 Binary files a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar and b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar differ diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java index 0d1977b3..3ec3d921 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java @@ -3309,4 +3309,18 @@ public class CoEPALController { return web.getRepositoryModelVersionDiff(id); } + /** + * 校验形状属性 + * @param me + * @param uuid + * @param define 若为空字符串,则获取系统当前保存的define进行校验 + * @return + */ + @Mapping("com.actionsoft.apps.coe.pal_repository_define_shape_attr_valid") + public String validRepositoryShapeAttr(UserContext me, String uuid, String define) { + CoeDesignerWeb web = new CoeDesignerWeb(me); + return web.validRepositoryShapeAttr(uuid, define); + } + + } diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/CoeCooperationAPIManager.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/CoeCooperationAPIManager.java index d1e71901..57e8cec4 100644 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/CoeCooperationAPIManager.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/CoeCooperationAPIManager.java @@ -505,8 +505,8 @@ public class CoeCooperationAPIManager { // 获取用户权限,判断是否已存在 List rolePermList = new CoeCooperationRolePermDao().getRolePermListByRole(teamId, hideRole.getId()); if (!rolePermList.contains(palVersionId)) { - // 添加角色权限 - CoeCooperationRolePermModel rolePerm = new CoeCooperationRolePermModel(UUIDGener.getUUID(), teamId, hideRole.getId(), palVersionId); + // 添加角色权限, 当前用户新建默认给全部的操作权限 + CoeCooperationRolePermModel rolePerm = new CoeCooperationRolePermModel(UUIDGener.getUUID(), teamId, hideRole.getId(), palVersionId,"w,d,v"); new CoeCooperationRolePermDao().insert(rolePerm); } } diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/method/cache/PALMethodCache.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/method/cache/PALMethodCache.java index 1a127e50..662ecbca 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/method/cache/PALMethodCache.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/method/cache/PALMethodCache.java @@ -5,6 +5,7 @@ import java.util.*; import com.actionsoft.apps.AppsConst; import com.actionsoft.apps.coe.pal.constant.CoEConstant; import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager; +import com.actionsoft.apps.coe.pal.cooperation.cache.CooperationCache; import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; import com.actionsoft.apps.lifecycle.api.AppsAPIManager; @@ -140,7 +141,8 @@ public class PALMethodCache { List methodList = PALMethodCache.getPALMethodList(sort); if (UtilString.isNotEmpty(teamId)) { List permMethodList = new ArrayList<>(); - List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, userId); +// List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, userId); + Set versionIds = CooperationCache.getUserDataVisitablePermission(teamId, userId, false); for (String verId : versionIds) { List verModels = PALRepositoryCache.getByVersionId(verId); if (verModels != null && verModels.size() > 0 && !permMethodList.contains(verModels.get(0).getMethodCategory())) { @@ -169,7 +171,8 @@ public class PALMethodCache { List methodList = PALMethodCache.getPALMethodList(sort); if (UtilString.isNotEmpty(teamId)) { List permMethodList = new ArrayList<>(); - List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, userId); +// List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, userId); + Set versionIds = CooperationCache.getUserDataVisitablePermission(teamId, userId, false); for (String verId : versionIds) { List verModels = PALRepositoryCache.getByVersionId(verId); if (verModels != null && verModels.size() > 0 && !permMethodList.contains(verModels.get(0).getMethodCategory())) { diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/web/CoeDesignerWeb.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/web/CoeDesignerWeb.java index b483ef84..9f636d36 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/web/CoeDesignerWeb.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/web/CoeDesignerWeb.java @@ -3401,6 +3401,80 @@ public class CoeDesignerWeb extends ActionWeb { return ro.toString(); } + /** + * 校验形状属性 + * @param uuid + * @param define 若为空字符串,则获取系统当前保存的define进行校验 + * @return + */ + public String validRepositoryShapeAttr(String uuid, String define) { + PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid); + if (model == null) { + return ResponseObject.newErrResponse("模型不存在").toString(); + } + if (UtilString.isEmpty(define) || "null".equals(define) || "undefined".equals(define)) { + define = PALRepositoryQueryAPIManager.getInstance().getProcessDefinition(_uc, uuid); + } + Map methodAttributeModelMap = new HashMap<>(); + + // 校验形状 + List elements = ShapeUtil.getShapeJsonToJsonObject(define); + List resultList = new ArrayList<>(); + for (JSONObject o : elements) { + String shapeId = o.getString("id"); + String shapeName = o.getString("name"); + String text = UtilString.isEmpty(o.getString("text")) ? o.getString("title") : o.getString("text"); + String shapeCategory = o.getString("category"); + JSONObject dataAttributes = o.getJSONObject("dataAttributes"); + JSONArray attributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray"); + for (int i = 0; i < attributesJsonArray.size(); i++) { + JSONObject attr = attributesJsonArray.getJSONObject(i); + String attrId = attr.getString("id"); + String value = attr.getString("value"); + if (!methodAttributeModelMap.containsKey(shapeName + "-" + attrId)) { + List methodAttributeModels = CoeDesignerShapeAPIManager.getInstance().getValidAndUseAttributeModels(model.getWsId(), shapeCategory.replace("_", "."), shapeName, model.getMethodId()); + for (PALMethodAttributeModel attributeModel : methodAttributeModels) { + if (!methodAttributeModelMap.containsKey(shapeName + "-" + attributeModel.getKey())) { + methodAttributeModelMap.put(shapeName + "-" + attributeModel.getKey(), attributeModel); + } + } + } + if (!methodAttributeModelMap.containsKey(shapeName + "-" + attrId)) { + continue;// 没有配置到形状的属性,不处理 + } + PALMethodAttributeModel attrModel = methodAttributeModelMap.get(shapeName + "-" + attrId); + if (attrModel.getIsRequired()) {// 筛选必填 + String attrType = attrModel.getType(); + boolean flag = true; + if ("relation".equals(attrType) || "awsorg".equals(attrType)) { + List list = DesignerShapeRelationCache.getListByAttrId(model.getId(), shapeId, attrId); + if (list == null || list.isEmpty()) { + flag = false; + } + } else { + flag = UtilString.isNotEmpty(value); + } + if (!flag) { + JSONObject tmp = new JSONObject(); + tmp.put("shapeId", shapeId); + tmp.put("shapeName", text); + tmp.put("attrName", attrModel.getNewTitle()); + tmp.put("attrId", attrId); + resultList.add(tmp); + } + } + } + } + ResponseObject ro = ResponseObject.newOkResponse(); + if (!resultList.isEmpty()) { + ro.setData(resultList); + ro.err("校验未通过"); + return ro.toString(); + } + return ResponseObject.newOkResponse().toString(); + + } + /******************************************新版门户流程详情end********************************************************/ //获取excel数据的内部类 diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/web/CoeProcessLevelWeb.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/web/CoeProcessLevelWeb.java index ba29655e..701d7b44 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/web/CoeProcessLevelWeb.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/web/CoeProcessLevelWeb.java @@ -6,7 +6,6 @@ import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager; import com.actionsoft.apps.coe.pal.cooperation.cache.CooperationCache; import com.actionsoft.apps.coe.pal.log.CoEOpLogAPI; import com.actionsoft.apps.coe.pal.log.CoEOpLogConst; -import com.actionsoft.apps.coe.pal.output.pr.util.ReportRepositoryCompare; import com.actionsoft.apps.coe.pal.pal.output.util.OutputWordUtil; import com.actionsoft.apps.coe.pal.pal.repository.util.DiagramsUtil; import com.actionsoft.apps.coe.pal.pal.repository.util.ShapeUtils; @@ -116,6 +115,7 @@ import org.apache.poi.ss.usermodel.VerticalAlignment; import org.docx4j.wml.R; import java.io.*; +import java.nio.charset.StandardCharsets; import java.sql.Connection; import java.sql.SQLException; import java.sql.Timestamp; @@ -173,14 +173,14 @@ public class CoeProcessLevelWeb extends ActionWeb { UtilString utilString = new UtilString(plSecurityW); List v = utilString.split(","); for (int i = 0, size = v.size(); i < size; i++) { - String w = (String) v.get(i); + String w = v.get(i); plSecurityR = plSecurityR.replace(",", " "); if (plSecurityR.indexOf(w) > -1) { plSecurityR = plSecurityR.replace(w, ""); } } plSecurityR = plSecurityR.trim(); - UtilString r = new UtilString(plSecurityR.toString()); + UtilString r = new UtilString(plSecurityR); List newplRs = r.split(" "); int c = 0; Iterator it = newplRs.iterator(); @@ -204,14 +204,14 @@ public class CoeProcessLevelWeb extends ActionWeb { UtilString utilString = new UtilString(newStr); List v = utilString.split(","); for (int i = 0, size = v.size(); i < size; i++) { - String w = (String) v.get(i); + String w = v.get(i); oldStr = oldStr.replace(",", " "); if (oldStr.indexOf(w) > -1) { oldStr = oldStr.replace(w, ""); } } oldStr = oldStr.trim(); - UtilString r = new UtilString(oldStr.toString()); + UtilString r = new UtilString(oldStr); List newplRs = r.split(" "); int c = 0; Iterator it = newplRs.iterator(); @@ -247,7 +247,7 @@ public class CoeProcessLevelWeb extends ActionWeb { macroLibraries.put("option", getCoeWorspaceHtml()); macroLibraries.put("wsuuid", wsuuid); macroLibraries.put("userId", _uc.getUserModel().getUID()); - CoeWorkSpaceModel model = (CoeWorkSpaceModel) CoeWorkSpaceDaoFactory.createCoeWorkSpace().getInstance(wsuuid); + CoeWorkSpaceModel model = CoeWorkSpaceDaoFactory.createCoeWorkSpace().getInstance(wsuuid); macroLibraries.put("wsName", model == null ? "" : I18nRes.findValue(CoEConstant.APP_ID, model.getWsName())); macroLibraries.put("treeData", PALRepositoryQueryAPIManager.getInstance().getPalRepositoryTreeRootData(_uc, wsuuid, "", "isUsed")); macroLibraries.put("appId", CoEConstant.APP_ID); @@ -892,7 +892,7 @@ public class CoeProcessLevelWeb extends ActionWeb { FileOutputStream out = null; try { out = new FileOutputStream(dc.getPath() + File.separator + "plMessage.txt"); - out.write(messageObject.toString().getBytes("UTF-8")); + out.write(messageObject.toString().getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { e.printStackTrace(); } finally { @@ -1558,7 +1558,7 @@ public class CoeProcessLevelWeb extends ActionWeb { FileOutputStream logOut = null; try { logOut = new FileOutputStream(expandDir.getPath() + "/importLog.txt"); - logOut.write(sbLog.toString().getBytes("UTF-8")); + logOut.write(sbLog.toString().getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { e.printStackTrace(); } finally { @@ -2040,7 +2040,7 @@ public class CoeProcessLevelWeb extends ActionWeb { //写入导入日志 try { FileOutputStream logOut = new FileOutputStream(path + "/importLog.txt"); - logOut.write(sbLog.toString().getBytes("UTF-8")); + logOut.write(sbLog.toString().getBytes(StandardCharsets.UTF_8)); logOut.flush(); logOut.close(); } catch (IOException e) { @@ -2298,7 +2298,7 @@ public class CoeProcessLevelWeb extends ActionWeb { map.put("sid", super.getContext().getSessionId()); map.put("option", getCoeWorspaceHtml()); map.put("wsuuid", wsuuid); - CoeWorkSpaceModel model = (CoeWorkSpaceModel) CoeWorkSpaceDaoFactory.createCoeWorkSpace().getInstance(wsuuid); + CoeWorkSpaceModel model = CoeWorkSpaceDaoFactory.createCoeWorkSpace().getInstance(wsuuid); map.put("wsName", model == null ? "" : I18nRes.findValue(CoEConstant.APP_ID, model.getWsName())); return HtmlPageTemplate.merge(CoEConstant.APP_ID, "pal.pl.manage.html", map); } @@ -2310,7 +2310,7 @@ public class CoeProcessLevelWeb extends ActionWeb { macroLibraries.put("sid", super.getContext().getSessionId()); macroLibraries.put("option", getCoeWorspaceHtml()); macroLibraries.put("wsId", wsId); - CoeWorkSpaceModel model = (CoeWorkSpaceModel) CoeWorkSpaceDaoFactory.createCoeWorkSpace().getInstance(wsId); + CoeWorkSpaceModel model = CoeWorkSpaceDaoFactory.createCoeWorkSpace().getInstance(wsId); macroLibraries.put("wsName", model == null ? "" : model.getWsName()); return HtmlPageTemplate.merge(CoEConstant.APP_ID, "pal.pl.level.portal.tree.htm", macroLibraries); } @@ -2326,7 +2326,7 @@ public class CoeProcessLevelWeb extends ActionWeb { */ public String createOrUpdateCoeProcessLevel(String wsid, String pid, String id, String type, String editable) { // 获得父级模型 - PALRepositoryModel parentPlModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(pid); + PALRepositoryModel parentPlModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(pid); // 获得有哪些建模方法 List methodModels = null; if (parentPlModel == null) { @@ -2354,7 +2354,7 @@ public class CoeProcessLevelWeb extends ActionWeb { } if (!id.equals("") && !id.equals("0")) { macroLibraries.put("showStyle", ""); - PALRepositoryModel plModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(id); + PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(id); if ("default".equals(plModel.getMethodId())) { macroLibraries.put("showStyleCss", "Y"); } @@ -2447,7 +2447,7 @@ public class CoeProcessLevelWeb extends ActionWeb { // } protected com.alibaba.fastjson.JSONArray getMoreSpecialAttr(String sid, String uuid) { - PALRepositoryModel m = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); + PALRepositoryModel m = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); if (m == null) { return new com.alibaba.fastjson.JSONArray(); } @@ -2477,7 +2477,7 @@ public class CoeProcessLevelWeb extends ActionWeb { private Map getMoreAttrContent(String sid, String uuid, Map macroLibraries) { Map map = new HashMap(); - PALRepositoryModel m = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); + PALRepositoryModel m = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); // 获取所有文件属性 List methodAttrModels = PALRepositoryAPIManager.getInstance().getValidAttributeModels(m.getWsId(), m.getMethodId()); Map attributeModelMap = new HashMap<>(); @@ -2639,14 +2639,14 @@ public class CoeProcessLevelWeb extends ActionWeb { } } else if ("relation".equals(type)) {// 关联pal模型文件、形状 JSONObject refObj = JSONObject.parseObject(attributeModel.getRef()); - event = "readonly='readonly' relationFileId=\"" + fileId + "\" relationShapeId=\"" + shapeId + "\" groupPath=\"" + attributeModel.getGroupPath() + "\" ref="+ refObj +" onclick=\"openRelationDialog($(this), \'saveContent\')\""; + event = "readonly='readonly' relationFileId=\"" + fileId + "\" relationShapeId=\"" + shapeId + "\" groupPath=\"" + attributeModel.getGroupPath() + "\" ref="+ refObj + " onclick=\"openRelationDialog($(this), 'saveContent')\""; input = ""; } else if ("awsorg".equals(type)) {// 关联bpm组织架构 JSONObject refObj = JSONObject.parseObject(attributeModel.getRef()); event = "readonly='readonly' data-value="+ dataArr +" groupPath=\"" + attributeModel.getGroupPath() + "\" ref="+ refObj +" onclick=\"openRelationAwsorgDialog($(this))\""; input = ""; } else if("DateTimePicker".equals(type)) { - input = "" + ""; + input = "" + ""; }else if ("table".equals(type)){ JSONObject table = JSON.parseObject(jsonValue); @@ -2966,11 +2966,7 @@ public class CoeProcessLevelWeb extends ActionWeb { } public boolean getIsDorpStatus(String plName) { - if ((plName.equals(CoeProcessLevelConstant.SUPPORTTHEMANAGEMENTPROCESS)) || (plName.equals(CoeProcessLevelConstant.COREBUSINESSPROCESSES)) || (plName.equals(CoeProcessLevelConstant.SUPPORTPROCESS)) || (plName.equals(CoeProcessLevelConstant.COREMANAGEMENTPROCESS)) || (plName.equals(CoeProcessLevelConstant.STRATEGICPROCESS))) { - return false; - } else { - return true; - } + return (!plName.equals(CoeProcessLevelConstant.SUPPORTTHEMANAGEMENTPROCESS)) && (!plName.equals(CoeProcessLevelConstant.COREBUSINESSPROCESSES)) && (!plName.equals(CoeProcessLevelConstant.SUPPORTPROCESS)) && (!plName.equals(CoeProcessLevelConstant.COREMANAGEMENTPROCESS)) && (!plName.equals(CoeProcessLevelConstant.STRATEGICPROCESS)); } /** @@ -3020,7 +3016,7 @@ public class CoeProcessLevelWeb extends ActionWeb { // 获取属性的关联类型(relationType) Map attrModelMap = new HashMap<>(); if(uuid != null && attrId != null && !"".equals(attrId)) { - PALRepositoryModel m = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); + PALRepositoryModel m = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); PALMethodModel palMethodModel = PALMethodCache.getPALMethodModelById(m.getMethodId()); if (palMethodModel != null) { List attributes = palMethodModel.getAttributes(); @@ -3332,7 +3328,7 @@ public class CoeProcessLevelWeb extends ActionWeb { return; } //记录日志 - PALRepositoryModel repository = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); + PALRepositoryModel repository = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); BPMNModel defineModel = null; if (repository.getMethodId().equals("process.bpmn2")) { defineModel = CoeDesignerAPIManager.getInstance().getDefinitionOfBpmn(uuid, 0); @@ -3372,7 +3368,7 @@ public class CoeProcessLevelWeb extends ActionWeb { String filePath = logVerPath;// 文件路径 UtilFile defaultFile = new UtilFile(filePath);// 文件 //写入内容 - defaultFile.write(jsonContent.getBytes("UTF8")); + defaultFile.write(jsonContent.getBytes(StandardCharsets.UTF_8)); } catch(Exception e) { e.printStackTrace(); } @@ -3432,7 +3428,7 @@ public class CoeProcessLevelWeb extends ActionWeb { UtilString sourceStr = new UtilString(source); List vstr = sourceStr.split(","); for (int i = 0, size = vstr.size(); i < size; i++) { - String id = (String) vstr.get(i); + String id = vstr.get(i); if (target.indexOf(id) == -1) { // 查找少了的id号 st.add(id); } @@ -3441,7 +3437,7 @@ public class CoeProcessLevelWeb extends ActionWeb { UtilString sourceStr = new UtilString(source); List vstr = sourceStr.split(","); for (int i = 0, size = vstr.size(); i < size; i++) { - String id = (String) vstr.get(i); + String id = vstr.get(i); // 查找少了的id号 st.add(id); } @@ -3551,11 +3547,11 @@ public class CoeProcessLevelWeb extends ActionWeb { UtilString ut = new UtilString(orderIndexs); List v = ut.split(","); for (int i = 0, size = v.size(); i < size; i++) { - String st = (String) v.get(i); + String st = v.get(i); UtilString u = new UtilString(st); List vv = u.split("|"); - String id = (String) vv.get(0); - int orderIndex = Integer.parseInt((String) vv.get(1)); + String id = vv.get(0); + int orderIndex = Integer.parseInt(vv.get(1)); PALRepositoryModelImpl model = (PALRepositoryModelImpl) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(id); model.setOrderIndex(orderIndex); wsId = model.getWsId(); @@ -3585,14 +3581,14 @@ public class CoeProcessLevelWeb extends ActionWeb { if (!pids.equals("")) { UtilString ut = new UtilString(pids); List v = ut.split(","); - String ids = (String) v.get(0); - String pid = (String) v.get(1); + String ids = v.get(0); + String pid = v.get(1); UtilString u = new UtilString(ids); List vv = u.split("|"); for (int i = 0, size = vv.size(); i < size; i++) { - String id = (String) vv.get(i); + String id = vv.get(i); PALRepositoryModelImpl model = (PALRepositoryModelImpl) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(id); - PALRepositoryModel pidModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(pid); + PALRepositoryModel pidModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(pid); model.setParentId(pid); model.setLevel(pidModel.getLevel() + 1); wsId = model.getWsId(); @@ -4041,7 +4037,7 @@ public class CoeProcessLevelWeb extends ActionWeb { String awsId = coeProcessLevelModel.getAWSProcessId(); if (!awsId.equals("")) { List table = ProcessDefCache.getInstance().getListOfProcessVersion(CoEConstant.APP_ID, awsId); - ProcessDefinition model = (ProcessDefinition) table.get(new Integer(table.size())); + ProcessDefinition model = table.get(new Integer(table.size())); if (model != null) { list.add(model); coeList.add(coeProcessLevelModel); @@ -4056,7 +4052,7 @@ public class CoeProcessLevelWeb extends ActionWeb { // 获得工作空间下流程树的根? private String getAwsProcessRootTreeJson(String wsId) { - CoeWorkSpaceModel model = (CoeWorkSpaceModel) CoeWorkSpaceDaoFactory.createCoeWorkSpace().getInstance(wsId); + CoeWorkSpaceModel model = CoeWorkSpaceDaoFactory.createCoeWorkSpace().getInstance(wsId); JSONArray jsonArray = new JSONArray(); JSONObject rootJson = new JSONObject(); rootJson.put("id", "node_0"); @@ -4079,7 +4075,7 @@ public class CoeProcessLevelWeb extends ActionWeb { rootJson.put("pid", "node_0"); rootJson.put("wsid", wsId); String processLevelName = ""; - PALRepositoryModel processLevelModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(coeProcessLevelModel.getId()); + PALRepositoryModel processLevelModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(coeProcessLevelModel.getId()); if (processLevelModel != null) { processLevelName = "[(" + processLevelModel.getName() + ")]"; } @@ -4100,7 +4096,7 @@ public class CoeProcessLevelWeb extends ActionWeb { UtilString idStr = new UtilString(ids); List v = idStr.split(","); for (int i = 0, size = v.size(); i < size; i++) { - String id = (String) v.get(i); + String id = v.get(i); if (id.equals(workFlowModel.getVersionId())) { json.put("checked", "true"); break; @@ -4158,7 +4154,7 @@ public class CoeProcessLevelWeb extends ActionWeb { */ public String getPortalHtml(String ruuid, String wsid, String type) { Map macroLibraries = new HashMap(); - PALRepositoryModel coeProcessLevelModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(ruuid); + PALRepositoryModel coeProcessLevelModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(ruuid); macroLibraries.put("createButton", ""); macroLibraries.put("importPalButton", ""); @@ -4245,11 +4241,7 @@ public class CoeProcessLevelWeb extends ActionWeb { UtilFile utilFile = new UtilFile(p + "/" + cplm.getId() + ".small.png"); if (utilFile.exists()) { byte[] base64Bytes = Base64.encode(utilFile.readBytes()); - try { - photo = "data:image/png;base64," + new String(base64Bytes, "UTF-8"); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } + photo = "data:image/png;base64," + new String(base64Bytes, StandardCharsets.UTF_8); userImg = "1"; } } @@ -4276,7 +4268,7 @@ public class CoeProcessLevelWeb extends ActionWeb { } String subProcessCount = ""; - StringBuilder subProcessList = new StringBuilder(""); + StringBuilder subProcessList = new StringBuilder(); // String icon = "../apps/" + CoEConstant.APP_ID + "/img/method/" + cplm.getMethodId() + "/16.leaf.png"; String icon = ""; if (!"default".equals(cplm.getMethodId())) { @@ -4517,7 +4509,7 @@ public class CoeProcessLevelWeb extends ActionWeb { // 获取标题路径 private String getProcessLevelTitle(String ruuid, String wsid, String type) { - PALRepositoryModel coeProcessLevelModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(ruuid); + PALRepositoryModel coeProcessLevelModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(ruuid); if (type.equals("0")) { return I18nRes.findValue(CoEConstant.APP_ID, ruuid); } else { @@ -4526,7 +4518,7 @@ public class CoeProcessLevelWeb extends ActionWeb { ruuid = coeProcessLevelModel.getParentId(); PALRepositoryModel model; while (true) { - model = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(ruuid); + model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(ruuid); if (model != null) { list.add(model); ruuid = model.getParentId(); @@ -4590,7 +4582,7 @@ public class CoeProcessLevelWeb extends ActionWeb { */ public String createProcessLevel(String wsid, String id) { Map macroLibraries = new HashMap(); - PALRepositoryModel coeProcessLevelModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(id); + PALRepositoryModel coeProcessLevelModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(id); List list; StringBuffer liString = new StringBuffer(); if (coeProcessLevelModel == null) { @@ -4748,7 +4740,7 @@ public class CoeProcessLevelWeb extends ActionWeb { object.put("icon", icon); if (!folderMap.containsKey(model.getMethodId())) { PALMethodModel methodModel = PALMethodManager.getInstance().getPALMethodModelById(model.getMethodId()); - folderMap.put(model.getMethodId(), methodModel == null ? true : methodModel.isFolder()); + folderMap.put(model.getMethodId(), methodModel == null || methodModel.isFolder()); } object.put("folder", folderMap.get(model.getMethodId())); result.add(object); @@ -4970,7 +4962,7 @@ public class CoeProcessLevelWeb extends ActionWeb { resultObj.put("updateDate", UtilDate.datetimeFormat(model.getModifyDate(), "yyyy年MM月dd日")); if (!folderMap.containsKey(model.getMethodId())) { PALMethodModel methodModel = PALMethodManager.getInstance().getPALMethodModelById(model.getMethodId()); - folderMap.put(model.getMethodId(), methodModel == null ? true : methodModel.isFolder()); + folderMap.put(model.getMethodId(), methodModel == null || methodModel.isFolder()); } resultObj.put("folder", folderMap.get(model.getMethodId())); result.add(resultObj); @@ -5298,7 +5290,7 @@ public class CoeProcessLevelWeb extends ActionWeb { private void updateDefineShape(PALRepositoryModelImpl newModel, Map mapNewUUID, String define) { String messageJson = null; - PALRepositoryModel levelModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(newModel.getId()); + PALRepositoryModel levelModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(newModel.getId()); String filePath = levelModel.getFilePath(); filePath = filePath + File.separator + levelModel.getId(); UtilFile utilFile = new UtilFile(filePath); @@ -5313,11 +5305,7 @@ public class CoeProcessLevelWeb extends ActionWeb { messageJson = messageJson.replace(entry.getKey(), entry.getValue()); } } - try { - utilFile.write(messageJson.getBytes("utf-8")); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } + utilFile.write(messageJson.getBytes(StandardCharsets.UTF_8)); DesignerRelationShapeCacheManager cache = DesignerRelationShapeCacheManager.getInstance(); Map> shapeMap = cache.getEventMap(); ShapeUtil.shapeJsonToObject(messageJson, shapeMap, newModel.getId()); @@ -5376,7 +5364,7 @@ public class CoeProcessLevelWeb extends ActionWeb { public String coePALProcessLevelCreateAjax(String wsid, String pid, String id, String type) { // 获得父级模型 - PALRepositoryModel parentPlModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(pid); + PALRepositoryModel parentPlModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(pid); // 获得有哪些建模方法? List palMethodModels = null; if (parentPlModel == null) { @@ -5420,7 +5408,7 @@ public class CoeProcessLevelWeb extends ActionWeb { } if (!id.equals("") && !id.equals("0")) { macroLibraries.put("showStyle", ""); - PALRepositoryModel plModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(id); + PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(id); plNo = plModel.getNo(); plName = plModel.getName(); plLevel = plModel.getLevel(); @@ -5434,7 +5422,7 @@ public class CoeProcessLevelWeb extends ActionWeb { if ("".equals(departmentId)) { continue; } - DepartmentModel dModel = (DepartmentModel) DepartmentCache.getModel(departmentId); + DepartmentModel dModel = DepartmentCache.getModel(departmentId); if (dModel == null) { continue; } @@ -5544,7 +5532,7 @@ public class CoeProcessLevelWeb extends ActionWeb { * @return */ public String mark(String uuid) { - PALRepositoryModel model = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); + PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); if (model == null) { throw new AWSException("流程未找到
uuid:" + uuid); } @@ -5852,11 +5840,7 @@ public class CoeProcessLevelWeb extends ActionWeb { UtilFile utilFile = new UtilFile(p + "/" + model.getId() + ".small.png"); if (utilFile.exists()) { byte[] base64Bytes = Base64.encode(utilFile.readBytes()); - try { - photo = "data:image/png;base64," + new String(base64Bytes, "UTF-8"); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } + photo = "data:image/png;base64," + new String(base64Bytes, StandardCharsets.UTF_8); } } } @@ -6760,7 +6744,7 @@ public class CoeProcessLevelWeb extends ActionWeb { if(!corr1.contains(processDef.getId()) && !corr2.contains(processDef.getId())) return true; } if ("correlated".equals(type)) { - if(corr1.contains(processDef.getId()) || corr2.contains(processDef.getId())) return true; + return corr1.contains(processDef.getId()) || corr2.contains(processDef.getId()); } } } else { @@ -7103,7 +7087,7 @@ public class CoeProcessLevelWeb extends ActionWeb { int index = str.toUpperCase().indexOf(query); int len = query.length(); if (index > -1) { - str = str.substring(0, index) + "" + str.substring(index, len + index) + "" + str.substring(len + index, str.length()); + str = str.substring(0, index) + "" + str.substring(index, len + index) + "" + str.substring(len + index); } return str; } @@ -7139,10 +7123,10 @@ public class CoeProcessLevelWeb extends ActionWeb { PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel(); PALRepositoryModel parentModel; if ("ws".equals(parentType)) { // 父节点是资产库 - parentModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plParentId); + parentModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plParentId); } else { plParentId = idMap.get(jsObject.getString("pid")); - parentModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plParentId); + parentModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plParentId); } String uid = super.getContext().getUID(); Timestamp nowTime = new Timestamp(System.currentTimeMillis()); @@ -7195,7 +7179,7 @@ public class CoeProcessLevelWeb extends ActionWeb { model.setOrderIndex(orderIndex + 1); model.setHistoryMaxVersion("0"); // 权限和父级同步 - PALRepositoryModel cplm = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plParentId); + PALRepositoryModel cplm = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plParentId); if (cplm != null) { model.setLevel(cplm.getLevel() + 1);// 比父级多一级层级 @@ -7226,10 +7210,10 @@ public class CoeProcessLevelWeb extends ActionWeb { String parentType = jsObject.getString("parentType"); PALRepositoryModel parentModel; if ("ws".equals(parentType)) { // 父节点是资产库 - parentModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plParentId); + parentModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plParentId); } else { plParentId = idMap.get(jsObject.getString("pid")); - parentModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plParentId); + parentModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plParentId); } plParentId = plParentId.length() == 36 ? parentModel.getVersionId() : plParentId; // 该流程是否已有兄弟流程(同一个流程,不同的版本)进行了当前节点的父节点下关联,关联过,取出数据,没有关联过,新建数据 @@ -7273,7 +7257,7 @@ public class CoeProcessLevelWeb extends ActionWeb { PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel(); PALRepositoryModelImpl model = new PALRepositoryModelImpl(); model.setWsId(wsId); - model.setLevel((Integer) (parentModel == null ? 1 : (parentModel.getLevel() + 1))); + model.setLevel(parentModel == null ? 1 : (parentModel.getLevel() + 1)); String plNo = ""; if (plParentId.length() == 36) { if (parentModel != null) { @@ -7316,7 +7300,7 @@ public class CoeProcessLevelWeb extends ActionWeb { // 创建 try { coeProcessLevel.insert(model); - PALRepositoryModel plModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(model.getId()); + PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(model.getId()); // 设置文件路径,无物理文件 String path = PLRFilePath.getInstance().create(AppsAPIManager.getInstance().getAppContext(CoEConstant.APP_ID), model.getId()); path = path.replace(model.getVersionId(), model.getId()); @@ -7658,7 +7642,7 @@ public class CoeProcessLevelWeb extends ActionWeb { */ public String getPortalParam(String ruuid, String wsid) { ResponseObject ro = ResponseObject.newOkResponse(); - PALRepositoryModel coeProcessLevelModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(ruuid); + PALRepositoryModel coeProcessLevelModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(ruuid); if (coeProcessLevelModel == null) { throw new AWSException("没有查找到文件"); } @@ -7713,7 +7697,7 @@ public class CoeProcessLevelWeb extends ActionWeb { } //记录日志 //流程 - PALRepositoryModel coeProcessLevelModel = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); + PALRepositoryModel coeProcessLevelModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); if (coeProcessLevelModel == null) { return ro.toString(); } @@ -7948,7 +7932,7 @@ public class CoeProcessLevelWeb extends ActionWeb { try { coeProcessLevel.insert(model); // 流程发布用户组权限和父级同步 - PALRepositoryModel parentModel = (PALRepositoryModel) coeProcessLevel.getInstance(parentId); + PALRepositoryModel parentModel = coeProcessLevel.getInstance(parentId); if (parentModel != null) { PublishUserGroupPerm dao = new PublishUserGroupPerm(); List list = dao.getAllPermsByResourceId(parentModel.getVersionId()); @@ -8049,7 +8033,7 @@ public class CoeProcessLevelWeb extends ActionWeb { try { coeProcessLevel.insert(model); // 流程发布用户组权限和父级同步 - PALRepositoryModel parentModel = (PALRepositoryModel) coeProcessLevel.getInstance(parentId); + PALRepositoryModel parentModel = coeProcessLevel.getInstance(parentId); if (parentModel != null) { PublishUserGroupPerm dao = new PublishUserGroupPerm(); List list = dao.getAllPermsByResourceId(parentModel.getVersionId()); @@ -8378,7 +8362,7 @@ public class CoeProcessLevelWeb extends ActionWeb { /************************************文件属性校验************************************/ ResponseObject ro = ResponseObject.newOkResponse(); - PALRepositoryModel m = (PALRepositoryModel) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); + PALRepositoryModel m = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid); // 获取所有文件属性 List methodAttrModels = PALRepositoryAPIManager.getInstance().getValidAttributeModels(m.getWsId(), m.getMethodId()); Map attributeModelMap = new HashMap<>(); @@ -8856,7 +8840,7 @@ public class CoeProcessLevelWeb extends ActionWeb { ResponseObject ro = ResponseObject.newOkResponse(); // 获取当前文件信息 PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel(); - PALRepositoryModel model = (PALRepositoryModel)coeProcessLevel .getInstance(id); + PALRepositoryModel model = coeProcessLevel .getInstance(id); if (id.length() >= 36 && model == null) { return ResponseObject.newErrResponse("模型文件查询失败").toString(); @@ -9237,11 +9221,7 @@ public class CoeProcessLevelWeb extends ActionWeb { UtilFile utilFile = new UtilFile(p + "/" + model.getId() + ".small.png"); if (utilFile.exists()) { byte[] base64Bytes = Base64.encode(utilFile.readBytes()); - try { - photo = "data:image/png;base64," + new String(base64Bytes, "UTF-8"); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } + photo = "data:image/png;base64," + new String(base64Bytes, StandardCharsets.UTF_8); } } if (UtilString.isEmpty(photo)) {// 默认 @@ -9465,7 +9445,7 @@ public class CoeProcessLevelWeb extends ActionWeb { JSONArray defaultAttrConfig = CoeProcessLevelUtil.getAllDefaultAttrData(); for (int i = 0; i < defaultAttrConfig.size(); i++) { JSONObject attr = defaultAttrConfig.getJSONObject(i); - attr.put("readonly", fileReadonly ? true : attr.getBooleanValue("readonly") ? true : false); + attr.put("readonly", fileReadonly || attr.getBooleanValue("readonly")); if (PALRepositoryModelImpl.FIELD_PL_NAME.equals(attr.getString("id"))) {// 名称 attr.put("value", model.getName()); } @@ -9515,7 +9495,7 @@ public class CoeProcessLevelWeb extends ActionWeb { obj.put("label", title); obj.put("ref", ref); obj.put("type", type); - obj.put("readonly", fileReadonly ? true : xmlReadonly ? true : false); + obj.put("readonly", fileReadonly || xmlReadonly); obj.put("desc",attributeModel.getDesc()==null?"":attributeModel.getDesc()); obj.put("isRequired",attributeModel.getIsRequired()); if ("string".equals(type)) { @@ -9569,7 +9549,7 @@ public class CoeProcessLevelWeb extends ActionWeb { } else if ("relation".equals(type)) { JSONObject refObj = JSONObject.parseObject(attributeModel.getRef()); obj.put("ref", refObj); - obj.put("readonly", fileReadonly ? true : false); + obj.put("readonly", fileReadonly); List list = DesignerShapeRelationCache.getListByAttrId(id, "", property.getPropertyId()); if (list != null && list.size() > 0) { // 判断是否有重复数据,进行重复过滤 @@ -9614,7 +9594,7 @@ public class CoeProcessLevelWeb extends ActionWeb { } else if ("awsorg".equals(type)) { JSONObject refObj = JSONObject.parseObject(attributeModel.getRef()); obj.put("ref", refObj); - obj.put("readonly", fileReadonly ? true : false); + obj.put("readonly", fileReadonly); List list = DesignerShapeRelationCache.getListByAttrId(id, "", property.getPropertyId()); if (list != null && list.size() > 0) { List departmentModelList = new ArrayList<>(); diff --git a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.htm b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.htm index 00cb8179..084b0308 100755 --- a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.htm +++ b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.htm @@ -912,12 +912,12 @@
  • 全选
    Ctrl+A
  • -
  • 调整垂直间距 -
    -
  • -
  • 调整水平间距 -
    -
  • + + + + + +
  • 创建连线 @@ -928,7 +928,8 @@
  • -
    + +
    @@ -1155,7 +1156,7 @@ -
    +
    文件属性
    diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/action.xml b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/action.xml index 1c358d94..1d70de12 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/action.xml +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/action.xml @@ -1730,4 +1730,8 @@ + + + + \ No newline at end of file diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.team.pal.designer.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.team.pal.designer.js old mode 100755 new mode 100644 index 5db1f993..1ecb8ddc --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.team.pal.designer.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.team.pal.designer.js @@ -22,8 +22,8 @@ $(function() { }, error: function (jqXHR, textStatus, errorThrown) { $.simpleAlert(errorThrown, 'err'); - console.log(jqXHR) - console.log(textStatus) + console.log(jqXHR); + console.log(textStatus); console.log(errorThrown) } }); @@ -90,75 +90,89 @@ $(function() { tempMessageArr[messageId] = messageArrayForSave[messageId]; } var messageArray = JSON.stringify(tempMessageArr); - var elements = obj.elements - for(let i in elements) { - for(let a = 0; a < elements[i].dataAttributes.length; a ++ ) { - if(elements[i].dataAttributes[a].attributesJsonArray !== undefined) { - for(let b = 0; b < elements[i].dataAttributes[a].attributesJsonArray.length; b ++) { - if(elements[i].dataAttributes[a].attributesJsonArray[b].isRequired && elements[i].dataAttributes[a].attributesJsonArray[b].value == '') { - $.simpleAlert("close"); - $.simpleAlert("必填项不能为空", 'error'); - return; - } - } - } - } - - } - $.ajax({ - type: "POST", - url: "./jd", - data: { + $.ajax({ + type: "POST", + url: "./jd", + data: { sid: CLB.sid, - cmd: "com.actionsoft.apps.coe.pal_repository_process_define_save", + cmd: "com.actionsoft.apps.coe.pal_repository_define_shape_attr_valid", uuid: ruuid, define: awsui.encode(obj), - teamId: $("#teamId").val(), - BPMInstanceName: BPMInstanceName, - messages: messageArray }, success: function (msg, textStatus, jqXHR) { + debugger; if(msg.result == "ok") { - $.simpleAlert("close"); - messageArrayForSave = {}; - $("#saving_tip").css("color", "rgb(26, 164, 125)"); - $("#saving_tip").text("保存成功"); - recordShapeText();// 记录最新的节点及其文本text - //更多属性的处理,当节点处理完成后再处理更多属性 - if (saveAttributesJson.length > 0 || removeAttributeJson.length > 0){ - $.ajax({ - type : "POST", - url : "./jd", - data : { - sid : encodeURI(CLB.sid), - cmd : "com.actionsoft.apps.coe.pal_pl_repository_more_attribute_save", - wsId : $("#wsId").val(), - uuid : ruuid, - attributesJson : JSON.stringify(saveAttributesJson), - removeAttributeJson : JSON.stringify(removeAttributeJson) - }, - success:function(r) { - saveAttributesJson = []; - removeAttributeJson = []; - }, - error:function(r) { + $.ajax({ + type: "POST", + url: "./jd", + data: { + sid: CLB.sid, + cmd: "com.actionsoft.apps.coe.pal_repository_process_define_save", + uuid: ruuid, + define: awsui.encode(obj), + teamId: $("#teamId").val(), + BPMInstanceName: BPMInstanceName, + messages: messageArray + }, + success: function (msg, textStatus, jqXHR) { + if(msg.result == "ok") { + $.simpleAlert("close"); + messageArrayForSave = {}; + $("#saving_tip").css("color", "rgb(26, 164, 125)"); + $("#saving_tip").text("保存成功"); + recordShapeText();// 记录最新的节点及其文本text + //更多属性的处理,当节点处理完成后再处理更多属性 + if (saveAttributesJson.length > 0 || removeAttributeJson.length > 0){ + $.ajax({ + type : "POST", + url : "./jd", + data : { + sid : encodeURI(CLB.sid), + cmd : "com.actionsoft.apps.coe.pal_pl_repository_more_attribute_save", + wsId : $("#wsId").val(), + uuid : ruuid, + attributesJson : JSON.stringify(saveAttributesJson), + removeAttributeJson : JSON.stringify(removeAttributeJson) + }, + success:function(r) { + saveAttributesJson = []; + removeAttributeJson = []; + }, + error:function(r) { + } + }); + } + $.simpleAlert("保存成功", "ok"); + //保存结束时间戳 + //var saveEndTime = new Date().getTime(); + //console.log("流程保存时间:", (saveEndTime - saveStartTime) + "毫秒"); + } else { + $.simpleAlert("close"); + $.simpleAlert(msg.data.desc, 'error', 2000); } - }); - } - $.simpleAlert("保存成功", "ok"); - //保存结束时间戳 - //var saveEndTime = new Date().getTime(); - //console.log("流程保存时间:", (saveEndTime - saveStartTime) + "毫秒"); + }, + error: function (jqXHR, textStatus, errorThrown) { + $.simpleAlert("close"); + $.simpleAlert('保存失败', 'error', 1500); + } + }); } else { $.simpleAlert("close"); - $.simpleAlert(msg.data.desc, 'error', 2000); + var result = msg.data; + var resultMsg = []; + for (var i = 0; i < result.length; i++) { + var o = result[i]; + resultMsg.push('[' + o.shapeName + ']的[' + o.attrName + ']不能为空' ); + } + $.simpleAlert(resultMsg.join('
    '), 'error'); + // $.simpleAlert(ro.msg, 'error'); } }, error: function (jqXHR, textStatus, errorThrown) { $.simpleAlert("close"); - $.simpleAlert('保存失败', 'error', 1500); + $.simpleAlert('校验失败', 'error', 1500); } - }); + }) } } } @@ -181,7 +195,7 @@ $(function() { } }); } - } + }; //在弹出“是否离开”的提示框后,选择离开,则触发onunload事件 window.onunload = function(){ @@ -197,7 +211,7 @@ $(function() { uuid: ruuid } }); - } + }; // saveTimer(); intervalRefresh(); } @@ -238,7 +252,7 @@ $(function() { $('#bar_sort').off("click").on("click",function (){ if ($("#saving_tip").text() != "已保存成功" && $("#saving_tip").text() != "保存成功" && $("#saving_tip").text() != "您的文件已经成功保存") { $.simpleAlert('页面未保存,请先保存', 'error', 1500); - return; + } else { // $.simpleAlert("正在编号", "loading"); // $.ajax({ @@ -268,11 +282,11 @@ $(function() { { shapeId: 'obj_c9e1cdab200000014a2eade016e8170d',order: 5}, { shapeId: 'obj_c9e1cdb266f0000159a7c8afa7701a68',order: 6}, ] - } - let obj = Model.define - console.log(obj) - let elements = obj.elements - let orderList = numObj.orderList + }; + let obj = Model.define; + console.log(obj); + let elements = obj.elements; + let orderList = numObj.orderList; for (let j = 0; j < orderList.length; j++) { for(let i in elements) { if (orderList[j].shapeId == i) { @@ -303,7 +317,7 @@ $(function() { $("#saving_tip").text("文件已修改,未保存"); } }) -}) +}); /**定时保存**/ @@ -321,7 +335,7 @@ function saveTimer() { alertmsg(count, msg); } }}) - } + }; alertmsg(count, msg); // $.simpleAlert("5秒之后自动进行保存", "info", 5000, {callback:function(){$("#bar_save").click();}}); }, 300000); @@ -343,7 +357,7 @@ function intervalRefresh() { alert : false, ok: function(msg){ if (msg.data.isLocked) { - var m = '当前流程被 ' + msg.data.currentUserName + ' 强行获取编辑权或锁定' + var m = '当前流程被 ' + msg.data.currentUserName + ' 强行获取编辑权或锁定'; $.simpleAlert(m,"info",4000,{mode:true,callback:function() { if ($("#saving_tip").text() != "已保存成功" && $("#saving_tip").text() != "保存成功" && $("#saving_tip").text() != "您的文件已经成功保存" && $("#saving_tip").text() != "") { $("#saving_tip").text('');// 防止reload时出现浏览器自带提示 @@ -389,7 +403,7 @@ var CommonLock = { window.location.reload(); } } -} +}; // 记录所有节点及节点名称,保存时对比 var shapeTextRecord = {}; diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.core.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.core.js index fa25881e..724701b8 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.core.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.core.js @@ -6,6 +6,8 @@ Designer.contextMenu.show = function(x, y) { var currentFocus = Utils.getShapeByPosition(x, y, false); menu.children().hide(); menu.children("li[ac=selectall]").show(); + menu.children("li[ac=selectVertical]").show(); + menu.children("li[ac=selectHorizontal]").show(); menu.children(".devi_selectall").show(); menu.children("li[ac=drawline]").show(); menu.children("li[ac=processAttribute]").show(); @@ -163,6 +165,10 @@ Designer.contextMenu.execAction = function(item) { showPropertiesDialog(true); } else if (action == "customdefine") { openCustomDefineDialog(); + } else if(action == 'selectVertical') { + Designer.selectVertical(this.menuPos); + } else if (action == 'selectHorizontal') { + Designer.selectHorizontal(this.menuPos); } }; diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.js index 69374804..e774df8a 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.js @@ -1117,7 +1117,6 @@ function getLinkFileValue(treeNode) { // 数属性tab页面效果js function selectAttrTabTag(showContent, selfObj) { - debugger; // 操作标签 var tag = $("#tabUlContainer li"); var taglength = tag.length; @@ -1303,7 +1302,7 @@ function noPermissionMsg(){ // 属性的动态切换 function attributeShowTabContent(currentShape) { - debugger; + // 属性弹出层显示的内容 var shape = Utils.getSelected()[0]; if (!shape) { @@ -1443,7 +1442,6 @@ function getPrivateAttributeHtml(attributesJsonArray, tbodyId, shape) { + '
    ' + obj.value + '
    ' + ' '; if ((!objReadonly && objType == "string") || (!objReadonly && objType == "list") || (!objReadonly && objType == "link")) { - debugger; // 目前支持到文本的输入 ,需求定下了再改 constr = '' + ' ' + objName + requiredSpan + '' @@ -1941,7 +1939,6 @@ function showEditButton(obj) { var inputUpdate = false; function saveInputContent(obj,value) { - debugger; // 按钮 // $(obj).siblings("span::contains('...')").hide(); inputUpdate = true; @@ -2777,10 +2774,16 @@ function setDivHeight() {/* } function changeArributeByShape() { - debugger; if (Utils.getSelected()[0] == null) { $("#dock_content_attribute").hide(); $("#attr_no_more_attribute_id").show(); + var iframeDocument=$("#file_attribute")[0].contentWindow.document; + var body = $(iframeDocument).find('body') + var pickerNum = $(body).find('input[name="dateTimePicker"]').length + if (pickerNum > 0) { + var height = $(body).find('#frmMain').height() + 300 + $("#file_attribute").height(height) + } } else { // 属性弹出层显示的内容 var shape = Utils.getSelected()[0]; @@ -3426,7 +3429,7 @@ function getRelevanceAwsOrgNameByShapeId(objIds, shapeId) { // 形状关联弹窗 function openRelationDig(obj,value) { - debugger; + var shapeRelationValue = $("input[objid_shapeId='" + $(obj).attr("objid") + "']").val(); var ref = $("input[objid_shapeId='" + $(obj).attr("objid") + "']").attr("ref"); // shape file shapeAndFile var relationShapeIds = ''; diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.methods.debug.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.methods.debug.js index b8a6e7fe..26eecc08 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.methods.debug.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.methods.debug.js @@ -1,7 +1,7 @@ /** * 设计器对外提供的方法 */ - + /** @@ -17,55 +17,216 @@ Designer.addFunction("open", function(definition){ $(".shape_box").remove(); Model.define.elements = {}; Model.persistence.elements = {}; - Model.define.page = definition.page; - + Model.define.page = definition.page; + //*******此处添加AWS流程设计器特有的属性*******// - Model.define.processProperties=definition.processProperties;//此处添加aws全局属性 - Model.define.processDocument=definition.processDocument;//此处添加aws全局属性 - Model.define.uuid=definition.uuid;//此处添加流程uuid - //Model.define.title=definition.title;//此处添加流程title - //向页面processDefId processDefTitle 赋值 - //process.processDefId=definition.uuid; - process.title=definition.title; + Model.define.processProperties=definition.processProperties;//此处添加aws全局属性 + Model.define.processDocument=definition.processDocument;//此处添加aws全局属性 + Model.define.uuid=definition.uuid;//此处添加流程uuid + //Model.define.title=definition.title;//此处添加流程title + //向页面processDefId processDefTitle 赋值 + //process.processDefId=definition.uuid; + process.title=definition.title; //*******添加结束*******// - - Model.persistence.page = Utils.copy(definition.page); - Designer.initialize.initCanvas(); - var shapes = definition.elements; - //先构造形状,再构造连接线,因为连接线的绘制过程有可能依赖所连接的图形 - var shapeCount = 0; - for(var shapeId in shapes){ - var shape = shapes[shapeId]; - if(shape.name != "linker"){ - Schema.initShapeFunctions(shape); - Designer.painter.renderShape(shape); - Model.add(shape, false); - } - shapeCount++; - } - for(var shapeId in shapes){ - var shape = shapes[shapeId]; - if(shape.name == "linker"){ - Designer.painter.renderLinker(shape); - Model.add(shape, false); - } - } - if(shapeCount == 0){ - Model.build(); - } - Navigator.draw(); + + Model.persistence.page = Utils.copy(definition.page); + Designer.initialize.initCanvas(); + var shapes = definition.elements; + //先构造形状,再构造连接线,因为连接线的绘制过程有可能依赖所连接的图形 + var shapeCount = 0; + for(var shapeId in shapes){ + var shape = shapes[shapeId]; + if(shape.name != "linker"){ + Schema.initShapeFunctions(shape); + Designer.painter.renderShape(shape); + Model.add(shape, false); + } + shapeCount++; + } + for(var shapeId in shapes){ + var shape = shapes[shapeId]; + if(shape.name == "linker"){ + Designer.painter.renderLinker(shape); + Model.add(shape, false); + } + } + if(shapeCount == 0){ + Model.build(); + } + Navigator.draw(); }); /** * 设计器方法:全选 */ Designer.addFunction("selectAll", function(){ - var shapes = Model.define.elements; - var shapeIds = []; - for(var shapeId in shapes){ - shapeIds.push(shapeId); - } - Utils.selectShape(shapeIds); + var shapes = Model.define.elements; + var shapeIds = []; + for(var shapeId in shapes){ + shapeIds.push(shapeId); + } + Utils.selectShape(shapeIds); +}); + +/** + * 设计器方法:调节垂直间距 + */ +Designer.addFunction("selectVertical", function(menuPos){ + var selectedIds = []; + var lineArr = [] + var shapeArr = [] + var menuY = menuPos.y + var shapes = Model.define.elements; + console.log(shapes) + + var subline1 = $('#designer_subline1') + var subline2 = $('#designer_subline2') + subline1.css({ + display : "block", + "z-index" : Model.orderList.length + 4, + width: Model.define.page.width, + height: 0, + borderStyle:'dotted', + borderWidth: '1px', + left: 0, + top : menuY + }); + subline2.css({ + display : "block", + "z-index" : Model.orderList.length + 5, + width: Model.define.page.width, + height: 0, + borderStyle:'dotted', + borderWidth: '1px', + left: 0, + top : menuY, + cursor: 'move' + }); + + var container = $("#canvas_container"); + var canvas = $("#designer_canvas"); + subline2.bind('mousedown.drag',function (b) { + container.bind('mousemove.drag',function (e) { + var newPos = Utils.getRelativePos(e.pageX, e.pageY, canvas); + if (newPos.y >= menuY) { + subline1.css({ + backgroundColor: 'rgba(114,253,107,0.5)', + height: newPos.y - menuY + }) + subline2.css({ + backgroundColor: 'translate', + height: 0 + }) + } else { + subline1.css({ + backgroundColor: 'translate', + height: 0 + }) + subline2.css({ + backgroundColor: 'rgba(246,163,163,0.5)', + height: menuY - newPos.y + }) + } + subline2.css({ + top : newPos.y, + }); + $(document).unbind("mouseup.drop").bind("mouseup.drop", + function() { + subline1.css({ + backgroundColor: 'translate', + height: 0 + }) + subline2.css({ + backgroundColor: 'translate', + height: 0 + }) + subline1.hide() + subline2.hide() + $(document).unbind("mouseup.drop") + }) + }) + $(document).bind('mouseup.drag',function () { + container.unbind("mousemove.drag"); + // subline2.unbind("mousedown.drag"); + $(document).unbind("mouseup.drag"); + }) + }) + + + for(var shapeId in shapes){ + if (shapes[shapeId].points == undefined) { + shapeArr.push(shapes[shapeId]) + } else { + lineArr.push(shapes[shapeId]) + } + } + + for (var i = 0; i < shapeArr.length; i++) { + if (shapeArr[i].props.y + shapeArr[i].props.h >= menuY) { + selectedIds.push(shapeArr[i].id) + } + } + for (var i = 0; i < lineArr.length; i++) { + if (lineArr[i].from.y >= menuY || lineArr[i].to.y >= menuY) { + selectedIds.push(lineArr[i].id) + } + } + // Utils.selectShape(selectedIds); + + + // for (var i = 0; i < selectedIds.length; i++) { + // N(selectedIds[i]) + // $(".shape_contour[forshape=" + selectedIds[i].id + "]").css({ + // left: selectedIds[i].props.x.toScale(), + // top: selectedIds[i].props.y.toScale() + // }) + // } + // var K = Utils.getSelectedLinkerIds(); + // if (selectedIds.length == 1 && K.length == 1) { + // return + // } + // if (K.length > 0) { + // var I = Utils.getSelectedIds(); + // Designer.painter.drawControls(I) + // } else { + // var E = $("#shape_controls"); + // E.css({ + // left: parseFloat(E.css("left")), + // top: parseFloat(E.css("top")) + 100 + // }) + // } + // var F = $("#shape_controls").position(); + // if (F && Utils.getSelected().length > 0) { + // Designer.op.showTip("X: " + Math.round(F.left.restoreScale()) + "  Y: " + Math.round(F.top.restoreScale())); + // } + // function N(a) { + // a.props.x += 0; + // a.props.y += 100; + // var b = $("#" + a.id); + // b.css({ + // left: parseFloat(b.css("left")), + // top: parseFloat(b.css("top")) + 100 + // }) + // } +}); + +/** + * 设计器方法:调节水平间距 + */ +Designer.addFunction("selectHorizontal", function(menuPos){ + var menuX = menuPos.x + let subline = $('#designer_subline') + console.log(subline) + subline.css({ + display : "block", + "z-index" : Model.orderList.length + 4, + width: 0, + height: Model.define.page.height, + borderStyle:'dotted', + borderWidth: '1px', + left: menuX, + top :0, + }); }); /**