|
|
@@ -0,0 +1,37 @@
|
|
|
+package com.common.workflow.service.activiti.supplierAppendListener;
|
|
|
+
|
|
|
+import com.common.workflow.service.util.HttpRequest;
|
|
|
+import org.activiti.engine.ActivitiException;
|
|
|
+import org.activiti.engine.delegate.DelegateExecution;
|
|
|
+import org.activiti.engine.delegate.ExecutionListener;
|
|
|
+import org.activiti.engine.delegate.Expression;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+@Component("appendApprovalRefuseService")
|
|
|
+public class AppendApprovalRefuseService implements ExecutionListener {
|
|
|
+
|
|
|
+ private Expression stepCode;
|
|
|
+ // 审批驳回
|
|
|
+ @Override
|
|
|
+ public void notify(DelegateExecution delegateExecution) {
|
|
|
+ String callbackUrl = delegateExecution.getVariable("callbackUrl").toString();
|
|
|
+ // String processKey = delegateExecution.getVariable("processKey").toString();
|
|
|
+ String businessKey = delegateExecution.getVariable("businessKey").toString();
|
|
|
+ Object nowStepCode = stepCode.getValue(delegateExecution).toString();
|
|
|
+ String approveUrl = callbackUrl + "/suppliercert-append-listener/approval-refuse";
|
|
|
+
|
|
|
+ String createUserId = "";
|
|
|
+ if (callbackUrl.length() > 0) {
|
|
|
+ // TODO 哪个环节被驳回的, 方便短信通知使用
|
|
|
+ String taskName = delegateExecution.getEventName();
|
|
|
+ createUserId = HttpRequest.sendGet(approveUrl, "businessKey=" + businessKey + "&stepCode=" + nowStepCode);
|
|
|
+ } else {
|
|
|
+ throw new ActivitiException("无回调地址,请联系管理员!");
|
|
|
+ }
|
|
|
+ if (createUserId.length() <= 0) {
|
|
|
+ throw new ActivitiException("驳回审批失败!请联系管理员!");
|
|
|
+ }
|
|
|
+ delegateExecution.setVariable("users", createUserId);
|
|
|
+ delegateExecution.setVariableLocal("users", createUserId);
|
|
|
+ }
|
|
|
+}
|