定时同步组织代码

This commit is contained in:
zhal 2022-06-29 16:43:05 +08:00
parent 6508c8285a
commit eed51d2b1f
5 changed files with 15 additions and 193 deletions

View File

@ -1,160 +0,0 @@
package com.actionsoft.apps.coe.pal.datamigration.job;
import com.actionsoft.apps.coe.pal.datamigration.aris.mapping.ModelMappingAPIManager;
import com.actionsoft.apps.coe.pal.datamigration.aris.model.*;
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;
import com.actionsoft.apps.coe.pal.pal.repository.designer.constant.CoeDesignerConstant;
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;
import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.commons.login.constant.LoginConst;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.server.SSOUtil;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.exception.ExceptionUtil;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import jodd.util.StringUtil;
import org.apache.commons.lang.StringUtils;
import org.docx4j.wml.R;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
public class SynchronousPostJob implements IJob {
/**
* 定时从BPM组织同步PAL组织架构中
* @param jobExecutionContext
* @throws JobExecutionException
*/
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
Map<String, String> idRelationMap = new HashMap<>();
//先执行新建操作产生plid
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
String plRid = UUIDGener.getUUID();
String id = UUIDGener.getUUID();
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;
}
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id, plRid, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", "伊利集团",
"", 1, "org", "org", true, 1,
id, false, "org.normal", "0", 1, null,
null, "admin", "admin", nowTime, null, null,
null, null, null, null, null, null, null,1);
System.out.println(model.getId());
coeProcessLevel.insert(model);
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");
/*shape.put("id", shapeId);
shape.put("text","伊利集团");
JSONObject props = shape.getJSONObject("props");// 位置大小
props.put("zindex", 0);
props.put("x", Integer.parseInt("784"));
props.put("y", Integer.parseInt("166"));
props.put("w", Integer.parseInt("110"));
props.put("h", Integer.parseInt("50"));
elements.put(shapeId, shape);*/
if (StringUtils.isNotEmpty(definition.getString("commonShapeConfig"))) {
definition.remove("commonShapeConfig");
}
List<RowMap> orgdepartmentList=DBSql.getMaps("select * from ORGUSER ");
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操作
}
}

View File

@ -755,8 +755,6 @@ public class DesignerRelationShapeWeb extends ActionWeb {
// by bzp
//根据传入uuid,进行过滤保留当前流程的数据
JSONArray newRelationShapeList = new JSONArray();
String treeJson=getTreeJson(wsId, "", category, type, method,ruuid);
//JSONObject jsonObject = JSONObject.parseObject(json);
@ -767,17 +765,14 @@ public class DesignerRelationShapeWeb extends ActionWeb {
JSONObject jsonObject = objects.getJSONObject(i);
String url=jsonObject.getString("url");
String id=jsonObject.getString("id");
String open=jsonObject.getString("open");
if(open!=null){
jsonArr_new.add(objects.getJSONObject(i));
}
if(UtilString.isNotEmpty(url)){
String spiltUuid = url.substring(url.lastIndexOf("&uuid=")+6);
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));
}
}

View File

@ -1,4 +1,4 @@
package com.actionsoft.apps.coe.pal.datamigration.job;
package com.actionsoft.apps.coe.pal.pal.repository.job;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
@ -129,8 +129,6 @@ public class SynchronousOrgJob implements IJob {
return modelId=model1.getId();
}
} else {
// 获取父部门
@ -184,7 +182,7 @@ public class SynchronousOrgJob implements IJob {
// 修改创建状态
//orgdepartmentList.remove(org);
// orgdepartmentList.add(parentOrg);
// orgdepartmentList.add(parentOrg);
}

View File

@ -8015,9 +8015,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
/***************************************************获取当前文件位置 byzhaolei**********************************************/
// 获取当前文件路径
String appendStr="";
JSONArray repositoryPathData = CoeProcessLevelUtil.getRepositoryPath(parentId);
StringBuffer sb = new StringBuffer();
if(repositoryPathData.size()>0){
@ -8040,6 +8038,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
*校验是否存在重复标题
* @param title
* @return
* by zhaolei
*/
public String checkCreatePalProcessLevelRepository(String title,String method){
@ -8057,6 +8056,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
* 根据用户选择类型创建相应制度图形
* @param type
* @return
* by zhaolei
*/
public String CreateSystemModelBySelectType(String title,String type,String method,String uuid,String parentId){
@ -8064,13 +8064,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
try {
if(method.equals("control.policy")){
//先执行新建操作产生plid
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
String plRid = UUIDGener.getUUID();
String id = UUIDGener.getUUID();
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
PALRepositoryModelImpl plModel = (PALRepositoryModelImpl) CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(uuid);
@ -8130,6 +8123,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
/**
* 创建角色图
* @return
* by zhaolei
*/
public String RelationShapeCreateRole(String uuid,String methodId){
@ -8140,7 +8134,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
if (rowMap != null) {
String plname = rowMap.getString("PLNAME");
Map<String, String> idRelationMap = new HashMap<>();
//先执行新建操作产生plid
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
@ -8148,15 +8141,6 @@ public class CoeProcessLevelWeb extends ActionWeb {
String id = UUIDGener.getUUID();
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;
}
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id, plRid, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", plname + "-角色图",
@ -8215,6 +8199,12 @@ public class CoeProcessLevelWeb extends ActionWeb {
}
/**
* 查找关联角色图
* @param uuid
* @return
*/
public String relationFindSameRole(String uuid){
ResponseObject ro = ResponseObject.newOkResponse();
RowMap rowMap=DBSql.getMap("SELECT EXT2 FROM APP_ACT_COE_PAL_REPOSITORY WHERE EXT2=?",uuid);

View File

@ -3511,11 +3511,10 @@ function openRelationDig(obj,value) {
buttons : [
{
text : '刷新',
cls : "green",
cls : "yellow",
handler : function() {
// 刷新页面
//initLayout();
document.getElementById("attr_content_iframe_relevance_shapes").contentWindow.location.reload(true);
}
},{
text : '新建角色模型',