Commit 20c8f168 authored by shaochangbin's avatar shaochangbin

2015-12-20版本

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="conf"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="com.genuitec.runtime.library/com.genuitec.spring_4.1">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="WEB-INF/lib"/>
<attribute name="owner.project.facets" value="me.spring"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.genuitec.runtime.library/com.genuitec.jstl_1.2.1">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="WEB-INF/lib"/>
<attribute name="owner.project.facets" value="jst.web.jstl"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>access</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.springframework.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.genuitec.eclipse.springframework.springnature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="WebRoot"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary/StandardBrowser/html5"/>
<classpathentry kind="output" path=""/>
</classpath>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<add-on id="spring.web"/>
</project>
eclipse.preferences.version=1
encoding//WebRoot/MyJsp.jsp=UTF-8
encoding//WebRoot/findEmployee.jsp=UTF-8
encoding//WebRoot/index2.jsp=UTF-8
encoding/<project>=UTF-8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="access">
<wb-resource deploy-path="/" source-path="/WebRoot" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/conf"/>
<property name="context-root" value="access"/>
<property name="java-output-path" value="/access/WebRoot/WEB-INF/classes"/>
</wb-module>
</project-modules>
<root>
<facet id="me.spring">
<node name="libprov">
<attribute name="config-id" value="me.spring_4.1"/>
<attribute name="copy-tlds" value="true"/>
<attribute name="nested-config-me.spring_4.1-security" value="none"/>
<attribute name="nested-config-me.spring_4.1-webflow" value="none"/>
<attribute name="provider-id" value="me-spring-library-provider"/>
<attribute name="version-id" value="4.1"/>
</node>
</facet>
<facet id="java"/>
<facet id="jst.web.jstl"/>
<facet id="wst.jsdt.web"/>
<facet id="jst.web"/>
</root>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="java"/>
<fixed facet="jst.web"/>
<fixed facet="wst.jsdt.web"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="jst.web.jstl" version="1.2.1"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.8"/>
<installed facet="me.spring" version="4.1"/>
</faceted-project>
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Window
\ No newline at end of file
#org.skyway.core settings
#Wed Sep 27 16:31:41 CST 2017
customization.specification=
<?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription>
<version>1</version>
<pluginVersion><![CDATA[3.6.2.me201505141600]]></pluginVersion>
<configSuffixes>
<configSuffix><![CDATA[xml]]></configSuffix>
</configSuffixes>
<enableImports><![CDATA[false]]></enableImports>
<configs>
<config>conf/applicationContext.xml</config>
</configs>
<autoconfigs>
</autoconfigs>
<configSets>
</configSets>
</beansProjectDescription>
{"ide":{},"libs":["ecma5","browser"],"plugins":{"guess-types":{}}}
\ No newline at end of file
Manifest-Version: 1.0
Class-Path:
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'MyJsp.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="js/jquery-1.8.3.min.js">
</script>
<script type="text/javascript">
$(function() {
$("#button").click(function() {
$.ajax({
type: "GET",
url: "http://localhost:9005/auth/user/login",
contentType: "application/json; charset=utf-8",
data: "hello",
dataType: "json",
success: function (resp) {
console.log(resp);
},
error: function (message) {
}
});
});
})
</script>
</head>
<body>
<button id="button">diawo</button>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>单图片上传</title>
<script type="text/javascript" src="js/jquery-1.8.3.min.js">
</script>
<script type="text/javascript">
$(function() {
$("button").click(function() {
alert("ahshd");
});
})
</script>
</head>
<body>
<form action="photoUpload" method="post" enctype="multipart/form-data">
选择文件:<input type="file" name="file">
</form>
<br>
<button>dianwo</button>
<fieldset>
<legend>图片上传</legend>
<h2>只能上传单张10M以下的 PNG、JPG、GIF 格式的图片</h2>
<form action="photoUpload" method="post" enctype="multipart/form-data">
选择文件:<input type="file" name="file"> <input type="submit"
value="上传">
</form>
</fieldset>
${photourl}
${photour2}
</body>
</html>
\ No newline at end of file
<%@ page language ="java" import="java.util.*" pageEncoding="utf-8" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://" +request.getServerName()+":"+request.getServerPort()+path+ "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href =" <%=basePath%> ">
<title> My JSP 'print.jsp' starting page</title >
<meta http-equiv ="pragma" content="no-cache" >
<meta http-equiv ="cache-control" content="no-cache" >
<meta http-equiv ="expires" content="0" >
<meta http-equiv ="keywords" content="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content="This is my page" >
<!-- 打印时下列方法生效 -->
<style media ="print" >
<!--
. Noprint{display: none;}
.PageN ext{pag e-break-after:always;}
-->
</style>
<style type ="text/css" >
<!--
.STYLE1 {font-size : 12px }
-->
.div {
height:50xp;
}
</style>
</head>
<body>
<!-- <table border ='8' width="500" height="500" >
<tr> <td>haha</td><td>haha</td><td>haha</td><td>haha</td></tr>
<tr><td></ td><td></ td><td></ td><td></ td></tr>
<tr><td></ td><td></ td><td></ td><td></ td></tr>
</table> -->
<table>
<tr> <td><h3>来访人:</h3></td><td><h3>张三</h3></td></tr>
<tr><td><h3>身份证号:</h3></td><td><h3>000000000000000000</h3></td></tr>
<tr><td><h3>来访人数:</h3></td><td><h3>2</h3></td></tr>
<tr><td><h3>来访事由:</h3></td><td><h3>参观学习</h3></td></tr>
<tr><td><h3>来访车辆:</h3></td><td><h3>冀cxxxxx</h3></td></tr>
<tr><td><h3>被部门:</h3></td><td><h3>行政部</h3></td></tr>
<tr><td><h3>被访人:</h3></td><td><h3>王主任</h3></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td><img src="D:/code/qrcode.png"/></td></tr>
</table>
<p class ="dis" align="center" >
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0
id= "WebBrowser" width=0>
</OBJECT>
<input id = "1" name =Button onClick=document.all.WebBrowser.ExecWB(1,1) class="Noprint" type=button value=打开 />
<input id = "2" name =Button onClick=document.all.WebBrowser.ExecWB(2,1) class="Noprint" type=button value=关闭所有 >
<input id = "3" name =Button onClick=document.all.WebBrowser.ExecWB(4,1) class="Noprint" type=button value=另存为 >
<input id = "4" name =Button onClick=document.all.WebBrowser.ExecWB(6,1) class="Noprint" type=button value=打印 >
<input id = "5" name =Button onClick=document.all.WebBrowser.ExecWB(6,6) class="Noprint" type=button value=直接打印 >
<input id = "6" name =Button onClick='displayHide_control()'
class="Noprint" type=button value=打印预览 >
<script language="javascript" type="text/javascript">
function displayHide_control()
{
var _control = document.getElementById("1");
_control.style.display="none";
var _control2 = document.getElementById("2");
_control2.style.display="none";
var _control3 = document.getElementById("3");
_control3.style.display="none";
var _control4 = document.getElementById("4");
_control4.style.display="none";
var _control5 = document.getElementById("5");
_control5.style.display="none";
var _control6 = document.getElementById("6");
_control6.style.display="none";
var _control7 = document.getElementById("7");
_control7.style.display="none";
var _control8 = document.getElementById("8");
_control8.style.display="none";
var _control9 = document.getElementById("9");
_control9.style.display="none";
var _control10 = document.getElementById("10");
_control10.style.display="none";
var _control11 = document.getElementById("11");
_control11.style.display="none";
document.all.WebBrowser.ExecWB(7,1);
}
</script>
<input id = "7" name =Button onClick=document.all.WebBrowser.ExecWB(8,1) class="Noprint" type=button value=页面设置 >
<input id = "8" name =Button onClick=document.all.WebBrowser.ExecWB(10,1) class="Noprint" type=button value=属性 >
<input id = "9" name =Button onClick=document.all.WebBrowser.ExecWB(17,1) class="Noprint" type=button value=全选 >
<input id = "10" name =Button onClick=document.all.WebBrowser.ExecWB(22,1) class="Noprint" type=button value=刷新 >
<input id = "11" name =Button onClick=document.all.WebBrowser.ExecWB(45,1) class="Noprint" type=button value=关闭 >
</p>
</body>
</html>
\ No newline at end of file
/123.jpg
/applicationContext.xml
/com/
/cssconfig.properties
/jdbc.properties
/libarcsoft_fsdk_face_detection.dll
/libarcsoft_fsdk_face_recognition.dll
/log4j.properties
/mybatis-config.xml
/spring-mvc.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- 数据库驱动 -->
<classPathEntry location="mysql-connector-java-5.1.13-bin.jar" />
<context id="DB2Tables" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="true" />
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
</commentGenerator>
<!--数据库链接URL,用户名、密码 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://58.30.212.112/YXPDB" userId="zhanghanyu"
password="5tgb*UHB">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- 生成模型的包名和位置 -->
<javaModelGenerator targetPackage="com.yxp.demo.entity"
targetProject="src">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- 生成映射文件的包名和位置 -->
<sqlMapGenerator targetPackage="com.yxp.demo.dao"
targetProject="src">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!-- 生成DAO的包名和位置 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.yxp.demo.dao" targetProject="src">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名 -->
<table tableName="sys_user" domainObjectName="User"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"></table>
</context>
</generatorConfiguration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>access</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>encoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
\ No newline at end of file
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP '1.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<form action="findEmployee" method="post"><br>
姓名<input type="text" name="username"><br>
职位<input type="text" name="dept"><br>
<input type="submit" value="提交">
</form>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'findPerson.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<form action="findPerson" method="post">
访客姓名:<input type="text" name="username"><br>
身份证号:<input type="text" name="idcard"><br>
访客图像:<input type="text" name="photo"><br>
<input type="submit" value="提交">
</form>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>flash上传头像组件演示</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function uploadevent(status) {
status += '';
switch (status) {
case '1': //根据返回状态,进行相关信息处理
var time = new Date().getTime();
/* document.getElementById('avatar_priview').innerHTML = "头像1 : <img src='1.png?"
+ time
+ "'/> <br/> 头像2: <img src='2.png?"
+ time
+ "'/><br/> 头像3: <img src='3.png?" + time + "'/>"; */
break;
break;
case '-1':
window.location.reload();
break;
default:
window.location.reload();
}
}
</script>
</head>
<body>
hahahahh
<center>本例子只作为案例解说,如需知更多内容请登陆官网:http://www.hdfu.net/</center>
<hr>
<EMBED src="<%=basePath%>upload_puglin/avatar.swf" quality=high
bgcolor=#FFFFFF WIDTH="650" HEIGHT="450" wmode="transparent"
flashVars="imgUrl=<%=basePath%>upload_puglin/default.jpg&uploadUrl=<%=basePath%>upPhoto?pm=66&id=130321uploadSrc=false"
NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash"
allowScriptAccess="always"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
</EMBED>
<%-- ${photourl}
${photourl1}
${sessionScope.photourl1} --%>
<br>
<%
if(request.getSession().getAttribute("photourl")!=null)
{
out.println(request.getSession().getAttribute("photourl"));
}
%>
<a href="saveReserve" >yuyue</a>
</body>
</html>
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>单图片上传</title>
<script type="text/javascript" src="js/jquery-1.8.3.min.js">
</script>
<script type="text/javascript">
$(function() {
$("button").click(function() {
alert("ahshd");
});
})
</script>
</head>
<body>
<form action="photoUpload" method="post" enctype="multipart/form-data">
选择文件:<input type="file" name="file">
</form>
<br>
<button>dianwo</button>
<fieldset>
<legend>图片上传</legend>
<h2>只能上传单张10M以下的 PNG、JPG、GIF 格式的图片</h2>
<form action="photoUpload" method="post" enctype="multipart/form-data">
选择文件:<input type="file" name="file"> <input type="submit"
value="上传">
</form>
</fieldset>
</body>
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/*! jQuery v1.8.3 jquery.com | jquery.org/license */
(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,i=1-r,s=0,o=f.tweens.length;for(;s<o;s++)f.tweens[s].run(i);return u.notifyWith(e,[f,i,n]),i<1&&o?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c,h=this,p=e.style,d={},m=[],g=e.nodeType&&Gt(e);n.queue||(l=v._queueHooks(e,"fx"),l.unqueued==null&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,v.queue(e,"fx").length||l.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?p.display="inline-block":p.zoom=1)),n.overflow&&(p.overflow="hidden",v.support.shrinkWrapBlocks||h.done(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r],a=a||s==="toggle";if(s===(g?"hide":"show"))continue;m.push(r)}}o=m.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),"hidden"in u&&(g=u.hidden),a&&(u.hidden=!g),g?v(e).show():h.done(function(){v(e).hide()}),h.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in d)v.style(e,t,d[t])});for(r=0;r<o;r++)i=m[r],f=h.createTween(i,g?u[i]:0),d[i]=u[i]||v.style(e,i),i in u||(u[i]=f.start,g&&(f.end=f.start,f.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call("\ufeff\u00a0")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":(e+"").replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")||(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)s.indexOf(" "+t[o]+" ")<0&&(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(v.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!v.nodeName(n.parentNode,"optgroup"))){t=v(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,c,h,p,d=(v._data(this,"events")||{})[n.type]||[],m=d.delegateCount,g=l.call(arguments),y=!n.exclusive&&!n.namespace,b=v.event.special[n.type]||{},w=[];g[0]=n,n.delegateTarget=this;if(b.preDispatch&&b.preDispatch.call(this,n)===!1)return;if(m&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<m;r++)c=d[r],h=c.selector,u[h]===t&&(u[h]=c.needsContext?v(h,this).index(s)>=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r<w.length&&!n.isPropagationStopped();r++){a=w[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){c=a.matches[i];if(y||!n.namespace&&!c.namespace||n.namespace_re&&n.namespace_re.test(c.namespace))n.data=c.data,n.handleObj=c,o=((v.event.special[c.origType]||{}).handle||c.handler).apply(a.elem,g),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return b.postDispatch&&b.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function ct(e,t,n,r,i,s){return r&&!r[d]&&(r=ct(r)),i&&!i[d]&&(i=ct(i,s)),N(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||dt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?lt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=lt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?T.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[at(ft(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[d]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return ct(a>1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a<r&&ht(e.slice(a,r)),r<s&&ht(e=e.slice(r)),r<s&&e.join(""))}h.push(n)}return ft(h)}function pt(e,t){var r=t.length>0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r<i;r++)nt(e,t[r],n);return n}function vt(e,t,n,r,s){var o,u,f,l,c,h=ut(e),p=h.length;if(!r&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},N=function(e,t){return e[d]=t==null||t,e},C=function(){var e={},t=[];return N(function(n,r){return t.push(n)>i.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:st(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:st(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},f=y.compareDocumentPosition?function(e,t){return e===t?(l=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return l=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return ot(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return ot(i[f],s[f]);return f===n?ot(e,s[f],-1):ot(i[f],t,1)},[0,0].sort(f),h=!l,nt.uniqueSort=function(e){var t,n=[],r=1,i=0;l=h,e.sort(f);if(l){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e},nt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},a=nt.compile=function(e,t){var n,r=[],i=[],s=A[d][e+" "];if(!s){t||(t=ut(e)),n=t.length;while(n--)s=ht(t[n]),s[d]?r.push(s):i.push(s);s=A(e,pt(i,r))}return s},g.querySelectorAll&&function(){var e,t=vt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],s=[":active"],u=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector;K(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,n=v.timers,r=0;qn=v.now();for(;r<n.length;r++)e=n[r],!e()&&n[r]===e&&n.splice(r--,1);n.length||v.fx.stop(),qn=t},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f={top:0,left:0},l=this[0],c=l&&l.ownerDocument;if(!c)return;return(r=c.body)===l?v.offset.bodyOffset(l):(n=c.documentElement,v.contains(n,l)?(typeof l.getBoundingClientRect!="undefined"&&(f=l.getBoundingClientRect()),i=tr(c),s=n.clientTop||r.clientTop||0,o=n.clientLeft||r.clientLeft||0,u=i.pageYOffset||n.scrollTop,a=i.pageXOffset||n.scrollLeft,{top:f.top+u-s,left:f.left+a-o}):f)},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window);
\ No newline at end of file
/*!
* jQuery Form Plugin
* version: 3.50.0-2014.02.05
* Requires jQuery v1.5 or later
* Copyright (c) 2013 M. Alsup
* Examples and documentation at: http://malsup.com/jquery/form/
* Project repository: https://github.com/malsup/form
* Dual licensed under the MIT and GPL licenses.
* https://github.com/malsup/form#copyright-and-license
*/
/*global ActiveXObject */
// AMD support
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
// using AMD; register as anon module
define(['jquery'], factory);
} else {
// no AMD; invoke directly
factory( (typeof(jQuery) != 'undefined') ? jQuery : window.Zepto );
}
}
(function($) {
"use strict";
/*
Usage Note:
-----------
Do not use both ajaxSubmit and ajaxForm on the same form. These
functions are mutually exclusive. Use ajaxSubmit if you want
to bind your own submit handler to the form. For example,
$(document).ready(function() {
$('#myForm').on('submit', function(e) {
e.preventDefault(); // <-- important
$(this).ajaxSubmit({
target: '#output'
});
});
});
Use ajaxForm when you want the plugin to manage all the event binding
for you. For example,
$(document).ready(function() {
$('#myForm').ajaxForm({
target: '#output'
});
});
You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
form does not have to exist when you invoke ajaxForm:
$('#myForm').ajaxForm({
delegation: true,
target: '#output'
});
When using ajaxForm, the ajaxSubmit function will be invoked for you
at the appropriate time.
*/
/**
* Feature detection
*/
var feature = {};
feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
feature.formdata = window.FormData !== undefined;
var hasProp = !!$.fn.prop;
// attr2 uses prop when it can but checks the return type for
// an expected string. this accounts for the case where a form
// contains inputs with names like "action" or "method"; in those
// cases "prop" returns the element
$.fn.attr2 = function() {
if ( ! hasProp ) {
return this.attr.apply(this, arguments);
}
var val = this.prop.apply(this, arguments);
if ( ( val && val.jquery ) || typeof val === 'string' ) {
return val;
}
return this.attr.apply(this, arguments);
};
/**
* ajaxSubmit() provides a mechanism for immediately submitting
* an HTML form using AJAX.
*/
$.fn.ajaxSubmit = function(options) {
/*jshint scripturl:true */
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
if (!this.length) {
log('ajaxSubmit: skipping submit process - no element selected');
return this;
}
var method, action, url, $form = this;
if (typeof options == 'function') {
options = { success: options };
}
else if ( options === undefined ) {
options = {};
}
method = options.type || this.attr2('method');
action = options.url || this.attr2('action');
url = (typeof action === 'string') ? $.trim(action) : '';
url = url || window.location.href || '';
if (url) {
// clean url (don't include hash vaue)
url = (url.match(/^([^#]+)/)||[])[1];
}
options = $.extend(true, {
url: url,
success: $.ajaxSettings.success,
type: method || $.ajaxSettings.type,
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
}, options);
// hook for manipulating the form data before it is extracted;
// convenient for use with rich editors like tinyMCE or FCKEditor
var veto = {};
this.trigger('form-pre-serialize', [this, options, veto]);
if (veto.veto) {
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
return this;
}
// provide opportunity to alter form data before it is serialized
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSerialize callback');
return this;
}
var traditional = options.traditional;
if ( traditional === undefined ) {
traditional = $.ajaxSettings.traditional;
}
var elements = [];
var qx, a = this.formToArray(options.semantic, elements);
if (options.data) {
options.extraData = options.data;
qx = $.param(options.data, traditional);
}
// give pre-submit callback an opportunity to abort the submit
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSubmit callback');
return this;
}
// fire vetoable 'validate' event
this.trigger('form-submit-validate', [a, this, options, veto]);
if (veto.veto) {
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
return this;
}
var q = $.param(a, traditional);
if (qx) {
q = ( q ? (q + '&' + qx) : qx );
}
if (options.type.toUpperCase() == 'GET') {
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
options.data = null; // data is null for 'get'
}
else {
options.data = q; // data is the query string for 'post'
}
var callbacks = [];
if (options.resetForm) {
callbacks.push(function() { $form.resetForm(); });
}
if (options.clearForm) {
callbacks.push(function() { $form.clearForm(options.includeHidden); });
}
// perform a load on the target only if dataType is not provided
if (!options.dataType && options.target) {
var oldSuccess = options.success || function(){};
callbacks.push(function(data) {
var fn = options.replaceTarget ? 'replaceWith' : 'html';
$(options.target)[fn](data).each(oldSuccess, arguments);
});
}
else if (options.success) {
callbacks.push(options.success);
}
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
var context = options.context || this ; // jQuery 1.4+ supports scope context
for (var i=0, max=callbacks.length; i < max; i++) {
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
}
};
if (options.error) {
var oldError = options.error;
options.error = function(xhr, status, error) {
var context = options.context || this;
oldError.apply(context, [xhr, status, error, $form]);
};
}
if (options.complete) {
var oldComplete = options.complete;
options.complete = function(xhr, status) {
var context = options.context || this;
oldComplete.apply(context, [xhr, status, $form]);
};
}
// are there files to upload?
// [value] (issue #113), also see comment:
// https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219
var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() !== ''; });
var hasFileInputs = fileInputs.length > 0;
var mp = 'multipart/form-data';
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
var fileAPI = feature.fileapi && feature.formdata;
log("fileAPI :" + fileAPI);
var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
var jqxhr;
// options.iframe allows user to force iframe mode
// 06-NOV-09: now defaulting to iframe mode if file input is detected
if (options.iframe !== false && (options.iframe || shouldUseFrame)) {
// hack to fix Safari hang (thanks to Tim Molendijk for this)
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
if (options.closeKeepAlive) {
$.get(options.closeKeepAlive, function() {
jqxhr = fileUploadIframe(a);
});
}
else {
jqxhr = fileUploadIframe(a);
}
}
else if ((hasFileInputs || multipart) && fileAPI) {
jqxhr = fileUploadXhr(a);
}
else {
jqxhr = $.ajax(options);
}
$form.removeData('jqxhr').data('jqxhr', jqxhr);
// clear element array
for (var k=0; k < elements.length; k++) {
elements[k] = null;
}
// fire 'notify' event
this.trigger('form-submit-notify', [this, options]);
return this;
// utility fn for deep serialization
function deepSerialize(extraData){
var serialized = $.param(extraData, options.traditional).split('&');
var len = serialized.length;
var result = [];
var i, part;
for (i=0; i < len; i++) {
// #252; undo param space replacement
serialized[i] = serialized[i].replace(/\+/g,' ');
part = serialized[i].split('=');
// #278; use array instead of object storage, favoring array serializations
result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
}
return result;
}
// XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)
function fileUploadXhr(a) {
var formdata = new FormData();
for (var i=0; i < a.length; i++) {
formdata.append(a[i].name, a[i].value);
}
if (options.extraData) {
var serializedData = deepSerialize(options.extraData);
for (i=0; i < serializedData.length; i++) {
if (serializedData[i]) {
formdata.append(serializedData[i][0], serializedData[i][1]);
}
}
}
options.data = null;
var s = $.extend(true, {}, $.ajaxSettings, options, {
contentType: false,
processData: false,
cache: false,
type: method || 'POST'
});
if (options.uploadProgress) {
// workaround because jqXHR does not expose upload property
s.xhr = function() {
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
xhr.upload.addEventListener('progress', function(event) {
var percent = 0;
var position = event.loaded || event.position; /*event.position is deprecated*/
var total = event.total;
if (event.lengthComputable) {
percent = Math.ceil(position / total * 100);
}
options.uploadProgress(event, position, total, percent);
}, false);
}
return xhr;
};
}
s.data = null;
var beforeSend = s.beforeSend;
s.beforeSend = function(xhr, o) {
//Send FormData() provided by user
if (options.formData) {
o.data = options.formData;
}
else {
o.data = formdata;
}
if(beforeSend) {
beforeSend.call(this, xhr, o);
}
};
return $.ajax(s);
}
// private function for handling file uploads (hat tip to YAHOO!)
function fileUploadIframe(a) {
var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
var deferred = $.Deferred();
// #341
deferred.abort = function(status) {
xhr.abort(status);
};
if (a) {
// ensure that every serialized input is still enabled
for (i=0; i < elements.length; i++) {
el = $(elements[i]);
if ( hasProp ) {
el.prop('disabled', false);
}
else {
el.removeAttr('disabled');
}
}
}
s = $.extend(true, {}, $.ajaxSettings, options);
s.context = s.context || s;
id = 'jqFormIO' + (new Date().getTime());
if (s.iframeTarget) {
$io = $(s.iframeTarget);
n = $io.attr2('name');
if (!n) {
$io.attr2('name', id);
}
else {
id = n;
}
}
else {
$io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
}
io = $io[0];
xhr = { // mock object
aborted: 0,
responseText: null,
responseXML: null,
status: 0,
statusText: 'n/a',
getAllResponseHeaders: function() {},
getResponseHeader: function() {},
setRequestHeader: function() {},
abort: function(status) {
var e = (status === 'timeout' ? 'timeout' : 'aborted');
log('aborting upload... ' + e);
this.aborted = 1;
try { // #214, #257
if (io.contentWindow.document.execCommand) {
io.contentWindow.document.execCommand('Stop');
}
}
catch(ignore) {}
$io.attr('src', s.iframeSrc); // abort op in progress
xhr.error = e;
if (s.error) {
s.error.call(s.context, xhr, e, status);
}
if (g) {
$.event.trigger("ajaxError", [xhr, s, e]);
}
if (s.complete) {
s.complete.call(s.context, xhr, e);
}
}
};
g = s.global;
// trigger ajax global events so that activity/block indicators work like normal
if (g && 0 === $.active++) {
$.event.trigger("ajaxStart");
}
if (g) {
$.event.trigger("ajaxSend", [xhr, s]);
}
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
if (s.global) {
$.active--;
}
deferred.reject();
return deferred;
}
if (xhr.aborted) {
deferred.reject();
return deferred;
}
// add submitting element to data if we know it
sub = form.clk;
if (sub) {
n = sub.name;
if (n && !sub.disabled) {
s.extraData = s.extraData || {};
s.extraData[n] = sub.value;
if (sub.type == "image") {
s.extraData[n+'.x'] = form.clk_x;
s.extraData[n+'.y'] = form.clk_y;
}
}
}
var CLIENT_TIMEOUT_ABORT = 1;
var SERVER_ABORT = 2;
function getDoc(frame) {
/* it looks like contentWindow or contentDocument do not
* carry the protocol property in ie8, when running under ssl
* frame.document is the only valid response document, since
* the protocol is know but not on the other two objects. strange?
* "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy
*/
var doc = null;
// IE8 cascading access check
try {
if (frame.contentWindow) {
doc = frame.contentWindow.document;
}
} catch(err) {
// IE8 access denied under ssl & missing protocol
log('cannot get iframe.contentWindow document: ' + err);
}
if (doc) { // successful getting content
return doc;
}
try { // simply checking may throw in ie8 under ssl or mismatched protocol
doc = frame.contentDocument ? frame.contentDocument : frame.document;
} catch(err) {
// last attempt
log('cannot get iframe.contentDocument: ' + err);
doc = frame.document;
}
return doc;
}
// Rails CSRF hack (thanks to Yvan Barthelemy)
var csrf_token = $('meta[name=csrf-token]').attr('content');
var csrf_param = $('meta[name=csrf-param]').attr('content');
if (csrf_param && csrf_token) {
s.extraData = s.extraData || {};
s.extraData[csrf_param] = csrf_token;
}
// take a breath so that pending repaints get some cpu time before the upload starts
function doSubmit() {
// make sure form attrs are set
var t = $form.attr2('target'),
a = $form.attr2('action'),
mp = 'multipart/form-data',
et = $form.attr('enctype') || $form.attr('encoding') || mp;
// update form attrs in IE friendly way
form.setAttribute('target',id);
if (!method || /post/i.test(method) ) {
form.setAttribute('method', 'POST');
}
if (a != s.url) {
form.setAttribute('action', s.url);
}
// ie borks in some cases when setting encoding
if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
$form.attr({
encoding: 'multipart/form-data',
enctype: 'multipart/form-data'
});
}
// support timout
if (s.timeout) {
timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
}
// look for server aborts
function checkState() {
try {
var state = getDoc(io).readyState;
log('state = ' + state);
if (state && state.toLowerCase() == 'uninitialized') {
setTimeout(checkState,50);
}
}
catch(e) {
log('Server abort: ' , e, ' (', e.name, ')');
cb(SERVER_ABORT);
if (timeoutHandle) {
clearTimeout(timeoutHandle);
}
timeoutHandle = undefined;
}
}
// add "extra" data to form if provided in options
var extraInputs = [];
try {
if (s.extraData) {
for (var n in s.extraData) {
if (s.extraData.hasOwnProperty(n)) {
// if using the $.param format that allows for multiple values with the same name
if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
extraInputs.push(
$('<input type="hidden" name="'+s.extraData[n].name+'">').val(s.extraData[n].value)
.appendTo(form)[0]);
} else {
extraInputs.push(
$('<input type="hidden" name="'+n+'">').val(s.extraData[n])
.appendTo(form)[0]);
}
}
}
}
if (!s.iframeTarget) {
// add iframe to doc and submit the form
$io.appendTo('body');
}
if (io.attachEvent) {
io.attachEvent('onload', cb);
}
else {
io.addEventListener('load', cb, false);
}
setTimeout(checkState,15);
try {
form.submit();
} catch(err) {
// just in case form has element with name/id of 'submit'
var submitFn = document.createElement('form').submit;
submitFn.apply(form);
}
}
finally {
// reset attrs and remove "extra" input elements
form.setAttribute('action',a);
form.setAttribute('enctype', et); // #380
if(t) {
form.setAttribute('target', t);
} else {
$form.removeAttr('target');
}
$(extraInputs).remove();
}
}
if (s.forceSync) {
doSubmit();
}
else {
setTimeout(doSubmit, 10); // this lets dom updates render
}
var data, doc, domCheckCount = 50, callbackProcessed;
function cb(e) {
if (xhr.aborted || callbackProcessed) {
return;
}
doc = getDoc(io);
if(!doc) {
log('cannot access response document');
e = SERVER_ABORT;
}
if (e === CLIENT_TIMEOUT_ABORT && xhr) {
xhr.abort('timeout');
deferred.reject(xhr, 'timeout');
return;
}
else if (e == SERVER_ABORT && xhr) {
xhr.abort('server abort');
deferred.reject(xhr, 'error', 'server abort');
return;
}
if (!doc || doc.location.href == s.iframeSrc) {
// response not received yet
if (!timedOut) {
return;
}
}
if (io.detachEvent) {
io.detachEvent('onload', cb);
}
else {
io.removeEventListener('load', cb, false);
}
var status = 'success', errMsg;
try {
if (timedOut) {
throw 'timeout';
}
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
log('isXml='+isXml);
if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
if (--domCheckCount) {
// in some browsers (Opera) the iframe DOM is not always traversable when
// the onload callback fires, so we loop a bit to accommodate
log('requeing onLoad callback, DOM not available');
setTimeout(cb, 250);
return;
}
// let this fall through because server response could be an empty document
//log('Could not access iframe DOM after mutiple tries.');
//throw 'DOMException: not available';
}
//log('response detected');
var docRoot = doc.body ? doc.body : doc.documentElement;
xhr.responseText = docRoot ? docRoot.innerHTML : null;
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
if (isXml) {
s.dataType = 'xml';
}
xhr.getResponseHeader = function(header){
var headers = {'content-type': s.dataType};
return headers[header.toLowerCase()];
};
// support for XHR 'status' & 'statusText' emulation :
if (docRoot) {
xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
}
var dt = (s.dataType || '').toLowerCase();
var scr = /(json|script|text)/.test(dt);
if (scr || s.textarea) {
// see if user embedded response in textarea
var ta = doc.getElementsByTagName('textarea')[0];
if (ta) {
xhr.responseText = ta.value;
// support for XHR 'status' & 'statusText' emulation :
xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
}
else if (scr) {
// account for browsers injecting pre around json response
var pre = doc.getElementsByTagName('pre')[0];
var b = doc.getElementsByTagName('body')[0];
if (pre) {
xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
}
else if (b) {
xhr.responseText = b.textContent ? b.textContent : b.innerText;
}
}
}
else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
xhr.responseXML = toXml(xhr.responseText);
}
try {
data = httpData(xhr, dt, s);
}
catch (err) {
status = 'parsererror';
xhr.error = errMsg = (err || status);
}
}
catch (err) {
log('error caught: ',err);
status = 'error';
xhr.error = errMsg = (err || status);
}
if (xhr.aborted) {
log('upload aborted');
status = null;
}
if (xhr.status) { // we've set xhr.status
status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
}
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
if (status === 'success') {
if (s.success) {
s.success.call(s.context, data, 'success', xhr);
}
deferred.resolve(xhr.responseText, 'success', xhr);
if (g) {
$.event.trigger("ajaxSuccess", [xhr, s]);
}
}
else if (status) {
if (errMsg === undefined) {
errMsg = xhr.statusText;
}
if (s.error) {
s.error.call(s.context, xhr, status, errMsg);
}
deferred.reject(xhr, 'error', errMsg);
if (g) {
$.event.trigger("ajaxError", [xhr, s, errMsg]);
}
}
if (g) {
$.event.trigger("ajaxComplete", [xhr, s]);
}
if (g && ! --$.active) {
$.event.trigger("ajaxStop");
}
if (s.complete) {
s.complete.call(s.context, xhr, status);
}
callbackProcessed = true;
if (s.timeout) {
clearTimeout(timeoutHandle);
}
// clean up
setTimeout(function() {
if (!s.iframeTarget) {
$io.remove();
}
else { //adding else to clean up existing iframe response.
$io.attr('src', s.iframeSrc);
}
xhr.responseXML = null;
}, 100);
}
var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
if (window.ActiveXObject) {
doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = 'false';
doc.loadXML(s);
}
else {
doc = (new DOMParser()).parseFromString(s, 'text/xml');
}
return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
};
var parseJSON = $.parseJSON || function(s) {
/*jslint evil:true */
return window['eval']('(' + s + ')');
};
var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
var ct = xhr.getResponseHeader('content-type') || '',
xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
data = xml ? xhr.responseXML : xhr.responseText;
if (xml && data.documentElement.nodeName === 'parsererror') {
if ($.error) {
$.error('parsererror');
}
}
if (s && s.dataFilter) {
data = s.dataFilter(data, type);
}
if (typeof data === 'string') {
if (type === 'json' || !type && ct.indexOf('json') >= 0) {
data = parseJSON(data);
} else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
$.globalEval(data);
}
}
return data;
};
return deferred;
}
};
/**
* ajaxForm() provides a mechanism for fully automating form submission.
*
* The advantages of using this method instead of ajaxSubmit() are:
*
* 1: This method will include coordinates for <input type="image" /> elements (if the element
* is used to submit the form).
* 2. This method will include the submit element's name/value data (for the element that was
* used to submit the form).
* 3. This method binds the submit() method to the form for you.
*
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
* passes the options argument along after properly binding events for submit elements and
* the form itself.
*/
$.fn.ajaxForm = function(options) {
options = options || {};
options.delegation = options.delegation && $.isFunction($.fn.on);
// in jQuery 1.3+ we can fix mistakes with the ready state
if (!options.delegation && this.length === 0) {
var o = { s: this.selector, c: this.context };
if (!$.isReady && o.s) {
log('DOM not ready, queuing ajaxForm');
$(function() {
$(o.s,o.c).ajaxForm(options);
});
return this;
}
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
return this;
}
if ( options.delegation ) {
$(document)
.off('submit.form-plugin', this.selector, doAjaxSubmit)
.off('click.form-plugin', this.selector, captureSubmittingElement)
.on('submit.form-plugin', this.selector, options, doAjaxSubmit)
.on('click.form-plugin', this.selector, options, captureSubmittingElement);
return this;
}
return this.ajaxFormUnbind()
.bind('submit.form-plugin', options, doAjaxSubmit)
.bind('click.form-plugin', options, captureSubmittingElement);
};
// private event handlers
function doAjaxSubmit(e) {
/*jshint validthis:true */
var options = e.data;
if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
e.preventDefault();
$(e.target).ajaxSubmit(options); // #365
}
}
function captureSubmittingElement(e) {
/*jshint validthis:true */
var target = e.target;
var $el = $(target);
if (!($el.is("[type=submit],[type=image]"))) {
// is this a child element of the submit el? (ex: a span within a button)
var t = $el.closest('[type=submit]');
if (t.length === 0) {
return;
}
target = t[0];
}
var form = this;
form.clk = target;
if (target.type == 'image') {
if (e.offsetX !== undefined) {
form.clk_x = e.offsetX;
form.clk_y = e.offsetY;
} else if (typeof $.fn.offset == 'function') {
var offset = $el.offset();
form.clk_x = e.pageX - offset.left;
form.clk_y = e.pageY - offset.top;
} else {
form.clk_x = e.pageX - target.offsetLeft;
form.clk_y = e.pageY - target.offsetTop;
}
}
// clear form vars
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
}
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
return this.unbind('submit.form-plugin click.form-plugin');
};
/**
* formToArray() gathers form element data into an array of objects that can
* be passed to any of the following ajax functions: $.get, $.post, or load.
* Each object in the array has both a 'name' and 'value' property. An example of
* an array for a simple login form might be:
*
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
*
* It is this array that is passed to pre-submit callback functions provided to the
* ajaxSubmit() and ajaxForm() methods.
*/
$.fn.formToArray = function(semantic, elements) {
var a = [];
if (this.length === 0) {
return a;
}
var form = this[0];
var formId = this.attr('id');
var els = semantic ? form.getElementsByTagName('*') : form.elements;
var els2;
if (els && !/MSIE [678]/.test(navigator.userAgent)) { // #390
els = $(els).get(); // convert to standard array
}
// #386; account for inputs outside the form which use the 'form' attribute
if ( formId ) {
els2 = $(':input[form=' + formId + ']').get();
if ( els2.length ) {
els = (els || []).concat(els2);
}
}
if (!els || !els.length) {
return a;
}
var i,j,n,v,el,max,jmax;
for(i=0, max=els.length; i < max; i++) {
el = els[i];
n = el.name;
if (!n || el.disabled) {
continue;
}
if (semantic && form.clk && el.type == "image") {
// handle image inputs on the fly when semantic == true
if(form.clk == el) {
a.push({name: n, value: $(el).val(), type: el.type });
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
continue;
}
v = $.fieldValue(el, true);
if (v && v.constructor == Array) {
if (elements) {
elements.push(el);
}
for(j=0, jmax=v.length; j < jmax; j++) {
a.push({name: n, value: v[j]});
}
}
else if (feature.fileapi && el.type == 'file') {
if (elements) {
elements.push(el);
}
var files = el.files;
if (files.length) {
for (j=0; j < files.length; j++) {
a.push({name: n, value: files[j], type: el.type});
}
}
else {
// #180
a.push({ name: n, value: '', type: el.type });
}
}
else if (v !== null && typeof v != 'undefined') {
if (elements) {
elements.push(el);
}
a.push({name: n, value: v, type: el.type, required: el.required});
}
}
if (!semantic && form.clk) {
// input type=='image' are not found in elements array! handle it here
var $input = $(form.clk), input = $input[0];
n = input.name;
if (n && !input.disabled && input.type == 'image') {
a.push({name: n, value: $input.val()});
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
}
return a;
};
/**
* Serializes form data into a 'submittable' string. This method will return a string
* in the format: name1=value1&amp;name2=value2
*/
$.fn.formSerialize = function(semantic) {
//hand off to jQuery.param for proper encoding
return $.param(this.formToArray(semantic));
};
/**
* Serializes all field elements in the jQuery object into a query string.
* This method will return a string in the format: name1=value1&amp;name2=value2
*/
$.fn.fieldSerialize = function(successful) {
var a = [];
this.each(function() {
var n = this.name;
if (!n) {
return;
}
var v = $.fieldValue(this, successful);
if (v && v.constructor == Array) {
for (var i=0,max=v.length; i < max; i++) {
a.push({name: n, value: v[i]});
}
}
else if (v !== null && typeof v != 'undefined') {
a.push({name: this.name, value: v});
}
});
//hand off to jQuery.param for proper encoding
return $.param(a);
};
/**
* Returns the value(s) of the element in the matched set. For example, consider the following form:
*
* <form><fieldset>
* <input name="A" type="text" />
* <input name="A" type="text" />
* <input name="B" type="checkbox" value="B1" />
* <input name="B" type="checkbox" value="B2"/>
* <input name="C" type="radio" value="C1" />
* <input name="C" type="radio" value="C2" />
* </fieldset></form>
*
* var v = $('input[type=text]').fieldValue();
* // if no values are entered into the text inputs
* v == ['','']
* // if values entered into the text inputs are 'foo' and 'bar'
* v == ['foo','bar']
*
* var v = $('input[type=checkbox]').fieldValue();
* // if neither checkbox is checked
* v === undefined
* // if both checkboxes are checked
* v == ['B1', 'B2']
*
* var v = $('input[type=radio]').fieldValue();
* // if neither radio is checked
* v === undefined
* // if first radio is checked
* v == ['C1']
*
* The successful argument controls whether or not the field element must be 'successful'
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
* The default value of the successful argument is true. If this value is false the value(s)
* for each element is returned.
*
* Note: This method *always* returns an array. If no valid value can be determined the
* array will be empty, otherwise it will contain one or more values.
*/
$.fn.fieldValue = function(successful) {
for (var val=[], i=0, max=this.length; i < max; i++) {
var el = this[i];
var v = $.fieldValue(el, successful);
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
continue;
}
if (v.constructor == Array) {
$.merge(val, v);
}
else {
val.push(v);
}
}
return val;
};
/**
* Returns the value of the field element.
*/
$.fieldValue = function(el, successful) {
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
if (successful === undefined) {
successful = true;
}
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
(t == 'checkbox' || t == 'radio') && !el.checked ||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
tag == 'select' && el.selectedIndex == -1)) {
return null;
}
if (tag == 'select') {
var index = el.selectedIndex;
if (index < 0) {
return null;
}
var a = [], ops = el.options;
var one = (t == 'select-one');
var max = (one ? index+1 : ops.length);
for(var i=(one ? index : 0); i < max; i++) {
var op = ops[i];
if (op.selected) {
var v = op.value;
if (!v) { // extra pain for IE...
v = (op.attributes && op.attributes.value && !(op.attributes.value.specified)) ? op.text : op.value;
}
if (one) {
return v;
}
a.push(v);
}
}
return a;
}
return $(el).val();
};
/**
* Clears the form data. Takes the following actions on the form's input fields:
* - input text fields will have their 'value' property set to the empty string
* - select elements will have their 'selectedIndex' property set to -1
* - checkbox and radio inputs will have their 'checked' property set to false
* - inputs of type submit, button, reset, and hidden will *not* be effected
* - button elements will *not* be effected
*/
$.fn.clearForm = function(includeHidden) {
return this.each(function() {
$('input,select,textarea', this).clearFields(includeHidden);
});
};
/**
* Clears the selected form elements.
*/
$.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
return this.each(function() {
var t = this.type, tag = this.tagName.toLowerCase();
if (re.test(t) || tag == 'textarea') {
this.value = '';
}
else if (t == 'checkbox' || t == 'radio') {
this.checked = false;
}
else if (tag == 'select') {
this.selectedIndex = -1;
}
else if (t == "file") {
if (/MSIE/.test(navigator.userAgent)) {
$(this).replaceWith($(this).clone(true));
} else {
$(this).val('');
}
}
else if (includeHidden) {
// includeHidden can be the value true, or it can be a selector string
// indicating a special test; for example:
// $('#myForm').clearForm('.special:hidden')
// the above would clean hidden inputs that have the class of 'special'
if ( (includeHidden === true && /hidden/.test(t)) ||
(typeof includeHidden == 'string' && $(this).is(includeHidden)) ) {
this.value = '';
}
}
});
};
/**
* Resets the form data. Causes all form elements to be reset to their original value.
*/
$.fn.resetForm = function() {
return this.each(function() {
// guard against an input with the name of 'reset'
// note that IE reports the reset function as an 'object'
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
this.reset();
}
});
};
/**
* Enables or disables any matching elements.
*/
$.fn.enable = function(b) {
if (b === undefined) {
b = true;
}
return this.each(function() {
this.disabled = !b;
});
};
/**
* Checks/unchecks any matching checkboxes or radio buttons and
* selects/deselects and matching option elements.
*/
$.fn.selected = function(select) {
if (select === undefined) {
select = true;
}
return this.each(function() {
var t = this.type;
if (t == 'checkbox' || t == 'radio') {
this.checked = select;
}
else if (this.tagName.toLowerCase() == 'option') {
var $sel = $(this).parent('select');
if (select && $sel[0] && $sel[0].type == 'select-one') {
// deselect all other options
$sel.find('option').selected(false);
}
this.selected = select;
}
});
};
// expose debug var
$.fn.ajaxSubmit.debug = false;
// helper fn for console logging
function log() {
if (!$.fn.ajaxSubmit.debug) {
return;
}
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
if (window.console && window.console.log) {
window.console.log(msg);
}
else if (window.opera && window.opera.postError) {
window.opera.postError(msg);
}
}
}));
.ui-pagination-container {
height: 34px;
line-height: 34px;
}
.ui-pagination-container .ui-pagination-page-item {
font-size: 14px;
padding: 4px 10px;
background: #fff;
border: 1px solid #c5b7b7;
color: #888;
margin: 0 3px;
text-decoration: none;
}
.ui-pagination-container .ui-pagination-page-item:hover {
border-color: #568dbd;
color: #568dbd;
text-decoration: none;
}
.ui-pagination-container .ui-pagination-page-item.active {
background: #568dbd;
border-color: #568dbd;
color: #fff;
cursor: default;
}
\ No newline at end of file
!function(t,a,e,i){var n=function(a,e){this.ele=a,this.defaults={currentPage:1,totalPage:10,isShow:!0,count:5,homePageText:"首页",endPageText:"尾页",prevPageText:"上一页",nextPageText:"下一页",callback:function(){}},this.opts=t.extend({},this.defaults,e),this.current=this.opts.currentPage,this.init()};n.prototype={init:function(){this.isRender=!0,this.render(),this.eventBind()},render:function(){var t=this.opts,a=this.current,e=t.totalPage,i=this.getPagesTpl();this.homePage='<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="1">'+t.homePageText+"</a>",this.prevPage='<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="'+(a-1)+'">'+t.prevPageText+"</a>",this.nextPage='<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="'+(a+1)+'">'+t.nextPageText+"</a>",this.endPage='<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="'+e+'">'+t.endPageText+"</a>",this.checkPage(),this.isRender&&this.ele.html("<div class='ui-pagination-container'>"+this.homePage+this.prevPage+i+this.nextPage+this.endPage+"</div>")},checkPage:function(){var t=this.opts,a=t.totalPage,e=this.current;t.isShow||(this.homePage=this.endPage=""),1===e&&(this.homePage=this.prevPage=""),e===a&&(this.endPage=this.nextPage=""),1===a&&(this.homePage=this.prevPage=this.endPage=this.nextPage=""),a<=1&&(this.isRender=!1)},getPagesTpl:function(){var t=this.opts,a=t.totalPage,e=this.current,i="",n=t.count;if(a<=n)for(g=1;g<=a;g++)i+=g===e?'<a href="javascript:void(0);" class="ui-pagination-page-item active" data-current="'+g+'">'+g+"</a>":'<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="'+g+'">'+g+"</a>";else{var s=n/2;if(e<=s)for(g=1;g<=n;g++)i+=g===e?'<a href="javascript:void(0);" class="ui-pagination-page-item active" data-current="'+g+'">'+g+"</a>":'<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="'+g+'">'+g+"</a>";else{var r=Math.floor(s),c=e+r,h=e-r,o=n%2==0;c>a&&(o?(h-=c-a-1,c=a+1):(h-=c-a,c=a)),o||c++;for(var g=h;g<c;g++)i+=g===e?'<a href="javascript:void(0);" class="ui-pagination-page-item active" data-current="'+g+'">'+g+"</a>":'<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="'+g+'">'+g+"</a>"}}return i},eventBind:function(){var a=this,e=this.opts.callback;this.ele.on("click",".ui-pagination-page-item",function(){var i=t(this).data("current");a.current!=i&&(a.current=i,a.render(),e&&"function"==typeof e&&e(i))})}},t.fn.pagination=function(t){return new n(this,t),this}}(jQuery,window,document);
\ No newline at end of file
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'saveEmployee.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<form action="saveEmployee" method="post" enctype="multipart/form-data">
访客姓名&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="username"><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="dept"><br>
联系电话&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="phone"><br>
选择照片 &nbsp;&nbsp;&nbsp;&nbsp;<input type="file" name="photourl"><br>
<input type="submit" value="提交">
</form>
<img alt="" src="http://172.16.103.171:9527/1507607221678.jpg">
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'saveEmployee.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<form action="savePerson" method="post">
访客姓名&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="username"><br>
身份证号&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="idcard"><br>
工作单位&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="unit"><br>
联系电话&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="phone"><br>
照片路径&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="photourl"><br>
被访人姓名:<input type="text" name="employee"><br>
车辆信息&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="car"><br>
访问原因&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="reason"><br>
是否预约&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="reserve"><br>
<input type="submit" value="提交">
</form>
</body>
</html>
<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*" to-ports="*"/>
</cross-domain-policy>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd">
<context:component-scan base-package="com.yx.service"/>
<!-- 加载数据库配置文件 -->
<context:property-placeholder location="classpath:jdbc.properties"/>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<!-- 数据库信息 -->
<property name="driverClass" value="${jdbc.driverClass}" />
<property name="jdbcUrl" value="${jdbc.jdbcUrl}" />
<property name="user" value="${jdbc.user}" />
<property name="password" value="${jdbc.password}" />
<!-- 池化信息 -->
<property name="initialPoolSize" value="${jdbc.initialPoolSize}" />
<property name="minPoolSize" value="${jdbc.minPoolSize}" />
<property name="maxPoolSize" value="${jdbc.maxPoolSize}" />
<property name="acquireIncrement" value="${jdbc.acquireIncrement}" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="configLocation" value="classpath:mybatis-config.xml"/>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.yx.dao"/>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
<tx:annotation-driven/>
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="insert*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="find*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="select*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="get*" propagation="SUPPORTS" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- aop -->
<aop:config>
<aop:advisor advice-ref="txAdvice"
pointcut="execution(* com.yx.service.*.*(..))"/>
</aop:config>
</beans>
\ No newline at end of file
#ServerURL=http://192.168.9.110:8000/signxmlhandler
ServerURL=http://192.168.1.13:8000/signserver/service/xml
#ServerURL=http://192.168.0.110:8000/signserver/service/xml
DigestAlg=sm3
#Encrypt Algorithm: des3/scb2
EncAlg=sm4
CertBaseInfo = version;issuerdn;subjectdn;serialnumber;notbefore;notafter
TSACertBaseInfo = issuerdn;subjectdn;serialnumber;signedTime;signedTSA;signedTimeByMS
CertExtendInfo =
AppID=
CertAlias =
BaseInfo =digestalg;digestdata;plaindata;dscert
SendMsgFormat=0
HashActionPosition=0
PrintLog=false
#console/file/log4j ####log4j not implement
logTarget=console
logFilePath=/temp/jit.dss.vstk.log
#rfc3161/rfc2630
TSAType=rfc3161
#dsCert/issuerDNAndSN/CertId
p1VerifyCertId=CertId
Compatible=true
dss.client.class=cn.com.jit.assp.client.DSSClientHttpUrlConnectionImpl
#dss.client.class=cn.com.jit.assp.client.DSSClientHttpClientImpl
#default/encAfterDec/secretEnvelop(use this mode after using VCTK do envelop) secretEnvelop:develop->RSAdecrypt->RSAencrypt->envelop
envelopType=default
#default unit KB and default size is 0,0 is not block;
packageSize=0
#default:10000 unit: ms
timeout=50000
connectTimeOut=50000
# default : system unicode
FileSystemCharSet=UTF-8
vstkVersion=20
EncryptMode=ecb
#package size every time, unit is byte
send_size=1048576
#bigger than this will take big data modle, unit is byte
bigdata_limit=20971520
\ No newline at end of file
#mysql connection infomation
jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.jdbcUrl=jdbc:mysql://123.57.35.186:3306/access?useUnicode=true&characterEncoding=UTF-8
jdbc.user=root
jdbc.password=yxkj123
#this c3p0 pool size information
jdbc.initialPoolSize=5
jdbc.minPoolSize=2
jdbc.maxPoolSize=10
jdbc.acquireIncrement=2
\ No newline at end of file
# Global logging configuration
log4j.rootLogger=ERROR, stdout
# MyBatis logging configuration...
log4j.logger.org.mybatis.example.BlogMapper=TRACE
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<typeAliases>
</typeAliases>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<mvc:annotation-driven />
<context:component-scan base-package="com.yx.controller" />
<!-- 配置视图解析器 -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/JSP/" />
<property name="suffix" value=".jsp" />
</bean>
<mvc:resources location="/scripts/" mapping="/scripts/**"></mvc:resources>
<mvc:resources location="/js/" mapping="/js/**"></mvc:resources>
<mvc:resources location="/upload_puglin/" mapping="/upload_puglin/**"></mvc:resources>
</beans>
\ No newline at end of file
#ServerURL=http://192.168.9.110:8000/signxmlhandler
ServerURL=http://192.168.1.13:8000/signserver/service/xml
#ServerURL=http://192.168.0.110:8000/signserver/service/xml
DigestAlg=sm3
#Encrypt Algorithm: des3/scb2
EncAlg=sm4
CertBaseInfo = version;issuerdn;subjectdn;serialnumber;notbefore;notafter
TSACertBaseInfo = issuerdn;subjectdn;serialnumber;signedTime;signedTSA;signedTimeByMS
CertExtendInfo =
AppID=
CertAlias =
BaseInfo =digestalg;digestdata;plaindata;dscert
SendMsgFormat=0
HashActionPosition=0
PrintLog=false
#console/file/log4j ####log4j not implement
logTarget=console
logFilePath=/temp/jit.dss.vstk.log
#rfc3161/rfc2630
TSAType=rfc3161
#dsCert/issuerDNAndSN/CertId
p1VerifyCertId=CertId
Compatible=true
dss.client.class=cn.com.jit.assp.client.DSSClientHttpUrlConnectionImpl
#dss.client.class=cn.com.jit.assp.client.DSSClientHttpClientImpl
#default/encAfterDec/secretEnvelop(use this mode after using VCTK do envelop) secretEnvelop:develop->RSAdecrypt->RSAencrypt->envelop
envelopType=default
#default unit KB and default size is 0,0 is not block;
packageSize=0
#default:10000 unit: ms
timeout=50000
connectTimeOut=50000
# default : system unicode
FileSystemCharSet=UTF-8
vstkVersion=20
EncryptMode=ecb
#package size every time, unit is byte
send_size=1048576
#bigger than this will take big data modle, unit is byte
bigdata_limit=20971520
\ No newline at end of file
img/1.png

205 KB

img/2.png

159 KB

img/3.png

119 KB

img/4.png

106 KB

img/a.jpg

32.2 KB

package com.yingxininfo.data;
import java.util.Arrays;
import com.yingxininfo.utils.FormatBytesUtil;
public class AuthenticationApplicationData {
// 客户号 8字节
private byte[] customerId;
// 终端号 2字节
private byte[] terminalId;
// 时间戳 4字节
private byte[] timestamp;
// 读卡控件版本 4字节
private byte[] readCardControlsVersion;
// 人像控件版本 4字节
private byte[] pictureControlsVersion;
// 证书序列号 32字节
private byte[] certificateNumber;
public AuthenticationApplicationData(byte[] customerId, byte[] terminalId, byte[] readCardControlsVersion,
byte[] pictureControlsVersion, byte[] certificateNumber) {
super();
this.customerId = customerId;
this.terminalId = terminalId;
this.timestamp = FormatBytesUtil.getTimestamp();
this.readCardControlsVersion = readCardControlsVersion;
this.pictureControlsVersion = pictureControlsVersion;
this.certificateNumber = certificateNumber;
}
public byte[] getAuthenticationApplicationData() {
byte[] data = FormatBytesUtil.concatAll(customerId, terminalId, timestamp, readCardControlsVersion,
pictureControlsVersion, certificateNumber);
System.out.println("身份认证申请数据区:" + Arrays.toString(data));
return data;
}
}
package com.yingxininfo.data;
import java.util.Arrays;
import com.yingxininfo.utils.FormatBytesUtil;
public class AuthenticationData {
// 客户号 8字节
private byte[] customerId;
// 终端号 2字节
private byte[] terminalId;
// 时间戳 4字节
private byte[] timestamp;
// 业务流水号 9字节
private byte[] streamNumber;
// 认证模式 1字节
private byte[] identityModel;
// ID验证数据字段及认证吗数据字段总长 2字节
private byte[] lengthOfTwo;
// ID验证数据长度 2字节
private byte[] lengthOfIdCheck;
// ID验证数据 变长 可为空
private byte[] idCheck;
// 认证码数据长度 2字节
private byte[] lengthOfVerification;
// 认证码数据 变长 可为空
private byte[] verification;
// 照片长度 4字节
private byte[] lengthOfPicture;
// 照片数据 变长 可为空
private byte[] picture;
// 认证申请保留数据长度 2字节
private byte[] lengthOfReservasion;
// 认证申请保留数据 变长 可为空
private byte[] reservation;
// 证书序列号 32字节
private byte[] certificateNumber;
public AuthenticationData(byte[] customerId, byte[] terminalId, byte[] streamNumber, byte[] identityModel,
byte[] idCheck, byte[] verification, byte[] picture, byte[] reservation, byte[] certificateNumber) {
super();
this.customerId = customerId;
this.terminalId = terminalId;
this.timestamp = FormatBytesUtil.getTimestamp();
this.streamNumber = streamNumber;
this.identityModel = identityModel;
int idCheckLengthTemp = 0;
int verificationLengthTemp = 0;
this.lengthOfIdCheck = new byte[] { 0, 0 };
if (idCheck != null) {
idCheckLengthTemp = idCheck.length;
this.lengthOfIdCheck = FormatBytesUtil.getByteOfShort((short) idCheck.length);
}
this.idCheck = idCheck;
this.lengthOfVerification = new byte[] { 0, 0 };
if (verification != null) {
verificationLengthTemp = verification.length;
this.lengthOfVerification = FormatBytesUtil.getByteOfShort((short) verification.length);
}
this.verification = verification;
this.lengthOfTwo = FormatBytesUtil.getByteOfShort((short) (idCheckLengthTemp + verificationLengthTemp + 4));
this.lengthOfPicture = new byte[] { 0, 0, 0, 0 };
if (picture != null) {
this.lengthOfPicture = FormatBytesUtil.getBytesOfInt(picture.length);
}
this.picture = picture;
this.lengthOfReservasion = new byte[] { 0, 0 };
if (reservation != null) {
this.lengthOfReservasion = FormatBytesUtil.getByteOfShort((short) reservation.length);
}
this.reservation = reservation;
this.certificateNumber = certificateNumber;
}
public byte[] getAuthenticationData() {
byte[] data = FormatBytesUtil.concatAll(customerId, terminalId, timestamp, streamNumber, identityModel,
lengthOfTwo, lengthOfIdCheck, idCheck, lengthOfVerification, verification, lengthOfPicture, picture,
lengthOfReservasion, reservation, certificateNumber);
System.out.println("身份认证数据区:" + Arrays.toString(data));
return data;
}
}
package com.yingxininfo.data;
import java.util.Arrays;
import com.yingxininfo.utils.Constans;
import com.yingxininfo.utils.FormatBytesUtil;
import cn.com.jit.assp.css.client.util.Base64;
import cn.com.jit.assp.dsign.DSign;
public class DataSignature {
public static byte[] signature(byte[] data) {
DSign dSign = new DSign();
DSign.init("/cssconfig.properties");
// String signResultString = dSign.p1Sign(Constans.strDN, Constans.strDigestAlg, data);
// byte[] signResultByte = Base64.decode(signResultString);
// return signResultByte;
return new byte[70];
}
public static boolean signCheck(byte[] dataPackage) {
byte[] dataLengthByte = Arrays.copyOfRange(dataPackage, 6, 10);
// 数据区长度
int dataLength = FormatBytesUtil.getIntFromBytes(dataLengthByte);
// 被签名数据
byte[] data = Arrays.copyOfRange(dataPackage, 0, 10 + dataLength);
// 签名长度数据
byte[] signatureLengthByte = Arrays.copyOfRange(dataPackage, 10 + dataLength, 11 + dataLength);
// 签名长度
int signatureLength = signatureLengthByte[0];
// 签名数据
byte[] signatureByte = Arrays.copyOfRange(dataPackage, 11 + dataLength, 11 + dataLength + signatureLength);
// 证书
byte[] zhengshu = Arrays.copyOfRange(data, data.length - 32, data.length);
DSign ds = new DSign();
DSign.init("/cssconfig.properties");
String certID = new String(zhengshu).trim();
System.out.println("证书序列号:" + certID);
String strDigetsAlg = "sm3";
long a = ds.p1Verify(certID, strDigetsAlg, Base64.encode(signatureByte), data);
if (a == 0) {
return true;
}
System.out.println("错误号为:" + ds.getErrorCode());
System.out.println("错误描述:" + ds.getErrorMessage());
return false;
}
}
package com.yingxininfo.data;
import java.io.UnsupportedEncodingException;
import com.yingxininfo.utils.FormatBytesUtil;
import cn.com.jit.assp.dsign.DSign;
public class ReservationData {
// 姓名
private String name;
// 身份证号
private String idNumber;
// 有效期起
private String validFrom;
// 有效期止
private String validEnd;
/*
* 网站上传信息 JSON字符串 必填 String jsonStr =
* "{'vendorIp':'202.211.100.100','venderName':'yingxininfo','businessType':'test','dealDate':'20161202'}";
*/
private byte[] updataInfo_JSON = new byte[] { 123, 39, 118, 101, 110, 100, 111, 114, 73, 112, 39, 58, 39, 50, 48,
50, 46, 50, 49, 49, 46, 49, 48, 48, 46, 49, 48, 48, 39, 44, 39, 118, 101, 110, 100, 101, 114, 78, 97, 109,
101, 39, 58, 39, 121, 105, 110, 103, 120, 105, 110, 105, 110, 102, 111, 39, 44, 39, 98, 117, 115, 105, 110,
101, 115, 115, 84, 121, 112, 101, 39, 58, 39, 116, 101, 115, 116, 39, 44, 39, 100, 101, 97, 108, 68, 97,
116, 101, 39, 58, 39, 50, 48, 49, 54, 49, 50, 48, 50, 39, 125 };
public ReservationData(String name, String idNumber, String validFrom, String validEnd) {
super();
this.name = name;
this.idNumber = idNumber;
this.validFrom = validFrom;
this.validEnd = validEnd;
}
public byte[] getReservasionBytes() {
// 各项信息长度固定
byte[] nameByte = new byte[45];
byte[] idNumberByte = new byte[18];
byte[] validFromByte = new byte[8];
byte[] validEndByte = new byte[8];
try {
// 姓名以UTF-8格式转换为byte[]
nameByte = FormatBytesUtil.copyByteToAnother(nameByte, name.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
// 身份证号中含有字母"X"的,一律大写
idNumberByte = FormatBytesUtil.getBytesFromString(idNumberByte, idNumber);
if (validFrom != null) {
validFromByte = FormatBytesUtil.getBytesFromString(validFromByte, validFrom);
}
if (validEnd != null) {
validEndByte = FormatBytesUtil.getBytesFromString(validEndByte, validEnd);
}
byte[] bytes = FormatBytesUtil.concatAll(nameByte, idNumberByte, validFromByte, validEndByte, updataInfo_JSON);
byte[] reservasionBytes = getDesign(bytes);
return reservasionBytes;
}
/**
* 通过签名服务器对保留数据单独进行加密
*
* @param bytes
* @return
*/
private byte[] getDesign(byte[] bytes) {
// DSign dSign = new DSign();
// String signReturn = null;
// DSign.init("./config/cssconfig.properties");
// // 正式线alias改成{ "rzfw01" }
// String[] alias = { "rzfwyw02" };
// signReturn = dSign.encryptEnvelop(alias, bytes);
// if (signReturn != null) {
// return signReturn.getBytes();
// }
return bytes;
}
}
package com.yingxininfo.data;
import java.util.Arrays;
import com.yingxininfo.utils.FormatBytesUtil;
public class SocketPackage {
// 协议版本 2字节 0x0001
private byte[] version;
// 命令类型 1字节 0x00(请求)0x01(应答)
private byte[] commandType;
// 命令 1字节 0x00(身份认证申请)0x01(身份认证)
private byte[] command;
// 命令内容 1字节 保留 0x00
private byte[] commandContent;
// 操作 1字节 保留 0x00
private byte[] operation;
// 数据区长度 4字节
private byte[] dataLength;
// 数据区 变长
private byte[] data;
// 签名长度 1字节
private byte[] signatureLength;
// 签名 变长
private byte[] signature;
public SocketPackage(byte[] version, byte[] commandType, byte[] command, byte[] commandContent, byte[] operation,
byte[] data) {
super();
this.version = version;
this.commandType = commandType;
this.command = command;
this.commandContent = commandContent;
this.operation = operation;
this.dataLength = FormatBytesUtil.getBytesOfInt(data.length);
this.data = data;
}
public byte[] getSocketPackage() {
byte[] clearText = FormatBytesUtil.concatAll(version, commandType, command, commandContent, operation,
dataLength, data);
System.out.println("身份认证请求Socket数据原文:" + Arrays.toString(clearText));
byte[] cipherText = DataSignature.signature(clearText);
System.out.println("身份认证请求Socket数据签名:" + Arrays.toString(cipherText));
this.signatureLength = new byte[] { (byte) cipherText.length };
this.signature = cipherText;
byte[] socketPackage = FormatBytesUtil.concatAll(clearText, signatureLength, signature);
System.out.println("身份认证请求Socket数据报文:" + Arrays.toString(socketPackage));
return socketPackage;
}
}
package com.yingxininfo.net;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;
import com.yingxininfo.utils.Constans;
public class SocketSender {
public static byte[] sendSocketPackage(byte[] socketPackage) {
DatagramPacket sendPacket = new DatagramPacket(socketPackage, socketPackage.length, Constans.ia, Constans.port);
DatagramPacket receivePacket = new DatagramPacket(new byte[200], 200);
try (DatagramSocket udpClient = new DatagramSocket()) {
udpClient.send(sendPacket);
udpClient.setSoTimeout(10000);
udpClient.receive(receivePacket);
return receivePacket.getData();
} catch (SocketException e) {
System.out.println("udpClient创建失败");
e.printStackTrace();
} catch (IOException e) {
System.out.println("send/receive调用失败");
e.printStackTrace();
}
return null;
}
}
package com.yingxininfo.test;
import java.util.Arrays;
import com.yingxininfo.data.AuthenticationApplicationData;
import com.yingxininfo.data.AuthenticationData;
import com.yingxininfo.data.DataSignature;
import com.yingxininfo.data.ReservationData;
import com.yingxininfo.data.SocketPackage;
import com.yingxininfo.net.SocketSender;
import com.yingxininfo.utils.Constans;
import com.yingxininfo.utils.FormatBytesUtil;
/**
* 身份认证测试Demo
*
* @author 夏晨棋
* @email xia794404765@gmail.com
* @qq 794404765
* @version 创建时间 2017年3月8日 下午3:25:38
*/
public class RunDemo {
public static void main(String[] args) {
/*
* 组装认证申请数据区 第一个包的数据区
*/
// 客户号 8字节 共用
byte[] customerId = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
// 终端号 2字节 共用
byte[] terminalId = new byte[] { 1, 2 };
// 读卡控件版本 4字节
byte[] readCardControlsVersion = new byte[] { 1, 2, 3, 4 };
// 人像控件版本 4字节
byte[] pictureControlsVersion = new byte[] { 1, 2, 3, 4 };
// 证书序列号 32字节 "csywzd1" 共用
byte[] certificateNumber = new byte[] { 99, 115, 121, 119, 122, 100, 49 };
certificateNumber = FormatBytesUtil.copyByteToAnother(new byte[32], certificateNumber);
System.out.println("证书序列号:" + Arrays.toString(certificateNumber));
AuthenticationApplicationData auApp = new AuthenticationApplicationData(customerId, terminalId,
readCardControlsVersion, pictureControlsVersion, certificateNumber);
byte[] auAppData = auApp.getAuthenticationApplicationData();
/*
* 组装认证申请Socket数据包 第一次UDP数据包
*/
// 协议版本 2字节 0x0001 共用
byte[] version = { 0, 1 };
// 命令类型 1字节 0x00(请求)0x01(应答) 共用
byte[] commandType = { 0 };
// 命令 1字节 0x00(身份认证申请)0x01(身份认证) 共用但值不同
byte[] command = { 0 };
// 命令内容 1字节 保留 0x00 共用
byte[] commandContent = { 0 };
// 操作 1字节 保留 0x00 共用
byte[] operation = { 0 };
SocketPackage auAppSP = new SocketPackage(version, commandType, command, commandContent, operation, auAppData);
byte[] auAppSPData = auAppSP.getSocketPackage();
byte[] applicationReturn = SocketSender.sendSocketPackage(auAppSPData);
/*
* 组装认证数据区 第二个包的数据区
*/
byte[] streamNumber = null;
if (applicationReturn != null) {
streamNumber = Arrays.copyOfRange(applicationReturn, 24, 33);// 获取到业务流水号要组装进第二个数据包中
System.out.println("流水号:" + Arrays.toString(streamNumber));
short randomBytesLength = FormatBytesUtil.getShortFromBytes(Arrays.copyOfRange(applicationReturn, 33, 35)); // 获取随机数长度
String randomData = FormatBytesUtil
.bytesToHexString(Arrays.copyOfRange(applicationReturn, 35, 35 + randomBytesLength)); // 获取随机数数据
System.out.println("随机数长度:" + randomBytesLength);
System.out.println("随机数数据:" + randomData);
}
if (applicationReturn == null) {
System.out.println("获取流水号失败,认证失败。");
return;
}
byte[] picture = Constans.picture; // 生成人像数据
byte[] reservationFour = new ReservationData("毛家亮", "342224198901241273", "20071114", "20171114")
.getReservasionBytes(); // 生成四项保留数据
// byte[] reservationTwo = new ReservationData("毛家亮", "342224198901241273", null, null).getReservasionBytes(); // 生成两项保留数据
/*
* 0X0F
*/
// byte[] identityModel_0X0F = new byte[] { 0x0f };
// AuthenticationData au_0X0F = new AuthenticationData(customerId, terminalId, streamNumber, identityModel_0X0F,
// Constans.idCheck, Constans.verification, picture, null, certificateNumber);
// byte[] auData_0X0F = au_0X0F.getAuthenticationData();
// byte[] identityModel_0X0F = new byte[] { 0x0f };
// AuthenticationData au_0X0F = new AuthenticationData(customerId, terminalId, streamNumber, identityModel_0X0F,
// Constans.idCheck, Constans.verification, new byte[10], null, certificateNumber);
// byte[] auData_0X0F = au_0X0F.getAuthenticationData();
/*
* 0X4F
*/
// byte[] identityModel_0X4F = new byte[] { 0x4f };
// AuthenticationData au_0X4F = new AuthenticationData(customerId, terminalId, streamNumber, identityModel_0X4F,
// Constans.idCheck, Constans.verification, picture, reservationTwo, certificateNumber);
// @SuppressWarnings("unused")
// byte[] auData_0X4F = au_0X4F.getAuthenticationData();
/*
* 0X1F
*/
// byte[] identityModel_0X1F = new byte[] { 0x1f };
// AuthenticationData au_0X1F = new AuthenticationData(customerId, terminalId, streamNumber, identityModel_0X1F,
// Constans.idCheck, Constans.verification, picture, reservationFour, certificateNumber);
// @SuppressWarnings("unused")
// byte[] auData_0X1F = au_0X1F.getAuthenticationData();
/*
* 0X13
*/
byte[] identityModel_0X13 = new byte[] { 0x13 };
AuthenticationData au_0X13 = new AuthenticationData(customerId, terminalId, streamNumber, identityModel_0X13,
Constans.idCheck, null, picture, reservationFour, certificateNumber);
@SuppressWarnings("unused")
byte[] auData_0X13 = au_0X13.getAuthenticationData();
//12
/*byte[] identityModel_0X12 = new byte[] { 0x12 };
AuthenticationData au_0X12 = new AuthenticationData(customerId, terminalId, streamNumber, identityModel_0X12,
null, null, picture, reservationFour, certificateNumber);
@SuppressWarnings("unused")
byte[] auData_0X12 = au_0X12.getAuthenticationData();
*/
/*
* 组装认证Socket数据包 第二次UDP数据包
*/
command[0] = 1; // 命令 1字节 0x00(身份认证申请)0x01(身份认证) 修改值的内容为1
SocketPackage auSP = new SocketPackage(version, commandType, command, commandContent, operation, auData_0X13);
byte[] auSPData = auSP.getSocketPackage();
byte[] auReturn = SocketSender.sendSocketPackage(auSPData);
if (auReturn != null) {
//System.out.println("验签结果:" + DataSignature.signCheck(auReturn)); // 验签
String string = new String(Arrays.copyOfRange(auReturn, 33, 37));
System.out.print("认证结果:" + string);
return;
}
System.out.println("认证失败。");
}
}
package com.yingxininfo.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class Constans {
// 签名方法参数
public static String strDN = "csywzd1";
public static String strDigestAlg = "sm3";
// UDP Socket参数
public static String ip = "111.200.45.122";
public static int port = 8282;
public static InetAddress ia = null;
static {
try {
ia = InetAddress.getByName(ip);
} catch (UnknownHostException e) {
System.out.println("InetAddress 初始化失败,请检查Constans类中的host地址。");
e.printStackTrace();
}
}
//Gavin li
//DN查询数据
public static byte[] idCheck = new byte[] {3, 0, -46, -106, 46, -33, 13, -87, 47, 73, 47, 43, -37, -113, -49, 21, -97, -78, -110, -38, -34, -69, -77, -101, -64, -93, 85, 71, -28, 75, 34, -69, -32, -12, 50, 48, 49, 54, 48, 56, 51, 48, 50, 48, 50, 48, 49, 49, 56, 48, 56, 1, 1, -2, -1, 81, 108, 91, -119, -112, -24, 123, 44, 78, 0, 120, 20, 122, 118, 98, 64, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 50, 0, 48, 0, 49, 0, 54, 0, 48, 0, 56, 0, 51, 0, 48, 0, 50, 0, 48, 0, 50, 0, 53, 0, 48, 0, 50, 0, 49, 0, 49, -21, -36, -61, -8, 54, -102, 16, -12, -123, 82, 65, 71, 115, -59, -22, 111, 16, -99, -117, 63, -111, -30, 80, 106, -32, -42, -67, -62, -69, 47, 74, 70, -46, -106, 46, -33, 13, -87, 47, 73, 47, 43, -37, -113, -49, 21, -97, -78, -110, -38, -34, -69, -77, -101, -64, -93, 85, 71, -28, 75, 34, -69, -32, -12, -8, 63, 41, 117, -72, -94, -39, 62, -118, -62, -124, 93, 70, 58, -115, -32, -14, -15, 116, 112, 91, 100, -84, -78, -124, -45, -60, 10, -17, -88, 0, -123, 0, 1, 48, 69, 2, 33, 0, -60, -75, -101, 57, -14, 58, 80, -39, 116, -59, 77, 26, -121, 40, 81, -114, 114, -60, 33, 35, -64, 59, 41, -44, 54, 91, -44, -114, -65, -22, 16, -53, 2, 32, 93, -91, 45, 96, 63, 123, -79, 84, 60, -20, -95, 14, 46, -108, 110, 57, 107, 27, -121, -21, -18, -106, -20, 9, 100, 11, -53, -120, 28, 68, 69, -119, 0, 77, 73, 73, 66, 50, 65, 89, 75, 75, 111, 69, 99, 122, 49, 85, 71, 65, 81, 81, 67, 65, 54, 67, 67, 65, 99, 103, 119, 103, 103, 72, 69, 65, 103, 69, 65, 77, 89, 72, 82, 77, 73, 72, 79, 65, 103, 69, 65, 77, 68, 119, 119, 77, 68, 69, 76, 77, 65, 107, 71, 65, 49, 85, 69, 66, 104, 77, 67, 81, 48, 52, 120, 68, 84, 65, 76, 10, 66, 103, 78, 86, 66, 65, 111, 84, 66, 69, 100, 66, 87, 86, 77, 120, 69, 106, 65, 81, 66, 103, 78, 86, 66, 65, 77, 84, 67, 85, 100, 66, 87, 86, 78, 84, 86, 85, 74, 68, 81, 81, 73, 73, 86, 110, 121, 67, 47, 50, 83, 122, 83, 57, 89, 119, 68, 81, 89, 74, 75, 111, 69, 99, 122, 49, 85, 66, 103, 105, 48, 68, 66, 81, 65, 69, 10, 102, 68, 66, 54, 65, 105, 69, 65, 54, 105, 50, 98, 109, 72, 43, 74, 51, 51, 78, 79, 68, 115, 97, 107, 104, 112, 72, 109, 88, 75, 68, 103, 110, 120, 72, 97, 57, 111, 89, 121, 119, 78, 84, 99, 51, 82, 114, 110, 111, 98, 99, 67, 73, 81, 68, 122, 122, 107, 85, 111, 70, 113, 111, 51, 74, 65, 99, 51, 90, 56, 89, 85, 67, 49, 98, 120, 10, 97, 77, 56, 54, 84, 69, 67, 86, 106, 70, 107, 121, 110, 103, 73, 122, 102, 119, 71, 83, 89, 81, 81, 103, 66, 65, 104, 120, 79, 89, 104, 53, 48, 49, 55, 56, 120, 116, 86, 114, 51, 102, 119, 50, 81, 56, 71, 73, 83, 115, 49, 80, 53, 121, 49, 52, 119, 48, 108, 74, 80, 117, 106, 101, 116, 98, 52, 69, 69, 79, 99, 105, 49, 98, 68, 108, 10, 119, 77, 70, 121, 119, 97, 107, 75, 80, 110, 51, 104, 48, 108, 73, 119, 103, 101, 111, 71, 67, 105, 113, 66, 72, 77, 57, 86, 66, 103, 69, 69, 65, 103, 69, 119, 67, 81, 89, 72, 75, 111, 69, 99, 122, 49, 85, 66, 97, 73, 67, 66, 48, 69, 113, 100, 105, 68, 74, 43, 90, 105, 112, 108, 89, 71, 83, 113, 52, 106, 117, 50, 68, 122, 104, 117, 10, 81, 98, 117, 118, 74, 51, 113, 112, 85, 75, 115, 107, 100, 48, 88, 82, 65, 55, 77, 103, 111, 90, 80, 73, 112, 55, 49, 120, 86, 57, 89, 79, 66, 102, 85, 74, 85, 107, 108, 53, 78, 87, 102, 90, 116, 84, 72, 97, 114, 51, 106, 83, 55, 101, 116, 113, 100, 82, 47, 80, 115, 103, 54, 104, 86, 77, 106, 48, 57, 103, 57, 88, 84, 54, 112, 102, 10, 87, 112, 106, 101, 53, 105, 53, 50, 80, 65, 66, 67, 71, 106, 54, 103, 89, 84, 74, 111, 43, 116, 84, 71, 89, 80, 55, 57, 102, 113, 47, 75, 89, 105, 54, 52, 90, 119, 68, 98, 112, 101, 112, 47, 68, 47, 83, 80, 56, 75, 70, 99, 103, 106, 111, 69, 100, 56, 55, 108, 84, 72, 71, 54, 120, 71, 90, 97, 75, 47, 98, 67, 121, 74, 80, 51, 10, 43, 70, 76, 50, 70, 119, 43, 122, 107, 105, 72, 122, 72, 86, 86, 55, 73, 104, 57, 107, 55, 53, 80, 78, 49, 111, 76, 108, 89, 97, 53, 57, 122, 78, 50, 119, 121, 80, 111, 71, 98, 107, 120, 119, 72, 55, 112, 99, 49, 98, 68, 55, 117, 81, 81, 84, 76, 49, 52, 86, 76, 52, 118, 104, 55, 57, 50, 78, 105, 105, 104, 85, 114, 90, 57, 74, 10, 50, 117, 122, 86, 100, 57, 54, 99, 113, 121, 105, 84, 87, 102, 67, 118, 100, 56, 86, 90, 110, 56, 65, 79, 105, 52, 89, 61, 10};
// public static byte[] idCheck = new byte[] { 3, 0, -51, -13, -36, 14, 123, 109, 106, 88, 2, 82, -46, -28, -84, -37,
// -82, 113, 111, -118, 34, 107, -40, -59, 69, -68, -10, 97, 110, -52, 70, -114, -34, -15, 50, 48, 49, 53, 49,
// 49, 49, 56, 48, 49, 53, 51, 50, 52, 55, 57, 56, 1, 1, 108, 81, -119, 91, -24, -112, 44, 123, 0, 78, 20, 120,
// 118, 122, 64, 98, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 50, 0, 48, 0, 49, 0, 53, 0, 49, 0, 49, 0,
// 49, 0, 56, 0, 50, 0, 48, 0, 49, 0, 55, 0, 49, 0, 49, 0, 49, 0, 52, 0, -89, 46, -122, 112, 37, 110, -52, 34,
// 26, 21, -1, 49, 44, -47, -64, -21, -25, 45, 32, 33, 110, -73, -93, -5, -8, -9, 105, 92, -18, 109, -87, 7,
// -51, -13, -36, 14, 123, 109, 106, 88, 2, 82, -46, -28, -84, -37, -82, 113, 111, -118, 34, 107, -40, -59, 69,
// -68, -10, 97, 110, -52, 70, -114, -34, -15, 21, -18, 19, -18, -69, 14, -63, 13, 73, 125, 50, 51, 93, 84, 27,
// 63, -42, -66, 95, -90, -94, -20, 47, -120, -100, -98, -68, 85, 73, 24, 97, 19, 0, 1, 48, 70, 2, 33, 0, -47,
// 62, -43, 102, -99, 98, 37, 96, -97, 106, -80, -120, -28, 89, 96, -102, 124, 104, -15, 108, -34, 63, -61, 39,
// 4, 20, -75, 21, -125, 88, 98, -37, 2, 33, 0, -25, -61, 57, -39, 33, -2, 51, -90, -38, -79, 111, 69, -91,
// -124, -27, 58, -93, -3, 37, 67, -9, -50, -12, 106, 1, 71, -103, 75, 67, -73, -29, -58, 77, 73, 73, 66, 49,
// 81, 89, 75, 75, 111, 69, 99, 122, 49, 85, 71, 65, 81, 81, 67, 65, 54, 67, 67, 65, 99, 85, 119, 103, 103, 72,
// 66, 65, 103, 69, 65, 77, 89, 72, 79, 77, 73, 72, 76, 65, 103, 69, 65, 77, 68, 119, 119, 77, 68, 69, 76, 77,
// 65, 107, 71, 65, 49, 85, 69, 13, 10, 66, 104, 77, 67, 81, 48, 52, 120, 68, 84, 65, 76, 66, 103, 78, 86, 66,
// 65, 111, 84, 66, 69, 100, 66, 87, 86, 77, 120, 69, 106, 65, 81, 66, 103, 78, 86, 66, 65, 77, 84, 67, 85,
// 100, 66, 87, 86, 78, 84, 86, 85, 74, 68, 81, 81, 73, 73, 86, 110, 121, 67, 47, 50, 83, 122, 13, 10, 83, 57,
// 89, 119, 67, 119, 89, 74, 75, 111, 69, 99, 122, 49, 85, 66, 103, 105, 48, 68, 66, 72, 115, 119, 101, 81, 73,
// 103, 72, 118, 115, 109, 113, 75, 73, 122, 90, 104, 57, 55, 111, 70, 52, 110, 75, 65, 51, 78, 47, 87, 79, 77,
// 65, 97, 80, 56, 66, 51, 57, 68, 103, 97, 112, 105, 13, 10, 122, 57, 66, 78, 103, 80, 89, 67, 73, 81, 67, 90,
// 89, 51, 89, 122, 122, 50, 84, 70, 113, 81, 49, 72, 72, 86, 106, 98, 106, 54, 57, 80, 99, 103, 79, 90, 79,
// 57, 69, 101, 67, 105, 69, 71, 119, 107, 72, 101, 98, 117, 107, 52, 85, 103, 81, 103, 111, 66, 111, 48, 86,
// 72, 49, 67, 13, 10, 97, 75, 109, 88, 107, 111, 72, 90, 79, 102, 112, 87, 79, 98, 102, 102, 69, 78, 106, 70,
// 116, 105, 116, 74, 116, 104, 54, 43, 101, 51, 106, 103, 102, 113, 48, 69, 69, 66, 82, 71, 121, 55, 56, 97,
// 82, 72, 57, 122, 69, 66, 112, 77, 55, 68, 116, 82, 89, 122, 107, 119, 103, 101, 111, 71, 13, 10, 67, 105,
// 113, 66, 72, 77, 57, 86, 66, 103, 69, 69, 65, 103, 69, 119, 67, 81, 89, 72, 75, 111, 69, 99, 122, 49, 85,
// 66, 97, 73, 67, 66, 48, 79, 50, 72, 51, 89, 79, 87, 114, 109, 72, 98, 108, 72, 119, 87, 98, 102, 112, 107,
// 56, 48, 74, 90, 57, 82, 50, 69, 104, 67, 115, 86, 13, 10, 68, 83, 104, 66, 116, 55, 118, 72, 78, 48, 102,
// 109, 68, 49, 69, 75, 68, 73, 79, 116, 88, 104, 109, 48, 65, 71, 47, 99, 122, 111, 105, 100, 77, 87, 81, 101,
// 101, 84, 106, 90, 84, 69, 55, 113, 85, 105, 65, 52, 105, 98, 55, 81, 76, 72, 78, 77, 99, 75, 97, 68, 53,
// 108, 115, 65, 13, 10, 104, 97, 70, 89, 111, 50, 100, 43, 87, 86, 65, 116, 111, 83, 67, 66, 65, 83, 66, 75,
// 86, 98, 88, 66, 83, 78, 107, 90, 101, 49, 52, 118, 90, 68, 83, 107, 43, 74, 109, 113, 43, 102, 72, 98, 122,
// 52, 89, 65, 118, 74, 72, 90, 54, 117, 57, 68, 111, 82, 116, 111, 115, 67, 51, 104, 13, 10, 118, 76, 65, 113,
// 98, 72, 109, 56, 65, 68, 55, 74, 70, 79, 112, 48, 102, 121, 120, 118, 98, 114, 99, 88, 74, 53, 118, 65, 118,
// 53, 55, 102, 82, 57, 104, 57, 72, 86, 86, 77, 113, 109, 71, 109, 50, 113, 120, 113, 52, 51, 111, 78, 76,
// 104, 80, 113, 49, 108, 73, 52, 77, 77, 57, 57, 13, 10, 98, 67, 114, 99, 111, 105, 113, 56, 106, 47, 122,
// 108, 85, 116, 68, 90, 99, 65, 122, 88, 112, 105, 80, 47, 103, 113, 69, 57, 57, 77, 75, 103, 77, 97, 49, 81,
// 69, 73, 116, 89, 77, 98, 111, 53, 68, 55, 73, 80, 101, 104, 48, 114, 84, 79, 103, 61 };
//认证码数据
public static byte[] verification = new byte[] {-66, 1, 77, 73, 73, 66, 82, 103, 89, 75, 75, 111, 69, 99, 122, 49, 85, 71, 65, 81, 81, 67, 65, 54, 67, 67, 65, 84, 89, 119, 103, 103, 69, 121, 65, 103, 69, 65, 77, 89, 72, 82, 77, 73, 72, 79, 65, 103, 69, 65, 77, 68, 119, 119, 77, 68, 69, 76, 77, 65, 107, 71, 65, 49, 85, 69, 66, 104, 77, 67, 81, 48, 52, 120, 68, 84, 65, 76, 10, 66, 103, 78, 86, 66, 65, 111, 84, 66, 69, 100, 66, 87, 86, 77, 120, 69, 106, 65, 81, 66, 103, 78, 86, 66, 65, 77, 84, 67, 85, 100, 66, 87, 86, 78, 84, 86, 85, 74, 68, 81, 81, 73, 73, 86, 110, 121, 67, 47, 50, 83, 122, 83, 57, 89, 119, 68, 81, 89, 74, 75, 111, 69, 99, 122, 49, 85, 66, 103, 105, 48, 68, 66, 81, 65, 69, 10, 102, 68, 66, 54, 65, 105, 69, 65, 108, 113, 68, 50, 119, 84, 76, 119, 47, 66, 43, 88, 66, 85, 108, 65, 82, 50, 73, 75, 80, 67, 112, 118, 101, 114, 115, 67, 66, 68, 103, 80, 109, 75, 49, 57, 105, 87, 114, 71, 116, 102, 81, 67, 73, 81, 68, 111, 78, 66, 69, 43, 53, 79, 53, 116, 81, 68, 43, 110, 66, 76, 101, 99, 79, 66, 111, 114, 10, 98, 77, 99, 118, 78, 71, 68, 57, 121, 103, 98, 86, 112, 55, 68, 47, 116, 111, 49, 67, 117, 119, 81, 103, 88, 67, 81, 79, 73, 102, 122, 109, 115, 99, 104, 108, 121, 115, 105, 72, 89, 87, 47, 72, 89, 106, 79, 121, 114, 105, 85, 67, 66, 54, 103, 82, 117, 54, 119, 108, 116, 55, 115, 119, 112, 87, 56, 69, 69, 66, 107, 90, 75, 111, 53, 100, 10, 68, 50, 118, 52, 87, 110, 99, 88, 121, 88, 51, 97, 119, 47, 107, 119, 87, 81, 89, 75, 75, 111, 69, 99, 122, 49, 85, 71, 65, 81, 81, 67, 65, 84, 65, 74, 66, 103, 99, 113, 103, 82, 122, 80, 86, 81, 70, 111, 103, 69, 67, 49, 115, 106, 50, 81, 50, 78, 120, 75, 90, 114, 50, 99, 83, 47, 119, 109, 48, 106, 113, 83, 56, 99, 57, 116, 10, 120, 110, 68, 51, 74, 72, 57, 100, 81, 112, 111, 48, 97, 69, 120, 89, 103, 103, 78, 87, 49, 77, 114, 48, 82, 51, 85, 56, 73, 121, 81, 98, 87, 122, 103, 116, 69, 48, 54, 121, 57, 108, 112, 89, 65, 50, 89, 110, 87, 104, 81, 49, 99, 113, 84, 117, 69, 112, 99, 109, 10, 0, 0};
// public static byte[] verification = new byte[] { -64, 1, 77, 73, 73, 66, 81, 119, 89, 75, 75, 111, 69, 99, 122, 49,
// 85, 71, 65, 81, 81, 67, 65, 54, 67, 67, 65, 84, 77, 119, 103, 103, 69, 118, 65, 103, 69, 65, 77, 89, 72, 79,
// 77, 73, 72, 76, 65, 103, 69, 65, 77, 68, 119, 119, 77, 68, 69, 76, 77, 65, 107, 71, 65, 49, 85, 69, 13, 10,
// 66, 104, 77, 67, 81, 48, 52, 120, 68, 84, 65, 76, 66, 103, 78, 86, 66, 65, 111, 84, 66, 69, 100, 66, 87, 86,
// 77, 120, 69, 106, 65, 81, 66, 103, 78, 86, 66, 65, 77, 84, 67, 85, 100, 66, 87, 86, 78, 84, 86, 85, 74, 68,
// 81, 81, 73, 73, 86, 110, 121, 67, 47, 50, 83, 122, 13, 10, 83, 57, 89, 119, 67, 119, 89, 74, 75, 111, 69,
// 99, 122, 49, 85, 66, 103, 105, 48, 68, 66, 72, 115, 119, 101, 81, 73, 104, 65, 73, 71, 53, 106, 121, 80, 90,
// 80, 86, 48, 83, 119, 108, 87, 65, 85, 82, 120, 111, 108, 104, 87, 81, 53, 69, 79, 106, 71, 101, 70, 80, 77,
// 76, 81, 50, 13, 10, 53, 118, 119, 47, 111, 49, 52, 78, 65, 105, 65, 77, 109, 69, 54, 57, 70, 57, 106, 87,
// 116, 50, 103, 75, 82, 108, 80, 105, 49, 107, 66, 51, 99, 110, 86, 71, 56, 56, 105, 49, 100, 108, 78, 53, 55,
// 75, 75, 114, 73, 105, 102, 85, 74, 119, 81, 103, 102, 113, 48, 54, 54, 110, 108, 72, 13, 10, 76, 117, 86,
// 66, 118, 76, 119, 65, 100, 57, 99, 68, 86, 97, 122, 86, 55, 48, 119, 102, 87, 116, 72, 84, 52, 101, 114,
// 114, 49, 67, 110, 105, 75, 73, 99, 69, 69, 75, 104, 116, 75, 70, 119, 81, 87, 119, 84, 48, 54, 104, 120, 83,
// 80, 54, 119, 52, 106, 116, 69, 119, 87, 81, 89, 75, 13, 10, 75, 111, 69, 99, 122, 49, 85, 71, 65, 81, 81,
// 67, 65, 84, 65, 74, 66, 103, 99, 113, 103, 82, 122, 80, 86, 81, 70, 111, 103, 69, 66, 53, 116, 54, 117, 83,
// 67, 49, 98, 118, 47, 85, 108, 110, 84, 107, 85, 54, 48, 68, 87, 120, 120, 77, 113, 43, 108, 49, 101, 102,
// 113, 53, 43, 79, 13, 10, 51, 53, 66, 97, 114, 100, 56, 48, 117, 76, 47, 56, 88, 101, 71, 74, 118, 112, 89,
// 113, 100, 102, 67, 80, 120, 54, 78, 101, 111, 118, 84, 115, 71, 47, 122, 111, 66, 103, 70, 87, 67, 116, 97,
// 80, 51, 57, 117, 79, 56, 117, 106, 71, 0, 0 };
public static byte[] picture = null;
static {
File f = new File("/123.jpg");
try (InputStream in = new FileInputStream(f)) {
picture = new byte[(int) f.length()];
in.read(picture);
} catch (FileNotFoundException e) {
System.out.println("文件未找到。");
e.printStackTrace();
} catch (IOException e) {
System.out.println("IOException.");
e.printStackTrace();
}
// OCX版人像控件输出结果需进行Base64.decode(image)转换,获得的字节数据进行组包
}
}
package com.yingxininfo.utils;
public class FormatBytesUtil {
/**
* 将byte数组转换为short类型
* @param bytes
* @return short
*/
public static short getShortFromBytes(byte[] bytes) {
return (short) ((0xff & bytes[0]) | (0xff00 & (bytes[1] << 8)));
}
/**
* 将byte数组转换为int类型
* @param bytes
* @return
*/
public static int getIntFromBytes(byte[] bytes) {
return (0xff & bytes[0]) | (0xff00 & (bytes[1] << 8))
| (0xff0000 & (bytes[2] << 16))
| (0xff000000 & (bytes[3] << 24));
}
/**
* 将short类型的数据转为byte数组 short类型为两个字节将这个字节转为byte数组长度为二 eg:id和认证码长度的转换
*
* @param data
* @return
*/
public static byte[] getByteOfShort(short data) {
byte[] bytes = new byte[2]; // 创建一个byte数组,长度设置为2
bytes[0] = (byte) (data & 0xff);// 参数与0xff做与运算
bytes[1] = (byte) ((data & 0xff00) >> 8);// 做过‘与’运算之后右移8位
return bytes;
}
/**
* int类型转换为4字节长度的byte数组 eg:时间戳的生成 数据区长度的转换
*
* @param data
* @return
*/
public static byte[] getBytesOfInt(int data) {
byte[] bytes = new byte[4];
bytes[0] = (byte) (data & 0xff);
bytes[1] = (byte) ((data & 0xff00) >> 8);
bytes[2] = (byte) ((data & 0xff0000) >> 16);
bytes[3] = (byte) ((data & 0xff000000) >> 24);
return bytes;
}
/**
* 时间戳
*
* @return 4字节时间戳
*/
public static byte[] getTimestamp() {
int i = (int) (System.currentTimeMillis() / 1000);
byte[] time = getBytesOfInt(i);
return time;
}
/**
* 把from中的内容拷贝到to中 eg:姓名拷贝到保留数据明文
*
* @param to
* @param from
* @return
*/
public static byte[] copyByteToAnother(byte[] to, byte[] from) {
for (int i = 0; i < from.length; i++) {
to[i] = from[i];
}
return to;
}
/**
* String类型转为byte数组,单字节转换方式
*
* @param bytes
* @param string
* @return
*/
public static byte[] getBytesFromString(byte[] bytes, String string) {
for (int i = 0; i < string.length(); i++) {
bytes[i] = (byte) string.charAt(i);
}
return bytes;
}
/**
* 将两个byte数组合并为一个
*
*
* @return byte_3
*/
public static byte[] byteMerger(byte[] byte1, byte[] byte2) {
byte[] byte3 = new byte[byte1.length + byte2.length];
System.arraycopy(byte1, 0, byte3, 0, byte1.length);
System.arraycopy(byte2, 0, byte3, byte1.length, byte2.length);
return byte3;
}
/**
* 用可变参数将所有的byte数组合并为一个
*
* @param first
* @param rest
* @return
*/
public static byte[] concatAll(byte[] first, byte[]... rest) {
int totalLength = first.length;
for (int i = 0; i < rest.length; i++) {
if (rest[i] != null) {
totalLength += rest[i].length;
}
}
byte[] result = new byte[totalLength];
System.arraycopy(first, 0, result, 0, first.length);
int offset = first.length;
for (int i = 0; i < rest.length; i++) {
if (rest[i] != null) {
System.arraycopy(rest[i], 0, result, offset, rest[i].length);
offset += rest[i].length;
}
}
return result;
}
/**
* 将byte数组转换成十六进制字符串 eg:流水号转换
*
* @author xia79
* @param ba
* @return
*/
public static String bytesToHexString(byte[] ba) {
String s = "";
for (int i = 0; i < ba.length; i++) {
s += String.format("%02X", ba[i]);
}
return s;
}
/**
* 将十六进制字符串转换成byte数组 eg:流水号转换
*
* @param hexString
* @return
*/
public static byte[] hexStringToBytes(String hexString) {
if (hexString == null || hexString.equals("")) {
return null;
}
hexString = hexString.toUpperCase();
int length = hexString.length() / 2;
char[] hexChars = hexString.toCharArray();
byte[] d = new byte[length];
for (int i = 0; i < length; i++) {
int pos = i * 2;
d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
}
return d;
}
private static byte charToByte(char c) {
return (byte) "0123456789ABCDEF".indexOf(c);
}
}
package com.yx.controller;
import java.util.List;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.google.gson.Gson;
import com.yx.entity.Company;
import com.yx.service.CompanyService;
import com.yx.utils.JsonUtils;
@Controller
public class CompanyController extends HttpServlet {
@Autowired
private CompanyService companyService;
// 添加来访单位
@RequestMapping(value = "/saveCompany", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public void saveCompany(HttpServletRequest request) {
String company = request.getParameter("companyName");
Company c = new Company();
c.setCompanyName(company);
companyService.saveCompany(c);
}
// 删除来访单位
@RequestMapping(value = "/deleteCompany", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public void deleteCompany(@RequestBody String companyName) {
companyService.deleteCompany(companyName);
}
// 更新来访单位
@RequestMapping(value = "/updateCompany", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public void updateCompany(@RequestBody Company company) {
companyService.updateCompany(company);
}
// 查找单个来访单位
@RequestMapping(value = "/findCompany", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public Company findCompany(@RequestBody String companyName) {
return companyService.findCompany(companyName);
}
// 查找全部来访单位
@RequestMapping(value = "/findCompanyAll", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String findCompanyAll() {
List<Company> list = companyService.findCompanyAll();
String result = JsonUtils.objectToJson(list);
return result;
}
}
package com.yx.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.google.gson.Gson;
import com.yx.entity.CountConditions;
import com.yx.entity.Employee;
import com.yx.entity.Person;
import com.yx.service.CountConditionsService;
import com.yx.utils.DateUtils;
import com.yx.utils.JsonUtils;
@Controller
public class CountconditionsController {
@Autowired
private CountConditionsService countConditionsService;
/**
* 访客查询
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/countPerson", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String countPerson(@RequestBody String data) {
try {
System.out.println(data);
Gson gson = new Gson();
CountConditions count = gson.fromJson(data, CountConditions.class);
if (count.getStartDate() == null || count.getStartDate().equals("")) {
count.setStartDate(DateUtils.getDate() + " 00-00-00");
}
if (count.getEndDate() == null || count.getEndDate().equals("")) {
count.setEndDate(DateUtils.getDate() + " 23-59-59");
}
int page = count.getCurrent();
page = (page - 1) * 5;
count.setCurrent(page);
List<Person> person = countConditionsService.countPerson(count);
String result = JsonUtils.objectToJson(person);
if (result != null) {
return result;
} else {
return "fail";
}
} catch (Exception e) {
System.out.println(e);
return "fail";
}
}
/**
* 访客总数查询
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/persontotal", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String persontotal(@RequestBody String data) {
try {
System.out.println(data);
Gson gson = new Gson();
CountConditions count = gson.fromJson(data, CountConditions.class);
if (count.getStartDate() == null || count.getStartDate().equals("")) {
count.setStartDate(DateUtils.getDate() + " 00-00-00");
}
if (count.getEndDate() == null || count.getEndDate().equals("")) {
count.setEndDate(DateUtils.getDate() + " 23-59-59");
}
int total = countConditionsService.persontotal(count);
int result = 0;
if (total % 5 != 0) {
result = total / 5 + 1;
} else {
result = total / 5;
}
System.out.println(result);
return result + "";
} catch (Exception e) {
return "fail";
}
}
}
package com.yx.controller;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.yx.entity.Employee;
import com.yx.entity.FaceModel;
import com.yx.entity.Page;
import com.yx.photo.AFRTestN;
import com.yx.service.EmployeeService;
import com.yx.utils.Base64test;
/**
* 员工信息控制类
*
* @author Administrator
*
*/
@Controller
public class EmployeeController extends HttpServlet {
@Autowired
private EmployeeService employeeService;
/**
* 员工信息查询
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findEmployee", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String findEmployee(@RequestBody String data) {
try {
Gson gson = new Gson();
Employee employee = gson.fromJson(data, Employee.class);
Employee list = employeeService.findEmployee(
employee.getUsername(), employee.getDept());
String json = gson.toJson(list);
return json;
} catch (Exception e) {
return "fail";
}
}
// @RequestMapping(value = "/findEmployeeList", method = RequestMethod.POST,
// produces = "text/html;charset=UTF-8")
// @ResponseBody
// public String findEmployeeList(@RequestBody String data) {
// try {
// Gson gson = new Gson();
// Employee employee = gson.fromJson(data, Employee.class);
// Employee list = employeeService.findEmployee(
// employee.getUsername(), employee.getDept());
// String json = gson.toJson(list);
// return json;
// } catch (Exception e) {
// return "fail";
// }
// }
/**
* 从数据库中找出最相近的人像特征,并返回相似值
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findFaceModel", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String findFaceModel(HttpServletRequest request) {
String string = Base64test.GenerateImageEMPNEW(
request.getParameter("base64"), "emp");
String result = employeeService.findFaceModel(string);
return result;
}
/**
* 员工信息修改
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/updatePwd", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String updatePwd(@RequestBody String data) {
try {
Gson gson = new Gson();
Employee employee = gson.fromJson(data, Employee.class);
if(employee.getPhotourl()!=null&&employee.getPhotourl().length()>0)
{
String emp = Base64test.GenerateImageEMP(employee.getPhotourl(),
employee.getLoginname());
employee.setPhotourl(emp);
}
employeeService.updatePwd(employee);
System.out.println(employee);
return "success";
} catch (Exception e) {
return "fail";
}
}
/**
* 员工信息删除
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/deleteEmployee", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String deleteEmployee(@RequestBody String data) {
try {
Gson gson = new Gson();
Page page = gson.fromJson(data, Page.class);
int id = Integer.parseInt(page.getPage());
employeeService.deleteEmployee(id);
return "success";
} catch (Exception e) {
return "fail";
}
}
/**
* 员工信息删除
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/test", method = RequestMethod.GET, produces = "text/html;charset=UTF-8")
@ResponseBody
public String test(HttpServletResponse resp) {
resp.setHeader("Access-Control-Allow-Origin", "*");
System.out.println("hahahaha");
return "hahaha";
}
/**
* 员工信息注册
*/
@ResponseBody
@RequestMapping(value = "/saveEmployee", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
public String photoUpload(HttpServletRequest request) {
try {
Employee employee = new Employee();
employee.setUsername(request.getParameter("username"));
employee.setDept(request.getParameter("dept"));
employee.setLoginname(request.getParameter("loginname"));
employee.setPhone(request.getParameter("phone"));
employee.setPassword(request.getParameter("password"));
employee.setTel(request.getParameter("tel"));
employee.setOffice(request.getParameter("office"));
employee.setSzm(request.getParameter("szm"));
employee.setRoom(request.getParameter("room"));
if (request.getParameter("base64") != null
&& request.getParameter("base64").length() > 0) {
String emp = Base64test.GenerateImageEMP(
request.getParameter("base64"),
request.getParameter("loginname"));
employee.setPhotourl(emp);
}
Employee check = employeeService.check(request
.getParameter("loginname"));
if (check != null) {
return "nosuccess";
}
employeeService.saveEmployee(employee);
return "success";
} catch (Exception e) {
return "fail";
}
}
/**
* 员工登录
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/login", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String login(HttpServletRequest request, HttpServletResponse response) {
try {
String username = request.getParameter("username");
String password = request.getParameter("password");
Gson gson = new Gson();
Employee employee = employeeService.login(username, password);
if (employee != null) {
String json = gson.toJson(employee);
return json;
} else {
return "fail";
}
} catch (Exception e) {
return "fail";
}
}
/**
* 员工管理
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findAll", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String findAll(@RequestBody String data) {
try {
Gson gson = new Gson();
Page p = gson.fromJson(data, Page.class);
// String string = request.getParameter("page");
if (data == null) {
data = "1";
}
int page = Integer.parseInt(p.getPage());
List<Employee> list = employeeService.findAll((page - 1) * 10, 10);
System.out.println(list);
String json = gson.toJson(list);
return json;
} catch (Exception e) {
return "fail";
}
}
/**
* 根据查询首字母员工
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findEmployeeBySZM", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String findEmployeeBySZM(@RequestBody String data) {
try {
Gson gson = new Gson();
data = data.toLowerCase();
List<Employee> list = employeeService.findEmployeeBySZM(data);
String json = gson.toJson(list);
return json;
} catch (Exception e) {
return "fail";
}
}
/**
* 分页数
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/total", method = RequestMethod.GET, produces = "text/html;charset=UTF-8")
@ResponseBody
public String total() {
int total = employeeService.total();
int result = 0;
if (total % 10 != 0) {
result = total / 10 + 1;
} else {
result = total / 10;
}
System.out.println(result);
return result + "";
}
}
package com.yx.controller;
import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.session.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import Decoder.BASE64Decoder;
import com.google.gson.Gson;
import com.yx.entity.Employee;
import com.yx.entity.Person;
import com.yx.entity.SoloPhoto;
import com.yx.photo.AFRTest;
import com.yx.service.AttestServiceImpl;
import com.yx.service.PersonService;
import com.yx.service.PersonServiceImpl;
import com.yx.service.QRCodeServiceImpl;
import com.yx.utils.Base64test;
import com.yx.utils.DateFormat;
import com.yx.utils.DateUtils;
import com.yx.utils.JsonUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
/**
* 访客信息控制类
*
* @author Administrator
*
*/
@Controller
public class PersonController extends HttpServlet {
@Autowired
private PersonService personService;
private AttestServiceImpl attestService = new AttestServiceImpl();
private QRCodeServiceImpl qr = new QRCodeServiceImpl();
/**
* 访客信息查询
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findPerson", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String findPerson(@RequestBody String idcard) {
try {
// String idcard = request.getParameter("idcard");
List<Person> persons = personService.findPerson(idcard);
if (persons != null) {
String json = JsonUtils.objectToJson(persons);
return json;
} else {
return "fail";
}
} catch (Exception e) {
return "fail";
}
}
/**
* 根据身份证号查询访客信息
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findPersonById", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String findPersonById(@RequestBody String id) {
try {
Person person = personService.findPersonById(id);
String result = JsonUtils.objectToJson(person);
if (result != null) {
return result;
} else {
return "fail";
}
} catch (Exception e) {
return "fail";
}
}
/**
* 访客信息登记
*
* @param request
* @param response
*/
@RequestMapping(value = "/savePerson", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String savePerson(HttpServletRequest request,
HttpServletResponse response) {
Gson gson = new Gson();
String data = request.getParameter("data");
Person person = gson.fromJson(data, Person.class);
person.setAccessdate(DateFormat.dateToString(new Date()));
person.setPhotourl(Base64test.GenerateImage(person.getPhotourl(),
person.getIdcard()));
personService.save(person);
return "success";
}
/**
* 访客离开
*
* @param request
* @param response
*/
@RequestMapping(value = "/personQuit", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String personQuit(@RequestBody String data) {
try {
Gson gson = new Gson();
Person person = gson.fromJson(data, Person.class);
person.setLeavedate(DateFormat.dateToString(new Date()));
personService.personQuit(person);
return "success";
} catch (Exception e) {
return "fail";
}
}
/**
* 拉黑名单
*
* @param request
* @param response
*/
@RequestMapping(value = "/updateBlackList", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String updateBlackList(@RequestBody String data) {
try {
Gson gson = new Gson();
Person person = gson.fromJson(data, Person.class);
personService.updateBlackList(person);
System.out.println(person);
return "success";
} catch (Exception e) {
return "fail";
}
}
/**
* 取消拉黑
*
* @param request
* @param response
*/
@RequestMapping(value = "/noBlackList", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String noBlackList(@RequestBody String data) {
try {
Gson gson = new Gson();
Person person = gson.fromJson(data, Person.class);
personService.updateBlackList(person);
System.out.println(person);
return "success";
} catch (Exception e) {
return "fail";
}
}
/**
* 人像对比
*
* @param data
* @return
*/
@RequestMapping(value = "/contrastPhoto", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String contrastPhoto(@RequestBody String data) {
try {
Gson gson = new Gson();
SoloPhoto soloPhoto = gson.fromJson(data, SoloPhoto.class);
String photourl = Base64test.GenerateImageNew(
soloPhoto.getSolourl(), soloPhoto.getIdcard());
String picpath1 = photourl;
String picpath2 = soloPhoto.getSolourl1();
String result = AFRTest.contrastPhoto(picpath1, picpath2);
return result;
} catch (Exception e) {
return "fail";
}
}
/**
* 访客信息实名验证 待开发
*
* @param request
* @param response
*/
@RequestMapping(value = "/attest", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String attest(HttpServletRequest request,
HttpServletResponse response) {
return "nihao";
}
/**
* 打印凭条 创建二维码
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/CreateQRCode", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String CreateQRCode(@RequestBody String data) {
try {
Gson gson = new Gson();
Person json = gson.fromJson(data, Person.class);
String qrUrl = qr.CreateQRCode(json.getIdcard());
Person person = personService.findPersonById(json.getIdcard());
person.setQrphotourl(qrUrl);
return JsonUtils.objectToJson(person);
} catch (Exception e) {
return "fail";
}
}
/**
* 返回未离开访客总条数
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/noleavetotal", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String noleavetotal() {
int total = personService.noleavetotal();
int result = 0;
if (total % 5 != 0) {
result = total / 5 + 1;
} else {
result = total / 5;
}
System.out.println(result);
return result + "";
/*
* try {} catch (Exception e) { return "fail"; }
*/
}
/**
* 一键离开
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/leaveAll", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String leaveAll() {
try {
personService.leaveAll(DateUtils.getDateformat());
return "success";
} catch (Exception e) {
return "fail";
}
}
/**
* 返回所有没有离开的访客
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findNoLeavePerson", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String findNoLeavePerson(@RequestBody String data) {
try {
int page = Integer.parseInt(data);
page = (page - 1) * 5;
List<Person> list = personService.findNoLeavePerson(page, 5);
return JsonUtils.objectToJson(list);
} catch (Exception e) {
return "fail";
}
}
/**
* 上传图片
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/upPhoto", produces = "text/html;charset=UTF-8")
@ResponseBody
public String upPhoto(HttpServletRequest request,
HttpServletResponse response) {
String idcard = request.getParameter("idcard");
System.out.println(idcard);
String path = "E://photo/";
String name = System.currentTimeMillis() + "";
try {
// 分别接收页面传过来的图片信息
String pic1 = request.getParameter("pic1");
// 新建一个文件夹
File filepath = new File(path);
if (!filepath.exists()) {
filepath.mkdirs();
}
// 图1信息
File file1 = new File(path + "/" + idcard + ".jpg");
FileOutputStream fout1 = null;
fout1 = new FileOutputStream(file1);
fout1.write(new BASE64Decoder().decodeBuffer(pic1));
fout1.close();
// request.getSession().setAttribute("photourl",
// "http://172.16.103.171:9527/"+name+".png");
} catch (Exception e) {
e.printStackTrace();
}
return "{\"status\":1}";
}
}
package com.yx.controller;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.google.gson.Gson;
import com.yx.entity.Person;
import com.yx.entity.Register;
import com.yx.service.RegisterService;
import com.yx.utils.DateFormat;
import com.yx.utils.JsonUtils;
import com.yx.utils.StaticVariable;
@Controller
public class RegisterController extends HttpServlet {
@Autowired
private RegisterService registerService;
/**
* 预约登记表
*
* @param registerdata
* @return
*/
@RequestMapping(value = "/register", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String register(@RequestBody String registerdata) {
try {
Gson gson = new Gson();
Register register = gson.fromJson(registerdata, Register.class);
register.setRegisterdate(DateFormat.dateToString(new Date()));
registerService.save(register);
return "success";
} catch (Exception e) {
return "fail";
}
}
/**
* 预约信息查询
*
* @param register
* @return
*/
@RequestMapping(value = "/findByName", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
@ResponseBody
public String findByName(@RequestBody String registerdata) {
try {
Gson gson = new Gson();
Register register = gson.fromJson(registerdata, Register.class);
List<Register> list = registerService.findByName(register);
String json = JsonUtils.objectToJson(list);
if (json != null) {
return json;
} else {
return "fail";
}
} catch (Exception e) {
return "fail";
}
}
/**
* 预约页默认显示最近10条数据
* @param register
* @return
*/
@RequestMapping(value = "/defaultShow", method = RequestMethod.GET, produces = "text/html;charset=UTF-8")
@ResponseBody
public String defaultShow() {
try {
List<Register> list = registerService.defaultShow();
String json = JsonUtils.objectToJson(list);
return json;
} catch (Exception e) {
return "fail";
}
}
}
package com.yx.dao;
import java.util.List;
import com.yx.entity.Company;
/**
* 来访人单位的操作接口,实现单位信息的 增 删 改 查
* @author shaochangbin
*
*/
public interface CompanyMapper {
//添加来访单位
void saveCompany(Company company);
//删除来访单位
void deleteCompany(String companyName);
//更新来访单位
void updateCompany(Company company);
//查找来访单位(单个查找)
Company findCompany(String companyName);
//查询所有单位
List<Company> findCompanyAll();
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yx.dao.CompanyMapper">
<insert id = "saveCompany" >
insert into Company (companyname) value (#{companyName})
</insert>
<delete id="deleteCompany" parameterType="String">
delete from Company where companyname = #{companyName}
</delete>
<update id="updateCompany" parameterType="com.yx.entity.Company">
update Company set companyname=#{companyName} where id=#{id}
</update>
<select id="findCompany" parameterType="String" resultType="com.yx.entity.Company">
select * from Company where companyname=#{companyName}
</select>
<select id="findCompanyAll" resultType="com.yx.entity.Company">
select * from Company
</select>
</mapper>
package com.yx.dao;
import java.util.List;
import com.yx.entity.CountConditions;
import com.yx.entity.Person;
public interface CountConditionsMapper {
List<Person> countPerson(CountConditions count);
int persontotal(CountConditions countConditions);
List<Person> findByPersonName(CountConditions c);
List<Person> findByEmployeeName(CountConditions c);
List<Person> findByUnit(CountConditions c);
List<Person> findByDate(CountConditions c);
List<Person> findByPersonDate(CountConditions c);
List<Person> findByPersonEmployee(CountConditions c);
List<Person> findByEmployeeDate(CountConditions c);
List<Person> findByDept(CountConditions c);
List<Person> findByReason(CountConditions c);
List<Person> findByBlackList(CountConditions c);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yx.dao.CountConditionsMapper">
<select id="countPerson" parameterType="com.yx.entity.CountConditions"
resultType="com.yx.entity.Person">
select * from Person
<where>
and accessdate>=#{startDate} and #{endDate} >= accessdate and 1=1
<if test="employeeName!=null and employeeName!=''">
and employee=#{employeeName}
</if>
<if test="personName!=null and personName!=''">
and username=#{personName}
</if>
<if test="dept!=null and dept!=''">
and dept=#{dept}
</if>
<if test="office!=null and office!=''">
and office=#{office}
</if>
<if test="unit!=null and unit!=''">
and unit=#{unit}
</if>
</where>
limit #{current},5
</select>
<select id="persontotal" parameterType="com.yx.entity.CountConditions"
resultType="int">
select count(*) from Person
<where>
and accessdate>=#{startDate} and #{endDate} >= accessdate and 1=1
<if test="employeeName!=null and employeeName!=''">
and employee=#{employeeName}
</if>
<if test="personName!=null and personName!=''">
and username=#{personName}
</if>
<if test="dept!=null and dept!=''">
and dept=#{dept}
</if>
<if test="office!=null and office!=''">
and office=#{office}
</if>
<if test="unit!=null and unit!=''">
and unit=#{unit}
</if>
</where>
</select>
<select id="findByPersonName" parameterType="com.yx.entity.CountConditions"
resultType="com.yx.entity.Person">
select * from Person where username=#{personName}
</select>
<select id="findByEmployeeName" parameterType="com.yx.entity.CountConditions"
resultType="com.yx.entity.Person">
select * from Person where employee=#{employeeName}
</select>
<select id="findByUnit" parameterType="com.yx.entity.CountConditions"
resultType="com.yx.entity.Person">
select * from Person where unit=#{unit}
</select>
<select id="findByDate" parameterType="com.yx.entity.CountConditions"
resultType="com.yx.entity.Person">
select * from Person where accessdate>#{startDate} and
#{endDate}>accessdate
</select>
<select id="findByDept" parameterType="com.yx.entity.CountConditions"
resultType="com.yx.entity.Person">
select * from Person where dept=#{dept}
</select>
<select id="findByReason" parameterType="com.yx.entity.CountConditions"
resultType="com.yx.entity.Person">
select * from Person where reason=#{reason}
</select>
<select id="findByBlackList" parameterType="com.yx.entity.CountConditions"
resultType="com.yx.entity.Person">
select * from Person where blacklist=#{blackList}
</select>
<select id="findByPersonDate" parameterType="com.yx.entity.CountConditions"
resultType="com.yx.entity.Person">
select * from Person where username=#{personName}and
accessdate>#{startDate}and#{endDate}>accessdate
</select>
<select id="findByPersonEmployee" parameterType="com.yx.entity.CountConditions"
resultType="com.yx.entity.Person">
select * from Person where username=#{personName}and
employee= #{employeeName}
</select>
<select id="findByEmployeeDate" parameterType="com.yx.entity.CountConditions"
resultType="com.yx.entity.Person">
select * from Person where employee=#{employeeName}and
accessdate>#{startDate}and#{endDate}>accessdate
</select>
</mapper>
package com.yx.dao;
import java.util.List;
import com.yx.entity.Employee;
import com.yx.entity.FaceModel;
public interface EmployeeMapper {
Employee findEmployee(String username, String dept);
void saveEmployee(Employee employee);
void saveFaceModel(String username ,byte[] faceModelByte);
List<FaceModel> findFaceModel();
Employee login(String loginname, String password);
List<Employee> findAll(int page, int num);
List<Employee> findEmployeeBySZM(String szm);
int total();
//注册验证
Employee check(String loginname);
void updatePwd(Employee employee);
void deleteEmployee(int id);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yx.dao.EmployeeMapper">
<select id="findEmployee" resultType="com.yx.entity.Employee">
select * from Employee
where username=#{0} and dept=#{1}
</select>
<select id="login" resultType="com.yx.entity.Employee">
select * from Employee where
loginname=#{0} and password=#{1}
</select>
<select id="check" resultType="String">
select * from Employee where
loginname=#{loginname}
</select>
<select id="findAll" resultType="com.yx.entity.Employee">
select * from Employee limit
#{0},#{1}
</select>
<select id="findEmployeeBySZM" resultType="com.yx.entity.Employee">
select * from Employee
where szm like concat(concat('%',#{szm}),'%') or username like
concat(concat('%',#{szm}),'%') limit 0,10
</select>
<select id="total" resultType="int">
select count(*) from Employee
</select>
<insert id="saveEmployee" parameterType="com.yx.entity.Employee">
insert into
Employee(username,dept,phone,photourl,checkin,loginname,password,tel,office,szm,room)
values(#{username},#{dept},#{phone},#{photourl},#{checkin},#{loginname},#{password},#{tel},#{office},#{szm},#{room})
</insert>
<insert id="saveFaceModel">
insert into Faces
(username,facemodel) value (#{0},#{1})
</insert>
<select id="findFaceModel" resultType="com.yx.entity.FaceModel">
select * from Faces
</select>
<update id="updatePwd" parameterType="com.yx.entity.Employee">
update Employee set
password=#{password},dept=#{dept},phone=#{phone},tel=#{tel},office=#{office},room=#{room}
<if test="photourl!=null and photourl!=''">
,photourl=#{photourl}
</if>
where id=#{id}
</update>
<delete id="deleteEmployee" parameterType="int">
delete from Employee
where id=#{id}
</delete>
</mapper>
\ No newline at end of file
package com.yx.dao;
import java.util.List;
import com.yx.entity.CountConditions;
import com.yx.entity.Person;
public interface PersonMapper {
List<Person> findPerson(String idcard);
Person findPersonById(String id);
void save(Person person);
void updateBlackList(Person person);
void noBlackList(Person person);
void personQuit(Person person);
void leaveAll(String date);
int noleavetotal();
List<Person> findNoLeavePerson(int page,int num);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yx.dao.PersonMapper">
<select id="findPerson" resultType="com.yx.entity.Person">
select * from Person where idcard=#{idcard} order by accessdate desc
</select>
<select id="findPersonById" parameterType="String" resultType="com.yx.entity.Person">
select * from Person where idcard=#{idcard} order by accessdate desc LIMIT 0,1
</select>
<select id="noleavetotal" resultType="int">
select count(*) from Person where leavedate is null
</select>
<select id="findNoLeavePerson" resultType="com.yx.entity.Person">
select * from Person where leavedate is null limit #{0},#{1}
</select>
<insert id="save" parameterType="com.yx.entity.Person">
insert into Person(username,idcard,unit,photourl,employee,car,reason,reserve,blacklist,accessdate,phone,goAddress,goods,sex,yxq,dept,room,office) values
(#{username},#{idcard},#{unit},#{photourl},#{employee},#{car},#{reason},#{reserve},#{blacklist},#{accessdate},#{phone},#{goAddress},#{goods},#{sex},#{yxq},#{dept},#{room},#{office})
</insert>
<update id="updateBlackList" parameterType="com.yx.entity.Person">
UPDATE Person set blacklist=#{blacklist} where idcard=#{idcard}
</update>
<update id="noBlackList" parameterType="com.yx.entity.Person">
UPDATE Person set blacklist=#{blacklist} where idcard=#{idcard}
</update>
<update id="personQuit" parameterType="com.yx.entity.Person">
UPDATE Person set blackaddress=#{blackaddress},leavedate=#{leavedate} where id=#{id}
</update>
<update id="leaveAll" parameterType="String">
UPDATE Person set leavedate=#{leavedate} where leavedate is null
</update>
</mapper>
\ No newline at end of file
package com.yx.dao;
import java.util.List;
import com.yx.entity.Register;
public interface RegisterMapper {
void save(Register register);
List<Register> findByName(Register register);
List<Register> defaultShow();
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yx.dao.RegisterMapper">
<insert id="save" parameterType="com.yx.entity.Register">
insert into Reserve(person,employee,reasondate,registerdate) values(#{person},#{employee},#{reasondate},#{registerdate})
</insert>
<select id="findByName" parameterType="com.yx.entity.Register" resultType="com.yx.entity.Register">
select * from Reserve where person=#{person} and employee=#{employee}
</select>
<select id="defaultShow" parameterType="com.yx.entity.Register" resultType="com.yx.entity.Register">
select id,person,employee,reasondate,registerdate from Reserve ORDER BY id DESC limit 0,10;
</select>
</mapper>
\ No newline at end of file
package com.yx.entity;
/**
* 访客所属单位实体类
* @author shaochangbin
*
*/
public class Company {
private int companyId;
private String companyName;
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public int getCompanyId() {
return companyId;
}
public void setCompanyId(int companyId) {
this.companyId = companyId;
}
@Override
public String toString() {
return "Company [companyId=" + companyId + ", companyName="
+ companyName + "]";
}
}
package com.yx.entity;
public class CountConditions {
private String personName; // 访客姓名
private String employeeName; // 被访人姓名
private String unit; // 访客单位
private String reason; // 来访原因
private String dept; // 被访人姓名
private String office; // 访客单位
private String room; // 来访原因
private String blackList; // 黑名单
private String startDate; // 查询开始时间
private String endDate; // 查询截止时间
private int current; // 第几页
public String getPersonName() {
return personName;
}
public void setPersonName(String personName) {
this.personName = personName;
}
public String getEmployeeName() {
return employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public String getOffice() {
return office;
}
public void setOffice(String office) {
this.office = office;
}
public String getRoom() {
return room;
}
public void setRoom(String room) {
this.room = room;
}
public String getBlackList() {
return blackList;
}
public void setBlackList(String blackList) {
this.blackList = blackList;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public int getCurrent() {
return current;
}
public void setCurrent(int current) {
this.current = current;
}
@Override
public String toString() {
return "CountConditions [personName=" + personName + ", employeeName="
+ employeeName + ", unit=" + unit + ", reason=" + reason
+ ", dept=" + dept + ", office=" + office + ", room=" + room
+ ", blackList=" + blackList + ", startDate=" + startDate
+ ", endDate=" + endDate + ", current=" + current + "]";
}
}
package com.yx.entity;
public class Employee {
private int id;
private String username;// 员工姓名
private String dept;// 职位
private String phone;// 手机号
private String tel;// 办公电话
private String office;// 职位
private String room;// 房间号
private String szm;// 姓名首字母
private String photourl;// 照片存储路径
private String checkin;// 员工签到
private String loginname;// 用户名
private String password;// 密码
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getOffice() {
return office;
}
public void setOffice(String office) {
this.office = office;
}
public String getRoom() {
return room;
}
public void setRoom(String room) {
this.room = room;
}
public String getSzm() {
return szm;
}
public void setSzm(String szm) {
this.szm = szm;
}
public String getPhotourl() {
return photourl;
}
public void setPhotourl(String photourl) {
this.photourl = photourl;
}
public String getCheckin() {
return checkin;
}
public void setCheckin(String checkin) {
this.checkin = checkin;
}
public String getLoginname() {
return loginname;
}
public void setLoginname(String loginname) {
this.loginname = loginname;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "Employee [id=" + id + ", username=" + username + ", dept="
+ dept + ", phone=" + phone + ", tel=" + tel + ", office="
+ office + ", room=" + room + ", szm=" + szm + ", photourl="
+ photourl + ", checkin=" + checkin + ", loginname="
+ loginname + ", password=" + password + "]";
}
}
package com.yx.entity;
public class FaceModel {
private int id;
private String username;
private byte[] facemodel;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public byte[] getFacemodel() {
return facemodel;
}
public void setFacemodel(byte[] facemodel) {
this.facemodel = facemodel;
}
@Override
public String toString() {
return "FaceModel [id=" + id + ", username=" + username
+ ", facemodel=" + facemodel + "]";
}
}
package com.yx.entity;
public class Page {
private String page;
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
@Override
public String toString() {
return "Page [page=" + page + ", getPage()=" + getPage()
+ ", getClass()=" + getClass() + ", hashCode()=" + hashCode()
+ ", toString()=" + super.toString() + "]";
}
}
package com.yx.entity;
import java.util.Date;
public class Person {
private int id;// 编号
private String username;// 访客姓名
private String idcard;// 访客身份证
private String unit;// 访客工作单位
private String photourl;// 访客照片存储路径
private String employee;// 被访问人员姓名
private String car;// 车辆信息
private String reason;// 访问原因
private String reserve;// 是否有预约
private String blacklist;// 是否是黑名单
private String accessdate;// 访问时间
private String leavedate;// 离开时间
private String phone;// 联系方式
private String goAddress;// 进入位置
private String blackaddress;// 离开位置
private String goods;// 携带物品
private String qrphotourl;// 二维码路径
private String room;// 被访人房间号
private String dept;// 被访人部门
private String office;// 被访人职位
// 身份证信息
private String sex;
private String yxq;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getIdcard() {
return idcard;
}
public void setIdcard(String idcard) {
this.idcard = idcard;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getPhotourl() {
return photourl;
}
public void setPhotourl(String photourl) {
this.photourl = photourl;
}
public String getEmployee() {
return employee;
}
public void setEmployee(String employee) {
this.employee = employee;
}
public String getCar() {
return car;
}
public void setCar(String car) {
this.car = car;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public String getReserve() {
return reserve;
}
public void setReserve(String reserve) {
this.reserve = reserve;
}
public String getBlacklist() {
return blacklist;
}
public void setBlacklist(String blacklist) {
this.blacklist = blacklist;
}
public String getAccessdate() {
return accessdate;
}
public void setAccessdate(String accessdate) {
this.accessdate = accessdate;
}
public String getLeavedate() {
return leavedate;
}
public void setLeavedate(String leavedate) {
this.leavedate = leavedate;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getGoAddress() {
return goAddress;
}
public void setGoAddress(String goAddress) {
this.goAddress = goAddress;
}
public String getBlackaddress() {
return blackaddress;
}
public void setBlackaddress(String blackaddress) {
this.blackaddress = blackaddress;
}
public String getGoods() {
return goods;
}
public void setGoods(String goods) {
this.goods = goods;
}
public String getQrphotourl() {
return qrphotourl;
}
public void setQrphotourl(String qrphotourl) {
this.qrphotourl = qrphotourl;
}
public String getRoom() {
return room;
}
public void setRoom(String room) {
this.room = room;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public String getOffice() {
return office;
}
public void setOffice(String office) {
this.office = office;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getYxq() {
return yxq;
}
public void setYxq(String yxq) {
this.yxq = yxq;
}
@Override
public String toString() {
return "Person [id=" + id + ", username=" + username + ", idcard="
+ idcard + ", unit=" + unit + ", photourl=" + photourl
+ ", employee=" + employee + ", car=" + car + ", reason="
+ reason + ", reserve=" + reserve + ", blacklist=" + blacklist
+ ", accessdate=" + accessdate + ", leavedate=" + leavedate
+ ", phone=" + phone + ", goAddress=" + goAddress
+ ", blackaddress=" + blackaddress + ", goods=" + goods
+ ", qrphotourl=" + qrphotourl + ", room=" + room + ", dept="
+ dept + ", office=" + office + ", sex=" + sex + ", yxq=" + yxq
+ "]";
}
}
package com.yx.entity;
public class Register {
private int id;
private String person;
private String employee;
private String reasondate;
private String registerdate;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPerson() {
return person;
}
public void setPerson(String person) {
this.person = person;
}
public String getEmployee() {
return employee;
}
public void setEmployee(String employee) {
this.employee = employee;
}
public String getReasondate() {
return reasondate;
}
public void setReasondate(String reasondate) {
this.reasondate = reasondate;
}
public String getRegisterdate() {
return registerdate;
}
public void setRegisterdate(String registerdate) {
this.registerdate = registerdate;
}
@Override
public String toString() {
return "Register [id=" + id + ", person=" + person + ", employee="
+ employee + ", reasondate=" + reasondate + ", registerdate="
+ registerdate + "]";
}
}
package com.yx.entity;
public class SoloPhoto {
private String idcard;
private String solourl;
private String solourl1;
public String getIdcard() {
return idcard;
}
public void setIdcard(String idcard) {
this.idcard = idcard;
}
public String getSolourl() {
return solourl;
}
public void setSolourl(String solourl) {
this.solourl = solourl;
}
public String getSolourl1() {
return solourl1;
}
public void setSolourl1(String solourl1) {
this.solourl1 = solourl1;
}
@Override
public String toString() {
return "SoloPhoto [idcard=" + idcard + ", solourl=" + solourl
+ ", solourl1=" + solourl1 + "]";
}
}
package com.yx.photo;
import com.sun.jna.Library;
import com.sun.jna.NativeLong;
import com.sun.jna.Platform;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.PointerByReference;
public interface AFD_FSDKLibrary extends Library {
AFD_FSDKLibrary INSTANCE = (AFD_FSDKLibrary)LoadUtils.loadLibrary(Platform.isWindows()?"libarcsoft_fsdk_face_detection.dll":"libarcsoft_fsdk_face_detection.so",AFD_FSDKLibrary.class);
NativeLong AFD_FSDK_InitialFaceEngine(String appid, String sdkid, Pointer pMem, int lMemSize, PointerByReference phEngine, int iOrientPriority, int nScale, int nMaxFaceNum);
NativeLong AFD_FSDK_StillImageFaceDetection(Pointer hEngine, ASVLOFFSCREEN pImgData, PointerByReference pFaceRes);
NativeLong AFD_FSDK_UninitialFaceEngine(Pointer hEngine);
AFD_FSDK_Version AFD_FSDK_GetVersion(Pointer hEngine);
}
\ No newline at end of file
package com.yx.photo;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.ptr.IntByReference;
public class AFD_FSDK_FACERES extends Structure {
public static class ByReference extends AFD_FSDK_FACERES implements Structure.ByReference {
public ByReference() {
}
public ByReference(Pointer p) {
super(p);
}
};
public int nFace;
public MRECT.ByReference rcFace;
public IntByReference lfaceOrient;
public AFD_FSDK_FACERES() {
}
public AFD_FSDK_FACERES(Pointer p) {
super(p);
read();
}
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] { "nFace", "rcFace", "lfaceOrient" });
}
}
package com.yx.photo;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Structure;
public class AFD_FSDK_Version extends Structure {
public int lCodebase;
public int lMajor;
public int lMinor;
public int lBuild;
public String Version;
public String BuildDate;
public String CopyRight;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] { "lCodebase", "lMajor", "lMinor", "lBuild", "Version", "BuildDate", "CopyRight" });
}
}
package com.yx.photo;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import com.sun.jna.Memory;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.FloatByReference;
import com.sun.jna.ptr.PointerByReference;
public class AFRTest {
public static final String APPID = "7wqvGwSD6mWU2QNLer27PQ2EM7otCaBDoqMLyQZ8B3mc";
public static final String FD_SDKKEY = "GadGzNEJLTzeaU7Dbk4mpSrnYb5BbaKNyyTLXyh7euqH";
public static final String FR_SDKKEY = "GadGzNEJLTzeaU7Dbk4mpSruhzLP9GHFz51yvaPuQCsf";
public static final int FD_WORKBUF_SIZE = 20 * 1024 * 1024;
public static final int FR_WORKBUF_SIZE = 40 * 1024 * 1024;
public static final int MAX_FACE_NUM = 50;
public static final boolean bUseRAWFile = false;
public static final boolean bUseBGRToEngine = true;
public static String contrastPhoto(String picpath1,String picpath2) {
System.out.println("#####################################################");
// init Engine
Pointer pFDWorkMem = CLibrary.INSTANCE.malloc(FD_WORKBUF_SIZE);
Pointer pFRWorkMem = CLibrary.INSTANCE.malloc(FR_WORKBUF_SIZE);
PointerByReference phFDEngine = new PointerByReference();
NativeLong ret = AFD_FSDKLibrary.INSTANCE.AFD_FSDK_InitialFaceEngine(APPID, FD_SDKKEY, pFDWorkMem, FD_WORKBUF_SIZE, phFDEngine, _AFD_FSDK_OrientPriority.AFD_FSDK_OPF_0_HIGHER_EXT, 32, MAX_FACE_NUM);
if (ret.longValue() != 0) {
CLibrary.INSTANCE.free(pFDWorkMem);
CLibrary.INSTANCE.free(pFRWorkMem);
System.out.println(String.format("AFD_FSDK_InitialFaceEngine ret 0x%x",ret.longValue()));
System.exit(0);
}
// print FDEngine version
Pointer hFDEngine = phFDEngine.getValue();
AFD_FSDK_Version versionFD = AFD_FSDKLibrary.INSTANCE.AFD_FSDK_GetVersion(hFDEngine);
System.out.println(String.format("%d %d %d %d", versionFD.lCodebase, versionFD.lMajor, versionFD.lMinor, versionFD.lBuild));
System.out.println(versionFD.Version);
System.out.println(versionFD.BuildDate);
System.out.println(versionFD.CopyRight);
PointerByReference phFREngine = new PointerByReference();
ret = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_InitialEngine(APPID, FR_SDKKEY, pFRWorkMem, FR_WORKBUF_SIZE, phFREngine);
if (ret.longValue() != 0) {
AFD_FSDKLibrary.INSTANCE.AFD_FSDK_UninitialFaceEngine(hFDEngine);
CLibrary.INSTANCE.free(pFDWorkMem);
CLibrary.INSTANCE.free(pFRWorkMem);
System.out.println(String.format("AFR_FSDK_InitialEngine ret 0x%x" ,ret.longValue()));
System.exit(0);
}
// print FREngine version
Pointer hFREngine = phFREngine.getValue();
AFR_FSDK_Version versionFR = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_GetVersion(hFREngine);
System.out.println(String.format("%d %d %d %d", versionFR.lCodebase, versionFR.lMajor, versionFR.lMinor, versionFR.lBuild));
System.out.println(versionFR.Version);
System.out.println(versionFR.BuildDate);
System.out.println(versionFR.CopyRight);
// load Image Data
ASVLOFFSCREEN inputImgA;
ASVLOFFSCREEN inputImgB;
if (bUseRAWFile) {
String filePathA = "001_640x480_I420.YUV";
int yuv_widthA = 640;
int yuv_heightA = 480;
int yuv_formatA = ASVL_COLOR_FORMAT.ASVL_PAF_I420;
String filePathB = "003_640x480_I420.YUV";
int yuv_widthB = 640;
int yuv_heightB = 480;
int yuv_formatB = ASVL_COLOR_FORMAT.ASVL_PAF_I420;
inputImgA = loadRAWImage(filePathA, yuv_widthA, yuv_heightA, yuv_formatA);
inputImgB = loadRAWImage(filePathB, yuv_widthB, yuv_heightB, yuv_formatB);
} else {
String filePathA = picpath1;
String filePathB = picpath2;
inputImgA = loadImage(filePathA);
inputImgB = loadImage(filePathB);
}
String result=String.format("%f" , compareFaceSimilarity(hFDEngine, hFREngine, inputImgA, inputImgB));
System.out.println(result);
//System.out.println(String.format("similarity between faceA and faceB is %f" , compareFaceSimilarity(hFDEngine, hFREngine, inputImgA, inputImgB)));
// release Engine
AFD_FSDKLibrary.INSTANCE.AFD_FSDK_UninitialFaceEngine(hFDEngine);
AFR_FSDKLibrary.INSTANCE.AFR_FSDK_UninitialEngine(hFREngine);
CLibrary.INSTANCE.free(pFDWorkMem);
CLibrary.INSTANCE.free(pFRWorkMem);
System.out.println("#####################################################");
return result;
}
public static FaceInfo[] doFaceDetection(Pointer hFDEngine, ASVLOFFSCREEN inputImg) {
FaceInfo[] faceInfo = new FaceInfo[0];
PointerByReference ppFaceRes = new PointerByReference();
NativeLong ret = AFD_FSDKLibrary.INSTANCE.AFD_FSDK_StillImageFaceDetection(hFDEngine, inputImg, ppFaceRes);
if (ret.longValue() != 0) {
System.out.println(String.format("AFD_FSDK_StillImageFaceDetection ret 0x%x" , ret.longValue()));
return faceInfo;
}
AFD_FSDK_FACERES faceRes = new AFD_FSDK_FACERES(ppFaceRes.getValue());
if (faceRes.nFace > 0) {
faceInfo = new FaceInfo[faceRes.nFace];
for (int i = 0; i < faceRes.nFace; i++) {
MRECT rect = new MRECT(new Pointer(Pointer.nativeValue(faceRes.rcFace.getPointer()) + faceRes.rcFace.size() * i));
int orient = faceRes.lfaceOrient.getPointer().getInt(i * 4);
faceInfo[i] = new FaceInfo();
faceInfo[i].left = rect.left;
faceInfo[i].top = rect.top;
faceInfo[i].right = rect.right;
faceInfo[i].bottom = rect.bottom;
faceInfo[i].orient = orient;
System.out.println(String.format("%d (%d %d %d %d) orient %d", i, rect.left, rect.top, rect.right, rect.bottom, orient));
}
}
return faceInfo;
}
public static AFR_FSDK_FACEMODEL extractFRFeature(Pointer hFREngine, ASVLOFFSCREEN inputImg, FaceInfo faceInfo) {
AFR_FSDK_FACEINPUT faceinput = new AFR_FSDK_FACEINPUT();
faceinput.lOrient = faceInfo.orient;
faceinput.rcFace.left = faceInfo.left;
faceinput.rcFace.top = faceInfo.top;
faceinput.rcFace.right = faceInfo.right;
faceinput.rcFace.bottom = faceInfo.bottom;
AFR_FSDK_FACEMODEL faceFeature = new AFR_FSDK_FACEMODEL();
NativeLong ret = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_ExtractFRFeature(hFREngine, inputImg, faceinput, faceFeature);
if (ret.longValue() != 0) {
System.out.println(String.format("AFR_FSDK_ExtractFRFeature ret 0x%x" ,ret.longValue()));
return null;
}
try {
return faceFeature.deepCopy();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static float compareFaceSimilarity(Pointer hFDEngine, Pointer hFREngine, ASVLOFFSCREEN inputImgA, ASVLOFFSCREEN inputImgB) {
// Do Face Detect
FaceInfo[] faceInfosA = doFaceDetection(hFDEngine, inputImgA);
if (faceInfosA.length < 1) {
System.out.println("no face in Image A ");
return 0.0f;
}
FaceInfo[] faceInfosB = doFaceDetection(hFDEngine, inputImgB);
if (faceInfosB.length < 1) {
System.out.println("no face in Image B ");
return 0.0f;
}
// Extract Face Feature
AFR_FSDK_FACEMODEL faceFeatureA = extractFRFeature(hFREngine, inputImgA, faceInfosA[0]);
if (faceFeatureA == null) {
System.out.println("extract face feature in Image A failed");
return 0.0f;
}
AFR_FSDK_FACEMODEL faceFeatureB = extractFRFeature(hFREngine, inputImgB, faceInfosB[0]);
if (faceFeatureB == null) {
System.out.println("extract face feature in Image B failed");
faceFeatureA.freeUnmanaged();
return 0.0f;
}
// calc similarity between faceA and faceB
FloatByReference fSimilScore = new FloatByReference(0.0f);
NativeLong ret = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_FacePairMatching(hFREngine, faceFeatureA, faceFeatureB, fSimilScore);
faceFeatureA.freeUnmanaged();
faceFeatureB.freeUnmanaged();
if (ret.longValue() != 0) {
System.out.println(String.format("AFR_FSDK_FacePairMatching failed:ret 0x%x" ,ret.longValue()));
return 0.0f;
}
return fSimilScore.getValue();
}
public static ASVLOFFSCREEN loadRAWImage(String yuv_filePath, int yuv_width, int yuv_height, int yuv_format) {
int yuv_rawdata_size = 0;
ASVLOFFSCREEN inputImg = new ASVLOFFSCREEN();
inputImg.u32PixelArrayFormat = yuv_format;
inputImg.i32Width = yuv_width;
inputImg.i32Height = yuv_height;
if (ASVL_COLOR_FORMAT.ASVL_PAF_I420 == inputImg.u32PixelArrayFormat) {
inputImg.pi32Pitch[0] = inputImg.i32Width;
inputImg.pi32Pitch[1] = inputImg.i32Width / 2;
inputImg.pi32Pitch[2] = inputImg.i32Width / 2;
yuv_rawdata_size = inputImg.i32Width * inputImg.i32Height * 3 / 2;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_NV12 == inputImg.u32PixelArrayFormat) {
inputImg.pi32Pitch[0] = inputImg.i32Width;
inputImg.pi32Pitch[1] = inputImg.i32Width;
yuv_rawdata_size = inputImg.i32Width * inputImg.i32Height * 3 / 2;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_NV21 == inputImg.u32PixelArrayFormat) {
inputImg.pi32Pitch[0] = inputImg.i32Width;
inputImg.pi32Pitch[1] = inputImg.i32Width;
yuv_rawdata_size = inputImg.i32Width * inputImg.i32Height * 3 / 2;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_YUYV == inputImg.u32PixelArrayFormat) {
inputImg.pi32Pitch[0] = inputImg.i32Width * 2;
yuv_rawdata_size = inputImg.i32Width * inputImg.i32Height * 2;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_RGB24_B8G8R8 == inputImg.u32PixelArrayFormat) {
inputImg.pi32Pitch[0] = inputImg.i32Width * 3;
yuv_rawdata_size = inputImg.i32Width * inputImg.i32Height * 3;
} else {
System.out.println("unsupported yuv format");
System.exit(0);
}
// load YUV Image Data from File
byte[] imagedata = new byte[yuv_rawdata_size];
File f = new File(yuv_filePath);
InputStream ios = null;
try {
ios = new FileInputStream(f);
ios.read(imagedata,0,yuv_rawdata_size);
} catch (Exception e) {
e.printStackTrace();
System.out.println("error in loading yuv file");
System.exit(0);
} finally {
try {
if (ios != null) {
ios.close();
}
} catch (IOException e) {
}
}
if (ASVL_COLOR_FORMAT.ASVL_PAF_I420 == inputImg.u32PixelArrayFormat) {
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, imagedata, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = new Memory(inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[1].write(0, imagedata, inputImg.pi32Pitch[0] * inputImg.i32Height, inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[2] = new Memory(inputImg.pi32Pitch[2] * inputImg.i32Height / 2);
inputImg.ppu8Plane[2].write(0, imagedata, inputImg.pi32Pitch[0] * inputImg.i32Height + inputImg.pi32Pitch[1] * inputImg.i32Height / 2, inputImg.pi32Pitch[2] * inputImg.i32Height / 2);
inputImg.ppu8Plane[3] = Pointer.NULL;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_NV12 == inputImg.u32PixelArrayFormat) {
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, imagedata, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = new Memory(inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[1].write(0, imagedata, inputImg.pi32Pitch[0] * inputImg.i32Height, inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_NV21 == inputImg.u32PixelArrayFormat) {
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, imagedata, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = new Memory(inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[1].write(0, imagedata, inputImg.pi32Pitch[0] * inputImg.i32Height, inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_YUYV == inputImg.u32PixelArrayFormat) {
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, imagedata, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = Pointer.NULL;
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_RGB24_B8G8R8 == inputImg.u32PixelArrayFormat) {
inputImg.ppu8Plane[0] = new Memory(imagedata.length);
inputImg.ppu8Plane[0].write(0, imagedata, 0, imagedata.length);
inputImg.ppu8Plane[1] = Pointer.NULL;
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
} else {
System.out.println("unsupported yuv format");
System.exit(0);
}
inputImg.setAutoRead(false);
return inputImg;
}
public static ASVLOFFSCREEN loadImage(String filePath) {
ASVLOFFSCREEN inputImg = new ASVLOFFSCREEN();
if (bUseBGRToEngine) {
BufferInfo bufferInfo = ImageLoader.getBGRFromFile(filePath);
inputImg.u32PixelArrayFormat = ASVL_COLOR_FORMAT.ASVL_PAF_RGB24_B8G8R8;
inputImg.i32Width = bufferInfo.width;
inputImg.i32Height = bufferInfo.height;
inputImg.pi32Pitch[0] = inputImg.i32Width * 3;
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, bufferInfo.buffer, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = Pointer.NULL;
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
} else {
BufferInfo bufferInfo = ImageLoader.getI420FromFile(filePath);
inputImg.u32PixelArrayFormat = ASVL_COLOR_FORMAT.ASVL_PAF_I420;
inputImg.i32Width = bufferInfo.width;
inputImg.i32Height = bufferInfo.height;
inputImg.pi32Pitch[0] = inputImg.i32Width;
inputImg.pi32Pitch[1] = inputImg.i32Width / 2;
inputImg.pi32Pitch[2] = inputImg.i32Width / 2;
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, bufferInfo.buffer, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = new Memory(inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[1].write(0, bufferInfo.buffer, inputImg.pi32Pitch[0] * inputImg.i32Height, inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[2] = new Memory(inputImg.pi32Pitch[2] * inputImg.i32Height / 2);
inputImg.ppu8Plane[2].write(0, bufferInfo.buffer, inputImg.pi32Pitch[0] * inputImg.i32Height + inputImg.pi32Pitch[1] * inputImg.i32Height / 2, inputImg.pi32Pitch[2] * inputImg.i32Height / 2);
inputImg.ppu8Plane[3] = Pointer.NULL;
}
inputImg.setAutoRead(false);
return inputImg;
}
}
package com.yx.photo;
import java.io.File;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
//import com.arcsoft.AFD_FSDKLibrary;
//import com.arcsoft.AFD_FSDK_FACERES;
//import com.arcsoft.AFD_FSDK_Version;
//import com.arcsoft.AFR_FSDKLibrary;
//import com.arcsoft.AFR_FSDK_FACEINPUT;
//import com.arcsoft.AFR_FSDK_FACEMODEL;
//import com.arcsoft.AFR_FSDK_Version;
//import com.arcsoft.ASVLOFFSCREEN;
//import com.arcsoft.ASVL_COLOR_FORMAT;
//import com.arcsoft.CLibrary;
//import com.arcsoft.FaceInfo;
//import com.arcsoft.MRECT;
//import com.arcsoft._AFD_FSDK_OrientPriority;
//import com.arcsoft.utils.BufferInfo;
//import com.arcsoft.utils.ImageLoader;
import com.sun.jna.Memory;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.FloatByReference;
import com.sun.jna.ptr.PointerByReference;
import com.yx.controller.EmployeeController;
import com.yx.entity.FaceModel;
import com.yx.service.EmployeeServiceImpl;
public class AFRTestN {
//初始化授权参数
public static final String APPID = "7wqvGwSD6mWU2QNLer27PQ2EM7otCaBDoqMLyQZ8B3mc";
public static final String FD_SDKKEY = "GadGzNEJLTzeaU7Dbk4mpSrnYb5BbaKNyyTLXyh7euqH";
public static final String FR_SDKKEY = "GadGzNEJLTzeaU7Dbk4mpSruhzLP9GHFz51yvaPuQCsf";
public static final int FD_WORKBUF_SIZE = 20 * 1024 * 1024;
public static final int FR_WORKBUF_SIZE = 40 * 1024 * 1024;
public static final int MAX_FACE_NUM = 50;
public static final boolean bUseBGRToEngine = true;
//声明获取手动输入对比文件名的对象
public static Scanner input = new Scanner(System.in);
public static String inputFileNameA = "";
public static String filePahtA = "";
//resultMin为实时的对比百分比结果,result做为相像的百分比结果。
public static float resultMin = 0.0f;
public static float result = 0.0f;
public static String resultFile = null;
public static String multipleContrast(AFR_FSDK_FACEMODEL faceModel,List<FaceModel> list) throws Exception {
AFR_FSDK_FACEMODEL aff = new AFR_FSDK_FACEMODEL();
System.out.println("#####################################################"+faceModel.toString());
// for(FaceModel f:list){
// AFR_FSDK_FACEMODEL array = aff.fromByteArray(f.getFacemodel());
// System.out.println("-------------------------------->"+array.toString());
// }
// init Engine
Pointer pFDWorkMem = CLibrary.INSTANCE.malloc(FD_WORKBUF_SIZE);
Pointer pFRWorkMem = CLibrary.INSTANCE.malloc(FR_WORKBUF_SIZE);
PointerByReference phFDEngine = new PointerByReference();
NativeLong ret = AFD_FSDKLibrary.INSTANCE.AFD_FSDK_InitialFaceEngine(APPID, FD_SDKKEY, pFDWorkMem, FD_WORKBUF_SIZE, phFDEngine, _AFD_FSDK_OrientPriority.AFD_FSDK_OPF_0_HIGHER_EXT, 32, MAX_FACE_NUM);
if (ret.longValue() != 0) {
CLibrary.INSTANCE.free(pFDWorkMem);
CLibrary.INSTANCE.free(pFRWorkMem);
System.out.println(String.format("AFD_FSDK_InitialFaceEngine ret 0x%x",ret.longValue()));
System.exit(0);
}
// print FDEngine version
Pointer hFDEngine = phFDEngine.getValue();
AFD_FSDK_Version versionFD = AFD_FSDKLibrary.INSTANCE.AFD_FSDK_GetVersion(hFDEngine);
System.out.println(String.format("%d %d %d %d", versionFD.lCodebase, versionFD.lMajor, versionFD.lMinor, versionFD.lBuild));
System.out.println(versionFD.Version);
System.out.println(versionFD.BuildDate);
System.out.println(versionFD.CopyRight);
PointerByReference phFREngine = new PointerByReference();
ret = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_InitialEngine(APPID, FR_SDKKEY, pFRWorkMem, FR_WORKBUF_SIZE, phFREngine);
if (ret.longValue() != 0) {
AFD_FSDKLibrary.INSTANCE.AFD_FSDK_UninitialFaceEngine(hFDEngine);
CLibrary.INSTANCE.free(pFDWorkMem);
CLibrary.INSTANCE.free(pFRWorkMem);
System.out.println(String.format("AFR_FSDK_InitialEngine ret 0x%x" ,ret.longValue()));
System.exit(0);
}
// print FREngine version
Pointer hFREngine = phFREngine.getValue();
AFR_FSDK_Version versionFR = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_GetVersion(hFREngine);
System.out.println(String.format("%d %d %d %d", versionFR.lCodebase, versionFR.lMajor, versionFR.lMinor, versionFR.lBuild));
System.out.println(versionFR.Version);
System.out.println(versionFR.BuildDate);
System.out.println(versionFR.CopyRight);
// load Image Data
ASVLOFFSCREEN inputImgA;
ASVLOFFSCREEN inputImgB;
long matchingTime = System.currentTimeMillis();
result = 0.0f;
resultFile = "";
for (int i = 0; i <= list.size() - 1; i++){
/*
*人像识别结果ret.longValue为对比成功与否的结果(包括错误原因),fSimilscore.getValue()为相似度
*/
FloatByReference fSimilScore = new FloatByReference(0.0f);
// ret = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_FacePairMatching(hFREngine,
// aff.fromByteArray(list.get(0).getFacemodel()),
// faceFeatureMap.get(filePathB[i].getName()), fSimilScore);
ret = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_FacePairMatching(hFREngine,
faceModel,aff.fromByteArray(list.get(i).getFacemodel()), fSimilScore);
resultMin = fSimilScore.getValue();
if(ret.longValue()!=0){
result = 0.0f;
}else if(resultMin==1){
result = resultMin;
resultFile = list.get(i).getUsername();
System.out.println("输入的文件与" + list.get(i).getUsername() +"相似度为100%");
continue;
}
if(result<resultMin){
result = resultMin;
resultFile = list.get(i).getUsername();
// System.out.println("输入的文件与"+resultFile+"的对比结果是:"+result);
}
System.out.println("输入的文件与" + list.get(i).getUsername() + "的对比结果是:" + resultMin);
}
System.out.println("最终输入的文件与"+resultFile+"最为相似,对比结果为:"+result);
// System.out.println("图片A输入名字到匹配结束时间:"+(System.currentTimeMillis()-initPicA));
System.out.println("所有图片特征对比用时:"+(System.currentTimeMillis()-matchingTime));
// }
AFD_FSDKLibrary.INSTANCE.AFD_FSDK_UninitialFaceEngine(hFDEngine);
AFR_FSDKLibrary.INSTANCE.AFR_FSDK_UninitialEngine(hFREngine);
//注销引擎
CLibrary.INSTANCE.free(pFDWorkMem);
CLibrary.INSTANCE.free(pFRWorkMem);
System.out.println("#####################################################");
return ""+result;
}
/**
* 人像在图片中的位置 左,上,右,下,角度
* @param hFDEngine 图像检测引擎
* @param inputImg 图像素描图
* @return 人像在图片中的位置 左,上,右,下,角度
*/
public static FaceInfo[] doFaceDetection(Pointer hFDEngine, ASVLOFFSCREEN inputImg) {
FaceInfo[] faceInfo = new FaceInfo[0];
PointerByReference ppFaceRes = new PointerByReference();
NativeLong ret = AFD_FSDKLibrary.INSTANCE.AFD_FSDK_StillImageFaceDetection(hFDEngine, inputImg, ppFaceRes);
if (ret.longValue() != 0) {
System.out.println(String.format("AFD_FSDK_StillImageFaceDetection ret 0x%x" , ret.longValue()));
return faceInfo;
}
AFD_FSDK_FACERES faceRes = new AFD_FSDK_FACERES(ppFaceRes.getValue());
if (faceRes.nFace > 0) {
faceInfo = new FaceInfo[faceRes.nFace];
for (int i = 0; i < faceRes.nFace; i++) {
MRECT rect = new MRECT(new Pointer(Pointer.nativeValue(faceRes.rcFace.getPointer()) + faceRes.rcFace.size() * i));
int orient = faceRes.lfaceOrient.getPointer().getInt(i * 4);
faceInfo[i] = new FaceInfo();
faceInfo[i].left = rect.left;
faceInfo[i].top = rect.top;
faceInfo[i].right = rect.right;
faceInfo[i].bottom = rect.bottom;
faceInfo[i].orient = orient;
System.out.println(String.format("%d (%d %d %d %d) orient %d", i, rect.left, rect.top, rect.right, rect.bottom, orient));
}
}
return faceInfo;
}
/**
* 获得图像中的人像特征
* @param hFREngine 图片对比引擎
* @param inputImg 图片的素描图
* @param faceInfo 人像在图片中的位置 左,上,右,下,角度
* @return 人像特征
*/
public static AFR_FSDK_FACEMODEL extractFRFeature(Pointer hFREngine, ASVLOFFSCREEN inputImg, FaceInfo faceInfo) {
AFR_FSDK_FACEINPUT faceinput = new AFR_FSDK_FACEINPUT();
faceinput.lOrient = faceInfo.orient;
faceinput.rcFace.left = faceInfo.left;
faceinput.rcFace.top = faceInfo.top;
faceinput.rcFace.right = faceInfo.right;
faceinput.rcFace.bottom = faceInfo.bottom;
AFR_FSDK_FACEMODEL faceFeature = new AFR_FSDK_FACEMODEL();
NativeLong ret = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_ExtractFRFeature(hFREngine, inputImg, faceinput, faceFeature);
if (ret.longValue() != 0) {
System.out.println(String.format("AFR_FSDK_ExtractFRFeature ret 0x%x" ,ret.longValue()));
return null;
}
try {
return faceFeature.deepCopy();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 获得图片的素描图
* @param filePath 图片的路径
* @return 素描图
*/
public static ASVLOFFSCREEN loadImage(String filePath) {
ASVLOFFSCREEN inputImg = new ASVLOFFSCREEN();
if (bUseBGRToEngine) {
BufferInfo bufferInfo = ImageLoader.getBGRFromFile(filePath);
inputImg.u32PixelArrayFormat = ASVL_COLOR_FORMAT.ASVL_PAF_RGB24_B8G8R8;
inputImg.i32Width = bufferInfo.width;
inputImg.i32Height = bufferInfo.height;
inputImg.pi32Pitch[0] = inputImg.i32Width * 3;
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, bufferInfo.buffer, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = Pointer.NULL;
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
} else {
BufferInfo bufferInfo = ImageLoader.getI420FromFile(filePath);
inputImg.u32PixelArrayFormat = ASVL_COLOR_FORMAT.ASVL_PAF_I420;
inputImg.i32Width = bufferInfo.width;
inputImg.i32Height = bufferInfo.height;
inputImg.pi32Pitch[0] = inputImg.i32Width;
inputImg.pi32Pitch[1] = inputImg.i32Width / 2;
inputImg.pi32Pitch[2] = inputImg.i32Width / 2;
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, bufferInfo.buffer, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = new Memory(inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[1].write(0, bufferInfo.buffer, inputImg.pi32Pitch[0] * inputImg.i32Height, inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[2] = new Memory(inputImg.pi32Pitch[2] * inputImg.i32Height / 2);
inputImg.ppu8Plane[2].write(0, bufferInfo.buffer, inputImg.pi32Pitch[0] * inputImg.i32Height + inputImg.pi32Pitch[1] * inputImg.i32Height / 2, inputImg.pi32Pitch[2] * inputImg.i32Height / 2);
inputImg.ppu8Plane[3] = Pointer.NULL;
}
inputImg.setAutoRead(false);
return inputImg;
}
}
package com.yx.photo;
import com.sun.jna.Library;
import com.sun.jna.NativeLong;
import com.sun.jna.Platform;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.FloatByReference;
import com.sun.jna.ptr.PointerByReference;
public interface AFR_FSDKLibrary extends Library {
AFR_FSDKLibrary INSTANCE = (AFR_FSDKLibrary)LoadUtils.loadLibrary(Platform.isWindows()?"libarcsoft_fsdk_face_recognition.dll":"libarcsoft_fsdk_face_recognition.so",AFR_FSDKLibrary.class);
NativeLong AFR_FSDK_InitialEngine(
String appid,
String sdkid,
Pointer pMem,
int lMemSize,
PointerByReference phEngine
);
NativeLong AFR_FSDK_ExtractFRFeature(
Pointer hEngine,
ASVLOFFSCREEN pImgData,
AFR_FSDK_FACEINPUT pFaceRes,
AFR_FSDK_FACEMODEL pFaceModels
);
NativeLong AFR_FSDK_FacePairMatching(
Pointer hEngine,
AFR_FSDK_FACEMODEL reffeature,
AFR_FSDK_FACEMODEL probefeature,
FloatByReference pfSimilScore
);
NativeLong AFR_FSDK_UninitialEngine(Pointer hEngine);
AFR_FSDK_Version AFR_FSDK_GetVersion(Pointer hEngine);
}
\ No newline at end of file
package com.yx.photo;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Structure;
public class AFR_FSDK_FACEINPUT extends Structure {
public MRECT.ByValue rcFace;
public int lOrient;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] {
"rcFace", "lOrient"
});
}
}
package com.yx.photo;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.ptr.ByteByReference;
public class AFR_FSDK_FACEMODEL extends Structure {
public ByteByReference pbFeature;
public int lFeatureSize;
protected boolean bAllocByMalloc;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] {
"pbFeature", "lFeatureSize"
});
}
public AFR_FSDK_FACEMODEL deepCopy() throws Exception{
if(!isValid()){
throw new Exception("invalid feature");
}
AFR_FSDK_FACEMODEL feature = new AFR_FSDK_FACEMODEL();
feature.bAllocByMalloc = true;
feature.lFeatureSize = lFeatureSize;
feature.pbFeature = new ByteByReference();
feature.pbFeature.setPointer(CLibrary.INSTANCE.malloc(feature.lFeatureSize));
CLibrary.INSTANCE.memcpy(feature.pbFeature.getPointer(),pbFeature.getPointer(),feature.lFeatureSize);
return feature;
}
public synchronized void freeUnmanaged(){
if(bAllocByMalloc&&isValid()){
CLibrary.INSTANCE.free(pbFeature.getPointer());
pbFeature = null;
//System.out.println("gc feature freeUnmanaged");
}
}
@Override
protected void finalize() throws Throwable {
freeUnmanaged();
}
public static AFR_FSDK_FACEMODEL fromByteArray(byte[] byteArray) throws Exception{
if(byteArray == null){
throw new Exception("invalid byteArray");
}
AFR_FSDK_FACEMODEL feature = new AFR_FSDK_FACEMODEL();
feature.lFeatureSize = byteArray.length;
feature.bAllocByMalloc = true;
feature.pbFeature = new ByteByReference();
feature.pbFeature.setPointer(CLibrary.INSTANCE.malloc(feature.lFeatureSize));
feature.pbFeature.getPointer().write(0, byteArray, 0, feature.lFeatureSize);
return feature;
}
public byte[] toByteArray() throws Exception{
if(!isValid()){
throw new Exception("invalid feature");
}
return pbFeature.getPointer().getByteArray(0, lFeatureSize);
}
private boolean isValid() {
return ((pbFeature != null)&&(Pointer.nativeValue(pbFeature.getPointer())!= 0));
}
}
package com.yx.photo;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Structure;
public class AFR_FSDK_Version extends Structure {
public int lCodebase;
public int lMajor;
public int lMinor;
public int lBuild;
public int lFeatureLevel;
public String Version;
public String BuildDate;
public String CopyRight;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] {
"lCodebase", "lMajor", "lMinor", "lBuild","lFeatureLevel","Version", "BuildDate", "CopyRight"
});
}
}
package com.yx.photo;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
public class ASVLOFFSCREEN extends Structure {
public int u32PixelArrayFormat;
public int i32Width;
public int i32Height;
public Pointer[] ppu8Plane = new Pointer[4];
public int[] pi32Pitch = new int[4];
public ASVLOFFSCREEN(){
}
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] {
"u32PixelArrayFormat", "i32Width", "i32Height", "ppu8Plane","pi32Pitch"
});
}
}
package com.yx.photo;
public class ASVL_COLOR_FORMAT {
public static final int ASVL_PAF_I420 = 0x601;
public static final int ASVL_PAF_NV12 = 0x801;
public static final int ASVL_PAF_NV21 = 0x802;
public static final int ASVL_PAF_YUYV = 0x501;
public static final int ASVL_PAF_RGB24_B8G8R8 = 0x201;
}
package com.yx.photo;
public class BufferInfo {
public int width;
public int height;
public byte[] buffer;
public BufferInfo(int w, int h, byte[] buf) {
width = w;
height = h;
buffer = buf;
}
}
\ No newline at end of file
package com.yx.photo;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Platform;
import com.sun.jna.Pointer;
public interface CLibrary extends Library {
CLibrary INSTANCE = (CLibrary)Native.loadLibrary((Platform.isWindows() ? "msvcrt" : "c"),CLibrary.class);
Pointer malloc(int len);
void free(Pointer p);
void printf(String format, Object... args);
Pointer memcpy(Pointer dst,Pointer src,long size);
}
\ No newline at end of file
package com.yx.photo;
public class FaceInfo {
public int left;
public int top;
public int right;
public int bottom;
public int orient;
}
package com.yx.photo;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import javax.imageio.ImageIO;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
public class ImageLoader {
public static final boolean USING_FLOAT = false;
public static BufferInfo getI420FromFile(String filePath) {
byte[] yuv = null;
int w = 0;
int h = 0;
try {
BufferedImage img = ImageIO.read(new File(filePath));
if (((img.getWidth() & 0x1) != 0) || ((img.getHeight() & 0x1) != 0)) {
img = img.getSubimage(0, 0, img.getWidth() & 0xFFFFFFFE, img.getHeight() & 0xFFFFFFFE);
}
w = img.getWidth();
h = img.getHeight();
int[] bgra = img.getRGB(0, 0, w, h, null, 0, w);
if(USING_FLOAT){
yuv = BGRA2I420_float(bgra, w, h);
}else{
yuv = BGRA2I420(bgra, w, h);
}
} catch (IOException e) {
e.printStackTrace();
System.exit(0);
}
return new BufferInfo(w, h, yuv);
}
public static BufferInfo getBGRFromFile(String filePath) {
byte[] bgr = null;
int width = 0;
int height = 0;
if(filePath.matches("(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]")){
FileOutputStream fos = null;
BufferedInputStream bis = null;
HttpURLConnection httpUrl = null;
URL url = null;
int BUFFER_SIZE = 1024;
byte[] buf = new byte[BUFFER_SIZE];
int size = 0;
try {
url = new URL(filePath);
httpUrl = (HttpURLConnection) url.openConnection();
httpUrl.connect();
BufferedImage img = ImageIO.read(httpUrl.getInputStream());
width = img.getWidth();
height = img.getHeight();
BufferedImage bgrimg = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
bgrimg.setRGB(0, 0, width, height, img.getRGB(0, 0, width, height, null, 0, width), 0, width);
bgr = ((DataBufferByte)bgrimg.getRaster().getDataBuffer()).getData();
} catch (IOException e) {
} catch (ClassCastException e) {
} finally {
try {
fos.close();
bis.close();
httpUrl.disconnect();
} catch (IOException e) {
} catch (NullPointerException e) {
}
}
return new BufferInfo(width, height, bgr);
}
try {
BufferedImage img = ImageIO.read(new File(filePath));
width = img.getWidth();
height = img.getHeight();
BufferedImage bgrimg = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
bgrimg.setRGB(0, 0, width, height, img.getRGB(0, 0, width, height, null, 0, width), 0, width);
bgr = ((DataBufferByte)bgrimg.getRaster().getDataBuffer()).getData();
} catch (IOException e) {
e.printStackTrace();
System.exit(0);
}
return new BufferInfo(width, height, bgr);
}
//Full swing for BT.601
public static byte[] BGRA2I420(int[] bgra, int width, int height) {
byte[] yuv = new byte[width * height * 3 / 2];
int u_offset = width * height;
int y_offset = width * height * 5 / 4;
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
int rgb = bgra[i * width + j] & 0x00FFFFFF;
int b = rgb & 0xFF;
int g = (rgb >> 8) & 0xFF;
int r = (rgb >> 16) & 0xFF;
int y = ((77 * r + 150 * g + 29 * b + 128) >> 8);
int u = (((-43) * r - 84 * g + 127 * b + 128) >> 8) + 128;
int v = ((127 * r - 106 * g - 21 * b + 128) >> 8) + 128;
y = y < 0 ? 0 : (y > 255 ? 255 : y);
u = u < 0 ? 0 : (u > 255 ? 255 : u);
v = v < 0 ? 0 : (v > 255 ? 255 : v);
yuv[i * width + j] = (byte) y;
yuv[u_offset + (i >> 1) * (width >> 1) + (j >> 1)] = (byte) u;
yuv[y_offset + (i >> 1) * (width >> 1) + (j >> 1)] = (byte) v;
}
}
return yuv;
}
// ITU-R standard for YCbCr
// Y = 0.299R + 0.587G + 0.114B
// U = -0.169R - 0.331G + 0.499B + 128
// V = 0.499R - 0.418G - 0.0813B + 128
public static byte[] BGRA2I420_float(int[] bgra, int width, int height) {
byte[] yuv = new byte[width * height * 3 / 2];
int u_offset = width * height;
int y_offset = width * height * 5 / 4;
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
int rgb = bgra[i * width + j] & 0x00FFFFFF;
float b = (rgb & 0xFF);
float g = ((rgb >> 8) & 0xFF);
float r = ((rgb >> 16) & 0xFF);
float y = (0.299f * r + 0.587f * g + 0.114f * b) ;
float u = (-0.169f) * r - 0.331f* g + 0.499f * b + 128.0f;
float v = 0.499f * r - 0.418f * g - 0.0813f * b + 128.0f;
yuv[i * width + j] = (byte) y;
yuv[u_offset + (i >> 1) * (width >> 1) + (j >> 1)] = (byte) u;
yuv[y_offset + (i >> 1) * (width >> 1) + (j >> 1)] = (byte) v;
}
}
return yuv;
}
}
package com.yx.photo;
//import com.arcsoft.*;
//import com.arcsoft.utils.BufferInfo;
//import com.arcsoft.utils.ImageLoader;
//import com.arcsoft.utils.SerializeUtil;
import com.sun.jna.Memory;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.FloatByReference;
import com.sun.jna.ptr.PointerByReference;
import com.yx.entity.Person;
import org.bytedeco.javacpp.opencv_core;
import org.bytedeco.javacpp.opencv_imgproc;
import org.bytedeco.javacv.*;
import redis.clients.jedis.Jedis;
import javax.swing.*;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Administrator on 2017/11/15.
*/
class LoadImageFromGrabber {
public static final String APPID = "7wqvGwSD6mWU2QNLer27PQ2EM7otCaBDoqMLyQZ8B3mc";
public static final String FD_SDKKEY = "GadGzNEJLTzeaU7Dbk4mpSrnYb5BbaKNyyTLXyh7euqH";
public static final String FR_SDKKEY = "GadGzNEJLTzeaU7Dbk4mpSruhzLP9GHFz51yvaPuQCsf";
public static final int FD_WORKBUF_SIZE = 20 * 1024 * 1024;
public static final int FR_WORKBUF_SIZE = 40 * 1024 * 1024;
public static final int MAX_FACE_NUM = 50;
public static final boolean bUseRAWFile = false;
public static final boolean bUseBGRToEngine = true;
// public static Jedis jedis ;
static OpenCVFrameConverter.ToIplImage converter = new OpenCVFrameConverter.ToIplImage();
public static void main(String[] args)throws FrameGrabber.Exception,InterruptedException {
System.out.println("#####################################################");
// jedis = new Jedis("127.0.0.1", 6379);
// init Engine
Pointer pFDWorkMem = CLibrary.INSTANCE.malloc(FD_WORKBUF_SIZE);
Pointer pFRWorkMem = CLibrary.INSTANCE.malloc(FR_WORKBUF_SIZE);
PointerByReference phFDEngine = new PointerByReference();
NativeLong ret = AFD_FSDKLibrary.INSTANCE.AFD_FSDK_InitialFaceEngine(APPID, FD_SDKKEY, pFDWorkMem, FD_WORKBUF_SIZE, phFDEngine, _AFD_FSDK_OrientPriority.AFD_FSDK_OPF_0_HIGHER_EXT, 32, MAX_FACE_NUM);
if (ret.longValue() != 0) {
CLibrary.INSTANCE.free(pFDWorkMem);
CLibrary.INSTANCE.free(pFRWorkMem);
System.out.println(String.format("AFD_FSDK_InitialFaceEngine ret 0x%x",ret.longValue()));
System.exit(0);
}
// print FDEngine version
Pointer hFDEngine = phFDEngine.getValue();
AFD_FSDK_Version versionFD = AFD_FSDKLibrary.INSTANCE.AFD_FSDK_GetVersion(hFDEngine);
System.out.println(String.format("%d %d %d %d", versionFD.lCodebase, versionFD.lMajor, versionFD.lMinor, versionFD.lBuild));
System.out.println(versionFD.Version);
System.out.println(versionFD.BuildDate);
System.out.println(versionFD.CopyRight);
PointerByReference phFREngine = new PointerByReference();
ret = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_InitialEngine(APPID, FR_SDKKEY, pFRWorkMem, FR_WORKBUF_SIZE, phFREngine);
if (ret.longValue() != 0) {
AFD_FSDKLibrary.INSTANCE.AFD_FSDK_UninitialFaceEngine(hFDEngine);
CLibrary.INSTANCE.free(pFDWorkMem);
CLibrary.INSTANCE.free(pFRWorkMem);
System.out.println(String.format("AFR_FSDK_InitialEngine ret 0x%x" ,ret.longValue()));
System.exit(0);
}
// print FREngine version
Pointer hFREngine = phFREngine.getValue();
AFR_FSDK_Version versionFR = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_GetVersion(hFREngine);
System.out.println(String.format("%d %d %d %d", versionFR.lCodebase, versionFR.lMajor, versionFR.lMinor, versionFR.lBuild));
System.out.println(versionFR.Version);
System.out.println(versionFR.BuildDate);
System.out.println(versionFR.CopyRight);
CanvasFrame canvas = new CanvasFrame("摄像头");//新建一个窗口
canvas.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
canvas.setAlwaysOnTop(true);
OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(0);
grabber.start(); //开始获取摄像头数据
// load Image Data
ASVLOFFSCREEN inputImgA;
ASVLOFFSCREEN inputImgB;
String filePathImg = "img";
File file = new File(filePathImg);
File[] filePathB = file.listFiles();
Map<String,AFR_FSDK_FACEMODEL> faceFeatureMap = new HashMap<>();
AFR_FSDK_FACEMODEL faceFeatureA;
AFR_FSDK_FACEMODEL faceFeatureB;
for(int j = 0; j < filePathB.length; j++){
inputImgB = loadLocalImage("img/"+ filePathB[j].getName());
//得到图片文件夹中所有照片的人像位置
FaceInfo[] faceInfosB = doFaceDetection(hFDEngine, inputImgB);
//取得图片文件夹中所有照片的人像特征
faceFeatureB = extractFRFeature(hFREngine, inputImgB, faceInfosB[0]);
if(faceFeatureB!=null) {
System.out.println("人像特征:" + "faceFeatureB");
}else{
System.out.println("人像特征为空!");
}
faceFeatureMap.put(filePathB[j].getName(),faceFeatureB);
// redisJava.setObject();
if(filePathB[j].getName()!=null && faceFeatureB!=null) {
// setFaceFeature(filePathB[j].getName(), faceFeatureB);
}else{
System.out.println(filePathB[j].getName()+"--#######--"+faceFeatureB);
}
}
// 水印文字位置
opencv_core.Point point = new opencv_core.Point(0, 20);
opencv_core.Point point2 = new opencv_core.Point(20, 40);
// 颜色,使用黑色
opencv_core.Scalar scalar = new opencv_core.Scalar(0, 0, 0, 0);
float result = 0.0f;
String userID = "";
while (true) {
if (!canvas.isDisplayable()) {//窗口是否关闭
grabber.stop();//停止抓取
System.exit(1);//退出
break;
}
Frame frame = grabber.grab();//获取摄像头图像
opencv_core.IplImage iplImage = converter.convertToIplImage(frame);//frame转IplImage
BufferedImage bImage = IplImageToBufferedImage(iplImage); //IplImage转BufferedImage
inputImgA = loadImage(bImage);
FaceInfo[] faceInfosA = doFaceDetection(hFDEngine, inputImgA);//确定人脸位置
if (faceInfosA.length < 1) {
continue;
}
faceFeatureA = extractFRFeature(hFREngine, inputImgA, faceInfosA[0]);
if (faceFeatureA == null) {
continue;
}
for (int j = 0; j <= filePathB.length-1; j ++) {
FloatByReference fSimilScore = new FloatByReference(0.0f);
NativeLong ret2 = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_FacePairMatching(hFREngine, faceFeatureA, faceFeatureMap.get(filePathB[j].getName()), fSimilScore);
// faceFeatureA.freeUnmanaged();
// faceFeatureMap.get(filePathB[j].getName()).freeUnmanaged();
if (ret2.longValue() != 0) {
System.out.println(String.format("AFR_FSDK_FacePairMatching failed:ret 0x%x", ret2.longValue()));
result = 0.0f;
continue;
}
if(result <= fSimilScore.getValue()){
result = fSimilScore.getValue();
userID = filePathB[j].getName();
}
}
opencv_core.Mat mat = converter.convertToMat(frame);//frame转mat
opencv_imgproc.putText(mat, userID, point, opencv_imgproc.CV_FONT_HERSHEY_PLAIN, 1.2, scalar, 1, 20, false);
opencv_imgproc.putText(mat, result+"" , point2, opencv_imgproc.CV_FONT_HERSHEY_PLAIN, 1.2, scalar, 1, 20, false);
// for(int i = 0; i <= faceInfosA.length - 1; i ++ ) {
drawLine(mat, faceInfosA[0].right, faceInfosA[0].left, faceInfosA[0].top, faceInfosA[0].bottom);
// }
canvas.showImage(converter.convert(mat));//显示图像
// Thread.sleep(10);//50毫秒刷新一次图像
}
}
static void drawLine(opencv_core.Mat mat,int right, int left, int top, int bottom){
opencv_imgproc.line(mat,new opencv_core.Point(left,top),new opencv_core.Point(right,top),new opencv_core.Scalar(0,255,0,0));
opencv_imgproc.line(mat,new opencv_core.Point(left,top),new opencv_core.Point(left,bottom),new opencv_core.Scalar(0,255,0,0));
opencv_imgproc.line(mat,new opencv_core.Point(right,top),new opencv_core.Point(right,bottom),new opencv_core.Scalar(0,255,0,0));
opencv_imgproc.line(mat,new opencv_core.Point(left,bottom),new opencv_core.Point(right,bottom),new opencv_core.Scalar(0,255,0,0));
}
public static BufferedImage IplImageToBufferedImage(opencv_core.IplImage src) {
OpenCVFrameConverter.ToIplImage grabberConverter = new OpenCVFrameConverter.ToIplImage();
Java2DFrameConverter paintConverter = new Java2DFrameConverter();
Frame frame = grabberConverter.convert(src);
return paintConverter.getBufferedImage(frame,1);
}
public static ASVLOFFSCREEN loadImage(BufferedImage bImage) {
long s = System.currentTimeMillis();
ASVLOFFSCREEN inputImg = new ASVLOFFSCREEN();
BufferInfo bufferInfo = getBGRFromFile(bImage);
inputImg.u32PixelArrayFormat = ASVL_COLOR_FORMAT.ASVL_PAF_RGB24_B8G8R8;
inputImg.i32Width = bufferInfo.width;
inputImg.i32Height = bufferInfo.height;
inputImg.pi32Pitch[0] = inputImg.i32Width * 3;
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, bufferInfo.buffer, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = Pointer.NULL;
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
inputImg.setAutoRead(false);
System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&生成素描图像用时:"+(System.currentTimeMillis()-s));
return inputImg;
}
public static BufferInfo getBGRFromFile(BufferedImage bImage) {
byte[] bgr = null;
int width = 0;
int height = 0;
width = bImage.getWidth();
height = bImage.getHeight();
BufferedImage bgrimg = new BufferedImage(bImage.getWidth(), bImage.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
bgrimg.setRGB(0, 0, width, height, bImage.getRGB(0, 0, width, height, null, 0, width), 0, width);
bgr = ((DataBufferByte)bgrimg.getRaster().getDataBuffer()).getData();
return new BufferInfo(width, height, bgr);
}
public static FaceInfo[] doFaceDetection(Pointer hFDEngine, ASVLOFFSCREEN inputImg) {
FaceInfo[] faceInfo = new FaceInfo[0];
PointerByReference ppFaceRes = new PointerByReference();
NativeLong ret = AFD_FSDKLibrary.INSTANCE.AFD_FSDK_StillImageFaceDetection(hFDEngine, inputImg, ppFaceRes);
if (ret.longValue() != 0) {
System.out.println(String.format("AFD_FSDK_StillImageFaceDetection ret 0x%x" , ret.longValue()));
return faceInfo;
}
AFD_FSDK_FACERES faceRes = new AFD_FSDK_FACERES(ppFaceRes.getValue());
if (faceRes.nFace > 0) {
faceInfo = new FaceInfo[faceRes.nFace];
for (int i = 0; i < faceRes.nFace; i++) {
MRECT rect = new MRECT(new Pointer(Pointer.nativeValue(faceRes.rcFace.getPointer()) + faceRes.rcFace.size() * i));
int orient = faceRes.lfaceOrient.getPointer().getInt(i * 4);
faceInfo[i] = new FaceInfo();
faceInfo[i].left = rect.left;
faceInfo[i].top = rect.top;
faceInfo[i].right = rect.right;
faceInfo[i].bottom = rect.bottom;
faceInfo[i].orient = orient;
System.out.println(String.format("%d (%d %d %d %d) orient %d", i, rect.left, rect.top, rect.right, rect.bottom, orient));
}
}
return faceInfo;
}
public static float compareFaceSimilarity(Pointer hFDEngine, Pointer hFREngine, ASVLOFFSCREEN inputImgA, ASVLOFFSCREEN inputImgB) {
// Do Face Detect
FaceInfo[] faceInfosA = doFaceDetection(hFDEngine, inputImgA);
if (faceInfosA.length < 1) {
System.out.println("no face in Image A ");
return 0.0f;
}
FaceInfo[] faceInfosB = doFaceDetection(hFDEngine, inputImgB);
if (faceInfosB.length < 1) {
System.out.println("no face in Image B ");
return 0.0f;
}
// Extract Face Feature
AFR_FSDK_FACEMODEL faceFeatureA = extractFRFeature(hFREngine, inputImgA, faceInfosA[0]);
if (faceFeatureA == null) {
System.out.println("extract face feature in Image A failed");
return 0.0f;
}
AFR_FSDK_FACEMODEL faceFeatureB = extractFRFeature(hFREngine, inputImgB, faceInfosB[0]);
if (faceFeatureB == null) {
System.out.println("extract face feature in Image B failed");
faceFeatureA.freeUnmanaged();
return 0.0f;
}
// calc similarity between faceA and faceB
FloatByReference fSimilScore = new FloatByReference(0.0f);
long matechingTime = System.currentTimeMillis();
NativeLong ret = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_FacePairMatching(hFREngine, faceFeatureA, faceFeatureB, fSimilScore);
System.out.println("FacePairMatching运行时间:"+(System.currentTimeMillis()-matechingTime));
faceFeatureA.freeUnmanaged();
faceFeatureB.freeUnmanaged();
if (ret.longValue() != 0) {
System.out.println(String.format("AFR_FSDK_FacePairMatching failed:ret 0x%x" ,ret.longValue()));
return 0.0f;
}
return fSimilScore.getValue();
}
public static AFR_FSDK_FACEMODEL extractFRFeature(Pointer hFREngine, ASVLOFFSCREEN inputImg, FaceInfo faceInfo) {
AFR_FSDK_FACEINPUT faceinput = new AFR_FSDK_FACEINPUT();
faceinput.lOrient = faceInfo.orient;
faceinput.rcFace.left = faceInfo.left;
faceinput.rcFace.top = faceInfo.top;
faceinput.rcFace.right = faceInfo.right;
faceinput.rcFace.bottom = faceInfo.bottom;
AFR_FSDK_FACEMODEL faceFeature = new AFR_FSDK_FACEMODEL();
NativeLong ret = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_ExtractFRFeature(hFREngine, inputImg, faceinput, faceFeature);
if (ret.longValue() != 0) {
System.out.println(String.format("AFR_FSDK_ExtractFRFeature ret 0x%x" ,ret.longValue()));
return null;
}
try {
return faceFeature.deepCopy();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static ASVLOFFSCREEN loadLocalImage(String filePath) {
long s = System.currentTimeMillis();
ASVLOFFSCREEN inputImg = new ASVLOFFSCREEN();
if (bUseBGRToEngine) {
BufferInfo bufferInfo = ImageLoader.getBGRFromFile(filePath);
inputImg.u32PixelArrayFormat = ASVL_COLOR_FORMAT.ASVL_PAF_RGB24_B8G8R8;
inputImg.i32Width = bufferInfo.width;
inputImg.i32Height = bufferInfo.height;
inputImg.pi32Pitch[0] = inputImg.i32Width * 3;
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, bufferInfo.buffer, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = Pointer.NULL;
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
} else {
BufferInfo bufferInfo = ImageLoader.getI420FromFile(filePath);
inputImg.u32PixelArrayFormat = ASVL_COLOR_FORMAT.ASVL_PAF_I420;
inputImg.i32Width = bufferInfo.width;
inputImg.i32Height = bufferInfo.height;
inputImg.pi32Pitch[0] = inputImg.i32Width;
inputImg.pi32Pitch[1] = inputImg.i32Width / 2;
inputImg.pi32Pitch[2] = inputImg.i32Width / 2;
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, bufferInfo.buffer, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = new Memory(inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[1].write(0, bufferInfo.buffer, inputImg.pi32Pitch[0] * inputImg.i32Height, inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[2] = new Memory(inputImg.pi32Pitch[2] * inputImg.i32Height / 2);
inputImg.ppu8Plane[2].write(0, bufferInfo.buffer, inputImg.pi32Pitch[0] * inputImg.i32Height + inputImg.pi32Pitch[1] * inputImg.i32Height / 2, inputImg.pi32Pitch[2] * inputImg.i32Height / 2);
inputImg.ppu8Plane[3] = Pointer.NULL;
}
inputImg.setAutoRead(false);
System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&:"+(System.currentTimeMillis()-s));
return inputImg;
}
}
package com.yx.photo;
import com.sun.jna.Native;
import com.sun.jna.Platform;
public class LoadUtils {
public static <T> T loadOSLibrary(String dirPath,String libname, Class<T> interfaceClass) {
String filePath = dirPath+"/";
if(Platform.isWindows()){
if(Platform.is64Bit()){
filePath += "win/x64/"+"lib"+libname+".dll";
}else{
filePath += "win/x86/"+"lib"+libname+".dll";
}
}else if(Platform.is64Bit() && Platform.isLinux()){
filePath += "linux/x64/"+"lib"+libname+".so";
}else{
System.out.println("unsupported platform");
System.exit(0);
}
// return loadLibrary(filePath,interfaceClass);
return loadLibrary("C:\\Users\\Administrator\\Desktop\\ArcSoft_FreeSDK_Demo-master\\FR\\java\\libarcsoft_fsdk_face_recognition.dll",interfaceClass);
}
public static <T> T loadLibrary(String filePath, Class<T> interfaceClass) {
return (T) Native.loadLibrary(filePath,interfaceClass);
}
}
package com.yx.photo;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
public class MRECT extends Structure {
public static class ByValue extends MRECT implements Structure.ByValue {
public ByValue() {
}
public ByValue(Pointer p) {
super(p);
}
}
public static class ByReference extends MRECT implements Structure.ByReference{
public ByReference() {
}
public ByReference(Pointer p) {
super(p);
}
};
public int left;
public int top;
public int right;
public int bottom;
public MRECT() {
}
public MRECT(Pointer p) {
super(p);
read();
}
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[] {
"left", "top", "right", "bottom"
});
}
}
\ No newline at end of file
package com.yx.photo;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import com.sun.jna.Memory;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.FloatByReference;
import com.sun.jna.ptr.PointerByReference;
public class PicUtil {
public static final String APPID = "7wqvGwSD6mWU2QNLer27PQ2EM7otCaBDoqMLyQZ8B3mc";
public static final String FD_SDKKEY = "GadGzNEJLTzeaU7Dbk4mpSrnYb5BbaKNyyTLXyh7euqH";
public static final String FR_SDKKEY = "GadGzNEJLTzeaU7Dbk4mpSruhzLP9GHFz51yvaPuQCsf";
public static final int FD_WORKBUF_SIZE = 20 * 1024 * 1024;
public static final int FR_WORKBUF_SIZE = 40 * 1024 * 1024;
public static final int MAX_FACE_NUM = 50;
public static final boolean bUseRAWFile = false;
public static final boolean bUseBGRToEngine = true;
/**
* 用于从给定路径的图片中提取出人像特征并转换为byte[]数据,
* 方便存入数据库中
* @param picpath1 图片的路径(包括本地路径和网络URL)
* @return 图片中人像特征的byte[]数据
*/
public static byte[] pathToByte(String picpath1) {
System.out.println("#####################################################");
// init Engine
Pointer pFDWorkMem = CLibrary.INSTANCE.malloc(FD_WORKBUF_SIZE);
Pointer pFRWorkMem = CLibrary.INSTANCE.malloc(FR_WORKBUF_SIZE);
PointerByReference phFDEngine = new PointerByReference();
NativeLong ret = AFD_FSDKLibrary.INSTANCE.AFD_FSDK_InitialFaceEngine(
APPID, FD_SDKKEY, pFDWorkMem, FD_WORKBUF_SIZE, phFDEngine,
_AFD_FSDK_OrientPriority.AFD_FSDK_OPF_0_HIGHER_EXT, 32,
MAX_FACE_NUM);
if (ret.longValue() != 0) {
CLibrary.INSTANCE.free(pFDWorkMem);
CLibrary.INSTANCE.free(pFRWorkMem);
System.out.println(String.format(
"AFD_FSDK_InitialFaceEngine ret 0x%x", ret.longValue()));
System.exit(0);
}
// print FDEngine version
Pointer hFDEngine = phFDEngine.getValue();
AFD_FSDK_Version versionFD = AFD_FSDKLibrary.INSTANCE
.AFD_FSDK_GetVersion(hFDEngine);
System.out.println(String.format("%d %d %d %d", versionFD.lCodebase,
versionFD.lMajor, versionFD.lMinor, versionFD.lBuild));
System.out.println(versionFD.Version);
System.out.println(versionFD.BuildDate);
System.out.println(versionFD.CopyRight);
PointerByReference phFREngine = new PointerByReference();
ret = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_InitialEngine(APPID, FR_SDKKEY,
pFRWorkMem, FR_WORKBUF_SIZE, phFREngine);
if (ret.longValue() != 0) {
AFD_FSDKLibrary.INSTANCE.AFD_FSDK_UninitialFaceEngine(hFDEngine);
CLibrary.INSTANCE.free(pFDWorkMem);
CLibrary.INSTANCE.free(pFRWorkMem);
System.out.println(String.format("AFR_FSDK_InitialEngine ret 0x%x",
ret.longValue()));
System.exit(0);
}
// print FREngine version
Pointer hFREngine = phFREngine.getValue();
AFR_FSDK_Version versionFR = AFR_FSDKLibrary.INSTANCE
.AFR_FSDK_GetVersion(hFREngine);
System.out.println(String.format("%d %d %d %d", versionFR.lCodebase,
versionFR.lMajor, versionFR.lMinor, versionFR.lBuild));
System.out.println(versionFR.Version);
System.out.println(versionFR.BuildDate);
System.out.println(versionFR.CopyRight);
// load Image Data
ASVLOFFSCREEN inputImgA;
if (bUseRAWFile) {
String filePathA = "001_640x480_I420.YUV";
int yuv_widthA = 640;
int yuv_heightA = 480;
int yuv_formatA = ASVL_COLOR_FORMAT.ASVL_PAF_I420;
String filePathB = "003_640x480_I420.YUV";
int yuv_widthB = 640;
int yuv_heightB = 480;
int yuv_formatB = ASVL_COLOR_FORMAT.ASVL_PAF_I420;
inputImgA = loadRAWImage(filePathA, yuv_widthA, yuv_heightA,
yuv_formatA);
} else {
String filePathA = picpath1;
//String filePathA = "D:/readcard/emp/4.png";
inputImgA = loadImage(filePathA);
}
byte[] faceModelByte = null;
AFR_FSDK_FACEMODEL similarity = compareFaceSimilarity(hFDEngine,hFREngine,
inputImgA);
if(similarity!=null){System.out.println("similarity人像对象非空!");}
try {
faceModelByte = similarity.toByteArray();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return faceModelByte;
}
/**
* 获取人像在图片中的位置
* @param hFDEngine 人像检索引擎
* @param inputImg 素描图
* @return 人像在图片中的位置
*/
public static FaceInfo[] doFaceDetection(Pointer hFDEngine,
ASVLOFFSCREEN inputImg) {
FaceInfo[] faceInfo = new FaceInfo[0];
PointerByReference ppFaceRes = new PointerByReference();
NativeLong ret = AFD_FSDKLibrary.INSTANCE
.AFD_FSDK_StillImageFaceDetection(hFDEngine, inputImg,
ppFaceRes);
if (ret.longValue() != 0) {
System.out.println(String.format(
"AFD_FSDK_StillImageFaceDetection ret 0x%x",
ret.longValue()));
return faceInfo;
}
AFD_FSDK_FACERES faceRes = new AFD_FSDK_FACERES(ppFaceRes.getValue());
if (faceRes.nFace > 0) {
faceInfo = new FaceInfo[faceRes.nFace];
for (int i = 0; i < faceRes.nFace; i++) {
MRECT rect = new MRECT(new Pointer(
Pointer.nativeValue(faceRes.rcFace.getPointer())
+ faceRes.rcFace.size() * i));
int orient = faceRes.lfaceOrient.getPointer().getInt(i * 4);
faceInfo[i] = new FaceInfo();
faceInfo[i].left = rect.left;
faceInfo[i].top = rect.top;
faceInfo[i].right = rect.right;
faceInfo[i].bottom = rect.bottom;
faceInfo[i].orient = orient;
System.out.println(String
.format("%d (%d %d %d %d) orient %d", i, rect.left,
rect.top, rect.right, rect.bottom, orient));
}
}
return faceInfo;
}
/**
* 通过素描图和人像位置获取人像特征
* @param hFREngine 人像对比引擎
* @param inputImg 人像素描图
* @param faceInfo 人像在图片中的位置
* @return 人像特征
*/
public static AFR_FSDK_FACEMODEL extractFRFeature(Pointer hFREngine,
ASVLOFFSCREEN inputImg, FaceInfo faceInfo) {
AFR_FSDK_FACEINPUT faceinput = new AFR_FSDK_FACEINPUT();
faceinput.lOrient = faceInfo.orient;
faceinput.rcFace.left = faceInfo.left;
faceinput.rcFace.top = faceInfo.top;
faceinput.rcFace.right = faceInfo.right;
faceinput.rcFace.bottom = faceInfo.bottom;
AFR_FSDK_FACEMODEL faceFeature = new AFR_FSDK_FACEMODEL();
NativeLong ret = AFR_FSDKLibrary.INSTANCE.AFR_FSDK_ExtractFRFeature(
hFREngine, inputImg, faceinput, faceFeature);
if (ret.longValue() != 0) {
System.out.println(String.format(
"AFR_FSDK_ExtractFRFeature ret 0x%x", ret.longValue()));
return null;
}
try {
return faceFeature.deepCopy();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 通过人像素描图,生成人像特征类
* @param hFDEngine 人像检索引擎
* @param hFREngine 人像对比引擎
* @param inputImgA 人像素描图
* @return 人像特征类
*/
public static AFR_FSDK_FACEMODEL compareFaceSimilarity(Pointer hFDEngine, Pointer hFREngine,
ASVLOFFSCREEN inputImgA) {
// Do Face Detect
FaceInfo[] faceInfosA = doFaceDetection(hFDEngine, inputImgA);
if (faceInfosA.length < 1) {
System.out.println("no face in Image A ");
return null;
}
// Extract Face Feature
AFR_FSDK_FACEMODEL faceFeatureA = extractFRFeature(hFREngine,
inputImgA, faceInfosA[0]);
if (faceFeatureA == null) {
System.out.println("extract face feature in Image A failed");
return null;
}
return faceFeatureA;
}
/**
* 通过图片路径生成图片素描图
* @param yuv_filePath 图片路径
* @param yuv_width 图片的宽
* @param yuv_height 图片的高
* @param yuv_format 人像角度
* @return ASVLOFFSCREEN对象
*/
public static ASVLOFFSCREEN loadRAWImage(String yuv_filePath,
int yuv_width, int yuv_height, int yuv_format) {
int yuv_rawdata_size = 0;
ASVLOFFSCREEN inputImg = new ASVLOFFSCREEN();
inputImg.u32PixelArrayFormat = yuv_format;
inputImg.i32Width = yuv_width;
inputImg.i32Height = yuv_height;
if (ASVL_COLOR_FORMAT.ASVL_PAF_I420 == inputImg.u32PixelArrayFormat) {
inputImg.pi32Pitch[0] = inputImg.i32Width;
inputImg.pi32Pitch[1] = inputImg.i32Width / 2;
inputImg.pi32Pitch[2] = inputImg.i32Width / 2;
yuv_rawdata_size = inputImg.i32Width * inputImg.i32Height * 3 / 2;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_NV12 == inputImg.u32PixelArrayFormat) {
inputImg.pi32Pitch[0] = inputImg.i32Width;
inputImg.pi32Pitch[1] = inputImg.i32Width;
yuv_rawdata_size = inputImg.i32Width * inputImg.i32Height * 3 / 2;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_NV21 == inputImg.u32PixelArrayFormat) {
inputImg.pi32Pitch[0] = inputImg.i32Width;
inputImg.pi32Pitch[1] = inputImg.i32Width;
yuv_rawdata_size = inputImg.i32Width * inputImg.i32Height * 3 / 2;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_YUYV == inputImg.u32PixelArrayFormat) {
inputImg.pi32Pitch[0] = inputImg.i32Width * 2;
yuv_rawdata_size = inputImg.i32Width * inputImg.i32Height * 2;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_RGB24_B8G8R8 == inputImg.u32PixelArrayFormat) {
inputImg.pi32Pitch[0] = inputImg.i32Width * 3;
yuv_rawdata_size = inputImg.i32Width * inputImg.i32Height * 3;
} else {
System.out.println("unsupported yuv format");
System.exit(0);
}
// load YUV Image Data from File
byte[] imagedata = new byte[yuv_rawdata_size];
File f = new File(yuv_filePath);
InputStream ios = null;
try {
ios = new FileInputStream(f);
ios.read(imagedata, 0, yuv_rawdata_size);
} catch (Exception e) {
e.printStackTrace();
System.out.println("error in loading yuv file");
System.exit(0);
} finally {
try {
if (ios != null) {
ios.close();
}
} catch (IOException e) {
}
}
if (ASVL_COLOR_FORMAT.ASVL_PAF_I420 == inputImg.u32PixelArrayFormat) {
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0]
* inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, imagedata, 0, inputImg.pi32Pitch[0]
* inputImg.i32Height);
inputImg.ppu8Plane[1] = new Memory(inputImg.pi32Pitch[1]
* inputImg.i32Height / 2);
inputImg.ppu8Plane[1].write(0, imagedata, inputImg.pi32Pitch[0]
* inputImg.i32Height, inputImg.pi32Pitch[1]
* inputImg.i32Height / 2);
inputImg.ppu8Plane[2] = new Memory(inputImg.pi32Pitch[2]
* inputImg.i32Height / 2);
inputImg.ppu8Plane[2].write(0, imagedata, inputImg.pi32Pitch[0]
* inputImg.i32Height + inputImg.pi32Pitch[1]
* inputImg.i32Height / 2, inputImg.pi32Pitch[2]
* inputImg.i32Height / 2);
inputImg.ppu8Plane[3] = Pointer.NULL;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_NV12 == inputImg.u32PixelArrayFormat) {
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0]
* inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, imagedata, 0, inputImg.pi32Pitch[0]
* inputImg.i32Height);
inputImg.ppu8Plane[1] = new Memory(inputImg.pi32Pitch[1]
* inputImg.i32Height / 2);
inputImg.ppu8Plane[1].write(0, imagedata, inputImg.pi32Pitch[0]
* inputImg.i32Height, inputImg.pi32Pitch[1]
* inputImg.i32Height / 2);
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_NV21 == inputImg.u32PixelArrayFormat) {
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0]
* inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, imagedata, 0, inputImg.pi32Pitch[0]
* inputImg.i32Height);
inputImg.ppu8Plane[1] = new Memory(inputImg.pi32Pitch[1]
* inputImg.i32Height / 2);
inputImg.ppu8Plane[1].write(0, imagedata, inputImg.pi32Pitch[0]
* inputImg.i32Height, inputImg.pi32Pitch[1]
* inputImg.i32Height / 2);
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_YUYV == inputImg.u32PixelArrayFormat) {
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0]
* inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, imagedata, 0, inputImg.pi32Pitch[0]
* inputImg.i32Height);
inputImg.ppu8Plane[1] = Pointer.NULL;
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
} else if (ASVL_COLOR_FORMAT.ASVL_PAF_RGB24_B8G8R8 == inputImg.u32PixelArrayFormat) {
inputImg.ppu8Plane[0] = new Memory(imagedata.length);
inputImg.ppu8Plane[0].write(0, imagedata, 0, imagedata.length);
inputImg.ppu8Plane[1] = Pointer.NULL;
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
} else {
System.out.println("unsupported yuv format");
System.exit(0);
}
inputImg.setAutoRead(false);
return inputImg;
}
/**
* 通过图片路径生成图片的素描图
* @param filePath 图片路径
* @return 图片的素描图
*/
public static ASVLOFFSCREEN loadImage(String filePath) {
ASVLOFFSCREEN inputImg = new ASVLOFFSCREEN();
if (bUseBGRToEngine) {
BufferInfo bufferInfo = ImageLoader.getBGRFromFile(filePath);
inputImg.u32PixelArrayFormat = ASVL_COLOR_FORMAT.ASVL_PAF_RGB24_B8G8R8;
inputImg.i32Width = bufferInfo.width;
inputImg.i32Height = bufferInfo.height;
inputImg.pi32Pitch[0] = inputImg.i32Width * 3;
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, bufferInfo.buffer, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = Pointer.NULL;
inputImg.ppu8Plane[2] = Pointer.NULL;
inputImg.ppu8Plane[3] = Pointer.NULL;
} else {
BufferInfo bufferInfo = ImageLoader.getI420FromFile(filePath);
inputImg.u32PixelArrayFormat = ASVL_COLOR_FORMAT.ASVL_PAF_I420;
inputImg.i32Width = bufferInfo.width;
inputImg.i32Height = bufferInfo.height;
inputImg.pi32Pitch[0] = inputImg.i32Width;
inputImg.pi32Pitch[1] = inputImg.i32Width / 2;
inputImg.pi32Pitch[2] = inputImg.i32Width / 2;
inputImg.ppu8Plane[0] = new Memory(inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[0].write(0, bufferInfo.buffer, 0, inputImg.pi32Pitch[0] * inputImg.i32Height);
inputImg.ppu8Plane[1] = new Memory(inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[1].write(0, bufferInfo.buffer, inputImg.pi32Pitch[0] * inputImg.i32Height, inputImg.pi32Pitch[1] * inputImg.i32Height / 2);
inputImg.ppu8Plane[2] = new Memory(inputImg.pi32Pitch[2] * inputImg.i32Height / 2);
inputImg.ppu8Plane[2].write(0, bufferInfo.buffer, inputImg.pi32Pitch[0] * inputImg.i32Height + inputImg.pi32Pitch[1] * inputImg.i32Height / 2, inputImg.pi32Pitch[2] * inputImg.i32Height / 2);
inputImg.ppu8Plane[3] = Pointer.NULL;
}
inputImg.setAutoRead(false);
return inputImg;
}
}
package com.yx.photo;
public class _AFD_FSDK_OrientCode {
public static final int AFD_FSDK_FOC_0 = 0x1;// 0 degree
public static final int AFD_FSDK_FOC_90 = 0x2; // 90 degree
public static final int AFD_FSDK_FOC_270 = 0x3; // 270 degree
public static final int AFD_FSDK_FOC_180 = 0x4; // 180 degree
public static final int AFD_FSDK_FOC_30 = 0x5; // 30 degree
public static final int AFD_FSDK_FOC_60 = 0x6; // 60 degree
public static final int AFD_FSDK_FOC_120 = 0x7; // 120 degree
public static final int AFD_FSDK_FOC_150 = 0x8; // 150 degree
public static final int AFD_FSDK_FOC_210 = 0x9; // 210 degree
public static final int AFD_FSDK_FOC_240 = 0xa; // 240 degree
public static final int AFD_FSDK_FOC_300 = 0xb; // 300 degree
public static final int AFD_FSDK_FOC_330 = 0xc; // 330 degree
}
package com.yx.photo;
public class _AFD_FSDK_OrientPriority {
public static final int AFD_FSDK_OPF_0_ONLY = 0x1; // 0; 0; ...
public static final int AFD_FSDK_OPF_90_ONLY = 0x2; // 90; 90; ...
public static final int AFD_FSDK_OPF_270_ONLY = 0x3; // 270; 270; ...
public static final int AFD_FSDK_OPF_180_ONLY = 0x4; // 180; 180; ...
public static final int AFD_FSDK_OPF_0_HIGHER_EXT = 0x5; // 0; 90; 270; 180; 0; 90; 270; 180; ...
}
package com.yx.service;
public interface AttestService {
String attest();
}
package com.yx.service;
import java.util.Arrays;
import com.yingxininfo.data.AuthenticationApplicationData;
import com.yingxininfo.data.AuthenticationData;
import com.yingxininfo.data.ReservationData;
import com.yingxininfo.data.SocketPackage;
import com.yingxininfo.net.SocketSender;
import com.yingxininfo.utils.Constans;
import com.yingxininfo.utils.FormatBytesUtil;
/**
* 身份认证
* @author yingxin
*
*/
public class AttestServiceImpl implements AttestService {
public String attest(){
/*
* 组装认证申请数据区 第一个包的数据区
*/
// 客户号 8字节 共用
byte[] customerId = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
// 终端号 2字节 共用
byte[] terminalId = new byte[] { 1, 2 };
// 读卡控件版本 4字节
byte[] readCardControlsVersion = new byte[] { 1, 2, 3, 4 };
// 人像控件版本 4字节
byte[] pictureControlsVersion = new byte[] { 1, 2, 3, 4 };
// 证书序列号 32字节 "csywzd1" 共用
byte[] certificateNumber = new byte[] { 99, 115, 121, 119, 122, 100, 49 };
certificateNumber = FormatBytesUtil.copyByteToAnother(new byte[32], certificateNumber);
System.out.println("证书序列号:" + Arrays.toString(certificateNumber));
AuthenticationApplicationData auApp = new AuthenticationApplicationData(customerId, terminalId,
readCardControlsVersion, pictureControlsVersion, certificateNumber);
byte[] auAppData = auApp.getAuthenticationApplicationData();
/*
* 组装认证申请Socket数据包 第一次UDP数据包
*/
// 协议版本 2字节 0x0001 共用
byte[] version = { 0, 1 };
// 命令类型 1字节 0x00(请求)0x01(应答) 共用
byte[] commandType = { 0 };
// 命令 1字节 0x00(身份认证申请)0x01(身份认证) 共用但值不同
byte[] command = { 0 };
// 命令内容 1字节 保留 0x00 共用
byte[] commandContent = { 0 };
// 操作 1字节 保留 0x00 共用
byte[] operation = { 0 };
SocketPackage auAppSP = new SocketPackage(version, commandType, command, commandContent, operation, auAppData);
byte[] auAppSPData = auAppSP.getSocketPackage();
byte[] applicationReturn = SocketSender.sendSocketPackage(auAppSPData);
/*
* 组装认证数据区 第二个包的数据区
*/
byte[] streamNumber = null;
if (applicationReturn != null) {
streamNumber = Arrays.copyOfRange(applicationReturn, 24, 33);// 获取到业务流水号要组装进第二个数据包中
System.out.println("流水号:" + Arrays.toString(streamNumber));
short randomBytesLength = FormatBytesUtil.getShortFromBytes(Arrays.copyOfRange(applicationReturn, 33, 35)); // 获取随机数长度
String randomData = FormatBytesUtil
.bytesToHexString(Arrays.copyOfRange(applicationReturn, 35, 35 + randomBytesLength)); // 获取随机数数据
System.out.println("随机数长度:" + randomBytesLength);
System.out.println("随机数数据:" + randomData);
}
if (applicationReturn == null) {
System.out.println("获取流水号失败,认证失败。");
return "获取流水号失败,认证失败。";
}
byte[] picture = Constans.picture; // 生成人像数据
byte[] reservationFour = new ReservationData("毛家亮", "342224198901241273", "20071114", "20171114")
.getReservasionBytes(); // 生成四项保留数据
// byte[] reservationTwo = new ReservationData("毛家亮", "342224198901241273", null, null).getReservasionBytes(); // 生成两项保留数据
/*
* 0X0F
*/
// byte[] identityModel_0X0F = new byte[] { 0x0f };
// AuthenticationData au_0X0F = new AuthenticationData(customerId, terminalId, streamNumber, identityModel_0X0F,
// Constans.idCheck, Constans.verification, picture, null, certificateNumber);
// byte[] auData_0X0F = au_0X0F.getAuthenticationData();
// byte[] identityModel_0X0F = new byte[] { 0x0f };
// AuthenticationData au_0X0F = new AuthenticationData(customerId, terminalId, streamNumber, identityModel_0X0F,
// Constans.idCheck, Constans.verification, new byte[10], null, certificateNumber);
// byte[] auData_0X0F = au_0X0F.getAuthenticationData();
/*
* 0X4F
*/
// byte[] identityModel_0X4F = new byte[] { 0x4f };
// AuthenticationData au_0X4F = new AuthenticationData(customerId, terminalId, streamNumber, identityModel_0X4F,
// Constans.idCheck, Constans.verification, picture, reservationTwo, certificateNumber);
// @SuppressWarnings("unused")
// byte[] auData_0X4F = au_0X4F.getAuthenticationData();
/*
* 0X1F
*/
// byte[] identityModel_0X1F = new byte[] { 0x1f };
// AuthenticationData au_0X1F = new AuthenticationData(customerId, terminalId, streamNumber, identityModel_0X1F,
// Constans.idCheck, Constans.verification, picture, reservationFour, certificateNumber);
// @SuppressWarnings("unused")
// byte[] auData_0X1F = au_0X1F.getAuthenticationData();
/*
* 0X13
*/
byte[] identityModel_0X13 = new byte[] { 0x13 };
AuthenticationData au_0X13 = new AuthenticationData(customerId, terminalId, streamNumber, identityModel_0X13,
Constans.idCheck, null, picture, reservationFour, certificateNumber);
@SuppressWarnings("unused")
byte[] auData_0X13 = au_0X13.getAuthenticationData();
//12
/*byte[] identityModel_0X12 = new byte[] { 0x12 };
AuthenticationData au_0X12 = new AuthenticationData(customerId, terminalId, streamNumber, identityModel_0X12,
null, null, picture, reservationFour, certificateNumber);
@SuppressWarnings("unused")
byte[] auData_0X12 = au_0X12.getAuthenticationData();
*/
/*
* 组装认证Socket数据包 第二次UDP数据包
*/
command[0] = 1; // 命令 1字节 0x00(身份认证申请)0x01(身份认证) 修改值的内容为1
SocketPackage auSP = new SocketPackage(version, commandType, command, commandContent, operation, auData_0X13);
byte[] auSPData = auSP.getSocketPackage();
byte[] auReturn = SocketSender.sendSocketPackage(auSPData);
if (auReturn != null) {
//System.out.println("验签结果:" + DataSignature.signCheck(auReturn)); // 验签
String string = new String(Arrays.copyOfRange(auReturn, 33, 37));
System.out.print("认证结果:" + string);
return string;
}
return "认证失败!";
}
public static void main(String[] args) {
}
}
package com.yx.service;
import java.util.List;
import com.yx.entity.Company;
/**
* 来访单位操作接口 增 删 改 查
* @author shaochangbin
*
*/
public interface CompanyService {
//添加来访单位
void saveCompany(Company company);
//删除来访单位
void deleteCompany(String companyName);
//修改来访单位
void updateCompany(Company company);
//查询单条来访单位
Company findCompany(String companyName);
//查询全部来访单位
List<Company> findCompanyAll();
}
package com.yx.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yx.dao.CompanyMapper;
import com.yx.dao.RegisterMapper;
import com.yx.entity.Company;
@Service
public class CompanyServiceImpl implements CompanyService {
@Autowired
private CompanyMapper companyMapper;
@Override
public void saveCompany(Company company) {
companyMapper.saveCompany(company);
}
@Override
public void deleteCompany(String companyName) {
companyMapper.deleteCompany(companyName);
}
@Override
public void updateCompany(Company company) {
companyMapper.updateCompany(company);
}
@Override
public Company findCompany(String companyName) {
return companyMapper.findCompany(companyName);
}
@Override
public List<Company> findCompanyAll() {
List<Company> list = companyMapper.findCompanyAll();
return list;
}
}
package com.yx.service;
import java.util.List;
import com.yx.entity.CountConditions;
import com.yx.entity.Employee;
import com.yx.entity.Person;
public interface CountConditionsService {
List<Person> countPerson(CountConditions count);
int persontotal(CountConditions countConditions);
List<Person> findByPersonName(CountConditions c);
List<Person> findByEmployeeName(CountConditions c);
List<Person> findByUnit(CountConditions c);
List<Person> findByDate(CountConditions c);
List<Person> findByPersonDate(CountConditions c);
List<Person> findByPersonEmployee(CountConditions c);
List<Person> findByEmployeeDate(CountConditions c);
List<Person> findByDept(CountConditions c);
List<Person> findByReason(CountConditions c);
List<Person> findByBlackList(CountConditions c);
}
package com.yx.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yx.dao.CountConditionsMapper;
import com.yx.entity.CountConditions;
import com.yx.entity.Person;
@Service
public class CountConditionsServiceImpl implements CountConditionsService {
@Autowired
private CountConditionsMapper countConditionsMapper;
@Override
public List<Person> findByPersonName(CountConditions c) {
return countConditionsMapper.findByPersonName(c);
}
@Override
public List<Person> findByEmployeeName(CountConditions c) {
System.out
.println("CountConditionsServiceImpl:findByEmployeeName----->"
+ c);
return countConditionsMapper.findByEmployeeName(c);
}
@Override
public List<Person> findByUnit(CountConditions c) {
return countConditionsMapper.findByUnit(c);
}
@Override
public List<Person> findByDate(CountConditions c) {
return countConditionsMapper.findByDate(c);
}
@Override
public List<Person> findByPersonDate(CountConditions c) {
return countConditionsMapper.findByPersonDate(c);
}
@Override
public List<Person> findByEmployeeDate(CountConditions c) {
return countConditionsMapper.findByEmployeeDate(c);
}
@Override
public List<Person> findByPersonEmployee(CountConditions c) {
return countConditionsMapper.findByPersonEmployee(c);
}
@Override
public List<Person> findByDept(CountConditions c) {
return countConditionsMapper.findByDept(c);
}
@Override
public List<Person> findByReason(CountConditions c) {
return countConditionsMapper.findByReason(c);
}
@Override
public List<Person> findByBlackList(CountConditions c) {
return countConditionsMapper.findByBlackList(c);
}
@Override
public List<Person> countPerson(CountConditions count) {
return countConditionsMapper.countPerson(count);
}
@Override
public int persontotal(CountConditions countConditions) {
return countConditionsMapper.persontotal(countConditions);
}
}
package com.yx.service;
import java.util.List;
import com.yx.entity.Employee;
import com.yx.entity.FaceModel;
import com.yx.photo.AFR_FSDK_FACEMODEL;
public interface EmployeeService {
Employee findEmployee(String username, String dept);
void saveEmployee(Employee employee) throws Exception;
Employee login(String loginname, String password);
List<Employee> findAll(int page, int num);
List<Employee> findEmployeeBySZM(String szm);
int total();
Employee check(String loginname);
String findFaceModel(String picpath);
void updatePwd(Employee employee);
void deleteEmployee(int id);
}
package com.yx.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yx.dao.EmployeeMapper;
import com.yx.entity.Employee;
import com.yx.entity.FaceModel;
import com.yx.photo.AFRTestN;
import com.yx.photo.AFR_FSDK_FACEMODEL;
import com.yx.photo.ASVLOFFSCREEN;
import com.yx.photo.PicUtil;
/**
* 员工信息实现类
*
* @author Administrator
*
*/
@Service
public class EmployeeServiceImpl implements EmployeeService {
@Autowired
private EmployeeMapper employeeMapper;
/**
* 员工信息查询
*/
@Override
public Employee findEmployee(String username, String dept) {
// TODO Auto-generated method stub
return employeeMapper.findEmployee(username, dept);
}
/**
* 员工信息保存
*/
@Override
public void saveEmployee(Employee employee) {
employeeMapper.saveEmployee(employee);
// 得到图片中的人像特征,并转为byte[]格式
// PicUtil.pathToByte(employee.getPhotourl());
// TODO 此处正式将把"e:/img/zp1.jpg"变为employee.getPhotourl()
// 提取人像特征
/*
* byte[] faceModelBtye = PicUtil.pathToByte(employee.getPhotourl()); if
* (!employee.getPhotourl().equals(null)) { employeeMapper
* .saveFaceModel(employee.getLoginname(), faceModelBtye); } else {
* System.out.println("员工未上传照片!"); }
*/
}
@Override
public Employee login(String loginname, String password) {
return employeeMapper.login(loginname, password);
}
@Override
public List<Employee> findAll(int page, int num) {
return employeeMapper.findAll(page, num);
}
@Override
public int total() {
return employeeMapper.total();
}
@Override
public Employee check(String loginname) {
// TODO Auto-generated method stub
return employeeMapper.check(loginname);
}
@Override
public String findFaceModel(String picpath) {
try {
AFR_FSDK_FACEMODEL faceModel = new AFR_FSDK_FACEMODEL();
AFR_FSDK_FACEMODEL array = null;
byte[] bs = PicUtil.pathToByte(picpath);
array = faceModel.fromByteArray(bs);
List<FaceModel> list = employeeMapper.findFaceModel();
String result = AFRTestN.multipleContrast(array, list);
return result;
} catch (Exception e) {
e.printStackTrace();
return "fail";
}
}
@Override
public void updatePwd(Employee employee) {
employeeMapper.updatePwd(employee);
}
@Override
public void deleteEmployee(int id) {
employeeMapper.deleteEmployee(id);
}
@Override
public List<Employee> findEmployeeBySZM(String szm) {
// TODO Auto-generated method stub
return employeeMapper.findEmployeeBySZM(szm);
}
}
package com.yx.service;
import java.util.List;
import com.yx.entity.Person;
public interface PersonService {
List<Person> findPerson(String idcard);
void save(Person person);
Person findPersonById(String id);
void updateBlackList(Person person);
void noBlackList(Person person);
void personQuit(Person person);
void leaveAll(String date);
int noleavetotal();
List<Person> findNoLeavePerson(int page, int num);
}
package com.yx.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yx.dao.PersonMapper;
import com.yx.entity.Company;
import com.yx.entity.Person;
/**
* 访客信息实现类
*
* @author Administrator
*
*/
@Service
public class PersonServiceImpl implements PersonService {
@Autowired
private PersonMapper personMapper;
@Autowired
private CompanyService companyService;
/**
* 访客信息查询
*/
@Override
public List<Person> findPerson(String idcard) {
return personMapper.findPerson(idcard);
}
/**
* 访客信息保存
*/
@Override
public void save(Person person) {
personMapper.save(person);
if (person.getUnit() != null && person.getUnit().length() > 0) {
Company c = companyService.findCompany(person.getUnit());
if (c == null) {
Company company = new Company();
company.setCompanyName(person.getUnit());
companyService.saveCompany(company);
}
}
}
/**
* 访客信息更新
*/
@Override
public void updateBlackList(Person person) {
personMapper.updateBlackList(person);
}
@Override
public Person findPersonById(String id) {
return personMapper.findPersonById(id);
}
@Override
public void personQuit(Person person) {
personMapper.personQuit(person);
}
@Override
public void noBlackList(Person person) {
personMapper.noBlackList(person);
}
@Override
public void leaveAll(String date) {
personMapper.leaveAll(date);
}
@Override
public int noleavetotal() {
return personMapper.noleavetotal();
}
@Override
public List<Person> findNoLeavePerson(int page, int num) {
return personMapper.findNoLeavePerson(page, num);
}
}
package com.yx.service;
public interface QRCodeService {
String CreateQRCode(String content);
}
package com.yx.service;
import java.io.File;
import java.nio.file.Path;
import java.util.HashMap;
import org.springframework.stereotype.Service;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import com.yx.utils.Address;
import com.yx.utils.StaticVariable;
@Service
public class QRCodeServiceImpl implements QRCodeService {
@Override
public String CreateQRCode(String contents) {
int width = 300;
int height = 300;
String format = "jpg";
String path = StaticVariable.getQrcodePhotoUrl() + contents + "_qr.jpg";
// 定义二维码参数
HashMap map = new HashMap();
map.put(EncodeHintType.CHARACTER_SET, "utf-8");// 字符集
map.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);// 纠错等级
map.put(EncodeHintType.MARGIN, 2);// 边距
// 生成二维码
try {
BitMatrix bitMatrix = new MultiFormatWriter().encode(contents,
BarcodeFormat.QR_CODE, width, height, map);
Path file = new File(path).toPath();
MatrixToImageWriter.writeToPath(bitMatrix, format, file);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "http://"+Address.getAddress()+":9527/qrcode/" + contents + "_qr.jpg";
}
}
package com.yx.service;
import java.util.List;
import com.yx.entity.Register;
public interface RegisterService {
void save(Register register);
List<Register> findByName(Register register);
List<Register> defaultShow();
}
package com.yx.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yx.dao.RegisterMapper;
import com.yx.entity.Register;
@Service
public class RegisterServiceImpl implements RegisterService {
@Autowired
private RegisterMapper registerMapper;
@Override
public void save(Register register) {
registerMapper.save(register);
}
@Override
public List<Register> findByName(Register register) {
return registerMapper.findByName(register);
}
@Override
public List<Register> defaultShow() {
return registerMapper.defaultShow();
}
}
package com.yx.test;
import java.sql.DriverManager;
import java.sql.SQLException;
import com.mysql.jdbc.Connection;
public class DataBase{
public static final String Driver = "com.mysql.jdbc.Driver";
public static final String url = "jdbc:mysql://123.57.35.186:3306/access?useUnicode=true&characterEncoding=UTF-8";
public static final String user = "root";
public static final String password = "yxkj123";
static {
try {
Class.forName(Driver);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
public static Connection getConnection() throws SQLException{
java.sql.Connection conn = null;
conn = DriverManager.getConnection(url,user,password);
return (Connection) conn;
}
}
package com.yx.test;
import java.io.ObjectInputStream;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import com.mysql.jdbc.PreparedStatement;
import com.mysql.jdbc.Statement;
import com.yx.photo.AFR_FSDK_FACEMODEL;
class Test{
public static void main(String[] args) throws Exception{
List<String> al = new ArrayList<String>();
// al.add("100");
// al.add("200");
// al.add("300");
AFR_FSDK_FACEMODEL model = new AFR_FSDK_FACEMODEL();
//先进行数据的保存
Connection conn = DataBase.getConnection();
java.sql.PreparedStatement pstmt = conn.prepareStatement("insert into books values(6,?)");//想数据库中插入第一组数据
pstmt.setObject(1,al);
// pstmt.setObject(1,model);
int time = pstmt.executeUpdate();//执行操作
System.out.println(time+"插入完成");//提示插入完成
pstmt.close();
//再进行数据的提出
java.sql.Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select book from books where id=5");
if(rs.next()){
ObjectInputStream oips = new ObjectInputStream(rs.getBinaryStream(1));
//从rs中得到对象的流,如果直接从rs.getObject(1)得到的对象是无法直接转化为下面的对象的。
ArrayList<String> obb = (ArrayList<String>)oips.readObject();//从流中读取对象
// System.out.println(obb.get(0));//输出对象中指定的数据
oips.close();
}
rs.close();
stmt.close();
conn.close();
}
}
package com.yx.utils;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class Address {
public static String getAddress() {
String address = "";
try {
InetAddress inetAddress = InetAddress.getLocalHost();
address = inetAddress.getHostAddress();
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return address;
}
}
package com.yx.utils;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class Base64test {
// 图片转base64 imgFile地址
public static String GetImageStr(String imgFile) {
InputStream in = null;
byte[] data = null;
try {
in = new FileInputStream(imgFile);
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);
}
// 访客照片
public static String GenerateImage(String imgStr, String idcard) {
// String name=System.currentTimeMillis()+"";
if (imgStr == null)
return "null";
BASE64Decoder decoder = new BASE64Decoder();
try {
byte[] b = decoder.decodeBuffer(imgStr);
for (int i = 0; i < b.length; ++i) {
if (b[i] < 0) {
b[i] += 256;
}
}
String imgFilePath = StaticVariable.getPersonPhotoUrl() + idcard
+ ".png";
OutputStream out = new FileOutputStream(imgFilePath);
out.write(b);
out.flush();
out.close();
return "http://"+Address.getAddress()+":9527/person/" + idcard + ".png";
} catch (Exception e) {
return "test";
}
}
// 员工照片
public static String GenerateImageEMP(String imgStr, String name) {
// String name=System.currentTimeMillis()+"";
if (imgStr == null)
return "";
BASE64Decoder decoder = new BASE64Decoder();
try {
byte[] b = decoder.decodeBuffer(imgStr);
for (int i = 0; i < b.length; ++i) {
if (b[i] < 0) {
b[i] += 256;
}
}
String imgFilePath = StaticVariable.getEmpPhotoUrl() + name
+ "_emp.png";
OutputStream out = new FileOutputStream(imgFilePath);
out.write(b);
out.flush();
out.close();
return "http://"+Address.getAddress()+":9527/emp/" + name + "_emp.png";
} catch (Exception e) {
return "";
}
}
// 员工新照片
public static String GenerateImageEMPNEW(String imgStr, String name) {
// String name=System.currentTimeMillis()+"";
if (imgStr == null)
return "";
BASE64Decoder decoder = new BASE64Decoder();
try {
byte[] b = decoder.decodeBuffer(imgStr);
for (int i = 0; i < b.length; ++i) {
if (b[i] < 0) {
b[i] += 256;
}
}
String imgFilePath = StaticVariable.getEmpPhotoUrl() + name
+ "_emp_new.png";
OutputStream out = new FileOutputStream(imgFilePath);
out.write(b);
out.flush();
out.close();
return imgFilePath;
} catch (Exception e) {
return "";
}
}
// 二次访问照片
public static String GenerateImageNew(String imgStr, String idcard) {
// String name=System.currentTimeMillis()+"";
if (imgStr == null)
return "";
BASE64Decoder decoder = new BASE64Decoder();
try {
byte[] b = decoder.decodeBuffer(imgStr);
for (int i = 0; i < b.length; ++i) {
if (b[i] < 0) {
b[i] += 256;
}
}
String imgFilePath = StaticVariable.getPersonPhotoUrl() + idcard
+ "_new.png";
OutputStream out = new FileOutputStream(imgFilePath);
out.write(b);
out.flush();
out.close();
return "http://"+Address.getAddress()+":9527/" + idcard + "_new.png";
} catch (Exception e) {
return "";
}
}
// in流转base64
public static String GetImageStr(InputStream in) {
byte[] data = null;
try {
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);
}
}
package com.yx.utils;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateFormat {
public static void main(String[] args) {
System.out.println(dateToString(new Date()));
}
public static String dateToString(Date date){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String string = format.format(date);
return string;
}
}
package com.yx.utils;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateUtils {
public static String getYear() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
Date date = new Date();
return sdf.format(date);
}
public static String getDate() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
return sdf.format(date);
}
public static String getDateformat() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
return sdf.format(date);
}
}
package com.yx.utils;
import com.google.gson.Gson;
public class JsonUtils{
public static String objectToJson(Object o){
Gson gson=new Gson();
String json = gson.toJson(o);
return json;
}
/*public Object jsonstrToObject(String jsonstr){
Gson gson=new Gson();
gson.fromJson(jsonstr, T);
return json;
}*/
}
package com.yx.utils;
public class StaticVariable {
private static String personPhotoUrl = "E://photo/person/";
private static String empPhotoUrl = "E://photo/emp/";
private static String qrcodePhotoUrl = "E://photo/qrcode/";
public static String getPersonPhotoUrl() {
return personPhotoUrl;
}
public static void setPersonPhotoUrl(String personPhotoUrl) {
StaticVariable.personPhotoUrl = personPhotoUrl;
}
public static String getEmpPhotoUrl() {
return empPhotoUrl;
}
public static void setEmpPhotoUrl(String empPhotoUrl) {
StaticVariable.empPhotoUrl = empPhotoUrl;
}
public static String getQrcodePhotoUrl() {
return qrcodePhotoUrl;
}
public static void setQrcodePhotoUrl(String qrcodePhotoUrl) {
StaticVariable.qrcodePhotoUrl = qrcodePhotoUrl;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment