diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java index 06831f5d..02787d27 100644 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java @@ -1,10 +1,14 @@ package com.actionsoft.apps.coe.pal.pal.repository.job; +import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel; +import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory; import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository; +import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager; import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager; import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel; import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil; +import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl; import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil; @@ -15,6 +19,8 @@ import com.actionsoft.bpms.schedule.IJob; import com.actionsoft.bpms.util.DBSql; import com.actionsoft.bpms.util.UUIDGener; +import com.actionsoft.sdk.local.SDK; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import jodd.util.StringUtil; @@ -39,22 +45,35 @@ public class SynchronousOrgJob implements IJob { static int orgindex = 0; static String parentModelId = ""; + static String wsId; + @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + + String wsIdParams = SDK.getJobAPI().getJobParameter(jobExecutionContext); + wsId=wsIdParams; + + //先执行新建操作产生plid PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel(); + String parentId="process"; + int orderIndex = getChildrenMaxOrderIndexByPidAndWsId(parentId, wsId) + 1; String plRid1 = UUIDGener.getUUID(); String id1 = UUIDGener.getUUID(); - Connection open = DBSql.open(); - orgdepartmentList = DBSql.getMaps(open,"select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID,ORDERINDEX from ORGDEPARTMENT "); - Timestamp nowTime = new Timestamp(System.currentTimeMillis()); - PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", "内蒙古伊利实业集团股份有限公司", - "", 1, "org", "org", true, 1, + String modeldefaultId=Createfolder(orderIndex); + + + Connection open = DBSql.open(); + orgdepartmentList = DBSql.getMaps(open,"select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID,ORDERINDEX from ORGDEPARTMENT"); + + + PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, wsId, "内蒙古伊利实业集团股份有限公司", + "", 1, modeldefaultId, "org", true, 1, id1, false, "org.normal", "0", 1, null, null, "admin", "admin", nowTime, "0", null, null, null, null, null, null, null, null, 1); @@ -68,6 +87,28 @@ public class SynchronousOrgJob implements IJob { } + /** + * 创建岗位模型文件夹 + * @param orderIndex + * @return + */ + public String Createfolder(int orderIndex){ + PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel(); + String plRid1 = UUIDGener.getUUID(); + String id1 = UUIDGener.getUUID(); + + Timestamp nowTime = new Timestamp(System.currentTimeMillis()); + + //新建文件夹 + PALRepositoryModelImpl modeldefault = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, wsId, "岗位模型", + "", orderIndex, "org", "org", true, 1, + id1, 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(); + } + public void createTree() { for (RowMap oneData : orgdepartmentList) { @@ -90,10 +131,10 @@ public class SynchronousOrgJob implements IJob { if (org.getString("PARENTDEPARTMENTID").equals("0")) { - String sql1 = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE WSID='6f4e292c-1b90-4dd2-8c20-7da159cb20a5' and EXT1='" + org.getString("ID") + "'"; + String sql1 = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE wsId='"+wsId+"' and EXT1='" + org.getString("ID") + "'"; String parentPalOrgId1 = DBSql.getString(sql1); if(StringUtil.isEmpty(parentPalOrgId1)){ - PALRepositoryModelImpl model1 = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", org.getString("DEPARTMENTNAME"), + PALRepositoryModelImpl model1 = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, wsId, org.getString("DEPARTMENTNAME"), "", 1, parentModelId, "org", true, 1, id1, false, "org.normal", "0", Integer.valueOf(org.getString("ORDERINDEX")), null, null, "admin", "admin", nowTime, org.getString("ID"), null, @@ -109,7 +150,7 @@ public class SynchronousOrgJob implements IJob { if(StringUtil.isNotEmpty(parentPalOrgId)){ - PALRepositoryModelImpl model2 = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", org.getString("DEPARTMENTNAME"), + PALRepositoryModelImpl model2 = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, wsId, org.getString("DEPARTMENTNAME"), "", 1, getParentPalOrgId(org), "org", true, 1, id1, false, "org.normal", "0", Integer.valueOf(org.getString("ORDERINDEX")), null, null, "admin", "admin", nowTime, org.getString("ID"), null, @@ -131,7 +172,7 @@ public class SynchronousOrgJob implements IJob { public String getParentPalOrgId(RowMap org) { - String sql = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE WSID='6f4e292c-1b90-4dd2-8c20-7da159cb20a5' and EXT1='" + org.getString("PARENTDEPARTMENTID") + "'"; + String sql = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE wsId='"+wsId+"' and EXT1='" + org.getString("PARENTDEPARTMENTID") + "'"; String parentPalOrgId = DBSql.getString(sql); if (parentPalOrgId.equals("0") || parentPalOrgId.equals("") || parentPalOrgId == null) { @@ -144,7 +185,7 @@ public class SynchronousOrgJob implements IJob { public String getParentPallevel(RowMap org) { - String sql = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE WSID='6f4e292c-1b90-4dd2-8c20-7da159cb20a5' and EXT1='" + org.getString("PARENTDEPARTMENTID") + "'"; + String sql = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE wsId='"+wsId+"' and EXT1='" + org.getString("PARENTDEPARTMENTID") + "'"; String parentPalOrgId = DBSql.getString(sql); if (parentPalOrgId.equals("0") || parentPalOrgId.equals("") || parentPalOrgId == null) { @@ -188,8 +229,7 @@ public class SynchronousOrgJob implements IJob { List orgdepartmentList=DBSql.getMaps("select POSITION_NO,POSITION_NAME from ORGUSER WHERE DEPARTMENTID=?",departmentId); - int zindex = 1; - + JSONArray shapes = new JSONArray(); if(orgdepartmentList.size()>0){ for(int i=0;i