出现重放 加以解决
This commit is contained in:
parent
80a0dbb73b
commit
abacd77904
|
@ -20,9 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 流程流转消息通知切面
|
||||
|
@ -35,6 +33,11 @@ public class ActivitiNoticeAspect {
|
|||
private SysNoticeService sysNoticeService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
private Set<String> work_ = new HashSet<>();
|
||||
|
||||
public ActivitiNoticeAspect() {
|
||||
logger.error("构造:ActivitiNoticeAspect");
|
||||
}
|
||||
|
||||
@Pointcut("@annotation(io.renren.common.annotation.ActivitiNoticeOperation)")
|
||||
public void activitiNoticePointCut() {
|
||||
|
@ -50,7 +53,6 @@ public class ActivitiNoticeAspect {
|
|||
final ActivitiNoticeOperation activitiNoticeOperation = method.getAnnotation(ActivitiNoticeOperation.class);
|
||||
Arrays.asList(joinPoint.getArgs()).stream().findFirst().ifPresent(arg -> {
|
||||
final DelegateTask delegateTask = (DelegateTask) arg;
|
||||
final Map<String, Object> kv = delegateTask.getVariables();
|
||||
final String eventName = delegateTask.getEventName();
|
||||
switch (eventName) {
|
||||
case TaskListener.EVENTNAME_ASSIGNMENT: // 节点被委派给某人
|
||||
|
@ -68,6 +70,11 @@ public class ActivitiNoticeAspect {
|
|||
private void notice(DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) {
|
||||
Map<String, Object> kv = delegateTask.getVariables();
|
||||
logger.error("录入表单:" + kv.toString());
|
||||
if (work_.contains(kv.get("id").toString())) {
|
||||
logger.error("------------出现重放------------");
|
||||
return;
|
||||
}
|
||||
work_.add(kv.get("id").toString());
|
||||
String creator = null;
|
||||
if (kv.containsKey("creator")) { // 表单存在创建者
|
||||
creator = kv.get("creator").toString();
|
||||
|
@ -90,6 +97,8 @@ public class ActivitiNoticeAspect {
|
|||
dto.setCreator(sysUserService.getByUsername("admin").getId());
|
||||
dto.setCreateDate(new Date());
|
||||
sysNoticeService.save(dto);
|
||||
Thread.sleep(100);
|
||||
work_.remove(kv.get("id").toString());
|
||||
} catch (Exception e) {
|
||||
logger.error("发送通知消息异常", e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue