平安银行
This commit is contained in:
commit
ae544dca00
8
.idea/.gitignore
vendored
Normal file
8
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
198
.idea/em.iml
Normal file
198
.idea/em.iml
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="web" name="Web">
|
||||||
|
<configuration>
|
||||||
|
<webroots>
|
||||||
|
<root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
|
||||||
|
</webroots>
|
||||||
|
<sourceRoots>
|
||||||
|
<root url="file://$MODULE_DIR$/src/main/java" />
|
||||||
|
<root url="file://$MODULE_DIR$/src/main/resources" />
|
||||||
|
</sourceRoots>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
<facet type="Spring" name="Spring">
|
||||||
|
<configuration />
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
|
<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: org.springframework.boot:spring-boot-starter-data-redis:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.3.9.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.3.9.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.3.9.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:5.3.7.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.16.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-thymeleaf:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf-spring5:3.0.12.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf:3.0.12.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.attoparser:attoparser:2.0.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.4.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.45" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.45" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.23" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.16.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.vintage:junit-vintage-engine:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.3.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.22" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.22" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.4.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-generator:3.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.72" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.22" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.22" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.12" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.4.2.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct-jdk8:1.4.2.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct-processor:1.4.2.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: joda-time:joda-time:2.10.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.9.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.20" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.20" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.9.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.9.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.9.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.9.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.9.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:swagger-bootstrap-ui:1.9.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.javassist:javassist:3.25.0-GA" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.6.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jetbrains:annotations:23.0.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun.oss:aliyun-sdk-oss:3.14.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jdom:jdom2:2.0.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.codehaus.jettison:jettison:1.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:aliyun-java-sdk-core:4.5.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jacoco:org.jacoco.agent:runtime:0.8.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.ini4j:ini4j:0.5.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.opentracing:opentracing-api:0.33.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.opentracing:opentracing-util:0.33.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.opentracing:opentracing-noop:0.33.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:aliyun-java-sdk-ram:3.1.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.aliyun:aliyun-java-sdk-kms:2.11.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.17" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-io:commons-io:2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:4.9.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.squareup.okio:okio:2.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.3.72" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.13" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.1.7.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.5.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.binarywang:weixin-java-open:4.0.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.binarywang:weixin-java-common:4.0.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.thoughtworks.xstream:xstream:1.4.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: xmlpull:xmlpull:1.1.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: xpp3:xpp3_min:1.1.4c" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.dom4j:dom4j:2.1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.binarywang:weixin-java-mp:4.0.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.binarywang:weixin-java-miniapp:4.0.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.65" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.65" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
16
.idea/misc.xml
Normal file
16
.idea/misc.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
|
<file type="web" url="file://$PROJECT_DIR$" />
|
||||||
|
</component>
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/em.iml" filepath="$PROJECT_DIR$/.idea/em.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
10
.idea/runConfigurations.xml
Normal file
10
.idea/runConfigurations.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RunConfigurationProducerService">
|
||||||
|
<option name="ignoredProducers">
|
||||||
|
<set>
|
||||||
|
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
250
pom.xml
Normal file
250
pom.xml
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.3.10.RELEASE</version>
|
||||||
|
<relativePath/>
|
||||||
|
</parent>
|
||||||
|
<groupId>com.xgl.lottery</groupId>
|
||||||
|
<artifactId>employee-care</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.4.3</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-generator</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-generator</artifactId>
|
||||||
|
<version>3.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>1.2.72</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>1.1.22</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.9</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.12</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-pool2</artifactId>
|
||||||
|
<version>2.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct</artifactId>
|
||||||
|
<version>1.4.2.Final</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-jdk8</artifactId>
|
||||||
|
<version>1.4.2.Final</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
|
<version>1.4.2.Final</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>joda-time</groupId>
|
||||||
|
<artifactId>joda-time</artifactId>
|
||||||
|
<version>2.10.6</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
|
<version>2.9.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>swagger-bootstrap-ui</artifactId>
|
||||||
|
<version>1.9.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
|
<version>2.6.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains</groupId>
|
||||||
|
<artifactId>annotations</artifactId>
|
||||||
|
<version>23.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun.oss</groupId>
|
||||||
|
<artifactId>aliyun-sdk-oss</artifactId>
|
||||||
|
<version>3.14.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
<version>5.3.17</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-fileupload</groupId>
|
||||||
|
<artifactId>commons-fileupload</artifactId>
|
||||||
|
<version>1.4</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper</artifactId>
|
||||||
|
<version>5.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.9.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
|
<artifactId>httpmime</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!--参数校验-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-lang</groupId>
|
||||||
|
<artifactId>commons-lang</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- huTool工具包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.5.6</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.binarywang</groupId>
|
||||||
|
<artifactId>weixin-java-open</artifactId>
|
||||||
|
<version>4.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<fork>true</fork>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!-- 跳过单元测试 -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
85
src/main/java/com/xgl/lottery/LoadDataApplicationRunner.java
Normal file
85
src/main/java/com/xgl/lottery/LoadDataApplicationRunner.java
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
package com.xgl.lottery;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.xgl.lottery.dal.mapper.LotteryItemMapper;
|
||||||
|
import com.xgl.lottery.dal.mapper.LotteryMapper;
|
||||||
|
import com.xgl.lottery.dal.mapper.LotteryPrizeMapper;
|
||||||
|
import com.xgl.lottery.dal.model.Lottery;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryItem;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryPrize;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.ApplicationArguments;
|
||||||
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class LoadDataApplicationRunner implements ApplicationRunner {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
RedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
LotteryPrizeMapper lotteryPrizeMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
LotteryItemMapper lotteryItemMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
|
log.info("=========begin ===========");
|
||||||
|
|
||||||
|
QueryWrapper<LotteryItem> lotteryItemQueryWrapper = new QueryWrapper<>();
|
||||||
|
lotteryItemQueryWrapper.eq("lottery_id", 1);
|
||||||
|
List<LotteryItem> lotteryItems = lotteryItemMapper.selectList(lotteryItemQueryWrapper);
|
||||||
|
|
||||||
|
LotteryItem defaultLotteryItem = lotteryItems.parallelStream().filter(o -> o.getDefaultItem().intValue() == 1).findFirst().orElse(null);
|
||||||
|
|
||||||
|
Map<String, Object> lotteryItemMap = new HashMap<>(16);
|
||||||
|
lotteryItemMap.put(RedisKeyManager.getLotteryItemRedisKey(1), lotteryItems);
|
||||||
|
lotteryItemMap.put(RedisKeyManager.getDefaultLotteryItemRedisKey(1), defaultLotteryItem);
|
||||||
|
redisTemplate.opsForValue().multiSet(lotteryItemMap);
|
||||||
|
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
|
queryWrapper.eq("lottery_id", 1);
|
||||||
|
List<LotteryPrize> lotteryPrizes = lotteryPrizeMapper.selectList(queryWrapper);
|
||||||
|
|
||||||
|
AtomicReference<LotteryPrize> defaultPrize = new AtomicReference<>();
|
||||||
|
lotteryPrizes.stream().forEach(lotteryPrize -> {
|
||||||
|
if (lotteryPrize.getId().equals(defaultLotteryItem.getPrizeId())) {
|
||||||
|
defaultPrize.set(lotteryPrize);
|
||||||
|
}
|
||||||
|
String key = RedisKeyManager.getLotteryPrizeRedisKey(1, lotteryPrize.getId());
|
||||||
|
setLotteryPrizeToRedis(key, lotteryPrize);
|
||||||
|
});
|
||||||
|
String key = RedisKeyManager.getDefaultLotteryPrizeRedisKey(1);
|
||||||
|
setLotteryPrizeToRedis(key, defaultPrize.get());
|
||||||
|
log.info("=========finish ===========");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setLotteryPrizeToRedis(String key, LotteryPrize lotteryPrize) {
|
||||||
|
redisTemplate.setHashValueSerializer(new Jackson2JsonRedisSerializer<>(Object.class));
|
||||||
|
redisTemplate.opsForHash().put(key, "id", lotteryPrize.getId());
|
||||||
|
redisTemplate.opsForHash().put(key, "lotteryId", lotteryPrize.getLotteryId());
|
||||||
|
redisTemplate.opsForHash().put(key, "prizeName", lotteryPrize.getPrizeName());
|
||||||
|
redisTemplate.opsForHash().put(key, "prizeType", lotteryPrize.getPrizeType());
|
||||||
|
redisTemplate.opsForHash().put(key, "totalStock", lotteryPrize.getTotalStock());
|
||||||
|
redisTemplate.opsForHash().put(key, "validStock", lotteryPrize.getValidStock());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
17
src/main/java/com/xgl/lottery/LotteryApplication.java
Normal file
17
src/main/java/com/xgl/lottery/LotteryApplication.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package com.xgl.lottery;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableTransactionManagement
|
||||||
|
@MapperScan({"com.xgl.lottery.dal.mapper","com.xgl.lottery.mapper"})
|
||||||
|
public class LotteryApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(LotteryApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
37
src/main/java/com/xgl/lottery/LotteryConstants.java
Normal file
37
src/main/java/com/xgl/lottery/LotteryConstants.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package com.xgl.lottery;
|
||||||
|
|
||||||
|
public class LotteryConstants {
|
||||||
|
|
||||||
|
|
||||||
|
public final static String DRAWING = "DRAWING";
|
||||||
|
|
||||||
|
|
||||||
|
public final static String LOTTERY = "LOTTERY";
|
||||||
|
|
||||||
|
|
||||||
|
public final static String LOTTERY_PRIZE = "LOTTERY_PRIZE";
|
||||||
|
|
||||||
|
|
||||||
|
public final static String DEFAULT_LOTTERY_PRIZE = "DEFAULT_LOTTERY_PRIZE";
|
||||||
|
|
||||||
|
public enum PrizeTypeEnum {
|
||||||
|
THANK(-1), NORMAL(1), UNIQUE(2);
|
||||||
|
private int value;
|
||||||
|
|
||||||
|
private PrizeTypeEnum(int value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public final static String LOTTERY_ITEM = "LOTTERY_ITEM";
|
||||||
|
|
||||||
|
|
||||||
|
public final static String DEFAULT_LOTTERY_ITEM = "DEFAULT_LOTTERY_ITEM";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
34
src/main/java/com/xgl/lottery/RedisKeyManager.java
Normal file
34
src/main/java/com/xgl/lottery/RedisKeyManager.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package com.xgl.lottery;
|
||||||
|
|
||||||
|
|
||||||
|
public class RedisKeyManager {
|
||||||
|
|
||||||
|
|
||||||
|
public static String getDrawingRedisKey(String accountIp) {
|
||||||
|
return new StringBuilder(LotteryConstants.DRAWING).append(":").append(accountIp).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getLotteryRedisKey(Integer id) {
|
||||||
|
return new StringBuilder(LotteryConstants.LOTTERY).append(":").append(id).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getLotteryPrizeRedisKey(Integer lotteryId) {
|
||||||
|
return new StringBuilder(LotteryConstants.LOTTERY_PRIZE).append(":").append(lotteryId).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getLotteryPrizeRedisKey(Integer lotteryId, Integer prizeId) {
|
||||||
|
return new StringBuilder(LotteryConstants.LOTTERY_PRIZE).append(":").append(lotteryId).append(":").append(prizeId).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDefaultLotteryPrizeRedisKey(Integer lotteryId) {
|
||||||
|
return new StringBuilder(LotteryConstants.DEFAULT_LOTTERY_PRIZE).append(":").append(lotteryId).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getLotteryItemRedisKey(Integer lotteryId) {
|
||||||
|
return new StringBuilder(LotteryConstants.LOTTERY_ITEM).append(":").append(lotteryId).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDefaultLotteryItemRedisKey(Integer lotteryId) {
|
||||||
|
return new StringBuilder(LotteryConstants.DEFAULT_LOTTERY_ITEM).append(":").append(lotteryId).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
67
src/main/java/com/xgl/lottery/ReturnCodeEnum.java
Normal file
67
src/main/java/com/xgl/lottery/ReturnCodeEnum.java
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package com.xgl.lottery;
|
||||||
|
|
||||||
|
public enum ReturnCodeEnum {
|
||||||
|
|
||||||
|
SUCCESS("0000", "成功"),
|
||||||
|
|
||||||
|
FAIL("9888", "文件下载失败"),
|
||||||
|
|
||||||
|
LOTTER_NOT_EXIST("9001", "指定抽奖活动不存在"),
|
||||||
|
|
||||||
|
LOTTER_FINISH("9002", "活动已结束"),
|
||||||
|
|
||||||
|
LOTTER_REPO_NOT_ENOUGHT("9003", "当前奖品库存不足"),
|
||||||
|
|
||||||
|
LOTTER_ITEM_NOT_INITIAL("9004", "奖项数据未初始化"),
|
||||||
|
|
||||||
|
LOTTER_DRAWING("9005", "上一次抽奖还未结束"),
|
||||||
|
|
||||||
|
LOTTER_BEFORE("9006", "请完成今日打卡才可以抽奖"),
|
||||||
|
|
||||||
|
LOTTER_NUM("9007", "没有抽奖次数"),
|
||||||
|
|
||||||
|
LOTTER_COME_OVER("9008", "活动已结束"),
|
||||||
|
|
||||||
|
ADDRESS_EXIT("9009", "地址已存在"),
|
||||||
|
|
||||||
|
REQUEST_PARAM_NOT_VALID("9998", "请求参数不正确"),
|
||||||
|
|
||||||
|
REQUEST_PARAM_NOT_EXIT("9997", "请求凭证不存在"),
|
||||||
|
|
||||||
|
REQUEST_PARAM_EXIT("9996", "该用户已存在"),
|
||||||
|
|
||||||
|
REQUEST_NOT_EXIT("9910", "该用户不存在"),
|
||||||
|
|
||||||
|
SYSTEM_ERROR("9999", "系统繁忙,请稍后重试"),
|
||||||
|
|
||||||
|
DRAW_VALID("9995", "今天已抽卡,请明日再来"),
|
||||||
|
|
||||||
|
HIT_CLOCK_TIME_VALID("9994", "打卡无效,打卡开始时间和结束时间不在同一天"),
|
||||||
|
|
||||||
|
HIT_CLOCK_TIME_ONCE("9993", "打卡无效,一天只能打一次卡"),
|
||||||
|
|
||||||
|
DRAW_CARD_NOT("9994", "抽卡池未初始化"),
|
||||||
|
|
||||||
|
ILLEGAL_ARGUMENT("3001", "非法参数");
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
private ReturnCodeEnum(String code, String msg) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodeString() {
|
||||||
|
return getCode() + "";
|
||||||
|
}
|
||||||
|
}
|
||||||
13
src/main/java/com/xgl/lottery/ServletInitializer.java
Normal file
13
src/main/java/com/xgl/lottery/ServletInitializer.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package com.xgl.lottery;
|
||||||
|
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
|
||||||
|
public class ServletInitializer extends SpringBootServletInitializer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
|
return application.sources(LotteryApplication.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
27
src/main/java/com/xgl/lottery/ThreadPoolExecutorConfig.java
Normal file
27
src/main/java/com/xgl/lottery/ThreadPoolExecutorConfig.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package com.xgl.lottery;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableAsync
|
||||||
|
@EnableConfigurationProperties(ThreadPoolExecutorProperties.class)
|
||||||
|
public class ThreadPoolExecutorConfig {
|
||||||
|
|
||||||
|
@Bean(name = "lotteryServiceExecutor")
|
||||||
|
public Executor lotteryServiceExecutor(ThreadPoolExecutorProperties poolExecutorProperties) {
|
||||||
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
|
executor.setCorePoolSize(poolExecutorProperties.getCorePoolSize());
|
||||||
|
executor.setMaxPoolSize(poolExecutorProperties.getMaxPoolSize());
|
||||||
|
executor.setQueueCapacity(poolExecutorProperties.getQueueCapacity());
|
||||||
|
executor.setThreadNamePrefix(poolExecutorProperties.getNamePrefix());
|
||||||
|
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||||
|
return executor;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.xgl.lottery;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ConfigurationProperties(prefix = "async.executor.thread")
|
||||||
|
public class ThreadPoolExecutorProperties {
|
||||||
|
private int corePoolSize;
|
||||||
|
private int maxPoolSize;
|
||||||
|
private int queueCapacity;
|
||||||
|
private String namePrefix;
|
||||||
|
}
|
||||||
15
src/main/java/com/xgl/lottery/config/AccessToken.java
Normal file
15
src/main/java/com/xgl/lottery/config/AccessToken.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package com.xgl.lottery.config;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AccessToken implements Serializable {
|
||||||
|
private static final long serialVersionUID = -1345910558078620805L;
|
||||||
|
@SerializedName("access_token")
|
||||||
|
private String accessToken;
|
||||||
|
@SerializedName("expires_in")
|
||||||
|
private int expires_in;
|
||||||
|
}
|
||||||
100
src/main/java/com/xgl/lottery/config/CheckInterceptor.java
Normal file
100
src/main/java/com/xgl/lottery/config/CheckInterceptor.java
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
package com.xgl.lottery.config;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.xgl.lottery.ReturnCodeEnum;
|
||||||
|
import com.xgl.lottery.mapper.UserInfoMapper;
|
||||||
|
import com.xgl.lottery.request.vo.UserInfo;
|
||||||
|
import com.xgl.lottery.service.dto.ResultResp;
|
||||||
|
import com.xgl.lottery.utils.EncryptUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class CheckInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserInfoMapper userInfoMapper;
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object o) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
|
String accessToken = request.getHeader("accessToken");
|
||||||
|
String requestURI = request.getRequestURI();
|
||||||
|
|
||||||
|
log.info("获取的url:"+requestURI);
|
||||||
|
if (requestURI.equals("/employee-care/doc.html")||requestURI.equals("/employee-care/docs.html")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (requestURI.equals("/employee-care/icon.jpg")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (requestURI.equals("/employee-care/oss/get/file")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(accessToken)&& requestURI.equals("/employee-care/business/add")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(accessToken)&& requestURI.equals("/employee-care/business/get/user")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(accessToken)&& (!requestURI.equals("/employee-care/business/add"))){
|
||||||
|
response(response, JSON.toJSONString(ResultResp.fail(ReturnCodeEnum.REQUEST_PARAM_NOT_EXIT.getCode(),ReturnCodeEnum.REQUEST_PARAM_NOT_EXIT.getMsg())));
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(accessToken)&&!requestURI.equals("/employee-care/business/add")){
|
||||||
|
String s = EncryptUtil.decryptByDES(accessToken);
|
||||||
|
UserInfo userInfo = userInfoMapper.selectByUm(s);
|
||||||
|
if (null==userInfo){
|
||||||
|
response(response, JSON.toJSONString(ResultResp.fail(ReturnCodeEnum.REQUEST_PARAM_NOT_EXIT.getCode(),ReturnCodeEnum.REQUEST_PARAM_NOT_EXIT.getMsg())));
|
||||||
|
return false;
|
||||||
|
}else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postHandle(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse, @NotNull Object o, ModelAndView modelAndView) throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCompletion(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse, @NotNull Object o, Exception e) throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void response(HttpServletResponse response, String str) throws Exception {
|
||||||
|
response.setContentType("application/json; charset=utf-8");
|
||||||
|
PrintWriter writer = response.getWriter();
|
||||||
|
writer.print(str);
|
||||||
|
writer.close();
|
||||||
|
response.flushBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
27
src/main/java/com/xgl/lottery/config/CorsConfig.java
Normal file
27
src/main/java/com/xgl/lottery/config/CorsConfig.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package com.xgl.lottery.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
|
import org.springframework.web.filter.CorsFilter;
|
||||||
|
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class CorsConfig {
|
||||||
|
|
||||||
|
private CorsConfiguration buildConfig() {
|
||||||
|
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||||
|
corsConfiguration.addAllowedOrigin("*");
|
||||||
|
corsConfiguration.addAllowedHeader("*");
|
||||||
|
corsConfiguration.addAllowedMethod("*");
|
||||||
|
return corsConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CorsFilter corsFilter() {
|
||||||
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
|
source.registerCorsConfiguration("/**", buildConfig()); //注册
|
||||||
|
return new CorsFilter(source);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,97 @@
|
|||||||
|
package com.xgl.lottery.config;
|
||||||
|
|
||||||
|
import com.xgl.lottery.ReturnCodeEnum;
|
||||||
|
import com.xgl.lottery.exception.BaseBusinessException;
|
||||||
|
import com.xgl.lottery.service.dto.ResultResp;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.BindException;
|
||||||
|
import org.springframework.validation.ObjectError;
|
||||||
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
|
|
||||||
|
import javax.validation.ConstraintViolation;
|
||||||
|
import javax.validation.ConstraintViolationException;
|
||||||
|
import javax.validation.ValidationException;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestControllerAdvice
|
||||||
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认全局异常处理。
|
||||||
|
*
|
||||||
|
* @param e e
|
||||||
|
* @return ResponseData
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(Exception.class)
|
||||||
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
|
public ResultResp<String> exception(Exception e) {
|
||||||
|
log.error("兜底异常信息 ex={}", e.getMessage());
|
||||||
|
return new ResultResp(ReturnCodeEnum.SYSTEM_ERROR.getCode(), e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assert异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler({IllegalArgumentException.class, IllegalStateException.class})
|
||||||
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
|
public ResultResp<String> exception(IllegalArgumentException e) {
|
||||||
|
return new ResultResp(ReturnCodeEnum.ILLEGAL_ARGUMENT.getCode(), e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抓取自定义异常 BaseException
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(BaseBusinessException.class)
|
||||||
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
|
public ResultResp<String> exception(BaseBusinessException e) {
|
||||||
|
return new ResultResp(e.getErrorCode(), e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param e
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(value = {BindException.class, ValidationException.class, MethodArgumentNotValidException.class})
|
||||||
|
public ResponseEntity<ResultResp<String>> handleValidatedException(Exception e) {
|
||||||
|
ResultResp<String> resp = null;
|
||||||
|
|
||||||
|
if (e instanceof MethodArgumentNotValidException) {
|
||||||
|
// BeanValidation exception
|
||||||
|
MethodArgumentNotValidException ex = (MethodArgumentNotValidException) e;
|
||||||
|
resp = ResultResp.fail(String.valueOf(HttpStatus.BAD_REQUEST.value()),
|
||||||
|
ex.getBindingResult().getAllErrors().stream()
|
||||||
|
.map(ObjectError::getDefaultMessage)
|
||||||
|
.collect(Collectors.joining("; "))
|
||||||
|
);
|
||||||
|
} else if (e instanceof ConstraintViolationException) {
|
||||||
|
// BeanValidation GET simple param
|
||||||
|
ConstraintViolationException ex = (ConstraintViolationException) e;
|
||||||
|
resp = ResultResp.fail(String.valueOf(HttpStatus.BAD_REQUEST.value()),
|
||||||
|
ex.getConstraintViolations().stream()
|
||||||
|
.map(ConstraintViolation::getMessage)
|
||||||
|
.collect(Collectors.joining("; "))
|
||||||
|
);
|
||||||
|
} else if (e instanceof BindException) {
|
||||||
|
// BeanValidation GET object param
|
||||||
|
BindException ex = (BindException) e;
|
||||||
|
resp = ResultResp.fail(String.valueOf(HttpStatus.BAD_REQUEST.value()),
|
||||||
|
ex.getAllErrors().stream()
|
||||||
|
.map(ObjectError::getDefaultMessage)
|
||||||
|
.collect(Collectors.joining("; "))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.error("参数校验异常:{}", resp.getMsg());
|
||||||
|
return new ResponseEntity<>(resp, HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.xgl.lottery.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||||
|
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
import org.joda.time.format.DateTimeFormat;
|
||||||
|
import org.joda.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class JodaDateTimeJsonDeserializer extends JsonDeserializer<DateTime> {
|
||||||
|
@Override
|
||||||
|
public DateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
|
||||||
|
String dateString = jsonParser.readValueAs(String.class);
|
||||||
|
DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
return dateTimeFormatter.parseDateTime(dateString);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.xgl.lottery.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class JodaDateTimeJsonSerializer extends JsonSerializer<DateTime> {
|
||||||
|
@Override
|
||||||
|
public void serialize(DateTime dateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
||||||
|
jsonGenerator.writeString(dateTime.toString("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.xgl.lottery.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||||
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
@Configuration
|
||||||
|
public class RedisTemplateConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||||
|
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
|
||||||
|
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||||
|
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||||
|
objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
|
||||||
|
SimpleModule simpleModule = new SimpleModule();
|
||||||
|
simpleModule.addSerializer(DateTime.class, new JodaDateTimeJsonSerializer());
|
||||||
|
simpleModule.addDeserializer(DateTime.class, new JodaDateTimeJsonDeserializer());
|
||||||
|
objectMapper.registerModule(simpleModule);
|
||||||
|
jackson2JsonRedisSerializer.setObjectMapper(objectMapper);
|
||||||
|
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
|
||||||
|
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||||
|
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
||||||
|
redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);
|
||||||
|
redisTemplate.afterPropertiesSet();
|
||||||
|
return redisTemplate;
|
||||||
|
}
|
||||||
|
}
|
||||||
39
src/main/java/com/xgl/lottery/config/Request.java
Normal file
39
src/main/java/com/xgl/lottery/config/Request.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package com.xgl.lottery.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class Request implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CheckInterceptor requestCheckInterceptor() {
|
||||||
|
return new CheckInterceptor();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
|
|
||||||
|
InterceptorRegistration registration = registry.addInterceptor(requestCheckInterceptor());
|
||||||
|
registration.addPathPatterns("/**");
|
||||||
|
registration.excludePathPatterns(
|
||||||
|
|
||||||
|
"/", "/index", "/index.html", "/asserts/**", "/webjars/**", "/static/**",
|
||||||
|
"/v2/api-docs",
|
||||||
|
"/swagger-resources/configuration/ui",
|
||||||
|
"/swagger-resources",
|
||||||
|
"/swagger-resources/configuration/security",
|
||||||
|
"/swagger-ui.html"
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
21
src/main/java/com/xgl/lottery/config/RestTemplateConfig.java
Normal file
21
src/main/java/com/xgl/lottery/config/RestTemplateConfig.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package com.xgl.lottery.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RestTemplateConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RestTemplate restTemplate(){
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
restTemplate.getMessageConverters().set(1,new StringHttpMessageConverter(StandardCharsets.UTF_8));
|
||||||
|
return restTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
69
src/main/java/com/xgl/lottery/constants/ActivityEnum.java
Normal file
69
src/main/java/com/xgl/lottery/constants/ActivityEnum.java
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
package com.xgl.lottery.constants;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public enum ActivityEnum {
|
||||||
|
|
||||||
|
A("A", "2022-05-09 00:00:00","2022-05-13 22:00:00"),
|
||||||
|
|
||||||
|
B("B", "2022-12-01 00:00:00","2022-12-01 23:59:59"),
|
||||||
|
|
||||||
|
C("C", "2022-12-03 00:00:00","2022-12-03 23:59:59"),
|
||||||
|
|
||||||
|
D("D", "2022-12-05 00:00:00","2022-12-05 23:59:59"),
|
||||||
|
|
||||||
|
E("E","2022-12-07 00:00:00","2022-12-07 23:59:59");
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String begin;
|
||||||
|
|
||||||
|
private String end;
|
||||||
|
|
||||||
|
private ActivityEnum(String code, String begin,String end) {
|
||||||
|
this.code = code;
|
||||||
|
this.begin = begin;
|
||||||
|
this.end=end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBegin() {
|
||||||
|
return begin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEnd() {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodeString() {
|
||||||
|
return getCode() + "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static List<HashMap<String,String>> getEnumList() throws ParseException {
|
||||||
|
DateFormat dfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
List<HashMap<String, String>> list = new ArrayList<>();
|
||||||
|
for (ActivityEnum activityEnum : EnumSet.allOf(ActivityEnum.class)) {
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
map.put("code",activityEnum.code);
|
||||||
|
map.put("begin",activityEnum.begin);
|
||||||
|
map.put("end",activityEnum.end);
|
||||||
|
map.put("flag","false");
|
||||||
|
Date now = new Date();
|
||||||
|
if(now.before(dfm.parse(activityEnum.end))&&now.after(dfm.parse(activityEnum.begin))){
|
||||||
|
map.put("flag","true");
|
||||||
|
}
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
41
src/main/java/com/xgl/lottery/constants/ReturnCodeEnum.java
Normal file
41
src/main/java/com/xgl/lottery/constants/ReturnCodeEnum.java
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package com.xgl.lottery.constants;
|
||||||
|
|
||||||
|
public enum ReturnCodeEnum {
|
||||||
|
|
||||||
|
SUCCESS("0000", "成功"),
|
||||||
|
|
||||||
|
LOTTER_NOT_EXIST("9001", "指定抽奖活动不存在"),
|
||||||
|
|
||||||
|
LOTTER_FINISH("9002", "活动已结束"),
|
||||||
|
|
||||||
|
LOTTER_REPO_NOT_ENOUGHT("9003", "当前奖品库存不足"),
|
||||||
|
|
||||||
|
LOTTER_ITEM_NOT_INITIAL("9004", "奖项数据未初始化"),
|
||||||
|
|
||||||
|
LOTTER_DRAWING("9005", "上一次抽奖还未结束"),
|
||||||
|
|
||||||
|
REQUEST_PARAM_NOT_VALID("9998", "请求参数不正确"),
|
||||||
|
|
||||||
|
SYSTEM_ERROR("9999", "系统繁忙,请稍后重试");
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
private ReturnCodeEnum(String code, String msg) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodeString() {
|
||||||
|
return getCode() + "";
|
||||||
|
}
|
||||||
|
}
|
||||||
149
src/main/java/com/xgl/lottery/controller/BusinessController.java
Normal file
149
src/main/java/com/xgl/lottery/controller/BusinessController.java
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
package com.xgl.lottery.controller;
|
||||||
|
|
||||||
|
import com.xgl.lottery.ReturnCodeEnum;
|
||||||
|
import com.xgl.lottery.constants.ActivityEnum;
|
||||||
|
import com.xgl.lottery.mapper.ReceivingAddressMapper;
|
||||||
|
import com.xgl.lottery.request.dto.ClockRecordDTO;
|
||||||
|
import com.xgl.lottery.request.dto.ReceivingAddressDTO;
|
||||||
|
import com.xgl.lottery.request.dto.UserInfoDTO;
|
||||||
|
import com.xgl.lottery.request.vo.*;
|
||||||
|
import com.xgl.lottery.service.BusinessService;
|
||||||
|
import com.xgl.lottery.service.dto.ResultResp;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Validated
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/business")
|
||||||
|
@Api(tags = "【h5】BusinessController-打卡抽卡相关控制器")
|
||||||
|
public class BusinessController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BusinessService businessService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ReceivingAddressMapper receivingAddressMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/token")
|
||||||
|
@ApiOperation(value = "用户token信息")
|
||||||
|
public ResultResp<String> getToken() throws IOException {
|
||||||
|
return businessService.getToken();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ApiOperation(value = "用户信息")
|
||||||
|
|
||||||
|
public ResultResp<HashMap<String, String>>userInfo(@Validated @RequestBody UserInfoDTO userInfoDTO) throws ParseException {
|
||||||
|
return businessService.userInfo(userInfoDTO);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/get/user")
|
||||||
|
@ApiOperation(value = "根据openid查询用户信息")
|
||||||
|
public ResultResp<UserInfo>getUser(@NotNull @RequestParam("openid")String openid) {
|
||||||
|
return businessService.getUser(openid);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/add/address")
|
||||||
|
@ApiOperation(value = "提交用户地址信息")
|
||||||
|
public ResultResp<HashMap<String, String>>userAddress(@Validated @RequestBody ReceivingAddressDTO receivingAddressDTO) {
|
||||||
|
ResultResp<HashMap<String, String>> resultResp = new ResultResp<>();
|
||||||
|
ReceivingAddress receivingAddress1 = receivingAddressMapper.selectByPrimaryKey(receivingAddressDTO.getOpenid());
|
||||||
|
if (null!=receivingAddress1){
|
||||||
|
resultResp.setCode(ReturnCodeEnum.ADDRESS_EXIT.getCode());
|
||||||
|
resultResp.setMsg(ReturnCodeEnum.ADDRESS_EXIT.getMsg());
|
||||||
|
return resultResp;
|
||||||
|
}
|
||||||
|
businessService.userAddress(receivingAddressDTO);
|
||||||
|
//返回结果设置
|
||||||
|
resultResp.setCode(ReturnCodeEnum.SUCCESS.getCode());
|
||||||
|
resultResp.setMsg(ReturnCodeEnum.SUCCESS.getMsg());
|
||||||
|
//对象转换
|
||||||
|
resultResp.setResult(null);
|
||||||
|
return resultResp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/address")
|
||||||
|
@ApiOperation(value = "查看用户地址信息")
|
||||||
|
public ResultResp<ReceivingAddress>userAddressInfo(@NotNull @RequestParam("openid")String openid) {
|
||||||
|
ResultResp<ReceivingAddress> resultResp = new ResultResp<>();
|
||||||
|
ReceivingAddress receivingAddress = businessService.userAddressInfo(openid);
|
||||||
|
//返回结果设置
|
||||||
|
resultResp.setCode(ReturnCodeEnum.SUCCESS.getCode());
|
||||||
|
resultResp.setMsg(ReturnCodeEnum.SUCCESS.getMsg());
|
||||||
|
//对象转换
|
||||||
|
resultResp.setResult(receivingAddress);
|
||||||
|
return resultResp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/prize")
|
||||||
|
@ApiOperation(value = "查看用户奖品")
|
||||||
|
public ResultResp<List<LotteryRecord>>userPrize(@NotNull @RequestParam("openid")String openid) {
|
||||||
|
ResultResp<List<LotteryRecord>> resultResp = new ResultResp<>();
|
||||||
|
List<LotteryRecord> lotteryRecord = businessService.userPrize(openid);
|
||||||
|
//返回结果设置
|
||||||
|
resultResp.setCode(ReturnCodeEnum.SUCCESS.getCode());
|
||||||
|
resultResp.setMsg(ReturnCodeEnum.SUCCESS.getMsg());
|
||||||
|
//对象转换
|
||||||
|
resultResp.setResult(lotteryRecord);
|
||||||
|
return resultResp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/clock/complete")
|
||||||
|
@ApiOperation(value = "用户已打卡日期")
|
||||||
|
public ResultResp<List<String>>clockComplete(@NotNull @RequestParam("openid")String openid) {
|
||||||
|
return businessService.clockComplete(openid);
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/sport/ranking")
|
||||||
|
@ApiOperation(value = "用户运动排名")
|
||||||
|
public ResultResp<ArrayList<ClockRecordSort>>sportRanking() {
|
||||||
|
return businessService.sportRanking();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/draw/card")
|
||||||
|
@ApiOperation(value = "用户抽取卡片")
|
||||||
|
public ResultResp<SportCard>drawCard(@NotNull @RequestParam("openid")String openid) {
|
||||||
|
return businessService.drawCard(openid);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/hit/clock")
|
||||||
|
@ApiOperation(value = "用户打卡")
|
||||||
|
public ResultResp<String>hitClock(@Validated @RequestBody ClockRecordDTO clockRecordDTO) throws Exception {
|
||||||
|
return businessService.hitClock2(clockRecordDTO);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/activity")
|
||||||
|
@ApiOperation(value = "获取活动")
|
||||||
|
public ResultResp<List<HashMap<String, String>>> getActivity() throws ParseException {
|
||||||
|
List<HashMap<String, String>> enumList = ActivityEnum.getEnumList();
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(),ReturnCodeEnum.SUCCESS.getMsg(),enumList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
135
src/main/java/com/xgl/lottery/controller/FileController.java
Normal file
135
src/main/java/com/xgl/lottery/controller/FileController.java
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
package com.xgl.lottery.controller;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.aliyun.oss.OSSClient;
|
||||||
|
import com.xgl.lottery.ReturnCodeEnum;
|
||||||
|
import com.xgl.lottery.config.AccessToken;
|
||||||
|
import com.xgl.lottery.service.dto.ResultResp;
|
||||||
|
import com.xgl.lottery.utils.DateUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.ServletRequest;
|
||||||
|
import javax.servlet.ServletResponse;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping({"/oss"})
|
||||||
|
public class FileController {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(FileController.class);
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
@Resource
|
||||||
|
RedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping({"/get/file"})
|
||||||
|
public ResultResp getUpload(ServletRequest servletRequest, ServletResponse servletResponse) throws IOException {
|
||||||
|
HttpServletRequest request = (HttpServletRequest)servletRequest;
|
||||||
|
HttpServletResponse response = (HttpServletResponse)servletResponse;
|
||||||
|
response.setHeader("Cache-Control", "no-store");
|
||||||
|
String appid = "wx35766a64d73d08a9";
|
||||||
|
String authCode = "18c8b79b82542686153689a04b34b1e5";
|
||||||
|
String code = request.getParameter("media_id");
|
||||||
|
String access_token = null;
|
||||||
|
String media_id;
|
||||||
|
String url;
|
||||||
|
if (StringUtils.isNotEmpty(code)) {
|
||||||
|
try {
|
||||||
|
access_token = this.redisTemplate.opsForValue().get("wx_token").toString();
|
||||||
|
} catch (Exception var23) {
|
||||||
|
var23.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(access_token)) {
|
||||||
|
url = MessageFormat.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}", appid, authCode);
|
||||||
|
ResponseEntity<String> responseEntity = this.restTemplate.getForEntity(url, String.class, new Object[0]);
|
||||||
|
if (200 == responseEntity.getStatusCodeValue()) {
|
||||||
|
media_id = (String)responseEntity.getBody();
|
||||||
|
AccessToken wxOAuth2AccessToken = (AccessToken)JSON.parseObject(media_id, AccessToken.class);
|
||||||
|
assert wxOAuth2AccessToken != null;
|
||||||
|
|
||||||
|
access_token = wxOAuth2AccessToken.getAccessToken();
|
||||||
|
this.redisTemplate.opsForValue().set("wx_token", access_token, (long)(wxOAuth2AccessToken.getExpires_in() - 2000), TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
media_id = request.getParameter("media_id");
|
||||||
|
if (StringUtils.isNotEmpty(media_id) && StringUtils.isNotBlank(access_token)) {
|
||||||
|
url = "https://api.weixin.qq.com/cgi-bin/media/get?access_token=" + access_token + "&media_id=" + media_id;
|
||||||
|
String datePath = DateUtil.format(new Date(), "yyyy/MM/dd");
|
||||||
|
String fileName = UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
|
JSONObject json = null;
|
||||||
|
ResponseEntity<String> forEntity = this.restTemplate.getForEntity(url, String.class, new Object[0]);
|
||||||
|
if (200 == forEntity.getStatusCodeValue()) {
|
||||||
|
try {
|
||||||
|
if (JSON.parseObject((String)forEntity.getBody()) != null && StringUtils.isNotEmpty(JSON.parseObject((String)forEntity.getBody()).getString("errmsg"))) {
|
||||||
|
return ResultResp.fail(JSON.parseObject((String)forEntity.getBody()).getString("errcode"), JSON.parseObject((String)forEntity.getBody()).getString("errmsg"));
|
||||||
|
}
|
||||||
|
} catch (Exception var22) {
|
||||||
|
var22.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
String upload = upload(datePath, fileName, url);
|
||||||
|
return StringUtils.isNotBlank(upload) ? ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), upload) : ResultResp.fail(ReturnCodeEnum.FAIL.getCode(), ReturnCodeEnum.FAIL.getMsg());
|
||||||
|
} else {
|
||||||
|
return ResultResp.success(ReturnCodeEnum.FAIL.getCode(), ReturnCodeEnum.FAIL.getMsg(), JSONObject.toJSONString(forEntity));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ResultResp.fail(ReturnCodeEnum.REQUEST_PARAM_NOT_VALID.getCode(), ReturnCodeEnum.REQUEST_PARAM_NOT_VALID.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String upload(String unionid, String media, String requestUrl) {
|
||||||
|
String endpoint = "oss-cn-shenzhen.aliyuncs.com";
|
||||||
|
String accessKeyId = "sSJ5t0yC1CaKhPJ4";
|
||||||
|
String accessKeySecret = "PsbdUTexU95BkiqO4ADELXpIaYdWGk";
|
||||||
|
String bucketName = "szxgl";
|
||||||
|
String key = "user/clock/" + unionid + "/" + media + ".jpg";
|
||||||
|
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
|
||||||
|
System.out.println(requestUrl);
|
||||||
|
|
||||||
|
try {
|
||||||
|
URL url = new URL(requestUrl);
|
||||||
|
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
|
||||||
|
conn.setDoInput(true);
|
||||||
|
conn.setRequestMethod("GET");
|
||||||
|
conn.connect();
|
||||||
|
InputStream input = conn.getInputStream();
|
||||||
|
System.out.println(conn.getResponseMessage());
|
||||||
|
System.out.print(conn.getContentType());
|
||||||
|
ossClient.putObject(bucketName, key, input);
|
||||||
|
conn.disconnect();
|
||||||
|
ossClient.shutdown();
|
||||||
|
return "https://" + bucketName + "." + endpoint + "/" + key;
|
||||||
|
} catch (Exception var12) {
|
||||||
|
log.error("文件上传异常", var12);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
170
src/main/java/com/xgl/lottery/controller/LotteryController.java
Normal file
170
src/main/java/com/xgl/lottery/controller/LotteryController.java
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
package com.xgl.lottery.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.xgl.lottery.RedisKeyManager;
|
||||||
|
import com.xgl.lottery.ReturnCodeEnum;
|
||||||
|
import com.xgl.lottery.controller.vo.LotteryItemVo;
|
||||||
|
import com.xgl.lottery.converter.LotteryConverter;
|
||||||
|
import com.xgl.lottery.exception.RewardException;
|
||||||
|
import com.xgl.lottery.mapper.ClockRecordMapper;
|
||||||
|
import com.xgl.lottery.mapper.DrawNumMapper;
|
||||||
|
import com.xgl.lottery.request.vo.ClockRecord;
|
||||||
|
import com.xgl.lottery.request.vo.DrawNum;
|
||||||
|
import com.xgl.lottery.request.vo.LotteryRecord;
|
||||||
|
import com.xgl.lottery.service.BusinessService;
|
||||||
|
import com.xgl.lottery.service.ILotteryService;
|
||||||
|
import com.xgl.lottery.service.dto.DoDrawDto;
|
||||||
|
import com.xgl.lottery.service.dto.ResultResp;
|
||||||
|
import com.xgl.lottery.utils.ExceptionUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "【h5】LotteryController-抽奖控制器")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/lottery")
|
||||||
|
public class LotteryController {
|
||||||
|
@Autowired
|
||||||
|
ILotteryService lotteryService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
RedisTemplate<String, String> redisTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
LotteryConverter lotteryConverter;
|
||||||
|
@Resource
|
||||||
|
private ClockRecordMapper clockRecordMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BusinessService businessService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DrawNumMapper drawNumMapper;
|
||||||
|
|
||||||
|
private static final String time = "2022-05-13 22:00:00";
|
||||||
|
|
||||||
|
@GetMapping("/draw")
|
||||||
|
@ApiOperation(value = "用户抽奖")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
|
||||||
|
@ApiImplicitParam(name = "openid", value = "用户openid",dataType = "String",required = true),
|
||||||
|
@ApiImplicitParam(name = "flag", value = "默认为false,全部消耗时为true",dataType = "Boolean",required = false)
|
||||||
|
})
|
||||||
|
public ResultResp<LotteryItemVo> doDraw( @NotNull @RequestParam("openid")String openid,@NotNull @RequestParam(value = "flag",defaultValue = "false")Boolean flag, HttpServletRequest request) {
|
||||||
|
|
||||||
|
|
||||||
|
Integer id=1;
|
||||||
|
|
||||||
|
String date = getDateTime();
|
||||||
|
|
||||||
|
if (date.compareTo(time) >= 0){
|
||||||
|
return ResultResp.fail(ReturnCodeEnum.LOTTER_COME_OVER.getCode(),ReturnCodeEnum.LOTTER_COME_OVER.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
ResultResp<LotteryItemVo> resultResp = new ResultResp<>();
|
||||||
|
try {
|
||||||
|
List<ClockRecord> clockRecords = clockRecordMapper.selectAllByOpenid(openid);
|
||||||
|
if (CollectionUtil.isNotEmpty(clockRecords)&&clockRecords.size()>0){
|
||||||
|
Date time = clockRecords.get(0).getEndTime();
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||||
|
String format = dateFormat.format(time);
|
||||||
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime localTime = LocalDateTime.parse(format, dtf);
|
||||||
|
LocalDateTime startTime = LocalDate.now().atTime(0, 0, 0);
|
||||||
|
LocalDateTime endTime = LocalDate.now().atTime(23, 59, 59);
|
||||||
|
if(!(localTime.isAfter(startTime) && localTime.isBefore(endTime))){
|
||||||
|
return ResultResp.fail(ReturnCodeEnum.LOTTER_BEFORE.getCode(),ReturnCodeEnum.LOTTER_BEFORE.getMsg());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
return ResultResp.fail(ReturnCodeEnum.LOTTER_BEFORE.getCode(),ReturnCodeEnum.LOTTER_BEFORE.getMsg());
|
||||||
|
}
|
||||||
|
DrawNum drawNum = drawNumMapper.selectByOpenid(openid);
|
||||||
|
if (null==drawNum){
|
||||||
|
return ResultResp.fail(ReturnCodeEnum.LOTTER_NUM.getCode(),ReturnCodeEnum.LOTTER_NUM.getMsg());
|
||||||
|
}
|
||||||
|
if (drawNum.getNum()<=0){
|
||||||
|
return ResultResp.fail(ReturnCodeEnum.LOTTER_NUM.getCode(),ReturnCodeEnum.LOTTER_NUM.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<LotteryRecord> lotteryRecord = businessService.userPrizeByLottery(openid);
|
||||||
|
if (CollectionUtil.isNotEmpty(lotteryRecord)&&lotteryRecord.size()>=1){
|
||||||
|
ResultResp<LotteryItemVo> resultResp1 = new ResultResp<>();
|
||||||
|
LotteryItemVo lotteryItemVo = new LotteryItemVo();
|
||||||
|
if (flag){
|
||||||
|
drawNumMapper.updateByOpenidSpentAll(openid);
|
||||||
|
}else {
|
||||||
|
DrawNum num = drawNumMapper.selectByOpenid(openid);
|
||||||
|
if (num.getNum()>0) {
|
||||||
|
drawNumMapper.updateByOpenidSpentOne(openid, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lotteryItemVo.setLotteryId( 1 );
|
||||||
|
lotteryItemVo.setAccountIp( openid);
|
||||||
|
lotteryItemVo.setPrizeName( "谢谢参与" );
|
||||||
|
lotteryItemVo.setLevel(8);
|
||||||
|
lotteryItemVo.setPrizeId( 8 );
|
||||||
|
resultResp1.setCode(ReturnCodeEnum.SUCCESS.getCode());
|
||||||
|
resultResp1.setMsg(ReturnCodeEnum.SUCCESS.getMsg());
|
||||||
|
resultResp1.setResult(lotteryItemVo);
|
||||||
|
return resultResp1;
|
||||||
|
}
|
||||||
|
if (flag){
|
||||||
|
drawNumMapper.updateByOpenidSpentAll(openid);
|
||||||
|
}else {
|
||||||
|
DrawNum num = drawNumMapper.selectByOpenid(openid);
|
||||||
|
if (num.getNum()>0) {
|
||||||
|
drawNumMapper.updateByOpenidSpentOne(openid, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DoDrawDto dto = new DoDrawDto();
|
||||||
|
dto.setAccountIp(openid);
|
||||||
|
dto.setLotteryId(id);
|
||||||
|
lotteryService.doDraw(dto);
|
||||||
|
|
||||||
|
resultResp.setCode(ReturnCodeEnum.SUCCESS.getCode());
|
||||||
|
resultResp.setMsg(ReturnCodeEnum.SUCCESS.getMsg());
|
||||||
|
resultResp.setResult(lotteryConverter.dto2LotteryItemVo(dto));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ExceptionUtil.handlerException4biz(resultResp, e);
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
}
|
||||||
|
return resultResp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getDateTime() {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String dateTime = sdf.format(new Date());
|
||||||
|
|
||||||
|
return dateTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.xgl.lottery.controller.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class LotteryItemVo {
|
||||||
|
private Integer lotteryId;
|
||||||
|
|
||||||
|
private String accountIp;
|
||||||
|
|
||||||
|
private String prizeName;
|
||||||
|
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
private Integer prizeId;
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.xgl.lottery.converter;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xgl.lottery.controller.vo.LotteryItemVo;
|
||||||
|
import com.xgl.lottery.service.dto.DoDrawDto;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mapstruct 对象属性映射
|
||||||
|
*/
|
||||||
|
@Mapper(componentModel = "spring")
|
||||||
|
public interface LotteryConverter {
|
||||||
|
|
||||||
|
LotteryItemVo dto2LotteryItemVo(DoDrawDto drawDto);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.xgl.lottery.dal.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public interface LotteryItemMapper extends BaseMapper<LotteryItem> {
|
||||||
|
|
||||||
|
}
|
||||||
13
src/main/java/com/xgl/lottery/dal/mapper/LotteryMapper.java
Normal file
13
src/main/java/com/xgl/lottery/dal/mapper/LotteryMapper.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package com.xgl.lottery.dal.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xgl.lottery.dal.model.Lottery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public interface LotteryMapper extends BaseMapper<Lottery> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.xgl.lottery.dal.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryPrize;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Update;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public interface LotteryPrizeMapper extends BaseMapper<LotteryPrize> {
|
||||||
|
|
||||||
|
@Update("update lottery_prize set valid_stock=valid_stock-1 where valid_stock>=1 and id=#{id}")
|
||||||
|
void updateValidStock(@Param("id") Serializable id);
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.xgl.lottery.dal.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public interface LotteryRecordMapper extends BaseMapper<LotteryRecord> {
|
||||||
|
|
||||||
|
}
|
||||||
41
src/main/java/com/xgl/lottery/dal/model/Lottery.java
Normal file
41
src/main/java/com/xgl/lottery/dal/model/Lottery.java
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package com.xgl.lottery.dal.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class Lottery extends Model {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String topic;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
private String link;
|
||||||
|
|
||||||
|
private String images;
|
||||||
|
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
53
src/main/java/com/xgl/lottery/dal/model/LotteryItem.java
Normal file
53
src/main/java/com/xgl/lottery/dal/model/LotteryItem.java
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
package com.xgl.lottery.dal.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class LotteryItem extends Model {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer lotteryId;
|
||||||
|
|
||||||
|
|
||||||
|
private String itemName;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
|
||||||
|
private BigDecimal percent;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer prizeId;
|
||||||
|
|
||||||
|
|
||||||
|
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||||
|
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer defaultItem;
|
||||||
|
|
||||||
|
}
|
||||||
42
src/main/java/com/xgl/lottery/dal/model/LotteryPrize.java
Normal file
42
src/main/java/com/xgl/lottery/dal/model/LotteryPrize.java
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package com.xgl.lottery.dal.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class LotteryPrize extends Model {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer lotteryId;
|
||||||
|
|
||||||
|
|
||||||
|
private String prizeName;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer prizeType;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer totalStock;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer validStock;
|
||||||
|
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
36
src/main/java/com/xgl/lottery/dal/model/LotteryRecord.java
Normal file
36
src/main/java/com/xgl/lottery/dal/model/LotteryRecord.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package com.xgl.lottery.dal.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class LotteryRecord extends Model {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String accountIp;
|
||||||
|
|
||||||
|
private Integer itemId;
|
||||||
|
|
||||||
|
private String prizeName;
|
||||||
|
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
private Integer lotteryType;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
package com.xgl.lottery.exception;
|
||||||
|
|
||||||
|
public class BaseBusinessException extends RuntimeException {
|
||||||
|
|
||||||
|
protected String errorCode;
|
||||||
|
|
||||||
|
protected String message;
|
||||||
|
|
||||||
|
protected String extFields;
|
||||||
|
|
||||||
|
public BaseBusinessException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseBusinessException(String errorCode) {
|
||||||
|
super();
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseBusinessException(Throwable arg0) {
|
||||||
|
super(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseBusinessException(String errorCode, Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseBusinessException(String errorCode, String message) {
|
||||||
|
super();
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseBusinessException(String errorCode, String message, Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseBusinessException(String errorCode, String message, String extFields, Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.message = message;
|
||||||
|
this.extFields = extFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for property <tt>errorCode</tt>.
|
||||||
|
*
|
||||||
|
* @return property value of errorCode
|
||||||
|
*/
|
||||||
|
public String getErrorCode() {
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter method for property <tt>errorCode</tt>.
|
||||||
|
*
|
||||||
|
* @param errorCode value to be assigned to property errorCode
|
||||||
|
*/
|
||||||
|
public void setErrorCode(String errorCode) {
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExtFields() {
|
||||||
|
return extFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtFields(String extFields) {
|
||||||
|
this.extFields = extFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for property <tt>message</tt>.
|
||||||
|
*
|
||||||
|
* @return property value of message
|
||||||
|
*/
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter method for property <tt>message</tt>.
|
||||||
|
*
|
||||||
|
* @param message value to be assigned to property message
|
||||||
|
*/
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
34
src/main/java/com/xgl/lottery/exception/BizException.java
Normal file
34
src/main/java/com/xgl/lottery/exception/BizException.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package com.xgl.lottery.exception;
|
||||||
|
|
||||||
|
public class BizException extends BaseBusinessException {
|
||||||
|
|
||||||
|
public BizException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizException(String errorCode) {
|
||||||
|
super();
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizException(Throwable arg0) {
|
||||||
|
super(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizException(String errorCode, Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizException(String errorCode, String message) {
|
||||||
|
super();
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BizException(String errorCode, String message, Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
35
src/main/java/com/xgl/lottery/exception/RewardException.java
Normal file
35
src/main/java/com/xgl/lottery/exception/RewardException.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package com.xgl.lottery.exception;
|
||||||
|
|
||||||
|
|
||||||
|
public class RewardException extends BaseBusinessException {
|
||||||
|
|
||||||
|
public RewardException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RewardException(String errorCode) {
|
||||||
|
super();
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RewardException(Throwable arg0) {
|
||||||
|
super(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RewardException(String errorCode, Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RewardException(String errorCode, String message) {
|
||||||
|
super();
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RewardException(String errorCode, String message, Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.xgl.lottery.exception;
|
||||||
|
|
||||||
|
|
||||||
|
public class UnRewardException extends BaseBusinessException {
|
||||||
|
|
||||||
|
public UnRewardException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnRewardException(String errorCode) {
|
||||||
|
super();
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnRewardException(Throwable arg0) {
|
||||||
|
super(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnRewardException(String errorCode, Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnRewardException(String errorCode, String message) {
|
||||||
|
super();
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnRewardException(String errorCode, String message, Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
34
src/main/java/com/xgl/lottery/mapper/ClockRecordMapper.java
Normal file
34
src/main/java/com/xgl/lottery/mapper/ClockRecordMapper.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package com.xgl.lottery.mapper;
|
||||||
|
|
||||||
|
import com.xgl.lottery.request.vo.ClockRecord;
|
||||||
|
import com.xgl.lottery.request.vo.HelpRecord;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ClockRecordMapper {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(ClockRecord record);
|
||||||
|
|
||||||
|
int insertHelp(@Param("openid")String openid, @Param("helpid")String helpid, @Param("createTime") String createTime);
|
||||||
|
|
||||||
|
int insertSelective(ClockRecord record);
|
||||||
|
|
||||||
|
ClockRecord selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
HelpRecord selectHelp(@Param("openid")String openid, @Param("helpid")String helpid, @Param("createTime") String createTime);
|
||||||
|
|
||||||
|
List<ClockRecord> selectAllByOpenid(@Param("openid")String openid);
|
||||||
|
|
||||||
|
List<String> clockComplete(@Param("openid")String openid);
|
||||||
|
|
||||||
|
List<ClockRecord> selectByOpenid();
|
||||||
|
|
||||||
|
List<ClockRecord> selectByOpenidAll();
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(ClockRecord record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(ClockRecord record);
|
||||||
|
}
|
||||||
40
src/main/java/com/xgl/lottery/mapper/DrawNumMapper.java
Normal file
40
src/main/java/com/xgl/lottery/mapper/DrawNumMapper.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package com.xgl.lottery.mapper;
|
||||||
|
|
||||||
|
import com.xgl.lottery.request.vo.ClockContinue;
|
||||||
|
import com.xgl.lottery.request.vo.DrawNum;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
public interface DrawNumMapper {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(DrawNum record);
|
||||||
|
|
||||||
|
int insertSelective(DrawNum record);
|
||||||
|
|
||||||
|
DrawNum selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
DrawNum selectByOpenid(@Param("openid") String openid);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(DrawNum record);
|
||||||
|
|
||||||
|
int updateByOpenid(@Param("openid") String openid,@Param("num")Integer num);
|
||||||
|
|
||||||
|
|
||||||
|
int updateByOpenidSpentAll(@Param("openid") String openid);
|
||||||
|
|
||||||
|
int updateByOpenidSpentOne(@Param("openid") String openid,@Param("num")Integer num);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(DrawNum record);
|
||||||
|
|
||||||
|
int updateByShareId(@Param("shareId") String shareId);
|
||||||
|
|
||||||
|
int insertClockContinue(ClockContinue record);
|
||||||
|
|
||||||
|
int updateClockContinue(@Param("num") int num, @Param("record_time") String record_time,@Param("openid") String openid);
|
||||||
|
|
||||||
|
int updateClockContinueadd(@Param("num") int num, @Param("record_time") String record_time,@Param("openid") String openid);
|
||||||
|
|
||||||
|
ClockContinue selectByOpenidAndTime(@Param("openid") String openid, @Param("record_time") String record_time);
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.xgl.lottery.mapper;
|
||||||
|
|
||||||
|
import com.xgl.lottery.request.vo.LotteryRecord;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface LotteryUserRecordMapper {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(LotteryRecord record);
|
||||||
|
|
||||||
|
int insertSelective(LotteryRecord record);
|
||||||
|
|
||||||
|
List<LotteryRecord> selectByPrimaryKey(@Param("openid") String openid);
|
||||||
|
|
||||||
|
|
||||||
|
List<LotteryRecord> selectByLettery(@Param("openid") String openid);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(LotteryRecord record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(LotteryRecord record);
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.xgl.lottery.mapper;
|
||||||
|
|
||||||
|
import com.xgl.lottery.request.vo.ReceivingAddress;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
public interface ReceivingAddressMapper {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(ReceivingAddress record);
|
||||||
|
|
||||||
|
int insertSelective(ReceivingAddress record);
|
||||||
|
|
||||||
|
ReceivingAddress selectByPrimaryKey(@Param("openid") String openid);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(ReceivingAddress record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(ReceivingAddress record);
|
||||||
|
}
|
||||||
24
src/main/java/com/xgl/lottery/mapper/SportCardMapper.java
Normal file
24
src/main/java/com/xgl/lottery/mapper/SportCardMapper.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package com.xgl.lottery.mapper;
|
||||||
|
|
||||||
|
import com.xgl.lottery.request.vo.SportCard;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SportCardMapper {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(SportCard record);
|
||||||
|
|
||||||
|
int insertSelective(SportCard record);
|
||||||
|
|
||||||
|
SportCard selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
SportCard selectByCardType(@Param("cardType")String cardType);
|
||||||
|
|
||||||
|
List<SportCard> selectAll();
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(SportCard record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(SportCard record);
|
||||||
|
}
|
||||||
24
src/main/java/com/xgl/lottery/mapper/UserInfoMapper.java
Normal file
24
src/main/java/com/xgl/lottery/mapper/UserInfoMapper.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package com.xgl.lottery.mapper;
|
||||||
|
|
||||||
|
import com.xgl.lottery.request.vo.UserInfo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
public interface UserInfoMapper {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(UserInfo record);
|
||||||
|
|
||||||
|
int insertSelective(UserInfo record);
|
||||||
|
|
||||||
|
UserInfo selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
UserInfo selectByUm(@Param("um") String um);
|
||||||
|
|
||||||
|
UserInfo selectByshareId(@Param("shareId") String shareId);
|
||||||
|
|
||||||
|
UserInfo selectByOpenid(@Param("openid") String openid);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(UserInfo record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(UserInfo record);
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.xgl.lottery.mapper;
|
||||||
|
|
||||||
|
import com.xgl.lottery.request.vo.UserSportCard;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface UserSportCardMapper {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(UserSportCard record);
|
||||||
|
|
||||||
|
int insertSelective(UserSportCard record);
|
||||||
|
|
||||||
|
UserSportCard selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
List<UserSportCard> selectByOpenid(@Param("openid") String openid);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(UserSportCard record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(UserSportCard record);
|
||||||
|
}
|
||||||
142
src/main/java/com/xgl/lottery/request/dto/ClockRecordDTO.java
Normal file
142
src/main/java/com/xgl/lottery/request/dto/ClockRecordDTO.java
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
package com.xgl.lottery.request.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "打卡记录")
|
||||||
|
public class ClockRecordDTO {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openid",required = true)
|
||||||
|
@NotNull(message = "openid不能为空")
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡片类型
|
||||||
|
*/
|
||||||
|
@NotNull(message = "openid不能为空")
|
||||||
|
@ApiModelProperty(value = "卡片类型",required = true)
|
||||||
|
private String cardType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
@NotNull(message = "图片不能为空")
|
||||||
|
@ApiModelProperty(value = "图片",required = true)
|
||||||
|
private String photo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
@NotNull(message = "开始时间不能为空")
|
||||||
|
@ApiModelProperty(value = "开始时间",example = "yyyy-MM-dd hh:mm:ss",required = true)
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
private String beginTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
@NotNull(message = "结束时间不能为空")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "结束时间",example = "yyyy-MM-dd hh:mm:ss",required = true)
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 打卡时长
|
||||||
|
// */
|
||||||
|
// @ApiModelProperty(value = "打卡时长",required = true)
|
||||||
|
// private Integer duration;
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 打卡日期
|
||||||
|
// */
|
||||||
|
// @ApiModelProperty(value = "打卡日期",required = true)
|
||||||
|
// private Date date;
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 创建时间
|
||||||
|
// */
|
||||||
|
// @ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
// private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getOpenid() {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenid(String openid) {
|
||||||
|
this.openid = openid == null ? null : openid.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardType() {
|
||||||
|
return cardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardType(String cardType) {
|
||||||
|
this.cardType = cardType == null ? null : cardType.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhoto() {
|
||||||
|
return photo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoto(String photo) {
|
||||||
|
this.photo = photo == null ? null : photo.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBeginTime() {
|
||||||
|
return beginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBeginTime(String beginTime) {
|
||||||
|
this.beginTime = beginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(String endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// public Integer getDuration() {
|
||||||
|
// return duration;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setDuration(Integer duration) {
|
||||||
|
// this.duration = duration;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Date getDate() {
|
||||||
|
// return date;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setDate(Date date) {
|
||||||
|
// this.date = date;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Date getCreateTime() {
|
||||||
|
// return createTime;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setCreateTime(Date createTime) {
|
||||||
|
// this.createTime = createTime;
|
||||||
|
// }
|
||||||
|
}
|
||||||
75
src/main/java/com/xgl/lottery/request/dto/DrawNumDTO.java
Normal file
75
src/main/java/com/xgl/lottery/request/dto/DrawNumDTO.java
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
package com.xgl.lottery.request.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "抽奖机会信息")
|
||||||
|
public class DrawNumDTO {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openid",required = true)
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "分享id",required = true)
|
||||||
|
private String shareId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 次数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "次数",required = true)
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getOpenid() {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenid(String openid) {
|
||||||
|
this.openid = openid == null ? null : openid.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShareId() {
|
||||||
|
return shareId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShareId(String shareId) {
|
||||||
|
this.shareId = shareId == null ? null : shareId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNum() {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNum(Integer num) {
|
||||||
|
this.num = num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
package com.xgl.lottery.request.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "中奖记录")
|
||||||
|
public class LotteryRecordDTO {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openId",required = true)
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "itemId",required = true)
|
||||||
|
private Integer itemId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "奖品名称",required = true)
|
||||||
|
private String prizeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public String getOpenId() {
|
||||||
|
return openId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenId(String openId) {
|
||||||
|
this.openId = openId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getItemId() {
|
||||||
|
return itemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItemId(Integer itemId) {
|
||||||
|
this.itemId = itemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrizeName() {
|
||||||
|
return prizeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrizeName(String prizeName) {
|
||||||
|
this.prizeName = prizeName == null ? null : prizeName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,112 @@
|
|||||||
|
package com.xgl.lottery.request.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "收货地址信息")
|
||||||
|
public class ReceivingAddressDTO {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openId",required = true)
|
||||||
|
@NotNull(message = "openid不能为空")
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "联系人",required = true)
|
||||||
|
@NotNull(message = "联系人不能为空")
|
||||||
|
private String linkName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "联系电话",required = true)
|
||||||
|
@NotNull(message = "联系电话不能为空")
|
||||||
|
private String linkPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地区
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "地区",required = true)
|
||||||
|
@NotNull(message = "地区不能为空")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地区详址
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "地区详址",required = true)
|
||||||
|
@NotNull(message = "地区详址不能为空")
|
||||||
|
private String addressDetail;
|
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 创建时间
|
||||||
|
// */
|
||||||
|
// @ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
// private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getOpenid() {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenid(String openid) {
|
||||||
|
this.openid = openid == null ? null : openid.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLinkName() {
|
||||||
|
return linkName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinkName(String linkName) {
|
||||||
|
this.linkName = linkName == null ? null : linkName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLinkPhone() {
|
||||||
|
return linkPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinkPhone(String linkPhone) {
|
||||||
|
this.linkPhone = linkPhone == null ? null : linkPhone.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address == null ? null : address.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddressDetail() {
|
||||||
|
return addressDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddressDetail(String addressDetail) {
|
||||||
|
this.addressDetail = addressDetail == null ? null : addressDetail.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// public Date getCreateTime() {
|
||||||
|
// return createTime;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setCreateTime(Date createTime) {
|
||||||
|
// this.createTime = createTime;
|
||||||
|
// }
|
||||||
|
}
|
||||||
59
src/main/java/com/xgl/lottery/request/dto/SportCardDTO.java
Normal file
59
src/main/java/com/xgl/lottery/request/dto/SportCardDTO.java
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package com.xgl.lottery.request.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "运动卡片信息")
|
||||||
|
public class SportCardDTO {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "内容",required = true)
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡片类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "卡片类型",required = true)
|
||||||
|
private String cardType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content == null ? null : content.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardType() {
|
||||||
|
return cardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardType(String cardType) {
|
||||||
|
this.cardType = cardType == null ? null : cardType.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
126
src/main/java/com/xgl/lottery/request/dto/UserInfoDTO.java
Normal file
126
src/main/java/com/xgl/lottery/request/dto/UserInfoDTO.java
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
package com.xgl.lottery.request.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户信息表
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "用户信息")
|
||||||
|
public class UserInfoDTO {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openid",required = true)
|
||||||
|
@NotNull(message = "图片不能为空")
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* um
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "um",required = true)
|
||||||
|
@NotNull(message = "图片不能为空")
|
||||||
|
private String um;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "联系电话",required = true)
|
||||||
|
private String linkPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "分享id",required = true)
|
||||||
|
private String shareId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "昵称",required = true)
|
||||||
|
@NotNull(message = "昵称不能为空")
|
||||||
|
private String nick;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户图像
|
||||||
|
*/
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户图像",required = true)
|
||||||
|
@NotNull(message = "用户图像不能为空")
|
||||||
|
private String headUrl;
|
||||||
|
// /**
|
||||||
|
// * 创建时间
|
||||||
|
// */
|
||||||
|
// @ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
// private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
public String getNick() {
|
||||||
|
return nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNick(String nick) {
|
||||||
|
this.nick = nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpenid() {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenid(String openid) {
|
||||||
|
this.openid = openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUm() {
|
||||||
|
return um;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUm(String um) {
|
||||||
|
this.um = um;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLinkPhone() {
|
||||||
|
return linkPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinkPhone(String linkPhone) {
|
||||||
|
this.linkPhone = linkPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShareId() {
|
||||||
|
return shareId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShareId(String shareId) {
|
||||||
|
this.shareId = shareId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeadUrl() {
|
||||||
|
return headUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeadUrl(String headUrl) {
|
||||||
|
this.headUrl = headUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// public Date getCreateTime() {
|
||||||
|
// return createTime;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setCreateTime(Date createTime) {
|
||||||
|
// this.createTime = createTime;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
package com.xgl.lottery.request.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "用户抽取卡片信息")
|
||||||
|
public class UserSportCardDTO {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openid",required = true)
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡片类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "卡片类型",required = true)
|
||||||
|
private String cardType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抽卡日期
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "抽卡日期",required = true)
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public String getOpenid() {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenid(String openid) {
|
||||||
|
this.openid = openid == null ? null : openid.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardType() {
|
||||||
|
return cardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardType(String cardType) {
|
||||||
|
this.cardType = cardType == null ? null : cardType.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Date date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
36
src/main/java/com/xgl/lottery/request/vo/Activity.java
Normal file
36
src/main/java/com/xgl/lottery/request/vo/Activity.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package com.xgl.lottery.request.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "运动卡片信息")
|
||||||
|
public class Activity {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "名称",required = true)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "开始时间",required = true)
|
||||||
|
private String begin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "结束时间",required = true)
|
||||||
|
private Date end;
|
||||||
|
|
||||||
|
}
|
||||||
77
src/main/java/com/xgl/lottery/request/vo/ClockContinue.java
Normal file
77
src/main/java/com/xgl/lottery/request/vo/ClockContinue.java
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
package com.xgl.lottery.request.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "打卡记录连续表")
|
||||||
|
public class ClockContinue {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "id",required = true)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openid",required = true)
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡片类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "卡片类型",required = true)
|
||||||
|
private String record_time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "图片",required = true)
|
||||||
|
private int num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpenid() {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenid(String openid) {
|
||||||
|
this.openid = openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecord_time() {
|
||||||
|
return record_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecord_time(String record_time) {
|
||||||
|
this.record_time = record_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNum() {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNum(int num) {
|
||||||
|
this.num = num;
|
||||||
|
}
|
||||||
|
}
|
||||||
141
src/main/java/com/xgl/lottery/request/vo/ClockRecord.java
Normal file
141
src/main/java/com/xgl/lottery/request/vo/ClockRecord.java
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
package com.xgl.lottery.request.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "打卡记录")
|
||||||
|
public class ClockRecord {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "id",required = true)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openid",required = true)
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡片类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "卡片类型",required = true)
|
||||||
|
private String cardType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "图片",required = true)
|
||||||
|
private String photo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "开始时间",required = true)
|
||||||
|
private Date beginTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "结束时间",required = true)
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打卡时长
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "打卡时长",required = true)
|
||||||
|
private long duration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打卡日期
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "打卡日期",required = true)
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpenid() {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenid(String openid) {
|
||||||
|
this.openid = openid == null ? null : openid.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardType() {
|
||||||
|
return cardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardType(String cardType) {
|
||||||
|
this.cardType = cardType == null ? null : cardType.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhoto() {
|
||||||
|
return photo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoto(String photo) {
|
||||||
|
this.photo = photo == null ? null : photo.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getBeginTime() {
|
||||||
|
return beginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBeginTime(Date beginTime) {
|
||||||
|
this.beginTime = beginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(Date endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDuration() {
|
||||||
|
return duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDuration(long duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Date date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
package com.xgl.lottery.request.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "打卡记录")
|
||||||
|
public class ClockRecordSort {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "sortId",required = true)
|
||||||
|
private Integer sortId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "昵称",required = true)
|
||||||
|
private String nick;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打卡时长
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "打卡时长",required = true)
|
||||||
|
private String duration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户图像
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "用户图像",required = true)
|
||||||
|
private String headUrl;
|
||||||
|
|
||||||
|
public String getHeadUrl() {
|
||||||
|
return headUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeadUrl(String headUrl) {
|
||||||
|
this.headUrl = headUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSortId() {
|
||||||
|
return sortId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSortId(Integer sortId) {
|
||||||
|
this.sortId = sortId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNick() {
|
||||||
|
return nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNick(String nick) {
|
||||||
|
this.nick = nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getDuration() {
|
||||||
|
return duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDuration(String duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
}
|
||||||
86
src/main/java/com/xgl/lottery/request/vo/DrawNum.java
Normal file
86
src/main/java/com/xgl/lottery/request/vo/DrawNum.java
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
package com.xgl.lottery.request.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "抽奖机会信息")
|
||||||
|
public class DrawNum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "id",required = true)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openid",required = true)
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "分享id",required = true)
|
||||||
|
private String shareId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 次数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "次数",required = true)
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpenid() {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenid(String openid) {
|
||||||
|
this.openid = openid == null ? null : openid.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShareId() {
|
||||||
|
return shareId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShareId(String shareId) {
|
||||||
|
this.shareId = shareId == null ? null : shareId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNum() {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNum(Integer num) {
|
||||||
|
this.num = num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
44
src/main/java/com/xgl/lottery/request/vo/HelpRecord.java
Normal file
44
src/main/java/com/xgl/lottery/request/vo/HelpRecord.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package com.xgl.lottery.request.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "打卡记录")
|
||||||
|
@Data
|
||||||
|
public class HelpRecord {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "id",required = true)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openid",required = true)
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡片类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "卡片类型",required = true)
|
||||||
|
private String helpid;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
76
src/main/java/com/xgl/lottery/request/vo/LotteryRecord.java
Normal file
76
src/main/java/com/xgl/lottery/request/vo/LotteryRecord.java
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
package com.xgl.lottery.request.vo;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
public class LotteryRecord {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String accountIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer itemId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String prizeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccountIp() {
|
||||||
|
return accountIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountIp(String accountIp) {
|
||||||
|
this.accountIp = accountIp == null ? null : accountIp.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getItemId() {
|
||||||
|
return itemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItemId(Integer itemId) {
|
||||||
|
this.itemId = itemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrizeName() {
|
||||||
|
return prizeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrizeName(String prizeName) {
|
||||||
|
this.prizeName = prizeName == null ? null : prizeName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
107
src/main/java/com/xgl/lottery/request/vo/ReceivingAddress.java
Normal file
107
src/main/java/com/xgl/lottery/request/vo/ReceivingAddress.java
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
package com.xgl.lottery.request.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "收货地址信息")
|
||||||
|
public class ReceivingAddress {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "id",required = true)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openId",required = true)
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "联系人",required = true)
|
||||||
|
private String linkName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "联系电话",required = true)
|
||||||
|
private String linkPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地区
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "地区",required = true)
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地区详址
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "地区详址",required = true)
|
||||||
|
private String addressDetail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getOpenid() {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenid(String openid) {
|
||||||
|
this.openid = openid == null ? null : openid.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLinkName() {
|
||||||
|
return linkName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinkName(String linkName) {
|
||||||
|
this.linkName = linkName == null ? null : linkName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLinkPhone() {
|
||||||
|
return linkPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinkPhone(String linkPhone) {
|
||||||
|
this.linkPhone = linkPhone == null ? null : linkPhone.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address == null ? null : address.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddressDetail() {
|
||||||
|
return addressDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddressDetail(String addressDetail) {
|
||||||
|
this.addressDetail = addressDetail == null ? null : addressDetail.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
71
src/main/java/com/xgl/lottery/request/vo/SportCard.java
Normal file
71
src/main/java/com/xgl/lottery/request/vo/SportCard.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package com.xgl.lottery.request.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "运动卡片信息")
|
||||||
|
public class SportCard {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "id",required = true)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "内容",required = true)
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡片类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "卡片类型",required = true)
|
||||||
|
private String cardType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content == null ? null : content.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardType() {
|
||||||
|
return cardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardType(String cardType) {
|
||||||
|
this.cardType = cardType == null ? null : cardType.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
162
src/main/java/com/xgl/lottery/request/vo/UserInfo.java
Normal file
162
src/main/java/com/xgl/lottery/request/vo/UserInfo.java
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
package com.xgl.lottery.request.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户信息表
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "用户信息")
|
||||||
|
public class UserInfo {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "id",required = true)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openid",required = true)
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* um
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "um",required = true)
|
||||||
|
private String um;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "联系电话",required = true)
|
||||||
|
private String linkPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "分享id",required = true)
|
||||||
|
private String shareId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "昵称",required = true)
|
||||||
|
private String nick;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户图像
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "用户图像",required = true)
|
||||||
|
private String headUrl;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer count;
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
private String cardType;
|
||||||
|
|
||||||
|
private String clockUrl;
|
||||||
|
|
||||||
|
|
||||||
|
public String getNick() {
|
||||||
|
return nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNick(String nick) {
|
||||||
|
this.nick = nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpenid() {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenid(String openid) {
|
||||||
|
this.openid = openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUm() {
|
||||||
|
return um;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUm(String um) {
|
||||||
|
this.um = um;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLinkPhone() {
|
||||||
|
return linkPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinkPhone(String linkPhone) {
|
||||||
|
this.linkPhone = linkPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShareId() {
|
||||||
|
return shareId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShareId(String shareId) {
|
||||||
|
this.shareId = shareId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeadUrl() {
|
||||||
|
return headUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeadUrl(String headUrl) {
|
||||||
|
this.headUrl = headUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCount() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCount(Integer count) {
|
||||||
|
this.count = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardType() {
|
||||||
|
return cardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardType(String cardType) {
|
||||||
|
this.cardType = cardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClockUrl() {
|
||||||
|
return clockUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClockUrl(String clockUrl) {
|
||||||
|
this.clockUrl = clockUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
77
src/main/java/com/xgl/lottery/request/vo/UserSportCard.java
Normal file
77
src/main/java/com/xgl/lottery/request/vo/UserSportCard.java
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
package com.xgl.lottery.request.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Kevin
|
||||||
|
* @date 2022/04/09
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "用户抽取卡片信息")
|
||||||
|
public class UserSportCard {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "id",required = true)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "openid",required = true)
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡片类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "卡片类型",required = true)
|
||||||
|
private String cardType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抽卡日期
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "抽卡日期",required = true)
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间",required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public String getOpenid() {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenid(String openid) {
|
||||||
|
this.openid = openid == null ? null : openid.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardType() {
|
||||||
|
return cardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardType(String cardType) {
|
||||||
|
this.cardType = cardType == null ? null : cardType.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Date date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
890
src/main/java/com/xgl/lottery/service/BusinessService.java
Normal file
890
src/main/java/com/xgl/lottery/service/BusinessService.java
Normal file
@ -0,0 +1,890 @@
|
|||||||
|
package com.xgl.lottery.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.xgl.lottery.RedisKeyManager;
|
||||||
|
import com.xgl.lottery.ReturnCodeEnum;
|
||||||
|
import com.xgl.lottery.dal.mapper.LotteryRecordMapper;
|
||||||
|
|
||||||
|
import com.xgl.lottery.mapper.*;
|
||||||
|
import com.xgl.lottery.request.dto.ClockRecordDTO;
|
||||||
|
import com.xgl.lottery.request.dto.ReceivingAddressDTO;
|
||||||
|
import com.xgl.lottery.request.dto.UserInfoDTO;
|
||||||
|
import com.xgl.lottery.request.vo.*;
|
||||||
|
import com.xgl.lottery.service.dto.ResultResp;
|
||||||
|
import com.xgl.lottery.utils.DateConvertUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import java.io.*;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.xgl.lottery.utils.SnowflakeIdUtil.getSnowflakeId;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class BusinessService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ClockRecordMapper clockRecordMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DrawNumMapper drawNumMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LotteryUserRecordMapper lotteryRecordMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReceivingAddressMapper receivingAddressMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SportCardMapper sportCardMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserInfoMapper userInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserSportCardMapper userSportCardMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
LotteryRecordMapper lotteryRecordMapper2;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
RedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
private static final String time = "2022-05-13 22:00:00";
|
||||||
|
String url ="https://orange.crossmatters7.com/api/Token/getToken";
|
||||||
|
String appid="6115253652";
|
||||||
|
String secret="9e6e91af8cb7e36ae3c288d2ff742752";
|
||||||
|
public ResultResp<String> getToken() throws IOException {
|
||||||
|
try {
|
||||||
|
log.info("--------------------redis获取token------------------");
|
||||||
|
String token1 = redisTemplate.opsForValue().get("token").toString();
|
||||||
|
if (StringUtils.isNotBlank(token1)) {
|
||||||
|
log.info("--------------------redis获取token成功------------------");
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), token1);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
log.info("--------------------是正常获取token------------------");
|
||||||
|
String s = url + "?appid=" + appid + "&secret=" + secret;
|
||||||
|
JSONObject json = httpRequest(s, "GET", null);
|
||||||
|
|
||||||
|
if(json!=null || json.getIntValue("code") == 0 ){ // invalid code 重新发起授权\
|
||||||
|
log.info("请求token成功, successful ......");
|
||||||
|
JSONObject data = (JSONObject) json.get("data");
|
||||||
|
if (data!=null){
|
||||||
|
String token = data.get("token").toString();
|
||||||
|
int expire_in = data.getIntValue("expire_in");
|
||||||
|
redisTemplate.opsForValue().set("token",token,expire_in, TimeUnit.SECONDS);
|
||||||
|
log.info("--------------------是正常获取token成功------------------");
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), token1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("--------------------获取token异常------------------");
|
||||||
|
Integer count=0;
|
||||||
|
if (count<3) {
|
||||||
|
String s = url + "?appid=" + appid + "&secret=" + secret;
|
||||||
|
JSONObject json = httpRequest(s, "GET", null);
|
||||||
|
count++;
|
||||||
|
if (json != null || json.getIntValue("code") == 0) {
|
||||||
|
log.info("请求token成功, successful ......");
|
||||||
|
JSONObject data = (JSONObject) json.get("data");
|
||||||
|
if (data != null) {
|
||||||
|
String token = data.get("token").toString();
|
||||||
|
int expire_in = data.getIntValue("expire_in");
|
||||||
|
redisTemplate.opsForValue().set("token", token, expire_in, TimeUnit.SECONDS);
|
||||||
|
log.info("--------------------异常-获取token成功------------------");
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), token);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JSONObject httpRequest(String requestUrl, String requestMethod, String postData) throws IOException {
|
||||||
|
JSONObject jsonObject = null;
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
// log.info("httpRequestUrl: "+requestUrl+", postData: "+postData);
|
||||||
|
URL url = new URL(requestUrl);
|
||||||
|
HttpURLConnection httpUrlConn = (HttpURLConnection) url.openConnection();
|
||||||
|
httpUrlConn.setConnectTimeout(10000);
|
||||||
|
httpUrlConn.setDoOutput(true);
|
||||||
|
httpUrlConn.setDoInput(true);
|
||||||
|
httpUrlConn.setUseCaches(false);
|
||||||
|
//设置请求方式(GET/POST)
|
||||||
|
httpUrlConn.setRequestMethod(requestMethod);
|
||||||
|
if ("GET".equalsIgnoreCase(requestMethod)){
|
||||||
|
httpUrlConn.connect();
|
||||||
|
}
|
||||||
|
//当有数据需要提交时
|
||||||
|
if (postData != null){
|
||||||
|
OutputStream outputStream = httpUrlConn.getOutputStream();
|
||||||
|
outputStream.write(postData.getBytes("UTF-8"));
|
||||||
|
outputStream.close();
|
||||||
|
outputStream=null;
|
||||||
|
}
|
||||||
|
//将返回的输入流转换成字符串
|
||||||
|
InputStream inputStream = httpUrlConn.getInputStream();
|
||||||
|
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
|
||||||
|
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
|
||||||
|
for (String str = null; (str = bufferedReader.readLine()) != null;)
|
||||||
|
buffer.append(str);
|
||||||
|
|
||||||
|
bufferedReader.close();
|
||||||
|
inputStreamReader.close();
|
||||||
|
inputStream.close();
|
||||||
|
inputStream = null;
|
||||||
|
httpUrlConn.disconnect();
|
||||||
|
jsonObject = JSONObject.parseObject(buffer.toString());
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ResultResp<HashMap<String, String>> userInfo(UserInfoDTO userInfoDTO) throws ParseException {
|
||||||
|
|
||||||
|
UserInfo userInfo = new UserInfo();
|
||||||
|
// BeanUtils.copyProperties(userInfoDTO, userInfo);
|
||||||
|
String shareid="";
|
||||||
|
if(StringUtils.isNotBlank(userInfoDTO.getShareId())){
|
||||||
|
shareid = String.valueOf(getSnowflakeId());
|
||||||
|
log.info("新的的shareid:"+shareid);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(userInfoDTO.getShareId())) {
|
||||||
|
|
||||||
|
long snowflakeId = getSnowflakeId();
|
||||||
|
userInfo.setShareId(String.valueOf(snowflakeId));
|
||||||
|
} else {
|
||||||
|
UserInfo userInfo2 = userInfoMapper.selectByshareId(userInfoDTO.getShareId());
|
||||||
|
if (null!=userInfo2) {
|
||||||
|
List<ClockRecord> clockRecords = clockRecordMapper.selectAllByOpenid(userInfo2.getOpenid());
|
||||||
|
if (CollectionUtil.isNotEmpty(clockRecords)&&clockRecords.size()>=1){
|
||||||
|
Date time = clockRecords.get(0).getEndTime();
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||||
|
String format = dateFormat.format(time);
|
||||||
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime localTime = LocalDateTime.parse(format, dtf);
|
||||||
|
LocalDateTime startTime = LocalDate.now().atTime(0, 0, 0);
|
||||||
|
LocalDateTime endTime = LocalDate.now().atTime(23, 59, 59);
|
||||||
|
if((localTime.isAfter(startTime) && localTime.isBefore(endTime))){
|
||||||
|
Date date = new Date();
|
||||||
|
SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String format2 = dateFormat2.format(date);
|
||||||
|
HelpRecord helpRecord= clockRecordMapper.selectHelp(userInfo2.getOpenid(),userInfoDTO.getOpenid(),format2);
|
||||||
|
if (!(userInfo2.getOpenid().equals(userInfoDTO.getOpenid()))&&null==helpRecord) {
|
||||||
|
drawNumMapper.updateByShareId(userInfoDTO.getShareId());
|
||||||
|
Date date3 = new Date();
|
||||||
|
SimpleDateFormat dateFormat3 = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String format3 = dateFormat3.format(date3);
|
||||||
|
clockRecordMapper.insertHelp(userInfo2.getOpenid(),userInfoDTO.getOpenid(),format3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UserInfo userInfo1 = userInfoMapper.selectByUm(userInfoDTO.getUm());
|
||||||
|
if (null == userInfo1) {
|
||||||
|
if (StringUtils.isBlank(userInfo.getShareId())){
|
||||||
|
userInfo.setShareId(shareid);
|
||||||
|
}
|
||||||
|
userInfo.setOpenid(userInfoDTO.getOpenid());
|
||||||
|
userInfo.setUm(userInfoDTO.getUm());
|
||||||
|
userInfo.setLinkPhone(userInfoDTO.getLinkPhone());
|
||||||
|
userInfo.setNick(userInfoDTO.getNick());
|
||||||
|
userInfo.setHeadUrl(userInfoDTO.getHeadUrl());
|
||||||
|
userInfo.setCreateTime(new Date());
|
||||||
|
log.info("新增加的用户为:"+JSONObject.toJSONString(userInfo));
|
||||||
|
userInfoMapper.insert(userInfo);
|
||||||
|
}
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
map.put("shareId", userInfo.getShareId());
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public ResultResp<UserInfo>getUser(String openid) {
|
||||||
|
|
||||||
|
UserInfo userInfo = userInfoMapper.selectByOpenid(openid);
|
||||||
|
if (null == userInfo) {
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawNum drawNum = drawNumMapper.selectByOpenid(openid);
|
||||||
|
List<UserSportCard> userSportCards = userSportCardMapper.selectByOpenid(openid);
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(userSportCards)) {
|
||||||
|
|
||||||
|
Date date = userSportCards.get(0).getDate();
|
||||||
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime startTime = LocalDate.now().atTime(0, 0, 0);
|
||||||
|
LocalDateTime endTime = LocalDate.now().atTime(23, 59, 59);
|
||||||
|
|
||||||
|
LocalDateTime parse = LocalDateTime.parse(dateFormat.format(date), dtf);
|
||||||
|
if ((parse.isAfter(startTime) && parse.isBefore(endTime))) {
|
||||||
|
List<ClockRecord> clockRecords = clockRecordMapper.selectAllByOpenid(openid);
|
||||||
|
if (CollectionUtil.isNotEmpty(clockRecords)) {
|
||||||
|
Date endTime1 = clockRecords.get(0).getEndTime();
|
||||||
|
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime startTime2 = LocalDate.now().atTime(0, 0, 0);
|
||||||
|
LocalDateTime endTime2 = LocalDate.now().atTime(23, 59, 59);
|
||||||
|
|
||||||
|
LocalDateTime parse2 = LocalDateTime.parse(dateFormat2.format(endTime1), dtf2);
|
||||||
|
if (!(parse2.isAfter(startTime2) && parse2.isBefore(endTime2))) {
|
||||||
|
SportCard sportCard = sportCardMapper.selectByCardType(userSportCards.get(0).getCardType());
|
||||||
|
if (null != sportCard) {
|
||||||
|
userInfo.setUrl(sportCard.getContent());
|
||||||
|
userInfo.setCardType(sportCard.getCardType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((parse2.isAfter(startTime2) && parse2.isBefore(endTime2))) {
|
||||||
|
ClockRecord clockRecord = clockRecords.get(0);
|
||||||
|
if (null != clockRecord) {
|
||||||
|
userInfo.setClockUrl(clockRecord.getPhoto());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
SportCard sportCard = sportCardMapper.selectByCardType(userSportCards.get(0).getCardType());
|
||||||
|
if (null != sportCard) {
|
||||||
|
userInfo.setUrl(sportCard.getContent());
|
||||||
|
userInfo.setCardType(sportCard.getCardType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (null != drawNum) {
|
||||||
|
userInfo.setCount(drawNum.getNum());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), userInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void userAddress(ReceivingAddressDTO receivingAddressDTO) {
|
||||||
|
ReceivingAddress receivingAddress = new ReceivingAddress();
|
||||||
|
BeanUtils.copyProperties(receivingAddressDTO, receivingAddress);
|
||||||
|
receivingAddress.setCreateTime(new Date());
|
||||||
|
receivingAddressMapper.insert(receivingAddress);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReceivingAddress userAddressInfo(String openid) {
|
||||||
|
|
||||||
|
return receivingAddressMapper.selectByPrimaryKey(openid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LotteryRecord> userPrize(String openid) {
|
||||||
|
return lotteryRecordMapper.selectByPrimaryKey(openid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LotteryRecord> userPrizeByLottery(String openid) {
|
||||||
|
return lotteryRecordMapper.selectByLettery(openid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ResultResp<List<String>> clockComplete(String openid) {
|
||||||
|
List<String> strings = clockRecordMapper.clockComplete(openid);
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), strings);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultResp<ArrayList<ClockRecordSort>> sportRanking() {
|
||||||
|
|
||||||
|
String date = getDateTime();
|
||||||
|
|
||||||
|
// String date="2022-05-14 01:00:00";
|
||||||
|
if (date.compareTo(time) >= 0){
|
||||||
|
|
||||||
|
List<ClockRecord> clockRecords = clockRecordMapper.selectByOpenidAll();
|
||||||
|
ArrayList<ClockRecordSort> arrayList = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(clockRecords)) {
|
||||||
|
clockRecords.forEach(item -> {
|
||||||
|
UserInfo userInfo = userInfoMapper.selectByOpenid(item.getOpenid());
|
||||||
|
ClockRecordSort clockRecordSort = new ClockRecordSort();
|
||||||
|
String s = DateConvertUtil.longSumSecondToTime(item.getDuration());
|
||||||
|
clockRecordSort.setDuration(s);
|
||||||
|
clockRecordSort.setNick(userInfo.getNick());
|
||||||
|
clockRecordSort.setHeadUrl(userInfo.getHeadUrl());
|
||||||
|
arrayList.add(clockRecordSort);
|
||||||
|
|
||||||
|
com.xgl.lottery.dal.model.LotteryRecord record = new com.xgl.lottery.dal.model.LotteryRecord();
|
||||||
|
record.setAccountIp(item.getOpenid());
|
||||||
|
record.setItemId(9);
|
||||||
|
record.setPrizeName("Keep解压腕力球");
|
||||||
|
record.setCreateTime(LocalDateTime.now());
|
||||||
|
record.setLotteryType(2);
|
||||||
|
lotteryRecordMapper2.insert(record);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), arrayList);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ClockRecord> clockRecords = clockRecordMapper.selectByOpenid();
|
||||||
|
ArrayList<ClockRecordSort> arrayList = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(clockRecords)) {
|
||||||
|
clockRecords.forEach(item -> {
|
||||||
|
UserInfo userInfo = userInfoMapper.selectByOpenid(item.getOpenid());
|
||||||
|
ClockRecordSort clockRecordSort = new ClockRecordSort();
|
||||||
|
String s = DateConvertUtil.longSumSecondToTime(item.getDuration());
|
||||||
|
clockRecordSort.setDuration(s);
|
||||||
|
clockRecordSort.setNick(userInfo.getNick());
|
||||||
|
clockRecordSort.setHeadUrl(userInfo.getHeadUrl());
|
||||||
|
arrayList.add(clockRecordSort);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), arrayList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ResultResp<SportCard> drawCard(String openid) {
|
||||||
|
|
||||||
|
String now = getDateTime();
|
||||||
|
// String date="2022-04-30 01:00:00";
|
||||||
|
if (now.compareTo(time) >= 0){
|
||||||
|
return ResultResp.fail(ReturnCodeEnum.LOTTER_COME_OVER.getCode(),ReturnCodeEnum.LOTTER_COME_OVER.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<SportCard> sportCards = sportCardMapper.selectAll();
|
||||||
|
if (CollectionUtil.isEmpty(sportCards)) {
|
||||||
|
return ResultResp.fail(ReturnCodeEnum.DRAW_CARD_NOT.getCode(), ReturnCodeEnum.DRAW_CARD_NOT.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<UserSportCard> userSportCards = userSportCardMapper.selectByOpenid(openid);
|
||||||
|
if (CollectionUtil.isNotEmpty(userSportCards)) {
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String format = dateFormat.format(new Date());
|
||||||
|
Date date = userSportCards.get(0).getDate();
|
||||||
|
log.info("最新抽取到卡:"+JSONObject.toJSONString(userSportCards.get(0)));
|
||||||
|
if (format.equals(dateFormat.format(date))) {
|
||||||
|
return ResultResp.fail(ReturnCodeEnum.DRAW_VALID.getCode(), ReturnCodeEnum.DRAW_VALID.getMsg());
|
||||||
|
} else {
|
||||||
|
ArrayList<String> objects = new ArrayList<>();
|
||||||
|
for (SportCard sportCard : sportCards) {
|
||||||
|
for (UserSportCard userSportCard : userSportCards) {
|
||||||
|
if (sportCard.getCardType().equals(userSportCard.getCardType())) {
|
||||||
|
objects.add(sportCard.getCardType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<SportCard> sport=new ArrayList<>();
|
||||||
|
sportCards.forEach(item->{
|
||||||
|
if(!objects.contains(item.getCardType())){
|
||||||
|
sport.add(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (sport.size()==0){
|
||||||
|
return ResultResp.fail(ReturnCodeEnum.DRAW_CARD_NOT.getCode(), ReturnCodeEnum.DRAW_CARD_NOT.getMsg());
|
||||||
|
}
|
||||||
|
log.info("最终的所剩余卡片:"+JSONObject.toJSONString(sport));
|
||||||
|
Collections.shuffle(sport);
|
||||||
|
SportCard sportCard = sport.get(0);
|
||||||
|
UserSportCard userSportCard = new UserSportCard();
|
||||||
|
userSportCard.setCardType(sportCard.getCardType());
|
||||||
|
userSportCard.setOpenid(openid);
|
||||||
|
userSportCard.setDate(new Date());
|
||||||
|
userSportCard.setCreateTime(new Date());
|
||||||
|
userSportCardMapper.insert(userSportCard);
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), sportCard);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Collections.shuffle(sportCards);
|
||||||
|
SportCard sportCard = sportCards.get(0);
|
||||||
|
UserSportCard userSportCard = new UserSportCard();
|
||||||
|
userSportCard.setCardType(sportCard.getCardType());
|
||||||
|
userSportCard.setOpenid(openid);
|
||||||
|
userSportCard.setDate(new Date());
|
||||||
|
userSportCard.setCreateTime(new Date());
|
||||||
|
userSportCardMapper.insert(userSportCard);
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), sportCard);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ResultResp<String> hitClock(ClockRecordDTO clockRecordDTO) throws Exception {
|
||||||
|
String timeEnd = clockRecordDTO.getEndTime();
|
||||||
|
Date date = new Date();
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String[] possiblePatterns =
|
||||||
|
{
|
||||||
|
"yyyy-MM-dd",
|
||||||
|
"yyyy-MM-dd HH:mm:ss",
|
||||||
|
"yyyyMMdd",
|
||||||
|
"yyyy/MM/dd",
|
||||||
|
"yyyy年MM月dd日",
|
||||||
|
"yyyy MM dd"
|
||||||
|
};
|
||||||
|
// boolean today = DateUtil.isToday(timeEnd, "yyyy-mm-dd HH:mm:ss");
|
||||||
|
// boolean today1 = DateUtil.isToday(dateFormat.format(date), "yyyy-mm-dd HH:mm:ss");
|
||||||
|
//
|
||||||
|
// String time = "2017-09-27 11:20:45";
|
||||||
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime localTime = LocalDateTime.parse(timeEnd, dtf);
|
||||||
|
LocalDateTime startTime = LocalDate.now().atTime(0, 0, 0);
|
||||||
|
LocalDateTime endTime = LocalDate.now().atTime(23, 59, 59);
|
||||||
|
|
||||||
|
LocalDateTime parse = LocalDateTime.parse(dateFormat.format(date), dtf);
|
||||||
|
if ((localTime.isAfter(startTime) && localTime.isBefore(endTime)) && (parse.isAfter(startTime) && parse.isBefore(endTime))) {
|
||||||
|
System.out.println("时间是今天");
|
||||||
|
String openid = clockRecordDTO.getOpenid();
|
||||||
|
List<ClockRecord> clockRecords = clockRecordMapper.selectAllByOpenid(openid);
|
||||||
|
if (CollectionUtil.isEmpty(clockRecords)) {
|
||||||
|
ClockRecord clockRecord = new ClockRecord();
|
||||||
|
BeanUtils.copyProperties(clockRecordDTO, clockRecord);
|
||||||
|
Date date1 = DateConvertUtil.parseDate(clockRecordDTO.getBeginTime(), possiblePatterns);
|
||||||
|
Date date2 = DateConvertUtil.parseDate(clockRecordDTO.getEndTime(), possiblePatterns);
|
||||||
|
assert date1 != null;
|
||||||
|
long timeStamp = DateConvertUtil.getTimeStamp(date1, 1);
|
||||||
|
assert date2 != null;
|
||||||
|
long timeStamp2 = DateConvertUtil.getTimeStamp(date2, 1);
|
||||||
|
long l = timeStamp2 - timeStamp;
|
||||||
|
clockRecord.setDuration(l);
|
||||||
|
clockRecord.setDate(new Date());
|
||||||
|
clockRecordMapper.insert(clockRecord);
|
||||||
|
UserInfo userInfo = userInfoMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
DrawNum drawNum = new DrawNum();
|
||||||
|
drawNum.setNum(5);
|
||||||
|
drawNum.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
drawNum.setShareId(userInfo.getShareId());
|
||||||
|
DrawNum drawNum1 = drawNumMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
if (null == drawNum1) {
|
||||||
|
drawNumMapper.insert(drawNum);
|
||||||
|
} else {
|
||||||
|
drawNumMapper.updateByOpenid(clockRecordDTO.getOpenid(), 5);
|
||||||
|
}
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), "打卡成功");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
List<ClockRecord> collect = clockRecords.stream().sorted(Comparator.comparing(ClockRecord::getDate).reversed()).collect(Collectors.toList());
|
||||||
|
ClockRecord clockRecord = collect.get(0);
|
||||||
|
log.info("最新的打卡记录:" + JSONObject.toJSONString(clockRecord));
|
||||||
|
Date date3 = clockRecord.getDate();
|
||||||
|
LocalDateTime time = LocalDateTime.parse(dateFormat.format(date3), dtf);
|
||||||
|
if (time.isAfter(startTime) && time.isBefore(endTime)) {
|
||||||
|
return ResultResp.success(ReturnCodeEnum.HIT_CLOCK_TIME_ONCE.getCode(), ReturnCodeEnum.HIT_CLOCK_TIME_ONCE.getMsg(), null);
|
||||||
|
}
|
||||||
|
if (collect.size() == 1) {
|
||||||
|
Date date1 = collect.get(0).getDate();
|
||||||
|
Date date2 = new Date();
|
||||||
|
String format = dateFormat.format(date1);
|
||||||
|
String format1 = dateFormat.format(date2);
|
||||||
|
Integer compare = DateConvertUtil.compare(format, format1);
|
||||||
|
UserInfo userInfo = userInfoMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
if (compare > 1) {
|
||||||
|
ClockRecord clockRecord2 = new ClockRecord();
|
||||||
|
BeanUtils.copyProperties(clockRecordDTO, clockRecord);
|
||||||
|
Date date33 = DateConvertUtil.parseDate(clockRecordDTO.getBeginTime(), possiblePatterns);
|
||||||
|
Date date4 = DateConvertUtil.parseDate(clockRecordDTO.getEndTime(), possiblePatterns);
|
||||||
|
assert date33 != null;
|
||||||
|
long timeStamp = DateConvertUtil.getTimeStamp(date33, 1);
|
||||||
|
assert date4 != null;
|
||||||
|
long timeStamp2 = DateConvertUtil.getTimeStamp(date4, 1);
|
||||||
|
long l = timeStamp2 - timeStamp;
|
||||||
|
clockRecord2.setDuration(l);
|
||||||
|
clockRecord2.setDate(new Date());
|
||||||
|
clockRecordMapper.insert(clockRecord2);
|
||||||
|
DrawNum drawNum = new DrawNum();
|
||||||
|
drawNum.setNum(5);
|
||||||
|
drawNum.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
drawNum.setShareId(userInfo.getShareId());
|
||||||
|
DrawNum drawNum1 = drawNumMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
if (null == drawNum1) {
|
||||||
|
drawNumMapper.insert(drawNum);
|
||||||
|
} else {
|
||||||
|
drawNumMapper.updateByOpenid(clockRecordDTO.getOpenid(), 5);
|
||||||
|
}
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), "打卡成功");
|
||||||
|
}
|
||||||
|
if (compare == 1) {
|
||||||
|
ClockRecord clockRecord2 = new ClockRecord();
|
||||||
|
BeanUtils.copyProperties(clockRecordDTO, clockRecord);
|
||||||
|
Date date33 = DateConvertUtil.parseDate(clockRecordDTO.getBeginTime(), possiblePatterns);
|
||||||
|
Date date4 = DateConvertUtil.parseDate(clockRecordDTO.getEndTime(), possiblePatterns);
|
||||||
|
assert date33 != null;
|
||||||
|
long timeStamp = DateConvertUtil.getTimeStamp(date33, 1);
|
||||||
|
assert date4 != null;
|
||||||
|
long timeStamp2 = DateConvertUtil.getTimeStamp(date4, 1);
|
||||||
|
long l = timeStamp2 - timeStamp;
|
||||||
|
clockRecord2.setDuration(l);
|
||||||
|
clockRecord2.setDate(new Date());
|
||||||
|
clockRecordMapper.insert(clockRecord2);
|
||||||
|
DrawNum drawNum = new DrawNum();
|
||||||
|
drawNum.setNum(5);
|
||||||
|
drawNum.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
drawNum.setShareId(userInfo.getShareId());
|
||||||
|
DrawNum drawNum1 = drawNumMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
if (null == drawNum1) {
|
||||||
|
drawNumMapper.insert(drawNum);
|
||||||
|
} else {
|
||||||
|
drawNumMapper.updateByOpenid(clockRecordDTO.getOpenid(), 10);
|
||||||
|
}
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), "打卡成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (collect.size() >= 2) {
|
||||||
|
int count = 0;
|
||||||
|
UserInfo userInfo = userInfoMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
for (int i = 0; i < collect.size() - 1; i++) {
|
||||||
|
Date date4 = collect.get(i).getDate();
|
||||||
|
Date date5 = new Date();
|
||||||
|
String format2 = dateFormat.format(date4);
|
||||||
|
String format3 = dateFormat.format(date5);
|
||||||
|
Integer compare1 = DateConvertUtil.compare(format2, format3);
|
||||||
|
if (compare1 > 1) {
|
||||||
|
ClockRecord clockRecord2 = new ClockRecord();
|
||||||
|
BeanUtils.copyProperties(clockRecordDTO, clockRecord);
|
||||||
|
Date date55 = DateConvertUtil.parseDate(clockRecordDTO.getBeginTime(), possiblePatterns);
|
||||||
|
Date date44 = DateConvertUtil.parseDate(clockRecordDTO.getEndTime(), possiblePatterns);
|
||||||
|
assert date55 != null;
|
||||||
|
long timeStamp = DateConvertUtil.getTimeStamp(date55, 1);
|
||||||
|
assert date44 != null;
|
||||||
|
long timeStamp2 = DateConvertUtil.getTimeStamp(date44, 1);
|
||||||
|
long l = timeStamp2 - timeStamp;
|
||||||
|
clockRecord2.setDuration(l);
|
||||||
|
clockRecord2.setDate(new Date());
|
||||||
|
clockRecordMapper.insert(clockRecord2);
|
||||||
|
DrawNum drawNum = new DrawNum();
|
||||||
|
drawNum.setNum(5);
|
||||||
|
drawNum.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
drawNum.setShareId(userInfo.getShareId());
|
||||||
|
DrawNum drawNum1 = drawNumMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
if (null == drawNum1) {
|
||||||
|
drawNumMapper.insert(drawNum);
|
||||||
|
} else {
|
||||||
|
drawNumMapper.updateByOpenid(clockRecordDTO.getOpenid(), 5);
|
||||||
|
}
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), "打卡成功");
|
||||||
|
}
|
||||||
|
count = 1;
|
||||||
|
Date date1 = collect.get(i).getDate();
|
||||||
|
Date date2 = collect.get(i + 1).getDate();
|
||||||
|
String format = dateFormat.format(date1);
|
||||||
|
String format1 = dateFormat.format(date2);
|
||||||
|
Integer compare = DateConvertUtil.compare(format, format1);
|
||||||
|
if (compare > 1) {
|
||||||
|
ClockRecord clockRecord2 = new ClockRecord();
|
||||||
|
BeanUtils.copyProperties(clockRecordDTO, clockRecord);
|
||||||
|
Date date333 = DateConvertUtil.parseDate(clockRecordDTO.getBeginTime(), possiblePatterns);
|
||||||
|
Date date444 = DateConvertUtil.parseDate(clockRecordDTO.getEndTime(), possiblePatterns);
|
||||||
|
assert date333 != null;
|
||||||
|
long timeStamp = DateConvertUtil.getTimeStamp(date333, 1);
|
||||||
|
assert date444 != null;
|
||||||
|
long timeStamp2 = DateConvertUtil.getTimeStamp(date444, 1);
|
||||||
|
long l = timeStamp2 - timeStamp;
|
||||||
|
clockRecord2.setDuration(l);
|
||||||
|
clockRecord2.setDate(new Date());
|
||||||
|
clockRecordMapper.insert(clockRecord2);
|
||||||
|
DrawNum drawNum = new DrawNum();
|
||||||
|
drawNum.setNum(5);
|
||||||
|
drawNum.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
drawNum.setShareId(userInfo.getShareId());
|
||||||
|
DrawNum drawNum1 = drawNumMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
if (null == drawNum1) {
|
||||||
|
drawNumMapper.insert(drawNum);
|
||||||
|
} else {
|
||||||
|
drawNumMapper.updateByOpenid(clockRecordDTO.getOpenid(), 10);
|
||||||
|
}
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), "打卡成功");
|
||||||
|
}
|
||||||
|
if (compare == 1) {
|
||||||
|
count = count + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int num = 0;
|
||||||
|
if (count == 1) {
|
||||||
|
num = 10;
|
||||||
|
}
|
||||||
|
if (count == 2) {
|
||||||
|
num = 20;
|
||||||
|
}
|
||||||
|
if (count == 3) {
|
||||||
|
num = 40;
|
||||||
|
}
|
||||||
|
if (count == 4) {
|
||||||
|
num = 60;
|
||||||
|
}
|
||||||
|
ClockRecord clockRecord2 = new ClockRecord();
|
||||||
|
BeanUtils.copyProperties(clockRecordDTO, clockRecord);
|
||||||
|
Date date333 = DateConvertUtil.parseDate(clockRecordDTO.getBeginTime(), possiblePatterns);
|
||||||
|
Date date444 = DateConvertUtil.parseDate(clockRecordDTO.getEndTime(), possiblePatterns);
|
||||||
|
assert date333 != null;
|
||||||
|
long timeStamp = DateConvertUtil.getTimeStamp(date333, 1);
|
||||||
|
assert date444 != null;
|
||||||
|
long timeStamp2 = DateConvertUtil.getTimeStamp(date444, 1);
|
||||||
|
long l = timeStamp2 - timeStamp;
|
||||||
|
clockRecord2.setDuration(l);
|
||||||
|
clockRecord2.setDate(new Date());
|
||||||
|
clockRecordMapper.insert(clockRecord2);
|
||||||
|
DrawNum drawNum = new DrawNum();
|
||||||
|
drawNum.setNum(5);
|
||||||
|
drawNum.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
drawNum.setShareId(userInfo.getShareId());
|
||||||
|
DrawNum drawNum1 = drawNumMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
if (null == drawNum1) {
|
||||||
|
drawNumMapper.insert(drawNum);
|
||||||
|
} else {
|
||||||
|
drawNumMapper.updateByOpenid(clockRecordDTO.getOpenid(), num);
|
||||||
|
}
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), "打卡成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return ResultResp.success(ReturnCodeEnum.HIT_CLOCK_TIME_VALID.getCode(), ReturnCodeEnum.HIT_CLOCK_TIME_VALID.getMsg(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = RuntimeException.class)
|
||||||
|
public ResultResp<String> hitClock2(ClockRecordDTO clockRecordDTO) throws Exception {
|
||||||
|
String timeEnd = clockRecordDTO.getEndTime();
|
||||||
|
Date date = new Date();
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
// String[] possiblePatterns =
|
||||||
|
// {
|
||||||
|
// "yyyy-MM-dd",
|
||||||
|
// "yyyy-MM-dd HH:mm:ss",
|
||||||
|
// "yyyyMMdd",
|
||||||
|
// "yyyy/MM/dd",
|
||||||
|
// "yyyy年MM月dd日",
|
||||||
|
// "yyyy MM dd"
|
||||||
|
// };
|
||||||
|
String[] possiblePatterns =
|
||||||
|
{
|
||||||
|
"yyyy-MM-dd HH:mm:ss"
|
||||||
|
};
|
||||||
|
// boolean today = DateUtil.isToday(timeEnd, "yyyy-mm-dd HH:mm:ss");
|
||||||
|
// boolean today1 = DateUtil.isToday(dateFormat.format(date), "yyyy-mm-dd HH:mm:ss");
|
||||||
|
//
|
||||||
|
// String time = "2017-09-27 11:20:45";
|
||||||
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime localTime = LocalDateTime.parse(timeEnd, dtf);
|
||||||
|
LocalDateTime startTime = LocalDate.now().atTime(0, 0, 0);
|
||||||
|
LocalDateTime endTime = LocalDate.now().atTime(23, 59, 59);
|
||||||
|
|
||||||
|
LocalDateTime parse = LocalDateTime.parse(dateFormat.format(date), dtf);
|
||||||
|
if ((localTime.isAfter(startTime) && localTime.isBefore(endTime)) && (parse.isAfter(startTime) && parse.isBefore(endTime))) {
|
||||||
|
System.out.println("时间是今天");
|
||||||
|
String openid = clockRecordDTO.getOpenid();
|
||||||
|
List<ClockRecord> clockRecords = clockRecordMapper.selectAllByOpenid(openid);
|
||||||
|
if (CollectionUtil.isEmpty(clockRecords)) {
|
||||||
|
ClockRecord clockRecord = new ClockRecord();
|
||||||
|
clockRecord.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
clockRecord.setBeginTime(dateFormat.parse(clockRecordDTO.getBeginTime()));
|
||||||
|
clockRecord.setEndTime(dateFormat.parse(clockRecordDTO.getEndTime()));
|
||||||
|
clockRecord.setPhoto(clockRecordDTO.getPhoto());
|
||||||
|
clockRecord.setCardType(clockRecordDTO.getCardType());
|
||||||
|
clockRecord.setCreateTime(new Date());
|
||||||
|
Date date1 = DateConvertUtil.parseDate(clockRecordDTO.getBeginTime(), possiblePatterns);
|
||||||
|
Date date2 = DateConvertUtil.parseDate(clockRecordDTO.getEndTime(), possiblePatterns);
|
||||||
|
assert date1 != null;
|
||||||
|
long timeStamp = DateConvertUtil.dateToStamp(clockRecordDTO.getBeginTime());
|
||||||
|
assert date2 != null;
|
||||||
|
long timeStamp2 = DateConvertUtil.dateToStamp(clockRecordDTO.getEndTime());
|
||||||
|
long l = timeStamp2 - timeStamp;
|
||||||
|
log.info("间隔时间是:"+l);
|
||||||
|
clockRecord.setDuration(l);
|
||||||
|
clockRecord.setDate(new Date());
|
||||||
|
clockRecordMapper.insert(clockRecord);
|
||||||
|
UserInfo userInfo = userInfoMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
DrawNum drawNum = new DrawNum();
|
||||||
|
drawNum.setNum(5);
|
||||||
|
drawNum.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
drawNum.setShareId(userInfo.getShareId());
|
||||||
|
drawNum.setCreateTime(new Date());
|
||||||
|
DrawNum drawNum1 = drawNumMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
if (null == drawNum1) {
|
||||||
|
drawNumMapper.insert(drawNum);
|
||||||
|
} else {
|
||||||
|
drawNumMapper.updateByOpenid(clockRecordDTO.getOpenid(), 5);
|
||||||
|
}
|
||||||
|
ClockContinue clockContinue = new ClockContinue();
|
||||||
|
clockContinue.setNum(1);
|
||||||
|
clockContinue.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
clockContinue.setRecord_time(dateFormat2.format(new Date()));
|
||||||
|
clockContinue.setCreateTime(new Date());
|
||||||
|
drawNumMapper.insertClockContinue(clockContinue);
|
||||||
|
DrawNum drawNum2 = drawNumMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
int num=0;
|
||||||
|
if (null!=drawNum2){
|
||||||
|
num=drawNum2.getNum();
|
||||||
|
}
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), String.valueOf(num));
|
||||||
|
}else {
|
||||||
|
List<ClockRecord> collect = clockRecords.stream().sorted(Comparator.comparing(ClockRecord::getDate).reversed()).collect(Collectors.toList());
|
||||||
|
ClockRecord clockRecord = collect.get(0);
|
||||||
|
log.info("最新的打卡记录:" + JSONObject.toJSONString(clockRecord));
|
||||||
|
Date date3 = clockRecord.getDate();
|
||||||
|
LocalDateTime time = LocalDateTime.parse(dateFormat.format(date3), dtf);
|
||||||
|
if (time.isAfter(startTime) && time.isBefore(endTime)) {
|
||||||
|
return ResultResp.success(ReturnCodeEnum.HIT_CLOCK_TIME_ONCE.getCode(), ReturnCodeEnum.HIT_CLOCK_TIME_ONCE.getMsg(), null);
|
||||||
|
}
|
||||||
|
Date today = new Date();
|
||||||
|
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
|
||||||
|
c.setTime(today);
|
||||||
|
|
||||||
|
c.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
|
|
||||||
|
Date yesterday = c.getTime();
|
||||||
|
SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
String format = dateFormat2.format(yesterday);
|
||||||
|
|
||||||
|
ClockContinue clockContinue = drawNumMapper.selectByOpenidAndTime(clockRecordDTO.getOpenid(), format);
|
||||||
|
if (null==clockContinue){
|
||||||
|
ClockRecord clockRecord2 = new ClockRecord();
|
||||||
|
clockRecord2.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
clockRecord2.setBeginTime(dateFormat.parse(clockRecordDTO.getBeginTime()));
|
||||||
|
clockRecord2.setEndTime(dateFormat.parse(clockRecordDTO.getEndTime()));
|
||||||
|
clockRecord2.setPhoto(clockRecordDTO.getPhoto());
|
||||||
|
clockRecord2.setCardType(clockRecordDTO.getCardType());
|
||||||
|
clockRecord2.setCreateTime(new Date());
|
||||||
|
Date date1 = DateConvertUtil.parseDate(clockRecordDTO.getBeginTime(), possiblePatterns);
|
||||||
|
Date date2 = DateConvertUtil.parseDate(clockRecordDTO.getEndTime(), possiblePatterns);
|
||||||
|
assert date1 != null;
|
||||||
|
long timeStamp = DateConvertUtil.dateToStamp(clockRecordDTO.getBeginTime());
|
||||||
|
assert date2 != null;
|
||||||
|
long timeStamp2 = DateConvertUtil.dateToStamp(clockRecordDTO.getEndTime());
|
||||||
|
long l = timeStamp2 - timeStamp;
|
||||||
|
clockRecord2.setDuration(l);
|
||||||
|
clockRecord2.setDate(new Date());
|
||||||
|
clockRecordMapper.insert(clockRecord2);
|
||||||
|
UserInfo userInfo = userInfoMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
DrawNum drawNum = new DrawNum();
|
||||||
|
drawNum.setNum(5);
|
||||||
|
drawNum.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
drawNum.setShareId(userInfo.getShareId());
|
||||||
|
drawNum.setCreateTime(new Date());
|
||||||
|
DrawNum drawNum1 = drawNumMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
if (null == drawNum1) {
|
||||||
|
drawNumMapper.insert(drawNum);
|
||||||
|
} else {
|
||||||
|
drawNumMapper.updateByOpenid(clockRecordDTO.getOpenid(), 5);
|
||||||
|
}
|
||||||
|
ClockContinue clockContinue2 = new ClockContinue();
|
||||||
|
clockContinue2.setNum(1);
|
||||||
|
clockContinue2.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
SimpleDateFormat dateFormat3 = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
clockContinue2.setRecord_time(dateFormat3.format(new Date()));
|
||||||
|
drawNumMapper.updateClockContinue(1,dateFormat3.format(new Date()),clockRecordDTO.getOpenid());
|
||||||
|
|
||||||
|
DrawNum drawNum2 = drawNumMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
int num=0;
|
||||||
|
if (null!=drawNum2){
|
||||||
|
num=drawNum2.getNum();
|
||||||
|
}
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), String.valueOf(num));
|
||||||
|
}else {
|
||||||
|
|
||||||
|
ClockRecord clockRecord2 = new ClockRecord();
|
||||||
|
clockRecord2.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
clockRecord2.setBeginTime(dateFormat.parse(clockRecordDTO.getBeginTime()));
|
||||||
|
clockRecord2.setEndTime(dateFormat.parse(clockRecordDTO.getEndTime()));
|
||||||
|
clockRecord2.setPhoto(clockRecordDTO.getPhoto());
|
||||||
|
clockRecord2.setCardType(clockRecordDTO.getCardType());
|
||||||
|
clockRecord2.setCreateTime(new Date());
|
||||||
|
Date date1 = DateConvertUtil.parseDate(clockRecordDTO.getBeginTime(), possiblePatterns);
|
||||||
|
Date date2 = DateConvertUtil.parseDate(clockRecordDTO.getEndTime(), possiblePatterns);
|
||||||
|
assert date1 != null;
|
||||||
|
long timeStamp = DateConvertUtil.dateToStamp(clockRecordDTO.getBeginTime());
|
||||||
|
assert date2 != null;
|
||||||
|
long timeStamp2 = DateConvertUtil.dateToStamp(clockRecordDTO.getEndTime());
|
||||||
|
long l = timeStamp2 - timeStamp;
|
||||||
|
clockRecord2.setDuration(l);
|
||||||
|
clockRecord2.setDate(new Date());
|
||||||
|
clockRecordMapper.insert(clockRecord2);
|
||||||
|
UserInfo userInfo = userInfoMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
if (null==userInfo){
|
||||||
|
return ResultResp.success(ReturnCodeEnum.REQUEST_NOT_EXIT.getCode(), ReturnCodeEnum.REQUEST_NOT_EXIT.getMsg(), "用户不存在");
|
||||||
|
}
|
||||||
|
DrawNum drawNum = new DrawNum();
|
||||||
|
drawNum.setNum(5);
|
||||||
|
drawNum.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
drawNum.setShareId(userInfo.getShareId());
|
||||||
|
drawNum.setCreateTime(new Date());
|
||||||
|
DrawNum drawNum1 = drawNumMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
int count = clockContinue.getNum();
|
||||||
|
int num=0;
|
||||||
|
if (count == 1) {
|
||||||
|
num = 10;
|
||||||
|
}
|
||||||
|
if (count == 2) {
|
||||||
|
num = 20;
|
||||||
|
}
|
||||||
|
if (count == 3) {
|
||||||
|
num = 40;
|
||||||
|
}
|
||||||
|
if (count == 4) {
|
||||||
|
num = 60;
|
||||||
|
}
|
||||||
|
if (null == drawNum1) {
|
||||||
|
drawNumMapper.insert(drawNum);
|
||||||
|
} else {
|
||||||
|
drawNumMapper.updateByOpenid(clockRecordDTO.getOpenid(), num);
|
||||||
|
}
|
||||||
|
ClockContinue clockContinue2 = new ClockContinue();
|
||||||
|
clockContinue2.setNum(1);
|
||||||
|
clockContinue2.setOpenid(clockRecordDTO.getOpenid());
|
||||||
|
SimpleDateFormat dateFormat3 = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
clockContinue2.setRecord_time(dateFormat3.format(new Date()));
|
||||||
|
drawNumMapper.updateClockContinueadd(1,dateFormat3.format(new Date()),clockRecordDTO.getOpenid());
|
||||||
|
|
||||||
|
DrawNum drawNum2 = drawNumMapper.selectByOpenid(clockRecordDTO.getOpenid());
|
||||||
|
int num1=0;
|
||||||
|
if (null!=drawNum2){
|
||||||
|
num1=drawNum2.getNum();
|
||||||
|
}
|
||||||
|
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), String.valueOf(num1));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return ResultResp.success(ReturnCodeEnum.HIT_CLOCK_TIME_VALID.getCode(), ReturnCodeEnum.HIT_CLOCK_TIME_VALID.getMsg(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDateTime() {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String dateTime = sdf.format(new Date());
|
||||||
|
|
||||||
|
return dateTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.xgl.lottery.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public interface ILotteryItemService extends IService<LotteryItem> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.xgl.lottery.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryPrize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public interface ILotteryPrizeService extends IService<LotteryPrize> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.xgl.lottery.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public interface ILotteryRecordService extends IService<LotteryRecord> {
|
||||||
|
|
||||||
|
}
|
||||||
15
src/main/java/com/xgl/lottery/service/ILotteryService.java
Normal file
15
src/main/java/com/xgl/lottery/service/ILotteryService.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package com.xgl.lottery.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xgl.lottery.dal.model.Lottery;
|
||||||
|
import com.xgl.lottery.service.dto.DoDrawDto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public interface ILotteryService extends IService<Lottery> {
|
||||||
|
|
||||||
|
void doDraw(DoDrawDto drawDto) throws Exception;
|
||||||
|
}
|
||||||
17
src/main/java/com/xgl/lottery/service/dto/DoDrawDto.java
Normal file
17
src/main/java/com/xgl/lottery/service/dto/DoDrawDto.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package com.xgl.lottery.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DoDrawDto {
|
||||||
|
|
||||||
|
private Integer lotteryId;
|
||||||
|
|
||||||
|
private String accountIp;
|
||||||
|
|
||||||
|
private String prizeName;
|
||||||
|
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
private Integer prizeId;
|
||||||
|
}
|
||||||
43
src/main/java/com/xgl/lottery/service/dto/ResultResp.java
Normal file
43
src/main/java/com/xgl/lottery/service/dto/ResultResp.java
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package com.xgl.lottery.service.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class ResultResp<T> implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 8140875256110329513L;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
private T result;
|
||||||
|
|
||||||
|
public ResultResp(String code, String msg) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ResultResp<T> fail(String code, String message) {
|
||||||
|
ResultResp<T> resultData = new ResultResp<>();
|
||||||
|
resultData.setCode(code);
|
||||||
|
resultData.setMsg(message);
|
||||||
|
return resultData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ResultResp<T> success(String code, String message,T data) {
|
||||||
|
ResultResp<T> resultData = new ResultResp<>();
|
||||||
|
resultData.setCode(code);
|
||||||
|
resultData.setMsg(message);
|
||||||
|
resultData.setResult(data);
|
||||||
|
return resultData;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.xgl.lottery.service.impl;
|
||||||
|
|
||||||
|
import com.xgl.lottery.dal.mapper.LotteryRecordMapper;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryItem;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryRecord;
|
||||||
|
import com.xgl.lottery.mapper.UserInfoMapper;
|
||||||
|
import com.xgl.lottery.request.vo.UserInfo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class AsyncLotteryRecordTask {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
LotteryRecordMapper lotteryRecordMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Async("lotteryServiceExecutor")
|
||||||
|
public void saveLotteryRecord(String accountIp, LotteryItem lotteryItem, String prizeName) {
|
||||||
|
log.info(Thread.currentThread().getName() + "---saveLotteryRecord");
|
||||||
|
if (StringUtils.isNotBlank(accountIp)) {
|
||||||
|
LotteryRecord record = new LotteryRecord();
|
||||||
|
record.setAccountIp(accountIp);
|
||||||
|
record.setItemId(lotteryItem.getId());
|
||||||
|
record.setPrizeName(prizeName);
|
||||||
|
record.setCreateTime(LocalDateTime.now());
|
||||||
|
record.setLotteryType(1);
|
||||||
|
lotteryRecordMapper.insert(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.xgl.lottery.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xgl.lottery.dal.mapper.LotteryItemMapper;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryItem;
|
||||||
|
import com.xgl.lottery.service.ILotteryItemService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LotteryItemServiceImpl extends ServiceImpl<LotteryItemMapper, LotteryItem> implements ILotteryItemService {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.xgl.lottery.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xgl.lottery.dal.mapper.LotteryPrizeMapper;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryPrize;
|
||||||
|
import com.xgl.lottery.service.ILotteryPrizeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LotteryPrizeServiceImpl extends ServiceImpl<LotteryPrizeMapper, LotteryPrize> implements ILotteryPrizeService {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.xgl.lottery.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xgl.lottery.dal.mapper.LotteryRecordMapper;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryRecord;
|
||||||
|
import com.xgl.lottery.service.ILotteryRecordService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LotteryRecordServiceImpl extends ServiceImpl<LotteryRecordMapper, LotteryRecord> implements ILotteryRecordService {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,137 @@
|
|||||||
|
package com.xgl.lottery.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xgl.lottery.LotteryConstants;
|
||||||
|
import com.xgl.lottery.RedisKeyManager;
|
||||||
|
import com.xgl.lottery.ReturnCodeEnum;
|
||||||
|
import com.xgl.lottery.dal.mapper.LotteryItemMapper;
|
||||||
|
import com.xgl.lottery.dal.mapper.LotteryMapper;
|
||||||
|
import com.xgl.lottery.dal.model.Lottery;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryItem;
|
||||||
|
import com.xgl.lottery.exception.BizException;
|
||||||
|
import com.xgl.lottery.exception.UnRewardException;
|
||||||
|
import com.xgl.lottery.service.ILotteryService;
|
||||||
|
import com.xgl.lottery.service.dto.DoDrawDto;
|
||||||
|
import com.xgl.lottery.service.impl.stock.AbstractRewardProcessor;
|
||||||
|
import com.xgl.lottery.service.impl.stock.RewardContext;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class LotteryServiceImpl extends ServiceImpl<LotteryMapper, Lottery> implements ILotteryService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
LotteryMapper lotteryMapper;
|
||||||
|
@Autowired
|
||||||
|
RedisTemplate redisTemplate;
|
||||||
|
@Autowired
|
||||||
|
LotteryItemMapper lotteryItemMapper;
|
||||||
|
@Autowired
|
||||||
|
ApplicationContext applicationContext;
|
||||||
|
@Autowired
|
||||||
|
AsyncLotteryRecordTask asyncLotteryRecordTask;
|
||||||
|
|
||||||
|
private static final int mulriple = 1000000;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doDraw(DoDrawDto drawDto) throws Exception {
|
||||||
|
RewardContext context = new RewardContext();
|
||||||
|
LotteryItem lotteryItem = null;
|
||||||
|
try {
|
||||||
|
|
||||||
|
Lottery lottery = checkLottery(drawDto);
|
||||||
|
lotteryItem = doPlay(lottery);
|
||||||
|
String key = RedisKeyManager.getLotteryPrizeRedisKey(lottery.getId(), lotteryItem.getPrizeId());
|
||||||
|
int prizeType = Integer.parseInt(redisTemplate.opsForHash().get(key, "prizeType").toString());
|
||||||
|
context.setLottery(lottery);
|
||||||
|
context.setLotteryItem(lotteryItem);
|
||||||
|
context.setAccountIp(drawDto.getAccountIp());
|
||||||
|
context.setKey(key);
|
||||||
|
AbstractRewardProcessor.rewardProcessorMap.get(prizeType).doReward(context);
|
||||||
|
} catch (UnRewardException u) {
|
||||||
|
context.setKey(RedisKeyManager.getDefaultLotteryPrizeRedisKey(lotteryItem.getLotteryId()));
|
||||||
|
lotteryItem = (LotteryItem) redisTemplate.opsForValue().get(RedisKeyManager.getDefaultLotteryItemRedisKey(lotteryItem.getLotteryId()));
|
||||||
|
context.setLotteryItem(lotteryItem);
|
||||||
|
AbstractRewardProcessor.rewardProcessorMap.get(LotteryConstants.PrizeTypeEnum.THANK.getValue()).doReward(context);
|
||||||
|
}
|
||||||
|
drawDto.setLevel(lotteryItem.getLevel());
|
||||||
|
drawDto.setPrizeName(context.getPrizeName());
|
||||||
|
drawDto.setPrizeId(context.getPrizeId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Lottery checkLottery(DoDrawDto drawDto) {
|
||||||
|
Lottery lottery;
|
||||||
|
Object lotteryJsonStr = redisTemplate.opsForValue().get(RedisKeyManager.getLotteryRedisKey(drawDto.getLotteryId()));
|
||||||
|
if (null != lotteryJsonStr) {
|
||||||
|
lottery = JSON.parseObject(lotteryJsonStr.toString(), Lottery.class);
|
||||||
|
} else {
|
||||||
|
lottery = lotteryMapper.selectById(drawDto.getLotteryId());
|
||||||
|
}
|
||||||
|
if (lottery == null) {
|
||||||
|
throw new BizException(ReturnCodeEnum.LOTTER_NOT_EXIST.getCode(), ReturnCodeEnum.LOTTER_NOT_EXIST.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
return lottery;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private LotteryItem doPlay(Lottery lottery) {
|
||||||
|
LotteryItem lotteryItem = null;
|
||||||
|
QueryWrapper<LotteryItem> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("lottery_id", lottery.getId());
|
||||||
|
Object lotteryItemsObj = redisTemplate.opsForValue().get(RedisKeyManager.getLotteryItemRedisKey(lottery.getId()));
|
||||||
|
System.out.println("获取的奖品信息:"+JSON.toJSONString(lotteryItemsObj));
|
||||||
|
List<LotteryItem> lotteryItems;
|
||||||
|
if (lotteryItemsObj == null) {
|
||||||
|
lotteryItems = lotteryItemMapper.selectList(queryWrapper);
|
||||||
|
} else {
|
||||||
|
lotteryItems = (List<LotteryItem>) lotteryItemsObj;
|
||||||
|
}
|
||||||
|
if (lotteryItems.isEmpty()) {
|
||||||
|
throw new BizException(ReturnCodeEnum.LOTTER_ITEM_NOT_INITIAL.getCode(), ReturnCodeEnum.LOTTER_ITEM_NOT_INITIAL.getMsg());
|
||||||
|
}
|
||||||
|
int lastScope = 0;
|
||||||
|
|
||||||
|
Map<Integer, int[]> awardItemScope = new HashMap<>();
|
||||||
|
for (LotteryItem item : lotteryItems) {
|
||||||
|
int currentScope = lastScope + new BigDecimal(item.getPercent().floatValue()).multiply(new BigDecimal(mulriple)).intValue();
|
||||||
|
awardItemScope.put(item.getId(), new int[]{lastScope + 1, currentScope});
|
||||||
|
lastScope = currentScope;
|
||||||
|
}
|
||||||
|
int luckyNumber = new SecureRandom().nextInt(mulriple);
|
||||||
|
int luckyPrizeId = 0;
|
||||||
|
if (!awardItemScope.isEmpty()) {
|
||||||
|
Set<Map.Entry<Integer, int[]>> set = awardItemScope.entrySet();
|
||||||
|
for (Map.Entry<Integer, int[]> entry : set) {
|
||||||
|
if (luckyNumber >= entry.getValue()[0] && luckyNumber <= entry.getValue()[1]) {
|
||||||
|
luckyPrizeId = entry.getKey();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (LotteryItem item : lotteryItems) {
|
||||||
|
if (item.getId().intValue() == luckyPrizeId) {
|
||||||
|
lotteryItem = item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lotteryItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
package com.xgl.lottery.service.impl.stock;
|
||||||
|
|
||||||
|
import com.xgl.lottery.LotteryConstants;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public abstract class AbstractRewardProcessor implements RewardProcessor<RewardContext>, ApplicationContextAware {
|
||||||
|
|
||||||
|
public static Map<Integer, RewardProcessor> rewardProcessorMap = new ConcurrentHashMap<Integer, RewardProcessor>();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected RedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
private void beforeProcessor(RewardContext context) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doReward(RewardContext context) {
|
||||||
|
beforeProcessor(context);
|
||||||
|
processor(context);
|
||||||
|
afterProcessor(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void afterProcessor(RewardContext context);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
protected abstract void processor(RewardContext context);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected abstract int getAwardType();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
|
rewardProcessorMap.put(LotteryConstants.PrizeTypeEnum.THANK.getValue(), (RewardProcessor) applicationContext.getBean(NoneStockRewardProcessor.class));
|
||||||
|
rewardProcessorMap.put(LotteryConstants.PrizeTypeEnum.NORMAL.getValue(), (RewardProcessor) applicationContext.getBean(HasStockRewardProcessor.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
package com.xgl.lottery.service.impl.stock;
|
||||||
|
|
||||||
|
import com.xgl.lottery.LotteryConstants;
|
||||||
|
import com.xgl.lottery.ReturnCodeEnum;
|
||||||
|
import com.xgl.lottery.dal.mapper.LotteryPrizeMapper;
|
||||||
|
import com.xgl.lottery.exception.UnRewardException;
|
||||||
|
import com.xgl.lottery.service.impl.AsyncLotteryRecordTask;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class HasStockRewardProcessor extends AbstractRewardProcessor {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AsyncLotteryRecordTask asyncLotteryRecordTask;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
LotteryPrizeMapper lotteryPrizeMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void afterProcessor(RewardContext context) {
|
||||||
|
asyncLotteryRecordTask.saveLotteryRecord(context.getAccountIp(), context.getLotteryItem(), context.getPrizeName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void processor(RewardContext context) {
|
||||||
|
Long result = redisTemplate.opsForHash().increment(context.getKey(), "validStock", -1);
|
||||||
|
if (result.intValue() < 0) {
|
||||||
|
throw new UnRewardException(ReturnCodeEnum.LOTTER_REPO_NOT_ENOUGHT.getCode(), ReturnCodeEnum.LOTTER_REPO_NOT_ENOUGHT.getMsg());
|
||||||
|
}
|
||||||
|
List<Object> propertys = Arrays.asList("id", "prizeName");
|
||||||
|
List<Object> prizes = redisTemplate.opsForHash().multiGet(context.getKey(), propertys);
|
||||||
|
context.setPrizeId(Integer.parseInt(prizes.get(0).toString()));
|
||||||
|
context.setPrizeName(prizes.get(1).toString());
|
||||||
|
lotteryPrizeMapper.updateValidStock(context.getPrizeId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getAwardType() {
|
||||||
|
return LotteryConstants.PrizeTypeEnum.NORMAL.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.xgl.lottery.service.impl.stock;
|
||||||
|
|
||||||
|
import com.xgl.lottery.LotteryConstants;
|
||||||
|
import com.xgl.lottery.service.impl.AsyncLotteryRecordTask;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class NoneStockRewardProcessor extends AbstractRewardProcessor {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AsyncLotteryRecordTask asyncLotteryRecordTask;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void afterProcessor(RewardContext context) {
|
||||||
|
asyncLotteryRecordTask.saveLotteryRecord(context.getAccountIp(), context.getLotteryItem(), context.getPrizeName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void processor(RewardContext context) {
|
||||||
|
List<Object> propertys = Arrays.asList("id", "prizeName");
|
||||||
|
List<Object> prizes = redisTemplate.opsForHash().multiGet(context.getKey(), propertys);
|
||||||
|
context.setPrizeId(Integer.parseInt(prizes.get(0).toString()));
|
||||||
|
context.setPrizeName(prizes.get(1).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getAwardType() {
|
||||||
|
return LotteryConstants.PrizeTypeEnum.THANK.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.xgl.lottery.service.impl.stock;
|
||||||
|
|
||||||
|
import com.xgl.lottery.dal.model.Lottery;
|
||||||
|
import com.xgl.lottery.dal.model.LotteryItem;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RewardContext {
|
||||||
|
|
||||||
|
private Lottery lottery;
|
||||||
|
|
||||||
|
private LotteryItem lotteryItem;
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
private String accountIp;
|
||||||
|
|
||||||
|
private String prizeName;
|
||||||
|
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
private Integer prizeId;
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package com.xgl.lottery.service.impl.stock;
|
||||||
|
|
||||||
|
public interface RewardProcessor<T> {
|
||||||
|
|
||||||
|
void doReward(RewardContext context);
|
||||||
|
|
||||||
|
}
|
||||||
279
src/main/java/com/xgl/lottery/utils/DateConvertUtil.java
Normal file
279
src/main/java/com/xgl/lottery/utils/DateConvertUtil.java
Normal file
@ -0,0 +1,279 @@
|
|||||||
|
package com.xgl.lottery.utils;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.ParsePosition;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class DateConvertUtil {
|
||||||
|
/**
|
||||||
|
* 根据时间转换为时间戳
|
||||||
|
* @param date
|
||||||
|
* @param timestampType 转换类型 0毫秒 1秒
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static long getTimeStamp(Date date, int timestampType)
|
||||||
|
{
|
||||||
|
long times = date.getTime();
|
||||||
|
if (timestampType == 1)
|
||||||
|
{
|
||||||
|
times = times/1000L;
|
||||||
|
}
|
||||||
|
return times;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间戳转时间
|
||||||
|
* @param timestamp
|
||||||
|
* @param timestampType 时间戳格式 0毫秒 1秒
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Date getDateTime(long timestamp,int timestampType)
|
||||||
|
{
|
||||||
|
if (timestampType == 1)
|
||||||
|
{
|
||||||
|
//如果时间戳格式是秒,需要江时间戳变为毫秒
|
||||||
|
timestamp = timestamp * 1000L;
|
||||||
|
}
|
||||||
|
Date dateTime = new Date(timestamp);
|
||||||
|
return dateTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化传入的时间,将时间转化为指定格式字符串
|
||||||
|
* @param date
|
||||||
|
* @param format 时间格式,如:yyyy-MM-dd HH:mm:ss SSS 或 yyyy年MM月dd日 HH:mm:ss
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getDateTimeString(Date date,String format )
|
||||||
|
{
|
||||||
|
if (format == null || format.length() <=0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 格式化日期
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||||
|
String timeString = sdf.format(date);
|
||||||
|
return timeString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化传入的时间戳,将时间戳转化为指定格式字符串
|
||||||
|
* @param timestamp
|
||||||
|
* @param format 时间格式,如:yyyy-MM-dd HH:mm:ss SSS 或 yyyy年MM月dd日 HH:mm:ss *
|
||||||
|
* @param timestampType 时间戳格式 0毫秒 1秒
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getTimeStampString(long timestamp,String format ,int timestampType)
|
||||||
|
{
|
||||||
|
if (format == null || format.length() <=0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (timestampType == 1)
|
||||||
|
{
|
||||||
|
//如果时间戳格式是秒,需要江时间戳变为毫秒
|
||||||
|
timestamp = timestamp * 1000L;
|
||||||
|
}
|
||||||
|
Date dateTime = new Date(timestamp);
|
||||||
|
// 格式化日期
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||||
|
String timeString = sdf.format(dateTime);
|
||||||
|
return timeString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param inputDate 要解析的字符串
|
||||||
|
* @param patterns 可能出现的日期格式
|
||||||
|
* @return 解析出来的日期,如果没有匹配的返回null
|
||||||
|
*/
|
||||||
|
public static Date parseDate(String inputDate,String[] patterns){
|
||||||
|
SimpleDateFormat df = new SimpleDateFormat();
|
||||||
|
for(String pattern:patterns){
|
||||||
|
df.applyPattern(pattern);
|
||||||
|
df.setLenient(false);//设置解析日期格式是否严格解析日期
|
||||||
|
ParsePosition pos = new ParsePosition(0);
|
||||||
|
Date date = df.parse(inputDate, pos);
|
||||||
|
if(date!=null){
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer compare(String date1,String date2) throws ParseException {
|
||||||
|
// 日期格式化
|
||||||
|
DateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Date startDate = simpleFormat.parse(date1);
|
||||||
|
Date endDate = simpleFormat.parse(date2);
|
||||||
|
long startTime = startDate.getTime();
|
||||||
|
long endTime = endDate.getTime();
|
||||||
|
int days = (int) ((endTime - startTime) / (1000 * 60 * 60 * 24));
|
||||||
|
System.out.println("两个时间之间的天数间隔为:" + days);
|
||||||
|
return days;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//验证结果
|
||||||
|
public static void main(String[] args) throws ParseException {
|
||||||
|
String[] possiblePatterns =
|
||||||
|
{
|
||||||
|
"yyyy-MM-dd",
|
||||||
|
"yyyy-MM-dd HH:mm:ss",
|
||||||
|
"yyyyMMdd",
|
||||||
|
"yyyy/MM/dd",
|
||||||
|
"yyyy年MM月dd日",
|
||||||
|
"yyyy MM dd"
|
||||||
|
};
|
||||||
|
String inputDate1 = "2018-01-01";
|
||||||
|
// String inputDate2 = "2018-01-01 12:12:12";
|
||||||
|
// String inputDate3 = "20180101";
|
||||||
|
// String inputDate4 = "2018/01/01";
|
||||||
|
// String inputDate5 = "2018年01月01日";
|
||||||
|
// String inputDate6 = "2018 01 01";
|
||||||
|
// System.out.println(parseDate(inputDate6,possiblePatterns));
|
||||||
|
// System.out.println(parseDate(inputDate1,possiblePatterns));
|
||||||
|
// System.out.println(parseDate(inputDate2,possiblePatterns));
|
||||||
|
// System.out.println(parseDate(inputDate3,possiblePatterns));
|
||||||
|
// System.out.println(parseDate(inputDate4,possiblePatterns));
|
||||||
|
// System.out.println(parseDate(inputDate5,possiblePatterns));
|
||||||
|
// System.out.println(parseDate(inputDate6,possiblePatterns));
|
||||||
|
Date date = new Date();
|
||||||
|
System.out.println("时间:"+date);
|
||||||
|
System.out.println(parseDate(inputDate1,possiblePatterns));
|
||||||
|
|
||||||
|
|
||||||
|
// 日期格式化
|
||||||
|
DateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Date startDate = simpleFormat.parse("2022-04-11 23:12:12");
|
||||||
|
Date endDate = simpleFormat.parse("2022-04-12 23:12:12");
|
||||||
|
long startTime = startDate.getTime();
|
||||||
|
long endTime = endDate.getTime();
|
||||||
|
int days = (int) ((endTime - startTime) / (1000 * 60 * 60 * 24));
|
||||||
|
System.out.println("两个时间之间的天数间隔为:" + days);
|
||||||
|
|
||||||
|
// LocalDate startDate = LocalDate.of(2021, 3, 1);
|
||||||
|
// LocalDate endDate = LocalDate.of(2021, 7, 8);
|
||||||
|
// long days = ChronoUnit.DAYS.between(startDate, endDate);
|
||||||
|
// System.out.println("两个时间之间的天数间隔为:" + days);
|
||||||
|
|
||||||
|
String timeEnd="2022-04-12 23:12:12";
|
||||||
|
String timeEnd2="2021-04-12 23:12:12";
|
||||||
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime localTime = LocalDateTime.parse(timeEnd, dtf);
|
||||||
|
LocalDateTime startTime1 = LocalDate.now().atTime(0, 0, 0);
|
||||||
|
LocalDateTime endTime1 = LocalDate.now().atTime(23, 59, 59);
|
||||||
|
LocalDateTime localTime2 = LocalDateTime.parse(timeEnd2, dtf);
|
||||||
|
boolean b = localTime.isAfter(startTime1) && localTime.isBefore(endTime1);
|
||||||
|
boolean b1 = localTime2.isAfter(startTime1) && localTime2.isBefore(endTime1);
|
||||||
|
System.out.println("bbbbbbb:"+b);
|
||||||
|
System.out.println("b1b1b1b1b1:"+b1);
|
||||||
|
|
||||||
|
|
||||||
|
ArrayList<String> list = new ArrayList<>();
|
||||||
|
//定义一个ArrayList,往集合中添加内容
|
||||||
|
list.add("你好吗");
|
||||||
|
list.add("hello");
|
||||||
|
list.add("今天天气很好");
|
||||||
|
list.add("我叫小明你叫什么");
|
||||||
|
list.add("hahahahaha");
|
||||||
|
list.add("youyouyouyou");
|
||||||
|
list.add("cicicicicici");
|
||||||
|
System.out.println("打印原集合内容:"+list);
|
||||||
|
//循环遍历集合,删除长度大于5的字符串
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
String str = list.get(i);
|
||||||
|
if (StringUtils.isNotBlank(str)) {
|
||||||
|
list.remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("打印删除后的集合内容:"+list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//将时间转换为时间戳
|
||||||
|
|
||||||
|
public static long dateToStamp(String s) throws Exception {
|
||||||
|
long times;
|
||||||
|
|
||||||
|
//设置时间格式,将该时间格式的时间转换为时间戳
|
||||||
|
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
Date date = simpleDateFormat.parse(s);
|
||||||
|
|
||||||
|
long time = date.getTime();
|
||||||
|
times = time/1000L;
|
||||||
|
// res = String.valueOf(time);
|
||||||
|
|
||||||
|
return times;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//将时间戳转换为时间
|
||||||
|
|
||||||
|
public static String stampToTime(String s) throws Exception{
|
||||||
|
String res;
|
||||||
|
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
long lt = new Long(s);
|
||||||
|
|
||||||
|
//将时间戳转换为时间
|
||||||
|
|
||||||
|
Date date = new Date(lt);
|
||||||
|
|
||||||
|
//将时间调整为yyyy-MM-dd HH:mm:ss时间样式
|
||||||
|
|
||||||
|
res = simpleDateFormat.format(date);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述 秒转时分秒
|
||||||
|
* @param sumSecond 总秒数
|
||||||
|
* @return java.lang.String 返回 “ 01:01:01 ” 格式的时间
|
||||||
|
*/
|
||||||
|
private static String sumSecondToTime(int sumSecond) {
|
||||||
|
if(sumSecond <= 0){
|
||||||
|
return "00:00:00";
|
||||||
|
}
|
||||||
|
int h = sumSecond/3600;
|
||||||
|
int m = (sumSecond-h*3600)/60;
|
||||||
|
int s = sumSecond - h*3600-m*60;
|
||||||
|
String time = "%02d:%02d:%02d";
|
||||||
|
time = String.format(time,h,m,s);
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述 秒转时分秒
|
||||||
|
* @param sumSecond 总秒数
|
||||||
|
* @return java.lang.String 返回 “ 01:01:01 ” 格式的时间
|
||||||
|
*/
|
||||||
|
public static String longSumSecondToTime(long sumSecond) {
|
||||||
|
if(sumSecond <= 0){
|
||||||
|
return "00:00:00";
|
||||||
|
}
|
||||||
|
long h = sumSecond/3600;
|
||||||
|
long m = (sumSecond-h*3600)/60;
|
||||||
|
long s = sumSecond - h*3600-m*60;
|
||||||
|
String time = "%02d:%02d:%02d";
|
||||||
|
time = String.format(time,h,m,s);
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
367
src/main/java/com/xgl/lottery/utils/DateUtil.java
Normal file
367
src/main/java/com/xgl/lottery/utils/DateUtil.java
Normal file
@ -0,0 +1,367 @@
|
|||||||
|
package com.xgl.lottery.utils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.*;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
@Slf4j
|
||||||
|
public class DateUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认 zoneId
|
||||||
|
*/
|
||||||
|
private static final ZoneId DEFAULT_ZONE_ID = ZoneId.systemDefault();
|
||||||
|
private static final ZoneOffset DEFAULT_ZONE_OFFSET = DEFAULT_ZONE_ID.getRules().getOffset(Instant.now());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间格式(yyyy-MM-dd)
|
||||||
|
*/
|
||||||
|
public static final String DATE_PATTERN = "yyyy-MM-dd";
|
||||||
|
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern(DATE_PATTERN);
|
||||||
|
/**
|
||||||
|
* 时间格式(yyyy-MM-dd HH:mm:ss)
|
||||||
|
*/
|
||||||
|
public static final String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern(DATE_TIME_PATTERN);
|
||||||
|
|
||||||
|
private static final Map<String, DateTimeFormatter> DATE_TIME_FORMATTER_MAP = new HashMap<>(2);
|
||||||
|
|
||||||
|
static {
|
||||||
|
DATE_TIME_FORMATTER_MAP.put(DATE_PATTERN, DATE_FORMATTER);
|
||||||
|
DATE_TIME_FORMATTER_MAP.put(DATE_TIME_PATTERN, DATE_TIME_FORMATTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从全局缓存中拿 pattern 对应的 formatter 或者新建
|
||||||
|
*
|
||||||
|
* @param pattern pattern
|
||||||
|
* @return pattern 对应的 formatter
|
||||||
|
*/
|
||||||
|
private static DateTimeFormatter getFormatter(String pattern) {
|
||||||
|
return DATE_TIME_FORMATTER_MAP.getOrDefault(pattern, DateTimeFormatter.ofPattern(pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期格式化为指定格式的字符串
|
||||||
|
*
|
||||||
|
* @param date 日期
|
||||||
|
* @param pattern 格式,如:DateUtils.DATE_PATTERN
|
||||||
|
* @return 返回指定格式字符串时间
|
||||||
|
*/
|
||||||
|
public static String format(Date date, String pattern) {
|
||||||
|
Assert.notNull(date, "传入的日期不可以为 [null]");
|
||||||
|
Assert.hasText(pattern, "PATTERN: [" + pattern + "] 参数非法");
|
||||||
|
return formatLocalDateTime(toLocalDateTime(date), pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LocalDate 类型的日期格式化为指定格式的字符串
|
||||||
|
*
|
||||||
|
* @param localDate LocalDate 类型的日期
|
||||||
|
* @param pattern 格式,如:DateUtils.DATE_PATTERN
|
||||||
|
* @return 返回指定格式字符串时间
|
||||||
|
*/
|
||||||
|
public static String formartLocalDate(LocalDate localDate, String pattern) {
|
||||||
|
Assert.notNull(localDate, "传入的日期不可以为 [null]");
|
||||||
|
Assert.hasText(pattern, "PATTERN: [" + pattern + "] 参数非法");
|
||||||
|
return formatLocalDateTime(toLocalDateTime(localDate), pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LocalDateTime 类型的时间格式化为指定格式的字符串
|
||||||
|
*
|
||||||
|
* @param localDateTime LocalDateTime 类型的时间
|
||||||
|
* @param pattern 格式,如 DateUtils.DATE_PATTERN
|
||||||
|
* @return 指定格式字符串时间
|
||||||
|
*/
|
||||||
|
public static String formatLocalDateTime(LocalDateTime localDateTime, String pattern) {
|
||||||
|
Assert.notNull(localDateTime, "传入的日期不可以为 [null]");
|
||||||
|
Assert.hasText(pattern, "PATTERN: [" + pattern + "] 参数非法");
|
||||||
|
return localDateTime.format(getFormatter(pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字符串转成 Date 类型
|
||||||
|
*
|
||||||
|
* @param str 日期字符串
|
||||||
|
* @param pattern 日期的格式:如:DateUtils.DATE_PATTERN
|
||||||
|
* @return Date 类型的时间
|
||||||
|
*/
|
||||||
|
public static Date toDate(String str, String pattern) {
|
||||||
|
Assert.hasText(str, "STR: [" + str + "] 参数非法");
|
||||||
|
Assert.hasText(pattern, "PATTERN: [" + pattern + "] 参数非法");
|
||||||
|
return toDate(LocalDateTime.parse(str, getFormatter(pattern)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LocalDate 转成 Date
|
||||||
|
*
|
||||||
|
* @param localDate LocalDate 类型日期
|
||||||
|
* @return Date 类型的日期
|
||||||
|
*/
|
||||||
|
public static Date toDate(LocalDate localDate) {
|
||||||
|
Assert.notNull(localDate, "传入的日期不可以为 [null]");
|
||||||
|
return Date.from(localDate.atStartOfDay(DEFAULT_ZONE_ID).toInstant());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LocalDateTime 转成 Date
|
||||||
|
*
|
||||||
|
* @param localDateTime LocalDateTime 类型时间
|
||||||
|
* @return Date 类型的时间
|
||||||
|
*/
|
||||||
|
public static Date toDate(LocalDateTime localDateTime) {
|
||||||
|
Assert.notNull(localDateTime, "传入的日期不可以为 [null]");
|
||||||
|
return Date.from(localDateTime.atZone(DEFAULT_ZONE_ID).toInstant());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字符串转成 LocalDate 类型的日期 默认 str 形如 "yyyy-MM-dd"
|
||||||
|
*
|
||||||
|
* @param str 字符串日期
|
||||||
|
* @return LocalDate 类型的日期
|
||||||
|
*/
|
||||||
|
public static LocalDate toLocalDate(String str) {
|
||||||
|
Assert.hasText(str, "STR: [" + str + "] 参数非法");
|
||||||
|
return toLocalDate(str, DATE_PATTERN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字符串转成 LocalDate 类型的日期
|
||||||
|
*
|
||||||
|
* @param str 字符串日期
|
||||||
|
* @param pattern 字符串格式,如 DateUtils.DATE_PATTERN
|
||||||
|
* @return LocalDate 类型的日期
|
||||||
|
*/
|
||||||
|
public static LocalDate toLocalDate(String str, String pattern) {
|
||||||
|
Assert.hasText(str, "STR: [" + str + "] 参数非法");
|
||||||
|
Assert.hasText(pattern, "PATTERN: [" + pattern + "] 参数非法");
|
||||||
|
return LocalDate.parse(str, getFormatter(pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date 类型日期转成 LocalDate 类型的日期
|
||||||
|
*
|
||||||
|
* @param date Date 类型的日期
|
||||||
|
* @return LocalDate 类型的日期
|
||||||
|
*/
|
||||||
|
public static LocalDate toLocalDate(Date date) {
|
||||||
|
Assert.notNull(date, "传入的日期不可以为 [null]");
|
||||||
|
return toZonedDateTime(date).toLocalDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字符串类型的时间转成 LocalDateTime 类型的时间,默认形如 "yyyy-MM-dd HH:mm:ss"
|
||||||
|
*
|
||||||
|
* @param str 字符串时间,默认形如 "yyyy-MM-dd HH:mm:ss"
|
||||||
|
* @return LocalDateTime 类型的时间
|
||||||
|
*/
|
||||||
|
public static LocalDateTime toLocalDateTime(String str) {
|
||||||
|
Assert.hasText(str, "STR: [" + str + "] 参数非法");
|
||||||
|
return toLocalDateTime(str, DATE_TIME_PATTERN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字符串类型的时间转成 LocalDateTime 类型的时间
|
||||||
|
*
|
||||||
|
* @param str 字符串时间
|
||||||
|
* @param pattern 字符串时间格式
|
||||||
|
* @return LocalDateTime 类型的时间
|
||||||
|
*/
|
||||||
|
public static LocalDateTime toLocalDateTime(String str, String pattern) {
|
||||||
|
Assert.hasText(str, "STR: [" + str + "] 参数非法");
|
||||||
|
Assert.hasText(pattern, "PATTERN: [" + pattern + "] 参数非法");
|
||||||
|
return LocalDateTime.parse(str, getFormatter(pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date 类型的时间转成 LocalDateTime 类型的时间
|
||||||
|
*
|
||||||
|
* @param date Date 类型的时间
|
||||||
|
* @return LocalDateTime 类型的时间
|
||||||
|
*/
|
||||||
|
public static LocalDateTime toLocalDateTime(Date date) {
|
||||||
|
Assert.notNull(date, "传入的日期不可以为 [null]");
|
||||||
|
return toZonedDateTime(date).toLocalDateTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LocalDate 时间转成 LocalDateTime 类型时间为当天开始时间
|
||||||
|
*
|
||||||
|
* @param localDate LocalDate 类型的时间
|
||||||
|
* @return LocalDateTime 类型时间为当天开始时间
|
||||||
|
*/
|
||||||
|
public static LocalDateTime toLocalDateTime(LocalDate localDate) {
|
||||||
|
Assert.notNull(localDate, "传入的日期不可以为 [null]");
|
||||||
|
return localDate.atStartOfDay();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对日期的【秒】进行加/减
|
||||||
|
*
|
||||||
|
* @param date 日期
|
||||||
|
* @param seconds 秒数,负数为减
|
||||||
|
* @return 加/减几秒后的日期
|
||||||
|
*/
|
||||||
|
public static Date addDateSeconds(Date date, int seconds) {
|
||||||
|
Assert.notNull(date, "传入的日期不可以为 [null]");
|
||||||
|
return toDate(toLocalDateTime(date).plusSeconds(seconds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对日期的【分钟】进行加/减
|
||||||
|
*
|
||||||
|
* @param date 日期
|
||||||
|
* @param minutes 分钟数,负数为减
|
||||||
|
* @return 加/减几分钟后的日期
|
||||||
|
*/
|
||||||
|
public static Date addDateMinutes(Date date, int minutes) {
|
||||||
|
Assert.notNull(date, "传入的日期不可以为 [null]");
|
||||||
|
return toDate(toLocalDateTime(date).plusMinutes(minutes));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对日期的【小时】进行加/减
|
||||||
|
*
|
||||||
|
* @param date 日期
|
||||||
|
* @param hours 小时数,负数为减
|
||||||
|
* @return 加/减几小时后的日期
|
||||||
|
*/
|
||||||
|
public static Date addDateHours(Date date, int hours) {
|
||||||
|
Assert.notNull(date, "传入的日期不可以为 [null]");
|
||||||
|
return toDate(toLocalDateTime(date).plusHours(hours));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对日期的【天】进行加/减
|
||||||
|
*
|
||||||
|
* @param date 日期
|
||||||
|
* @param days 天数,负数为减
|
||||||
|
* @return 加/减几天后的日期
|
||||||
|
*/
|
||||||
|
public static Date addDateDays(Date date, int days) {
|
||||||
|
Assert.notNull(date, "传入的日期不可以为 [null]");
|
||||||
|
return toDate(toLocalDateTime(date).plusDays(days));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对日期的【周】进行加/减
|
||||||
|
*
|
||||||
|
* @param date 日期
|
||||||
|
* @param weeks 周数,负数为减
|
||||||
|
* @return 加/减几周后的日期
|
||||||
|
*/
|
||||||
|
public static Date addDateWeeks(Date date, int weeks) {
|
||||||
|
Assert.notNull(date, "传入的日期不可以为 [null]");
|
||||||
|
return toDate(toLocalDateTime(date).plusWeeks(weeks));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对日期的【月】进行加/减
|
||||||
|
*
|
||||||
|
* @param date 日期
|
||||||
|
* @param months 月数,负数为减
|
||||||
|
* @return 加/减几月后的日期
|
||||||
|
*/
|
||||||
|
public static Date addDateMonths(Date date, int months) {
|
||||||
|
Assert.notNull(date, "传入的日期不可以为 [null]");
|
||||||
|
return toDate(toLocalDateTime(date).plusMonths(months));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对日期的【年】进行加/减
|
||||||
|
*
|
||||||
|
* @param date 日期
|
||||||
|
* @param years 年数,负数为减
|
||||||
|
* @return 加/减几年后的日期
|
||||||
|
*/
|
||||||
|
public static Date addDateYears(Date date, int years) {
|
||||||
|
Assert.notNull(date, "传入的日期不可以为 [null]");
|
||||||
|
return toDate(toLocalDateTime(date).plusYears(years));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从 Date 获取特定时区的时间
|
||||||
|
*
|
||||||
|
* @param date Date 类型的时间
|
||||||
|
* @return DateUtils.DEFAULT_ZONE_ID 标定的时区时间
|
||||||
|
*/
|
||||||
|
public static ZonedDateTime toZonedDateTime(Date date) {
|
||||||
|
Assert.notNull(date, "传入的日期不可以为 [null]");
|
||||||
|
return date.toInstant().atZone(DEFAULT_ZONE_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从秒数拿到 LocalDateTime
|
||||||
|
*
|
||||||
|
* @param seconds 秒数
|
||||||
|
* @return localDateTime
|
||||||
|
*/
|
||||||
|
public static LocalDateTime fromSeconds(long seconds) {
|
||||||
|
return LocalDateTime.ofEpochSecond(seconds, 0, DEFAULT_ZONE_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从毫秒数拿到 LocalDateTime
|
||||||
|
*
|
||||||
|
* @param millSeconds 毫秒数
|
||||||
|
* @return localDateTime
|
||||||
|
*/
|
||||||
|
public static LocalDateTime fromMillSeconds(long millSeconds) {
|
||||||
|
Instant instant = Instant.ofEpochMilli(millSeconds);
|
||||||
|
return LocalDateTime.ofInstant(instant, DEFAULT_ZONE_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从 LocalDateTime 拿到秒数
|
||||||
|
*
|
||||||
|
* @param localDateTime localDateTime
|
||||||
|
* @return 秒数
|
||||||
|
*/
|
||||||
|
public static long getSeconds(LocalDateTime localDateTime) {
|
||||||
|
Assert.notNull(localDateTime, "传入的日期不可以为 [null]");
|
||||||
|
return getMillSeconds(localDateTime) / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从 LocalDateTime 拿到毫秒数
|
||||||
|
*
|
||||||
|
* @param localDateTime localDateTime
|
||||||
|
* @return 毫秒数
|
||||||
|
*/
|
||||||
|
public static long getMillSeconds(LocalDateTime localDateTime) {
|
||||||
|
Assert.notNull(localDateTime, "传入的日期不可以为 [null]");
|
||||||
|
return localDateTime.toInstant(DEFAULT_ZONE_OFFSET).toEpochMilli();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isToday(String str, String formatStr) throws Exception{
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat(formatStr);
|
||||||
|
Date date = null;
|
||||||
|
try {
|
||||||
|
date = format.parse(str);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
log.error("解析日期错误", e);
|
||||||
|
}
|
||||||
|
Calendar c1 = Calendar.getInstance();
|
||||||
|
c1.setTime(date);
|
||||||
|
int year1 = c1.get(Calendar.YEAR);
|
||||||
|
int month2 = c1.get(Calendar.MONTH)+1;
|
||||||
|
int day1 = c1.get(Calendar.DAY_OF_MONTH);
|
||||||
|
Calendar c2 = Calendar.getInstance();
|
||||||
|
c2.setTime(new Date());
|
||||||
|
int year2 = c2.get(Calendar.YEAR);
|
||||||
|
int month3 = c2.get(Calendar.MONTH)+1;
|
||||||
|
int day2 = c2.get(Calendar.DAY_OF_MONTH);
|
||||||
|
if(year1 == year2 && month2 == month3 && day1 == day2){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
193
src/main/java/com/xgl/lottery/utils/EncryptUtil.java
Normal file
193
src/main/java/com/xgl/lottery/utils/EncryptUtil.java
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
package com.xgl.lottery.utils;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.SecretKey;
|
||||||
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
public final class EncryptUtil {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(EncryptUtil.class);
|
||||||
|
|
||||||
|
public static final String MD5 = "MD5";
|
||||||
|
|
||||||
|
public static final String base64 = "base64";
|
||||||
|
|
||||||
|
public static String DesKey = "12345600";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 偏移变量,固定占8位字节
|
||||||
|
*/
|
||||||
|
private final static String IV_PARAMETER = "12345678";
|
||||||
|
/**
|
||||||
|
* 密钥算法
|
||||||
|
*/
|
||||||
|
private static final String ALGORITHM = "DES";
|
||||||
|
/**
|
||||||
|
* 加密/解密算法-工作模式-填充模式
|
||||||
|
*/
|
||||||
|
private static final String CIPHER_ALGORITHM = "DES/CBC/PKCS5Padding";
|
||||||
|
/**
|
||||||
|
* 默认编码
|
||||||
|
*/
|
||||||
|
private static final String CHARSET = "utf-8";
|
||||||
|
|
||||||
|
private EncryptUtil(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Md5加密
|
||||||
|
* @param srcContent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String encodeByMD5(byte[] srcContent) {
|
||||||
|
if (srcContent == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String strDes = null;
|
||||||
|
try {
|
||||||
|
MessageDigest md5 = MessageDigest.getInstance(MD5);
|
||||||
|
md5.update(srcContent);
|
||||||
|
strDes = bytesToHexString(md5.digest());
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return strDes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二进制字节流转16进制字符串
|
||||||
|
* @param bytes
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String bytesToHexString(byte[] bytes) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < bytes.length; i++) {
|
||||||
|
String hex = Integer.toHexString(0xFF & bytes[i]);
|
||||||
|
if (hex.length() == 1) {
|
||||||
|
sb.append('0');
|
||||||
|
}
|
||||||
|
sb.append(hex);
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static String getMsgDigest(Map<String,String> map) throws Exception{
|
||||||
|
if(map == null || map.isEmpty()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
TreeMap<String, String> treeMap = new TreeMap<>();
|
||||||
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||||
|
treeMap.put(entry.getKey(),entry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuffer paramStr = new StringBuffer();
|
||||||
|
for (Map.Entry<String, String> treeEntry : treeMap.entrySet()) {
|
||||||
|
paramStr.append(treeEntry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(paramStr.toString());
|
||||||
|
return encodeByMD5(paramStr.toString().getBytes("UTF-8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* base64加密
|
||||||
|
* @param srcContent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String encodeByBase64(byte[] srcContent) {
|
||||||
|
if (srcContent == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return Base64.getEncoder().encodeToString(srcContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DES 加密
|
||||||
|
*/
|
||||||
|
public static String encryptByDES(String data){
|
||||||
|
try {
|
||||||
|
SecretKey secretKey = new SecretKeySpec(DesKey.getBytes(CHARSET), ALGORITHM);
|
||||||
|
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
|
||||||
|
IvParameterSpec iv = new IvParameterSpec(IV_PARAMETER.getBytes(CHARSET));
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, secretKey, iv);
|
||||||
|
byte[] bytes = cipher.doFinal(data.getBytes(CHARSET));
|
||||||
|
return new String(Base64.getEncoder().encode(bytes));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DES 解密
|
||||||
|
*/
|
||||||
|
public static String decryptByDES(String data) {
|
||||||
|
try {
|
||||||
|
SecretKey secretKey = new SecretKeySpec(DesKey.getBytes(CHARSET), "DES");
|
||||||
|
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
|
||||||
|
IvParameterSpec iv = new IvParameterSpec(IV_PARAMETER.getBytes(CHARSET));
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, secretKey, iv);
|
||||||
|
return new String(cipher.doFinal(Base64.getDecoder().decode(data.getBytes(CHARSET))), CHARSET);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String aa = encryptByDES("XK180");
|
||||||
|
System.out.println("加密后的结果:"+aa);
|
||||||
|
String secret="U2FsdGVkX1/I3JZhuGx9mWe/dECQ2iTu";
|
||||||
|
String s = decryptByDES(aa);
|
||||||
|
System.out.println("解密后的结果:"+s);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加密文件
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String MD5ToFile(InputStream data) {
|
||||||
|
String md5Str = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
md5Str = DigestUtils.md5Hex(data);
|
||||||
|
} catch (IOException var3) {
|
||||||
|
log.error(var3.getMessage(), var3);
|
||||||
|
}
|
||||||
|
|
||||||
|
return md5Str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
41
src/main/java/com/xgl/lottery/utils/ExceptionUtil.java
Normal file
41
src/main/java/com/xgl/lottery/utils/ExceptionUtil.java
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
package com.xgl.lottery.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xgl.lottery.ReturnCodeEnum;
|
||||||
|
import com.xgl.lottery.exception.BizException;
|
||||||
|
import com.xgl.lottery.exception.RewardException;
|
||||||
|
import com.xgl.lottery.exception.UnRewardException;
|
||||||
|
import com.xgl.lottery.service.dto.ResultResp;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class ExceptionUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将下层抛出的异常转换为resp返回码
|
||||||
|
*
|
||||||
|
* @param e Exception
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static ResultResp handlerException4biz(ResultResp response, Exception e) {
|
||||||
|
if (!(e instanceof Exception)) {
|
||||||
|
return null;
|
||||||
|
} else if (e instanceof BizException) {
|
||||||
|
response.setCode(((BizException) e).getErrorCode());
|
||||||
|
response.setMsg(e.getMessage());
|
||||||
|
} else if (e instanceof RewardException) {
|
||||||
|
response.setCode(((RewardException) e).getErrorCode());
|
||||||
|
response.setMsg(e.getMessage());
|
||||||
|
} else if (e instanceof UnRewardException) {
|
||||||
|
response.setCode(((UnRewardException) e).getErrorCode());
|
||||||
|
response.setMsg(e.getMessage());
|
||||||
|
} else if (e instanceof Exception) {
|
||||||
|
log.error("handlerException4biz", e);
|
||||||
|
response.setCode(ReturnCodeEnum.SYSTEM_ERROR.getCode());
|
||||||
|
response.setMsg(ReturnCodeEnum.SYSTEM_ERROR.getMsg());
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
120
src/main/java/com/xgl/lottery/utils/SnowflakeIdUtil.java
Normal file
120
src/main/java/com/xgl/lottery/utils/SnowflakeIdUtil.java
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
package com.xgl.lottery.utils;
|
||||||
|
|
||||||
|
public class SnowflakeIdUtil {
|
||||||
|
|
||||||
|
// ==============================Fields===========================================
|
||||||
|
/** 开始时间截 (2015-01-01) */
|
||||||
|
private final long twepoch = 1420041600000L;
|
||||||
|
/** 机器id所占的位数 */
|
||||||
|
private final long workerIdBits = 5L;
|
||||||
|
/** 数据标识id所占的位数 */
|
||||||
|
private final long datacenterIdBits = 5L;
|
||||||
|
/** 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) */
|
||||||
|
private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
|
||||||
|
/** 支持的最大数据标识id,结果是31 */
|
||||||
|
private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
|
||||||
|
/** 序列在id中占的位数 */
|
||||||
|
private final long sequenceBits = 12L;
|
||||||
|
/** 机器ID向左移12位 */
|
||||||
|
private final long workerIdShift = sequenceBits;
|
||||||
|
/** 数据标识id向左移17位(12+5) */
|
||||||
|
private final long datacenterIdShift = sequenceBits + workerIdBits;
|
||||||
|
/** 时间截向左移22位(5+5+12) */
|
||||||
|
private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
|
||||||
|
/** 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) */
|
||||||
|
private final long sequenceMask = -1L ^ (-1L << sequenceBits);
|
||||||
|
/** 工作机器ID(0~31) */
|
||||||
|
private long workerId;
|
||||||
|
/** 数据中心ID(0~31) */
|
||||||
|
private long datacenterId;
|
||||||
|
/** 毫秒内序列(0~4095) */
|
||||||
|
private long sequence = 0L;
|
||||||
|
/** 上次生成ID的时间截 */
|
||||||
|
private long lastTimestamp = -1L;
|
||||||
|
private static SnowflakeIdUtil idWorker;
|
||||||
|
/**
|
||||||
|
* 以SnowFlake算法,获取唯一有序id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static long getSnowflakeId() {
|
||||||
|
if(idWorker == null) {
|
||||||
|
synchronized (SnowflakeIdUtil.class) {
|
||||||
|
if(idWorker == null) {
|
||||||
|
idWorker = new SnowflakeIdUtil(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return idWorker.nextId();
|
||||||
|
}
|
||||||
|
// ==============================Methods==========================================
|
||||||
|
private SnowflakeIdUtil() {
|
||||||
|
}
|
||||||
|
//==============================Constructors=====================================
|
||||||
|
/**
|
||||||
|
* 构造函数
|
||||||
|
* @param workerId 工作ID (0~31)
|
||||||
|
* @param datacenterId 数据中心ID (0~31)
|
||||||
|
*/
|
||||||
|
private SnowflakeIdUtil(long workerId, long datacenterId) {
|
||||||
|
if (workerId > maxWorkerId || workerId < 0) {
|
||||||
|
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
|
||||||
|
}
|
||||||
|
if (datacenterId > maxDatacenterId || datacenterId < 0) {
|
||||||
|
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
|
||||||
|
}
|
||||||
|
this.workerId = workerId;
|
||||||
|
this.datacenterId = datacenterId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 阻塞到下一个毫秒,直到获得新的时间戳
|
||||||
|
* @param lastTimestamp 上次生成ID的时间截
|
||||||
|
* @return 当前时间戳
|
||||||
|
*/
|
||||||
|
protected long tilNextMillis(long lastTimestamp) {
|
||||||
|
long timestamp = timeGen();
|
||||||
|
while (timestamp <= lastTimestamp) {
|
||||||
|
timestamp = timeGen();
|
||||||
|
}
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 返回以毫秒为单位的当前时间
|
||||||
|
* @return 当前时间(毫秒)
|
||||||
|
*/
|
||||||
|
protected long timeGen() {
|
||||||
|
return System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获得下一个ID (该方法是线程安全的)
|
||||||
|
* @return SnowflakeId
|
||||||
|
*/
|
||||||
|
protected synchronized long nextId() {
|
||||||
|
long timestamp = timeGen();
|
||||||
|
//如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
|
||||||
|
if (timestamp < lastTimestamp) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
|
||||||
|
}
|
||||||
|
//如果是同一时间生成的,则进行毫秒内序列
|
||||||
|
if (lastTimestamp == timestamp) {
|
||||||
|
sequence = (sequence + 1) & sequenceMask;
|
||||||
|
//毫秒内序列溢出
|
||||||
|
if (sequence == 0) {
|
||||||
|
//阻塞到下一个毫秒,获得新的时间戳
|
||||||
|
timestamp = tilNextMillis(lastTimestamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//时间戳改变,毫秒内序列重置
|
||||||
|
else {
|
||||||
|
sequence = 0L;
|
||||||
|
}
|
||||||
|
//上次生成ID的时间截
|
||||||
|
lastTimestamp = timestamp;
|
||||||
|
//移位并通过或运算拼到一起组成64位的ID
|
||||||
|
return ((timestamp - twepoch) << timestampLeftShift) //
|
||||||
|
| (datacenterId << datacenterIdShift) //
|
||||||
|
| (workerId << workerIdShift) //
|
||||||
|
| sequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "aliyun.accessSecret",
|
||||||
|
"type": "java.lang.String",
|
||||||
|
"description": "Description for aliyun.accessSecret."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aliyun.oss.endpoint",
|
||||||
|
"type": "java.lang.String",
|
||||||
|
"description": "Description for aliyun.oss.endpoint."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aliyun.accessKey",
|
||||||
|
"type": "java.lang.String",
|
||||||
|
"description": "Description for aliyun.accessKey."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aliyun.oss.bucketName",
|
||||||
|
"type": "java.lang.String",
|
||||||
|
"description": "Description for aliyun.oss.bucketName."
|
||||||
|
}
|
||||||
|
] }
|
||||||
96
src/main/resources/application-dev.yml
Normal file
96
src/main/resources/application-dev.yml
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
server:
|
||||||
|
port: 8083 #端口号
|
||||||
|
servlet:
|
||||||
|
context-path: /employee-care
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
druid:
|
||||||
|
url: jdbc:mysql://39.108.110.167:13376/employee_care?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&serverTimezone=GMT%2B8 #数据库端口号:3366 数据库名:lottery
|
||||||
|
username: root #数据库用户名
|
||||||
|
password: szxgl@2001B #数据库密码
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
initial-size: 30
|
||||||
|
max-active: 100
|
||||||
|
min-idle: 10
|
||||||
|
max-wait: 60000
|
||||||
|
time-between-eviction-runs-millis: 60000
|
||||||
|
min-evictable-idle-time-millis: 300000
|
||||||
|
validation-query: SELECT 1 FROM DUAL
|
||||||
|
test-while-idle: true
|
||||||
|
test-on-borrow: false
|
||||||
|
test-on-return: false
|
||||||
|
filters: stat,wall
|
||||||
|
redis:
|
||||||
|
port: 8266 #redis 端口号 无密码
|
||||||
|
host: 39.108.110.167
|
||||||
|
password: 'Qiween@4531871' # 密码
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: -1
|
||||||
|
max-idle: 2000
|
||||||
|
max-wait: -1
|
||||||
|
min-idle: 1
|
||||||
|
time-between-eviction-runs: 50000
|
||||||
|
# mvc:
|
||||||
|
# view:
|
||||||
|
# prefix: classpath:/templates/
|
||||||
|
# suffix: .html
|
||||||
|
# mybatis-plus
|
||||||
|
mybatis-plus:
|
||||||
|
configuration:
|
||||||
|
map-underscore-to-camel-case: true
|
||||||
|
auto-mapping-behavior: full
|
||||||
|
mapper-locations: classpath*:mapper/**/*Mapper.xml
|
||||||
|
|
||||||
|
# 线程池
|
||||||
|
async:
|
||||||
|
executor:
|
||||||
|
thread:
|
||||||
|
core-pool-size: 6
|
||||||
|
max-pool-size: 12
|
||||||
|
queue-capacity: 100000
|
||||||
|
name-prefix: lottery-service-
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
swagger:
|
||||||
|
basePackage: com.xgl.lottery.controller
|
||||||
|
basic:
|
||||||
|
enable: true
|
||||||
|
password: 123
|
||||||
|
username: admin
|
||||||
|
contact:
|
||||||
|
email: ''
|
||||||
|
name: xu
|
||||||
|
url: ''
|
||||||
|
description: 平安银行项目接口文档
|
||||||
|
swaggerShow: true
|
||||||
|
title: 平安银行项目接口文档
|
||||||
|
|
||||||
|
|
||||||
|
aliyun:
|
||||||
|
accessKey: sSJ5t0yC1CaKhPJ4
|
||||||
|
accessSecret: PsbdUTexU95BkiqO4ADELXpIaYdWGk
|
||||||
|
oss:
|
||||||
|
bucketName: szxgl
|
||||||
|
endpoint: oss-cn-shenzhen.aliyuncs.com
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.xgl.lottery.mapper: debug
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 自定义配置
|
||||||
|
szxgl:
|
||||||
|
config:
|
||||||
|
testMode: false # 测试模式
|
||||||
|
redis_key_prefix: 'xfhd-wechat-third-party:' # Redis数据存储Key前缀
|
||||||
|
component_appid: wxc6f151a4f30269b0 # 微信第三方平台appid
|
||||||
|
component_appsecret: eb401ce905264932a84ec638a6b3ae1c # 微信第三方平台appsecret
|
||||||
|
component_token: Xfhd8NetSzxGl201A # 微信第三方平台公众号消息校验Token
|
||||||
|
component_aeskey: ZTJmMDMxZDQ4YmVmNGIyZjk4M2MyYjc1NTFjMDQ1MjM # 微信第三方平台公众号消息加解密Key
|
||||||
|
component_oauth_redirect_uri: https://wx.xfhd.net/thirdparty/auth/jump # 微信第三方平台授权回调URI (步骤2:引入用户进入授权页)
|
||||||
|
wx_oauth_redirect_uri: https://wx.xfhd.net/thirdparty/webauth/api/callback # 代公众号发起网页授权回调地址
|
||||||
|
timetask:
|
||||||
|
syncwxdata: 0 0 5 * * ? # 定期从微信服务器获取数据(每1分钟执行一次:0 0/1 * * * ?,凌晨5点执行:0 0 5 * * ?)
|
||||||
93
src/main/resources/application-prod.yml
Normal file
93
src/main/resources/application-prod.yml
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
server:
|
||||||
|
port: 8083 #端口号
|
||||||
|
servlet:
|
||||||
|
context-path: /employee-care
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
druid:
|
||||||
|
url: jdbc:mysql://rm-wz9vza84pe0hb338kbo.mysql.rds.aliyuncs.com:3306/employee_care?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&serverTimezone=GMT%2B8 #数据库端口号:3366 数据库名:lottery
|
||||||
|
username: root #数据库用户名
|
||||||
|
password: 'lyg8266@Qiween#com' #数据库密码
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
initial-size: 30
|
||||||
|
max-active: 100
|
||||||
|
min-idle: 10
|
||||||
|
max-wait: 60000
|
||||||
|
time-between-eviction-runs-millis: 60000
|
||||||
|
min-evictable-idle-time-millis: 300000
|
||||||
|
validation-query: SELECT 1 FROM DUAL
|
||||||
|
test-while-idle: true
|
||||||
|
test-on-borrow: false
|
||||||
|
test-on-return: false
|
||||||
|
filters: stat,wall
|
||||||
|
redis:
|
||||||
|
port: 19088 #redis 端口号 无密码
|
||||||
|
host: r-wz97jov3cc4roi3b1ppd.redis.rds.aliyuncs.com
|
||||||
|
password: Xfhd@2020 # 密码
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: -1
|
||||||
|
max-idle: 2000
|
||||||
|
max-wait: -1
|
||||||
|
min-idle: 1
|
||||||
|
time-between-eviction-runs: 50000
|
||||||
|
# mvc:
|
||||||
|
# view:
|
||||||
|
# prefix: classpath:/templates/
|
||||||
|
# suffix: .html
|
||||||
|
# mybatis-plus
|
||||||
|
mybatis-plus:
|
||||||
|
configuration:
|
||||||
|
map-underscore-to-camel-case: true
|
||||||
|
auto-mapping-behavior: full
|
||||||
|
mapper-locations: classpath*:mapper/**/*Mapper.xml
|
||||||
|
|
||||||
|
# 线程池
|
||||||
|
async:
|
||||||
|
executor:
|
||||||
|
thread:
|
||||||
|
core-pool-size: 6
|
||||||
|
max-pool-size: 12
|
||||||
|
queue-capacity: 100000
|
||||||
|
name-prefix: lottery-service-
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
swagger:
|
||||||
|
basePackage: com.xgl.lottery.controller
|
||||||
|
basic:
|
||||||
|
enable: true
|
||||||
|
password: 123
|
||||||
|
username: admin
|
||||||
|
contact:
|
||||||
|
email: ''
|
||||||
|
name: xu
|
||||||
|
url: ''
|
||||||
|
description: 平安银行项目接口文档
|
||||||
|
swaggerShow: true
|
||||||
|
title: 平安银行项目接口文档
|
||||||
|
|
||||||
|
|
||||||
|
aliyun:
|
||||||
|
accessKey: sSJ5t0yC1CaKhPJ4
|
||||||
|
accessSecret: PsbdUTexU95BkiqO4ADELXpIaYdWGk
|
||||||
|
oss:
|
||||||
|
bucketName: szxgl
|
||||||
|
endpoint: oss-cn-shenzhen.aliyuncs.com
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.xgl.lottery.mapper: debug
|
||||||
|
|
||||||
|
# 自定义配置
|
||||||
|
szxgl:
|
||||||
|
config:
|
||||||
|
testMode: false # 测试模式
|
||||||
|
redis_key_prefix: 'xfhd-wechat-third-party:' # Redis数据存储Key前缀
|
||||||
|
component_appid: wxc6f151a4f30269b0 # 微信第三方平台appid
|
||||||
|
component_appsecret: eb401ce905264932a84ec638a6b3ae1c # 微信第三方平台appsecret
|
||||||
|
component_token: Xfhd8NetSzxGl201A # 微信第三方平台公众号消息校验Token
|
||||||
|
component_aeskey: ZTJmMDMxZDQ4YmVmNGIyZjk4M2MyYjc1NTFjMDQ1MjM # 微信第三方平台公众号消息加解密Key
|
||||||
|
component_oauth_redirect_uri: https://wx.xfhd.net/thirdparty/auth/jump # 微信第三方平台授权回调URI (步骤2:引入用户进入授权页)
|
||||||
|
wx_oauth_redirect_uri: https://wx.xfhd.net/thirdparty/webauth/api/callback # 代公众号发起网页授权回调地址
|
||||||
|
timetask:
|
||||||
|
syncwxdata: 0 0 5 * * ? # 定期从微信服务器获取数据(每1分钟执行一次:0 0/1 * * * ?,凌晨5点执行:0 0 5 * * ?)
|
||||||
4
src/main/resources/application.yml
Normal file
4
src/main/resources/application.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
spring:
|
||||||
|
profiles:
|
||||||
|
active: dev
|
||||||
82
src/main/resources/log4j2-spring.xml
Normal file
82
src/main/resources/log4j2-spring.xml
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--Configuration后面的status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出-->
|
||||||
|
<!--monitorInterval:Log4j能够自动检测修改配置文件和重新配置本身,设置间隔秒数-->
|
||||||
|
<configuration monitorInterval="10">
|
||||||
|
<!--日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
|
||||||
|
|
||||||
|
<!--变量配置-->
|
||||||
|
<Properties>
|
||||||
|
<!-- 格式化输出:%date表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %msg:日志消息,%n是换行符-->
|
||||||
|
<!-- %logger{36} 表示 Logger 名字最长36个字符 -->
|
||||||
|
<property name="LOG_PATTERN" value="[employee-care]%date{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" />
|
||||||
|
<!-- 定义日志存储的路径,tomcat环境下用${sys:catalina.home},本地测试可定义到target目录下方便清理与忽略日志文件 -->
|
||||||
|
<property name="FILE_PATH" value="${sys:catalina.home}/logs/employee-care/" />
|
||||||
|
</Properties>
|
||||||
|
|
||||||
|
<appenders>
|
||||||
|
|
||||||
|
<console name="Console" target="SYSTEM_OUT">
|
||||||
|
<!--输出日志的格式-->
|
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||||
|
<!--控制台只输出level及其以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
|
||||||
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
</console>
|
||||||
|
|
||||||
|
<!--文件会打印出所有信息,这个log每次运行程序会自动清空,由append属性决定,适合临时测试用-->
|
||||||
|
<File name="Filelog" fileName="${sys:catalina.home}/logs/employee-care/test.log" append="false">
|
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||||
|
</File>
|
||||||
|
|
||||||
|
<!-- 这个会打印出所有的info及以下级别的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
|
||||||
|
<RollingFile name="RollingFileInfo" fileName="${sys:catalina.home}/logs/employee-care/info.log" filePattern="${FILE_PATH}/info-%d{yyyyMMdd}_%i.log.gz">
|
||||||
|
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
|
||||||
|
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||||
|
<Policies>
|
||||||
|
<!--interval属性用来指定多久滚动一次,默认是1 hour-->
|
||||||
|
<TimeBasedTriggeringPolicy interval="1"/>
|
||||||
|
<SizeBasedTriggeringPolicy size="30MB"/>
|
||||||
|
</Policies>
|
||||||
|
<!-- DefaultRolloverStrategy属性如不设置,则默认为最多同一文件夹下7个文件开始覆盖-->
|
||||||
|
<DefaultRolloverStrategy max="15"/>
|
||||||
|
</RollingFile>
|
||||||
|
|
||||||
|
<!-- 这个会打印出所有的error及以下级别的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
|
||||||
|
<RollingFile name="RollingFileError" fileName="${sys:catalina.home}/logs/employee-care/error.log" filePattern="${FILE_PATH}/error-%d{yyyyMMdd}_%i.log.gz">
|
||||||
|
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
|
||||||
|
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||||
|
<Policies>
|
||||||
|
<!--interval属性用来指定多久滚动一次,默认是1 hour-->
|
||||||
|
<TimeBasedTriggeringPolicy interval="1"/>
|
||||||
|
<SizeBasedTriggeringPolicy size="30MB"/>
|
||||||
|
</Policies>
|
||||||
|
<!-- DefaultRolloverStrategy属性如不设置,则默认为最多同一文件夹下7个文件开始覆盖-->
|
||||||
|
<DefaultRolloverStrategy max="15"/>
|
||||||
|
</RollingFile>
|
||||||
|
|
||||||
|
</appenders>
|
||||||
|
|
||||||
|
<!--Logger节点用来单独指定日志的形式,比如要为指定包下的class指定不同的日志级别等。-->
|
||||||
|
<!--然后定义loggers,只有定义了logger并引入的appender,appender才会生效-->
|
||||||
|
<loggers>
|
||||||
|
|
||||||
|
<!--过滤掉spring和mybatis的一些无用的DEBUG信息-->
|
||||||
|
<logger name="org.mybatis" level="info" additivity="false">
|
||||||
|
<AppenderRef ref="Console"/>
|
||||||
|
</logger>
|
||||||
|
<!--监控系统信息-->
|
||||||
|
<!--若是additivity设为false,则 子Logger 只会在自己的appender里输出,而不会在 父Logger 的appender里输出。-->
|
||||||
|
<Logger name="org.springframework" level="info" additivity="false">
|
||||||
|
<AppenderRef ref="Console"/>
|
||||||
|
</Logger>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="Console"/>
|
||||||
|
<appender-ref ref="Filelog"/>
|
||||||
|
<appender-ref ref="RollingFileInfo"/>
|
||||||
|
<appender-ref ref="RollingFileError"/>
|
||||||
|
</root>
|
||||||
|
</loggers>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
194
src/main/resources/mapper/ClockRecordMapper.xml
Normal file
194
src/main/resources/mapper/ClockRecordMapper.xml
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.xgl.lottery.mapper.ClockRecordMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.xgl.lottery.request.vo.ClockRecord">
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
|
<result column="openid" jdbcType="VARCHAR" property="openid" />
|
||||||
|
<result column="card_type" jdbcType="VARCHAR" property="cardType" />
|
||||||
|
<result column="photo" jdbcType="VARCHAR" property="photo" />
|
||||||
|
<result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" />
|
||||||
|
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
|
||||||
|
<result column="duration" jdbcType="BIGINT" property="duration" />
|
||||||
|
<result column="date" jdbcType="TIMESTAMP" property="date" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, openid, card_type, photo, begin_time, end_time, duration, date, create_time
|
||||||
|
</sql>
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from clock_record
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectHelp" resultType="com.xgl.lottery.request.vo.HelpRecord">
|
||||||
|
select id,openid,helpid,create_time from help_reord where openid=#{openid,jdbcType=VARCHAR} and helpid=#{helpid,jdbcType=VARCHAR} and create_time= #{createTime,jdbcType=VARCHAR} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAllByOpenid" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from clock_record
|
||||||
|
where openid = #{openid,jdbcType=VARCHAR} order by end_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="clockComplete" parameterType="java.lang.String" resultType="java.lang.String">
|
||||||
|
select date from clock_record where openid=#{openid,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByOpenid" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from clock_record WHERE DATEDIFF(date,NOW())=0
|
||||||
|
order by duration asc limit 15
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectByOpenidAll" resultType="com.xgl.lottery.request.vo.ClockRecord">
|
||||||
|
SELECT b.* from (
|
||||||
|
(SELECT openid from
|
||||||
|
clock_continue where num=5 GROUP BY openid) ) a
|
||||||
|
LEFT JOIN
|
||||||
|
(select
|
||||||
|
id,
|
||||||
|
openid,
|
||||||
|
card_type,
|
||||||
|
photo,
|
||||||
|
begin_time,
|
||||||
|
end_time,
|
||||||
|
duration,
|
||||||
|
date
|
||||||
|
from clock_record GROUP BY openid order by duration asc)b on a.openid=b.openid ORDER BY b.duration asc limit 100
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
|
delete from clock_record
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" parameterType="com.xgl.lottery.request.vo.ClockRecord">
|
||||||
|
insert into clock_record (id, openid, card_type,
|
||||||
|
photo, begin_time, end_time,
|
||||||
|
duration, date, create_time
|
||||||
|
)
|
||||||
|
values (#{id,jdbcType=INTEGER}, #{openid,jdbcType=VARCHAR}, #{cardType,jdbcType=VARCHAR},
|
||||||
|
#{photo,jdbcType=VARCHAR}, #{beginTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
|
||||||
|
#{duration,jdbcType=BIGINT}, #{date,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertHelp">
|
||||||
|
insert into help_reord (openid, helpid,
|
||||||
|
create_time
|
||||||
|
)
|
||||||
|
values (#{openid,jdbcType=VARCHAR}, #{helpid,jdbcType=VARCHAR}
|
||||||
|
, #{createTime,jdbcType=VARCHAR}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertSelective" parameterType="com.xgl.lottery.request.vo.ClockRecord">
|
||||||
|
insert into clock_record
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">
|
||||||
|
openid,
|
||||||
|
</if>
|
||||||
|
<if test="cardType != null">
|
||||||
|
card_type,
|
||||||
|
</if>
|
||||||
|
<if test="photo != null">
|
||||||
|
photo,
|
||||||
|
</if>
|
||||||
|
<if test="beginTime != null">
|
||||||
|
begin_time,
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null">
|
||||||
|
end_time,
|
||||||
|
</if>
|
||||||
|
<if test="duration != null">
|
||||||
|
duration,
|
||||||
|
</if>
|
||||||
|
<if test="date != null">
|
||||||
|
date,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
#{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">
|
||||||
|
#{openid,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="cardType != null">
|
||||||
|
#{cardType,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="photo != null">
|
||||||
|
#{photo,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="beginTime != null">
|
||||||
|
#{beginTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null">
|
||||||
|
#{endTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="duration != null">
|
||||||
|
#{duration,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="date != null">
|
||||||
|
#{date,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.xgl.lottery.request.vo.ClockRecord">
|
||||||
|
update clock_record
|
||||||
|
<set>
|
||||||
|
<if test="openid != null">
|
||||||
|
openid = #{openid,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="cardType != null">
|
||||||
|
card_type = #{cardType,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="photo != null">
|
||||||
|
photo = #{photo,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="beginTime != null">
|
||||||
|
begin_time = #{beginTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null">
|
||||||
|
end_time = #{endTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="duration != null">
|
||||||
|
duration = #{duration,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="date != null">
|
||||||
|
date = #{date,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.xgl.lottery.request.vo.ClockRecord">
|
||||||
|
update clock_record
|
||||||
|
set openid = #{openid,jdbcType=VARCHAR},
|
||||||
|
card_type = #{cardType,jdbcType=VARCHAR},
|
||||||
|
photo = #{photo,jdbcType=VARCHAR},
|
||||||
|
begin_time = #{beginTime,jdbcType=TIMESTAMP},
|
||||||
|
end_time = #{endTime,jdbcType=TIMESTAMP},
|
||||||
|
duration = #{duration,jdbcType=BIGINT},
|
||||||
|
date = #{date,jdbcType=TIMESTAMP},
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
158
src/main/resources/mapper/DrawNumMapper.xml
Normal file
158
src/main/resources/mapper/DrawNumMapper.xml
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.xgl.lottery.mapper.DrawNumMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.xgl.lottery.request.vo.DrawNum">
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
|
<result column="openid" jdbcType="VARCHAR" property="openid" />
|
||||||
|
<result column="share_id" jdbcType="VARCHAR" property="shareId" />
|
||||||
|
<result column="num" jdbcType="INTEGER" property="num" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, openid, share_id, num, create_time
|
||||||
|
</sql>
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from draw_num
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByOpenid" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from draw_num
|
||||||
|
where openid = #{openid,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
|
delete from draw_num
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" parameterType="com.xgl.lottery.request.vo.DrawNum">
|
||||||
|
insert into draw_num (id, openid, share_id,
|
||||||
|
num, create_time)
|
||||||
|
values (#{id,jdbcType=INTEGER}, #{openid,jdbcType=VARCHAR}, #{shareId,jdbcType=VARCHAR},
|
||||||
|
#{num,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertClockContinue" parameterType="com.xgl.lottery.request.vo.ClockContinue">
|
||||||
|
insert into clock_continue (id, openid, record_time,
|
||||||
|
num, create_time)
|
||||||
|
values (#{id,jdbcType=INTEGER}, #{openid,jdbcType=VARCHAR}, #{record_time,jdbcType=VARCHAR},
|
||||||
|
#{num,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" parameterType="com.xgl.lottery.request.vo.DrawNum">
|
||||||
|
insert into draw_num
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">
|
||||||
|
openid,
|
||||||
|
</if>
|
||||||
|
<if test="shareId != null">
|
||||||
|
share_id,
|
||||||
|
</if>
|
||||||
|
<if test="num != null">
|
||||||
|
num,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
#{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">
|
||||||
|
#{openid,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="shareId != null">
|
||||||
|
#{shareId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="num != null">
|
||||||
|
#{num,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.xgl.lottery.request.vo.DrawNum">
|
||||||
|
update draw_num
|
||||||
|
<set>
|
||||||
|
<if test="openid != null">
|
||||||
|
openid = #{openid,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="shareId != null">
|
||||||
|
share_id = #{shareId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="num != null">
|
||||||
|
num = #{num,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateByOpenid" >
|
||||||
|
update draw_num
|
||||||
|
set
|
||||||
|
num = num+ #{num,jdbcType=INTEGER}
|
||||||
|
where openid = #{openid,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.xgl.lottery.request.vo.DrawNum">
|
||||||
|
update draw_num
|
||||||
|
set openid = #{openid,jdbcType=VARCHAR},
|
||||||
|
share_id = #{shareId,jdbcType=VARCHAR},
|
||||||
|
num = #{num,jdbcType=INTEGER},
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<update id="updateByOpenidSpentAll" >
|
||||||
|
update draw_num
|
||||||
|
set
|
||||||
|
num = 0
|
||||||
|
where openid = #{openid,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<update id="updateByOpenidSpentOne" >
|
||||||
|
update draw_num
|
||||||
|
set
|
||||||
|
num = num- #{num,jdbcType=INTEGER}
|
||||||
|
where openid = #{openid,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateByShareId" parameterType="java.lang.String">
|
||||||
|
update draw_num
|
||||||
|
set
|
||||||
|
num = num+1
|
||||||
|
where share_id = #{shareId,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectByOpenidAndTime" resultType="com.xgl.lottery.request.vo.ClockContinue">
|
||||||
|
select
|
||||||
|
openid,record_time,num
|
||||||
|
from clock_continue
|
||||||
|
where openid = #{openid,jdbcType=VARCHAR} and record_time= #{record_time,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
|
<update id="updateClockContinue">
|
||||||
|
update clock_continue
|
||||||
|
set record_time = #{record_time,jdbcType=VARCHAR},
|
||||||
|
num = #{num,jdbcType=INTEGER}
|
||||||
|
where openid = #{openid,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
<update id="updateClockContinueadd">
|
||||||
|
update clock_continue
|
||||||
|
set record_time = #{record_time,jdbcType=VARCHAR},
|
||||||
|
num =num +#{num,jdbcType=INTEGER}
|
||||||
|
where openid = #{openid,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
93
src/main/resources/mapper/LotteryRecordMapper.xml
Normal file
93
src/main/resources/mapper/LotteryRecordMapper.xml
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.xgl.lottery.mapper.LotteryRecordMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.xgl.lottery.request.vo.LotteryRecord">
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
|
<result column="account_ip" jdbcType="VARCHAR" property="accountIp" />
|
||||||
|
<result column="item_id" jdbcType="INTEGER" property="itemId" />
|
||||||
|
<result column="prize_name" jdbcType="VARCHAR" property="prizeName" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, account_ip, item_id, prize_name, create_time
|
||||||
|
</sql>
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from lottery_record
|
||||||
|
where account_ip = #{openid,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
|
delete from lottery_record
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" parameterType="com.xgl.lottery.request.vo.LotteryRecord">
|
||||||
|
insert into lottery_record (id, account_ip, item_id,
|
||||||
|
prize_name, create_time)
|
||||||
|
values (#{id,jdbcType=INTEGER}, #{accountIp,jdbcType=VARCHAR}, #{itemId,jdbcType=INTEGER},
|
||||||
|
#{prizeName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" parameterType="com.xgl.lottery.request.vo.LotteryRecord">
|
||||||
|
insert into lottery_record
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="accountIp != null">
|
||||||
|
account_ip,
|
||||||
|
</if>
|
||||||
|
<if test="itemId != null">
|
||||||
|
item_id,
|
||||||
|
</if>
|
||||||
|
<if test="prizeName != null">
|
||||||
|
prize_name,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
#{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="accountIp != null">
|
||||||
|
#{accountIp,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="itemId != null">
|
||||||
|
#{itemId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="prizeName != null">
|
||||||
|
#{prizeName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.xgl.lottery.request.vo.LotteryRecord">
|
||||||
|
update lottery_record
|
||||||
|
<set>
|
||||||
|
<if test="accountIp != null">
|
||||||
|
account_ip = #{accountIp,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="itemId != null">
|
||||||
|
item_id = #{itemId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="prizeName != null">
|
||||||
|
prize_name = #{prizeName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.xgl.lottery.request.vo.LotteryRecord">
|
||||||
|
update lottery_record
|
||||||
|
set account_ip = #{accountIp,jdbcType=VARCHAR},
|
||||||
|
item_id = #{itemId,jdbcType=INTEGER},
|
||||||
|
prize_name = #{prizeName,jdbcType=VARCHAR},
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
102
src/main/resources/mapper/LotteryUserRecordMapper.xml
Normal file
102
src/main/resources/mapper/LotteryUserRecordMapper.xml
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.xgl.lottery.mapper.LotteryUserRecordMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.xgl.lottery.request.vo.LotteryRecord">
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
|
<result column="account_ip" jdbcType="VARCHAR" property="accountIp" />
|
||||||
|
<result column="item_id" jdbcType="INTEGER" property="itemId" />
|
||||||
|
<result column="prize_name" jdbcType="VARCHAR" property="prizeName" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, account_ip, item_id, prize_name, create_time
|
||||||
|
</sql>
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from lottery_record
|
||||||
|
where account_ip = #{openid,jdbcType=VARCHAR} and item_id !=8 order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectByLettery" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from lottery_record
|
||||||
|
where account_ip = #{openid,jdbcType=VARCHAR} and item_id !=8 and lottery_type!=2 order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
|
delete from lottery_record
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" parameterType="com.xgl.lottery.request.vo.LotteryRecord">
|
||||||
|
insert into lottery_record (id, account_ip, item_id,
|
||||||
|
prize_name, create_time)
|
||||||
|
values (#{id,jdbcType=INTEGER}, #{accountIp,jdbcType=VARCHAR}, #{itemId,jdbcType=INTEGER},
|
||||||
|
#{prizeName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" parameterType="com.xgl.lottery.request.vo.LotteryRecord">
|
||||||
|
insert into lottery_record
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="accountIp != null">
|
||||||
|
account_ip,
|
||||||
|
</if>
|
||||||
|
<if test="itemId != null">
|
||||||
|
item_id,
|
||||||
|
</if>
|
||||||
|
<if test="prizeName != null">
|
||||||
|
prize_name,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
#{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="accountIp != null">
|
||||||
|
#{accountIp,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="itemId != null">
|
||||||
|
#{itemId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="prizeName != null">
|
||||||
|
#{prizeName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.xgl.lottery.request.vo.LotteryRecord">
|
||||||
|
update lottery_record
|
||||||
|
<set>
|
||||||
|
<if test="accountIp != null">
|
||||||
|
account_ip = #{accountIp,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="itemId != null">
|
||||||
|
item_id = #{itemId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="prizeName != null">
|
||||||
|
prize_name = #{prizeName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.xgl.lottery.request.vo.LotteryRecord">
|
||||||
|
update lottery_record
|
||||||
|
set account_ip = #{accountIp,jdbcType=VARCHAR},
|
||||||
|
item_id = #{itemId,jdbcType=INTEGER},
|
||||||
|
prize_name = #{prizeName,jdbcType=VARCHAR},
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
117
src/main/resources/mapper/ReceivingAddressMapper.xml
Normal file
117
src/main/resources/mapper/ReceivingAddressMapper.xml
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.xgl.lottery.mapper.ReceivingAddressMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.xgl.lottery.request.vo.ReceivingAddress">
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
|
<result column="openid" jdbcType="VARCHAR" property="openid" />
|
||||||
|
<result column="link_name" jdbcType="VARCHAR" property="linkName" />
|
||||||
|
<result column="link_phone" jdbcType="VARCHAR" property="linkPhone" />
|
||||||
|
<result column="address" jdbcType="VARCHAR" property="address" />
|
||||||
|
<result column="address_detail" jdbcType="VARCHAR" property="addressDetail" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, openid, link_name, link_phone, address, address_detail, create_time
|
||||||
|
</sql>
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from receiving_address
|
||||||
|
where openid = #{openid,jdbcType=VARCHAR} limit 1
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
|
delete from receiving_address
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" parameterType="com.xgl.lottery.request.vo.ReceivingAddress">
|
||||||
|
insert into receiving_address (id, openid, link_name,
|
||||||
|
link_phone, address, address_detail,
|
||||||
|
create_time)
|
||||||
|
values (#{id,jdbcType=INTEGER}, #{openid,jdbcType=VARCHAR}, #{linkName,jdbcType=VARCHAR},
|
||||||
|
#{linkPhone,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{addressDetail,jdbcType=VARCHAR},
|
||||||
|
#{createTime,jdbcType=TIMESTAMP})
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" parameterType="com.xgl.lottery.request.vo.ReceivingAddress">
|
||||||
|
insert into receiving_address
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">
|
||||||
|
openid,
|
||||||
|
</if>
|
||||||
|
<if test="linkName != null">
|
||||||
|
link_name,
|
||||||
|
</if>
|
||||||
|
<if test="linkPhone != null">
|
||||||
|
link_phone,
|
||||||
|
</if>
|
||||||
|
<if test="address != null">
|
||||||
|
address,
|
||||||
|
</if>
|
||||||
|
<if test="addressDetail != null">
|
||||||
|
address_detail,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
#{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">
|
||||||
|
#{openid,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="linkName != null">
|
||||||
|
#{linkName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="linkPhone != null">
|
||||||
|
#{linkPhone,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="address != null">
|
||||||
|
#{address,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="addressDetail != null">
|
||||||
|
#{addressDetail,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.xgl.lottery.request.vo.ReceivingAddress">
|
||||||
|
update receiving_address
|
||||||
|
<set>
|
||||||
|
<if test="openid != null">
|
||||||
|
openid = #{openid,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="linkName != null">
|
||||||
|
link_name = #{linkName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="linkPhone != null">
|
||||||
|
link_phone = #{linkPhone,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="address != null">
|
||||||
|
address = #{address,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="addressDetail != null">
|
||||||
|
address_detail = #{addressDetail,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.xgl.lottery.request.vo.ReceivingAddress">
|
||||||
|
update receiving_address
|
||||||
|
set openid = #{openid,jdbcType=VARCHAR},
|
||||||
|
link_name = #{linkName,jdbcType=VARCHAR},
|
||||||
|
link_phone = #{linkPhone,jdbcType=VARCHAR},
|
||||||
|
address = #{address,jdbcType=VARCHAR},
|
||||||
|
address_detail = #{addressDetail,jdbcType=VARCHAR},
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user