树形数据过滤提交
This commit is contained in:
parent
eed51d2b1f
commit
6e02e23c05
@ -760,24 +760,27 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
//JSONObject jsonObject = JSONObject.parseObject(json);
|
||||
JSONArray jsonArr_new= new JSONArray();
|
||||
JSONArray objects=JSONArray.parseArray(treeJson);
|
||||
if (objects!=null) {
|
||||
for (int i=0;i<objects.size();i++) {
|
||||
JSONObject jsonObject = objects.getJSONObject(i);
|
||||
String url=jsonObject.getString("url");
|
||||
String id=jsonObject.getString("id");
|
||||
|
||||
if(UtilString.isNotEmpty(url)){
|
||||
RowMap rowMap=DBSql.getMap("SELECT EXT2 FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=? AND EXT2=?",id,ruuid);
|
||||
if(rowMap!=null){
|
||||
if (attrId.equals("role")) {//需要在pal写死相关文件上传的属性代码为related_files
|
||||
if (objects != null) {
|
||||
for (int i = 0; i < objects.size(); i++) {
|
||||
JSONObject jsonObject = objects.getJSONObject(i);
|
||||
String url = jsonObject.getString("url");
|
||||
String id = jsonObject.getString("id");
|
||||
if (UtilString.isNotEmpty(url)) {
|
||||
RowMap rowMap = DBSql.getMap("SELECT EXT2 FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=? AND EXT2=?", id, ruuid);
|
||||
if (rowMap != null) {
|
||||
jsonArr_new.add(objects.getJSONObject(i));
|
||||
}
|
||||
} else {
|
||||
jsonArr_new.add(objects.getJSONObject(i));
|
||||
}
|
||||
}else{
|
||||
jsonArr_new.add(objects.getJSONObject(i));
|
||||
}
|
||||
|
||||
}
|
||||
macroLibraries.put("treeData", jsonArr_new.toString());
|
||||
} else {
|
||||
macroLibraries.put("treeData", treeJson);
|
||||
}
|
||||
macroLibraries.put("treeData", jsonArr_new.toString());
|
||||
|
||||
|
||||
//macroLibraries.put("treeData", getTreeJson(wsId, "", category, type, method,ruuid));
|
||||
macroLibraries.put("sid", _uc.getSessionId());
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.actionsoft.apps.coe.pal.pal.repository.job;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.DiagramUtil;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.ShapeUtil;
|
||||
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;
|
||||
@ -9,25 +11,26 @@ 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;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
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.JSON;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sun.corba.se.pept.transport.ContactInfo;
|
||||
import jodd.madvoc.meta.In;
|
||||
import jodd.util.StringUtil;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
|
||||
/**
|
||||
* 同步部门、岗位数据
|
||||
*/
|
||||
public class SynchronousOrgJob implements IJob {
|
||||
|
||||
|
||||
@ -38,31 +41,17 @@ public class SynchronousOrgJob implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
|
||||
Map<String, String> idRelationMap = new HashMap<>();
|
||||
//先执行新建操作产生plid
|
||||
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||
|
||||
String parentId = "org";
|
||||
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;
|
||||
}
|
||||
|
||||
String plRid1 = UUIDGener.getUUID();
|
||||
String id1 = UUIDGener.getUUID();
|
||||
|
||||
|
||||
orgdepartmentList = DBSql.getMaps("select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID,ORDERINDEX from ORGDEPARTMENT limit 20");
|
||||
|
||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
|
||||
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", "内蒙古伊利实业集团股份有限公司",
|
||||
"", 1, "org", "org", true, 1,
|
||||
id1, false, "org.normal", "0", 1, null,
|
||||
@ -71,22 +60,15 @@ public class SynchronousOrgJob implements IJob {
|
||||
coeProcessLevel.insert(model);
|
||||
|
||||
parentModelId=model.getId();
|
||||
// createTree(orgdepartmentList);
|
||||
orgindex = 0;
|
||||
createTree();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void createTree() {
|
||||
|
||||
for (RowMap oneData : orgdepartmentList) {
|
||||
|
||||
System.out.println("onedata======"+oneData.toString());
|
||||
orgindex++;
|
||||
/* if (oneData.getString("isCreate").equals("1")) {
|
||||
continue;
|
||||
}*/
|
||||
creatNode(oneData);
|
||||
|
||||
}
|
||||
@ -104,56 +86,40 @@ public class SynchronousOrgJob implements IJob {
|
||||
String id1 = UUIDGener.getUUID();
|
||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
System.out.println("=================当前节点ID:" + org.getString("ID"));
|
||||
if (org.getString("PARENTDEPARTMENTID").equals("0")) {
|
||||
|
||||
|
||||
System.out.println("orgdepartment======="+org.getString("DEPARTMENTNAME"));
|
||||
String sql1 = "SELECT ID FROM app_act_coe_pal_repository WHERE WSID='6f4e292c-1b90-4dd2-8c20-7da159cb20a5' and EXT1='" + org.getString("ID") + "'";
|
||||
String parentPalOrgId1 = DBSql.getString(sql1);
|
||||
if(StringUtil.isEmpty(parentPalOrgId1)){
|
||||
System.out.println("org========"+org.toString());
|
||||
System.out.println("parentID"+org.getString("ORDERINDEX"));
|
||||
PALRepositoryModelImpl model1 = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", 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);
|
||||
|
||||
// 修改创建状态
|
||||
//orgdepartmentList.get(orgindex).put("isCreate", "1");
|
||||
// org.put("isCreate","1");
|
||||
|
||||
|
||||
System.out.println("父节点创建" + model1.getId());
|
||||
createPostData(model1.getId(),org.getString("ID"),model1);
|
||||
return modelId=model1.getId();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// 获取父部门
|
||||
// getParentOrg(org);
|
||||
|
||||
String parentPalOrgId = getParentPalOrgId(org);
|
||||
|
||||
if(StringUtil.isNotEmpty(parentPalOrgId)){
|
||||
|
||||
System.out.println("xxxxxxxxxxxxxxxxxx"+org.getString("ORDERINDEX"));
|
||||
System.out.println("orgdepartment======"+org.getString("ID"));
|
||||
System.out.println("orgdepartment======="+org.getString("DEPARTMENTNAME"));
|
||||
PALRepositoryModelImpl model2 = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", 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,
|
||||
null, null, null, null, null, null, null, 1);
|
||||
coeProcessLevel.insert(model2);
|
||||
System.out.println("bbbbbbbbbb" + model2.getId());
|
||||
|
||||
createPostData(model2.getId(),org.getString("ID"),model2);
|
||||
return modelId=model2.getId();
|
||||
|
||||
|
||||
// 修改创建状态
|
||||
//orgdepartmentList.get(orgindex).put("isCreate", "1");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -164,25 +130,13 @@ public class SynchronousOrgJob implements IJob {
|
||||
}
|
||||
|
||||
public String getParentPalOrgId(RowMap org) {
|
||||
// RowMap parentOrg;
|
||||
// List<RowMap> orgdepartmentList = DBSql.getMaps("select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID from ORGDEPARTMENT where id = '" +org.getString("PARENTDEPARTMENTID")+"'");
|
||||
// parentOrg = orgdepartmentList.get(0);
|
||||
// System.out.println( "==============父节点ID"+parentOrg.getString("ID"));
|
||||
// return parentOrg.getString("ID");
|
||||
|
||||
String sql = "SELECT ID FROM app_act_coe_pal_repository WHERE WSID='6f4e292c-1b90-4dd2-8c20-7da159cb20a5' and EXT1='" + org.getString("PARENTDEPARTMENTID") + "'";
|
||||
String parentPalOrgId = DBSql.getString(sql);
|
||||
|
||||
|
||||
if (parentPalOrgId.equals("0") || parentPalOrgId.equals("") || parentPalOrgId == null) {
|
||||
RowMap parentOrg = DBSql.getMap("select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID,ORDERINDEX from ORGDEPARTMENT where id = '" + org.getString("PARENTDEPARTMENTID") + "'");
|
||||
|
||||
|
||||
creatNode(parentOrg);
|
||||
|
||||
// 修改创建状态
|
||||
|
||||
//orgdepartmentList.remove(org);
|
||||
// orgdepartmentList.add(parentOrg);
|
||||
}
|
||||
|
||||
|
||||
@ -191,15 +145,10 @@ public class SynchronousOrgJob implements IJob {
|
||||
|
||||
|
||||
public String getParentPallevel(RowMap org) {
|
||||
// RowMap parentOrg;
|
||||
// List<RowMap> orgdepartmentList = DBSql.getMaps("select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID from ORGDEPARTMENT where id = '" +org.getString("PARENTDEPARTMENTID")+"'");
|
||||
// parentOrg = orgdepartmentList.get(0);
|
||||
// System.out.println( "==============父节点ID"+parentOrg.getString("ID"));
|
||||
// return parentOrg.getString("ID");
|
||||
|
||||
String sql = "SELECT ID FROM app_act_coe_pal_repository WHERE WSID='6f4e292c-1b90-4dd2-8c20-7da159cb20a5' and EXT1='" + org.getString("PARENTDEPARTMENTID") + "'";
|
||||
String parentPalOrgId = DBSql.getString(sql);
|
||||
|
||||
|
||||
if (parentPalOrgId.equals("0") || parentPalOrgId.equals("") || parentPalOrgId == null) {
|
||||
RowMap parentOrg = DBSql.getMap("select DEPARTMENTNAME,ID,LAYER,PARENTDEPARTMENTID from ORGDEPARTMENT where id = '" + org.getString("PARENTDEPARTMENTID") + "'");
|
||||
|
||||
@ -209,6 +158,74 @@ public class SynchronousOrgJob implements IJob {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建岗位图形
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
public void createPostData(String uuid,String departmentId,PALRepositoryModelImpl model){
|
||||
Map<String, String> 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");
|
||||
|
||||
//新建一个uuid
|
||||
String shapeId = UUIDGener.getObjectId();
|
||||
|
||||
//拿到基础结构
|
||||
JSONObject shape = ShapeUtil.getProcessShapeDefinitionByName("org.normal", "position");
|
||||
|
||||
if (StringUtils.isNotEmpty(definition.getString("commonShapeConfig"))) {
|
||||
definition.remove("commonShapeConfig");
|
||||
}
|
||||
|
||||
List<RowMap> orgdepartmentList=DBSql.getMaps("select * from ORGUSER WHERE DEPARTMENTID=?",departmentId);
|
||||
|
||||
int zindex = 1;
|
||||
|
||||
if(orgdepartmentList.size()>0){
|
||||
|
||||
for(int i=0;i<orgdepartmentList.size();i++){
|
||||
|
||||
//新建一个uuid
|
||||
String shapeId1 = UUIDGener.getObjectId();
|
||||
//拿到基础结构
|
||||
JSONObject shape1 = ShapeUtil.getProcessShapeDefinitionByName("org.normal", "position");
|
||||
String postionname=orgdepartmentList.get(i).getString("POSITION_NAME");
|
||||
if(StringUtil.isNotEmpty(postionname)){
|
||||
shape1.put("id", shapeId1);
|
||||
|
||||
shape1.put("text",orgdepartmentList.get(i).getString("POSITION_NAME"));
|
||||
|
||||
JSONObject props1 = shape1.getJSONObject("props");// 位置大小
|
||||
|
||||
props1.put("x", 130*zindex);
|
||||
props1.put("y", 277);
|
||||
props1.put("w", 110);
|
||||
props1.put("h", 50);
|
||||
|
||||
props1.put("zindex", zindex++);
|
||||
|
||||
elements.put(shapeId1, shape1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 设置画布大小
|
||||
DiagramUtil.setDiagramHeightWidth(definition, elements);
|
||||
defineModel.setDefinition(definition.toString());
|
||||
// 保存文件
|
||||
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// dao操作
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user