huguohui преди 5 години
ревизия
fd8ee02e61
променени са 100 файла, в които са добавени 13201 реда и са изтрити 0 реда
  1. 21 0
      ypjf_web/.gitignore
  2. 2 0
      ypjf_web/.myumldata
  3. BIN
      ypjf_web/gradle/wrapper/gradle-wrapper.jar
  4. 5 0
      ypjf_web/gradle/wrapper/gradle-wrapper.properties
  5. 172 0
      ypjf_web/gradlew
  6. 84 0
      ypjf_web/gradlew.bat
  7. 952 0
      ypjf_web/pom.xml
  8. 23 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/LuceneField.java
  9. 21 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/LuceneSearch.java
  10. 21 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/NotLog.java
  11. 28 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/PKSequence.java
  12. 21 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/SecurityApi.java
  13. 25 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/TableGroup.java
  14. 25 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/TableSuffix.java
  15. 25 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/WhereSQL.java
  16. 258 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/aspect/SecurityAspect.java
  17. 110 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/cached/ICached.java
  18. 245 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/cached/RedisCachedImpl.java
  19. 16 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/common/BaseLogger.java
  20. 98 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/common/SessionUser.java
  21. 52 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/common/SpringAnnotationBeanNameGenerator.java
  22. 127 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/common/StaticHtmlFreeMarkerView.java
  23. 267 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/controller/BaseController.java
  24. 1217 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/dao/BaseJdbcDaoImpl.java
  25. 395 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/dao/IBaseJdbcDao.java
  26. 61 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/dao/RowNumberSingleColumnRowMapper.java
  27. 44 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/Db2Dialect.java
  28. 30 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/IDialect.java
  29. 45 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/InformixDialect.java
  30. 45 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/MssqlDialect.java
  31. 35 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/MysqlDialect.java
  32. 41 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/OracleDialect.java
  33. 36 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/PostgresqlDialect.java
  34. 35 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/Sqlite3Dialect.java
  35. 208 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/entity/AuditLog.java
  36. 51 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/entity/BaseEntity.java
  37. 11 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/entity/IBaseEntity.java
  38. 20 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/queue/RedisMessageDelegateListener.java
  39. 26 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/queue/SendMessage.java
  40. 789 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/service/BaseServiceImpl.java
  41. 440 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/service/IBaseService.java
  42. 34 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FrameAuthenticationToken.java
  43. 106 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FrameFWLogFilter.java
  44. 77 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FramePermissionsAuthorizationFilter.java
  45. 571 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FrameShiroFilterFactoryBean.java
  46. 58 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FrameShiroHttpServletResponse.java
  47. 77 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FrameStaticHtmlFilter.java
  48. 21 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FrontUserFilter.java
  49. 61 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/HomeFilter.java
  50. 97 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/KeepOneSessionControlFilter.java
  51. 98 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/OperatorUserFilter.java
  52. 116 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/PcUserFilter.java
  53. 103 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/RedisShiroSessionDao.java
  54. 41 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/RolesOrFilter.java
  55. 133 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/ShiroDbRealm.java
  56. 149 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/ShiroRedisCache.java
  57. 27 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/ShiroRedisCacheManager.java
  58. 142 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/ShiroUser.java
  59. 18 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/SystemUserFilter.java
  60. 45 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/AuthenticatedTag.java
  61. 43 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/GuestTag.java
  62. 52 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/HasAnyRolesTag.java
  63. 13 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/HasPermissionTag.java
  64. 11 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/HasRoleTag.java
  65. 11 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/LacksPermissionTag.java
  66. 12 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/LacksRoleTag.java
  67. 33 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/NotAuthenticatedTag.java
  68. 46 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/PermissionTag.java
  69. 121 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/PrincipalTag.java
  70. 29 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/RoleTag.java
  71. 50 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/SecureTag.java
  72. 32 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/ShiroTags.java
  73. 38 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/UserTag.java
  74. 77 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/task/LuceneTask.java
  75. 141 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/Base64.java
  76. 28 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/CalculationUtil.java
  77. 41 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/CaptchaUtils.java
  78. 41 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/CheckSumBuilder.java
  79. 564 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/ClassUtils.java
  80. 25 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/CookieUtils.java
  81. 309 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/CopyUtil.java
  82. 76 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/CryptAES.java
  83. 46 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/DBUtils.java
  84. 59 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/DateTypeEditor.java
  85. 1055 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/DateUtils.java
  86. 69 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/Des3.java
  87. 122 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/EntityInfo.java
  88. 131 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/Enumerations.java
  89. 68 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/ExcelUtils.java
  90. 103 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/ExportExcelUtil.java
  91. 116 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/FileUtils.java
  92. 262 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/Finder.java
  93. 48 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/FrameObjectMapper.java
  94. 251 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/GetEwm.java
  95. 139 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/GlobalStatic.java
  96. 58 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/HTMLCharacterEscapes.java
  97. 167 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/HtmlToPDF.java
  98. 253 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/HttpClientUtil.java
  99. 360 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/HttpClientUtils.java
  100. 0 0
      ypjf_web/src/main/java/com/cz/yingpu/frame/util/IPUtils.java

+ 21 - 0
ypjf_web/.gitignore

@@ -0,0 +1,21 @@
+target/
+.idea
+*.iml
+/src/main/java/test
+/out
+/classes
+.classpath
+.project
+.settings/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+/springrain-base-frame/src/main/webapp/WEB-INF/
+
+# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
+!/.mvn/wrapper/maven-wrapper.jar

+ 2 - 0
ypjf_web/.myumldata

@@ -0,0 +1,2 @@
+#Thu Dec 14 10:20:03 CST 2017
+CodeGenContainer=java.util.Vector

BIN
ypjf_web/gradle/wrapper/gradle-wrapper.jar


+ 5 - 0
ypjf_web/gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists

+ 172 - 0
ypjf_web/gradlew

@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+  cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"

+ 84 - 0
ypjf_web/gradlew.bat

@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

+ 952 - 0
ypjf_web/pom.xml

@@ -0,0 +1,952 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<groupId>com.cz</groupId>
+	<artifactId>yingpu</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<packaging>war</packaging>
+	
+
+	<name>yingpu</name>
+	<url>http://git.oschina.net/chunanyong/yingpu</url>
+
+    <repositories>
+        <repository>
+            <id>aliyun</id>
+            <name>aliyun</name>
+            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
+            <layout>default</layout>
+            <releases>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+            </snapshots>
+        </repository>
+    </repositories>
+    <pluginRepositories>
+        <pluginRepository>
+            <id>aliyun</id>
+            <name>aliyun</name>
+            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </pluginRepository>
+    </pluginRepositories>
+	<properties>
+		<finalName>yingpu</finalName>
+		<jetty.version>9.2.3.v20140905</jetty.version>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<junit.version>4.12</junit.version>
+
+		<aspectjweaver.version>1.8.9</aspectjweaver.version>
+		<!--  
+		<persistence-api.version>1.0.2</persistence-api.version>
+		-->
+		<spring.baseline.version>4.3.1.RELEASE</spring.baseline.version>
+		<spring-data-redis.version>1.7.3.RELEASE</spring-data-redis.version>
+		<slf4j-api.version>1.7.21</slf4j-api.version>
+		<jcl-over-slf4j.version>1.7.21</jcl-over-slf4j.version>
+		<logback.version>1.1.7</logback.version>
+		
+		<!--  
+		<javax.validation.version>1.1.0.Final</javax.validation.version>
+		<hibernate.validator.version>5.3.2.Final</hibernate.validator.version>
+        -->
+		<commons-lang3.version>3.4</commons-lang3.version>
+		<commons-pool.version>2.4.2</commons-pool.version>
+		<commons-collections.version>4.1</commons-collections.version>
+		<commons-io.version>2.4</commons-io.version>
+		<commons-codec.version>1.9</commons-codec.version>
+		<commons-beanutils.version>1.9.3</commons-beanutils.version>
+		<commons-fileupload.version>1.3.1</commons-fileupload.version>
+
+		<freemarker.version>2.3.22</freemarker.version>
+		<jedis.version>2.9.0</jedis.version>
+		<shiro.version>1.3.2</shiro.version>
+		<jxl.version>2.6.12</jxl.version>
+		<jodconverter.version>2.2.1</jodconverter.version>
+		
+		<jackson.version>2.8.4</jackson.version>
+		<gson.version>2.8.0</gson.version>
+		
+		<druid.version>1.0.26</druid.version>
+		<httpcore.version>4.4.5</httpcore.version>
+		<httpclient.version>4.5.2</httpclient.version>
+
+		<jsoup.version>1.10.2</jsoup.version>
+
+		<xstream.version>1.4.9</xstream.version>
+
+		<lucene.version>5.5.1</lucene.version>
+		<!-- 
+		<quartz.version>2.2.1</quartz.version>
+		 -->
+		<joda-time.version>2.9.6</joda-time.version>
+		
+		<servlet-api.version>2.5</servlet-api.version>
+		<mysql-connector-java.version>5.1.39</mysql-connector-java.version>
+		<javax.persistence.version>2.1.1</javax.persistence.version>
+		<jsp-api.version>2.1</jsp-api.version>
+
+		<maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
+		<maven-war-plugin.version>2.6</maven-war-plugin.version>
+		<maven-javadoc-plugin.version>2.10.3</maven-javadoc-plugin.version>
+		<maven-jar-plugin.version>2.6</maven-jar-plugin.version>
+		<maven-source-plugin.version>2.4</maven-source-plugin.version>
+		<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
+		
+		<maven-resources-plugin.version>2.7</maven-resources-plugin.version>
+		
+
+		
+	</properties>
+
+	<dependencies>
+	<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
+		<dependency>
+		    <groupId>javax.servlet</groupId>
+		    <artifactId>jstl</artifactId>
+		    <version>1.2</version>
+		</dependency>
+	
+	
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>${junit.version}</version>
+			<scope>test</scope>
+		</dependency>
+		
+		<dependency>
+		    <groupId>org.hamcrest</groupId>
+		    <artifactId>hamcrest-core</artifactId>
+		    <version>1.3</version>
+		    <scope>test</scope>
+		</dependency>
+		
+		<!-- 
+		<dependency>
+			<groupId>net.sf.json-lib</groupId>
+			<artifactId>json-lib</artifactId>
+			<version>2.4</version>
+			<classifier>jdk15</classifier>
+		</dependency>
+		 -->
+		<!-- =========================== -->
+		<!-- provided scope dependencies -->
+		<!-- =========================== -->
+	
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-server</artifactId>
+			<version>${jetty.version}</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-webapp</artifactId>
+			<version>${jetty.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-servlet</artifactId>
+			<version>${jetty.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-util</artifactId>
+			<version>${jetty.version}</version>
+			<scope>compile</scope>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-jsp-2.1</artifactId>
+			<version>7.5.4.v20111024</version>
+			<scope>provided</scope>
+		</dependency>
+		
+		<dependency>
+			<groupId>com.thoughtworks.xstream</groupId>
+			<artifactId>xstream</artifactId>
+			<version>1.4.9</version>
+		</dependency>
+		<dependency>
+			<groupId>org.jdom</groupId>
+			<artifactId>jdom</artifactId>
+			<version>1.1.3</version>
+		</dependency>
+		<dependency>
+	    <groupId>dom4j</groupId>
+	   		<artifactId>dom4j</artifactId>
+	    	<version>1.6.1</version>
+		</dependency>
+ <!-- 
+		<dependency>
+			<groupId>org.apache.tomcat</groupId>
+			<artifactId>jasper</artifactId>
+			<version>6.0.35</version>
+			<scope>provided</scope>
+		</dependency>
+ -->
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>servlet-api</artifactId>
+			<version>${servlet-api.version}</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>javax.servlet.jsp</groupId>
+			<artifactId>jsp-api</artifactId>
+			<version>${jsp-api.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		
+	
+	
+	
+	
+		<!-- =========================== -->
+		<!-- springFramework dependencies -->
+		<!-- =========================== -->
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-core</artifactId>
+			<version>${spring.baseline.version}</version>
+		</dependency>
+		
+		 <dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-aop</artifactId>
+			<version>${spring.baseline.version}</version>
+		</dependency>
+		
+		 <dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-beans</artifactId>
+			<version>${spring.baseline.version}</version>
+		</dependency>
+		 <dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-tx</artifactId>
+			<version>${spring.baseline.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-jdbc</artifactId>
+			<version>${spring.baseline.version}</version>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-expression</artifactId>
+			<version>${spring.baseline.version}</version>
+		</dependency>
+		
+		
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-context-support</artifactId>
+			<version>${spring.baseline.version}</version>
+		</dependency>
+		
+		 <dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-context</artifactId>
+			<version>${spring.baseline.version}</version>
+		</dependency>
+		
+		
+		
+		 <dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-web</artifactId>
+			<version>${spring.baseline.version}</version>
+		</dependency>
+	
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-webmvc</artifactId>
+			<version>${spring.baseline.version}</version>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-oxm</artifactId>
+			<version>${spring.baseline.version}</version>
+		</dependency>
+
+		
+       
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-test</artifactId>
+			<version>${spring.baseline.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		
+		
+
+		<dependency>
+			<groupId>org.aspectj</groupId>
+			<artifactId>aspectjweaver</artifactId>
+			<version>${aspectjweaver.version}</version>
+		</dependency>
+
+        <!-- =========================== -->
+        
+        
+        <!-- jsr303 validation dependencies-->
+        
+        <!--  
+        
+        <dependency>
+            <groupId>javax.validation</groupId>
+            <artifactId>validation-api</artifactId>
+            <version>${javax.validation.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <version>${hibernate.validator.version}</version>
+        </dependency>
+        -->
+
+		<dependency>
+			<groupId>org.freemarker</groupId>
+			<artifactId>freemarker-gae</artifactId>
+			<version>${freemarker.version}</version>
+		</dependency>
+	
+		<dependency>
+			<groupId>org.freemarker</groupId>
+			<artifactId>freemarker</artifactId>
+			<version>${freemarker.version}</version>
+		</dependency>
+		
+		
+
+
+
+
+		<dependency>
+			<groupId>org.apache.shiro</groupId>
+			<artifactId>shiro-core</artifactId>
+			<version>${shiro.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.shiro</groupId>
+			<artifactId>shiro-web</artifactId>
+			<version>${shiro.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.shiro</groupId>
+			<artifactId>shiro-spring</artifactId>
+			<version>${shiro.version}</version>
+		</dependency>
+		
+
+        <dependency>
+			<groupId>commons-fileupload</groupId>
+			<artifactId>commons-fileupload</artifactId>
+			<version>${commons-fileupload.version}</version>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-lang3</artifactId>
+			<version>${commons-lang3.version}</version>
+		</dependency>
+		<dependency>
+			  <groupId>org.apache.commons</groupId>
+              <artifactId>commons-collections4</artifactId>
+			<version>${commons-collections.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-codec</groupId>
+			<artifactId>commons-codec</artifactId>
+			<version>${commons-codec.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-io</groupId>
+			<artifactId>commons-io</artifactId>
+			<version>${commons-io.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-beanutils</groupId>
+			<artifactId>commons-beanutils</artifactId>
+			<version>${commons-beanutils.version}</version>
+		</dependency>
+
+		<!-- <dependency> <groupId>javax.persistence</groupId> <artifactId>persistence-api</artifactId> 
+			<version>${persistence-api.version}</version> </dependency> -->
+
+		<dependency>
+			<groupId>org.eclipse.persistence</groupId>
+			<artifactId>javax.persistence</artifactId>
+			<version>${javax.persistence.version}</version>
+		</dependency>
+
+
+		<dependency>
+			<groupId>net.sourceforge.jexcelapi</groupId>
+			<artifactId>jxl</artifactId>
+			<version>${jxl.version}</version>
+			<exclusions>
+				<exclusion>
+					<artifactId>log4j</artifactId>
+					<groupId>log4j</groupId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+
+		<dependency>
+			<groupId>com.alibaba</groupId>
+			<artifactId>druid</artifactId>
+			<version>${druid.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>${slf4j-api.version}</version>
+		</dependency>
+
+		
+		
+		
+		
+	
+
+		<dependency>
+		    <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+			<version>${jackson.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-databind</artifactId>
+			<version>${jackson.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-annotations</artifactId>
+		    <version>${jackson.version}</version>
+		</dependency>
+		
+		
+
+		
+		<dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+			<version>${mysql-connector-java.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>redis.clients</groupId>
+			<artifactId>jedis</artifactId>
+			<version>${jedis.version}</version>
+		</dependency>
+		<dependency>
+			  <groupId>org.apache.commons</groupId>
+              <artifactId>commons-pool2</artifactId>
+			<version>${commons-pool.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.data</groupId>
+			<artifactId>spring-data-redis</artifactId>
+			<version>${spring-data-redis.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>jcl-over-slf4j</artifactId>
+			<version>${jcl-over-slf4j.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>ch.qos.logback</groupId>
+			<artifactId>logback-core</artifactId>
+			<version>${logback.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>ch.qos.logback</groupId>
+			<artifactId>logback-classic</artifactId>
+			<version>${logback.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>com.google.code.gson</groupId>
+			<artifactId>gson</artifactId>
+			<version>${gson.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>com.thoughtworks.xstream</groupId>
+			<artifactId>xstream</artifactId>
+			<version>${xstream.version}</version>
+		</dependency>
+		
+		<!-- 
+		
+		  <dependency>
+            <groupId>com.ning</groupId>
+            <artifactId>async-http-client</artifactId>
+            <version>1.8.13</version>
+        </dependency>
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>1.1.4c</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.5</version>
+        </dependency>
+         -->
+        
+        <!-- lucene  -->
+        
+        <dependency>
+		    <groupId>org.apache.lucene</groupId>
+		    <artifactId>lucene-core</artifactId>
+		    <version>${lucene.version}</version>
+       </dependency>
+		
+		<dependency>
+		    <groupId>org.apache.lucene</groupId>
+		    <artifactId>lucene-analyzers-common</artifactId>
+		    <version>${lucene.version}</version>
+       </dependency>
+       
+       	<dependency>
+		    <groupId>org.apache.lucene</groupId>
+		    <artifactId>lucene-analyzers-smartcn</artifactId>
+		    <version>${lucene.version}</version>
+       </dependency>
+		<dependency>
+		    <groupId>org.apache.lucene</groupId>
+		    <artifactId>lucene-queryparser</artifactId>
+		    <version>${lucene.version}</version>
+       </dependency>
+       <dependency>
+		    <groupId>org.apache.lucene</groupId>
+		    <artifactId>lucene-backward-codecs</artifactId>
+		    <version>${lucene.version}</version>
+       </dependency>
+       
+       <dependency> 
+			<groupId>joda-time</groupId>
+			<artifactId>joda-time</artifactId>
+			<version>${joda-time.version}</version>
+		</dependency>
+       
+       
+      <dependency>
+	    <groupId>org.apache.httpcomponents</groupId>
+	    <artifactId>httpclient</artifactId>
+	    <version>${httpclient.version}</version>
+     </dependency>
+      <dependency>
+	    <groupId>org.apache.httpcomponents</groupId>
+	    <artifactId>httpmime</artifactId>
+	    <version>${httpclient.version}</version>
+     </dependency>
+     <dependency>
+	    <groupId>org.apache.httpcomponents</groupId>
+	    <artifactId>httpcore</artifactId>
+	    <version>${httpcore.version}</version>
+	 </dependency>
+
+		<dependency>
+			<groupId>com.artofsolving</groupId>
+			<artifactId>jodconverter</artifactId>
+			<version>${jodconverter.version}</version>
+		</dependency>
+
+		<dependency>
+			<!-- jsoup HTML parser library @ http://jsoup.org/ -->
+			<groupId>org.jsoup</groupId>
+			<artifactId>jsoup</artifactId>
+			<version>${jsoup.version}</version>
+		</dependency>
+       <!--  
+		<dependency>
+			<groupId>org.quartz-scheduler</groupId>
+			<artifactId>quartz</artifactId>
+			<version>${quartz.version}</version>
+		</dependency>
+     -->
+       
+      <dependency>
+			<groupId>net.sf.json-lib</groupId>
+			<artifactId>json-lib</artifactId>
+			<version>2.4</version>
+			<classifier>jdk15</classifier>
+		</dependency>
+
+		<!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient -->
+		<dependency>
+			<groupId>commons-httpclient</groupId>
+			<artifactId>commons-httpclient</artifactId>
+			<version>3.1</version>
+		</dependency>
+
+		<!-- https://mvnrepository.com/artifact/bouncycastle/bcprov-jdk14 -->
+		<dependency>
+			<groupId>bouncycastle</groupId>
+			<artifactId>bcprov-jdk14</artifactId>
+			<version>136</version>
+		</dependency>
+
+		<dependency>
+			<groupId>com.xiongyingqi</groupId>
+			<artifactId>qrcode</artifactId>
+			<version>0.1.10</version>
+		</dependency>
+
+
+
+		<dependency>
+			<groupId>cn.jpush.api</groupId>
+			<artifactId>jpush-client</artifactId>
+			<version>3.2.6</version>
+		</dependency>
+
+
+        <dependency>
+            <groupId>net.sourceforge.htmlunit</groupId>
+            <artifactId>htmlunit</artifactId>
+            <version>2.31</version>
+        </dependency>
+		<dependency>
+			<groupId>xml-apis</groupId>
+			<artifactId>xml-apis</artifactId>
+			<version>1.4.01</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-logging</groupId>
+			<artifactId>commons-logging</artifactId>
+			<version>1.2</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-net</groupId>
+			<artifactId>commons-net</artifactId>
+			<version>3.6</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sourceforge.htmlunit</groupId>
+			<artifactId>htmlunit-core-js</artifactId>
+			<version>2.31</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sourceforge.htmlunit</groupId>
+			<artifactId>htmlunit-cssparser</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sourceforge.htmlunit</groupId>
+			<artifactId>neko-htmlunit</artifactId>
+			<version>2.31</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-text</artifactId>
+			<version>1.3</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.httpcomponents</groupId>
+			<artifactId>httpmime</artifactId>
+			<version>4.5.5</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.jetty.websocket</groupId>
+			<artifactId>websocket-client</artifactId>
+			<version>9.4.10.v20180503</version>
+		</dependency>
+		<dependency>
+			<groupId>xalan</groupId>
+			<artifactId>xalan</artifactId>
+			<version>2.7.2</version>
+		</dependency>
+		<dependency>
+			<groupId>xalan</groupId>
+			<artifactId>xalan</artifactId>
+			<version>2.7.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-client</artifactId>
+			<version>9.4.10.v20180503</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-http</artifactId>
+			<version>9.4.10.v20180503</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-io</artifactId>
+			<version>9.4.10.v20180503</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-xml</artifactId>
+			<version>9.4.10.v20180503</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.jetty.websocket</groupId>
+			<artifactId>websocket-api</artifactId>
+			<version>9.4.10.v20180503</version>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.jetty.websocket</groupId>
+			<artifactId>websocket-common</artifactId>
+			<version>9.4.10.v20180503</version>
+		</dependency>
+		<dependency>
+			<groupId>xalan</groupId>
+			<artifactId>serializer</artifactId>
+			<version>2.7.2</version>
+		</dependency>
+		<dependency>
+			<groupId>xerces</groupId>
+			<artifactId>xercesImpl</artifactId>
+			<version>2.11.0</version>
+		</dependency>
+
+		<!--支付宝-->
+		<dependency>
+			<groupId>com.alipay.sdk</groupId>
+			<artifactId>alipay-sdk-java</artifactId>
+			<version>3.0.52.ALL</version>
+		</dependency>
+		<!--阿里云-->
+		<dependency>
+			<groupId>com.aliyun</groupId>
+			<artifactId>aliyun-java-sdk-core</artifactId>
+			<version>3.7.1</version>
+		</dependency>
+		<dependency>
+			<groupId>com.aliyun</groupId>
+			<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
+			<version>1.1.0</version>
+		</dependency>
+
+		<dependency>
+			<groupId>javax.mail</groupId>
+			<artifactId>mail</artifactId>
+			<version>1.4.4</version>
+		</dependency>
+	</dependencies>
+
+
+
+	<build>
+
+		<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
+		<testSourceDirectory>${basedir}/src/main/java/test</testSourceDirectory>
+		<outputDirectory>${basedir}/src/main/webapp/WEB-INF/classes</outputDirectory>
+		<testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>
+		<resources>
+			<resource>
+				<directory>${basedir}/src/main/resources</directory>
+				<includes>
+					<include>**/*.xml</include>
+					<include>**/*.properties</include>
+				</includes>
+			</resource>
+			<resource>
+				<directory>${basedir}/src/main/java</directory>
+				<includes>
+					<include>**/*.xml</include>
+					<include>**/*.properties</include>
+				</includes>
+			</resource>
+		</resources>
+		<testResources>
+		
+		<!-- 
+			<testResource>
+				<directory>${basedir}/src/test/resources</directory>
+				<excludes>
+					<exclude>**/*.java</exclude>
+					<exclude>**/*.web.xml</exclude>
+				</excludes>
+				<filtering>true</filtering>
+			</testResource>
+			<testResource>
+				<directory>${basedir}/src/test/java</directory>
+				<includes>
+					<include>**/*.xml</include>
+					<include>**/*.properties</include>
+					<include>**/*Test.java</include>
+					<include>**/*TestCase.java</include>
+				</includes>
+				<excludes>
+					<exclude>**/Test*.java</exclude>
+				</excludes>
+			</testResource>
+			 -->
+			
+		</testResources>
+
+		<finalName>${finalName}</finalName>
+
+		<pluginManagement>
+			<plugins>
+				<!-- =================== -->
+				<!-- Java compile plugin -->
+				<!-- =================== -->
+				<plugin>
+					<groupId>org.apache.maven.plugins</groupId>
+					<artifactId>maven-war-plugin</artifactId>
+					<!-- <artifactId>maven-compiler-plugin</artifactId> -->
+					<version>${maven-compiler-plugin.version}</version>
+					<configuration>
+						<compilerVersion>1.7</compilerVersion>
+						<source>1.7</source>
+						<target>1.7</target>
+						<encoding>utf-8</encoding>
+						<compilerArguments>
+                          <extdirs>src/main/webapp/WEB-INF/lib</extdirs>
+                        </compilerArguments>
+					</configuration>
+				</plugin>
+
+
+				<!-- ================== -->
+				<!-- Java Source plugin -->
+				<!-- ================== -->
+				<plugin>
+					<artifactId>maven-source-plugin</artifactId>
+					<version>${maven-source-plugin.version}</version>
+					<configuration>
+						<attach>true</attach>
+					</configuration>
+					<executions>
+						<execution>
+							<phase>compile</phase>
+							<goals>
+								<goal>jar</goal>
+							</goals>
+						</execution>
+					</executions>
+				</plugin>
+
+				<!-- ============== -->
+				<!-- Javadoc plugin -->
+				<!-- ============== -->
+				<plugin>
+					<artifactId>maven-javadoc-plugin</artifactId>
+					<version>${maven-javadoc-plugin.version}</version>
+					<configuration>
+						<docencoding>${project.build.sourceEncoding}</docencoding>
+					</configuration>
+					<executions>
+						<execution>
+							<id>javadoc-jar</id>
+							<phase>package</phase>
+							<goals>
+								<goal>jar</goal>
+							</goals>
+						</execution>
+					</executions>
+				</plugin>
+
+				<!-- ============== -->
+				<!-- jar plugin -->
+				<!-- ============== -->
+				<plugin>
+					<artifactId>maven-jar-plugin</artifactId>
+					<version>${maven-jar-plugin.version}</version>
+					<configuration>
+						<archive>
+							<index>true</index>
+							<manifest>
+								<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+								<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+							</manifest>
+							<manifestEntries>
+								<Build-Version>${project.version}-${maven.build.timestamp}</Build-Version>
+							</manifestEntries>
+						</archive>
+					</configuration>
+				</plugin>
+
+				<!-- ============== -->
+				<!-- war plugin -->
+				<!-- ============== -->
+				<plugin>
+					<artifactId>maven-war-plugin</artifactId>
+					<version>${maven-war-plugin.version}</version>
+					<configuration>
+						<warName>yingpu</warName>
+						<archive>
+							<index>true</index>
+							<manifest>
+								<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+								<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+							</manifest>
+							<manifestEntries>
+								<Build-Version>${project.version}-${maven.build.timestamp}</Build-Version>
+							</manifestEntries>
+						</archive>
+					</configuration>
+				</plugin>
+
+
+	<!-- =================== -->
+				<!-- Java resource plugin -->
+				<!-- =================== -->
+				<plugin>
+					<artifactId>maven-resources-plugin</artifactId>
+					<version>${maven-resources-plugin.version}</version>
+				</plugin>
+
+
+
+			</plugins>
+		</pluginManagement>
+
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.7</source>
+                    <target>1.7</target>
+                </configuration>
+            </plugin>
+
+     <!--  
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+			</plugin>
+	 -->
+
+			<plugin>
+				<artifactId>maven-jar-plugin</artifactId>
+			</plugin>
+
+			<plugin>
+				<artifactId>maven-war-plugin</artifactId>
+			</plugin>
+
+		</plugins>
+	</build>
+
+</project>
+  

+ 23 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/LuceneField.java

@@ -0,0 +1,23 @@
+
+/**
+ * 
+ */
+package com.cz.yingpu.frame.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *  标记可以用于Lucene搜索,根据类名创建索引
+ * @copyright {@link 9iu.org}
+ * @author springrain<9iuorg@gmail.com>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.annotation.LuceneField
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD) 
+public @interface LuceneField  {
+
+}

+ 21 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/LuceneSearch.java

@@ -0,0 +1,21 @@
+
+/**
+ * 
+ */
+package com.cz.yingpu.frame.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ *  标记可以用于Lucene搜索,根据类名创建索引
+ * @copyright {@link 9iu.org}
+ * @author springrain<9iuorg@gmail.com>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.annotation.LuceneSearch
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface LuceneSearch  {
+	
+
+}

+ 21 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/NotLog.java

@@ -0,0 +1,21 @@
+
+/**
+ * 
+ */
+package com.cz.yingpu.frame.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ *  用于Entity的注解,不希望记录日志
+ * @copyright {@link 9iu.org}
+ * @author springrain<9iuorg@gmail.com>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.annotation.NotLog
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface NotLog  {
+	
+
+}

+ 28 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/PKSequence.java

@@ -0,0 +1,28 @@
+
+/**
+ * 
+ */
+package com.cz.yingpu.frame.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *  用于Entity的注解,当主键值为空时,主要是用于数据库sequence取值
+ * @copyright {@link 9iu.org}
+ * @author springrain<9iuorg@gmail.com>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.annotation.PKSequence
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD) 
+public @interface PKSequence  {
+	/**
+	 *sequence取值,默认为空,可以指定sequence取值方式 例如 oracle的 test.nextvalue,db2的 next value for test
+	 * @return
+	 */
+	String name() default "";  
+
+}

+ 21 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/SecurityApi.java

@@ -0,0 +1,21 @@
+package com.cz.yingpu.frame.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *  标记可以用于api接口返回数据加密,引用此注解的方法都会配合SecurityAspect进行加密
+ * @author Michael
+ * @version  2017-03-08 11:08:15
+ * @see com.cz.yingpu.frame.annotation.SecurityApi
+ */
+@Target({ElementType.PARAMETER, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface SecurityApi {
+//	String description()  default "";
+	String value() default "" ;
+}

+ 25 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/TableGroup.java

@@ -0,0 +1,25 @@
+
+/**
+ * 
+ */
+package com.cz.yingpu.frame.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ *  用于Entity的注解,主要是用于映射表名和设置扩展后缀
+ * @copyright {@link 9iu.org}
+ * @author springrain<9iuorg@gmail.com>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.annotation.TableGroup
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface TableGroup  {
+	/**
+	 * 扩展后缀,默认为空,可以指定字段 例如 ext 的getExt() 返回值是 _history_2013
+	 * @return
+	 */
+	String name() default "";  
+
+}

+ 25 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/TableSuffix.java

@@ -0,0 +1,25 @@
+
+/**
+ * 
+ */
+package com.cz.yingpu.frame.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ *  用于Entity的注解,主要是用于映射表名和设置扩展后缀
+ * @copyright {@link weicms.net}
+ * @author springrain<9iuorg@gmail.com>
+ * @version  2013-03-19 11:08:15
+ * @see org.springrain.frame.annotation.TableSuffix
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface TableSuffix  {
+	/**
+	 * 扩展后缀,默认为空,可以指定字段 例如 suffix 的getSuffix() 返回值是 _history_2013
+	 * @return
+	 */
+	String name() default "";  
+
+}

+ 25 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/annotation/WhereSQL.java

@@ -0,0 +1,25 @@
+
+/**
+ * 
+ */
+package com.cz.yingpu.frame.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * TODO 用于queryBean的geter 方法,主要是用于查询条件的映射<br/>
+ * 例如:@WhereSQL(sql="id=:Auditlog_id"),表示getId()返回值直接作为:Auditlog_id的命名参数的值
+ * @copyright {@link 9iu.org}
+ * @author springrain<9iuorg@gmail.com>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.annotation.WhereSQL
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface WhereSQL  {
+	/**
+	 * 设置where条件
+	 * @return
+	 */
+	String sql() default "";  
+}

Файловите разлики са ограничени, защото са твърде много
+ 258 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/aspect/SecurityAspect.java


+ 110 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/cached/ICached.java

@@ -0,0 +1,110 @@
+package com.cz.yingpu.frame.cached;
+
+import java.util.List;
+import java.util.Set;
+
+
+public interface ICached {
+	/**
+	 * 删除 缓存
+	 * @param key
+	 * @return
+	 * @throws Exception
+	 */
+	String deleteCached(byte[] key)throws Exception;
+	/**
+	 * 更新 缓存
+	 * @param key
+	 * @param value
+	 * @return
+	 * @throws Exception
+	 */
+	Object updateCached(byte[] key,byte[] value,Long expire)throws Exception;
+	/**
+	 * 获取缓存
+	 * @param key
+	 * @return
+	 * @throws Exception
+	 */
+	Object getCached(byte[] key)throws Exception;
+	/**
+	 * 根据 正则表达式key 获取 列表
+	 * @param keys
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	Set getKeys(byte[] keys)throws Exception;
+	
+	/**
+	 * 根据 正则表达式key 获取 列表
+	 * @param keys
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	Set getHashKeys(byte[] key)throws Exception;
+	
+	
+	
+	/**
+	 * 更新 缓存
+	 * @param key
+	 * @param value
+	 * @return
+	 * @throws Exception
+	 */
+	Boolean updateHashCached(byte[] key,byte[] mapkey,byte[] value,Long expire)throws Exception;
+	
+
+	/**
+	 * 获取缓存
+	 * @param key
+	 * @return
+	 * @throws Exception
+	 */
+	Object getHashCached(byte[] key,byte[] mapkey)throws Exception;
+	
+	
+	/**
+	 * 删除 缓存
+	 * @param key
+	 * @param value
+	 * @return
+	 * @throws Exception
+	 */
+	Long deleteHashCached(byte[] key,byte[] mapkey)throws Exception;
+	
+	/**
+	 * 获取 map的长度
+	 * @param key
+	 * @return
+	 * @throws Exception
+	 */
+	Long getHashSize(byte[] key)throws Exception;
+/**
+ * 获取 map中的所有值
+ * @param key
+ * @return
+ * @throws Exception
+ */
+	@SuppressWarnings("rawtypes")
+	List getHashValues(byte[] key)throws Exception;
+	
+	
+	/**
+	 * 获取 map的长度
+	 * @param key
+	 * @return
+	 * @throws Exception
+	 */
+	Long getDBSize()throws Exception;
+	
+	/**
+	 * 获取 map的长度
+	 * @param key
+	 * @return
+	 * @throws Exception
+	 */
+	void clearDB()throws Exception;
+}

+ 245 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/cached/RedisCachedImpl.java

@@ -0,0 +1,245 @@
+package com.cz.yingpu.frame.cached;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.springframework.dao.DataAccessException;
+import org.springframework.data.redis.connection.RedisConnection;
+import org.springframework.data.redis.core.RedisCallback;
+import org.springframework.data.redis.core.RedisTemplate;
+
+import com.cz.yingpu.frame.util.SerializeUtil;
+
+public class RedisCachedImpl implements ICached {
+	public RedisCachedImpl() {
+
+	}
+	// -1 - never expire
+    private int expire = 1800;
+	private RedisTemplate<String, Object> redisTemplate;
+
+	@Override
+	public String deleteCached(final byte[] sessionId) throws Exception {
+		redisTemplate.execute(new RedisCallback<Object>() {
+			@Override
+			public Long doInRedis(RedisConnection connection)
+					throws DataAccessException {
+				connection.del(sessionId);
+				return null;
+			}
+		});
+		return null;
+	}
+
+	@Override
+	public String updateCached(final byte[] key, final byte[] session,final Long expireSec)
+			throws Exception {
+		return (String) redisTemplate.execute(new RedisCallback<Object>() {
+			@Override
+			public String doInRedis(final RedisConnection connection)
+					throws DataAccessException {
+				connection.set(key, session);
+				if(expireSec!=null){
+					connection.expire(key, expireSec);
+				}else{
+					connection.expire(key, expire);
+				}
+				return new String(key);
+			}
+		});
+
+	}
+
+	@Override
+	public Object getCached(final byte[] sessionId) throws Exception {
+		return redisTemplate.execute(new RedisCallback<Object>() {
+			@Override
+			public Object doInRedis(RedisConnection connection)
+					throws DataAccessException {
+				byte[] bs = connection.get(sessionId);
+				return SerializeUtil.unserialize(bs);
+			}
+		});
+
+	}
+
+
+	@SuppressWarnings("rawtypes")
+	@Override
+	public Set getKeys(final byte[] keys) throws Exception {
+		return redisTemplate.execute(new RedisCallback<Set>() {
+			@Override
+			@SuppressWarnings("unchecked")
+			public Set doInRedis(RedisConnection connection)
+					throws DataAccessException {
+				Set<byte[]> setByte = connection.keys(keys);
+				if (setByte == null || setByte.size() < 1) {
+					return null;
+				}
+				Set set = new HashSet();
+				for (byte[] key : setByte) {
+					byte[] bs = connection.get(key);
+					set.add(SerializeUtil.unserialize(bs));
+				}
+
+				return set;
+
+			}
+		});
+	}
+
+
+	@SuppressWarnings("rawtypes")
+	@Override
+	public Set getHashKeys(final byte[] key) throws Exception {
+		return redisTemplate.execute(new RedisCallback<Set>() {
+			@Override
+			@SuppressWarnings("unchecked")
+			public Set doInRedis(RedisConnection connection)
+					throws DataAccessException {
+				Set<byte[]> hKeys = connection.hKeys(key);
+				if(hKeys==null||hKeys.size()>1){
+					return null;
+				}
+				Set set=new HashSet();
+				for(byte[] bs:hKeys){
+					set.add(SerializeUtil.unserialize(bs));
+				}
+			return set;
+			}
+		});
+
+	}
+
+	@Override
+	public Boolean  updateHashCached(final byte[] key,final byte[] mapkey, final byte[] value, Long expire)
+			throws Exception {
+	
+		return redisTemplate.execute(new RedisCallback<Boolean>() {
+			@Override
+			public Boolean doInRedis(RedisConnection connection)
+					throws DataAccessException {
+				Boolean hSet = connection.hSet(key, mapkey, value);
+				return hSet;
+			}
+		});
+	}
+
+	@Override
+	public Object getHashCached(final byte[] key, final byte[] mapkey) throws Exception {
+		return redisTemplate.execute(new RedisCallback<Object>() {
+			@Override
+			public Object doInRedis(RedisConnection connection)
+					throws DataAccessException {
+				byte[] hGet = connection.hGet(key, mapkey);
+				return SerializeUtil.unserialize(hGet);
+
+			}
+		});
+	}
+	
+	
+	@Override
+	public Long deleteHashCached(final byte[] key, final byte[] mapkey) throws Exception {
+		return redisTemplate.execute(new RedisCallback<Long>() {
+			@Override
+			public Long doInRedis(RedisConnection connection)
+					throws DataAccessException {
+				Long hDel = connection.hDel(key, mapkey);
+				return hDel;
+
+			}
+		});
+	}
+	
+	
+	@Override
+	public Long getHashSize(final byte[] key) throws Exception {
+		return redisTemplate.execute(new RedisCallback<Long>() {
+			@Override
+			public Long doInRedis(RedisConnection connection)
+					throws DataAccessException {
+				Long len = connection.hLen(key);
+				
+				return len;
+
+			}
+		});
+	}
+
+	
+	@Override
+	public Long getDBSize() throws Exception {
+		return redisTemplate.execute(new RedisCallback<Long>() {
+			@Override
+			public Long doInRedis(RedisConnection connection)
+					throws DataAccessException {
+				Long len = connection.dbSize();
+				
+				return len;
+
+			}
+		});
+	}
+
+	@Override
+	public void clearDB() throws Exception {
+		 redisTemplate.execute(new RedisCallback<Long>() {
+			@Override
+			public Long doInRedis(RedisConnection connection)
+					throws DataAccessException {
+				  connection.flushDb();
+				return null;
+
+			}
+		});
+	}
+	
+	public RedisTemplate<String, Object> getRedisTemplate() {
+		return redisTemplate;
+	}
+
+	public void setRedisTemplate(RedisTemplate<String, Object> redisTemplate) {
+		this.redisTemplate = redisTemplate;
+	}
+
+	public int getExpire() {
+		return expire;
+	}
+
+	public void setExpire(int expire) {
+		this.expire = expire;
+	}
+
+	@SuppressWarnings("rawtypes")
+	@Override
+	public List getHashValues(final byte[] key) throws Exception {
+		return redisTemplate.execute(new RedisCallback<List>() {
+			@Override
+			@SuppressWarnings("unchecked")
+			public List doInRedis(RedisConnection connection)
+					throws DataAccessException {
+				 List<byte[]> hVals = connection.hVals(key);
+				
+				 if(hVals==null||hVals.size()<1){
+					 return null;
+				 }
+				 List list=new ArrayList();
+				 
+				 for(byte[] bs:hVals){
+					 list.add(SerializeUtil.unserialize(bs));
+				 }
+				return list;
+
+			}
+		});
+	}
+
+
+
+
+	
+
+}

+ 16 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/common/BaseLogger.java

@@ -0,0 +1,16 @@
+package com.cz.yingpu.frame.common;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+ 
+/**
+ *  Log基类,所有的类默认继承此类,可以直接使用 logger 记录日志,例如 logger.error("error");
+ * @copyright {@link 9iu.org}
+ * @author springrain<9iuorg@gmail.com>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.common.BaseLogger
+ */
+public class BaseLogger {
+	public   Logger logger = LoggerFactory.getLogger(getClass());
+
+}

+ 98 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/common/SessionUser.java

@@ -0,0 +1,98 @@
+package com.cz.yingpu.frame.common;
+
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.session.Session;
+import org.apache.shiro.subject.Subject;
+
+import com.cz.yingpu.frame.shiro.ShiroUser;
+
+/**
+ * 当前登录用户信息,可以在bean中调用获取当前登录用户信息,例如 SessionUser.getUserId()获取当前登录人的userId
+ * 
+ * @copyright {@link 9iu.org}
+ * @author springrain<9iuorg@gmail.com>
+ * @version 2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.common.SessionUser
+ */
+public class SessionUser {
+
+	public SessionUser() {
+	}
+
+	public static ShiroUser getShiroUser() {
+
+		try {
+
+			Subject user = SecurityUtils.getSubject();
+			if (user == null) {
+				return null;
+			}
+			ShiroUser shiroUser = (ShiroUser) user.getPrincipal();
+			if (shiroUser == null) {
+				return null;
+			}
+			return shiroUser;
+		} catch (Exception e) {
+			return null;
+		}
+	}
+
+	public static Session getSession() {
+		try {
+			Subject user = SecurityUtils.getSubject();
+			if (user == null) {
+				return null;
+			}
+			Session session = user.getSession();
+			return session;
+		} catch (Exception e) {
+			return null;
+		}
+	}
+
+	public static String getUserId() {
+		try {
+			ShiroUser shiroUser = getShiroUser();
+			if (shiroUser == null) {
+				return null;
+			}
+			return shiroUser.getId();
+		} catch (Exception e) {
+			return null;
+		}
+	}
+
+	public static Integer getUserType() {
+		ShiroUser shiroUser = getShiroUser();
+		if (shiroUser == null) {
+			return null;
+		}
+		return shiroUser.getUserType();
+	}
+
+	public static String getUserCode() {
+		ShiroUser shiroUser = getShiroUser();
+		if (shiroUser == null) {
+			return null;
+		}
+		return shiroUser.getAccount();
+
+	}
+
+	public static String getUserName() {
+		ShiroUser shiroUser = getShiroUser();
+		if (shiroUser == null) {
+			return null;
+		}
+		return shiroUser.getName();
+	}
+
+	public static String getEmail() {
+		ShiroUser shiroUser = getShiroUser();
+		if (shiroUser == null) {
+			return null;
+		}
+		return shiroUser.getEmail();
+	}
+
+}

+ 52 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/common/SpringAnnotationBeanNameGenerator.java

@@ -0,0 +1,52 @@
+package com.cz.yingpu.frame.common;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.context.annotation.AnnotationBeanNameGenerator;
+/**
+ * 重新设置springbean的命名规则,暂时不用
+ * @author zhengyongshegn
+ *
+ */
+public class SpringAnnotationBeanNameGenerator extends  AnnotationBeanNameGenerator  {
+/*
+	@Override
+	public String generateBeanName(BeanDefinition definition,
+			BeanDefinitionRegistry registry) {
+		String s=super.generateBeanName(definition, registry);
+		System.out.println(s);
+		
+		String className = definition.getBeanClassName();
+		//System.out.println(className);
+		className=className.substring(className.lastIndexOf(".")+1);
+		if(className.toLowerCase().endsWith("impl")){
+			className=className.substring(0, className.length()-4);
+		}
+		
+		className=className.substring(0,1).toLowerCase() + className.substring(1);
+		//System.out.println(className);
+
+		
+		return className;
+	}
+	*/
+	@Override
+	protected String buildDefaultBeanName(BeanDefinition definition) {
+		String className =definition.getBeanClassName();  
+	
+		className=className.substring(className.lastIndexOf(".")+1);
+		if(className.toLowerCase().endsWith("impl")){
+			className=className.substring(0, className.length()-4);
+		}
+		if((className.toLowerCase().endsWith("service")||className.toLowerCase().endsWith("dao"))==false){
+			return super.buildDefaultBeanName(definition);
+		}
+		
+	
+		className=className.substring(0,1).toLowerCase() + className.substring(1);
+		return className;
+	}
+
+	
+	
+	
+}

+ 127 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/common/StaticHtmlFreeMarkerView.java

@@ -0,0 +1,127 @@
+package com.cz.yingpu.frame.common;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.cache.Cache;
+import org.springframework.cache.CacheManager;
+import org.springframework.web.servlet.support.RequestContextUtils;
+import org.springframework.web.servlet.view.freemarker.FreeMarkerView;
+
+import com.cz.yingpu.frame.util.GlobalStatic;
+import com.cz.yingpu.frame.util.SpringUtils;
+
+import freemarker.template.SimpleHash;
+import freemarker.template.Template;
+
+
+//@Component("staticHtmlFreeMarkerView")
+public class StaticHtmlFreeMarkerView extends FreeMarkerView {
+	
+	private CacheManager cacheManager=null;
+	private Cache cache=null;
+
+	/**
+	 * Process the model map by merging it with the FreeMarker template.
+	 * Output is directed to the servlet response.
+	 * <p>This method can be overridden if custom behavior is needed.
+	 */
+	@Override
+	protected void doRender(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception{
+
+		if(cacheManager==null){
+		 cacheManager=(CacheManager) SpringUtils.getBeanByType(CacheManager.class);
+		 cache = cacheManager.getCache(GlobalStatic.staticHtmlCacheKey);
+		}
+
+		// Expose model to JSP tags (as request attributes).
+		exposeModelAsRequestAttributes(model, request);
+		// Expose all standard FreeMarker hash models.
+		SimpleHash fmModel = buildTemplateModel(model, request, response);
+
+		if (logger.isDebugEnabled()) {
+			logger.debug("Rendering FreeMarker template [" + getUrl() + "] in FreeMarkerView '" + getBeanName() + "'");
+		}
+		// Grab the locale-specific version of the template.
+		Locale locale = RequestContextUtils.getLocale(request);
+		
+		
+		String uri = request.getRequestURI();
+		String contextPath = request.getContextPath();
+		int i=uri.indexOf(contextPath);
+		if(i>-1){
+			uri=uri.substring(i+contextPath.length());
+		}
+		
+		
+		//cache key,可以根据URI从数据库进行查询资源Id
+		String htmlCacheKey="findHtmlPathByURI_"+uri;
+				
+		String htmlPath=cache.get(htmlCacheKey, String.class);
+		
+		
+		Template template=getTemplate(locale);
+		if(StringUtils.isBlank(htmlPath)||htmlPath.equals("error")){//缓存中不存在
+			processTemplate(template, fmModel, response);
+			return;
+		}
+		
+		File htmlFile = new File(htmlPath);  
+		if(htmlFile.exists()){
+			response.setContentType("text/html;charset="+GlobalStatic.defaultCharset);
+			response.setCharacterEncoding(GlobalStatic.defaultCharset);
+		    response.getWriter().write(IOUtils.toString(htmlFile.toURI(), GlobalStatic.defaultCharset));
+		}else{
+			createHtml(htmlFile, htmlCacheKey, fmModel, model, template, response);
+		}
+		
+		
+	}
+	/**
+	 * 生成静态文件
+	 * @param htmlFile
+	 * @param htmlCacheKey
+	 * @param fmModel
+	 * @param model
+	 * @param template
+	 * @param response
+	 * @throws Exception
+	 */
+	private synchronized void createHtml(File htmlFile,String htmlCacheKey,SimpleHash fmModel,Map<String, Object> model, Template template, HttpServletResponse response)throws Exception{
+		String htmlPath=cache.get(htmlCacheKey, String.class);
+		if(StringUtils.isBlank(htmlPath)||"error".equals(htmlPath)){//缓存中不存在
+			processTemplate(template, fmModel, response);
+			return;
+		}
+		//生成文件 开始期间
+		cache.put(htmlCacheKey, "error");
+		htmlFile.createNewFile();
+		
+		Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFile),GlobalStatic.defaultCharset));
+		template.process(model, out);
+		out.flush();  
+	    out.close(); 
+	    //生成文件 结束
+		cache.put(htmlCacheKey, htmlPath);
+		//输出文件
+		response.setContentType("text/html;charset="+GlobalStatic.defaultCharset);
+		response.setCharacterEncoding(GlobalStatic.defaultCharset);
+	    response.getWriter().write(IOUtils.toString(htmlFile.toURI(), GlobalStatic.defaultCharset));
+		
+	}
+	
+	
+	
+	
+	
+}

+ 267 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/controller/BaseController.java

@@ -0,0 +1,267 @@
+package com.cz.yingpu.frame.controller;
+
+import java.beans.PropertyEditorSupport;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.util.Date;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.InitBinder;
+
+import com.cz.yingpu.frame.common.BaseLogger;
+import com.cz.yingpu.frame.util.DateTypeEditor;
+import com.cz.yingpu.frame.util.Page;
+
+/**
+ * 基础的Controller,所有的Controller必须继承此类
+ * 
+ * @copyright {@link 9iu.org}
+ * @author springrain<9iuorg@gmail.com>
+ * @version 2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.controller.BaseController
+ * @param <T>
+ */
+// @Controller
+public class BaseController extends BaseLogger {
+
+	public String messageurl = "/common/message";
+
+	public String message = "message";
+
+	public String redirect = "redirect:";
+
+	public String forward = "forward:";
+
+	//@Resource
+	//private CacheManager shiroCacheManager;
+
+	/**
+	 * 增加了@ModelAttribute的方法可以在本controller方法调用前执行,可以存放一些共享变量,如枚举值,或是一些初始化操作
+	 */
+
+	// @ModelAttribute("")
+	public void init(Model model) {
+		// model.addAttribute("now", new Date());
+
+	}
+
+	/**
+	 * 初始化映射格式.
+	 * 
+	 * @param binder
+	 */
+	@InitBinder
+	public void initBinder(WebDataBinder binder) {
+		
+		binder.registerCustomEditor(Date.class, new DateTypeEditor());
+		
+		/*
+		binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
+			public void setAsText(String value) {
+				try {
+					if (StringUtils.isNotBlank(value)) {
+						try {
+							setValue(new SimpleDateFormat(DateUtils.DATETIME_FORMAT).parse(value));
+						} catch (Exception e) {
+							setValue(new SimpleDateFormat(DateUtils.DATE_FORMAT).parse(value));
+						}
+					} else {
+						setValue(null);
+					}
+				} catch (Exception e) {
+					setValue(null);
+					logger.error(e.getMessage(), e);
+				}
+			}
+		
+			 // public String getAsText() { return new
+			 // SimpleDateFormat("yyyy-MM-dd").format((Date) getValue()); }
+			 
+		});
+		
+		
+		*/
+
+		binder.registerCustomEditor(Integer.class, new PropertyEditorSupport() {
+			@Override
+			public void setAsText(String value) {
+				try {
+					if (StringUtils.isNotBlank(value)) {
+						try {
+							setValue(Integer.valueOf(value));
+						} catch (NumberFormatException e) {
+							setValue(null);
+						}
+						
+					} else {
+						setValue(null);
+					}
+				} catch (Exception e) {
+					setValue(null);
+					logger.error(e.getMessage(), e);
+				}
+			}
+		});
+		binder.registerCustomEditor(Long.class, new PropertyEditorSupport() {
+			@Override
+			public void setAsText(String value) {
+				try {
+					if (StringUtils.isNotBlank(value)) {
+						setValue(Long.valueOf(value));
+					} else {
+						setValue(null);
+					}
+				} catch (Exception e) {
+					setValue(null);
+					logger.error(e.getMessage(), e);
+				}
+			}
+		});
+		binder.registerCustomEditor(Double.class, new PropertyEditorSupport() {
+			@Override
+			public void setAsText(String value) {
+				try {
+					if (StringUtils.isNotBlank(value)) {
+						setValue(Double.valueOf(value));
+					} else {
+						setValue(null);
+					}
+				} catch (Exception e) {
+					setValue(null);
+					logger.error(e.getMessage(), e);
+				}
+			}
+		});
+
+		binder.registerCustomEditor(BigDecimal.class, new PropertyEditorSupport() {
+			@Override
+			public void setAsText(String value) {
+				try {
+					if (StringUtils.isNotBlank(value)) {
+						setValue(new BigDecimal(value));
+					} else {
+						setValue(null);
+					}
+				} catch (Exception e) {
+					setValue(null);
+					logger.error(e.getMessage(), e);
+				}
+			}
+		});
+
+	}
+
+	@ExceptionHandler
+	public String exp(HttpServletRequest request, Exception e) {
+		e.printStackTrace();
+		request.setAttribute("e", e);
+		logger.error(e.getMessage(), e);
+		return "/error";
+	}
+
+	/**
+	 * 公共下载方法
+	 * 
+	 * @param response
+	 * @param file
+	 *            下载的文件
+	 * @param fileName
+	 *            下载时显示的文件名
+	 * @return
+	 * @throws Exception
+	 */
+	public HttpServletResponse downFile(HttpServletResponse response, File file, String fileName,
+			boolean delFile) throws Exception {
+		response.setContentType("application/x-download");
+		response.setHeader("Pragma", "public");
+		response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
+		OutputStream out = null;
+		InputStream in = null;
+		// 下面一步不可少
+		fileName = new String(fileName.getBytes("GBK"), "ISO-8859-1");
+		response.addHeader("Content-disposition", "attachment;filename=" + fileName);// 设定输出文件头
+
+		try {
+			out = response.getOutputStream();
+			in = new FileInputStream(file);
+			int len = in.available();
+			byte[] b = new byte[len];
+			in.read(b);
+			out.write(b);
+			out.flush();
+
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			throw new Exception("下载失败!");
+		} finally {
+			if (in != null) {
+				in.close();
+			}
+			if (out != null) {
+				out.close();
+			}
+			if (delFile) {
+				file.delete();
+			}
+		}
+		return response;
+	}
+	/**
+	 * 获取分页 page 对象
+	 * @param request
+	 * @return
+	 */
+	public Page newPage(HttpServletRequest request) {
+		// ==获取分页信息
+	 return 	newPage(request, "id", "desc");
+	}
+	/**
+	 * 指定默认的排序字段和方法 返回page分页对象
+	 * @param request
+	 * @param defaultOrder
+	 * @param defaultSort
+	 * @return
+	 */
+	public Page newPage(HttpServletRequest request,String defaultOrder,String defaultSort) {
+		// ==获取分页信息
+		
+		String str_pageIndex = request.getParameter("pageIndex");
+		int pageIndex = NumberUtils.toInt(str_pageIndex, 1);
+		String order = request.getParameter("order");
+		String sort = request.getParameter("sort");
+		String pageSize=request.getParameter("pageSize");
+		if (StringUtils.isBlank(order)) {
+			order = defaultOrder;
+		}
+		if (StringUtils.isBlank(sort)) {
+			sort = defaultSort;
+		}
+		
+		if (StringUtils.isBlank(order)) {
+			order = "id";
+		}
+		if (StringUtils.isBlank(sort)) {
+			sort = "desc";
+		}
+		Page page = new Page(pageIndex);
+		if(StringUtils.isNotBlank(pageSize)){
+			page.setPageSize(Integer.parseInt(pageSize));
+		}
+		page.setOrder(order);
+		page.setSort(sort);
+		return page;
+	}
+	
+	
+
+}

Файловите разлики са ограничени, защото са твърде много
+ 1217 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/dao/BaseJdbcDaoImpl.java


+ 395 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/dao/IBaseJdbcDao.java

@@ -0,0 +1,395 @@
+
+/**
+ * 
+ */
+package com.cz.yingpu.frame.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.jdbc.core.CallableStatementCreator;
+import org.springframework.jdbc.core.SqlParameter;
+
+import com.cz.yingpu.frame.util.Finder;
+import com.cz.yingpu.frame.util.Page;
+
+
+/**
+ * 基础的Dao接口,所有的Dao都必须实现此接口,每个数据库都需要一个实现.</br> 
+ * 例如 demo数据的实现接口是com.cz.yingpu.springrain.dao.IBasespringrainDao,demo2数据的实现接口是com.cz.yingpu.demo2.dao.IBasedemo2Dao</br>
+ * 
+ * @copyright {@link 9iu.org}
+ * @author springrain<Auto generate>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.dao.IBaseJdbcDao
+ */
+
+public interface IBaseJdbcDao {
+	
+	
+	Integer updateValidValue(Object o) throws Exception;
+
+	/**
+	 * 查询结果是 List<Entity>
+	 * 
+	 * @param finder
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> List<T> queryForList(Finder finder, Class<T> clazz)
+			throws Exception;
+
+	/**
+	 * 调用存储过程 查询结果是 List<Entity>
+	 * 
+	 * @param finder
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> List<T> queryForListByProc(Finder finder, Class<T> clazz)
+			throws Exception;
+
+	/**
+	 * 调用数据库函数 查询结果是 List<Entity>
+	 * 
+	 * @param finder
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> List<T> queryForListByFunction(Finder finder, Class<T> clazz)
+			throws Exception;
+
+
+	/**
+	 * 调用数据库存储过程 返回指定 对象
+	 * 
+	 * @param <T>
+	 * @param sql
+	 * @param paramMap
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> T queryForObjectByProc(Finder finder, Class<T> clazz)
+			throws Exception;
+
+	/**
+	 * 调用数据库函数 返回指定 对象
+	 * 
+	 * @param <T>
+	 * @param sql
+	 * @param paramMap
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> T queryForObjectByByFunction(Finder finder, Class<T> clazz)
+			throws Exception;
+
+	/**
+	 * 执行函数 返回执行结果为Map
+	 * 
+	 * @param finder
+	 * @return
+	 */
+	public Map<String,Object> queryObjectByFunction(Finder finder)throws Exception;
+
+	/**
+	 * 执行存储过程 返回执行结果为
+	 * 
+	 * @param finder
+	 * @return
+	 */
+	public Map<String, Object> queryObjectByProc(Finder finder)throws Exception;
+	
+	
+	/**
+	 * 调用数据库存储过程  查询结果是 List
+	 * @param finder
+	 * @return
+	 * @throws Exception
+	 */
+	public  List<Map<String,Object>> queryForListByProc(Finder finder) throws Exception;
+	
+	/**
+	 * 调用数据库函数  查询结果是 List
+	 * @param finder
+	 * @return
+	 * @throws Exception
+	 */
+	public  List<Map<String,Object>> queryForListByFunction(Finder finder) throws Exception;
+	
+	
+	
+
+	/**
+	 * 返回结果是List<Map>
+	 * 
+	 * @param sql
+	 * @param map
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Map<String, Object>> queryForList(Finder finder)
+			throws Exception;
+
+	/**
+	 * 返回结果是List<Map>
+	 * 
+	 * @param finder
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Map<String, Object>> queryForList(Finder finder, Page page)
+			throws Exception;
+
+	/**
+	 * 查询一个对象
+	 * 
+	 * @param <T>
+	 * @param sql
+	 * @param paramMap
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> T queryForObject(Finder finder, Class<T> clazz) throws Exception;
+
+	/**
+	 * Entity作为查询的query bean,并返回Entity
+	 * 
+	 * @param entity
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> T queryForObject(T entity) throws Exception;
+
+	/**
+	 * Entity作为查询的query bean,并返回Entity
+	 * 
+	 * @param entity
+	 * @param page
+	 *            分页对象
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> List<T> queryForListByEntity(T entity, Page page)
+			throws Exception;
+
+	/**
+	 * 查询返回一个map
+	 * 
+	 * @param sql
+	 * @param paramMap
+	 * @return
+	 * @throws Exception
+	 */
+	public Map<String, Object> queryForObject(Finder finder) throws Exception;
+
+	/**
+	 * 更新数据
+	 * 
+	 * @param sql
+	 * @param paramMap
+	 * @return
+	 * @throws Exception
+	 */
+	public Integer update(Finder finder) throws Exception;
+
+	/**
+	 * 分页查询,自己提供详细参数
+	 * 
+	 * @param <T>
+	 * @param sql
+	 * @param countSql
+	 * @param orderSql
+	 * @param paramMap
+	 * @param clazz
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> List<T> queryForList(Finder finder, Class<T> clazz, Page page)
+			throws Exception;
+
+	/**
+	 * 列表查询,每个service都会重载,要把sql语句封装到service中,Finder只是最后的方案
+	 * 
+	 * @param finder
+	 * @param page
+	 *            分页对象
+	 * @param clazz
+	 * @param queryBean
+	 *            是queryBean
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> List<T> findListDataByFinder(Finder finder, Page page,
+			Class<T> clazz, Object queryBean) throws Exception;
+
+	/**
+	 * 保存一个对象
+	 * 
+	 * @param <T>
+	 * @param clazz
+	 * @return
+	 */
+	public Object save(Object entity) throws Exception;
+
+	public Object save(Object entity, boolean ignoreNull) throws Exception;
+	
+	
+/**
+ * 批量更新
+ * @param list
+ * @return List
+ * @throws Exception
+ */
+	@SuppressWarnings("rawtypes")
+	public List<Integer>  save(List list) throws Exception;
+
+	/**
+	 * 更新一个对象,更新对象映射的所有字段
+	 * 
+	 * @param <T>
+	 * @param clazz
+	 * @return
+	 */
+	public Integer update(Object entity) throws Exception;
+	
+	
+	
+/**
+ * 更新一个对象,id必须有值,updatenotnull=true 不更新为null的字段,false更新所有字段
+ * @param entity
+ * @param updatenotnull
+ * @return
+ * @throws Exception
+ */
+	public Integer update(Object entity,boolean onlyupdatenotnull) throws Exception;
+	
+	
+	/**
+	 * 批量更新对象
+	 * @param list
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public  List<Integer> update(List list) throws Exception;
+	
+	/**
+	 * 批量更新对象,id必须有值,updatenotnull=true 不更新为null的字段,false更新所有字段
+	 * @param list
+	 * @param updatenotnull
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public  List<Integer> update(List list,boolean onlyupdatenotnull) throws Exception;
+	
+	
+
+
+	/**
+	 * 根据Id 删除
+	 * 
+	 * @param id
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public void deleteById(Object id, Class clazz) throws Exception;
+
+	/**
+	 * 根据ID批量删除
+	 * 
+	 * @param ids
+	 * @param clazz
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public void deleteByIds(List ids, Class clazz) throws Exception;
+
+	/**
+	 * 根据ID 查询对象,主要用于分表
+	 * 
+	 * @param <T>
+	 * @param id
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> T findByID(Object id, Class<T> clazz) throws Exception;
+
+	/**
+	 * 根据ID 查询对象,用于分表
+	 * 
+	 * @param id
+	 * @param clazz
+	 * @param tableExt
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> T findByID(Object id, Class<T> clazz, String tableExt)
+			throws Exception;
+
+	/**
+	 * 判断主键是否有值 save or update 对象
+	 * 
+	 * @param entity
+	 * @return
+	 */
+	public Object saveorupdate(Object entity) throws Exception;
+
+	/**
+	 * 根据查询的queryBean,拼接Finder 的 Where条件,只包含 and 条件,用于普通查询
+	 * 
+	 * @param finder
+	 * @param o
+	 * @return
+	 * @throws Exception
+	 */
+	public Finder getFinderWhereByQueryBean(Finder finder, Object o)
+			throws Exception;
+	
+	  /**
+	   * 执行 call 操作,执行存储过程,和数据库函数
+	   * @param callableStatementCreator
+	   * @param parameter
+	   * @return
+	   * @throws Exception
+	   */
+	 public Object executeCallBack(CallableStatementCreator callableStatementCreator,List<SqlParameter> parameter)throws Exception;
+
+	/**
+	 * 根据page对象中sort和order 添加order by 排序,一般用于前台传递的自定义排序
+	 * 
+	 * @param finder
+	 * @param page
+	 * @return
+	 */
+	Finder getFinderOrderBy(Finder finder, Page page) throws Exception;
+
+	/**
+	 * 获取数据库的版本
+	 * 
+	 * @return
+	 */
+	// public String getDataBaseVersion();
+	/**
+	 * 获取数据库的类型
+	 * 
+	 * @return
+	 */
+	// public String getDataBaseType() ;
+	/**
+	 * 获取数据库所有的表
+	 * 
+	 * @return
+	 */
+	// public List<String> getDataBaseAllTables();
+
+}

+ 61 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/dao/RowNumberSingleColumnRowMapper.java

@@ -0,0 +1,61 @@
+package com.cz.yingpu.frame.dao;
+
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+
+import org.springframework.dao.TypeMismatchDataAccessException;
+import org.springframework.jdbc.core.SingleColumnRowMapper;
+/**
+ * 映射java基本类型
+ * @copyright {@link 9iu.org}
+ * @author springrain<Auto generate>
+ * @version 2013-03-19 11:08:15
+ * @param <T>
+ */
+public class RowNumberSingleColumnRowMapper<T> extends SingleColumnRowMapper<T>{
+	private Class<T> requiredType;
+	
+	public RowNumberSingleColumnRowMapper(){
+		
+	}
+	
+	public RowNumberSingleColumnRowMapper (Class<T> requiredType) {
+		this.requiredType = requiredType;
+	}
+	@SuppressWarnings({ "unused", "unchecked" })
+	@Override
+	public T mapRow(ResultSet rs, int rowNum) throws SQLException {
+
+		// Validate column count.
+		ResultSetMetaData rsmd = rs.getMetaData();
+		int nrOfColumns = rsmd.getColumnCount();
+		/*
+		if (nrOfColumns != 1) {
+			throw new IncorrectResultSetColumnCountException(1, nrOfColumns);
+		}
+       */
+		// Extract column value from JDBC ResultSet.
+		int columnIndex=1;
+		String columnName=rsmd.getColumnName(columnIndex);
+		if("frame_page_sql_row_number".equals(columnName.toLowerCase())){
+			columnIndex=2;
+		}
+		
+		Object result = getColumnValue(rs,columnIndex, this.requiredType);
+		if (result != null && this.requiredType != null && !this.requiredType.isInstance(result)) {
+			// Extracted value does not match already: try to convert it.
+			try {
+				return (T) convertValueToRequiredType(result, this.requiredType);
+			}
+			catch (IllegalArgumentException ex) {
+				throw new TypeMismatchDataAccessException(
+						"Type mismatch affecting row number " + rowNum + " and column type '" +
+						rsmd.getColumnTypeName(1) + "': " + ex.getMessage());
+			}
+		}
+		return (T) result;
+	
+	}
+
+}

+ 44 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/Db2Dialect.java

@@ -0,0 +1,44 @@
+package com.cz.yingpu.frame.dao.dialect;
+
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.util.Page;
+
+@Component("db2Dialect")
+public class Db2Dialect implements IDialect {
+
+	@Override
+	public String getPageSql(String sql, String orderby, Page page) {
+		// 设置分页参数
+		// 设置分页参数
+		int satrt = (page.getPageIndex() - 1) * page.getPageSize() + 1;
+		int end = page.getPageIndex() * page.getPageSize();
+		//去掉无用的空格
+		sql=sql.trim();
+		// 去掉select
+		if (sql.toLowerCase().startsWith("select")) {
+			sql = sql.substring(6);
+		}
+	
+  StringBuffer sb=new StringBuffer();
+	sb.append("SELECT * from (SELECT ROWNUMBER() OVER (");
+	sb.append(orderby);
+	sb.append(")  frame_page_sql_row_number,");
+	sb.append(sql);
+	sb.append("  ) frame_sql_temp_table WHERE frame_sql_temp_table.frame_page_sql_row_number >= ");
+	sb.append(satrt).append(" and frame_sql_temp_table.frame_page_sql_row_number<=").append(end);
+//	sb.append(" order by frame_page_sql_row_number ");
+		return sb.toString();
+	}
+
+	@Override
+	public String getDataDaseType() {
+		return "db2";
+	}
+
+	@Override
+	public boolean isRowNumber() {
+		return true;
+	}
+
+}

+ 30 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/IDialect.java

@@ -0,0 +1,30 @@
+/**
+ * 数据库方言接口
+ */
+
+package com.cz.yingpu.frame.dao.dialect;
+
+import com.cz.yingpu.frame.util.Page;
+
+
+public  interface IDialect {
+	/**
+	 * 得到分页语句
+	 * @param sql 正常的select 语句,没有order by 
+	 * @param orderby order by 语句
+	 * @param page 分页对象
+	 * @return
+	 */
+	String getPageSql(String sql,String orderby,Page page);
+	/**
+	 * 获取数据库类型
+	 * @return
+	 */
+	String getDataDaseType();
+	/**
+	 * 是否包含 rownum 列
+	 * @return
+	 */
+	boolean isRowNumber();
+	
+}

+ 45 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/InformixDialect.java

@@ -0,0 +1,45 @@
+package com.cz.yingpu.frame.dao.dialect;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.util.Page;
+
+@Component("informixDialect")
+public class InformixDialect implements IDialect {
+
+	@Override
+	public String getPageSql(String sql, String orderby, Page page) {
+		// 设置分页参数
+	int pageSize = page.getPageSize();
+	int pageNo = page.getPageIndex();
+	
+	  //去掉无用的空格
+		sql=sql.trim();
+		// 去掉select
+		if (sql.toLowerCase().startsWith("select")) {
+			sql = sql.substring(6);
+		}
+	
+  StringBuffer sb=new StringBuffer();
+	sb.append("SELECT SKIP ");
+	sb.append(pageSize * (pageNo - 1)).append(" FIRST ").append(pageSize).append(" ");
+    sb.append(sql);
+	if (StringUtils.isNotBlank(orderby)) {
+		sb.append(" ").append(orderby);
+	}
+	
+return sb.toString();
+	}
+
+	@Override
+	public String getDataDaseType() {
+		return "informix";
+	}
+
+	@Override
+	public boolean isRowNumber() {
+		return false;
+	}
+
+}

+ 45 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/MssqlDialect.java

@@ -0,0 +1,45 @@
+package com.cz.yingpu.frame.dao.dialect;
+
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.util.Page;
+
+@Component("mssqlDialect")
+public class MssqlDialect implements IDialect {
+
+	@Override
+	public String getPageSql(String sql, String orderby, Page page) {
+		// 设置分页参数
+	int pageSize = page.getPageSize();
+	int pageNo = page.getPageIndex();
+	//去掉无用的空格
+	sql=sql.trim();
+	// 去掉select
+	if (sql.toLowerCase().startsWith("select")) {
+		sql = sql.substring(6);
+	}
+	
+  StringBuffer sb=new StringBuffer();
+	sb.append("SELECT TOP ");
+	sb.append(pageSize);
+	sb.append(" * from (SELECT ROW_NUMBER() OVER (");
+	sb.append(orderby);
+	sb.append(")  frame_page_sql_row_number,");
+	sb.append(sql);
+	sb.append("  ) frame_sql_temp_table WHERE frame_page_sql_row_number > ");
+	sb.append(pageSize * (pageNo - 1));
+	sb.append(" order by frame_page_sql_row_number ");
+		return sb.toString();
+	}
+
+	@Override
+	public String getDataDaseType() {
+		return "mssql";
+	}
+
+	@Override
+	public boolean isRowNumber() {
+		return true;
+	}
+
+}

+ 35 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/MysqlDialect.java

@@ -0,0 +1,35 @@
+package com.cz.yingpu.frame.dao.dialect;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.util.Page;
+
+@Component("mysqlDialect")
+public class MysqlDialect implements IDialect {
+
+	@Override
+	public String getPageSql(String sql, String orderby, Page page) {
+		// 设置分页参数
+		int pageSize = page.getPageSize();
+		int pageNo = page.getPageIndex();
+		StringBuffer sb = new StringBuffer(sql);
+		if (StringUtils.isNotBlank(orderby)) {
+			sb.append(" ").append(orderby);
+		}
+		sb.append(" limit ").append(pageSize * (pageNo - 1)).append(",")
+				.append(pageSize);
+		return sb.toString();
+	}
+
+	@Override
+	public String getDataDaseType() {
+		return "mysql";
+	}
+
+	@Override
+	public boolean isRowNumber() {
+		return false;
+	}
+
+}

+ 41 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/OracleDialect.java

@@ -0,0 +1,41 @@
+package com.cz.yingpu.frame.dao.dialect;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.util.Page;
+
+@Component("oracleDialect")
+public class OracleDialect implements IDialect {
+
+	@Override
+	public String getPageSql(String sql, String orderby, Page page) {
+		// 设置分页参数
+		int satrt = (page.getPageIndex() - 1) * page.getPageSize() + 1;
+		int end = page.getPageIndex() * page.getPageSize();
+
+		StringBuffer sb = new StringBuffer();
+		sb.append("select * from ( select  rownum frame_page_sql_row_number ,frame_sql_temp_table1.* from (");
+		sb.append(sql);
+		if (StringUtils.isNotBlank(orderby)) {
+			sb.append(" ").append(orderby);
+		}
+		sb.append(") frame_sql_temp_table1 where rownum <= ").append(end)
+				.append(") frame_sql_temp_table2");
+		sb.append(" where frame_sql_temp_table2.frame_page_sql_row_number >= ")
+				.append(satrt);
+
+		return sb.toString();
+	}
+
+	@Override
+	public String getDataDaseType() {
+		return "oracle";
+	}
+
+	@Override
+	public boolean isRowNumber() {
+		return true;
+	}
+
+}

+ 36 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/PostgresqlDialect.java

@@ -0,0 +1,36 @@
+package com.cz.yingpu.frame.dao.dialect;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.util.Page;
+
+@Component("postgresqlDialect")
+public class PostgresqlDialect implements IDialect {
+
+	@Override
+	public String getPageSql(String sql, String orderby, Page page) {
+		// 设置分页参数
+		int pageSize = page.getPageSize();
+		int pageNo = page.getPageIndex();
+		StringBuffer sb = new StringBuffer(sql);
+		if (StringUtils.isNotBlank(orderby)) {
+			sb.append(" ").append(orderby);
+		}
+		sb.append(" limit ").append(pageSize).append(" offset ")
+				.append(pageSize * (pageNo - 1));
+
+		return sb.toString();
+	}
+
+	@Override
+	public String getDataDaseType() {
+		return "postgresql";
+	}
+
+	@Override
+	public boolean isRowNumber() {
+		return false;
+	}
+
+}

+ 35 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/dao/dialect/Sqlite3Dialect.java

@@ -0,0 +1,35 @@
+package com.cz.yingpu.frame.dao.dialect;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.util.Page;
+
+@Component("sqlite3Dialect")
+public class Sqlite3Dialect implements IDialect {
+
+	@Override
+	public String getPageSql(String sql, String orderby, Page page) {
+		// 设置分页参数
+		int pageSize = page.getPageSize();
+		int pageNo = page.getPageIndex();
+		StringBuffer sb = new StringBuffer(sql);
+		if (StringUtils.isNotBlank(orderby)) {
+			sb.append(" ").append(orderby);
+		}
+		sb.append(" limit ").append(pageSize * (pageNo - 1)).append(",")
+				.append(pageSize);
+		return sb.toString();
+	}
+
+	@Override
+	public String getDataDaseType() {
+		return "sqlite3";
+	}
+
+	@Override
+	public boolean isRowNumber() {
+		return false;
+	}
+
+}

+ 208 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/entity/AuditLog.java

@@ -0,0 +1,208 @@
+package com.cz.yingpu.frame.entity;
+
+import java.util.Calendar;
+
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import com.cz.yingpu.frame.annotation.TableGroup;
+import com.cz.yingpu.frame.annotation.WhereSQL;
+import com.cz.yingpu.frame.util.GlobalStatic;
+/**
+ * TODO 在此加入类描述
+ * @copyright {@link 9iu.org}
+ * @author springrain<Auto generate>
+ * @version  2013-04-02 10:17:31
+ * @see com.cz.yingpu.frame.entity.AuditLog
+ */
+@Table(name="t_auditlog")
+@TableGroup(name="ext")
+public class AuditLog  extends BaseEntity  {
+	
+	private static final long serialVersionUID = 1L;
+
+	//alias
+	/*
+	public static final String TABLE_ALIAS = "Auditlog";
+	public static final String ALIAS_ID = "ID";
+	public static final String ALIAS_OPERATION_TYPE = "操作类型";
+	public static final String ALIAS_OPERATOR_NAME = "操作人姓名";
+	public static final String ALIAS_PRE_VALUE = "旧值";
+	public static final String ALIAS_CUR_VALUE = "新值";
+	public static final String ALIAS_OPERATION_TIME = "操作时间";
+	public static final String ALIAS_OPERATION_CLASS = "操作类";
+	public static final String ALIAS_OPERATION_CLASS_ID = "记录ID";
+    */
+	//date formats
+	//public static final String FORMAT_OPERATION_TIME = DateUtils.DATETIME_FORMAT;
+	
+	//columns START
+	/**
+	 * ID
+	 */
+	private java.lang.String id;
+	/**
+	 * 操作类型
+	 */
+	private java.lang.String operationType;
+	/**
+	 * 操作人姓名
+	 */
+	private java.lang.String operatorName;
+	/**
+	 * 旧值
+	 */
+	private java.lang.String preValue;
+	/**
+	 * 新值
+	 */
+	private java.lang.String curValue;
+	/**
+	 * 操作时间
+	 */
+	private java.util.Date operationTime;
+	/**
+	 * 操作类
+	 */
+	private java.lang.String operationClass;
+	/**
+	 * 记录ID
+	 */
+	private java.lang.String operationClassId;
+	//columns END
+	
+	
+	private String ext;
+	
+	//concstructor
+
+	public AuditLog(){
+	}
+
+	public AuditLog(
+		java.lang.String id
+	){
+		this.id = id;
+	}
+
+	//get and set
+	public void setId(java.lang.String value) {
+		this.id = value;
+	}
+	
+	@Id
+     @WhereSQL(sql="id=:Auditlog_id")
+	public java.lang.String getId() {
+		return this.id;
+	}
+	public void setOperationType(java.lang.String value) {
+		this.operationType = value;
+	}
+	
+     @WhereSQL(sql="operationType=:Auditlog_operationType")
+	public java.lang.String getOperationType() {
+		return this.operationType;
+	}
+	public void setOperatorName(java.lang.String value) {
+		this.operatorName = value;
+	}
+	
+     @WhereSQL(sql="operatorName=:Auditlog_operatorName")
+	public java.lang.String getOperatorName() {
+		return this.operatorName;
+	}
+	public void setPreValue(java.lang.String value) {
+		this.preValue = value;
+	}
+	
+     @WhereSQL(sql="preValue=:Auditlog_preValue")
+	public java.lang.String getPreValue() {
+		return this.preValue;
+	}
+	public void setCurValue(java.lang.String value) {
+		this.curValue = value;
+	}
+	
+     @WhereSQL(sql="curValue=:Auditlog_curValue")
+	public java.lang.String getCurValue() {
+		return this.curValue;
+	}
+	
+	
+	public void setOperationTime(java.util.Date value) {
+		this.operationTime = value;
+	}
+	
+     @WhereSQL(sql="operationTime=:Auditlog_operationTime")
+	public java.util.Date getOperationTime() {
+		return this.operationTime;
+	}
+	public void setOperationClass(java.lang.String value) {
+		this.operationClass = value;
+	}
+	
+     @WhereSQL(sql="operationClass=:Auditlog_operationClass")
+	public java.lang.String getOperationClass() {
+		return this.operationClass;
+	}
+	public void setOperationClassId(java.lang.String value) {
+		this.operationClassId = value;
+	}
+	
+     @WhereSQL(sql="operationClassId=:Auditlog_operationClassId")
+	public java.lang.String getOperationClassId() {
+		return this.operationClassId;
+	}
+	
+	@Override
+	public String toString() {
+		return new StringBuffer()
+			.append("ID[").append(getId()).append("],")
+			.append("操作类型[").append(getOperationType()).append("],")
+			.append("操作人姓名[").append(getOperatorName()).append("],")
+			.append("旧值[").append(getPreValue()).append("],")
+			.append("新值[").append(getCurValue()).append("],")
+			.append("操作时间[").append(getOperationTime()).append("],")
+			.append("操作类[").append(getOperationClass()).append("],")
+			.append("记录ID[").append(getOperationClassId()).append("],")
+			.toString();
+	}
+	
+	@Override
+	public int hashCode() {
+		return new HashCodeBuilder()
+			.append(getId())
+			.toHashCode();
+	}
+	
+	@Override
+	public boolean equals(Object obj) {
+		if(obj instanceof AuditLog == false) return false;
+		if(this == obj) return true;
+		AuditLog other = (AuditLog)obj;
+		return new EqualsBuilder()
+			.append(getId(),other.getId())
+			.isEquals();
+	}
+	
+	@Transient
+	public String getExt() {
+		if(StringUtils.isBlank(ext)){
+			int year= Calendar.getInstance().get(Calendar.YEAR);
+			this.ext= GlobalStatic.tableSuffix + year;
+		}
+			return ext;
+	}
+
+	public void setExt(String ext) {
+		this.ext = ext;
+	}
+	
+}
+
+	

+ 51 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/entity/BaseEntity.java

@@ -0,0 +1,51 @@
+package com.cz.yingpu.frame.entity;
+
+import javax.persistence.Transient;
+
+
+
+/**
+ *  Entity基类,所有的entity必须继承此类
+ * @copyright {@link 9iu.org}
+ * @author springrain<9iuorg@gmail.com>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.entity.BaseEntity
+ */
+public class BaseEntity  implements IBaseEntity {
+
+
+	private static final long serialVersionUID = 1L;
+	
+
+	
+	/**
+	 * 表的别名,用于处理复杂的where 条件拼接
+	 */
+	private String frameTableAlias=null;
+	
+	@Transient
+	public static long isSerialVersionUID() {
+		return serialVersionUID;
+	}
+	
+	public void setSerialVersionUID(long l) {
+		//return serialVersionUID;
+	}
+	@Transient
+	public String getFrameTableAlias() {
+		return frameTableAlias;
+	}
+	
+	@Transient
+	public String isFrameTableAlias() {
+		return frameTableAlias;
+	}
+
+	public void setFrameTableAlias(String frameTableAlias) {
+		this.frameTableAlias = frameTableAlias;
+	}
+
+	
+
+	
+}

+ 11 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/entity/IBaseEntity.java

@@ -0,0 +1,11 @@
+package com.cz.yingpu.frame.entity;
+/**
+ *  Entity的基础接口
+ * @copyright {@link 9iu.org}
+ * @author springrain<9iuorg@gmail.com>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.entity.IBaseEntity
+ */
+public interface IBaseEntity extends java.io.Serializable {
+
+}

+ 20 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/queue/RedisMessageDelegateListener.java

@@ -0,0 +1,20 @@
+package com.cz.yingpu.frame.queue;
+
+import java.io.Serializable;
+
+public class RedisMessageDelegateListener {
+	public Integer i=1;
+	
+	
+	//也可以串行处理
+	//public synchronized void handleMessage(Serializable message){
+	
+	public  void handleMessage(Serializable message){
+		
+        System.out.println(i+":"+message);
+        i++;
+        System.out.println("000000000000000000");
+        
+    }
+
+}

+ 26 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/queue/SendMessage.java

@@ -0,0 +1,26 @@
+package com.cz.yingpu.frame.queue;
+
+import java.io.Serializable;
+
+import org.springframework.data.redis.core.RedisTemplate;
+
+public class SendMessage {
+	private RedisTemplate<String, Object> redisTemplate;
+
+
+    public RedisTemplate<String, Object> getRedisTemplate() {
+        return redisTemplate;
+    }
+
+
+
+    public void setRedisTemplate(RedisTemplate<String, Object> redisTemplate) {
+        this.redisTemplate = redisTemplate;
+    }
+
+
+
+    public void sendMessage(String channel, Serializable message) {
+        redisTemplate.convertAndSend(channel, message);
+    }
+}

+ 789 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/service/BaseServiceImpl.java

@@ -0,0 +1,789 @@
+/**
+ * 
+ */
+package com.cz.yingpu.frame.service;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.annotation.Resource;
+
+import ch.qos.logback.classic.db.names.TableName;
+import com.cz.yingpu.system.entity.Message;
+import jxl.Cell;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.jdbc.core.CallableStatementCreator;
+import org.springframework.jdbc.core.SqlParameter;
+import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
+
+import com.cz.yingpu.frame.common.BaseLogger;
+import com.cz.yingpu.frame.dao.IBaseJdbcDao;
+import com.cz.yingpu.frame.entity.IBaseEntity;
+import com.cz.yingpu.frame.util.ClassUtils;
+import com.cz.yingpu.frame.util.DateUtils;
+import com.cz.yingpu.frame.util.EntityInfo;
+import com.cz.yingpu.frame.util.ExcelUtils;
+import com.cz.yingpu.frame.util.Finder;
+import com.cz.yingpu.frame.util.GlobalStatic;
+import com.cz.yingpu.frame.util.Page;
+import com.cz.yingpu.frame.util.ReturnDatas;
+import com.cz.yingpu.frame.util.SpringUtils;
+
+import freemarker.template.Template;
+/**
+ * 基础的Service父类,所有的Service都必须继承此类,每个数据库都需要一个实现.</br> 
+ * 例如 demo数据的实现类是com.cz.yingpu.springrain.service.BasedemoServiceImpl,demo2数据的实现类是com.cz.yingpu.demo2.service.Basedemo2ServiceImpl</br>
+ * 
+ * @copyright {@link 9iu.org}
+ * @author springrain<Auto generate>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.service.BaseServiceImpl
+ */
+public abstract class BaseServiceImpl extends BaseLogger implements
+		IBaseService {
+
+	@Resource
+	public SpringUtils springUtils;
+	@Resource
+	public FreeMarkerConfigurer freeMarkerConfigurer;
+
+	public abstract IBaseJdbcDao getBaseDao();
+
+	/**
+	 * 获取spring Bean
+	 */
+	@SuppressWarnings("static-access")
+	@Override
+	public Object getBean(String beanName) throws Exception {
+		if (beanName == null)
+			return null;
+		getSpringUtils();
+		return SpringUtils.getBean(beanName);
+	}
+
+	/**
+	 * @return the springUtils
+	 */
+	@Override
+	public SpringUtils getSpringUtils() {
+		return springUtils;
+	}
+
+	@Override
+	public <T> List<T> queryForList(Finder finder, Class<T> clazz)
+			throws Exception {
+		return getBaseDao().queryForList(finder, clazz);
+	}
+
+	@Override
+	public List<Map<String, Object>> queryForList(Finder finder)
+			throws Exception {
+		return getBaseDao().queryForList(finder);
+	}
+
+	/**
+	 * 执行函数 返回执行结果为Map
+	 * 
+	 * @param finder
+	 * @return
+	 */
+	@Override
+	public  Map<String, Object> queryObjectByFunction(Finder finder)  throws Exception{
+		return getBaseDao().queryObjectByFunction(finder);
+	}
+
+	@Override
+	public <T> T findById(Object id, Class<T> clazz, String tableExt)
+			throws Exception {
+		return getBaseDao().findByID(id, clazz, tableExt);
+	}
+
+	/**
+	 * 执行存储过程 返回执行结果为
+	 * 
+	 * @param finder
+	 * @return
+	 */
+	@Override
+	public Map<String, Object> queryObjectByProc(Finder finder)  throws Exception{
+		return getBaseDao().queryObjectByProc(finder);
+	}
+	
+	/**
+	 * 调用数据库存储过程  查询结果是 List
+	 * @param finder
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public  List<Map<String,Object>> queryForListByProc(Finder finder) throws Exception{
+		return getBaseDao().queryForListByProc(finder);
+	}
+	
+	/**
+	 * 调用数据库函数  查询结果是 List
+	 * @param finder
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public  List<Map<String,Object>> queryForListByFunction(Finder finder) throws Exception{
+		return getBaseDao().queryForListByFunction(finder);
+	}
+	
+	
+
+	@Override
+	public <T> T queryForObject(Finder finder, Class<T> clazz) throws Exception {
+
+		return getBaseDao().queryForObject(finder, clazz);
+	}
+
+	@Override
+	public Map<String, Object> queryForObject(Finder finder) throws Exception {
+		return getBaseDao().queryForObject(finder);
+	}
+
+	@Override
+	public Integer update(Finder finder) throws Exception {
+
+		return getBaseDao().update(finder);
+	}
+
+	@SuppressWarnings("rawtypes")
+	@Override
+	public void deleteById(Object id, Class clazz) throws Exception {
+		getBaseDao().deleteById(id, clazz);
+	}
+
+	@SuppressWarnings("rawtypes")
+	@Override
+	public void deleteByIds(List ids, Class clazz) throws Exception {
+		getBaseDao().deleteByIds(ids, clazz);
+	}
+
+	@Override
+	public void deleteByEntity(IBaseEntity entity) throws Exception {
+		EntityInfo entityInfoByEntity = ClassUtils
+				.getEntityInfoByEntity(entity);
+		String tableName = entityInfoByEntity.getTableName();
+		String tableExt = entityInfoByEntity.getTableSuffix();
+		if (StringUtils.isNotBlank(tableExt)) {
+			tableName = tableName + tableExt;
+		}
+
+		Finder finder = new Finder("DELETE FROM ");
+		finder.append(tableName).append(" WHERE 1=1 ");
+		getFinderWhereByQueryBean(finder, entity);
+		getBaseDao().update(finder);
+	}
+	@Override
+	public void deleteMessages(Message message) throws Exception{
+		Finder finder = new Finder("DELETE FROM t_message where userId=:userId");
+		finder.setParam("userId",message.getUserId());
+		getBaseDao().update(finder);
+	}
+	@Override
+	public <T> List<T> queryForList(Finder finder, Class<T> clazz, Page page)
+			throws Exception {
+		return getBaseDao().queryForList(finder, clazz, page);
+	}
+
+	@Override
+	public List<Map<String, Object>> queryForList(Finder finder, Page page)
+			throws Exception {
+		return getBaseDao().queryForList(finder, page);
+	}
+
+	/**
+	 * Entity作为查询的query bean,并返回Entity
+	 * 
+	 * @param entity
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public <T> T queryForObject(T entity) throws Exception {
+		return getBaseDao().queryForObject(entity);
+
+	}
+
+	/**
+	 * Entity作为查询的query bean,并返回Entity
+	 * 
+	 * @param entity
+	 * @param page
+	 *            分页对象
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public <T> List<T> queryForListByEntity(T entity, Page page)
+			throws Exception {
+		return getBaseDao().queryForListByEntity(entity, page);
+	}
+
+	@Override
+	public <T> List<T> findListDataByFinder(Finder finder, Page page,
+			Class<T> clazz, Object queryBean) throws Exception {
+		return getBaseDao()
+				.findListDataByFinder(finder, page, clazz, queryBean);
+	}
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	@Override
+	public <T> File findDataExportExcel(List list, String ftlurl,
+			Page page,Object queryBean) throws Exception {
+		Map map = new HashMap();
+		ReturnDatas returnDatas=new ReturnDatas();
+		map.put(GlobalStatic.exportexcel, true);// 设置导出excel变量
+		Template template = freeMarkerConfigurer.getConfiguration()
+				.getTemplate(ftlurl + GlobalStatic.suffix);
+		page.setPageSize(GlobalStatic.excelPageSize);
+		page.setPageIndex(1);
+		List datas = list;
+		returnDatas.setData(datas);
+		map.put(GlobalStatic.returnDatas, returnDatas);
+		String fileName = UUID.randomUUID().toString();
+		String tempFFilepath = GlobalStatic.tempRootpath + "/" + fileName
+				+ "/freemarker.html";
+		String tempExcelpath = GlobalStatic.tempRootpath + "/" + fileName + "/"
+				+ fileName + GlobalStatic.excelext;
+		File tempfdir = new File(GlobalStatic.tempRootpath + "/" + fileName);
+		if (tempfdir.exists() == false) {
+			tempfdir.mkdirs();
+		}
+
+		File ffile = new File(tempFFilepath);
+
+		File excelFile = new File(tempExcelpath);
+		boolean first = true;
+		boolean end = false;
+		int pageCount = page.getPageCount();
+		if (pageCount < 2) {
+			pageCount = 1;
+			end = true;
+		}
+		createExceFile(template, ffile, excelFile, first, end, map);
+		first = false;
+		/*for (int i = 2; i <= pageCount; i++) {
+			if (i == pageCount) {
+				end = true;
+			}
+			page.setPageIndex(i);
+			datas = findListDataByFinder(finder, page, clazz, queryBean);
+			returnDatas.setData(datas);
+			map.put(GlobalStatic.returnDatas, returnDatas);
+			createExceFile(template, ffile, excelFile, first, end, map);
+		}*/
+		if (ffile.exists()) {
+			ffile.delete();
+		}
+		
+		if(excelFile.exists()){
+			excelFile.setReadOnly();
+		}
+		return excelFile;
+		
+	}
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	@Override
+	public <T> File findDataExportExcel(Finder finder, String ftlurl,
+			Page page, Class<T> clazz, Object queryBean) throws Exception {
+		Map map = new HashMap();
+		ReturnDatas returnDatas=new ReturnDatas();
+		map.put(GlobalStatic.exportexcel, true);// 设置导出excel变量
+		Template template = freeMarkerConfigurer.getConfiguration()
+				.getTemplate(ftlurl + GlobalStatic.suffix);
+		page.setPageSize(GlobalStatic.excelPageSize);
+		page.setPageIndex(1);
+		List datas = findListDataByFinder(finder, page, clazz, queryBean);
+		returnDatas.setData(datas);
+		map.put(GlobalStatic.returnDatas, returnDatas);
+		String fileName = UUID.randomUUID().toString();
+		String tempFFilepath = GlobalStatic.tempRootpath + "/" + fileName
+				+ "/freemarker.html";
+		String tempExcelpath = GlobalStatic.tempRootpath + "/" + fileName + "/"
+				+ fileName + GlobalStatic.excelext;
+		File tempfdir = new File(GlobalStatic.tempRootpath + "/" + fileName);
+		if (tempfdir.exists() == false) {
+			tempfdir.mkdirs();
+		}
+
+		File ffile = new File(tempFFilepath);
+
+		File excelFile = new File(tempExcelpath);
+		boolean first = true;
+		boolean end = false;
+		int pageCount = page.getPageCount();
+		if (pageCount < 2) {
+			pageCount = 1;
+			end = true;
+		}
+		createExceFile(template, ffile, excelFile, first, end, map);
+		first = false;
+		for (int i = 2; i <= pageCount; i++) {
+			if (i == pageCount) {
+				end = true;
+			}
+			page.setPageIndex(i);
+			datas = findListDataByFinder(finder, page, clazz, queryBean);
+			returnDatas.setData(datas);
+			map.put(GlobalStatic.returnDatas, returnDatas);
+			createExceFile(template, ffile, excelFile, first, end, map);
+		}
+		if (ffile.exists()) {
+			ffile.delete();
+		}
+		
+		if(excelFile.exists()){
+			excelFile.setReadOnly();
+		}
+		
+		return excelFile;
+	}
+
+	/**
+	 * 创建一个 excel 文件
+	 * 
+	 * @param template
+	 * @param ffile
+	 * @param excelFile
+	 * @param first
+	 * @param end
+	 * @param map
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	private File createExceFile(Template template, File ffile, File excelFile,
+			boolean first, boolean end, Map map) throws Exception {
+		Writer out = null;
+		try {
+			out = new BufferedWriter(new OutputStreamWriter(
+					new FileOutputStream(ffile), "UTF-8"));
+			template.process(map, out);
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+			throw new Exception("生成freemarker页面错误");
+		} finally {
+			if (out != null) {
+				out.flush();
+				out.close();
+			}
+		}
+
+		FileInputStream in = null;
+		BufferedReader br = null;
+		FileOutputStream fos = null;
+		OutputStreamWriter osw = null;
+		BufferedWriter bw = null;
+		try {
+			in = new FileInputStream(ffile);
+			br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
+			fos = new FileOutputStream(excelFile, true);
+			osw = new OutputStreamWriter(fos, "UTF-8");
+			bw = new BufferedWriter(osw);
+			if (first) {// 如果是第一次,输出编码格式,防止 office 乱码
+				bw.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
+			}
+			String line = null;
+
+			boolean iswrite = false;
+			while ((line = br.readLine()) != null) {
+				if (StringUtils.isBlank(line))
+					continue;
+
+				line = line.trim();
+				if (line.startsWith("<!--first_") && first == false) {
+					iswrite = false;
+					continue;
+				}
+				if (line.startsWith("<!--last_") && end == false) {
+					iswrite = false;
+					continue;
+				}
+
+				if ("<!--first_start_export-->".equals(line)) {
+					iswrite = first;
+					continue;
+
+				} else if ("<!--last_start_export-->".equals(line)) {
+					iswrite = end;
+					continue;
+
+				} else if ("<!--first_start_no_export-->".equals(line)) {
+					iswrite = false;
+					continue;
+
+				} else if ("<!--first_end_no_export-->".equals(line)) {
+					iswrite = true;
+					continue;
+
+				} else if ("<!--start_no_export-->".equals(line)) {
+					iswrite = false;
+					continue;
+				} else if ("<!--start_export-->".equals(line)) {
+					iswrite = true;
+					continue;
+				} else if ("<!--last_start_export-->".equals(line)) {
+					iswrite = true;
+					continue;
+				} else if ("<!--last_end_export-->".equals(line)) {
+					iswrite = false;
+					continue;
+				} else if (line.startsWith("<!--end_")) {// 不包含需要输出的内容
+					if ("<!--end_no_export-->".equals(line)) {// 特殊标签,不输出内容
+						iswrite = true;
+					} else {
+						iswrite = false;
+					}
+					continue;
+				}
+
+				if (iswrite) {// 如果是写入标签
+					bw.write(line);
+				}
+
+			}
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+			throw new Exception("追加xlsx内容错误");
+		} finally {
+			if (bw != null)
+				bw.close();
+			if (osw != null)
+				osw.close();
+			if (fos != null)
+				fos.close();
+			if (br != null)
+				br.close();
+			if (in != null)
+				in.close();
+		}
+
+		return excelFile;
+	}
+
+	@Override
+	public Object save(Object entity) throws Exception {
+		return getBaseDao().save(entity);
+	}
+	@Override
+	public Object save(Object entity, boolean ignoreNull) throws Exception {
+		return getBaseDao().save(entity, ignoreNull);
+	}
+	@SuppressWarnings("rawtypes")
+	@Override
+	public List<Integer> save(List list) throws Exception {
+		return getBaseDao().save(list);
+	}
+	@Override
+	public Integer update(IBaseEntity entity) throws Exception {
+		return getBaseDao().update(entity);
+	}
+	@Override
+	public void  updateReda(Message message) throws Exception{
+		Finder finder = new Finder("UPDATE t_message SET isRead=:isRead where userId=:userId");
+		finder.setParam("isRead","1");
+		finder.setParam("userId",message.getUserId());
+		getBaseDao().update(finder);
+	}
+	
+	@Override
+	public Integer update(IBaseEntity entity,boolean onlyupdatenotnull) throws Exception{
+		return getBaseDao().update(entity,onlyupdatenotnull);
+	}
+
+	public Integer updateVaildValue(IBaseEntity e) throws Exception {
+		return getBaseDao().updateValidValue(e);
+	}
+	
+	
+	
+	@SuppressWarnings("rawtypes")
+	@Override
+	public List<Integer> update(List list) throws Exception {
+		return getBaseDao().update(list);
+	}
+	
+	@SuppressWarnings("rawtypes")
+	@Override
+	public List<Integer> update(List list,boolean onlyupdatenotnull) throws Exception{
+		return getBaseDao().update(list,onlyupdatenotnull);
+	}
+	
+	
+	
+
+	@Override
+	public <T> T findById(Object id, Class<T> clazz) throws Exception {
+		return getBaseDao().findByID(id, clazz);
+	}
+
+	@Override
+	public Object saveorupdate(Object entity) throws Exception {
+		return getBaseDao().saveorupdate(entity);
+	}
+
+	@Override
+	public <T> T queryForObjectByProc(Finder finder, Class<T> clazz)
+			throws Exception {
+		return getBaseDao().queryForObjectByProc(finder, clazz);
+	}
+	
+	@Override
+	public <T> List<T> queryForListByProc(Finder finder, Class<T> clazz)
+			throws Exception {
+		return getBaseDao().queryForListByProc(finder, clazz);
+	}
+
+	@Override
+	public <T> T queryForObjectByByFunction(Finder finder, Class<T> clazz)
+			throws Exception {
+		return getBaseDao().queryForObjectByByFunction(finder, clazz);
+	}
+
+	@Override
+	public <T> List<T> queryForListByFunction(Finder finder, Class<T> clazz)
+			throws Exception {
+		return getBaseDao().queryForListByFunction(finder, clazz);
+	}
+
+	/**
+	 * 根据查询的queryBean,拼接Finder 的 Where条件,只包含 and 条件,用于普通查询
+	 * 
+	 * @param finder
+	 * @param o
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public Finder getFinderWhereByQueryBean(Finder finder, Object o)
+			throws Exception {
+		return getBaseDao().getFinderWhereByQueryBean(finder, o);
+	}
+	@Override
+	public Finder getFinderOrderBy(Finder finder,Page page)	throws Exception{
+		return getBaseDao().getFinderOrderBy(finder, page);
+	}
+	
+	
+	
+	@SuppressWarnings("rawtypes")
+	@Override
+	public <T> String saveImportExcelFile(File excelFile, Class<T> clazz,
+			boolean istest) throws Exception {
+		StringBuffer message = new StringBuffer();
+		List<Cell[]> excel = ExcelUtils.getExcle(excelFile);
+		if (CollectionUtils.isEmpty(excel)) {
+			return "Excel文件没有sheet!";
+		}
+		Map<Integer, String> map = new HashMap<Integer, String>();
+		Cell[] title = excel.get(0);
+		if (title == null || title.length < 1) {
+			return "表头没有数据!";
+		}
+		List<String> listTitle=new ArrayList<String>();
+		// 封装字段
+		for (int i = 0; i < title.length; i++) {
+			map.put(i, title[i].getContents());
+			listTitle.add(title[i].getContents());
+		}
+
+		for (int j = 2; j < excel.size(); j++) {
+			Cell[] cells = excel.get(j);
+			T r = clazz.newInstance();
+			for (int m = 0; m < cells.length; m++) {
+				Object o = r;
+				Cell cell = cells[m];
+				String name = map.get(m);
+				try {
+					if (name.contains(".")) {
+						String[] strs = name.split("\\.");
+						// 获取最后的属性名称
+						name = strs[strs.length - 1];
+						// 循环获取实体对象
+						for (int i = 0; i < strs.length - 1; i++) {
+							o = ClassUtils.getPropertieValue(strs[i], o);
+						}
+					}
+				} catch (Exception e) {
+					String s = "第" + (m + 1) + "列列名有错误," + name + " 类型错误!";
+					if (istest) {
+						message.append(s).append("</br>");
+					} else {
+						throw new Exception(s);
+					}
+				}
+				String value = cell.getContents().trim();
+				Class className = ClassUtils.getReturnType(name, o.getClass());
+					
+				if (className==String.class) {
+					try {
+						ClassUtils.setPropertieValue(name, o, value);
+					} catch (Exception e) {
+						String s = "第" + (j + 1) + "行,第" + (m + 1) + "列:"+ name + " 类型错误!";
+						if (istest) {
+							message.append(s).append("</br>");
+						} else {
+							throw new Exception(s);
+						}
+					}
+				} else if (className==Date.class) {
+					try {
+						value = value.replace("/", "-");
+						Date d = DateUtils.convertString2Date(value);
+
+						ClassUtils.setPropertieValue(name, o, d);
+					} catch (Exception e) {
+						String s = "第" + (j + 1) + "行,第" + (m + 1) + "列:"+ name + " 类型错误!";
+						if (istest) {
+							message.append(s).append("</br>");
+						} else {
+							throw new Exception(s);
+						}
+					}
+
+				} else if (className==Double.class) {
+					try {
+						Double db = null;
+						if (StringUtils.isNotBlank(value)) {
+							db = Double.valueOf(value);
+						}
+						ClassUtils.setPropertieValue(name, o, db);
+					} catch (Exception e) {
+						String s = "第" + (j + 1) + "行,第" + (m + 1) + "列:"+ name + " 类型错误!";
+						if (istest) {
+							message.append(s).append("</br>");
+						} else {
+							throw new Exception(s);
+						}
+					}
+				} else if (className==Float.class) {
+					try {
+						Float f = null;
+						if (StringUtils.isNotBlank(value)) {
+							f = Float.valueOf(value);
+						}
+						ClassUtils.setPropertieValue(name, o, f);
+					} catch (Exception e) {
+						String s = "第" + (j + 1) + "行,第" + (m + 1) + "列:"+ name + " 类型错误!";
+						if (istest) {
+							message.append(s).append("</br>");
+						} else {
+							throw new Exception(s);
+						}
+					}
+
+				} else if (className==Integer.class) {
+					try {
+						Integer _i = null;
+
+						if (StringUtils.isNotBlank(value)) {
+							_i = Integer.valueOf(value);
+						}
+
+						ClassUtils.setPropertieValue(name, o, _i);
+					} catch (Exception e) {
+						String s = "第" + (j + 1) + "行,第" + (m + 1) + "列:"+ name + " 类型错误!";
+						if (istest) {
+							message.append(s).append("</br>");
+						} else {
+							throw new Exception(s);
+						}
+					}
+				}
+
+				else if (className==BigDecimal.class) {
+					try {
+						BigDecimal bd = null;
+						if (StringUtils.isNotBlank(value)) {
+							bd = new BigDecimal(value);
+						}
+						ClassUtils.setPropertieValue(name, o, bd);
+					} catch (Exception e) {
+						String s = "第" + (j + 1) + "行,第" + (m + 1) + "列:"+ name + " 类型错误!";
+						if (istest) {
+							message.append(s).append("</br>");
+						} else {
+							throw new Exception(s);
+						}
+					}
+				}
+
+			}
+			try {
+				String s=saveFromExcel(r, (j + 1), istest, listTitle);
+				if(istest&&StringUtils.isNotBlank(s)){
+					message.append(s).append("</br>");
+				}
+			} catch (Exception e) {
+				throw new Exception("第" + (j + 1) + "行,保存失败");
+			}
+		}
+		if (excelFile.exists()&&(istest==false)) {
+			excelFile.delete();
+		}
+		if(StringUtils.isBlank(message.toString())){
+			return null;
+		}
+		if (excelFile.exists()&&istest&&StringUtils.isNotBlank(message.toString())) {
+			excelFile.delete();
+		}
+		
+		
+		return message.toString();
+
+	}
+
+	@Override
+	public <T> String saveImportExcelFile(File excelFile, Class<T> clazz)
+			throws Exception {
+		String message = saveImportExcelFile(excelFile, clazz, true);
+		if (StringUtils.isNotBlank(message)) {
+			return message;
+		}
+		return saveImportExcelFile(excelFile, clazz, false);
+
+	}
+
+	@Override
+	public String saveFromExcel(Object entity, int index, boolean istest,
+			List<String> listTitle) throws Exception {
+		if(istest){
+			return null;
+		}
+		return save(entity).toString();
+	}
+	
+	   /**
+		   * 执行 call 操作,执行存储过程,和数据库函数
+		   * @param callableStatementCreator
+		   * @param parameter
+		   * @return
+		   * @throws Exception
+		   */
+		 @Override
+		public Object executeCallBack(CallableStatementCreator callableStatementCreator,List<SqlParameter> parameter)throws Exception{
+		   return getBaseDao().executeCallBack(callableStatementCreator, parameter);
+	   }
+
+	
+
+}

+ 440 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/service/IBaseService.java

@@ -0,0 +1,440 @@
+
+/**
+ * 
+ */
+package com.cz.yingpu.frame.service;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+import com.cz.yingpu.system.entity.Message;
+import org.springframework.jdbc.core.CallableStatementCreator;
+import org.springframework.jdbc.core.SqlParameter;
+
+import com.cz.yingpu.frame.entity.IBaseEntity;
+import com.cz.yingpu.frame.util.Finder;
+import com.cz.yingpu.frame.util.Page;
+import com.cz.yingpu.frame.util.SpringUtils;
+
+
+/**
+ * 基础的Service接口,所有的Service都必须实现此接口,每个数据库都需要一个实现.</br> 
+ * 例如 demo数据的实现接口是com.cz.yingpu.springrain.service.IBasespringrainService,demo2数据的实现接口是com.cz.yingpu.demo2.service.IBasedemo2Service</br>
+ * 
+ * @copyright {@link 9iu.org}
+ * @author springrain<Auto generate>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.service.IBaseService
+ */
+public interface IBaseService {
+	/**
+	 * 获取SpringUtils
+	 * @return
+	 * @throws Exception
+	 */
+	public SpringUtils getSpringUtils() throws Exception;
+	/**
+	 * 获取 获取 spring 中的Bean
+	 * @param beanName
+	 * @return
+	 * @throws Exception
+	 */
+	public  Object getBean(String beanName) throws Exception;
+	/**
+	 * 根据查询列表的宏,导出Excel
+	 * @param finder 为空则只查询 clazz表
+	 * @param ftlurl 类表的模版宏
+	 * @param page 分页对象
+	 * @param clazz 要查询的对象
+	 * @param baseService service 调用
+	 * @param queryBean  querybean
+	 * @return
+	 * @throws Exception
+	 */
+	
+	public<T> File findDataExportExcel(Finder finder,String ftlurl,Page page,Class<T> clazz,  Object queryBean) throws Exception;
+	
+	public<T> File findDataExportExcel(List list, String ftlurl, Page page, Object queryBean) throws Exception;
+	
+	/**
+	 * 查询结果是 List<Entity>
+	 * @param finder
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> List<T> queryForList(Finder finder, Class<T> clazz) throws Exception;
+	
+	/**
+	 * 调用数据库函数  查询结果是 List<Entity>
+	 * @param finder
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> List<T> queryForListByFunction(Finder finder, Class<T> clazz) throws Exception;
+	
+	
+	
+	
+	/**
+	 * 调用数据库存储过程  查询结果是 List
+	 * @param finder
+	 * @return
+	 * @throws Exception
+	 */
+	public  List<Map<String,Object>> queryForListByProc(Finder finder) throws Exception;
+	
+	/**
+	 * 调用数据库函数  查询结果是 List
+	 * @param finder
+	 * @return
+	 * @throws Exception
+	 */
+	public  List<Map<String,Object>> queryForListByFunction(Finder finder) throws Exception;
+	
+	
+	/**
+	 * 调用数据库存储过程  返回指定 对象
+	 * @param <T>
+	 * @param sql
+	 * @param paramMap
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+
+	public <T> T queryForObjectByProc(Finder finder, Class<T> clazz) throws Exception ;
+	
+	/**
+	 * 调用数据库存储过程  返回指定 对象
+	 * @param <T>
+	 * @param sql
+	 * @param paramMap
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+
+	public <T> List<T> queryForListByProc(Finder finder, Class<T> clazz) throws Exception ;
+	
+	/**
+	 *  调用数据库函数  返回指定 对象
+	 * @param <T>
+	 * @param sql
+	 * @param paramMap
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> T queryForObjectByByFunction(Finder finder, Class<T> clazz) throws Exception ;
+	
+	/**
+	 * 执行函数 返回执行结果为Map
+	 * @param finder
+	 * @return
+	 * @throws Exception 
+	 */
+	public Object queryObjectByFunction(Finder finder) throws Exception;
+	
+	
+	/**
+	 * 执行存储过程 返回执行结果为
+	 * @param finder
+	 * @return
+	 * @throws Exception 
+	 */
+	public Map<String,Object> queryObjectByProc(Finder finder) throws Exception;
+	/**
+	 * 返回结果是List<Map>
+	 * @param sql
+	 * @param map
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Map<String,Object>> queryForList(Finder finder)  throws Exception ;
+	
+	/**
+	 * 分页查询 返回 List<Map>
+	 * @param finder
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Map<String,Object>>  queryForList(Finder finder,Page page) throws Exception ;
+	
+	
+
+	
+	/**
+	 * 查询打个对象
+	 * @param <T>
+	 * @param sql
+	 * @param paramMap
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> T queryForObject(Finder finder, Class<T> clazz) throws Exception ;
+	/**
+	 * 查询一个map
+	 * @param sql
+	 * @param paramMap
+	 * @return
+	 * @throws Exception
+	 */
+	public  Map<String,Object>  queryForObject(Finder finder) throws Exception;
+	
+	
+	/**
+	 * Entity作为查询的query bean,并返回Entity
+	 * @param entity
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> T queryForObject(T entity) throws Exception ;
+	
+	/**
+	 *  Entity作为查询的query bean,并返回Entity
+	 * @param entity
+	 * @param page 分页对象
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> List<T> queryForListByEntity(T entity,Page page) throws Exception ;
+	
+	
+
+	
+	
+	
+	/**
+	 * 更新数据
+	 * @param sql
+	 * @param paramMap
+	 * @return
+	 * @throws Exception
+	 */
+	public Integer update(Finder finder) throws Exception;
+	
+
+
+  
+	
+	
+	/**
+	 * 分页查询,自己提供详细参数
+	 * @param <T>
+	 * @param sql
+	 * @param countSql
+	 * @param orderSql
+	 * @param paramMap
+	 * @param clazz
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> List<T> queryForList(Finder finder, Class<T> clazz, Page page) throws Exception;
+	
+
+	
+/**
+ * 列表查询,每个service都会重载,要把sql语句封装到service中,Finder只是最后的方案
+ * @param finder
+ * @param page
+ * @param clazz
+ * @param queryBean
+ * @return
+ * @throws Exception
+ */
+	public <T> List<T>  findListDataByFinder(Finder finder,Page page,Class<T> clazz,Object queryBean)  throws Exception;
+
+
+    /**
+     * 保存一个对象
+     * @param <T>
+     * @param clazz
+     * @return
+     */
+	public  Object save( Object entity) throws Exception;
+
+
+	public  Object save( Object entity, boolean ignoreNull) throws Exception;
+
+	
+	/**
+	 * 批量更新
+	 * @param list
+	 * @return List
+	 * @throws Exception
+	 */
+		@SuppressWarnings("rawtypes")
+		public List<Integer>  save(List list) throws Exception;
+	
+	
+	 /**
+     * 更新一个对象
+     * @param <T>
+     * @param clazz
+     * @return
+     */
+	public  Integer update( IBaseEntity entity) throws Exception;
+
+	/**
+	 * 修改用户的通知信息状态
+	 * @param message
+	 * @throws Exception
+	 */
+	public void  updateReda(Message message) throws Exception;
+	
+	
+	
+	/**
+	 * 更新一个对象,id必须有值,updatenotnull=true 不更新为null的字段,false更新所有字段
+	 * @param entity
+	 * @param updatenotnull
+	 * @return
+	 * @throws Exception
+	 */
+		public Integer update(IBaseEntity entity,boolean onlyupdatenotnull) throws Exception;
+	
+	
+
+	
+	/**
+	 * 批量更新对象
+	 * @param list
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public  List<Integer> update(List list) throws Exception;
+	
+	
+	/**
+	 * 批量更新对象,id必须有值,updatenotnull=true 不更新为null的字段,false更新所有字段
+	 * @param list
+	 * @param updatenotnull
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public  List<Integer> update(List list,boolean onlyupdatenotnull) throws Exception;
+	
+	/**
+	 * 根据ID 查询对象
+	 * @param <T>
+	 * @param id
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> T findById(Object id,Class<T> clazz)throws Exception;
+	
+	/**
+	 * 根据ID 查询对象,用于分表
+	 * @param id
+	 * @param clazz
+	 * @param tableExt
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> T findById(Object id, Class<T> clazz,String tableExt) throws Exception ;
+	
+	/**
+	 * 根据Id 删除
+	 * @param id
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public void deleteById(Object id,Class clazz) throws Exception;
+	
+	/**
+	 * 根据ID批量删除
+	 * @param ids
+	 * @param clazz
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public void deleteByIds(List ids,Class clazz) throws Exception;
+	
+	/**
+	 * 根据Entity 删除
+	 * @param IBaseEntity entity
+	 * @throws Exception
+	 */
+	public void deleteByEntity(IBaseEntity entity) throws Exception;
+
+	/**
+	 * 根据Entity 删除用户站内所有信息
+	 * @throws Exception
+	 */
+	public void deleteMessages(Message message) throws Exception;
+	
+	/**
+	 * 判断主键是否有值 save or update 对象
+	 * @param entity
+	 * @return
+	 */
+	public Object saveorupdate(Object entity) throws Exception ;
+	
+	
+	/**
+	 * 根据查询的queryBean,拼接Finder 的 Where条件,只包含 and 条件,用于普通查询
+	 * @param finder
+	 * @param o
+	 * @return
+	 * @throws Exception
+	 */
+	public Finder getFinderWhereByQueryBean(Finder finder,Object o) throws Exception;
+	/**
+	 * 根据page对象中sort和order 添加order by 排序,一般用于前台传递的自定义排序
+	 * 
+	 * @param finder
+	 * @param page
+	 * @return
+	 */
+	Finder getFinderOrderBy(Finder finder, Page page) throws Exception;
+	/**
+	 * 导入Excle文件
+	 * @param excel
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> String saveImportExcelFile(File excel,Class<T> clazz)throws Exception;
+	
+	
+	/**
+	 * 导入Excle文件
+	 * @param excel
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	public <T> String saveImportExcelFile(File excel,Class<T> clazz,boolean istest)throws Exception;
+	
+	
+	
+	/**
+	 * Excel 导入时会循环调用该方法
+	 * @param entity
+	 * @param index 
+	 * @param listTitle 
+	 * @param issave 
+	 * @return
+	 * @throws Exception
+	 */
+   public String saveFromExcel(Object entity, int index, boolean istest, List<String> listTitle) throws Exception;
+   /**
+	   * 执行 call 操作,执行存储过程,和数据库函数
+	   * @param callableStatementCreator
+	   * @param parameter
+	   * @return
+	   * @throws Exception
+	   */
+	 public Object executeCallBack(CallableStatementCreator callableStatementCreator,List<SqlParameter> parameter)throws Exception;
+
+
+
+}

+ 34 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FrameAuthenticationToken.java

@@ -0,0 +1,34 @@
+package com.cz.yingpu.frame.shiro;
+
+import org.apache.shiro.authc.UsernamePasswordToken;
+/**
+ * 扩展token
+ * @author caomei
+ *
+ */
+public class FrameAuthenticationToken extends UsernamePasswordToken {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	
+	private Integer userType;
+
+	public FrameAuthenticationToken(final String username, final String password) {
+		super(username, password);
+	}
+	
+	
+	public FrameAuthenticationToken(){
+		
+	}
+
+	public Integer getUserType() {
+		return userType;
+	}
+
+	public void setUserType(Integer userType) {
+		this.userType = userType;
+	}
+
+}

+ 106 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FrameFWLogFilter.java

@@ -0,0 +1,106 @@
+package com.cz.yingpu.frame.shiro;
+
+import java.io.IOException;
+import java.util.Date;
+
+import javax.annotation.Resource;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.web.servlet.OncePerRequestFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.common.SessionUser;
+import com.cz.yingpu.frame.util.DateUtils;
+import com.cz.yingpu.frame.util.IPUtils;
+import com.cz.yingpu.system.entity.Fwlog;
+import com.cz.yingpu.system.service.IMenuService;
+/**
+ * 记录访问日志的过滤器
+ * @author caomei
+ *
+ */
+
+
+@Component("framefwlog")
+public class FrameFWLogFilter extends OncePerRequestFilter {
+	public Logger logger = LoggerFactory.getLogger(getClass());
+	@Resource
+	private IMenuService menuService;
+	@Override
+	protected void doFilterInternal(ServletRequest request,
+			ServletResponse response, FilterChain chain)
+			throws ServletException, IOException {
+		
+		HttpServletRequest req = (HttpServletRequest) request;
+		
+		String uri = req.getRequestURI();
+		String requestURL = req.getRequestURL().toString();
+		String contextPath = req.getContextPath();
+		if(uri.endsWith("/pre")){// 去掉pre
+			uri=uri.substring(0,uri.length()-4);
+		}
+		if(uri.endsWith("/json")){// 去掉json
+			uri=uri.substring(0,uri.length()-5);
+		}
+		if(uri.endsWith("/more")){// 去掉more
+			uri=uri.substring(0,uri.length()-5);
+		}
+		int i=uri.indexOf(contextPath);
+		if(i>-1){
+			uri=uri.substring(i+contextPath.length());
+		}
+		if(StringUtils.isBlank(uri)){
+			uri="/";
+		}
+		
+		
+		
+		
+		 boolean permitted = false;
+		 if("/".equals(uri)){
+			 permitted=true;
+		 }else{
+		 permitted= SecurityUtils.getSubject().isPermitted(uri);
+		 }
+		 String isqx="否";
+		 if(permitted){
+			 isqx="是";
+		 }
+		 String ip = IPUtils.getClientAddress(req);
+		
+		 Fwlog fwlog=new Fwlog();
+		 fwlog.setFwUrl(requestURL);
+		 fwlog.setIsqx(isqx);
+		 fwlog.setIp(ip);
+	
+		fwlog.setUserCode(SessionUser.getUserCode());
+		fwlog.setUserName(SessionUser.getUserName());
+		Date startDate=new Date();
+		fwlog.setStartDate(startDate);
+		fwlog.setStrDate(DateUtils.convertDate2String("yyyy-MM-dd HH:mm:ss.SSSS", startDate));
+		HttpSession httpSession = req.getSession(false);
+		if(httpSession!=null){
+			fwlog.setSessionId(httpSession.getId());
+		}
+		try {
+			String menuName = menuService.getNameByPageurl(uri);
+//			req.setAttribute(GlobalStatic.pageurlName, menuName);
+			fwlog.setMenuName(menuName);
+			menuService.save(fwlog);
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+		}
+		chain.doFilter(request, response);
+	}
+	
+	
+}

+ 77 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FramePermissionsAuthorizationFilter.java

@@ -0,0 +1,77 @@
+package com.cz.yingpu.frame.shiro;
+
+import java.io.IOException;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.subject.Subject;
+import org.apache.shiro.web.filter.authz.PermissionsAuthorizationFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+/**
+ * 权限访问的过滤器
+ * @author caomei
+ *
+ */
+
+
+@Component("frameperms")
+public class FramePermissionsAuthorizationFilter extends
+		PermissionsAuthorizationFilter {
+	public Logger logger = LoggerFactory.getLogger(getClass());
+	//@Resource
+	//private IMenuService menuService;
+	//@Resource
+	//private CacheManager shiroCacheManager;
+	
+
+	@Override
+	public boolean isAccessAllowed(ServletRequest request,
+			ServletResponse response, Object mappedValue) throws IOException {
+		/*
+		Session session = user.getSession(false);
+		Cache<Object, Object> cache = shiroCacheManager.getCache(GlobalStatic.authenticationCacheName);
+		String cachedSessionId = cache.get(GlobalStatic.authenticationCacheName+"-"+shiroUser.getAccount()).toString();
+		String sessionId=(String) session.getId();
+		if(!sessionId.equals(cachedSessionId)){
+			user.logout();
+		}
+		*/
+		
+		HttpServletRequest req = (HttpServletRequest) request;
+		Subject subject = getSubject(request, response);
+		String uri = req.getRequestURI();
+		String contextPath = req.getContextPath();
+		if(uri.endsWith("/pre")){// 去掉pre
+			uri=uri.substring(0,uri.length()-4);
+		}
+		if(uri.endsWith("/json")){// 去掉json
+			uri=uri.substring(0,uri.length()-5);
+		}
+		if(uri.endsWith("/more")){// 去掉more
+			uri=uri.substring(0,uri.length()-5);
+		}
+		int i=uri.indexOf(contextPath);
+		if(i>-1){
+			uri=uri.substring(i+contextPath.length());
+		}
+		if(StringUtils.isBlank(uri)){
+			uri="/";
+		}
+		
+		 boolean permitted = false;
+		 if("/".equals(uri)){
+			 permitted=true;
+		 }else{
+		     permitted= subject.isPermitted(uri);
+		 }
+	
+		return permitted;
+
+	}
+}

+ 571 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FrameShiroFilterFactoryBean.java

@@ -0,0 +1,571 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.cz.yingpu.frame.shiro;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.shiro.config.Ini;
+import org.apache.shiro.mgt.SecurityManager;
+import org.apache.shiro.util.CollectionUtils;
+import org.apache.shiro.util.Nameable;
+import org.apache.shiro.util.StringUtils;
+import org.apache.shiro.web.config.IniFilterChainResolverFactory;
+import org.apache.shiro.web.filter.AccessControlFilter;
+import org.apache.shiro.web.filter.authc.AuthenticationFilter;
+import org.apache.shiro.web.filter.authz.AuthorizationFilter;
+import org.apache.shiro.web.filter.mgt.DefaultFilterChainManager;
+import org.apache.shiro.web.filter.mgt.FilterChainManager;
+import org.apache.shiro.web.filter.mgt.FilterChainResolver;
+import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver;
+import org.apache.shiro.web.mgt.WebSecurityManager;
+import org.apache.shiro.web.servlet.AbstractShiroFilter;
+import org.apache.shiro.web.servlet.ShiroHttpServletRequest;
+import org.apache.shiro.web.servlet.ShiroHttpServletResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanInitializationException;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+
+/**
+ * {@link org.springframework.beans.factory.FactoryBean FactoryBean} to be used in Spring-based web applications for
+ * defining the master Shiro Filter.
+ * <h4>Usage</h4>
+ * Declare a DelegatingFilterProxy in {@code web.xml}, matching the filter name to the bean id:
+ * <pre>
+ * &lt;filter&gt;
+ *   &lt;filter-name&gt;<b>shiroFilter</b>&lt;/filter-name&gt;
+ *   &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;filter-class&gt;
+ *   &lt;init-param&gt;
+ *    &lt;param-name&gt;targetFilterLifecycle&lt;/param-name&gt;
+ *     &lt;param-value&gt;true&lt;/param-value&gt;
+ *   &lt;/init-param&gt;
+ * &lt;/filter&gt;
+ * </pre>
+ * Then, in your spring XML file that defines your web ApplicationContext:
+ * <pre>
+ * &lt;bean id="<b>shiroFilter</b>" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"&gt;
+ *    &lt;property name="securityManager" ref="securityManager"/&gt;
+ *    &lt;!-- other properties as necessary ... --&gt;
+ * &lt;/bean&gt;
+ * </pre>
+ * <h4>Filter Auto-Discovery</h4>
+ * While there is a {@link #setFilters(java.util.Map) filters} property that allows you to assign a filter beans
+ * to the 'pool' of filters available when defining {@link #setFilterChainDefinitions(String) filter chains}, it is
+ * optional.
+ * <p/>
+ * This implementation is also a {@link BeanPostProcessor} and will acquire
+ * any {@link javax.servlet.Filter Filter} beans defined independently in your Spring application context.  Upon
+ * discovery, they will be automatically added to the {@link #setFilters(java.util.Map) map} keyed by the bean ID.
+ * That ID can then be used in the filter chain definitions, for example:
+ *
+ * <pre>
+ * &lt;bean id="<b>myCustomFilter</b>" class="com.class.that.implements.javax.servlet.Filter"/&gt;
+ * ...
+ * &lt;bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"&gt;
+ *    ...
+ *    &lt;property name="filterChainDefinitions"&gt;
+ *        &lt;value&gt;
+ *            /some/path/** = authc, <b>myCustomFilter</b>
+ *        &lt;/value&gt;
+ *    &lt;/property&gt;
+ * &lt;/bean&gt;
+ * </pre>
+ * <h4>Global Property Values</h4>
+ * Most Shiro servlet Filter implementations exist for defining custom Filter
+ * {@link #setFilterChainDefinitions(String) chain definitions}.  Most implementations subclass one of the
+ * {@link AccessControlFilter}, {@link AuthenticationFilter}, {@link AuthorizationFilter} classes to simplify things,
+ * and each of these 3 classes has configurable properties that are application-specific.
+ * <p/>
+ * A dilemma arises where, if you want to for example set the application's 'loginUrl' for any Filter, you don't want
+ * to have to manually specify that value for <em>each</em> filter instance definied.
+ * <p/>
+ * To prevent configuration duplication, this implementation provides the following properties to allow you
+ * to set relevant values in only one place:
+ * <ul>
+ * <li>{@link #setLoginUrl(String)}</li>
+ * <li>{@link #setSuccessUrl(String)}</li>
+ * <li>{@link #setUnauthorizedUrl(String)}</li>
+ * </ul>
+ *
+ * Then at startup, any values specified via these 3 properties will be applied to all configured
+ * Filter instances so you don't have to specify them individually on each filter instance.  To ensure your own custom
+ * filters benefit from this convenience, your filter implementation should subclass one of the 3 mentioned
+ * earlier.
+ *
+ * @see org.springframework.web.filter.DelegatingFilterProxy DelegatingFilterProxy
+ * @since 1.0
+ */
+@SuppressWarnings("rawtypes")
+public class FrameShiroFilterFactoryBean implements FactoryBean, BeanPostProcessor {
+
+    private static transient final Logger log = LoggerFactory.getLogger(FrameShiroFilterFactoryBean.class);
+
+    private SecurityManager securityManager;
+
+    private Map<String, Filter> filters;
+
+    private Map<String, String> filterChainDefinitionMap; //urlPathExpression_to_comma-delimited-filter-chain-definition
+
+    private String loginUrl;
+    private String successUrl;
+    private String unauthorizedUrl;
+
+    private AbstractShiroFilter instance;
+
+    public FrameShiroFilterFactoryBean() {
+        this.filters = new LinkedHashMap<String, Filter>();
+        this.filterChainDefinitionMap = new LinkedHashMap<String, String>(); //order matters!
+    }
+
+    /**
+     * Sets the application {@code SecurityManager} instance to be used by the constructed Shiro Filter.  This is a
+     * required property - failure to set it will throw an initialization exception.
+     *
+     * @return the application {@code SecurityManager} instance to be used by the constructed Shiro Filter.
+     */
+    public SecurityManager getSecurityManager() {
+        return securityManager;
+    }
+
+    /**
+     * Sets the application {@code SecurityManager} instance to be used by the constructed Shiro Filter.  This is a
+     * required property - failure to set it will throw an initialization exception.
+     *
+     * @param securityManager the application {@code SecurityManager} instance to be used by the constructed Shiro Filter.
+     */
+    public void setSecurityManager(SecurityManager securityManager) {
+        this.securityManager = securityManager;
+    }
+
+    /**
+     * Returns the application's login URL to be assigned to all acquired Filters that subclass
+     * {@link AccessControlFilter} or {@code null} if no value should be assigned globally. The default value
+     * is {@code null}.
+     *
+     * @return the application's login URL to be assigned to all acquired Filters that subclass
+     *         {@link AccessControlFilter} or {@code null} if no value should be assigned globally.
+     * @see #setLoginUrl
+     */
+    public String getLoginUrl() {
+        return loginUrl;
+    }
+
+    /**
+     * Sets the application's login URL to be assigned to all acquired Filters that subclass
+     * {@link AccessControlFilter}.  This is a convenience mechanism: for all configured {@link #setFilters filters},
+     * as well for any default ones ({@code authc}, {@code user}, etc), this value will be passed on to each Filter
+     * via the {@link AccessControlFilter#setLoginUrl(String)} method<b>*</b>.  This eliminates the need to
+     * configure the 'loginUrl' property manually on each filter instance, and instead that can be configured once
+     * via this attribute.
+     * <p/>
+     * <b>*</b>If a filter already has already been explicitly configured with a value, it will
+     * <em>not</em> receive this value. Individual filter configuration overrides this global convenience property.
+     *
+     * @param loginUrl the application's login URL to apply to as a convenience to all discovered
+     *                 {@link AccessControlFilter} instances.
+     * @see AccessControlFilter#setLoginUrl(String)
+     */
+    public void setLoginUrl(String loginUrl) {
+        this.loginUrl = loginUrl;
+    }
+
+    /**
+     * Returns the application's after-login success URL to be assigned to all acquired Filters that subclass
+     * {@link AuthenticationFilter} or {@code null} if no value should be assigned globally. The default value
+     * is {@code null}.
+     *
+     * @return the application's after-login success URL to be assigned to all acquired Filters that subclass
+     *         {@link AuthenticationFilter} or {@code null} if no value should be assigned globally.
+     * @see #setSuccessUrl
+     */
+    public String getSuccessUrl() {
+        return successUrl;
+    }
+
+    /**
+     * Sets the application's after-login success URL to be assigned to all acquired Filters that subclass
+     * {@link AuthenticationFilter}.  This is a convenience mechanism: for all configured {@link #setFilters filters},
+     * as well for any default ones ({@code authc}, {@code user}, etc), this value will be passed on to each Filter
+     * via the {@link AuthenticationFilter#setSuccessUrl(String)} method<b>*</b>.  This eliminates the need to
+     * configure the 'successUrl' property manually on each filter instance, and instead that can be configured once
+     * via this attribute.
+     * <p/>
+     * <b>*</b>If a filter already has already been explicitly configured with a value, it will
+     * <em>not</em> receive this value. Individual filter configuration overrides this global convenience property.
+     *
+     * @param successUrl the application's after-login success URL to apply to as a convenience to all discovered
+     *                   {@link AccessControlFilter} instances.
+     * @see AuthenticationFilter#setSuccessUrl(String)
+     */
+    public void setSuccessUrl(String successUrl) {
+        this.successUrl = successUrl;
+    }
+
+    /**
+     * Returns the application's after-login success URL to be assigned to all acquired Filters that subclass
+     * {@link AuthenticationFilter} or {@code null} if no value should be assigned globally. The default value
+     * is {@code null}.
+     *
+     * @return the application's after-login success URL to be assigned to all acquired Filters that subclass
+     *         {@link AuthenticationFilter} or {@code null} if no value should be assigned globally.
+     * @see #setSuccessUrl
+     */
+    public String getUnauthorizedUrl() {
+        return unauthorizedUrl;
+    }
+
+    /**
+     * Sets the application's 'unauthorized' URL to be assigned to all acquired Filters that subclass
+     * {@link AuthorizationFilter}.  This is a convenience mechanism: for all configured {@link #setFilters filters},
+     * as well for any default ones ({@code roles}, {@code perms}, etc), this value will be passed on to each Filter
+     * via the {@link AuthorizationFilter#setUnauthorizedUrl(String)} method<b>*</b>.  This eliminates the need to
+     * configure the 'unauthorizedUrl' property manually on each filter instance, and instead that can be configured once
+     * via this attribute.
+     * <p/>
+     * <b>*</b>If a filter already has already been explicitly configured with a value, it will
+     * <em>not</em> receive this value. Individual filter configuration overrides this global convenience property.
+     *
+     * @param unauthorizedUrl the application's 'unauthorized' URL to apply to as a convenience to all discovered
+     *                        {@link AuthorizationFilter} instances.
+     * @see AuthorizationFilter#setUnauthorizedUrl(String)
+     */
+    public void setUnauthorizedUrl(String unauthorizedUrl) {
+        this.unauthorizedUrl = unauthorizedUrl;
+    }
+
+    /**
+     * Returns the filterName-to-Filter map of filters available for reference when defining filter chain definitions.
+     * All filter chain definitions will reference filters by the names in this map (i.e. the keys).
+     *
+     * @return the filterName-to-Filter map of filters available for reference when defining filter chain definitions.
+     */
+    public Map<String, Filter> getFilters() {
+        return filters;
+    }
+
+    /**
+     * Sets the filterName-to-Filter map of filters available for reference when creating
+     * {@link #setFilterChainDefinitionMap(java.util.Map) filter chain definitions}.
+     * <p/>
+     * <b>Note:</b> This property is optional:  this {@code FactoryBean} implementation will discover all beans in the
+     * web application context that implement the {@link Filter} interface and automatically add them to this filter
+     * map under their bean name.
+     * <p/>
+     * For example, just defining this bean in a web Spring XML application context:
+     * <pre>
+     * &lt;bean id=&quot;myFilter&quot; class=&quot;com.class.that.implements.javax.servlet.Filter&quot;&gt;
+     * ...
+     * &lt;/bean&gt;</pre>
+     * Will automatically place that bean into this Filters map under the key '<b>myFilter</b>'.
+     *
+     * @param filters the optional filterName-to-Filter map of filters available for reference when creating
+     *                {@link #setFilterChainDefinitionMap (java.util.Map) filter chain definitions}.
+     */
+    public void setFilters(Map<String, Filter> filters) {
+        this.filters = filters;
+    }
+
+    /**
+     * Returns the chainName-to-chainDefinition map of chain definitions to use for creating filter chains intercepted
+     * by the Shiro Filter.  Each map entry should conform to the format defined by the
+     * {@link FilterChainManager#createChain(String, String)} JavaDoc, where the map key is the chain name (e.g. URL
+     * path expression) and the map value is the comma-delimited string chain definition.
+     *
+     * @return he chainName-to-chainDefinition map of chain definitions to use for creating filter chains intercepted
+     *         by the Shiro Filter.
+     */
+    public Map<String, String> getFilterChainDefinitionMap() {
+        return filterChainDefinitionMap;
+    }
+
+    /**
+     * Sets the chainName-to-chainDefinition map of chain definitions to use for creating filter chains intercepted
+     * by the Shiro Filter.  Each map entry should conform to the format defined by the
+     * {@link FilterChainManager#createChain(String, String)} JavaDoc, where the map key is the chain name (e.g. URL
+     * path expression) and the map value is the comma-delimited string chain definition.
+     *
+     * @param filterChainDefinitionMap the chainName-to-chainDefinition map of chain definitions to use for creating
+     *                                 filter chains intercepted by the Shiro Filter.
+     */
+    public void setFilterChainDefinitionMap(Map<String, String> filterChainDefinitionMap) {
+        this.filterChainDefinitionMap = filterChainDefinitionMap;
+    }
+
+    /**
+     * A convenience method that sets the {@link #setFilterChainDefinitionMap(java.util.Map) filterChainDefinitionMap}
+     * property by accepting a {@link java.util.Properties Properties}-compatible string (multi-line key/value pairs).
+     * Each key/value pair must conform to the format defined by the
+     * {@link FilterChainManager#createChain(String,String)} JavaDoc - each property key is an ant URL
+     * path expression and the value is the comma-delimited chain definition.
+     *
+     * @param definitions a {@link java.util.Properties Properties}-compatible string (multi-line key/value pairs)
+     *                    where each key/value pair represents a single urlPathExpression-commaDelimitedChainDefinition.
+     */
+    public void setFilterChainDefinitions(String definitions) {
+        Ini ini = new Ini();
+        ini.load(definitions);
+        //did they explicitly state a 'urls' section?  Not necessary, but just in case:
+        Ini.Section section = ini.getSection(IniFilterChainResolverFactory.URLS);
+        if (CollectionUtils.isEmpty(section)) {
+            //no urls section.  Since this _is_ a urls chain definition property, just assume the
+            //default section contains only the definitions:
+            section = ini.getSection(Ini.DEFAULT_SECTION_NAME);
+        }
+        setFilterChainDefinitionMap(section);
+    }
+
+    /**
+     * Lazily creates and returns a {@link AbstractShiroFilter} concrete instance via the
+     * {@link #createInstance} method.
+     *
+     * @return the application's Shiro Filter instance used to filter incoming web requests.
+     * @throws Exception if there is a problem creating the {@code Filter} instance.
+     */
+    @Override
+	public Object getObject() throws Exception {
+        if (instance == null) {
+            instance = createInstance();
+        }
+        return instance;
+    }
+
+    /**
+     * Returns <code>{@link org.apache.shiro.web.servlet.AbstractShiroFilter}.class</code>
+     *
+     * @return <code>{@link org.apache.shiro.web.servlet.AbstractShiroFilter}.class</code>
+     */
+    @Override
+	public Class getObjectType() {
+        return SpringShiroFilter.class;
+    }
+
+    /**
+     * Returns {@code true} always.  There is almost always only ever 1 Shiro {@code Filter} per web application.
+     *
+     * @return {@code true} always.  There is almost always only ever 1 Shiro {@code Filter} per web application.
+     */
+    @Override
+	public boolean isSingleton() {
+        return true;
+    }
+
+    protected FilterChainManager createFilterChainManager() {
+
+        DefaultFilterChainManager manager = new DefaultFilterChainManager();
+        Map<String, Filter> defaultFilters = manager.getFilters();
+        //apply global settings if necessary:
+        for (Filter filter : defaultFilters.values()) {
+            applyGlobalPropertiesIfNecessary(filter);
+        }
+
+        //Apply the acquired and/or configured filters:
+        Map<String, Filter> filters = getFilters();
+        if (!CollectionUtils.isEmpty(filters)) {
+            for (Map.Entry<String, Filter> entry : filters.entrySet()) {
+                String name = entry.getKey();
+                Filter filter = entry.getValue();
+                applyGlobalPropertiesIfNecessary(filter);
+                if (filter instanceof Nameable) {
+                    ((Nameable) filter).setName(name);
+                }
+                //'init' argument is false, since Spring-configured filters should be initialized
+                //in Spring (i.e. 'init-method=blah') or implement InitializingBean:
+                manager.addFilter(name, filter, false);
+            }
+        }
+
+        //build up the chains:
+        Map<String, String> chains = getFilterChainDefinitionMap();
+        if (!CollectionUtils.isEmpty(chains)) {
+            for (Map.Entry<String, String> entry : chains.entrySet()) {
+                String url = entry.getKey();
+                String chainDefinition = entry.getValue();
+                manager.createChain(url, chainDefinition);
+            }
+        }
+
+        return manager;
+    }
+
+    /**
+     * This implementation:
+     * <ol>
+     * <li>Ensures the required {@link #setSecurityManager(org.apache.shiro.mgt.SecurityManager) securityManager}
+     * property has been set</li>
+     * <li>{@link #createFilterChainManager() Creates} a {@link FilterChainManager} instance that reflects the
+     * configured {@link #setFilters(java.util.Map) filters} and
+     * {@link #setFilterChainDefinitionMap(java.util.Map) filter chain definitions}</li>
+     * <li>Wraps the FilterChainManager with a suitable
+     * {@link org.apache.shiro.web.filter.mgt.FilterChainResolver FilterChainResolver} since the Shiro Filter
+     * implementations do not know of {@code FilterChainManager}s</li>
+     * <li>Sets both the {@code SecurityManager} and {@code FilterChainResolver} instances on a new Shiro Filter
+     * instance and returns that filter instance.</li>
+     * </ol>
+     *
+     * @return a new Shiro Filter reflecting any configured filters and filter chain definitions.
+     * @throws Exception if there is a problem creating the AbstractShiroFilter instance.
+     */
+    protected AbstractShiroFilter createInstance() throws Exception {
+
+        log.debug("Creating Shiro Filter instance.");
+
+        SecurityManager securityManager = getSecurityManager();
+        if (securityManager == null) {
+            String msg = "SecurityManager property must be set.";
+            throw new BeanInitializationException(msg);
+        }
+
+        if (!(securityManager instanceof WebSecurityManager)) {
+            String msg = "The security manager does not implement the WebSecurityManager interface.";
+            throw new BeanInitializationException(msg);
+        }
+
+        FilterChainManager manager = createFilterChainManager();
+
+        //Expose the constructed FilterChainManager by first wrapping it in a
+        // FilterChainResolver implementation. The AbstractShiroFilter implementations
+        // do not know about FilterChainManagers - only resolvers:
+        PathMatchingFilterChainResolver chainResolver = new PathMatchingFilterChainResolver();
+        chainResolver.setFilterChainManager(manager);
+
+        //Now create a concrete ShiroFilter instance and apply the acquired SecurityManager and built
+        //FilterChainResolver.  It doesn't matter that the instance is an anonymous inner class
+        //here - we're just using it because it is a concrete AbstractShiroFilter instance that accepts
+        //injection of the SecurityManager and FilterChainResolver:
+        return new SpringShiroFilter((WebSecurityManager) securityManager, chainResolver);
+    }
+
+    private void applyLoginUrlIfNecessary(Filter filter) {
+        String loginUrl = getLoginUrl();
+        if (StringUtils.hasText(loginUrl) && (filter instanceof AccessControlFilter)) {
+            AccessControlFilter acFilter = (AccessControlFilter) filter;
+            //only apply the login url if they haven't explicitly configured one already:
+            String existingLoginUrl = acFilter.getLoginUrl();
+            if (AccessControlFilter.DEFAULT_LOGIN_URL.equals(existingLoginUrl)) {
+                acFilter.setLoginUrl(loginUrl);
+            }
+        }
+    }
+
+    private void applySuccessUrlIfNecessary(Filter filter) {
+        String successUrl = getSuccessUrl();
+        if (StringUtils.hasText(successUrl) && (filter instanceof AuthenticationFilter)) {
+            AuthenticationFilter authcFilter = (AuthenticationFilter) filter;
+            //only apply the successUrl if they haven't explicitly configured one already:
+            String existingSuccessUrl = authcFilter.getSuccessUrl();
+            if (AuthenticationFilter.DEFAULT_SUCCESS_URL.equals(existingSuccessUrl)) {
+                authcFilter.setSuccessUrl(successUrl);
+            }
+        }
+    }
+
+    private void applyUnauthorizedUrlIfNecessary(Filter filter) {
+        String unauthorizedUrl = getUnauthorizedUrl();
+        if (StringUtils.hasText(unauthorizedUrl) && (filter instanceof AuthorizationFilter)) {
+            AuthorizationFilter authzFilter = (AuthorizationFilter) filter;
+            //only apply the unauthorizedUrl if they haven't explicitly configured one already:
+            String existingUnauthorizedUrl = authzFilter.getUnauthorizedUrl();
+            if (existingUnauthorizedUrl == null) {
+                authzFilter.setUnauthorizedUrl(unauthorizedUrl);
+            }
+        }
+    }
+
+    private void applyGlobalPropertiesIfNecessary(Filter filter) {
+        applyLoginUrlIfNecessary(filter);
+        applySuccessUrlIfNecessary(filter);
+        applyUnauthorizedUrlIfNecessary(filter);
+    }
+
+    /**
+     * Inspects a bean, and if it implements the {@link Filter} interface, automatically adds that filter
+     * instance to the internal {@link #setFilters(java.util.Map) filters map} that will be referenced
+     * later during filter chain construction.
+     */
+    @Override
+	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
+        if (bean instanceof Filter) {
+            log.debug("Found filter chain candidate filter '{}'", beanName);
+            Filter filter = (Filter) bean;
+            applyGlobalPropertiesIfNecessary(filter);
+            getFilters().put(beanName, filter);
+        } else {
+            log.trace("Ignoring non-Filter bean '{}'", beanName);
+        }
+        return bean;
+    }
+
+    /**
+     * Does nothing - only exists to satisfy the BeanPostProcessor interface and immediately returns the
+     * {@code bean} argument.
+     */
+    @Override
+	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
+        return bean;
+    }
+
+    /**
+     * Ordinarily the {@code AbstractShiroFilter} must be subclassed to additionally perform configuration
+     * and initialization behavior.  Because this {@code FactoryBean} implementation manually builds the
+     * {@link AbstractShiroFilter}'s
+     * {@link AbstractShiroFilter#setSecurityManager(org.apache.shiro.web.mgt.WebSecurityManager) securityManager} and
+     * {@link AbstractShiroFilter#setFilterChainResolver(org.apache.shiro.web.filter.mgt.FilterChainResolver) filterChainResolver}
+     * properties, the only thing left to do is set those properties explicitly.  We do that in a simple
+     * concrete subclass in the constructor.
+     */
+    private static final class SpringShiroFilter extends AbstractShiroFilter {
+
+        protected SpringShiroFilter(WebSecurityManager webSecurityManager, FilterChainResolver resolver) {
+            super();
+            if (webSecurityManager == null) {
+                throw new IllegalArgumentException("WebSecurityManager property cannot be null.");
+            }
+            setSecurityManager(webSecurityManager);
+            if (resolver != null) {
+                setFilterChainResolver(resolver);
+            }
+        }
+        
+
+        /**
+         * Returns a new {@link ShiroHttpServletResponse} instance, wrapping the {@code orig} argument, in order to provide
+         * correct URL rewriting behavior required by the Servlet Specification when using Shiro-based sessions (and not
+         * Servlet Container HTTP-based sessions).
+         *
+         * @param orig    the original {@code HttpServletResponse} instance provided by the Servlet Container.
+         * @param request the {@code ShiroHttpServletRequest} instance wrapping the original request.
+         * @return the wrapped ServletResponse instance to use during {@link FilterChain} execution.
+         * @since 1.0
+         */
+        @Override
+        protected ServletResponse wrapServletResponse(HttpServletResponse orig, ShiroHttpServletRequest request) {
+            return new FrameShiroHttpServletResponse(orig, getServletContext(), request);
+        }
+
+        
+    }
+}

+ 58 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FrameShiroHttpServletResponse.java

@@ -0,0 +1,58 @@
+package com.cz.yingpu.frame.shiro;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.shiro.web.servlet.ShiroHttpServletRequest;
+import org.apache.shiro.web.servlet.ShiroHttpServletResponse;
+
+public class FrameShiroHttpServletResponse extends ShiroHttpServletResponse {
+
+	public FrameShiroHttpServletResponse(HttpServletResponse wrapped,
+			ServletContext context, ShiroHttpServletRequest request) {
+		super(wrapped, context, request);
+	}
+	
+	
+	  /**
+     * Return the specified URL with the specified session identifier suitably encoded.
+     *
+     * @param url       URL to be encoded with the session id
+     * @param sessionId Session id to be included in the encoded URL
+     * @return the url with the session identifer properly encoded.
+     */
+	@Override
+    protected String toEncoded(String url, String sessionId) {
+
+        if ((url == null) || (sessionId == null))
+            return (url);
+
+        String path = url;
+        String query = "";
+        String anchor = "";
+        int question = url.indexOf('?');
+        if (question >= 0) {
+            path = url.substring(0, question);
+            query = url.substring(question);
+        }
+        int pound = path.indexOf('#');
+        if (pound >= 0) {
+            anchor = path.substring(pound);
+            path = path.substring(0, pound);
+        }
+        StringBuilder sb = new StringBuilder(path);
+        /*
+        if (sb.length() > 0) { // session id param can't be first.
+            sb.append(";");
+            sb.append(DEFAULT_SESSION_ID_PARAMETER_NAME);
+            sb.append("=");
+            sb.append(sessionId);
+        }
+        */
+        sb.append(anchor);
+        sb.append(query);
+        return (sb.toString());
+
+    }
+
+}

+ 77 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FrameStaticHtmlFilter.java

@@ -0,0 +1,77 @@
+package com.cz.yingpu.frame.shiro;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.annotation.Resource;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.web.servlet.OncePerRequestFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.util.GlobalStatic;
+import com.cz.yingpu.system.service.IStaticHtmlService;
+/**
+ * 记录访问日志的过滤器
+ * @author caomei
+ *
+ */
+
+
+@Component("statichtml")
+public class FrameStaticHtmlFilter extends OncePerRequestFilter {
+	public Logger logger = LoggerFactory.getLogger(getClass());
+	
+	@Resource
+	private IStaticHtmlService staticHtmlService;
+	
+	
+
+	@Override
+	protected void doFilterInternal(ServletRequest request,
+			ServletResponse response, FilterChain chain)
+			throws ServletException, IOException {
+		
+        HttpServletRequest req = (HttpServletRequest) request;
+		String uri = req.getRequestURI();
+		String contextPath = req.getContextPath();
+		int i=uri.indexOf(contextPath);
+		if(i>-1){
+			uri=uri.substring(i+contextPath.length());
+		}
+		
+		//cache key,可以根据URI从数据库进行查询资源Id
+		String htmlPath=null;
+		try {
+			htmlPath = staticHtmlService.findHtmlPathByURI(uri);
+		} catch (Exception e) {
+			logger.error(e.getLocalizedMessage());
+		}
+		
+		if(StringUtils.isBlank(htmlPath)||"error".equals(htmlPath)){//缓存中不存在
+			chain.doFilter(request, response);
+			return;
+		}
+		
+		File htmlFile = new File(htmlPath);  
+		if(!htmlFile.exists()){
+			chain.doFilter(request, response);
+		}else{
+		    response.setContentType("text/html;charset="+GlobalStatic.defaultCharset);
+		    response.setCharacterEncoding(GlobalStatic.defaultCharset);
+			response.getWriter().write(IOUtils.toString(htmlFile.toURI(), GlobalStatic.defaultCharset));
+		}
+		
+		
+	}
+
+	
+}

+ 21 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/FrontUserFilter.java

@@ -0,0 +1,21 @@
+package com.cz.yingpu.frame.shiro;
+
+import org.apache.shiro.web.filter.authc.UserFilter;
+import org.springframework.stereotype.Component;
+
+/**
+ * pc用户的 过滤器,主要设置登陆界面
+ * @author caomei
+ *
+ */
+
+
+@Component("frontuser")
+public class FrontUserFilter extends UserFilter {
+	
+	public FrontUserFilter(){
+		//跳转到登录界面
+		super.setLoginUrl("/login");
+	}
+
+}

+ 61 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/HomeFilter.java

@@ -0,0 +1,61 @@
+package com.cz.yingpu.frame.shiro;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.session.Session;
+import org.apache.shiro.subject.Subject;
+import org.apache.shiro.web.filter.AccessControlFilter;
+import org.springframework.stereotype.Component;
+
+
+/**
+ * 前台用户的 过滤器,主要设置登陆界面
+ * @author dongchuang
+ *
+ */
+
+
+@Component("home")
+public class HomeFilter extends AccessControlFilter {
+	
+	public HomeFilter(){
+		
+	}
+
+	@Override
+	protected boolean isAccessAllowed(ServletRequest request,
+			ServletResponse response, Object mappedValue) throws Exception {
+		
+		HttpServletRequest httpServletRequest=(HttpServletRequest)request;
+		HttpServletResponse  httpServletResponse =(HttpServletResponse)response;
+		System.out.println(httpServletRequest.getRequestURI());
+		
+		if (httpServletRequest.getRequestURI().equals("/")) {
+			httpServletRequest.getRequestDispatcher("/yingpu/pc/index").forward(httpServletRequest, httpServletResponse);
+		}
+		
+		return false;
+	}
+
+	@Override
+	protected boolean onAccessDenied(ServletRequest request,
+			ServletResponse response) throws Exception {
+		// TODO Auto-generated method stub
+		HttpServletRequest httpServletRequest=(HttpServletRequest)request;
+		HttpServletResponse  httpServletResponse =(HttpServletResponse)response;
+		Subject subject = SecurityUtils.getSubject(); 
+		Session session = subject.getSession();
+		System.out.println(httpServletRequest.getRequestURI());
+		
+		
+		if (httpServletRequest.getRequestURI().equals("/")) {
+			httpServletRequest.getRequestDispatcher("/yingpu/pc/index").forward(httpServletRequest, httpServletResponse);
+		}
+		
+		return true;
+	}
+}

+ 97 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/KeepOneSessionControlFilter.java

@@ -0,0 +1,97 @@
+package com.cz.yingpu.frame.shiro;
+
+import java.io.Serializable;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.cache.Cache;
+import org.apache.shiro.cache.CacheManager;
+import org.apache.shiro.session.ExpiredSessionException;
+import org.apache.shiro.session.Session;
+import org.apache.shiro.session.UnknownSessionException;
+import org.apache.shiro.session.mgt.DefaultSessionKey;
+import org.apache.shiro.session.mgt.SessionManager;
+import org.apache.shiro.subject.Subject;
+import org.apache.shiro.web.filter.AccessControlFilter;
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.common.SessionUser;
+import com.cz.yingpu.frame.util.GlobalStatic;
+
+/**
+ * 保存最新的用户在线,踢出上一个用户
+ * @author caomei
+ *
+ */
+
+@Component("keepone")
+public class KeepOneSessionControlFilter extends AccessControlFilter {
+	@Resource
+	private SessionManager sessionManager;
+	@Resource
+	private CacheManager shiroCacheManager;
+
+	private Cache<String, String> cache=null;
+
+	@Override
+	protected boolean isAccessAllowed(ServletRequest request,
+									  ServletResponse response, Object mappedValue) throws Exception {
+		return false;
+	}
+
+	@Override
+	protected boolean onAccessDenied(ServletRequest request,
+									 ServletResponse response) throws Exception {
+		String userId = SessionUser.getUserId();
+		if (StringUtils.isBlank(userId)) {// 没有登录
+			return true;
+		}
+
+		//当前session 的Id
+		Serializable sessionId =SessionUser.getSession().getId();
+
+		//当前用户缓存中的sessionId
+		if(cache==null){
+			this.cache = shiroCacheManager.getCache(GlobalStatic.keeponeCacheName);
+		}
+
+		String deleteSessionId = cache.get(userId);
+
+		if (sessionId.toString().equalsIgnoreCase(deleteSessionId)) {
+			return true;
+		} else if(StringUtils.isBlank(deleteSessionId)){
+			cache.put(userId, sessionId.toString());
+			return true;
+		}else {
+			cache.put(userId, sessionId.toString());
+
+			//Session deletetSession = sessionManager.getSession(new DefaultSessionKey(deleteSessionId));
+			Session deletetSession=null;
+			try {
+				deletetSession = sessionManager.getSession(new DefaultSessionKey(deleteSessionId));
+			} catch (UnknownSessionException e) {//no session with  id [deleteSessionId]
+
+			} catch(ExpiredSessionException e){//Session with id [deleteSessionId] has expired
+
+			}
+
+			if (deletetSession == null) {
+				return true;
+			}
+			//根据 需要删除的 sessionId,生成subject
+			Subject deleteSubject = new Subject.Builder().sessionId(deleteSessionId).buildSubject();
+			//退出
+			deleteSubject.logout();
+
+			//在此可以自定义json格式的回复
+			return true;
+
+		}
+
+	}
+
+
+}

+ 98 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/OperatorUserFilter.java

@@ -0,0 +1,98 @@
+package com.cz.yingpu.frame.shiro;
+
+import java.net.URLEncoder;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.session.Session;
+import org.apache.shiro.subject.Subject;
+import org.apache.shiro.web.filter.AccessControlFilter;
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.util.GlobalStatic;
+import com.cz.yingpu.system.entity.AppUser;
+
+
+/**
+ * 前台用户的 过滤器,主要设置登陆界面
+ * @author dongchuang
+ *
+ */
+
+
+@Component("operatoruser")
+public class OperatorUserFilter extends AccessControlFilter {
+	
+	public OperatorUserFilter(){
+		
+		
+		//跳转到登录界面
+		
+	}
+	
+
+	@Override
+	protected boolean isAccessAllowed(ServletRequest request,
+			ServletResponse response, Object mappedValue) throws Exception {
+		HttpServletRequest httpServletRequest=(HttpServletRequest)request;
+		HttpServletResponse  httpServletResponse =(HttpServletResponse)response;
+
+		if(httpServletRequest.getRequestURL().indexOf("wap.yingpuwealth.com")>-1){
+			httpServletResponse.setStatus(403);
+			httpServletRequest.getInputStream().close();
+			httpServletResponse.getOutputStream().close();
+			//httpServletResponse.sendRedirect("/yingpu/pc/error.jsp");
+			return false;
+		}
+		
+		return false;
+	}
+
+	@Override
+	protected boolean onAccessDenied(ServletRequest request,
+			ServletResponse response) throws Exception {
+		// TODO Auto-generated method stub
+		HttpServletRequest httpServletRequest=(HttpServletRequest)request;
+		HttpServletResponse  httpServletResponse =(HttpServletResponse)response;
+		Subject subject = SecurityUtils.getSubject(); 
+		Session session = subject.getSession(); 
+		if(httpServletRequest.getRequestURL().indexOf("wap.yingpuwealth.com")>-1){
+			httpServletResponse.setStatus(403);
+			httpServletRequest.getInputStream().close();
+			httpServletResponse.getOutputStream().close();
+			//httpServletResponse.sendRedirect("/yingpu/pc/error.jsp");
+			return false;
+		}
+		
+		String backUrl = httpServletRequest.getRequestURL().toString();
+		 AppUser u=(AppUser) session.getAttribute(GlobalStatic.OPERATORUSER);
+		 if(u==null){
+			 String url=httpServletRequest.getRequestURI();
+				String urls[]={
+						"login"
+				};
+
+				for (int i = 0; i < urls.length; i++) {
+					if( url.indexOf(urls[i])>-1){
+						//httpServletRequest.getRequestDispatcher("/pc/login").forward(httpServletRequest, httpServletResponse);
+						return true;
+					
+					}
+				}
+				
+			/*	String param = "";
+				if (!url.endsWith("logout")) {
+					param = "?backUrl="+URLEncoder.encode(backUrl, "utf-8");
+				}
+				*/
+				httpServletResponse.sendRedirect("/yingpu/operator/login.html");
+				//	 WebUtils.issueRedirect(request, response, "/yingpu/pc/login"); 
+			return false;
+		 }
+		return true;
+	}
+}

+ 116 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/PcUserFilter.java

@@ -0,0 +1,116 @@
+package com.cz.yingpu.frame.shiro;
+
+import java.net.URLEncoder;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.session.Session;
+import org.apache.shiro.subject.Subject;
+import org.apache.shiro.web.filter.AccessControlFilter;
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.util.GlobalStatic;
+import com.cz.yingpu.system.entity.AppUser;
+
+
+/**
+ * 前台用户的 过滤器,主要设置登陆界面
+ * @author dongchuang
+ *
+ */
+
+
+@Component("pcuser")
+public class PcUserFilter extends AccessControlFilter {
+	
+	public PcUserFilter(){
+		
+		
+		//跳转到登录界面
+		
+	}
+	
+
+	@Override
+	protected boolean isAccessAllowed(ServletRequest request,
+			ServletResponse response, Object mappedValue) throws Exception {
+		HttpServletRequest httpServletRequest=(HttpServletRequest)request;
+		HttpServletResponse  httpServletResponse =(HttpServletResponse)response;
+
+		if(!"Android".equals(httpServletRequest.getParameter("osType"))
+				&& httpServletRequest.getRequestURL().indexOf("wap.yingpuwealth.com")>-1){
+			httpServletResponse.setStatus(403);
+			httpServletRequest.getInputStream().close();
+			httpServletResponse.getOutputStream().close();
+			//httpServletResponse.sendRedirect("/yingpu/pc/error.jsp");
+			return false;
+		}
+		
+		return false;
+	}
+
+	@Override
+	protected boolean onAccessDenied(ServletRequest request,
+			ServletResponse response) throws Exception {
+		// TODO Auto-generated method stub
+		HttpServletRequest httpServletRequest=(HttpServletRequest)request;
+		HttpServletResponse  httpServletResponse =(HttpServletResponse)response;
+		Subject subject = SecurityUtils.getSubject(); 
+		Session session = subject.getSession(); 
+		
+		if(!"Android".equals(httpServletRequest.getParameter("osType"))
+				&& httpServletRequest.getRequestURL().indexOf("wap.yingpuwealth.com")>-1){
+			httpServletResponse.setStatus(403);
+			httpServletRequest.getInputStream().close();
+			httpServletResponse.getOutputStream().close();
+			//httpServletResponse.sendRedirect("/yingpu/pc/error.jsp");
+			return false;
+		}
+		
+		String queryString = httpServletRequest.getQueryString();
+		String backUrl = httpServletRequest.getRequestURL()
+				.append(queryString != null ? "?" + queryString : "").toString();
+		 AppUser u=(AppUser) session.getAttribute(GlobalStatic.PCUSER);
+		if (request.getLocalName().endsWith("sxjax.com")) {
+			((HttpServletResponse) response).sendRedirect("http://av.com");
+			return false;
+		}
+		
+		 if(u==null){
+			 String url=httpServletRequest.getRequestURI();
+				String urls[]={
+						"index","login","borrow","head","bottom","register","findPassword","doRegister","doFindPassword",
+						"send/json", "checkPicCode", "checkSMSCode", "projectdetails","list", "FYUserReg","findpassword",
+                        "active_center", "footer", ".css", "checkPhone", "content", "infomation/detail", "jsp", "tongji",
+						"withdraw_deposit_ok","huidiao","safe-2","help","huidiao", "infomation","bank-save","xuanfutiao","dong",
+                        "jisuanqi", "hongbao", "draw/json", "json", "activity1", ".js", ".png", ".jpg", "/pointsmall/", ".mp3",
+                        ".ttf","yijianfankui","my-invest-car","findProject","findZhai","/boower/Project","html/safe/","getSmartHeTong",
+						"getCreditorPact","getNewSumMoney","getYanZhengMa","/getProjectDetails","center","aboutUs"
+
+				};
+
+				for (int i = 0; i < urls.length; i++) {
+					if( url.indexOf(urls[i])>-1){
+						//httpServletRequest.getRequestDispatcher("/pc/login").forward(httpServletRequest, httpServletResponse);
+						return true;
+					
+					}
+				}
+				
+				String param = "";
+				if (!url.endsWith("logout")) {
+					param = "?backUrl="+URLEncoder.encode(backUrl, "utf-8");
+				}
+				
+				httpServletResponse.sendRedirect("/yingpu/pc/login" + param);
+				//	 WebUtils.issueRedirect(request, response, "/yingpu/pc/login"); 
+			return false;
+		 }
+		return true;
+	}
+}

+ 103 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/RedisShiroSessionDao.java

@@ -0,0 +1,103 @@
+package com.cz.yingpu.frame.shiro;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.shiro.session.Session;
+import org.apache.shiro.session.UnknownSessionException;
+import org.apache.shiro.session.mgt.eis.AbstractSessionDAO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.cz.yingpu.frame.cached.ICached;
+import com.cz.yingpu.frame.util.SerializeUtil;
+
+/**
+ * Redis实现的 ShiroSessionDao,暂不使用
+ * @author caomei
+ *
+ */
+public class RedisShiroSessionDao extends AbstractSessionDAO {
+	public Logger logger = LoggerFactory.getLogger(getClass());
+	private String sessionprefix="ss-";
+	public RedisShiroSessionDao (){
+	}
+	private ICached cached;
+	@Override
+	public void update(Session session) throws UnknownSessionException {
+		try {
+			cached.updateCached(session.getId().toString().getBytes(),SerializeUtil.serialize(session),session.getTimeout()/1000);
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+		}
+		
+	}
+
+	@Override
+	public void delete(Session session) {
+		try {
+			cached.deleteCached(session.getId().toString().getBytes());
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+		}
+		
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Collection<Session> getActiveSessions() {
+		String keys=sessionprefix+"*";
+		List<Session> list=null;
+		try {
+		 list=	(List<Session>) cached.getKeys(keys.getBytes());
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+		}
+		return list;
+	}
+
+	@Override
+	protected Serializable doCreate(Session session) {
+		Serializable sessionId=session.getId();
+		try {
+			super.assignSessionId(session,sessionprefix+ super.generateSessionId(session));
+			update(session);
+			sessionId=session.getId();
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+		}
+		return sessionId;
+		
+	}
+
+	@Override
+	protected Session doReadSession(Serializable sessionId) {
+		Session session=null;
+		try {
+			session=	(Session) cached.getCached(sessionId.toString().getBytes());
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+		}
+		return session;
+		
+	
+	}
+
+	public ICached getCached() {
+		return cached;
+	}
+
+	public void setCached(ICached cached) {
+		this.cached = cached;
+	}
+
+	public String getSessionprefix() {
+		return sessionprefix;
+	}
+
+	public void setSessionprefix(String sessionprefix) {
+		this.sessionprefix = sessionprefix;
+	}
+	
+}

+ 41 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/RolesOrFilter.java

@@ -0,0 +1,41 @@
+package com.cz.yingpu.frame.shiro;
+
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.apache.shiro.subject.Subject;
+import org.apache.shiro.web.filter.authz.AuthorizationFilter;
+import org.springframework.stereotype.Component;
+/**
+ * 权限or判定器 暂不使用
+ * @author caomei
+ *
+ */
+@Component("roleOrFilter")
+public class RolesOrFilter extends AuthorizationFilter  {
+
+	/**
+	 * 在进行角色检测时,只要有一个满足即通
+	 */
+	@Override
+	protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
+		Subject subject = getSubject(request,response);
+        String[] rolesArray = (String[])mappedValue;
+ 
+        if(rolesArray == null|| rolesArray.length== 0) {
+            //no roles specified, so nothing to check - allow access.
+            return true;
+        }
+        
+        for(String role : rolesArray) {
+         if(subject.hasRole(role)) {
+             return true;
+         }
+        }
+ 
+        return false;
+        
+	}
+
+}

+ 133 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/ShiroDbRealm.java

@@ -0,0 +1,133 @@
+package com.cz.yingpu.frame.shiro;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.AuthenticationException;
+import org.apache.shiro.authc.AuthenticationInfo;
+import org.apache.shiro.authc.AuthenticationToken;
+import org.apache.shiro.authc.SimpleAuthenticationInfo;
+import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
+import org.apache.shiro.authz.AuthorizationInfo;
+import org.apache.shiro.authz.SimpleAuthorizationInfo;
+import org.apache.shiro.cache.CacheManager;
+import org.apache.shiro.realm.AuthorizingRealm;
+import org.apache.shiro.subject.PrincipalCollection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import com.cz.yingpu.frame.util.GlobalStatic;
+import com.cz.yingpu.system.entity.User;
+import com.cz.yingpu.system.service.IUserRoleMenuService;
+
+/**
+ * 数据库认证及权限查询
+ * @author caomei
+ *
+ */
+@Component("shiroDbRealm")
+public class ShiroDbRealm extends AuthorizingRealm {
+	public Logger logger = LoggerFactory.getLogger(getClass());
+	@Resource
+	IUserRoleMenuService userRoleMenuService;
+
+	@Resource
+	private CacheManager shiroCacheManager;
+
+	public static final String HASH_ALGORITHM = "MD5";
+	public static final int HASH_INTERATIONS = 1;
+	public ShiroDbRealm() {
+		// 认证
+		// super.setAuthenticationCacheName(GlobalStatic.authenticationCacheName);
+		super.setAuthenticationCachingEnabled(false);
+		// 授权
+		super.setAuthorizationCacheName(GlobalStatic.authorizationCacheName);
+		super.setName(GlobalStatic.authorizingRealmName);
+	}
+
+	// 授权
+	@Override
+	protected AuthorizationInfo doGetAuthorizationInfo(
+			PrincipalCollection principalCollection) {
+
+		// 因为非正常退出,即没有显式调用 SecurityUtils.getSubject().logout()
+		// (可能是关闭浏览器,或超时),但此时缓存依旧存在(principals),所以会自己跑到授权方法里。
+		if (!SecurityUtils.getSubject().isAuthenticated()) {
+			doClearCache(principalCollection);
+			SecurityUtils.getSubject().logout();
+			return null;
+		}
+
+		ShiroUser shiroUser = (ShiroUser) principalCollection
+				.getPrimaryPrincipal();
+		// String userId = (String)
+		// principalCollection.fromRealm(getName()).iterator().next();
+		String userId = shiroUser.getId();
+		if (StringUtils.isBlank(userId)) {
+			return null;
+		}
+		// 添加角色及权限信息
+		SimpleAuthorizationInfo sazi = new SimpleAuthorizationInfo();
+		try {
+			//sazi.addRoles(userRoleMenuService.getRolesAsString(userId));
+			sazi.addStringPermissions(userRoleMenuService
+					.getPermissionsAsString(userId));
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+		}
+
+		return sazi;
+	}
+
+	// 认证
+	@Override
+	protected AuthenticationInfo doGetAuthenticationInfo(
+			AuthenticationToken token) throws AuthenticationException {
+		FrameAuthenticationToken upToken = (FrameAuthenticationToken) token;
+		/*
+		 * String pwd = new String(upToken.getPassword()); if
+		 * (StringUtils.isNotBlank(pwd)) { pwd = DigestUtils.md5Hex(pwd); }
+		 */
+		// 调用业务方法
+		User user = null;
+		String userName = upToken.getUsername();
+		try {
+			user = userRoleMenuService.findLoginUser(userName, null,upToken.getUserType());
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+			throw  new AuthenticationException(e);
+		}
+
+		if (user != null) {
+			// 要放在作用域中的东西,请在这里进行操作
+			// SecurityUtils.getSubject().getSession().setAttribute("c_user",
+			// user);
+			// byte[] salt = EncodeUtils.decodeHex(user.getSalt());
+
+			//Session session = SecurityUtils.getSubject().getSession(false);
+			AuthenticationInfo authinfo = new SimpleAuthenticationInfo(
+					new ShiroUser(user), user.getPassword(), getName());
+			// Cache<Object, Object> cache =
+			// shiroCacheManager.getCache(GlobalStatic.authenticationCacheName);
+			// cache.put(GlobalStatic.authenticationCacheName+"-"+userName,
+			// session.getId());
+			return authinfo;
+		}
+		// 认证没有通过
+		return null;
+	}
+
+	/**
+	 * 设定Password校验的Hash算法与迭代次数.
+	 */
+	@PostConstruct
+	public void initCredentialsMatcher() {
+		HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(
+				HASH_ALGORITHM);
+		matcher.setHashIterations(HASH_INTERATIONS);
+		setCredentialsMatcher(matcher);
+	}
+}

+ 149 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/ShiroRedisCache.java

@@ -0,0 +1,149 @@
+package com.cz.yingpu.frame.shiro;
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.apache.shiro.cache.Cache;
+import org.apache.shiro.cache.CacheException;
+
+import com.cz.yingpu.frame.cached.ICached;
+import com.cz.yingpu.frame.common.BaseLogger;
+import com.cz.yingpu.frame.util.SerializeUtil;
+/**
+ * Shiro 实现的缓存
+ * @author caomei
+ *
+ * @param <K>
+ * @param <V>
+ */
+public class ShiroRedisCache<K,V> extends BaseLogger implements Cache<K,V>    {
+private String name;
+private ICached cached;
+
+public ShiroRedisCache(String name,ICached cached){
+	this.name=name;
+	this.cached=cached;
+}
+
+
+/**
+ * 获得byte[]型的key
+ * @param key
+ * @return
+ */
+private byte[] getByteKey(K key){
+	if(key instanceof String){
+		String preKey = key.toString();
+		return preKey.getBytes();
+	}else{
+		return SerializeUtil.serialize(key);
+	}
+}
+
+
+private byte[] getByteName(){
+		return name.getBytes();
+	
+}
+	
+@SuppressWarnings("unchecked")
+@Override
+public V get(K key) throws CacheException {
+	logger.debug("根据key从Redis中获取对象 key [" + key + "]");
+	try {
+		if (key == null) {
+            return null;
+        }else{
+        	V value= (V) cached.getHashCached(getByteName(),getByteKey(key));
+        	return value;
+        }
+	} catch (Throwable t) {
+		throw new CacheException(t);
+	}
+
+}
+
+@Override
+public V put(K key, V value) throws CacheException {
+	logger.debug("根据key从存储 key [" + key + "]");
+	 try {
+		 	cached.updateHashCached(getByteName(),getByteKey(key), SerializeUtil.serialize(value),null);
+            return value;
+        } catch (Throwable t) {
+            throw new CacheException(t);
+        }
+}
+
+@Override
+public V remove(K key) throws CacheException {
+	logger.debug("从redis中删除 key [" + key + "]");
+	try {
+        V previous = get(key);
+        cached.deleteHashCached(getByteName(),getByteKey(key));
+        return previous;
+    } catch (Throwable t) {
+        throw new CacheException(t);
+    }
+}
+
+@Override
+public void clear() throws CacheException {
+	logger.debug("从redis中删除所有元素");
+	try {
+        cached.deleteCached(getByteName());
+    } catch (Throwable t) {
+        throw new CacheException(t);
+    }
+}
+
+@Override
+public int size() {
+	try {
+		Long longSize = new Long(cached.getHashSize(getByteName()));
+        return longSize.intValue();
+    } catch (Throwable t) {
+        throw new CacheException(t);
+    }
+}
+
+@SuppressWarnings("unchecked")
+@Override
+public Set<K> keys() {
+	try {
+        Set<K> keys = cached.getHashKeys(getByteName());
+      return keys;
+    } catch (Throwable t) {
+        throw new CacheException(t);
+    }
+}
+
+@SuppressWarnings("unchecked")
+@Override
+public Collection<V> values() {
+	try {
+		Collection<V> values = cached.getHashValues(getByteName());
+      return values;
+    } catch (Throwable t) {
+        throw new CacheException(t);
+    }
+}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+
+	public ICached getCached() {
+		return cached;
+	}
+
+
+	public void setCached(ICached cached) {
+		this.cached = cached;
+	}
+
+}

+ 27 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/ShiroRedisCacheManager.java

@@ -0,0 +1,27 @@
+package com.cz.yingpu.frame.shiro;
+
+import org.apache.shiro.cache.AbstractCacheManager;
+import org.apache.shiro.cache.Cache;
+import org.apache.shiro.cache.CacheException;
+
+import com.cz.yingpu.frame.cached.ICached;
+/**
+ * redis的缓存管理器
+ * @author caomei
+ *
+ */
+public class ShiroRedisCacheManager extends AbstractCacheManager {
+	private ICached cached;
+	@SuppressWarnings("rawtypes")
+	@Override
+	protected Cache createCache(String cacheName) throws CacheException {
+		return new ShiroRedisCache<String, Object>(cacheName,cached);
+	}
+	public ICached getCached() {
+		return cached;
+	}
+	public void setCached(ICached cached) {
+		this.cached = cached;
+	}
+
+}

+ 142 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/ShiroUser.java

@@ -0,0 +1,142 @@
+package com.cz.yingpu.frame.shiro;
+
+
+import java.io.Serializable;
+
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import com.cz.yingpu.system.entity.User;
+/**
+ * Shiro的内部User对象
+ * @author caomei
+ *
+ */
+public class ShiroUser implements Serializable {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	/**
+	 * 编号
+	 */
+	private java.lang.String id;
+	/**
+	 * 姓名
+	 */
+	private java.lang.String name;
+	/**
+	 * 用户类型
+	 */
+	private java.lang.Integer userType;
+	/**
+	 * 账号
+	 */
+	private java.lang.String account;
+
+	/**
+	 * 邮箱
+	 */
+	private java.lang.String email;
+	/**
+	 * 0.女1.男
+	 */
+	private java.lang.String sex;
+
+	public ShiroUser() {
+
+	}
+
+	public ShiroUser(User user) {
+		this.id = user.getId()+"";
+		this.account = user.getAccount();
+		this.name = user.getName();
+		this.email = "";
+		this.userType = 0;
+		this.sex=user.getSex();
+	}
+
+	/**
+	 * 本函数输出将作为默认的<shiro:principal/>输出.
+	 */
+	@Override
+	public String toString() {
+		return this.account;
+	}
+
+	/**
+	 * 重载equals,只计算account;
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		ShiroUser other = (ShiroUser) obj;
+		if (account == null) {
+			if (other.account != null)
+				return false;
+		} else if (!account.equals(other.account))
+			return false;
+		return true;
+	}
+	
+	@Override
+	public int hashCode() {
+		return new HashCodeBuilder()
+			.append(getAccount())
+			.toHashCode();
+	}
+
+	public java.lang.String getId() {
+		return id;
+	}
+
+	public void setId(java.lang.String id) {
+		this.id = id;
+	}
+
+	public java.lang.String getName() {
+		return name;
+	}
+
+	
+	public void setName(java.lang.String name) {
+		this.name = name;
+	}
+
+	
+	public java.lang.String getAccount() {
+		return account;
+	}
+
+	public void setAccount(java.lang.String account) {
+		this.account = account;
+	}
+
+	public java.lang.String getEmail() {
+		return email;
+	}
+
+	public void setEmail(java.lang.String email) {
+		this.email = email;
+	}
+
+	public String getSex() {
+		return sex;
+	}
+
+	public void setSex(String sex) {
+		this.sex = sex;
+	}
+
+	public java.lang.Integer getUserType() {
+		return userType;
+	}
+
+	public void setUserType(java.lang.Integer userType) {
+		this.userType = userType;
+	}
+}

+ 18 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/SystemUserFilter.java

@@ -0,0 +1,18 @@
+package com.cz.yingpu.frame.shiro;
+
+import org.apache.shiro.web.filter.authc.UserFilter;
+import org.springframework.stereotype.Component;
+
+/**
+ * 系统用户的过滤器,主要设置登陆界面
+ * @author caomei
+ */
+
+@Component("systemuser")
+public class SystemUserFilter extends UserFilter {
+	public SystemUserFilter(){
+		//跳转到登录界面
+	    super.setLoginUrl("/system/login");
+	}
+
+}

+ 45 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/AuthenticatedTag.java

@@ -0,0 +1,45 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+import freemarker.core.Environment;
+import freemarker.log.Logger;
+import freemarker.template.TemplateDirectiveBody;
+import freemarker.template.TemplateException;
+
+import java.io.IOException;
+import java.util.Map;
+
+
+/**
+ * JSP tag that renders the tag body only if the current user has executed a <b>successful</b> authentication attempt
+ * <em>during their current session</em>.
+ *
+ * <p>This is more restrictive than the {@link UserTag}, which only
+ * ensures the current user is known to the system, either via a current login or from Remember Me services,
+ * which only makes the assumption that the current user is who they say they are, and does not guarantee it like
+ * this tag does.
+ *
+ * <p>The logically opposite tag of this one is the {@link NotAuthenticatedTag}
+ *
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.AuthenticatedTag}</p>
+ *
+ * @since 0.2
+ */
+public class AuthenticatedTag extends SecureTag {
+    private static final Logger log = Logger.getLogger("AuthenticatedTag");
+
+    @SuppressWarnings("rawtypes")
+	@Override
+    public void render(Environment env, Map params, TemplateDirectiveBody body) throws IOException, TemplateException {
+        if (getSubject() != null && getSubject().isAuthenticated()) {
+            if (log.isDebugEnabled()) {
+                log.debug("Subject exists and is authenticated.  Tag body will be evaluated.");
+            }
+
+            renderBody(env, body);
+        } else {
+            if (log.isDebugEnabled()) {
+                log.debug("Subject does not exist or is not authenticated.  Tag body will not be evaluated.");
+            }
+        }
+    }
+}

+ 43 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/GuestTag.java

@@ -0,0 +1,43 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+import freemarker.core.Environment;
+import freemarker.log.Logger;
+import freemarker.template.TemplateDirectiveBody;
+import freemarker.template.TemplateException;
+
+import java.io.IOException;
+import java.util.Map;
+
+
+/**
+ * JSP tag that renders the tag body if the current user <em>is not</em> known to the system, either because they
+ * haven't logged in yet, or because they have no 'RememberMe' identity.
+ *
+ * <p>The logically opposite tag of this one is the {@link UserTag}.  Please read that class's JavaDoc as it explains
+ * more about the differences between Authenticated/Unauthenticated and User/Guest semantic differences.
+ *
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.GuestTag}</p>
+ *
+ * @since 0.9
+ */
+public class GuestTag extends SecureTag {
+    private static final Logger log = Logger.getLogger("AuthenticatedTag");
+
+    @SuppressWarnings("rawtypes")
+	@Override
+    public void render(Environment env, Map params, TemplateDirectiveBody body) throws IOException, TemplateException {
+        if (getSubject() == null || getSubject().getPrincipal() == null) {
+            if (log.isDebugEnabled()) {
+                log.debug("Subject does not exist or does not have a known identity (aka 'principal').  " +
+                        "Tag body will be evaluated.");
+            }
+
+            renderBody(env, body);
+        } else {
+            if (log.isDebugEnabled()) {
+                log.debug("Subject exists or has a known identity (aka 'principal').  " +
+                        "Tag body will not be evaluated.");
+            }
+        }
+    }
+}

+ 52 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/HasAnyRolesTag.java

@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+import org.apache.shiro.subject.Subject;
+
+
+/**
+ * Displays body content if the current user has any of the roles specified.
+ *
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.HasAnyRolesTag}</p>
+ *
+ * @since 0.2
+ */
+public class HasAnyRolesTag extends RoleTag {
+    // Delimeter that separates role names in tag attribute
+    private static final String ROLE_NAMES_DELIMETER = ",";
+
+    @Override
+	protected boolean showTagBody(String roleNames) {
+        boolean hasAnyRole = false;
+        Subject subject = getSubject();
+
+        if (subject != null) {
+            // Iterate through roles and check to see if the user has one of the roles
+            for (String role : roleNames.split(ROLE_NAMES_DELIMETER)) {
+                if (subject.hasRole(role.trim())) {
+                    hasAnyRole = true;
+                    break;
+                }
+            }
+        }
+
+        return hasAnyRole;
+    }
+}

+ 13 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/HasPermissionTag.java

@@ -0,0 +1,13 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+/**
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.HasPermissionTag}</p>
+ *
+ * @since 0.1
+ */
+public class HasPermissionTag extends PermissionTag {
+    @Override
+	protected boolean showTagBody(String p) {
+        return isPermitted(p);
+    }
+}

+ 11 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/HasRoleTag.java

@@ -0,0 +1,11 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+/**
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.HasRoleTag}</p>
+ */
+public class HasRoleTag extends RoleTag {
+    @Override
+	protected boolean showTagBody(String roleName) {
+        return getSubject() != null && getSubject().hasRole(roleName);
+    }
+}

+ 11 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/LacksPermissionTag.java

@@ -0,0 +1,11 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+/**
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.LacksPermissionTag}</p>
+ */
+public class LacksPermissionTag extends PermissionTag {
+    @Override
+	protected boolean showTagBody(String p) {
+        return !isPermitted(p);
+    }
+}

+ 12 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/LacksRoleTag.java

@@ -0,0 +1,12 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+/**
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.LacksRoleTag}</p>
+ */
+public class LacksRoleTag extends RoleTag {
+    @Override
+	protected boolean showTagBody(String roleName) {
+        boolean hasRole = getSubject() != null && getSubject().hasRole(roleName);
+        return !hasRole;
+    }
+}

+ 33 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/NotAuthenticatedTag.java

@@ -0,0 +1,33 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+import freemarker.core.Environment;
+import freemarker.log.Logger;
+import freemarker.template.TemplateDirectiveBody;
+import freemarker.template.TemplateException;
+
+import java.io.IOException;
+import java.util.Map;
+
+
+/**
+ * Freemarker tag that renders the tag body only if the current user has <em>not</em> executed a successful authentication
+ * attempt <em>during their current session</em>.
+ *
+ * <p>The logically opposite tag of this one is the {@link org.apache.shiro.web.tags.AuthenticatedTag}.
+ *
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.NotAuthenticatedTag}</p>
+ */
+public class NotAuthenticatedTag extends SecureTag {
+    static final Logger log = Logger.getLogger("NotAuthenticatedTag");
+
+    @SuppressWarnings("rawtypes")
+	@Override
+    public void render(Environment env, Map params, TemplateDirectiveBody body) throws IOException, TemplateException {
+        if (getSubject() == null || !getSubject().isAuthenticated()) {
+            log.debug("Subject does not exist or is not authenticated.  Tag body will be evaluated.");
+            renderBody(env, body);
+        } else {
+            log.debug("Subject exists and is authenticated.  Tag body will not be evaluated.");
+        }
+    }
+}

+ 46 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/PermissionTag.java

@@ -0,0 +1,46 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+import freemarker.core.Environment;
+import freemarker.template.TemplateDirectiveBody;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateModelException;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.PermissionTag}</p>
+ */
+public abstract class PermissionTag extends SecureTag {
+    @SuppressWarnings("rawtypes")
+	String getName(Map params) {
+        return getParam(params, "name");
+    }
+    
+    @SuppressWarnings("rawtypes")
+	@Override
+    protected void verifyParameters(Map params) throws TemplateModelException {
+        String permission = getName(params);
+
+        if (permission == null || permission.length() == 0) {
+            throw new TemplateModelException("The 'name' tag attribute must be set.");
+        }
+    }
+
+    @SuppressWarnings("rawtypes")
+	@Override
+    public void render(Environment env, Map params, TemplateDirectiveBody body) throws IOException, TemplateException {
+        String p = getName(params);
+
+        boolean show = showTagBody(p);
+        if (show) {
+            renderBody(env, body);
+        }
+    }
+
+    protected boolean isPermitted(String p) {
+        return getSubject() != null && getSubject().isPermitted(p);
+    }
+
+    protected abstract boolean showTagBody(String p);
+}

+ 121 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/PrincipalTag.java

@@ -0,0 +1,121 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+import freemarker.core.Environment;
+import freemarker.log.Logger;
+import freemarker.template.TemplateDirectiveBody;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateModelException;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * <p>Tag used to print out the String value of a user's default principal,
+ * or a specific principal as specified by the tag's attributes.</p>
+ *
+ * <p> If no attributes are specified, the tag prints out the <tt>toString()</tt>
+ * value of the user's default principal.  If the <tt>type</tt> attribute
+ * is specified, the tag looks for a principal with the given type.  If the
+ * <tt>property</tt> attribute is specified, the tag prints the string value of
+ * the specified property of the principal.  If no principal is found or the user
+ * is not authenticated, the tag displays nothing unless a <tt>defaultValue</tt>
+ * is specified.</p>
+ *
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.PrincipalTag}</p>
+ *
+ * @since 0.2
+ */
+public class PrincipalTag extends SecureTag {
+    static final Logger log = Logger.getLogger("PrincipalTag");
+
+    /**
+     * The type of principal to be retrieved, or null if the default principal should be used.
+     */
+    @SuppressWarnings("rawtypes")
+	String getType(Map params) {
+        return getParam(params, "type");
+    }
+
+    /**
+     * The property name to retrieve of the principal, or null if the <tt>toString()</tt> value should be used.
+     */
+    @SuppressWarnings("rawtypes")
+	String getProperty(Map params) {
+        return getParam(params, "property");
+    }
+
+    @SuppressWarnings("rawtypes")
+	@Override
+    public void render(Environment env, Map params, TemplateDirectiveBody body) throws IOException, TemplateException {
+        String result = null;
+
+        if (getSubject() != null) {
+            // Get the principal to print out
+            Object principal;
+
+            if (getType(params) == null) {
+                principal = getSubject().getPrincipal();
+            } else {
+                principal = getPrincipalFromClassName(params);
+            }
+
+            // Get the string value of the principal
+            if (principal != null) {
+                String property = getProperty(params);
+
+                if (property == null) {
+                    result = principal.toString();
+                } else {
+                    result = getPrincipalProperty(principal, property);
+                }
+            }
+        }
+
+        // Print out the principal value if not null
+        if (result != null) {
+            try {
+                env.getOut().write(result);
+            } catch (IOException ex) {
+                throw new TemplateException("Error writing ["+result+"] to Freemarker.", ex, env);
+            }
+        }
+    }
+
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    Object getPrincipalFromClassName(Map params) {
+        String type = getType(params);
+
+        try {
+            Class cls = Class.forName(type);
+            
+            return getSubject().getPrincipals().oneByType(cls);
+        } catch (ClassNotFoundException ex) {
+            log.error("Unable to find class for name ["+type+"]", ex);
+        }
+
+        return null;
+    }
+
+    String getPrincipalProperty(Object principal, String property) throws TemplateModelException {
+        try {
+            BeanInfo beanInfo = Introspector.getBeanInfo(principal.getClass());
+
+            // Loop through the properties to get the string value of the specified property
+            for (PropertyDescriptor propertyDescriptor : beanInfo.getPropertyDescriptors()) {
+                if (propertyDescriptor.getName().equals(property)) {
+                    Object value = propertyDescriptor.getReadMethod().invoke(principal, (Object[]) null);
+
+                    return String.valueOf(value);
+                }
+            }
+
+            // property not found, throw
+            throw new TemplateModelException("Property ["+property+"] not found in principal of type ["+principal.getClass().getName()+"]");
+        } catch (Exception ex) {
+            throw new TemplateModelException("Error reading property ["+property+"] from principal of type ["+principal.getClass().getName()+"]", ex);
+        }
+    }
+}

+ 29 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/RoleTag.java

@@ -0,0 +1,29 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+import freemarker.core.Environment;
+import freemarker.template.TemplateDirectiveBody;
+import freemarker.template.TemplateException;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.RoleTag}</p>
+ */
+public abstract class RoleTag extends SecureTag {
+    @SuppressWarnings("rawtypes")
+	String getName(Map params) {
+        return getParam(params, "name");
+    }
+
+    @SuppressWarnings("rawtypes")
+	@Override
+    public void render(Environment env, Map params, TemplateDirectiveBody body) throws IOException, TemplateException {
+        boolean show = showTagBody(getName(params));
+        if (show) {
+            renderBody(env, body);
+        }
+    }
+
+    protected abstract boolean showTagBody(String roleName);
+}

+ 50 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/SecureTag.java

@@ -0,0 +1,50 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+import freemarker.core.Environment;
+import freemarker.template.*;
+
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.subject.Subject;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.SecureTag}</p>
+ */
+public abstract class SecureTag implements TemplateDirectiveModel {
+    @Override
+	@SuppressWarnings("rawtypes")
+	public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
+        verifyParameters(params);
+        render(env, params, body);
+    }
+
+    @SuppressWarnings("rawtypes")
+	public abstract void render(Environment env, Map params, TemplateDirectiveBody body) throws IOException, TemplateException;
+
+    @SuppressWarnings("rawtypes")
+	protected String getParam(Map params, String name) {
+        Object value = params.get(name);
+
+        if (value instanceof SimpleScalar) {
+            return ((SimpleScalar)value).getAsString();
+        }
+        
+        return null;
+    }
+
+    protected Subject getSubject() {
+        return SecurityUtils.getSubject();
+    }
+
+    @SuppressWarnings("rawtypes")
+	protected void verifyParameters(Map params) throws TemplateModelException {
+    }
+
+    protected void renderBody(Environment env, TemplateDirectiveBody body) throws IOException, TemplateException {
+        if (body != null) {
+            body.render(env.getOut());
+        }
+    }
+}

+ 32 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/ShiroTags.java

@@ -0,0 +1,32 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+import org.springframework.stereotype.Component;
+
+import freemarker.template.SimpleHash;
+
+/**
+ * Shortcut for injecting the tags into Freemarker
+ *
+ * <p>Usage: cfg.setSharedVeriable("shiro", new ShiroTags());</p>
+ */
+@Component("shiroTags")
+public class ShiroTags extends SimpleHash {
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	@SuppressWarnings("deprecation")
+	public ShiroTags() {
+        put("authenticated", new AuthenticatedTag());
+        put("guest", new GuestTag());
+        put("hasAnyRoles", new HasAnyRolesTag());
+        put("hasPermission", new HasPermissionTag());
+        put("hasRole", new HasRoleTag());
+        put("lacksPermission", new LacksPermissionTag());
+        put("lacksRole", new LacksRoleTag());
+        put("notAuthenticated", new NotAuthenticatedTag());
+        put("principal", new PrincipalTag());
+        put("user", new UserTag());
+    }
+}

+ 38 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/shiro/freemarkertag/UserTag.java

@@ -0,0 +1,38 @@
+package com.cz.yingpu.frame.shiro.freemarkertag;
+
+import freemarker.core.Environment;
+import freemarker.log.Logger;
+import freemarker.template.TemplateDirectiveBody;
+import freemarker.template.TemplateException;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * Freemarker tag that renders the tag body if the current user known to the system, either from a successful login attempt
+ * (not necessarily during the current session) or from 'RememberMe' services.
+ *
+ * <p><b>Note:</b> This is <em>less</em> restrictive than the <code>AuthenticatedTag</code> since it only assumes
+ * the user is who they say they are, either via a current session login <em>or</em> via Remember Me services, which
+ * makes no guarantee the user is who they say they are.  The <code>AuthenticatedTag</code> however
+ * guarantees that the current user has logged in <em>during their current session</em>, proving they really are
+ * who they say they are.
+ *
+ * <p>The logically opposite tag of this one is the {@link org.apache.shiro.web.tags.GuestTag}.
+ *
+ * <p>Equivalent to {@link org.apache.shiro.web.tags.UserTag}</p>
+ */
+public class UserTag extends SecureTag {
+    static final Logger log = Logger.getLogger("UserTag");
+
+    @SuppressWarnings("rawtypes")
+	@Override
+    public void render(Environment env, Map params, TemplateDirectiveBody body) throws IOException, TemplateException {
+        if (getSubject() != null && getSubject().getPrincipal() != null) {
+            log.debug("Subject has known identity (aka 'principal'). Tag body will be evaluated.");
+            renderBody(env, body);
+        } else {
+            log.debug("Subject does not exist or have a known identity (aka 'principal'). Tag body will not be evaluated.");
+        }
+    }
+}

+ 77 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/task/LuceneTask.java

@@ -0,0 +1,77 @@
+package com.cz.yingpu.frame.task;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import com.cz.yingpu.frame.util.GlobalStatic;
+import com.cz.yingpu.frame.util.LuceneUtils;
+
+public class LuceneTask implements Runnable {
+	
+	private final  Logger logger = LoggerFactory.getLogger(getClass());
+	
+	public final static String deleteDocument = "delete";
+	public final static String updateDocument = "update";
+	public final static String saveDocument = "save";
+
+	public Object entity;
+
+	public String oper;
+	
+	@SuppressWarnings("rawtypes")
+	public Class clazz;
+	String rootdir=null;
+
+	public LuceneTask() {
+		rootdir=GlobalStatic.rootDir+"/lucene/index";
+	}
+
+	public LuceneTask(Object entity, String oper) {
+		this();
+		this.oper = oper;
+		this.entity = entity;
+	}
+	//删除专用
+	@SuppressWarnings("rawtypes")
+	public LuceneTask(Object id, Class clazz) {
+		this.entity = id;
+		this.clazz = clazz;
+		this.oper="delete";
+	}
+	
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	@Override
+	public void run() {
+		try {
+			
+			
+			if (deleteDocument.equals(oper)) {
+				if(entity instanceof List){
+					LuceneUtils.deleteListDocument(rootdir,(List)entity,clazz);
+				}else{
+					LuceneUtils.deleteDocument(rootdir,entity,clazz);
+				}
+				
+			}else if (updateDocument.equals(oper))  {
+				if(entity instanceof List){
+					 LuceneUtils.updateListDocument(rootdir,(List)entity);
+				}else{
+				   LuceneUtils.updateDocument(rootdir,entity);
+				}
+			}else if (saveDocument.equals(oper))  {
+				if(entity instanceof List){
+					LuceneUtils.saveListDocument(rootdir,(List)entity);
+				}else{
+					LuceneUtils.saveDocument(rootdir,entity);
+				}
+				
+			}
+		} catch (Exception e) {
+			logger.error(e.getLocalizedMessage(),e);
+		}
+
+	}
+
+}

+ 141 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/Base64.java

@@ -0,0 +1,141 @@
+package com.cz.yingpu.frame.util ;
+import sun.misc.BASE64Encoder;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;  
+import java.io.OutputStream;  
+        
+/** 
+  * Base64���빤���� 
+  *  
+  * @author liufeng  
+  * @date 2012-10-11 
+  */ 
+public class Base64 {  
+     private static final char [] legalChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" .toCharArray();  
+        
+     public static String encode( byte [] data) {  
+         int start = 0 ;  
+         int len = data.length;  
+         StringBuffer buf = new StringBuffer(data.length * 3 / 2 );  
+        
+         int end = len - 3 ;  
+         int i = start;  
+         int n = 0 ;  
+        
+         while (i <= end) {  
+             int d = (((data[i]) & 0x0ff ) << 16 ) | (((data[i + 1 ]) & 0x0ff ) << 8 ) | ((data[i + 2 ]) & 0x0ff );  
+        
+             buf.append(legalChars[(d >> 18 ) & 63 ]);  
+             buf.append(legalChars[(d >> 12 ) & 63 ]);  
+             buf.append(legalChars[(d >> 6 ) & 63 ]);  
+             buf.append(legalChars[d & 63 ]);  
+        
+             i += 3 ;  
+        
+             if (n++ >= 14 ) {  
+                 n = 0 ;  
+                 buf.append( " " );  
+             }  
+         }  
+        
+         if (i == start + len - 2 ) {  
+             int d = (((data[i]) & 0x0ff ) << 16 ) | (((data[i + 1 ]) & 255 ) << 8 );  
+        
+             buf.append(legalChars[(d >> 18 ) & 63 ]);  
+             buf.append(legalChars[(d >> 12 ) & 63 ]);  
+             buf.append(legalChars[(d >> 6 ) & 63 ]);  
+             buf.append( "=" );  
+         } else if (i == start + len - 1 ) {  
+             int d = ((data[i]) & 0x0ff ) << 16 ;  
+        
+             buf.append(legalChars[(d >> 18 ) & 63 ]);  
+             buf.append(legalChars[(d >> 12 ) & 63 ]);  
+             buf.append( "==" );  
+         }  
+        
+         return buf.toString();  
+     }  
+        
+     private static int decode( char c) {  
+         if (c >= 'A' && c <= 'Z' )  
+             return (c) - 65 ;  
+         else if (c >= 'a' && c <= 'z' )  
+             return (c) - 97 + 26 ;  
+         else if (c >= '0' && c <= '9' )  
+             return (c) - 48 + 26 + 26 ;  
+         else 
+             switch (c) {  
+             case '+' :  
+                 return 62 ;  
+             case '/' :  
+                 return 63 ;  
+             case '=' :  
+                 return 0 ;  
+             default :  
+                 throw new RuntimeException( "unexpected code: " + c);  
+             }  
+     }  
+        
+     /** 
+      * Decodes the given Base64 encoded String to a new byte array. The byte array holding the decoded data is returned. 
+      */ 
+        
+     public static byte [] decode(String s) {  
+        
+         ByteArrayOutputStream bos = new ByteArrayOutputStream();  
+         try {  
+             decode(s, bos);  
+         } catch (IOException e) {  
+             throw new RuntimeException();  
+         }  
+         byte [] decodedBytes = bos.toByteArray();  
+         try {  
+             bos.close();  
+             bos = null ;  
+         } catch (IOException ex) {  
+             System.err.println( "Error while decoding BASE64: " + ex.toString());  
+         }  
+         return decodedBytes;  
+     }  
+        
+     private static void decode(String s, OutputStream os) throws IOException {  
+         int i = 0 ;  
+        
+         int len = s.length();  
+        
+         while ( true ) {  
+             while (i < len && s.charAt(i) <= ' ' )  
+                 i++;  
+        
+             if (i == len)  
+                 break ;  
+        
+             int tri = (decode(s.charAt(i)) << 18 ) + (decode(s.charAt(i + 1 )) << 12 ) + (decode(s.charAt(i + 2 )) << 6 ) + (decode(s.charAt(i + 3 )));  
+        
+             os.write((tri >> 16 ) & 255 );  
+             if (s.charAt(i + 2 ) == '=' )  
+                 break ;  
+             os.write((tri >> 8 ) & 255 );  
+             if (s.charAt(i + 3 ) == '=' )  
+                 break ;  
+             os.write(tri & 255 );  
+        
+             i += 4 ;  
+         }  
+     }
+
+    public static String encodeBase64URLSafeString(byte[] data){
+
+        String encodeBase64 = new BASE64Encoder().encode(data);
+
+        String safeBase64Str = encodeBase64.replace('+', '-');
+
+        safeBase64Str = safeBase64Str.replace('/', '_');
+
+        safeBase64Str = safeBase64Str.replaceAll("=", "");
+
+        return safeBase64Str;
+
+    }
+} 

+ 28 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/CalculationUtil.java

@@ -0,0 +1,28 @@
+package com.cz.yingpu.frame.util;
+
+import java.math.BigDecimal;
+
+import com.sun.star.lang.NullPointerException;
+
+public class CalculationUtil {
+	//加法
+	public static Double addition(Double d1,Double d2) throws NullPointerException{
+		if(d1==null||d2==null) throw new NullPointerException("用来计算的值不能为null");
+	 return  	new BigDecimal(d1).add(new BigDecimal(d2)).doubleValue();
+	}
+	//减法
+	public static Double subtract(Double d1,Double d2) throws NullPointerException{
+		if(d1==null||d2==null) throw new NullPointerException("用来计算的值不能为null");
+	 return  	new BigDecimal(d1).subtract(new BigDecimal(d2)).doubleValue();
+	}
+	//乘法
+		public static Double multiply(Double d1,Double d2) throws NullPointerException{
+			if(d1==null||d2==null) throw new NullPointerException("用来计算的值不能为null");
+		 return  	new BigDecimal(d1).multiply(new BigDecimal(d2)).doubleValue();
+		}
+		//除法
+		public static Double divide(Double d1,Double d2) throws NullPointerException{
+			if(d1==null||d2==null) throw new NullPointerException("用来计算的值不能为null");
+		 return  	new BigDecimal(d1).divide(new BigDecimal(d2),2,BigDecimal.ROUND_HALF_UP).doubleValue();
+		}
+}

+ 41 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/CaptchaUtils.java

@@ -0,0 +1,41 @@
+package com.cz.yingpu.frame.util;
+import java.awt.image.BufferedImage;
+
+import com.cz.yingpu.frame.util.patchca.service.Captcha;
+import com.cz.yingpu.frame.util.patchca.service.ConfigurableCaptchaService;
+
+public class CaptchaUtils  {
+	private static  ConfigurableCaptchaService cs = new ConfigurableCaptchaService();
+   
+
+	/**
+	 * 生成随机图片
+	 */
+	public static BufferedImage genRandomCodeImage(StringBuffer randomCode) {
+        Captcha captcha = cs.getCaptcha();
+        randomCode.append(captcha.getChallenge());
+        return captcha.getImage();
+		
+		
+	}
+
+	
+/*
+	public static void main(String[] args) {
+	
+		StringBuffer code = new StringBuffer();
+		BufferedImage image = CaptchaUtils.genRandomCodeImage(code);
+		try {
+			// 将内存中的图片通过流动形式输出到客户端
+			ImageIO.write(image, "png", new FileOutputStream(new File(
+					"random-code.png")));
+		} catch (Exception e) {
+			System.out.println(e);
+		}
+
+	}
+*/
+	
+	
+}
+

+ 41 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/CheckSumBuilder.java

@@ -0,0 +1,41 @@
+package com.cz.yingpu.frame.util;
+
+import java.security.MessageDigest;
+
+public class CheckSumBuilder {
+	 // 计算并获取CheckSum
+    public static String getCheckSum(String appSecret, String nonce, String curTime) {
+        return encode("sha1", appSecret + nonce + curTime);
+    }
+
+    // 计算并获取md5值
+    public static String getMD5(String requestBody) {
+        return encode("md5", requestBody);
+    }
+
+    private static String encode(String algorithm, String value) {
+        if (value == null) {
+            return null;
+        }
+        try {
+            MessageDigest messageDigest
+                    = MessageDigest.getInstance(algorithm);
+            messageDigest.update(value.getBytes());
+            return getFormattedText(messageDigest.digest());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+    private static String getFormattedText(byte[] bytes) {
+        int len = bytes.length;
+        StringBuilder buf = new StringBuilder(len * 2);
+        for (int j = 0; j < len; j++) {
+            buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
+            buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
+        }
+        return buf.toString();
+    }
+    private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5',
+            '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
+}

+ 564 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/ClassUtils.java

@@ -0,0 +1,564 @@
+
+/**
+ * 
+ */
+package com.cz.yingpu.frame.util;
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import com.cz.yingpu.frame.annotation.LuceneField;
+import com.cz.yingpu.frame.annotation.LuceneSearch;
+import com.cz.yingpu.frame.annotation.NotLog;
+import com.cz.yingpu.frame.annotation.PKSequence;
+import com.cz.yingpu.frame.annotation.TableSuffix;
+import com.cz.yingpu.frame.annotation.WhereSQL;
+
+
+/**
+* 处理类的工具类. 例如反射
+*
+ * @copyright {@link weicms.net}
+ * @author springrain<Auto generate>
+ * @version  2013-03-19 11:08:15
+ * @see com.cz.yingpu.frame.util.ClassUtils
+*/
+
+public class ClassUtils {
+	
+	
+	//缓存 entity的字段信息
+	public static Map<String,EntityInfo> staticEntitymap=new  ConcurrentHashMap<String,EntityInfo>();
+	//缓存 所有的WhereSql注解
+	public static Map<String, List<WhereSQLInfo>> staticWhereSQLmap=new  ConcurrentHashMap<String, List<WhereSQLInfo>>();
+	//缓存 所有的字段
+	public static Map<String, Set<String>> allFieldmap=new  ConcurrentHashMap<String, Set<String>>();
+	//缓存 所有的数据库字段
+	public static Map<String, List<String>> allDBFieldmap=new  ConcurrentHashMap<String, List<String>>();
+	
+	
+	//缓存 实体类是否进行LuceneSearch
+    public static Map<String,Boolean> luceneSearchmap=new  ConcurrentHashMap<String, Boolean>();
+	
+	//缓存 所有的参与Lucene的字段
+	public static Map<String,List<String>> allLucenemap=new  ConcurrentHashMap<String, List<String>>();
+	
+
+	
+	/**
+	 * 添加一个EntityInfo 信息,用于缓存.
+	 * @param info
+	 * @return
+	 */
+	public static  Map<String,EntityInfo> addEntityInfo(EntityInfo info){
+		if(info==null||info.getClassName()==null){
+			 return null;
+		}
+		staticEntitymap.put(info.getClassName(), info);
+		return staticEntitymap;
+	}
+/**
+ * 根据ClassName获取 EntityInfo
+ * @param className
+ * @return
+ * @throws Exception
+ */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public static EntityInfo getEntityInfoByClass(Class clazz) throws Exception{
+		if(clazz==null)
+			return null;
+		String className=clazz.getName();
+		if(className==null)
+			return null;
+		boolean iskey=staticEntitymap.containsKey(className);
+		if(iskey){
+			return staticEntitymap.get(className);
+		}
+
+		
+		 if((clazz.isAnnotationPresent(Table.class)==false)){
+			 return null;
+		 }
+		
+		String tableName = ClassUtils.getTableNameByClass(clazz);
+		if(tableName==null)
+			return null;
+		EntityInfo info=new EntityInfo();
+		info.setTableName(tableName);
+		info.setClassName(clazz.getName());
+		List<String> fields = ClassUtils.getAllDBFields(clazz);
+    	if(fields==null)
+		return null;
+    	 for(String fdName:fields){
+ 			boolean ispk= isAnnotation(clazz,fdName,Id.class);
+ 			if(ispk==true){
+ 				info.setPkName(fdName);
+ 			  boolean isSequence=	 isAnnotation(clazz,fdName,PKSequence.class);
+ 			 Class returnType = getReturnType(fdName, clazz);
+ 			info.setPkReturnType(returnType);
+ 			  if(isSequence){
+ 					PropertyDescriptor pd = new PropertyDescriptor(fdName, clazz);
+ 					Method getMethod = pd.getReadMethod();// 获得get方法
+ 					PKSequence sequenceAnnotation = getMethod.getAnnotation(PKSequence.class);
+ 					info.setPksequence(sequenceAnnotation.name());
+ 			  }
+ 				break;
+ 			}
+ 		 }
+    	
+    	
+   	 if(clazz.isAnnotationPresent(TableSuffix.class)){
+   		info.setSharding(true);
+	 }
+ 	 if(clazz.isAnnotationPresent(NotLog.class)){
+    		info.setNotLog(true);
+ 	 }
+   	     	staticEntitymap.put(className,info);
+		return staticEntitymap.get(className);
+	}
+	/**
+	 * 根据对象获取Entity信息,主要是为了获取分表的信息
+	 * @param o
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public static EntityInfo getEntityInfoByEntity(Object o) throws Exception{
+		if(o==null)
+			return null;
+		Class clazz=o.getClass();
+		EntityInfo info=getEntityInfoByClass(clazz);
+		if(info==null){
+			return null;
+		}
+		String tableExt=getTableExt(o);
+		info.setTableSuffix(tableExt);
+		return info;
+	}
+
+	
+	
+	/**
+	 * 根据ClassName获取wheresql 注解的类信息
+	 * @param className
+	 * @return
+	 * @throws Exception 
+	 * @throws ClassNotFoundException 
+	 */
+	@SuppressWarnings("rawtypes")
+	public static List<WhereSQLInfo> getWhereSQLInfo(Class clazz) throws  Exception{
+		if(clazz==null)
+			return null;
+		String className=clazz.getName();
+		if(StringUtils.isBlank(className)){
+			return null;
+		}
+		
+		boolean iskey=staticWhereSQLmap.containsKey(className);
+		if(iskey){
+			return staticWhereSQLmap.get(className);
+		}
+		Set<String> names = getAllFieldNames(clazz);
+		if(CollectionUtils.isEmpty(names))
+			return null;
+		
+		 List<WhereSQLInfo>  wheresql=new ArrayList<WhereSQLInfo> ();
+		for(String name:names){
+			boolean isWhereSQL= isAnnotation(clazz,name,WhereSQL.class);
+			if(isWhereSQL==false){
+				continue;
+			}
+			
+			PropertyDescriptor pd = new PropertyDescriptor(name, clazz);
+			Method getMethod = pd.getReadMethod();// 获得get方法
+			
+			WhereSQL ws= getMethod.getAnnotation(WhereSQL.class);
+			WhereSQLInfo info=new WhereSQLInfo();
+			info.setName(name);
+			info.setWheresql(ws.sql());
+			wheresql.add(info);
+		}
+		
+		return wheresql;
+		
+	}
+	
+	
+	
+	
+
+	/**
+	 * 获取一个类的所有属性名称,包括继承的父类
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public static Set<String> getAllFieldNames(Class clazz) throws Exception{
+		if(clazz==null){
+			return null;
+		}
+		String className=clazz.getName();
+		boolean iskey=allFieldmap.containsKey(className);
+		if(iskey){
+		 return  allFieldmap.get(className);
+		}
+		Set<String>	allSet=new HashSet<String>();
+		allSet=	recursionFiled(clazz,allSet);
+		allFieldmap.put(className, allSet);
+		return allSet;
+	}
+	
+	
+	
+	
+	/**
+	 * 获取所有数据库的类字段对应的属性
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public static List<String> getAllDBFields(Class clazz) throws Exception{
+		
+		if(clazz==null){
+			return null;
+		}
+		String className=clazz.getName();
+		boolean iskey=allDBFieldmap.containsKey(className);
+		if(iskey){
+			return allDBFieldmap.get(className);
+		}
+		
+		Set<String> allNames = getAllFieldNames(clazz);
+     if(CollectionUtils.isEmpty(allNames))
+    	 return null;
+    
+     List<String>   dbList=new ArrayList<String>();
+	 for(String fdName:allNames){
+		boolean isDB= isAnnotation(clazz,fdName,Transient.class);
+		if(isDB==false){
+			dbList.add(fdName);
+		}
+	 }
+	 allDBFieldmap.put(className, dbList);
+		return dbList;
+	}
+	
+	
+	/**
+	 * 获取所有标注的lucene标注的字段,LuceneSearch标注为实体类使用了Lucene,LuceneField为字段进行了索引
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public static List<String> getLuceneFields(Class clazz) throws Exception{
+		
+		if(clazz==null){
+			return null;
+		}
+		//检测
+		
+		//取消检测,增加手动模式
+		
+		// if(!clazz.isAnnotationPresent(LuceneSearch.class)){
+		//   		return null;
+		//}
+		String className=clazz.getName();
+		boolean iskey=allLucenemap.containsKey(className);
+		if(iskey){
+			return allLucenemap.get(className);
+		}
+		
+		Set<String> allNames = getAllFieldNames(clazz);
+     if(CollectionUtils.isEmpty(allNames))
+    	 return null;
+    
+     List<String>   luceneList=new ArrayList<String>();
+	 for(String fdName:allNames){
+		boolean isLuceneField= isAnnotation(clazz,fdName,LuceneField.class);
+		if(isLuceneField){
+			luceneList.add(fdName);
+		}
+	 }
+	     allLucenemap.put(className, luceneList);
+		return luceneList;
+	}
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	/**
+	 * clazz 属性 fd 的 getReadMethod() 是否包含 注解 annotationName
+	 * @param clazz
+	 * @param fdName
+	 * @param annotationClass
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public static boolean isAnnotation(Class clazz,String fdName,Class annotationClass) throws Exception{
+		
+		if(clazz==null||fdName==null||annotationClass==null)
+			return false;
+		PropertyDescriptor pd = new PropertyDescriptor(fdName, clazz);
+		Method getMethod = pd.getReadMethod();// 获得get方法
+		return getMethod.isAnnotationPresent(annotationClass);
+		
+	}
+	
+	/**
+	 * 获取 Class 的@Table注解 name 属性,没有属性则返回 类名
+	 * @param clazz
+	 * @return
+	 * @throws Exception 
+	 */
+	@SuppressWarnings("rawtypes")
+	public static String  getTableName(Object object) throws Exception{
+		
+		if(object==null)
+			return null;
+	   String tableName=null;
+	   
+		if(object instanceof Class){
+		EntityInfo entityInfo = getEntityInfoByClass((Class)object);
+		tableName=entityInfo.getTableName();
+		}else{
+			EntityInfo entityInfoByEntity = ClassUtils
+					.getEntityInfoByEntity(object);
+			 tableName = entityInfoByEntity.getTableName();
+			String tableExt = entityInfoByEntity.getTableSuffix();
+			if (StringUtils.isNotBlank(tableExt)) {
+				tableName = tableName + tableExt;
+			}
+		}
+		
+
+		if(tableName==null){
+			return object.getClass().getSimpleName();
+		}
+		
+			return tableName;
+		
+	}
+	
+	
+	/**
+	 * 获取 Class 的@Table注解 name 属性,没有属性则返回 类名
+	 * @param clazz
+	 * @return
+	 */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public static String  getTableNameByClass(Class clazz){
+		
+		if(clazz==null)
+			return null;
+		
+		 if((clazz.isAnnotationPresent(Table.class)==false))
+			 return clazz.getSimpleName();
+		 
+		Table table= (Table) clazz.getAnnotation(Table.class);
+		
+		String tableName=table.name();
+		if(tableName==null)
+			return clazz.getSimpleName();
+			return tableName;
+		
+	}
+	
+	
+	
+	/**
+	 * 获取数据库分表的后缀
+	 * @param o
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	public static String getTableExt(Object o) throws Exception{
+		Class clazz=o.getClass();
+		if(clazz.isAnnotationPresent(TableSuffix.class)==false)
+			return "";
+		
+		TableSuffix group =	(TableSuffix)clazz.getAnnotation(TableSuffix.class);
+		String p=group.name();
+		String  tableExt= (String) getPropertieValue(p, o);
+		return tableExt;
+		
+	}
+	
+	
+	
+	/**
+	 * 递归查询父类的所有属性,set 去掉重复的属性
+	 * @param clazz
+	 * @param fdNameSet
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	private static  Set<String> recursionFiled(Class clazz,Set<String> fdNameSet) throws Exception {
+		Field[] fds = clazz.getDeclaredFields();
+		for (int i = 0; i < fds.length; i++) {
+			Field fd = fds[i];
+			fdNameSet.add(fd.getName());
+		}
+		Class superClass = clazz.getSuperclass();
+		if (superClass != Object.class) {
+			recursionFiled(superClass,fdNameSet);
+		}
+		return fdNameSet;
+	}
+	
+	
+	/**
+	 * 获得主键的值
+	 * @param clazz
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public static Object getPKValue(Object o) throws Exception{
+		Class clazz=o.getClass();
+	     String id=getEntityInfoByClass(clazz).getPkName();
+		return getPropertieValue(id,o) ;
+			
+	}
+	
+	/**
+	 * 获取一个实体类的属性值
+	 * @param p
+	 * @param o
+	 * @return
+	 * @throws Exception
+	 */
+	public static Object getPropertieValue(String p,Object o) throws Exception{
+		Object _obj=null;
+		for(Class<?> clazz = o.getClass(); clazz != Object.class;  clazz = clazz.getSuperclass()) {
+			try{
+			 PropertyDescriptor pd = new PropertyDescriptor(p, clazz);
+				Method getMethod = pd.getReadMethod();// 获得get方法
+				if(getMethod!=null){
+					_obj= getMethod.invoke(o);
+					break;
+				}
+			}catch(Exception e){
+				return null;
+			}
+			
+		}
+		
+		return _obj;
+		
+	}
+	/**
+	 * 设置实体类的属性值
+	 * @param p
+	 * @param o
+	 * @return
+	 * @throws Exception
+	 */
+	public static Object setPropertieValue(String p,Object o,Object value) throws Exception{
+		Object _obj=null;
+		for(Class<?> clazz = o.getClass(); clazz != Object.class;  clazz = clazz.getSuperclass()) {
+			 PropertyDescriptor pd = new PropertyDescriptor(p, clazz);
+				Method setMethod = pd.getWriteMethod();// 获得set方法
+				if(setMethod!=null){
+					setMethod.invoke(o, value);  
+					break;
+				}
+			
+		}
+		
+		return _obj;
+		
+	}
+	
+	/**
+	 * 获取字段的返回类型
+	 * @param p
+	 * @param o
+	 * @return
+	 * @throws Exception
+	 */
+	@SuppressWarnings("rawtypes")
+	public static Class getReturnType(String p,Class _clazz) throws Exception{
+		
+		Class  returnType=null;
+		for(Class<?> clazz = _clazz; clazz != Object.class;  clazz = clazz.getSuperclass()) {
+			 PropertyDescriptor pd = new PropertyDescriptor(p, clazz);
+				Method getMethod = pd.getReadMethod();// 获得get方法
+				if(getMethod!=null){
+					returnType= getMethod.getReturnType();
+					break;
+				}
+			
+		}
+		
+		return returnType;
+	}
+	
+	/**
+	 * 是否是java的基本类型
+	 * @param clazz
+	 * @return
+	 */
+	@SuppressWarnings("rawtypes")
+	public static  boolean isBaseType(Class clazz){
+		if(clazz==null){
+			return false;
+		}
+		String className=clazz.getName().toLowerCase();
+		if(className.startsWith("java.")){
+			return true;
+		}else{
+			return false;
+		}
+	}
+	
+	
+	//实体类是否进行Lucene检索
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public static boolean isLuceneSearch(Class clazz) throws Exception{
+		if(clazz==null)
+			return false;
+		String className=clazz.getName();
+		if(className==null){
+			return false;
+		}
+			
+		boolean iskey=luceneSearchmap.containsKey(className);
+		if(iskey){
+			return luceneSearchmap.get(className);
+		}
+
+		boolean isLuceneSearch=clazz.isAnnotationPresent(LuceneSearch.class);
+		luceneSearchmap.put(className,isLuceneSearch );
+		return isLuceneSearch;
+		
+	}
+	
+	
+	
+	
+}

+ 25 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/CookieUtils.java

@@ -0,0 +1,25 @@
+package com.cz.yingpu.frame.util;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+
+public class CookieUtils {
+
+	public static String getCookieValue(HttpServletRequest request,String key){
+		Cookie[] cookies = request.getCookies();
+		
+		if(cookies==null){
+			return null;
+		}
+		
+		
+		for (Cookie cookie:cookies) {
+			if(cookie.getName().equalsIgnoreCase(key)){ //获取键 
+			    return cookie.getValue();    //获取值 
+			}
+		}
+		
+		
+		return null;
+	}
+}

+ 309 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/CopyUtil.java

@@ -0,0 +1,309 @@
+package com.cz.yingpu.frame.util;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/*********************************************
+ * 	<p>
+ *  进行对象复制的类       
+ *  </p>
+ *  <p>                                                                   
+ *  对象复制不仅仅局限于同一类型,不同类型之间也可以复制     
+ *  </p>   
+ *  <p>
+ *  eg.1<br/>
+ *  A aClass = new A();<br/>
+ *  B bClass = new B();<br/>
+ *  CopyUtil.copyClass(bClass,aClass);
+ *  </p>
+ *  <p>
+ *  eg.2<br/>
+ *  A aClass = new A();<br/>
+ *  B bClass = (B) CopyUtil.copyAndCreate(B.class, aClass);
+ *  </p>
+ *  
+ *********************************************/
+
+public class CopyUtil {
+	String a = new String();
+	/*********************************************
+	 * 复制classA的属性值给classB,两个对象可以是不同的       
+	 * 类型,但是对应的字段要一样.    
+	 * @param   classB     复制到的对象.  
+	 * @param   classA     被复制的对象.    
+	 * @param   extend     附加参数
+	 * 
+	 * <p>
+	 * 对象值的对拷方法的附加参数:extend
+	 * <br />
+	 * 形式1: ["field1"[,"field2"[,field3...]]] :和lefeJoin联合使用的时候,只拷贝附加参数内的值,如果没有leftJoin,则排除附加参数内的值
+	 * <br />
+	 * 形式2: ["|leftJoin|"]
+	 * <br />
+	 * eg1: CopyUtil.copyClass(a,b,"username","password");
+	 * <br />
+	 * result: a.username = null , a.password = null;
+	 * <br />
+	 * eg2: CopyUtil.copyClass(a,b,"username","password","|leftJoin|");
+	 * <br />
+	 * result: a.username != null, a.password != null;
+	 * <br />
+	 * 形式3: ["|enableLike|"] 
+	 * <br />
+	 * eg3:CopyUtil.copyClass(a,b,"|enableLike|");
+	 * <br />
+	 * result: a.username == "%tommy%"
+	 * <br />
+	 * 形式4: ["star=precision2"]:对某一个数据进行经度的格式化 
+	 * <br />
+	 * eg4:CopyUtil.copyClass(a,b,"star=precision2");
+	 * <br />
+	 * result: a.star = 3.23
+	 * <br />
+	 * 形式5: "name->username" :在拷贝的过程中进行域名的转化
+	 * <br />
+	 * eg5:CopyUtil.copyClass(a,b,"name->username");
+	 * <br />
+	 * result: a.username == b.name
+	 * </p>
+	 * @throws ParseException
+	 * class A name , phone 
+	 * class B name , phone 
+	 * 
+	 *
+	 * 
+	 * 
+	 * 
+	*********************************************/
+	public static Object copyClass(Object classB , Object classA , String ... extend) throws IllegalAccessException, ParseException {
+		if(null == classA) {classB = null;return null;}
+		Field[] fields = classA.getClass().getDeclaredFields();
+		Field field = null;
+		Boolean enableLike = false;
+		Boolean leftJoin = false;
+		Boolean forced = false;
+		Boolean noNull = false;
+		for(String e:extend){
+			if("|enableLike|".equals(e)){
+				enableLike = true;
+			}
+			if("|leftJoin|".equals(e)){
+				leftJoin = true;
+			}
+			
+			if("|forced|".equals(e)){
+				forced = true;
+			}
+			
+			if("|noNull|".equals(e)){
+				noNull = true;
+			}
+			
+		}
+		for (int i = 0; i < fields.length; i++) {
+			String name = fields[i].getName();
+			Boolean pass = false;
+			Integer precision = -1; //默认精度-1
+			String precisionName = null;
+			for (String e : extend) {
+				pass = false;
+				if(e.contains("->")){
+					String[] kv = e.split("->");
+					if(name.equals(kv[0])){
+						name = kv[1];
+						break;
+					}
+				}
+				if(leftJoin){
+					pass = true;
+					if(name.equals(e)){
+						pass = false;
+						break;
+					}
+				}else{
+					pass = false;
+					if(name.equals(e)){
+						pass = true;
+						break;
+					}
+				}
+				//形式:star=precision2:对star做精确度为2的格式化,四舍五入
+				if(e.contains("precision")){
+					String subStr = e.substring(e.indexOf("=precision") + 10, e.length());
+					precision = Integer.parseInt(subStr);
+					precisionName = e.substring(0,e.indexOf("=precision"));
+					if(name.equals(precisionName)) break;
+				}
+			}
+			if(pass) continue;
+			try{
+				field = classB.getClass().getDeclaredField(name);
+			}catch(NoSuchFieldException e){
+				continue;
+			}
+			field.setAccessible(true);
+			fields[i].setAccessible(true);
+			
+			
+			Object value = fields[i].get(classA);
+			
+			if(noNull && null == value) continue; //如果禁止null出现,进入下次循环
+			
+			if(forced){ //如果进行强制类型转化
+				if(fields[i].getType().getName().equals("java.lang.String")){ 
+					if(field.getType().getName().equals("java.lang.Integer")){//如果是string转化为int
+						if(value==null || "".equals(value))	continue;
+						value = Integer.parseInt((String)value);
+					}
+					if(field.getType().getName().equals("java.lang.Double")){
+						if(value==null || "".equals(value)) continue;
+						value = Double.parseDouble((String)value);
+					}
+					if(field.getType().getName().equals("java.lang.Boolean")){
+						if(value==null) continue;
+						if(value.equals("0") || "".equals(value) || "false".equalsIgnoreCase((String)value)) value = false;
+						else value = true;
+					}
+					if(field.getType().getName().equals("java.util.Date")){  //如果是string转化为Date
+						if(value==null) continue;
+						try{
+							SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+							value = sdf.parse((String)value);
+						}catch(Exception e){
+							try{
+								SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
+								value = sdf.parse((String)value);
+							}catch(Exception ex){
+								try{
+									SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+									value = sdf.parse((String)value);
+								}catch(Exception exp){
+									SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
+									Date date = sdf.parse((String)value);
+									value = new Date(date.getTime() + 60 * 1000 * 60 * 24);  //为了防止出现 1970-01-01 07:30 以及以前时间的状况,在原有时间基础上加一天
+								}
+							} 
+						}
+					}
+				}
+			}
+			
+			if(enableLike && (value instanceof String)){
+				value = "%" + (String)value + "%";
+			}
+			//形式:star=precision2:对star做精确度为2的格式化,四舍五入
+			if(precision > -1 && name.equals(precisionName) && (value instanceof Double)){
+				Double f =  (Double) value;
+				BigDecimal bigDecimal = new BigDecimal(f); 
+				value = bigDecimal.setScale(precision,BigDecimal.ROUND_HALF_UP).doubleValue(); 
+			}
+		
+			field.set(classB,value);
+		}
+		return classB;
+	}
+	
+	/*********************************************
+	 * 首先创建目标对象,然后将classA的属性值复制给目标对象    
+	 * 可以是不同类型,但是对应的字段要一样.     
+	 * @param   target     要复制的对象的类型.         
+	 * @param   classA     被复制的对象.        
+	 * @throws ParseException 
+	 * 
+	 *********************************************/
+	public static Object copyAndCreate(Class target, Object classA ,String ... extend) throws IllegalAccessException,InstantiationException,NoSuchFieldException, ParseException{
+		if(classA == null) return null;
+		Object classB = target.newInstance();
+		copyClass(classB,classA,extend);
+		return classB;
+	}
+	
+	/*********************************************
+	 * 首先创建目标对象,然后将classA的属性值复制给目标对象    
+	 * 可以是不同类型,但是对应的字段要一样.     
+	 * @param   target     要复制的对象的类型.         
+	 * @param   classA     被复制的对象.        
+	 * @throws ParseException 
+	 *********************************************/
+	public static List copyAndCreateList(Class target,List listA,String ... extend) throws  IllegalAccessException,InstantiationException,NoSuchFieldException, ParseException{
+		List listB = new ArrayList();
+		if(listA == null || listA.size() == 0) return listB;
+		
+		for (Object classA : listA) {
+			Object classB = target.newInstance();
+			copyClass(classB,classA, extend);
+			listB.add(classB);
+		}
+		return listB;
+	}
+	
+	/*********************************************
+	 * 首先创建目标对象,然后将classA的属性值复制给目标对象    
+	 * 可以是不同类型,但是对应的字段要一样.     
+	 * @param   target     要复制的对象的类型.         
+	 * @param   classA     被复制的对象.        
+	 * @throws ParseException 
+	 *********************************************/
+	public static Set copyAndCreateSet(Class target,Set listA) throws  IllegalAccessException,InstantiationException,NoSuchFieldException, ParseException{
+		Set setB = new HashSet();
+		if(listA == null || listA.size() == 0) return setB;
+		
+		for (Object classA : listA) {
+			Object classB = target.newInstance();
+			copyClass(classB,classA);
+			setB.add(classB);
+		}
+		return setB;
+	}
+	
+	/**
+	 * 清空一个对象内部的数据
+	 * @param o
+	 * @throws IllegalArgumentException
+	 * @throws IllegalAccessException
+	 */
+	public static void clearObj(Object o) throws IllegalArgumentException, IllegalAccessException {
+		Field[] fields = o.getClass().getDeclaredFields();
+		for (Field field : fields) {
+			//如果是静态变量,则跳过
+			if(Modifier.isStatic(field.getModifiers())) continue;
+			field.setAccessible(true);
+			field.set(o,null);
+		}
+	}
+
+	/**
+	 * 为一个对象的某个field赋值
+	 * @param target
+	 * @param o
+	 * @param field
+	 * @throws SecurityException 
+	 * @throws NoSuchFieldException 
+	 * @throws IllegalAccessException 
+	 * @throws IllegalArgumentException 
+	 */
+	public static void putValue(Object target,Object o,String fieldName) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException{
+		Field field = target.getClass().getDeclaredField(fieldName);
+		if(field!=null){
+			field.setAccessible(true);
+			field.set(target,o);
+		}
+	}
+	
+	
+	public static void main(String[] args) throws ParseException {
+		String aa = "07:30";
+		SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
+		Date value = sdf.parse(aa);
+		System.out.println(value);
+	}
+	
+}

+ 76 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/CryptAES.java

@@ -0,0 +1,76 @@
+package com.cz.yingpu.frame.util;
+
+import org.apache.commons.codec.binary.Base64;
+
+import java.security.Key;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * php与java通用AES加密解密算法
+ * AES指高级加密标准(Advanced Encryption Standard),是当前最流行的一种密码算法,在web应用开发,特别是对外提供接口时经常会用到,
+ * 下面是整理的一套php与java通用的AES加密解密算法。
+ * @author Administrator
+ *
+ */
+public class CryptAES {
+	
+	private static final String AESTYPE ="AES/ECB/PKCS5Padding";
+	private static final  String keyStr = "UITN25LMUQC436IM";
+	 
+	/**
+	 * 加密方法
+	 * @param plainText
+	 * @return
+	 */
+    public static String AES_Encrypt(String plainText) {
+        byte[] encrypt = null;
+        try{
+            Key key = generateKey(keyStr);
+            Cipher cipher = Cipher.getInstance(AESTYPE);
+            cipher.init(Cipher.ENCRYPT_MODE, key);
+            encrypt = cipher.doFinal(plainText.getBytes());    
+        }catch(Exception e){
+            e.printStackTrace();
+        }
+        return new String(Base64.encodeBase64(encrypt));
+    }
+ 
+    /**
+     * 解密方法
+     * @param encryptData
+     * @return
+     */
+    public static String AES_Decrypt(String encryptData) {
+        byte[] decrypt = null;
+        try{
+            Key key = generateKey(keyStr);
+            Cipher cipher = Cipher.getInstance(AESTYPE);
+            cipher.init(Cipher.DECRYPT_MODE, key);
+            decrypt = cipher.doFinal(Base64.decodeBase64(encryptData));
+        }catch(Exception e){
+            e.printStackTrace();
+        }
+        return new String(decrypt).trim();
+    }
+ 
+    private static Key generateKey(String key)throws Exception{
+        try{           
+            SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES");
+            return keySpec;
+        }catch(Exception e){
+            e.printStackTrace();
+            throw e;
+        }
+    }
+
+    public static void main(String[] args) {
+        String plainText = "NemfhxNmMMFj1hUGFWutog==";
+        //String encText = AES_Encrypt(plainText);
+       // String decString = AES_Decrypt(plainText);
+//        
+     //   System.out.println(encText);
+        System.out.println(AES_Decrypt(plainText));
+    } 
+}

+ 46 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/DBUtils.java

@@ -0,0 +1,46 @@
+package com.cz.yingpu.frame.util;
+
+import java.io.File;
+import java.util.Date;
+
+public class DBUtils {
+ private String backupcmd;
+ private String backupfilepath;
+ private String restorecmd;
+public String getBackupcmd() {
+	return backupcmd;
+}
+public void setBackupcmd(String backupcmd) {
+	this.backupcmd = backupcmd;
+}
+public String getBackupfilepath() {
+	return backupfilepath;
+}
+public void setBackupfilepath(String backupfilepath) {
+	this.backupfilepath = backupfilepath;
+}
+public String getRestorecmd() {
+	return restorecmd;
+}
+public void setRestorecmd(String restorecmd) {
+	this.restorecmd = restorecmd;
+}
+
+public File backupFile() throws Exception{
+	Date now=new Date();
+	String s=DateUtils.convertDate2String("yyyy-MM-dd_HH-mm-ss_SSS", now);
+	String filepath=backupfilepath+s+".sql";
+	String cmd=backupcmd+filepath;
+	Runtime rt = Runtime.getRuntime();    
+	Process proc = rt.exec(cmd);
+	if(proc.waitFor()==0){
+      File f=new File(filepath);
+      return f;
+	}else{
+		return null;
+	}
+	
+}
+
+	
+}

+ 59 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/DateTypeEditor.java

@@ -0,0 +1,59 @@
+package com.cz.yingpu.frame.util;
+
+import java.beans.PropertyEditorSupport;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.springframework.util.StringUtils;
+
+/**
+ * 日期编辑器
+ * 
+ * 根据日期字符串长度判断是长日期还是短日期。只支持yyyy-MM-dd,yyyy-MM-dd HH:mm:ss两种格式。
+ * 扩展支持yyyy,yyyy-MM日期格式
+ */
+public class DateTypeEditor extends PropertyEditorSupport {
+	/**
+	 * 短类型日期长度
+	 */
+	public static final int SHORT_DATE = 10;
+	
+	public static final int YEAR_DATE = 4;
+	
+	public static final int MONTH_DATE = 7;
+
+	@Override
+	public void setAsText(String text) throws IllegalArgumentException {
+		text = text.trim();
+		if (!StringUtils.hasText(text)) {
+			setValue(null);
+			return;
+		}
+		try {
+			if (text.length() <= YEAR_DATE) {
+				setValue(new SimpleDateFormat("yyyy").parse(text));
+			}else  if (text.length() <= MONTH_DATE) {
+				setValue(new SimpleDateFormat("yyyy-MM").parse(text));
+			}else if (text.length() <= SHORT_DATE) {
+				setValue(new SimpleDateFormat("yyyy-MM-dd").parse(text));
+			} else {
+				setValue(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(text));
+			}
+		} catch (ParseException ex) {
+			IllegalArgumentException iae = new IllegalArgumentException(
+					"Could not parse date: " + ex.getMessage());
+			iae.initCause(ex);
+			throw iae;
+		}
+	}
+
+	/**
+	 * Format the Date as String, using the specified DateFormat.
+	 */
+	@Override
+	public String getAsText() {
+		Date value = (Date) getValue();
+		return (value != null ? new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(value) : "");
+	}
+}

Файловите разлики са ограничени, защото са твърде много
+ 1055 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/DateUtils.java


+ 69 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/Des3.java

@@ -0,0 +1,69 @@
+package com.cz.yingpu.frame.util;
+
+import java.security.Key;  
+
+import javax.crypto.Cipher;  
+import javax.crypto.SecretKeyFactory;  
+import javax.crypto.spec.DESedeKeySpec;  
+import javax.crypto.spec.IvParameterSpec;  
+        
+/** 
+  * 3DES加密工具类 
+  *  
+  * @author wangjing  
+  * @date 2016-07-05 
+  */ 
+public class Des3 {  
+     // 密钥  
+     private final static String secretKey = "liuyunqiang@lx100$#365#$" ;  
+     // 向量  
+     private final static String iv = "01234567" ;  
+     // 加解密统一使用的编码方式  
+     private final static String encoding = "utf-8" ;  
+        
+     /** 
+      * 3DES加密 
+      *  
+      * @param plainText 普通文本 
+      * @return 
+      * @throws Exception  
+      */ 
+     public static String encode(String plainText) throws Exception {  
+         Key deskey = null ;  
+         DESedeKeySpec spec = new DESedeKeySpec(secretKey.getBytes());  
+         SecretKeyFactory keyfactory = SecretKeyFactory.getInstance( "desede" );  
+         deskey = keyfactory.generateSecret(spec);  
+        
+         Cipher cipher = Cipher.getInstance( "desede/CBC/PKCS5Padding" );  
+         IvParameterSpec ips = new IvParameterSpec(iv.getBytes());  
+         cipher.init(Cipher.ENCRYPT_MODE, deskey, ips);  
+         byte [] encryptData = cipher.doFinal(plainText.getBytes(encoding));  
+         return Base64.encode(encryptData);  
+     }  
+        
+     /** 
+      * 3DES解密 
+      *  
+      * @param encryptText 加密文本 
+      * @return 
+      * @throws Exception 
+      */ 
+     public static String decode(String encryptText) throws Exception {  
+         Key deskey = null ;  
+         DESedeKeySpec spec = new DESedeKeySpec(secretKey.getBytes());  
+         SecretKeyFactory keyfactory = SecretKeyFactory.getInstance( "desede" );  
+         deskey = keyfactory.generateSecret(spec);  
+         Cipher cipher = Cipher.getInstance( "desede/CBC/PKCS5Padding" );  
+         IvParameterSpec ips = new IvParameterSpec(iv.getBytes());  
+         cipher.init(Cipher.DECRYPT_MODE, deskey, ips);  
+        
+         byte [] decryptData = cipher.doFinal(Base64.decode(encryptText));  
+        
+         return new String(decryptData, encoding);  
+     }  
+     
+     public static void main(String[] args) throws Exception {
+    	 String c = "wx6yqMfzbfDvfGGlGclgXc4mMKV8ob5GIwAprXmvd7mpJ38ML+coxIZ7FF8p*SqGsm4UnUnXQxJBs37jim3SOaayb6k1kZhRy6lQ+DJ09iTH1k8XrpPeKsQHi*xN5oWUXN0Yg/q3tviUsX6eXv8FtGXczNJJr3EGW3";
+    	 System.out.println(decode(c));    
+	}
+} 

+ 122 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/EntityInfo.java

@@ -0,0 +1,122 @@
+package com.cz.yingpu.frame.util;
+
+import java.util.Map;
+/**
+* 记录缓存数据库一个表对应的Entity的信息
+*
+ * @copyright {@link weicms.net}
+ * @author springrain<Auto generate>
+ * @version  2013-03-19 11:08:15
+ * @see org.springrain.frame.util.EntityInfo
+*/
+public class EntityInfo {
+	
+	private String tableName=null;
+	private String className=null;
+	private String filedsName=null;
+	private String tableSuffix="";
+	private Map<String,String> sqlmap=null;
+
+	private Class<?> pkReturnType;
+	
+	
+	private String pkName=null;
+
+	//是否分表
+	private boolean sharding=false;
+	/**
+	 * 主键序列
+	 */
+	private String pksequence=null;
+	/**
+	 * 是否不记录日志,默认false 为记录
+	 */
+	private boolean notLog=false;
+	
+	
+	/**
+	 * 数据库的表名
+	 * @return
+	 */
+	public String getTableName() {
+		return tableName;
+	}
+	public void setTableName(String tableName) {
+		this.tableName = tableName;
+	}
+	/**
+	 * 数据库表映射的实体类名
+	 * @return
+	 */
+	public String getClassName() {
+		return className;
+	}
+	public void setClassName(String className) {
+		this.className = className;
+	}
+	/**
+	 * 获取表所有的字段名,用 , 隔开
+	 * @return String
+	 */
+	public String getFiledsName() {
+		return filedsName;
+	}
+	public void setFiledsName(String filedName) {
+		this.filedsName = filedName;
+	}
+	
+	/**
+	 * 数据库分表的后缀名 例如 _history_2012
+	 * @return
+	 */
+	public String getTableSuffix() {
+		return tableSuffix;
+	}
+	public void setTableSuffix(String tableSuffix) {
+		this.tableSuffix = tableSuffix;
+	}
+	/**
+	 * 获取table主键对应Enitty属性名称
+	 * @return String
+	 */
+	public String getPkName() {
+		return pkName;
+	}
+	public void setPkName(String pkName) {
+		this.pkName = pkName;
+	}
+	public Map<String, String> getSqlmap() {
+		return sqlmap;
+	}
+	public void setSqlmap(Map<String, String> sqlmap) {
+		this.sqlmap = sqlmap;
+	}
+	public boolean isSharding() {
+		return sharding;
+	}
+	public void setSharding(boolean sharding) {
+		this.sharding = sharding;
+	}
+	public String getPksequence() {
+		return pksequence;
+	}
+	public void setPksequence(String pksequence) {
+		this.pksequence = pksequence;
+	}
+	public boolean isNotLog() {
+		return notLog;
+	}
+	public void setNotLog(boolean notLog) {
+		this.notLog = notLog;
+	}
+	@SuppressWarnings("rawtypes")
+	public Class getPkReturnType() {
+		return pkReturnType;
+	}
+	@SuppressWarnings("rawtypes")
+	public void setPkReturnType(Class pkReturnType) {
+		this.pkReturnType = pkReturnType;
+	}
+
+
+}

+ 131 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/Enumerations.java

@@ -0,0 +1,131 @@
+package com.cz.yingpu.frame.util;
+
+public class Enumerations {
+	
+	public enum OrgType{
+		部门(1),虚拟权限组(2),站长部门(10),微信订阅服务号(11),企业号(12),PC站(13),wap站(14),投票(15);
+		int type;
+		private OrgType(Integer type){
+			this.type = type;
+		}
+		
+		public int getType() {
+			return type;
+		}
+		
+		public static OrgType getOrgType(Integer type){
+			switch (type) {
+				case 1:
+					return 部门;
+				case 2:
+					return 虚拟权限组;
+				case 10:
+					return 站长部门;
+				case 11:
+					return 微信订阅服务号;
+				case 12:
+					return 企业号;
+				case 13:
+					return PC站;
+				case 14:
+					return wap站;
+				case 15:
+					return 投票;
+				default:
+					return null;
+			}
+		}
+		
+		public static OrgType getOrgTypeByName(String name){
+			if("微信订阅服务号".equals(name))
+				return 微信订阅服务号;
+			else if("wap站".equals(name))
+				return wap站;
+			else if("PC站".equals(name))
+				return PC站;
+			else if("企业号".equals(name))
+				return 企业号;
+			else if("投票".equals(name))
+				return 投票;
+			else 
+				return null;
+		}
+	}
+	public enum UserOrgType{
+		会员(0),员工(10),主管(11),代理主管(12),虚拟主管(13);
+		int type;
+		private UserOrgType(Integer type){
+			this.type = type;
+		}
+		
+		public int getType() {
+			return type;
+		}
+		
+		public static UserOrgType getUserOrgType(Integer type){
+			switch (type) {
+				case 0:
+					return 会员;
+				case 10:
+					return 员工;
+				case 11:
+					return 主管;
+				case 12:
+					return 代理主管;
+				case 13:
+					return 虚拟主管;
+				default:
+					return null;
+			}
+		}
+		
+		public static UserOrgType getUserOrgTypeByName(String name){
+			if("会员".equals(name))
+				return 会员;
+			else if("员工".equals(name))
+				return 员工;
+			else if("主管".equals(name))
+				return 主管;
+			else if("代理主管".equals(name))
+				return 代理主管;
+			else if("虚拟主管".equals(name))
+				return 虚拟主管;
+			else 
+				return null;
+		}
+	}
+	
+	/**
+	 * @author Administrator
+	 * 站点类型
+	 */
+	public enum SiteType{
+		mp(11),cp(12),pc(13),wap(14),poll(15);
+		int type;
+		
+		private SiteType(Integer type) {
+			this.type = type;
+		}
+		
+		public static SiteType getSiteType(int type){
+			switch (type) {
+				case 11:
+					return mp;
+				case 12:
+					return cp;
+				case 13:
+					return pc;
+				case 14:
+					return wap;
+				case 15:
+					return poll;
+				default:
+					return null;
+			}
+		}
+
+		public int getType() {
+			return type;
+		}
+	}
+}

+ 68 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/ExcelUtils.java

@@ -0,0 +1,68 @@
+package com.cz.yingpu.frame.util;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import jxl.Cell;
+import jxl.Sheet;
+import jxl.Workbook;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ExcelUtils {
+	private static  Logger logger = LoggerFactory.getLogger(ExcelUtils.class);
+	public static Cell[] getExcleRow(File excelFile, int rowIndex) throws Exception {
+		Workbook workbook = null;
+		
+		Cell[] row = null;
+		try {
+			workbook = Workbook.getWorkbook(excelFile);
+			row = workbook.getSheet(0).getRow(rowIndex);
+		} catch (Exception e) {
+			logger.error(e.getLocalizedMessage(),e);
+		} finally {
+			if (workbook != null) {
+				workbook.close();
+			}
+		}
+		return row;
+
+	}
+	
+	
+	public static List<Cell[]> getExcle(File excelFile) throws Exception {
+		Workbook workbook = null;
+		int count=0;
+		List<Cell[]> list=new ArrayList<Cell[]>();
+		try {
+			workbook = Workbook.getWorkbook(excelFile);
+			Sheet sheet = workbook.getSheet(0);
+			count = sheet.getRows();
+			for(int i=0;i<count;i++){
+				Cell[] row = sheet.getRow(i);
+				list.add(row);
+			}
+			
+		} catch (Exception e) {
+			logger.error(e.getLocalizedMessage(),e);
+		} finally {
+			if (workbook != null) {
+				workbook.close();
+			}
+		}
+		return list;
+
+	}
+
+	public static void main(String[] args) throws Exception  {
+
+		List<Cell[]> cells = getExcle(new File("C:\\Users\\Administrator\\Desktop\\test.xls"));
+		System.out.println(cells.size());
+		Cell[] cell = cells.get(3);
+		System.out.println(cell[0].getContents());
+	}
+	
+
+}

+ 103 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/ExportExcelUtil.java

@@ -0,0 +1,103 @@
+package com.cz.yingpu.frame.util;
+import java.io.OutputStream;  
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import java.lang.reflect.Field;  
+  
+import jxl.Workbook;  
+import jxl.format.Alignment;  
+import jxl.format.Border;  
+import jxl.format.BorderLineStyle;  
+import jxl.format.VerticalAlignment;  
+import jxl.write.Label;  
+import jxl.write.WritableCellFormat;  
+import jxl.write.WritableFont;  
+import jxl.write.WritableSheet;  
+import jxl.write.WritableWorkbook;
+
+public class ExportExcelUtil {
+	public  final static String exportExcel(HttpServletResponse response,String fileName,String[] Title, List<Object> listContent,Integer type) {
+		  String result="系统提示:Excel文件导出成功!";    
+		  // 以下开始输出到EXCEL  
+		  try {      
+		   //定义输出流,以便打开保存对话框______________________begin
+
+//		   HttpServletResponse response=((ServletWebRequest) RequestContextHolder.getRequestAttributes()).getResponse();
+		   OutputStream os = response.getOutputStream();// 取得输出流        
+		   response.reset();// 清空输出流        
+		   response.setHeader("Content-disposition", "attachment; filename="+ new String(fileName.getBytes("GB2312"),"ISO8859-1"));  
+		// 设定输出文件头        
+		   response.setContentType("application/msexcel");// 定义输出类型      
+		   //定义输出流,以便打开保存对话框_______________________end  
+		  
+		   /** **********创建工作簿************ */  
+		   WritableWorkbook workbook = Workbook.createWorkbook(os);  
+		  
+		   /** **********创建工作表************ */  
+		  
+		   WritableSheet sheet = workbook.createSheet("Sheet1", 0);  
+		  
+		   /** **********设置纵横打印(默认为纵打)、打印纸***************** */  
+		   jxl.SheetSettings sheetset = sheet.getSettings();  
+		   sheetset.setProtected(false);  
+		  
+		  
+		   /** ************设置单元格字体************** */  
+		   WritableFont NormalFont = new WritableFont(WritableFont.ARIAL, 10);  
+		   WritableFont BoldFont = new WritableFont(WritableFont.ARIAL, 10,WritableFont.BOLD);  
+		  
+		   /** ************以下设置三种单元格样式,灵活备用************ */  
+		   // 用于标题居中  
+		   WritableCellFormat wcf_center = new WritableCellFormat(BoldFont);  
+		   wcf_center.setBorder(Border.ALL, BorderLineStyle.THIN); // 线条  
+		   wcf_center.setVerticalAlignment(VerticalAlignment.CENTRE); // 文字垂直对齐  
+		   wcf_center.setAlignment(Alignment.CENTRE); // 文字水平对齐  
+		   wcf_center.setWrap(false); // 文字是否换行  
+		     
+		   // 用于正文居左  
+		   WritableCellFormat wcf_left = new WritableCellFormat(NormalFont);  
+		   wcf_left.setBorder(Border.NONE, BorderLineStyle.THIN); // 线条  
+		   wcf_left.setVerticalAlignment(VerticalAlignment.CENTRE); // 文字垂直对齐  
+		   wcf_left.setAlignment(Alignment.LEFT); // 文字水平对齐  
+		   wcf_left.setWrap(false); // 文字是否换行     
+		   
+		  
+		   /** ***************以下是EXCEL开头大标题,暂时省略********************* */  
+		   //sheet.mergeCells(0, 0, colWidth, 0);  
+		   //sheet.addCell(new Label(0, 0, "XX报表", wcf_center));  
+		   /** ***************以下是EXCEL第一行列标题********************* */  
+		   for (int i = 0; i < Title.length; i++) {  
+		    sheet.addCell(new Label(i, 0,Title[i],wcf_center));  
+		   }     
+		   /** ***************以下是EXCEL正文数据********************* */  
+		   Field[] fields=null;  
+		   int i=1;
+		   for(Object obj:listContent){  
+		       fields=obj.getClass().getDeclaredFields();  
+		       int j=0;  
+		       for(Field v:fields){  
+		           v.setAccessible(true);
+		           Object va=v.get(obj);  		
+		           if(va==null){  
+		               va=" ";
+		           }
+		           sheet.addCell(new Label(j, i,va.toString(),wcf_left));  
+		           j++;  
+		       }  
+		       i++;  
+		   }
+		   
+		   /** **********将以上缓存中的内容写到EXCEL文件中******** */  
+		   workbook.write();  
+		   /** *********关闭文件************* */  
+		   workbook.close();     
+		  
+		  } catch (Exception e) {  
+		   result="系统提示:Excel文件导出失败,原因:"+ e.toString();  
+		   System.out.println(result);   
+		   e.printStackTrace();  
+		  }  
+		  return result;  
+		 }  
+
+}

+ 116 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/FileUtils.java

@@ -0,0 +1,116 @@
+package com.cz.yingpu.frame.util;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
+public class FileUtils {
+	
+	
+	
+	public static List<File> getPathAllFileExt(String path,String ext){
+		List<File> list =new ArrayList<File>();
+		
+		getPathAllFileExt(list,path,ext);
+		
+		return list;
+		
+	}
+	
+	public  static  List<File> getPathAllFileExt(List<File> list,String path,String ext){
+		
+		File dir=new File(path);
+		if(dir.isDirectory()==false)
+			return list;
+		
+		File[] files=dir.listFiles();
+		
+	if(files==null||files.length<1)
+		return list;
+	for(File f:files){
+		if(f.isDirectory()){
+			String dirPath=f.getAbsolutePath();
+			getPathAllFileExt(list,dirPath,ext);
+		}else{
+			if(f.getName().endsWith(ext)){
+				
+				list.add(f);
+			}
+		}
+	}
+		
+		return list;
+	}
+	
+	 /**
+     * 获取文件后缀
+     * 
+     * @param originalFilename
+     * @return
+     */
+    public static String getSuffix(String originalFilename) {
+        return originalFilename.substring(originalFilename.lastIndexOf("."), originalFilename.length());
+    }
+
+    
+    /**
+     * 获取文件名
+     * 
+     * @param suffix
+     * @return
+     */
+    public static String reSetFileName(String suffix) {
+        return System.currentTimeMillis()+suffix;
+    }
+    
+    
+    /**
+     * 把文件读到写入流
+     * @param writer
+     * @param file
+     * @throws Exception
+     */
+    
+    public static void readIOFromFile(Writer writer,File file) throws IOException{
+    	readIOFromFile(writer, file, true);
+    }
+    
+    /**
+     * 把文件读到写入流
+     * @param writer
+     * @param file
+     * @throws Exception
+     */
+    
+    public static void readIOFromFile(Writer writer,File file,boolean closeWriter) throws IOException{
+    	 // 读出文件到response  
+        // 这里是先需要把要把文件内容先读到缓冲区  
+        // 再把缓冲区的内容写到response的输出流供用户下载  
+        FileInputStream fileInputStream = new FileInputStream(file);  
+        BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);  
+        BufferedReader reader = new BufferedReader (new InputStreamReader(bufferedInputStream,GlobalStatic.defaultCharset));
+        
+        char[] data = new char[1024];
+        while( reader.read(data)!=-1){
+     	   writer.write(data); 
+         } 
+        
+        reader.close();
+        bufferedInputStream.close();
+        fileInputStream.close();
+        if(closeWriter){
+        	 writer.close();
+        }
+       
+        
+        
+    }
+
+
+}

+ 262 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/Finder.java

@@ -0,0 +1,262 @@
+package com.cz.yingpu.frame.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * 封装查询接口
+ * 
+ * @copyright {@link weicms.net}
+ * @author springrain<Auto generate>
+ * @version 2013-03-19 11:08:15
+ * @see org.springrain.frame.util.Finder
+ */
+public class Finder {
+	private Map<String,Object> params=null;
+    private StringBuffer sql=new StringBuffer();
+   // private String countSql=null;
+    private String orderSql=null;
+    //存储过程
+    private String procName=null;
+    //函数
+    private String funName=null;
+    
+    private String pageSql=null;
+    //设置总条数查询的finder
+    private Finder countFinder=null;
+    
+    //默认进行sql编码,处理字符串的拼接注入
+    private boolean escapeSql=true;
+    
+    //给sql的末尾拼字符串
+    private String endsql;
+    
+    public String getEndsql() {
+		return endsql;
+	}
+
+	public void setEndsql(String endsql) {
+		this.endsql = endsql;
+	}
+
+	public Finder(){}
+    
+    public Finder (String s){
+    	this.sql.append(s);
+    }
+    
+    /** 添加子句 */
+	public Finder append(String s) {
+		sql.append(s);
+		return this;
+	}
+	
+	/**
+	 * 拼接一个finder对象的sql和参数
+	 * @param f
+	 * @return
+	 * @throws Exception 
+	 */
+	public Finder appendFinder(Finder f) throws Exception {
+		if(f==null||StringUtils.isBlank(f.getSql())){
+			return this;
+		}
+	    sql.append(f.getSql());
+	    
+	    getParams().putAll(f.getParams());
+	    
+	    return this;
+	}
+	
+	
+
+	/**
+	 * 设置参数。
+	 * 
+	 * @param param
+	 * @param value
+	 * @return
+	 */
+	public Finder setParam(String param, Object value) {
+		getParams().put(param, value);
+		return this;
+	}
+	/**
+	 * 根据 Entity(分表)或者Class返回查询语句的Finder
+	 * 等同 getSelectFinder(User.class)==return new Finder("SELECT * FROM t_User ");
+	 * @param object
+	 * @return
+	 * @throws Exception
+	 */
+	public static Finder getSelectFinder(Object object) throws Exception{
+		return getSelectFinder(object, "*");
+	}
+	/**
+	 * 根据 Entity(分表)或者Class返回更新语句的Finder
+	 * 等同 getUpdateFinder(User.class,"id,name")==return new Finder("SELECT id,name FROM t_User ");
+	 * @param object,updatesql
+	 * @return
+	 * @throws Exception
+	 */
+	
+	public static Finder getSelectFinder(Object object,String selectsql) throws Exception{
+		if(object==null){
+			return null;
+		}
+		if(StringUtils.isBlank(selectsql)){
+			selectsql="*";
+		}
+		String tableName=getTableName(object);
+		Finder finder=new Finder("SELECT ");
+		finder.append(selectsql).append(" FROM ").append(tableName).append(" ");
+		return finder;
+		
+	}
+	
+	/**
+	 * 根据 Entity(分表)或者Class返回更新语句的Finder
+	 * 等同 getUpdateFinder(User.class)==return new Finder("UPDATE t_User SET ");
+	 * @param object
+	 * @return
+	 * @throws Exception
+	 */
+	public static Finder getUpdateFinder(Object object) throws Exception{
+		return getUpdateFinder(object, null);
+	}
+	
+	/**
+	 * 根据 Entity(分表)或者Class返回更新语句的Finder
+	 * 等同 getUpdateFinder(User.class,"name=:name")==return new Finder("UPDATE t_User SET name=:name ");
+	 * @param object,updatesql
+	 * @return
+	 * @throws Exception
+	 */
+	
+	public static Finder getUpdateFinder(Object object,String updatesql) throws Exception{
+		if(object==null){
+			return null;
+		}
+		String tableName=getTableName(object);
+		Finder finder=new Finder("UPDATE ");
+		finder.append(tableName).append(" SET ");
+		if(StringUtils.isNotBlank(updatesql)){
+			finder.append(updatesql).append(" ");
+		}
+		return finder;
+		
+	}
+	
+	/**
+	 * 根据 Entity(分表)或者Class返回删除语句的Finder
+	 * 等同 getDeleteFinder(User.class)==return new Finder("DELETE FROM  t_user ");
+	 * @param object
+	 * @return
+	 * @throws Exception
+	 */
+	
+	public static Finder getDeleteFinder(Object object) throws Exception{
+		if(object==null){
+			return null;
+		}
+		String tableName=getTableName(object);
+		Finder finder=new Finder("DELETE FROM  ");
+		finder.append(tableName).append(" ");
+		return finder;
+	}
+	
+	
+	public static String getTableName(Object object) throws Exception {
+		return ClassUtils.getTableName(object);
+	}
+	
+	
+	
+	
+	
+	
+
+	public Map<String, Object> getParams() {
+		if(params==null){
+			params=new HashMap<String,Object>();
+		}
+		return params;
+	}
+
+	/*
+	public void setParams(Map<String, Object> params) {
+		this.params = params;
+	}
+	*/
+
+	public String getSql() throws Exception {
+		if(sql==null)
+			return null;
+		
+		
+		String _sql=sql.toString();
+		if(isEscapeSql()&&_sql.contains("'")){
+			throw new Exception("SQL语句请不要直接拼接字符串参数!!!使用标准的占位符实现,例如  finder.append(' and id=:id').setParam('id',_id);  ");
+		}
+		return _sql;
+	}
+
+	public void setSql(String sql) {
+		this.sql = new StringBuffer(sql);
+	}
+
+	
+
+	public String getOrderSql() {
+		return orderSql;
+	}
+
+	public void setOrderSql(String orderSql) {
+		this.orderSql = orderSql;
+	}
+
+	public String getPageSql() {
+		return pageSql;
+	}
+
+	public void setPageSql(String pageSql) {
+		this.pageSql = pageSql;
+	}
+
+	public String getProcName() {
+		return procName;
+	}
+
+	public void setProcName(String procName) {
+		this.procName = procName;
+	}
+
+	public String getFunName() {
+		return funName;
+	}
+
+	public void setFunName(String funName) {
+		this.funName = funName;
+	}
+/**
+ * 查询总条数的 Finder对象
+ * @return Finder
+ */
+	public Finder getCountFinder() {
+		return countFinder;
+	}
+
+	public void setCountFinder(Finder countFinder) {
+		this.countFinder = countFinder;
+	}
+
+	public boolean isEscapeSql() {
+		return escapeSql;
+	}
+
+	public void setEscapeSql(boolean escapeSql) {
+		this.escapeSql = escapeSql;
+	}
+
+}

+ 48 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/FrameObjectMapper.java

@@ -0,0 +1,48 @@
+package com.cz.yingpu.frame.util;
+
+import java.text.SimpleDateFormat;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+public class FrameObjectMapper extends ObjectMapper {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public FrameObjectMapper(){
+		   
+		       //为 null 的不转换
+		       // this.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL); 
+		   this.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+			   //支持 属性不对应
+		   this.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES , false);
+			   //为bean 为null时不报异常
+		   this.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS,false);
+			   //键 支持 不带 双引号 ""
+		   this.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
+		       //设置日期格式
+		   this.setDateFormat(new SimpleDateFormat(DateUtils.DATETIME_FORMAT));
+		   
+			   //过滤敏感字符
+		   this.getFactory().setCharacterEscapes(new HTMLCharacterEscapes());
+			   
+		   //属性别名:@JsonProperty 序列化/反序列化都有效
+		   //排除属性:@JsonIgnore 一般标记在属性或方法上,作用于序列化与反序列化
+		   //排除属性:@JsonIgnoreProperties 如果是代理类,由于无法标记在属性或方法上,可以标记在类声明上,也作用于反序列化时的字段解析
+		   //属性排序:@JsonPropertyOrder
+		   //自定义序列化:@JsonSerialize
+		   //自定义反序列化:@JsonDeserialize
+		   
+		   //@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+		   //@JsonFormat(shape = JsonFormat.Shape.STRING, pattern=DateUtils.DATETIME_FORMAT,timezone = DateUtils.DATE_TIMEZONE)
+		   
+		   
+		
+	}
+}

+ 251 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/GetEwm.java

@@ -0,0 +1,251 @@
+package com.cz.yingpu.frame.util;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.geom.AffineTransform;
+import java.awt.image.AffineTransformOp;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.imageio.ImageIO;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.EncodeHintType;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.WriterException;
+import com.google.zxing.client.j2se.MatrixToImageWriter;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
+
+
+public class GetEwm { 
+	// 图片宽度的一般  
+    private static final int IMAGE_WIDTH = 80;  
+    private static final int IMAGE_HEIGHT = 80;  
+    private static final int IMAGE_HALF_WIDTH = IMAGE_WIDTH / 2;  
+    private static final int FRAME_WIDTH = 2;  
+  
+    // 二维码写码器  
+    private static MultiFormatWriter mutiWriter = new MultiFormatWriter();  
+  
+    public static void encode(String content, int width, int height,  
+            String srcImagePath, String destImagePath) {  
+        try {  
+            ImageIO.write(genBarcode(content, width, height, srcImagePath),  
+                    "jpg", new File(destImagePath));  
+        } catch (IOException e) {  
+            e.printStackTrace();  
+        } catch (WriterException e) {  
+            e.printStackTrace();  
+        }  
+    }  
+  
+    private static BufferedImage genBarcode(String content, int width,  
+            int height, String srcImagePath) throws WriterException,  
+            IOException {  
+        // 读取源图像  
+        BufferedImage scaleImage = scale(srcImagePath, IMAGE_WIDTH,  
+                IMAGE_HEIGHT, true);  
+        int[][] srcPixels = new int[IMAGE_WIDTH][IMAGE_HEIGHT];  
+        for (int i = 0; i < scaleImage.getWidth(); i++) {  
+            for (int j = 0; j < scaleImage.getHeight(); j++) {  
+                srcPixels[i][j] = scaleImage.getRGB(i, j);  
+            }  
+        }  
+  
+        Map<EncodeHintType, Object> hint = new HashMap<EncodeHintType, Object>();  
+        hint.put(EncodeHintType.CHARACTER_SET, "utf-8");  
+        hint.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);  
+        // 生成二维码  
+        BitMatrix matrix = mutiWriter.encode(content, BarcodeFormat.QR_CODE,  
+                width, height, hint);  
+  
+        // 二维矩阵转为一维像素数组  
+        int halfW = matrix.getWidth() / 2;  
+        int halfH = matrix.getHeight() / 2;  
+        int[] pixels = new int[width * height];  
+  
+        for (int y = 0; y < matrix.getHeight(); y++) {  
+            for (int x = 0; x < matrix.getWidth(); x++) {  
+                // 读取图片  
+                if (x > halfW - IMAGE_HALF_WIDTH  
+                        && x < halfW + IMAGE_HALF_WIDTH  
+                        && y > halfH - IMAGE_HALF_WIDTH  
+                        && y < halfH + IMAGE_HALF_WIDTH) {  
+                    pixels[y * width + x] = srcPixels[x - halfW  
+                            + IMAGE_HALF_WIDTH][y - halfH + IMAGE_HALF_WIDTH];  
+                }   
+                // 在图片四周形成边框  
+                else if ((x > halfW - IMAGE_HALF_WIDTH - FRAME_WIDTH  
+                        && x < halfW - IMAGE_HALF_WIDTH + FRAME_WIDTH  
+                        && y > halfH - IMAGE_HALF_WIDTH - FRAME_WIDTH && y < halfH  
+                        + IMAGE_HALF_WIDTH + FRAME_WIDTH)  
+                        || (x > halfW + IMAGE_HALF_WIDTH - FRAME_WIDTH  
+                                && x < halfW + IMAGE_HALF_WIDTH + FRAME_WIDTH  
+                                && y > halfH - IMAGE_HALF_WIDTH - FRAME_WIDTH && y < halfH  
+                                + IMAGE_HALF_WIDTH + FRAME_WIDTH)  
+                        || (x > halfW - IMAGE_HALF_WIDTH - FRAME_WIDTH  
+                                && x < halfW + IMAGE_HALF_WIDTH + FRAME_WIDTH  
+                                && y > halfH - IMAGE_HALF_WIDTH - FRAME_WIDTH && y < halfH  
+                                - IMAGE_HALF_WIDTH + FRAME_WIDTH)  
+                        || (x > halfW - IMAGE_HALF_WIDTH - FRAME_WIDTH  
+                                && x < halfW + IMAGE_HALF_WIDTH + FRAME_WIDTH  
+                                && y > halfH + IMAGE_HALF_WIDTH - FRAME_WIDTH && y < halfH  
+                                + IMAGE_HALF_WIDTH + FRAME_WIDTH)) {  
+                    pixels[y * width + x] = 0xfffffff;  
+                } else {  
+                    // 此处可以修改二维码的颜色,可以分别制定二维码和背景的颜色;  
+                    pixels[y * width + x] = matrix.get(x, y) ? 0xff000000  
+                            : 0xfffffff;  
+                }  
+            }  
+        }  
+  
+        BufferedImage image = new BufferedImage(width, height,  
+                BufferedImage.TYPE_INT_RGB);  
+        image.getRaster().setDataElements(0, 0, width, height, pixels);  
+  
+        return image;  
+    }  
+  
+    /** 
+     * 把传入的原始图像按高度和宽度进行缩放,生成符合要求的图标 
+     *  
+     * @param srcImageFile 
+     *            源文件地址 
+     * @param height 
+     *            目标高度 
+     * @param width 
+     *            目标宽度 
+     * @param hasFiller 
+     *            比例不对时是否需要补白:true为补白; false为不补白; 
+     * @throws IOException 
+     */  
+    private static BufferedImage scale(String srcImageFile, int height,  
+            int width, boolean hasFiller) throws IOException {  
+        double ratio = 0.0; // 缩放比例  
+        File file = new File(srcImageFile);  
+        BufferedImage srcImage = ImageIO.read(file);  
+        Image destImage = srcImage.getScaledInstance(width, height,  
+                Image.SCALE_SMOOTH);  
+        // 计算比例  
+        if ((srcImage.getHeight() > height) || (srcImage.getWidth() > width)) {  
+            if (srcImage.getHeight() > srcImage.getWidth()) {  
+                ratio = (new Integer(height)).doubleValue()  
+                        / srcImage.getHeight();  
+            } else {  
+                ratio = (new Integer(width)).doubleValue()  
+                        / srcImage.getWidth();  
+            }  
+            AffineTransformOp op = new AffineTransformOp(  
+                    AffineTransform.getScaleInstance(ratio, ratio), null);  
+            destImage = op.filter(srcImage, null);  
+        }  
+        if (hasFiller) {// 补白  
+            BufferedImage image = new BufferedImage(width, height,  
+                    BufferedImage.TYPE_INT_RGB);  
+            Graphics2D graphic = image.createGraphics();  
+            graphic.setColor(Color.white);  
+            graphic.fillRect(0, 0, width, height);  
+            if (width == destImage.getWidth(null))  
+                graphic.drawImage(destImage, 0,  
+                        (height - destImage.getHeight(null)) / 2,  
+                        destImage.getWidth(null), destImage.getHeight(null),  
+                        Color.white, null);  
+            else  
+                graphic.drawImage(destImage,  
+                        (width - destImage.getWidth(null)) / 2, 0,  
+                        destImage.getWidth(null), destImage.getHeight(null),  
+                        Color.white, null);  
+            graphic.dispose();  
+            destImage = image;  
+        }  
+        return (BufferedImage) destImage;  
+    } 
+    
+    public static String getEwm(String code)throws IOException {  
+    	String url = "http://m.snseccare.com/yingchen/phone/user_web.action?code="+code;
+    	UUID uuid  =  UUID.randomUUID(); 
+    	String tempName =  uuid.toString()+".jpg";
+//    	String path = SysParamHelp.getValueByKey("imgHardAddress")+"/ewm/"+tempName ;
+//    	String urlPath = SysParamHelp.getValueByKey("postImgAddress")+"/ewm/"+tempName ;
+        String path ="E:/ewm/"+tempName ;
+        String urlPath = "E:/ewm/"+tempName ;
+    	String hardPath =  "/webdata/app/yingchen/APP-ICON.jpg";
+    	encode(url,  300, 300, hardPath, path);
+    	return urlPath;
+    }
+
+    /********************************************************************************
+       * 上面的为生成带图片的二维码
+     * 下面为不带图片的二维码
+    * ******************************************************************************/
+
+    public static String ewm(Integer id,String inviteCode) throws WriterException, IOException {
+        int width = 200;
+        int height = 200;
+        // 硬盘路径
+        String subDirectory = "/yingpu/" + id + "/";
+        String hardPath =  "/webdata/app"+ subDirectory; // 路径在硬盘上面的位置
+        String urlPath = "http://114.215.130.18:22222"+subDirectory; // 路径在服务器上面的位置
+        File rom= new File(hardPath+id);
+        if (rom.exists()) {
+            rom.delete();
+        }
+
+        File dir = new File(hardPath);
+        if (!dir.exists()) {
+            dir.mkdirs();
+        }
+
+//		String ip = getLocalIP();
+        //	String ip = SysParamHelp.getValueByKey("IPAddress");
+        // 生成图片格式
+        String format = "png";
+        Hashtable hints = new Hashtable();
+        hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
+        // 调整二维码精度
+        hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
+        BitMatrix bitMatrix = new MultiFormatWriter().encode("http://wap.yingpuwealth.com/yingpu/web/share.html?inviteCode="+inviteCode,
+                BarcodeFormat.QR_CODE, width, height, hints);
+        String ss=id+".png";
+        File outputFile = new File(hardPath,ss);
+        MatrixToImageWriter.writeToFile(bitMatrix, format, outputFile);
+        return urlPath+ss;
+    }
+
+    public static String getLocalIP(){
+        InetAddress addr = null;
+        try {
+            addr = InetAddress.getLocalHost();
+        } catch (UnknownHostException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        byte[] ipAddr = addr.getAddress();
+        String ipAddrStr = "";
+        for (int i = 0; i < ipAddr.length; i++) {
+            if (i > 0) {
+                ipAddrStr += ".";
+            }
+            ipAddrStr += ipAddr[i] & 0xFF;
+        }
+        //System.out.println(ipAddrStr);
+        return ipAddrStr;
+    }
+
+    public static void main(String[] args)throws Exception {
+//    	encode("http://m.snseccare.com/yingchen/phone/user_web.action?code=117610",
+//                        300, 300, "null", "E:\\1.jpg");
+        ewm(3372,"595211");
+    } 
+}

+ 139 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/GlobalStatic.java

@@ -0,0 +1,139 @@
+package com.cz.yingpu.frame.util;
+/**
+ * 全局的静态变量,用于全局变量的存放
+ * @copyright {@link weicms.net}
+ * @author springrain<Auto generate>
+ * @version  2013-03-19 11:08:15
+ * @see org.springrain.frame.util.GlobalStatic
+ */
+public class GlobalStatic {
+	public static  String rootDir=null;
+	public static  String webInfoDir=null;
+	public static  String staticHtmlDir=null;
+	public static  String tempRootpath = System.getProperty("user.dir") + "/temp/";
+	public static final int excelPageSize=1000;
+	public static final  String suffix=".html";
+	public static final String excelext=".xls";
+	public static final String exportexcel="exportexcel";//是否是导出操作的key
+	public static final String dataUpdate="更新";
+	public static final String dataSave="保存";
+	public static final String dataDelete="删除";
+	
+	
+	
+	//pc的用户session键
+		public static final String OPERATORUSER="operatoruser";
+	//pc的用户session键
+	public static final String PCUSER="pcuser";
+	//page对象的缓存后缀key
+	public static final String pageCacheExtKey="_springrain_page_key";
+
+	//sysSysParam表缓存
+	public static final String sysparamCache = "sysParamData";
+	//主业务缓存
+	public static final String cacheKey="springraincache";
+	//权限缓存
+	public static final String qxCacheKey="springrainqxcache";
+	//页面静态化缓存
+	public static final String staticHtmlCacheKey="statichtmlcache";
+	//登录次数校验缓存
+	public static final String springrainloginCacheKey="springrainlogincache";
+	//缓存用户最后有效的登陆sessionId
+	public static final String springrainkeeponeCacheKey="springrainkeeponecache";
+	//防火墙缓存
+    public static final String springrainfirewallCacheKey="springrainfriewallcache";
+	//微信缓存
+   // public static final String springrainweixinCacheKey="springrainweixincache";
+    //cms 缓存
+    public static final String springraincmsCacheKey="springraincmscache";
+    
+    //defaultSiteId 缓存
+    public static final String springraindefaultSiteId="defaultSiteId";
+
+
+	//config表缓存
+	public static final String configCache = "configData";
+	//警报邮件收件人
+	public static final String ALARM_EMAIL = "alarmEmail" ;
+	public static final String ALARM_EMAIL_TO = "alarmEmailTO" ;
+	public static final String ALARM_EMAIL_CC = "alarmEmailCC" ;
+    //前后台传递的tokenKey
+    public static final String tokenKey="springraintoken";
+    //如果token错误,跳转地址的key
+    public static final String errorTokentoURLKey="errorspringraintokentourlkey";
+    //token错误跳转的页面
+    public static final String errorTokentoURL="/errorpage/tokenerror";
+    
+    //自定义的登录地址key
+    public static final String customLoginURLKey="customLoginURLKey";
+    //自定义的token
+    public static final String tokenCacheKey="tokenCache";
+	//缓存用户最后有效的登陆sessionId
+	public static final String keeponeCacheName="shiro-keepone-session";
+
+    
+	public static final String defaultCharset="UTF-8";
+	
+	public static final String tableSuffix="_history_";
+	public static final String frameTableAlias="frameTableAlias";
+	public static final String returnDatas="returnDatas";
+	
+
+	//认证
+	//public static final String reloginsession="shiro-reloginsession";
+	//认证
+	public static final String authenticationCacheName="shiro-authenticationCacheName";
+	//授权
+	public static final String authorizationCacheName="shiro-authorizationCacheName";
+	//realm名称
+	public static final String authorizingRealmName="shiroDbAuthorizingRealmName";
+	
+	
+	//默认验证码参数名称
+	public static final String DEFAULT_CAPTCHA_PARAM = "captcha";
+	
+	
+
+	//密码连续错误10次,锁定不再进行登录查询,锁定 ERROR_LOGIN_LOCK_MINUTE  分钟
+	public static final int ERROR_LOGIN_COUNT = 10;
+	//错误登录后的,锁定分钟数
+	public static final int ERROR_LOGIN_LOCK_MINUTE = 30;
+	
+	
+	//同一IP防火墙阀值
+	public static final Integer FRIEWALL_LOCK_COUNT = 10000;
+	//同一IP阀值时间,单位是 秒
+	public static final Integer FRIEWALL_LOCK_SECOND = 60;
+	//锁定分钟数
+	public static final Integer FRIEWALL_LOCKED_MINUTE = 10;
+	
+	static{
+		String path=Thread.currentThread().getContextClassLoader().getResource("").toString();
+		path = path.replace("\\", "/");
+		System.out.println("********************************************************");
+		System.out.print(path);
+		
+		if(path.startsWith("file:/")){
+			path=path.substring(6, path.length());
+		}
+		
+		
+		int _info=path.indexOf("/WEB-INF/classes");
+		if(_info>0){
+			path=path.substring(0, _info);
+		}
+		if(!path.startsWith("/")){
+			path="/"+path;
+		}
+		rootDir=path;
+
+		
+		tempRootpath = rootDir + "/temp/";
+		staticHtmlDir=rootDir + "/statichtml/";
+		
+	}
+	
+	
+	
+
+}

+ 58 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/HTMLCharacterEscapes.java

@@ -0,0 +1,58 @@
+package com.cz.yingpu.frame.util;
+
+import com.fasterxml.jackson.core.SerializableString;
+import com.fasterxml.jackson.core.io.CharacterEscapes;
+import com.fasterxml.jackson.core.io.SerializedString;
+
+public class HTMLCharacterEscapes extends CharacterEscapes
+{
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	private final int[] asciiEscapes;
+	
+     //  <   \u003C
+    private static final SerializedString escapeFor003C = new SerializedString("&lt;"); 
+    
+    //  >   \u003E
+    private static final SerializedString escapeFor003E = new SerializedString("&gt;"); 
+
+    //  /   \u005C
+   // private static final SerializedString escapeFor005C = new SerializedString("\\"); 
+    //  &   \u0026
+   // private static final SerializedString escapeFor0026 = new SerializedString("&amp;"); 
+    
+    public HTMLCharacterEscapes()
+    {
+        // start with set of characters known to require escaping (double-quote, backslash etc)
+        int[] esc = CharacterEscapes.standardAsciiEscapesForJSON();
+        // and force escaping of a few others:
+        esc['<'] = CharacterEscapes.ESCAPE_CUSTOM;
+        esc['>'] = CharacterEscapes.ESCAPE_CUSTOM;
+       // esc['&'] = CharacterEscapes.ESCAPE_CUSTOM;
+       // esc['\''] = CharacterEscapes.ESCAPE_CUSTOM;
+        asciiEscapes = esc;
+    }
+    // this method gets called for character codes 0 - 127
+    @Override public int[] getEscapeCodesForAscii() {
+        return asciiEscapes;
+    }
+    // and this for others; we don't need anything special here
+    @Override public SerializableString getEscapeSequence(int ch) {
+        // no further escaping (beyond ASCII chars) needed:
+    	 switch (ch) {
+         case 0x003C:
+             return escapeFor003C;
+         case 0x003E:
+             return escapeFor003E;
+         //case 0x005C:
+         //    return escapeFor005C;
+        // case 0x0026:
+        //     return escapeFor0026;
+         default:
+             return null;
+         }
+    }
+}
+

+ 167 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/HtmlToPDF.java

@@ -0,0 +1,167 @@
+package com.cz.yingpu.frame.util;
+
+
+import org.zefer.pd4ml.PD4Constants;
+import org.zefer.pd4ml.PD4ML;
+
+import java.awt.*;
+import java.io.*;
+import java.net.URL;
+
+/**
+ * Created by Administrator on 2017/6/19 0019.
+ */
+public class HtmlToPDF {
+    protected int topValue = 10;
+    protected int leftValue = 20;
+    protected int rightValue = 10;
+    protected int bottomValue = 10;
+    protected int userSpaceWidth = 1300;
+
+    // 手动构造HTML代码
+    public static void generatePDF_1(File outputPDFFile, StringReader strReader) throws Exception {
+        FileOutputStream fos = new FileOutputStream(outputPDFFile);
+        PD4ML pd4ml = new PD4ML();
+        
+        pd4ml.setPageInsets(new Insets(20, 10, 10, 10));
+        pd4ml.setHtmlWidth(950);
+        pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.A4));
+        pd4ml.useTTF("/webdata/yingpu/fonts", true);
+        pd4ml.setDefaultTTFs("KaiTi_GB2312", "KaiTi_GB2312", "KaiTi_GB2312");
+        pd4ml.enableDebugInfo();
+        pd4ml.render(strReader, fos);
+    }
+
+    // 将HTML文件转换成PDF
+    public static void generatePDF_2(File outputPDFFile, String inputHTMLFileName) throws Exception {
+        FileOutputStream fos = new FileOutputStream(outputPDFFile);
+        PD4ML pd4ml = new PD4ML();
+        pd4ml.setPageInsets(new Insets(20, 10, 10, 10));
+        pd4ml.setHtmlWidth(950);
+        pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.A4));
+//        pd4ml.useTTF("java:fonts", true);
+//        String path = request.getSession().getServletContext().getRealPath("");
+        pd4ml.useTTF("C:\\Users\\Administrator\\Desktop\\pd4\\fonts", true);
+        pd4ml.setDefaultTTFs("KaiTi_GB2312", "KaiTi_GB2312", "KaiTi_GB2312");
+        pd4ml.enableDebugInfo();
+        pd4ml.render("file:" + inputHTMLFileName, fos);
+    }
+
+    public  void doConversion( String urlstring, String outputPath ) throws Exception {
+        URL url = new URL(urlstring);
+        url.openConnection();
+        File output = new File(outputPath);
+        java.io.FileOutputStream fos = new java.io.FileOutputStream(output);
+
+        PD4ML pd4ml = new PD4ML();
+
+        pd4ml.setHtmlWidth(userSpaceWidth); // set frame width of "virtual web browser"
+
+        // choose target paper format and "rotate" it to landscape orientation
+        pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.A4));
+
+        // de fine PDF page margins
+        pd4ml.setPageInsetsMM(new Insets(topValue, leftValue, bottomValue, rightValue));
+
+        // source HTML document also may have margins, could be suppressed this way
+        // (PD4ML *Pro* feature):
+        pd4ml.addStyle("BODY {margin: 0}", true);
+
+        // If built-in basic PDF fonts are not sufficient or
+        // if you need to output non-Latin texts,
+        // TTF embedding feature should help (PD4ML *Pro*)
+        pd4ml.useTTF("C:\\Users\\Administrator\\Desktop\\pd4\\fonts", true);
+        pd4ml.setDefaultTTFs("KaiTi_GB2312", "KaiTi_GB2312", "KaiTi_GB2312");
+        pd4ml.render(url, fos); // actual document conversion from URL to file
+        fos.close();
+
+        System.out.println( outputPath + "\ndone." );
+    }
+
+    /**
+     * 通过读取HTML生成PDF
+     * @param realName 真实姓名
+     * @param idcard 身份证号
+     * @param number 合同编号
+     * @param yfname 乙方名称
+     * @param yfidcard 乙方身份证
+     * @param productnumber 项目编号
+     * @param xxbj 小写本金
+     * @param dxbj 大写本金
+     * @param nhlv 年化利率
+     * @param hkfs 还款方式
+     * @param bjh 本息和
+     * @param starttime 开始时间
+     * @param endtime  结束时间
+     * @param time 页面地址
+     * @param outputFile PDF输出地址
+     * @throws Exception
+     */
+    public static void createPDF(String realName,String idcard,String number,
+    		String yfname,String yfidcard,String productnumber,String xxbj,String dxbj,String nhlv,
+    		String hkfs,String bjh,String starttime,String endtime,String time,String protocolTemplate,String inputFile,String outputFile)throws Exception {
+        File file=new File(inputFile);
+        InputStreamReader fis = new InputStreamReader(new FileInputStream(file), "utf-8");// 创建文件输入流
+        char[] data = new char[1024];// 创建缓冲字符数组
+        int rn = 0;
+        StringBuilder sb = new StringBuilder();// 创建字符串构建器
+        while ((rn = fis.read(data)) > 0) {// 读取文件内容到字符串构建器
+            String str = String.valueOf(data, 0, rn);
+            sb.append(str);
+        }
+        fis.close();// 关闭输入流
+        // 从构建器中生成字符串,并替换搜索文本
+      String str = sb.toString();
+       
+        String[] kvs = {
+        		"jiafang", realName, "jfshenfenzheng", idcard, "bianhao", number, "yifang", yfname,
+        		"yfshenfenzheng", yfidcard, "productno", productnumber, "bjxx", xxbj, "bjdx", dxbj,
+        		"nhll", nhlv, "hkfs", hkfs, "dqyh", bjh, "starttime", starttime, "endtime", endtime,
+        		"lkrq", time
+        };
+
+        for (int i = 0; i < kvs.length; i += 2) {
+        	String key = kvs[i];
+        	String val = kvs[i + 1];
+        	str = str.replaceAll("<span id=\"" + key + "\">([^<>]*)</span>", val);
+        }
+ 
+        StringReader strReader = new StringReader(str);
+        generatePDF_1(new File(outputFile), strReader);
+    }
+
+
+
+    public static void main(String[] args) throws Exception {
+        HtmlToPDF htmlToPDF = new HtmlToPDF();
+//        htmlToPDF.generatePDF_2(new File("C:\\Users\\Administrator\\Desktop\\pd4.pdf"),"C:\\Users\\Administrator\\Desktop\\template.html");
+//        htmlToPDF.doConversion("C:\\\\Users\\\\Administrator\\\\Desktop\\\\news.html","C:\\Users\\Administrator\\Desktop\\pd5.pdf");
+        File file=new File("C:\\Users\\Administrator\\Desktop\\template.html");
+        FileReader fis = new FileReader(file);// 创建文件输入流
+        char[] data = new char[1024];// 创建缓冲字符数组
+        int rn = 0;
+        StringBuilder sb = new StringBuilder();// 创建字符串构建器
+        while ((rn = fis.read(data)) > 0) {// 读取文件内容到字符串构建器
+            String str = String.valueOf(data, 0, rn);
+            sb.append(str);
+        }
+        fis.close();// 关闭输入流
+        String str = sb.toString();
+        String[] kvs = {
+        		"jiafang", "jfshenfenzheng", "bianhao", "yifang",
+        		"yfshenfenzheng", "productno", "bjxx", "bjdx",
+        		"nhll", "hkfs", "dqyh", "starttime", "endtime",
+        		"lkrq"
+        };
+		
+		
+		for (int i = 0; i < kvs.length; i += 1) {
+			String key = kvs[i];
+			str = str.replaceAll("<span id=\"" + key + "\">([^<>]*)</span>", "asdfasdfas");
+		}
+		
+	       
+        StringReader strReader = new StringReader(str);
+        generatePDF_1(new File("C:\\Users\\Administrator"),strReader);
+    }
+}

+ 253 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/HttpClientUtil.java

@@ -0,0 +1,253 @@
+package com.cz.yingpu.frame.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.ssl.DefaultHostnameVerifier;
+import org.apache.http.conn.util.PublicSuffixMatcher;
+import org.apache.http.conn.util.PublicSuffixMatcherLoader;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.apache.http.entity.mime.content.FileBody;
+import org.apache.http.entity.mime.content.StringBody;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HttpClientUtil {
+	
+	private static   Logger logger = LoggerFactory.getLogger(HttpClientUtil.class);
+	private static RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(15000).setConnectTimeout(15000)
+			.setConnectionRequestTimeout(15000).build();
+
+
+
+	/**
+	 * 发送 post请求
+	 * 
+	 * @param httpUrl
+	 *            地址
+	 */
+	public static String sendHttpPost(String httpUrl) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
+		return sendHttpPost(httpPost);
+	}
+
+	/**
+	 * 发送 post请求
+	 * 
+	 * @param httpUrl
+	 *            地址
+	 * @param params
+	 *            参数(格式:key1=value1&key2=value2)
+	 */
+	public static String sendHttpPost(String httpUrl, String params) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
+		try {
+			// 设置参数
+			StringEntity stringEntity = new StringEntity(params, "UTF-8");
+			stringEntity.setContentType("application/x-www-form-urlencoded");
+			httpPost.setEntity(stringEntity);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return sendHttpPost(httpPost);
+	}
+
+	/**
+	 * 发送 post请求
+	 * 
+	 * @param httpUrl
+	 *            地址
+	 * @param maps
+	 *            参数
+	 */
+	public static String sendHttpPost(String httpUrl, Map<String, String> maps) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
+		// 创建参数队列
+		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
+		for (String key : maps.keySet()) {
+			nameValuePairs.add(new BasicNameValuePair(key, maps.get(key)));
+		}
+		try {
+			httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return sendHttpPost(httpPost);
+	}
+
+	/**
+	 * 发送 post请求(带文件)
+	 * 
+	 * @param httpUrl
+	 *            地址
+	 * @param maps
+	 *            参数
+	 * @param fileLists
+	 *            附件
+	 */
+	public static String sendHttpPost(String httpUrl, Map<String, String> maps, List<File> fileLists) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
+		MultipartEntityBuilder meBuilder = MultipartEntityBuilder.create();
+		for (String key : maps.keySet()) {
+			meBuilder.addPart(key, new StringBody(maps.get(key), ContentType.TEXT_PLAIN));
+		}
+		for (File file : fileLists) {
+			FileBody fileBody = new FileBody(file);
+			meBuilder.addPart("files", fileBody);
+		}
+		HttpEntity reqEntity = meBuilder.build();
+		httpPost.setEntity(reqEntity);
+		return sendHttpPost(httpPost);
+	}
+
+	/**
+	 * 发送Post请求
+	 * 
+	 * @param httpPost
+	 * @return
+	 */
+	private static String sendHttpPost(HttpPost httpPost) {
+		CloseableHttpClient httpClient = null;
+		CloseableHttpResponse response = null;
+		HttpEntity entity = null;
+		String responseContent = null;
+		try {
+			// 创建默认的httpClient实例.
+			httpClient = HttpClients.createDefault();
+			httpPost.setConfig(requestConfig);
+			// 执行请求
+			response = httpClient.execute(httpPost);
+			entity = response.getEntity();
+			responseContent = EntityUtils.toString(entity, "UTF-8");
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				// 关闭连接,释放资源
+				if (response != null) {
+					response.close();
+				}
+				if (httpClient != null) {
+					httpClient.close();
+				}
+			} catch (IOException e) {
+				logger.error(e.getLocalizedMessage());
+			}
+		}
+		return responseContent;
+	}
+
+	/**
+	 * 发送 get请求
+	 * 
+	 * @param httpUrl
+	 */
+	public static String sendHttpGet(String httpUrl) {
+		HttpGet httpGet = new HttpGet(httpUrl);// 创建get请求
+		return sendHttpGet(httpGet);
+	}
+
+	/**
+	 * 发送 get请求Https
+	 * 
+	 * @param httpUrl
+	 */
+	public static String sendHttpsGet(String httpUrl) {
+		HttpGet httpGet = new HttpGet(httpUrl);// 创建get请求
+		return sendHttpsGet(httpGet);
+	}
+
+	/**
+	 * 发送Get请求
+	 * 
+	 * @param httpPost
+	 * @return
+	 */
+	private static String sendHttpGet(HttpGet httpGet) {
+		CloseableHttpClient httpClient = null;
+		CloseableHttpResponse response = null;
+		HttpEntity entity = null;
+		String responseContent = null;
+		try {
+			// 创建默认的httpClient实例.
+			httpClient = HttpClients.createDefault();
+			httpGet.setConfig(requestConfig);
+			// 执行请求
+			response = httpClient.execute(httpGet);
+			entity = response.getEntity();
+			responseContent = EntityUtils.toString(entity, "UTF-8");
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				// 关闭连接,释放资源
+				if (response != null) {
+					response.close();
+				}
+				if (httpClient != null) {
+					httpClient.close();
+				}
+			} catch (IOException e) {
+				logger.error(e.getLocalizedMessage());
+			}
+		}
+		return responseContent;
+	}
+
+	/**
+	 * 发送Get请求Https
+	 * 
+	 * @param httpPost
+	 * @return
+	 */
+	private static String sendHttpsGet(HttpGet httpGet) {
+		CloseableHttpClient httpClient = null;
+		CloseableHttpResponse response = null;
+		HttpEntity entity = null;
+		String responseContent = null;
+		try {
+			// 创建默认的httpClient实例.
+			PublicSuffixMatcher publicSuffixMatcher = PublicSuffixMatcherLoader
+					.load(new URL(httpGet.getURI().toString()));
+			DefaultHostnameVerifier hostnameVerifier = new DefaultHostnameVerifier(publicSuffixMatcher);
+			httpClient = HttpClients.custom().setSSLHostnameVerifier(hostnameVerifier).build();
+			httpGet.setConfig(requestConfig);
+			// 执行请求
+			response = httpClient.execute(httpGet);
+			entity = response.getEntity();
+			responseContent = EntityUtils.toString(entity, "UTF-8");
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				// 关闭连接,释放资源
+				if (response != null) {
+					response.close();
+				}
+				if (httpClient != null) {
+					httpClient.close();
+				}
+			} catch (IOException e) {
+				logger.error(e.getLocalizedMessage());
+			}
+		}
+		return responseContent;
+	}
+}

+ 360 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/HttpClientUtils.java

@@ -0,0 +1,360 @@
+package com.cz.yingpu.frame.util;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.net.ssl.SSLContext;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.config.Registry;
+import org.apache.http.config.RegistryBuilder;
+import org.apache.http.conn.socket.ConnectionSocketFactory;
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.apache.http.entity.mime.content.FileBody;
+import org.apache.http.entity.mime.content.StringBody;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.ssl.SSLContexts;
+import org.apache.http.util.EntityUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HttpClientUtils {
+	
+	private static  PoolingHttpClientConnectionManager connectionManager = null;
+	//private static  HttpClientBuilder httpClientBuilder=null;
+	
+	private static final   Logger logger = LoggerFactory.getLogger(HttpClientUtils.class);
+	private static RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(5000).setConnectTimeout(5000)
+			.setConnectionRequestTimeout(3000).build();
+	
+	static{
+		
+		SSLContext sslcontext = SSLContexts.createSystemDefault();
+
+        // Create a registry of custom connection socket factories for supported
+        // protocol schemes.
+        Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
+            .register("http", PlainConnectionSocketFactory.INSTANCE)
+            .register("https", new SSLConnectionSocketFactory(sslcontext))
+            .build();
+
+	    	    connectionManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
+	    	    connectionManager.setMaxTotal(1000);
+	    	    connectionManager.setDefaultMaxPerRoute(200);//每个路由最大的请求数量
+	    	    //httpClientBuilder = HttpClients.custom().setConnectionManager(connectionManager).setDefaultRequestConfig(requestConfig);
+		       // HttpHost localhost = new HttpHost("http://www.baidu.com",80);
+		       //connectionManager.setMaxPerRoute(new HttpRoute(localhost), 200);
+		
+	}
+
+	public static CloseableHttpClient getHttpClient() {     
+        return getHttpClientBuilder().build();  
+    }
+	
+	public static CloseableHttpClient getHttpClient(SSLContext sslContext) {   
+        return getHttpClientBuilder(sslContext).build();  
+    }
+	
+	
+	public static HttpClientBuilder getHttpClientBuilder(){
+		return HttpClients.custom().setConnectionManager(connectionManager).setDefaultRequestConfig(requestConfig);
+	}
+	
+    public static HttpClientBuilder getHttpClientBuilder(SSLContext sslContext){
+    	if(sslContext!=null){
+    		return getHttpClientBuilder().setSSLContext(sslContext);
+    	}else{
+    		return getHttpClientBuilder();
+    	}
+    	
+	}
+	
+	
+	
+	
+   /**
+    * post 请求
+    * @param httpUrl 
+    *              请求地址
+    * @param sslContext 
+    *              ssl证书信息
+    * @return
+    */
+	public static String sendHttpPost(String httpUrl,SSLContext sslContext) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
+		return sendHttpPost(httpPost,sslContext);
+	}
+    
+    
+	/**
+	 * 发送 post请求
+	 * 
+	 * @param httpUrl
+	 *            地址
+	 */
+	public static String sendHttpPost(String httpUrl) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
+		return sendHttpPost(httpPost,null);
+	}
+	
+	
+
+	/**
+	 * 发送 post请求
+	 * 
+	 * @param httpUrl
+	 *            地址
+	 * @param params
+	 *            参数(格式:key1=value1&key2=value2)
+	 */
+	public static String sendHttpPost(String httpUrl, String params) {
+		return sendHttpPost(httpUrl, params, null);
+	}
+
+	/**
+	 * 发送 post请求
+	 * 
+	 * @param httpUrl
+	 *            地址
+	 * @param params
+	 *            参数(格式:key1=value1&key2=value2)
+     * @param sslContext 
+     *              ssl证书信息
+	 */
+	public static String sendHttpPost(String httpUrl, String params,SSLContext sslContext) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
+		try {
+			// 设置参数
+			StringEntity stringEntity = new StringEntity(params, "UTF-8");
+			stringEntity.setContentType("application/x-www-form-urlencoded");
+			httpPost.setEntity(stringEntity);
+		} catch (Exception e) {
+			logger.error(e.getLocalizedMessage(),e);
+		}
+		return sendHttpPost(httpPost,sslContext);
+	}
+	
+
+	/**
+	 * 发送 post请求
+	 * 
+	 * @param httpUrl
+	 *            地址
+	 * @param maps
+	 *            参数
+	 */
+	public static String sendHttpPost(String httpUrl, Map<String, String> maps) {
+		return sendHttpPost(httpUrl,maps,null);
+	}
+
+	/**
+	 * 发送 post请求
+	 * 
+	 * @param httpUrl
+	 *            地址
+	 * @param maps
+	 *            参数
+     * @param sslContext 
+     *              ssl证书信息
+	 */
+	public static String sendHttpPost(String httpUrl, Map<String, String> maps,SSLContext sslContext) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
+		// 创建参数队列
+		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
+		for (String key : maps.keySet()) {
+			nameValuePairs.add(new BasicNameValuePair(key, maps.get(key)));
+		}
+		try {
+			httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+		}
+		return sendHttpPost(httpPost,null);
+	}
+	
+	/**
+	 * 发送 post请求(带文件)
+	 * 
+	 * @param httpUrl
+	 *            地址
+	 * @param fileLists
+	 *            附件
+	 * @param maps
+	 *            参数
+	 */
+	public static String sendHttpPost(String httpUrl, List<File> fileLists,Map<String, String> maps) {
+		return sendHttpPost(httpUrl, fileLists, maps,null);
+	}
+
+	/**
+	 * 发送 post请求(带文件)
+	 * 
+	 * @param httpUrl
+	 *            地址
+	 * @param fileLists
+	 *            附件
+	 * @param maps
+	 *            参数
+     * @param sslContext 
+     *              ssl证书信息
+	 */
+	public static String sendHttpPost(String httpUrl, List<File> fileLists,Map<String, String> maps,SSLContext sslContext) {
+		HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
+		MultipartEntityBuilder meBuilder = MultipartEntityBuilder.create();
+		for (String key : maps.keySet()) {
+			meBuilder.addPart(key, new StringBody(maps.get(key), ContentType.TEXT_PLAIN));
+		}
+		for (File file : fileLists) {
+			FileBody fileBody = new FileBody(file);
+			meBuilder.addPart("files", fileBody);
+		}
+		HttpEntity reqEntity = meBuilder.build();
+		httpPost.setEntity(reqEntity);
+		return sendHttpPost(httpPost,sslContext);
+	}
+	
+	
+	
+	
+	/**
+	 * 发送Post请求
+	 * @param httpPost
+	 * @return
+	 */
+	public static String sendHttpPost(HttpPost httpPost) {
+		return sendHttpPost(httpPost, null);
+	}
+
+	/**
+	 * 发送Post请求
+	 * 
+	 * @param httpPost
+     * @param sslContext 
+     *              ssl证书信息
+	 * @return
+	 */
+	public static String sendHttpPost(HttpPost httpPost,SSLContext sslConext) {
+		CloseableHttpClient httpClient = getHttpClient(sslConext);
+		CloseableHttpResponse response = null;
+		HttpEntity entity = null;
+		String responseContent = null;
+		try {
+			// 执行请求
+			response = httpClient.execute(httpPost);
+			entity = response.getEntity();
+			responseContent = EntityUtils.toString(entity, "UTF-8");
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+		} finally {
+			
+			try{
+				// 关闭连接,释放资源
+				if (entity != null) {
+				   EntityUtils.consumeQuietly(entity); //会自动释放连接
+				}
+				if(response!=null){
+					response.close();
+				}
+				
+			}catch (Exception e) {
+				logger.error(e.getMessage(),e);
+			} 
+			
+	}
+		return responseContent;
+	}
+
+	
+	
+	/**
+	 * 发送 get请求
+	 * 
+	 * @param httpUrl
+	 */
+	public static String sendHttpGet(String httpUrl) {
+		return sendHttpGet(httpUrl,null);
+	}
+	
+	
+	/**
+	 * 发送 get请求
+	 * 
+	 * @param httpUrl
+     * @param sslContext 
+     *              ssl证书信息
+	 */
+	public static String sendHttpGet(String httpUrl,SSLContext sslConext) {
+		HttpGet httpGet = new HttpGet(httpUrl);// 创建get请求
+		return sendHttpGet(httpGet,sslConext);
+	}
+
+	/**
+	 * 发送Get请求
+	 * 
+	 * @param httpPost
+	 * @return
+	 */
+	public static String sendHttpGet(HttpGet httpGet) {
+		return sendHttpGet(httpGet, null);
+	}
+	/**
+	 * 发送Get请求
+	 * 
+	 * @param httpPost
+     * @param sslContext 
+     *              ssl证书信息
+	 * @return
+	 */
+	public static String sendHttpGet(HttpGet httpGet,SSLContext sslConext) {
+		CloseableHttpClient httpClient = getHttpClient(sslConext);
+		//System.out.println(httpClient);
+		CloseableHttpResponse response = null;
+		HttpEntity entity = null;
+		String responseContent = null;
+		try {
+			// 执行请求
+			response = httpClient.execute(httpGet);
+			entity = response.getEntity();
+			responseContent = EntityUtils.toString(entity, "UTF-8");
+		} catch (Exception e) {
+			logger.error(e.getMessage(),e);
+		} finally {
+				
+			try{
+				// 关闭连接,释放资源
+				if (entity != null) {
+				   EntityUtils.consumeQuietly(entity); //会自动释放连接
+				}
+				if(response!=null){
+					response.close();
+				}
+				
+			}catch (Exception e) {
+				logger.error(e.getMessage(),e);
+			} 
+				
+				
+		}
+		return responseContent;
+	}
+
+	
+	
+	
+}

+ 0 - 0
ypjf_web/src/main/java/com/cz/yingpu/frame/util/IPUtils.java


Някои файлове не бяха показани, защото твърде много файлове са промени