权限阅览代码恢复

This commit is contained in:
zhaol 2025-01-22 20:53:21 +08:00
parent 66f02980c0
commit 5874c2a16d
4 changed files with 113 additions and 208 deletions

View File

@ -24,6 +24,7 @@ import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask;
import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
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.dao.PALRepositoryPropertyDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.constant.CoeDesignerConstant;
@ -166,6 +167,9 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
updateProcessNumber(boN.get("PUBLISHFILEID").toString(), param.getUserContext(), bo.get("WSID").toString(), boN.getString("PUBLISH_NUMBER"), model.getPublishDate());
}
//by bzp 测试编号生成
//new ProcesNumberUtil().getNumber(processInstId);
@ -239,9 +243,92 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
SDK.getBOAPI().create("BO_EU_EVENT_DATA_MONITORING",bodata1,boProcessInstance1.getId(),"");
//更新部门视图
updateDeptView(bolistN, bolistC, bolistS);
}
/**
* 更新部门视图
* @param bolistN
* @param bolistC
* @param bolistS
*/
public void updateDeptView(List<BO> bolistN, List<BO> bolistC, List<BO> bolistS){
if (bolistN != null) {
for (BO boN : bolistN) {
String fileId = boN.getString("PUBLISHFILEID");
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='1' WHERE ID='" + fileId + "'");
/**
* 更新部门视图EXT6字段
*/
List<RowMap> rlatRowMap = DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID='" + fileId + "' and ATTRID='Issuing_department'");
if (rlatRowMap.size() > 0) {
// 发布部门
String dempId = "";
for (RowMap oneRowMap : rlatRowMap) {
String relationshapetext = oneRowMap.getString("RELATIONSHAPETEXT");
JSONObject js = JSONObject.parseObject(relationshapetext);
dempId += js.getString("id") + ",";
}
dempId = dempId.substring(0, dempId.length() - 1);
int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6=TO_CLOB('" + dempId + "') WHERE ID = '" + fileId + "'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(fileId);
if (plModel != null) {
PALRepositoryCache.getCache().put(fileId, plModel);
}
}
}
}
if (bolistC != null) {
for (BO boC : bolistC) {
String changefileId = boC.getString("CHANGEFILEID");
String changefileIdNew = boC.getString("CHANGEDFILEIDNEW");
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='0' WHERE ID='"+changefileId+"'");
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='1' WHERE ID='"+changefileIdNew+"'");
/**
* 更新部门视图EXT6字段
*/
List<RowMap> rlatRowMap=DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID='"+changefileIdNew+"' and ATTRID='Issuing_department'");
if(rlatRowMap.size()>0){
// 发布部门
String dempId = "";
for(RowMap oneRowMap:rlatRowMap){
String relationshapetext=oneRowMap.getString("RELATIONSHAPETEXT");
JSONObject js=JSONObject.parseObject(relationshapetext);
dempId += js.getString("id") + ",";
}
dempId = dempId.substring(0, dempId.length() - 1);
int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6=TO_CLOB('" + dempId + "') WHERE ID='" + changefileIdNew + "'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(changefileIdNew);
if (plModel != null) {
PALRepositoryCache.getCache().put(changefileIdNew, plModel);
}
}
}
}
if (bolistS != null) {
for (BO boS : bolistS) {
String fileId = boS.get("STOPFILEID").toString();
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='0' WHERE ID='"+fileId+"'");
}
}
}
/**
* 以当前发布变更停用的流程作为前后置流程的流程对其流程接口的文本进行调整
*
@ -664,6 +751,19 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
* @param bolistS 停用发布流程信息删除相应流程权限信息
*/
private void savePublishScope(BO publish, List<BO> bolistN, List<BO> bolistC, List<BO> bolistS) {
ProcessInstance boProcessInstances = SDK.getProcessAPI()
.createBOProcessInstance("obj_e0ba99c88d4e423a88c00da30700d722","admin", "阅览权限监控");
BO viewing=new BO();
viewing.set("PROCESSID", publish.getBindId());
//存储发布流程的流程实例ID与权限阅览数据视图做关联
viewing.set("PROCESSTITLE" , publish.getString("PROCESS_TITLE"));
SDK.getBOAPI().create("BO_ACT_VIEWING_RIGHTS",viewing,boProcessInstances.getId(),"");
String newBoName = "BO_ACT_PUBLISH_PERM_SCOPE";
String bindId = publish.getBindId();
String wsId = publish.getString("WSID");
String applyUser = publish.getString("APPLYUSERID");
@ -673,6 +773,8 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
String sendScopeLevel = publish.getString("SEND_SCOPE_LEVEL");
Set<String> removeVerIds = new HashSet<>();
Map<String, String> addVerMap = new HashMap<>();
//将发布范围权限信息保存至范围权限表
if (bolistN != null) {
for (BO boN : bolistN) {
@ -682,8 +784,8 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
SDK.getLogAPI().consoleErr("[发布范围权限信息保存至范围权限表]更新失败,模型[" + palId + "]");
continue;
}
addVerMap.put(model.getId(), model.getName());
//removeVerIds.add(model.getVersionId());
addVerMap.put(model.getVersionId(), model.getName());
removeVerIds.add(model.getVersionId());
}
}
if (bolistC != null) {
@ -694,8 +796,8 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
SDK.getLogAPI().consoleErr("[发布范围权限信息保存至范围权限表]更新失败,模型[" + palId + "]");
continue;
}
addVerMap.put(model.getId(), model.getName());
//removeVerIds.add(model.getVersionId());
addVerMap.put(model.getVersionId(), model.getName());
removeVerIds.add(model.getVersionId());
}
}
if (bolistS != null) {
@ -706,15 +808,10 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
SDK.getLogAPI().consoleErr("[发布范围权限信息保存至范围权限表]更新失败,模型[" + palId + "]");
continue;
}
BO publishPermScope=SDK.getBOAPI().query("BO_ACT_PUBLISH_PERM_SCOPE").addQuery("PALVERSIONID=",palId).detail();
if(publishPermScope!=null){
SDK.getBOAPI().remove("BO_ACT_PUBLISH_PERM_SCOPE",publishPermScope.getId());
}
//removeVerIds.add(model.getVersionId());
removeVerIds.add(model.getVersionId());
}
}
/*
// 先删除相应原有权限数据再进行数据更新
Set<String> removeIds = new HashSet<>();
for (String removeVerId : removeVerIds) {
@ -727,8 +824,7 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
}
for (String removeId : removeIds) {
SDK.getBOAPI().remove(newBoName, removeId);
}*/
String newBoName = "BO_ACT_PUBLISH_PERM_SCOPE";
}
// 重新添加权限
//List<BO> list = new ArrayList<>();
for (Map.Entry<String, String> entry : addVerMap.entrySet()) {
@ -817,8 +913,6 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
bo.set("BUSINESS_DIVISION",department);
}
}
} else if(allpath.contains("伊利集团总部")){
bo.set("BUSINESS_DIVISION","伊利集团总部");
}

View File

@ -500,60 +500,8 @@ public class ProcessEndAfterEvent_gc extends ExecuteListener implements ExecuteL
for (BO bo : bo_act_coe_publish_n) {
try {
String fileId = bo.getString("PUBLISHFILEID");
DBSql.update(open,"UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='1' WHERE ID='"+fileId+"'");
/**
* 更新部门视图EXT6字段
*/
List<RowMap> rlatRowMap=DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID = '"+fileId+"' and ATTRID='Issuing_department'");
if(rlatRowMap.size()>0){
// 发布部门
String dempId = "";
for(RowMap oneRowMap:rlatRowMap){
String relationshapetext=oneRowMap.getString("RELATIONSHAPETEXT");
JSONObject js=JSONObject.parseObject(relationshapetext);
dempId += js.getString("id") + ",";
}
dempId = dempId.substring(0, dempId.length() - 1);
int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('" + dempId + "') WHERE ID = '" + fileId + "'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(fileId);
if (plModel != null) {
PALRepositoryCache.getCache().put(fileId, plModel);
}
}
/*Map<String, JSONObject> queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(fileId);
if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) {
// 发布部门
String dempId = "";
JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department");
if (null != Issuing_department && !Issuing_department.equals("")) {
JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value");
SDK.getLogAPI().consoleInfo(Issuing_department.toString());
if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) {
for (Object PUBDEPTO : PUBDEPTJA) {
JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO));
dempId += PUBDEPTJO.getString("id") + ",";
}
dempId = dempId.substring(0, dempId.length() - 1);
int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('" + dempId + "') WHERE ID = '" + fileId + "'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(fileId);
if (plModel != null) {
PALRepositoryCache.getCache().put(fileId, plModel);
}
}
}
}*/
} catch (Exception e) {
}
@ -564,61 +512,8 @@ public class ProcessEndAfterEvent_gc extends ExecuteListener implements ExecuteL
try {
String changefileId = bo.getString("CHANGEFILEID");
String changefileIdNew = bo.getString("CHANGEDFILEIDNEW");
DBSql.update(open,"UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+changefileId+"'");
DBSql.update(open,"UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '"+changefileIdNew+"'");
/**
* 更新部门视图EXT6字段
*/
/* Map<String, JSONObject> queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(changefileIdNew);
if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) {
// 发布部门
String dempId = "";
JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department");
if (null != Issuing_department && !Issuing_department.equals("")) {
JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value");
SDK.getLogAPI().consoleInfo(Issuing_department.toString());
if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) {
for (Object PUBDEPTO : PUBDEPTJA) {
JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO));
dempId += PUBDEPTJO.getString("id") + ",";
}
dempId = dempId.substring(0, dempId.length() - 1);
int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('" + dempId + "') WHERE ID = '" + changefileIdNew + "'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(changefileIdNew);
if (plModel != null) {
PALRepositoryCache.getCache().put(changefileIdNew, plModel);
}
}
}
}*/
/**
* 更新部门视图EXT6字段
*/
List<RowMap> rlatRowMap=DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID = '"+changefileIdNew+"' and ATTRID='Issuing_department'");
if(rlatRowMap.size()>0){
// 发布部门
String dempId = "";
for(RowMap oneRowMap:rlatRowMap){
String relationshapetext=oneRowMap.getString("RELATIONSHAPETEXT");
JSONObject js=JSONObject.parseObject(relationshapetext);
dempId += js.getString("id") + ",";
}
dempId = dempId.substring(0, dempId.length() - 1);
int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('" + dempId + "') WHERE ID = '" + changefileIdNew + "'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(changefileIdNew);
if (plModel != null) {
PALRepositoryCache.getCache().put(changefileIdNew, plModel);
}
}
} catch (Exception e) {
}
@ -629,7 +524,6 @@ public class ProcessEndAfterEvent_gc extends ExecuteListener implements ExecuteL
for (BO bo : bo_act_coe_publish_s) {
try {
String fileId = bo.getString("STOPFILEID");
DBSql.update(open,"UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+fileId+"'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(fileId);
@ -1371,7 +1265,6 @@ public class ProcessEndAfterEvent_gc extends ExecuteListener implements ExecuteL
recordFailLists.add(bo);
}
}
System.out.println("recordFailLists========="+recordFailLists.size());
SDK.getBOAPI().create("BO_EU_READ_COUNT", recordFailLists, processInstance, UserContext.fromUID(processInstance.getCreateUser()));
}
@ -1398,7 +1291,6 @@ public class ProcessEndAfterEvent_gc extends ExecuteListener implements ExecuteL
throws DocumentException {
System.out.println("idList========="+idList.toString());
String processInstId = processInstance.getId();
// System.err.println(processInstance.getTitle() + "开始发送:" + userId);

View File

@ -513,32 +513,8 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
for (BO bo : bo_act_coe_publish_n) {
try {
String fileId = bo.getString("PUBLISHFILEID");
DBSql.update(open, "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '" + fileId + "'");
/**
* 更新部门视图EXT6字段
*/
List<RowMap> rlatRowMap = DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID = '" + fileId + "' and ATTRID='Issuing_department'");
if (rlatRowMap.size() > 0) {
// 发布部门
String dempId = "";
for (RowMap oneRowMap : rlatRowMap) {
String relationshapetext = oneRowMap.getString("RELATIONSHAPETEXT");
JSONObject js = JSONObject.parseObject(relationshapetext);
dempId += js.getString("id") + ",";
}
dempId = dempId.substring(0, dempId.length() - 1);
int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('" + dempId + "') WHERE ID = '" + fileId + "'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(fileId);
if (plModel != null) {
PALRepositoryCache.getCache().put(fileId, plModel);
}
}
RowMap rowMap = DBSql
/*RowMap rowMap = DBSql
.getMap("SELECT * FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID=" +fileId+"");
OutputTaskModel model = new OutputTask().getTaskReportById(rowMap.getString("TASKID"));
@ -555,7 +531,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
String sql_lever = sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '"
+ rowMap.getString("PUBLISHFILEID") + "'";
String lever = DBSql.getString(sql_lever);
// lever = lever.substring(0,3);
if (lever.length() == 5 && lever.substring(4).equals("0")) {
lever.substring(0, 3);
} else if (lever.length() == 1) {
@ -585,37 +560,11 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
SDK.getBOAPI().create("BO_EU_GPT_DOCFILE", gptBO, boProcessInstance.getId(), processExecutionContext.getProcessInstance().getCreateUser());
}
}
/*Map<String, JSONObject> queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(fileId);
if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) {
// 发布部门
String dempId = "";
JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department");
if (null != Issuing_department && !Issuing_department.equals("")) {
JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value");
SDK.getLogAPI().consoleInfo(Issuing_department.toString());
if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) {
for (Object PUBDEPTO : PUBDEPTJA) {
JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO));
dempId += PUBDEPTJO.getString("id") + ",";
}
dempId = dempId.substring(0, dempId.length() - 1);
int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('" + dempId + "') WHERE ID = '" + fileId + "'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(fileId);
if (plModel != null) {
PALRepositoryCache.getCache().put(fileId, plModel);
}
}
}
}*/
} catch (Exception e) {
}
}
@ -625,38 +574,9 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
try {
String changefileId = bo.getString("CHANGEFILEID");
String changefileIdNew = bo.getString("CHANGEDFILEIDNEW");
DBSql.update(open,"UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+changefileId+"'");
DBSql.update(open,"UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '"+changefileIdNew+"'");
/**
* 更新部门视图EXT6字段
*/
List<RowMap> rlatRowMap=DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID = '"+changefileIdNew+"' and ATTRID='Issuing_department'");
if(rlatRowMap.size()>0){
// 发布部门
String dempId = "";
for(RowMap oneRowMap:rlatRowMap){
String relationshapetext=oneRowMap.getString("RELATIONSHAPETEXT");
JSONObject js=JSONObject.parseObject(relationshapetext);
dempId += js.getString("id") + ",";
}
dempId = dempId.substring(0, dempId.length() - 1);
int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('" + dempId + "') WHERE ID = '" + changefileIdNew + "'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(changefileIdNew);
if (plModel != null) {
PALRepositoryCache.getCache().put(changefileIdNew, plModel);
}
}
//先查找旧文件
BO docfile= SDK.getBOAPI().query("BO_EU_GPT_DOCFILE").addQuery("PLID=", changefileId).detail();
/*BO docfile= SDK.getBOAPI().query("BO_EU_GPT_DOCFILE").addQuery("PLID=", changefileId).detail();
if(docfile!=null){
String docid=docfile.getString("DOCID");
@ -721,7 +641,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
}
}
}*/
} catch (Exception e) {
@ -733,7 +653,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
for (BO bo : bo_act_coe_publish_s) {
try {
String fileId = bo.getString("STOPFILEID");
DBSql.update(open,"UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='0' WHERE ID = '"+fileId+"'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(fileId);