岗位代码提交
This commit is contained in:
parent
4063176d04
commit
6359a04870
Binary file not shown.
@ -911,13 +911,17 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
JSONObject jsonObject = objects.getJSONObject(i);
|
||||
String isParent = jsonObject.getString("isParent");
|
||||
if (isParent != null) {
|
||||
//过滤架构图
|
||||
if(jsonObject.get("name").equals("流程架构图")){
|
||||
continue;
|
||||
}
|
||||
if (isParent.equals("false")) {
|
||||
//过滤废止数据
|
||||
RowMap rowMap = DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME=? AND ISSTOP=? AND ISUSE=?", jsonObject.getString("name"), 1, 1);
|
||||
RowMap rowMap = DBSql.getMap("SELECT PLMETHODID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME=? AND ISSTOP=? AND ISUSE=? ", jsonObject.getString("name"), 1, 1);
|
||||
if (rowMap != null) {
|
||||
continue;
|
||||
}
|
||||
RowMap publishRowMap = DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME=? AND ISPUBLISH=? AND ISUSE=?", jsonObject.getString("name"), 1, 1);
|
||||
RowMap publishRowMap = DBSql.getMap("SELECT PLMETHODID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME=? AND ISPUBLISH=? AND ISUSE=? ", jsonObject.getString("name"), 1, 1);
|
||||
if (publishRowMap != null) {
|
||||
jsonObject.put("nocheck", false);
|
||||
jsonArr_new.add(jsonObject);
|
||||
@ -1344,6 +1348,10 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
if(stoprowMap.getString("ISSTOP").equals("0")){
|
||||
//如果为相关文件 未发布不可选中
|
||||
if(attrId.equals("R_relevant_flies") || attrId.equals("related_files")){
|
||||
|
||||
if(model.getName().equals("流程架构图")){
|
||||
continue;
|
||||
}
|
||||
/*RowMap rowMap=DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME=? AND ISPUBLISH=? AND ISUSE=?", name,1,1);
|
||||
if(isParent.equals("true")){
|
||||
node.put("nocheck", true);
|
||||
@ -1353,6 +1361,7 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
}*/
|
||||
|
||||
RowMap rowMap=DBSql.getMap("SELECT ISPUBLISH FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME=? AND ISUSE=?", name,1);
|
||||
|
||||
if(isParent.equals("true")){
|
||||
node.put("nocheck", true);
|
||||
result.add(node);
|
||||
|
||||
@ -7,7 +7,6 @@ import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPI
|
||||
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.impl.PALRepositoryModelImpl;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.util.DiagramsUtil;
|
||||
@ -16,7 +15,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
|
||||
import com.actionsoft.bpms.cc.Adapter;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.server.Quota;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.bpms.util.UUIDGener;
|
||||
|
||||
@ -44,9 +43,6 @@ public class SynchronousOrgJob implements IJob {
|
||||
static String parentModelId = "";
|
||||
static String wsId;
|
||||
|
||||
private UserContext _uc;
|
||||
|
||||
|
||||
/**
|
||||
* 同步组织、架构数据
|
||||
* 更新组织名称/数量,更新岗位名称/数量
|
||||
@ -56,8 +52,9 @@ public class SynchronousOrgJob implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
|
||||
String wsIdParams = SDK.getJobAPI().getJobParameter(jobExecutionContext);
|
||||
wsId = wsIdParams;
|
||||
wsId=queryMaPublishGetWsId();
|
||||
|
||||
//先执行新建操作产生plid
|
||||
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
@ -71,7 +68,7 @@ public class SynchronousOrgJob implements IJob {
|
||||
|
||||
//判断如果methodID为角色图,则创建到对应角色模型文件夹中
|
||||
String modeldefaultId;
|
||||
RowMap rowMaprole=DBSql.getMap("SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME='岗位模型' and PLCATEGORY='org'");
|
||||
RowMap rowMaprole=DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME='岗位模型' and PLCATEGORY='org'");
|
||||
if(rowMaprole==null){
|
||||
modeldefaultId = Createfolder(orderIndex);
|
||||
}else{
|
||||
@ -157,14 +154,14 @@ public class SynchronousOrgJob implements IJob {
|
||||
|
||||
RowMap orgrowMap=DBSql.getMap("SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY WHERE EXT1=?",org.getString("ID"));
|
||||
if(orgrowMap==null){
|
||||
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,
|
||||
null, null, null, null, null, null, null, 1);
|
||||
coeProcessLevel.insert(model1);
|
||||
createPostData(model1.getId(), org.getString("ID"), model1, conn);
|
||||
return modelId = model1.getId();
|
||||
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,
|
||||
null, null, null, null, null, null, null, 1);
|
||||
coeProcessLevel.insert(model1);
|
||||
createPostData(model1.getId(), org.getString("ID"), model1, conn);
|
||||
return modelId = model1.getId();
|
||||
}else{
|
||||
String plname=orgrowMap.getString("PLNAME");
|
||||
if(!plname.equals(org.getString("DEPARTMENTNAME"))){
|
||||
@ -182,22 +179,22 @@ public class SynchronousOrgJob implements IJob {
|
||||
if (StringUtil.isNotEmpty(parentPalOrgId)) {
|
||||
RowMap orgrowMap=DBSql.getMap("SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY WHERE EXT1=?",org.getString("ID"));
|
||||
if(orgrowMap==null) {
|
||||
PALRepositoryModelImpl model2 = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, wsId, org.getString("DEPARTMENTNAME"),
|
||||
"", 1, getParentPalOrgId(org, conn), "org", true, 1,
|
||||
id1, false, "org.normal", "0", Integer.valueOf(org.getString("ORDERINDEX")), null,
|
||||
null, "admin", "admin", nowTime, org.getString("ID"), null,
|
||||
null, null, null, null, null, null, null, 1);
|
||||
coeProcessLevel.insert(model2);
|
||||
PALRepositoryModelImpl model2 = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, wsId, org.getString("DEPARTMENTNAME"),
|
||||
"", 1, getParentPalOrgId(org, conn), "org", true, 1,
|
||||
id1, false, "org.normal", "0", Integer.valueOf(org.getString("ORDERINDEX")), null,
|
||||
null, "admin", "admin", nowTime, org.getString("ID"), null,
|
||||
null, null, null, null, null, null, null, 1);
|
||||
coeProcessLevel.insert(model2);
|
||||
|
||||
createPostData(model2.getId(), org.getString("ID"), model2, conn);
|
||||
return modelId = model2.getId();
|
||||
createPostData(model2.getId(), org.getString("ID"), model2, conn);
|
||||
return modelId = model2.getId();
|
||||
}else{
|
||||
String plname=orgrowMap.getString("PLNAME");
|
||||
if(!plname.equals(org.getString("DEPARTMENTNAME"))){
|
||||
String updateSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLNAME=? WHERE ID=?";
|
||||
DBSql.update(conn, String.format(updateSql, org.getString("DEPARTMENTNAME"), orgrowMap.getString("ID")));
|
||||
}
|
||||
String plname=orgrowMap.getString("PLNAME");
|
||||
if(!plname.equals(org.getString("DEPARTMENTNAME"))){
|
||||
String updateSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLNAME=? WHERE ID=?";
|
||||
DBSql.update(conn, String.format(updateSql, org.getString("DEPARTMENTNAME"), orgrowMap.getString("ID")));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -257,10 +254,6 @@ public class SynchronousOrgJob implements IJob {
|
||||
JSONObject shape = ShapeUtil.getProcessShapeDefinitionByName("org.normal", "position");
|
||||
String positionName = orgdepartmentList.get(i).getString("POSITION_NAME");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (StringUtil.isNotEmpty(positionName)) {
|
||||
|
||||
JSONObject newShape = JSONObject.parseObject(shape.toString());
|
||||
@ -372,7 +365,27 @@ public class SynchronousOrgJob implements IJob {
|
||||
int maxOrderIndex = DBSql.getInt(sql, "orderIndex");
|
||||
return maxOrderIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前许可环境获取当前wsid
|
||||
* @return
|
||||
*/
|
||||
public String queryMaPublishGetWsId(){
|
||||
String wsId = null;
|
||||
boolean dev = Quota.isDEV();
|
||||
if(dev==true){
|
||||
wsId="0285ff6a-e418-4d8b-a5b1-22240296f769";
|
||||
}
|
||||
boolean prd=Quota.isPRD();
|
||||
if(prd==true){
|
||||
wsId="7d3ca852-a0bd-42e6-80b1-3dcea6f55083";
|
||||
}
|
||||
boolean qas=Quota.isQAS();
|
||||
if(qas==true){
|
||||
wsId="7d3ca852-a0bd-42e6-80b1-3dcea6f55083";
|
||||
}
|
||||
return wsId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.actionsoft.apps.coe.pal.pal.repository.job;
|
||||
|
||||
|
||||
import com.actionsoft.apps.coe.pal.batch.constant.BatchConst;
|
||||
import com.actionsoft.apps.coe.pal.batch.util.LogUtil;
|
||||
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;
|
||||
@ -14,6 +16,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeRepositoryImportUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.util.DiagramsUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.util.ShapeUtil;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
@ -85,7 +88,7 @@ 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 and id='0bffb3ad-bf31-4453-84c5-84815bc45ee4'");
|
||||
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;
|
||||
@ -294,17 +297,28 @@ public class SynchronousPortJob implements IJob {
|
||||
|
||||
List result = new ArrayList();
|
||||
|
||||
|
||||
if(positionName.equals(shape2.get("name"))){
|
||||
flag=false;
|
||||
}
|
||||
}
|
||||
|
||||
if(flag==true){
|
||||
|
||||
|
||||
JSONObject newShape = JSONObject.parseObject(shape.toString());
|
||||
newShape.put("id", shapeId);
|
||||
newShape.put("text", positionName);
|
||||
shapes.add(newShape);
|
||||
JSONArray newShapes = this.getMethodElementsJSONArray(shapes, 6);
|
||||
|
||||
|
||||
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);
|
||||
@ -386,7 +400,66 @@ public class SynchronousPortJob implements IJob {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建具有合理位置的节点数据
|
||||
*
|
||||
* @param elements
|
||||
* @param shapeRowCount
|
||||
* @return
|
||||
*/
|
||||
private JSONArray getMethodElementsJSONArray(JSONArray elements, int shapeRowCount, int maxZIndex, int initY) {
|
||||
JSONArray result = new JSONArray();
|
||||
int zindex = maxZIndex;
|
||||
int initX = 0;
|
||||
int pageEdge = 100;
|
||||
int count = 0;
|
||||
initX += pageEdge;
|
||||
initY += pageEdge;
|
||||
if (maxZIndex > 0) {// 在已有图的基础上增加的形状,缩小默认的纵轴距离高度
|
||||
initY = initY - pageEdge;
|
||||
}
|
||||
for (int i = 0; i < elements.size(); i++) {
|
||||
JSONObject shape = elements.getJSONObject(i);
|
||||
count++;
|
||||
if (count % (shapeRowCount+1) == 0) {
|
||||
count = 1;
|
||||
initY += 90;
|
||||
// 换行
|
||||
initX = 0;
|
||||
initX = pageEdge + initX;
|
||||
}
|
||||
zindex++;
|
||||
if (shape.containsKey("dataAttributes")) {
|
||||
JSONArray dataAttributes = JSONArray.parseArray(shape.getString("dataAttributes"));
|
||||
for (int index = 0; index < dataAttributes.size(); index++) {
|
||||
dataAttributes.getJSONObject(index).put("id", UUIDGener.getObjectId());
|
||||
}
|
||||
shape.put("dataAttributes", dataAttributes);
|
||||
}
|
||||
int totalWidth = 160;// 每个节点总宽度,空白+节点+空白
|
||||
int totalHeight = 200;// 每个节点总高度,空白+节点+空白
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int w = validateJson(shape.getJSONObject("props").getInteger("w"));
|
||||
int h = validateJson(shape.getJSONObject("props").getInteger("h"));
|
||||
int leftBlankWidth = (totalWidth - w)/2;
|
||||
int topBlankHeight = (totalHeight - h)/2;
|
||||
x = initX + leftBlankWidth;
|
||||
initX = x + w + leftBlankWidth;
|
||||
y = initY + topBlankHeight;
|
||||
// y = pageEdge + initY;
|
||||
// if (y < 0) {
|
||||
// y = 100;
|
||||
// }
|
||||
JSONObject props = shape.getJSONObject("props");
|
||||
props.put("x", x);
|
||||
props.put("y", y);
|
||||
props.put("zindex", zindex);
|
||||
shape.put("props", props);
|
||||
result.add(shape);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String validateJson(String name) {
|
||||
return name == null ? "" : name;
|
||||
@ -434,8 +507,43 @@ public class SynchronousPortJob implements IJob {
|
||||
return wsId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取形状的最大层级zindex
|
||||
* @param elements
|
||||
* @return
|
||||
*/
|
||||
private int getMaxPropsZIndex(JSONObject elements) {
|
||||
int max = 0;
|
||||
Iterator<String> it = elements.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
String key = it.next();
|
||||
JSONObject shape = elements.getJSONObject(key);
|
||||
JSONObject props = shape.getJSONObject("props");
|
||||
int zindex = props.getIntValue("zindex");
|
||||
max = max > zindex ? max : zindex;
|
||||
}
|
||||
return max;
|
||||
}
|
||||
/**
|
||||
* 获取已有形状的最大纵向高度
|
||||
* @param elements
|
||||
* @return
|
||||
*/
|
||||
private int getMaxPositionY(JSONObject elements) {
|
||||
int max = 0;
|
||||
Iterator<String> it = elements.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
String key = it.next();
|
||||
JSONObject shape = elements.getJSONObject(key);
|
||||
String shapeName = shape.getString("name");
|
||||
if(!"linker".equals(shapeName)) {
|
||||
JSONObject props = shape.getJSONObject("props");
|
||||
int y = props.getIntValue("y") + props.getIntValue("h");
|
||||
max = max > y ? max : y;
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user