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 88e0bab1..1f382827 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/pal/repository/job/SynchronousPortJob.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousPortJob.java index f7ffe016..7f206561 100644 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousPortJob.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousPortJob.java @@ -87,7 +87,8 @@ public class SynchronousPortJob implements IJob { Connection open = DBSql.open(); try { - orgdepartmentList = DBSql.getMaps(open, "select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID,ORDERINDEX from ORGDEPARTMENT where Closed=0 "); + orgdepartmentList = DBSql.getMaps(open, "select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID,ORDERINDEX from ORGDEPARTMENT where Closed=0 "); + RowMap parentModel=DBSql.getMap("SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME='内蒙古伊利实业集团股份有限公司' and PLMETHODID='org.normal'"); String parentModelIds=null; @@ -188,7 +189,7 @@ public class SynchronousPortJob implements IJob { String updateSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLNAME=? WHERE ID=? AND PLMETHODID='org.normal'"; DBSql.update(conn, String.format(updateSql, org.getString("DEPARTMENTNAME"), orgrowMap.getString("ID"))); } - createPostData(model.getId(), org.getString("ID"), model, conn); + createPostData(model.getId(), org.getString("ID"), model, conn); } @@ -258,17 +259,10 @@ public class SynchronousPortJob implements IJob { Map idRelationMap = new HashMap<>(); - 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"); - List orgdepartmentList = DBSql.getMaps(conn, "select DESCR from BO_EU_ORG_POSTS WHERE DEPTID=? AND DESCR IS NOT NULL ", departmentId); + + List orgdepartmentList = DBSql.getMaps(conn, "select DESCR,DEPTNAME from BO_EU_ORG_POSTS WHERE DEPTID=? AND DESCR IS NOT NULL ", departmentId); JSONArray shapes = new JSONArray(); @@ -278,7 +272,7 @@ public class SynchronousPortJob implements IJob { boolean flag=true; String positionName = orgdepartmentList.get(i).getString("DESCR"); - + String deptname = orgdepartmentList.get(i).getString("DEPTNAME"); //新建一个uuid String shapeId = UUIDGener.getObjectId(); //拿到基础结构 @@ -289,51 +283,79 @@ public class SynchronousPortJob implements IJob { PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(uuid); - List> fileElements = CoeDesignerUtil.getShapeMessageJson4(uuid); + System.out.println("name=============="+parentModel.getName()); + try { + List> fileElements = CoeDesignerUtil.getShapeMessageJson4(uuid); - for (Map shape2 : fileElements) { - List result = new ArrayList(); + if (fileElements.size() > 0) { + for (Map shape2 : fileElements) { + + List result = new ArrayList(); - if(positionName.equals(shape2.get("name"))){ - flag=false; - } - } + if (positionName.equals(shape2.get("name"))) { + flag = false; + } + } - if(flag==true){ + if (flag == true) { + System.out.println("uuid==============="+uuid); + System.out.println("部门名称为=================" + deptname); + System.out.println("新建岗位为==================" + positionName); + JSONObject newShape = JSONObject.parseObject(shape.toString()); + newShape.put("id", shapeId); + newShape.put("text", positionName); + shapes.add(newShape); + } + }else{ JSONObject newShape = JSONObject.parseObject(shape.toString()); newShape.put("id", shapeId); newShape.put("text", positionName); shapes.add(newShape); - - - CoeRepositoryImportUtil util = new CoeRepositoryImportUtil(); - - - - int maxZIndex = getMaxPropsZIndex(elements);// 层级 - int initY = getMaxPositionY(elements);// 默认的纵向坐标 - JSONArray newShapes = getMethodElementsJSONArray(shapes, 6, maxZIndex, initY); - JSONObject elementsJson = JSONObject.parseObject(definition.getString("elements")); - for (int k = 0; k < newShapes.size(); k++) { - JSONObject shapeObj = newShapes.getJSONObject(k); - elementsJson.put(shapeObj.getString("id"), shapeObj); - } - definition.put("elements", elementsJson); - // 设置画布大小 - DiagramsUtil.setDiagramHeightWidth(definition, elements); - defineModel.setDefinition(definition.toString()); - // 保存文件 - CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作*/ } + } catch (Exception e) { + e.printStackTrace(); + } + } + try { + if(shapes.size()>0){ + CoeRepositoryImportUtil util = new CoeRepositoryImportUtil(); + BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(uuid, 0); + if (defineModel == null) { + defineModel = CoeDesignerUtil.createModel(uuid, 0); + defineModel.setCreateHistory(false); + } + String define = defineModel.getDefinition(); + JSONObject definition = JSONObject.parseObject(define); + JSONObject elements = definition.getJSONObject("elements"); + + int maxZIndex = getMaxPropsZIndex(elements);// 层级 + int initY = getMaxPositionY(elements);// 默认的纵向坐标 + JSONArray newShapes = getMethodElementsJSONArray(shapes, 6, maxZIndex, initY); + JSONObject elementsJson = JSONObject.parseObject(definition.getString("elements")); + for (int k = 0; k < newShapes.size(); k++) { + JSONObject shapeObj = newShapes.getJSONObject(k); + elementsJson.put(shapeObj.getString("id"), shapeObj); + } + definition.put("elements", elementsJson); + // 设置画布大小 + DiagramsUtil.setDiagramHeightWidth(definition, elements); + defineModel.setDefinition(definition.toString()); + // 保存文件 + CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作*/ + } + + } catch (Exception e) { + e.printStackTrace(); + } }