冀北监测点试运行功能提交
This commit is contained in:
@@ -24,12 +24,12 @@ public class BpmWebConfiguration {
|
||||
/**
|
||||
* 配置 Flowable Web 过滤器
|
||||
*/
|
||||
@Bean
|
||||
/* @Bean
|
||||
public FilterRegistrationBean<FlowableWebFilter> flowableWebFilter() {
|
||||
FilterRegistrationBean<FlowableWebFilter> registrationBean = new FilterRegistrationBean<>();
|
||||
registrationBean.setFilter(new FlowableWebFilter());
|
||||
registrationBean.setOrder(WebFilterOrderEnum.FLOWABLE_FILTER);
|
||||
return registrationBean;
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
package com.njcn.bpm.config;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.bpm.utils.FlowableUtils;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Flowable Web 过滤器,将 userId 设置到 {@link org.flowable.common.engine.impl.identity.Authentication} 中
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
public class FlowableWebFilter extends OncePerRequestFilter {
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
||||
throws ServletException, IOException {
|
||||
try {
|
||||
String userIndex = RequestUtil.getUserIndex();
|
||||
// 设置工作流的用户
|
||||
if (StrUtil.isNotBlank(userIndex)) {
|
||||
FlowableUtils.setAuthenticatedUserId(userIndex);
|
||||
}
|
||||
// 过滤
|
||||
chain.doFilter(request, response);
|
||||
} finally {
|
||||
// 清理
|
||||
FlowableUtils.clearAuthenticatedUserId();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//package com.njcn.bpm.config;
|
||||
//
|
||||
//import cn.hutool.core.util.StrUtil;
|
||||
//import com.njcn.bpm.utils.FlowableUtils;
|
||||
//import com.njcn.web.utils.RequestUtil;
|
||||
//import org.springframework.web.filter.OncePerRequestFilter;
|
||||
//
|
||||
//import javax.servlet.FilterChain;
|
||||
//import javax.servlet.ServletException;
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//import java.io.IOException;
|
||||
//
|
||||
///**
|
||||
// * Flowable Web 过滤器,将 userId 设置到 {@link org.flowable.common.engine.impl.identity.Authentication} 中
|
||||
// *
|
||||
// * @author jason
|
||||
// */
|
||||
//public class FlowableWebFilter extends OncePerRequestFilter {
|
||||
//
|
||||
// @Override
|
||||
// protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
||||
// throws ServletException, IOException {
|
||||
// try {
|
||||
// String userIndex = RequestUtil.getUserIndex();
|
||||
// // 设置工作流的用户
|
||||
// if (StrUtil.isNotBlank(userIndex)) {
|
||||
// FlowableUtils.setAuthenticatedUserId(userIndex);
|
||||
// }
|
||||
// // 过滤
|
||||
// chain.doFilter(request, response);
|
||||
// } finally {
|
||||
// // 清理
|
||||
// FlowableUtils.clearAuthenticatedUserId();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user