|
@@ -25,7 +25,7 @@ import java.util.stream.Stream;
|
|
|
public class FlowDBLogAspect {
|
|
public class FlowDBLogAspect {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- UpdateDataTableDao updateDataTableDao;
|
|
|
|
|
|
|
+ private UpdateDataTableDao updateDataTableDao;
|
|
|
|
|
|
|
|
//流程步骤 请求路径 方法名
|
|
//流程步骤 请求路径 方法名
|
|
|
//驳回发起人 /ibps/business/v3/bpm/task/reject/starter rejectToStarter()
|
|
//驳回发起人 /ibps/business/v3/bpm/task/reject/starter rejectToStarter()
|
|
@@ -40,18 +40,21 @@ public class FlowDBLogAspect {
|
|
|
//解锁 /ibps/business/v3/bpm/task/unlock unlock()
|
|
//解锁 /ibps/business/v3/bpm/task/unlock unlock()
|
|
|
//反对 /ibps/business/v3/bpm/task/oppose oppose()
|
|
//反对 /ibps/business/v3/bpm/task/oppose oppose()
|
|
|
|
|
|
|
|
|
|
+ // 2023-08-28 新增
|
|
|
|
|
+ //启动 /ibps/business/v3/bpm/instance/start
|
|
|
|
|
+ //保存草稿 /ibps/business/v3/bpm/instance/saveDraft
|
|
|
|
|
+
|
|
|
// 声明环绕通知 定义切点 流程涉及到的接口
|
|
// 声明环绕通知 定义切点 流程涉及到的接口
|
|
|
- @Around("execution(* com.lc.ibps.bpmn.api.IBpmTaskService.*(..))")
|
|
|
|
|
|
|
+ @Around("execution(* com.lc.ibps.bpmn.api.*.*(..))")
|
|
|
public Object around(ProceedingJoinPoint point) throws Throwable {
|
|
public Object around(ProceedingJoinPoint point) throws Throwable {
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
|
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
|
|
- String methodName = point.getSignature().getName();
|
|
|
|
|
// 执行目标方法
|
|
// 执行目标方法
|
|
|
StopWatch stopWatch = new StopWatch();
|
|
StopWatch stopWatch = new StopWatch();
|
|
|
stopWatch.start();
|
|
stopWatch.start();
|
|
|
Object result = point.proceed();
|
|
Object result = point.proceed();
|
|
|
stopWatch.stop();
|
|
stopWatch.stop();
|
|
|
|
|
|
|
|
- if (ifAddLog(methodName)){
|
|
|
|
|
|
|
+ if (NAMES.contains(request.getRequestURI())){
|
|
|
List<Object> paramList = Stream.of(point.getArgs())
|
|
List<Object> paramList = Stream.of(point.getArgs())
|
|
|
.filter(args -> !(args instanceof ServletRequest))
|
|
.filter(args -> !(args instanceof ServletRequest))
|
|
|
.filter(args -> !(args instanceof ServletResponse))
|
|
.filter(args -> !(args instanceof ServletResponse))
|
|
@@ -59,7 +62,7 @@ public class FlowDBLogAspect {
|
|
|
String printParamStr = paramList.size() == 1 ? JSONUtil.toJsonStr(paramList.get(0)) : JSONUtil.toJsonStr(paramList);
|
|
String printParamStr = paramList.size() == 1 ? JSONUtil.toJsonStr(paramList.get(0)) : JSONUtil.toJsonStr(paramList);
|
|
|
// 记录操作日志
|
|
// 记录操作日志
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
- map.put("method_", methodName);
|
|
|
|
|
|
|
+ map.put("method_", point.getSignature().getName());
|
|
|
map.put("params_", printParamStr);
|
|
map.put("params_", printParamStr);
|
|
|
map.put("user_id_", ContextUtil.getCurrentUser().getUserId());
|
|
map.put("user_id_", ContextUtil.getCurrentUser().getUserId());
|
|
|
map.put("user_name_", ContextUtil.getCurrentUser().getFullname());
|
|
map.put("user_name_", ContextUtil.getCurrentUser().getFullname());
|
|
@@ -72,10 +75,10 @@ public class FlowDBLogAspect {
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public boolean ifAddLog(String methodName) {
|
|
|
|
|
- String[] names = {"rejectToStarter", "agree", "save", "rejectToPrevious", "reject", "doEndProcess",
|
|
|
|
|
- "suspendProcess", "recoverProcess", "lock", "unlock", "oppose"};
|
|
|
|
|
- return Arrays.asList(names).contains(methodName);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ private static final Set<String> NAMES = new HashSet<>(
|
|
|
|
|
+ Arrays.asList("/bpm/task/reject/starter", "/bpm/task/agree", "/bpm/task/save/task", "/bpm/task/reject/previous",
|
|
|
|
|
+ "/bpm/task/reject", "/bpm/task/doEndProcess","/bpm/task/suspendProcess", "/bpm/task/recoverProcess",
|
|
|
|
|
+ "/bpm/task/lock", "/bpm/task/unlock", "/bpm/task/oppose","/bpm/instance/start","/bpm/instance/saveDraft")
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
}
|
|
}
|