convertPage.jsp 2.3 KB
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.*" %>
<%@ page import="weaver.conn.*" %>
<%@page import="com.weaver.formmodel.util.StringHelper"%>
<%@page import="weaver.hrm.User"%>
<%@page import="weaver.hrm.HrmUserVarify"%>
<%
	User user = HrmUserVarify.getUser(request, response);
	if(user==null) {
	    response.sendRedirect("/login/Login.jsp");
	    return;
	}
	
	String modeid = StringHelper.null2String(request.getParameter("modeid"));//421
	String key = StringHelper.null2String(request.getParameter("key"));//obj1
	String val = StringHelper.null2String(request.getParameter("val"));
	
	if(StringHelper.isEmpty(modeid)){
		response.sendRedirect("/notice/noright.jsp");
	    return;
	}
	RecordSet rs = new RecordSet();
	String sql = "";
	String formid = "";

	sql = "SELECT a.formid,b.tablename FROM modeinfo a ,workflow_bill b WHERE a.formid=b.id AND a.id="+modeid;
	rs.execute(sql);
	if(rs.next()){
		formid = rs.getString("formid");
		String tablename = rs.getString("tablename");
		sql = "select id from "+tablename+" where "+key+"='"+val+"'";
	}
	
	if(!StringHelper.isEmpty(modeid)){
		sql += " and formmodeid="+modeid;
	}
	rs.execute(sql);
	String url = "";
	if(rs.next()){
		String billid = rs.getString("id");
		String params = request.getQueryString();
		String[] arr = params.split("&");
		String param = "";
		for (int i = 0; i < arr.length; i++) {
			String s = arr[i];
			if(s.startsWith("modeid=")||s.startsWith("key=")||s.startsWith("val=")||s.startsWith("pkfield=")){
				continue;
			}else{
				param += "&"+s;
			}
		}	
		url = "/spa/cube/index.jsp#/main/cube/card?type=0&modeId="+modeid+"&formId="+formid+"&billid="+billid+"&opentype=0"+param;
		response.sendRedirect(url);
		return;
	}
	String msg = "no data";

%>
<html>
	<style>
		TABLE.ViewForm {
		    WIDTH: 100%;
		    border: 0;
		    margin: 0;
		    border-collapse: collapse;
		    BACKGROUND-COLOR: #F7F7F7;
		    padding: 15px;
		}
		tr.Section th{
			margin: 10px;
			line-height: 35px;
		}
	</style>
	<body>
		<table class="ViewForm">
			<tbody>
				<tr>
					<td valign="top">
						<table>
							<tbody>
								<tr class="Section">
									<th style="font-size: 8pt">
										<%=msg %>
									</th>
								</tr>
							</tbody>
						</table>
					</td>
				</tr>
			</tbody>
		</table>
	</body>
</html>