| | |
| | | <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.slf4j:jul-to-slf4j:1.7.30" level="project" /> |
| | | <orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.11.RELEASE" level="project" /> |
| | |
| | | <orderEntry type="library" name="Maven: cn.hutool:hutool-all:4.5.6" 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="module" module-name="mb-cloud-competition" /> |
| | | <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.13" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.gavaghan:geodesy:1.1.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-jdbc-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-transaction-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-transaction-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-infra-executor:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.vertx:vertx-mysql-client:4.2.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.vertx:vertx-core:4.2.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.netty:netty-handler-proxy:4.1.54.Final" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.netty:netty-codec-socks:4.1.54.Final" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.netty:netty-codec-http:4.1.54.Final" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.netty:netty-codec-http2:4.1.54.Final" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.netty:netty-resolver-dns:4.1.54.Final" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.netty:netty-codec-dns:4.1.54.Final" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.vertx:vertx-sql-client:4.2.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sql-parser-sql92:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sql-parser-engine:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sql-parser-spi:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sql-parser-statement:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.github.ben-manes.caffeine:caffeine:2.8.6" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.checkerframework:checker-qual:3.7.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.4.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sql-parser-mysql:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sql-parser-postgresql:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sql-parser-oracle:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sql-parser-sqlserver:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sql-parser-opengauss:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-authority-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-authority-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-single-table-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-single-table-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-infra-route:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-traffic-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-infra-common:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-infra-util:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.groovy:groovy:4.0.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-infra-binder:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-dialect-exception-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-traffic-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-infra-context:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-distsql-parser:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-distsql-statement:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sql-translator-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sql-translator-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-standalone-mode-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-mode-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-schedule-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-lite-core:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-api:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-infra-common:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-registry-center:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-simple-executor:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-executor-kernel:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-error-handler-general:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-error-handler-spi:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-dataflow-executor:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-script-executor:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.commons:commons-exec:1.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-http-executor:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-tracing-rdb:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-tracing-api:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere.elasticjob:elasticjob-lite-lifecycle:3.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-standalone-mode-repository-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-standalone-mode-repository-jdbc-h2:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-standalone-mode-repository-jdbc-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-cluster-mode-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-cluster-mode-repository-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sharding-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sharding-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-data-pipeline-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-data-pipeline-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-cluster-mode-repository-zookeeper-curator:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.curator:curator-framework:4.0.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.curator:curator-client:5.1.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.6.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper-jute:3.6.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.yetus:audience-annotations:0.5.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.netty:netty-transport-native-epoll:4.1.54.Final" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.netty:netty-transport-native-unix-common:4.1.54.Final" level="project" /> |
| | | <orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.curator:curator-recipes:2.12.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-infra-rewrite:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sql-translator-native-provider:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-infra-merge:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.calcite:calcite-linq4j:1.31.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.calcite.avatica:avatica-core:1.22.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.calcite.avatica:avatica-metrics:1.22.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.5.1" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.httpcomponents.client5:httpclient5:5.1.3" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.httpcomponents.core5:httpcore5-h2:5.1.3" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.httpcomponents.core5:httpcore5:5.1.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-system-datetime:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-infra-datetime-spi:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sharding-cosid:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: me.ahoo.cosid:cosid-core:1.14.4" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-sharding-nanoid:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.aventrix.jnanoid:jnanoid:2.0.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-readwrite-splitting-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-readwrite-splitting-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-db-discovery-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-db-discovery-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-db-discovery-mysql:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-db-discovery-opengauss:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-encrypt-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-encrypt-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-encrypt-sm:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-shadow-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-shadow-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-infra-federation-executor:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-infra-federation-optimizer:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.calcite:calcite-core:1.31.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.esri.geometry:esri-geometry-api:2.2.0" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.3" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: com.google.uzaygezen:uzaygezen-core:0.2" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: com.yahoo.datasketches:sketches-core:0.9.0" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: com.yahoo.datasketches:memory:0.9.0" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: net.hydromatic:aggdesigner-algorithm:6.0" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.commons:commons-dbcp2:2.7.0" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: org.codehaus.janino:commons-compiler:3.1.2" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: org.codehaus.janino:janino:3.1.2" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-parser-core:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-parser-api:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.shardingsphere:shardingsphere-infra-parser:5.2.0" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: com.h2database:h2:1.4.200" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.30" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" /> |
| | | <orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.alipay.sdk:alipay-sdk-java:4.8.10.ALL" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.62" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:2.2.1.RELEASE" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-client:1.2.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-common:1.2.1" level="project" /> |
| | |
| | | <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:2.2.6.RELEASE" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.9.RELEASE" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.59" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.59" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-ribbon:2.2.6.RELEASE" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-archaius:2.2.6.RELEASE" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-archaius:2.2.6.RELEASE" level="project" /> |
| | |
| | | <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.3.6.RELEASE" level="project" /> |
| | | <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.3.6.RELEASE" level="project" /> |
| | | <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.3.6.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="RUNTIME" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: net.minidev:json-smart:2.3" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: net.minidev:accessors-smart:1.2" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" 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.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" 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: org.mockito:mockito-core:3.3.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.18" level="project" /> |
| | |
| | | <artifactId>jaxb-api</artifactId> |
| | | <version>2.3.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>cn.mb.cloud</groupId> |
| | | <artifactId>mb-cloud-competition</artifactId> |
| | | <version>1.1.3</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
New file |
| | |
| | | package com.dsh.course.advice; |
| | | |
| | | import cn.mb.cloud.common.core.constant.enums.ErrorCodeConstants; |
| | | import cn.mb.cloud.common.core.exception.BusinessException; |
| | | import cn.mb.cloud.common.core.util.ResponseData; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @Slf4j |
| | | @RestControllerAdvice |
| | | public class ControllerException { |
| | | |
| | | @ExceptionHandler(BusinessException.class) |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ResponseBody |
| | | public ResponseData bussiness(BusinessException e) { |
| | | log.error("业务异常 message= " + e.getMessage() + " code= " + e.getErrorCode(), e); |
| | | return ResponseData.builder().code(ErrorCodeConstants.FAIL.getValue()). |
| | | msg(e.getMessage()).build(); |
| | | } |
| | | |
| | | @ExceptionHandler(RuntimeException.class) |
| | | @ResponseStatus(HttpStatus.OK) |
| | | @ResponseBody |
| | | public ResponseData runtimeException(RuntimeException e) { |
| | | log.error("运行时异常信息" + e.getMessage(), e); |
| | | return ResponseData.builder().code(ErrorCodeConstants.FAIL.getValue()).msg(e.getMessage()).build(); |
| | | } |
| | | |
| | | /** |
| | | * 全局异常. |
| | | * |
| | | * @param e the e |
| | | * @return R |
| | | */ |
| | | |
| | | @ExceptionHandler(Exception.class) |
| | | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) |
| | | @ResponseBody |
| | | public ResponseData exception(Exception e) { |
| | | log.error("全局异常信息" + e.getMessage(), e); |
| | | return ResponseData.fail(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 平台协议 |
| | | */ |
| | | @Data |
| | | @TableName("t_agreement") |
| | | public class Agreement extends BaseBean { |
| | | /** |
| | | * 使用范围(1=用户,2=司机) |
| | | */ |
| | | @TableField("useType") |
| | | private Integer useType; |
| | | /** |
| | | * 协议内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 类型(1:隐私协议,2:用户协议,3:用户指南,4:法律条款,5:关于我们,6=注册协议,7=取消订单说明,8=充值领券规则设置,9=司机注册协议,10=改派说明,11=跨城出行乘车须知,12:常见问题,13:计价规则,14:包车协议,15:小件物流协议) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class BaseBean { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 1:正常,2:停用,3:删除 |
| | | */ |
| | | @TableField("flag") |
| | | private Integer flag; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | /** |
| | | * 添加人员 |
| | | */ |
| | | @TableField("insertUser") |
| | | private Integer insertUser; |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @TableField("updateTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @TableField("updateUser") |
| | | private Integer updateUser; |
| | | |
| | | public BaseBean() { |
| | | Date date = new Date(); |
| | | this.flag = 1; |
| | | this.insertTime = date; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 取消订单设置 |
| | | */ |
| | | @Data |
| | | @TableName("t_sys_cancle_order") |
| | | public class CancleOrder { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | /** |
| | | * 时间(分钟) |
| | | */ |
| | | @TableField("minuteNum") |
| | | private Integer minuteNum; |
| | | /** |
| | | * 金额 |
| | | */ |
| | | @TableField("money") |
| | | private Double money; |
| | | /** |
| | | * 类型(1=取消,2=预约取消) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 订单类型(1=专车) |
| | | */ |
| | | @TableField("orderType") |
| | | private Integer orderType; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 车辆 |
| | | */ |
| | | @Data |
| | | @TableName("t_car") |
| | | public class Car { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 是否是平台车辆(1=是,2=否) 1:Y 2:N |
| | | */ |
| | | @TableField("isPlatCar") |
| | | private Integer isPlatCar; |
| | | /** |
| | | * 公司id |
| | | */ |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | /** |
| | | * 加盟商id |
| | | */ |
| | | @TableField("franchiseeId") |
| | | private Integer franchiseeId; |
| | | /** |
| | | * 车辆颜色 |
| | | */ |
| | | @TableField("carColor") |
| | | private String carColor; |
| | | /** |
| | | * 车型id |
| | | */ |
| | | @TableField("carModelId") |
| | | private Integer carModelId; |
| | | /** |
| | | * 车辆品牌id |
| | | */ |
| | | @TableField("carBrandId") |
| | | private Integer carBrandId; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | | @TableField("carLicensePlate") |
| | | private String carLicensePlate; |
| | | /** |
| | | * 车辆照片 |
| | | */ |
| | | @TableField("carPhoto") |
| | | private String carPhoto; |
| | | /** |
| | | * 行驶证号 |
| | | */ |
| | | @TableField("drivingLicenseNumber") |
| | | private String drivingLicenseNumber; |
| | | /** |
| | | * 行驶证照片 |
| | | */ |
| | | @TableField("drivingLicensePhoto") |
| | | private String drivingLicensePhoto; |
| | | /** |
| | | * 年检到期时间 |
| | | */ |
| | | @TableField("annualInspectionTime") |
| | | private Date annualInspectionTime; |
| | | /** |
| | | * 保险照片 |
| | | */ |
| | | @TableField("insurancePhoto") |
| | | private String insurancePhoto; |
| | | /** |
| | | * 商业保险到期时间 |
| | | */ |
| | | @TableField("commercialInsuranceTime") |
| | | private Date commercialInsuranceTime; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 状态(1=正常,2=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加来源(1=司机注册 2=平台添加 3=分公司添加 4=加盟商添加) |
| | | * (1=Driver Registration 2=Platform Addition 3=Branch Office Addition 4=Franchisee Addition) |
| | | */ |
| | | @TableField("addType") |
| | | private Integer addType; |
| | | /** |
| | | * 公司id |
| | | */ |
| | | @TableField("addObjectId") |
| | | private Integer addObjectId; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 车辆品牌 |
| | | */ |
| | | @Data |
| | | @TableName("t_car_brand") |
| | | public class CarBrand { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 图片 |
| | | */ |
| | | @TableField("imgUrl") |
| | | private String imgUrl; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @TableField("remark") |
| | | private String remark; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 状态(1=正常,2=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 车辆型号 |
| | | */ |
| | | @Data |
| | | @TableName("t_car_model") |
| | | public class CarModel { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @TableField("remark") |
| | | private String remark; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 状态(1=正常,2=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 座位数 |
| | | */ |
| | | @TableField("seat") |
| | | private Integer seat; |
| | | /** |
| | | * 车辆品牌id |
| | | */ |
| | | @TableField("brandId") |
| | | private Integer brandId; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 车辆服务 |
| | | */ |
| | | @Data |
| | | @TableName("t_car_service") |
| | | public class CarService { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 车辆id |
| | | */ |
| | | @TableField("carId") |
| | | private Integer carId; |
| | | /** |
| | | * 服务类型(1=专车,4=小件物流-同城) |
| | | Business types: (1=private car, 4=courier-same city) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 服务车型id |
| | | */ |
| | | @TableField("serverCarModelId") |
| | | private Integer serverCarModelId; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 城市 |
| | | */ |
| | | @Data |
| | | @TableName("t_city") |
| | | public class City { |
| | | //主键 |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | //中文名称 |
| | | @TableField("chineseName") |
| | | private String chineseName; |
| | | //英文名称 |
| | | @TableField("englishName") |
| | | private String englishName; |
| | | //印尼文名称 |
| | | @TableField("indonesianName") |
| | | private String indonesianName; |
| | | @TableField("pid") |
| | | private Integer pid; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("t_hot_address") |
| | | public class HotAddress { |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | |
| | | @TableField("cityId") |
| | | private Integer cityId; |
| | | |
| | | private String name; |
| | | |
| | | private String address; |
| | | |
| | | private Double lon; |
| | | |
| | | private Double lat; |
| | | |
| | | private Integer hide; |
| | | |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("t_img") |
| | | public class Img { |
| | | //主键 |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | //图片类型(1=启动页,2=引导页,3=icon) |
| | | @TableField("type") |
| | | private Integer type; |
| | | //应用端口(1用户端,2=司机端) |
| | | @TableField("usePort") |
| | | private Integer usePort; |
| | | //名称 |
| | | @TableField("name") |
| | | private String name; |
| | | //图片地址 |
| | | @TableField("url") |
| | | private String url; |
| | | //排序 |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | //状态(1=正常,2=冻结,3=删除)1:normal 2:freeze 3:delete |
| | | @TableField("state") |
| | | private Integer state; |
| | | //添加时间 |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 车辆型号 |
| | | */ |
| | | @Data |
| | | @TableName("t_server_carmodel") |
| | | public class MotorModel { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("img") |
| | | private String img; |
| | | /** |
| | | * 状态(1=正常,2=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | @TableField("language") |
| | | private Integer language; |
| | | @TableField("ename") |
| | | private String ename; |
| | | @TableField("yname") |
| | | private String yname; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 开通城市 |
| | | */ |
| | | @Data |
| | | @TableName("t_open_city") |
| | | public class OpenCity extends BaseBean { |
| | | /** |
| | | * 城市编号(行政编号) |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @TableField("lon") |
| | | private Double lon; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @TableField("lat") |
| | | private Double lat; |
| | | /** |
| | | * 是否需要网约车资格(1:是,2:否) |
| | | */ |
| | | @TableField("isQualifications") |
| | | private Integer isQualifications; |
| | | /** |
| | | * 省名称 |
| | | */ |
| | | @TableField("areaName") |
| | | private String areaName; |
| | | /** |
| | | * 市名称 |
| | | */ |
| | | @TableField("cityName") |
| | | private String cityName; |
| | | /** |
| | | * 区县名称 |
| | | */ |
| | | @TableField("provinceName") |
| | | private String provinceName; |
| | | @TableField("cityId") |
| | | private Integer cityId; |
| | | @TableField("areaId") |
| | | private Integer areaId; |
| | | @TableField("chineseName") |
| | | private String chineseName; |
| | | @TableField("englishName") |
| | | private String englishName; |
| | | @TableField("indonesianName") |
| | | private String indonesianName; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 开通城市业务类型 |
| | | */ |
| | | @Data |
| | | @TableName("t_open_city_business") |
| | | public class OpenCityBusiness extends BaseBean { |
| | | /** |
| | | * 业务类型(1=专车,4=同城小件物流) |
| | | */ |
| | | @TableField("businessType") |
| | | private Integer businessType; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 系统电话 |
| | | */ |
| | | @Data |
| | | @TableName("t_phone") |
| | | public class Phone { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1:报警电话,2:投诉电话) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 是否是平台数据(1=是,2=否) 1:Y 2:N |
| | | */ |
| | | @TableField("platform") |
| | | private Integer platform; |
| | | /** |
| | | * 电话 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 在线客服 |
| | | */ |
| | | @Data |
| | | @TableName("t_problem") |
| | | public class Problem { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 提问内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 回答内容 |
| | | */ |
| | | @TableField("answer") |
| | | private String answer; |
| | | /** |
| | | * 处理人 |
| | | */ |
| | | @TableField("handleUserId") |
| | | private Integer handleUserId; |
| | | /** |
| | | * 处理时间 |
| | | */ |
| | | @TableField("handleTime") |
| | | private Date handleTime; |
| | | /** |
| | | * 提问时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 状态(1=待处理,2=已处理) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 推单设置 |
| | | */ |
| | | @Data |
| | | @TableName("t_sys_push_order") |
| | | public class PushOrder { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | /** |
| | | * 推单距离(公里) |
| | | */ |
| | | @TableField("pushDistance") |
| | | private Double pushDistance; |
| | | /** |
| | | * 推单时间(秒) |
| | | */ |
| | | @TableField("pushTime") |
| | | private Integer pushTime; |
| | | /** |
| | | * 推单占所有司机百分比 |
| | | */ |
| | | @TableField("driverProportion") |
| | | private Double driverProportion; |
| | | /** |
| | | * 推单次数(1=第一轮,2=第二轮,3=第三轮) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 推单单据类型(1=专车) |
| | | */ |
| | | @TableField("pushType") |
| | | private Integer pushType; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 敏感词 |
| | | */ |
| | | @Data |
| | | @TableName("t_sys_sensitive_words") |
| | | public class SensitiveWords { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 服务车型设置 |
| | | */ |
| | | @Data |
| | | @TableName("t_server_carmodel") |
| | | public class ServerCarModel { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 业务类型(1=专车)1 = Special vehicle |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 车型名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 车型照片 |
| | | */ |
| | | @TableField("img") |
| | | private String img; |
| | | /** |
| | | * 包车价格(100-300) |
| | | */ |
| | | @TableField("price") |
| | | private String price; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) 1:normal 2:freeze 3:delete |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 系统积分设置 |
| | | */ |
| | | @Data |
| | | @TableName("t_sys_integral") |
| | | public class SysIntegral { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | /** |
| | | * 积分 |
| | | */ |
| | | @TableField("integral") |
| | | private Integer integral; |
| | | |
| | | /** |
| | | * 积分设置 |
| | | */ |
| | | @TableField(value = "content") |
| | | private String content; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 系统通知 |
| | | */ |
| | | @Data |
| | | @TableName("t_system_notice") |
| | | public class SystemNotice { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 类型(1=公告,2=系统消息) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 系统消息类型(1=打车业务,2=优惠券) |
| | | */ |
| | | @TableField("noticeType") |
| | | private Integer noticeType; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 公告id |
| | | */ |
| | | @TableField("noticesId") |
| | | private Integer noticesId; |
| | | /** |
| | | * 消息内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 接收对象id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 阅读状态(1=未读,2=已读) |
| | | */ |
| | | @TableField("read") |
| | | private Integer read; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 服务价格规则 |
| | | */ |
| | | @Data |
| | | @TableName("t_system_price") |
| | | public class SystemPrice { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 业务类型(1=专车,4=小件物流-同城) |
| | | Business types: (1=private car, 4=courier-same city) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | /** |
| | | * 服务车型设置 |
| | | */ |
| | | @TableField("serverCarModelId") |
| | | private Integer serverCarModelId; |
| | | /** |
| | | * 价格规则,每个输入框为一个参数{"num1":1,"num2":2.3} |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | |
| | | @TableField("orderType") |
| | | private Integer orderType; |
| | | @TableField("cityId") |
| | | private Integer cityId; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 通知 |
| | | */ |
| | | @Data |
| | | @TableName("t_notices") |
| | | public class TNotices extends BaseBean { |
| | | /** |
| | | * 标题 |
| | | */ |
| | | @TableField("title") |
| | | private String title; |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 是否显示/发布(1=是,2=否) 1:Y 2:N |
| | | */ |
| | | @TableField("isShow") |
| | | private Integer isShow; |
| | | /** |
| | | * 是否播报(1=是,2=否) 1:Y 2:N |
| | | */ |
| | | @TableField("isBroadcast") |
| | | private Integer isBroadcast; |
| | | /** |
| | | * 公告类型(1=滚动消息,2=公告) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 图片地址 |
| | | */ |
| | | @TableField("imgUrl") |
| | | private String imgUrl; |
| | | /** |
| | | * 是否删除(1=否,2=是)1:N,2:Y |
| | | * @return |
| | | */ |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | /** |
| | | * 是否发布用户(1=否,2=是)1:N,2:Y |
| | | * @return |
| | | */ |
| | | @TableField("isUser") |
| | | private Integer isUser; |
| | | /** |
| | | * 是否发布司机(1=否,2=是)1:N,2:Y |
| | | * @return |
| | | */ |
| | | @TableField("isDriver") |
| | | private Integer isDriver; |
| | | @TableField("language") |
| | | private Integer language; |
| | | } |
New file |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 版本管理 |
| | | */ |
| | | @Data |
| | | @TableName("t_version_management") |
| | | public class VersionManagement { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 包路径 |
| | | */ |
| | | @TableField("url") |
| | | private String url; |
| | | /** |
| | | * 版本号 |
| | | */ |
| | | @TableField("version") |
| | | private String version; |
| | | /** |
| | | * 更新说明 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 是否强制更新(0=否,1=是) |
| | | */ |
| | | @TableField("mandatory") |
| | | private Integer mandatory; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | /** |
| | | * 类型(1=用户端,2=司机端) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.auth; |
| | | |
| | | import com.dsh.course.feignClient.auth.model.GetTokenRequest; |
| | | import com.dsh.course.feignClient.auth.model.RefreshTokenRequest; |
| | | import com.dsh.course.feignClient.auth.model.TokenResponse; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | @FeignClient("mb-cloud-auth") |
| | | public interface UserClient { |
| | | |
| | | /** |
| | | * 获取登录token |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @PostMapping("/oauth/getToken") |
| | | TokenResponse getToken(GetTokenRequest request); |
| | | |
| | | |
| | | /** |
| | | * 刷新登录token |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @PostMapping("/oauth/refreshToken") |
| | | TokenResponse refreshToken(RefreshTokenRequest request); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.auth.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class GetTokenRequest { |
| | | /** |
| | | * 用户名 |
| | | */ |
| | | private String username; |
| | | /** |
| | | * 密码 |
| | | */ |
| | | private String password; |
| | | /** |
| | | * 存储对象 |
| | | */ |
| | | private Object object; |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.auth.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class RefreshTokenRequest { |
| | | /** |
| | | * 原始token |
| | | */ |
| | | private String token; |
| | | /** |
| | | * 刷新令牌凭证 |
| | | */ |
| | | private String refresh_token; |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.auth.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class TokenResponse { |
| | | /** |
| | | * token |
| | | */ |
| | | private String token; |
| | | /** |
| | | * 刷新token的凭证 |
| | | */ |
| | | private String refresh_token; |
| | | /** |
| | | * 过期时间 |
| | | */ |
| | | private Long expiration_time; |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.course; |
| | | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/29 10:09 |
| | | */ |
| | | @FeignClient("mb-cloud-course") |
| | | public interface CourseClient { |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.CarBrand; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface CarBrandMapper extends BaseMapper<CarBrand> { |
| | | |
| | | |
| | | |
| | | List<Map<String, Object>> queryAllBrand(@Param("language") Integer language); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.guns.modular.system.model.CarInsurance; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface CarInsuranceMapper extends BaseMapper<CarInsurance> { |
| | | |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @param carId |
| | | * @param offset |
| | | * @param limit |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryInsuranceList(@Param("carId") Integer carId, @Param("offset") Integer offset, |
| | | @Param("limit") Integer limit); |
| | | |
| | | int queryInsuranceListCount(@Param("carId") Integer carId); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.Car; |
| | | import com.dsh.course.model.dto.CarServerRes; |
| | | import com.dsh.course.model.vo.BaseWarpper; |
| | | import com.dsh.course.model.vo.CarInfoRes; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface CarMapper extends BaseMapper<Car> { |
| | | |
| | | |
| | | /** |
| | | * 获取空闲车辆 |
| | | * @param companyId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<BaseWarpper> queryIdleData(@Param("companyId") Integer companyId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 车牌查询 |
| | | * @param licensePlate |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Car query(@Param("licensePlate") String licensePlate) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 根据id获取车辆详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | CarInfoRes queryCarById(@Param("id") Integer id); |
| | | |
| | | CarServerRes getCarServer(@Param("carId") String carId); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.CarModel; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface CarModelMapper extends BaseMapper<CarModel> { |
| | | |
| | | |
| | | List<Map<String, Object>> query(@Param("brandId") Integer brandId) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.CarService; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface CarServiceMapper extends BaseMapper<CarService> { |
| | | |
| | | |
| | | // CarService query(@Param("type") Integer orderType, @Param("carId") Integer carId); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.City; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface CityMapper extends BaseMapper<City> { |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.model.node.ZTreeNode; |
| | | import com.dsh.guns.modular.system.model.Dept; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 部门表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface DeptMapper extends BaseMapper<Dept> { |
| | | |
| | | /** |
| | | * 获取ztree的节点列表 |
| | | */ |
| | | List<ZTreeNode> tree(); |
| | | |
| | | /** |
| | | * 获取所有部门列表 |
| | | */ |
| | | List<Map<String, Object>> list(@Param("condition") String condition); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.guns.modular.system.model.Dict; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 字典表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface DictMapper extends BaseMapper<Dict> { |
| | | |
| | | /** |
| | | * 根据编码获取词典列表 |
| | | */ |
| | | List<Dict> selectByCode(@Param("code") String code); |
| | | |
| | | /** |
| | | * 查询字典列表 |
| | | */ |
| | | List<Map<String, Object>> list(@Param("condition") String conditiion); |
| | | |
| | | /** |
| | | * 根据父类编码获取词典列表 |
| | | */ |
| | | List<Dict> selectByParentCode(@Param("code") String code); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.Img; |
| | | |
| | | public interface ImgMapper extends BaseMapper<Img> { |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.guns.modular.system.model.LoginLog; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 登录记录 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface LoginLogMapper extends BaseMapper<LoginLog> { |
| | | |
| | | /** |
| | | * 获取登录日志 |
| | | */ |
| | | List<Map<String, Object>> getLoginLogs(@Param("page") Page<LoginLog> page, @Param("beginTime") String beginTime, |
| | | @Param("endTime") String endTime, @Param("logName") String logName, @Param("orderByField") String orderByField, @Param("isAsc") boolean isAsc); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.model.node.MenuNode; |
| | | import com.dsh.course.model.node.ZTreeNode; |
| | | import com.dsh.guns.modular.system.model.Menu; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 菜单表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface MenuMapper extends BaseMapper<Menu> { |
| | | |
| | | /** |
| | | * 根据条件查询菜单 |
| | | * |
| | | * @return |
| | | * @date 2017年2月12日 下午9:14:34 |
| | | */ |
| | | List<Map<String, Object>> selectMenus(@Param("condition") String condition, @Param("level") String level); |
| | | |
| | | /** |
| | | * 根据条件查询菜单 |
| | | * |
| | | * @return |
| | | * @date 2017年2月12日 下午9:14:34 |
| | | */ |
| | | List<Long> getMenuIdsByRoleId(@Param("roleId") Integer roleId); |
| | | |
| | | /** |
| | | * 获取菜单列表树 |
| | | * |
| | | * @return |
| | | * @date 2017年2月19日 下午1:33:51 |
| | | */ |
| | | List<ZTreeNode> menuTreeList(); |
| | | |
| | | /** |
| | | * 获取菜单列表树 |
| | | * |
| | | * @return |
| | | * @date 2017年2月19日 下午1:33:51 |
| | | */ |
| | | List<ZTreeNode> menuTreeListByMenuIds(List<Long> menuIds); |
| | | |
| | | /** |
| | | * 删除menu关联的relation |
| | | * |
| | | * @param menuId |
| | | * @return |
| | | * @date 2017年2月19日 下午4:10:59 |
| | | */ |
| | | int deleteRelationByMenu(Long menuId); |
| | | |
| | | /** |
| | | * 获取资源url通过角色id |
| | | * |
| | | * @param roleId |
| | | * @return |
| | | * @date 2017年2月19日 下午7:12:38 |
| | | */ |
| | | List<String> getResUrlsByRoleId(Integer roleId); |
| | | |
| | | /** |
| | | * 根据角色获取菜单 |
| | | * |
| | | * @param roleIds |
| | | * @return |
| | | * @date 2017年2月19日 下午10:35:40 |
| | | */ |
| | | List<MenuNode> getMenusByRoleIds(List<String> roleIds); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.MotorModel; |
| | | |
| | | public interface MotorModelMapper extends BaseMapper<MotorModel> { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.guns.modular.system.model.Notice; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 通知表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface NoticeMapper extends BaseMapper<Notice> { |
| | | |
| | | /** |
| | | * 获取通知列表 |
| | | */ |
| | | List<Map<String, Object>> list(@Param("condition") String condition); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.OpenCityBusiness; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface OpenCityBusinessMapper extends BaseMapper<OpenCityBusiness> { |
| | | |
| | | |
| | | /** |
| | | * 获取业务类型 |
| | | * @param province 省名称 |
| | | * @param city 市名称 |
| | | * @param district 区县名称 |
| | | * @return |
| | | */ |
| | | List<OpenCityBusiness> queryBusiness(@Param("province") String province, @Param("city") String city, |
| | | @Param("district") String district); |
| | | |
| | | |
| | | /** |
| | | * 根据开通城市id获取业务类型 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | List<OpenCityBusiness> queryBusinessById(@Param("id") Integer id); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.OpenCity; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface OpenCityMapper extends BaseMapper<OpenCity> { |
| | | |
| | | |
| | | /** |
| | | * 获取开通城市列表(有效的) |
| | | * @return |
| | | */ |
| | | List<OpenCity> queryOpenCity(); |
| | | |
| | | |
| | | /** |
| | | * 获取开通城市 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<OpenCity> queryByCode(@Param("code") String code); |
| | | |
| | | List<OpenCity> selectList1(); |
| | | |
| | | |
| | | List<OpenCity> selectListCity(@Param("language") Integer language); |
| | | |
| | | List<OpenCity> selectListCity1(@Param("language") Integer language, @Param("code") Integer code); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.guns.modular.system.model.OperationLog; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 操作日志 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface OperationLogMapper extends BaseMapper<OperationLog> { |
| | | |
| | | /** |
| | | * 获取操作日志 |
| | | */ |
| | | List<Map<String, Object>> getOperationLogs(@Param("page") Page<OperationLog> page, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("logName") String logName, @Param("logType") String logType); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.Phone; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface PhoneMapper extends BaseMapper<Phone> { |
| | | |
| | | |
| | | /** |
| | | * 根据行政区域获取设置的电话 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<Phone> queryPhones(@Param("province") String province, @Param("city") String city, @Param("code") String code); |
| | | |
| | | |
| | | /** |
| | | * 获取电话数据 |
| | | * @param type |
| | | * @param platform |
| | | * @param code |
| | | * @return |
| | | */ |
| | | Phone query(@Param("type") Integer type, @Param("platform") Integer platform, |
| | | @Param("province") String province, @Param("city") String city, |
| | | @Param("code") String code); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取电话 |
| | | * @param companyId |
| | | * @param type |
| | | * @return |
| | | */ |
| | | Phone queryInfo(@Param("companyId") Integer companyId, @Param("type") Integer type); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.Problem; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface ProblemMapper extends BaseMapper<Problem> { |
| | | |
| | | |
| | | /** |
| | | * 获取提交的留言 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryProblems(@Param("pageNum") Integer pageNum, @Param("size") Integer size, |
| | | @Param("uid") Integer uid); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.PushOrder; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface PushOrderMapper extends BaseMapper<PushOrder> { |
| | | |
| | | |
| | | /** |
| | | * 获取推送配置 |
| | | * @param type |
| | | * @param pushType |
| | | * @return |
| | | */ |
| | | List<PushOrder> querys(@Param("type") Integer type, @Param("pushType") Integer pushType, |
| | | @Param("companyId") Integer companyId); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.guns.modular.system.model.Relation; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色和菜单关联表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface RelationMapper extends BaseMapper<Relation> { |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.model.node.ZTreeNode; |
| | | import com.dsh.guns.modular.system.model.Role; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface RoleMapper extends BaseMapper<Role> { |
| | | |
| | | /** |
| | | * 根据条件查询角色列表 |
| | | * |
| | | * @return |
| | | * @date 2017年2月12日 下午9:14:34 |
| | | */ |
| | | List<Map<String, Object>> selectRoles(@Param("condition") String condition); |
| | | |
| | | /** |
| | | * 删除某个角色的所有权限 |
| | | * |
| | | * @param roleId 角色id |
| | | * @return |
| | | * @date 2017年2月13日 下午7:57:51 |
| | | */ |
| | | int deleteRolesById(@Param("roleId") Integer roleId); |
| | | |
| | | /** |
| | | * 获取角色列表树 |
| | | * |
| | | * @return |
| | | * @date 2017年2月18日 上午10:32:04 |
| | | */ |
| | | List<ZTreeNode> roleTreeList(); |
| | | |
| | | /** |
| | | * 获取角色列表树 |
| | | * |
| | | * @return |
| | | * @date 2017年2月18日 上午10:32:04 |
| | | */ |
| | | List<ZTreeNode> roleTreeListByRoleId(String[] roleId); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.SensitiveWords; |
| | | |
| | | public interface SensitiveWordsMapper extends BaseMapper<SensitiveWords> { |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.ServerCarModel; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ServerCarModelMapper extends BaseMapper<ServerCarModel> { |
| | | |
| | | |
| | | /** |
| | | * 获取业务对应的所有有效服务车型 |
| | | * @param type |
| | | * @return |
| | | */ |
| | | List<ServerCarModel> queryServerCarModel(@Param("type") Integer type); |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.SysIntegral; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface SysIntegralMapper extends BaseMapper<SysIntegral> { |
| | | |
| | | SysIntegral query(@Param("companyId") Integer companyId); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.SystemNotice; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface SystemNoticeMapper extends BaseMapper<SystemNotice> { |
| | | |
| | | |
| | | /** |
| | | * 获取未阅读数量 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Integer queryNoReadNoticeNum(@Param("uid") Integer uid, @Param("userType") Integer userType); |
| | | |
| | | |
| | | /** |
| | | * 获取消息列表 |
| | | * @param type |
| | | * @param pageNum |
| | | * @param size |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryList(@Param("type") Integer type, @Param("pageNum") Integer pageNum, |
| | | @Param("size") Integer size, @Param("uid") Integer uid, @Param("userType") Integer userType, @Param("language") Integer language); |
| | | |
| | | |
| | | /** |
| | | * 阅读操作 |
| | | * @param id |
| | | * @param uid |
| | | */ |
| | | void readSystemNotice(@Param("id") Integer id, @Param("uid") Integer uid, @Param("userType") Integer userType); |
| | | |
| | | |
| | | /** |
| | | * 删除数据 |
| | | * @param id |
| | | * @param uid |
| | | */ |
| | | void delSystemNotice(@Param("id") Integer id, @Param("uid") Integer uid, @Param("userType") Integer userType); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.entity.TNotices; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface TNoticesMapper extends BaseMapper<TNotices> { |
| | | |
| | | |
| | | /** |
| | | * 获取公告列表 |
| | | * @param type |
| | | * @return |
| | | */ |
| | | List<TNotices> queryNotices(@Param("type") Integer type); |
| | | |
| | | |
| | | /** |
| | | * 获取用户的公告数据 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryList(@Param("pageNum") Integer pageNum, @Param("size") Integer size, |
| | | @Param("uid") Integer uid, @Param("userType") Integer userType,@Param("language") Integer language); |
| | | |
| | | List<Map<String,Object>> getRollingNoticeList(@Param("page") Page<Map<String, Object>> page, |
| | | @Param("beginTime") String beginTime, |
| | | @Param("endTime") String endTime, |
| | | @Param("typeValue") Integer typeValue, |
| | | @Param("content") String content, @Param("yy") Integer yy); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.guns.core.dataScope.DataScope; |
| | | import com.dsh.guns.modular.system.model.User; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 管理员表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface UserMapper extends BaseMapper<User> { |
| | | |
| | | /** |
| | | * 修改用户状态 |
| | | */ |
| | | int setStatus(@Param("userId") Integer userId, @Param("status") int status); |
| | | |
| | | /** |
| | | * 修改密码 |
| | | */ |
| | | int changePwd(@Param("userId") Integer userId, @Param("pwd") String pwd); |
| | | |
| | | /** |
| | | * 根据条件查询用户列表 |
| | | */ |
| | | List<Map<String, Object>> selectUsers(@Param("dataScope") DataScope dataScope, @Param("name") String name, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("deptid") Integer deptid); |
| | | |
| | | /** |
| | | * 设置用户的角色 |
| | | */ |
| | | int setRoles(@Param("userId") Integer userId, @Param("roleIds") String roleIds); |
| | | |
| | | /** |
| | | * 通过账号获取用户 |
| | | */ |
| | | User getByAccount(@Param("account") String account); |
| | | |
| | | /** |
| | | * 根据角色判断菜单有"首页"的数量 |
| | | * @param roleStr |
| | | * @return |
| | | */ |
| | | Integer getMenuNumByRole(@Param("roleStr") String roleStr); |
| | | |
| | | List<Map<String,Object>> getUserListPage(@Param("page") Page<Map<String, Object>> page, |
| | | @Param("dataScope") DataScope dataScope, |
| | | @Param("name") String name, |
| | | @Param("beginTime") String beginTime, |
| | | @Param("endTime") String endTime, |
| | | @Param("deptid") Integer deptid); |
| | | } |
New file |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.course.entity.VersionManagement; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Map; |
| | | |
| | | public interface VersionManagementMapper extends BaseMapper<VersionManagement> { |
| | | |
| | | |
| | | /** |
| | | * 获取最新版本 |
| | | * @return |
| | | */ |
| | | Map<String, Object> queryNewVersion(@Param("type") Integer type); |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.dto; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class CarServerRes { |
| | | private String server; |
| | | private String carName; |
| | | } |
New file |
| | |
| | | //package com.dsh.app.model.dto; |
| | | // |
| | | //import com.baomidou.mybatisplus.annotation.IdType; |
| | | //import com.baomidou.mybatisplus.annotation.TableField; |
| | | //import com.baomidou.mybatisplus.annotation.TableId; |
| | | //import com.baomidou.mybatisplus.annotation.TableName; |
| | | //import lombok.Data; |
| | | // |
| | | //import java.util.Date; |
| | | // |
| | | ///** |
| | | // * 司机每天活动数量 |
| | | // */ |
| | | //@Data |
| | | //@TableName("t_driver_activity_history") |
| | | //public class DriverActivityHistory { |
| | | // /** |
| | | // * 主键 |
| | | // */ |
| | | // @TableId(value = "id", type = IdType.AUTO) |
| | | // @TableField("id") |
| | | // private Integer id; |
| | | // /** |
| | | // * 活动日期 |
| | | // */ |
| | | // @TableField("day") |
| | | // private Date day; |
| | | // /** |
| | | // * 司机id |
| | | // */ |
| | | // @TableField("driverId") |
| | | // private Integer driverId; |
| | | // /** |
| | | // * 活动类型(1=邀请司机注册,2=邀请用户注册,3=累计在线,4=订单量) |
| | | // */ |
| | | // @TableField("type") |
| | | // private Integer type; |
| | | // /** |
| | | // * 活动id |
| | | // */ |
| | | // @TableField("activityId") |
| | | // private Integer activityId; |
| | | // /** |
| | | // * 是否完成(1=否,2=完成) |
| | | // */ |
| | | // @TableField("carryOut") |
| | | // private Integer carryOut; |
| | | // /** |
| | | // * 奖励金额 |
| | | // */ |
| | | // @TableField("money") |
| | | // private Double money; |
| | | // //领取时间 |
| | | // @TableField("collectionTime") |
| | | // private Date collectionTime; |
| | | // /** |
| | | // * 添加时间 |
| | | // */ |
| | | // @TableField("insertTime") |
| | | // private Date insertTime; |
| | | // |
| | | //} |
New file |
| | |
| | | package com.dsh.course.model.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class GetPhoneInfoRequest { |
| | | |
| | | private Integer companyId; |
| | | |
| | | private Integer type; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class IntegralDto { |
| | | |
| | | private Double num1 = 0D; |
| | | |
| | | private Integer num2 = 0; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class TNoticeListWarpper { |
| | | private List<TNoticeWarpper> list; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.dto; |
| | | |
| | | import com.dsh.course.entity.TNotices; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel("公告") |
| | | public class TNoticeWarpper { |
| | | @ApiModelProperty("主键") |
| | | private Integer id; |
| | | @ApiModelProperty("标题") |
| | | private String title; |
| | | @ApiModelProperty("内容") |
| | | private String content; |
| | | @ApiModelProperty("图片地址") |
| | | private String imgUrl; |
| | | @ApiModelProperty("发布时间") |
| | | private Long insertTime; |
| | | |
| | | |
| | | public static List<TNoticeWarpper> getTNoticeWarppers(List<TNotices> notices){ |
| | | List<TNoticeWarpper> list = new ArrayList<>(); |
| | | if(null != notices){ |
| | | for(TNotices t : notices){ |
| | | TNoticeWarpper noticeWarpper = new TNoticeWarpper(); |
| | | noticeWarpper.setId(t.getId()); |
| | | noticeWarpper.setTitle(t.getTitle()); |
| | | noticeWarpper.setContent(t.getContent()); |
| | | noticeWarpper.setImgUrl(t.getImgUrl()); |
| | | noticeWarpper.setInsertTime(t.getInsertTime().getTime()); |
| | | list.add(noticeWarpper); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.node; |
| | | |
| | | |
| | | import com.dsh.constant.IsMenu; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author fengshuonan |
| | | * @Description 菜单的节点 |
| | | * @date 2016年12月6日 上午11:34:17 |
| | | */ |
| | | public class MenuNode implements Comparable { |
| | | |
| | | /** |
| | | * 节点id |
| | | */ |
| | | private Long id; |
| | | |
| | | /** |
| | | * 父节点 |
| | | */ |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * 节点名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 按钮级别 |
| | | */ |
| | | private Integer levels; |
| | | |
| | | /** |
| | | * 按钮级别 |
| | | */ |
| | | private Integer ismenu; |
| | | |
| | | /** |
| | | * 按钮的排序 |
| | | */ |
| | | private Integer num; |
| | | |
| | | /** |
| | | * 节点的url |
| | | */ |
| | | private String url; |
| | | |
| | | /** |
| | | * 节点图标 |
| | | */ |
| | | private String icon; |
| | | |
| | | private String ename; |
| | | private String bname; |
| | | |
| | | public String getEname() { |
| | | return ename; |
| | | } |
| | | |
| | | public void setEname(String ename) { |
| | | this.ename = ename; |
| | | } |
| | | |
| | | public String getBname() { |
| | | return bname; |
| | | } |
| | | |
| | | public void setBname(String bname) { |
| | | this.bname = bname; |
| | | } |
| | | |
| | | /** |
| | | * 子节点的集合 |
| | | */ |
| | | private List<MenuNode> children; |
| | | |
| | | /** |
| | | * 查询子节点时候的临时集合 |
| | | */ |
| | | private List<MenuNode> linkedList = new ArrayList<MenuNode>(); |
| | | |
| | | public MenuNode() { |
| | | super(); |
| | | } |
| | | |
| | | public MenuNode(Long id, Long parentId) { |
| | | super(); |
| | | this.id = id; |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | public Integer getLevels() { |
| | | return levels; |
| | | } |
| | | |
| | | public void setLevels(Integer levels) { |
| | | this.levels = levels; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public static MenuNode createRoot() { |
| | | return new MenuNode(0L, -1L); |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getParentId() { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(Long parentId) { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public List<MenuNode> getChildren() { |
| | | return children; |
| | | } |
| | | |
| | | public void setChildren(List<MenuNode> children) { |
| | | this.children = children; |
| | | } |
| | | |
| | | public Integer getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(Integer num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public Integer getIsmenu() { |
| | | return ismenu; |
| | | } |
| | | |
| | | public void setIsmenu(Integer ismenu) { |
| | | this.ismenu = ismenu; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "MenuNode{" + |
| | | "id=" + id + |
| | | ", parentId=" + parentId + |
| | | ", name='" + name + '\'' + |
| | | ", levels=" + levels + |
| | | ", num=" + num + |
| | | ", url='" + url + '\'' + |
| | | ", icon='" + icon + '\'' + |
| | | ", children=" + children + |
| | | ", linkedList=" + linkedList + |
| | | '}'; |
| | | } |
| | | |
| | | /** |
| | | * 重写排序比较接口,首先根据等级排序,然后更具排序字段排序 |
| | | * |
| | | * @param o |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int compareTo(Object o) { |
| | | MenuNode menuNode = (MenuNode) o; |
| | | Integer num = menuNode.getNum(); |
| | | Integer levels = menuNode.getLevels(); |
| | | if (num == null) { |
| | | num = 0; |
| | | } |
| | | if (levels == null) { |
| | | levels = 0; |
| | | } |
| | | if (this.levels.compareTo(levels) == 0) { |
| | | return this.num.compareTo(num); |
| | | } else { |
| | | return this.levels.compareTo(levels); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 构建页面菜单列表 |
| | | */ |
| | | public static List<MenuNode> buildTitle(List<MenuNode> nodes) { |
| | | if (nodes.size() <= 0) { |
| | | return nodes; |
| | | } |
| | | //剔除非菜单 |
| | | nodes.removeIf(node -> node.getIsmenu() != IsMenu.YES.getCode()); |
| | | //对菜单排序,返回列表按菜单等级,序号的排序方式排列 |
| | | Collections.sort(nodes); |
| | | return mergeList(nodes, nodes.get(nodes.size() - 1).getLevels(), null); |
| | | } |
| | | |
| | | /** |
| | | * 递归合并数组为子数组,最后返回第一层 |
| | | * |
| | | * @param menuList |
| | | * @param listMap |
| | | * @return |
| | | */ |
| | | private static List<MenuNode> mergeList(List<MenuNode> menuList, int rank, Map<Long, List<MenuNode>> listMap) { |
| | | //保存当次调用总共合并了多少元素 |
| | | int n; |
| | | //保存当次调用总共合并出来的list |
| | | Map<Long, List<MenuNode>> currentMap = new HashMap<>(); |
| | | //由于按等级从小到大排序,需要从后往前排序 |
| | | //判断该节点是否属于当前循环的等级,不等于则跳出循环 |
| | | for (n = menuList.size() - 1; n >=0&&menuList.get(n).getLevels() == rank; n--) { |
| | | //判断之前的调用是否有返回以该节点的id为key的map,有则设置为children列表。 |
| | | if (listMap != null && listMap.get(menuList.get(n).getId()) != null) { |
| | | menuList.get(n).setChildren(listMap.get(menuList.get(n).getId())); |
| | | } |
| | | if (menuList.get(n).getParentId()!=null&&menuList.get(n).getParentId()!=0) { |
| | | //判断当前节点所属的pid是否已经创建了以该pid为key的键值对,没有则创建新的链表 |
| | | currentMap.computeIfAbsent(menuList.get(n).getParentId(), k -> new LinkedList<>()); |
| | | //将该节点插入到对应的list的头部 |
| | | currentMap.get(menuList.get(n).getParentId()).add(0, menuList.get(n)); |
| | | } |
| | | } |
| | | if (n <0) { |
| | | return menuList; |
| | | } else { |
| | | return mergeList(menuList.subList(0, n+1), menuList.get(n).getLevels(), currentMap); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.node; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | /** |
| | | * |
| | | * jquery ztree 插件的节点 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年2月17日 下午8:25:14 |
| | | */ |
| | | public class ZTreeNode { |
| | | |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING) |
| | | private Long id; //节点id |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING) |
| | | private Long pId;//父节点id |
| | | |
| | | private String name;//节点名称 |
| | | |
| | | private Boolean open;//是否打开节点 |
| | | |
| | | private Boolean checked;//是否被选中 |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getpId() { |
| | | return pId; |
| | | } |
| | | |
| | | public void setpId(Long pId) { |
| | | this.pId = pId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Boolean getOpen() { |
| | | return open; |
| | | } |
| | | |
| | | public void setOpen(Boolean open) { |
| | | this.open = open; |
| | | } |
| | | |
| | | public Boolean getIsOpen() { |
| | | return open; |
| | | } |
| | | |
| | | public void setIsOpen(Boolean open) { |
| | | this.open = open; |
| | | } |
| | | |
| | | public Boolean getChecked() { |
| | | return checked; |
| | | } |
| | | |
| | | public void setChecked(Boolean checked) { |
| | | this.checked = checked; |
| | | } |
| | | |
| | | public static ZTreeNode createParent(){ |
| | | ZTreeNode zTreeNode = new ZTreeNode(); |
| | | zTreeNode.setChecked(true); |
| | | zTreeNode.setId(0L); |
| | | zTreeNode.setName("顶级"); |
| | | zTreeNode.setOpen(true); |
| | | zTreeNode.setpId(0L); |
| | | return zTreeNode; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class BaseListWarpper { |
| | | private List<BaseWarpper> list; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 公共封装类 |
| | | */ |
| | | @Data |
| | | @ApiModel("公共对象") |
| | | public class BaseWarpper { |
| | | @ApiModelProperty("主键id") |
| | | private Integer id; |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | @ApiModelProperty("内容") |
| | | private String content; |
| | | @ApiModelProperty("数量") |
| | | private Integer number; |
| | | @ApiModelProperty("总数量") |
| | | private Integer totalNumber; |
| | | @ApiModelProperty("金额") |
| | | private Double amount; |
| | | @ApiModelProperty("时长(分钟)") |
| | | private Integer minute; |
| | | @ApiModelProperty("经度") |
| | | private Double lon; |
| | | @ApiModelProperty("纬度") |
| | | private Double lat; |
| | | |
| | | public static BaseWarpper getBaseWarpper(Map<String, Object> map){ |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | if(null != map){ |
| | | baseWarpper.setId(null != map.get("id") ? Integer.valueOf(map.get("id").toString()) : 0); |
| | | baseWarpper.setName(null != map.get("name") ? map.get("name").toString() : ""); |
| | | baseWarpper.setContent(null != map.get("content") ? map.get("content").toString() : ""); |
| | | baseWarpper.setNumber(null != map.get("number") ? Integer.valueOf(map.get("number").toString()) : 0); |
| | | baseWarpper.setTotalNumber(null != map.get("totalNumber") ? Integer.valueOf(map.get("totalNumber").toString()) : 0); |
| | | baseWarpper.setAmount(null != map.get("amount") ? Double.valueOf(map.get("amount").toString()) : 0); |
| | | baseWarpper.setMinute(null != map.get("minute") ? Integer.valueOf(map.get("minute").toString()) : 0); |
| | | baseWarpper.setLon(null != map.get("lon") ? Double.valueOf(map.get("lon").toString()) : 0); |
| | | baseWarpper.setLat(null != map.get("lat") ? Double.valueOf(map.get("lat").toString()) : 0); |
| | | } |
| | | return baseWarpper; |
| | | } |
| | | |
| | | public static List<BaseWarpper> getBaseWarppers(List<Map<String, Object>> list){ |
| | | List<BaseWarpper> data = new ArrayList<>(); |
| | | if(null != list){ |
| | | for(Map<String, Object> map : list){ |
| | | data.add(BaseWarpper.getBaseWarpper(map)); |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CancleOrderReq { |
| | | private Integer type; |
| | | |
| | | private Integer orderType; |
| | | |
| | | private Integer companyId; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 取消订单设置 |
| | | */ |
| | | @Data |
| | | public class CancleOrderRes { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | private Integer companyId; |
| | | /** |
| | | * 时间(分钟) |
| | | */ |
| | | private Integer minuteNum; |
| | | /** |
| | | * 金额 |
| | | */ |
| | | private Double money; |
| | | /** |
| | | * 类型(1=取消,2=预约取消) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 订单类型(1=专车) |
| | | */ |
| | | private Integer orderType; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 车辆 |
| | | */ |
| | | @Data |
| | | public class CarInfoRes { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 是否是平台车辆(1=是,2=否) 1:Y 2:N |
| | | */ |
| | | private Integer isPlatCar; |
| | | /** |
| | | * 公司id |
| | | */ |
| | | private Integer companyId; |
| | | /** |
| | | * 加盟商id |
| | | */ |
| | | private Integer franchiseeId; |
| | | /** |
| | | * 车辆颜色 |
| | | */ |
| | | private String carColor; |
| | | /** |
| | | * 车型 |
| | | */ |
| | | private String carModelName; |
| | | /** |
| | | * 车辆品牌 |
| | | */ |
| | | private String carBrandName; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | | private String carLicensePlate; |
| | | /** |
| | | * 车辆照片 |
| | | */ |
| | | private String carPhoto; |
| | | /** |
| | | * 行驶证号 |
| | | */ |
| | | private String drivingLicenseNumber; |
| | | /** |
| | | * 行驶证照片 |
| | | */ |
| | | private String drivingLicensePhoto; |
| | | /** |
| | | * 年检到期时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date annualInspectionTime; |
| | | /** |
| | | * 保险照片 |
| | | */ |
| | | private String insurancePhoto; |
| | | /** |
| | | * 商业保险到期时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date commercialInsuranceTime; |
| | | /** |
| | | * 添加来源(1=司机注册 2=平台添加 3=分公司添加 4=加盟商添加) |
| | | * (1=Driver Registration 2=Platform Addition 3=Branch Office Addition 4=Franchisee Addition) |
| | | */ |
| | | private Integer addType; |
| | | /** |
| | | * 公司id |
| | | */ |
| | | private Integer addObjectId; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CarServiceReq { |
| | | private Integer orderType; |
| | | |
| | | private Integer carId; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CarServiceRes { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 车辆id |
| | | */ |
| | | private Integer carId; |
| | | /** |
| | | * 服务类型(1=专车,4=小件物流-同城) |
| | | Business types: (1=private car, 4=courier-same city) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 服务车型id |
| | | */ |
| | | private Integer serverCarModelId; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class CityReq { |
| | | private List<String> citys; |
| | | private Integer language; |
| | | |
| | | public CityReq(List<String> citys, Integer language) { |
| | | this.citys = citys; |
| | | this.language = language; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import com.dsh.course.entity.City; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class CityRes { |
| | | List<City> cities; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ImgReq { |
| | | private Integer usePort; |
| | | |
| | | private Integer type; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class ImgRes { |
| | | //主键 |
| | | private Integer id; |
| | | //图片类型(1=启动页,2=引导页,3=icon) |
| | | private Integer type; |
| | | //应用端口(1用户端,2=司机端) |
| | | private Integer usePort; |
| | | //名称 |
| | | private String name; |
| | | //图片地址 |
| | | private String url; |
| | | //排序 |
| | | private Integer sort; |
| | | //状态(1=正常,2=冻结,3=删除)1:normal 2:freeze 3:delete |
| | | private Integer state; |
| | | //添加时间 |
| | | private Date insertTime; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class NoReadNoticeNumReq { |
| | | private Integer userId; |
| | | |
| | | private Integer userType; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("可接单业务") |
| | | public class OrdersWarpper { |
| | | @ApiModelProperty("类型") |
| | | private Integer type; |
| | | @ApiModelProperty("类型名称") |
| | | private String name; |
| | | @ApiModelProperty("是否已设置(1=否,2=是)") |
| | | private Integer state; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | @ApiModel("客服留言") |
| | | public class ProblemWarpper { |
| | | @ApiModelProperty("主键") |
| | | private Integer id; |
| | | @ApiModelProperty("留言时间") |
| | | private String insertTime; |
| | | @ApiModelProperty("留言内容") |
| | | private String content; |
| | | @ApiModelProperty("回复内容") |
| | | private String answer; |
| | | |
| | | |
| | | public static List<ProblemWarpper> getProblemWarpper(List<Map<String, Object>> maps){ |
| | | List<ProblemWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for(Map<String, Object> map : maps) { |
| | | ProblemWarpper problemWarpper = new ProblemWarpper(); |
| | | problemWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); |
| | | problemWarpper.setInsertTime(null != map.get("insertTime") ? String.valueOf(map.get("insertTime")) : ""); |
| | | problemWarpper.setContent(null != map.get("content") ? String.valueOf(map.get("content")) : ""); |
| | | problemWarpper.setAnswer(null != map.get("answer") ? String.valueOf(map.get("answer")) : ""); |
| | | list.add(problemWarpper); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class PushOrderListReq { |
| | | private Integer type; |
| | | |
| | | private Integer pushType; |
| | | |
| | | private Integer companyId; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 推单设置 |
| | | */ |
| | | @Data |
| | | public class PushOrderListRes { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | private Integer companyId; |
| | | /** |
| | | * 推单距离(公里) |
| | | */ |
| | | private Double pushDistance; |
| | | /** |
| | | * 推单时间(秒) |
| | | */ |
| | | private Integer pushTime; |
| | | /** |
| | | * 推单占所有司机百分比 |
| | | */ |
| | | private Double driverProportion; |
| | | /** |
| | | * 推单次数(1=第一轮,2=第二轮,3=第三轮) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 推单单据类型(1=专车) |
| | | */ |
| | | private Integer pushType; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class PushOrderListWapper { |
| | | private List<PushOrderListRes> listRes; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class QueryHotAddressWrapper { |
| | | |
| | | @ApiModelProperty(value = "省id") |
| | | private Integer cityId; |
| | | |
| | | @ApiModelProperty(value = "地点名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "地址信息") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | private Double lon; |
| | | |
| | | @ApiModelProperty(value = "维度") |
| | | private Double lat; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ServerCarModelListRes { |
| | | private List<ServerCarModelRes> list; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 服务车型设置 |
| | | */ |
| | | @Data |
| | | public class ServerCarModelRes { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 业务类型(1=专车)1 = Special vehicle |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 车型名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 车型照片 |
| | | */ |
| | | private String img; |
| | | /** |
| | | * 包车价格(100-300) |
| | | */ |
| | | private String price; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除)1:normal 2:freeze 3:delete |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | @ApiModel("服务车型") |
| | | public class ServerCarModelWarpper { |
| | | @ApiModelProperty("车型id") |
| | | private Integer id; |
| | | @ApiModelProperty("车型名称") |
| | | private String name; |
| | | @ApiModelProperty("车型照片") |
| | | private String img; |
| | | @ApiModelProperty("预估金额") |
| | | private Double amount; |
| | | @ApiModelProperty("包车的价格") |
| | | private String price; |
| | | @ApiModelProperty("预估里程(公里)") |
| | | private Double mileage; |
| | | @ApiModelProperty("预估时间(分钟)") |
| | | private Double duration; |
| | | |
| | | public static ServerCarModelWarpper getServerCarModelWarpper(Map<String, Object> map){ |
| | | ServerCarModelWarpper serverCarModelWarpper = new ServerCarModelWarpper(); |
| | | if(null != map){ |
| | | serverCarModelWarpper.setId(null != map.get("id") ? Integer.valueOf(map.get("id").toString()) : 0); |
| | | serverCarModelWarpper.setName(null != map.get("name") ? map.get("name").toString() : ""); |
| | | serverCarModelWarpper.setImg(null != map.get("img") ? map.get("img").toString() : ""); |
| | | serverCarModelWarpper.setAmount(null != map.get("amount") ? Double.valueOf(map.get("amount").toString()) : 0); |
| | | serverCarModelWarpper.setPrice(null != map.get("price") ? map.get("price").toString() : ""); |
| | | serverCarModelWarpper.setMileage(null != map.get("mileage") ? Double.valueOf(map.get("mileage").toString()) : 0); |
| | | serverCarModelWarpper.setDuration(null != map.get("duration") ? Double.valueOf(map.get("duration").toString()) : 0); |
| | | } |
| | | return serverCarModelWarpper; |
| | | } |
| | | |
| | | |
| | | public static List<ServerCarModelWarpper>getServerCarModelWarppers(List<Map<String, Object>> list){ |
| | | List<ServerCarModelWarpper> data = new ArrayList<>(); |
| | | if(null != list){ |
| | | for(Map<String, Object> map : list){ |
| | | data.add(ServerCarModelWarpper.getServerCarModelWarpper(map)); |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 系统积分设置 |
| | | */ |
| | | @Data |
| | | public class SysIntegralRes { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | private Integer companyId; |
| | | |
| | | /** |
| | | * 消费多少等于 |
| | | */ |
| | | private Double money = 0D; |
| | | |
| | | /** |
| | | * 积分 |
| | | */ |
| | | private Integer integral = 0; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class SystemNoticeAddReq { |
| | | private Integer userType; |
| | | |
| | | private String content; |
| | | |
| | | private Integer userId; |
| | | |
| | | private Integer noticeType; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class SystemNoticeListReq { |
| | | private Integer id; |
| | | |
| | | private Integer type; |
| | | |
| | | private Integer pageNum; |
| | | |
| | | private Integer size; |
| | | |
| | | private Integer uid; |
| | | |
| | | private Integer userType; |
| | | |
| | | private Integer language; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class SystemNoticeListWarpper { |
| | | private List<SystemNoticeWarpper> list; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | @ApiModel("消息类表") |
| | | public class SystemNoticeWarpper { |
| | | @ApiModelProperty("主键") |
| | | private Integer id; |
| | | @ApiModelProperty("类型(1=公告,2=系统消息)") |
| | | private Integer type; |
| | | @ApiModelProperty("标题") |
| | | private String title; |
| | | @ApiModelProperty("内容") |
| | | private String content; |
| | | @ApiModelProperty("图片") |
| | | private String img; |
| | | @ApiModelProperty("时间") |
| | | private String time; |
| | | @ApiModelProperty("阅读状态(1=未读,2=已读)") |
| | | private Integer read; |
| | | @ApiModelProperty("消息类型(1=打车业务,2=优惠券)") |
| | | private Integer noticeType; |
| | | |
| | | |
| | | public static List<SystemNoticeWarpper> getSystemNoticeWarpper(List<Map<String, Object>> maps){ |
| | | List<SystemNoticeWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for(Map<String, Object> map : maps){ |
| | | SystemNoticeWarpper systemNoticeWarpper = new SystemNoticeWarpper(); |
| | | systemNoticeWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); |
| | | systemNoticeWarpper.setType(null != map.get("type") ? Integer.valueOf(String.valueOf(map.get("type"))) : 0); |
| | | systemNoticeWarpper.setTitle(null != map.get("title") ? String.valueOf(map.get("title")) : ""); |
| | | systemNoticeWarpper.setContent(null != map.get("content") ? String.valueOf(map.get("content")) : ""); |
| | | systemNoticeWarpper.setImg(null != map.get("img") ? String.valueOf(map.get("img")) : ""); |
| | | systemNoticeWarpper.setTime(null != map.get("time") ? String.valueOf(map.get("time")) : ""); |
| | | systemNoticeWarpper.setRead(null != map.get("read") ? Integer.valueOf(String.valueOf(map.get("read"))) : 0); |
| | | systemNoticeWarpper.setNoticeType(null != map.get("noticeType") ? Integer.valueOf(String.valueOf(map.get("noticeType"))) : 1); |
| | | list.add(systemNoticeWarpper); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class SystemPriceReq { |
| | | |
| | | private Integer companyId; |
| | | |
| | | private Integer type; |
| | | |
| | | private Integer serverCarModelId; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 服务价格规则 |
| | | */ |
| | | @Data |
| | | public class SystemPriceRes { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 业务类型(1=专车,4=小件物流-同城) |
| | | Business types: (1=private car, 4=courier-same city) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | private Integer companyId; |
| | | /** |
| | | * 服务车型设置 |
| | | */ |
| | | private Integer serverCarModelId; |
| | | /** |
| | | * 价格规则,每个输入框为一个参数{"num1":1,"num2":2.3} |
| | | */ |
| | | private String content; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | @ApiModel("版本") |
| | | public class VersionWarpper { |
| | | @ApiModelProperty("主键") |
| | | private Integer id; |
| | | @ApiModelProperty("包地址") |
| | | private String url; |
| | | @ApiModelProperty("版本说明") |
| | | private String content; |
| | | @ApiModelProperty("是否强制更新(0=否,1=是)") |
| | | private Integer mandatory; |
| | | @ApiModelProperty("版本号") |
| | | private String version; |
| | | |
| | | public static VersionWarpper getVersionWarpper(Map<String, Object> map){ |
| | | VersionWarpper versionWarpper = new VersionWarpper(); |
| | | if(null != map){ |
| | | versionWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); |
| | | versionWarpper.setUrl(null != map.get("url") ? String.valueOf(map.get("url")) : ""); |
| | | versionWarpper.setContent(null != map.get("content") ? String.valueOf(map.get("content")) : ""); |
| | | versionWarpper.setMandatory(null != map.get("mandatory") ? Integer.valueOf(String.valueOf(map.get("mandatory"))) : 0); |
| | | versionWarpper.setVersion(null != map.get("version") ? String.valueOf(map.get("version")) : ""); |
| | | } |
| | | return versionWarpper; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.Agreement; |
| | | |
| | | public interface IAgreementService extends IService<Agreement> { |
| | | |
| | | |
| | | /** |
| | | * 获取协议内容 |
| | | * @param type |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | String queryByType(Integer type, Integer userType,Integer language) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.CancleOrder; |
| | | |
| | | |
| | | public interface ICancleOrderService extends IService<CancleOrder> { |
| | | |
| | | |
| | | /** |
| | | * 获取取消订单设置 |
| | | * @param type |
| | | * @param orderType |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | CancleOrder query(Integer type, Integer orderType, Integer companyId) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.Car; |
| | | import com.dsh.course.model.dto.CarServerRes; |
| | | import com.dsh.course.model.vo.BaseWarpper; |
| | | import com.dsh.course.model.vo.CarInfoRes; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | public interface ICarService extends IService<Car> { |
| | | |
| | | |
| | | /** |
| | | * 获取车辆详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | CarInfoRes queryCarById(Integer id); |
| | | |
| | | |
| | | /** |
| | | * 获取自己的车辆数据及空闲车辆 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> queryCars(Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 判断车辆是否被绑定 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | boolean idle(Integer id) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取所有车辆品牌 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryAllBrand(Integer language) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 查询车辆型号 |
| | | * @param brandId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryCarModel(Integer brandId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 添加车辆 |
| | | * @param modelId |
| | | * @param color |
| | | * @param licensePlate |
| | | * @param time |
| | | * @param drivingLicensePhoto |
| | | * @param carPhoto |
| | | * @param insurancePhoto |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil addCar(Integer modelId, String color, String licensePlate, Date time, String drivingLicensePhoto, |
| | | String carPhoto, String insurancePhoto, Integer uid) throws Exception; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取空闲车辆 |
| | | * @param companyId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<BaseWarpper> queryIdleData(Integer companyId) throws Exception; |
| | | |
| | | CarServerRes getCarServer(String carId); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.CarService; |
| | | |
| | | public interface ICarServiceService extends IService<CarService> { |
| | | |
| | | |
| | | /** |
| | | * 获取车辆服务类型 |
| | | * @param orderType |
| | | * @param carId |
| | | * @return |
| | | */ |
| | | CarService query(Integer orderType, Integer carId); |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.City; |
| | | |
| | | public interface ICityService extends IService<City> { |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.HotAddress; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface IHotAddressService extends IService<HotAddress> { |
| | | |
| | | /** |
| | | * 查询热门地址 |
| | | * @param cityId |
| | | * @return |
| | | */ |
| | | List<HotAddress> selectHotAddressByCityId(Integer cityId); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.Img; |
| | | |
| | | public interface IImgService extends IService<Img> { |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.OpenCityBusiness; |
| | | import com.dsh.course.model.vo.BaseWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IOpenCityBusinessService extends IService<OpenCityBusiness> { |
| | | |
| | | |
| | | /** |
| | | * 获取业务类型 |
| | | * @param province 省名 |
| | | * @param city 市名称 |
| | | * @param district 区县名称 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<BaseWarpper> queryBusiness(String province, String city, String district) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 根据选择的城市id获取业务类型 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<BaseWarpper> queryBusinessById(Integer id) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.OpenCity; |
| | | import com.dsh.course.model.vo.BaseWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IOpenCityService extends IService<OpenCity> { |
| | | |
| | | |
| | | /** |
| | | * 获取开通城市列表 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<BaseWarpper> queryOpenCity() throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 判断是否是开通城市 |
| | | * @param code |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | boolean openCity(String code) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.Phone; |
| | | import com.dsh.course.model.dto.GetPhoneInfoRequest; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface IPhoneService extends IService<Phone> { |
| | | |
| | | /** |
| | | * 获取所有的系统电话 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Phone> queryPhones(String code) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取客服电话(个人中心) |
| | | * @param code |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> queryCustomerPhone(String code) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据定位的城市行政编号获取分公司的客服电话 |
| | | * @param code |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> queryPhone(String code) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取客服电话 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> queryPhone(Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 根据公司类型获取手机号 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | String selectPhoneByCompany(GetPhoneInfoRequest request); |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.Problem; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface IProblemService extends IService<Problem> { |
| | | |
| | | |
| | | /** |
| | | * 添加留言 |
| | | * @param content |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil leaveMessage(String content, Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取提交的留言列表 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryProblems(Integer pageNum, Integer size, Integer uid) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.PushOrder; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IPushOrderService extends IService<PushOrder> { |
| | | |
| | | |
| | | /** |
| | | * 获取推送配置数据 |
| | | * @param type |
| | | * @param pushType |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<PushOrder> querys(Integer type, Integer pushType, Integer companyId) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.SensitiveWords; |
| | | |
| | | public interface ISensitiveWordsService extends IService<SensitiveWords> { |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.ServerCarModel; |
| | | import com.dsh.course.model.vo.ServerCarModelRes; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IServerCarModelService extends IService<ServerCarModel> { |
| | | |
| | | |
| | | /** |
| | | * 根据类型获取服务车型 |
| | | * @param type |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<ServerCarModelRes> queryServerCarModel(Integer type) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.SysIntegral; |
| | | |
| | | public interface ISysIntegralService extends IService<SysIntegral> { |
| | | |
| | | |
| | | SysIntegral query(Integer companyId); |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.SystemNotice; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface ISystemNoticeService extends IService<SystemNotice> { |
| | | |
| | | |
| | | /** |
| | | * 添加系统消息 |
| | | * @param userType |
| | | * @param content |
| | | * @param userId |
| | | * @throws Exception |
| | | */ |
| | | void addSystemNotice(Integer userType, String content, Integer userId, Integer noticeType) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取未阅读数据 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | int queryNoReadNoticeNum(Integer uid, Integer userType) throws Exception; |
| | | |
| | | /** |
| | | * 获取消息列列表 |
| | | * @param type |
| | | * @param pageNum |
| | | * @param size |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryList(Integer type, Integer pageNum, Integer size, Integer uid, Integer userType,Integer lanugage); |
| | | |
| | | |
| | | /** |
| | | * 阅读操作 |
| | | * @param id |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | void readSystemNotice(Integer id, Integer uid, Integer userType) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 删除公告或消息 |
| | | * @param id |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | void delSystemNotice(Integer id, Integer uid, Integer userType) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 清空公告或消息 |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | void clearSystemNotice(Integer uid, Integer userType) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.SystemPrice; |
| | | |
| | | public interface ISystemPriceService extends IService<SystemPrice> { |
| | | |
| | | |
| | | /** |
| | | * 获取系统计价规则 |
| | | * @param companyId |
| | | * @param type |
| | | * @param serverCarModelId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | SystemPrice query(Integer companyId, Integer type, Integer serverCarModelId) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.TNotices; |
| | | import com.dsh.course.model.dto.TNoticeWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface ITNoticesService extends IService<TNotices> { |
| | | |
| | | |
| | | /** |
| | | * 获取公告列表 |
| | | * @param type |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<TNoticeWarpper> queryNotices(Integer type) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.VersionManagement; |
| | | |
| | | import java.util.Map; |
| | | |
| | | public interface IVersionManagementService extends IService<VersionManagement> { |
| | | |
| | | |
| | | /** |
| | | * 获取最新版本数据 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> queryNewVersion(Integer type) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.CarService; |
| | | import com.dsh.course.mapper.CarServiceMapper; |
| | | import com.dsh.course.service.ICarServiceService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class CarServiceServiceImpl extends ServiceImpl<CarServiceMapper, CarService> implements ICarServiceService { |
| | | |
| | | @Override |
| | | public CarService query(Integer orderType, Integer carId) { |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.City; |
| | | import com.dsh.course.mapper.CityMapper; |
| | | import com.dsh.course.service.ICityService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class CityServiceImpl extends ServiceImpl<CityMapper, City> implements ICityService { |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.Img; |
| | | import com.dsh.course.mapper.ImgMapper; |
| | | import com.dsh.course.service.IImgService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class ImgServiceImpl extends ServiceImpl<ImgMapper, Img> implements IImgService { |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.OpenCityBusiness; |
| | | import com.dsh.course.mapper.OpenCityBusinessMapper; |
| | | import com.dsh.course.model.vo.BaseWarpper; |
| | | import com.dsh.course.service.IOpenCityBusinessService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | public class OpenCityBusinessServiceImpl extends ServiceImpl<OpenCityBusinessMapper, OpenCityBusiness> implements IOpenCityBusinessService { |
| | | |
| | | @Resource |
| | | private OpenCityBusinessMapper openCityBusinessMapper; |
| | | |
| | | |
| | | /** |
| | | * 获取业务类型 |
| | | * @param province 省名 |
| | | * @param city 市名称 |
| | | * @param district 区县名称 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<BaseWarpper> queryBusiness(String province, String city, String district) throws Exception { |
| | | List<OpenCityBusiness> openCityBusinesses = openCityBusinessMapper.queryBusiness(province, city, district); |
| | | if(openCityBusinesses.size() == 0){ |
| | | openCityBusinesses = openCityBusinessMapper.queryBusiness(province, city, null); |
| | | } |
| | | if(openCityBusinesses.size() == 0){ |
| | | openCityBusinesses = openCityBusinessMapper.queryBusiness(province, null, null); |
| | | } |
| | | List<BaseWarpper> list = new ArrayList<>(); |
| | | for(OpenCityBusiness b : openCityBusinesses){ |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | switch (b.getBusinessType()){ |
| | | case 1: |
| | | baseWarpper.setName("专车"); |
| | | baseWarpper.setId(1); |
| | | break; |
| | | case 4: |
| | | baseWarpper.setName("同城小件物流"); |
| | | baseWarpper.setId(4); |
| | | break; |
| | | } |
| | | list.add(baseWarpper); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据开通的城市id获取业务类型 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<BaseWarpper> queryBusinessById(Integer id) throws Exception { |
| | | List<OpenCityBusiness> openCityBusinesses = openCityBusinessMapper.queryBusinessById(id); |
| | | List<BaseWarpper> list = new ArrayList<>(); |
| | | for(OpenCityBusiness b : openCityBusinesses){ |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | switch (b.getBusinessType()){ |
| | | case 1: |
| | | baseWarpper.setName("专车"); |
| | | baseWarpper.setId(1); |
| | | break; |
| | | case 4: |
| | | baseWarpper.setName("同城小件物流"); |
| | | baseWarpper.setId(4); |
| | | break; |
| | | } |
| | | list.add(baseWarpper); |
| | | } |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.OpenCity; |
| | | import com.dsh.course.mapper.OpenCityMapper; |
| | | import com.dsh.course.model.vo.BaseWarpper; |
| | | import com.dsh.course.service.IOpenCityService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | public class OpenCityServiceImpl extends ServiceImpl<OpenCityMapper, OpenCity> implements IOpenCityService { |
| | | |
| | | @Resource |
| | | private OpenCityMapper openCityMapper; |
| | | |
| | | |
| | | /** |
| | | * 获取开通城市列表 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<BaseWarpper> queryOpenCity() throws Exception { |
| | | List<OpenCity> openCities = openCityMapper.queryOpenCity(); |
| | | List<BaseWarpper> list = new ArrayList<>(); |
| | | for(OpenCity c : openCities){ |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setId(c.getId()); |
| | | baseWarpper.setName(StringUtils.isEmpty(c.getProvinceName()) ? |
| | | (StringUtils.isEmpty(c.getCityName()) ? (StringUtils.isEmpty(c.getAreaName()) ? "" : c.getAreaName()) : c.getCityName()) : c.getProvinceName()); |
| | | baseWarpper.setLon(null != c.getLon() ? c.getLon() : 0); |
| | | baseWarpper.setLat(null != c.getLat() ? c.getLat() : 0); |
| | | baseWarpper.setContent(c.getCode()); |
| | | baseWarpper.setName(baseWarpper.getName().replaceAll("市辖区", "")); |
| | | list.add(baseWarpper); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断是否是开通城市 |
| | | * @param code |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public boolean openCity(String code) throws Exception { |
| | | String province = code.substring(0, 2) + "0000"; |
| | | String city = code.substring(0, 4) + "00"; |
| | | List<OpenCity> openCities = openCityMapper.queryByCode(code); |
| | | if(openCities.size() == 0){ |
| | | openCities = openCityMapper.queryByCode(city); |
| | | } |
| | | if(openCities.size() == 0){ |
| | | openCities = openCityMapper.queryByCode(province); |
| | | } |
| | | if(openCities.size() == 0){ |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.Problem; |
| | | import com.dsh.course.entity.SensitiveWords; |
| | | import com.dsh.course.mapper.ProblemMapper; |
| | | import com.dsh.course.mapper.SensitiveWordsMapper; |
| | | import com.dsh.course.service.IProblemService; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | | public class ProblemServiceImpl extends ServiceImpl<ProblemMapper, Problem> implements IProblemService { |
| | | |
| | | @Resource |
| | | private ProblemMapper problemMapper; |
| | | |
| | | @Resource |
| | | private SensitiveWordsMapper sensitiveWordsMapper; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加留言 |
| | | * @param content |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil leaveMessage(String content, Integer uid) throws Exception { |
| | | if(!StringUtils.isEmpty(content)){ |
| | | if(content.length() > 200){ |
| | | return ResultUtil.error("留言内容过长"); |
| | | } |
| | | List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null); |
| | | for(SensitiveWords s : sensitiveWords){ |
| | | content = content.replaceAll(s.getContent(), "***"); |
| | | } |
| | | } |
| | | |
| | | Problem problem = new Problem(); |
| | | problem.setContent(content); |
| | | problem.setUserId(uid); |
| | | problem.setInsertTime(new Date()); |
| | | problem.setState(1); |
| | | this.baseMapper.insert(problem); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取提交的留言 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryProblems(Integer pageNum, Integer size, Integer uid) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | return problemMapper.queryProblems(pageNum, size, uid); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.PushOrder; |
| | | import com.dsh.course.mapper.PushOrderMapper; |
| | | import com.dsh.course.service.IPushOrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | public class PushOrderServiceImpl extends ServiceImpl<PushOrderMapper, PushOrder> implements IPushOrderService { |
| | | |
| | | @Resource |
| | | private PushOrderMapper pushOrderMapper; |
| | | |
| | | |
| | | /** |
| | | * 获取推送配置 |
| | | * @param type |
| | | * @param pushType |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<PushOrder> querys(Integer type, Integer pushType, Integer companyId) throws Exception { |
| | | return pushOrderMapper.querys(type, pushType, companyId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.SensitiveWords; |
| | | import com.dsh.course.mapper.SensitiveWordsMapper; |
| | | import com.dsh.course.service.ISensitiveWordsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class SensitiveWordsServiceImpl extends ServiceImpl<SensitiveWordsMapper, SensitiveWords> implements ISensitiveWordsService { |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.ServerCarModel; |
| | | import com.dsh.course.mapper.ServerCarModelMapper; |
| | | import com.dsh.course.model.vo.ServerCarModelRes; |
| | | import com.dsh.course.service.IServerCarModelService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | |
| | | |
| | | @Service |
| | | public class ServerCarModelServiceImpl extends ServiceImpl<ServerCarModelMapper, ServerCarModel> implements IServerCarModelService { |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<ServerCarModelRes> queryServerCarModel(Integer type) throws Exception { |
| | | List<ServerCarModel> serverCarModels = this.baseMapper.queryServerCarModel(type); |
| | | List<ServerCarModelRes> list = new ArrayList<>(); |
| | | for (ServerCarModel serverCarModel : serverCarModels) { |
| | | ServerCarModelRes serverCarModelRes = new ServerCarModelRes(); |
| | | BeanUtils.copyProperties(serverCarModel, serverCarModelRes); |
| | | list.add(serverCarModelRes); |
| | | } |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.SysIntegral; |
| | | import com.dsh.course.mapper.SysIntegralMapper; |
| | | import com.dsh.course.service.ISysIntegralService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class SysIntegralServiceImpl extends ServiceImpl<SysIntegralMapper, SysIntegral> implements ISysIntegralService { |
| | | |
| | | |
| | | @Override |
| | | public SysIntegral query(Integer companyId) { |
| | | return this.baseMapper.query(companyId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.SystemNotice; |
| | | import com.dsh.course.mapper.SystemNoticeMapper; |
| | | import com.dsh.course.mapper.TNoticesMapper; |
| | | import com.dsh.course.service.ISystemNoticeService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | | public class SystemNoticeServiceImpl extends ServiceImpl<SystemNoticeMapper, SystemNotice> implements ISystemNoticeService { |
| | | |
| | | @Resource |
| | | private SystemNoticeMapper systemNoticeMapper; |
| | | |
| | | @Resource |
| | | private TNoticesMapper tNoticesMapper; |
| | | |
| | | |
| | | /** |
| | | * 添加系统消息 |
| | | * @param userType |
| | | * @param content |
| | | * @param userId |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void addSystemNotice(Integer userType, String content, Integer userId, Integer noticeType) throws Exception { |
| | | SystemNotice systemNotice = new SystemNotice(); |
| | | systemNotice.setContent(content); |
| | | systemNotice.setInsertTime(new Date()); |
| | | systemNotice.setRead(1); |
| | | systemNotice.setType(2); |
| | | systemNotice.setNoticeType(noticeType); |
| | | systemNotice.setUserId(userId); |
| | | systemNotice.setUserType(userType); |
| | | this.baseMapper.insert(systemNotice); |
| | | } |
| | | |
| | | /** |
| | | * 获取未阅读数据 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public int queryNoReadNoticeNum(Integer uid, Integer userType) throws Exception { |
| | | return systemNoticeMapper.queryNoReadNoticeNum(uid, userType); |
| | | } |
| | | |
| | | /** |
| | | * 获取消息列表 |
| | | * @param type |
| | | * @param pageNum |
| | | * @param size |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryList(Integer type, Integer pageNum, Integer size, Integer uid, Integer userType,Integer language) { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> list = null; |
| | | if(type == 1){//系统公告 |
| | | list = tNoticesMapper.queryList(pageNum, size, uid, userType,language); |
| | | } |
| | | if(type == 2){//系统消息 |
| | | list = systemNoticeMapper.queryList(type, pageNum, size, uid, userType,language); |
| | | for(Map<String, Object> map : list){ |
| | | systemNoticeMapper.readSystemNotice(Integer.valueOf(String.valueOf(map.get("id"))), uid, userType); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 阅读操作 |
| | | * @param id |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void readSystemNotice(Integer id, Integer uid, Integer userType) throws Exception { |
| | | systemNoticeMapper.readSystemNotice(id, uid, userType); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除公告或消息 |
| | | * @param id |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void delSystemNotice(Integer id, Integer uid, Integer userType) throws Exception { |
| | | systemNoticeMapper.delSystemNotice(id, uid, userType); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 清空消息或公告 |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void clearSystemNotice(Integer uid, Integer userType) throws Exception { |
| | | systemNoticeMapper.delSystemNotice(null, uid, userType); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.TNotices; |
| | | import com.dsh.course.mapper.TNoticesMapper; |
| | | import com.dsh.course.model.dto.TNoticeWarpper; |
| | | import com.dsh.course.service.ITNoticesService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class TNoticesService1Impl extends ServiceImpl<TNoticesMapper, TNotices> implements ITNoticesService { |
| | | |
| | | @Resource |
| | | private TNoticesMapper tNoticesMapper; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取滚动消息 |
| | | * @param type 1=滚动消息,2=公告 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<TNoticeWarpper> queryNotices(Integer type) throws Exception { |
| | | List<TNotices> notices = tNoticesMapper.queryNotices(type); |
| | | return TNoticeWarpper.getTNoticeWarppers(notices); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.VersionManagement; |
| | | import com.dsh.course.mapper.VersionManagementMapper; |
| | | import com.dsh.course.service.IVersionManagementService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class VersionManagementServiceImpl extends ServiceImpl<VersionManagementMapper, VersionManagement> implements IVersionManagementService { |
| | | |
| | | @Resource |
| | | private VersionManagementMapper versionManagementMapper; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取最新版本 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Map<String, Object> queryNewVersion(Integer type) throws Exception { |
| | | return versionManagementMapper.queryNewVersion(type); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.util; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Instant; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | |
| | | |
| | | /** |
| | | * 日期时间类型的工具类,提供对日期和时间基于毫秒及以上精度的格式化方法、 |
| | | * 运算方法、比较方法等。注意:大部分对日期对象(java.util.Date)操作的方法, |
| | | * 不会修改原日期对象,而以一个新的日期对象返回。 |
| | | * <p> |
| | | * <p> |
| | | * <p><pre><b> |
| | | * 历史更新记录:</b> |
| | | * 2004-6-17 创建此类型 |
| | | * 2005-9-30 修改方法:parseToDate(),去掉了对年份从(1970-9999)这个范围的限制。抛出异常:IllegalArgumentException(),JThinkRuntimeException() |
| | | * 2005-10-2 修改方法: 其它方法,抛出异常:IllegalArgumentException(),JThinkRuntimeException() |
| | | * 2005-10-2 增加方法: addTime(Date d, double times, int type) |
| | | * 2005-10-2 增加方法: addSystemTime() |
| | | * 2005-10-2 修改方法, 对于所有以日期对象类型java.util.Date为参数的方法,如果日期为null,都抛出异常:IllegalArgumentException() |
| | | * <p> |
| | | * </pre></p> |
| | | */ |
| | | |
| | | public final class DateTimeHelper { |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 8:26:30.400 am 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHmmssSa_12 = "yyyy-MM-dd KK:mm:ss.S a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 8:26:16 am 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHmmssa_12 = "yyyy-MM-dd KK:mm:ss a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 8:26 am 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHmma_12 = "yyyy-MM-dd KK:mm a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 8 am 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHa_12 = "yyyy-MM-dd KK a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-07-05 am 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMdda_12 = "yyyy-MM-dd a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 08:26:30.400 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHmmssS = "yyyy-MM-dd HH:mm:ss.S"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 08:26:16 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHmmss = "yyyy-MM-dd HH:mm:ss"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 08:26 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHHmm = "yyyy-MM-dd HH:mm"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-08-03 08 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMddHH = "yyyy-MM-dd HH"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002-07-05 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMMdd = "yyyy-MM-dd"; |
| | | /** |
| | | * 把时间格式化成如:2002-07 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyMM = "yyyy-MM"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:07.19 格式的字符串 |
| | | */ |
| | | public final static String FMT_MMdd = "MM.dd"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:12:08 PM(下午) 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmA_12 = "KK:mm a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:0:55 AM上午, CST 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmAz_12 = "KK:mm a,z"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:0:56 AM上午, 中国标准时间 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmAzzzz_12 = "KK:mm a,zzzz"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:12:08:23 am 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmssA_12 = "KK:mm:ss a"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:0:55:33 AM上午, CST 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmssAz_12 = "KK:mm:ss a,z"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:0:56:23 AM上午, 中国标准时间 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmssAzzzz_12 = "KK:mm:ss a,zzzz"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:22:04:45 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmss = "HH:mm:ss"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:22:04:45.824 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmssS = "HH:mm:ss.S"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:22:04 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmm = "HH:mm"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:22:04,CST 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmz = "HH:mm,z"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:22:04,中国标准时间 格式的字符串 |
| | | */ |
| | | public final static String FMT_HHmmzzzz = "HH:mm,zzzz"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:Sun,Nov 14,'2004 格式的字符串 |
| | | */ |
| | | public final static String FMT_WWMMDDYY_EN = "EEE,MMM d,''yyyy"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:星期日,2004年十一月14号 格式的字符串 |
| | | */ |
| | | public final static String FMT_WWMMDDYY_CN = "EEE,yyyy年MMMd号"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:Sun,Nov 14,'2004 格式的字符串 |
| | | */ |
| | | public final static String FMT_MMDDYY_EN = "MMM d,''yyyy"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:星期日,2004年十一月14号 格式的字符串 |
| | | */ |
| | | public final static String FMT_MMDDYY_CN = "yyyy年MMMd号"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:星期几 格式的字符串,即可获得该日这个时间是星期几 |
| | | */ |
| | | public final static String FMT_WW = "EEE"; |
| | | |
| | | public final static String FMT_ddMMyyyy = "dd-MM-yyyy"; |
| | | |
| | | /** |
| | | * 把时间格式成日期数字,如:20120606 |
| | | */ |
| | | public final static String FMT_yyyyMMdd_noseparator = "yyyyMMdd"; |
| | | |
| | | public final static String FMT_yyyyMMdd_Zh = "yyyy年MM月dd日"; |
| | | |
| | | public final static String FMT_yyyyMMddHH_noseparator = "yyyyMMddHH"; |
| | | |
| | | /** |
| | | * 把时间格式成日期数字,如:20120606121212 |
| | | */ |
| | | public final static String FMT_yyyyMMddhhmmss_noseparator = "yyyyMMddHHmmss"; |
| | | |
| | | /** |
| | | * 把时间格式化成如:2002.07.05 格式的字符串 |
| | | */ |
| | | public final static String FMT_yyyyxMMxdd = "yyyy.MM.dd"; |
| | | /** |
| | | * 常用的格式化时间的格式组,用于本类中格式化字符串成时间型 |
| | | */ |
| | | private final static String[] formatStr = { |
| | | FMT_ddMMyyyy, |
| | | FMT_yyyyMMddHHmmssS, |
| | | FMT_yyyyMMddHHmmss, |
| | | FMT_yyyyMMddHHmm, |
| | | FMT_yyyyMMddHH, |
| | | FMT_yyyyMMdd, |
| | | FMT_HHmmss, |
| | | FMT_HHmmssS, |
| | | FMT_HHmm, |
| | | FMT_HHmmz, |
| | | FMT_HHmmzzzz, |
| | | FMT_yyyyMMddHHmmssSa_12, |
| | | FMT_yyyyMMddHHmmssa_12, |
| | | FMT_yyyyMMddHHmma_12, |
| | | FMT_yyyyMMddHHa_12, |
| | | FMT_yyyyMMdda_12, |
| | | FMT_HHmmA_12, |
| | | FMT_HHmmAz_12, |
| | | FMT_HHmmAzzzz_12, |
| | | FMT_HHmmssA_12, |
| | | FMT_HHmmssAz_12, |
| | | FMT_HHmmssAzzzz_12 |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 私有化构造器,使得不能产生该类对象,类中所有的方法均为静态方法 |
| | | */ |
| | | private DateTimeHelper() { |
| | | } |
| | | |
| | | /** |
| | | * 根据给出的Date值和格式串采用操作系统的默认所在的国家风格来格式化时间,并返回相应的字符串 |
| | | * |
| | | * @param date |
| | | * @param formatStr |
| | | * @return 如果为null,返回字符串"" |
| | | */ |
| | | public static String formatDateTimetoString(Date date, String formatStr) { |
| | | String reStr = ""; |
| | | if (date == null || formatStr == null || formatStr.trim().length() < 1) { |
| | | return reStr; |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat(); |
| | | sdf.applyPattern(formatStr); |
| | | reStr = sdf.format(date); |
| | | return reStr; |
| | | } |
| | | |
| | | public static Date getSystemDate(String fmtstr) { |
| | | try { |
| | | return parseToDate(formatDateTimetoString(getSystemDate(), fmtstr)); |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | return getSystemDate(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据给出的Date值和格式串采用给定的国家所在的国家风格来格式化时间,并返回相应的字符串 |
| | | * |
| | | * @param date 日期对象 |
| | | * @param formatStr 日期格式 |
| | | * @return 如果为null,返回字符串"" |
| | | */ |
| | | public static String formatDateTimetoString(Date date, String formatStr, Locale locale) { |
| | | String reStr = ""; |
| | | if (date == null || formatStr == null || locale == null || formatStr.trim().length() < 1) { |
| | | return reStr; |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat(formatStr, locale); |
| | | reStr = sdf.format(date); |
| | | return reStr; |
| | | } |
| | | |
| | | /** |
| | | * 根据给出的Date值字符串和格式串采用操作系统的默认所在的国家风格来格式化时间,并返回相应的字符串 |
| | | * |
| | | * @param dateStr 日期串 |
| | | * @param formatStr 日期格式 |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatDateTimetoString(String dateStr, String formatStr) throws Exception { |
| | | String dStr = ""; |
| | | if (dateStr != null && dateStr.trim().length() > 0 && formatStr != null && formatStr.trim().length() > 0) { |
| | | dStr = formatDateTimetoString(parseToDate(dateStr), formatStr); |
| | | } |
| | | return dStr; |
| | | } |
| | | |
| | | /** |
| | | * 根据给出的Date值字符串和格式串采用指定国家的风格来格式化时间,并返回相应的字符串 |
| | | * |
| | | * @param dateStr 日期串 |
| | | * @param formatStr 日期格式 |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatDateTimetoString(String dateStr, String formatStr, Locale locale) throws Exception { |
| | | String dStr = ""; |
| | | if (dateStr != null && dateStr.trim().length() > 0 && formatStr != null && formatStr.trim().length() > 0 && locale != null) { |
| | | dStr = formatDateTimetoString(parseToDate(dateStr, locale), formatStr, locale); |
| | | } |
| | | return dStr; |
| | | } |
| | | |
| | | /** |
| | | * 按指定的格式和操作系统默认国家的风格把给定的日期字符串格式化为一个Date型日期 |
| | | * |
| | | * @param dateTimeStr |
| | | * @param formatStr |
| | | * @return java.util.Date类型对象 |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseToDate(String dateTimeStr, String formatStr) throws Exception { |
| | | if (dateTimeStr == null || formatStr == null || dateTimeStr.trim().length() < 1 || formatStr.trim().length() < 1) { |
| | | throw new IllegalArgumentException("参数dateTimeStr、formatStr不能是null或空格串!"); |
| | | } |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat(formatStr); |
| | | try { |
| | | return sdf.parse(dateTimeStr); |
| | | } catch (ParseException e) { |
| | | throw new Exception(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 按指定的格式和指定国家的风格把给定的日期字符串格式化为一个Date型日期 |
| | | * |
| | | * @param dateTimeStr |
| | | * @param formatStr |
| | | * @param locale |
| | | * @return java.util.Date类型对象 |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseToDate(String dateTimeStr, String formatStr, Locale locale) throws Exception { |
| | | if (dateTimeStr != null && formatStr != null && locale != null && dateTimeStr.trim().length() > 0 && formatStr.trim().length() > 0) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat(formatStr, locale); |
| | | try { |
| | | return sdf.parse(dateTimeStr); |
| | | } catch (ParseException e) { |
| | | throw new Exception(e); |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("参数dateTimeStr、formatStr、locale不能是null或空格串!"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 按操作系统默认国家的风格把给定的日期字符串格式化为一个Date型日期 |
| | | * |
| | | * @param dateTimeStr |
| | | * @return java.util.Date类型对象 |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseToDate(String dateTimeStr) throws Exception { |
| | | if (dateTimeStr == null || dateTimeStr.trim().length() < 1) { |
| | | throw new IllegalArgumentException("参数dateTimeSt不能是null或空格串!"); |
| | | } |
| | | int formatStrLength = formatStr.length; |
| | | int i = 0; |
| | | |
| | | for (i = 0; i < formatStrLength; i++) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat(formatStr[i]); |
| | | try { |
| | | return sdf.parse(dateTimeStr); |
| | | } catch (ParseException e) { |
| | | } |
| | | } |
| | | throw new Exception("日期格式不正确!"); |
| | | } |
| | | |
| | | /** |
| | | * 根据给出的年月和日返回一个日期型的对象 |
| | | * |
| | | * @param year 年 |
| | | * @param month 月 ,1到12 |
| | | * @param day 日 ,1到31 |
| | | * @return java.util.Date类型对象 |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseToDate(int year, int month, int day) throws Exception { |
| | | if (month < 1 || month > 12 || day < 1 || day > 31) { |
| | | throw new IllegalArgumentException("参数不正确!"); |
| | | } |
| | | String yearStr = String.valueOf(year); |
| | | String monthStr = String.valueOf(month); |
| | | String dayStr = String.valueOf(day); |
| | | |
| | | return parseToDate(yearStr + "-" + monthStr + "-" + dayStr); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 根据给出的年月日、时分秒、返回一个对应的Date型对象 |
| | | * |
| | | * @param year 年 |
| | | * @param month 月 ,1到12 |
| | | * @param day 日 ,1到31 |
| | | * @param h 小时,从0到23 |
| | | * @param m 分,从0到60 |
| | | * @param s 秒,从0到60 |
| | | * @return java.util.Date类型对象 |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseToDate(int year, int month, int day, int h, int m, int s) throws Exception { |
| | | if (month < 1 || month > 12 || day < 1 || day > 31 || h < 0 || h > 23 || m < 0 || m > 60 || s < 0 || s > 60) { |
| | | throw new IllegalArgumentException("参数不正确!"); |
| | | } |
| | | String yearStr = String.valueOf(year); |
| | | String monthStr = String.valueOf(month); |
| | | String dayStr = String.valueOf(day); |
| | | String hStr = String.valueOf(h); |
| | | String mStr = String.valueOf(m); |
| | | String sStr = String.valueOf(s); |
| | | |
| | | return parseToDate(yearStr + "-" + monthStr + "-" + dayStr + " " + hStr + ":" + mStr + ":" + sStr); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 按指定国家的风格把给定的日期字符串格式化为一个Date型日期 |
| | | * |
| | | * @param dateTimeStr |
| | | * @return java.util.Date类型对象 |
| | | * @throws Exception |
| | | */ |
| | | public static Date parseToDate(String dateTimeStr, Locale locale) throws Exception { |
| | | if (dateTimeStr == null || dateTimeStr.trim().length() < 1 || locale == null) { |
| | | throw new IllegalArgumentException("参数dateTimeSt、locale不能是null或空格串!"); |
| | | } |
| | | int formatStrLength = formatStr.length; |
| | | int i = 0; |
| | | for (i = 0; i < formatStrLength; i++) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat(formatStr[i], locale); |
| | | try { |
| | | return sdf.parse(dateTimeStr); |
| | | } catch (ParseException e) { |
| | | } |
| | | } |
| | | throw new Exception("日期格式不正确!"); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间字符串按操作系统默认的国家风格格式化成"yyyy-MM-dd HH:mm:ss"格式的日期时间串; |
| | | * |
| | | * @param dateTimeStr |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatDateTimetoString(String dateTimeStr) throws Exception { |
| | | return formatDateTimetoString(dateTimeStr, FMT_yyyyMMddHHmmss); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间字符串按指定国家的风格格式化成"yyyy-MM-dd HH:mm:ss"格式的日期时间串; |
| | | * |
| | | * @param dateTimeStr |
| | | * @param locale |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatDateTimetoString(String dateTimeStr, Locale locale) throws Exception { |
| | | return formatDateTimetoString(dateTimeStr, FMT_yyyyMMddHHmmss, locale); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间按操作系统默认的国家内格格式化成"yyyy-MM-dd HH:mm:ss"格式的日期时间串; |
| | | * |
| | | * @param dateTime |
| | | * @return 如果为null,返回"" |
| | | */ |
| | | public static String formatDateTimetoString(Date dateTime) { |
| | | return formatDateTimetoString(dateTime, FMT_yyyyMMddHHmmss); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间按指定国家的风格格式化成"yyyy-MM-dd HH:mm:ss"格式的日期时间串; |
| | | * |
| | | * @param dateTime |
| | | * @param locale |
| | | * @return 如果为null,返回"" |
| | | */ |
| | | public static String formatDateTimetoString(Date dateTime, Locale locale) { |
| | | return formatDateTimetoString(dateTime, FMT_yyyyMMddHHmmss, locale); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期字符串按操作系统默认的国家风格格式化成"yyyy-MM-dd"格式的日期串; |
| | | * |
| | | * @param date |
| | | * @param dateStr 日期串 |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatDatetoString(Date date, String dateStr) throws Exception { |
| | | return formatDateTimetoString(dateStr, FMT_yyyyMMdd); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期字符串按指定国家的风格格式化成"yyyy-MM-dd"格式的日期串; |
| | | * |
| | | * @param dateStr 日期串 |
| | | * @param locale Locale |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatDatetoString(String dateStr, Locale locale) throws Exception { |
| | | return formatDateTimetoString(dateStr, FMT_yyyyMMdd, locale); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期按指定操作系统默认国家的风格格式化成"yyyy-MM-dd"格式的日期串; |
| | | * |
| | | * @param d 日期对象 |
| | | * @return 如果为null,返回"" |
| | | */ |
| | | public static String formatDatetoString(Date d) { |
| | | return formatDateTimetoString(d, FMT_yyyyMMdd); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期按指定国家的风格格式化成"yyyy-MM-dd"格式的日期串; |
| | | * |
| | | * @param d 日期对象 |
| | | * @param locale Locale |
| | | * @return 如果为null,返回"" |
| | | */ |
| | | public static String formatDatetoString(Date d, Locale locale) { |
| | | return formatDateTimetoString(d, FMT_yyyyMMdd, locale); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间字符串按操作系统默认的国家风格格式化成"HH:mm:ss"格式的时间串; |
| | | * |
| | | * @param dateTimeStr |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatTimetoString(String dateTimeStr) throws Exception { |
| | | return formatDateTimetoString(dateTimeStr, FMT_HHmmss); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间字符串按指定国家的风格格式化成"HH:mm:ss"格式的时间串; |
| | | * |
| | | * @param dateTimeStr |
| | | * @param locale |
| | | * @return 如果为null,返回"" |
| | | * @throws Exception |
| | | */ |
| | | public static String formatTimetoString(String dateTimeStr, Locale locale) throws Exception { |
| | | return formatDateTimetoString(dateTimeStr, FMT_HHmmss, locale); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间按指定操作系统默认国家的风格格式化成"HH:mm:ss"格式的时间串; |
| | | * |
| | | * @param dateTimeStr |
| | | * @return 如果为null,返回"" |
| | | */ |
| | | public static String formatTimetoString(Date dateTimeStr) { |
| | | return formatDateTimetoString(dateTimeStr, FMT_HHmmss); |
| | | } |
| | | |
| | | /** |
| | | * 将给定的日期时间按指定国家的风格格式化成"HH:mm:ss"格式的时间串; |
| | | * |
| | | * @param dateTimeStr |
| | | * @param locale |
| | | * @return 如果为null,返回"" |
| | | */ |
| | | public static String formatTimetoString(Date dateTimeStr, Locale locale) { |
| | | return formatDateTimetoString(dateTimeStr, FMT_HHmmss, locale); |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的年份整数 |
| | | * |
| | | * @param d |
| | | * @return 年份 |
| | | */ |
| | | public static int getYearOfDate(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.YEAR); |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的月份整数 |
| | | * |
| | | * @param d |
| | | * @return 月份 |
| | | */ |
| | | public static int getMonthOfYear(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.MONTH) + 1; |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的天份整数,是这个月的第几天 |
| | | * |
| | | * @param d |
| | | * @return 天份 |
| | | */ |
| | | public static int getDayOfMonth(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.DAY_OF_MONTH); |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的天份整数,是这个年份的第几天 |
| | | * |
| | | * @param d |
| | | * @return 天份 |
| | | */ |
| | | public static int getDayOfYear(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.DAY_OF_YEAR); |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的天份整数,是这个周的第几天 |
| | | * |
| | | * @param d |
| | | * @return 天份 |
| | | */ |
| | | public static int getDayOfWeek(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.DAY_OF_WEEK) - 1; |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的周的整数,是这个月的第几周 |
| | | * |
| | | * @param d |
| | | * @return 周 |
| | | */ |
| | | public static int getWeekOfMonth(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.WEEK_OF_MONTH); |
| | | } |
| | | |
| | | /** |
| | | * 返回一个时间的周的整数,是这个年份的第几周 |
| | | * |
| | | * @param d |
| | | * @return 周 |
| | | */ |
| | | public static int getWeekOfYear(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | return calendar.get(Calendar.WEEK_OF_YEAR); |
| | | } |
| | | |
| | | /** |
| | | * 返回该时间所对应的在一天中的小时数的整数,如当前(Date now)是下午3点,返回为15 |
| | | * |
| | | * @param d |
| | | * @return 小时 |
| | | */ |
| | | public static int getHoursOfDay(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | int hours = calendar.get(Calendar.HOUR_OF_DAY); |
| | | return hours; |
| | | } |
| | | |
| | | /** |
| | | * 返回该时间所对应的在一天中的小时数的整数(采用12小时制),如当前(Date now)是下午3点,返回为3 |
| | | * |
| | | * @param d |
| | | * @return 小时 |
| | | */ |
| | | public static int getHoursOfDay12(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | int hours = calendar.get(Calendar.HOUR); |
| | | return hours; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回该时间所对应的分钟数中的整数,如now是15点14分,则返回14 |
| | | * |
| | | * @param d |
| | | * @return 分钟 |
| | | */ |
| | | public static int getMinutesOfHour(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | int minutes = calendar.get(Calendar.MINUTE); |
| | | |
| | | return minutes; |
| | | } |
| | | |
| | | /** |
| | | * 返回该时间所对应的秒数中的整数,如now是15点14分34秒,则返回34 |
| | | * |
| | | * @param d |
| | | * @return 秒 |
| | | */ |
| | | public static int getSecondsOfMinute(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | int seconds = calendar.get(Calendar.SECOND); |
| | | |
| | | return seconds; |
| | | } |
| | | |
| | | /** |
| | | * 返回该时间所对应的毫秒数中的整数,如now是15点14分34秒470毫秒,则返回470 |
| | | * |
| | | * @param d |
| | | * @return 毫秒 |
| | | */ |
| | | public static int getMillisecondsOfSecond(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | int millisecond = calendar.get(Calendar.MILLISECOND); |
| | | |
| | | return millisecond; |
| | | } |
| | | |
| | | /** |
| | | * 返回该时间相对于1970年1月1日开始计算的对应的毫秒数 |
| | | * |
| | | * @param d |
| | | * @return 毫秒数 |
| | | */ |
| | | public static long getTime(Date d) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | return d.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 比较两个时间的先后顺序。 |
| | | * 如果时间d1在d2之前,返回1, |
| | | * 如果时间d1在d2之后,返回-1, |
| | | * 如果二者相等,返回0 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 如果时间d1在d2之前,返回1, |
| | | * 如果时间d1在d2之后,返回-1, |
| | | * 如果二者相等,返回0 |
| | | */ |
| | | public static int compareTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | |
| | | long dI1 = d1.getTime(); |
| | | long dI2 = d2.getTime(); |
| | | |
| | | if (dI1 > dI2) { |
| | | return -1; |
| | | } else if (dI1 < dI2) { |
| | | return 1; |
| | | } else { |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 返回两个日期之间的毫秒数的差距 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 二者至1970年1.1后的毫秒数的差值 |
| | | */ |
| | | public static long getMillisecondsOfTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | long dI1 = d1.getTime(); |
| | | long dI2 = d2.getTime(); |
| | | return (dI1 - dI2); |
| | | } |
| | | |
| | | /** |
| | | * 获得两个日期之间相差的秒数 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 两日期之间相差的秒数 |
| | | */ |
| | | public static double getSecondsOfTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | long i = getMillisecondsOfTwoDate(d1, d2); |
| | | |
| | | return (double) i / 1000; |
| | | } |
| | | |
| | | /** |
| | | * 获得两个日期之间相差的分钟数 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 两日期之间相差的分钟数 |
| | | */ |
| | | public static double getMinutesOfTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | long millions = getMillisecondsOfTwoDate(d1, d2); |
| | | return (double) millions / 60 / 1000; |
| | | } |
| | | |
| | | /** |
| | | * 获得两个日期之间相差的小时数 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 两日期之间相差的小时数 |
| | | */ |
| | | public static double getHoursOfTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | long millions = getMillisecondsOfTwoDate(d1, d2); |
| | | return (double) millions / 60 / 60 / 1000; |
| | | } |
| | | |
| | | /** |
| | | * 获得两个日期之间相差的天数 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 两日期之间相差的天数 |
| | | */ |
| | | public static double getDaysOfTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | long millions = getMillisecondsOfTwoDate(d1, d2); |
| | | return (double) millions / 24 / 60 / 60 / 1000; |
| | | } |
| | | |
| | | /** |
| | | * 获得两个日期之间相差的天数 |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return 两日期之间相差的天数 |
| | | */ |
| | | public static Long daysOfTwoDate(Date d1, Date d2) { |
| | | if (d1 == null || d2 == null) { |
| | | throw new IllegalArgumentException("参数d1或d2不能是null对象!"); |
| | | } |
| | | long millions = getMillisecondsOfTwoDate(d1, d2); |
| | | return millions / 24 / 60 / 60 / 1000; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的时间值,可以为负。 |
| | | * |
| | | * @param d 日期对象 |
| | | * @param times 时间值 |
| | | * @param type 类型, |
| | | * Calendar.MILLISECOND,毫秒<BR> |
| | | * Calendar.SECOND,秒<BR> |
| | | * Calendar.MINUTE,分钟<BR> |
| | | * Calendar.HOUR,小时<BR> |
| | | * Calendar.DATE,日<BR> |
| | | * @return 如果d为null,返回null |
| | | */ |
| | | public static Date addTime(Date d, double times, int type) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | long qv = 1; |
| | | switch (type) { |
| | | case Calendar.MILLISECOND: |
| | | qv = 1; |
| | | break; |
| | | case Calendar.SECOND: |
| | | qv = 1000; |
| | | break; |
| | | case Calendar.MINUTE: |
| | | qv = 1000 * 60; |
| | | break; |
| | | case Calendar.HOUR: |
| | | qv = 1000 * 60 * 60; |
| | | break; |
| | | case Calendar.DATE: |
| | | qv = 1000 * 60 * 60 * 24; |
| | | break; |
| | | default: |
| | | throw new RuntimeException("时间类型不正确!type=" + type); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | long milliseconds = (long) Math.round(Math.abs(times) * qv); |
| | | if (times > 0) { |
| | | for (; milliseconds > 0; milliseconds -= 2147483647) { |
| | | if (milliseconds > 2147483647) { |
| | | calendar.add(Calendar.MILLISECOND, 2147483647); |
| | | } else { |
| | | calendar.add(Calendar.MILLISECOND, (int) milliseconds); |
| | | } |
| | | } |
| | | } else { |
| | | for (; milliseconds > 0; milliseconds -= 2147483647) { |
| | | if (milliseconds > 2147483647) { |
| | | calendar.add(Calendar.MILLISECOND, -2147483647); |
| | | } else { |
| | | calendar.add(Calendar.MILLISECOND, -(int) milliseconds); |
| | | } |
| | | } |
| | | } |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的年份,可以为负, 返回新的被加上了年份的日期对象,不影响参数日期对象值 |
| | | * |
| | | * @param d |
| | | * @param years |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addYears(Date d, int years) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.YEAR, years); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的月份,可以为负 |
| | | * |
| | | * @param d |
| | | * @param months |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addMonths(Date d, int months) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.MONTH, months); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的天数,可以为负 |
| | | * |
| | | * @param d 日期对象 |
| | | * @param days |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addDays(Date d, int days) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.HOUR, days * 24); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的小时,可以为负 |
| | | * |
| | | * @param d 日期对象 |
| | | * @param hours |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addHours(Date d, int hours) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.HOUR, hours); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的分钟,可以为负 |
| | | * |
| | | * @param d |
| | | * @param minutes |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addMinutes(Date d, int minutes) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.MINUTE, minutes); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的秒数,可以为负 |
| | | * |
| | | * @param d |
| | | * @param seconds |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addSeconds(Date d, int seconds) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.SECOND, seconds); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 把给定的时间加上指定的毫秒数,可以为负 |
| | | * |
| | | * @param d |
| | | * @param milliseconds |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date addMilliseconds(Date d, int milliseconds) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.add(Calendar.MILLISECOND, milliseconds); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的年份是新的给定的年份 |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param year 新的年份 |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date setYearOfDate(Date d, int year) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.YEAR, year); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的月份是新的给定的月份 |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param month 新的月份 |
| | | * @return 新日期对象 |
| | | */ |
| | | public static Date setMonthOfDate(Date d, int month) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.MONTH, month); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的天是新的给定的天 |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param day 新的天 |
| | | * @return 新日期对象 |
| | | */ |
| | | public static Date setDayOfDate(Date d, int day) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.DAY_OF_MONTH, day); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的小时是新的给定的小时 |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param hour 新的小时数 |
| | | * @return 新日期对象 |
| | | */ |
| | | public static Date setHourOfDate(Date d, int hour) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.HOUR_OF_DAY, hour); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的分钟是新的给定的分钟数 |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param minute 新的分钟数 |
| | | * @return 新日期对象 |
| | | */ |
| | | public static Date setMinuteOfDate(Date d, int minute) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.MINUTE, minute); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的秒数是新的给定的分钟数 |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param second 新的秒数 |
| | | * @return 新日期对象 |
| | | */ |
| | | public static Date setSecondOfDate(Date d, int second) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.SECOND, second); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 设置一个日期对象的毫秒数是新的给定的分钟数 |
| | | * |
| | | * @param d 需要设定的日期对象 |
| | | * @param millisecond 新的毫秒数 |
| | | * @return 新日期对象 |
| | | */ |
| | | public static Date setMillisecondOfDate(Date d, int millisecond) { |
| | | if (d == null) { |
| | | throw new IllegalArgumentException("参数d不能是null对象!"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(d); |
| | | calendar.set(Calendar.MILLISECOND, millisecond); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回指定日期的月份的天数量 |
| | | * |
| | | * @param d 日期对象 |
| | | */ |
| | | public static int getDaysOfMonth(Date d) { |
| | | int year = getYearOfDate(d); |
| | | int month = getMonthOfYear(d); |
| | | return getDaysOfMonth(year, month); |
| | | } |
| | | |
| | | /** |
| | | * 返回指定日期的月份的天数量 |
| | | * |
| | | * @param year 年 |
| | | * @param month 月 |
| | | */ |
| | | public static int getDaysOfMonth(int year, int month) { |
| | | int days = 0; |
| | | if (month == 2) { |
| | | if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { |
| | | days = 29; |
| | | } else { |
| | | days = 28; |
| | | } |
| | | } |
| | | if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) { |
| | | days = 30; |
| | | } |
| | | if ((month == 1) || (month == 3) || (month == 5) || (month == 7) || (month == 8) || (month == 10) || (month == 12)) { |
| | | days = 31; |
| | | } |
| | | return days; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回系统时间,以日期对象形式返回 |
| | | * |
| | | * @return 日期对象 |
| | | */ |
| | | public static Date getSystemDate() { |
| | | return new Date(System.currentTimeMillis()); |
| | | } |
| | | |
| | | /** |
| | | * 返回系统时间,以毫秒形式返回 |
| | | * |
| | | * @return 毫秒数 |
| | | */ |
| | | public static long getSystemTime() { |
| | | return System.currentTimeMillis(); |
| | | } |
| | | |
| | | /** |
| | | * 返回24小时前的时间 |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date getLastDay(Date date) { |
| | | long day = date.getTime(); |
| | | long lastDay = day - 24 * 60 * 60 * 1000; |
| | | return new Date(lastDay); |
| | | } |
| | | |
| | | /** |
| | | * 返回24小时后的时间 |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date getTomorrow(Date date) { |
| | | long day = date.getTime(); |
| | | long tomorrow = day + 24 * 60 * 60 * 1000; |
| | | return new Date(tomorrow); |
| | | } |
| | | |
| | | /** |
| | | * 取得30天前的这个时间 |
| | | * |
| | | * @return |
| | | */ |
| | | public static Date getDayLastMonth() { |
| | | long day = new Date().getTime(); |
| | | long dayLastMonth = day - 24 * 60 * 60 * 1000 * 20; |
| | | return new Date(dayLastMonth); |
| | | } |
| | | |
| | | /** |
| | | * 取得30天后的这个时间 |
| | | * |
| | | * @return |
| | | */ |
| | | public static Date getDayNextMonth() { |
| | | long day = new Date().getTime(); |
| | | long dayNextMonth = day + 20 * 24 * 60 * 60 * 1000; |
| | | return new Date(dayNextMonth); |
| | | } |
| | | |
| | | public static int getMonthCount(Date sDate, Date eDate) { |
| | | String sDateStr = DateTimeHelper.formatDateTimetoString(sDate, "MM"); |
| | | String eDateStr = DateTimeHelper.formatDateTimetoString(eDate, "MM"); |
| | | int monthCount = Integer.parseInt(eDateStr) - Integer.parseInt(sDateStr) + 1; |
| | | return monthCount; |
| | | } |
| | | |
| | | /** |
| | | * 取得下个月的这天,比如2月1日可取得3月1日,此方法有很大局限性,不能用于月末的天数 |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date getDayNextMonth(Date date) { |
| | | String yearStr = DateTimeHelper.formatDateTimetoString(date, "yyyy"); |
| | | String monthStr = DateTimeHelper.formatDateTimetoString(date, "MM"); |
| | | String dayStr = DateTimeHelper.formatDateTimetoString(date, "dd"); |
| | | int year = Integer.parseInt(yearStr); |
| | | int month = Integer.parseInt(monthStr); |
| | | if (month == 12) { |
| | | month = 1; |
| | | year = year + 1; |
| | | yearStr = String.valueOf(year); |
| | | monthStr = String.valueOf(month); |
| | | } |
| | | |
| | | String dateStr = yearStr + "-" + monthStr + "-" + dayStr; |
| | | try { |
| | | date = DateTimeHelper.parseToDate(dateStr); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return date; |
| | | } |
| | | |
| | | /** |
| | | * 获取当月开始时0点0分0秒 |
| | | * |
| | | * @return |
| | | */ |
| | | public static Date getCurrentMouthStart() { |
| | | Date d = getSystemDate(); |
| | | d = setDayOfDate(d, 1); |
| | | d = setHourOfDate(d, 0); |
| | | d = setMinuteOfDate(d, 0); |
| | | d = setSecondOfDate(d, 0); |
| | | return d; |
| | | } |
| | | |
| | | /** |
| | | * 返回下月的这天 |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date getDateNextMonth(Date date) { |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(date); |
| | | cal.add(Calendar.MONTH, +1); |
| | | return cal.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 根据时间获取和当前时间的差距. |
| | | * |
| | | * @param date - 待比较实际 |
| | | * @return 时间差距字符串 |
| | | */ |
| | | public static String getPassdTime(Date date) { |
| | | if (null == date) { |
| | | return null; |
| | | } |
| | | String ret = null; |
| | | |
| | | // 计算和当前相差秒数 |
| | | long currentTimeMillis = System.currentTimeMillis(); |
| | | long timeDiff = (currentTimeMillis - date.getTime()); |
| | | |
| | | int seconds = (int) (timeDiff / 1000); |
| | | int minutes = seconds / 60; |
| | | int hours = minutes / 60; |
| | | int days = hours / 24; |
| | | int months = days / 30; |
| | | |
| | | if (days <= 7) { |
| | | if (days != 0) { |
| | | ret = days + "天前"; |
| | | } else if (hours != 0) { |
| | | ret = hours + "小时前"; |
| | | } else if (minutes != 0) { |
| | | ret = minutes + "分钟前"; |
| | | } else { |
| | | ret = "刚刚"; |
| | | } |
| | | } else { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");// HH:mm:ss"); |
| | | ret = sdf.format(date); |
| | | } |
| | | |
| | | return ret; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前日期后几天的日期 |
| | | * |
| | | * @param day 天数 |
| | | * @return |
| | | */ |
| | | public static Date getCurrentNextDays(int day) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DAY_OF_YEAR, day); |
| | | Date date = calendar.getTime(); |
| | | return date; |
| | | } |
| | | |
| | | public static String getCurrentStringDate() { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String dateString = simpleDateFormat.format(new Date()); |
| | | return dateString; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前日期是星期几<br> |
| | | * |
| | | * @param dt |
| | | * @return 当前日期是星期几 |
| | | */ |
| | | public static String getWeekOfDate(Date dt) { |
| | | String[] weekDays = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"}; |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(dt); |
| | | int w = cal.get(Calendar.DAY_OF_WEEK) - 1; |
| | | if (w < 0) { |
| | | w = 0; |
| | | } |
| | | return weekDays[w]; |
| | | } |
| | | |
| | | /** |
| | | * 获取今天时间 2017-11-20 00:00:00 |
| | | */ |
| | | public static Date todayDate() { |
| | | try { |
| | | String date = formatDatetoString(new Date()); |
| | | String todayString = date + " 00:00:00"; |
| | | return parseToDate(todayString, FMT_yyyyMMdd); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new Date(); |
| | | } |
| | | |
| | | /** |
| | | * 获取指定日期的 时间 2017-11-20 00:00:00 |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date createDate(Date date) { |
| | | try { |
| | | String dates = formatDatetoString(date); |
| | | String todayString = dates + " 00:00:00"; |
| | | return parseToDate(todayString, FMT_yyyyMMdd); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new Date(); |
| | | } |
| | | |
| | | |
| | | public static String createDateTime(Date date) { |
| | | try { |
| | | String dates = formatDatetoString(date); |
| | | String time = DateTimeHelper.formatDateTimetoString(new Date(), FMT_HHmmss); |
| | | String todayString = dates + " " + time; |
| | | return todayString; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * @param time |
| | | * @return |
| | | */ |
| | | public static String getTimeHint(Date time) { |
| | | String hint = ""; |
| | | double minutes = DateTimeHelper.getMinutesOfTwoDate(new Date(), time); |
| | | double hours = DateTimeHelper.getHoursOfTwoDate(new Date(), time); |
| | | double days = DateTimeHelper.getDaysOfTwoDate(new Date(), time); |
| | | if (minutes < 1) { |
| | | hint = "刚刚"; |
| | | } else if (hours < 1) { |
| | | hint = new Double(minutes).intValue() + "分钟前"; |
| | | } else if (days < 1) { |
| | | hint = new Double(hours).intValue() + "小时前"; |
| | | } else if (days < 7) { |
| | | hint = new Double(days).intValue() + "天前"; |
| | | } else { |
| | | hint = DateTimeHelper.formatDateTimetoString(time, DateTimeHelper.FMT_yyyyMMdd); |
| | | } |
| | | return hint; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据时间获取和当前时间的差距. |
| | | * |
| | | * @param date - 待比较实际 |
| | | * @return 时间差距字符串 |
| | | */ |
| | | public static String getLoginTime(Date date) { |
| | | if (null == date) { |
| | | return null; |
| | | } |
| | | String ret = null; |
| | | |
| | | // 计算和当前相差秒数 |
| | | long currentTimeMillis = System.currentTimeMillis(); |
| | | long timeDiff = (currentTimeMillis - date.getTime()); |
| | | |
| | | int seconds = (int) (timeDiff / 1000); |
| | | int minutes = seconds / 60; |
| | | int hours = minutes / 60; |
| | | int days = hours / 24; |
| | | int months = days / 30; |
| | | |
| | | if (months != 0) { |
| | | ret = "1个月前"; |
| | | } else if (days != 0) { |
| | | ret = days + "天前"; |
| | | } else if (hours != 0) { |
| | | ret = hours + "小时前"; |
| | | } else if (minutes != 0) { |
| | | ret = minutes + "分钟前"; |
| | | } else { |
| | | ret = "刚刚"; |
| | | } |
| | | |
| | | return ret; |
| | | } |
| | | |
| | | |
| | | public static Date getWXTime() { |
| | | |
| | | Calendar calendar = Calendar.getInstance(Locale.CHINA); |
| | | Date date = calendar.getTime(); |
| | | |
| | | return date; |
| | | } |
| | | |
| | | /** |
| | | * 是否是同一天 |
| | | * |
| | | * @param first |
| | | * @param second |
| | | * @return |
| | | */ |
| | | public static Boolean isSameDay(Date first, Date second) { |
| | | |
| | | if (first == null || second == null) { |
| | | return false; |
| | | } |
| | | |
| | | int day1 = getDayOfYear(first); |
| | | int day2 = getDayOfYear(second); |
| | | if (day1 != day2) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 是否超过指定时刻 |
| | | * |
| | | * @param day 时间 |
| | | * @param time 指定时刻 |
| | | * @return |
| | | */ |
| | | public static Boolean expireDayTime(Date day, Integer time) { |
| | | if (null == day) { |
| | | return false; |
| | | } |
| | | try { |
| | | String dates = formatDatetoString(day); |
| | | String timeHour = ""; |
| | | for (int i = 0; i <= 23; i++) { |
| | | if (i == time) { |
| | | if (i < 10) { |
| | | timeHour += " 0" + time + ":00:00"; |
| | | } else if (i < 23) { |
| | | timeHour += " " + time + ":00:00"; |
| | | } else { |
| | | timeHour += " 00" + time + ":00:00"; |
| | | } |
| | | } |
| | | } |
| | | String todayString = dates + timeHour; |
| | | Date esDayTime = parseToDate(todayString, FMT_yyyyMMddHHmmss); |
| | | if (DateTimeHelper.compareTwoDate(day, esDayTime) != 1) { |
| | | int i = compareTwoDate(day, esDayTime); |
| | | System.out.println(i); |
| | | return true; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 指定一天哪一个小时 |
| | | * |
| | | * @param time |
| | | * @return |
| | | */ |
| | | public static Date createDayTime(Integer time) { |
| | | String dates = formatDatetoString(new Date()); |
| | | String timeHour = ""; |
| | | for (int i = 0; i <= 23; i++) { |
| | | if (i == time) { |
| | | if (i < 10) { |
| | | timeHour += " 0" + time + ":00:00"; |
| | | } else if (i < 23) { |
| | | timeHour += " " + time + ":00:00"; |
| | | } else { |
| | | timeHour += " 00" + time + ":00:00"; |
| | | } |
| | | } |
| | | } |
| | | String todayString = dates + timeHour; |
| | | Date esDayTime = new Date(); |
| | | try { |
| | | esDayTime = parseToDate(todayString, FMT_yyyyMMddHHmmss); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | return esDayTime; |
| | | } |
| | | |
| | | /** |
| | | * 数字换算成中文(周) |
| | | * |
| | | * @param time |
| | | * @return |
| | | */ |
| | | public static String getWeekString(Integer time) { |
| | | if (time == 1) { |
| | | return "一"; |
| | | } else if (time == 2) { |
| | | return "二"; |
| | | } else if (time == 3) { |
| | | return "三"; |
| | | } else if (time == 4) { |
| | | return "四"; |
| | | } else if (time == 5) { |
| | | return "五"; |
| | | } else if (time == 6) { |
| | | return "六"; |
| | | } else if (time == 0 || time == 7) { |
| | | return "日"; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * LocalDateTime -> Date |
| | | * |
| | | * @param localDateTime |
| | | * @return |
| | | */ |
| | | public static Date asDate(LocalDateTime localDateTime) { |
| | | return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | /** |
| | | * Date -> LocalDateTime |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static LocalDateTime asLocalDateTime(Date date) { |
| | | return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDateTime(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取两个时间的间隔(秒) |
| | | * |
| | | * @param d1 |
| | | * @param d2 |
| | | * @return |
| | | */ |
| | | public static long getDateBetween(Date d1, Date d2) { |
| | | return Math.abs((d1.getTime() - d2.getTime()) / 1000);//取绝对值 |
| | | } |
| | | |
| | | /** |
| | | * @param date |
| | | * @return 获取今天最后的时间 |
| | | */ |
| | | public static Date getEndDate(Date date) { |
| | | if (date == null) { |
| | | return null; |
| | | } |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(date); |
| | | c.set(Calendar.HOUR_OF_DAY, 23); |
| | | c.set(Calendar.MINUTE, 59); |
| | | c.set(Calendar.SECOND, 59); |
| | | return c.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * 日期天数差 |
| | | */ |
| | | public static int daysBetween(Date today, Date endDate) throws ParseException { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | today = sdf.parse(sdf.format(today)); |
| | | endDate = sdf.parse(sdf.format(endDate)); |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(today); |
| | | long time1 = cal.getTimeInMillis(); |
| | | cal.setTime(endDate); |
| | | long time2 = cal.getTimeInMillis(); |
| | | long between_days = (time2 - time1) / (1000 * 3600 * 24); |
| | | return Integer.parseInt(String.valueOf(between_days)); |
| | | } |
| | | |
| | | /** |
| | | * 获取到当月所有日期 |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static List<Date> getAllTheDateOftheMonth(Date date) { |
| | | List<Date> list = new ArrayList<Date>(); |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(date); |
| | | cal.set(Calendar.DATE, 1); |
| | | |
| | | int month = cal.get(Calendar.MONTH); |
| | | while (cal.get(Calendar.MONTH) == month) { |
| | | list.add(cal.getTime()); |
| | | cal.add(Calendar.DATE, 1); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /*public static void main(String[] args) throws ParseException { |
| | | List<Date> allTheDateOftheMonth = getAllTheDateOftheMonth(new Date()); |
| | | Date date = allTheDateOftheMonth.get(11); |
| | | System.out.println(date.toLocaleString()); |
| | | int i = daysBetween(new Date(), date); |
| | | System.out.println(i); |
| | | }*/ |
| | | |
| | | |
| | | } |
New file |
| | |
| | | ///** |
| | | // * Copyright (c) 2015-2016, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | // * <p> |
| | | // * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | // * you may not use this file except in compliance with the License. |
| | | // * You may obtain a copy of the License at |
| | | // * <p> |
| | | // * http://www.apache.org/licenses/LICENSE-2.0 |
| | | // * <p> |
| | | // * Unless required by applicable law or agreed to in writing, software |
| | | // * distributed under the License is distributed on an "AS IS" BASIS, |
| | | // * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | // * See the License for the specific language governing permissions and |
| | | // * limitations under the License. |
| | | // */ |
| | | //package com.dsh.app.util; |
| | | // |
| | | //import org.apache.commons.lang3.StringUtils; |
| | | //import org.apache.commons.lang3.time.DateFormatUtils; |
| | | //import org.apache.commons.lang3.time.DateUtils; |
| | | // |
| | | //import java.sql.Timestamp; |
| | | //import java.text.DateFormat; |
| | | //import java.text.ParseException; |
| | | //import java.text.SimpleDateFormat; |
| | | //import java.util.Calendar; |
| | | //import java.util.Date; |
| | | //import java.util.TimeZone; |
| | | // |
| | | //public class DateUtil { |
| | | // |
| | | // private static TimeZone tz = TimeZone.getTimeZone("GMT+8"); |
| | | // |
| | | // /** |
| | | // * 获取YYYY格式 |
| | | // */ |
| | | // public static String getYear() { |
| | | // return formatDate(new Date(), "yyyy"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 获取YYYY格式 |
| | | // */ |
| | | // public static String getYear(Date date) { |
| | | // return formatDate(date, "yyyy"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 获取YYYY-MM-DD格式 |
| | | // */ |
| | | // public static String getDay() { |
| | | // return formatDate(new Date(), "yyyy-MM-dd"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 获取YYYY-MM-DD格式 |
| | | // */ |
| | | // public static String getDay(Date date) { |
| | | // return formatDate(date, "yyyy-MM-dd"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 获取YYYYMMDD格式 |
| | | // */ |
| | | // public static String getDays() { |
| | | // return formatDate(new Date(), "yyyyMMdd"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 获取YYYYMMDD格式 |
| | | // */ |
| | | // public static String getDays(Date date) { |
| | | // return formatDate(date, "yyyyMMdd"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 获取YYYY-MM-DD HH:mm:ss格式 |
| | | // */ |
| | | // public static String getTime() { |
| | | // return formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 获取YYYY-MM-DD HH:mm:ss.SSS格式 |
| | | // */ |
| | | // public static String getMsTime() { |
| | | // return formatDate(new Date(), "yyyy-MM-dd HH:mm:ss.SSS"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 获取YYYYMMDDHHmmss格式 |
| | | // */ |
| | | // public static String getAllTime() { |
| | | // return formatDate(new Date(), "yyyyMMddHHmmss"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 获取YYYY-MM-DD HH:mm:ss格式 |
| | | // */ |
| | | // public static String getTime(Date date) { |
| | | // return formatDate(date, "yyyy-MM-dd HH:mm:ss"); |
| | | // } |
| | | // |
| | | // public static String formatDate(Date date, String pattern) { |
| | | // String formatDate = null; |
| | | // if (StringUtils.isNotBlank(pattern)) { |
| | | // formatDate = DateFormatUtils.format(date, pattern); |
| | | // } else { |
| | | // formatDate = DateFormatUtils.format(date, "yyyy-MM-dd"); |
| | | // } |
| | | // return formatDate; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 日期比较,如果s>=e 返回true 否则返回false) |
| | | // * |
| | | // * @author luguosui |
| | | // */ |
| | | // public static boolean compareDate(String s, String e) { |
| | | // if (parseDate(s) == null || parseDate(e) == null) { |
| | | // return false; |
| | | // } |
| | | // return parseDate(s).getTime() >= parseDate(e).getTime(); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 格式化日期 |
| | | // */ |
| | | // public static Date parseDate(String date) { |
| | | // return parse(date, "yyyy-MM-dd"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 格式化日期 |
| | | // */ |
| | | // public static Date parseTimeMinutes(String date) { |
| | | // return parse(date, "yyyy-MM-dd HH:mm"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 格式化日期 |
| | | // */ |
| | | // public static Date parseTime(String date) { |
| | | // return parse(date, "yyyy-MM-dd HH:mm:ss"); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 格式化日期 |
| | | // */ |
| | | // public static Date parse(String date, String pattern) { |
| | | // try { |
| | | // return DateUtils.parseDate(date, pattern); |
| | | // } catch (ParseException e) { |
| | | // e.printStackTrace(); |
| | | // return null; |
| | | // } |
| | | // } |
| | | // |
| | | // /** |
| | | // * 格式化日期 |
| | | // */ |
| | | // public static String format(Date date, String pattern) { |
| | | // return DateFormatUtils.format(date, pattern); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 把日期转换为Timestamp |
| | | // */ |
| | | // public static Timestamp format(Date date) { |
| | | // return new Timestamp(date.getTime()); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 校验日期是否合法 |
| | | // */ |
| | | // public static boolean isValidDate(String s) { |
| | | // return parse(s, "yyyy-MM-dd HH:mm:ss") != null; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 校验日期是否合法 |
| | | // */ |
| | | // public static boolean isValidDate(String s, String pattern) { |
| | | // return parse(s, pattern) != null; |
| | | // } |
| | | // |
| | | // public static int getDiffYear(String startTime, String endTime) { |
| | | // DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // try { |
| | | // int years = (int) (((fmt.parse(endTime).getTime() - fmt.parse( |
| | | // startTime).getTime()) / (1000 * 60 * 60 * 24)) / 365); |
| | | // return years; |
| | | // } catch (Exception e) { |
| | | // // 如果throw java.text.ParseException或者NullPointerException,就说明格式不对 |
| | | // return 0; |
| | | // } |
| | | // } |
| | | // |
| | | // /** |
| | | // * <li>功能描述:时间相减得到天数 |
| | | // */ |
| | | // public static long getDaySub(String beginDateStr, String endDateStr) { |
| | | // long day = 0; |
| | | // SimpleDateFormat format = new SimpleDateFormat( |
| | | // "yyyy-MM-dd"); |
| | | // Date beginDate = null; |
| | | // Date endDate = null; |
| | | // |
| | | // try { |
| | | // beginDate = format.parse(beginDateStr); |
| | | // endDate = format.parse(endDateStr); |
| | | // } catch (ParseException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // day = (endDate.getTime() - beginDate.getTime()) / (24 * 60 * 60 * 1000); |
| | | // // System.out.println("相隔的天数="+day); |
| | | // |
| | | // return day; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 得到n天之后的日期 |
| | | // */ |
| | | // public static String getAfterDayDate(String days) { |
| | | // int daysInt = Integer.parseInt(days); |
| | | // |
| | | // Calendar canlendar = Calendar.getInstance(); // java.util包 |
| | | // canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 |
| | | // Date date = canlendar.getTime(); |
| | | // |
| | | // SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // String dateStr = sdfd.format(date); |
| | | // |
| | | // return dateStr; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 得到n天之后是周几 |
| | | // */ |
| | | // public static String getAfterDayWeek(String days) { |
| | | // int daysInt = Integer.parseInt(days); |
| | | // |
| | | // Calendar canlendar = Calendar.getInstance(); // java.util包 |
| | | // canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 |
| | | // Date date = canlendar.getTime(); |
| | | // |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("E"); |
| | | // String dateStr = sdf.format(date); |
| | | // |
| | | // return dateStr; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 得到系统日期 |
| | | // * |
| | | // * @return |
| | | // */ |
| | | // public static Date getDate() { |
| | | // TimeZone.setDefault(tz); |
| | | // return new Date(); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 获取当前毫秒数 |
| | | // * |
| | | // * @return long |
| | | // */ |
| | | // public static long getCurMilli() { |
| | | // long millisecond = 0; |
| | | // Calendar cal = Calendar.getInstance(); |
| | | // millisecond = cal.getTimeInMillis(); |
| | | // return millisecond; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 得到系统Calendar日期 |
| | | // * |
| | | // * @return |
| | | // */ |
| | | // public static Calendar getCalendar() { |
| | | // TimeZone.setDefault(tz); |
| | | // Calendar cal = Calendar.getInstance(); |
| | | // return cal; |
| | | // } |
| | | // /** |
| | | // * 毫秒转日期时间 |
| | | // * |
| | | // * @param millisecond |
| | | // * @return |
| | | // */ |
| | | // public static String getDateTime(long millisecond) { |
| | | // if (millisecond == 0) { |
| | | // millisecond = getCurMilli(); |
| | | // } |
| | | // SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // Calendar calendar = getCalendar(); |
| | | // calendar.setTimeInMillis(millisecond); |
| | | // return dateformat.format(calendar.getTime()); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 日期转毫秒(加分钟) |
| | | // * |
| | | // * @param date |
| | | // * @return |
| | | // */ |
| | | // public static long getMillisecond_fz(String date, Integer day) { |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // String newDate = ""; |
| | | // if ("".equals(date)) { |
| | | // newDate = sdf.format(DateUtil.getDate()); |
| | | // } else { |
| | | // newDate = getDateTime(Long.parseLong(date)); |
| | | // } |
| | | // Date dt = null; |
| | | // try { |
| | | // dt = sdf.parse(newDate); |
| | | // } catch (ParseException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // Calendar rightNow = Calendar.getInstance(); |
| | | // rightNow.setTime(dt); |
| | | // rightNow.add(Calendar.MINUTE, day); |
| | | // Date dt1 = rightNow.getTime(); |
| | | // return dt1.getTime(); |
| | | // } |
| | | // |
| | | //} |
New file |
| | |
| | | package com.dsh.course.util; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * Double文档 |
| | | */ |
| | | public class DoubleUtil { |
| | | |
| | | public static Double format(Double num) { |
| | | BigDecimal b = new BigDecimal(num); |
| | | num = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | return num; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.util; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | public class EmojiUtil { |
| | | /** |
| | | * 编码 |
| | | * |
| | | * @param str 待转换字符串 |
| | | * @return 转换后字符串 |
| | | * @throws UnsupportedEncodingException exception |
| | | * @Description 将字符串中的emoji表情转换成可以在utf-8字符集数据库中保存的格式(表情占4个字节,需要utf8mb4字符集) |
| | | */ |
| | | public static String emojiEncode(String str) |
| | | throws UnsupportedEncodingException { |
| | | String patternString = "([\\x{10000}-\\x{10ffff}\ud800-\udfff])"; |
| | | |
| | | Pattern pattern = Pattern.compile(patternString); |
| | | Matcher matcher = pattern.matcher(str); |
| | | StringBuffer sb = new StringBuffer(); |
| | | while (matcher.find()) { |
| | | try { |
| | | matcher.appendReplacement( |
| | | sb, |
| | | "[[" |
| | | + URLEncoder.encode(matcher.group(1), |
| | | "UTF-8") + "]]"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | // LOG.error("emojiConvert error", e); |
| | | throw e; |
| | | } |
| | | } |
| | | matcher.appendTail(sb); |
| | | // LOG.debug("emojiConvert " + str + " to " + sb.toString() |
| | | // + ", len:" + sb.length()); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 解码 |
| | | * |
| | | * @param str 转换后的字符串 |
| | | * @return 转换前的字符串 |
| | | * @throws UnsupportedEncodingException exception |
| | | * @Description 还原utf8数据库中保存的含转换后emoji表情的字符串 |
| | | */ |
| | | public static String emojiDecode(String str) |
| | | throws UnsupportedEncodingException { |
| | | String patternString = "\\[\\[(.*?)\\]\\]"; |
| | | |
| | | Pattern pattern = Pattern.compile(patternString); |
| | | if (str == null) { |
| | | return str; |
| | | } |
| | | Matcher matcher = pattern.matcher(str); |
| | | |
| | | StringBuffer sb = new StringBuffer(); |
| | | while (matcher.find()) { |
| | | try { |
| | | matcher.appendReplacement(sb, |
| | | URLDecoder.decode(matcher.group(1), "UTF-8")); |
| | | } catch (UnsupportedEncodingException e) { |
| | | // LOG.error("emojiRecovery error", e); |
| | | throw e; |
| | | } |
| | | } |
| | | matcher.appendTail(sb); |
| | | // LOG.debug("emojiRecovery " + str + " to " + sb.toString()); |
| | | // System.out.println("emojiRecovery " + str + " to " + sb.toString()); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * @param str 待过滤字符串 |
| | | * @return 过滤后字符串 |
| | | * exception |
| | | * @Description 将字符串中的emoji表情过滤掉 |
| | | */ |
| | | public static String emojiSub(String str) { |
| | | String patternString = "([\\x{10000}-\\x{10ffff}\ud800-\udfff])"; |
| | | Pattern pattern = Pattern.compile(patternString); |
| | | Matcher matcher = pattern.matcher(str); |
| | | StringBuffer sb = new StringBuffer(); |
| | | while (matcher.find()) { |
| | | matcher.appendReplacement(sb, ""); |
| | | } |
| | | matcher.appendTail(sb); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.GoogleMap; |
| | | |
| | | public class AddressComponentsVo { |
| | | /** |
| | | * 长名称 |
| | | */ |
| | | private String longName; |
| | | /** |
| | | * 短名称 |
| | | */ |
| | | private String shortName; |
| | | |
| | | public String getLongName() { |
| | | return longName; |
| | | } |
| | | |
| | | public void setLongName(String longName) { |
| | | this.longName = longName; |
| | | } |
| | | |
| | | public String getShortName() { |
| | | return shortName; |
| | | } |
| | | |
| | | public void setShortName(String shortName) { |
| | | this.shortName = shortName; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.GoogleMap; |
| | | |
| | | public class DistancematrixVo { |
| | | /** |
| | | * 预估时间(秒) |
| | | */ |
| | | private Long duration; |
| | | |
| | | /** |
| | | * 预估里程(米) |
| | | */ |
| | | private Long distance; |
| | | |
| | | public Long getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(Long duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public Long getDistance() { |
| | | return distance; |
| | | } |
| | | |
| | | public void setDistance(Long distance) { |
| | | this.distance = distance; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.GoogleMap; |
| | | |
| | | public class FindPlaceFromTextVo { |
| | | /** |
| | | * 名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 详细地址 |
| | | */ |
| | | private String address; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private Double lat; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private Double lng; |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getAddress() { |
| | | return address; |
| | | } |
| | | |
| | | public void setAddress(String address) { |
| | | this.address = address; |
| | | } |
| | | |
| | | public Double getLat() { |
| | | return lat; |
| | | } |
| | | |
| | | public void setLat(Double lat) { |
| | | this.lat = lat; |
| | | } |
| | | |
| | | public Double getLng() { |
| | | return lng; |
| | | } |
| | | |
| | | public void setLng(Double lng) { |
| | | this.lng = lng; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.GoogleMap; |
| | | |
| | | public class GeocodeVo { |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private double lat; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private double lng; |
| | | |
| | | public double getLat() { |
| | | return lat; |
| | | } |
| | | |
| | | public void setLat(double lat) { |
| | | this.lat = lat; |
| | | } |
| | | |
| | | public double getLng() { |
| | | return lng; |
| | | } |
| | | |
| | | public void setLng(double lng) { |
| | | this.lng = lng; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.GoogleMap; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.maps.*; |
| | | import com.google.maps.model.*; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.Instant; |
| | | |
| | | /** |
| | | * 谷歌地图工具类 |
| | | */ |
| | | @Component |
| | | public class GoogleMapUtil { |
| | | |
| | | private final String key = "AIzaSyBNgMRPVj8zt4OEGrUoyHifEDE9SCHYSLE"; |
| | | |
| | | |
| | | /** |
| | | * 地理编码(地址获取位置坐标) |
| | | * @param address 地址信息 |
| | | * @throws Exception |
| | | */ |
| | | public GeocodeVo getGeocode(String address) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | GeocodingResult[] results = GeocodingApi.geocode(context, address).await(); |
| | | GeocodeVo vo = null; |
| | | if(results.length > 0){ |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(results[0].addressComponents)); |
| | | |
| | | Geometry geometry = results[0].geometry; |
| | | LatLng location = geometry.location; |
| | | vo = new GeocodeVo(); |
| | | vo.setLat(location.lat); |
| | | vo.setLng(location.lng); |
| | | } |
| | | context.shutdown(); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 逆地理编码获取地址信息 |
| | | * @param lat 纬度 |
| | | * @param lng 经度 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ReverseGeocodeVo getReverseGeocode(double lat, double lng) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | GeocodingApiRequest request = GeocodingApi.reverseGeocode(context, new LatLng(lat, lng)); |
| | | GeocodingResult[] results = request.await(); |
| | | ReverseGeocodeVo vo = null; |
| | | if(results.length > 0){ |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(results[0].addressComponents)); |
| | | |
| | | |
| | | vo = new ReverseGeocodeVo(); |
| | | AddressComponent[] addressComponents = results[0].addressComponents; |
| | | AddressComponentsVo[] addressComponentsVos = new AddressComponentsVo[addressComponents.length]; |
| | | for (int i = 0; i < addressComponents.length; i++) { |
| | | AddressComponentsVo addressComponentsVos1 = new AddressComponentsVo(); |
| | | addressComponentsVos1.setLongName(addressComponents[i].longName); |
| | | addressComponentsVos1.setShortName(addressComponents[i].shortName); |
| | | addressComponentsVos[i] = addressComponentsVos1; |
| | | } |
| | | String address = results[0].formattedAddress; |
| | | vo.setAddressComponentsVos(addressComponentsVos); |
| | | vo.setAddress(address); |
| | | } |
| | | context.shutdown(); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 搜索地图获取地图结果 |
| | | * @param input |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public FindPlaceFromTextVo findplacefromtext(String input) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | FindPlaceFromTextRequest request = new FindPlaceFromTextRequest(context); |
| | | request.input(input); |
| | | request.inputType(FindPlaceFromTextRequest.InputType.TEXT_QUERY); |
| | | FindPlaceFromText findPlaceFromText = request.await(); |
| | | PlacesSearchResult[] candidates = findPlaceFromText.candidates; |
| | | FindPlaceFromTextVo vo = null; |
| | | System.err.println(JSON.toJSONString(candidates)); |
| | | if(candidates.length > 0){ |
| | | vo = new FindPlaceFromTextVo(); |
| | | String formattedAddress = candidates[0].formattedAddress; |
| | | String name = candidates[0].name; |
| | | Geometry geometry = candidates[0].geometry; |
| | | if(null == geometry){//没有返回结果,使用place_id继续搜索 |
| | | // [{"permanentlyClosed":false,"placeId":"ChIJy1edVzvF7zYRaOqiGTkmb6I","rating":0.0,"userRatingsTotal":0}] |
| | | String placeId = candidates[0].placeId; |
| | | |
| | | |
| | | } |
| | | LatLng location = geometry.location; |
| | | double lat = location.lat; |
| | | double lng = location.lng; |
| | | |
| | | vo.setName(name); |
| | | vo.setAddress(formattedAddress); |
| | | vo.setLat(lat); |
| | | vo.setLng(lng); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 模糊搜索地图内容 |
| | | * @param query |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public FindPlaceFromTextVo textsearch(String query) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | TextSearchRequest request = new TextSearchRequest(context); |
| | | request.query(query); |
| | | PlacesSearchResponse placesSearchResponse = request.await(); |
| | | PlacesSearchResult[] results = placesSearchResponse.results; |
| | | FindPlaceFromTextVo vo = null; |
| | | System.err.println(JSON.toJSONString(results)); |
| | | if(results.length > 0){ |
| | | vo = new FindPlaceFromTextVo(); |
| | | String formattedAddress = results[0].formattedAddress; |
| | | String name = results[0].name; |
| | | Geometry geometry = results[0].geometry; |
| | | LatLng location = geometry.location; |
| | | double lat = location.lat; |
| | | double lng = location.lng; |
| | | |
| | | vo.setName(name); |
| | | vo.setAddress(formattedAddress); |
| | | vo.setLat(lat); |
| | | vo.setLng(lng); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取两个地点之间的预估里程和预估时间 |
| | | * @param origin 起点名称 |
| | | * @param destination 终点名称 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public DistancematrixVo getDistancematrix(String origin, String destination) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | DistanceMatrixApiRequest request = DistanceMatrixApi.getDistanceMatrix(context, new String[]{origin}, new String[]{destination}); |
| | | request.mode(TravelMode.DRIVING);//出行方式(驾车) |
| | | request.avoid(DirectionsApi.RouteRestriction.TOLLS); |
| | | request.trafficModel(TrafficModel.BEST_GUESS); |
| | | request.departureTime(Instant.now()); |
| | | DistanceMatrix distanceMatrix = request.await(); |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(distanceMatrix)); |
| | | context.shutdown(); |
| | | |
| | | DistanceMatrixElement elements = distanceMatrix.rows[0].elements[0]; |
| | | DistancematrixVo vo = new DistancematrixVo(); |
| | | vo.setDistance(elements.distance.inMeters); |
| | | vo.setDuration(elements.duration.inSeconds); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取两点之间的距离 |
| | | * @param sLat |
| | | * @param sLnt |
| | | * @param eLat |
| | | * @param eLnt |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public DistancematrixVo getDistancematrix(Double sLat, Double sLnt, Double eLat, Double eLnt) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | DistanceMatrixApiRequest request = DistanceMatrixApi.newRequest(context); |
| | | request.origins(new LatLng(sLat, sLnt)); |
| | | request.destinations(new LatLng(eLat, eLnt)); |
| | | request.mode(TravelMode.DRIVING);//出行方式(驾车) |
| | | request.avoid(DirectionsApi.RouteRestriction.TOLLS); |
| | | request.trafficModel(TrafficModel.BEST_GUESS); |
| | | request.departureTime(Instant.now()); |
| | | DistanceMatrix distanceMatrix = request.await(); |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(distanceMatrix)); |
| | | context.shutdown(); |
| | | |
| | | DistanceMatrixElement elements = distanceMatrix.rows[0].elements[0]; |
| | | DistancematrixVo vo = new DistancematrixVo(); |
| | | vo.setDistance(elements.distance.inMeters); |
| | | vo.setDuration(elements.duration.inSeconds); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取两地点之间的线路规划 |
| | | * @param origin 起点 要计算方向的位置ID、地址或文本纬度/经度值。目标参数的选项与原点参数的相同。 |
| | | * @param destination 终点 要计算方向的位置ID、地址或文本纬度/经度值。目标参数的选项与原点参数的相同。 |
| | | * |
| | | */ |
| | | public void getDirections(String origin, String destination) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | DirectionsApiRequest directions = DirectionsApi.getDirections(context, origin, destination); |
| | | directions.mode(TravelMode.BICYCLING);//出行方式(骑行) |
| | | DirectionsResult result = directions.await(); |
| | | |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(result)); |
| | | context.shutdown(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public void main(String[] ages){ |
| | | try { |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.GoogleMap; |
| | | |
| | | public class ReverseGeocodeVo { |
| | | /** |
| | | * 完整地址名称 |
| | | */ |
| | | private String address; |
| | | /** |
| | | * 分段地址名称数组 |
| | | */ |
| | | private AddressComponentsVo[] addressComponentsVos; |
| | | |
| | | |
| | | public String getAddress() { |
| | | return address; |
| | | } |
| | | |
| | | public void setAddress(String address) { |
| | | this.address = address; |
| | | } |
| | | |
| | | public AddressComponentsVo[] getAddressComponentsVos() { |
| | | return addressComponentsVos; |
| | | } |
| | | |
| | | public void setAddressComponentsVos(AddressComponentsVo[] addressComponentsVos) { |
| | | this.addressComponentsVos = addressComponentsVos; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.util; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | public class HeaderAuthUtil { |
| | | |
| | | /** |
| | | * 用户UserId变量 |
| | | */ |
| | | protected final static String HEADER_USERID = "userId"; |
| | | |
| | | /** |
| | | * 获取Request请求头UserId |
| | | * @return |
| | | */ |
| | | public static String getLoginAuthUserId (HttpServletRequest request) { |
| | | String userId = request.getHeader(HEADER_USERID); |
| | | return userId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.JavaType; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * 返回json数据封装工具类 |
| | | * |
| | | * @ClassName: JsonUtil |
| | | * @author: yuds |
| | | * @date: 2019-09-20 09:19:27 |
| | | * @version: V1.0.0 |
| | | */ |
| | | public class JsonUtil { |
| | | |
| | | /** |
| | | * <li>将对象转化为json输出 |
| | | * <li>QuoteFieldNames ———-输出key时是否使用双引号,默认为true |
| | | * <li>WriteMapNullValue ——–是否输出值为null的字段,默认为false |
| | | * <li>WriteNullNumberAsZero —-数值字段如果为null,输出为0,而非null |
| | | * <li>WriteNullListAsEmpty —–List字段如果为null,输出为[],而非null |
| | | * <li>WriteNullStringAsEmpty —字符类型字段如果为null,输出为”“,而非null |
| | | * <li>WriteNullBooleanAsFalse –Boolean字段如果为null,输出为false,而非null |
| | | * <li>DisableCircularReferenceDetect 禁止循环引用检测 |
| | | */ |
| | | private static SerializerFeature[] serializerFeaturess = { SerializerFeature.WriteMapNullValue, |
| | | SerializerFeature.WriteNullNumberAsZero, SerializerFeature.WriteNullListAsEmpty, |
| | | SerializerFeature.WriteNullStringAsEmpty, SerializerFeature.WriteNullBooleanAsFalse, |
| | | SerializerFeature.DisableCircularReferenceDetect, }; |
| | | |
| | | private JsonUtil() { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * fastJson Object转json |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | public static String objToJson(Object obj) { |
| | | return JSON.toJSONString(obj, serializerFeaturess); |
| | | } |
| | | |
| | | /** |
| | | * fastJson Object转json |
| | | * |
| | | * @param obj |
| | | * @param dateFormat 时间格式化 |
| | | * @return |
| | | */ |
| | | public static String objToJson(Object obj, String dateFormat) { |
| | | return JSON.toJSONStringWithDateFormat(obj, dateFormat, serializerFeaturess); |
| | | } |
| | | |
| | | // 定义jackson对象 |
| | | private static final ObjectMapper MAPPER = new ObjectMapper(); |
| | | |
| | | /** |
| | | * 将对象转换成json字符串。 |
| | | * <p> |
| | | * Title: pojoToJson |
| | | * </p> |
| | | * <p> |
| | | * Description: |
| | | * </p> |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public static String objectToJson(Object data) { |
| | | try { |
| | | SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | MAPPER.setDateFormat(fmt); |
| | | String string = MAPPER.writeValueAsString(data); |
| | | return string; |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 将json结果集转化为对象 |
| | | * |
| | | * @param jsonData json数据 |
| | | * @param beanType 对象中的object类型 |
| | | * @return |
| | | */ |
| | | public static <T> T jsonToPojo(String jsonData, Class<T> beanType) { |
| | | try { |
| | | T t = MAPPER.readValue(jsonData, beanType); |
| | | return t; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 将json数据转换成pojo对象list |
| | | * <p> |
| | | * Title: jsonToList |
| | | * </p> |
| | | * <p> |
| | | * Description: |
| | | * </p> |
| | | * |
| | | * @param jsonData |
| | | * @param beanType |
| | | * @return |
| | | */ |
| | | public static <T> List<T> jsonToList(String jsonData, Class<T> beanType) { |
| | | JavaType javaType = MAPPER.getTypeFactory().constructParametricType(List.class, beanType); |
| | | try { |
| | | List<T> list = MAPPER.readValue(jsonData, javaType); |
| | | return list; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | public static JsonNode jsonToNode(String jsonData) { |
| | | try { |
| | | return MAPPER.readTree(jsonData); |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static Map<String, String> jsonToMap(String json) { |
| | | JsonNode nodes = jsonToNode(json); |
| | | Iterator<Map.Entry<String, JsonNode>> fields = nodes.fields(); |
| | | Map<String, String> map = new HashMap<>(); |
| | | while (fields.hasNext()) { |
| | | Map.Entry<String, JsonNode> next = fields.next(); |
| | | String value = next.getValue().asText(""); |
| | | map.put(next.getKey(), value); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.util; |
| | | |
| | | import java.text.ParseException; |
| | | import java.time.Duration; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * LocalDateTimeUtils |
| | | * LocalDateTime 时间工具 |
| | | * |
| | | * @author yudeshan |
| | | * @version V1.0 |
| | | */ |
| | | public class LocalDateTimeUtils { |
| | | private final static int[] dayArr = new int[] { 20, 19, 21, 20, 21, 22, 23, 23, 23, 24, 23, 22 }; |
| | | private final static String[] constellationArr = new String[] { "摩羯座", "水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "摩羯座" }; |
| | | |
| | | |
| | | /** |
| | | * 取两个时间相差毫秒数 |
| | | * |
| | | * @param start 开始时间 |
| | | * @param end 结束时间 |
| | | * @return |
| | | */ |
| | | public static long betweenMillis(LocalDateTime start, LocalDateTime end) { |
| | | Duration duration = Duration.between(start, end); |
| | | return duration.toMillis(); |
| | | } |
| | | |
| | | /** |
| | | * 通过生日计算年龄 |
| | | * @param birthDay 生日 |
| | | * @return |
| | | * @throws ParseException |
| | | */ |
| | | public static int getAgeByBirth(LocalDate birthDay) throws ParseException { |
| | | int age = 0; |
| | | //出生日期晚于当前时间,无法计算 |
| | | LocalDate now=LocalDate.now(); |
| | | if (birthDay.isAfter(now)) { |
| | | throw new IllegalArgumentException( "生日大于当前时间!"); |
| | | } |
| | | //当前年份 |
| | | int yearNow = now.getYear(); |
| | | //当前月份 |
| | | int monthNow = now.getMonthValue(); |
| | | //当前日期 |
| | | int dayOfMonthNow = now.getDayOfMonth(); |
| | | |
| | | int yearBirth =birthDay.getYear(); |
| | | int monthBirth = birthDay.getMonthValue(); |
| | | int dayOfMonthBirth = birthDay.getDayOfMonth(); |
| | | //计算整岁数 |
| | | age = yearNow - yearBirth; |
| | | if (monthNow <= monthBirth) { |
| | | if (monthNow == monthBirth) { |
| | | if (dayOfMonthNow < dayOfMonthBirth){ |
| | | //当前日期在生日之前,年龄减一 |
| | | age--; |
| | | } |
| | | } else { |
| | | //当前月份在生日之前,年龄减一 |
| | | age--; |
| | | } |
| | | } |
| | | return age; |
| | | } |
| | | |
| | | /** |
| | | * 根据月份计算星座 |
| | | */ |
| | | |
| | | public static String getConstellation(LocalDate date) { |
| | | Integer month=date.getMonthValue(); |
| | | Integer day=date.getDayOfMonth(); |
| | | return day < dayArr[month - 1] ? constellationArr[month - 1] : constellationArr[month]; |
| | | } |
| | | } |
New file |
| | |
| | | //package com.dsh.app.util; |
| | | // |
| | | //import com.alibaba.csp.sentinel.util.StringUtil; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.stereotype.Component; |
| | | //import redis.clients.jedis.Jedis; |
| | | //import redis.clients.jedis.JedisPool; |
| | | //import redis.clients.jedis.Pipeline; |
| | | // |
| | | //import java.io.IOException; |
| | | //import java.util.ArrayList; |
| | | //import java.util.List; |
| | | // |
| | | // |
| | | ///** |
| | | // * Redis工具类 |
| | | // */ |
| | | //@Component |
| | | //public class RedisUtil { |
| | | // |
| | | // @Autowired |
| | | // private JedisPool jedisPool; |
| | | // |
| | | // |
| | | // /** |
| | | // * 向redis中存储字符串没有过期时间 |
| | | // * @param key |
| | | // * @param value |
| | | // */ |
| | | // public void setStrValue(String key, String value){ |
| | | // if(StringUtil.isNotEmpty(key)){ |
| | | // Jedis resource = jedisPool.getResource(); |
| | | // String set = resource.set(key, value); |
| | | // closeJedis(resource); |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 以分钟为单位设置存储值(设置过期时间) |
| | | // * @param key |
| | | // * @param value |
| | | // * @param time 秒 |
| | | // */ |
| | | // public void setStrValue(String key, String value, int time){ |
| | | // if(StringUtil.isNotEmpty(key)){ |
| | | // Jedis resource = jedisPool.getResource(); |
| | | // String setex = resource.setex(key, time, value); |
| | | // closeJedis(resource); |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 从redis中获取值 |
| | | // * @param key |
| | | // * @return |
| | | // */ |
| | | // public String getValue(String key){ |
| | | // if(StringUtil.isNotEmpty(key)){ |
| | | // Jedis resource = jedisPool.getResource(); |
| | | // String data = resource.get(key); |
| | | // closeJedis(resource); |
| | | // return data; |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 批量获取 |
| | | // * @param kes |
| | | // * @return |
| | | // */ |
| | | // public List<Object> getValues(List<String> kes){ |
| | | // if(null != kes){ |
| | | // Jedis resource = jedisPool.getResource(); |
| | | // Pipeline pipelined = resource.pipelined(); |
| | | // for(String key : kes){ |
| | | // pipelined.get(key); |
| | | // } |
| | | // List<Object> list = pipelined.syncAndReturnAll(); |
| | | // |
| | | // closeJedis(resource); |
| | | // pipelined.clear(); |
| | | // try { |
| | | // pipelined.close(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // List<Object> data = new ArrayList<>(); |
| | | // for(Object o : list){ |
| | | // if(null != o){ |
| | | // data.add(o); |
| | | // } |
| | | // } |
| | | // return data; |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 删除key |
| | | // * @param key |
| | | // */ |
| | | // public void remove(String key){ |
| | | // if(StringUtil.isNotEmpty(key)){ |
| | | // Jedis resource = jedisPool.getResource(); |
| | | // Long del = resource.del(key); |
| | | // closeJedis(resource); |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 删除资源 |
| | | // * @param jedis |
| | | // */ |
| | | // public void closeJedis(Jedis jedis){ |
| | | // if(null != jedis){ |
| | | // jedis.close(); |
| | | // } |
| | | // } |
| | | //} |
New file |
| | |
| | | //package com.dsh.app.util; |
| | | // |
| | | //import com.alibaba.fastjson.JSONObject; |
| | | //import io.swagger.annotations.ApiModel; |
| | | //import io.swagger.annotations.ApiModelProperty; |
| | | // |
| | | ///** |
| | | // * 定义统一返回对象 |
| | | // */ |
| | | //@ApiModel(value = "统一返回结果集") |
| | | //public class ResultUtil<T> { |
| | | // |
| | | // public static final Integer SUCCESS = 200; |
| | | // |
| | | // public static final Integer PARAM_ERROR = 300; |
| | | // |
| | | // public static final Integer RUNTIME_ERROR = 400; |
| | | // |
| | | // public static final Integer ERROR = 500; |
| | | // |
| | | // public static final Integer TOKEN_ERROR = 600; |
| | | // |
| | | // public static final Integer SIGN_ERROR = 700; |
| | | // |
| | | // public static final String Token = "TOKEN_INVALID"; |
| | | // |
| | | // public static final String SIGN = "SIGN_INVALID"; |
| | | // |
| | | // @ApiModelProperty(name = "code", value = "业务状态码 200:成功,300:参数错误,400:运行异常,500:其他异常, 600:token无效,需重新登录,700:签名无效") |
| | | // private Integer code;//备用状态码 |
| | | // |
| | | // @ApiModelProperty(name = "msg", value = "返回结果说明") |
| | | // private String msg;//返回说明 |
| | | // |
| | | // @ApiModelProperty(name = "data", value = "返回结果值") |
| | | // private T data;//返回数据 |
| | | // |
| | | // |
| | | // |
| | | // public String getMsg() { |
| | | // return msg; |
| | | // } |
| | | // |
| | | // public T getData() { |
| | | // return data; |
| | | // } |
| | | // |
| | | // |
| | | // public Integer getCode() { |
| | | // return code; |
| | | // } |
| | | // |
| | | // private ResultUtil(Integer code, String msg) { |
| | | // this.code = code; |
| | | // this.msg = msg; |
| | | // } |
| | | // |
| | | // private ResultUtil(Integer code, String msg, T data) { |
| | | // this.code = code; |
| | | // this.msg = msg; |
| | | // this.data = data; |
| | | // } |
| | | // |
| | | // |
| | | // public static <T> ResultUtil<T> getResult(Integer code, String msg){ |
| | | // return new ResultUtil<>(code, msg); |
| | | // } |
| | | // |
| | | // public static <T> ResultUtil<T> getResult(Integer code, String msg, T data){ |
| | | // return new ResultUtil<>(code, msg, data); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 错误信息 |
| | | // * @return |
| | | // */ |
| | | // public static ResultUtil error(String mag){ |
| | | // return ResultUtil.getResult(ResultUtil.ERROR, mag, new JSONObject()); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 错误信息 |
| | | // * @return |
| | | // */ |
| | | // public static <T> ResultUtil <T> error(String mag, T obj){ |
| | | // return ResultUtil.getResult(ResultUtil.ERROR, mag, obj); |
| | | // } |
| | | // |
| | | // /** |
| | | // * token失效 |
| | | // * @return |
| | | // */ |
| | | // public static ResultUtil tokenErr(){ |
| | | // return ResultUtil.getResult(ResultUtil.TOKEN_ERROR, ResultUtil.Token, new JSONObject()); |
| | | // } |
| | | // |
| | | // /** |
| | | // * token失效 |
| | | // * @return |
| | | // */ |
| | | // public static ResultUtil tokenErr(String msg){ |
| | | // return ResultUtil.getResult(ResultUtil.TOKEN_ERROR, msg, new JSONObject()); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 参数异常 |
| | | // * @return |
| | | // */ |
| | | // public static ResultUtil paranErr(){ |
| | | // return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "PARAM_ERROR", new JSONObject()); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 参数异常 |
| | | // * @return |
| | | // */ |
| | | // public static <T> ResultUtil<T> paranErr(T data){ |
| | | // return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "SYSTEM_RUN_ERROR", data); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 运行异常 |
| | | // * @return |
| | | // */ |
| | | // public static ResultUtil runErr(){ |
| | | // return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, "SYSTEM_RUN_ERROR", new JSONObject()); |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 运行异常 |
| | | // * @return |
| | | // */ |
| | | // public static <T>ResultUtil<T> runErr(T data){ |
| | | // return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, "SYSTEM_RUN_ERROR", data); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 运行异常 |
| | | // * @return |
| | | // */ |
| | | // public static <T>ResultUtil<T> runErr(T data, String msg){ |
| | | // return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, msg, data); |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 返回成功 |
| | | // * @param |
| | | // * @return |
| | | // */ |
| | | // public static ResultUtil success(){ |
| | | // return ResultUtil.getResult(ResultUtil.SUCCESS, "SUCCESS", new JSONObject()); |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 返回成功 |
| | | // * @param data |
| | | // * @param <T> |
| | | // * @return |
| | | // */ |
| | | // public static <T> ResultUtil<T> success(T data){ |
| | | // return ResultUtil.getResult(ResultUtil.SUCCESS, "SUCCESS", data); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 返回成功 |
| | | // * @param msg |
| | | // * @param data |
| | | // * @param <T> |
| | | // * @return |
| | | // */ |
| | | // public static <T> ResultUtil<T> success(String msg, T data){ |
| | | // return ResultUtil.getResult(ResultUtil.SUCCESS, msg, data); |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 签名无效 |
| | | // * @param <T> |
| | | // * @return |
| | | // */ |
| | | // public static <T> ResultUtil<T> sign(){ |
| | | // return ResultUtil.getResult(ResultUtil.SIGN_ERROR, SIGN); |
| | | // } |
| | | // |
| | | //} |
New file |
| | |
| | | package com.dsh.course.util; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | |
| | | public class StrUtils { |
| | | /** |
| | | * 把逗号分隔的字符串转换字符串数组 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String[] splitStr2StrArr(String str,String split) { |
| | | if (str != null && !str.equals("")) { |
| | | return str.split(split); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 把逗号分隔字符串转换List的Long |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static List<Long> splitStr2LongArr(String str) { |
| | | String[] strings = splitStr2StrArr(str,","); |
| | | if (strings == null) return null; |
| | | |
| | | List<Long> result = new ArrayList<>(); |
| | | for (String string : strings) { |
| | | result.add(Long.parseLong(string)); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | /** |
| | | * 把逗号分隔字符串转换List的Long |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static List<Long> splitStr2LongArr(String str,String split) { |
| | | String[] strings = splitStr2StrArr(str,split); |
| | | if (strings == null) return null; |
| | | |
| | | List<Long> result = new ArrayList<>(); |
| | | for (String string : strings) { |
| | | result.add(Long.parseLong(string)); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public static String getRandomString(int length) { |
| | | String str = "0123456789"; |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < length; i++) { |
| | | int number = random.nextInt(10); |
| | | sb.append(str.charAt(number)); |
| | | } |
| | | return sb.toString(); |
| | | |
| | | } |
| | | |
| | | public static String getComplexRandomString(int length) { |
| | | String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < length; i++) { |
| | | int number = random.nextInt(62); |
| | | sb.append(str.charAt(number)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | public static String getClassCodeString(int length) { |
| | | String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < length; i++) { |
| | | int number =random.nextInt(36); |
| | | sb.append(str.charAt(number)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static String convertPropertiesToHtml(String properties){ |
| | | //1:容量:6:32GB_4:样式:12:塑料壳 |
| | | StringBuilder sBuilder = new StringBuilder(); |
| | | String[] propArr = properties.split("_"); |
| | | for (String props : propArr) { |
| | | String[] valueArr = props.split(":"); |
| | | sBuilder.append(valueArr[1]).append(":").append(valueArr[3]).append("<br>"); |
| | | } |
| | | return sBuilder.toString(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.util; |
| | | |
| | | import cn.mb.cloud.common.core.exception.BusinessException; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 判断字符串不能为空和null,以及号码格式效验, |
| | | * 否则则抛出异常信息 |
| | | */ |
| | | public class StringUtil { |
| | | private StringUtil() { |
| | | } |
| | | |
| | | public static void checkNull(String str, String message) throws BusinessException { |
| | | if (!StringUtils.hasLength(str)) { |
| | | throw new BusinessException(message); |
| | | } |
| | | } |
| | | |
| | | public static void checkFormat(String str, String message) throws BusinessException { |
| | | if (!str.matches("^1[2|3|4|5|6|7|8|9][0-9]{9}$")) { |
| | | throw new BusinessException(message); |
| | | } |
| | | } |
| | | |
| | | public static boolean isOneEmpty(Object... os) { |
| | | for (Object o : os) { |
| | | if (Objects.isNull(o)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.util; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.util.Date; |
| | | |
| | | |
| | | //根据当前传入的时间,返回距离当前时间多少天 |
| | | |
| | | public class StudyTimeUtil { |
| | | private StudyTimeUtil() { |
| | | } |
| | | |
| | | /** |
| | | * 获取两个时间的间隔(秒) |
| | | * |
| | | * @param startDate 开始的时间 |
| | | * @return 返回当前时间与开始时间的相差天数 |
| | | */ |
| | | public static int getDateBetween(Date startDate) throws ParseException { |
| | | Date endDate = new Date(); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | long startDateTime = dateFormat.parse(dateFormat.format(startDate)).getTime(); |
| | | long endDateTime = dateFormat.parse(dateFormat.format(endDate)).getTime(); |
| | | int days = (int)((endDateTime - startDateTime) / (1000 * 3600 * 24)); |
| | | return days; |
| | | } |
| | | |
| | | public static Date getStartDate(LocalDateTime localDate) { |
| | | Date date = Date.from(localDate.atZone(ZoneId.systemDefault()).toInstant()); |
| | | return date; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.util; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | @Component |
| | | public class TokenUtil { |
| | | |
| | | |
| | | @Autowired |
| | | private com.dsh.course.util.RedisUtil redisUtil; |
| | | |
| | | |
| | | public Integer getUserIdFormRedis(HttpServletRequest request) throws Exception { |
| | | String requestHeader = request.getHeader("Authorization"); |
| | | if (requestHeader != null && requestHeader.startsWith("Bearer ")) { |
| | | requestHeader = requestHeader.substring(requestHeader.indexOf(" ") + 1); |
| | | String key = null; |
| | | int length = requestHeader.length(); |
| | | if(length > 32){ |
| | | key = requestHeader.substring(length - 32); |
| | | }else{ |
| | | key = requestHeader; |
| | | } |
| | | String value = redisUtil.getValue(key); |
| | | return null != value ? Integer.valueOf(value) : null; |
| | | }else{ |
| | | return null; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.httpClinet; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.apache.http.NameValuePair; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | import org.apache.http.client.entity.UrlEncodedFormEntity; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
| | | import org.apache.http.entity.ContentType; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | import org.apache.http.ssl.SSLContexts; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.nio.charset.Charset; |
| | | import java.security.KeyStore; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * http工具类 |
| | | */ |
| | | @Component |
| | | public class HttpClientUtil { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(HttpClientUtil.class); |
| | | |
| | | private PoolingHttpClientConnectionManager connectionManager; |
| | | |
| | | |
| | | public HttpClientUtil(){ |
| | | //1.创建连接池管理器 |
| | | connectionManager = new PoolingHttpClientConnectionManager(60000, |
| | | TimeUnit.MILLISECONDS); |
| | | connectionManager.setMaxTotal(1000); |
| | | connectionManager.setDefaultMaxPerRoute(50); |
| | | } |
| | | |
| | | /** |
| | | * 创建一个httpClient对象 |
| | | */ |
| | | private CloseableHttpClient getHttpCline(){ |
| | | return HttpClients.custom() |
| | | .setConnectionManager(connectionManager) |
| | | .disableAutomaticRetries() |
| | | .build(); |
| | | } |
| | | |
| | | private RequestConfig getRequestConfig(){ |
| | | RequestConfig.Builder builder = RequestConfig.custom(); |
| | | builder.setSocketTimeout(60000)//3.1设置客户端等待服务端返回数据的超时时间 |
| | | .setConnectTimeout(30000)//3.2设置客户端发起TCP连接请求的超时时间 |
| | | .setExpectContinueEnabled(true) |
| | | .setConnectionRequestTimeout(30000);//3.3设置客户端从连接池获取链接的超时时间 |
| | | return builder.build(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 创建一个POST请求实例 |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private CloseableHttpResponse setPostHttpRequset(String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(this.getRequestConfig()); |
| | | if(null != header){ |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | List<NameValuePair> list = new ArrayList<>(); |
| | | if(null != params){ |
| | | Set<String> keys = params.keySet(); |
| | | for(String key : keys){ |
| | | list.add(new BasicNameValuePair(key, null == params.get(key) ? null : params.get(key).toString())); |
| | | } |
| | | } |
| | | switch (contentType){ |
| | | case "form": |
| | | httpPost.setEntity(new UrlEncodedFormEntity(list, "UTF-8")); |
| | | break; |
| | | case "json": |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String s =objectMapper.writeValueAsString(params); |
| | | httpPost.setEntity(new StringEntity(s, ContentType.create(ContentType.APPLICATION_JSON.getMimeType(), Charset.forName("UTF-8")))); |
| | | break; |
| | | } |
| | | return getHttpCline().execute(httpPost); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取get请求实例 |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private CloseableHttpResponse setGetHttpRequset(String url, Map<String, Object> params, Map<String, String> header) throws Exception{ |
| | | StringBuffer sb = new StringBuffer(); |
| | | String p = ""; |
| | | if(null != params){ |
| | | Set<String> keys = params.keySet(); |
| | | for(String key : keys){ |
| | | sb.append(key + "=" + params.get(key) + "&"); |
| | | } |
| | | p = "?" + sb.substring(0, sb.length() - 1); |
| | | } |
| | | HttpGet httpGet = new HttpGet(url + p); |
| | | httpGet.setConfig(getRequestConfig()); |
| | | if(null != header){ |
| | | for(String key : header.keySet()){ |
| | | httpGet.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | return getHttpCline().execute(httpGet); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送http请求 |
| | | * @param mothed "GET、POST、PUT、HEAD、DELETE、HEAD、OPTIONS" |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | * @param header 请求头 |
| | | * @param contentType 参数请求方式form/json |
| | | * @return |
| | | */ |
| | | public HttpResult pushHttpRequset(String mothed, String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ |
| | | String randome = UUID.randomUUID().toString(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); |
| | | logger.info(sdf.format(new Date()) + "----(" + randome + ")请求参数:" + JSON.toJSONString(params)); |
| | | CloseableHttpResponse httpResponse = null; |
| | | switch (mothed){ |
| | | case "GET": |
| | | httpResponse = this.setGetHttpRequset(url, params, header); |
| | | break; |
| | | case "POST": |
| | | httpResponse = setPostHttpRequset(url, params, header, contentType); |
| | | break; |
| | | } |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | logger.info(sdf.format(new Date()) + "----(" + randome + ")返回结果:" + content); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | this.close(httpResponse); |
| | | return httpResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送XML请求 |
| | | * @param url 请求地址 |
| | | * @param xml XML数据 |
| | | * @param header 自定义请求头 |
| | | * @return |
| | | */ |
| | | public HttpResult pushHttpRequsetXml(String url, String xml, Map<String, String> header) throws Exception{ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(getRequestConfig()); |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | CloseableHttpResponse httpResponse = getHttpCline().execute(httpPost); |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | this.close(httpResponse); |
| | | return httpResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 请求https发送XML请求 |
| | | * @param url 接口路径 |
| | | * @param xml 内容 |
| | | * @param header 请求头 |
| | | * @param certPassword 证书密码 |
| | | * @param certPath 证书路径 |
| | | * @param certType 证书类型 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public String pushHttpsRequsetXml(String url, String xml, Map<String, String> header, String certPassword, String certPath, String certType) throws Exception{ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | CloseableHttpClient httpCline = this.initCert(certPassword, certPath, certType); |
| | | CloseableHttpResponse httpResponse = httpCline.execute(httpPost); |
| | | String content = null; |
| | | if(httpResponse.getStatusLine().getStatusCode() == 200){ |
| | | content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | }else{ |
| | | content = "返回状态码:" + httpResponse.getStatusLine() + "。" + EntityUtils.toString(httpResponse.getEntity()); |
| | | } |
| | | this.close(httpResponse); |
| | | httpCline.close(); |
| | | return content; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 初始化https对象(带证书) |
| | | * @param key 证书密码 |
| | | * @param certPath 证书路径 |
| | | * @param certType 证书类型 |
| | | * @throws Exception |
| | | */ |
| | | private CloseableHttpClient initCert(String key, String certPath, String certType) throws Exception { |
| | | KeyStore keyStore = KeyStore.getInstance(certType); |
| | | InputStream inputStream = new FileInputStream(new File(certPath)); |
| | | try { |
| | | keyStore.load(inputStream, key.toCharArray()); |
| | | } finally { |
| | | inputStream.close(); |
| | | } |
| | | SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, key.toCharArray()).build(); |
| | | SSLConnectionSocketFactory sslsf = |
| | | new SSLConnectionSocketFactory(sslcontext, new String[] {"TLSv1"}, null, |
| | | SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); |
| | | return HttpClients.custom().setSSLSocketFactory(sslsf).build(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 关闭资源 |
| | | */ |
| | | private void close(CloseableHttpResponse httpResponse){ |
| | | try { |
| | | if(null != httpResponse){ |
| | | EntityUtils.consume(httpResponse.getEntity());//此处高能,通过源码分析,由EntityUtils是否回收HttpEntity |
| | | httpResponse.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | try { |
| | | if(null != httpResponse){ |
| | | httpResponse.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.httpClinet; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * http请求返回封装 |
| | | */ |
| | | @Data |
| | | public class HttpResult { |
| | | /** |
| | | * 返回状态码 |
| | | */ |
| | | private Integer code; |
| | | /** |
| | | * 返回结果 |
| | | */ |
| | | private String data; |
| | | |
| | | /** |
| | | * 返回封装结果 |
| | | * @param code |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public static HttpResult getHttpResult(Integer code, String data){ |
| | | HttpResult httpResult = new HttpResult(); |
| | | httpResult.setCode(code); |
| | | httpResult.setData(data); |
| | | return httpResult; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.midtrans; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/5 14:02 |
| | | */ |
| | | @Data |
| | | public class Beneficiaries { |
| | | private String name; |
| | | private String bank; |
| | | private String account; |
| | | private String alias_name; |
| | | private String email; |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.midtrans; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class DirectRefundTransaction { |
| | | /** |
| | | * 交易状态码 |
| | | */ |
| | | private String status_code; |
| | | /** |
| | | * 交易状态说明 |
| | | */ |
| | | private String status_message; |
| | | /** |
| | | * 交易id |
| | | */ |
| | | private String transaction_id; |
| | | /** |
| | | * 支付id |
| | | */ |
| | | private String order_id; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | private String gross_amount; |
| | | /** |
| | | * 支付方式 |
| | | */ |
| | | private String payment_type; |
| | | /** |
| | | * 交易时间 |
| | | */ |
| | | private String transaction_time; |
| | | /** |
| | | * 退款操作后的交易状态。可能的值是 |
| | | * refund:交易已全额退款。 |
| | | * partial_refund: 交易部分退款。 |
| | | */ |
| | | private String transaction_status; |
| | | /** |
| | | * 退款流程的识别 |
| | | */ |
| | | private String refund_chargeback_id; |
| | | /** |
| | | * 退款金额 |
| | | */ |
| | | private String refund_amount; |
| | | /** |
| | | * 退款密钥 |
| | | */ |
| | | private String refund_key; |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.midtrans; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.midtrans.Config; |
| | | import com.midtrans.Midtrans; |
| | | import com.midtrans.httpclient.SnapApi; |
| | | import com.midtrans.httpclient.TransactionApi; |
| | | import com.midtrans.httpclient.error.MidtransError; |
| | | import org.json.JSONObject; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Midtrans支付工具类 |
| | | * @author pzb |
| | | * @Date 2022/11/28 14:19 |
| | | */ |
| | | public class MidtransUtil { |
| | | |
| | | private static String sandbox_merchant_id = "G118246934"; |
| | | |
| | | private static String sandbox_serverKey = "SB-Mid-server-qR4Xy4kbpyxND_7f6c1_knb9"; |
| | | |
| | | private static String sandbox_clientKey = "SB-Mid-client-xhRbIV8lsbu7bKCE"; |
| | | |
| | | private static String merchant_id = "G118246934"; |
| | | |
| | | private static String serverKey = "Mid-server-w1ATM2ldDpd0c4Q0s9sNfeNN"; |
| | | |
| | | private static String clientKey = "Mid-client-X22yMA1Wvs0v1vfO"; |
| | | |
| | | |
| | | /** |
| | | * 获取支付令牌 |
| | | * @param order_id 商户订单id |
| | | * @param gross_amount 支付金额 |
| | | * @param xOverrideNotification 支付状态通知回调地址 |
| | | * @return |
| | | */ |
| | | public static TokenResult getPayToken(String order_id, String gross_amount, String xOverrideNotification){ |
| | | //沙箱环境 |
| | | Midtrans.serverKey = sandbox_serverKey; |
| | | Midtrans.clientKey = sandbox_clientKey; |
| | | Midtrans.isProduction = false; |
| | | |
| | | //生产环境 |
| | | // Midtrans.serverKey = serverKey; |
| | | // Midtrans.clientKey = clientKey; |
| | | // Midtrans.isProduction = true; |
| | | |
| | | Midtrans.paymentOverrideNotification(xOverrideNotification); |
| | | // Create Token and then you can send token variable to FrontEnd, |
| | | // to initialize Snap JS when customer click pay button |
| | | //201 成功创建 Snap 令牌。 “令牌”:“66e4fa55-fdac-4ef9-91b5-733b97d1b862” |
| | | //401 未能创建令牌,因为发送了错误的授权。 “访问被拒绝,请检查客户端或服务器密钥” |
| | | //4xx 未能创建令牌,因为发送了错误的参数。按照 error_message 并检查您的参数。 “transaction_details.gross_amount 不等于 item_details 的总和” |
| | | //5xx 由于 Midtrans 内部错误,无法创建令牌。大多数情况下这是暂时的,您可以稍后重试。 “抱歉,我们遇到内部服务器错误。我们会尽快解决这个问题。” |
| | | |
| | | try { |
| | | JSONObject transaction = SnapApi.createTransaction(requestBody(order_id, gross_amount), Config.getGlobalConfig()); |
| | | TokenResult tokenResult = new TokenResult(); |
| | | tokenResult.setToken(transaction.getString("token")); |
| | | tokenResult.setRedirect_url(transaction.getString("redirect_url")); |
| | | return tokenResult; |
| | | } catch (MidtransError midtransError) { |
| | | midtransError.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | // Create params JSON Raw Object request |
| | | public static Map<String, Object> requestBody(String order_id, String gross_amount) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | Map<String, String> transactionDetails = new HashMap<>(); |
| | | transactionDetails.put("order_id", order_id); |
| | | transactionDetails.put("gross_amount", gross_amount); |
| | | Map<String, String> creditCard = new HashMap<>(); |
| | | creditCard.put("secure", "true"); |
| | | params.put("transaction_details", transactionDetails); |
| | | params.put("credit_card", creditCard); |
| | | return params; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取订单支付状态 |
| | | * @param order_id |
| | | * @return |
| | | */ |
| | | public static PaymentNotice getPayStatus(String order_id){ |
| | | //沙箱环境 |
| | | Midtrans.serverKey = sandbox_serverKey; |
| | | Midtrans.clientKey = sandbox_clientKey; |
| | | Midtrans.isProduction = false; |
| | | |
| | | //生产环境 |
| | | // Midtrans.serverKey = serverKey; |
| | | // Midtrans.clientKey = clientKey; |
| | | // Midtrans.isProduction = true; |
| | | JSONObject jsonObject = null; |
| | | try { |
| | | jsonObject = TransactionApi.checkTransaction(order_id); |
| | | } catch (MidtransError midtransError) { |
| | | midtransError.printStackTrace(); |
| | | } |
| | | PaymentNotice paymentNotice = JSON.parseObject(jsonObject.toString(), PaymentNotice.class); |
| | | if(null == paymentNotice){ |
| | | System.err.println("回调结果解析失败"); |
| | | return null; |
| | | } |
| | | String signature_key = paymentNotice.getSignature_key(); |
| | | order_id = paymentNotice.getOrder_id(); |
| | | String status_code = paymentNotice.getStatus_code(); |
| | | if("400".equals(status_code)){ |
| | | System.err.println("数据丢失或无效"); |
| | | return null; |
| | | } |
| | | if("401".equals(status_code)){ |
| | | System.err.println("授权错误"); |
| | | return null; |
| | | } |
| | | if("404".equals(status_code)){ |
| | | System.err.println("找不到请求的资源"); |
| | | return null; |
| | | } |
| | | String gross_amount = paymentNotice.getGross_amount(); |
| | | String sha_512_securePassword = get_SHA_512_SecurePassword(order_id + status_code + gross_amount + sandbox_serverKey); |
| | | if(!signature_key.equals(sha_512_securePassword)){ |
| | | System.err.println("签名校验失败"); |
| | | return null; |
| | | } |
| | | return paymentNotice; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付回调解析 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static PaymentNotice payResultNotification(HttpServletRequest request){ |
| | | String param = null; |
| | | try { |
| | | param = getParam(request); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | System.err.println("支付回调结果:========》" + param); |
| | | |
| | | PaymentNotice paymentNotice = JSON.parseObject(param, PaymentNotice.class); |
| | | if(null == paymentNotice){ |
| | | System.err.println("回调结果解析失败"); |
| | | return null; |
| | | } |
| | | String signature_key = paymentNotice.getSignature_key(); |
| | | String order_id = paymentNotice.getOrder_id(); |
| | | String status_code = paymentNotice.getStatus_code(); |
| | | if("400".equals(status_code)){ |
| | | System.err.println("数据丢失或无效"); |
| | | return null; |
| | | } |
| | | if("401".equals(status_code)){ |
| | | System.err.println("授权错误"); |
| | | return null; |
| | | } |
| | | if("404".equals(status_code)){ |
| | | System.err.println("找不到请求的资源"); |
| | | return null; |
| | | } |
| | | String gross_amount = paymentNotice.getGross_amount(); |
| | | String sha_512_securePassword = get_SHA_512_SecurePassword(order_id + status_code + gross_amount + sandbox_serverKey); |
| | | if(!signature_key.equals(sha_512_securePassword)){ |
| | | System.err.println("签名校验失败"); |
| | | return null; |
| | | } |
| | | return paymentNotice; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 退款交易 |
| | | * @param transaction_id 支付订单id |
| | | * @param refund_key 商户退款id |
| | | * @param amount 退款金额 |
| | | * @param reason 退款说明 |
| | | * @return |
| | | */ |
| | | public static DirectRefundTransaction directRefundTransaction(String transaction_id, String refund_key, String amount, String reason){ |
| | | //沙箱环境 |
| | | Midtrans.serverKey = sandbox_serverKey; |
| | | Midtrans.clientKey = sandbox_clientKey; |
| | | Midtrans.isProduction = false; |
| | | |
| | | //生产环境 |
| | | // Midtrans.serverKey = serverKey; |
| | | // Midtrans.clientKey = clientKey; |
| | | // Midtrans.isProduction = true; |
| | | |
| | | Map<String, String> requestBody = new HashMap<>(); |
| | | requestBody.put("refund_key", refund_key); |
| | | requestBody.put("amount", amount); |
| | | requestBody.put("reason", reason); |
| | | |
| | | JSONObject jsonObject = null; |
| | | try { |
| | | jsonObject = TransactionApi.directRefundTransaction(transaction_id, requestBody); |
| | | } catch (MidtransError midtransError) { |
| | | midtransError.printStackTrace(); |
| | | } |
| | | /** |
| | | * { |
| | | * "status_code": "200", |
| | | * "status_message": "Success, refund request is approved by the bank", |
| | | * "transaction_id": "fddb5889-fd39-46fe-809d-30679fe42434", |
| | | * "order_id": "MID-1620622357", |
| | | * "gross_amount": "10000.00", |
| | | * "payment_type": "credit_card", |
| | | * "transaction_time": "2016-06-28 09:42:20", |
| | | * "transaction_status": "refund", |
| | | * "refund_chargeback_id": 47594, |
| | | * "refund_amount": "10000.00", |
| | | * "refund_key": "01f1f771-b75c-48ef-b21d-193a79f8aa5b" |
| | | * } |
| | | */ |
| | | |
| | | DirectRefundTransaction directRefundTransaction = JSON.parseObject(jsonObject.toString(), DirectRefundTransaction.class); |
| | | if(null == directRefundTransaction){ |
| | | System.err.println("退款结果解析失败"); |
| | | return null; |
| | | } |
| | | String status_code = directRefundTransaction.getStatus_code(); |
| | | if("400".equals(status_code)){ |
| | | System.err.println("数据丢失或无效"); |
| | | return null; |
| | | } |
| | | if("401".equals(status_code)){ |
| | | System.err.println("授权错误"); |
| | | return null; |
| | | } |
| | | if("404".equals(status_code)){ |
| | | System.err.println("找不到请求的资源"); |
| | | return null; |
| | | } |
| | | return directRefundTransaction; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取请求内容 |
| | | * @param request |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | private static String getParam(HttpServletRequest request) throws IOException { |
| | | // 读取参数 |
| | | InputStream inputStream; |
| | | StringBuilder sb = new StringBuilder(); |
| | | inputStream = request.getInputStream(); |
| | | String s; |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); |
| | | while ((s = in.readLine()) != null) { |
| | | sb.append(s); |
| | | } |
| | | in.close(); |
| | | inputStream.close(); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | |
| | | private static String get_SHA_512_SecurePassword(String passwordToHash){ |
| | | String generatedPassword = null; |
| | | try { |
| | | MessageDigest md = MessageDigest.getInstance("SHA-512"); |
| | | byte[] bytes = md.digest(passwordToHash.getBytes(StandardCharsets.UTF_8)); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for(int i=0; i< bytes.length ;i++){ |
| | | sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1)); |
| | | } |
| | | generatedPassword = sb.toString(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return generatedPassword; |
| | | } |
| | | |
| | | |
| | | // public static void main(String[] agrs){ |
| | | //// TokenResult payToken = MidtransUtil.getPayToken("123456,1", "10", "http://192.168.0.80:5000/payment"); |
| | | //// System.err.println(payToken.toString()); |
| | | // |
| | | //// String sha_512_securePassword = get_SHA_512_SecurePassword("Postman-157856885120010000.00VT-server-HJMpl9HLr_ntOKt5mRONdmKj"); |
| | | //// System.err.println(sha_512_securePassword); |
| | | // |
| | | // PaymentNotice payStatus = MidtransUtil.getPayStatus("123456,1"); |
| | | // System.err.println(null != payStatus ? payStatus.toString() : ""); |
| | | // } |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.midtrans; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class PaymentNotice { |
| | | /** |
| | | * 交易时间 |
| | | */ |
| | | private String transaction_time; |
| | | /** |
| | | * 交易状态 |
| | | * capture ✅ 交易成功,卡内余额获取成功。 |
| | | * 如果您不采取任何行动,交易将在当天或次日或您与合作银行约定的结算时间内成功结算。然后交易状态变为 结算。 |
| | | * 假设付款成功是安全的。 |
| | | * settlement ✅ 交易结算成功。资金已记入您的账户。 |
| | | * pending 🕒 交易已创建并等待客户在直接借记、银行转账、电子货币等支付提供商处付款。对于卡支付方式:等待客户完成(和发卡机构验证)3DS/OTP 流程。 |
| | | * deny ❌ 用于支付的凭据被支付提供商或 Midtrans 欺诈检测系统 (FDS) 拒绝。 |
| | | * 要了解拒绝交易的原因和详细信息,请参阅status_message响应中的 。 |
| | | * cancel ❌ 交易被取消。可以由商家触发。您可以在以下情况下 |
| | | * 触发取消 |
| | | * 状态: 1. 如果您在捕获状态后取消交易。 |
| | | * 2. 如果您在Challenge状态后拒绝交易。如果您未能在一天内 |
| | | * 回复具有挑战状态的交易,则 Midtrans 将自动取消该交易。 |
| | | * expire ❌ 由于付款延迟,交易无法处理。 |
| | | * refund ↩️ 交易被标记为退款。退款状态可由商户触发。 |
| | | * partial_refund ↩️ 交易标记为部分退款(如果您选择的退款金额小于支付金额)。退款状态可由商户触发。 |
| | | * authorize 🕒 只有当您使用卡交易的预授权功能时才特别可用(默认情况下您不会拥有的高级功能,因此在大多数情况下可以安全地忽略)。交易成功,卡内余额预留(授权)成功。您可以稍后执行 API“捕获”将其更改为capture,或者如果不采取任何操作将自动释放。根据您的业务用例,您可以假定authorize状态为成功交易。 |
| | | */ |
| | | private String transaction_status; |
| | | /** |
| | | * 交易id |
| | | */ |
| | | private String transaction_id; |
| | | /** |
| | | * 状态说明 |
| | | */ |
| | | private String status_message; |
| | | /** |
| | | * 状态code |
| | | */ |
| | | private String status_code; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String signature_key; |
| | | /** |
| | | * 支付类型 |
| | | */ |
| | | private String payment_type; |
| | | /** |
| | | * 商户订单id |
| | | */ |
| | | private String order_id; |
| | | /** |
| | | * 商户id |
| | | */ |
| | | private String merchant_id; |
| | | /** |
| | | * 支付卡号 |
| | | */ |
| | | private String masked_card; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | private String gross_amount; |
| | | /** |
| | | * 欺诈状况 |
| | | * accept ✅ 交易可以安全进行。它不被视为欺诈。 |
| | | * deny ❌ 交易被视为欺诈。它被 Midtrans FDS 拒绝。FDS拒绝交易通常不会导致transaction_status:pending,capture,settlement。 |
| | | * challenge ⚠️ 交易被标记为潜在欺诈,但无法准确确定。 |
| | | * 您可以从 MAP 帐户或使用Approve Transaction API或Deny Transaction API接受或拒绝交易。如果不采取任何行动,交易将被自动拒绝。 |
| | | */ |
| | | private String fraud_status; |
| | | /** |
| | | * eci |
| | | */ |
| | | private String eci; |
| | | /** |
| | | * |
| | | */ |
| | | private String currency; |
| | | /** |
| | | * |
| | | */ |
| | | private String channel_response_message; |
| | | /** |
| | | * |
| | | */ |
| | | private String channel_response_code; |
| | | /** |
| | | * card_type |
| | | */ |
| | | private String card_type; |
| | | /** |
| | | * |
| | | */ |
| | | private String bank; |
| | | /** |
| | | * |
| | | */ |
| | | private String approval_code; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.midtrans; |
| | | |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import com.midtrans.Config; |
| | | import com.midtrans.Midtrans; |
| | | import com.midtrans.httpclient.IrisApi; |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 付款工具类 |
| | | * @author zhibing.pu |
| | | * @date 2023/5/4 19:22 |
| | | */ |
| | | public class Payouts { |
| | | |
| | | private static String sandbox_merchant_id = "G118246934"; |
| | | |
| | | private static String sandbox_serverKey = "IRIS-330198f0-e49d-493f-baae-585cfded355d"; |
| | | |
| | | // private static String sandbox_serverKey = "SB-Mid-server-qR4Xy4kbpyxND_7f6c1_knb9"; |
| | | |
| | | private static String sandbox_clientKey = "SB-Mid-client-xhRbIV8lsbu7bKCE"; |
| | | |
| | | private static String merchant_id = "G118246934"; |
| | | |
| | | private static String serverKey = "Mid-server-w1ATM2ldDpd0c4Q0s9sNfeNN"; |
| | | |
| | | private static String clientKey = "Mid-client-X22yMA1Wvs0v1vfO"; |
| | | |
| | | |
| | | /** |
| | | * 添加转账账户信息 |
| | | * @param beneficiary_name |
| | | * @param beneficiary_account |
| | | * @param beneficiary_bank |
| | | * @param beneficiary_email |
| | | * @return |
| | | */ |
| | | public static ResultUtil addBeneficiaries(String beneficiary_name, String alias_name, String beneficiary_account, String beneficiary_bank, String beneficiary_email){ |
| | | try { |
| | | //沙箱环境 |
| | | Midtrans.serverKey = sandbox_serverKey; |
| | | Midtrans.clientKey = sandbox_clientKey; |
| | | Midtrans.isProduction = false; |
| | | |
| | | //生产环境 |
| | | // Midtrans.serverKey = serverKey; |
| | | // Midtrans.clientKey = clientKey; |
| | | // Midtrans.isProduction = true; |
| | | Map<String, String> requestBody = new HashMap<>(); |
| | | requestBody.put("name", beneficiary_name); |
| | | requestBody.put("account", beneficiary_account); |
| | | requestBody.put("bank", beneficiary_bank); |
| | | requestBody.put("alias_name", alias_name); |
| | | requestBody.put("email", beneficiary_email); |
| | | JSONObject beneficiaries = IrisApi.createBeneficiaries(requestBody, Config.getGlobalConfig()); |
| | | String status = beneficiaries.getString("status"); |
| | | if("created".equals(status)){ |
| | | return ResultUtil.success(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更新转账用户数据 |
| | | * @param beneficiary_name |
| | | * @param beneficiary_account |
| | | * @param beneficiary_bank |
| | | * @param beneficiary_email |
| | | * @return |
| | | */ |
| | | public static ResultUtil editBeneficiaries(String beneficiary_name, String alias_name, String beneficiary_account, String beneficiary_bank, String beneficiary_email){ |
| | | try { |
| | | //沙箱环境 |
| | | Midtrans.serverKey = sandbox_serverKey; |
| | | Midtrans.clientKey = sandbox_clientKey; |
| | | Midtrans.isProduction = false; |
| | | |
| | | //生产环境 |
| | | // Midtrans.serverKey = serverKey; |
| | | // Midtrans.clientKey = clientKey; |
| | | // Midtrans.isProduction = true; |
| | | Map<String, String> requestBody = new HashMap<>(); |
| | | requestBody.put("name", beneficiary_name); |
| | | requestBody.put("account", beneficiary_account); |
| | | requestBody.put("bank", beneficiary_bank); |
| | | requestBody.put("alias_name", alias_name); |
| | | requestBody.put("email", beneficiary_email); |
| | | JSONObject beneficiaries = IrisApi.updateBeneficiaries(alias_name, requestBody, Config.getGlobalConfig()); |
| | | String status = beneficiaries.getString("status"); |
| | | if("updated".equals(status)){ |
| | | return ResultUtil.success(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取转账用户 |
| | | * @param account |
| | | * @return |
| | | */ |
| | | public static Beneficiaries getBeneficiaries(String account){ |
| | | try { |
| | | //沙箱环境 |
| | | Midtrans.serverKey = sandbox_serverKey; |
| | | Midtrans.clientKey = sandbox_clientKey; |
| | | Midtrans.isProduction = false; |
| | | |
| | | //生产环境 |
| | | // Midtrans.serverKey = serverKey; |
| | | // Midtrans.clientKey = clientKey; |
| | | // Midtrans.isProduction = true; |
| | | JSONArray beneficiaries = IrisApi.getBeneficiaries(Config.getGlobalConfig()); |
| | | for (int i = 0; i < beneficiaries.length(); i++) { |
| | | JSONObject jsonObject = beneficiaries.getJSONObject(i); |
| | | String account1 = jsonObject.getString("account"); |
| | | if(account.equals(account1)){ |
| | | Beneficiaries beneficiaries1 = new Beneficiaries(); |
| | | beneficiaries1.setName(jsonObject.getString("name")); |
| | | beneficiaries1.setAccount(jsonObject.getString("account")); |
| | | beneficiaries1.setAlias_name(jsonObject.getString("alias_name")); |
| | | beneficiaries1.setBank(jsonObject.getString("bank")); |
| | | beneficiaries1.setEmail(jsonObject.getString("email")); |
| | | return beneficiaries1; |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 单笔转账 |
| | | * @param beneficiary_name 转账用户名称 |
| | | * @param alias_name 用户别名 |
| | | * @param beneficiary_account 转账用户账号 |
| | | * @param beneficiary_bank 转账银行 |
| | | * @param beneficiary_email 邮箱 |
| | | * @param amount 金额 |
| | | * @param notes 备注 |
| | | * @return |
| | | */ |
| | | public static ResultUtil<String> payout(String beneficiary_name, String alias_name, String beneficiary_account, String beneficiary_bank, String beneficiary_email, Double amount, String notes){ |
| | | try { |
| | | //沙箱环境 |
| | | Midtrans.serverKey = sandbox_serverKey; |
| | | Midtrans.clientKey = sandbox_clientKey; |
| | | Midtrans.isProduction = false; |
| | | |
| | | //生产环境 |
| | | // Midtrans.serverKey = serverKey; |
| | | // Midtrans.clientKey = clientKey; |
| | | // Midtrans.isProduction = true; |
| | | Beneficiaries beneficiaries = getBeneficiaries(beneficiary_account); |
| | | if(null == beneficiaries){ |
| | | ResultUtil resultUtil = addBeneficiaries(beneficiary_name, alias_name, beneficiary_account, beneficiary_bank, beneficiary_email); |
| | | if(resultUtil.getCode() != 200){ |
| | | System.err.println(resultUtil.getMsg()); |
| | | return resultUtil; |
| | | } |
| | | }else{ |
| | | ResultUtil resultUtil = editBeneficiaries(beneficiary_name, alias_name, beneficiary_account, beneficiary_bank, beneficiary_email); |
| | | if(resultUtil.getCode() != 200){ |
| | | return resultUtil; |
| | | } |
| | | } |
| | | |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("beneficiary_name", beneficiary_name); |
| | | map.put("beneficiary_account", beneficiary_account); |
| | | map.put("beneficiary_bank", beneficiary_bank); |
| | | map.put("beneficiary_email", beneficiary_email); |
| | | map.put("amount", amount.toString()); |
| | | map.put("notes", notes); |
| | | list.add(map); |
| | | |
| | | Map<String, Object> requestBody = new HashMap<>(); |
| | | requestBody.put("payouts", list); |
| | | JSONObject jsonObject = IrisApi.createPayouts(requestBody, Config.getGlobalConfig()); |
| | | JSONArray payouts = jsonObject.getJSONArray("payouts"); |
| | | JSONObject jsonObject1 = payouts.getJSONObject(0); |
| | | String status = jsonObject1.getString("status");//状态(queued:付款正在等待执行,processed:付款请求已发送到银行并完成,completed:付款请求将发送到银行并通过收款人帐户接收,failed:付款未通过) |
| | | String reference_no = jsonObject1.getString("reference_no");//流水号 |
| | | if("queued".equals(status)){ |
| | | return ResultUtil.success("付款正在等待执行", reference_no, "0"); |
| | | } |
| | | if("processed".equals(status)){ |
| | | return ResultUtil.success("付款请求已发送到银行并完成", reference_no, "1"); |
| | | } |
| | | if("completed".equals(status)){ |
| | | return ResultUtil.success("付款请求将发送到银行并通过收款人帐户接收", reference_no, "1"); |
| | | } |
| | | if("failed".equals(status)){ |
| | | return ResultUtil.error("付款未通过"); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | return ResultUtil.error("未知错误"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 确认转账付款操作 |
| | | * @param reference_no 转账流水号 |
| | | * @param otp 谷歌身份验证OTP(QR码将在合作伙伴注册期间发送到审批者的电子邮件) |
| | | * @return |
| | | */ |
| | | public static ResultUtil approve(String reference_no, String otp){ |
| | | try { |
| | | //沙箱环境 |
| | | Midtrans.serverKey = sandbox_serverKey; |
| | | Midtrans.clientKey = sandbox_clientKey; |
| | | Midtrans.isProduction = false; |
| | | |
| | | //生产环境 |
| | | // Midtrans.serverKey = serverKey; |
| | | // Midtrans.clientKey = clientKey; |
| | | // Midtrans.isProduction = true; |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(reference_no); |
| | | |
| | | Map<String, Object> requestBody = new HashMap<>(); |
| | | requestBody.put("reference_nos", list); |
| | | requestBody.put("otp", otp); |
| | | JSONObject jsonObject = IrisApi.approvePayouts(requestBody, Config.getGlobalConfig()); |
| | | String status = jsonObject.getString("status"); |
| | | if("ok".equals(status)){ |
| | | return ResultUtil.success(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(e.getMessage()); |
| | | } |
| | | return ResultUtil.error("未知错误"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 拒绝转账付款操作 |
| | | * @param reference_no 转账流水号 |
| | | * @param reject_reason 拒绝付款的原因 |
| | | * @return |
| | | */ |
| | | public static ResultUtil reject(String reference_no, String reject_reason){ |
| | | try { |
| | | //沙箱环境 |
| | | Midtrans.serverKey = sandbox_serverKey; |
| | | Midtrans.clientKey = sandbox_clientKey; |
| | | Midtrans.isProduction = false; |
| | | |
| | | //生产环境 |
| | | // Midtrans.serverKey = serverKey; |
| | | // Midtrans.clientKey = clientKey; |
| | | // Midtrans.isProduction = true; |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(reference_no); |
| | | |
| | | Map<String, Object> requestBody = new HashMap<>(); |
| | | requestBody.put("reference_nos", list); |
| | | requestBody.put("reject_reason", reject_reason); |
| | | JSONObject jsonObject = IrisApi.rejectPayouts(requestBody, Config.getGlobalConfig()); |
| | | String status = jsonObject.getString("status"); |
| | | if("ok".equals(status)){ |
| | | return ResultUtil.success(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(e.getMessage()); |
| | | } |
| | | return ResultUtil.error("未知错误"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取转账付款详情 |
| | | * @param reference_no |
| | | * @return |
| | | */ |
| | | public static ResultUtil<Integer> getPayout(String reference_no){ |
| | | /** |
| | | * { |
| | | * "amount": "200000.00", 已处理的付款金额 |
| | | * "beneficiary_name": "Ryan Renolds", 收款人姓名 |
| | | * "beneficiary_account": "33287352", 收款人的收款账号 |
| | | * "bank": "Bank Central Asia ( BCA )", 收款人使用的银行名称 |
| | | * "reference_no": "83hgf882", 付款流水号reference_no |
| | | * "notes": "Payout June 17", 备注 |
| | | * "beneficiary_email": "beneficiary@example.com", 邮箱 |
| | | * "status": "queued", 状态 |
| | | * "created_by": "John Doe", 由制造商创建的付款 |
| | | * "created_at": "2017-01-11T00:00:00Z", |
| | | * "updated_at": "2017-01-11T00:00:00Z" |
| | | * } |
| | | */ |
| | | try { |
| | | //沙箱环境 |
| | | Midtrans.serverKey = sandbox_serverKey; |
| | | Midtrans.clientKey = sandbox_clientKey; |
| | | Midtrans.isProduction = false; |
| | | |
| | | //生产环境 |
| | | // Midtrans.serverKey = serverKey; |
| | | // Midtrans.clientKey = clientKey; |
| | | // Midtrans.isProduction = true; |
| | | |
| | | JSONObject jsonObject = IrisApi.getPayoutDetails(reference_no, Config.getGlobalConfig()); |
| | | String status = jsonObject.getString("status"); |
| | | if("queued".equals(status)){ |
| | | return ResultUtil.success("付款正在等待执行", 0); |
| | | } |
| | | if("processed".equals(status)){ |
| | | return ResultUtil.success("付款请求已发送到银行并完成", 1); |
| | | } |
| | | if("completed".equals(status)){ |
| | | return ResultUtil.success("付款请求将发送到银行并通过收款人帐户接收", 1); |
| | | } |
| | | if("failed".equals(status)){ |
| | | return ResultUtil.error("付款未通过"); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | return ResultUtil.error("未知错误"); |
| | | } |
| | | |
| | | |
| | | |
| | | // public static void main(String[] ages){ |
| | | // ResultUtil<String> payout = Payouts.payout("John Do2", "3345278432", "3345278432", "bca", "beneficiary1@example.com", 10000.0d, "test payout"); |
| | | // if(payout.getCode() != 200){ |
| | | // System.err.println(payout.getMsg()); |
| | | // } |
| | | // System.err.println(payout.getData()); |
| | | //// ResultUtil approve = Payouts.approve("9pYr3axOfiugd2KdLb", "335163"); |
| | | //// if(approve.getCode() != 200){ |
| | | //// System.err.println(approve.getMsg()); |
| | | //// } |
| | | // } |
| | | } |
New file |
| | |
| | | package com.dsh.course.util.midtrans; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel |
| | | public class TokenResult { |
| | | /** |
| | | * token |
| | | */ |
| | | @ApiModelProperty("token") |
| | | private String token; |
| | | /** |
| | | * 重定向地址 |
| | | */ |
| | | @ApiModelProperty("重定向地址") |
| | | private String redirect_url; |
| | | } |
| | |
| | | package com.dsh.guns.modular.system.client.competition; |
| | | |
| | | import com.dsh.competition.entity.Competition; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | @FeignClient("mb-cloud-competition") |
| | | public interface CompetitionClient { |
| | | @PostMapping("/base/competition/queryById") |
| | | Competition queryById(Integer id); |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.client.competition.model; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class ListQuery { |
| | | |
| | | private String provinceCode; |
| | | private String cityCode; |
| | | private String eventName; |
| | | private String time; |
| | | private Integer state; |
| | | private Integer registerCondition ; |
| | | private List<Integer> ids; |
| | | |
| | | } |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.dsh.competition.entity.Competition; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | | import com.dsh.guns.core.common.annotion.Permission; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.client.competition.CompetitionClient; |
| | | import com.dsh.guns.modular.system.client.competition.model.ListQuery; |
| | | import com.dsh.guns.modular.system.model.TStore; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.warpper.RoleWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 菜单控制器 |
| | |
| | | |
| | | @Autowired |
| | | private CompetitionClient competitionClient; |
| | | |
| | | @Autowired |
| | | private IStoreService storeService; |
| | | |
| | | |
| | | /** |
| | |
| | | * 跳转到菜单详情列表页面 |
| | | */ |
| | | @RequestMapping(value = "/tCompetition_edit/{id}") |
| | | public String menuEdit(@PathVariable Integer id, Model model) { |
| | | return PREFIX + "menu_edit.html"; |
| | | public String tCompetitionEdit(@PathVariable Integer id, Model model) { |
| | | Competition competition = competitionClient.queryById(id); |
| | | model.addAttribute("item",competition); |
| | | return PREFIX + "tCompetition_edit.html"; |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String provinceCode,String cityCode,String shopName,String eventName,String time,Integer state,Integer registerCondition) { |
| | | List<Integer> ids = new ArrayList<>(); |
| | | // 获取门店id |
| | | if(ToolUtil.isNotEmpty(shopName)){ |
| | | List<TStore> list = storeService.list(new LambdaQueryWrapper<TStore>().like(TStore::getName, shopName)); |
| | | ids = list.stream().map(TStore::getId).collect(Collectors.toList()); |
| | | }else { |
| | | ids = storeService.list().stream().map(TStore::getId).collect(Collectors.toList()); |
| | | } |
| | | if(ids.size()==0){ |
| | | ids.add(-1); |
| | | } |
| | | ListQuery listQuery = new ListQuery(); |
| | | // List<Competition> competitions = competitionClient.list(); |
| | | return super.warpObject(null); |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.dsh.guns.modular.system.enums; |
| | | |
| | | |
| | | |
| | | /** |
| | | * @Description 活动类型枚举 |
| | | * @Author xiaochen |
| | | * @Date 2023/02/15 9:42 |
| | | */ |
| | | public enum ActivityTypeEnum { |
| | | |
| | | /*1司机活动 2用户活动 3赠送活动 4大额优惠券 5保底收入 6优惠券*/ |
| | | |
| | | DRIVER_ACTIVITY(1, "司机活动"), |
| | | USER_ACTIVITY(2, "用户活动"), |
| | | SEND_ACTIVITY(3, "赠送活动"), |
| | | BIG_COUPON(4, "大额优惠券"), |
| | | INCOME_RULE(5, "保底收入"), |
| | | COUPON(6,"优惠券"); |
| | | |
| | | private String desc; |
| | | |
| | | |
| | | private int code; |
| | | |
| | | |
| | | ActivityTypeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static ActivityTypeEnum fromCode(Integer code) { |
| | | ActivityTypeEnum[] resultTypes = ActivityTypeEnum.values(); |
| | | for (ActivityTypeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.enums; |
| | | |
| | | |
| | | |
| | | /** |
| | | * @Description 司机保证收入状态枚举 |
| | | * @Author xiaochen |
| | | * @Date 2023/02/15 9:42 |
| | | */ |
| | | public enum RuleStatusEnum { |
| | | |
| | | NOT_START(1, "未开始"), |
| | | STARTED(2, "已开始"), |
| | | ENDED(3, "已结束"), |
| | | PAUSED(4,"暂停中"); |
| | | |
| | | private String desc; |
| | | |
| | | |
| | | private int code; |
| | | |
| | | |
| | | RuleStatusEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static RuleStatusEnum fromCode(Integer code) { |
| | | RuleStatusEnum[] resultTypes = RuleStatusEnum.values(); |
| | | for (RuleStatusEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 车辆保险 |
| | | */ |
| | | @TableName("t_car_insurance") |
| | | public class CarInsurance { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 车辆id |
| | | */ |
| | | @TableField("carId") |
| | | private Integer carId; |
| | | /** |
| | | * 保险公司名称 |
| | | */ |
| | | @TableField("insurCom") |
| | | private String insurCom; |
| | | /** |
| | | * 保险号 |
| | | */ |
| | | @TableField("insurNum") |
| | | private String insurNum; |
| | | /** |
| | | * 保险类型 |
| | | */ |
| | | @TableField("insurType") |
| | | private String insurType; |
| | | /** |
| | | * 保险金额 |
| | | */ |
| | | @TableField("insurCount") |
| | | private Double insurCount; |
| | | /** |
| | | * 保险生效日期 |
| | | */ |
| | | @TableField("insurEff") |
| | | private Date insurEff; |
| | | /** |
| | | * 保险到期日期 |
| | | */ |
| | | @TableField("insurExp") |
| | | private Date insurExp; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getCarId() { |
| | | return carId; |
| | | } |
| | | |
| | | public void setCarId(Integer carId) { |
| | | this.carId = carId; |
| | | } |
| | | |
| | | public String getInsurCom() { |
| | | return insurCom; |
| | | } |
| | | |
| | | public void setInsurCom(String insurCom) { |
| | | this.insurCom = insurCom; |
| | | } |
| | | |
| | | public String getInsurNum() { |
| | | return insurNum; |
| | | } |
| | | |
| | | public void setInsurNum(String insurNum) { |
| | | this.insurNum = insurNum; |
| | | } |
| | | |
| | | public String getInsurType() { |
| | | return insurType; |
| | | } |
| | | |
| | | public void setInsurType(String insurType) { |
| | | this.insurType = insurType; |
| | | } |
| | | |
| | | public Double getInsurCount() { |
| | | return insurCount; |
| | | } |
| | | |
| | | public void setInsurCount(Double insurCount) { |
| | | this.insurCount = insurCount; |
| | | } |
| | | |
| | | public Date getInsurEff() { |
| | | return insurEff; |
| | | } |
| | | |
| | | public void setInsurEff(Date insurEff) { |
| | | this.insurEff = insurEff; |
| | | } |
| | | |
| | | public Date getInsurExp() { |
| | | return insurExp; |
| | | } |
| | | |
| | | public void setInsurExp(Date insurExp) { |
| | | this.insurExp = insurExp; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "CarInsurance{" + |
| | | "id=" + id + |
| | | ", carId=" + carId + |
| | | ", insurCom='" + insurCom + '\'' + |
| | | ", insurNum='" + insurNum + '\'' + |
| | | ", insurType='" + insurType + '\'' + |
| | | ", insurCount=" + insurCount + |
| | | ", insurEff=" + insurEff + |
| | | ", insurExp=" + insurExp + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | /** |
| | | * 高德接口统计 |
| | | */ |
| | | @TableName("t_gdinterface") |
| | | public class GDInterface { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 接口名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 接口说明 |
| | | */ |
| | | @TableField("explanation") |
| | | private String explanation; |
| | | /** |
| | | * 调用次数 |
| | | */ |
| | | @TableField("num") |
| | | private Integer num; |
| | | /** |
| | | * 调用日期 |
| | | */ |
| | | @TableField("time") |
| | | private String time; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getExplanation() { |
| | | return explanation; |
| | | } |
| | | |
| | | public void setExplanation(String explanation) { |
| | | this.explanation = explanation; |
| | | } |
| | | |
| | | public Integer getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(Integer num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public String getTime() { |
| | | return time; |
| | | } |
| | | |
| | | public void setTime(String time) { |
| | | this.time = time; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "GDInterface{" + |
| | | "id=" + id + |
| | | ", name='" + name + '\'' + |
| | | ", explanation='" + explanation + '\'' + |
| | | ", num=" + num + |
| | | ", time=" + time + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 收入明细 |
| | | */ |
| | | @TableName("t_income") |
| | | public class Income { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 收入方类型(1=公司,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 收入对象id |
| | | */ |
| | | @TableField("objectId") |
| | | private Integer objectId; |
| | | /** |
| | | * 收入类型(1=活动,2=业务) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 收入类型id |
| | | */ |
| | | @TableField("incomeId") |
| | | private Integer incomeId; |
| | | /** |
| | | * 订单类型 |
| | | */ |
| | | @TableField("orderType") |
| | | private Integer orderType; |
| | | /** |
| | | * 收入金额 |
| | | */ |
| | | @TableField("money") |
| | | private Double money; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getUserType() { |
| | | return userType; |
| | | } |
| | | |
| | | public void setUserType(Integer userType) { |
| | | this.userType = userType; |
| | | } |
| | | |
| | | public Integer getObjectId() { |
| | | return objectId; |
| | | } |
| | | |
| | | public void setObjectId(Integer objectId) { |
| | | this.objectId = objectId; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getIncomeId() { |
| | | return incomeId; |
| | | } |
| | | |
| | | public void setIncomeId(Integer incomeId) { |
| | | this.incomeId = incomeId; |
| | | } |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Income{" + |
| | | "id=" + id + |
| | | ", userType=" + userType + |
| | | ", objectId=" + objectId + |
| | | ", type=" + type + |
| | | ", incomeId=" + incomeId + |
| | | ", orderType=" + orderType + |
| | | ", money=" + money + |
| | | ", insertTime=" + insertTime + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 司机预约排班记录 |
| | | */ |
| | | @TableName("t_line_shift_driver") |
| | | public class LineShiftDriver { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 线路班次id |
| | | */ |
| | | @TableField("lineShiftId") |
| | | private Integer lineShiftId; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 预约日期 |
| | | */ |
| | | @TableField("day") |
| | | private Date day; |
| | | /** |
| | | * 剩余座位数 |
| | | */ |
| | | @TableField("laveSeat") |
| | | private Integer laveSeat; |
| | | /** |
| | | * 剩余座位号(多个以逗号分隔) |
| | | */ |
| | | @TableField("laveSeatNumber") |
| | | private String laveSeatNumber; |
| | | /** |
| | | * 总座位数 |
| | | */ |
| | | @TableField("totalSeat") |
| | | private Integer totalSeat; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("inserTime") |
| | | private Date inserTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getLineShiftId() { |
| | | return lineShiftId; |
| | | } |
| | | |
| | | public void setLineShiftId(Integer lineShiftId) { |
| | | this.lineShiftId = lineShiftId; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Date getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(Date day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public Integer getLaveSeat() { |
| | | return laveSeat; |
| | | } |
| | | |
| | | public void setLaveSeat(Integer laveSeat) { |
| | | this.laveSeat = laveSeat; |
| | | } |
| | | |
| | | public String getLaveSeatNumber() { |
| | | return laveSeatNumber; |
| | | } |
| | | |
| | | public void setLaveSeatNumber(String laveSeatNumber) { |
| | | this.laveSeatNumber = laveSeatNumber; |
| | | } |
| | | |
| | | public Integer getTotalSeat() { |
| | | return totalSeat; |
| | | } |
| | | |
| | | public void setTotalSeat(Integer totalSeat) { |
| | | this.totalSeat = totalSeat; |
| | | } |
| | | |
| | | public Date getInserTime() { |
| | | return inserTime; |
| | | } |
| | | |
| | | public void setInserTime(Date inserTime) { |
| | | this.inserTime = inserTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "LineShiftDriver{" + |
| | | "id=" + id + |
| | | ", lineShiftId=" + lineShiftId + |
| | | ", driverId=" + driverId + |
| | | ", day=" + day + |
| | | ", laveSeat=" + laveSeat + |
| | | ", laveSeatNumber='" + laveSeatNumber + '\'' + |
| | | ", totalSeat=" + totalSeat + |
| | | ", inserTime=" + inserTime + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 取消订单 |
| | | */ |
| | | @TableName("t_order_cancel") |
| | | public class OrderCancel { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | /** |
| | | * 订单类型(1=专车,4=小件物流-同城) |
| | | Business types: (1=private car, 4=courier-same city) |
| | | */ |
| | | @TableField("orderType") |
| | | private Integer orderType; |
| | | /** |
| | | * 取消原因 |
| | | */ |
| | | @TableField("reason") |
| | | private String reason; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @TableField("remark") |
| | | private String remark; |
| | | /** |
| | | * 支付方式(1=微信,2=支付宝,3=余额) |
| | | * 1:wechat 2:alipay 3:balance |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | @TableField("money") |
| | | private Double money; |
| | | /** |
| | | * 状态(1=临时,2=正式) |
| | | * 1=Temporary, 2=Formal |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | * @return |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 取消人员类型(1=用户,2=后台) |
| | | * @return |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 操作人员id |
| | | * @return |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(Long orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | public String getReason() { |
| | | return reason; |
| | | } |
| | | |
| | | public void setReason(String reason) { |
| | | this.reason = reason; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Integer getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(Integer payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Integer getUserType() { |
| | | return userType; |
| | | } |
| | | |
| | | public void setUserType(Integer userType) { |
| | | this.userType = userType; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderCancel{" + |
| | | "id=" + id + |
| | | ", orderId=" + orderId + |
| | | ", orderType=" + orderType + |
| | | ", reason='" + reason + '\'' + |
| | | ", remark='" + remark + '\'' + |
| | | ", payType=" + payType + |
| | | ", money=" + money + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | ", userType=" + userType + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 小件物流订单 |
| | | */ |
| | | @Data |
| | | @TableName("t_order_logistics") |
| | | public class OrderLogistics { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 订单类型(4=同城物流,5=跨城物流) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 车辆id |
| | | */ |
| | | @TableField("carId") |
| | | private Integer carId; |
| | | /** |
| | | * 订单号 |
| | | */ |
| | | @TableField("orderNum") |
| | | private String orderNum; |
| | | /** |
| | | * 货物名称 |
| | | */ |
| | | @TableField("cargoName") |
| | | private String cargoName; |
| | | /** |
| | | * 是否加急(1=否,2=是)1:N,2:Y |
| | | */ |
| | | @TableField("urgent") |
| | | private Integer urgent; |
| | | /** |
| | | * 货物数量 |
| | | */ |
| | | @TableField("cargoNumber") |
| | | private Integer cargoNumber; |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @TableField("remark") |
| | | private String remark; |
| | | /** |
| | | * 下单地点经度 |
| | | */ |
| | | @TableField("placementLon") |
| | | private Double placementLon; |
| | | /** |
| | | * 下单地点纬度 |
| | | */ |
| | | @TableField("placementLat") |
| | | private Double placementLat; |
| | | /** |
| | | * 下单地点 |
| | | */ |
| | | @TableField("placementAddress") |
| | | private String placementAddress; |
| | | /** |
| | | * 起点经度 |
| | | */ |
| | | @TableField("startLon") |
| | | private Double startLon; |
| | | /** |
| | | * 起点纬度 |
| | | */ |
| | | @TableField("startLat") |
| | | private Double startLat; |
| | | /** |
| | | * 起点 |
| | | */ |
| | | @TableField("startAddress") |
| | | private String startAddress; |
| | | /** |
| | | * 目的地经度 |
| | | */ |
| | | @TableField("endLon") |
| | | private Double endLon; |
| | | /** |
| | | * 目的地纬度 |
| | | */ |
| | | @TableField("endLat") |
| | | private Double endLat; |
| | | /** |
| | | * 目的地 |
| | | */ |
| | | @TableField("endAddress") |
| | | private String endAddress; |
| | | /** |
| | | * 收件人姓名 |
| | | */ |
| | | @TableField("recipient") |
| | | private String recipient; |
| | | /** |
| | | * 收件人电话 |
| | | */ |
| | | @TableField("recipientPhone") |
| | | private String recipientPhone; |
| | | /** |
| | | * 上车点经度 |
| | | */ |
| | | @TableField("boardingLon") |
| | | private Double boardingLon; |
| | | /** |
| | | * 上车点纬度 |
| | | */ |
| | | @TableField("boardingLat") |
| | | private Double boardingLat; |
| | | /** |
| | | * 上车地点 |
| | | */ |
| | | @TableField("boardingAddress") |
| | | private String boardingAddress; |
| | | /** |
| | | * 上车时间 |
| | | */ |
| | | @TableField("boardingTime") |
| | | private Date boardingTime; |
| | | /** |
| | | * 下车点经度 |
| | | */ |
| | | @TableField("getoffLon") |
| | | private Double getoffLon; |
| | | /** |
| | | * 下车点纬度 |
| | | */ |
| | | @TableField("getoffLat") |
| | | private Double getoffLat; |
| | | /** |
| | | * 下车点 |
| | | */ |
| | | @TableField("getoffAddress") |
| | | private String getoffAddress; |
| | | /** |
| | | * 下车时间 |
| | | */ |
| | | @TableField("getoffTime") |
| | | private Date getoffTime; |
| | | /** |
| | | * 行驶里程数(米) |
| | | */ |
| | | @TableField("mileage") |
| | | private Double mileage; |
| | | /** |
| | | * 支付方式(1=OK平台支付,2=其他方式支付) |
| | | */ |
| | | @TableField("payManner") |
| | | private Integer payManner; |
| | | /** |
| | | * 支付方式(1=微信,2=支付宝,3=余额) |
| | | * 1:wechat 2:alipay 3:balance |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 订单金额 |
| | | */ |
| | | @TableField("orderMoney") |
| | | private Double orderMoney; |
| | | /** |
| | | * 行程费 |
| | | */ |
| | | @TableField("travelMoney") |
| | | private Double travelMoney; |
| | | /** |
| | | * 小费 |
| | | */ |
| | | @TableField("tipMoney") |
| | | private Double tipMoney; |
| | | /** |
| | | * 红包抵扣金额 |
| | | */ |
| | | @TableField("redPacketMoney") |
| | | private Double redPacketMoney; |
| | | /** |
| | | * 优惠券抵扣金额 |
| | | */ |
| | | @TableField("couponMoney") |
| | | private Double couponMoney; |
| | | /** |
| | | * 红包id |
| | | */ |
| | | @TableField("redPacketId") |
| | | private Integer redPacketId; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | @TableField("couponId") |
| | | private Integer couponId; |
| | | /** |
| | | * 折扣 |
| | | */ |
| | | @TableField("discount") |
| | | private Double discount; |
| | | /** |
| | | * 折扣优惠金额 |
| | | */ |
| | | @TableField("discountMoney") |
| | | private Double discountMoney; |
| | | /** |
| | | * 折扣活动id |
| | | */ |
| | | @TableField("activityId") |
| | | private Integer activityId; |
| | | /** |
| | | * 公司id |
| | | */ |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | @TableField("payMoney") |
| | | private Double payMoney; |
| | | /** |
| | | * 状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=已支付差价) |
| | | 1=Awaiting order acceptance, 2=Awaiting departure, 3=En route to appointment location, 4=Waiting for passenger to board, 5=In-service, 6=Service completed, 7=Awaiting payment, 8=Awaiting evaluation, 9=Service completed, 10=Cancelled, 11=In process of reassigning, 12=Waiting for cancellation payment |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 下单时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 预约取货时间 |
| | | */ |
| | | @TableField("travelTime") |
| | | private Date travelTime; |
| | | /** |
| | | * 抢单时间 |
| | | */ |
| | | @TableField("snatchOrderTime") |
| | | private Date snatchOrderTime; |
| | | /** |
| | | * 司机点出发时间 |
| | | */ |
| | | @TableField("setOutTime") |
| | | private Date setOutTime; |
| | | /** |
| | | * 司机到达预约地点时间 |
| | | */ |
| | | @TableField("arriveTime") |
| | | private Date arriveTime; |
| | | /** |
| | | * 开始服务时间 |
| | | */ |
| | | @TableField("startServiceTime") |
| | | private Date startServiceTime; |
| | | /** |
| | | * 结束服务时间 |
| | | */ |
| | | @TableField("endServiceTime") |
| | | private Date endServiceTime; |
| | | /** |
| | | * 订单来源(1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单) |
| | | */ |
| | | @TableField("orderSource") |
| | | private Integer orderSource; |
| | | /** |
| | | * 发票id |
| | | */ |
| | | @TableField("invoiceId") |
| | | private Integer invoiceId; |
| | | /** |
| | | * 高德猎鹰轨迹id |
| | | * @return |
| | | */ |
| | | @TableField("trackId") |
| | | private String trackId; |
| | | /** |
| | | * 是否删除(1=否,2=是)1:N,2:Y |
| | | */ |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | /** |
| | | * 移动小号 |
| | | * @return |
| | | */ |
| | | @TableField("telX") |
| | | private String telX; |
| | | /** |
| | | * 绑定小号关系id |
| | | * @return |
| | | */ |
| | | @TableField("bindId") |
| | | private String bindId; |
| | | /** |
| | | * 取件码 |
| | | * @return |
| | | */ |
| | | @TableField("pickUpCode") |
| | | private String pickUpCode; |
| | | /** |
| | | * 是否是改派单(1=否,=是) |
| | | * @return |
| | | */ |
| | | @TableField("isReassign") |
| | | private Integer isReassign; |
| | | /** |
| | | * 改派通知标识(0=没有改派,1=改派中,2=已改派)用于通知前端获取新司机数据 |
| | | * The reassignment notification flag (0=no reassignment, 1=reassignment in progress, 2=reassignment completed) is used to notify the frontend to fetch new driver data. |
| | | */ |
| | | @TableField("reassignNotice") |
| | | private Integer reassignNotice; |
| | | /** |
| | | * 抢单状态(1=正常抢单,2=订单大厅) |
| | | * 1:normal 2:grab hall |
| | | */ |
| | | @TableField("orderHall") |
| | | private Integer orderHall; |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 第三方支付记录 |
| | | */ |
| | | @TableName("t_payment_record") |
| | | public class PaymentRecord { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 支付类别(1=订单相关支付,2=其他支付) |
| | | * 1=Payment related to orders, 2=Other payments |
| | | * 1:order |
| | | */ |
| | | @TableField("category") |
| | | private Integer category; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | * 1:user 2:driver |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | /** |
| | | * 订单类型 |
| | | */ |
| | | @TableField("orderType") |
| | | private Integer orderType; |
| | | /** |
| | | * 支付方式(1=微信,2=支付宝) |
| | | * 1:wechat 2:alipay |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | @TableField("amount") |
| | | private Double amount; |
| | | /** |
| | | * 第三方支付订单号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 支付状态(1=未支付,2=已支付) |
| | | * 1=Unpaid, 2=Paid |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getCategory() { |
| | | return category; |
| | | } |
| | | |
| | | public void setCategory(Integer category) { |
| | | this.category = category; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Long getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(Long orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | public Integer getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(Integer payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public Double getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(Double amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "PaymentRecord{" + |
| | | "id=" + id + |
| | | ", category=" + category + |
| | | ", userId=" + userId + |
| | | ", type=" + type + |
| | | ", orderId=" + orderId + |
| | | ", orderType=" + orderType + |
| | | ", payType=" + payType + |
| | | ", amount=" + amount + |
| | | ", code='" + code + '\'' + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 省市区三级联动 |
| | | * </p> |
| | | * |
| | | * @author 吕雪 |
| | | * @since 2019-12-30 |
| | | */ |
| | | @TableName("region") |
| | | public class Region extends Model<Region> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键ID |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 城市名称 |
| | | */ |
| | | private String name; |
| | | private String code; |
| | | private String citycode; |
| | | /** |
| | | * 父级ID |
| | | */ |
| | | @TableField("parent_id") |
| | | private Integer parentId; |
| | | /** |
| | | * 英文名称 |
| | | */ |
| | | private String english; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getCitycode() { |
| | | return citycode; |
| | | } |
| | | |
| | | public void setCitycode(String citycode) { |
| | | this.citycode = citycode; |
| | | } |
| | | |
| | | public Integer getParentId() { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(Integer parentId) { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | public String getEnglish() { |
| | | return english; |
| | | } |
| | | |
| | | public void setEnglish(String english) { |
| | | this.english = english; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Region{" + |
| | | "id=" + id + |
| | | ", name=" + name + |
| | | ", code=" + code + |
| | | ", citycode=" + citycode + |
| | | ", parentId=" + parentId + |
| | | ", english=" + english + |
| | | "}"; |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 管理员表 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | * 收入明细 |
| | | */ |
| | | @TableName("t_competition") |
| | | public class TCompetition extends Model<TCompetition> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public class TCompetition { |
| | | /** |
| | | * 主键id |
| | | * 主键 |
| | | */ |
| | | @TableId(value="id", type= IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 头像 |
| | | * 收入方类型(1=公司,2=司机) |
| | | */ |
| | | private String avatar; |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 账号 |
| | | * 收入对象id |
| | | */ |
| | | private String account; |
| | | @TableField("objectId") |
| | | private Integer objectId; |
| | | /** |
| | | * 密码 |
| | | * 收入类型(1=活动,2=业务) |
| | | */ |
| | | private String password; |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * md5密码盐 |
| | | * 收入类型id |
| | | */ |
| | | private String salt; |
| | | @TableField("incomeId") |
| | | private Integer incomeId; |
| | | /** |
| | | * 名字 |
| | | * 订单类型 |
| | | */ |
| | | private String name; |
| | | @TableField("orderType") |
| | | private Integer orderType; |
| | | /** |
| | | * 生日 |
| | | * 收入金额 |
| | | */ |
| | | private Date birthday; |
| | | @TableField("money") |
| | | private Double money; |
| | | /** |
| | | * 性别(1:男 2:女) |
| | | * 添加时间 |
| | | */ |
| | | private Integer sex; |
| | | /** |
| | | * 电子邮件 |
| | | */ |
| | | private String email; |
| | | /** |
| | | * 电话 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 角色id |
| | | */ |
| | | private String roleid; |
| | | /** |
| | | * 部门id |
| | | */ |
| | | private Integer deptid; |
| | | /** |
| | | * 状态(1:启用 2:冻结 3:删除) |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createtime; |
| | | /** |
| | | * 保留字段 |
| | | */ |
| | | private Integer version; |
| | | |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getAvatar() { |
| | | return avatar; |
| | | public Integer getUserType() { |
| | | return userType; |
| | | } |
| | | |
| | | public void setAvatar(String avatar) { |
| | | this.avatar = avatar; |
| | | public void setUserType(Integer userType) { |
| | | this.userType = userType; |
| | | } |
| | | |
| | | public String getAccount() { |
| | | return account; |
| | | public Integer getObjectId() { |
| | | return objectId; |
| | | } |
| | | |
| | | public void setAccount(String account) { |
| | | this.account = account; |
| | | public void setObjectId(Integer objectId) { |
| | | this.objectId = objectId; |
| | | } |
| | | |
| | | public String getPassword() { |
| | | return password; |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | |
| | | public void setPassword(String password) { |
| | | this.password = password; |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getSalt() { |
| | | return salt; |
| | | public Integer getIncomeId() { |
| | | return incomeId; |
| | | } |
| | | |
| | | public void setSalt(String salt) { |
| | | this.salt = salt; |
| | | public void setIncomeId(Integer incomeId) { |
| | | this.incomeId = incomeId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public Date getBirthday() { |
| | | return birthday; |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setBirthday(Date birthday) { |
| | | this.birthday = birthday; |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Integer getSex() { |
| | | return sex; |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setSex(Integer sex) { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public String getRoleid() { |
| | | return roleid; |
| | | } |
| | | |
| | | public void setRoleid(String roleid) { |
| | | this.roleid = roleid; |
| | | } |
| | | |
| | | public Integer getDeptid() { |
| | | return deptid; |
| | | } |
| | | |
| | | public void setDeptid(Integer deptid) { |
| | | this.deptid = deptid; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public Date getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(Date createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public Integer getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(Integer version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "User{" + |
| | | return "Income{" + |
| | | "id=" + id + |
| | | ", avatar=" + avatar + |
| | | ", account=" + account + |
| | | ", password=" + password + |
| | | ", salt=" + salt + |
| | | ", name=" + name + |
| | | ", birthday=" + birthday + |
| | | ", sex=" + sex + |
| | | ", email=" + email + |
| | | ", phone=" + phone + |
| | | ", roleid=" + roleid + |
| | | ", deptid=" + deptid + |
| | | ", status=" + status + |
| | | ", createtime=" + createtime + |
| | | ", version=" + version + |
| | | "}"; |
| | | ", userType=" + userType + |
| | | ", objectId=" + objectId + |
| | | ", type=" + type + |
| | | ", incomeId=" + incomeId + |
| | | ", orderType=" + orderType + |
| | | ", money=" + money + |
| | | ", insertTime=" + insertTime + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @TableName("t_store") |
| | | @Data |
| | | public class TStore { |
| | | private Integer id; |
| | | private String name; |
| | | private Integer storeStaffId; |
| | | private Integer cityManagerId; |
| | | private String province; |
| | | private String provinceCode; |
| | | private String city; |
| | | private String cityCode; |
| | | private String phone; |
| | | private String address; |
| | | private String lat; |
| | | private String lon; |
| | | private String startTime; |
| | | private String endTime; |
| | | private String coverDrawing; |
| | | private String realPicture; |
| | | private String introduce; |
| | | private String welfarePicture; |
| | | private BigDecimal score; |
| | | private Integer state; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.guns.modular.system.model.Dict; |
| | | import com.dsh.guns.modular.system.model.TStore; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 字典服务 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-27 17:00 |
| | | */ |
| | | public interface IStoreService extends IService<TStore> { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.guns.modular.system.mapper.StoreMapper; |
| | | import com.dsh.guns.modular.system.model.TStore; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class StoreServiceImpl extends ServiceImpl<StoreMapper, TStore> implements IStoreService { |
| | | |
| | | } |
New file |
| | |
| | | <?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.dsh.guns.modular.system.mapper.StoreMapper"> |
| | | |
| | | |
| | | |
| | | </mapper> |
| | |
| | | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| | | |
| | | |
| | | <title>玩湃生活 - 404 页面</title> |
| | | <title>evmoto摩托 - 404 页面</title> |
| | | <link rel="shortcut icon" href="${ctxPath}/log.ico"> <link href="${ctxPath}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"> |
| | | <link href="${ctxPath}/css/font-awesome.css?v=4.4.0" rel="stylesheet"> |
| | | <link href="${ctxPath}/css/style.css?v=4.1.0" rel="stylesheet"> |
| | |
| | | <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="${ctxPath}/blackboard?type=${type}" frameborder="0" data-id="${ctxPath}/blackboard" seamless></iframe> |
| | | </div> |
| | | <div class="footer"> |
| | | <div class="pull-right">© 2019-2021 <a href="#" onclick="return false" target="_blank">playpai</a> |
| | | <div class="pull-right">© 2019-2021 <a href="#" onclick="return false" target="_blank">evmoto</a> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <meta charset="utf-8"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| | | <meta name="renderer" content="webkit"> |
| | | <title>玩湃生活</title> |
| | | <title>evmoto - homepage</title> |
| | | <link rel="shortcut icon" href="${ctxPath}/log.ico"> |
| | | <link href="${ctxPath}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"> |
| | | <link href="${ctxPath}/css/font-awesome.min.css?v=4.4.0" rel="stylesheet"> |
| | |
| | | <meta charset="utf-8"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| | | |
| | | <title>playpai - Login</title> |
| | | <title>evmoto - Login</title> |
| | | |
| | | <link rel="shortcut icon" href="${ctxPath}/log.ico"> |
| | | <link href="${ctxPath}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"> |
| | |
| | | -webkit-box-shadow: 0 0 0 1000px white inset; // 背景设为白色 |
| | | -webkit-text-fill-color: #fff; // 字体颜色 |
| | | } |
| | | .right-align { |
| | | text-align: right; |
| | | height: 40px; |
| | | } |
| | | </style> |
| | | </head> |
| | | |
| | |
| | | |
| | | |
| | | <img src="${ctxPath}/img/index4.png" style="width: 300px;height: 400px;z-index: 1000;border-radius: 10px"> |
| | | <div style="position: relative; max-width: 300px;min-height: 300px;background: white;border-radius: 8px;box-sizing: border-box;padding: 0 30px 0 50px;display: flex;align-items: center;justify-content: center;"> |
| | | <div style="position: relative;left: -20px; max-width: 300px;min-height: 300px;background: white;border-radius: 8px;box-sizing: border-box;padding: 0 30px 0 50px;display: flex;align-items: center;justify-content: center;"> |
| | | <div style="max-height: 100%"> |
| | | <h3 style="color: black;"><img src="${ctxPath}/img/logo.png" width="30px" height="30px"/> Play pai site</h3> |
| | | <br/> |
| | |
| | | <form class="m-t" role="form" action="${ctxPath}/login" method="post"> |
| | | <div class="item"> |
| | | <img src="${ctxPath}/img/account.png" /> |
| | | <input class="itemInput" type="text" name="username" id="username" placeholder="请输入账号" required="" value=""> |
| | | <input class="itemInput" type="text" name="username" id="username" placeholder="Please enter account" required="" value=""> |
| | | </div> |
| | | <div class="item"> |
| | | <img src="${ctxPath}/img/password.png" /> |
| | | <input class="itemInput" type="password" name="password" id="password" placeholder="请输入密码" required="" value=""> |
| | | <input class="itemInput" type="password" name="password" id="password" placeholder="Please enter password" required="" value=""> |
| | | </div> |
| | | <div class="item"> |
| | | <img src="${ctxPath}/img/password.png" /> |
| | | <input class="itemInput" name="codes" id="codes" placeholder="请输入验证码" required="" value=""> |
| | | <label>language</label> |
| | | <select name="language" id="language" class="itemInput"> |
| | | <option value="1">中文</option> |
| | | <option value="2">english</option> |
| | | <option value="3">IndonesiaName</option> |
| | | </select> |
| | | </div> |
| | | <div class="right-align"> |
| | | <a style="color: #00b7ee" href="#">修改密码</a> |
| | | </div> |
| | | <button onclick="login()" class="btn full-width m-b" style="background-color: #db9f24;color: white;">登录</button> |
| | | <button onclick="login()" class="btn full-width m-b" style="background-color: #0573EA;color: white;">Login</button> |
| | | <button type="submit" id="submit" style="display: none;"></button> |
| | | </p> |
| | | </form> |