审批节点分配审批人时事件注解
This commit is contained in:
parent
9eeab30dcf
commit
4e0e39da8d
|
@ -0,0 +1,21 @@
|
||||||
|
package io.renren.common.annotation;
|
||||||
|
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程流转消息通知
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface ActivitiNoticeOperation {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程名称
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String value() default "";
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package io.renren.common.aspect;
|
||||||
|
|
||||||
|
|
||||||
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
|
import io.renren.modules.notice.service.SysNoticeService;
|
||||||
|
import io.renren.modules.sys.service.SysUserService;
|
||||||
|
import org.activiti.engine.delegate.DelegateTask;
|
||||||
|
import org.activiti.engine.delegate.TaskListener;
|
||||||
|
import org.aspectj.lang.JoinPoint;
|
||||||
|
import org.aspectj.lang.annotation.After;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程流转消息通知切面
|
||||||
|
*/
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
public class ActivitiNoticeAspect {
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(ActivitiNoticeAspect.class);
|
||||||
|
@Autowired
|
||||||
|
private SysNoticeService sysNoticeService;
|
||||||
|
@Autowired
|
||||||
|
private SysUserService sysUserService;
|
||||||
|
|
||||||
|
@Pointcut("@annotation(io.renren.common.annotation.ActivitiNoticeOperation)")
|
||||||
|
public void activitiNoticePointCut() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@After(value = "activitiNoticePointCut()")
|
||||||
|
public void notice(JoinPoint joinPoint) throws NoSuchMethodException {
|
||||||
|
logger.error("-------------------------------进入流程流转消息切面---------------------------------");
|
||||||
|
long beginTime = System.currentTimeMillis();
|
||||||
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
|
Method method = joinPoint.getTarget().getClass().getDeclaredMethod(signature.getName(), signature.getParameterTypes());
|
||||||
|
final ActivitiNoticeOperation activitiNoticeOperation = method.getAnnotation(ActivitiNoticeOperation.class);
|
||||||
|
Arrays.asList(joinPoint.getArgs()).stream().findFirst().ifPresent(arg -> {
|
||||||
|
final DelegateTask delegateTask = (DelegateTask) arg;
|
||||||
|
final String eventName = delegateTask.getEventName();
|
||||||
|
switch (eventName) {
|
||||||
|
case TaskListener.EVENTNAME_ASSIGNMENT: // 节点被委派给某人
|
||||||
|
{
|
||||||
|
logger.error(delegateTask.getOwner() == null ? "" : delegateTask.getOwner() + "的节点被委派给某人-->" + delegateTask.getAssignee());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -44,8 +44,10 @@ public class InitiatorDataEntryListener implements TaskListener {
|
||||||
logger.error("录入表单:" + kv.toString());
|
logger.error("录入表单:" + kv.toString());
|
||||||
if (kv.containsKey("creator")) { // 表单存在创建者
|
if (kv.containsKey("creator")) { // 表单存在创建者
|
||||||
taskService.setAssignee(delegateTask.getId(), kv.get("creator").toString());
|
taskService.setAssignee(delegateTask.getId(), kv.get("creator").toString());
|
||||||
|
taskService.setOwner(delegateTask.getId(), kv.get("creator").toString()); // 指定流程所有人
|
||||||
} else if (kv.containsKey("userId")) {
|
} else if (kv.containsKey("userId")) {
|
||||||
taskService.setAssignee(delegateTask.getId(), kv.get("userId").toString());
|
taskService.setAssignee(delegateTask.getId(), kv.get("userId").toString());
|
||||||
|
taskService.setOwner(delegateTask.getId(), kv.get("userId").toString()); // 指定流程所有人
|
||||||
}
|
}
|
||||||
GsonBuilder builder = new GsonBuilder();
|
GsonBuilder builder = new GsonBuilder();
|
||||||
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonDeserializer;
|
import com.google.gson.JsonDeserializer;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
import io.renren.modules.activiti.service.ActTaskService;
|
import io.renren.modules.activiti.service.ActTaskService;
|
||||||
import io.renren.modules.demanData.dto.TDemandDataDTO;
|
import io.renren.modules.demanData.dto.TDemandDataDTO;
|
||||||
import io.renren.modules.demanData.entity.TDemandDataEntityFlag;
|
import io.renren.modules.demanData.entity.TDemandDataEntityFlag;
|
||||||
|
@ -59,6 +60,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
|
||||||
private TDemandDataService tDemandDataService;
|
private TDemandDataService tDemandDataService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActivitiNoticeOperation("需求部门审批")
|
||||||
public void notify(DelegateExecution execution) throws Exception {
|
public void notify(DelegateExecution execution) throws Exception {
|
||||||
logger.error("----------------------进入能力需求受理者结束节点---------------------------");
|
logger.error("----------------------进入能力需求受理者结束节点---------------------------");
|
||||||
execution.getProcessBusinessKey();
|
execution.getProcessBusinessKey();
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonDeserializer;
|
import com.google.gson.JsonDeserializer;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
import io.renren.modules.activiti.service.ActTaskService;
|
import io.renren.modules.activiti.service.ActTaskService;
|
||||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||||
import io.renren.modules.processForm.service.ApiGatewayService;
|
import io.renren.modules.processForm.service.ApiGatewayService;
|
||||||
|
@ -66,6 +67,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
|
||||||
private TAbilityApplicationService tAbilityApplicationService;
|
private TAbilityApplicationService tAbilityApplicationService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActivitiNoticeOperation("资源部门负责人审批")
|
||||||
public void notify(DelegateTask delegateTask) {
|
public void notify(DelegateTask delegateTask) {
|
||||||
logger.error("-------------------------进入部门动态审批人流程-------------------------------");
|
logger.error("-------------------------进入部门动态审批人流程-------------------------------");
|
||||||
final String eventName = delegateTask.getEventName();
|
final String eventName = delegateTask.getEventName();
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonDeserializer;
|
import com.google.gson.JsonDeserializer;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||||
import io.renren.modules.resource.dto.ResourceDTO;
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
import io.renren.modules.resource.service.ResourceService;
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
|
@ -65,6 +66,7 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActivitiNoticeOperation("大数据局负责人审批")
|
||||||
public void notify(DelegateTask delegateTask) {
|
public void notify(DelegateTask delegateTask) {
|
||||||
logger.error("事件类型:" + delegateTask.getEventName());
|
logger.error("事件类型:" + delegateTask.getEventName());
|
||||||
final String eventName = delegateTask.getEventName();
|
final String eventName = delegateTask.getEventName();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonDeserializer;
|
import com.google.gson.JsonDeserializer;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
import io.renren.modules.resource.dto.ResourceDTO;
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
|
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
|
||||||
import io.renren.modules.resource.service.ResourceService;
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
|
@ -54,6 +55,7 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis
|
||||||
private ResourceService resourceService;
|
private ResourceService resourceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActivitiNoticeOperation("资源下线前资源所属部门审批人审批")
|
||||||
public void notify(DelegateTask delegateTask) {
|
public void notify(DelegateTask delegateTask) {
|
||||||
logger.error("----------------------进入资源所有者节点---------------------------");
|
logger.error("----------------------进入资源所有者节点---------------------------");
|
||||||
logger.error("事件类型:" + delegateTask.getEventName());
|
logger.error("事件类型:" + delegateTask.getEventName());
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonDeserializer;
|
import com.google.gson.JsonDeserializer;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
import io.renren.modules.processForm.service.ApiGatewayService;
|
import io.renren.modules.processForm.service.ApiGatewayService;
|
||||||
import io.renren.modules.resource.dto.ResourceDTO;
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
|
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
|
||||||
|
@ -55,6 +56,7 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
|
||||||
private ResourceService resourceService;
|
private ResourceService resourceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ActivitiNoticeOperation("资源所属部门审批人审批")
|
||||||
public void notify(DelegateExecution execution) throws Exception {
|
public void notify(DelegateExecution execution) throws Exception {
|
||||||
logger.error("----------------------进入审批通过节点---------------------------");
|
logger.error("----------------------进入审批通过节点---------------------------");
|
||||||
logger.error("事件类型:" + execution.getEventName());
|
logger.error("事件类型:" + execution.getEventName());
|
||||||
|
|
Loading…
Reference in New Issue