*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String dataBaseId=ProcessEngineManagement.getDefaultProcessEngine().getProcessEngineConfiguration().getSelectedDatabase().getId();
DBConnFactory dbcf = (DBConnFactory)SpringConfigLoadHelper.getBean(dataBaseId);
Connection connection = null;
try {
String context = request.getContextPath();
//从登录的口获取到用户名和密码
String userName = request.getParameter("userName");
String password = request.getParameter("password");
List<Object> list= new ArrayList<Object>();
//该接口同时也是登出的口,当发现有特殊参数时则做登出操作。
String logout = request.getParameter("doLogOut");
if(StringUtil.isNotEmpty(logout)){
request.getSession().invalidate();
response.sendRedirect(context+"/fixflow/login.jsp");
return;
}
//这里进行用户名密码验证,可以任意修改这里的代码。
list.add(userName);
password = MD5.getMD5(password.getBytes());
list.add(password);
StringBuffer sb = new StringBuffer();
sb.append("SELECT USERID,USERNAME FROM AU_USERINFO WHERE LOGINID=? AND PASSWORD=?");
connection = dbcf.createConnection();
//这里是自带的数据库操作方式。
SqlCommand sqlcommand = new SqlCommand(connection);
List<Map<String, Object>> list2 = sqlcommand.queryForList(sb.toString(),list);
if(list2!=null && list2.size()>0){
//这里约定了一个参数,流程引擎在运行时会默认从session里按照这两个key来获取参数,如果替换了登录的方式,请保证这两个key依然可以获取到正确的数据