yangyoupeng

第一次提交

Showing 183 changed files with 2843 additions and 0 deletions
File mode changed
zhaoonline-coupen
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
</value>
</option>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default copy" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
<profile default="false" name="Annotation profile for coupen-dispatcher" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="coupen-dispatcher" />
</profile>
<profile default="false" name="Annotation profile for coupen-generator" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="coupen-generator" />
</profile>
<profile default="false" name="Annotation profile for coupen-processor" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="coupen-processor" />
</profile>
<profile default="false" name="Annotation profile for coupen-core" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="coupen-core" />
</profile>
<profile default="false" name="Annotation profile for coupen-dispatcher-api" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" />
<module name="coupen-dispatcher-api" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="coupen-core" target="1.8" />
<module name="coupen-dispatcher" target="1.8" />
<module name="coupen-dispatcher-api" target="1.8" />
<module name="coupen-generator" target="1.8" />
<module name="coupen-processor" target="1.8" />
<module name="zhaoonline-coupen" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>
\ No newline at end of file
<component name="CopyrightManager">
<settings default="" />
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/coupen-core" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/coupen-dispatcher" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/coupen-dispatcher-api" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/coupen-generator" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/coupen-processor" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: aopalliance:aopalliance:1.0">
<CLASSES>
<root url="jar://D:/maven/aopalliance/aopalliance/1.0/aopalliance-1.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/aopalliance/aopalliance/1.0/aopalliance-1.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: ch.qos.logback:logback-core:1.1.7">
<CLASSES>
<root url="jar://D:/maven/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: com.auth0:java-jwt:3.0.1">
<CLASSES>
<root url="jar://D:/maven/com/auth0/java-jwt/3.0.1/java-jwt-3.0.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/com/auth0/java-jwt/3.0.1/java-jwt-3.0.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/com/auth0/java-jwt/3.0.1/java-jwt-3.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0">
<CLASSES>
<root url="jar://D:/maven/com/fasterxml/jackson/core/jackson-annotations/2.8.0/jackson-annotations-2.8.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/com/fasterxml/jackson/core/jackson-annotations/2.8.0/jackson-annotations-2.8.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/com/fasterxml/jackson/core/jackson-annotations/2.8.0/jackson-annotations-2.8.0-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.1">
<CLASSES>
<root url="jar://D:/maven/com/fasterxml/jackson/core/jackson-core/2.8.1/jackson-core-2.8.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/com/fasterxml/jackson/core/jackson-core/2.8.1/jackson-core-2.8.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/com/fasterxml/jackson/core/jackson-core/2.8.1/jackson-core-2.8.1-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.1">
<CLASSES>
<root url="jar://D:/maven/com/fasterxml/jackson/core/jackson-databind/2.8.1/jackson-databind-2.8.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/com/fasterxml/jackson/core/jackson-databind/2.8.1/jackson-databind-2.8.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/com/fasterxml/jackson/core/jackson-databind/2.8.1/jackson-databind-2.8.1-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: com.google.guava:guava:18.0">
<CLASSES>
<root url="jar://D:/maven/com/google/guava/guava/18.0/guava-18.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/com/google/guava/guava/18.0/guava-18.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/com/google/guava/guava/18.0/guava-18.0-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: com.zhaoonline:microservice-redis:1.0.0-SNAPSHOT">
<CLASSES>
<root url="jar://D:/maven/com/zhaoonline/microservice-redis/1.0.0-SNAPSHOT/microservice-redis-1.0.0-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/com/zhaoonline/microservice-redis/1.0.0-SNAPSHOT/microservice-redis-1.0.0-SNAPSHOT-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/com/zhaoonline/microservice-redis/1.0.0-SNAPSHOT/microservice-redis-1.0.0-SNAPSHOT-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: commons-codec:commons-codec:1.10">
<CLASSES>
<root url="jar://D:/maven/commons-codec/commons-codec/1.10/commons-codec-1.10.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/commons-codec/commons-codec/1.10/commons-codec-1.10-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/commons-codec/commons-codec/1.10/commons-codec-1.10-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: commons-logging:commons-logging:1.2">
<CLASSES>
<root url="jar://D:/maven/commons-logging/commons-logging/1.2/commons-logging-1.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/commons-logging/commons-logging/1.2/commons-logging-1.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/commons-logging/commons-logging/1.2/commons-logging-1.2-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: io.jsonwebtoken:jjwt:0.7.0">
<CLASSES>
<root url="jar://D:/maven/io/jsonwebtoken/jjwt/0.7.0/jjwt-0.7.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/io/jsonwebtoken/jjwt/0.7.0/jjwt-0.7.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/io/jsonwebtoken/jjwt/0.7.0/jjwt-0.7.0-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: javax.validation:validation-api:1.1.0.Final">
<CLASSES>
<root url="jar://D:/maven/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: joda-time:joda-time:2.9.4">
<CLASSES>
<root url="jar://D:/maven/joda-time/joda-time/2.9.4/joda-time-2.9.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/joda-time/joda-time/2.9.4/joda-time-2.9.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/joda-time/joda-time/2.9.4/joda-time-2.9.4-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: junit:junit:4.12">
<CLASSES>
<root url="jar://D:/maven/junit/junit/4.12/junit-4.12.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/junit/junit/4.12/junit-4.12-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/junit/junit/4.12/junit-4.12-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.apache.commons:commons-pool2:2.4.2">
<CLASSES>
<root url="jar://D:/maven/org/apache/commons/commons-pool2/2.4.2/commons-pool2-2.4.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/apache/commons/commons-pool2/2.4.2/commons-pool2-2.4.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/apache/commons/commons-pool2/2.4.2/commons-pool2-2.4.2-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.bitbucket.b_c:jose4j:0.5.2">
<CLASSES>
<root url="jar://D:/maven/org/bitbucket/b_c/jose4j/0.5.2/jose4j-0.5.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/bitbucket/b_c/jose4j/0.5.2/jose4j-0.5.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/bitbucket/b_c/jose4j/0.5.2/jose4j-0.5.2-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.bouncycastle:bcprov-jdk15on:1.55">
<CLASSES>
<root url="jar://D:/maven/org/bouncycastle/bcprov-jdk15on/1.55/bcprov-jdk15on-1.55.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/bouncycastle/bcprov-jdk15on/1.55/bcprov-jdk15on-1.55-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/bouncycastle/bcprov-jdk15on/1.55/bcprov-jdk15on-1.55-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.hamcrest:hamcrest-core:1.3">
<CLASSES>
<root url="jar://D:/maven/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.mockito:mockito-all:1.10.19">
<CLASSES>
<root url="jar://D:/maven/org/mockito/mockito-all/1.10.19/mockito-all-1.10.19.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/mockito/mockito-all/1.10.19/mockito-all-1.10.19-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/mockito/mockito-all/1.10.19/mockito-all-1.10.19-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.slf4j:jcl-over-slf4j:1.7.21">
<CLASSES>
<root url="jar://D:/maven/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.slf4j:slf4j-api:1.7.21">
<CLASSES>
<root url="jar://D:/maven/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework.data:spring-data-commons:1.12.2.RELEASE">
<CLASSES>
<root url="jar://D:/maven/org/springframework/data/spring-data-commons/1.12.2.RELEASE/spring-data-commons-1.12.2.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/springframework/data/spring-data-commons/1.12.2.RELEASE/spring-data-commons-1.12.2.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/springframework/data/spring-data-commons/1.12.2.RELEASE/spring-data-commons-1.12.2.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework.data:spring-data-keyvalue:1.1.2.RELEASE">
<CLASSES>
<root url="jar://D:/maven/org/springframework/data/spring-data-keyvalue/1.1.2.RELEASE/spring-data-keyvalue-1.1.2.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/springframework/data/spring-data-keyvalue/1.1.2.RELEASE/spring-data-keyvalue-1.1.2.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/springframework/data/spring-data-keyvalue/1.1.2.RELEASE/spring-data-keyvalue-1.1.2.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework.data:spring-data-redis:1.7.2.RELEASE">
<CLASSES>
<root url="jar://D:/maven/org/springframework/data/spring-data-redis/1.7.2.RELEASE/spring-data-redis-1.7.2.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/springframework/data/spring-data-redis/1.7.2.RELEASE/spring-data-redis-1.7.2.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/springframework/data/spring-data-redis/1.7.2.RELEASE/spring-data-redis-1.7.2.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-aop:4.2.6.RELEASE">
<CLASSES>
<root url="jar://D:/maven/org/springframework/spring-aop/4.2.6.RELEASE/spring-aop-4.2.6.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/springframework/spring-aop/4.2.6.RELEASE/spring-aop-4.2.6.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/springframework/spring-aop/4.2.6.RELEASE/spring-aop-4.2.6.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-beans:4.3.2.RELEASE">
<CLASSES>
<root url="jar://D:/maven/org/springframework/spring-beans/4.3.2.RELEASE/spring-beans-4.3.2.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/springframework/spring-beans/4.3.2.RELEASE/spring-beans-4.3.2.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/springframework/spring-beans/4.3.2.RELEASE/spring-beans-4.3.2.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-context:4.3.2.RELEASE">
<CLASSES>
<root url="jar://D:/maven/org/springframework/spring-context/4.3.2.RELEASE/spring-context-4.3.2.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/springframework/spring-context/4.3.2.RELEASE/spring-context-4.3.2.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/springframework/spring-context/4.3.2.RELEASE/spring-context-4.3.2.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-context-support:4.3.2.RELEASE">
<CLASSES>
<root url="jar://D:/maven/org/springframework/spring-context-support/4.3.2.RELEASE/spring-context-support-4.3.2.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/springframework/spring-context-support/4.3.2.RELEASE/spring-context-support-4.3.2.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/springframework/spring-context-support/4.3.2.RELEASE/spring-context-support-4.3.2.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-core:4.3.2.RELEASE">
<CLASSES>
<root url="jar://D:/maven/org/springframework/spring-core/4.3.2.RELEASE/spring-core-4.3.2.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/springframework/spring-core/4.3.2.RELEASE/spring-core-4.3.2.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/springframework/spring-core/4.3.2.RELEASE/spring-core-4.3.2.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-expression:4.3.2.RELEASE">
<CLASSES>
<root url="jar://D:/maven/org/springframework/spring-expression/4.3.2.RELEASE/spring-expression-4.3.2.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/springframework/spring-expression/4.3.2.RELEASE/spring-expression-4.3.2.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/springframework/spring-expression/4.3.2.RELEASE/spring-expression-4.3.2.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-oxm:4.2.6.RELEASE">
<CLASSES>
<root url="jar://D:/maven/org/springframework/spring-oxm/4.2.6.RELEASE/spring-oxm-4.2.6.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/springframework/spring-oxm/4.2.6.RELEASE/spring-oxm-4.2.6.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/springframework/spring-oxm/4.2.6.RELEASE/spring-oxm-4.2.6.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: org.springframework:spring-tx:4.2.6.RELEASE">
<CLASSES>
<root url="jar://D:/maven/org/springframework/spring-tx/4.2.6.RELEASE/spring-tx-4.2.6.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/org/springframework/spring-tx/4.2.6.RELEASE/spring-tx-4.2.6.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/org/springframework/spring-tx/4.2.6.RELEASE/spring-tx-4.2.6.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Maven: redis.clients:jedis:2.9.0">
<CLASSES>
<root url="jar://D:/maven/redis/clients/jedis/2.9.0/jedis-2.9.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://D:/maven/redis/clients/jedis/2.9.0/jedis-2.9.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://D:/maven/redis/clients/jedis/2.9.0/jedis-2.9.0-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/coupen-core/coupen-core.iml" filepath="$PROJECT_DIR$/coupen-core/coupen-core.iml" />
<module fileurl="file://$PROJECT_DIR$/coupen-dispatcher/coupen-dispatcher.iml" filepath="$PROJECT_DIR$/coupen-dispatcher/coupen-dispatcher.iml" />
<module fileurl="file://$PROJECT_DIR$/coupen-dispatcher-api/coupen-dispatcher-api.iml" filepath="$PROJECT_DIR$/coupen-dispatcher-api/coupen-dispatcher-api.iml" />
<module fileurl="file://$PROJECT_DIR$/coupen-generator/coupen-generator.iml" filepath="$PROJECT_DIR$/coupen-generator/coupen-generator.iml" />
<module fileurl="file://$PROJECT_DIR$/coupen-processor/coupen-processor.iml" filepath="$PROJECT_DIR$/coupen-processor/coupen-processor.iml" />
<module fileurl="file://$PROJECT_DIR$/zhaoonline-coupen.iml" filepath="$PROJECT_DIR$/zhaoonline-coupen.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
This diff could not be displayed because it is too large.
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:18.0" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.1" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.21" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.7" level="project" />
<orderEntry type="library" name="Maven: com.zhaoonline:microservice-redis:1.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: redis.clients:jedis:2.9.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.4.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:1.7.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:1.1.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:1.12.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:4.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:4.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.2.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.slf4j:jcl-over-slf4j:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.10.19" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: com.auth0:java-jwt:3.0.1" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.55" level="project" />
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.7.0" level="project" />
<orderEntry type="library" name="Maven: org.bitbucket.b_c:jose4j:0.5.2" level="project" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<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-4.0.0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>com.zhaoonline.coupen</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>coupen-core</artifactId>
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>com.zhaoonline</groupId>
<artifactId>microservice-redis</artifactId>
<exclusions>
<exclusion>
<groupId>com.zhaoonline</groupId>
<artifactId>alpaca-config-zookeeper</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- test相关 -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- jwt相关 -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
</dependency>
<dependency>
<groupId>org.bitbucket.b_c</groupId>
<artifactId>jose4j</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.zhaoonline.coupen.bean;
import org.joda.time.DateTime;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 11:13<br/>
* Description:活动
*/
public class Activity {
private String activityName;
private Integer activityID;
//活动开启时间
protected DateTime startDate;
//活动结束时间
protected DateTime endDate;
public Activity(){
}
public Activity(Integer ID,String name){
this.activityName = name;
this.activityID=ID;
}
public String getActivityName() {
return activityName;
}
public void setActivityName(String activityName) {
this.activityName = activityName;
}
public Integer getActivityID() {
return activityID;
}
public void setActivityID(Integer activityID) {
this.activityID = activityID;
}
public DateTime getStartDate() {
return startDate;
}
public void setStartDate(DateTime startDate) {
this.startDate = startDate;
}
public DateTime getEndDate() {
return endDate;
}
public void setEndDate(DateTime endDate) {
this.endDate = endDate;
}
}
package com.zhaoonline.coupen.bean;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 11:06<br/>
* Description:业务类型:投资币、自营等
*/
public class BizType {
private Integer bizTypeID;
private String bizTypeName;
public BizType(){
}
public BizType(Integer ID,String name){
this.bizTypeName = name;
this.bizTypeID=ID;
}
public Integer getBizTypeID() {
return bizTypeID;
}
public void setBizTypeID(Integer bizTypeID) {
this.bizTypeID = bizTypeID;
}
public String getBizTypeName() {
return bizTypeName;
}
public void setBizTypeName(String bizTypeName) {
this.bizTypeName = bizTypeName;
}
}
package com.zhaoonline.coupen.bean;
import org.joda.time.DateTime;
import java.math.BigDecimal;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 19:16<br/>
* Description:please descript you class
*/
public class CommonCoupenEntity {
protected CommonCoupenSeed seed;
protected BigDecimal amount;
protected String coupenID;
protected OwnerUser ownerUser;
//预定分发日期。
protected DateTime distributeDate;
public CommonCoupenSeed getSeed() {
return seed;
}
public void setSeed(CommonCoupenSeed seed) {
this.seed = seed;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getCoupenID() {
return coupenID;
}
public void setCoupenID(String coupenID) {
this.coupenID = coupenID;
}
public DateTime getDistributeDate() {
return distributeDate;
}
public void setDistributeDate(DateTime distributeDate) {
this.distributeDate = distributeDate;
}
public OwnerUser getOwnerUser() {
return ownerUser;
}
public void setOwnerUser(OwnerUser ownerUser) {
this.ownerUser = ownerUser;
}
}
package com.zhaoonline.coupen.bean;
import org.joda.time.DateTime;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 10:41<br/>
* Description:please descript you class
*/
public class CommonCoupenSeed {
protected Activity activity;
protected String seedID;
protected CoupenCatagory catagory;
protected BizType bizType;
protected BigDecimal totalAmount=new BigDecimal(0);
//红包的个数至少为1;
protected @NotNull Integer coupenCount=new Integer(1);
//validStartDate和validEndDate为有效期
protected DateTime validStartDate;
protected DateTime validEndDate;
//最后领取时间
protected DateTime drawDeadlineDate;
protected DistributeType distributeStrategy;
protected DrawType drawType;
public Activity getActivity() {
return activity;
}
public void setActivity(Activity activity) {
this.activity = activity;
}
public String getSeedID() {
return seedID;
}
public void setSeedID(String seedID) {
this.seedID = seedID;
}
public CoupenCatagory getCatagory() {
return catagory;
}
public void setCatagory(CoupenCatagory catagory) {
this.catagory = catagory;
}
public BizType getBizType() {
return bizType;
}
public void setBizType(BizType bizType) {
this.bizType = bizType;
}
public BigDecimal getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
}
public Integer getCoupenCount() {
return coupenCount;
}
public void setCoupenCount(Integer coupenCount) {
this.coupenCount = coupenCount;
}
public DateTime getDrawDeadlineDate() {
return drawDeadlineDate;
}
public void setDrawDeadlineDate(DateTime drawDeadlineDate) {
this.drawDeadlineDate = drawDeadlineDate;
}
public DateTime getValidStartDate() {
return validStartDate;
}
public void setValidStartDate(DateTime validStartDate) {
this.validStartDate = validStartDate;
}
public DateTime getValidEndDate() {
return validEndDate;
}
public void setValidEndDate(DateTime validEndDate) {
this.validEndDate = validEndDate;
}
public DistributeType getDistributeStrategy() {
return distributeStrategy;
}
public void setDistributeStrategy(DistributeType distributeStrategy) {
this.distributeStrategy = distributeStrategy;
}
public DrawType getDrawType() {
return drawType;
}
public void setDrawType(DrawType drawType) {
this.drawType = drawType;
}
}
package com.zhaoonline.coupen.bean;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 11:03<br/>
* Description:分类:可以是红包、可以优惠券
*/
public class CoupenCatagory {
private Integer catagoryID;
private String catagoryName;
public CoupenCatagory(){
}
public CoupenCatagory(Integer ID,String name){
this.catagoryName = name;
this.catagoryID=ID;
}
public Integer getCatagoryID() {
return catagoryID;
}
public void setCatagoryID(Integer catagoryID) {
this.catagoryID = catagoryID;
}
public String getCatagoryName() {
return catagoryName;
}
public void setCatagoryName(String catagoryName) {
this.catagoryName = catagoryName;
}
}
package com.zhaoonline.coupen.bean;
import java.util.ArrayList;
import java.util.List;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 19:14<br/>
* Description:Context表示上下文的意思,其中可以包括CoupenEnttity
*/
public class CoupenContext<T extends CommonCoupenEntity,R extends CommonCoupenSeed> {
private R seed=null;
private List<T> coupens =new ArrayList<T>(0);
public List<T> getCoupens() {
return coupens;
}
public void setCoupens(List<T> coupens) {
this.coupens = coupens;
}
public R getSeed() {
return seed;
}
public void setSeed(R seed) {
this.seed = seed;
}
public static CoupenContext empty() {
CoupenContext context =new CoupenContext();
return context;
}
}
package com.zhaoonline.coupen.bean;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 11:18<br/>
* Description:分配类型。该类作为元数据。
*/
public class DistributeType {
private Integer typeID;
private String typeName;
public Integer getTypeID() {
return typeID;
}
public void setTypeID(Integer typeID) {
this.typeID = typeID;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
}
package com.zhaoonline.coupen.bean;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 11:14<br/>
* Description:领取类型,该类作为元数据
*/
public class DrawType {
private Integer typeID;
private String typeName;
public Integer getTypeID() {
return typeID;
}
public void setTypeID(Integer typeID) {
this.typeID = typeID;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
}
package com.zhaoonline.coupen.bean;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/15<br/>
* Time: 10:45<br/>
* Description:HelpOpenCoupenSeed即 帮拆红包。
* 用户在领取红包后,红包并不能立刻生效。用户必须邀请一定数目的好友进行帮拆
* 帮拆的红包,也可以分为:1)满足全部帮拆好友数目后,红包才生效。
* 2)即拆即用,好友每帮忙拆一个红包。其帮拆的一部分立刻生效,红包的主人可以立即使用该红包。
*/
public class HelpOpenCoupenSeed extends CommonCoupenSeed {
//帮拆的数目
private Integer helperCount=new Integer(0);
private HelpOpenType helpOpenType=HelpOpenType.VALIDE_LAST_TIME;
public Integer getHelperCount() {
return helperCount;
}
public void setHelperCount(Integer helperCount) {
this.helperCount = helperCount;
}
public HelpOpenType getHelpOpenType() {
return helpOpenType;
}
public void setHelpOpenType(HelpOpenType helpOpenType) {
this.helpOpenType = helpOpenType;
}
}
package com.zhaoonline.coupen.bean;
/**
* Created by 杨有鹏 on 2016/12/15.
* 帮拆类型
*/
public enum HelpOpenType {
UNKNOWN(0),//未知
VALIDE_LAST_TIME(1),//最后时刻生效即帮拆
VALIDE_ON_TIME(2);//帮拆就生效
private final int type;
HelpOpenType(int type){
this.type=type;
}
public static HelpOpenType build(int type){
switch (type){
case 1:return VALIDE_LAST_TIME;
case 2:return VALIDE_ON_TIME;
default:return UNKNOWN;
}
}
public boolean is(HelpOpenType helpOpenType) {
return this.type == helpOpenType.type;
}
public boolean isNot(HelpOpenType helpOpenType){
return !is(helpOpenType);
}
}
package com.zhaoonline.coupen.bean;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/15<br/>
* Time: 10:29<br/>
* Description:该红包类型。主要服务对象是好友帮拆的即拆即用的Counpen
* 所谓即拆即用的Coupen:用户在领取红包后,红包并不能立刻生效。用户必须邀请一定数目的好友进行帮拆,
* 每个好友帮拆之后,红包中其中一部分就生效,用户在这部分红包生效之后立刻使用该红包。可使用的额度只是好友帮拆的内容
*/
public class LeafCoupenEntity extends CommonCoupenEntity {
private CommonCoupenEntity parentCoupen;
public CommonCoupenEntity getParentCoupen() {
return parentCoupen;
}
public void setParentCoupen(CommonCoupenEntity parentCoupen) {
this.parentCoupen = parentCoupen;
}
}
package com.zhaoonline.coupen.bean;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/15<br/>
* Time: 14:33<br/>
* Description:用户信息
*/
public class OwnerUser {
private String ownerUserID;
private String ownerUserType;
public String getOwnerUserID() {
return ownerUserID;
}
public void setOwnerUserID(String ownerUserID) {
this.ownerUserID = ownerUserID;
}
public String getOwnerUserType() {
return ownerUserType;
}
public void setOwnerUserType(String ownerUserType) {
this.ownerUserType = ownerUserType;
}
}
package com.zhaoonline.coupen.cache;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/15<br/>
* Time: 17:55<br/>
* Description:please descript you class
*/
public class CacheEntry<T> {
String key;
T value;
CacheEntry pre;
CacheEntry next;
}
package com.zhaoonline.coupen.cache;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/15<br/>
* Time: 17:54<br/>
* Description:
*/
public class LRUCache<T> {
private ConcurrentHashMap<String, T> caches = null;
private CacheEntry<T> first;
private CacheEntry<T> last;
private int capacity = 0;
public LRUCache() {
this(200);
}
public LRUCache(int capacity) {
this.capacity=capacity;
this.caches = new ConcurrentHashMap<String,T>(capacity);
}
public synchronized T put(String key, T value) {
CacheEntry<T> entry = getEntry(key);
if (entry == null) {
if (caches.size() >= capacity) {
caches.remove(last.key);
removeLast();
}
entry = new CacheEntry<T>();
entry.key = key;
}else{
entry.value=null;
}
entry.value = value;
moveToFirst(entry);
return caches.put(key, value);
}
public int getSize() {
return caches.size();
}
public synchronized T get(String key) {
CacheEntry<T> entry = getEntry(key);
if (entry == null){
return null;
}
moveToFirst(entry);
return entry.value;
}
public synchronized void remove(String key) {
CacheEntry<T> entry = getEntry(key);
if (entry != null) {
if (entry.pre != null)
entry.pre.next = entry.next;
if (entry.next != null)
entry.next.pre = entry.pre;
if (entry == first)
first = entry.next;
if (entry == last)
last = entry.pre;
}
caches.remove(key);
}
private void removeLast() {
if (last != null) {
last = last.pre;
if (last == null)
first = null;
else
last.next = null;
}
}
private void moveToFirst(CacheEntry<T> entry) {
if (entry == first)
return;
if (entry.pre != null)
entry.pre.next = entry.next;
if (entry.next != null)
entry.next.pre = entry.pre;
if (entry == last)
last = last.pre;
if (first == null || last == null) {
first = last = entry;
return;
}
entry.next = first;
first.pre = entry;
first = entry;
entry.pre = null;
}
private CacheEntry<T> getEntry(String key) {
T item = caches.get(key);
if (item == null) {
return null;
}
CacheEntry<T> entry = new CacheEntry<T>();
entry.key = key;
entry.value = item;
return entry;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
CacheEntry<T> entry = first;
while (entry != null) {
sb.append(String.format("%s:%s ", entry.key, entry.value));
entry = entry.next;
}
return sb.toString();
}
public Set<String> keySet(){
Set<String> keSet=new HashSet<String>();
ConcurrentHashMap.KeySetView<String, T> keysSetView= caches.keySet();
Iterator<String> iter=keysSetView.iterator();
while(iter.hasNext()){
String key=iter.next();
keSet.add(key);
}
return keSet;
}
}
package com.zhaoonline.coupen.cache;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/15<br/>
* Time: 18:13<br/>
* Description:随机缓存
*/
public class RandomCache<K,V> {
private ConcurrentHashMap<K,V> caches = null;
private int capacity = 0;
private List<K> keys=null;
public RandomCache() {
this(200);
}
public RandomCache(int capacity) {
this.capacity=capacity;
this.caches = new ConcurrentHashMap<K,V>(capacity);
this.keys= Collections.synchronizedList(new ArrayList<K>(capacity));
}
public synchronized void put(K key,V value){
caches.put(key, value);
keys.add(key);
}
public synchronized void remove(K key){
caches.remove(key);
keys.remove(key);
}
public K randomKey(){
Random random = new Random();
if(keys.size() == 0){
return null;
}
int keyIndex=random.nextInt(keys.size());
K key=keys.get(keyIndex);
return key;
}
public synchronized K shuffledRandomKey(){
List<K> clonedKeys=new ArrayList<>(keys);
Collections.shuffle(clonedKeys);
if(clonedKeys.size() == 0){
return null;
}
return clonedKeys.get(0);
}
public int size(){
return caches.size();
}
public boolean isEmpty(){
return caches.isEmpty();
}
public List<K> allKeys(){
return keys;
}
public V getCache(String key){
if(key == null){
return null;
}
return caches.get(key);
}
public synchronized void clear() {
this.caches = new ConcurrentHashMap<K,V>(capacity);
this.keys= Collections.synchronizedList(new ArrayList<K>(capacity));
}
}
package com.zhaoonline.coupen.concurrent;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/16<br/>
* Time: 17:48<br/>
* Description:please descript you class
*/
public interface ConcurrentStrategy {
public boolean proceeding();
public boolean proceeding(long timeout);
}
package com.zhaoonline.coupen.concurrent;
import com.zhaoonline.coupen.concurrent.tokenbucket.TokenBucket;
import com.zhaoonline.coupen.concurrent.tokenbucket.TokenBuckets;
import java.util.concurrent.TimeUnit;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/16<br/>
* Time: 17:49<br/>
* Description:please descript you class
*/
public class TokenBucktStrategy implements ConcurrentStrategy {
TokenBucket bucket = null;
public TokenBucktStrategy(){
bucket = TokenBuckets.builder()
.withCapacity(1000)
.withFixedIntervalRefillStrategy(400, 1, TimeUnit.SECONDS)
.build();
}
/**
* 立即返回
* @return
*/
@Override
public boolean proceeding() {
return bucket.tryConsume();
}
/**
* @param 令牌桶的timemout等同于从令牌桶里面获取多少个令牌。
* @return
*/
@Override
public boolean proceeding(long timeout) {
bucket.consume(timeout);
return true;
}
}
package com.zhaoonline.coupen.concurrent.tokenbucket;
import com.google.common.base.Ticker;
import java.util.concurrent.TimeUnit;
/**
* A token bucket refill strategy that will provide N tokens for a token bucket to consume every T units of time.
* The tokens are refilled in bursts rather than at a fixed rate. This refill strategy will never allow more than
* N tokens to be consumed during a window of time T.
*/
public class FixedIntervalRefillStrategy implements TokenBucketImpl.RefillStrategy {
private final Ticker ticker;
private final long numTokensPerPeriod;
private final long periodDurationInNanos;
private long lastRefillTime;
private long nextRefillTime;
/**
* Create a FixedIntervalRefillStrategy.
*
* @param ticker A ticker to use to measure time.
* @param numTokensPerPeriod The number of tokens to add to the bucket every period.
* @param period How often to refill the bucket.
* @param unit Unit for period.
*/
public FixedIntervalRefillStrategy(Ticker ticker, long numTokensPerPeriod, long period, TimeUnit unit) {
this.ticker = ticker;
this.numTokensPerPeriod = numTokensPerPeriod;
this.periodDurationInNanos = unit.toNanos(period);
this.lastRefillTime = -periodDurationInNanos;
this.nextRefillTime = -periodDurationInNanos;
}
@Override
public synchronized long refill() {
long now = ticker.read();
if (now < nextRefillTime) {
return 0;
}
// We now know that we need to refill the bucket with some tokens, the question is how many. We need to count how
// many periods worth of tokens we've missed.
long numPeriods = Math.max(0, (now - lastRefillTime) / periodDurationInNanos);
// Move the last refill time forward by this many periods.
lastRefillTime += numPeriods * periodDurationInNanos;
// ...and we'll refill again one period after the last time we refilled.
nextRefillTime = lastRefillTime + periodDurationInNanos;
return numPeriods * numTokensPerPeriod;
}
@Override
public long getDurationUntilNextRefill(TimeUnit unit) {
long now = ticker.read();
return unit.convert(Math.max(0, nextRefillTime - now), TimeUnit.NANOSECONDS);
}
}
\ No newline at end of file
package com.zhaoonline.coupen.concurrent.tokenbucket;
import java.util.concurrent.TimeUnit;
/**
* A token bucket is used for rate limiting access to a portion of code.
*
* @see <a href="http://en.wikipedia.org/wiki/Token_bucket">Token Bucket on Wikipedia</a>
* @see <a href="http://en.wikipedia.org/wiki/Leaky_bucket">Leaky Bucket on Wikipedia</a>
*/
public interface TokenBucket {
/**
* Returns the capacity of this token bucket. This is the maximum number of tokens that the bucket can hold at
* any one time.
*
* @return The capacity of the bucket.
*/
long getCapacity();
/**
* Returns the current number of tokens in the bucket. If the bucket is empty then this method will return 0.
*
* @return The current number of tokens in the bucket.
*/
long getNumTokens();
/**
* Returns the amount of time in the specified time unit until the next group of tokens can be added to the token
* bucket.
*
* @param unit The time unit to express the return value in.
* @return The amount of time until the next group of tokens can be added to the token bucket.
* @see org.isomorphism.util.TokenBucket.RefillStrategy#getDurationUntilNextRefill(java.util.concurrent.TimeUnit)
*/
long getDurationUntilNextRefill(TimeUnit unit) throws UnsupportedOperationException;
/**
* Attempt to consume a single token from the bucket. If it was consumed then {@code true} is returned, otherwise
* {@code false} is returned.
*
* @return {@code true} if a token was consumed, {@code false} otherwise.
*/
boolean tryConsume();
/**
* Attempt to consume a specified number of tokens from the bucket. If the tokens were consumed then {@code true}
* is returned, otherwise {@code false} is returned.
*
* @param numTokens The number of tokens to consume from the bucket, must be a positive number.
* @return {@code true} if the tokens were consumed, {@code false} otherwise.
*/
boolean tryConsume(long numTokens);
/**
* Consume a single token from the bucket. If no token is currently available then this method will block until a
* token becomes available.
*/
void consume();
/**
* Consumes multiple tokens from the bucket. If enough tokens are not currently available then this method will block
* until
*
* @param numTokens The number of tokens to consume from teh bucket, must be a positive number.
*/
void consume(long numTokens);
/**
* Refills the bucket with the specified number of tokens. If the bucket is currently full or near capacity then
* fewer than {@code numTokens} may be added.
*
* @param numTokens The number of tokens to add to the bucket.
*/
void refill(long numTokens);
/**
* Encapsulation of a refilling strategy for a token bucket.
*/
static interface RefillStrategy {
/**
* Returns the number of tokens to add to the token bucket.
*
* @return The number of tokens to add to the token bucket.
*/
long refill();
/**
* Returns the amount of time in the specified time unit until the next group of tokens can be added to the token
* bucket. Please note, depending on the {@code SleepStrategy} used by the token bucket, tokens may not actually
* be added until much after the returned duration. If for some reason the implementation of
* {@code RefillStrategy} doesn't support knowing when the next batch of tokens will be added, then an
* {@code UnsupportedOperationException} may be thrown. Lastly, if the duration until the next time tokens will
* be added to the token bucket is less than a single unit of the passed in time unit then this method will
* return 0.
*
* @param unit The time unit to express the return value in.
* @return The amount of time until the next group of tokens can be added to the token bucket.
*/
long getDurationUntilNextRefill(TimeUnit unit) throws UnsupportedOperationException;
}
/**
* Encapsulation of a strategy for relinquishing control of the CPU.
*/
static interface SleepStrategy {
/**
* Sleep for a short period of time to allow other threads and system processes to execute.
*/
void sleep();
}
}
\ No newline at end of file
package com.zhaoonline.coupen.concurrent.tokenbucket;
import java.util.concurrent.TimeUnit;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* A token bucket implementation that is of a leaky bucket in the sense that it has a finite capacity and any added
* tokens that would exceed this capacity will "overflow" out of the bucket and are lost forever.
* <p>
* In this implementation the rules for refilling the bucket are encapsulated in a provided {@code RefillStrategy}
* instance. Prior to attempting to consume any tokens the refill strategy will be consulted to see how many tokens
* should be added to the bucket.
* <p>
* In addition in this implementation the method of yielding CPU control is encapsulated in the provided
* {@code SleepStrategy} instance. For high performance applications where tokens are being refilled incredibly quickly
* and an accurate bucket implementation is required, it may be useful to never yield control of the CPU and to instead
* busy wait. This strategy allows the caller to make this decision for themselves instead of the library forcing a
* decision.
*/
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/16<br/>
* Time: 17:42<br/>
* Description:please descript you class
*/
public class TokenBucketImpl implements TokenBucket {
private final long capacity;
private final RefillStrategy refillStrategy;
private final SleepStrategy sleepStrategy;
private long size;
TokenBucketImpl(long capacity, long initialTokens, RefillStrategy refillStrategy, SleepStrategy sleepStrategy) {
checkArgument(capacity > 0);
checkArgument(initialTokens <= capacity);
this.capacity = capacity;
this.refillStrategy = checkNotNull(refillStrategy);
this.sleepStrategy = checkNotNull(sleepStrategy);
this.size = initialTokens;
}
/**
* Returns the capacity of this token bucket. This is the maximum number of tokens that the bucket can hold at
* any one time.
*
* @return The capacity of the bucket.
*/
@Override
public long getCapacity() {
return capacity;
}
/**
* Returns the current number of tokens in the bucket. If the bucket is empty then this method will return 0.
*
* @return The current number of tokens in the bucket.
*/
@Override
public synchronized long getNumTokens() {
// Give the refill strategy a chance to add tokens if it needs to so that we have an accurate
// count.
refill(refillStrategy.refill());
return size;
}
/**
* Returns the amount of time in the specified time unit until the next group of tokens can be added to the token
* bucket.
*
* @see org.isomorphism.util.TokenBucket.RefillStrategy#getDurationUntilNextRefill(java.util.concurrent.TimeUnit)
* @param unit The time unit to express the return value in.
* @return The amount of time until the next group of tokens can be added to the token bucket.
*/
@Override
public long getDurationUntilNextRefill(TimeUnit unit) throws UnsupportedOperationException {
return refillStrategy.getDurationUntilNextRefill(unit);
}
/**
* Attempt to consume a single token from the bucket. If it was consumed then {@code true} is returned, otherwise
* {@code false} is returned.
*
* @return {@code true} if a token was consumed, {@code false} otherwise.
*/
public boolean tryConsume() {
return tryConsume(1);
}
/**
* Attempt to consume a specified number of tokens from the bucket. If the tokens were consumed then {@code true}
* is returned, otherwise {@code false} is returned.
*
* @param numTokens The number of tokens to consume from the bucket, must be a positive number.
* @return {@code true} if the tokens were consumed, {@code false} otherwise.
*/
public synchronized boolean tryConsume(long numTokens) {
checkArgument(numTokens > 0, "Number of tokens to consume must be positive");
checkArgument(numTokens <= capacity, "Number of tokens to consume must be less than the capacity of the bucket.");
refill(refillStrategy.refill());
// Now try to consume some tokens
if (numTokens <= size) {
size -= numTokens;
return true;
}
return false;
}
/**
* Consume a single token from the bucket. If no token is currently available then this method will block until a
* token becomes available.
*/
public void consume() {
consume(1);
}
/**
* Consumes multiple tokens from the bucket. If enough tokens are not currently available then this method will block
* until
*
* @param numTokens The number of tokens to consume from teh bucket, must be a positive number.
*/
public void consume(long numTokens) {
while (true) {
if (tryConsume(numTokens)) {
break;
}
sleepStrategy.sleep();
}
}
/**
* Refills the bucket with the specified number of tokens. If the bucket is currently full or near capacity then
* fewer than {@code numTokens} may be added.
*
* @param numTokens The number of tokens to add to the bucket.
*/
public synchronized void refill(long numTokens) {
long newTokens = Math.min(capacity, Math.max(0, numTokens));
size = Math.max(0, Math.min(size + newTokens, capacity));
}
}
package com.zhaoonline.coupen.concurrent.tokenbucket;
import com.google.common.base.Ticker;
import com.google.common.util.concurrent.Uninterruptibles;
import java.util.concurrent.TimeUnit;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/16<br/>
* Time: 17:42<br/>
* Description:please descript you class
*/
/**
* Static utility methods pertaining to creating {@link TokenBucketImpl} instances.
*/
public final class TokenBuckets {
private TokenBuckets() {
}
/**
* Create a new builder for token buckets.
*/
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Long capacity = null;
private long initialTokens = 0;
private TokenBucketImpl.RefillStrategy refillStrategy = null;
private TokenBucketImpl.SleepStrategy sleepStrategy = YIELDING_SLEEP_STRATEGY;
private final Ticker ticker = Ticker.systemTicker();
/**
* Specify the overall capacity of the token bucket.
*/
public Builder withCapacity(long numTokens) {
checkArgument(numTokens > 0, "Must specify a positive number of tokens");
capacity = numTokens;
return this;
}
/**
* Initialize the token bucket with a specific number of tokens.
*/
public Builder withInitialTokens(long numTokens) {
checkArgument(numTokens > 0, "Must specify a positive number of tokens");
initialTokens = numTokens;
return this;
}
/**
* Refill tokens at a fixed interval.
*/
public Builder withFixedIntervalRefillStrategy(long refillTokens, long period, TimeUnit unit) {
return withRefillStrategy(new FixedIntervalRefillStrategy(ticker, refillTokens, period, unit));
}
/**
* Use a user defined refill strategy.
*/
public Builder withRefillStrategy(TokenBucket.RefillStrategy refillStrategy) {
this.refillStrategy = checkNotNull(refillStrategy);
return this;
}
/**
* Use a sleep strategy that will always attempt to yield the CPU to other processes.
*/
public Builder withYieldingSleepStrategy() {
return withSleepStrategy(YIELDING_SLEEP_STRATEGY);
}
/**
* Use a sleep strategy that will not yield the CPU to other processes. It will busy wait until more tokens become
* available.
*/
public Builder withBusyWaitSleepStrategy() {
return withSleepStrategy(BUSY_WAIT_SLEEP_STRATEGY);
}
/**
* Use a user defined sleep strategy.
*/
public Builder withSleepStrategy(TokenBucket.SleepStrategy sleepStrategy) {
this.sleepStrategy = checkNotNull(sleepStrategy);
return this;
}
/**
* Build the token bucket.
*/
public TokenBucket build() {
checkNotNull(capacity, "Must specify a capacity");
checkNotNull(refillStrategy, "Must specify a refill strategy");
return new TokenBucketImpl(capacity, initialTokens, refillStrategy, sleepStrategy);
}
}
private static final TokenBucketImpl.SleepStrategy YIELDING_SLEEP_STRATEGY = new TokenBucketImpl.SleepStrategy() {
@Override
public void sleep() {
// Sleep for the smallest unit of time possible just to relinquish control
// and to allow other threads to run.
Uninterruptibles.sleepUninterruptibly(1, TimeUnit.NANOSECONDS);
}
};
private static final TokenBucketImpl.SleepStrategy BUSY_WAIT_SLEEP_STRATEGY = new TokenBucketImpl.SleepStrategy() {
@Override
public void sleep() {
// Do nothing, don't sleep.
}
};
}
package com.zhaoonline.coupen.jwt;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 14:58<br/>
* Description:please descript you class
*/
public class JWTConfig {
private String issuer;
private String password;
private String encodeKeyName;
public String getIssuer() {
return issuer;
}
public void setIssuer(String issuer) {
this.issuer = issuer;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEncodeKeyName() {
return encodeKeyName;
}
public void setEncodeKeyName(String encodeKeyName) {
this.encodeKeyName = encodeKeyName;
}
}
package com.zhaoonline.coupen.jwt;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 10:38<br/>
* Description:please descript you class
*/
public class JWTDecoder {
private static ObjectMapper objectMapper =new ObjectMapper();
JWTVerifier verifier = null;
JWTConfig config =new JWTConfig();
public JWTDecoder(JWTConfig config) throws UnsupportedEncodingException {
this.config= config;
verifier =JWT.require(Algorithm.HMAC256(config.getPassword()))
.withIssuer(config.getIssuer())
.build();
}
public <T> T decode(String jwtToken,Class<T> clazz ) throws IOException {
DecodedJWT jwt = verifier.verify(jwtToken);
java.lang.String coupenJsonString= jwt.getClaim(config.getEncodeKeyName()).asString();
T decodeCoupen= objectMapper.readValue(coupenJsonString,clazz);
return decodeCoupen;
}
}
package com.zhaoonline.coupen.jwt;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.UnsupportedEncodingException;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 10:38<br/>
* Description:please descript you class
*/
public class JWTEncoder {
private static ObjectMapper objectMapper =new ObjectMapper();
JWTConfig config =new JWTConfig();
public JWTEncoder(JWTConfig config){
this.config= config;
}
public String encode(Object object) throws JsonProcessingException, UnsupportedEncodingException {
String coupenSeedString =objectMapper.writeValueAsString(object);
String token = JWT.create()
.withIssuer(config.getIssuer())
.withClaim(config.getEncodeKeyName(),coupenSeedString)
.sign(Algorithm.HMAC256(config.getPassword()));
return token;
}
}
package com.zhaoonline.coupen.lifecycle;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/16<br/>
* Time: 15:22<br/>
* Description:please descript you class
*/
public class LifeCycle {
private AtomicBoolean start=new AtomicBoolean(false);
private AtomicBoolean needReload=new AtomicBoolean(false);
public void markNeedReload(){
needReload.set(true);
}
public void resetNeedReload(){
needReload.set(false);
}
public boolean checkNeedReload(){
return needReload.get();
}
public void markStart(){
start.compareAndSet(false,true);
}
public void markShutDown(){
start.set(false);
}
public void resetAll(){
needReload.set(false);
start.set(false);
}
}
package com.zhaoonline.coupen.repository;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/15<br/>
* Time: 16:06<br/>
* Description:活动的增删改查
*/
public class ActivityRepository {
}
package com.zhaoonline.coupen.repository;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/15<br/>
* Time: 16:08<br/>
* Description:CoupenEntity(具体的Counpen实体)的增删改查
*/
public class CoupenEntityRepository {
}
package com.zhaoonline.coupen.repository;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/15<br/>
* Time: 16:07<br/>
* Description:CoupenSeed的增删改查
*/
public class CoupenSeedRepository {
}
package com.zhaoonline.coupen.repository;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/15<br/>
* Time: 16:36<br/>
* Description:用户与Coupen之间映射关系的增删改查
*/
public class UserCoupenMappingRepository {
}
package com.zhaoonline.coupen.utils;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/15<br/>
* Time: 20:00<br/>
* Description:please descript you class
*/
public class JsonUtils {
private static ObjectMapper mapper= new ObjectMapper();
/**
* Method name: toObject <BR>
* Description: 读取失败就返回null <BR>
* Remark: <BR>
* @param inputStram
* @param clazz
* @return T<BR>
* @throws IOException
* @throws JsonMappingException
* @throws JsonParseException
*/
public static <T> T toObject(InputStream inputStram , Class<T> clazz) throws JsonParseException, JsonMappingException, IOException {
return mapper.readValue(inputStram, clazz);
}
public static String toJson(Object object) throws JsonProcessingException {
return mapper.writeValueAsString(object);
}
public static <T> T toObject(String jsonString,Class<T> clazz) throws IOException {
return mapper.readValue(jsonString, clazz);
}
public static Map toMap(String jsonString) throws IOException {
return toObject(jsonString,Map.class);
}
}
package com.zhaoonline.coupen.utils;
import java.io.Closeable;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 19:57<br/>
* Description:please descript you class
*/
public class Utils {
public static void closeStream(Closeable stream){
if(stream!=null){
try {
stream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static String getRandomForDate(String param){
SimpleDateFormat simpleDateFormat;
simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date date = new Date();
String str = simpleDateFormat.format(date);
Random random = new Random();
int rannum = (int) (random.nextDouble() * (9999 - 100 + 1)) + 100;// 获取5位随机数
return param + str + rannum;
}
}
package com.zhaoonline.coupen.concurrent.tokenbucket;
import com.google.common.base.Ticker;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals;
public class FixedIntervalRefillStrategyTest {
private static final long N = 5; // 5 tokens
private static final long P = 10; // every 10
private static final TimeUnit U = TimeUnit.SECONDS; // seconds
private final MockTicker ticker = new MockTicker();
private final FixedIntervalRefillStrategy strategy = new FixedIntervalRefillStrategy(ticker, N, P, U);
@Test
public void testFirstRefill() {
assertEquals(N, strategy.refill());
}
@Test
public void testNoRefillUntilPeriodUp() {
strategy.refill();
// Another refill shouldn't come for P time units.
for (int i = 0; i < P - 1; i++) {
ticker.advance(1, U);
assertEquals(0, strategy.refill());
}
}
@Test
public void testRefillEveryPeriod() {
strategy.refill();
ticker.advance(P, U);
assertEquals(N, strategy.refill());
ticker.advance(P, U);
assertEquals(N, strategy.refill());
ticker.advance(P, U);
assertEquals(N, strategy.refill());
}
@Test
public void testRefillEveryOtherPeriod() {
strategy.refill();
// Move time forward two periods, since we're skipping a period next time we should add double the tokens.
ticker.advance(2 * P, U);
assertEquals(2 * N, strategy.refill());
ticker.advance(2 * P, U);
assertEquals(2 * N, strategy.refill());
}
@Test
public void testRefillOnNonEvenPeriods() {
// The strategy is configured to refill tokens every P time units. So we should only get refills at 0, P, 2P, 3P,
// etc. Any other time should return 0 tokens.
// t = 0
assertEquals(N, strategy.refill());
// t = P+1
ticker.advance(P + 1, U);
assertEquals(N, strategy.refill());
// t = 2P+1
ticker.advance(P, U);
assertEquals(N, strategy.refill());
// t = 3P
ticker.advance(P - 1, U);
assertEquals(N, strategy.refill());
// t = 4P-1
ticker.advance(P - 1, U);
assertEquals(0, strategy.refill());
// t = 4P
ticker.advance(1, U);
assertEquals(N, strategy.refill());
}
@Test
public void testDurationUntilFirstRefill() {
// A refill has never happened, so one is supposed to happen immediately.
assertEquals(0, strategy.getDurationUntilNextRefill(TimeUnit.SECONDS));
}
@Test
public void testDurationAfterFirstRefill() {
strategy.refill();
for (int i = 0; i < P - 1; i++) {
assertEquals(P - i, strategy.getDurationUntilNextRefill(TimeUnit.SECONDS));
ticker.advance(1, U);
}
}
@Test
public void testDurationAtSecondRefillTime() {
strategy.refill();
ticker.advance(P, U);
assertEquals(0, strategy.getDurationUntilNextRefill(TimeUnit.SECONDS));
}
@Test
public void testDurationInProperUnits() {
strategy.refill();
assertEquals(10000, strategy.getDurationUntilNextRefill(TimeUnit.MILLISECONDS));
}
private static final class MockTicker extends Ticker {
private long now = 0;
@Override
public long read() {
return now;
}
public void advance(long delta, TimeUnit unit) {
now += unit.toNanos(delta);
}
}
}
\ No newline at end of file
package com.zhaoonline.coupen.concurrent.tokenbucket;
import org.junit.Test;
public class TokenBucketBuilderTest {
private final TokenBuckets.Builder builder = TokenBuckets.builder();
@Test(expected = IllegalArgumentException.class)
public void testNegativeCapacity() {
builder.withCapacity(-1);
}
@Test(expected = IllegalArgumentException.class)
public void testZeroCapacity() {
builder.withCapacity(0);
}
@Test(expected = IllegalArgumentException.class)
public void testNegativeInitialTokens() {
builder.withInitialTokens(-1);
}
}
\ No newline at end of file
package com.zhaoonline.coupen.concurrent.tokenbucket;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
public class TokenBucketImplTest {
private static final long CAPACITY = 10;
private final MockRefillStrategy refillStrategy = new MockRefillStrategy();
private final TokenBucket.SleepStrategy sleepStrategy = mock(TokenBucket.SleepStrategy.class);
private final TokenBucketImpl bucket = new TokenBucketImpl(CAPACITY, 0, refillStrategy, sleepStrategy);
@Test(expected = IllegalArgumentException.class)
public void testNegativeCapacity() {
new TokenBucketImpl(-1, 0, refillStrategy, sleepStrategy);
}
@Test(expected = IllegalArgumentException.class)
public void testZeroCapacity() {
new TokenBucketImpl(0, 0, refillStrategy, sleepStrategy);
}
@Test(expected = IllegalArgumentException.class)
public void testMoreInitialTokensThanCapacity() {
new TokenBucketImpl(1, 2, refillStrategy, sleepStrategy);
}
@Test
public void testGetCapacity() {
assertEquals(CAPACITY, bucket.getCapacity());
}
@Test
public void testEmptyBucketHasZeroTokens() {
assertEquals(0, bucket.getNumTokens());
}
@Test
public void testBucketWithInitialTokens() {
TokenBucketImpl bucket = new TokenBucketImpl(CAPACITY, CAPACITY, refillStrategy, sleepStrategy);
assertEquals(CAPACITY, bucket.getNumTokens());
}
@Test
public void testAddingTokenIncreasesNumTokens() {
refillStrategy.addToken();
assertEquals(1, bucket.getNumTokens());
}
@Test
public void testAddingMultipleTokensIncreasesNumTokens() {
refillStrategy.addTokens(2);
assertEquals(2, bucket.getNumTokens());
}
@Test
public void testAtCapacityNumTokens() {
refillStrategy.addTokens(CAPACITY);
assertEquals(CAPACITY, bucket.getNumTokens());
}
@Test
public void testOverCapacityNumTokens() {
refillStrategy.addTokens(CAPACITY + 1);
assertEquals(CAPACITY, bucket.getNumTokens());
}
@Test
public void testConsumingTokenDecreasesNumTokens() {
refillStrategy.addTokens(1);
bucket.consume();
assertEquals(0, bucket.getNumTokens());
}
@Test
public void testConsumingMultipleTokensDecreasesNumTokens() {
refillStrategy.addTokens(CAPACITY);
bucket.consume(2);
assertEquals(CAPACITY - 2, bucket.getNumTokens());
}
@Test
public void testEmptyNumTokens() {
refillStrategy.addTokens(CAPACITY);
bucket.consume(CAPACITY);
assertEquals(0, bucket.getNumTokens());
}
@Test
public void testFailedConsumeKeepsNumTokens() {
refillStrategy.addTokens(1);
bucket.tryConsume(2);
assertEquals(1, bucket.getNumTokens());
}
@Test(expected = IllegalArgumentException.class)
public void testTryConsumeZeroTokens() {
bucket.tryConsume(0);
}
@Test(expected = IllegalArgumentException.class)
public void testTryConsumeNegativeTokens() {
bucket.tryConsume(-1);
}
@Test(expected = IllegalArgumentException.class)
public void testTryConsumeMoreThanCapacityTokens() {
bucket.tryConsume(100);
}
@Test
public void testTryConsumeOnEmptyBucket() {
assertFalse(bucket.tryConsume());
}
@Test
public void testTryConsumeOneToken() {
refillStrategy.addToken();
assertTrue(bucket.tryConsume());
}
@Test
public void testTryConsumeMoreTokensThanAreAvailable() {
refillStrategy.addToken();
assertFalse(bucket.tryConsume(2));
}
@Test
public void testTryManuallyRefillOneToken() {
bucket.refill(1);
assertTrue(bucket.tryConsume());
}
@Test
public void testTryManuallyRefillCapacityTokens() {
bucket.refill(CAPACITY);
assertTrue(bucket.tryConsume(CAPACITY));
assertFalse(bucket.tryConsume(1));
}
@Test
public void testTryManuallyRefillMoreThanCapacityTokens() {
bucket.refill(CAPACITY + 1);
assertTrue(bucket.tryConsume(CAPACITY));
assertFalse(bucket.tryConsume(1));
}
@Test
public void testTryManualRefillAndStrategyRefill() {
bucket.refill(CAPACITY);
refillStrategy.addTokens(CAPACITY);
assertTrue(bucket.tryConsume(CAPACITY));
assertFalse(bucket.tryConsume(1));
}
@Test
public void testTryRefillMoreThanCapacityTokens() {
refillStrategy.addTokens(CAPACITY + 1);
assertTrue(bucket.tryConsume(CAPACITY));
assertFalse(bucket.tryConsume(1));
}
@Test
public void testTryRefillWithTooManyTokens() {
refillStrategy.addTokens(CAPACITY);
assertTrue(bucket.tryConsume());
refillStrategy.addTokens(Long.MAX_VALUE);
assertTrue(bucket.tryConsume(CAPACITY));
assertFalse(bucket.tryConsume(1));
}
private static final class MockRefillStrategy implements TokenBucketImpl.RefillStrategy {
private long numTokensToAdd = 0;
public long refill() {
long numTokens = numTokensToAdd;
numTokensToAdd = 0;
return numTokens;
}
@Override
public long getDurationUntilNextRefill(TimeUnit unit) throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
public void addToken() {
numTokensToAdd++;
}
public void addTokens(long numTokens) {
numTokensToAdd += numTokens;
}
}
}
\ No newline at end of file
package com.zhaoonline.coupen.jwt;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zhaoonline.coupen.bean.Activity;
import com.zhaoonline.coupen.bean.BizType;
import com.zhaoonline.coupen.bean.CommonCoupenSeed;
import org.junit.Assert;
import org.junit.Test;
import java.io.IOException;
import java.math.BigDecimal;
/**
* Created by ZhaoOnline<br/>
* User: yangyoupeng<br/>
* Date: 2016/12/14<br/>
* Time: 10:42<br/>
* Description:please descript you class
*/
public class TestJWTEncoder {
ObjectMapper objectMapper = new ObjectMapper();
/**
* 测试使用原生的JWT来对对象进行编码和解码
* @throws IOException
*/
@Test
public void testEncodeAndDecodeWithoriginalJWT() throws IOException {
CommonCoupenSeed coupenSeed =new CommonCoupenSeed();
Activity activity= new Activity(1,"新年大礼包");
BigDecimal totalAmount = new BigDecimal(8880);
Integer coupenCount = 10;
coupenSeed.setActivity(activity);
coupenSeed.setTotalAmount(totalAmount);
coupenSeed.setBizType(new BizType(1,"TZB"));
coupenSeed.setCoupenCount(coupenCount);
JWTConfig config =new JWTConfig();
config.setIssuer("zhaoonline");
config.setPassword("hellowwolrd");
String coupenSeedString =objectMapper.writeValueAsString(coupenSeed);
String token = JWT.create()
.withIssuer(config.getIssuer())
.withClaim("counpen",coupenSeedString)
.sign(Algorithm.HMAC256(config.getPassword()));
System.out.println(token);
JWTVerifier verifier = JWT.require(Algorithm.HMAC256(config.getPassword()))
.withIssuer(config.getIssuer())
.build();
DecodedJWT jwt = verifier.verify(token);
String coupenJsonString= jwt.getClaim("counpen").asString();
CommonCoupenSeed decodeCoupen= objectMapper.readValue(coupenJsonString,CommonCoupenSeed.class);
Assert.assertEquals(activity.getActivityName(), decodeCoupen.getActivity().getActivityName());
Assert.assertEquals(coupenCount, decodeCoupen.getCoupenCount());
}
/**
* 使用我们封装过得getCoupenCountJWTEncoder和JWTDecoder来测试编码和解码
*/
@Test
public void testEncodeAndDecodeWithWrappedJWT() throws IOException {
CommonCoupenSeed coupenSeed =new CommonCoupenSeed();
Activity activity= new Activity(1,"新年大礼包");
BigDecimal totalAmount = new BigDecimal(8880);
Integer coupenCount = 10;
coupenSeed.setActivity(activity);
coupenSeed.setTotalAmount(totalAmount);
coupenSeed.setBizType(new BizType(1,"TZB"));
coupenSeed.setCoupenCount(coupenCount);
JWTConfig config =new JWTConfig();
config.setIssuer("zhaoonline");
config.setPassword("hellowwolrd");
config.setEncodeKeyName("coupen");
JWTEncoder encoder= new JWTEncoder(config);
String token= encoder.encode(coupenSeed);
JWTDecoder decoder=new JWTDecoder(config);
CommonCoupenSeed decodeCoupen= decoder.decode(token,CommonCoupenSeed.class);
Assert.assertEquals(activity.getActivityName(), decodeCoupen.getActivity().getActivityName());
Assert.assertEquals(coupenCount, decodeCoupen.getCoupenCount());
}
}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.