申请流程归档事件,同步新增或修改权限信息
This commit is contained in:
parent
d0747e1168
commit
4c6181dd8b
@ -0,0 +1,50 @@
|
||||
package com.actionsoft.apps.coe.pal.publisher.event;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.publisher.constant.FilePermConstant;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
|
||||
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListenerInterface;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
|
||||
import com.actionsoft.bpms.util.UUIDGener;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
|
||||
/**
|
||||
* 申请权限流程,归档结束后,增加权限
|
||||
*/
|
||||
public class AddFilePermTaskEndEvent extends ExecuteListener implements ExecuteListenerInterface {
|
||||
public String getDescription() {
|
||||
return "申请权限流程,归档结束后,增加权限";
|
||||
}
|
||||
@Override
|
||||
public void execute(ProcessExecutionContext ctx) throws Exception {
|
||||
BO bo = ctx.getBO(FilePermConstant.BO_ACT_FILE_PERM);
|
||||
createOrUpdatePublishScope(ctx,bo);
|
||||
}
|
||||
public void createOrUpdatePublishScope(ProcessExecutionContext ctx,BO sourceBo) throws Exception {
|
||||
String sendScope = "0";
|
||||
String wsId = "7d3ca852-a0bd-42e6-80b1-3dcea6f55083";
|
||||
//先查询有没有记录,有则更新,无则新增
|
||||
String applyfiles = sourceBo.getString("APPLYFILES");
|
||||
BO oldBo = SDK.getBOAPI().query(FilePermConstant.BO_ACT_PUBLISH_PERM_SCOPE).addQuery("PALVERSIONID=", applyfiles).detail();
|
||||
if(oldBo==null){
|
||||
BO bo = new BO();
|
||||
bo.set("PERMID", UUIDGener.getUUID());
|
||||
bo.set("WSID", wsId);
|
||||
bo.set("PALVERSIONID", sourceBo.getString("APPLYFILES"));
|
||||
bo.set("PALNAME", sourceBo.getString("APPLYFILENAMES"));
|
||||
bo.set("PERMTYPE", sendScope);
|
||||
bo.set("ORGPERM", ctx.getUserContext().getDepartmentModel().getId());
|
||||
//存储发布流程的流程实例ID,与权限阅览数据视图做关联
|
||||
ProcessInstance boProcessInstance = SDK.getProcessAPI()
|
||||
.createBOProcessInstance("obj_e076b01bd0d04bc39e5af12e2c8c188c", ctx.getUserContext().getUID(), "权限阅览");
|
||||
SDK.getBOAPI().create(FilePermConstant.BO_ACT_PUBLISH_PERM_SCOPE, bo, boProcessInstance.getId(), ctx.getUserContext().getUID());
|
||||
}else{
|
||||
String orgPerm = oldBo.getString("ORGPERM");
|
||||
orgPerm +=","+ctx.getUserContext().getDepartmentModel().getId();
|
||||
oldBo.set("ORGPERM",orgPerm);
|
||||
SDK.getBOAPI().update(FilePermConstant.BO_ACT_PUBLISH_PERM_SCOPE,oldBo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user